201041
authorhgs
Wed, 03 Nov 2010 09:32:20 +0530
changeset 51 61fad867f68e
child 52 3d676fce9a4e
201041
brandingserver/bsclient/bsclientdefs.h
brandingserver/bsclient/bselementfactory.cpp
brandingserver/bsclient/bsprocessstarter.cpp
brandingserver/bsclient/bsprocessstarter.h
brandingserver/bsclient/cbsaccess.cpp
brandingserver/bsclient/cbsaccess.h
brandingserver/bsclient/cbsbitmap.cpp
brandingserver/bsclient/cbsbrandobserver.cpp
brandingserver/bsclient/cbsbrandobserver.h
brandingserver/bsclient/cbsclient.cpp
brandingserver/bsclient/cbsclient.h
brandingserver/bsclient/cbselement.cpp
brandingserver/bsclient/cbselement.h
brandingserver/bsclient/cbsfactory.cpp
brandingserver/bsclient/cbsiconfileprovider.cpp
brandingserver/bsclient/cbsiconfileprovider.h
brandingserver/bsclient/cbsupdater.cpp
brandingserver/bsclient/cbsupdater.h
brandingserver/bsclient/mbsbrandobserverregistrar.h
brandingserver/bsclient/tbselementiterator.cpp
brandingserver/bsclient/tbsmdescarrayadapter.cpp
brandingserver/bsserver/bsimportconstants.h
brandingserver/bsserver/bsserverdefs.h
brandingserver/bsserver/cbsbackupobserver.cpp
brandingserver/bsserver/cbsbackupobserver.h
brandingserver/bsserver/cbsbrandhandler.cpp
brandingserver/bsserver/cbsbrandhandler.h
brandingserver/bsserver/cbsibywriter.cpp
brandingserver/bsserver/cbsibywriter.h
brandingserver/bsserver/cbsinstallhandler.cpp
brandingserver/bsserver/cbsinstallhandler.h
brandingserver/bsserver/cbsserver.cpp
brandingserver/bsserver/cbsserver.h
brandingserver/bsserver/cbssession.cpp
brandingserver/bsserver/cbssession.h
brandingserver/bsserver/cbsstorage.cpp
brandingserver/bsserver/cbsstorage.h
brandingserver/bsserver/cbsstoragemanager.cpp
brandingserver/bsserver/cbsstoragemanager.h
brandingserver/bwins/bsclientu.def
brandingserver/eabi/bsclientu.def
brandingserver/group/backup_registration.xml
brandingserver/group/bld.inf
brandingserver/group/bsclient.mmp
brandingserver/group/bsserver.mmp
brandingserver/group/bsuids.h
brandingserver/group/debugtrace.h
brandingserver/inc/bselementfactory.h
brandingserver/inc/cbsbitmap.h
brandingserver/inc/cbsfactory.h
brandingserver/inc/mbsaccess.h
brandingserver/inc/mbsbackupobserver.h
brandingserver/inc/mbsbackuprestorestateobserver.h
brandingserver/inc/mbsbrandchangeobserver.h
brandingserver/inc/mbselement.h
brandingserver/inc/mbsupdater.h
brandingserver/inc/rbsobjowningptrarray.h
brandingserver/inc/rbsobjowningptrarray.inl
brandingserver/inc/tbselementiterator.h
brandingserver/inc/tbsmdescarrayadapter.h
brandingserver/rom/brandingserver.iby
brandingserver/sis/bs.pkg
brandingserver/sis/bsstub.pkg
brandingserver/sis/bsstub.sis
brandingserver/sis/metadata.xml
brandingserver/tools/bsimport/group/bld.inf
brandingserver/tools/bsimport/group/brandimporter_UID_.cpp
brandingserver/tools/bsimport/group/importer.mmp
brandingserver/tools/bsimport/group/installer.mmp
brandingserver/tools/bsimport/inc/cbsimportconstants.h
brandingserver/tools/bsimport/inc/cbsimportfilereader.h
brandingserver/tools/bsimport/inc/cbsimportmanager.h
brandingserver/tools/bsimport/inc/cbsimportstorage.h
brandingserver/tools/bsimport/inc/cbsimportstoragemanager.h
brandingserver/tools/bsimport/inc/cbsimportxmlparser-1.h
brandingserver/tools/bsimport/inc/cbsimportxmlparser.h
brandingserver/tools/bsimport/inc/importlogwriter.h
brandingserver/tools/bsimport/src/bsbrandremover.cpp
brandingserver/tools/bsimport/src/bsbrandremover.h
brandingserver/tools/bsimport/src/cbsimportfilereader.cpp
brandingserver/tools/bsimport/src/cbsimportmanager.cpp
brandingserver/tools/bsimport/src/cbsimportstorage.cpp
brandingserver/tools/bsimport/src/cbsimportstoragemanager.cpp
brandingserver/tools/bsimport/src/cbsimportxmlparser.cpp
brandingserver/tools/bsimport/src/importer.cpp
brandingserver/tools/bsimport/src/installer.cpp
brandingserver/tools/makefile/import.mk
brandingserver/tools/sis/brand-example.pkg
brandingserver/tools/sis/import_data/brand_data.xml
brandingserver/tools/sis/import_data/file.JPG
brandingserver/tools/sis/import_data/install.txt
brandingserver/tools/sis/make-example.cmd
brandingserver/tools/xml/loc2xml.pl
brandingserver/tools/xml/mbg2xml.pl
brandingserver/tools/xml/xml2h.pl
group/bld.inf
imservices/data/200195A9.txt
imservices/group/bld.inf
imservices/imfeatureplugin/bwins/imdatamodelhooku.def
imservices/imfeatureplugin/bwins/imdatamodelu.def
imservices/imfeatureplugin/bwins/imecomhooku.def
imservices/imfeatureplugin/bwins/immanageru.def
imservices/imfeatureplugin/bwins/imoperationshooku.def
imservices/imfeatureplugin/bwins/imoperationu.def
imservices/imfeatureplugin/bwins/improcessorhooku.def
imservices/imfeatureplugin/bwins/improcessoru.def
imservices/imfeatureplugin/eabi/imdatamodelhooku.def
imservices/imfeatureplugin/eabi/imdatamodelu.def
imservices/imfeatureplugin/eabi/imecomhooku.def
imservices/imfeatureplugin/eabi/immanageru.def
imservices/imfeatureplugin/eabi/imoperationshooku.def
imservices/imfeatureplugin/eabi/imoperationu.def
imservices/imfeatureplugin/eabi/improcessorhooku.def
imservices/imfeatureplugin/eabi/improcessoru.def
imservices/imfeatureplugin/group/bld.inf
imservices/imfeatureplugin/group/imdlluids.hrh
imservices/imfeatureplugin/rom/imfeatureplugin.iby
imservices/imfeatureplugin/sis/imfeatureplugin.pkg
imservices/imfeatureplugin/sis/imfeaturepluginstub.pkg
imservices/imfeatureplugin/sis/imfeaturepluginstub.sis
imservices/imfeatureplugin/sis/metadata.xml
imservices/imfeatureplugin/srcimdatamodel/apidataobjfactory.h
imservices/imfeatureplugin/srcimdatamodel/group/bld.inf
imservices/imfeatureplugin/srcimdatamodel/group/imdatamodel.mmp
imservices/imfeatureplugin/srcimdatamodel/group/imdatamodelhook.mmp
imservices/imfeatureplugin/srcimdatamodel/imapidataobjfactory.cpp
imservices/imfeatureplugin/srcimdatamodel/imapidataobjfactory.h
imservices/imfeatureplugin/srcimdatamodel/imapidataobjfactory.inl
imservices/imfeatureplugin/srcimdatamodel/imapidataobjfactoryaccessor.cpp
imservices/imfeatureplugin/srcimdatamodel/imapidataobjfactoryaccessor.h
imservices/imfeatureplugin/srcimdatamodel/imapiobjbase.h
imservices/imfeatureplugin/srcimdatamodel/imconversation/conversationsubscriptionitem.cpp
imservices/imfeatureplugin/srcimdatamodel/imconversation/conversationsubscriptionitem.h
imservices/imfeatureplugin/srcimdatamodel/imconversation/imconversationeventimp.cpp
imservices/imfeatureplugin/srcimdatamodel/imconversation/imconversationeventimp.h
imservices/imfeatureplugin/srcimdatamodel/imconversation/imconversationinfoimp.cpp
imservices/imfeatureplugin/srcimdatamodel/imconversation/imconversationinfoimp.h
imservices/imfeatureplugin/srcimdatamodel/imdatacacheimp.cpp
imservices/imfeatureplugin/srcimdatamodel/imdatacacheimp.h
imservices/imfeatureplugin/srcimdatamodel/imdatamodelhook/imdatamodelhook.cpp
imservices/imfeatureplugin/srcimdatamodel/imdatamodelhook/imdatamodelhook.rss
imservices/imfeatureplugin/srcimdatamodel/imeventcodec.cpp
imservices/imfeatureplugin/srcimdatamodel/imeventcodec.h
imservices/imfeatureplugin/srcimdatamodel/imobjectfactoryimp.cpp
imservices/imfeatureplugin/srcimdatamodel/imobjectfactoryimp.h
imservices/imfeatureplugin/srcimdatamodel/imtypehelpers.h
imservices/imfeatureplugin/srcimdatamodel/ximpimitemparent.h
imservices/imfeatureplugin/srcimdatamodel/ximpimsubscriptionitembase.cpp
imservices/imfeatureplugin/srcimdatamodel/ximpimsubscriptionitembase.h
imservices/imfeatureplugin/srcimfrontend/group/bld.inf
imservices/imfeatureplugin/srcimfrontend/group/imecomhook.mmp
imservices/imfeatureplugin/srcimfrontend/group/immanager.mmp
imservices/imfeatureplugin/srcimfrontend/srcecomhook/imecomhook.cpp
imservices/imfeatureplugin/srcimfrontend/srcecomhook/imecomhook.rss
imservices/imfeatureplugin/srcimfrontend/srcimmanager/imconversationimp.cpp
imservices/imfeatureplugin/srcimfrontend/srcimmanager/imconversationimp.h
imservices/imfeatureplugin/srcimfrontend/srcimmanager/imfeaturesimp.cpp
imservices/imfeatureplugin/srcimfrontend/srcimmanager/imfeaturesimp.h
imservices/imfeatureplugin/srcimoperations/group/bld.inf
imservices/imfeatureplugin/srcimoperations/group/imoperation.mmp
imservices/imfeatureplugin/srcimoperations/group/imoperationshook.mmp
imservices/imfeatureplugin/srcimoperations/imconversation/operationreceivemessage.cpp
imservices/imfeatureplugin/srcimoperations/imconversation/operationreceivemessage.h
imservices/imfeatureplugin/srcimoperations/imconversation/operationsendmessage.cpp
imservices/imfeatureplugin/srcimoperations/imconversation/operationsendmessage.h
imservices/imfeatureplugin/srcimoperations/imoperationdefs.h
imservices/imfeatureplugin/srcimoperations/imoperationfactoryimp.cpp
imservices/imfeatureplugin/srcimoperations/imoperationfactoryimp.h
imservices/imfeatureplugin/srcimoperations/imoperationshook/imoperationshook.cpp
imservices/imfeatureplugin/srcimoperations/imoperationshook/imoperationshook.rss
imservices/imfeatureplugin/srcimoperations/operationlaunchcleaner.cpp
imservices/imfeatureplugin/srcimoperations/operationlaunchcleaner.h
imservices/imfeatureplugin/srcimprocessor/group/bld.inf
imservices/imfeatureplugin/srcimprocessor/group/improcessor.mmp
imservices/imfeatureplugin/srcimprocessor/group/improcessorhook.mmp
imservices/imfeatureplugin/srcimprocessor/imconversationdatahost/protocolimconversationdatahostimp.cpp
imservices/imfeatureplugin/srcimprocessor/imconversationdatahost/protocolimconversationdatahostimp.h
imservices/imfeatureplugin/srcimprocessor/improcessorhook/improcessorhook.cpp
imservices/imfeatureplugin/srcimprocessor/improcessorhook/improcessorhook.rss
imservices/imfeatureplugin/srcimprocessor/protocoldatahostimp.cpp
imservices/imfeatureplugin/srcimprocessor/protocoldatahostimp.h
imservices/imfeatureplugin/srcimprocessor/protocolimdatahostimp.cpp
imservices/imfeatureplugin/srcimprocessor/protocolimdatahostimp.h
imservices/imfeatureplugin/srcutils/imlogutils.cpp
imservices/imfeatureplugin/srcutils/imlogutils.h
imservices/instantmessagingcache/group/backup_registration.xml
imservices/instantmessagingcache/group/bld.inf
imservices/instantmessagingcache/imcacheclient/bwins/imcacheclientu.def
imservices/instantmessagingcache/imcacheclient/eabi/imcacheclientu.def
imservices/instantmessagingcache/imcacheclient/group/bld.inf
imservices/instantmessagingcache/imcacheclient/group/imcacheclient.mmp
imservices/instantmessagingcache/imcacheclient/inc/cimcacheaccesseventhandler.h
imservices/instantmessagingcache/imcacheclient/inc/cimcacheaccessor.h
imservices/instantmessagingcache/imcacheclient/inc/cimcacheclient.h
imservices/instantmessagingcache/imcacheclient/inc/cimcacheeventhandler.h
imservices/instantmessagingcache/imcacheclient/inc/cimcacheupdater.h
imservices/instantmessagingcache/imcacheclient/inc/imcacheprocessstarter.h
imservices/instantmessagingcache/imcacheclient/inc/mimcacheclient.h
imservices/instantmessagingcache/imcacheclient/src/cimcacheaccesseventhandler.cpp
imservices/instantmessagingcache/imcacheclient/src/cimcacheaccessor.cpp
imservices/instantmessagingcache/imcacheclient/src/cimcacheclient.cpp
imservices/instantmessagingcache/imcacheclient/src/cimcacheeventhandler.cpp
imservices/instantmessagingcache/imcacheclient/src/cimcachefactory.cpp
imservices/instantmessagingcache/imcacheclient/src/cimcacheupdater.cpp
imservices/instantmessagingcache/imcacheclient/src/imcacheprocessstarter.cpp
imservices/instantmessagingcache/imcacheserver/group/bld.inf
imservices/instantmessagingcache/imcacheserver/group/imcacheserver.mmp
imservices/instantmessagingcache/imcacheserver/inc/ccacheserveractivehelper.h
imservices/instantmessagingcache/imcacheserver/inc/cimcachebufferarray.h
imservices/instantmessagingcache/imcacheserver/inc/cimcachemessagebase.h
imservices/instantmessagingcache/imcacheserver/inc/cimcachemessageheader.h
imservices/instantmessagingcache/imcacheserver/inc/cimcacheserver.h
imservices/instantmessagingcache/imcacheserver/inc/cimcachesession.h
imservices/instantmessagingcache/imcacheserver/inc/mimcachemessagefactory.h
imservices/instantmessagingcache/imcacheserver/inc/mimcachemessageheader.h
imservices/instantmessagingcache/imcacheserver/inc/timcachemessagefactory.h
imservices/instantmessagingcache/imcacheserver/src/ccacheserveractivehelper.cpp
imservices/instantmessagingcache/imcacheserver/src/cimcachebufferarray.cpp
imservices/instantmessagingcache/imcacheserver/src/cimcachemessagebase.cpp
imservices/instantmessagingcache/imcacheserver/src/cimcachemessageheader.cpp
imservices/instantmessagingcache/imcacheserver/src/cimcacheserver.cpp
imservices/instantmessagingcache/imcacheserver/src/cimcachesession.cpp
imservices/instantmessagingcache/imcacheserver/src/timcachemessagefactory.cpp
imservices/instantmessagingcache/inc/imcachedebugtrace.h
imservices/instantmessagingcache/inc/imcacheuids.h
imservices/instantmessagingcache/rom/instantmessagingcache.iby
imservices/instantmessagingcache/sis/imcache.pkg
imservices/instantmessagingcache/sis/imcachestub.pkg
imservices/instantmessagingcache/sis/imcachestub.sis
imservices/instantmessagingcache/sis/metadata.xml
imservices/instantmessagingcache/tsrc/bwins/imcache_testu.def
imservices/instantmessagingcache/tsrc/conf/imcache_test.cfg
imservices/instantmessagingcache/tsrc/eabi/imcache_testu.def
imservices/instantmessagingcache/tsrc/group/bld.inf
imservices/instantmessagingcache/tsrc/group/imcache_test.mmp
imservices/instantmessagingcache/tsrc/group/imcache_test.pkg
imservices/instantmessagingcache/tsrc/inc/imcache_test.h
imservices/instantmessagingcache/tsrc/init/TestFramework.ini
imservices/instantmessagingcache/tsrc/src/imcache_test.cpp
imservices/instantmessagingcache/tsrc/src/imcache_testBlocks.cpp
imservices/searchfeatureplugin/bwins/searchdatamodelhooku.def
imservices/searchfeatureplugin/bwins/searchdatamodelu.def
imservices/searchfeatureplugin/bwins/searchecomhooku.def
imservices/searchfeatureplugin/bwins/searchmanageru.def
imservices/searchfeatureplugin/bwins/searchoperationshooku.def
imservices/searchfeatureplugin/bwins/searchoperationu.def
imservices/searchfeatureplugin/bwins/searchprocessorhooku.def
imservices/searchfeatureplugin/bwins/searchprocessoru.def
imservices/searchfeatureplugin/eabi/searchdatamodelhooku.def
imservices/searchfeatureplugin/eabi/searchdatamodelu.def
imservices/searchfeatureplugin/eabi/searchecomhooku.def
imservices/searchfeatureplugin/eabi/searchmanageru.def
imservices/searchfeatureplugin/eabi/searchoperationshooku.def
imservices/searchfeatureplugin/eabi/searchoperationu.def
imservices/searchfeatureplugin/eabi/searchprocessorhooku.def
imservices/searchfeatureplugin/eabi/searchprocessoru.def
imservices/searchfeatureplugin/group/bld.inf
imservices/searchfeatureplugin/group/searchdlluids.hrh
imservices/searchfeatureplugin/rom/searchfeatureplugin.iby
imservices/searchfeatureplugin/srcsearchdatamodel/apidataobjfactory.h
imservices/searchfeatureplugin/srcsearchdatamodel/group/bld.inf
imservices/searchfeatureplugin/srcsearchdatamodel/group/searchdatamodel.mmp
imservices/searchfeatureplugin/srcsearchdatamodel/group/searchdatamodelhook.mmp
imservices/searchfeatureplugin/srcsearchdatamodel/search/searchelementimp.cpp
imservices/searchfeatureplugin/srcsearchdatamodel/search/searchelementimp.h
imservices/searchfeatureplugin/srcsearchdatamodel/search/searcheventimp.cpp
imservices/searchfeatureplugin/srcsearchdatamodel/search/searcheventimp.h
imservices/searchfeatureplugin/srcsearchdatamodel/search/searchinfoimp.cpp
imservices/searchfeatureplugin/srcsearchdatamodel/search/searchinfoimp.h
imservices/searchfeatureplugin/srcsearchdatamodel/search/searchkeyinfoimp.cpp
imservices/searchfeatureplugin/srcsearchdatamodel/search/searchkeyinfoimp.h
imservices/searchfeatureplugin/srcsearchdatamodel/search/searchkeyseventimp.cpp
imservices/searchfeatureplugin/srcsearchdatamodel/search/searchkeyseventimp.h
imservices/searchfeatureplugin/srcsearchdatamodel/search/searchkeyssubscriptionitem.h
imservices/searchfeatureplugin/srcsearchdatamodel/search/searchkeysubscriptionitem.cpp
imservices/searchfeatureplugin/srcsearchdatamodel/search/searchsubscriptionitem.cpp
imservices/searchfeatureplugin/srcsearchdatamodel/search/searchsubscriptionitem.h
imservices/searchfeatureplugin/srcsearchdatamodel/searchapidataobjfactory.cpp
imservices/searchfeatureplugin/srcsearchdatamodel/searchapidataobjfactory.h
imservices/searchfeatureplugin/srcsearchdatamodel/searchapidataobjfactory.inl
imservices/searchfeatureplugin/srcsearchdatamodel/searchapidataobjfactoryaccessor.cpp
imservices/searchfeatureplugin/srcsearchdatamodel/searchapidataobjfactoryaccessor.h
imservices/searchfeatureplugin/srcsearchdatamodel/searchapiobjbase.h
imservices/searchfeatureplugin/srcsearchdatamodel/searchdatacacheimp.cpp
imservices/searchfeatureplugin/srcsearchdatamodel/searchdatacacheimp.h
imservices/searchfeatureplugin/srcsearchdatamodel/searchdatamodelhook/searchdatamodelhook.cpp
imservices/searchfeatureplugin/srcsearchdatamodel/searchdatamodelhook/searchdatamodelhook.rss
imservices/searchfeatureplugin/srcsearchdatamodel/searcheventcodec.cpp
imservices/searchfeatureplugin/srcsearchdatamodel/searcheventcodec.h
imservices/searchfeatureplugin/srcsearchdatamodel/searchitemparent.h
imservices/searchfeatureplugin/srcsearchdatamodel/searchobjectfactoryimp.cpp
imservices/searchfeatureplugin/srcsearchdatamodel/searchobjectfactoryimp.h
imservices/searchfeatureplugin/srcsearchdatamodel/searchtypehelpers.h
imservices/searchfeatureplugin/srcsearchfrontend/group/bld.inf
imservices/searchfeatureplugin/srcsearchfrontend/group/searchecomhook.mmp
imservices/searchfeatureplugin/srcsearchfrontend/group/searchmanager.mmp
imservices/searchfeatureplugin/srcsearchfrontend/srcecomhook/searchecomhook.cpp
imservices/searchfeatureplugin/srcsearchfrontend/srcecomhook/searchecomhook.rss
imservices/searchfeatureplugin/srcsearchfrontend/srcsearchmanager/searchfeatureimp.cpp
imservices/searchfeatureplugin/srcsearchfrontend/srcsearchmanager/searchfeatureimp.h
imservices/searchfeatureplugin/srcsearchfrontend/srcsearchmanager/searchimp.cpp
imservices/searchfeatureplugin/srcsearchfrontend/srcsearchmanager/searchimp.h
imservices/searchfeatureplugin/srcsearchoperations/group/bld.inf
imservices/searchfeatureplugin/srcsearchoperations/group/searchoperation.mmp
imservices/searchfeatureplugin/srcsearchoperations/group/searchoperationshook.mmp
imservices/searchfeatureplugin/srcsearchoperations/searchop/operationgetsearchkeys.cpp
imservices/searchfeatureplugin/srcsearchoperations/searchop/operationgetsearchkeys.h
imservices/searchfeatureplugin/srcsearchoperations/searchop/operationhandlesearchkeys.cpp
imservices/searchfeatureplugin/srcsearchoperations/searchop/operationhandlesearchkeys.h
imservices/searchfeatureplugin/srcsearchoperations/searchop/operationhandlesearchresult.cpp
imservices/searchfeatureplugin/srcsearchoperations/searchop/operationhandlesearchresult.h
imservices/searchfeatureplugin/srcsearchoperations/searchop/operationsearch.cpp
imservices/searchfeatureplugin/srcsearchoperations/searchop/operationsearch.h
imservices/searchfeatureplugin/srcsearchoperations/searchoperationdefs.h
imservices/searchfeatureplugin/srcsearchoperations/searchoperationfactoryimp.cpp
imservices/searchfeatureplugin/srcsearchoperations/searchoperationfactoryimp.h
imservices/searchfeatureplugin/srcsearchoperations/searchoperationshook/searchoperationshook.cpp
imservices/searchfeatureplugin/srcsearchoperations/searchoperationshook/searchoperationshook.rss
imservices/searchfeatureplugin/srcsearchoperations/ximpobjectcollectionimp.h
imservices/searchfeatureplugin/srcsearchoperations/ximprequestcompleteeventimp.h
imservices/searchfeatureplugin/srcsearchoperations/ximprestrictedobjectcollectionimp.h
imservices/searchfeatureplugin/srcsearchprocessor/group/bld.inf
imservices/searchfeatureplugin/srcsearchprocessor/group/searchprocessor.mmp
imservices/searchfeatureplugin/srcsearchprocessor/group/searchprocessorhook.mmp
imservices/searchfeatureplugin/srcsearchprocessor/protocoldatahostimp.cpp
imservices/searchfeatureplugin/srcsearchprocessor/protocoldatahostimp.h
imservices/searchfeatureplugin/srcsearchprocessor/protocolsearchdatahostimp.cpp
imservices/searchfeatureplugin/srcsearchprocessor/protocolsearchdatahostimp.h
imservices/searchfeatureplugin/srcsearchprocessor/searchdatahost/protocolsearchfeaturedatahostimp.cpp
imservices/searchfeatureplugin/srcsearchprocessor/searchdatahost/protocolsearchfeaturedatahostimp.h
imservices/searchfeatureplugin/srcsearchprocessor/searchprocessorhook/searchprocessorhook.cpp
imservices/searchfeatureplugin/srcsearchprocessor/searchprocessorhook/searchprocessorhook.rss
imservices/searchfeatureplugin/srcutils/searchlogutils.cpp
imservices/searchfeatureplugin/srcutils/searchlogutils.h
imservices/xmppsettingsapi/bwins/xmppsettingsapiu.def
imservices/xmppsettingsapi/eabi/xmppsettingsapiu.def
imservices/xmppsettingsapi/group/1020E334.txt
imservices/xmppsettingsapi/group/bld.inf
imservices/xmppsettingsapi/group/xmppsettingsapi.mmp
imservices/xmppsettingsapi/inc/xmppsettingscolumn.h
imservices/xmppsettingsapi/inc/xmppsettingsrecord.h
imservices/xmppsettingsapi/rom/xmppsettingsapi.iby
imservices/xmppsettingsapi/src/xmppsettingsapi.cpp
imservices/xmppsettingsapi/src/xmppsettingscolumn.cpp
imservices/xmppsettingsapi/src/xmppsettingsrecord.cpp
imservices/xmppsettingsapi/tsrc/bmarm/xmppsettings_apiU.DEF
imservices/xmppsettingsapi/tsrc/bwins/xmppsettings_apiu.def
imservices/xmppsettingsapi/tsrc/eabi/xmppsettings_apiu.def
imservices/xmppsettingsapi/tsrc/group/bld.inf
imservices/xmppsettingsapi/tsrc/group/xmppsettings_api.mmp
imservices/xmppsettingsapi/tsrc/group/xmppsettings_api.pkg
imservices/xmppsettingsapi/tsrc/group/xmppsettings_api_DoxyFile.txt
imservices/xmppsettingsapi/tsrc/group/xmppsettings_api_nrm.mmp
imservices/xmppsettingsapi/tsrc/inc/xmppsettings_api.h
imservices/xmppsettingsapi/tsrc/init/TestFramework.ini
imservices/xmppsettingsapi/tsrc/src/xmppsettings_api.cpp
imservices/xmppsettingsapi/tsrc/src/xmppsettings_apiBlocks.cpp
imservices/xmppsettingsfetcher/bwins/xmppsettingsfetcheru.def
imservices/xmppsettingsfetcher/eabi/xmppsettingsfetcheru.def
imservices/xmppsettingsfetcher/group/bld.inf
imservices/xmppsettingsfetcher/group/xmppsettingsfetcher.mmp
imservices/xmppsettingsfetcher/inc/xmppparameters.h
imservices/xmppsettingsfetcher/inc/xmppsettingsfetcher.h
imservices/xmppsettingsfetcher/rom/xmppsettingsfetcher.iby
imservices/xmppsettingsfetcher/src/xmppparameters.cpp
imservices/xmppsettingsfetcher/src/xmppsettingsfetcher.cpp
imservices/xmppsettingsfetcher/tsrc/xmppsettingsfetchermt/bmarm/xmppsettingsfetchermtu.def
imservices/xmppsettingsfetcher/tsrc/xmppsettingsfetchermt/bwins/xmppsettingsfetchermtu.def
imservices/xmppsettingsfetcher/tsrc/xmppsettingsfetchermt/eabi/xmppsettingsfetchermtu.def
imservices/xmppsettingsfetcher/tsrc/xmppsettingsfetchermt/group/bld.inf
imservices/xmppsettingsfetcher/tsrc/xmppsettingsfetchermt/group/xmppsettingfetcher_test.pkg
imservices/xmppsettingsfetcher/tsrc/xmppsettingsfetchermt/group/xmppsettingsfetchermt.mmp
imservices/xmppsettingsfetcher/tsrc/xmppsettingsfetchermt/inc/xmppsettingsfetchermt.h
imservices/xmppsettingsfetcher/tsrc/xmppsettingsfetchermt/init/1020E334.txt
imservices/xmppsettingsfetcher/tsrc/xmppsettingsfetchermt/init/10282CE5.txt
imservices/xmppsettingsfetcher/tsrc/xmppsettingsfetchermt/init/200195A9.txt
imservices/xmppsettingsfetcher/tsrc/xmppsettingsfetchermt/init/2001B288.txt
imservices/xmppsettingsfetcher/tsrc/xmppsettingsfetchermt/init/TestFramework.ini
imservices/xmppsettingsfetcher/tsrc/xmppsettingsfetchermt/src/xmppsettingsfetchermt.cpp
imservices/xmppsettingsfetcher/tsrc/xmppsettingsfetchermt/src/xmppsettingsfetchermtCases.cpp
imsrv_plat/group/bld.inf
imsrv_plat/im_cache_client_api/group/bld.inf
imsrv_plat/im_cache_client_api/im_cache_client_api.metaxml
imsrv_plat/im_cache_client_api/inc/cimcachefactory.h
imsrv_plat/im_cache_client_api/inc/imcachedefs.h
imsrv_plat/im_cache_client_api/inc/mimcacheaccessor.h
imsrv_plat/im_cache_client_api/inc/mimcacheeventhandler.h
imsrv_plat/im_cache_client_api/inc/mimcacheupdater.h
imsrv_plat/im_cache_client_api/tsrc/bwins/imcache_testu.def
imsrv_plat/im_cache_client_api/tsrc/conf/imcache_test.cfg
imsrv_plat/im_cache_client_api/tsrc/conf/test.xml
imsrv_plat/im_cache_client_api/tsrc/eabi/imcache_testu.def
imsrv_plat/im_cache_client_api/tsrc/group/bld.inf
imsrv_plat/im_cache_client_api/tsrc/group/imcache_test.mmp
imsrv_plat/im_cache_client_api/tsrc/group/imcache_test.pkg
imsrv_plat/im_cache_client_api/tsrc/inc/imcache_test.h
imsrv_plat/im_cache_client_api/tsrc/init/TestFramework.ini
imsrv_plat/im_cache_client_api/tsrc/src/imcache_test.cpp
imsrv_plat/im_cache_client_api/tsrc/src/imcache_testBlocks.cpp
imsrv_plat/im_cache_server_api/group/bld.inf
imsrv_plat/im_cache_server_api/im_cache_server_api.metaxml
imsrv_plat/im_cache_server_api/inc/cinstantmsgindicator.h
imsrv_plat/presence_avabilitytext/group/bld.inf
imsrv_plat/presence_avabilitytext/inc/avabilitytext.h
imsrv_plat/ximp_core_base_api/group/bld.inf
imsrv_plat/ximp_core_base_api/inc/ximpbase.h
imsrv_plat/ximp_core_base_api/inc/ximpbase.inl
imsrv_plat/ximp_core_base_api/inc/ximpbaseifids.hrh
imsrv_plat/ximp_core_base_api/inc/ximperrors.hrh
imsrv_plat/ximp_core_base_api/ximp_core_base_api.metaxml
imsrv_plat/ximp_core_data_model_api/group/bld.inf
imsrv_plat/ximp_core_data_model_api/inc/ximpcontextclientinfo.h
imsrv_plat/ximp_core_data_model_api/inc/ximpcontextstate.h
imsrv_plat/ximp_core_data_model_api/inc/ximpdatamodelifids.hrh
imsrv_plat/ximp_core_data_model_api/inc/ximpdatasubscriptionstate.h
imsrv_plat/ximp_core_data_model_api/inc/ximpfeatureinfo.h
imsrv_plat/ximp_core_data_model_api/inc/ximpidentity.h
imsrv_plat/ximp_core_data_model_api/inc/ximpobjectcollection.h
imsrv_plat/ximp_core_data_model_api/inc/ximpobjectfactory.h
imsrv_plat/ximp_core_data_model_api/inc/ximpprotocolinfo.h
imsrv_plat/ximp_core_data_model_api/inc/ximprestrictedobjectcollection.h
imsrv_plat/ximp_core_data_model_api/inc/ximpserviceinfo.h
imsrv_plat/ximp_core_data_model_api/inc/ximpstatus.h
imsrv_plat/ximp_core_data_model_api/ximp_core_data_model_api.metaxml
imsrv_plat/ximp_core_feature_plugin_api/group/bld.inf
imsrv_plat/ximp_core_feature_plugin_api/inc/apidataobjfactoryaccessor.h
imsrv_plat/ximp_core_feature_plugin_api/inc/apidataobjfactoryaccessor.inl
imsrv_plat/ximp_core_feature_plugin_api/inc/eventcodec.h
imsrv_plat/ximp_core_feature_plugin_api/inc/protocoldatahost.h
imsrv_plat/ximp_core_feature_plugin_api/inc/protocoldatahost.inl
imsrv_plat/ximp_core_feature_plugin_api/inc/ximpapidataobjbase.h
imsrv_plat/ximp_core_feature_plugin_api/inc/ximpapieventbase.h
imsrv_plat/ximp_core_feature_plugin_api/inc/ximpapiobjbase.h
imsrv_plat/ximp_core_feature_plugin_api/inc/ximpcontextinternal.h
imsrv_plat/ximp_core_feature_plugin_api/inc/ximpfeaturepluginifids.hrh
imsrv_plat/ximp_core_feature_plugin_api/inc/ximphost.h
imsrv_plat/ximp_core_feature_plugin_api/inc/ximphoststates.h
imsrv_plat/ximp_core_feature_plugin_api/inc/ximpidentityimp.h
imsrv_plat/ximp_core_feature_plugin_api/inc/ximpitemparentbase.h
imsrv_plat/ximp_core_feature_plugin_api/inc/ximpobjecthelpers.h
imsrv_plat/ximp_core_feature_plugin_api/inc/ximpobjecthelpers.inl
imsrv_plat/ximp_core_feature_plugin_api/inc/ximpoperationbase.h
imsrv_plat/ximp_core_feature_plugin_api/inc/ximpoperationdefs.h
imsrv_plat/ximp_core_feature_plugin_api/inc/ximpoperationfactory1.h
imsrv_plat/ximp_core_feature_plugin_api/inc/ximpoperationfactory1.inl
imsrv_plat/ximp_core_feature_plugin_api/inc/ximppanics.h
imsrv_plat/ximp_core_feature_plugin_api/inc/ximppsccontext.h
imsrv_plat/ximp_core_feature_plugin_api/inc/ximprbufhelpers.h
imsrv_plat/ximp_core_feature_plugin_api/inc/ximprequestidbuilder.h
imsrv_plat/ximp_core_feature_plugin_api/inc/ximpsubscriptionitem.h
imsrv_plat/ximp_core_feature_plugin_api/inc/ximpsubscriptionitembase.h
imsrv_plat/ximp_core_feature_plugin_api/tsrc/docs/readme.txt
imsrv_plat/ximp_core_feature_plugin_api/tsrc/group/bld.inf
imsrv_plat/ximp_core_feature_plugin_api/tsrc/group/ximpfw_release_tests.pkg
imsrv_plat/ximp_core_feature_plugin_api/tsrc/group/ximpfwmrt.iby
imsrv_plat/ximp_core_feature_plugin_api/tsrc/init/ximpfw_install.pkg
imsrv_plat/ximp_core_feature_plugin_api/tsrc/init/ximpfw_upgrade.pkg
imsrv_plat/ximp_core_feature_plugin_api/tsrc/sis/Nokia_RnDCert_02.der
imsrv_plat/ximp_core_feature_plugin_api/tsrc/sis/Nokia_RnDCert_02.key
imsrv_plat/ximp_core_feature_plugin_api/tsrc/sis/ximpfw_release_tests.pkg
imsrv_plat/ximp_core_feature_plugin_api/tsrc/sis/ximpfw_release_tests.sis
imsrv_plat/ximp_core_feature_plugin_api/tsrc/sis/ximpfw_release_tests.sisx
imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_eunittemplate/bld.inf
imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_eunittemplate/t_eunittemplate.cpp
imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_eunittemplate/t_eunittemplate.h
imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_eunittemplate/t_eunittemplate.mmp
imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_presenceall/bld.inf
imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_presenceall/t_presenceall.cpp
imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_presenceall/t_presenceall.h
imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_presenceall/t_presenceall.mmp
imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_presenceauthorization/bld.inf
imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_presenceauthorization/t_presenceauthorization.cpp
imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_presenceauthorization/t_presenceauthorization.h
imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_presenceauthorization/t_presenceauthorization.mmp
imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_presenceblocking/bld.inf
imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_presenceblocking/t_presenceblocking.cpp
imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_presenceblocking/t_presenceblocking.h
imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_presenceblocking/t_presenceblocking.mmp
imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_presencecache/T_PresenceCache.cpp
imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_presencecache/T_PresenceCache.h
imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_presencecache/T_PresenceCache.mmp
imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_presencecache/T_PresenceCache_DllMain.cpp
imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_presencecache/bld.inf
imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_presencegrantrequestmngt/bld.inf
imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_presencegrantrequestmngt/t_presencegrantrequestmngt.cpp
imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_presencegrantrequestmngt/t_presencegrantrequestmngt.h
imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_presencegrantrequestmngt/t_presencegrantrequestmngt.mmp
imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_presencegrouplistmngt/bld.inf
imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_presencegrouplistmngt/t_presencegrouplistmngt.cpp
imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_presencegrouplistmngt/t_presencegrouplistmngt.h
imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_presencegrouplistmngt/t_presencegrouplistmngt.mmp
imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_presencegroupmembermngt/bld.inf
imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_presencegroupmembermngt/t_presencegroupmembermngt.cpp
imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_presencegroupmembermngt/t_presencegroupmembermngt.h
imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_presencegroupmembermngt/t_presencegroupmembermngt.mmp
imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_presencepublishing/bld.inf
imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_presencepublishing/t_presencepublishing.cpp
imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_presencepublishing/t_presencepublishing.h
imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_presencepublishing/t_presencepublishing.mmp
imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_presencewatcherlistmngt/bld.inf
imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_presencewatcherlistmngt/t_presencewatcherlistmngt.cpp
imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_presencewatcherlistmngt/t_presencewatcherlistmngt.h
imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_presencewatcherlistmngt/t_presencewatcherlistmngt.mmp
imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_presencewatching/bld.inf
imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_presencewatching/t_presencewatching.cpp
imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_presencewatching/t_presencewatching.h
imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_presencewatching/t_presencewatching.mmp
imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_rootservices/bld.inf
imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_rootservices/t_rootservices.cpp
imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_rootservices/t_rootservices.h
imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_rootservices/t_rootservices.mmp
imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_sessionmng/bld.inf
imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_sessionmng/t_sessionmng.cpp
imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_sessionmng/t_sessionmng.h
imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_sessionmng/t_sessionmng.mmp
imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_utils/bld.inf
imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_utils/t_utils.cpp
imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_utils/t_utils.h
imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_utils/t_utils.mmp
imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcprotocols/bld.inf
imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcprotocols/pr_prfwtestprotocol/bld.inf
imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcprotocols/pr_prfwtestprotocol/pr_prfwtestprotocol.cpp
imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcprotocols/pr_prfwtestprotocol/pr_prfwtestprotocol.h
imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcprotocols/pr_prfwtestprotocol/pr_prfwtestprotocol.mmp
imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcprotocols/pr_prfwtestprotocol/pr_prfwtestprotocol.rss
imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcprotocols/prfwtestprotocols.h
imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcprotocols/prfwtestprotocols_resource.hrh
imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/bld.inf
imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/bwins/prfwtestcaseutilsu.def
imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/eabi/prfwtestcaseutilsu.def
imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/eunitcommon/cglobalwaitingnote.h
imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/eunitcommon/eunit_test_mover.pl
imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/eunitcommon/eunittools.h
imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/eunitcommon/eunittstdll_armv5u.def
imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/eunitcommon/eunittstdll_winsu.def
imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/eunitcommon/eunittstdllbase.hrh
imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/eunitcommon/move_tests_to_eunit.inf
imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/eunitcommon/move_tests_to_eunit.mk
imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/processmaster/bld.inf
imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/processmaster/pm.h
imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/processmaster/prfwtestprocessmaster.cpp
imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/processmaster/prfwtestprocessmaster.h
imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/processmaster/prfwtestprocessmaster.mmp
imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/testcaseutils/bld.inf
imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/testcaseutils/prfwgeneralwaiter.cpp
imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/testcaseutils/prfwgeneralwaiter.h
imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/testcaseutils/prfwsrvtestclient.cpp
imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/testcaseutils/prfwsrvtestclient.h
imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/testcaseutils/prfwtestcaseutils.mmp
imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/testcaseutils/prfwtestcaseutilspanics.h
imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/testcaseutils/prfwtestcontextwrapper.cpp
imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/testcaseutils/prfwtestcontextwrapper.h
imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/testcaseutils/prfwtestcontextwrappermgr.cpp
imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/testcaseutils/prfwtestcontextwrappermgr.h
imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/testcaseutils/prfwtestdlluids.hrh
imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/testcaseutils/prfwtesteventfactory.cpp
imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/testcaseutils/prfwtesteventfactory.h
imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/testcaseutils/prfwtestfilelogichelper.cpp
imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/testcaseutils/prfwtestfilelogichelper.h
imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/testcaseutils/prfwtestfileobserver.h
imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/testcaseutils/prfwtestfilesrvmsg.cpp
imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/testcaseutils/prfwtestfilesrvmsg.h
imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/testcaseutils/prfwtestfiletool.cpp
imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/testcaseutils/prfwtestfiletool.h
imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/testcaseutils/prfwtestlistener.cpp
imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/testcaseutils/prfwtestlistener.h
imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/testcaseutils/prfwtestmessaging.h
imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/testcaseutils/prfwtestmessenger.cpp
imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/testcaseutils/prfwtestmessenger.h
imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/testcaseutils/prfwtestpresencedatautils.cpp
imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/testcaseutils/prfwtestpresencedatautils.h
imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/testcaseutils/prfwtestrobustnesstools.h
imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/testcaseutils/prfwteststatuseventlistener.cpp
imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/testcaseutils/prfwteststatuseventlistener.h
imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/testcaseutils/prfwtestwaithelper.cpp
imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/testcaseutils/prfwtestwaithelper.h
imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/testcaseutils/prfwwaitobserver.h
imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/testcaseutils/userafter.h
imsrv_plat/ximp_core_feature_plugin_api/ximp_core_feature_plugin_api.metaxml
imsrv_plat/ximp_core_management_api/group/bld.inf
imsrv_plat/ximp_core_management_api/inc/ximpclient.h
imsrv_plat/ximp_core_management_api/inc/ximpclient.inl
imsrv_plat/ximp_core_management_api/inc/ximpcontext.h
imsrv_plat/ximp_core_management_api/inc/ximpcontextobserver.h
imsrv_plat/ximp_core_management_api/inc/ximpcontextstateevent.h
imsrv_plat/ximp_core_management_api/inc/ximpmanagementifids.hrh
imsrv_plat/ximp_core_management_api/inc/ximprequestcompleteevent.h
imsrv_plat/ximp_core_management_api/ximp_core_management_api.metaxml
imsrv_plat/ximp_core_protocol_plugin_api/group/bld.inf
imsrv_plat/ximp_core_protocol_plugin_api/inc/ximpprotocolconnection.h
imsrv_plat/ximp_core_protocol_plugin_api/inc/ximpprotocolplugin.h
imsrv_plat/ximp_core_protocol_plugin_api/inc/ximpprotocolpluginbase.h
imsrv_plat/ximp_core_protocol_plugin_api/inc/ximpprotocolpluginbase.inl
imsrv_plat/ximp_core_protocol_plugin_api/inc/ximpprotocolpluginifids.hrh
imsrv_plat/ximp_core_protocol_plugin_api/ximp_core_protocol_plugin_api.metaxml
imsrv_plat/ximp_core_protocol_plugin_host_api/group/bld.inf
imsrv_plat/ximp_core_protocol_plugin_host_api/inc/ximpprotocolconnectionhost.h
imsrv_plat/ximp_core_protocol_plugin_host_api/inc/ximpprotocolconnectionhostobserver.h
imsrv_plat/ximp_core_protocol_plugin_host_api/inc/ximpprotocolpluginhost.h
imsrv_plat/ximp_core_protocol_plugin_host_api/inc/ximpprotocolpluginhostifids.hrh
imsrv_plat/ximp_core_protocol_plugin_host_api/inc/ximpprotocolrequestcompleteevent.h
imsrv_plat/ximp_core_protocol_plugin_host_api/ximp_core_protocol_plugin_host_api.metaxml
imsrv_plat/ximp_im_base_api/group/bld.inf
imsrv_plat/ximp_im_base_api/inc/imdlluids.hrh
imsrv_plat/ximp_im_base_api/inc/imerrors.hrh
imsrv_plat/ximp_im_base_api/inc/imoperationdefs.h
imsrv_plat/ximp_im_base_api/ximp_im_base_api.metaxml
imsrv_plat/ximp_im_data_model_api/group/bld.inf
imsrv_plat/ximp_im_data_model_api/inc/imconversationinfo.h
imsrv_plat/ximp_im_data_model_api/inc/imdatamodelifids.hrh
imsrv_plat/ximp_im_data_model_api/inc/imgroupinfo.h
imsrv_plat/ximp_im_data_model_api/inc/iminvitationinfo.h
imsrv_plat/ximp_im_data_model_api/inc/imobjectfactory.h
imsrv_plat/ximp_im_data_model_api/inc/imsearchinfo.h
imsrv_plat/ximp_im_data_model_api/ximp_im_data_model_api.metaxml
imsrv_plat/ximp_im_management_api/group/bld.inf
imsrv_plat/ximp_im_management_api/inc/imaccesscontrollist.h
imsrv_plat/ximp_im_management_api/inc/imconversation.h
imsrv_plat/ximp_im_management_api/inc/imconversationevent.h
imsrv_plat/ximp_im_management_api/inc/imfeatures.h
imsrv_plat/ximp_im_management_api/inc/imfeatures.inl
imsrv_plat/ximp_im_management_api/inc/imgroup.h
imsrv_plat/ximp_im_management_api/inc/imgroupevent.h
imsrv_plat/ximp_im_management_api/inc/iminvitation.h
imsrv_plat/ximp_im_management_api/inc/iminvitationevent.h
imsrv_plat/ximp_im_management_api/inc/immanagementifids.hrh
imsrv_plat/ximp_im_management_api/inc/imsearch.h
imsrv_plat/ximp_im_management_api/inc/imsearchelement.h
imsrv_plat/ximp_im_management_api/inc/imsearchevent.h
imsrv_plat/ximp_im_management_api/ximp_im_management_api.metaxml
imsrv_plat/ximp_im_protocol_plugin_api/group/bld.inf
imsrv_plat/ximp_im_protocol_plugin_api/inc/cprotocolimfeatures.h
imsrv_plat/ximp_im_protocol_plugin_api/inc/cprotocolimfeatures.inl
imsrv_plat/ximp_im_protocol_plugin_api/inc/improtocolpluginifids.hrh
imsrv_plat/ximp_im_protocol_plugin_api/inc/protocolimconversation.h
imsrv_plat/ximp_im_protocol_plugin_api/inc/protocolimfeatures.h
imsrv_plat/ximp_im_protocol_plugin_api/inc/protocolimfeatures.inl
imsrv_plat/ximp_im_protocol_plugin_api/inc/protocolimgroup.h
imsrv_plat/ximp_im_protocol_plugin_api/inc/protocoliminvitation.h
imsrv_plat/ximp_im_protocol_plugin_api/inc/protocolimsearch.h
imsrv_plat/ximp_im_protocol_plugin_api/ximp_im_protocol_plugin_api.metaxml
imsrv_plat/ximp_im_protocol_plugin_host_api/group/bld.inf
imsrv_plat/ximp_im_protocol_plugin_host_api/inc/improtocolpluginhostifids.hrh
imsrv_plat/ximp_im_protocol_plugin_host_api/inc/protocolimconversationdatahost.h
imsrv_plat/ximp_im_protocol_plugin_host_api/inc/protocolimdatahost.h
imsrv_plat/ximp_im_protocol_plugin_host_api/inc/protocolimdatahost.inl
imsrv_plat/ximp_im_protocol_plugin_host_api/inc/protocolimdatahostimp.h
imsrv_plat/ximp_im_protocol_plugin_host_api/inc/protocolimgroupdatahost.h
imsrv_plat/ximp_im_protocol_plugin_host_api/inc/protocoliminvitationdatahost.h
imsrv_plat/ximp_im_protocol_plugin_host_api/inc/protocolimpluginhost.h
imsrv_plat/ximp_im_protocol_plugin_host_api/inc/protocolimsearchdatahost.h
imsrv_plat/ximp_im_protocol_plugin_host_api/ximp_im_protocol_plugin_host_api.metaxml
imsrv_plat/ximp_presence_base_api/group/bld.inf
imsrv_plat/ximp_presence_base_api/inc/presenceerrors.hrh
imsrv_plat/ximp_presence_base_api/ximp_presence_base_api.metaxml
imsrv_plat/ximp_presence_cache_api/group/bld.inf
imsrv_plat/ximp_presence_cache_api/inc/prescachereadhandler.h
imsrv_plat/ximp_presence_cache_api/inc/prescachewritehandler.h
imsrv_plat/ximp_presence_cache_api/inc/presencecachereader.h
imsrv_plat/ximp_presence_cache_api/inc/presencecachereader.inl
imsrv_plat/ximp_presence_cache_api/inc/presencecachewriter.h
imsrv_plat/ximp_presence_cache_api/inc/presencecachewriter.inl
imsrv_plat/ximp_presence_cache_api/ximp_presence_cache_api.metaxml
imsrv_plat/ximp_presence_data_model_api/group/bld.inf
imsrv_plat/ximp_presence_data_model_api/inc/devicepresenceinfo.h
imsrv_plat/ximp_presence_data_model_api/inc/personpresenceinfo.h
imsrv_plat/ximp_presence_data_model_api/inc/presenceblockinfo.h
imsrv_plat/ximp_presence_data_model_api/inc/presencebuddyinfo.h
imsrv_plat/ximp_presence_data_model_api/inc/presencebuddyinfolist.h
imsrv_plat/ximp_presence_data_model_api/inc/presencedatamodelifids.hrh
imsrv_plat/ximp_presence_data_model_api/inc/presencegrantrequestinfo.h
imsrv_plat/ximp_presence_data_model_api/inc/presenceinfo.h
imsrv_plat/ximp_presence_data_model_api/inc/presenceinfofield.h
imsrv_plat/ximp_presence_data_model_api/inc/presenceinfofieldcollection.h
imsrv_plat/ximp_presence_data_model_api/inc/presenceinfofieldvaluebinary.h
imsrv_plat/ximp_presence_data_model_api/inc/presenceinfofieldvalueenum.h
imsrv_plat/ximp_presence_data_model_api/inc/presenceinfofieldvaluetext.h
imsrv_plat/ximp_presence_data_model_api/inc/presenceinfofilter.h
imsrv_plat/ximp_presence_data_model_api/inc/presenceobjectfactory.h
imsrv_plat/ximp_presence_data_model_api/inc/presencewatcherinfo.h
imsrv_plat/ximp_presence_data_model_api/inc/presentitygroupinfo.h
imsrv_plat/ximp_presence_data_model_api/inc/presentitygroupmemberinfo.h
imsrv_plat/ximp_presence_data_model_api/inc/servicepresenceinfo.h
imsrv_plat/ximp_presence_data_model_api/ximp_presence_data_model_api.metaxml
imsrv_plat/ximp_presence_management_api/group/bld.inf
imsrv_plat/ximp_presence_management_api/inc/ownpresenceevent.h
imsrv_plat/ximp_presence_management_api/inc/presenceauthorization.h
imsrv_plat/ximp_presence_management_api/inc/presenceblocklistevent.h
imsrv_plat/ximp_presence_management_api/inc/presencefeatures.h
imsrv_plat/ximp_presence_management_api/inc/presencefeatures.inl
imsrv_plat/ximp_presence_management_api/inc/presencegrantrequestlistevent.h
imsrv_plat/ximp_presence_management_api/inc/presencemanagementifids.hrh
imsrv_plat/ximp_presence_management_api/inc/presencepublishing.h
imsrv_plat/ximp_presence_management_api/inc/presencewatcherlistevent.h
imsrv_plat/ximp_presence_management_api/inc/presencewatching.h
imsrv_plat/ximp_presence_management_api/inc/presentitygroupcontentevent.h
imsrv_plat/ximp_presence_management_api/inc/presentitygrouplistevent.h
imsrv_plat/ximp_presence_management_api/inc/presentitygroups.h
imsrv_plat/ximp_presence_management_api/inc/presentitypresenceevent.h
imsrv_plat/ximp_presence_management_api/ximp_presence_management_api.metaxml
imsrv_plat/ximp_presence_protocol_plugin_api/group/bld.inf
imsrv_plat/ximp_presence_protocol_plugin_api/inc/presenceprotocolpluginifids.hrh
imsrv_plat/ximp_presence_protocol_plugin_api/inc/protocolpresenceauthorization.h
imsrv_plat/ximp_presence_protocol_plugin_api/inc/protocolpresencefeatures.h
imsrv_plat/ximp_presence_protocol_plugin_api/inc/protocolpresencepublishing.h
imsrv_plat/ximp_presence_protocol_plugin_api/inc/protocolpresencewatching.h
imsrv_plat/ximp_presence_protocol_plugin_api/inc/protocolpresentitygroups.h
imsrv_plat/ximp_presence_protocol_plugin_api/ximp_presence_protocol_plugin_api.metaxml
imsrv_plat/ximp_presence_protocol_plugin_host_api/group/bld.inf
imsrv_plat/ximp_presence_protocol_plugin_host_api/inc/presenceprotocolpluginhostifids.hrh
imsrv_plat/ximp_presence_protocol_plugin_host_api/inc/protocolpresenceauthorizationdatahost.h
imsrv_plat/ximp_presence_protocol_plugin_host_api/inc/protocolpresencedatahost.h
imsrv_plat/ximp_presence_protocol_plugin_host_api/inc/protocolpresencepublishingdatahost.h
imsrv_plat/ximp_presence_protocol_plugin_host_api/inc/protocolpresencewatchingdatahost.h
imsrv_plat/ximp_presence_protocol_plugin_host_api/inc/protocolpresentitygroupsdatahost.h
imsrv_plat/ximp_presence_protocol_plugin_host_api/ximp_presence_protocol_plugin_host_api.metaxml
imsrv_plat/ximp_search_base_api/group/bld.inf
imsrv_plat/ximp_search_base_api/inc/searchdlluids.hrh
imsrv_plat/ximp_search_base_api/inc/searcherrors.hrh
imsrv_plat/ximp_search_base_api/inc/searchoperationdefs.h
imsrv_plat/ximp_search_base_api/ximp_search_base_api.metaxml
imsrv_plat/ximp_search_data_model_api/group/bld.inf
imsrv_plat/ximp_search_data_model_api/inc/searchdatamodelifids.hrh
imsrv_plat/ximp_search_data_model_api/inc/searchinfo.h
imsrv_plat/ximp_search_data_model_api/inc/searchkeyinfo.h
imsrv_plat/ximp_search_data_model_api/inc/searchobjectfactory.h
imsrv_plat/ximp_search_data_model_api/ximp_search_data_model_api.metaxml
imsrv_plat/ximp_search_management_api/group/bld.inf
imsrv_plat/ximp_search_management_api/inc/search.h
imsrv_plat/ximp_search_management_api/inc/searchelement.h
imsrv_plat/ximp_search_management_api/inc/searchevent.h
imsrv_plat/ximp_search_management_api/inc/searchfeature.h
imsrv_plat/ximp_search_management_api/inc/searchfeature.inl
imsrv_plat/ximp_search_management_api/inc/searchkeysevent.h
imsrv_plat/ximp_search_management_api/inc/searchmanagementifids.hrh
imsrv_plat/ximp_search_management_api/ximp_search_management_api.metaxml
imsrv_plat/ximp_search_protocol_plugin_api/group/bld.inf
imsrv_plat/ximp_search_protocol_plugin_api/inc/protocolsearch.h
imsrv_plat/ximp_search_protocol_plugin_api/inc/protocolsearchfeature.h
imsrv_plat/ximp_search_protocol_plugin_api/inc/searchprotocolpluginifids.hrh
imsrv_plat/ximp_search_protocol_plugin_api/ximp_search_protocol_plugin_api.metaxml
imsrv_plat/ximp_search_protocol_plugin_host_api/group/bld.inf
imsrv_plat/ximp_search_protocol_plugin_host_api/inc/protocolsearchdatahost.h
imsrv_plat/ximp_search_protocol_plugin_host_api/inc/protocolsearchfeaturedatahost.h
imsrv_plat/ximp_search_protocol_plugin_host_api/inc/protocolsearchpluginhost.h
imsrv_plat/ximp_search_protocol_plugin_host_api/inc/searchprotocolpluginhostifids.hrh
imsrv_plat/ximp_search_protocol_plugin_host_api/ximp_search_protocol_plugin_host_api.metaxml
imsrv_plat/xmpp_settings_api/group/bld.inf
imsrv_plat/xmpp_settings_api/inc/xmppparams.h
imsrv_plat/xmpp_settings_api/inc/xmppservicesettingsapi.h
imsrv_plat/xmpp_settings_api/inc/xmppsettingsapicommon.h
imsrv_plat/xmpp_settings_api/tsrc/bmarm/xmppsettings_apiu.def
imsrv_plat/xmpp_settings_api/tsrc/bwins/xmppsettings_apiu.def
imsrv_plat/xmpp_settings_api/tsrc/conf/xmppsettings_api.cfg
imsrv_plat/xmpp_settings_api/tsrc/eabi/xmppsettings_apiU.def
imsrv_plat/xmpp_settings_api/tsrc/group/bld.inf
imsrv_plat/xmpp_settings_api/tsrc/group/xmppsettings_api.mmp
imsrv_plat/xmpp_settings_api/tsrc/group/xmppsettings_api.pkg
imsrv_plat/xmpp_settings_api/tsrc/group/xmppsettings_api_DoxyFile.txt
imsrv_plat/xmpp_settings_api/tsrc/group/xmppsettings_api_nrm.mmp
imsrv_plat/xmpp_settings_api/tsrc/inc/xmppsettings_api.h
imsrv_plat/xmpp_settings_api/tsrc/init/TestFramework.ini
imsrv_plat/xmpp_settings_api/tsrc/src/xmppsettings_api.cpp
imsrv_plat/xmpp_settings_api/tsrc/src/xmppsettings_apiBlocks.cpp
imsrv_plat/xmpp_settings_api/xmpp_settings_api.metaxml
layers.sysdef.xml
sysdef_1_4_0.dtd
ximpfw/core/bwins/ximpdatamodelu.def
ximpfw/core/bwins/ximpmanageru.def
ximpfw/core/bwins/ximpoperationsu.def
ximpfw/core/bwins/ximpprocessoru.def
ximpfw/core/bwins/ximpsrvclientu.def
ximpfw/core/bwins/ximputilsu.def
ximpfw/core/eabi/ximpdatamodelu.def
ximpfw/core/eabi/ximpmanageru.def
ximpfw/core/eabi/ximpoperationsu.def
ximpfw/core/eabi/ximpprocessoru.def
ximpfw/core/eabi/ximpsrvclientu.def
ximpfw/core/eabi/ximputilsu.def
ximpfw/core/group/bld.inf
ximpfw/core/group/ximpdatamodel.mmp
ximpfw/core/group/ximpecomhook.mmp
ximpfw/core/group/ximpmanager.mmp
ximpfw/core/group/ximpoperations.mmp
ximpfw/core/group/ximpprocessor.mmp
ximpfw/core/group/ximprootserver.mmp
ximpfw/core/group/ximpserver.mmp
ximpfw/core/group/ximpsrvclient.mmp
ximpfw/core/group/ximputils.mmp
ximpfw/core/srcclient/ximpprocessstarter.cpp
ximpfw/core/srcclient/ximpprocessstarter.h
ximpfw/core/srcclient/ximpsrvcontextclient.cpp
ximpfw/core/srcclient/ximpsrvcontextclient.h
ximpfw/core/srcclient/ximpsrvrootclient.cpp
ximpfw/core/srcclient/ximpsrvrootclient.h
ximpfw/core/srcdatamodel/ximpapidataobjbase.cpp
ximpfw/core/srcdatamodel/ximpapidataobjfactory.cpp
ximpfw/core/srcdatamodel/ximpapidataobjfactory.h
ximpfw/core/srcdatamodel/ximpapidataobjfactory.inl
ximpfw/core/srcdatamodel/ximpapieventbase.cpp
ximpfw/core/srcdatamodel/ximpapiobjbase.cpp
ximpfw/core/srcdatamodel/ximpconfigurationitem.h
ximpfw/core/srcdatamodel/ximpconfigurationitembase.cpp
ximpfw/core/srcdatamodel/ximpconfigurationitembase.h
ximpfw/core/srcdatamodel/ximpcontextclientinfoimp.cpp
ximpfw/core/srcdatamodel/ximpcontextclientinfoimp.h
ximpfw/core/srcdatamodel/ximpcontexteventfilter.cpp
ximpfw/core/srcdatamodel/ximpcontexteventfilter.h
ximpfw/core/srcdatamodel/ximpcontextstateeventimp.cpp
ximpfw/core/srcdatamodel/ximpcontextstateeventimp.h
ximpfw/core/srcdatamodel/ximpcontextstateimp.cpp
ximpfw/core/srcdatamodel/ximpcontextstateimp.h
ximpfw/core/srcdatamodel/ximpdatasubscriptionstateimp.cpp
ximpfw/core/srcdatamodel/ximpdatasubscriptionstateimp.h
ximpfw/core/srcdatamodel/ximpeventcodec.cpp
ximpfw/core/srcdatamodel/ximpeventcodec.h
ximpfw/core/srcdatamodel/ximpfeatureinfoimp.cpp
ximpfw/core/srcdatamodel/ximpfeatureinfoimp.h
ximpfw/core/srcdatamodel/ximpfeaturepluginholder.cpp
ximpfw/core/srcdatamodel/ximpfeaturepluginholder.h
ximpfw/core/srcdatamodel/ximpidentityimp.cpp
ximpfw/core/srcdatamodel/ximpitemparent.h
ximpfw/core/srcdatamodel/ximpobjectcollectionimp.cpp
ximpfw/core/srcdatamodel/ximpobjectcollectionimp.h
ximpfw/core/srcdatamodel/ximpobjectfactoryimp.cpp
ximpfw/core/srcdatamodel/ximpobjectfactoryimp.h
ximpfw/core/srcdatamodel/ximpprotocolinfoimp.cpp
ximpfw/core/srcdatamodel/ximpprotocolinfoimp.h
ximpfw/core/srcdatamodel/ximprequestcompleteeventimp.cpp
ximpfw/core/srcdatamodel/ximprequestcompleteeventimp.h
ximpfw/core/srcdatamodel/ximprestrictedobjectcollectionimp.cpp
ximpfw/core/srcdatamodel/ximprestrictedobjectcollectionimp.h
ximpfw/core/srcdatamodel/ximpserviceinfoimp.cpp
ximpfw/core/srcdatamodel/ximpserviceinfoimp.h
ximpfw/core/srcdatamodel/ximpstatusimp.cpp
ximpfw/core/srcdatamodel/ximpstatusimp.h
ximpfw/core/srcdatamodel/ximpsubscriptionitembase.cpp
ximpfw/core/srcdatamodel/ximptypehelpers.h
ximpfw/core/srcfrontend/srcecomhook/ximpecomhook.cpp
ximpfw/core/srcfrontend/srcecomhook/ximpecomhook.rss
ximpfw/core/srcfrontend/srcmanager/ximpclientifsingleton.cpp
ximpfw/core/srcfrontend/srcmanager/ximpclientifsingleton.h
ximpfw/core/srcfrontend/srcmanager/ximpclientimp.cpp
ximpfw/core/srcfrontend/srcmanager/ximpclientimp.h
ximpfw/core/srcfrontend/srcmanager/ximpcntxteventobsarray.cpp
ximpfw/core/srcfrontend/srcmanager/ximpcntxteventobsarray.h
ximpfw/core/srcfrontend/srcmanager/ximpcontextclientproxy.cpp
ximpfw/core/srcfrontend/srcmanager/ximpcontextclientproxy.h
ximpfw/core/srcfrontend/srcmanager/ximpcontexteventpump.cpp
ximpfw/core/srcfrontend/srcmanager/ximpcontexteventpump.h
ximpfw/core/srcfrontend/srcmanager/ximpcontextimp.cpp
ximpfw/core/srcfrontend/srcmanager/ximpcontextimp.h
ximpfw/core/srcfrontend/srcmanager/ximpundotask.h
ximpfw/core/srcfrontend/srcmanager/ximpundotask.inl
ximpfw/core/srcoperations/sessionmng/ximpoperationbind.cpp
ximpfw/core/srcoperations/sessionmng/ximpoperationbind.h
ximpfw/core/srcoperations/sessionmng/ximpoperationbind2.cpp
ximpfw/core/srcoperations/sessionmng/ximpoperationbind2.h
ximpfw/core/srcoperations/sessionmng/ximpoperationforcedteardown.cpp
ximpfw/core/srcoperations/sessionmng/ximpoperationforcedteardown.h
ximpfw/core/srcoperations/sessionmng/ximpoperationunbind.cpp
ximpfw/core/srcoperations/sessionmng/ximpoperationunbind.h
ximpfw/core/srcoperations/ximpoperationfactory.h
ximpfw/core/srcoperations/ximpoperationfactoryimp.cpp
ximpfw/core/srcoperations/ximpoperationfactoryimp.h
ximpfw/core/srcprocessor/ximpcontexteventqueue.cpp
ximpfw/core/srcprocessor/ximpcontexteventqueue.h
ximpfw/core/srcprocessor/ximpeventcapsule.cpp
ximpfw/core/srcprocessor/ximpeventcapsule.h
ximpfw/core/srcprocessor/ximpeventmanager.cpp
ximpfw/core/srcprocessor/ximpeventmanager.h
ximpfw/core/srcprocessor/ximpeventqueueobserver.h
ximpfw/core/srcprocessor/ximpfeaturemanager.cpp
ximpfw/core/srcprocessor/ximpfeaturemanager.h
ximpfw/core/srcprocessor/ximpglobals.cpp
ximpfw/core/srcprocessor/ximpglobals.h
ximpfw/core/srcprocessor/ximpglobalsobserver.h
ximpfw/core/srcprocessor/ximphostimp.cpp
ximpfw/core/srcprocessor/ximphostimp.h
ximpfw/core/srcprocessor/ximphostmanager.cpp
ximpfw/core/srcprocessor/ximphostmanager.h
ximpfw/core/srcprocessor/ximpoperationbase.cpp
ximpfw/core/srcprocessor/ximppluginfactory.cpp
ximpfw/core/srcprocessor/ximppluginfactory.h
ximpfw/core/srcprocessor/ximpprotocolrequestcompleteeventimp.cpp
ximpfw/core/srcprocessor/ximpprotocolrequestcompleteeventimp.h
ximpfw/core/srcprocessor/ximppsccontextimp.cpp
ximpfw/core/srcprocessor/ximppsccontextimp.h
ximpfw/core/srcpscserver/ximpcontextsession.cpp
ximpfw/core/srcpscserver/ximpcontextsession.h
ximpfw/core/srcpscserver/ximpserver.cpp
ximpfw/core/srcpscserver/ximpserver.h
ximpfw/core/srcpscserver/ximpserverdefs.h
ximpfw/core/srcpscserver/ximpserversessionadapter.cpp
ximpfw/core/srcpscserver/ximpserversessionadapter.h
ximpfw/core/srcrootserver/ximprootserver.cpp
ximpfw/core/srcrootserver/ximprootserver.h
ximpfw/core/srcrootserver/ximprootserverdefs.h
ximpfw/core/srcrootserver/ximprootserversessionadapter.cpp
ximpfw/core/srcrootserver/ximprootserversessionadapter.h
ximpfw/core/srcrootserver/ximprootsession.cpp
ximpfw/core/srcrootserver/ximprootsession.h
ximpfw/core/srcutils/ximpobjecthelpers.cpp
ximpfw/core/srcutils/ximppanics.cpp
ximpfw/core/srcutils/ximprbufhelpers.cpp
ximpfw/core/srcutils/ximprequestidbuilder.cpp
ximpfw/core/srcutils/ximpsrv.h
ximpfw/core/srcutils/ximpsrvmessage.h
ximpfw/core/srcutils/ximpsrvmessageimp.cpp
ximpfw/core/srcutils/ximpsrvmessageimp.h
ximpfw/core/srcutils/ximpsrvsession.h
ximpfw/core/srcutils/ximpsrvsessionadapter.cpp
ximpfw/core/srcutils/ximpsrvsessionadapter.h
ximpfw/core/srcutils/ximptrace.cpp
ximpfw/core/srcutils/ximptrace.h
ximpfw/group/bld.inf
ximpfw/group/ximpdlluids.hrh
ximpfw/presence/bwins/presencecacheclientu.def
ximpfw/presence/bwins/presencecacheecomhooku.def
ximpfw/presence/bwins/presencedatamodelhooku.def
ximpfw/presence/bwins/presencedatamodelu.def
ximpfw/presence/bwins/presenceecomhookU.DEF
ximpfw/presence/bwins/presencemanagerU.DEF
ximpfw/presence/bwins/presenceoperationu.def
ximpfw/presence/eabi/presencecacheclientu.def
ximpfw/presence/eabi/presencecacheecomhooku.def
ximpfw/presence/eabi/presencedatamodelhooku.def
ximpfw/presence/eabi/presencedatamodelu.def
ximpfw/presence/eabi/presenceecomhooku.def
ximpfw/presence/eabi/presencemanageru.def
ximpfw/presence/eabi/presenceoperationu.def
ximpfw/presence/group/bld.inf
ximpfw/presence/group/presencecacheclient.mmp
ximpfw/presence/group/presencecacheecomhook.mmp
ximpfw/presence/group/presencecacheserver.mmp
ximpfw/presence/group/presencedatamodel.mmp
ximpfw/presence/group/presencedatamodelhook.mmp
ximpfw/presence/group/presencedlluids.hrh
ximpfw/presence/group/presenceecomhook.mmp
ximpfw/presence/group/presencemanager.mmp
ximpfw/presence/group/presenceoperation.mmp
ximpfw/presence/srcpresencecache/presencecacheclient/presencecacheclient.cpp
ximpfw/presence/srcpresencecache/presencecacheclient/presencecacheclient.h
ximpfw/presence/srcpresencecache/presencecacheclient/presencecacheclientnotification.cpp
ximpfw/presence/srcpresencecache/presencecacheclient/presencecacheclientnotification.h
ximpfw/presence/srcpresencecache/presencecacheecomhook/presencecacheecomhook.cpp
ximpfw/presence/srcpresencecache/presencecacheecomhook/presencecacheecomhook.rss
ximpfw/presence/srcpresencecache/presencecacheserver/presencecachebuddystore.cpp
ximpfw/presence/srcpresencecache/presencecacheserver/presencecachebuddystore.h
ximpfw/presence/srcpresencecache/presencecacheserver/presencecachedefs.h
ximpfw/presence/srcpresencecache/presencecacheserver/presencecacheserver.cpp
ximpfw/presence/srcpresencecache/presencecacheserver/presencecacheserver.h
ximpfw/presence/srcpresencecache/presencecacheserver/presencecacheservicestore.cpp
ximpfw/presence/srcpresencecache/presencecacheserver/presencecacheservicestore.h
ximpfw/presence/srcpresencecache/presencecacheserver/presencecachesession.cpp
ximpfw/presence/srcpresencecache/presencecacheserver/presencecachesession.h
ximpfw/presence/srcpresencedatamodel/apidataobjfactory.h
ximpfw/presence/srcpresencedatamodel/presenceapidataobjfactory.cpp
ximpfw/presence/srcpresencedatamodel/presenceapidataobjfactory.h
ximpfw/presence/srcpresencedatamodel/presenceapidataobjfactory.inl
ximpfw/presence/srcpresencedatamodel/presenceapidataobjfactoryaccessor.cpp
ximpfw/presence/srcpresencedatamodel/presenceapidataobjfactoryaccessor.h
ximpfw/presence/srcpresencedatamodel/presenceapiobjbase.h
ximpfw/presence/srcpresencedatamodel/presenceauthorization/blocklistsubscriptionitem.cpp
ximpfw/presence/srcpresencedatamodel/presenceauthorization/blocklistsubscriptionitem.h
ximpfw/presence/srcpresencedatamodel/presenceauthorization/grantrequestlistsubscriptionitem.cpp
ximpfw/presence/srcpresencedatamodel/presenceauthorization/grantrequestlistsubscriptionitem.h
ximpfw/presence/srcpresencedatamodel/presenceauthorization/groupcontenteventobserver.h
ximpfw/presence/srcpresencedatamodel/presenceauthorization/groupmemberspresenceconfigurationitem.cpp
ximpfw/presence/srcpresencedatamodel/presenceauthorization/groupmemberspresenceconfigurationitem.h
ximpfw/presence/srcpresencedatamodel/presenceauthorization/presenceblockinfoimp.cpp
ximpfw/presence/srcpresencedatamodel/presenceauthorization/presenceblockinfoimp.h
ximpfw/presence/srcpresencedatamodel/presenceauthorization/presenceblocklisteventimp.cpp
ximpfw/presence/srcpresencedatamodel/presenceauthorization/presenceblocklisteventimp.h
ximpfw/presence/srcpresencedatamodel/presenceauthorization/presenceconfigurationitem.cpp
ximpfw/presence/srcpresencedatamodel/presenceauthorization/presenceconfigurationitem.h
ximpfw/presence/srcpresencedatamodel/presenceauthorization/presencegrantrequestinfoimp.cpp
ximpfw/presence/srcpresencedatamodel/presenceauthorization/presencegrantrequestinfoimp.h
ximpfw/presence/srcpresencedatamodel/presenceauthorization/presencegrantrequestlisteventimp.cpp
ximpfw/presence/srcpresencedatamodel/presenceauthorization/presencegrantrequestlisteventimp.h
ximpfw/presence/srcpresencedatamodel/presenceauthorization/presencetoeveryoneconfigurationitem.cpp
ximpfw/presence/srcpresencedatamodel/presenceauthorization/presencetoeveryoneconfigurationitem.h
ximpfw/presence/srcpresencedatamodel/presencecache/presencebuddyinfoimp.cpp
ximpfw/presence/srcpresencedatamodel/presencecache/presencebuddyinfoimp.h
ximpfw/presence/srcpresencedatamodel/presencecache/presencebuddyinfolistimp.cpp
ximpfw/presence/srcpresencedatamodel/presencecache/presencebuddyinfolistimp.h
ximpfw/presence/srcpresencedatamodel/presencedatacacheimp.cpp
ximpfw/presence/srcpresencedatamodel/presencedatacacheimp.h
ximpfw/presence/srcpresencedatamodel/presencedatamodelhook/presencedatamodelhook.cpp
ximpfw/presence/srcpresencedatamodel/presencedatamodelhook/presencedatamodelhook.rss
ximpfw/presence/srcpresencedatamodel/presenceeventcodec.cpp
ximpfw/presence/srcpresencedatamodel/presenceeventcodec.h
ximpfw/presence/srcpresencedatamodel/presencefilterstore.cpp
ximpfw/presence/srcpresencedatamodel/presencefilterstore.h
ximpfw/presence/srcpresencedatamodel/presenceinfo/devicepresenceinfoimp.cpp
ximpfw/presence/srcpresencedatamodel/presenceinfo/devicepresenceinfoimp.h
ximpfw/presence/srcpresencedatamodel/presenceinfo/personpresenceinfoimp.cpp
ximpfw/presence/srcpresencedatamodel/presenceinfo/personpresenceinfoimp.h
ximpfw/presence/srcpresencedatamodel/presenceinfo/presenceinfofieldcollectionimp.cpp
ximpfw/presence/srcpresencedatamodel/presenceinfo/presenceinfofieldcollectionimp.h
ximpfw/presence/srcpresencedatamodel/presenceinfo/presenceinfofieldimp.cpp
ximpfw/presence/srcpresencedatamodel/presenceinfo/presenceinfofieldimp.h
ximpfw/presence/srcpresencedatamodel/presenceinfo/presenceinfofieldvaluebinaryimp.cpp
ximpfw/presence/srcpresencedatamodel/presenceinfo/presenceinfofieldvaluebinaryimp.h
ximpfw/presence/srcpresencedatamodel/presenceinfo/presenceinfofieldvalueenumimp.cpp
ximpfw/presence/srcpresencedatamodel/presenceinfo/presenceinfofieldvalueenumimp.h
ximpfw/presence/srcpresencedatamodel/presenceinfo/presenceinfofieldvaluetextimp.cpp
ximpfw/presence/srcpresencedatamodel/presenceinfo/presenceinfofieldvaluetextimp.h
ximpfw/presence/srcpresencedatamodel/presenceinfo/presenceinfofilterimp.cpp
ximpfw/presence/srcpresencedatamodel/presenceinfo/presenceinfoimp.cpp
ximpfw/presence/srcpresencedatamodel/presenceinfo/servicepresenceinfoimp.cpp
ximpfw/presence/srcpresencedatamodel/presenceinfo/servicepresenceinfoimp.h
ximpfw/presence/srcpresencedatamodel/presenceobjectfactoryimp.cpp
ximpfw/presence/srcpresencedatamodel/presenceobjectfactoryimp.h
ximpfw/presence/srcpresencedatamodel/presencepublishing/documentutils.cpp
ximpfw/presence/srcpresencedatamodel/presencepublishing/documentutils.h
ximpfw/presence/srcpresencedatamodel/presencepublishing/ownpresenceeventimp.cpp
ximpfw/presence/srcpresencedatamodel/presencepublishing/ownpresenceeventimp.h
ximpfw/presence/srcpresencedatamodel/presencepublishing/ownpresencesubscriptionitem.cpp
ximpfw/presence/srcpresencedatamodel/presencepublishing/ownpresencesubscriptionitem.h
ximpfw/presence/srcpresencedatamodel/presencepublishing/presenceinfofilterimp.h
ximpfw/presence/srcpresencedatamodel/presencepublishing/presenceinfoimp.h
ximpfw/presence/srcpresencedatamodel/presencepublishing/presencewatcherinfoimp.cpp
ximpfw/presence/srcpresencedatamodel/presencepublishing/presencewatcherinfoimp.h
ximpfw/presence/srcpresencedatamodel/presencepublishing/presencewatcherlisteventimp.cpp
ximpfw/presence/srcpresencedatamodel/presencepublishing/presencewatcherlisteventimp.h
ximpfw/presence/srcpresencedatamodel/presencepublishing/watcherlistsubscriptionitem.cpp
ximpfw/presence/srcpresencedatamodel/presencepublishing/watcherlistsubscriptionitem.h
ximpfw/presence/srcpresencedatamodel/presencetypehelpers.h
ximpfw/presence/srcpresencedatamodel/presencewatching/presentitygroupmemberspresencesubscriptionitem.cpp
ximpfw/presence/srcpresencedatamodel/presencewatching/presentitygroupmemberspresencesubscriptionitem.h
ximpfw/presence/srcpresencedatamodel/presencewatching/presentitypresenceeventimp.cpp
ximpfw/presence/srcpresencedatamodel/presencewatching/presentitypresenceeventimp.h
ximpfw/presence/srcpresencedatamodel/presencewatching/presentitypresencesubscriptionitem.cpp
ximpfw/presence/srcpresencedatamodel/presencewatching/presentitypresencesubscriptionitem.h
ximpfw/presence/srcpresencedatamodel/presentitygroups/groupcontentsubscriptionitem.cpp
ximpfw/presence/srcpresencedatamodel/presentitygroups/groupcontentsubscriptionitem.h
ximpfw/presence/srcpresencedatamodel/presentitygroups/grouplistsubscriptionitem.cpp
ximpfw/presence/srcpresencedatamodel/presentitygroups/grouplistsubscriptionitem.h
ximpfw/presence/srcpresencedatamodel/presentitygroups/presentitygroupcontenteventimp.cpp
ximpfw/presence/srcpresencedatamodel/presentitygroups/presentitygroupcontenteventimp.h
ximpfw/presence/srcpresencedatamodel/presentitygroups/presentitygroupinfoimp.cpp
ximpfw/presence/srcpresencedatamodel/presentitygroups/presentitygroupinfoimp.h
ximpfw/presence/srcpresencedatamodel/presentitygroups/presentitygrouplisteventimp.cpp
ximpfw/presence/srcpresencedatamodel/presentitygroups/presentitygrouplisteventimp.h
ximpfw/presence/srcpresencedatamodel/presentitygroups/presentitygroupmemberinfoimp.cpp
ximpfw/presence/srcpresencedatamodel/presentitygroups/presentitygroupmemberinfoimp.h
ximpfw/presence/srcpresencefrontend/srcecomhook/presenceecomhook.cpp
ximpfw/presence/srcpresencefrontend/srcecomhook/presenceecomhook.rss
ximpfw/presence/srcpresencefrontend/srcpresencemanager/presenceauthorizationimp.cpp
ximpfw/presence/srcpresencefrontend/srcpresencemanager/presenceauthorizationimp.h
ximpfw/presence/srcpresencefrontend/srcpresencemanager/presencefeaturesimp.cpp
ximpfw/presence/srcpresencefrontend/srcpresencemanager/presencefeaturesimp.h
ximpfw/presence/srcpresencefrontend/srcpresencemanager/presencepublishingimp.cpp
ximpfw/presence/srcpresencefrontend/srcpresencemanager/presencepublishingimp.h
ximpfw/presence/srcpresencefrontend/srcpresencemanager/presencewatchingimp.cpp
ximpfw/presence/srcpresencefrontend/srcpresencemanager/presencewatchingimp.h
ximpfw/presence/srcpresencefrontend/srcpresencemanager/presentitygroupsimp.cpp
ximpfw/presence/srcpresencefrontend/srcpresencemanager/presentitygroupsimp.h
ximpfw/presence/srcpresenceoperations/operationlaunchcleaner.cpp
ximpfw/presence/srcpresenceoperations/operationlaunchcleaner.h
ximpfw/presence/srcpresenceoperations/operationsetsubscriptiondata.cpp
ximpfw/presence/srcpresenceoperations/operationsetsubscriptiondata.h
ximpfw/presence/srcpresenceoperations/operationsynthesisesubscriptionevent.cpp
ximpfw/presence/srcpresenceoperations/operationsynthesisesubscriptionevent.h
ximpfw/presence/srcpresenceoperations/presenceauthorization/operationblockpresenceforpresentity.cpp
ximpfw/presence/srcpresenceoperations/presenceauthorization/operationblockpresenceforpresentity.h
ximpfw/presence/srcpresenceoperations/presenceauthorization/operationcancelpresenceblockfrompresentity.cpp
ximpfw/presence/srcpresenceoperations/presenceauthorization/operationcancelpresenceblockfrompresentity.h
ximpfw/presence/srcpresenceoperations/presenceauthorization/operationgrantpresencetoeveryone.cpp
ximpfw/presence/srcpresenceoperations/presenceauthorization/operationgrantpresencetoeveryone.h
ximpfw/presence/srcpresenceoperations/presenceauthorization/operationgrantpresencetopresentity.cpp
ximpfw/presence/srcpresenceoperations/presenceauthorization/operationgrantpresencetopresentity.h
ximpfw/presence/srcpresenceoperations/presenceauthorization/operationgrantpresencetopresentitygroupmembers.cpp
ximpfw/presence/srcpresenceoperations/presenceauthorization/operationgrantpresencetopresentitygroupmembers.h
ximpfw/presence/srcpresenceoperations/presenceauthorization/operationhandlepresenceblocking.cpp
ximpfw/presence/srcpresenceoperations/presenceauthorization/operationhandlepresenceblocking.h
ximpfw/presence/srcpresenceoperations/presenceauthorization/operationhandlepresencegrantrequests.cpp
ximpfw/presence/srcpresenceoperations/presenceauthorization/operationhandlepresencegrantrequests.h
ximpfw/presence/srcpresenceoperations/presenceauthorization/operationsubscribeblocklist.cpp
ximpfw/presence/srcpresenceoperations/presenceauthorization/operationsubscribeblocklist.h
ximpfw/presence/srcpresenceoperations/presenceauthorization/operationsubscribegrantrequestlist.cpp
ximpfw/presence/srcpresenceoperations/presenceauthorization/operationsubscribegrantrequestlist.h
ximpfw/presence/srcpresenceoperations/presenceauthorization/operationunsubscribeblocklist.cpp
ximpfw/presence/srcpresenceoperations/presenceauthorization/operationunsubscribeblocklist.h
ximpfw/presence/srcpresenceoperations/presenceauthorization/operationunsubscribegrantrequestlist.cpp
ximpfw/presence/srcpresenceoperations/presenceauthorization/operationunsubscribegrantrequestlist.h
ximpfw/presence/srcpresenceoperations/presenceauthorization/operationwithdrawpresencefromeveryone.cpp
ximpfw/presence/srcpresenceoperations/presenceauthorization/operationwithdrawpresencefromeveryone.h
ximpfw/presence/srcpresenceoperations/presenceauthorization/operationwithdrawpresencefrompresentity.cpp
ximpfw/presence/srcpresenceoperations/presenceauthorization/operationwithdrawpresencefrompresentity.h
ximpfw/presence/srcpresenceoperations/presenceauthorization/operationwithdrawpresencefrompresentitygroupmembers.cpp
ximpfw/presence/srcpresenceoperations/presenceauthorization/operationwithdrawpresencefrompresentitygroupmembers.h
ximpfw/presence/srcpresenceoperations/presenceoperationdefs.h
ximpfw/presence/srcpresenceoperations/presenceoperationfactoryimp.cpp
ximpfw/presence/srcpresenceoperations/presenceoperationfactoryimp.h
ximpfw/presence/srcpresenceoperations/presencepublishing/operationhandleownpresence.cpp
ximpfw/presence/srcpresenceoperations/presencepublishing/operationhandleownpresence.h
ximpfw/presence/srcpresenceoperations/presencepublishing/operationhandlepresencewatcherlist.cpp
ximpfw/presence/srcpresenceoperations/presencepublishing/operationhandlepresencewatcherlist.h
ximpfw/presence/srcpresenceoperations/presencepublishing/operationpublishownpresence.cpp
ximpfw/presence/srcpresenceoperations/presencepublishing/operationpublishownpresence.h
ximpfw/presence/srcpresenceoperations/presencepublishing/operationsubscribeownpresence.cpp
ximpfw/presence/srcpresenceoperations/presencepublishing/operationsubscribeownpresence.h
ximpfw/presence/srcpresenceoperations/presencepublishing/operationsubscribewatcherlist.cpp
ximpfw/presence/srcpresenceoperations/presencepublishing/operationsubscribewatcherlist.h
ximpfw/presence/srcpresenceoperations/presencepublishing/operationunsubscribeownpresence.cpp
ximpfw/presence/srcpresenceoperations/presencepublishing/operationunsubscribeownpresence.h
ximpfw/presence/srcpresenceoperations/presencepublishing/operationunsubscribewatcherlist.cpp
ximpfw/presence/srcpresenceoperations/presencepublishing/operationunsubscribewatcherlist.h
ximpfw/presence/srcpresenceoperations/presencewatching/operationhandlepresentitypresence.cpp
ximpfw/presence/srcpresenceoperations/presencewatching/operationhandlepresentitypresence.h
ximpfw/presence/srcpresenceoperations/presencewatching/operationsubscribepresentitygroupmemberspresence.cpp
ximpfw/presence/srcpresenceoperations/presencewatching/operationsubscribepresentitygroupmemberspresence.h
ximpfw/presence/srcpresenceoperations/presencewatching/operationsubscribepresentitypresence.cpp
ximpfw/presence/srcpresenceoperations/presencewatching/operationsubscribepresentitypresence.h
ximpfw/presence/srcpresenceoperations/presencewatching/operationunsubscribepresentitygroupmemberspresence.cpp
ximpfw/presence/srcpresenceoperations/presencewatching/operationunsubscribepresentitygroupmemberspresence.h
ximpfw/presence/srcpresenceoperations/presencewatching/operationunsubscribepresentitypresence.cpp
ximpfw/presence/srcpresenceoperations/presencewatching/operationunsubscribepresentitypresence.h
ximpfw/presence/srcpresenceoperations/presentitygroups/operationaddpresentitygroupmember.cpp
ximpfw/presence/srcpresenceoperations/presentitygroups/operationaddpresentitygroupmember.h
ximpfw/presence/srcpresenceoperations/presentitygroups/operationcreatepresentitygroup.cpp
ximpfw/presence/srcpresenceoperations/presentitygroups/operationcreatepresentitygroup.h
ximpfw/presence/srcpresenceoperations/presentitygroups/operationdeletepresentitygroup.cpp
ximpfw/presence/srcpresenceoperations/presentitygroups/operationdeletepresentitygroup.h
ximpfw/presence/srcpresenceoperations/presentitygroups/operationhandlepresentitygroupcontent.cpp
ximpfw/presence/srcpresenceoperations/presentitygroups/operationhandlepresentitygroupcontent.h
ximpfw/presence/srcpresenceoperations/presentitygroups/operationhandlepresentitygroupmemberadded.cpp
ximpfw/presence/srcpresenceoperations/presentitygroups/operationhandlepresentitygroupmemberadded.h
ximpfw/presence/srcpresenceoperations/presentitygroups/operationhandlepresentitygroupmemberdisplaynameupdated.cpp
ximpfw/presence/srcpresenceoperations/presentitygroups/operationhandlepresentitygroupmemberdisplaynameupdated.h
ximpfw/presence/srcpresenceoperations/presentitygroups/operationhandlepresentitygroupmemberremoved.cpp
ximpfw/presence/srcpresenceoperations/presentitygroups/operationhandlepresentitygroupmemberremoved.h
ximpfw/presence/srcpresenceoperations/presentitygroups/operationhandlepresentitygroups.cpp
ximpfw/presence/srcpresenceoperations/presentitygroups/operationhandlepresentitygroups.h
ximpfw/presence/srcpresenceoperations/presentitygroups/operationremovepresentitygroupmember.cpp
ximpfw/presence/srcpresenceoperations/presentitygroups/operationremovepresentitygroupmember.h
ximpfw/presence/srcpresenceoperations/presentitygroups/operationsubscribegroupcontent.cpp
ximpfw/presence/srcpresenceoperations/presentitygroups/operationsubscribegroupcontent.h
ximpfw/presence/srcpresenceoperations/presentitygroups/operationsubscribegrouplist.cpp
ximpfw/presence/srcpresenceoperations/presentitygroups/operationsubscribegrouplist.h
ximpfw/presence/srcpresenceoperations/presentitygroups/operationunsubscribegroupcontent.cpp
ximpfw/presence/srcpresenceoperations/presentitygroups/operationunsubscribegroupcontent.h
ximpfw/presence/srcpresenceoperations/presentitygroups/operationunsubscribegrouplist.cpp
ximpfw/presence/srcpresenceoperations/presentitygroups/operationunsubscribegrouplist.h
ximpfw/presence/srcpresenceoperations/presentitygroups/operationupdatepresentitygroupdisplayname.cpp
ximpfw/presence/srcpresenceoperations/presentitygroups/operationupdatepresentitygroupdisplayname.h
ximpfw/presence/srcpresenceoperations/presentitygroups/operationupdatepresentitygroupmemberdisplayname.cpp
ximpfw/presence/srcpresenceoperations/presentitygroups/operationupdatepresentitygroupmemberdisplayname.h
ximpfw/presence/srcpresenceprocessor/protocolpresenceauthorizationdatahostimp.cpp
ximpfw/presence/srcpresenceprocessor/protocolpresenceauthorizationdatahostimp.h
ximpfw/presence/srcpresenceprocessor/protocolpresencedatahostimp.cpp
ximpfw/presence/srcpresenceprocessor/protocolpresencedatahostimp.h
ximpfw/presence/srcpresenceprocessor/protocolpresencepublishingdatahostimp.cpp
ximpfw/presence/srcpresenceprocessor/protocolpresencepublishingdatahostimp.h
ximpfw/presence/srcpresenceprocessor/protocolpresencewatchingdatahostimp.cpp
ximpfw/presence/srcpresenceprocessor/protocolpresencewatchingdatahostimp.h
ximpfw/presence/srcpresenceprocessor/protocolpresentitygroupsdatahostimp.cpp
ximpfw/presence/srcpresenceprocessor/protocolpresentitygroupsdatahostimp.h
ximpfw/rom/ximpfw.iby
ximpfw/rom/ximpfw_install.pkg
ximpfw/sis/metadata.xml
ximpfw/sis/ximpfw.pkg
ximpfw/sis/ximpfwstub.pkg
ximpfw/sis/ximpfwstub.sis
ximpfw/tsrc/docs/readme.txt
ximpfw/tsrc/group/bld.inf
ximpfw/tsrc/group/test_mover.make
ximpfw/tsrc/group/ximpfw_release_tests.pkg
ximpfw/tsrc/group/ximpfwmrt.iby
ximpfw/tsrc/init/ximpfw_install.pkg
ximpfw/tsrc/init/ximpfw_upgrade.pkg
ximpfw/tsrc/sis/ximpfw_release_tests.pkg
ximpfw/tsrc/src/t_eunittemplate/bld.inf
ximpfw/tsrc/src/t_eunittemplate/t_eunittemplate.cpp
ximpfw/tsrc/src/t_eunittemplate/t_eunittemplate.h
ximpfw/tsrc/src/t_eunittemplate/t_eunittemplate.mmp
ximpfw/tsrc/src/t_presenceall/bld.inf
ximpfw/tsrc/src/t_presenceall/t_presenceall.cpp
ximpfw/tsrc/src/t_presenceall/t_presenceall.h
ximpfw/tsrc/src/t_presenceall/t_presenceall.mmp
ximpfw/tsrc/src/t_presenceauthorization/bld.inf
ximpfw/tsrc/src/t_presenceauthorization/t_presenceauthorization.cpp
ximpfw/tsrc/src/t_presenceauthorization/t_presenceauthorization.h
ximpfw/tsrc/src/t_presenceauthorization/t_presenceauthorization.mmp
ximpfw/tsrc/src/t_presenceblocking/bld.inf
ximpfw/tsrc/src/t_presenceblocking/t_presenceblocking.cpp
ximpfw/tsrc/src/t_presenceblocking/t_presenceblocking.h
ximpfw/tsrc/src/t_presenceblocking/t_presenceblocking.mmp
ximpfw/tsrc/src/t_presencecache/T_PresenceCache.cpp
ximpfw/tsrc/src/t_presencecache/T_PresenceCache.h
ximpfw/tsrc/src/t_presencecache/T_PresenceCache.mmp
ximpfw/tsrc/src/t_presencecache/T_PresenceCache_DllMain.cpp
ximpfw/tsrc/src/t_presencecache/bld.inf
ximpfw/tsrc/src/t_presencegrantrequestmngt/bld.inf
ximpfw/tsrc/src/t_presencegrantrequestmngt/t_presencegrantrequestmngt.cpp
ximpfw/tsrc/src/t_presencegrantrequestmngt/t_presencegrantrequestmngt.h
ximpfw/tsrc/src/t_presencegrantrequestmngt/t_presencegrantrequestmngt.mmp
ximpfw/tsrc/src/t_presencegrouplistmngt/bld.inf
ximpfw/tsrc/src/t_presencegrouplistmngt/t_presencegrouplistmngt.cpp
ximpfw/tsrc/src/t_presencegrouplistmngt/t_presencegrouplistmngt.h
ximpfw/tsrc/src/t_presencegrouplistmngt/t_presencegrouplistmngt.mmp
ximpfw/tsrc/src/t_presencegroupmembermngt/bld.inf
ximpfw/tsrc/src/t_presencegroupmembermngt/t_presencegroupmembermngt.cpp
ximpfw/tsrc/src/t_presencegroupmembermngt/t_presencegroupmembermngt.h
ximpfw/tsrc/src/t_presencegroupmembermngt/t_presencegroupmembermngt.mmp
ximpfw/tsrc/src/t_presencepublishing/bld.inf
ximpfw/tsrc/src/t_presencepublishing/t_presencepublishing.cpp
ximpfw/tsrc/src/t_presencepublishing/t_presencepublishing.h
ximpfw/tsrc/src/t_presencepublishing/t_presencepublishing.mmp
ximpfw/tsrc/src/t_presencewatcherlistmngt/bld.inf
ximpfw/tsrc/src/t_presencewatcherlistmngt/t_presencewatcherlistmngt.cpp
ximpfw/tsrc/src/t_presencewatcherlistmngt/t_presencewatcherlistmngt.h
ximpfw/tsrc/src/t_presencewatcherlistmngt/t_presencewatcherlistmngt.mmp
ximpfw/tsrc/src/t_presencewatching/bld.inf
ximpfw/tsrc/src/t_presencewatching/t_presencewatching.cpp
ximpfw/tsrc/src/t_presencewatching/t_presencewatching.h
ximpfw/tsrc/src/t_presencewatching/t_presencewatching.mmp
ximpfw/tsrc/src/t_rootservices/bld.inf
ximpfw/tsrc/src/t_rootservices/t_rootservices.cpp
ximpfw/tsrc/src/t_rootservices/t_rootservices.h
ximpfw/tsrc/src/t_rootservices/t_rootservices.mmp
ximpfw/tsrc/src/t_sessionmng/bld.inf
ximpfw/tsrc/src/t_sessionmng/t_sessionmng.cpp
ximpfw/tsrc/src/t_sessionmng/t_sessionmng.h
ximpfw/tsrc/src/t_sessionmng/t_sessionmng.mmp
ximpfw/tsrc/src/t_utils/bld.inf
ximpfw/tsrc/src/t_utils/t_utils.cpp
ximpfw/tsrc/src/t_utils/t_utils.h
ximpfw/tsrc/src/t_utils/t_utils.mmp
ximpfw/tsrc/tsrcprotocols/bld.inf
ximpfw/tsrc/tsrcprotocols/pr_prfwtestprotocol/bld.inf
ximpfw/tsrc/tsrcprotocols/pr_prfwtestprotocol/pr_prfwtestprotocol.cpp
ximpfw/tsrc/tsrcprotocols/pr_prfwtestprotocol/pr_prfwtestprotocol.h
ximpfw/tsrc/tsrcprotocols/pr_prfwtestprotocol/pr_prfwtestprotocol.mmp
ximpfw/tsrc/tsrcprotocols/pr_prfwtestprotocol/pr_prfwtestprotocol.rss
ximpfw/tsrc/tsrcprotocols/prfwtestprotocols.h
ximpfw/tsrc/tsrcprotocols/prfwtestprotocols_resource.hrh
ximpfw/tsrc/tsrcutils/bld.inf
ximpfw/tsrc/tsrcutils/bwins/prfwtestcaseutilsu.def
ximpfw/tsrc/tsrcutils/eabi/prfwtestcaseutilsu.def
ximpfw/tsrc/tsrcutils/eunitcommon/cglobalwaitingnote.h
ximpfw/tsrc/tsrcutils/eunitcommon/eunit_test_mover.pl
ximpfw/tsrc/tsrcutils/eunitcommon/eunittools.h
ximpfw/tsrc/tsrcutils/eunitcommon/eunittstdll_armv5u.def
ximpfw/tsrc/tsrcutils/eunitcommon/eunittstdll_winsu.def
ximpfw/tsrc/tsrcutils/eunitcommon/eunittstdllbase.hrh
ximpfw/tsrc/tsrcutils/eunitcommon/move_tests_to_eunit.inf
ximpfw/tsrc/tsrcutils/eunitcommon/move_tests_to_eunit.mk
ximpfw/tsrc/tsrcutils/processmaster/bld.inf
ximpfw/tsrc/tsrcutils/processmaster/pm.h
ximpfw/tsrc/tsrcutils/processmaster/prfwtestprocessmaster.cpp
ximpfw/tsrc/tsrcutils/processmaster/prfwtestprocessmaster.h
ximpfw/tsrc/tsrcutils/processmaster/prfwtestprocessmaster.mmp
ximpfw/tsrc/tsrcutils/testcaseutils/bld.inf
ximpfw/tsrc/tsrcutils/testcaseutils/prfwgeneralwaiter.cpp
ximpfw/tsrc/tsrcutils/testcaseutils/prfwgeneralwaiter.h
ximpfw/tsrc/tsrcutils/testcaseutils/prfwsrvtestclient.cpp
ximpfw/tsrc/tsrcutils/testcaseutils/prfwsrvtestclient.h
ximpfw/tsrc/tsrcutils/testcaseutils/prfwtestcaseutils.mmp
ximpfw/tsrc/tsrcutils/testcaseutils/prfwtestcaseutilspanics.h
ximpfw/tsrc/tsrcutils/testcaseutils/prfwtestcontextwrapper.cpp
ximpfw/tsrc/tsrcutils/testcaseutils/prfwtestcontextwrapper.h
ximpfw/tsrc/tsrcutils/testcaseutils/prfwtestcontextwrappermgr.cpp
ximpfw/tsrc/tsrcutils/testcaseutils/prfwtestcontextwrappermgr.h
ximpfw/tsrc/tsrcutils/testcaseutils/prfwtestdlluids.hrh
ximpfw/tsrc/tsrcutils/testcaseutils/prfwtesteventfactory.cpp
ximpfw/tsrc/tsrcutils/testcaseutils/prfwtesteventfactory.h
ximpfw/tsrc/tsrcutils/testcaseutils/prfwtestfilelogichelper.cpp
ximpfw/tsrc/tsrcutils/testcaseutils/prfwtestfilelogichelper.h
ximpfw/tsrc/tsrcutils/testcaseutils/prfwtestfileobserver.h
ximpfw/tsrc/tsrcutils/testcaseutils/prfwtestfilesrvmsg.cpp
ximpfw/tsrc/tsrcutils/testcaseutils/prfwtestfilesrvmsg.h
ximpfw/tsrc/tsrcutils/testcaseutils/prfwtestfiletool.cpp
ximpfw/tsrc/tsrcutils/testcaseutils/prfwtestfiletool.h
ximpfw/tsrc/tsrcutils/testcaseutils/prfwtestlistener.cpp
ximpfw/tsrc/tsrcutils/testcaseutils/prfwtestlistener.h
ximpfw/tsrc/tsrcutils/testcaseutils/prfwtestmessaging.h
ximpfw/tsrc/tsrcutils/testcaseutils/prfwtestmessenger.cpp
ximpfw/tsrc/tsrcutils/testcaseutils/prfwtestmessenger.h
ximpfw/tsrc/tsrcutils/testcaseutils/prfwtestpresencedatautils.cpp
ximpfw/tsrc/tsrcutils/testcaseutils/prfwtestpresencedatautils.h
ximpfw/tsrc/tsrcutils/testcaseutils/prfwtestrobustnesstools.h
ximpfw/tsrc/tsrcutils/testcaseutils/prfwteststatuseventlistener.cpp
ximpfw/tsrc/tsrcutils/testcaseutils/prfwteststatuseventlistener.h
ximpfw/tsrc/tsrcutils/testcaseutils/prfwtestwaithelper.cpp
ximpfw/tsrc/tsrcutils/testcaseutils/prfwtestwaithelper.h
ximpfw/tsrc/tsrcutils/testcaseutils/prfwwaitobserver.h
ximpfw/tsrc/tsrcutils/testcaseutils/userafter.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/brandingserver/bsclient/bsclientdefs.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,29 @@
+/*
+* 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:CBSClientdefs.h
+*
+*/
+#ifndef __BRANDINGDEFS_H__
+#define __BRANDINGDEFS_H__
+#include <e32std.h>
+
+
+#endif  //__BRANDINGDEFS_H__
+
+// END OF FILE
+
+
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/brandingserver/bsclient/bselementfactory.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -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: bselementfactory.cpp
+*
+*/
+
+
+//  INCLUDE FILES
+
+#include "debugtrace.h"
+#include "bselementfactory.h"
+#include "cbselement.h"
+
+
+
+EXPORT_C MBSElement* BSElementFactory::CreateBSElementL( const TDesC8& aElementId,
+									 TBSElementType /*aElementType*/,
+									 TInt aElementData )
+	{
+	return CBSElement::NewL( aElementId, aElementData );
+	}
+
+
+EXPORT_C MBSElement* BSElementFactory::CreateBSElementL( const TDesC8& aElementId,
+									 TBSElementType aElementType,
+									 const TDesC& aElementData )
+	{
+	return CBSElement::NewL( aElementId, aElementData, aElementType );
+	}
+
+
+EXPORT_C MBSElement* BSElementFactory::CreateBSElementL( const TDesC8& aElementId,
+									 TBSElementType /*aElementType*/,
+									 const TDesC8& aElementData )
+	{
+	return CBSElement::NewL( aElementId, aElementData );
+	}
+
+
+EXPORT_C MBSElement* BSElementFactory::CreateBSElementL( const TDesC8& aElementId,
+									 TBSElementType /*aElementType*/,
+									 CBSBitmap* aElementData )
+	{
+	return CBSElement::NewL( aElementId, aElementData );
+	}
+
+
+
+EXPORT_C MBSElement* BSElementFactory::CreateBSElementL( const TDesC8& aElementId,
+									 TBSElementType /*aElementType*/,
+									 RBSObjOwningPtrArray<MBSElement>& aElementData )
+	{
+	return CBSElement::NewL( aElementId, aElementData );
+	}
+
+
+
+
+//  END OF FILE
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/brandingserver/bsclient/bsprocessstarter.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,405 @@
+/*
+* 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: bsprocessstarter.cpp
+*
+*/
+//  INCLUDE FILES
+#include "bsprocessstarter.h"
+#include <e32std.h>
+#include <f32file.h>
+
+
+// CONSTANTS
+_LIT( KEka2ExeDir,"\\sys\\bin\\");
+_LIT( KEka2LaunchMutexExt, "[lMtx]" );
+const TInt KEka2SrvConnTries = 7;
+const TInt KEka2SrvConnInitialRetryWait = 500; //MicroSeconds => 0.0005s
+
+
+
+// ==============================================================
+// ====================== HELPER CLASS ==========================
+// ==============================================================
+
+/**
+ * RSessionBase accessor to give to the ProcessStarter
+ * access to RSessionBase::CreateSession().
+ */
+class REka2SessionBaseAccessor : public RSessionBase
+    {
+    public: // Constructor
+        inline REka2SessionBaseAccessor()
+            {
+            }
+
+    public: // New functions
+
+        /**
+         * Public access to RSessionBase::CreateSession().
+         */
+        inline TInt CreateSession( const TDesC& aServer,
+                                   const TVersion& aVersion,
+                                   TInt aAsyncMessageSlots )
+            {
+            return RSessionBase::CreateSession( aServer,
+                                                aVersion,
+                                                aAsyncMessageSlots );
+            }
+    };
+
+
+
+
+
+// ==============================================================
+// ====================== PROCESSSTARTER ========================
+// ==============================================================
+
+
+// --------------------------------------------------------------
+// BSProcessStarter::FullExePathForClienLocation()
+// --------------------------------------------------------------
+//
+void BSProcessStarter::FullExePathForClienLocation(
+    const TDesC& aExeName,
+    TFileName& aFullExePath )
+    {
+    //Get drive (C:) where this client code is installed
+        {
+        TFileName tmp;
+        Dll::FileName( tmp );
+        aFullExePath.Copy( TParsePtrC( tmp ).Drive() );
+        }
+
+    //Build the rest from the exe path
+    aFullExePath.Append( KEka2ExeDir );
+    aFullExePath.Append( aExeName );
+    }
+
+
+
+// --------------------------------------------------------------
+// BSProcessStarter::StartInstance()
+// --------------------------------------------------------------
+//
+TInt BSProcessStarter::StartInstance(
+    const TDesC& aFullExePath,
+    const TDesC& aCommand,
+    const TArray< TProcessStartupParam >* aParams )
+    {
+    RMutex launchMutex;
+    TInt error = KErrNotFound;
+
+        {
+        // Dynamic mutex name used to allow code share
+        TName launchMutexName( TParsePtrC( aFullExePath ).Name() );
+        launchMutexName.Append( KEka2LaunchMutexExt );
+
+        // Open or Create mutex to serialize to access to server startup code.
+        // (race condition safe way)
+        while( error == KErrNotFound )
+            {
+            error = launchMutex.CreateGlobal( launchMutexName );
+            if( error != KErrAlreadyExists )
+                {
+                break;
+                }
+            error = launchMutex.OpenGlobal( launchMutexName );
+            }
+
+        if( error != KErrNone )
+            {
+            return error;
+            }
+        }
+
+
+    launchMutex.Wait();
+
+    //Serialized access
+    error = BSProcessStarter::DoStartInstance( aFullExePath,
+                                             aCommand,
+                                             aParams );
+
+    launchMutex.Signal();
+    launchMutex.Close();
+
+    return error;
+    }
+
+
+
+// --------------------------------------------------------------
+// BSProcessStarter::ConnectToServer()
+// --------------------------------------------------------------
+//
+TInt BSProcessStarter::ConnectToServer(
+    const TDesC& aFullExePath,
+    const TDesC& aCommand,
+    const TArray< TProcessStartupParam >* aParams,
+    RSessionBase& aSessionToConnect,
+    const TDesC& aServerName,
+    const TVersion& aClientVersion,
+    TInt aAsyncMessageSlots )
+    {
+    if( aSessionToConnect.Handle() != KNullHandle )
+        {
+        return KErrInUse;
+        }
+
+    TInt err = KErrNone;
+    TInt startupWait = KEka2SrvConnInitialRetryWait;
+
+    //Server connect and launch loop
+    for( TInt trie = 0 ; trie < KEka2SrvConnTries ; trie++ )
+        {
+        REka2SessionBaseAccessor acc;
+        err = acc.CreateSession( aServerName,
+                                 aClientVersion,
+                                 aAsyncMessageSlots );
+
+        if( err == KErrNone )
+            {
+            //session ownership is now on client
+            aSessionToConnect = acc;
+            return KErrNone;
+            }
+
+        else if( ( err == KErrNotFound ) ||
+                 ( err == KErrServerTerminated ) )
+            {
+            //Server missing or died when connecting
+            //Start a new server
+            err = BSProcessStarter::StartInstance( aFullExePath,
+                                                 aCommand,
+                                                 aParams );
+
+            //If process exist already, then all is fine
+            //(some other process started it between the origical connect and launch trie)
+            if( err == KErrAlreadyExists )
+                {
+                err = KErrNone;
+                }
+
+            //If server process start failed, bail out.
+            if( err != KErrNone )
+                {
+                return err;
+                }
+
+            //If this is 2nd or subsequent try,
+            //give some time for server to startup
+            if( trie > 0 )
+                {
+                // Code scanner warning : Use of User::After (id:92)
+                // it is required to be used here
+                User::After( startupWait ); // CSI: 92 # See above
+                startupWait = 2 * startupWait;
+                }
+            }
+
+        else
+            {
+            //Server process start failed. Bail out.
+            return err;
+            }
+        }
+
+    return err;
+    }
+
+
+
+// --------------------------------------------------------------
+// BSProcessStarter::DoStartServerInstance()
+// --------------------------------------------------------------
+//
+TInt BSProcessStarter::DoStartInstance(
+    const TDesC& aFullExePath,
+    const TDesC& aCommand,
+    const TArray< TProcessStartupParam >* aParams )
+    {
+    TInt error = KErrNone;
+
+    //Create process
+    RProcess process;
+    error = process.Create( aFullExePath, aCommand );
+
+    if( error == KErrNone )
+        {
+        //Set process startup parameters
+        error = ApplyParameters( aParams, process );
+
+        //And execute the process and wait it's startup
+       if( error == KErrNone )
+            {
+            TRequestStatus rendezvousStatus;
+            process.Rendezvous( rendezvousStatus );
+
+            process.Resume();
+            // Codescanner warning: user of User::WaitForRequest (Id:94)
+            // it is required to use at server startup
+            User::WaitForRequest( rendezvousStatus ); // CSI: 94 # See above
+            error = rendezvousStatus.Int();
+
+            if( process.ExitType() != EExitPending )
+                {
+                //Something failed in server startup
+                //Force the error code to be always something
+                //else than KErrNone
+                if( error == KErrNone )
+                    {
+                    error = KErrServerTerminated;
+                    }
+                }
+            }
+        }
+
+    process.Close();
+
+    return error;
+    }
+
+
+
+// --------------------------------------------------------------
+// BSProcessStarter::ApplyParameters()
+// --------------------------------------------------------------
+//
+TInt BSProcessStarter::ApplyParameters(
+    const TArray< TProcessStartupParam >* aParams,
+    RProcess& aProcess )
+    {
+    TInt error = KErrNone;
+    if( aParams )
+        {
+        const TInt paramCount = aParams->Count();
+        for( TInt ix = 0; ix < paramCount; ix++ )
+            {
+            error = (*aParams)[ ix ].ApplyParam( aProcess );
+            if( error != KErrNone )
+                {
+                break;
+                }
+            }
+        }
+
+    return error;
+    }
+
+
+
+// ==============================================================
+// ================== TPROCESSSTARTUPPARAM ======================
+// ==============================================================
+
+// --------------------------------------------------------------
+// TProcessStartupParam::TProcessStartupParam()
+// --------------------------------------------------------------
+//
+TProcessStartupParam::TProcessStartupParam()
+    : iType( EUnknown ),
+      iSlot( KErrNotFound )
+    {
+    }
+
+
+// --------------------------------------------------------------
+// TProcessStartupParam::Set()
+// --------------------------------------------------------------
+//
+void TProcessStartupParam::Set( TInt aSlot,
+                                const RHandleBase& aHandle )
+    {
+    iType = EHandle;
+    iSlot = aSlot;
+    iHandle = &aHandle;
+    }
+
+
+// --------------------------------------------------------------
+// TProcessStartupParam::Set()
+// --------------------------------------------------------------
+//
+void TProcessStartupParam::Set( TInt aSlot,
+                                const RSubSessionBase& aSubSession )
+    {
+    iType = ESubSession;
+    iSlot = aSlot;
+    iSubSession = &aSubSession;
+    }
+
+
+// --------------------------------------------------------------
+// TProcessStartupParam::Set()
+// --------------------------------------------------------------
+//
+void TProcessStartupParam::Set( TInt aSlot,
+                                const TDesC16& aDes )
+    {
+    iType = EDes16;
+    iSlot = aSlot;
+    iDes16.Set( aDes );
+    }
+
+
+// --------------------------------------------------------------
+// TProcessStartupParam::Set()
+// --------------------------------------------------------------
+//
+void TProcessStartupParam::Set( TInt aSlot,
+                                const TDesC8& aDes )
+    {
+    iType = EDes8;
+    iSlot = aSlot;
+    iDes8.Set( aDes );
+    }
+
+
+// --------------------------------------------------------------
+// TProcessStartupParam::Set()
+// --------------------------------------------------------------
+//
+void TProcessStartupParam::Set( TInt aSlot,
+                                TInt aInt )
+    {
+    iType = EInt;
+    iSlot = aSlot;
+    iInt = aInt;
+    }
+
+
+// --------------------------------------------------------------
+// TProcessStartupParam::ApplyParam()
+// --------------------------------------------------------------
+//
+TInt TProcessStartupParam::ApplyParam( RProcess& aProcess ) const
+    {
+    switch( iType )
+        {
+        case EHandle: return aProcess.SetParameter( iSlot, *iHandle );
+        case ESubSession: return aProcess.SetParameter( iSlot, *iSubSession );
+        case EDes16: return aProcess.SetParameter( iSlot, iDes16 );
+        case EDes8: return aProcess.SetParameter( iSlot, iDes8 );
+        case EInt: return aProcess.SetParameter( iSlot, iInt );
+        }
+
+    return KErrUnknown;
+    }
+
+
+// END OF FILE
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/brandingserver/bsclient/bsprocessstarter.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,104 @@
+/*
+* 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: bsprocessstarter.h
+*
+*/
+#ifndef __PROCESSSTARTER_H__
+#define __PROCESSSTARTER_H__
+
+#include <e32std.h>
+class TProcessStartupParam;
+
+
+
+/**
+ * Generic process starter.
+ */
+class BSProcessStarter
+    {
+    public:     // New methods
+
+        static void FullExePathForClienLocation(
+                        const TDesC& aExeName,
+                        TFileName& aFullExePath );
+
+        static TInt StartInstance(
+                        const TDesC& aFullExePath,
+                        const TDesC& aCommand,
+                        const TArray< TProcessStartupParam >* aParams );
+
+        static TInt ConnectToServer(
+                        const TDesC& aFullExePath,
+                        const TDesC& aCommand,
+                        const TArray< TProcessStartupParam >* aParams,
+                        RSessionBase& aSessionToConnect,
+                        const TDesC& aServerName,
+                        const TVersion& aClientVersion,
+                        TInt aAsyncMessageSlots );
+
+
+
+    private:    // Helpers
+        static TInt DoStartInstance(
+                        const TDesC& aFullExePath,
+                        const TDesC& aCommand,
+                        const TArray< TProcessStartupParam >* aParams );
+
+        static TInt ApplyParameters(
+                        const TArray< TProcessStartupParam >* aParams,
+                        RProcess& aProcess );
+
+    };
+
+
+
+
+/**
+ * Generic process startup parameters.
+ */
+class TProcessStartupParam
+    {
+    public:
+
+        TProcessStartupParam();
+        void Set( TInt aSlot, const RHandleBase& aHandle );
+        void Set( TInt aSlot, const RSubSessionBase& aSubSession );
+        void Set( TInt aSlot, const TDesC16& aDes );
+        void Set( TInt aSlot, const TDesC8& aDes );
+        void Set( TInt aSlot, TInt aInt );
+        TInt ApplyParam( RProcess& aProcess ) const;
+
+
+
+    private: //data
+
+        enum TParamType{ EUnknown, EHandle, ESubSession,
+                         EDes16, EDes8, EInt };
+
+        TParamType iType;
+        TInt iSlot;
+        const RHandleBase* iHandle;
+        const RSubSessionBase* iSubSession;
+        TPtrC16 iDes16;
+        TPtrC8 iDes8;
+        TInt iInt;
+    };
+
+
+#endif      //  __PROCESSSTARTER_H__
+
+
+//END OF FILE
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/brandingserver/bsclient/cbsaccess.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,291 @@
+/*
+* 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: CBSAccess.cpp
+*
+*/
+
+
+//  INCLUDE FILES
+
+#include <e32base.h>
+#include <AknsSkinInstance.h>	// skins 
+#include <AknsUtils.h>
+#include <coemain.h>
+
+#include "cbsaccess.h"
+#include "cbsbitmap.h"
+#include "debugtrace.h"
+#include "mbsaccess.h"
+#include "mbsupdater.h"
+#include "cbsiconfileprovider.h"
+
+void Panic(TInt aPanic)
+    {
+    _LIT( KPanic, "CBS" );
+    User::Panic( KPanic, aPanic );
+    }
+
+// Two-phased constructor.
+CBSAccess* CBSAccess::NewL( const TDesC8& aBrandId,
+							const TDesC8& aAppId,
+    					 	const TDesC8& aDefaultBrandId,
+							TLanguage aLanguageId,
+    					  	TBool aCacheData,
+							TInt aReserved )
+    {
+    CBSAccess* self = new ( ELeave ) CBSAccess( aLanguageId, aCacheData, aReserved) ;
+    CleanupStack::PushL( self );
+    self->ConstructL( aBrandId, aAppId, aDefaultBrandId );
+    CleanupStack::Pop( self );  //self
+    return self;
+    }
+
+// Symbian OS default constructor can leave.
+void CBSAccess::ConstructL( const TDesC8& aBrandId, const TDesC8& aAppId, 
+    					 	const TDesC8& aDefaultBrandId )
+    {
+    iBrand = aBrandId.AllocL();
+    iDefaultBrand = aDefaultBrandId.AllocL();
+    iAppId = aAppId.AllocL();
+    User::LeaveIfError( iClient.Connect() );
+    
+	iClient.StartTransactionL( *iAppId, *iBrand, aDefaultBrandId,
+								iLanguageId, EBSTxAccess, iReserved );
+    }
+
+// Destructor
+CBSAccess::~CBSAccess()
+    {
+    delete iBrand;
+    delete iDefaultBrand;
+    delete iAppId;
+    iClient.Close();
+    }
+
+// C++ default constructor can NOT contain any code, that
+// might leave.
+//
+CBSAccess::CBSAccess( TLanguage aLanguageId, TBool aCacheData, TInt aReserved )
+: iLanguageId( aLanguageId ), iUseCache( aCacheData ), iReserved( aReserved )
+	{
+	}
+
+// -----------------------------------------------------------------------------
+// CBSAccess::Close()
+// -----------------------------------------------------------------------------
+//
+void CBSAccess::Close()
+	{
+	delete this;
+	}
+
+// -----------------------------------------------------------------------------
+// CBSAccess::GetTextL()
+// -----------------------------------------------------------------------------
+//
+HBufC* CBSAccess::GetTextL( const TDesC8& aId )
+	{
+	HBufC* buffer = NULL;
+
+	iClient.GetTextL( aId, buffer );
+		
+    TRACE( T_LIT("iClient.GetText( iBrandId, aId, buffer )") );
+    return buffer;
+	}
+
+// -----------------------------------------------------------------------------
+// CBSAccess::GetTextLC()
+// -----------------------------------------------------------------------------
+//
+HBufC* CBSAccess::GetTextLC( const TDesC8& aId )
+	{
+	HBufC* buffer = NULL;
+    iClient.GetTextL( aId, buffer );
+    TRACE( T_LIT("iClient.GetText( aBrandId, aId, buffer )") );
+
+    CleanupStack::PushL( buffer );
+    return buffer;
+	}
+
+
+// -----------------------------------------------------------------------------
+// CBSAccess::GetIntL()
+// -----------------------------------------------------------------------------
+//
+TInt CBSAccess::GetIntL( const TDesC8& aId )
+	{
+	TInt value = 0;
+
+	iClient.GetIntL( aId, value );
+    return value;
+	}
+
+TInt CBSAccess :: isBrandUpdateRequiredL ()
+{
+	TInt updateRequired = -1; 
+	iClient.isBrandUpdateRequiredL (updateRequired);
+ 	return updateRequired;
+
+}
+
+// -----------------------------------------------------------------------------
+// CBSAccess::GetSeveralIntL()
+// -----------------------------------------------------------------------------
+//
+MBSElement* CBSAccess::GetSeveralL( MDesC8Array& aIds )
+	{
+	MBSElement* returnValue = iClient.GetSeveralL( aIds );
+	return returnValue;
+	}
+
+// -----------------------------------------------------------------------------
+// CBSAccess::GetFileL()
+// -----------------------------------------------------------------------------
+//
+void CBSAccess::GetFileL( const TDesC8& aId,
+					   	  RFile& aFile )
+	{
+	iClient.GetFileL( aId, aFile );
+	}
+
+// -----------------------------------------------------------------------------
+// CBSAccess::GetStructureL()
+// -----------------------------------------------------------------------------
+//
+MBSElement* CBSAccess::GetStructureL( const TDesC8& aId )
+	{
+	MBSElement* returnValue = NULL;
+
+	returnValue = iClient.GetStructureL( aId );
+	
+	return returnValue;
+	
+	}
+
+// -----------------------------------------------------------------------------
+// CBSAccess::GetBufferL()
+// -----------------------------------------------------------------------------
+//
+HBufC8* CBSAccess::GetBufferL( const TDesC8& aId )
+	{
+	HBufC8* buffer = NULL;
+	iClient.GetBufferL( aId, buffer );
+	return buffer;
+	}
+
+// -----------------------------------------------------------------------------
+// CBSAccess::GetBufferLC()
+// -----------------------------------------------------------------------------
+//
+HBufC8* CBSAccess::GetBufferLC( const TDesC8& aId )
+	{
+	HBufC8* buffer = GetBufferL( aId );
+	CleanupStack::PushL( buffer );
+	return buffer;
+	}
+
+// -----------------------------------------------------------------------------
+// CBSAccess::RegisterObserverL()
+// -----------------------------------------------------------------------------
+//
+void CBSAccess::RegisterObserverL( MBSBrandChangeObserver* aObserver, MBSBackupRestoreStateObserver* aBackupObserver)
+	{
+	iClient.RegisterObserverL( aObserver, aBackupObserver );
+	}
+
+// -----------------------------------------------------------------------------
+// CBSAccess::UnRegisterObserverL()
+// -----------------------------------------------------------------------------
+//
+void CBSAccess::UnRegisterObserverL( MBSBrandChangeObserver* aObserver, MBSBackupRestoreStateObserver* aBackupObserver )
+	{
+	iClient.UnRegisterObserverL( aObserver, aBackupObserver );
+	}
+
+// -----------------------------------------------------------------------------
+// CBSAccess::GetBitmapL()
+// -----------------------------------------------------------------------------
+//
+void CBSAccess::GetBitmapL( const TDesC8& aBitmapId,
+				 CFbsBitmap*& aBitmap,
+				 CFbsBitmap*& aMask )
+	{
+	TBool useSkins = ETrue;
+	CCoeEnv* coeEnv = CCoeEnv::Static();
+	if( !coeEnv )
+		{
+		TRACE( T_LIT("GETBITMAPL NO COE ENV ") );
+		// no CONE -> don't try to use skins
+		useSkins = EFalse;
+		}
+	
+	MBSElement* bitmapItem = NULL;
+
+	// get the structure containing the info for the bitmap
+	bitmapItem = GetStructureL( aBitmapId );
+	CleanupClosePushL( *bitmapItem );
+
+	// get the list from the bitmap element
+	const CBSBitmap* bitmap = &bitmapItem->BitmapDataL();
+	
+	RFile bitmapFile;
+	
+	// we need to get the bitmap file from where we can load the bitmap
+	GetFileL( bitmap->BitmapFileId(), bitmapFile );
+	
+	TInt err = KErrNotFound;
+	CFbsBitmap* skinBitmap = NULL;
+	if( useSkins )
+		{
+		MAknsSkinInstance* skin = AknsUtils::SkinInstance();	
+
+		TAknsItemID itemId;
+		itemId.Set( bitmap->SkinIdMajor(), bitmap->SkinIdMinor() );
+
+	    // Codescanner warning: neglected to put variable on cleanup stack (id:35)
+	    // This method cannot leave after this line if the bitmap is created
+	    TRAP( err, skinBitmap = AknsUtils::CreateBitmapL( skin, itemId ) ); // CSI: 35 # See above	
+		}
+    // if useSkins is TRUE that means there is a COE Env, and icons can be created
+	// otherwise, without CoeEnv, we cannot create icons, hence leave 
+    if( err == KErrNotFound && useSkins)
+    	{
+		// no skin bitmap found
+		
+	    // icon server take ownership of of icon file provider
+	    CBSIconFileProvider* ifp = CBSIconFileProvider::NewL( bitmapFile );
+	    CleanupStack::PushL( ifp );
+	
+	    AknIconUtils::CreateIconLC( aBitmap, aMask,
+                					*ifp,
+                					bitmap->BitmapId(), bitmap->BitmapMaskId() ); 
+                					  
+		CleanupStack::Pop( 2 ); // aBitmap, aMask
+		CleanupStack::Pop(ifp) ; 
+    	}
+    else if( err )
+    	{
+    	User::Leave( err );
+    	}
+	else
+		{
+		aBitmap = skinBitmap;
+		aMask = NULL;
+		}
+	bitmapFile.Close() ;
+	CleanupStack::PopAndDestroy(); // structure
+	}
+
+//  END OF FILE
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/brandingserver/bsclient/cbsaccess.h	Wed Nov 03 09:32:20 2010 +0530
@@ -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: cbsaccess.h
+*
+* Description: cbsaccess.h
+*
+*/
+
+
+#ifndef __CBSACCESS_H__
+#define __CBSACCESS_H__
+#include <e32std.h>
+#include "mbsaccess.h"
+#include "cbsclient.h"
+
+
+// Forward declarations
+class CFbsBitmap;
+
+/**
+ * 
+ */
+NONSHARABLE_CLASS( CBSAccess ): public CBase,
+								public MBSAccess
+    {
+	public:
+		/**
+		* Two-phased constructor.
+		*/
+		static CBSAccess* NewL( const TDesC8& aBrandId,
+								const TDesC8& aAppId,
+								const TDesC8& aDefaultBrandId,
+								TLanguage aLanguageId,
+        					  	TBool aCacheData,
+								TInt aReserved = 0 );
+
+		// destructor
+    	virtual ~CBSAccess();
+
+		/*
+		* Close
+		*/
+		void Close();
+
+	private:
+
+    	void ConstructL( const TDesC8& aBrandId, 
+    					 const TDesC8& aAppId, 
+    					 const TDesC8& aDefaultBrandId );
+		CBSAccess( TLanguage aLanguageId, TBool aCacheData, TInt aReserved = 0);
+
+
+	private: // from MBranding
+
+    	/*
+    	* Get text type item
+    	* @param aId ID of the item
+    	* @return the text item
+    	*/
+        HBufC* GetTextL( const TDesC8& aId );
+
+    	/*
+    	* Get text type item
+    	* @param aId ID of the item
+    	* @return the text item
+    	*/
+        HBufC* GetTextLC( const TDesC8& aId );
+
+    	/*
+    	* Get 8-bit data type item
+    	* @param aId ID of the item
+    	* @return the data buffer item
+    	*/
+        HBufC8* GetBufferL( const TDesC8& aId );
+
+    	/*
+    	* Get 8-bit data type item
+    	* @param aId ID of the item
+    	* @return the data buffer item
+    	*/
+        HBufC8* GetBufferLC( const TDesC8& aId );
+
+    	/*
+    	* Get integer type item
+    	* @param aId ID of the item
+    	* @return the integer item
+    	*/
+        TInt GetIntL( const TDesC8& aId );
+
+
+    	/*
+    	* Get an array of items
+    	* @param aIds ID's of the items
+    	* @return the items
+    	*/
+        MBSElement* GetSeveralL( MDesC8Array& aIds );
+
+    	/*
+    	* Get a file item
+    	* @param aId ID of the item
+    	* @param aFile on return will contain an open file handle
+    	*        to the file
+    	*/
+        void GetFileL( const TDesC8& aId, RFile& aFile );
+
+    	/*
+    	* Get a structure type item
+    	* @param aIds ID of the item
+    	* @param aFile on return will contain the strucure type item
+    	* @return structure branding element
+    	*/
+        MBSElement* GetStructureL( const TDesC8& aId );
+
+    	/*
+    	* Register to observer brand data updates
+    	* @param aObserver the observer interface
+    	*/
+        void RegisterObserverL( MBSBrandChangeObserver* aObserver, MBSBackupRestoreStateObserver *aBackupObserver );
+
+    	/*
+    	* Unregister a brand data update observer
+    	* @param aObserver the observer interface
+    	*/
+        void UnRegisterObserverL( MBSBrandChangeObserver* aObserver, MBSBackupRestoreStateObserver *aBackupObserver);
+
+    	/*
+    	* Get a bitmap type item
+    	* @param aBitmapId the ID of the bitmap item itself
+    	* @param aBitmap on return will contain the bitmap
+    	* @param aMask on return will contain the mask
+    	*/
+		void GetBitmapL( const TDesC8& aBitmapId,
+						 CFbsBitmap*& aBitmap,
+						 CFbsBitmap*& aMask );
+
+
+
+	TInt isBrandUpdateRequiredL ();
+
+		
+    public:     // New methods
+
+
+
+	private: // data
+		HBufC8* iBrand;
+		HBufC8* iDefaultBrand;
+		HBufC8* iAppId;
+		TLanguage iLanguageId;
+		TBool iUseCache;
+		RBSClient iClient;
+		TInt iReserved;
+    };
+
+#endif      //  __CBSACCESS_H__
+
+
+//  END OF FILE
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/brandingserver/bsclient/cbsbitmap.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,135 @@
+/*
+* Copyright (c) 2006-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: cbsbitmap.cpp
+*
+*/
+
+
+//  INCLUDE FILES
+
+#include "e32base.h"
+#include "cbsbitmap.h"
+
+// -----------------------------------------------------------------------------
+// CBSBitmap::NewLC
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CBSBitmap* CBSBitmap::NewLC( TInt aBitmapId,
+							TInt aBitmapMaskId,
+							TInt aSkinId,
+							TInt aSkinMaskId,
+							const TDesC8& aBitmapFileId )
+    {
+	CBSBitmap* self = new ( ELeave ) CBSBitmap( aBitmapId, aBitmapMaskId,
+												aSkinId, aSkinMaskId );
+    CleanupStack::PushL( self );
+    self->ConstructL( aBitmapFileId );
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CBSBitmap::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CBSBitmap* CBSBitmap::NewL( TInt aBitmapId,
+							TInt aBitmapMaskId,
+							TInt aSkinIdMajor,
+							TInt aSkinIdMinor,
+							const TDesC8& aBitmapFileId )
+    {
+    CBSBitmap* self = NewLC( aBitmapId,
+    						 aBitmapMaskId,
+    						 aSkinIdMajor,
+    						 aSkinIdMinor,
+    						 aBitmapFileId );
+    CleanupStack::Pop();
+    return self;
+    }
+
+
+// Symbian OS default constructor can leave.
+void CBSBitmap::ConstructL( const TDesC8& aBitmapFileId )
+    {
+	iBitmapFileId = aBitmapFileId.AllocL();
+    }
+
+// destructor
+CBSBitmap::~CBSBitmap()
+    {
+	delete iBitmapFileId;
+    }
+
+// C++ default constructor can NOT contain any code, that
+// might leave.
+//
+CBSBitmap::CBSBitmap( TInt aBitmapId,
+					  TInt aBitmapMaskId,
+					  TInt aSkinIdMajor,
+					  TInt aSkinIdMinor )
+: iBitmapId( aBitmapId), iBitmapMaskId( aBitmapMaskId ),
+  iSkinIdMajor( aSkinIdMajor ), iSkinIdMinor( aSkinIdMinor )
+	{
+	}
+
+
+// -----------------------------------------------------------------------------
+// CBSBitmap::BitmapId()
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt CBSBitmap::BitmapId() const
+	{
+	return iBitmapId;
+	}
+
+// -----------------------------------------------------------------------------
+// CBSBitmap::BitmapMaskId()
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt CBSBitmap::BitmapMaskId() const
+	{
+	return iBitmapMaskId;
+	}
+
+// -----------------------------------------------------------------------------
+// CBSBitmap::SkinId()
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt CBSBitmap::SkinIdMajor() const
+	{
+	return iSkinIdMajor;
+	}
+
+// -----------------------------------------------------------------------------
+// CBSBitmap::SkinMaskId()
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt CBSBitmap::SkinIdMinor() const
+	{
+	return iSkinIdMinor;
+	}
+
+// -----------------------------------------------------------------------------
+// CBSBitmap::BitmapFileId()
+// -----------------------------------------------------------------------------
+//
+EXPORT_C const TDesC8& CBSBitmap::BitmapFileId() const
+	{
+	return *iBitmapFileId;
+	}
+
+
+
+//  END OF FILE
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/brandingserver/bsclient/cbsbrandobserver.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,98 @@
+/*
+* 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: cbsbrandobserver.cpp
+*
+*/
+//  INCLUDE FILES
+
+#include "cbsbrandobserver.h"
+#include <mbsbrandchangeobserver.h>
+#include <mbsbackuprestorestateobserver.h>
+#include "mbsbrandobserverregistrar.h"
+
+CBSBrandObserver* CBSBrandObserver::NewL( MBSBrandChangeObserver* aObserver,
+										  MBSBackupRestoreStateObserver* aBackupObserver,
+									   	  MBSBrandObserverRegistrar* aRegistrar )
+    {
+	CBSBrandObserver* self = new ( ELeave ) CBSBrandObserver( aObserver, aBackupObserver, aRegistrar ) ;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );  //self
+    return self;
+    }
+
+
+void CBSBrandObserver::ConstructL()
+    {
+    iContinueBackupStateObserving = ETrue ;
+    iContinueDataUpdateObserving = ETrue ;
+    
+	CActiveScheduler::Add( this );
+	iRegistrar->RegisterObserverToServerL( iStatus );
+	SetActive();
+    }
+
+
+CBSBrandObserver::~CBSBrandObserver()
+    {
+    Cancel();
+    }
+
+
+CBSBrandObserver::CBSBrandObserver( MBSBrandChangeObserver* aObserver,
+									MBSBackupRestoreStateObserver* aBackupObserver,
+									MBSBrandObserverRegistrar* aRegistrar )
+: CActive( CActive::EPriorityIdle ), iObserver( aObserver ), iBackupObserver( aBackupObserver ),
+									 iRegistrar( aRegistrar )
+	{
+	}
+
+void CBSBrandObserver::RunL()
+	{
+	
+	// Pankaj - chk for what has changed..
+	TInt isBackupRestore = iRegistrar->GetBackupRestoreL() ;
+	if(isBackupRestore)
+		{
+		// if client donot want to listen backup state event any more donot call its observer..
+		if(iBackupObserver && iContinueBackupStateObserving)
+			{
+			TInt activeState = iRegistrar->GetBackupStateL() ;
+			iContinueBackupStateObserving = iBackupObserver->BackupRestoreActivated(activeState) ;
+			}
+		}
+	else
+		{
+		// if client donot want to listen update data event any more donot call its observer..
+		if(iObserver && iContinueDataUpdateObserving)
+			{
+			TInt newVersion = iRegistrar->GetNewVersionL();
+			iContinueDataUpdateObserving = iObserver->BrandUpdateAvailable( newVersion ) ;
+			}
+		}
+		
+	if(iContinueBackupStateObserving || iContinueDataUpdateObserving)
+		{
+		iRegistrar->RegisterObserverToServerL( iStatus );
+		SetActive();
+		}
+	}
+	
+void CBSBrandObserver::DoCancel()
+	{
+	
+	}
+
+
+//  END OF FILE
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/brandingserver/bsclient/cbsbrandobserver.h	Wed Nov 03 09:32:20 2010 +0530
@@ -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: CBSBrandObserver.h
+*
+*/
+
+
+#ifndef __CBSBRANDOBSERVER_H__
+#define __CBSBRANDOBSERVER_H__
+#include <e32std.h>
+#include <e32base.h>
+
+class MBSBrandChangeObserver;
+class MBSBackupRestoreStateObserver;
+class MBSBrandObserverRegistrar;
+
+/**
+ *
+ */
+NONSHARABLE_CLASS( CBSBrandObserver ): public CActive
+    {
+	public:
+		/**
+		* Two-phased constructor.
+		*/
+		static CBSBrandObserver* NewL( MBSBrandChangeObserver* aObserver,
+									   MBSBackupRestoreStateObserver* aBackupObserver,	
+									   MBSBrandObserverRegistrar* aRegistrar );
+
+    	virtual ~CBSBrandObserver();
+
+    public: // From CActive
+
+        void RunL();   
+		void DoCancel();
+
+	private:
+		CBSBrandObserver( MBSBrandChangeObserver* aObserver,
+						  MBSBackupRestoreStateObserver* aBackupObserver,	
+						  MBSBrandObserverRegistrar* aRegistrar );
+
+
+    	void ConstructL();
+
+	private:
+
+
+	private: // data
+	
+		// doesn't own: observer
+		MBSBrandChangeObserver* iObserver ;
+		
+		// doesn't own: observer
+		MBSBackupRestoreStateObserver* iBackupObserver ;
+		
+		// doesn't own: registrar
+		MBSBrandObserverRegistrar* iRegistrar;
+		
+		TBool iContinueBackupStateObserving ;
+		TBool iContinueDataUpdateObserving ;
+    };
+
+#endif      //  __CBSBRANDOBSERVER_H__
+
+
+//  END OF FILE
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/brandingserver/bsclient/cbsclient.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,753 @@
+/*
+* 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: CBSClient.cpp
+*
+*/
+
+
+//  INCLUDE FILES
+#include "cbsclient.h"
+#include "bsclientdefs.h"
+#include "bsprocessstarter.h"
+#include "bsserverdefs.h"
+#include "mbselement.h"
+#include "bselementfactory.h"
+#include "cbsbitmap.h"
+#include "cbsbrandobserver.h"
+#include <e32base.h>
+#include <s32mem.h>
+#include "debugtrace.h"
+
+// ==============================================================
+// ======================== CLIENT ==============================
+// ==============================================================
+
+// Destructor
+RBSClient::~RBSClient()
+    {
+#if _BullseyeCoverage
+    cov_write();
+#endif
+    }
+
+// C++ default constructor can NOT contain any code, that
+// might leave.
+//
+RBSClient::RBSClient()
+    {
+    }
+
+
+// -----------------------------------------------------------------------------
+// RBSClient::Connect()
+// -----------------------------------------------------------------------------
+//
+TInt RBSClient::Connect()
+    {
+    TRACE( T_LIT("RBSClient::Connect() begin") );
+    TFileName fullExePath;
+    BSProcessStarter::FullExePathForClienLocation( KBSServerExe,
+                                                 fullExePath );
+
+    return BSProcessStarter::ConnectToServer( fullExePath,
+                                            KNullDesC,
+                                            NULL,
+                                            *this,
+                                            KBSServerName,
+                                            TVersion( KBSVersionMajor,
+                                                      KBSVersionMinor,
+                                                      KBSVersionBuild ),
+                                            KBSMsgSlotCount );
+    }
+
+
+// -----------------------------------------------------------------------------
+// RBSClient::Close()
+// -----------------------------------------------------------------------------
+//
+void RBSClient::Close()
+    {
+    TRACE( T_LIT("RBSClient::Close() begin") );
+    RSessionBase::Close();
+    }
+
+
+// -----------------------------------------------------------------------------
+// RBSClient::Close()
+// -----------------------------------------------------------------------------
+//
+void RBSClient::StartTransactionL(  const TDesC8& aApplicationId,
+        				  const TDesC8& aBrandId,
+        				  const TDesC8& aDefaultBrandId,
+        				  TLanguage aLanguage,
+        				  TTransactionType aType,
+        				  TInt aReserved )
+	{
+	TRACE( T_LIT("RBSClient::StartTransactionL() begin") );
+	InitClientL( aApplicationId, aBrandId, aDefaultBrandId, 
+				 aLanguage, aType, aReserved );
+	}
+
+// -----------------------------------------------------------------------------
+// RBSClient::Close()
+// -----------------------------------------------------------------------------
+//
+TInt RBSClient::StopTransactionL( const TDesC8& /*aApplicationId*/,
+        				  const TDesC8& /*aBrandId*/,
+        				  TLanguage /*aLanguage*/,
+        				  TInt /*aReserved*/ )
+	{
+	TRACE( T_LIT("RBSClient::StopTransactionL() begin") );
+	TInt returnValue = 0;
+    TPckg<TInt> pack( returnValue );
+    TIpcArgs args( &pack );
+    TInt err = SendReceive( EBSStopTransaction, args );
+    User::LeaveIfError( err );
+	return returnValue;
+	}
+
+// -----------------------------------------------------------------------------
+// RBSClient::Close()
+// -----------------------------------------------------------------------------
+//
+void RBSClient::CancelTransactionL( const TDesC8& aApplicationId,
+        				  const TDesC8& aBrandId,
+        				  TLanguage aLanguage,
+        				  TInt aReserved )
+	{
+	TIpcArgs args = CreateArgumentsL( aApplicationId, aBrandId,
+					  				  aLanguage, aReserved );
+					  				  
+	TInt err = SendReceive( EBSCancelTransaction, args );
+	User::LeaveIfError( err );
+	}
+
+// -----------------------------------------------------------------------------
+// RBSClient::InitClientL()
+// -----------------------------------------------------------------------------
+//
+void RBSClient::InitClientL( const TDesC8& aApplicationId,
+        				  const TDesC8& aBrandId,
+        				  const TDesC8& aDefaultBrandId,
+        				  TLanguage aLanguage,
+        				  TTransactionType aType,
+        				  TInt aReserved )
+	{
+	TRACE( T_LIT("RBSClient::InitClientL() begin aAppId[%S],aBrandId[%S],TAType[%d]"),&aApplicationId,&aBrandId,aType );
+	CBufFlat* flatBuf = CBufFlat::NewL( aDefaultBrandId.Length() + aBrandId.Length() + 2 );
+	CleanupStack::PushL( flatBuf );
+
+ 	RBufWriteStream stream;
+	CleanupClosePushL( stream );
+	stream.Open( *flatBuf );
+	stream.WriteInt16L( aBrandId.Length() );
+	stream.WriteL( aBrandId );
+	stream.WriteInt16L( aDefaultBrandId.Length() );
+	stream.WriteL( aDefaultBrandId );
+
+    TPtr8 ptrElement( flatBuf->Ptr(0) );
+
+	// set the arguments for the message
+	TIpcArgs args(  &aApplicationId );
+    args.Set( 1,  &ptrElement );
+    args.Set( 2, aLanguage );
+    args.Set( 3, aReserved );
+    
+	TInt operation = 0;
+	switch( aType )
+		{
+		case EBSTxInstall:
+			{
+			operation = EBSInitInstall;
+			break;
+			}
+		case EBSTxUninstall:
+			{
+			operation = EBSInitUninstall;
+			break;
+			}
+		case EBSTxAppend:
+			{
+			operation = EBSInitAppend;
+			break;
+			}
+		case EBSTxReplace:
+			{
+			operation = EBSInitReplace;
+			break;
+			}
+		case EBSTxAccess:
+			{
+			operation = EBSInitAccess;
+			break;
+			}
+		default:
+			{
+			User::Leave( KErrArgument );
+			break;
+			}
+		}		
+	TInt err = SendReceive( operation, args );
+	TRACE( T_LIT("RBSClient::InitClientL() 1st SendReceive err=%d"),err );
+	CleanupStack::PopAndDestroy( 2, flatBuf ); // stream, flatBuf
+	
+	User::LeaveIfError( err );
+
+	User::LeaveIfError( SendReceive( EBSStartTransaction ) );
+	TRACE( T_LIT("RBSClient::InitClientL() end") );
+	}
+   
+// -----------------------------------------------------------------------------
+// RBSClient::CreateArgumentsL()
+// -----------------------------------------------------------------------------
+//
+TIpcArgs RBSClient::CreateArgumentsL( const TDesC8& aApplicationId,
+        				  const TDesC8& aBrandId,
+        				  TLanguage aLanguage,
+        				  TInt aReserved )
+	{
+	// set the arguments for the message
+	TIpcArgs args(  &aApplicationId );
+    args.Set( 1,  &aBrandId );
+    args.Set( 2, aLanguage );
+    args.Set( 3, aReserved );
+    
+    return args;
+	}
+
+
+// -----------------------------------------------------------------------------
+// RBSClient::InsertL()
+// -----------------------------------------------------------------------------
+//
+void RBSClient::InsertL( MBSElement* aElement )
+	{
+	SendUpdateL( aElement, EBSInstall );
+	}
+
+
+// -----------------------------------------------------------------------------
+// RBSClient::ReplaceL()
+// -----------------------------------------------------------------------------
+//
+void RBSClient::ReplaceL( MBSElement* aElement )
+	{
+	SendUpdateL( aElement, EBSReplace );
+	}
+	
+// -----------------------------------------------------------------------------
+// RBSClient::AppendL()
+// -----------------------------------------------------------------------------
+//
+void RBSClient::AppendL( MBSElement* aElement )
+	{
+	SendUpdateL( aElement, EBSAppend );
+	}
+
+// -----------------------------------------------------------------------------
+// RBSClient::SendUpdateL()
+// -----------------------------------------------------------------------------
+//
+void RBSClient::SendUpdateL( MBSElement* aElement, TBSMessages aMessage )
+	{
+	// FIXME magic number
+	CBufFlat* flatBuf = CBufFlat::NewL( 128 );
+	CleanupStack::PushL( flatBuf );
+
+ 	RBufWriteStream elementStream;
+	CleanupClosePushL( elementStream );
+	elementStream.Open( *flatBuf );
+
+	aElement->ExternalizeL( elementStream );
+
+    TPtr8 ptrElement( flatBuf->Ptr(0) );
+	TIpcArgs args( &ptrElement );
+	
+	TInt err = SendReceive( aMessage, args );
+
+	CleanupStack::PopAndDestroy(); // elementStream
+	CleanupStack::PopAndDestroy( flatBuf );
+	User::LeaveIfError( err );
+	}
+
+// -----------------------------------------------------------------------------
+// RBSClient::GetTextL()
+// -----------------------------------------------------------------------------
+//
+void RBSClient::GetTextL( const TDesC8& aId, HBufC*& aValue )
+    {
+	TInt size = 0;
+    TPckg<TInt> pack( size );
+    
+	TIpcArgs args( &aId );
+	args.Set( 1, &pack );
+    TInt err = SendReceive( EBSPrepareText, args );
+    User::LeaveIfError( err );
+    
+	aValue = HBufC::NewL( size );
+	TPtr ptrBuf( aValue->Des() );
+
+    args.Set( 2, &ptrBuf );    
+    err = SendReceive( EBSGetText, args );
+    
+    if( err )
+    	{
+    	delete aValue;
+    	aValue = NULL;
+    	User::Leave( err );
+    	}
+    }
+
+// -----------------------------------------------------------------------------
+// RBSClient::GetIntL()
+// -----------------------------------------------------------------------------
+//
+void RBSClient::GetIntL( const TDesC8& aId, TInt& aValue )
+    {
+    TPckg<TInt> pack( aValue );
+    TIpcArgs args( &aId);
+    args.Set( 1, &pack );
+    TInt err = SendReceive( EBSGetInt, args );
+    User::LeaveIfError( err );
+    }
+
+void RBSClient :: isBrandUpdateRequiredL (TInt & aUpdateRequired)
+{
+	//TIpcArgs args;
+
+    TPckg<TInt> pack (aUpdateRequired);
+	//args.Set (0, &pack);
+	TInt err = SendReceive (EBSIsBrandUpdateRequired, TIpcArgs (&pack));
+
+	User :: LeaveIfError (err);
+}
+// -----------------------------------------------------------------------------
+// RBSClient::GetTextL()
+// -----------------------------------------------------------------------------
+//
+void RBSClient::GetBufferL( const TDesC8& aId, HBufC8*& aValue )
+    {
+	TInt size = 0;
+    TPckg<TInt> pack( size );
+    
+	TIpcArgs args( &aId );
+	args.Set( 1, &pack );
+    TInt err = SendReceive( EBSPrepareBuffer, args );
+    User::LeaveIfError( err );
+    
+	aValue = HBufC8::NewL( size );
+	TPtr8 ptrBuf( aValue->Des() );
+
+    args.Set( 2, &ptrBuf );    
+    err = SendReceive( EBSGetBuffer, args );
+    
+    if( err )
+    	{
+    	delete aValue;
+    	aValue = NULL;
+    	User::Leave( err );
+    	}
+    }
+
+// -----------------------------------------------------------------------------
+// RBSClient::GetSeveralL()
+// -----------------------------------------------------------------------------
+//
+MBSElement* RBSClient::GetSeveralL( MDesC8Array& aIds )
+	{
+	TInt size = 0;
+
+    TPckg<TInt> pack( size );
+    TIpcArgs args;
+    args.Set( 0, &pack );
+
+
+	// FIXME magic number
+	CBufFlat* flatBuf = CBufFlat::NewL( 128 );
+	CleanupStack::PushL( flatBuf );
+
+ 	RBufWriteStream idStream;
+	CleanupClosePushL( idStream );
+	idStream.Open( *flatBuf );
+
+	ExternalizeIdArrayL( idStream, aIds );
+	
+	TPtr8 flatPtr = flatBuf->Ptr(0);
+	args.Set( 1, &flatPtr );
+	// get the size of the data
+	TInt err = SendReceive( EBSPrepareSeveral, args );
+
+	CleanupStack::PopAndDestroy(); // idStream
+	CleanupStack::PopAndDestroy( flatBuf );
+	User::LeaveIfError( err );
+
+    HBufC8* buf = HBufC8::NewLC( size );
+    TPtr8 ptrBuf( buf->Des() );
+
+    TIpcArgs msgArgs;
+    msgArgs.Set( 0, &ptrBuf );
+
+	err = SendReceive( EBSGetSeveral, msgArgs );
+
+	TInt length = buf->Size();
+
+	RDesReadStream readStream;
+	CleanupClosePushL( readStream );
+	readStream.Open( *buf );
+
+	MBSElement* returnValue = InternalizeElementL( readStream );
+	
+	CleanupStack::PopAndDestroy(); // readStream
+	CleanupStack::PopAndDestroy( buf ); // buf
+
+	User::LeaveIfError( err );
+	return returnValue;
+	}
+
+
+// -----------------------------------------------------------------------------
+// RBSClient::GetFileL()
+// -----------------------------------------------------------------------------
+//
+void RBSClient::GetFileL( const TDesC8& aId, RFile& aFile )
+	{
+	TInt fsh;
+
+	TPckgBuf<TInt> fh;
+
+	TIpcArgs args( &fh );
+	args.Set( 2, &aId );
+
+	fsh = SendReceive( EBSGetFile, args );
+	TInt err = aFile.AdoptFromServer( fsh, fh() );
+
+	User::LeaveIfError( err );
+	}
+
+// -----------------------------------------------------------------------------
+// RBSClient::GetStructureL()
+// -----------------------------------------------------------------------------
+//
+MBSElement* RBSClient::GetStructureL( const TDesC8& aId )
+	{
+	TInt size = 0;
+
+    TPckg<TInt> pack( size );
+    TIpcArgs args;
+    args.Set( 0, &pack );
+
+	args.Set( 1, &aId );
+	// get the size of the data
+	TInt err = SendReceive( EBSPrepareStructure, args );
+
+	User::LeaveIfError( err );
+
+
+    HBufC8* buf = HBufC8::NewLC( size );
+    TPtr8 ptrBuf( buf->Des() );
+
+    TIpcArgs msgArgs;
+    msgArgs.Set( 0, &ptrBuf );
+
+	err = SendReceive( EBSGetStructure, msgArgs );
+
+	TInt length = buf->Size();
+
+	RDesReadStream readStream;
+	CleanupClosePushL( readStream );
+	readStream.Open( *buf );
+
+	MBSElement* returnValue = InternalizeElementL( readStream );
+	CleanupStack::PopAndDestroy(); // readStream
+	CleanupStack::PopAndDestroy( buf ); // buf
+
+	User::LeaveIfError( err );
+
+	return returnValue;
+	}
+
+// -----------------------------------------------------------------------------
+// RBSClient::InternalizeElementL()
+// -----------------------------------------------------------------------------
+//
+MBSElement* RBSClient::InternalizeElementL( RReadStream& aStream )
+    {
+    MBSElement* returnValue= NULL;
+    // Write common header for all elements
+    TBSElementType type = (TBSElementType)aStream.ReadInt16L();
+    
+    TInt idSize = aStream.ReadInt16L();
+
+	HBufC8* elementId = HBufC8::NewLC( idSize );
+	TPtr8 elementIdPtr = elementId->Des();
+
+    if( idSize > 0 )
+        {
+        // read ID only if it's defined
+        aStream.ReadL( elementIdPtr, idSize );
+        elementIdPtr.SetLength( idSize );// Set length
+        }
+        
+// Ptr() returns a pointer to the start address of decriptor data,
+// TPtrC constructor then parses the data until null terminator met.
+// This results in wrong descriptor length & bad data!
+// Solution is either 
+// 1) to use PtrZ() which appends a zero terminator,
+// or 2) pass to constructor an object that has length data.
+// Option 2) is less prone to errors, so use it.
+// In general, assignment operator with descriptors should be avoided!
+// So use TPtrC16(const TDesC16 &aDes) instead 
+// of TPtrC16(const TUint16 *aString)!
+    TPtrC8 idPtrC( *elementId );//idPtrC creation moved here so it will be updated correctly.
+
+	if( elementId->Length() == 0 )
+		{
+		CleanupStack::PopAndDestroy( elementId );
+		elementId = NULL;
+		idPtrC.Set( KNullDesC8 );
+		}
+		
+    // Write element type specific data
+    switch( type )
+        {
+        case EBSInt:
+            {
+            TInt intData = aStream.ReadInt16L();
+			returnValue = BSElementFactory::CreateBSElementL( idPtrC,
+															  EBSInt,
+															  intData );					
+
+            break;
+            }
+        case EBSText:     // flowthrough
+        case EBSFile:
+            {
+			TInt textSize = aStream.ReadInt16L();
+			HBufC* textData = HBufC::NewLC( textSize );
+
+			TPtr textPtr = textData->Des();
+			aStream.ReadL( textPtr, textSize );
+			
+			returnValue = BSElementFactory::CreateBSElementL( idPtrC, 
+															  type,
+															  *textData );
+			CleanupStack::PopAndDestroy( textData );
+            break;
+            }
+        case EBSList:
+            {
+			RBSObjOwningPtrArray<MBSElement> listData;
+			CleanupClosePushL( listData );
+			TInt count = aStream.ReadInt16L();
+			
+			for( TInt i = 0; i < count; i++ )
+				{
+				MBSElement* subElement = InternalizeElementL( aStream );
+				CleanupClosePushL( *subElement );
+				listData.AppendL( subElement );
+				CleanupStack::Pop(); // subElement
+				}
+
+			returnValue = BSElementFactory::CreateBSElementL( idPtrC, 
+															  EBSList,
+															  listData );
+
+			CleanupStack::Pop(); // listData
+
+            break;
+            }
+
+        case EBSBuffer:
+        	{
+			TInt bufferSize = aStream.ReadInt16L();
+			HBufC8* buffeData = HBufC8::NewLC( bufferSize );
+
+			TPtr8 bufferPtr = buffeData->Des();
+			aStream.ReadL( bufferPtr, bufferSize );
+
+			returnValue = BSElementFactory::CreateBSElementL( idPtrC, 
+															  EBSBuffer,
+															  *buffeData );
+
+			CleanupStack::PopAndDestroy( buffeData );
+        	break;
+        	}
+
+        case EBSBitmap:
+            {
+			TInt length = aStream.ReadInt16L();
+			HBufC8* fileId = HBufC8::NewLC( length );
+			
+			TPtr8 fileIdPtr = fileId->Des();
+			aStream.ReadL( fileIdPtr, length );
+			
+			TInt bitmapId = aStream.ReadInt16L();
+			TInt maskId = aStream.ReadInt16L();
+			TInt skinId = aStream.ReadInt16L();
+			TInt skinMaskId = aStream.ReadInt16L();
+
+			CBSBitmap* bitmap = CBSBitmap::NewLC( bitmapId,
+												  maskId,
+												  skinId,
+												  skinMaskId,
+												  fileIdPtr );
+												  
+			returnValue = BSElementFactory::CreateBSElementL( idPtrC, 
+															  EBSBitmap,
+															  bitmap );
+			CleanupStack::Pop( bitmap ); // bitmap
+			CleanupStack::PopAndDestroy( fileId ); // bitmap
+			
+            break;
+            }
+
+        default:
+            {
+            // unknown type!
+            User::Leave( KErrCorrupt );
+            break;
+            }
+        }
+        
+	if( elementId )
+		{
+		CleanupStack::PopAndDestroy( elementId );
+		}
+        
+	return returnValue;
+    }
+    
+    
+// -----------------------------------------------------------------------------
+// RBSClient::InternalizeElementL()
+// -----------------------------------------------------------------------------
+//
+void RBSClient::ExternalizeIdArrayL( RWriteStream& aStream, MDesC8Array& aArray )
+	{
+	TInt count = aArray.MdcaCount();
+	aStream.WriteInt16L( count );
+	
+	for( TInt i = 0; i < count; i++ )
+		{
+		TPtrC8 ptr = aArray.MdcaPoint(i);
+		aStream.WriteInt16L( aArray.MdcaPoint( i ).Length() );
+		aStream.WriteL( aArray.MdcaPoint( i ) );
+		}
+	
+	}
+
+// -----------------------------------------------------------------------------
+// RBSClient::RemoveBrandL()
+// -----------------------------------------------------------------------------
+//
+void RBSClient::RemoveBrandL( const TDesC8& aApplicationId,
+								   const TDesC8& aBrandId )
+	{
+	// set the arguments for the message
+	TIpcArgs args(  &aApplicationId );
+	args.Set( 1, &aBrandId );
+	TInt err = SendReceive( EBSRemoveBrand, args );
+	User::LeaveIfError( err );
+	}
+
+// -----------------------------------------------------------------------------
+// RBSClient::RemoveBrandsL()
+// -----------------------------------------------------------------------------
+//
+void RBSClient::RemoveBrandsL( const TDesC8& aApplicationId )
+	{
+	// set the arguments for the message
+	TIpcArgs args(  &aApplicationId );
+		
+	TInt err = SendReceive( EBSRemoveApplication, args );
+	User::LeaveIfError( err );
+	}
+
+// -----------------------------------------------------------------------------
+// RBSClient::RegisterObserverL()
+// -----------------------------------------------------------------------------
+//
+void RBSClient::RegisterObserverL( MBSBrandChangeObserver* aObserver, MBSBackupRestoreStateObserver* aBackupStateObserver )
+	{
+	CBSBrandObserver* tempObserver = CBSBrandObserver::NewL( aObserver, aBackupStateObserver, this );
+	if( iObserver )
+		{
+		delete iObserver;
+		}
+	iObserver = tempObserver;
+	}
+
+// -----------------------------------------------------------------------------
+// RBSClient::UnRegisterObserverL()
+// -----------------------------------------------------------------------------
+//
+void RBSClient::UnRegisterObserverL( MBSBrandChangeObserver* /*aObserver*/, MBSBackupRestoreStateObserver* /*aBackupStateObserver*/ )
+	{
+	delete iObserver;
+	iObserver = NULL;
+	}
+
+// -----------------------------------------------------------------------------
+// RBSClient::UnRegisterObserverL()
+// -----------------------------------------------------------------------------
+//
+void RBSClient::RegisterObserverToServerL( TRequestStatus& aStatus )
+	{
+	TIpcArgs args;
+	SendReceive( EBSObserveBrand, args, aStatus );
+	}
+
+// -----------------------------------------------------------------------------
+// RBSClient::GetNewVersionL()
+// -----------------------------------------------------------------------------
+//
+TInt RBSClient::GetNewVersionL()
+	{
+    return GetValueL( EBSObserveGetNewVersion);
+	}
+
+// -----------------------------------------------------------------------------
+// RBSClient::GetValueL()
+// -----------------------------------------------------------------------------
+//
+TInt RBSClient::GetValueL(TInt msg)
+	{
+	TInt returnValue = 0;
+    TPckg<TInt> pack( returnValue );
+    TIpcArgs args( &pack );
+    TInt err = SendReceive( msg, args );
+    User::LeaveIfError( err );	
+    return returnValue;
+	}
+
+// -----------------------------------------------------------------------------
+// RBSClient::GetBackupStateL()
+// -----------------------------------------------------------------------------
+//
+TInt RBSClient::GetBackupStateL()	
+	{
+    return GetValueL( EBSObserveGetBackupState);
+	}
+
+// -----------------------------------------------------------------------------
+// RBSClient::GetBackupRestoreL()
+// -----------------------------------------------------------------------------
+//
+TInt RBSClient::GetBackupRestoreL()	
+	{
+    return GetValueL( EBSObserveGetChange);
+	}
+
+//  END OF FILE
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/brandingserver/bsclient/cbsclient.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,143 @@
+/*
+* 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: CBSClient.h
+*
+*/
+
+
+#ifndef __CBSCLIENT_H__
+#define __CBSCLIENT_H__
+#include <e32std.h>
+#include <f32file.h>
+#include <bamdesca.h>
+#include <s32mem.h>
+#include "mbsupdater.h"
+#include "bsserverdefs.h"
+#include "mbsbrandobserverregistrar.h"
+
+class MBSElement;
+class MBSBrandChangeObserver;
+class MBSBackupRestoreStateObserver;
+class CBSBrandObserver;
+
+/**
+ * Simple ClientServer for
+ * testing and example purposes.
+ */
+class RBSClient : public RSessionBase,
+				  public MBSBrandObserverRegistrar
+    {
+    
+    public:     // Constructor and destructor
+        RBSClient();
+        ~RBSClient();
+
+
+    public:     // New methods
+
+        TInt Connect();
+        void Close();
+        
+		void StartTransactionL( const TDesC8& aApplicationId,
+        				  const TDesC8& aBrandId,
+        				  const TDesC8& aDefaultBrandId,
+        				  TLanguage aLanguage,
+        				  TTransactionType aType,
+						  TInt aReserved = 0 );
+        
+        TInt StopTransactionL( const TDesC8& aApplicationId,
+        				  const TDesC8& aBrandId,
+        				  TLanguage aLanguage,
+        				  TInt aReserved = 0 );
+        
+        void CancelTransactionL( const TDesC8& aApplicationId,
+        				  const TDesC8& aBrandId,
+        				  TLanguage aLanguage,
+        				  TInt aReserved = 0);
+        
+        void InsertL( MBSElement* aElement );
+        void ReplaceL( MBSElement* aElement );
+        void AppendL( MBSElement* aElement );
+        
+        void GetTextL( const TDesC8& aId, HBufC*& aValue );
+        void GetBufferL( const TDesC8& aId, HBufC8*& aValue );
+        void GetIntL( const TDesC8& aId, TInt& aValue );
+
+        MBSElement* GetSeveralL( MDesC8Array& aIds );
+		MBSElement* GetStructureL( const TDesC8& aId );
+		void GetFileL( const TDesC8& aId, RFile& aFile );
+		
+		void RemoveBrandL( const TDesC8& aApplicationId,
+								   const TDesC8& aBrandId );
+
+		void RemoveBrandsL( const TDesC8& aApplicationId );
+
+		void isBrandUpdateRequiredL (TInt& aUpdateRequired);
+
+    	/*
+    	* Register to observer brand data updates
+    	* @param aObserver the observer interface
+    	*/
+        void RegisterObserverL( MBSBrandChangeObserver* aObserver, MBSBackupRestoreStateObserver* aBackupStateObserver);
+
+    	/*
+    	* Unregister a brand data update observer
+    	* @param aObserver the observer interface
+    	*/
+        void UnRegisterObserverL( MBSBrandChangeObserver* aObserver, MBSBackupRestoreStateObserver* aBackupStateObserver );
+
+
+	private:
+
+        void InitClientL( const TDesC8& aApplicationId,
+        				  const TDesC8& aBrandId,
+        				  const TDesC8& aDefaultBrandId,
+        				  TLanguage aLanguage,
+        				  TTransactionType aType,
+        				  TInt aReserved );
+        				  
+		TIpcArgs CreateArgumentsL( const TDesC8& aApplicationId,
+        				  const TDesC8& aBrandId,
+        				  TLanguage aLanguage,
+        				  TInt aReserved );
+
+        MBSElement* InternalizeElementL( RReadStream& aStream );
+        
+        void ExternalizeIdArrayL( RWriteStream& aStream, MDesC8Array& aArray );
+	
+		void SendUpdateL( MBSElement* aElement, TBSMessages aMessage );
+		
+	private: // from MBSBrandObserverRegistrar
+		/*
+    	* Registeres the brand observer to server
+    	*/
+        void RegisterObserverToServerL( TRequestStatus& aStatus );
+        
+        TInt GetNewVersionL();
+        TInt GetValueL(TInt msg) ;
+        TInt GetBackupStateL() ;
+        TInt GetBackupRestoreL() ;
+        
+        
+	private:
+		TTransactionType iType;
+		CBSBrandObserver* iObserver;
+		TInt isUpdateRequired;
+    };
+
+#endif      //  __CBSCLIENT_H__
+
+
+//  END OF FILE
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/brandingserver/bsclient/cbselement.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,343 @@
+/*
+* 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: cbselement.cpp
+*
+*/
+//  INCLUDE FILES
+
+#include <utf.h>
+#include "e32base.h"
+#include "s32strm.h"
+#include "cbselement.h"
+#include "cbsbitmap.h"
+
+
+CBSElement* CBSElement::NewL(
+						const TDesC8& aElementId,
+						TInt aData )
+    {
+
+	CBSElement* self = new ( ELeave ) CBSElement() ;
+    CleanupStack::PushL( self );
+    self->ConstructL( EBSInt,
+    				  aElementId,
+    				  aData,
+    				  ETrue,
+    				  NULL,
+    				  KNullDesC,
+    				  KNullDesC8,
+    				  NULL );
+    CleanupStack::Pop( self );  //self
+    return self;
+    }
+
+
+CBSElement* CBSElement::NewL(
+						const TDesC8& aElementId,
+						const TDesC& aData,
+						TBSElementType aType /*= EText*/ )
+    {
+    if( aType != EBSFile && aType != EBSText )
+        {
+        User::Leave( KErrArgument );
+        }
+
+    CBSElement* self = new ( ELeave ) CBSElement() ;
+    CleanupStack::PushL( self );
+    self->ConstructL( aType,
+    				  aElementId,
+    				  0,
+    				  EFalse,
+    				  NULL,
+    				  aData,
+    				  KNullDesC8,
+    				  NULL);
+    CleanupStack::Pop( self );  //self
+    return self;
+    }
+
+
+CBSElement* CBSElement::NewL(
+						const TDesC8& aElementId,
+						const TDesC8& aData )
+    {
+    CBSElement* self = new ( ELeave ) CBSElement() ;
+    CleanupStack::PushL( self );
+    self->ConstructL( EBSBuffer,
+    				  aElementId,
+    				  0,
+    				  EFalse,
+    				  NULL,
+    				  KNullDesC,
+    				  aData,
+    				  NULL);
+    CleanupStack::Pop( self );  //self
+    return self;
+    }
+
+CBSElement* CBSElement::NewL(
+						const TDesC8& aElementId,
+						RBSObjOwningPtrArray<MBSElement>& aStructure )
+    {
+    CBSElement* self = new ( ELeave ) CBSElement();
+    CleanupStack::PushL( self );
+    self->ConstructL( EBSList,
+    				  aElementId,
+    				  0,
+    				  EFalse,
+    				  NULL,
+    				  KNullDesC,
+    				  KNullDesC8,
+    				  &aStructure );
+    CleanupStack::Pop( self );  //self
+    return self;
+    }
+
+CBSElement* CBSElement::NewL(
+    					const TDesC8& aElementId,
+    					CBSBitmap* aBitmap )
+    {
+    CBSElement* self = new ( ELeave ) CBSElement() ;
+    CleanupStack::PushL( self );
+    self->ConstructL( EBSBitmap,
+    				  aElementId,
+    				  0,
+    				  EFalse,
+    				  aBitmap,
+    				  KNullDesC,
+    				  KNullDesC8,
+    				  NULL );
+
+	if( !aBitmap )
+		{
+		User::Leave( KErrArgument );
+		}
+
+    CleanupStack::Pop( self );  //self
+    return self;
+    }
+
+void CBSElement::ConstructL(
+						 TBSElementType aElementType,
+					 	 const TDesC8& aElementId,
+					 	 TInt aIntData,
+					 	 TBool aIntDataInitialized,
+					 	 CBSBitmap* aBitmap,
+					 	 const TDesC& aTextData,
+					 	 const TDesC8& aBufferData,
+					 	 RBSObjOwningPtrArray<MBSElement>* aStructure )
+    {
+	iElementType = aElementType;
+
+	iElementId = aElementId.AllocL();
+
+	iIntData = aIntData;
+	iIntDataInitialized = aIntDataInitialized;
+
+	iBitmapData = aBitmap;
+
+	if( 0 != aTextData.Compare( KNullDesC() ) )
+		{
+		iTextData = aTextData.AllocL();
+		}
+	if( 0 != aBufferData.Compare( KNullDesC8() ) )
+		{
+		iBufferData = aBufferData.AllocL();
+		}
+	if( aStructure )
+		{
+		iArrayInitialized = ETrue;
+		iArray = *aStructure;
+		}
+    }
+
+
+CBSElement::~CBSElement()
+    {
+	delete iTextData;
+	delete iBufferData;
+	delete iElementId;
+
+	iArray.Close();
+	delete iBitmapData;
+    }
+
+
+CBSElement::CBSElement()
+	{
+	}
+
+void CBSElement::Close()
+	{
+	delete this;
+	}
+	
+	
+TBSElementType CBSElement::ElementType()
+	{
+	return iElementType;
+	}
+
+const TDesC8& CBSElement::ElementId()
+	{
+	return *iElementId;
+	}
+
+TInt CBSElement::IntDataL()
+	{
+	if( !iIntDataInitialized )
+		{
+		User::Leave( KErrArgument );
+		}
+	return iIntData;
+	}
+
+const TDesC& CBSElement::TextDataL()
+	{
+	if( !iTextData )
+		{
+		User::Leave( KErrArgument );
+		}
+	return *iTextData;
+	}
+
+const TDesC8& CBSElement::BufferDataL()
+	{
+	if( !iBufferData )
+		{
+		User::Leave( KErrArgument );
+		}
+	return *iBufferData;
+	}
+
+const CBSBitmap& CBSElement::BitmapDataL()
+    {
+	if( !iBitmapData )
+		{
+		User::Leave( KErrArgument );
+		}
+    return *iBitmapData;
+    }
+
+TArray<MBSElement*> CBSElement::GetStructureL()
+	{
+	if( !iArrayInitialized )
+		{
+		User::Leave( KErrArgument );
+		}
+
+	return iArray.Array();
+	}
+
+const MBSElement& CBSElement::FindSubEntryL( const TDesC& aElementId )
+	{
+    if ( !iArray.Count() )
+        {
+        User::Leave( KErrNotFound );
+        }
+    
+	MBSElement* element = NULL;
+	HBufC8* id = CnvUtfConverter::ConvertFromUnicodeToUtf8L( aElementId );	
+	User::LeaveIfNull( id );
+	CleanupStack::PushL( id );
+	for ( TInt i( 0 ) ; i < iArray.Count() ; i++ )
+	    {
+	    if ( iArray[ i ] )
+	        {
+    	    if ( !iArray[ i ]->ElementId().CompareC( *id ) )
+    	        {
+    	        // Match found
+    	        element = iArray[ i ];
+    	        i = iArray.Count();// Exit loop.
+    	        }
+	        }
+	    }
+	CleanupStack::PopAndDestroy( id );
+	  
+	if ( !element )
+	    {
+	    User::Leave( KErrNotFound );
+	    }
+	      
+	return *element;
+	}
+
+void CBSElement::ExternalizeL( RWriteStream& aWriteStream )
+    {
+    // Write common header for all elements
+    aWriteStream.WriteInt16L( iElementType );
+    aWriteStream.WriteInt16L( iElementId->Length() );
+    if( iElementId->Length() > 0 )
+        {
+        // Write ID only if it's defined
+        aWriteStream.WriteL( *iElementId );
+        }
+
+    // Write element type specific data
+    switch( iElementType )
+        {
+        case EBSInt:
+            {
+            aWriteStream.WriteInt16L( iIntData );
+            break;
+            }
+        case EBSText:     // flowthrough
+        case EBSFile:
+            {
+            aWriteStream.WriteInt16L( iTextData->Length() );
+            aWriteStream.WriteL( *iTextData );
+            break;
+            }
+        case EBSList:
+            {
+			TInt count = iArray.Count();
+            aWriteStream.WriteInt16L( count );
+            // Write all subitems to stream
+            for( TInt i = 0; i < count; i++ )
+                {
+				MBSElement* element = iArray[i];
+                element->ExternalizeL( aWriteStream );
+                }
+            break;
+            }
+        case EBSBitmap:
+            {
+			TPtrC8 ptr = iBitmapData->BitmapFileId();
+			aWriteStream.WriteInt16L( ptr.Length() );
+            aWriteStream.WriteL( ptr );
+            
+            aWriteStream.WriteInt16L( iBitmapData->BitmapId() );
+            aWriteStream.WriteInt16L( iBitmapData->BitmapMaskId() );
+            aWriteStream.WriteInt16L( iBitmapData->SkinIdMajor() );
+            aWriteStream.WriteInt16L( iBitmapData->SkinIdMinor() );
+
+            break;
+            }
+        case EBSBuffer:
+        	{
+            aWriteStream.WriteInt16L( iBufferData->Length() );
+            aWriteStream.WriteL( *iBufferData );
+        	break;
+        	}
+        default:
+            {
+            // unknown type!
+            User::Leave( KErrCorrupt );
+            break;
+            }
+        }
+    }
+
+
+//  END OF FILE
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/brandingserver/bsclient/cbselement.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,112 @@
+/*
+* 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: cbselement.h
+*
+*/
+
+
+#ifndef __CBSELEMENT_H__
+#define __CBSELEMENT_H__
+#include <e32std.h>
+
+#include "mbselement.h"
+#include "rbsobjowningptrarray.h"
+
+class RWriteStream;
+
+/**
+ *
+ */
+NONSHARABLE_CLASS( CBSElement ): public CBase,
+								 public MBSElement
+    {
+	public:
+		/**
+		* Two-phased constructor.
+		*/
+		static CBSElement* NewL(
+						const TDesC8& aElementId,
+						TInt aData );
+
+		static CBSElement* NewL(
+						const TDesC8& aElementId,
+						const TDesC& aData,
+						TBSElementType aType = EBSText );
+
+		static CBSElement* NewL(
+						const TDesC8& aElementId,
+						const TDesC8& aData );
+
+		// Transfers ownership
+		static CBSElement* NewL(
+						const TDesC8& aElementId,
+						CBSBitmap* aBitmap );
+
+		static CBSElement* NewL(
+						const TDesC8& aElementId,
+						RBSObjOwningPtrArray<MBSElement>& aStructure );
+
+		void Close();
+
+		virtual ~CBSElement();
+
+	private:
+		CBSElement();
+
+
+    	void ConstructL( TBSElementType aElementType,
+					 	 const TDesC8& aElementId,
+					 	 TInt aIntData,
+					 	 TBool aIntDataInitialized,
+					 	 CBSBitmap* aBitmap,
+					 	 const TDesC& aTextData,
+					 	 const TDesC8& aBufferData,
+					 	 RBSObjOwningPtrArray<MBSElement>* aStructure );
+
+	private:
+		TBSElementType ElementType();
+		const TDesC8& ElementId();
+
+		// Leaves with KErrArgument if trying to
+		// get wrong type
+		TInt IntDataL();
+		const TDesC& TextDataL();
+		const TDesC8& BufferDataL();
+        const CBSBitmap& BitmapDataL();
+		TArray<MBSElement*> GetStructureL();
+
+		const MBSElement& FindSubEntryL( const TDesC& aElementId );
+
+        void ExternalizeL( RWriteStream& aWriteStream );
+
+
+
+	private: // data
+		TBSElementType 			iElementType;
+		HBufC8*					iElementId;
+		TInt					iIntData;
+		TBool					iIntDataInitialized;
+		HBufC*					iTextData;
+		HBufC8*					iBufferData;
+		TBool					iArrayInitialized;
+		RBSObjOwningPtrArray<MBSElement>	iArray;
+		CBSBitmap*         		iBitmapData;
+
+    };
+
+#endif      //  __CBSELEMENT_H__
+
+
+//  END OF FILE
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/brandingserver/bsclient/cbsfactory.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,130 @@
+/*
+* 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 for creating branding
+*
+*/
+
+// INCLUDE FILES
+#include    "cbsfactory.h"
+#include	"cbsaccess.h"
+#include	"cbsupdater.h"
+#include	"mbsaccess.h"
+#include	"mbsupdater.h"
+#include	"cbsclient.h"
+#include    "debugtrace.h"
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// BrandingFactory::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CBSFactory* CBSFactory::NewL( const TDesC8& aDefaultBrandId,
+							  const TDesC8& aApplicationId )
+	{
+    TRACE( T_LIT("CBSFactory::NewL begin") );
+    CBSFactory* self = new ( ELeave ) CBSFactory() ;
+    CleanupStack::PushL( self );
+    self->ConstructL( aDefaultBrandId, aApplicationId );
+    CleanupStack::Pop( self );  //self
+    TRACE( T_LIT("CBSFactory::NewL end") );
+    return self;
+	}
+
+
+// C++ default constructor can NOT contain any code, that
+// might leave.
+//
+CBSFactory::CBSFactory()
+	{
+	}
+
+// destructor
+CBSFactory::~CBSFactory()
+	{
+	delete iDefaultBrand;
+	delete iApplicationId;
+	if( iServerKeepAlive )
+		{
+		iServerKeepAlive->Close();	
+		}
+	delete iServerKeepAlive;
+	}
+
+// Symbian OS default constructor can leave.
+void CBSFactory::ConstructL( const TDesC8& aDefaultBrandId,
+							 const TDesC8& aApplicationId )
+	{
+	iDefaultBrand = aDefaultBrandId.AllocL();
+	iApplicationId = aApplicationId.AllocL();
+	iServerKeepAlive = new(ELeave) RBSClient(); // CSI: 74 # this needs to be like this
+	User::LeaveIfError( iServerKeepAlive->Connect() );
+	}
+
+
+// -----------------------------------------------------------------------------
+// CBSFactory::CreateAccessL()
+// -----------------------------------------------------------------------------
+//
+EXPORT_C MBSAccess* CBSFactory::CreateAccessL( const TDesC8& aBrandId,
+    					  						  TLanguage aLanguageId,
+    					  						  TBool aCacheData, /* = EFalse */
+    					  						  TInt aReserved /*= 0*/ )
+    {
+    TRACE( T_LIT("CBSFactory::CreateAccessL begin") );
+    CBSAccess* access = CBSAccess::NewL( aBrandId, *iApplicationId, *iDefaultBrand,
+    									 aLanguageId, aCacheData, aReserved );
+    TRACE( T_LIT("CBSFactory::CreateAccessL end") );
+    return access;
+    }
+
+// -----------------------------------------------------------------------------
+// CBSFactory::CreateAccessL()
+// -----------------------------------------------------------------------------
+//
+EXPORT_C MBSAccess* CBSFactory::CreateAccessLC( const TDesC8& aBrandId,
+    					  						  TLanguage aLanguageId,
+    					  						  TBool aCacheData, /* = EFalse */
+    					  						  TInt aReserved /*= 0 */)
+    {
+    CBSAccess* access = CBSAccess::NewL( aBrandId, *iApplicationId, *iDefaultBrand,
+    									 aLanguageId, aCacheData, aReserved );
+	CleanupClosePushL( *access );
+    return access;
+    }
+
+// -----------------------------------------------------------------------------
+// CBSFactory::CreateUpdaterL()
+// -----------------------------------------------------------------------------
+//
+EXPORT_C MBSUpdater* CBSFactory::CreateUpdaterL()
+    {
+    CBSUpdater* updater = CBSUpdater::NewL( *iApplicationId );
+    return updater;
+    }
+
+// -----------------------------------------------------------------------------
+// CBSFactory::CreateUpdaterLC()
+// -----------------------------------------------------------------------------
+//
+EXPORT_C MBSUpdater* CBSFactory::CreateUpdaterLC()
+    {
+    CBSUpdater* updater = CBSUpdater::NewL( *iApplicationId );
+    CleanupClosePushL( *updater );
+    return updater;
+    }
+
+//  End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/brandingserver/bsclient/cbsiconfileprovider.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,91 @@
+/*
+* 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:  Icon file provider.
+ *
+*/
+
+
+// INCLUDE FILES
+#include    "cbsiconfileprovider.h"
+#include	<aknappui.h>
+#include    <AknIconUtils.h>
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CBSIconFileProvider::CBSIconFileProvider
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CBSIconFileProvider::CBSIconFileProvider()
+    {
+    }
+// -----------------------------------------------------------------------------
+// CBSIconFileProvider::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CBSIconFileProvider::ConstructL(RFile& aFile)
+    {
+    User::LeaveIfError( iFile.Duplicate( aFile ) );
+    }
+
+// -----------------------------------------------------------------------------
+// CBSIconFileProvider::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CBSIconFileProvider* CBSIconFileProvider::NewL(
+        RFile& aFile )
+    {
+    CBSIconFileProvider* self = new( ELeave ) CBSIconFileProvider();
+
+    CleanupStack::PushL( self );
+    self->ConstructL(aFile);
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+
+// Destructor
+CBSIconFileProvider::~CBSIconFileProvider()
+    {
+    delete iFilename;
+    iFile.Close();
+    }
+
+// -----------------------------------------------------------------------------
+// CBSIconFileProvider::RetrieveIconFileHandleL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CBSIconFileProvider::RetrieveIconFileHandleL(
+            RFile& aFile, const TIconFileType /*aType*/ )
+    {
+    aFile.Duplicate( iFile );
+    }
+
+// -----------------------------------------------------------------------------
+// CBSIconFileProvider::Finished
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CBSIconFileProvider::Finished()
+    {
+    // commit suicide because Avkon Icon Server said so
+    delete this;
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/brandingserver/bsclient/cbsiconfileprovider.h	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  Icon file provider.
+ *
+*/
+
+
+
+#ifndef CBSICONFILEPROVIDER_H
+#define CBSICONFILEPROVIDER_H
+
+//  INCLUDES
+#include <e32base.h>
+#include <AknsItemID.h>
+#include <AknIconUtils.h>
+
+
+// FORWARD DECLARATIONS
+
+// CLASS DECLARATION
+
+/**
+ *  Icon file provider.
+ *  See MAknIconFileProvider.h for comments.
+ *
+ *  @lib chat.app
+ *  @since 3.0
+ */
+class CBSIconFileProvider : public CBase, public MAknIconFileProvider
+    {
+    public:  // Constructors and destructor
+
+        /**
+         * Two-phased constructor.
+         */
+        static CBSIconFileProvider* NewL( RFile& aFile );
+        /**
+         * Destructor.
+         */
+        virtual ~CBSIconFileProvider();
+
+    public: // Functions from base classes
+
+        /**
+         * @see MAknIconFileProvider
+         */
+        void RetrieveIconFileHandleL(
+                RFile& aFile, const TIconFileType aType );
+
+        /**
+         * @see MAknIconFileProvider
+         */
+        void Finished();
+
+    private:
+
+        /**
+         * C++ default constructor.
+         */
+        CBSIconFileProvider();
+        
+        /**
+         * By default Symbian 2nd phase constructor is private.
+         */
+		void ConstructL(RFile& aFile);
+
+    private:    // Data
+
+        // owned. filename of this icon. must be a copy,
+        // a reference could end up pointing into another file.
+        HBufC* iFilename;
+        
+        RFile iFile;
+    };
+
+#endif      // CBSICONFILEPROVIDER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/brandingserver/bsclient/cbsupdater.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,538 @@
+/*
+* 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: CBSUpdater.cpp
+*
+*/
+
+
+//  INCLUDE FILES
+
+#include "e32base.h"
+
+#include "cbsupdater.h"
+#include "debugtrace.h"
+#include "mbsaccess.h"
+#include "bselementfactory.h"
+#include "mbselement.h"
+#include "bsserverdefs.h"
+
+// Two-phased constructor.
+CBSUpdater* CBSUpdater::NewL( const TDesC8& aApplicationId )
+    {
+    CBSUpdater* self = new ( ELeave ) CBSUpdater() ;
+    CleanupStack::PushL( self );
+    self->ConstructL( aApplicationId );
+    CleanupStack::Pop( self );  //self
+    return self;
+    }
+
+// Symbian OS default constructor can leave.
+void CBSUpdater::ConstructL( const TDesC8& aApplicationId  )
+    {
+    iApplicationId = aApplicationId.AllocL();
+    User::LeaveIfError( iClient.Connect() );
+    }
+
+// Destructor
+CBSUpdater::~CBSUpdater()
+    {
+    delete iApplicationId;
+    delete iBrandId;
+    iClient.Close();
+    }
+
+// C++ default constructor can NOT contain any code, that
+// might leave.
+//
+CBSUpdater::CBSUpdater()
+	{
+	}
+
+
+// -----------------------------------------------------------------------------
+// CBSUpdater::Close()
+// -----------------------------------------------------------------------------
+//
+void CBSUpdater::Close()
+	{
+	delete this;
+	}
+
+// -----------------------------------------------------------------------------
+// CBSUpdater::StartTransactionL()
+// -----------------------------------------------------------------------------
+//
+void CBSUpdater::StartTransactionL( const TDesC8& aBrandId,
+									TLanguage aLanguageId,
+									TUpdateTransactionType aType, /*EUpdateInstall*/
+									TInt aReserved)
+	{
+	if( iActive )
+		{
+		User::Leave( KErrAlreadyExists );
+		}
+	
+	iActive = ETrue;
+	HBufC8* tmp = aBrandId.AllocL();
+	delete iBrandId;
+	iBrandId = tmp;
+	iLanguageId = aLanguageId;
+	iReserved = aReserved;
+	iTxType = aType;
+	
+	TTransactionType operation = EBSTxAccess;
+	switch( aType )
+		{
+		case EUpdateInstall:
+			{
+			operation = EBSTxInstall;
+			break;
+			}
+		case EUpdateAppend:
+			{
+			operation = EBSTxAppend;
+			break;
+			}
+		case EUpdateReplace:
+			{
+			operation = EBSTxReplace;
+			break;
+			}
+		case EUpdateUninstall:
+			{
+			operation = EBSTxUninstall;
+			break;
+			}
+		default:
+			break;
+		}
+	
+	TRAPD( err, iClient.StartTransactionL( *iApplicationId, aBrandId, KNullDesC8,
+									aLanguageId, operation, aReserved ) );
+	if( err )
+		{
+		iActive = EFalse;
+		User::Leave( err );
+		}
+
+	}
+// -----------------------------------------------------------------------------
+// CBSUpdater::StopTransactionL()
+// -----------------------------------------------------------------------------
+//
+TInt CBSUpdater::StopTransactionL()
+	{
+	if( !iActive )
+		{
+		User::Leave( KErrNotFound );
+		}
+	
+	TInt returnValue = iClient.StopTransactionL( *iApplicationId, 
+												 *iBrandId, 
+												 iLanguageId, 
+												 iReserved );
+	iActive = EFalse;
+	return returnValue;
+	}
+
+
+// -----------------------------------------------------------------------------
+// CBSUpdater::CancelTransactionL()
+// -----------------------------------------------------------------------------
+//
+void CBSUpdater::CancelTransactionL()
+	{
+	if( !iActive )
+		{
+		User::Leave( KErrNotFound );
+		}
+	
+	iClient.CancelTransactionL( *iApplicationId, *iBrandId, iLanguageId, iReserved );
+	iActive = EFalse;
+	}
+
+
+
+//*** BRAND INSTALLING ***//
+// -----------------------------------------------------------------------------
+// CBSUpdater::InsertTextL()
+// -----------------------------------------------------------------------------
+//
+void CBSUpdater::InsertTextL( const TDesC8& aId,
+				  			  const TDesC& aText )
+	{
+	if( !iActive )
+		{
+		User::Leave( KErrNotReady );
+		}
+	if( iTxType != EUpdateInstall )
+		{
+		User::Leave( KErrArgument );
+		}
+	MBSElement* element = BSElementFactory::CreateBSElementL( aId, EBSText, aText );
+	CleanupClosePushL( *element );
+	InsertElementL( element );
+	CleanupStack::PopAndDestroy(); // element
+	}
+
+
+// -----------------------------------------------------------------------------
+// CBSUpdater::InsertBufferL()
+// -----------------------------------------------------------------------------
+//
+void CBSUpdater::InsertBufferL( const TDesC8& aId,
+								const TDesC8& aBuffer )
+	{
+	if( !iActive )
+		{
+		User::Leave( KErrNotReady );
+		}
+	if( iTxType != EUpdateInstall )
+		{
+		User::Leave( KErrArgument );
+		}
+	MBSElement* element = BSElementFactory::CreateBSElementL( aId, EBSBuffer, aBuffer );
+	CleanupClosePushL( *element );
+	InsertElementL( element );
+	CleanupStack::PopAndDestroy(); // element
+	}
+
+
+// -----------------------------------------------------------------------------
+// CBSUpdater::InsertIntL()
+// -----------------------------------------------------------------------------
+//
+void CBSUpdater::InsertIntL( const TDesC8& aId,
+				 			 TInt aInt )
+	{
+	if( !iActive )
+		{
+		User::Leave( KErrNotReady );
+		}
+	if( iTxType != EUpdateInstall )
+		{
+		User::Leave( KErrArgument );
+		}
+	MBSElement* element = BSElementFactory::CreateBSElementL( aId, EBSInt, aInt );
+	CleanupClosePushL( *element );
+	InsertElementL( element );
+	CleanupStack::PopAndDestroy(); // element
+	}
+
+
+// -----------------------------------------------------------------------------
+// CBSUpdater::InsertFileL()
+// -----------------------------------------------------------------------------
+//
+void CBSUpdater::InsertFileL( const TDesC8& aId,
+				  			  const TDesC& aFileName )
+	{
+	if( !iActive )
+		{
+		User::Leave( KErrNotReady );
+		}
+	if( iTxType != EUpdateInstall )
+		{
+		User::Leave( KErrArgument );
+		}
+	MBSElement* element = BSElementFactory::CreateBSElementL( aId, EBSFile, aFileName );
+	CleanupClosePushL( *element );
+	InsertElementL( element );
+	CleanupStack::PopAndDestroy(); // element
+	}
+
+
+// -----------------------------------------------------------------------------
+// CBSUpdater::InsertElementL()
+// -----------------------------------------------------------------------------
+//
+void CBSUpdater::InsertElementL( MBSElement* aElement )
+	{
+	if( !iActive )
+		{
+		User::Leave( KErrNotReady );
+		}
+	if( iTxType != EUpdateInstall )
+		{
+		User::Leave( KErrArgument );
+		}
+	iClient.InsertL( aElement );
+	}
+
+
+
+
+//*** BRAND UPDATING - replacing ***//
+// -----------------------------------------------------------------------------
+// CBSUpdater::ReplaceTextL()
+// -----------------------------------------------------------------------------
+//
+void CBSUpdater::ReplaceTextL( const TDesC8& aId,
+				   			   const TDesC& aText )
+	{
+	if( !iActive )
+		{
+		User::Leave( KErrNotReady );
+		}
+	if( iTxType != EUpdateReplace )
+		{
+		User::Leave( KErrArgument );
+		}
+	MBSElement* element = BSElementFactory::CreateBSElementL( aId, EBSText, aText );
+	CleanupClosePushL( *element );
+	ReplaceElementL( element );
+	CleanupStack::PopAndDestroy(); // element
+	}
+
+
+// -----------------------------------------------------------------------------
+// CBSUpdater::ReplaceBufferL()
+// -----------------------------------------------------------------------------
+//
+void CBSUpdater::ReplaceBufferL( const TDesC8& aId,
+					 			 const TDesC8& aBuffer )
+	{
+	if( !iActive )
+		{
+		User::Leave( KErrNotReady );
+		}
+	if( iTxType != EUpdateReplace )
+		{
+		User::Leave( KErrArgument );
+		}
+	MBSElement* element = BSElementFactory::CreateBSElementL( aId, EBSBuffer, aBuffer );
+	CleanupClosePushL( *element );
+	ReplaceElementL( element );
+	CleanupStack::PopAndDestroy(); // element
+	}
+
+
+// -----------------------------------------------------------------------------
+// CBSUpdater::ReplaceIntL()
+// -----------------------------------------------------------------------------
+//
+void CBSUpdater::ReplaceIntL( const TDesC8& aId,
+				  			  TInt aInt )
+	{
+	if( !iActive )
+		{
+		User::Leave( KErrNotReady );
+		}
+	if( iTxType != EUpdateReplace )
+		{
+		User::Leave( KErrArgument );
+		}
+	MBSElement* element = BSElementFactory::CreateBSElementL( aId, EBSInt, aInt );
+	CleanupClosePushL( *element );
+	ReplaceElementL( element );
+	CleanupStack::PopAndDestroy(); // element
+	}
+
+
+// -----------------------------------------------------------------------------
+// CBSUpdater::ReplaceFileL()
+// -----------------------------------------------------------------------------
+//
+void CBSUpdater::ReplaceFileL( const TDesC8& aId,
+				   			   const TDesC& aFileName )
+	{
+	if( !iActive )
+		{
+		User::Leave( KErrNotReady );
+		}
+	if( iTxType != EUpdateReplace )
+		{
+		User::Leave( KErrArgument );
+		}
+	MBSElement* element = BSElementFactory::CreateBSElementL( aId, EBSFile, aFileName );
+	CleanupClosePushL( *element );
+	ReplaceElementL( element );
+	CleanupStack::PopAndDestroy(); // element
+	}
+
+
+// -----------------------------------------------------------------------------
+// CBSUpdater::ReplaceElementL()
+// -----------------------------------------------------------------------------
+//
+void CBSUpdater::ReplaceElementL( MBSElement* aElement )
+	{
+	if( !iActive )
+		{
+		User::Leave( KErrNotReady );
+		}
+	if( iTxType != EUpdateReplace )
+		{
+		User::Leave( KErrArgument );
+		}
+	iClient.ReplaceL( aElement );
+	}
+
+
+
+
+//*** BRAND UPDATING - appending ***//
+// -----------------------------------------------------------------------------
+// CBSUpdater::AppendTextL()
+// -----------------------------------------------------------------------------
+//
+void CBSUpdater::AppendTextL( const TDesC8& aId,
+				  			  const TDesC& aText )
+	{
+	if( !iActive )
+		{
+		User::Leave( KErrNotReady );
+		}
+	if( iTxType != EUpdateAppend )
+		{
+		User::Leave( KErrArgument );
+		}
+	MBSElement* element = BSElementFactory::CreateBSElementL( aId, EBSText, aText );
+	CleanupClosePushL( *element );
+	AppendElementL( element );
+	CleanupStack::PopAndDestroy(); // element
+	}
+
+
+// -----------------------------------------------------------------------------
+// CBSUpdater::AppendBufferL()
+// -----------------------------------------------------------------------------
+//
+void CBSUpdater::AppendBufferL( const TDesC8& aId,
+								const TDesC8& aBuffer )
+	{
+	if( !iActive )
+		{
+		User::Leave( KErrNotReady );
+		}
+	if( iTxType != EUpdateAppend )
+		{
+		User::Leave( KErrArgument );
+		}
+	MBSElement* element = BSElementFactory::CreateBSElementL( aId, EBSBuffer, aBuffer );
+	CleanupClosePushL( *element );
+	AppendElementL( element );
+	CleanupStack::PopAndDestroy(); // element
+	}
+
+
+// -----------------------------------------------------------------------------
+// CBSUpdater::AppendIntL()
+// -----------------------------------------------------------------------------
+//
+void CBSUpdater::AppendIntL( const TDesC8& aId,
+				 		     TInt aInt )
+	{
+	if( !iActive )
+		{
+		User::Leave( KErrNotReady );
+		}
+	if( iTxType != EUpdateAppend )
+		{
+		User::Leave( KErrArgument );
+		}
+	MBSElement* element = BSElementFactory::CreateBSElementL( aId, EBSInt, aInt );
+	CleanupClosePushL( *element );
+	AppendElementL( element );
+	CleanupStack::PopAndDestroy(); // element
+	}
+
+
+// -----------------------------------------------------------------------------
+// CBSUpdater::AppendFileL()
+// -----------------------------------------------------------------------------
+//
+void CBSUpdater::AppendFileL( const TDesC8& aId,
+				  			  const TDesC& aFileName )
+	{
+	if( !iActive )
+		{
+		User::Leave( KErrNotReady );
+		}
+	if( iTxType != EUpdateAppend )
+		{
+		User::Leave( KErrArgument );
+		}
+	MBSElement* element = BSElementFactory::CreateBSElementL( aId, EBSFile, aFileName );
+	CleanupClosePushL( *element );
+	AppendElementL( element );
+	CleanupStack::PopAndDestroy(); // element
+	}
+
+
+// -----------------------------------------------------------------------------
+// CBSUpdater::AppendElementL()
+// -----------------------------------------------------------------------------
+//
+void CBSUpdater::AppendElementL( MBSElement* aElement )
+	{
+	if( !iActive )
+		{
+		User::Leave( KErrNotReady );
+		}
+	if( iTxType != EUpdateAppend )
+		{
+		User::Leave( KErrArgument );
+		}
+	iClient.AppendL( aElement );
+	}
+
+
+// -----------------------------------------------------------------------------
+// CBSUpdater::AppendElementL()
+// -----------------------------------------------------------------------------
+//
+void CBSUpdater::RemoveBrandL( const TDesC8& aApplicationId,
+								   const TDesC8& aBrandId )
+	{
+	if( !iActive )
+		{
+		User::Leave( KErrNotReady );
+		}
+	iClient.RemoveBrandL( aApplicationId, aBrandId );
+	}
+
+// -----------------------------------------------------------------------------
+// CBSUpdater::AppendElementL()
+// -----------------------------------------------------------------------------
+//
+void CBSUpdater:: RemoveBrandsL( const TDesC8& aApplicationId )
+	{
+	if( !iActive )
+		{
+		User::Leave( KErrNotReady );
+		}
+	iClient.RemoveBrandsL( aApplicationId );
+	}
+
+// -----------------------------------------------------------------------------
+// CBSUpdater::RegisterObserverL()
+// -----------------------------------------------------------------------------
+//
+void CBSUpdater:: RegisterObserverL( MBSBackupRestoreStateObserver* aBackupObserver )
+{
+	iClient.RegisterObserverL(NULL, aBackupObserver) ;
+}
+
+// -----------------------------------------------------------------------------
+// CBSUpdater::UnRegisterObserverL()
+// -----------------------------------------------------------------------------
+//
+void CBSUpdater:: UnRegisterObserverL( MBSBackupRestoreStateObserver* aObserver )
+{
+	iClient.UnRegisterObserverL(NULL, aObserver) ;
+}
+
+//  END OF FILE
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/brandingserver/bsclient/cbsupdater.h	Wed Nov 03 09:32:20 2010 +0530
@@ -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: CBSUpdater.h
+*
+*/
+
+
+#ifndef __CBSUPDATER_H__
+#define __CBSUPDATER_H__
+#include <e32std.h>
+#include "mbsupdater.h"
+#include "cbsclient.h"
+
+/**
+ * Simple ClientServer for
+ * testing and example purposes.
+ */
+NONSHARABLE_CLASS( CBSUpdater ): public CBase,
+								 public MBSUpdater
+    {
+	public:
+		/**
+		* Two-phased constructor.
+		*/
+		static CBSUpdater* NewL( const TDesC8& aApplicationId );
+
+    	virtual ~CBSUpdater();
+
+		/*
+		* @see MBSUpdater
+		*/ 
+		void Close();
+
+	private:
+    	void ConstructL( const TDesC8& aApplicationId );
+		CBSUpdater();
+
+
+	private: // from MBSUpdater
+
+     	/*
+     	* @see MBSUpdater
+     	*/
+        void StartTransactionL( const TDesC8& aBrandId,
+         						TLanguage aLanguageId,
+         						TUpdateTransactionType aType = EUpdateInstall,
+								TInt aReserved = 0 );
+     	/*
+     	* @see MBSUpdater
+     	*/
+		TInt StopTransactionL();
+
+     	/*
+     	* @see MBSUpdater
+     	*/
+		void CancelTransactionL();
+
+
+     	/*
+     	* @see MBSUpdater
+     	*/
+		void RemoveBrandL( const TDesC8& aApplicationId,
+								   const TDesC8& aBrandId );
+
+     	/*
+     	* @see MBSUpdater
+     	*/
+		void RemoveBrandsL( const TDesC8& aApplicationId );
+
+
+		//*** BRAND INSTALLING ***//
+     	/*
+     	* @see MBSUpdater
+     	*/
+        void InsertTextL( const TDesC8& aId,
+        				  const TDesC& aText );
+
+     	/*
+     	* @see MBSUpdater
+     	*/
+        void InsertBufferL( const TDesC8& aId,
+        					const TDesC8& aBuffer );
+
+     	/*
+     	* @see MBSUpdater
+     	*/
+        void InsertIntL( const TDesC8& aId,
+        				 TInt aInt );
+
+     	/*
+     	* @see MBSUpdater
+     	*/
+        void InsertFileL( const TDesC8& aId,
+        				  const TDesC& aFileName );
+
+     	/*
+     	* @see MBSUpdater
+     	*/
+        void InsertElementL( MBSElement* aElement );
+
+
+
+		//*** BRAND UPDATING - replacing ***//
+     	/*
+     	* @see MBSUpdater
+     	*/
+        void ReplaceTextL( const TDesC8& aId,
+        				   const TDesC& aText );
+
+     	/*
+     	* @see MBSUpdater
+     	*/
+        void ReplaceBufferL( const TDesC8& aId,
+        					 const TDesC8& aBuffer );
+
+     	/*
+     	* @see MBSUpdater
+     	*/
+        void ReplaceIntL( const TDesC8& aId,
+        				  TInt aInt );
+
+     	/*
+     	* @see MBSUpdater
+     	*/
+        void ReplaceFileL( const TDesC8& aId,
+        				   const TDesC& aFileName );
+
+     	/*
+     	* @see MBSUpdater
+     	*/
+        void ReplaceElementL( MBSElement* aElement );
+
+
+
+		//*** BRAND UPDATING - appending ***//
+     	/*
+     	* @see MBSUpdater
+     	*/
+        void AppendTextL( const TDesC8& aId,
+        				  const TDesC& aText );
+
+     	/*
+     	* @see MBSUpdater
+     	*/
+        void AppendBufferL( const TDesC8& aId,
+        					const TDesC8& aBuffer );
+
+     	/*
+     	* @see MBSUpdater
+     	*/
+        void AppendIntL( const TDesC8& aId,
+        				 TInt aInt );
+
+     	/*
+     	* @see MBSUpdater
+     	*/
+        void AppendFileL( const TDesC8& aId,
+        				  const TDesC& aFileName );
+
+     	/*
+     	* @see MBSUpdater
+     	*/
+        void AppendElementL( MBSElement* aElement );
+
+     	/*
+     	* @see MBSUpdater
+     	*/
+        void RegisterObserverL( MBSBackupRestoreStateObserver* aBackupObserver ) ;
+		
+     	/*
+     	* @see MBSUpdater
+     	*/
+        void UnRegisterObserverL( MBSBackupRestoreStateObserver* aObserver ) ;
+
+		
+	private: // data
+
+		// tells if a transaction is ongoing or not
+		TBool iActive;
+
+		HBufC8* iApplicationId;
+		HBufC8* iBrandId;
+		TLanguage iLanguageId;
+		TBool iUseCache;
+		RBSClient iClient;
+		TUpdateTransactionType iTxType;
+		TInt iReserved;
+    };
+
+#endif      //  __CBSUPDATER_H__
+
+
+//  END OF FILE
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/brandingserver/bsclient/mbsbrandobserverregistrar.h	Wed Nov 03 09:32:20 2010 +0530
@@ -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: MBSBrandObserverRegistrar.h
+*
+*/
+
+
+
+#ifndef __MBSBRANDOBSERVERREGISTRAR_H
+#define __MBSBRANDOBSERVERREGISTRAR_H
+
+#include <e32std.h>
+
+
+/**
+ * An interface through which client can take into use
+ * available brand data updates.
+ *
+ * @since
+ */
+class MBSBrandObserverRegistrar
+    {
+    public:
+
+    	/*
+    	* Registeres the brand observer to server
+    	*/
+        virtual void RegisterObserverToServerL( TRequestStatus& aStatus) = 0;
+
+
+    	/*
+    	* Gets the new updated version number 
+    	*/
+        virtual TInt GetNewVersionL() = 0;
+        
+        virtual TInt GetBackupRestoreL() = 0;
+        
+        virtual TInt GetBackupStateL() = 0;
+
+protected:
+    	/*
+    	* Destructor
+    	*/
+    	virtual ~MBSBrandObserverRegistrar() {};
+    };
+
+#endif //__MBSBRANDOBSERVERREGISTRAR_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/brandingserver/bsclient/tbselementiterator.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -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: tbselementiterator.cpp
+*
+*/
+
+
+
+// INCLUDE FILES
+#include    "tbselementiterator.h"
+#include    <E32STD.H>
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// TBSElementIterator::TBSElementIterator
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+TBSElementIterator::TBSElementIterator( const TDesC& aElementId )
+	: iElementId( aElementId )
+    {
+    }
+
+MBSElement& TBSElementIterator::Next()
+    {
+    }
+
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/brandingserver/bsclient/tbsmdescarrayadapter.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  One value adapter for MDesCArray.
+*
+*/
+
+//  INCLUDES
+#include "tbsmdescarrayadapter.h"
+#include <e32std.h>
+#include <badesca.h>
+
+
+//LOCAL constants
+namespace
+    {
+    //Panic
+    _LIT( KBSMDesArrayAdapterPanic, "BSDesArrAdp" );
+
+    //Panic reasons
+    enum TBSMDesArrayAdapterReasons
+        {
+        EMdcaPointOutOfBounds
+        };
+
+    void BSMDesAdapPanic( TBSMDesArrayAdapterReasons aPanicReason )
+        {
+        User::Panic( KBSMDesArrayAdapterPanic, aPanicReason );
+        }
+    }
+
+
+
+
+// ================= MEMBER FUNCTIONS =======================
+// C++ default constructor can NOT contain any code, that
+// might leave.
+//
+EXPORT_C TBSMDesCArrayAdapter::TBSMDesCArrayAdapter( const TDesC& aDesc )
+    : iDesc( aDesc )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// TBSMDesCArrayAdapter::MdcaCount()
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt TBSMDesCArrayAdapter::MdcaCount() const
+    {
+    //there is just one adapted descriptor
+    return 1;
+    }
+
+// -----------------------------------------------------------------------------
+// TBSMDesCArrayAdapter::MdcaPoint()
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TPtrC TBSMDesCArrayAdapter::MdcaPoint( TInt aIndex ) const
+    {
+    //there is just one adapted descriptor
+    __ASSERT_ALWAYS( aIndex == 0, BSMDesAdapPanic( EMdcaPointOutOfBounds ) );
+    return iDesc;
+    }
+
+
+
+//  End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/brandingserver/bsserver/bsimportconstants.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,64 @@
+/*
+* 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:  BrandingServer constants.
+*
+*/
+// CONSTANTS
+
+// Characters to strip from xml text values
+_LIT( KCommonControlCharacters, "\n\t\r" );
+_LIT( KEndl,                    "\n\r" );
+
+// === Directory & file constants =============================================
+_LIT( KDirSeparator,        "\\" );
+_LIT( KDot,        			"." );
+_LIT( KDefFileName,         "brandfile.bin.r" );
+_LIT( KDefEventLogDir,      "BSImport" );
+_LIT( KDefEventLogFile,     "eventlog.txt" );
+_LIT( KFileElementStore,    "files" );
+_LIT( KBSDataStore,    		"data" );
+_LIT( KAllFilesWildCard,    "*.*" );
+_LIT( KBSCDrive,			"C:" );
+_LIT( KBSZDrive,			"Z:" );
+// Codescanner warning : hard-coded drive letters (id:25)
+// this folder is always on c-drive
+_LIT( KBSIbyDirectory,		"c:\\data\\bs\\" ); // CSI: 25 # See above
+_LIT( KBSIbyExtension, 		".iby" );
+_LIT( KBSFileLangSuffix,    "r" );
+const TInt KMaxVersionLenght = 3;
+
+const TInt KLeadingZero = 0;
+const TInt KLangBufLength = 2;
+
+// folders inside server's private: "\\private\\102828DD\\"
+_LIT( KInstallObservePath,      "import\\install\\" ); // new files
+_LIT( KInstallPath,             "install\\" );         // installed files
+
+// drive where installation files are saved
+_LIT( KInstallDrive,            "C:" );
+
+// brand installation file extension
+_LIT( KBrandInstallExt,         ".install" );
+
+// Separator which separates brand id from application id in
+// uninstall buffer
+_LIT( KInstallFileDataSeparator, "$" );
+
+_LIT( KDiscardBrandFileName,         "discardedbrand.txt" );
+
+ 
+
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/brandingserver/bsserver/bsserverdefs.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,117 @@
+/*
+* 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: server defintions.
+*
+*/
+#ifndef __BSSERVERDEFS_H__
+#define __BSSERVERDEFS_H__
+#include <e32std.h>
+
+/**
+ *
+ *
+ */
+const TInt KBSVersionMajor = 1;
+const TInt KBSVersionMinor = 1;
+const TInt KBSVersionBuild = 1;
+
+/**
+ *
+ *
+ */
+_LIT( KBSServerExe, "bsserver.exe" );
+
+
+/**
+ *
+ *
+ */
+_LIT( KBSServerName, "bs" );
+
+
+/**
+ *
+ *
+ */
+const TUint KBSMsgSlotCount = 4;
+
+
+enum TTransactionType
+	{
+	EBSTxInstall = 1,
+	EBSTxUninstall,
+	EBSTxAppend,
+	EBSTxReplace,
+	EBSTxAccess
+	};
+
+/**
+ *
+ *
+ */
+enum TBSMessages
+    {
+    // access API
+    EBSInitInstall = 1,
+    EBSInitUninstall,
+    EBSInitAppend,
+    EBSInitReplace,
+    EBSInitAccess,
+    EBSPrepareText,
+    EBSGetText,
+    EBSGetInt,
+    EBSPrepareBuffer,
+    EBSGetBuffer,
+    EBSPrepareSeveral,
+    EBSGetSeveral,
+    EBSGetFile,
+    EBSPrepareStructure,
+    EBSGetStructure,
+    
+    EBSStartTransaction,
+    EBSStopTransaction,
+    EBSCancelTransaction,
+    
+    // installing
+    EBSInstall,
+    
+    // replacing
+    EBSReplace,
+    
+    // appending
+    EBSAppend,
+    
+    // removing
+    EBSRemoveBrand,
+    
+    EBSRemoveApplication,
+    
+    // observing
+    EBSObserveBrand,
+    EBSObserveGetNewVersion,
+    EBSObserveGetChange,
+    EBSObserveGetBackupState,
+    EBSIsBrandUpdateRequired,
+    EBSOperationLast
+    };
+
+
+#endif  //__BSSERVERDEFS_H__
+
+// END OF FILE
+
+
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/brandingserver/bsserver/cbsbackupobserver.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,195 @@
+/*
+* Copyright (c) 2006-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:  Stores element data and writes it to stream
+*
+*/
+
+
+#include <connect/sbdefs.h>
+
+#include "cbsbackupobserver.h"
+
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// CBSBackupObserver::NewL
+// ---------------------------------------------------------------------------
+//
+CBSBackupObserver* CBSBackupObserver::NewL()
+    {
+    CBSBackupObserver* self = NewLC();
+    CleanupStack::Pop();
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CBSBackupObserver::NewLC
+// ---------------------------------------------------------------------------
+//
+CBSBackupObserver* CBSBackupObserver::NewLC()
+    {
+    CBSBackupObserver* self = new (ELeave) CBSBackupObserver();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CBSBackupObserver::ConstructL
+// ---------------------------------------------------------------------------
+//
+void CBSBackupObserver::ConstructL()
+    {
+    CActiveScheduler::Add( this );
+    iProperty.Attach( KUidSystemCategory, conn::KUidBackupRestoreKey );
+    iLatestState = BackupStateL();
+    Subscribe();
+    }
+
+// ---------------------------------------------------------------------------
+// CBSBackupObserver::CBSBackupObserver
+// ---------------------------------------------------------------------------
+//
+CBSBackupObserver::CBSBackupObserver() :
+    CActive( EPriorityStandard )
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// CBSBackupObserver::~CBSBackupObserver
+// ---------------------------------------------------------------------------
+//
+CBSBackupObserver::~CBSBackupObserver()
+    {
+    Cancel();
+    iObservers.Close();
+    }
+
+// ---------------------------------------------------------------------------
+// CBSBackupObserver::RunL
+// ---------------------------------------------------------------------------
+//
+void CBSBackupObserver::RunL()
+    {
+    MBSBackupObserver::TBackupState newState = BackupStateL();
+    if( newState != iLatestState )
+        {
+        // state changed
+        iLatestState = newState;
+        NotifyObserversL( iLatestState );
+        }
+    Subscribe();
+    }
+
+// ---------------------------------------------------------------------------
+// CBSBackupObserver::DoCancel
+// ---------------------------------------------------------------------------
+//
+void CBSBackupObserver::DoCancel()
+    {
+    iProperty.Cancel();
+    }
+
+// ---------------------------------------------------------------------------
+// CBSBackupObserver::RunError
+// ---------------------------------------------------------------------------
+//
+TInt CBSBackupObserver::RunError( TInt /*aError*/ )
+    {
+    return KErrNone;
+    }
+
+// ---------------------------------------------------------------------------
+// CBSBackupObserver::RegisterObserver
+// ---------------------------------------------------------------------------
+//
+TInt CBSBackupObserver::RegisterObserver( MBSBackupObserver* aObserver )
+    {
+    TInt err = iObservers.InsertInAddressOrder( aObserver );
+    if( err == KErrAlreadyExists )
+        {
+        // ignore duplicate registration
+        err = KErrNone;
+        }
+
+    // if backup is already active -> notify
+    if( iLatestState == MBSBackupObserver::EBackupActive )
+        {
+        TRAP_IGNORE( aObserver->HandleBackupStateL( iLatestState ) );
+        }
+
+    return err;
+    }
+
+// ---------------------------------------------------------------------------
+// CBSBackupObserver::UnregisterObserver
+// ---------------------------------------------------------------------------
+//
+void CBSBackupObserver::UnregisterObserver( MBSBackupObserver* aObserver )
+    {
+    TInt index = iObservers.FindInAddressOrder( aObserver );
+    if( index != KErrNotFound )
+        {
+        iObservers.Remove( index );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CBSBackupObserver::Subscribe
+// ---------------------------------------------------------------------------
+//
+void CBSBackupObserver::Subscribe()
+    {
+    if( IsActive() )
+        {
+        // already active
+        return;
+        }
+    iStatus = KRequestPending;
+    iProperty.Subscribe( iStatus );
+    SetActive();    
+    }
+
+// ---------------------------------------------------------------------------
+// CBSBackupObserver::NotifyObservers
+// ---------------------------------------------------------------------------
+//
+void CBSBackupObserver::NotifyObserversL( MBSBackupObserver::TBackupState aState )
+    {
+    TInt count = iObservers.Count();
+    for( TInt i = 0; i < count; i++ )
+        {
+        TRAP_IGNORE( iObservers[i]->HandleBackupStateL( aState ) );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CBSBackupObserver::BackupState
+// ---------------------------------------------------------------------------
+//
+MBSBackupObserver::TBackupState CBSBackupObserver::BackupStateL()
+    {
+    TInt value = 0;
+    User::LeaveIfError( iProperty.Get( value ) );
+    if( value == 0 || 
+        value == ( conn::EBURNormal | conn::ENoBackup ) )
+        {
+        // backup or restore is not active at the moment
+        return MBSBackupObserver::EBackupNotActive;
+        }
+    return MBSBackupObserver::EBackupActive;
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/brandingserver/bsserver/cbsbackupobserver.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,116 @@
+/*
+* Copyright (c) 2006-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:  Gets and notifies backup and Restore events from system
+*
+*/
+
+
+#ifndef CBSBACKUPOBSERVER_H
+#define CBSBACKUPOBSERVER_H
+
+#include <e32base.h>
+#include <e32property.h>
+
+#include "mbsbackupobserver.h"
+
+/**
+ *  Gets and notifies backup and Restore events from system
+ *
+ *  @lib bsserver.exe
+ *  @since S60 v3.2
+ */
+class CBSBackupObserver : public CActive
+{
+public:
+
+    static CBSBackupObserver* NewL();
+
+    static CBSBackupObserver* NewLC();
+
+    ~CBSBackupObserver();
+
+
+private: // From CActive
+
+    /**
+     * @see CActive
+     */
+    void RunL();
+    
+    /**
+     * @see CActive
+     */
+    void DoCancel();
+    
+    /**
+     * @see CActive
+     */
+    TInt RunError( TInt aError );
+
+
+private: // Private constructors
+
+    CBSBackupObserver();
+
+    void ConstructL();
+
+
+public: // New Methods
+
+    /**
+     * Register observer to observe backup state changes
+     * @param aObserver observer to register
+     * @return KErrNone or some other system wide errorcode
+     */
+    TInt RegisterObserver( MBSBackupObserver* aObserver );
+    
+    /**
+     * Unregister observer
+     * @param aObserver observer to remove
+     */
+    void UnregisterObserver( MBSBackupObserver* aObserver );   
+
+
+private: // New methods
+
+    /**
+     * Subscribes to backup and restore P&S value.
+     */
+    void Subscribe();
+    
+    /**
+     * Notify registered observers of new backup state
+     */
+    void NotifyObserversL( MBSBackupObserver::TBackupState aState );
+    
+    /**
+     * Read current backup state
+     * @return current backup state
+     */
+    MBSBackupObserver::TBackupState BackupStateL();
+
+
+private: // Data
+
+    // backup state property
+    RProperty iProperty;
+    
+    // Own (array only). Observers
+    RPointerArray<MBSBackupObserver> iObservers;
+    
+    // latest state of backup and restore;
+    MBSBackupObserver::TBackupState iLatestState;
+};
+
+#endif //CBSBACKUPOBSERVER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/brandingserver/bsserver/cbsbrandhandler.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,614 @@
+/*
+* 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: CBSBrandHandler.cpp
+*
+*/
+
+
+//  INCLUDE FILES
+
+#include "cbsbrandhandler.h"
+#include "bselementfactory.h"
+#include "debugtrace.h"
+#include "cbsstoragemanager.h"
+#include "cbsbitmap.h"
+#include "bsimportconstants.h"
+
+#include <e32base.h>
+#include <utf.h>
+#include <s32file.h>
+
+void Panic(TInt aPanic)
+    {
+    _LIT( KPanic, "CBS" );
+    User::Panic( KPanic, aPanic );
+    }
+
+// Two-phased constructor.
+CBSBrandHandler* CBSBrandHandler::NewL( const TDesC& aApplicationId,
+									    const TDesC& aBrandId, 
+									    const TDesC& aDefaultBrandId, 
+									    TLanguage aLanguage,
+									    CBSSession* aSession,
+									    TInt aReserved )
+    {
+    CBSBrandHandler* self = new ( ELeave ) CBSBrandHandler( aLanguage, aReserved ) ;
+    CleanupStack::PushL( self );
+    self->ConstructL( aApplicationId, aBrandId, aDefaultBrandId, aSession );
+    CleanupStack::Pop( self );  //self
+    return self;
+    }
+
+// Symbian OS default constructor can leave.
+void CBSBrandHandler::ConstructL( const TDesC& aApplicationId,
+						 		  const TDesC& aBrandId,
+						 		  const TDesC& aDefaultBrandId,
+						 		  CBSSession* aSession )
+    {
+	iApplicationId = aApplicationId.AllocL();
+	iBrandId = aBrandId.AllocL();
+	iDefaultBrandId = aDefaultBrandId.AllocL();
+	iSession = aSession;
+	
+	User::LeaveIfError( iFs.Connect() );
+	
+	iHandle = new(ELeave) RFile(); // CSI: 74 # this needs to be like this
+
+	isDefaultBrandUsed = ETrue;
+	iStorageManager = CBSStorageManager::NewL( iSession, KNullDesC );
+    TInt err = -1;
+    TRAP (err, iStorageManager->BrandHandleL( *iApplicationId,
+                                   *iBrandId, iLanguage,
+                                   *iHandle,
+                                   iReserved ));
+
+
+    if (err != KErrNone)
+        {
+	iStorageManager->BrandHandleL( *iApplicationId,
+                                           *iDefaultBrandId, iLanguage,
+								   *iHandle,
+								   iReserved );
+        }
+	VerifyVersionL();
+    }
+
+// Destructor
+CBSBrandHandler::~CBSBrandHandler()
+    {
+    delete iDefaultBrand;
+    delete iApplicationId;
+    delete iBrandId;
+    delete iDefaultBrandId;
+  	if( iHandle )
+  		{
+  		iHandle->Close();
+		delete iHandle;
+		iHandle = NULL;
+  		}
+
+    delete iStorageManager;
+  
+    iFs.Close();
+    }
+
+// C++ default constructor can NOT contain any code, that
+// might leave.
+//
+CBSBrandHandler::CBSBrandHandler( TLanguage aLanguage,
+						 		  TInt aReserved )
+: iLanguage( aLanguage ), iReserved( aReserved)
+	{
+	}
+
+
+
+TInt CBSBrandHandler:: isBrandUpdateRequiredL ()
+{
+	TRACE( T_LIT( "isBrandUpdateRequired  entered"));
+	TInt updateRequired = -1;
+	if (isDefaultBrandUsed)
+		{
+		TRACE( T_LIT( "isBrandUpdateRequired  isDefaultBrandused is TRUE."));
+		/* default brand is used, so can check if the actual brand is installed by anychance or not */
+		updateRequired = iStorageManager->isActualBrandInstalledL (*iApplicationId, *iBrandId, iLanguage );
+		if (1 == updateRequired)
+			{
+				TRACE( T_LIT( "isBrandUpdateRequired  isDefaultBrandused returned 1, so update required, setting defaultbrand FALSE."));
+				isDefaultBrandUsed = EFalse;
+			}
+		}
+	TRACE( T_LIT( "isBrandUpdateRequired  isDefaultBrandused leaving.."));		
+	return updateRequired;
+}
+
+// -----------------------------------------------------------------------------
+// CBSBrandHandler::SetDefaultBrandIdL()
+// -----------------------------------------------------------------------------
+//
+void CBSBrandHandler::SetDefaultBrandIdL( const TDesC8& aBrandId )
+    {
+    HBufC* temp = CnvUtfConverter::ConvertToUnicodeFromUtf8L( aBrandId );
+    delete iDefaultBrand;
+    iDefaultBrand = temp;
+    }
+
+// -----------------------------------------------------------------------------
+// CBSBrandHandler::GetTextL()
+// -----------------------------------------------------------------------------
+//
+HBufC* CBSBrandHandler::GetTextL( const TDesC8& aId )
+	{
+	TRACE( T_LIT( "CBranding::GetTextL begin [%S]"), &aId);
+	
+	MBSElement* element = ReadElementLC( aId );
+
+	HBufC* returnValue = element->TextDataL().AllocL();
+
+	CleanupStack::PopAndDestroy(); // element
+	TRACE( T_LIT( "CBranding::GetTextL end") );
+    return returnValue;
+	}
+
+// -----------------------------------------------------------------------------
+// CBSBrandHandler::GetBufferL()
+// -----------------------------------------------------------------------------
+//
+HBufC8* CBSBrandHandler::GetBufferL( const TDesC8& aId )
+	{
+	TRACE( T_LIT( "CBSBrandHandler::GetBufferL begin") );
+	
+	MBSElement* element = ReadElementLC( aId );
+
+	HBufC8* returnValue = element->BufferDataL().AllocL();
+
+	CleanupStack::PopAndDestroy(); // element
+	TRACE( T_LIT( "CBSBrandHandler::GetBufferL end") );
+    return returnValue;
+	}
+
+// -----------------------------------------------------------------------------
+// CBSBrandHandler::GetIntL()
+// -----------------------------------------------------------------------------
+//
+TInt CBSBrandHandler::GetIntL( const TDesC8& aId )
+	{
+    TRACE( T_LIT( "CBSBrandHandler::GetIntL begin") );
+	TInt value = 0;
+
+	MBSElement* element = ReadElementLC( aId );
+
+	value = element->IntDataL();
+
+	CleanupStack::PopAndDestroy(); // element
+
+	TRACE( T_LIT( "CBSBrandHandler::GetIntL end") );
+    return value;
+	}
+
+// -----------------------------------------------------------------------------
+// CBSBrandHandler::GetFileL()
+// -----------------------------------------------------------------------------
+//
+void CBSBrandHandler::GetFileL( const TDesC8& aId, RFile& aFile )
+	{
+	TRACE( T_LIT( "CBSBrandHandler::GetFileL begin aId[%S] "), &aId );
+	RFile file;
+	User::LeaveIfError( iFs.ShareProtected() );
+
+	if (iLanguage >= 100)
+		User::LeaveIfError (KErrNotFound);
+	HBufC* fileName = GetTextL( aId );
+	CleanupStack :: PushL (fileName);
+
+    TBuf<KLangBufLength> buffer;
+// append leading zero only if language code is <10.
+    if ( 10 > iLanguage )
+        {
+    	buffer.AppendNum( KLeadingZero );
+        }		
+
+    buffer.AppendNum( iLanguage );
+
+	TInt err = -1;
+	TRAP (err, iStorageManager->FileElementHandleL( *iApplicationId,
+						     			 *iBrandId,
+						     			 *fileName,
+						     			 buffer,
+						     			 file ));
+
+	if (KErrNone != err)
+	    {
+		/* if the file is not found in the default brand also, then leave */
+	    iStorageManager->FileElementHandleL( *iApplicationId,
+	                                         *iDefaultBrandId,
+	                                         *fileName,
+	                                         buffer,
+	                                         file);
+
+		TRACE( T_LIT( "CBSBrandHandler::GetFileL found in default brand") );
+	    
+	    }
+	
+	CleanupStack :: PopAndDestroy (fileName);
+
+	aFile = file;
+    TRACE( T_LIT( "CBSBrandHandler::GetFileL end") );
+	}
+
+
+// -----------------------------------------------------------------------------
+// CBSBrandHandler::GetSeveralL()
+// -----------------------------------------------------------------------------
+//
+MBSElement* CBSBrandHandler::GetSeveralL( RBSObjOwningPtrArray<HBufC8>& aIds )
+	{
+	MBSElement* returnValue = NULL;
+	TInt count = aIds.Count();
+	
+	RBSObjOwningPtrArray<MBSElement> listData;
+	CleanupClosePushL( listData );
+	for(TInt i = 0; i < count; i++ )
+		{
+		MBSElement* subElement = ReadElementLC( *aIds[ i ] );
+		listData.AppendL( subElement );
+		CleanupStack::Pop( subElement );
+		}
+	returnValue = BSElementFactory::CreateBSElementL( KNullDesC8,
+													  EBSList,
+													  listData );
+	CleanupStack::Pop(); // listData
+	return returnValue;
+	}
+
+
+// -----------------------------------------------------------------------------
+// CBSBrandHandler::GetStructureL()
+// -----------------------------------------------------------------------------
+//
+MBSElement* CBSBrandHandler::GetStructureL( TDesC8& aId )
+	{
+	MBSElement* returnValue = NULL;
+
+	TRACE( T_LIT( "CBSBrandHandler::GetStructureL begin") );
+	
+	returnValue = ReadElementLC( aId );
+
+	CleanupStack::Pop(); // element
+
+	TRACE( T_LIT( "CBSBrandHandler::GetStructureL end") );
+
+	return returnValue;
+	}
+
+
+// -----------------------------------------------------------------------------
+// CBSBrandHandler::ReadElementLC()
+// -----------------------------------------------------------------------------
+//
+MBSElement* CBSBrandHandler::ReadElementLC( const TDesC8& aId, TBool aForceDefault /*= EFalse*/ )
+	{
+	TRACE( T_LIT( "CBSBrandHandler::ReadElementLC begin aId"));
+
+	if( aForceDefault )
+		{
+		TRACE( T_LIT( "CBSBrandHandler::ReadElementLC default brand"));
+		iStorageManager->BrandHandleL( *iApplicationId,
+									   *iDefaultBrandId, iLanguage,
+									   *iHandle,
+									   iReserved );		
+		}
+	else
+		{
+		TInt err = -1;
+		TRAP (err, iStorageManager->BrandHandleL( *iApplicationId,
+									   *iBrandId, iLanguage,
+									   *iHandle,
+									   iReserved ));
+		if (KErrNone != err)
+			{
+			iStorageManager->BrandHandleL( *iApplicationId,
+										   *iDefaultBrandId, iLanguage,
+										   *iHandle,
+										   iReserved ); 	
+			}
+		}
+	
+	RFileReadStream stream;
+	stream.Attach( *iHandle );
+	CleanupClosePushL( stream );
+	
+	VerifyVersionL( stream );
+	
+	TInt count = stream.ReadInt16L();
+	
+	MBSElement* returnValue = NULL;
+
+	for( TInt i = 0; i < count; i++ )
+		{
+		TRAPD( err, returnValue = ReadStreamL( aId, stream ) );
+		
+		if( err == KErrEof )
+			{
+			TRACE( T_LIT( "CBSBrandHandler::ReadElementLC EOF!") );
+			// the id is not found in this file
+			User::Leave( KErrNotFound );
+			}
+		if( returnValue )
+			{
+			TRACE( T_LIT( "CBSBrandHandler::ReadElementLC ELEMENT FOUND.. at position %d"), i);
+			// we found what we are looking for
+			break;
+			}
+		}
+		
+	CleanupStack::PopAndDestroy( &stream ); // stream	
+	
+	TBool popElementFromCleanupStack( EFalse );
+	
+	/* If retur value is not found and if its read the actual brand, then try in default brand as well. aForceDefault will decide that. */
+	if( !returnValue && !aForceDefault)
+		{
+		TRACE( T_LIT( "CBSBrandHandler::ReadElementLC force default is true") );
+
+		// the element was not found
+		// try the default brand if it's not the same as wanted brand
+		if( 0 != iBrandId->Compare( *iDefaultBrandId ) )
+			{
+			TRACE( T_LIT( "CBSBrandHandler::ReadElementLC calling READELEMENTLC again") );
+
+			/* Call ReadElementLC wiht aForceDefault set to TRUE */
+			returnValue = ReadElementLC( aId, ETrue );
+
+			if ( returnValue )
+			    {
+				TRACE( T_LIT( "CBSBrandHandler::ReadElementLC VALUE IS FOUND!!!") );
+			    popElementFromCleanupStack = ETrue;
+			    }
+			else
+				{
+				TRACE( T_LIT( "CBSBrandHandler::ReadElementLC VALUE IS NOT FOUND!!!") );
+				CleanupStack :: Pop (returnValue);
+				}
+			}
+		if( !returnValue )
+			{
+			TRACE( T_LIT( "CBSBrandHandler::ReadElementLC VALUE not FOUND LEAVING WITH -1 !!!") );
+			User::Leave( KErrNotFound );			
+			}
+		}
+	
+	CleanupClosePushL( *returnValue );
+    // since we make one function call to ReadElementLC in case the default 
+	// brand id is used to retrieved the element, we have to pop one returnValue
+	// pointer from CleanupStack (otherwise we have two identical pointers on 
+	// the stack!!!)
+	if ( popElementFromCleanupStack )
+   		{
+   	 	CleanupStack::Pop( returnValue );
+    	}
+	
+	TRACE( T_LIT( "CBSBrandHandler::ReadElementLC end ") );
+	return returnValue;
+	}
+
+// -----------------------------------------------------------------------------
+// CBSBrandHandler::VerifyVersionL()
+// -----------------------------------------------------------------------------
+//
+void CBSBrandHandler::VerifyVersionL( RFileReadStream& aStream )
+	{
+	TInt version = aStream.ReadInt16L();
+	if( version != iReserved )
+		{
+		User::Leave( KErrArgument );
+		}
+	}
+
+
+// -----------------------------------------------------------------------------
+// CBSBrandHandler::VerifyVersionL()
+// -----------------------------------------------------------------------------
+//
+void CBSBrandHandler::VerifyVersionL()
+	{
+	if( !iHandle )
+		{
+		User::Leave( KErrNotReady );
+		}
+	RFileReadStream stream;
+	stream.Attach( *iHandle );
+	CleanupClosePushL( stream );
+	
+	VerifyVersionL( stream );
+	
+	CleanupStack::PopAndDestroy(); // stream
+	}
+
+// -----------------------------------------------------------------------------
+// CBSBrandHandler::ReadStreamL()
+// -----------------------------------------------------------------------------
+//
+MBSElement* CBSBrandHandler::ReadStreamL( const TDesC8& aId, RFileReadStream& aStream,
+										  TBool aAllowEmptyId /* = EFalse */ )
+	{
+	TRACE( T_LIT( "CBSBrandHandler::ReadStreamL BEGIN"));
+	TBSElementType type = (TBSElementType)aStream.ReadInt16L();
+	MBSElement* returnValue = NULL;
+	
+	TInt idSize = aStream.ReadInt16L();
+	
+	HBufC8* elementId = HBufC8::NewLC( idSize );
+	TPtr8 elementIdPtr = elementId->Des();
+
+	if( idSize == 0 && aAllowEmptyId )
+		{
+		// we don't read empty ID
+		}
+	else
+		{
+		aStream.ReadL( elementIdPtr, idSize );
+        elementIdPtr.SetLength( idSize );// Set length
+		}
+	
+
+	TBool match = EFalse;
+	if( aAllowEmptyId || ( 0 == elementIdPtr.Compare( aId ) ) )
+		{
+		match = ETrue;
+		}
+		
+    TPtrC8 idPtrC( *elementId );// idPtrC creation moved here so it will be updated correctly.
+	if( elementId->Length() == 0 )
+		{
+		CleanupStack::PopAndDestroy( elementId );
+		elementId = NULL;
+		idPtrC.Set( KNullDesC8 );
+		}
+
+	switch( type )
+		{
+		case EBSInt:
+			{
+			TInt intData = aStream.ReadInt16L();
+			TRACE( T_LIT( "CBSBrandHandler::ReadStreamL type INT"));
+			if( match )
+				{
+                // Codescanner warning: neglected to put variable on cleanup stack (id:35)
+                // This method cannot leave after this line
+				returnValue = BSElementFactory::CreateBSElementL( idPtrC, // CSI: 35 # See above
+																  EBSInt,
+																  intData ); 
+				}
+			break;
+			}		
+		case EBSText:
+		case EBSFile: // flow through
+			{
+			TInt textSize = aStream.ReadInt16L();
+			HBufC* textData = HBufC::NewLC( textSize );
+
+			TPtr textPtr = textData->Des();
+			aStream.ReadL( textPtr, textSize );
+
+			TRACE( T_LIT( "CBSBrandHandler::ReadStreamL type TEXT/ FILE"));
+			if( match )
+				{
+                // Codescanner warning: neglected to put variable on cleanup stack (id:35)
+                // This method cannot leave after this line
+				returnValue = BSElementFactory::CreateBSElementL( idPtrC, // CSI: 35 # See above
+																  type,
+																  *textData ); 
+				}
+
+			CleanupStack::PopAndDestroy( textData );
+			break;
+			}
+		case EBSList:
+			{
+			RBSObjOwningPtrArray<MBSElement> listData;
+			CleanupClosePushL( listData );
+			TInt count = aStream.ReadInt16L();
+			
+			for( TInt i = 0; i < count; i++ )
+				{
+				MBSElement* subElement = ReadStreamL( KNullDesC8, aStream, ETrue );
+				CleanupDeletePushL( subElement );
+				listData.AppendL( subElement );
+				CleanupStack::Pop(); // subElement
+				}
+				
+			if( match )
+				{
+                // Codescanner warning: neglected to put variable on cleanup stack (id:35)
+                // This method cannot leave after this line
+				returnValue = BSElementFactory::CreateBSElementL( idPtrC, // CSI: 35 # See above
+																  EBSList,
+																  listData ); 
+				}
+			CleanupStack::Pop(); // listData
+			break;
+			}
+		case EBSBuffer:
+			{
+			TInt bufferSize = aStream.ReadInt16L();
+			HBufC8* buffeData = HBufC8::NewLC( bufferSize );
+
+			TPtr8 bufferPtr = buffeData->Des();
+			aStream.ReadL( bufferPtr, bufferSize );
+
+			if( match )
+				{
+                // Codescanner warning: neglected to put variable on cleanup stack (id:35)
+                // This method cannot leave after this line				
+				returnValue = BSElementFactory::CreateBSElementL( idPtrC, // CSI: 35 # See above
+																  EBSBuffer,
+																  *buffeData ); 
+				}
+
+			CleanupStack::PopAndDestroy( buffeData );
+			break;
+			}
+		case EBSBitmap:
+			{
+			TInt length = aStream.ReadInt16L();
+			HBufC8* fileId = HBufC8::NewLC( length );
+			
+			TPtr8 fileIdPtr = fileId->Des();
+			aStream.ReadL( fileIdPtr, length );
+			
+			TInt bitmapId = aStream.ReadInt16L();
+			TInt maskId = aStream.ReadInt16L();
+			TInt skinId = aStream.ReadInt16L();
+			TInt skinMaskId = aStream.ReadInt16L();
+
+			TRACE( T_LIT( "CBSBrandHandler::ReadStreamL type BITMAP .. bitmap ID is [%d]"), bitmapId);
+			if( match )
+				{
+				CBSBitmap* bitmap = CBSBitmap::NewLC( bitmapId,
+													  maskId,
+													  skinId,
+													  skinMaskId,
+													  fileIdPtr );
+
+                // Codescanner warning: neglected to put variable on cleanup stack (id:35)
+                // This method cannot leave after this line
+				returnValue = BSElementFactory::CreateBSElementL( idPtrC, // CSI: 35 # See above
+																  EBSBitmap,
+																  bitmap ); 
+				CleanupStack::Pop( bitmap ); 
+				}
+		    CleanupStack::PopAndDestroy( fileId ); 
+
+			break;
+			}
+		default:
+			{
+			TRACE( T_LIT( "CBSBrandHandler::ReadStreamL type DEFAULT : corrupt"));
+			User::Leave( KErrCorrupt );
+			break;
+			}
+		}
+
+	if( elementId )
+		{
+		CleanupStack::PopAndDestroy( elementId );
+		}
+
+	TRACE( T_LIT( "CBSBrandHandler::ReadStreamL END"));
+	return returnValue;
+	}
+
+//  END OF FILE
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/brandingserver/bsserver/cbsbrandhandler.h	Wed Nov 03 09:32:20 2010 +0530
@@ -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: CBSBrandHandler.h
+*
+*/
+
+
+#ifndef __CBSBRANDHANDLER_H__
+#define __CBSBRANDHANDLER_H__
+
+#include "rbsobjowningptrarray.h"
+
+#include <e32std.h>
+#include <e32base.h>
+#include <barsc.h>
+#include <bamdesca.h>
+#include <f32file.h>
+#include <s32file.h>
+
+// FORWARD DECLARATIONS
+class MBSElement;
+class CBSStorageManager;
+class CBSSession;
+
+/**
+ *
+ *
+ */
+NONSHARABLE_CLASS( CBSBrandHandler ): public CBase
+	{
+	public:
+		/**
+		* Two-phased constructor.
+		*/
+		static CBSBrandHandler* NewL( const TDesC& aApplicationId,
+									  const TDesC& aBrandId, 
+									  const TDesC& aDefaultBrandId, 
+									  TLanguage aLanguage,
+									  CBSSession* aSession,
+									  TInt aReserved = 0);
+
+
+
+    	virtual ~CBSBrandHandler();
+
+	private: // constructors
+	
+		void ConstructL( const TDesC& aApplicationId,
+						 const TDesC& aBrandId,
+						 const TDesC& aDefaultBrandId,
+						 CBSSession* aSession );
+						 
+		CBSBrandHandler( TLanguage aLanguage,
+						 TInt aReserved );
+
+	public:
+		HBufC* GetTextL( const TDesC8& aId );
+		HBufC8* GetBufferL( const TDesC8& aId );
+		TInt GetIntL( const TDesC8& aId );
+		MBSElement* GetSeveralL( RBSObjOwningPtrArray<HBufC8>& aIds );
+		void GetFileL( const TDesC8& aId, RFile& aFile );
+		MBSElement* GetStructureL( TDesC8& aId );
+    	void SetDefaultBrandIdL( const TDesC8& aBrandId );
+
+
+		TInt isBrandUpdateRequiredL ();
+
+    private:     // New methods
+
+		MBSElement* ReadElementLC( const TDesC8& aId, TBool aForceDefault = EFalse );
+		
+		MBSElement* ReadStreamL( const TDesC8& aId, 
+								 RFileReadStream& aStream, 
+								 TBool aAllowEmptyId = EFalse );
+
+		void VerifyVersionL();
+		void VerifyVersionL( RFileReadStream& aStream );
+
+	private: // data
+		HBufC* iDefaultBrand;
+        ///<File server session, owned
+        RFs                     iFs;
+
+		HBufC* iApplicationId;
+		HBufC* iBrandId;
+		HBufC* iDefaultBrandId;
+	    TLanguage iLanguage;
+	    
+	    TBool isDefaultBrandUsed;
+		
+	    RFile* iHandle;
+	    
+	    CBSStorageManager* iStorageManager;
+	    
+	    // doesn't own: session
+	    CBSSession* iSession;
+	    TInt iReserved ;
+
+    };
+
+#endif      //  __CBSBRANDHANDLER_H__
+
+
+//  END OF FILE
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/brandingserver/bsserver/cbsibywriter.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,235 @@
+/*
+* Copyright (c) 2006-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:  Writes IBY files
+*
+*/
+
+
+#include <f32file.h>
+#include <bautils.h>
+#include <utf.h>
+
+#include "cbsibywriter.h"
+#include "bsimportconstants.h"
+//#include "importlogwriter.h"
+#include "debugtrace.h"
+
+// CONSTANTS
+_LIT8( KIBYHeader1,           "\n#ifndef __BRAND_" );
+_LIT8( KIBYHeader2,           "\n#define __BRAND_" );
+_LIT8( KIBYHeaderEnd,         "_IBY_" );
+_LIT8( KIBYFileItem,          "\nfile=" );
+_LIT8( KIBYEmptyLine,         "\n" );
+_LIT8( KIBYSpace,             " \t\t " );
+_LIT8( KIBYFooter,            "\n#endif //__BRAND_" );
+
+// File & dir
+_LIT8( KIBYBaseSource,        "\\epoc32\\winscw\\c" );
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// CBSIBYWriter::NewL
+// ---------------------------------------------------------------------------
+//
+CBSIBYWriter* CBSIBYWriter::NewL()
+    {
+    CBSIBYWriter* self = NewLC();
+    CleanupStack::Pop();
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CBSIBYWriter::NewLC
+// ---------------------------------------------------------------------------
+//
+CBSIBYWriter* CBSIBYWriter::NewLC()
+    {
+    CBSIBYWriter* self = new (ELeave) CBSIBYWriter();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CBSIBYWriter::ConstructL
+// ---------------------------------------------------------------------------
+//
+void CBSIBYWriter::ConstructL()
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// CBSIBYWriter::CBSIBYWriter
+// ---------------------------------------------------------------------------
+//
+CBSIBYWriter::CBSIBYWriter()
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// CBSIBYWriter::~CBSIBYWriter
+// ---------------------------------------------------------------------------
+//
+CBSIBYWriter::~CBSIBYWriter()
+    {
+    iSourcePath.ResetAndDestroy();
+    iSourceFiles.ResetAndDestroy();
+    iDestinations.ResetAndDestroy();
+    delete iIbyFile;
+    }
+
+// ---------------------------------------------------------------------------
+// CBSIBYWriter::SetFileItemL
+// ---------------------------------------------------------------------------
+//
+void CBSIBYWriter::SetFileItemL( const TDesC& aSrc, const TDesC& aDest )
+    {
+    TRACE( T_LIT( "CBSIBYWriter::SetFileItemL begin") );
+    // Parse and construct filenames
+    TParse srcparse;
+    srcparse.Set( aSrc, NULL, NULL );
+
+    TParse dstparse;
+    dstparse.Set( aDest, NULL, NULL );
+
+    // Path
+    HBufC8* srcpath = HBufC8::NewLC( srcparse.Path().Length() );
+    TPtr8 ptr( srcpath->Des() );
+    CnvUtfConverter::ConvertFromUnicodeToUtf8( ptr, srcparse.Path() );
+
+    HBufC8* src = HBufC8::NewLC( srcparse.NameAndExt().Length() );
+    ptr.Set( src->Des() );
+    CnvUtfConverter::ConvertFromUnicodeToUtf8( ptr, srcparse.NameAndExt() );
+
+    HBufC8* dst = HBufC8::NewLC( aDest.Length() );
+    ptr.Set( dst->Des() );
+    
+    HBufC* newDst = HBufC::NewLC( aDest.Length() );
+    TPtr dstPtr( newDst->Des() );
+    TPtrC name = dstparse.NameAndExt();
+	TPtrC path = dstparse.Path();
+	dstPtr.Append( KBSZDrive );
+	dstPtr.Append( path );
+	dstPtr.Append( name );
+	
+    CnvUtfConverter::ConvertFromUnicodeToUtf8( ptr, dstPtr );
+    
+    TRACE( T_LIT( "CBSIBYWriter::SetFileItemL - setting source file %S"), &aSrc );
+    TRACE( T_LIT( "CBSIBYWriter::SetFileItemL - setting destination file %S"), newDst );
+	CleanupStack::PopAndDestroy( newDst );
+    CleanupStack::Pop( 3 );
+
+    // Append filepair
+    iSourcePath.Append( srcpath );
+    iSourceFiles.Append( src );
+    iDestinations.Append( dst );
+    
+    TRACE( T_LIT( "CBSIBYWriter::SetFileItemL end") );
+    }
+
+// ---------------------------------------------------------------------------
+// CBSIBYWriter::WriteIBYFile()
+// ---------------------------------------------------------------------------
+//
+void CBSIBYWriter::WriteIBYFileL( RFs& aFs, const TDesC& aFileName )
+    {
+	TRACE( T_LIT( "CBSIBYWriter::WriteIBYFileL begin") );
+	
+    TInt count = iSourceFiles.Count();
+    if( count == 0 )
+    	{
+    	TRACE( T_LIT( "CBSIBYWriter::WriteIBYFileL - No file elements, nothing to do.") );
+    	return;
+    	}
+    if( count != iDestinations.Count() )
+        {
+		TRACE( T_LIT("Internal error: IBY filename count mismatch ( %d != %d )"),
+            count, iDestinations.Count() );
+        User::Leave( KErrCorrupt );
+        }
+
+	RFile outfile;
+	TInt err = outfile.Open( aFs, aFileName, EFileWrite );
+	if( err == KErrNotFound )
+		{
+		TRACE( T_LIT( "CBSIBYWriter::WriteIBYFileL - IBY file not initialized!") );
+		// if the file is not initialized -> not ready
+		err = KErrNotReady;
+		}
+	User::LeaveIfError( err );
+
+    // write data
+    TInt size = -1;
+    User::LeaveIfError( outfile.Size( size ) );
+
+    outfile.Write( size, KIBYEmptyLine );
+    
+	TRACE( T_LIT( "CBSIBYWriter::WriteIBYFileL - start writing files to IBY") );
+    
+    for( TInt i = 0; i < count; i++ )
+        {
+        outfile.Write( KIBYFileItem );
+        outfile.Write( KIBYBaseSource );
+        outfile.Write( iSourcePath[i]->Des() );
+        outfile.Write( iSourceFiles[i]->Des() );
+        outfile.Write( KIBYSpace );
+        outfile.Write( iDestinations[i]->Des() );
+        TRACE( T_LIT( "CBSIBYWriter::WriteIBYFileL - %S"), iDestinations[i] );
+        }
+
+	TRACE( T_LIT( "CBSIBYWriter::WriteIBYFileL - writing IBY file footer") );
+    outfile.Write( KIBYEmptyLine );
+    outfile.Write( KIBYFooter );
+    outfile.Write( KIBYHeaderEnd );
+
+    // cleanup
+    outfile.Close();
+    TRACE( T_LIT( "CBSIBYWriter::WriteIBYFileL end") );
+    }
+
+// ---------------------------------------------------------------------------
+// CBSIBYWriter::WriteIBYFile()
+// ---------------------------------------------------------------------------
+//
+void CBSIBYWriter::InitIbyFileL( RFs& aFs, const TDesC& aFileName )
+	{
+	TRACE( T_LIT( "CBSIBYWriter::InitIbyFileL begin") );
+	HBufC* temp = aFileName.AllocL();
+	delete iIbyFile;
+	iIbyFile = temp;
+
+    TInt err = aFs.MkDir( KBSIbyDirectory );
+    if( err == KErrAlreadyExists )
+    	{
+    	err = KErrNone;
+    	}
+    User::LeaveIfError( err );
+	
+	TRACE( T_LIT( "CBSIBYWriter::InitIbyFileL IBY directory (%S) created"), &KBSIbyDirectory() );
+	
+	// Open file for writing
+	RFile outfile;
+    User::LeaveIfError( outfile.Replace( aFs, aFileName, EFileWrite ) );
+    
+    TRACE( T_LIT( "CBSIBYWriter::InitIbyFileL IBY file (%S) created"), &aFileName );
+    
+    outfile.Write( KIBYHeader1 );
+    outfile.Write( KIBYHeaderEnd );
+    outfile.Write( KIBYHeader2 );
+    outfile.Write( KIBYHeaderEnd );
+    outfile.Close();
+    TRACE( T_LIT( "CBSIBYWriter::InitIbyFileL end") );
+	}
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/brandingserver/bsserver/cbsibywriter.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,93 @@
+/*
+* Copyright (c) 2006-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:  Writes IBY files
+*
+*/
+
+
+#ifndef CBSIBYWRITER_H
+#define CBSIBYWRITER_H
+
+#include <e32base.h>
+
+class RFs;
+
+/**
+ *  Writes IBY files
+ *
+ *  @lib
+ *  @since S60 v3.2
+ */
+class CBSIBYWriter : public CBase
+{
+public:
+
+    static CBSIBYWriter* NewL();
+
+    static CBSIBYWriter* NewLC();
+
+    ~CBSIBYWriter();
+
+    /**
+     * Initialize IBY file
+     *
+     * @param aFs file system handle
+     * @param aFileName Full name of the iby file
+     * @since S60 3.2
+     * @return none
+     */
+    void InitIbyFileL( RFs& aFs, const TDesC& aFileName );
+
+    /**
+     * File item included in IBY file
+     *
+     * @since S60 3.2
+     * @param aSrc source file
+     * @param aDest destination file
+     * @return none
+     */
+    void SetFileItemL( const TDesC& aSrc, const TDesC& aDest );
+
+    /**
+     * Writes Iby file from given file items
+     *
+     * @since S60 3.2
+     * @param aFs file system handle
+     * @param aFileName Full name of the iby file
+     * @return none
+     */
+    void WriteIBYFileL( RFs& aFs, const TDesC& aFileName );
+
+private:
+
+    CBSIBYWriter();
+
+    void ConstructL();
+
+private: // Data
+
+    // Own. Source path array
+    RPointerArray<HBufC8> iSourcePath;
+
+    // Own. Source files
+    RPointerArray<HBufC8> iSourceFiles;
+
+    // Own. Destination files
+    RPointerArray<HBufC8> iDestinations;
+    
+    // Own. Iby file name
+    HBufC* iIbyFile;
+};
+
+#endif //CBSIBYWRITER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/brandingserver/bsserver/cbsinstallhandler.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,564 @@
+/*
+* 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: CBSInstallhandler.cpp
+*
+*/
+
+
+//  INCLUDE FILES
+#include <apgcli.h>
+#include <apacmdln.h>
+#include <eikenv.h>
+#include <bautils.h>
+#include <utf.h>
+#include <e32property.h>
+
+#include "cbsinstallhandler.h"
+#include "debugtrace.h"
+#include "bsimportconstants.h"
+#include "cbsstoragemanager.h"
+
+
+// CONSTANTS
+// branding installer application
+_LIT( KInstallerApp,            "bsinstall.exe" );
+
+
+// wildcard for finding installed brand files
+_LIT( KBrandWild,               "*" );
+
+// Line feed separates uninstalled brands from each other
+_LIT( KLineFeed,                "\n" );
+
+
+// Pub&Sub Key for uninstalled brands
+const TUint KUninstallKey       = 0x01;
+
+
+// METHODS
+
+// Two-phased constructor.
+CBSInstallHandler* CBSInstallHandler::NewL( )
+    {
+    TRACE( T_LIT( "CBSInstallHandler::NewL begin") );
+    CBSInstallHandler* self = new ( ELeave ) CBSInstallHandler() ;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    TRACE( T_LIT( "CBSInstallHandler::NewL end") );
+    return self;
+    }
+
+// Symbian OS default constructor can leave.
+void CBSInstallHandler::ConstructL()
+    {
+    User::LeaveIfError( iFs.Connect() );
+    CActiveScheduler::Add( this );
+    }
+
+// Destructor
+CBSInstallHandler::~CBSInstallHandler()
+    {
+    Cancel();
+    iFs.Close();
+    }
+
+// C++ default constructor can NOT contain any code, that
+// might leave.
+//
+CBSInstallHandler::CBSInstallHandler() :
+    CActive( EPriorityIdle )
+	{
+	}
+
+// -----------------------------------------------------------------------------
+// CBSInstallHandler::InstallNewFilesL()
+// -----------------------------------------------------------------------------
+//
+void CBSInstallHandler::InstallNewFilesL()
+    {
+	TRACE( T_LIT( "CBSInstallHandler::InstallNewFilesL begin") );
+    TInt needInstaller = 0;
+    
+        
+    TRAP_IGNORE( needInstaller += CheckForDiscardedBrandsL( KBSDataStore ) );
+
+    // uninstall removed brands
+    needInstaller += 
+        SyncFilesL( KInstallPath, KInstallObservePath, EInstallDeleteFromSrc );
+    
+    // install new brands
+    needInstaller += 
+        SyncFilesL( KInstallObservePath, KInstallPath, EInstallCopyNewToDest );
+    
+    if( needInstaller )
+        {
+        // something new was installed
+        LaunchInstallerAppL();
+        }
+	TRACE( T_LIT( "CBSInstallHandler::InstallNewFilesL end") );
+    }
+
+// -----------------------------------------------------------------------------
+// CBSInstallHandler::StartObservingL()
+// -----------------------------------------------------------------------------
+//
+void CBSInstallHandler::StartObservingL()
+	{
+	TRACE( T_LIT( "CBSInstallHandler::StartObservingL begin") );
+	if( IsActive() )
+	    {
+	    __ASSERT_DEBUG( EFalse, User::Leave( KErrAlreadyExists ) );
+	    return;
+	    }
+	
+	// observe path: (drive:)[private](/import/install)
+	TPath path( KNullDesC );
+	GetPrivateFolder( path, KInstallObservePath );
+    
+    iFs.NotifyChange( ENotifyEntry, iStatus, path );
+    SetActive();
+	TRACE( T_LIT( "CBSInstallHandler::StartObservingL end") );
+	}
+
+// -----------------------------------------------------------------------------
+// CBSInstallHandler::StopObserving()
+// -----------------------------------------------------------------------------
+//
+void CBSInstallHandler::StopObserving()
+	{
+	TRACE( T_LIT( "CBSInstallHandler::StopObserving begin") );
+    Cancel();
+	TRACE( T_LIT( "CBSInstallHandler::StopObserving end") );
+	}
+
+// -----------------------------------------------------------------------------
+// CBSInstallHandler::DoCancel()
+// -----------------------------------------------------------------------------
+//
+void CBSInstallHandler::DoCancel()
+    {
+    iFs.NotifyChangeCancel();
+    }
+
+// -----------------------------------------------------------------------------
+// CBSInstallHandler::RunL()
+// -----------------------------------------------------------------------------
+//
+void CBSInstallHandler::RunL()
+    {
+	TRACE( T_LIT( "CBSInstallHandler::RunL start") );
+    if( iStatus == KErrNone )
+        {
+        TRACE( T_LIT( "CBSInstallHandler::RunL installing...") );
+        TRAP_IGNORE( InstallNewFilesL() );
+        StartObservingL();
+        }
+    else
+        {
+        TRACE( T_LIT( "CBSInstallHandler::RunL observing stopped") );
+        }
+	TRACE( T_LIT( "CBSInstallHandler::RunL end") );
+    }
+
+// -----------------------------------------------------------------------------
+// CBSInstallHandler::LaunchInstallerAppL()
+// -----------------------------------------------------------------------------
+//
+void CBSInstallHandler::LaunchInstallerAppL()
+    {
+	TRACE( T_LIT( "CBSInstallHandler::LaunchInstallerAppL start") );
+    // initialize RApaLsSession
+    RApaLsSession apas;
+    User::LeaveIfError( apas.Connect() );
+    CleanupClosePushL( apas );
+    apas.GetAllApps();
+    
+    // start installer
+    CApaCommandLine* command = CApaCommandLine::NewLC();
+    command->SetExecutableNameL( KInstallerApp );
+    User::LeaveIfError( apas.StartApp( *command ) );
+    TRACE( T_LIT( "CBSInstallHandler::LaunchInstallerAppL bsinstall.exe launched OK") );
+
+    CleanupStack::PopAndDestroy( 2 ); // apas, command
+	TRACE( T_LIT( "CBSInstallHandler::LaunchInstallerAppL end") );
+    }
+    
+// -----------------------------------------------------------------------------
+// CBSInstallHandler::SyncFilesL()
+// -----------------------------------------------------------------------------
+//
+TBool CBSInstallHandler::SyncFilesL( const TDesC& aSrcDir, const TDesC& aDestDir, 
+                                     TInstallOperation aOperation )
+    {
+	TRACE( T_LIT( "CBSInstallHandler::SyncFilesL start") );
+
+    // Check new install folder
+    HBufC* fileBuf = HBufC::NewLC( KMaxFileName );
+    TPtr file( fileBuf->Des() );
+    GetPrivateFolder( file, aSrcDir );
+    
+    TBool ret = BaflUtils::PathExists( iFs, file );
+    if( !ret )
+        {
+        // install folder doesn't exist.
+    	TRACE( T_LIT( 
+            "CBSInstallHandler::SyncFilesL no src folder!") );
+        CleanupStack::PopAndDestroy( fileBuf );
+        return EFalse;
+        }
+
+    // Apply extension filter
+    file.Append( KBrandWild );       //
+    file.Append( KBrandInstallExt ); // *.install
+
+    // Get list of src dir files
+    CDir* dir = NULL;
+    User::LeaveIfError( iFs.GetDir( file, 
+        KEntryAttNormal, ESortNone, dir ) );
+    CleanupStack::PushL( dir );
+    
+    // Create destination directory
+    GetPrivateFolder( file, aDestDir );
+    BaflUtils::EnsurePathExistsL( iFs, file );
+    
+    // Compare source dir to destination
+    TBool OperationExecuted = EFalse;
+    TInt count = dir->Count();
+
+    for( TInt i = 0; i < count; i++ )
+        {
+        GetPrivateFolder( file, aDestDir );
+        file.Append( (*dir)[i].iName );
+        if( !BaflUtils::FileExists( iFs, file ) )
+            {
+            // file does not exist in destionation dir
+            // => react according to operation
+            HBufC* fileSrcBuf = HBufC::NewLC( KMaxFileName );
+            TPtr fileSrc( fileSrcBuf->Des() );
+            GetPrivateFolder( fileSrc, aSrcDir );
+            fileSrc.Append( (*dir)[i].iName );
+            
+            switch( aOperation )
+                {
+                case EInstallCopyNewToDest:
+                    {
+                    // copy new files from src to destination
+                    TRACE( T_LIT( "CBSInstallHandler::SyncFilesL copy") );
+                    OperationNotifyL( aOperation, file );
+                    User::LeaveIfError( BaflUtils::CopyFile( 
+                        iFs, fileSrc, file ) );
+                    break;
+                    }
+                case EInstallDeleteFromSrc:
+                    {
+                    // delete files from src if they are not found from dest
+                    TRACE( T_LIT( "CBSInstallHandler::SyncFilesL del") );
+                    OperationNotifyL( aOperation, fileSrc );
+                    User::LeaveIfError( BaflUtils::DeleteFile( iFs, fileSrc ) );
+                    break;
+                    }
+                default:
+                    {
+                    // Every operation should have a case!
+                    __ASSERT_DEBUG( EFalse, 
+                        User::LeaveIfError( KErrArgument ) );
+                    }
+                }
+            
+            OperationExecuted = ETrue;
+            CleanupStack::PopAndDestroy( fileSrcBuf );
+            }
+        }
+    CleanupStack::PopAndDestroy( 2 ); // fileBuf, dir
+    TRACE( T_LIT( "CBSInstallHandler::SyncFilesL end") );
+    return OperationExecuted;
+    }
+
+// -----------------------------------------------------------------------------
+// CBSInstallHandler::OperationNotifyL()
+// -----------------------------------------------------------------------------
+//
+void CBSInstallHandler::OperationNotifyL( TInstallOperation aOperation, 
+                                          const TDesC& aSrcFile )
+    {
+	TRACE( T_LIT( "CBSInstallHandler::OperationNotifyL start") );
+    if( aOperation == EInstallDeleteFromSrc )
+        {
+        // parse brand id and application id from filename
+        TParse parse;
+        parse.Set( aSrcFile, NULL, NULL );
+        
+        // find ids from filename
+        TInt firstSepar = parse.Name().Find( KInstallFileDataSeparator );
+        TInt secondSepar = parse.Name().
+            Mid( firstSepar + 1 ).Find( KInstallFileDataSeparator );
+        TInt cutlen = 0;
+        secondSepar == KErrNotFound ? cutlen = parse.Name().Length() :
+                                      cutlen = firstSepar + secondSepar + 1;
+        
+        // brandString: [brandId]$[appId]
+        TPtrC brandString ( parse.Name().Left( cutlen ) );
+        if( IsBrandInstalled( brandString ) )
+            {
+            TRACE( T_LIT( "CBSInstallHandler::OperationNotifyL %S exists in import\\install =>RProperty NOT UPDATED!"),&aSrcFile );
+            // brand still exists, so no need to uninstall.
+            return;
+            }
+
+        // Create discardedbrand.txt file in the /appid/brandid path
+        CreateFlagFile( aSrcFile );
+                
+        UpdateRPropertyL( brandString );
+        
+        TRACE( T_LIT( "CBSInstallHandler::OperationNotifyL uninstall string to pub&sub updated OK") );
+        }
+	TRACE( T_LIT( "CBSInstallHandler::OperationNotifyL end") );
+    }
+    
+// -----------------------------------------------------------------------------
+// CBSInstallHandler::IsBrandInstalled()
+// -----------------------------------------------------------------------------
+//
+TBool CBSInstallHandler::IsBrandInstalled( const TDesC& aBrand )
+    {
+	TRACE( T_LIT( "CBSInstallHandler::IsBrandInstalled start") );
+    TFileName file;
+    GetPrivateFolder( file, KInstallObservePath );
+    file.Append( aBrand );
+    file.Append( KBrandInstallExt );
+    
+    // check file directly: 
+    // aaa$bbb -> aaa$bbb.install
+    CDir* dir = NULL;
+    iFs.GetDir( file, KEntryAttNormal, ESortNone, dir );
+    if( dir && dir->Count() > 0 )
+        {
+        // brand is installed
+        delete dir;
+    	TRACE( T_LIT( "CBSInstallHandler::IsBrandInstalled true") );
+        return ETrue;
+        }
+    delete dir;
+    dir = NULL;
+
+    GetPrivateFolder( file, KInstallObservePath );
+    file.Append( aBrand );
+    file.Append( KInstallFileDataSeparator );
+    file.Append( KBrandWild );
+    file.Append( KBrandInstallExt );
+    
+    // check file with different versions:
+    // aaa$bbb -> aaa$bbb$*.install
+    iFs.GetDir( file, KEntryAttNormal, ESortNone, dir );
+    if( dir && dir->Count() > 0 )
+        {
+        // brand is installed
+        delete dir;
+    	TRACE( T_LIT( "CBSInstallHandler::IsBrandInstalled true") );
+        return ETrue;
+        }
+    delete dir;
+    
+    // brand is not installed
+	TRACE( T_LIT( "CBSInstallHandler::IsBrandInstalled false") );
+    return EFalse;
+    }
+
+// -----------------------------------------------------------------------------
+// CBSInstallHandler::GetPrivateFolder()
+// -----------------------------------------------------------------------------
+//
+void CBSInstallHandler::GetPrivateFolder( TDes& aPath, const TDesC& aAppend )
+    {
+    iFs.PrivatePath( aPath );
+    aPath.Insert( 0, KInstallDrive );
+    aPath.Append( aAppend );
+    }
+
+void CBSInstallHandler::CreateFlagFile(const TDesC& aSrcFile)
+	{
+	TRACE( T_LIT( "CBSInstallHandler::CreateFlagFile begin") );
+	// parse brand id and application id from aSrcFile
+	TParse parse;
+	parse.Set( aSrcFile, NULL, NULL );
+
+	// find ids from filename
+	TInt firstSepar = parse.Name().Find( KInstallFileDataSeparator );
+
+	// Get the brand Id
+	HBufC* brandId = (parse.Name().Left(firstSepar)).AllocL();
+
+	// to get application id
+	TInt secondSepar = parse.Name().
+	    Mid( firstSepar + 1 ).Find( KInstallFileDataSeparator );
+	
+	TInt cutlen = 0;
+	secondSepar == KErrNotFound ? cutlen = parse.Name().Length() :
+	                              cutlen = firstSepar + secondSepar + 1;
+
+
+	TParse parseAgain;
+	parseAgain.Set(parse.Name().Left( cutlen ), NULL, NULL );
+	HBufC* applicationId = (parseAgain.Name().Right( cutlen - firstSepar - 1)).AllocL(); 
+	
+
+	HBufC *fileName = CBSStorageManager::ConstructDiscardBrandFileNameL(*applicationId, *brandId) ;
+	CleanupStack::PushL(fileName);
+	HBufC *fullPath = CBSStorageManager::FullDiscardBrandFileNameLC( *fileName ) ;
+	
+	// crate a flag file
+	RFile file;
+	file.Create(iFs, *fullPath, EFileWrite);
+	file.Close() ;
+	
+	delete brandId ;
+	delete applicationId ;
+	
+	CleanupStack::PopAndDestroy(fullPath) ;
+	CleanupStack::PopAndDestroy(fileName) ;
+	TRACE( T_LIT( "CBSInstallHandler::CreateFlagFile end") );
+	}
+
+// -----------------------------------------------------------------------------
+// CBSInstallHandler::CheckForDiscardedBrandsL()
+// -----------------------------------------------------------------------------
+//
+TBool CBSInstallHandler::CheckForDiscardedBrandsL( const TDesC& aDir )
+    {
+    TRACE( T_LIT( "CBSInstallHandler::CheckForDiscardedBrandsL begin") );
+    TBool discardedBrandExists( EFalse );
+       
+    CDir* appDir = NULL; // will contain all application folders     
+    
+    TPath path;
+    iFs.PrivatePath( path );
+    path.Insert( 0, KInstallDrive );
+    path.Append( aDir ); 
+    path.Append( KDirSeparator ); // "C:\\private\\102828dd\\data\\"    
+
+    User::LeaveIfError( 
+        iFs.GetDir( path, KEntryAttDir, ESortNone, appDir ) );
+    CleanupStack::PushL( appDir );
+
+    /*TFileName find( path );
+    find.Append( KInstallFiles );*/
+    
+    // create array of files (as text)
+    TInt count = appDir->Count();
+    //for each application do...
+    for( TInt i = 0; i < count; i++ )
+        { 
+        TFileName file( path );
+        file.Append( (*appDir)[i].iName );
+        file.Append( KDirSeparator ); // "C:\\private\\102828dd\\data\\xsp\\"    
+        
+        TRACE( T_LIT( "CBSInstallHandler::CheckForDiscardedBrandsL AppDir='%S'"),&file );
+        CDir* brandDir = NULL; // will contain all brand folder for each application 
+        User::LeaveIfError( 
+            iFs.GetDir( file, KEntryAttDir, ESortNone, brandDir ) );
+        CleanupStack::PushL( brandDir );
+        
+        TInt countBrands = brandDir->Count();
+        //for each brand of a certain application do...
+        for( TInt j(0) ; j < countBrands ; j++ )
+            {            
+            TFileName discardedFile( file );
+            discardedFile.Append( (*brandDir)[j].iName );
+            discardedFile.Append( KDirSeparator );
+            discardedFile.Append( KDiscardBrandFileName );   // "C:\\private\\102828dd\\data\\xsp\\branda\\discarded.txt"    
+            
+            TRACE( T_LIT( "CBSInstallHandler::CheckForDiscardedBrandsL BrandDir='%S'"),&file );
+            
+            // check for the existance of the 'discarded.txt' file  
+            if ( BaflUtils::FileExists( iFs, discardedFile ) )
+                {
+                TRACE( T_LIT( "CBSInstallHandler::CheckForDiscardedBrandsL '%S' found!=>brand is discarded."),&discardedFile );
+                discardedBrandExists = ETrue;
+                
+                //set RProperty for this brand                
+                
+                //the string written to RProperty: 
+                //"[brandId]$[applicationId]"(e.g."branda$xsp")
+                HBufC* writeBuf = HBufC::NewLC( RProperty::KMaxPropertySize );
+                TPtr writeData( writeBuf->Des() );                
+                writeData.Append( (*brandDir)[j].iName );
+                writeData.Append( KInstallFileDataSeparator );
+                writeData.Append( (*appDir)[i].iName );
+                TRACE( T_LIT( "CBSInstallHandler::CheckForDiscardedBrandsL uninstallstring='%S'"),writeBuf );
+                
+                //UpdateProperty here!!!
+                UpdateRPropertyL( writeData );
+                
+                CleanupStack::PopAndDestroy( writeBuf );
+                }
+            }        
+        CleanupStack::PopAndDestroy( brandDir );
+        }
+
+    CleanupStack::PopAndDestroy( appDir );    
+    TRACE( T_LIT( "CBSInstallHandler::CheckForDiscardedBrandsL end") );
+    return discardedBrandExists;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CBSInstallHandler::UpdateRPropertyL 
+// -----------------------------------------------------------------------------
+//
+void CBSInstallHandler::UpdateRPropertyL( const TDesC& aUninstallationString )
+    {
+    HBufC* dataBuf = HBufC::NewLC( RProperty::KMaxPropertySize );
+    TPtr data( dataBuf->Des() );                
+    
+    // Update uninstall string to pub&sub (only if the RProperty does not 
+    // contain the unistallation string yet)
+    RProcess me;
+    TUid uid = me.Identity();
+    TInt ret = RProperty::Define( uid, KUninstallKey, RProperty::EText);
+    if( ret != KErrAlreadyExists )
+        {
+        TRACE( T_LIT( "CBSInstallHandler::UpdateRPropertyL RProperty does not exist") );
+        User::LeaveIfError( ret );
+        }
+    TRACE( T_LIT( "CBSInstallHandler::UpdateRPropertyL RProperty created/exists OK") );    
+    User::LeaveIfError( RProperty::Get( uid, KUninstallKey, data ) );
+    
+    // don't append the uninstall string in case it already exists
+    // in the RProperty
+    if( KErrNotFound == data.Find( aUninstallationString ) )
+        {
+        if( data.Length() > 0 )
+            {
+            data.Append( KLineFeed );
+            TRACE( T_LIT( "CBSInstallHandler::UpdateRPropertyL lineFeed appended to RProperty uninstallstring") );
+            }
+        data.Append( aUninstallationString );
+        TRACE( T_LIT( "CBSInstallHandler::UpdateRPropertyL '%S' appended to RProperty uninstallstring"), &aUninstallationString );
+        if( data.Length() <= RProperty::KMaxPropertySize )
+            {
+            User::LeaveIfError( RProperty::Set( uid, KUninstallKey, data ) );
+            TRACE( T_LIT( "CBSInstallHandler::UpdateRPropertyL RProperty::Set OK") );
+            }
+        }
+    else
+        {
+        TRACE( T_LIT( "CBSInstallHandler::UpdateRPropertyL '%S' already exists in RProperty"), &aUninstallationString );    
+        }
+        
+    CleanupStack::PopAndDestroy( dataBuf );   
+    
+    }
+
+//  END OF FILE
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/brandingserver/bsserver/cbsinstallhandler.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,176 @@
+/*
+* 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: cbsinstallhandler.h
+*
+*/
+
+
+#ifndef __CBSINSTALLHANDLER_H__
+#define __CBSINSTALLHANDLER_H__
+
+#include <e32base.h>
+
+// FORWARD DECLARATIONS
+class RFs;
+
+/**
+ * CBSInstallHandler
+ *
+ * Handles installation and uninstallation of brand packages.
+ * Calls external application "bsinstall.exe" to do the actual work.
+ * Can Observe the installation directory so that any sis installation
+ * can be detected while the server is running.
+ *
+ */
+NONSHARABLE_CLASS( CBSInstallHandler ): public CActive
+	{
+	public: 
+	    
+	    // Operations for folder synchronization:
+	    enum TInstallOperation
+	        {
+	        // copy files from source to destination if they don't
+	        // already exists. 
+	        EInstallCopyNewToDest,
+	        
+	        // Delete files from source directory if the same
+	        // files doesn't exist in destination directory.
+	        EInstallDeleteFromSrc
+	        };
+	
+	public: // constructors
+		
+		static CBSInstallHandler* NewL();
+
+    	virtual ~CBSInstallHandler();
+
+	private: // constructors
+	
+		void ConstructL();
+						 
+		CBSInstallHandler();
+
+	public:
+	
+        /**
+        * Uninstall removed brands and installs new brands.
+        * This should be called right after construction to sync the
+        * installation state.
+        */
+        void InstallNewFilesL();
+        
+        /**
+        * Start observing installation folder. Detects new brands if they
+        * are installed while the server is active.
+        */
+        void StartObservingL();
+        
+        /**
+        * Stop observing installation folder. All new brands are installed
+        * only when calling InstallNewFilesL.
+        */
+        void StopObserving();
+
+    private: // From CActive
+    
+        /**
+        * @see CActive
+        */
+        void RunL();
+        
+        /**
+        * @see CActive
+        */
+        void DoCancel();
+
+    private: // new methods
+        
+        /**
+        * Launches external installer application. It should install all
+        * available brands into server.
+        */
+        void LaunchInstallerAppL();
+               
+        /**
+        * Sync files between aSrcDir and aDestDir, according to given 
+        * operation. See TInstallOperation for operations. Calls 
+        * OperationNotifyL before every operation.
+        *
+        * @param aSrcDir Source directory
+        * @param aDestDir Destination directory
+        * @param aOperation Sync operation to execute
+        * @return ETrue  - Something synchronized
+        *         EFalse - Nothing synchronized
+        */
+        TBool SyncFilesL( const TDesC& aSrcDir, const TDesC& aDestDir, 
+                          TInstallOperation aOperation );
+        
+        /**
+        * Notification that file is about to be synchronized. 
+        *
+        * @param aOperation operation type which will be executed
+        * @param aSrcFile file under operation
+        */
+        void OperationNotifyL( TInstallOperation aOperation, 
+                               const TDesC& aSrcFile );
+        
+        /**
+        * check if some version of given brand is installed in
+        * branding server. 
+        *
+        * @param aBrand brand installation file to check
+        *        this has to be brand file name without extension and 
+        *        version information.
+        */
+        TBool IsBrandInstalled( const TDesC& aBrand );                  
+
+        /**
+        * Helper method to get servers private path
+        * @param aPath contains the path to servers private folder
+        * @param aAppend text to add into private path.
+        */
+        void GetPrivateFolder( TDes& aPath, const TDesC& aAppend = KNullDesC );
+	
+        /**
+        * To create a flag file if brand gets discarded
+        * @param aSrcFile file under operation
+        */
+		void CreateFlagFile(const TDesC& aSrcFile);
+
+        /**
+        * Checks if an discarded brand exists.
+        * (It also writes the RProperty for the bsinstall.exe)
+        *
+        * @param aDir the folder of the data storages
+        * @return ETrue, in case a discarded brand was found, EFalse otherwise
+        */
+        TBool CheckForDiscardedBrandsL( const TDesC& aDir );
+        
+        
+        /**
+        * Updates the RProperty. The specified string is added to the
+        * RProperty only if RProperty does not contain the same string yet.
+        *
+        * @param aUninstallationString a string
+        */
+        void UpdateRPropertyL( const TDesC& aUninstallationString );
+        
+	private: // data
+
+        // Own. File server session handle.
+        RFs     iFs;
+    };
+
+#endif      //  __CBSINSTALLHANDLER_H__
+//  END OF FILE
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/brandingserver/bsserver/cbsserver.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,664 @@
+/*
+* 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: cbsserver.cpp
+*
+*/
+
+
+//  INCLUDE FILES
+
+#define __INCLUDE_CAPABILITY_NAMES__
+#define __INCLUDE_ALL_SUPPORTED_CAPABILITIES__
+
+#include "cbsserver.h"
+#include "cbssession.h"
+#include "bsserverdefs.h"
+#include "debugtrace.h"
+#include "cbsstoragemanager.h"
+#include "cbsinstallhandler.h"
+#include "cbsbackupobserver.h"
+
+// CBSFileMapping
+
+CBSServer::CBSFileMapping* CBSServer::CBSFileMapping::NewL( CBSSession* aSession,
+				    									    const TDesC& aFile,
+				    									    TBool aVersioned )
+	{
+	CBSFileMapping* self = new( ELeave ) CBSFileMapping( aVersioned );
+	CleanupStack::PushL( self );
+	self->ConstructL( aSession, aFile );
+	CleanupStack::Pop( self );
+	return self;
+	}
+void CBSServer::CBSFileMapping::ConstructL(  CBSSession* aSession,
+    									     const TDesC& aFile )
+	{
+	iSession = aSession;
+	iFile = aFile.AllocL();
+	}
+CBSServer::CBSFileMapping::CBSFileMapping( TBool aVersioned )
+: iVersioned( aVersioned )
+	{
+	}
+CBSServer::CBSFileMapping::~CBSFileMapping()
+	{
+	delete iFile;
+	}
+
+CBSSession* CBSServer::CBSFileMapping::Session()
+	{
+	return iSession;
+	}
+const TDesC& CBSServer::CBSFileMapping::File()
+	{
+	return *iFile;
+	}
+TBool CBSServer::CBSFileMapping::Versioned()
+	{
+	return iVersioned;
+	}
+
+
+// ==============================================================
+// =============== PLATSEC POLICY CONFIGURATION =================
+// ==============================================================
+
+static const TInt KBSPlatSecRangeCount = 2;
+
+//Ranges for the Request values
+static const TInt KBSPlatSecRanges[ KBSPlatSecRangeCount ] =
+    {
+    0,
+    EBSOperationLast
+    };
+
+
+// Element indexes for the defined ranges
+static const TUint8 KBSPlatSecElementsIndex[ KBSPlatSecRangeCount ] =
+    {
+    0,
+    CPolicyServer::ENotSupported
+    };
+
+
+// Policy elements
+static const CPolicyServer::TPolicyElement KBSPlatSecElements[] =
+    {
+        {
+        _INIT_SECURITY_POLICY_C2( ECapabilityReadUserData,
+                                  ECapabilityWriteUserData ),
+        -5 //CPolicyServer::EFailClient
+        }
+    };
+
+
+// The platsec policy
+static const CPolicyServer::TPolicy KBSPlatSecPolicy =
+    {
+    // Shortcut to the index into Elements,that is used to check a connection attempt
+    0,
+
+    // Number of ranges in the iRanges array
+    KBSPlatSecRangeCount,
+
+    // A pointer to an array of ordered ranges of request numbers
+    KBSPlatSecRanges,
+
+    // A pointer to an array of TUint8 values specifying
+    // the appropriate action to take for each range in iRanges
+    KBSPlatSecElementsIndex,
+
+    // A pointer to an array of distinct policy elements
+    KBSPlatSecElements
+    };
+
+
+
+// ==============================================================
+// ======================= SERVER  ==============================
+// ==============================================================
+void CBSServer::ExecuteL()
+    {
+    TRACE( T_LIT( "CBrandingServer::ExecuteL() begin") );
+    // start scheduler
+    CActiveScheduler* pA = new( ELeave )CActiveScheduler;
+    CleanupStack::PushL( pA );
+    CActiveScheduler::Install( pA );
+
+
+    // create server
+    CBSServer* server = new( ELeave ) CBSServer();
+    CleanupStack::PushL( server );
+    server->InitializeL();
+    server->StartL( KBSServerName );
+
+
+    //Signal client that we are started
+    RProcess().Rendezvous( KErrNone );
+
+    //Execute the server
+    // Codescanner warning: using CActiveScheduler::Start (id:3)
+    // this has to be called for server starting.
+    CActiveScheduler::Start(); // CSI: 3 # See above
+
+
+    //Cleanup
+    CleanupStack::PopAndDestroy( server );//server
+    CleanupStack::PopAndDestroy( pA );
+    CActiveScheduler::Install( NULL );
+    TRACE( T_LIT( "CBrandingServer::ExecuteL() end") );
+    }
+
+
+
+CBSServer::~CBSServer()
+    {
+    TRACE( T_LIT( "CBrandingServer::~CBSServer() begin") );
+    delete iBackupObserver;
+    delete iInstallHandler;
+    iSessions.Close();
+    iFileMapping.Close();
+    delete iStorageManager;
+
+#if _BullseyeCoverage
+    cov_write();
+#endif
+    TRACE( T_LIT( "CBrandingServer::~CBSServer() end") );
+    }
+
+
+
+CBSServer::CBSServer()
+    : CPolicyServer( CActive::EPriorityStandard,
+                     KBSPlatSecPolicy )
+    {
+    }
+
+
+
+CSession2* CBSServer::NewSessionL( const TVersion &aVersion,
+                                          const RMessage2& /*aMessage*/ ) const
+    {
+    TRACE( T_LIT( "CBrandingServer::NewSessionL() begin") );
+    TVersion srvVersion( KBSVersionMajor,
+                         KBSVersionMinor,
+                         KBSVersionBuild );
+
+
+    if( !User::QueryVersionSupported( aVersion, srvVersion ) )
+        {
+        User::Leave( KErrNotSupported );
+        }
+
+    CBSSession* session = CBSSession::NewL();
+    //enable backup observer
+    iBackupObserver->RegisterObserver( session );
+    
+    TRACE( T_LIT( "CBrandingServer::NewSessionL() end session[%d] created"), session );
+    return session;
+    }
+
+
+CPolicyServer::TCustomResult
+    CBSServer::CustomFailureActionL( const RMessage2& aMsg,
+                                            TInt /*aAction*/,
+                                            const TSecurityInfo& aMissing )
+    {
+    TRACE( T_LIT( "CBrandingServer::CustomFailureActionL() Request %d to session [%d] failed."),
+                   aMsg.Function(), aMsg.Session() );
+
+    TBuf<512> diagnosticMsg;
+    _LIT( KDetails, "Failure details: ");
+    diagnosticMsg.Append( KDetails );
+    _LIT( KFormat, "SecureId[%d] VendorId[%d] Missing caps[" );
+    diagnosticMsg.AppendFormat( KFormat,
+                                aMissing.iSecureId.iId, aMissing.iVendorId.iId );
+
+    const SCapabilitySet& missingCaps = (const SCapabilitySet&) aMissing.iCaps;
+    TBuf<1> separator;
+    _LIT( KSeparator, "]" );
+	for( TInt ix = 0; ix < ECapability_Limit; ix++ )
+		{
+		if( missingCaps[ix>>5] &(1<<(ix&31)))
+			{
+            diagnosticMsg.Append( separator );
+
+            const char* capName = CapabilityNames[ ix ];
+		    while( *capName )
+		        {
+                TUint16 c = *capName;
+                diagnosticMsg.Append( &c, 1 );
+                ++capName;
+                }
+			
+            separator = KSeparator;
+    		}
+		}
+
+    diagnosticMsg.Append( KSeparator );
+    TRACE( T_LIT( "%S"), &diagnosticMsg );
+
+    return CPolicyServer::EFail;
+    }
+
+void CBSServer::HandleBackupStateL( TBackupState aState )
+    {
+    switch( aState )
+        {
+        case EBackupNotActive: // backup has completed
+            {
+            // restart install handler and check for brand changes
+            iInstallHandler->InstallNewFilesL();
+            iInstallHandler->StartObservingL();
+            
+            //notify clients that we're back in business
+            break;
+            }
+        case EBackupActive: // backup activated
+            {
+            // stop install handler 
+            iInstallHandler->StopObserving();
+            
+            // Notify clients that branding data is not currently 
+            //       available
+            break;
+            }
+        default:
+            {
+            // unknown state
+            }
+        }
+    }
+
+void CBSServer::SessionCreatedL( CBSSession* aSession )
+    {
+    TRACE( T_LIT( "CBSServer::SessionCreatedL begin aSession[%d]"),aSession );
+    iSessionCount++;
+    iSessions.AppendL( aSession );
+    }
+
+
+void CBSServer::SessionDied( CBSSession* aSession )
+    {
+    TInt count = iSessions.Count();
+	for( TInt i = 0; i < count; i++ )
+		{
+		if( iSessions[i] == aSession )
+			{
+			iSessions.Remove( i );
+			break;
+			}
+		}
+	TInt ignore = 0;
+	TRAP( ignore, UnRegisterSessionL( aSession ) );
+	
+    //enable backup observer
+	iBackupObserver->UnregisterObserver( aSession );
+    
+    iSessionCount--;
+    if( iSessionCount == 0 )
+        {
+        // Codescanner warning: using CActiveScheduler::Stop ( Id: 4)
+        // it is required to stop the server
+        CActiveScheduler::Stop(); // CSI: 4 # See above
+        }
+    }
+
+
+
+TBool CBSServer::MatchSessionL( const TDesC& aApplicationId,
+							    const TDesC& aBrandId,
+							    TLanguage aLanguageId,
+							 	CBSSession* aSession,
+							 	TInt aReserved  )
+	{
+	TInt sessionCount = iSessions.Count();
+	TBool returnValue = EFalse;
+	for( TInt i = 0; i < sessionCount; i++ )
+		{
+		if( iSessions[i] == aSession )
+			{
+			// we don't want to report the querying session itself
+			continue;
+			}
+		if( iSessions[i]->MatchSessionL( aApplicationId,
+										 aBrandId,
+										 aLanguageId,
+										 aReserved ) )
+			{
+			// even one match is enough for us
+			returnValue = ETrue;
+			break;
+			}
+		}
+	return returnValue;
+	}
+
+TBool CBSServer::MatchSessionUninstallL( const TDesC& aApplicationId,
+								 const TDesC& aBrandId, CBSSession* aSession)
+{
+	TInt sessionCount = iSessions.Count();
+	TBool returnValue = EFalse;
+	for( TInt i = 0; i < sessionCount; i++ )
+		{
+		if( iSessions[i] == aSession )
+			{
+			// we don't want to report the querying session itself
+			continue;
+			}
+		if( iSessions[i]->MatchSessionUninstallL( aApplicationId,
+										 aBrandId ))
+			{
+			// even one match is enough for us
+			returnValue = ETrue;
+			break;
+			}
+		}
+	return returnValue;
+	
+}
+
+void CBSServer::RegisterFileForSessionL( CBSSession* aSession, 
+										 const TDesC& aFile,
+										 TBool aVersioned )
+	{
+	TRACE( T_LIT( "CBSServer::RegisterFileForSessionL begin aSession[%d],aFile[%S]"),aSession,&aFile );
+	TBool found  = EFalse;
+	TInt count = iFileMapping.Count();		
+	for( TInt i = 0; i < count; i ++ )
+		{		
+		if( iFileMapping[i]->Session() == aSession && iFileMapping[i]->File() == aFile &&
+				iFileMapping[i]->Versioned() == aVersioned)
+			{
+				found = ETrue; 			
+			}			
+		}
+	
+	if(!found)
+		{			
+		
+		CBSFileMapping* fileMapping = CBSFileMapping::NewL( aSession, aFile, aVersioned );
+		CleanupStack::PushL( fileMapping );
+		iFileMapping.AppendL( fileMapping );
+		CleanupStack::Pop( fileMapping );
+		}
+	TRACE( T_LIT( "CBSServer::RegisterFileForSessionL end") );
+	}
+
+void CBSServer::UnRegisterSessionL( CBSSession* aSession )
+	{
+	TRACE( T_LIT( "CBSServer::RegisterFileForSessionL begin aSession[%d]"),aSession );
+	TInt count = iFileMapping.Count();
+	for( TInt i = 0; i < count; i ++ )
+		{
+		if( iFileMapping[i]->Session() == aSession )
+			{
+
+			if( !iStorageManager )
+				{
+				iStorageManager = CBSStorageManager::NewL( aSession, KNullDesC );	
+				}
+			if( !FileStillInUse( aSession, iFileMapping[i]->File() ) )
+				{
+				TPtrC baseFile = KNullDesC();
+				if( iFileMapping[i]->Versioned() )
+					{
+					baseFile.Set( iStorageManager->FilenameWithoutVersion( iFileMapping[i]->File() ) );
+					}
+				else
+					{
+					baseFile.Set( iFileMapping[i]->File() );
+					}
+				// we found the session, now check if any other
+				// session is using the same file
+				if( !FileStillInUse( aSession, baseFile ) )
+					{
+					// no other sessions using the file
+					// cleanup versioned file
+					CleanupFileL( iFileMapping[i]->File() );
+					}					
+
+				}
+			CBSFileMapping* fileMapping = iFileMapping[i];
+			iFileMapping.Remove( i );
+			delete fileMapping;
+			break;
+			}
+		}
+	TRACE( T_LIT( "CBSServer::RegisterFileForSessionL end") );
+	}
+
+TBool CBSServer::FileStillInUse( CBSSession* aSession,
+								 const TDesC& aFile )
+	{
+	TBool returnValue = EFalse;
+	TInt count = iFileMapping.Count();
+	for( TInt i = 0; i < count; i ++ )
+		{
+		if( 0 == iFileMapping[i]->File().Compare( aFile ) )
+			{
+			// file found, check that it's not the same sesion
+			if( iFileMapping[i]->Session() != aSession )
+				{
+
+				// it's not the same session
+				// so the file is still in use, we can
+				// return ETrue
+				returnValue = ETrue;
+				break;
+				}
+			}
+		}
+	return returnValue;
+	}
+		
+void CBSServer::CleanupFileL( const TDesC& aFile )
+	{
+	if( !iStorageManager )
+		{
+		iStorageManager = CBSStorageManager::NewL( NULL, KNullDesC);	
+		}
+	iStorageManager->CleanupFileL( aFile ); 
+	}
+
+TArray<CBSServer::CBSFileMapping*> CBSServer::RegisteredFiles()
+	{
+	return iFileMapping.Array();
+	}
+
+void CBSServer::InitializeL()
+    {
+    TRACE( T_LIT( "CBSServer::InitializeL begin") );
+    // Initialize brand install handler
+    iInstallHandler = CBSInstallHandler::NewL();
+    iInstallHandler->InstallNewFilesL();
+    iInstallHandler->StartObservingL();
+    
+    //to enable backup observer
+    // Initialize backup and restore observer
+    CBSBackupObserver* tmp = CBSBackupObserver::NewL();
+    delete iBackupObserver;
+    iBackupObserver = tmp;
+    User::LeaveIfError( iBackupObserver->RegisterObserver( this ) );
+    TRACE( T_LIT( "CBSServer::InitializeL end") );
+    }
+
+void CBSServer::BrandUpdatedL( const TDesC& aApplicationId,
+							   const TDesC& aBrandId,
+							   TLanguage aLanguageId,
+							   CBSSession* aSession,
+							   TInt aReserved )
+	{
+	TRACE( T_LIT( "CBSServer::BrandUpdatedL begin aAppid[%S],aBrandId[%S]"),&aApplicationId, &aBrandId );
+	TInt sessionCount = iSessions.Count();
+	for( TInt i = 0; i < sessionCount; i++ )
+		{
+		if( iSessions[i] == aSession )
+			{
+			// we don't want to report the querying session itself
+			continue;
+			}
+		iSessions[i]->BrandUpdatedL( aApplicationId,
+									 aBrandId,
+									 aLanguageId,
+									 aReserved );
+		}
+	TRACE( T_LIT( "CBSServer::BrandUpdatedL end") );
+	}
+
+
+
+// ---------------------------------------------------------------------------
+// CBSServer::DisplaySessionInfoL display the info for each open session,
+// except for the one that called this method
+// ---------------------------------------------------------------------------
+//
+void CBSServer::DisplaySessionInfoL( CBSSession* aSession, TInt aErrorCode )
+	{
+    TRACE( T_LIT( "CBSServer::DisplaySessionInfoL() begin aSession[%d], aErrorCode[%d]"),aSession,aErrorCode );
+
+    User::LeaveIfNull( aSession );
+    // some constants
+    const TInt KStringLength = 512;
+    const TInt KNumberLength = 16;
+    _LIT( KMessage0,"Operation failed.Errorcode:");    
+    _LIT( KMessage1," Info on open sessions [ProcessFileName|ThreadId|ProcessId|Caption]:");
+    _LIT( KBracketOpen, " [");
+    _LIT( KBracketClose, "]");
+    _LIT( KSeparator, "|");
+    
+
+    HBufC* outputString = HBufC::NewLC( KStringLength );
+    TPtr outputStringPtr( outputString->Des() );
+
+    TBuf<KNumberLength> number;
+    number.Num( aErrorCode );
+    
+    //make sure the string is long enough
+    TInt newLength = outputString->Length() +
+                     KMessage0().Length() +
+                     number.Length() + 
+                     KMessage1().Length();
+    
+    //reallocate if necessary
+    if ( outputStringPtr.MaxLength() < newLength )
+        {
+        CleanupStack::Pop( outputString );
+        outputString = outputString->ReAllocL( newLength );
+        outputStringPtr.Set( outputString->Des() );
+        CleanupStack::PushL( outputString );
+        }    
+        
+    outputStringPtr.Append( KMessage0 );
+    outputStringPtr.Append( number );
+    outputStringPtr.Append( KMessage1 );
+    
+        
+    TInt count = iSessions.Count();
+	TRACE( T_LIT( "CBSServer::DisplaySessionInfoL() numberSessions=%d"),count );
+	CBSSession* currentSession;
+	for( TInt i = 0; i < count; i++ )
+		{		
+		currentSession = iSessions[i];
+        TRACE( T_LIT( "CBSServer::DisplaySessionInfoL() iteration=%d session=%d"),i,currentSession );
+    	if ( currentSession 
+    	     && currentSession->InfoAvailable()
+    	     && currentSession != aSession )
+    	    {
+    		TBuf<KNumberLength> threadIdStr;
+    		TThreadId threadId;
+    		if ( KErrNone == currentSession->ThreadId( threadId ) )
+    		    {
+    		    threadIdStr.NumUC( threadId.Id(), EDecimal );
+    		    }    		
+    		TBuf<KNumberLength> processIdStr;
+    		TProcessId processId;
+    		if ( KErrNone == currentSession->ProcessId( processId ) )
+    		    {
+    		    processIdStr.NumUC( processId.Id(), EDecimal );
+    		    }
+            
+            //make sure the string is long enough
+            newLength = outputString->Length() +
+                        KBracketOpen().Length() +
+                        currentSession->FileName().Length() + 
+                        threadIdStr.Length() + 
+                        processIdStr.Length() +
+                        currentSession->Caption().Length() +                        
+                        ( 3 * KSeparator().Length() ) +                        
+                        KBracketClose().Length();
+
+            //reallocate if necessary
+            if ( outputStringPtr.MaxLength() < newLength )
+                {
+                CleanupStack::Pop( outputString );
+                outputString = outputString->ReAllocL( newLength );
+                outputStringPtr.Set( outputString->Des() );
+                CleanupStack::PushL( outputString );
+                }
+
+  		    outputStringPtr.Append( KBracketOpen );
+    		
+    		//processfilename
+    		outputStringPtr.Append( currentSession->FileName() );
+    		outputStringPtr.Append( KSeparator );
+    		    		
+    		//threadid    		
+    		outputStringPtr.Append( threadIdStr );
+    		outputStringPtr.Append( KSeparator );
+    		
+    		//processid    		
+    		outputStringPtr.Append( processIdStr );
+    		outputStringPtr.Append( KSeparator );	
+    		
+    		//caption
+    		outputStringPtr.Append( currentSession->Caption() );    		
+
+    		outputStringPtr.Append( KBracketClose );
+    	    }
+		}     
+	
+	TRACE( T_LIT( "CBSServer::DisplaySessionInfoL() string creation OK") );
+	TRACE( T_LIT( "%S"), outputString );
+	CleanupStack::PopAndDestroy( outputString );
+	TRACE( T_LIT( "CBSServer::DisplaySessionInfoL() end") );
+	}
+	
+// ==============================================================
+// ====================== ENTRY POINT ===========================
+// ==============================================================
+GLDEF_C TInt E32Main()
+    {
+    TRACE( T_LIT("E32Main - enter") );
+
+    User::RenameThread( KBSServerName );
+
+    CTrapCleanup* tc = CTrapCleanup::New();
+    if( !tc )
+        {
+        return KErrNoMemory;
+        }
+
+    TRAPD( err, CBSServer::ExecuteL() );
+    delete tc;
+
+    TRACE( T_LIT("E32Main - exit: %d"), err );
+    return err;
+    }
+
+
+
+//  END OF FILE
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/brandingserver/bsserver/cbsserver.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,147 @@
+/*
+* 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: CBSSERVER.H
+*
+*/
+
+
+#ifndef __CBSSERVER_H__
+#define __CBSSERVER_H__
+#include <e32base.h>
+
+#include "rbsobjowningptrarray.h"
+#include "mbsbackupobserver.h"
+
+// FORWARD DECLARATIONS
+class CBSSession;
+class CBSStorageManager;
+class CBSInstallHandler;
+class CBSBackupObserver;
+
+/**
+ * Service server.
+ */
+NONSHARABLE_CLASS( CBSServer ): public CPolicyServer,
+                                public MBSBackupObserver
+    {
+    public:
+    	NONSHARABLE_CLASS( CBSFileMapping ): public CBase
+    		{
+    		public:
+	    		static CBSFileMapping* NewL( CBSSession* aSession,
+	    									 const TDesC& aFile,
+	    									 TBool aVersioned );
+	    		
+	    		~CBSFileMapping();
+    		private: // constructors 
+	    		void ConstructL( CBSSession* aSession,
+								 const TDesC& aFile );
+	    		CBSFileMapping( TBool aVersioned );
+			
+			public: // new methods
+				CBSSession* Session();
+				const TDesC& File();
+				TBool Versioned();
+				
+			private: // data
+				// doesn't own: session
+				CBSSession* iSession;
+				HBufC* 		iFile;
+			  	TBool 		iVersioned;
+    		};
+    	
+    public:     // Execution and destructors
+        static void ExecuteL();
+        virtual ~CBSServer();
+
+    private:    // C++ constructor
+        CBSServer();
+
+    protected:     // Methods from CPolicyServer
+
+        CSession2* NewSessionL( const TVersion& aVersion,
+                                const RMessage2& aMessage ) const;
+
+
+        CPolicyServer::TCustomResult CustomFailureActionL(
+                                const RMessage2& aMsg,
+                                TInt aAction,
+                                const TSecurityInfo& aMissing);
+
+    public: // From MBSBackupObserver
+    
+        void HandleBackupStateL( TBackupState aState );
+        
+    public:     //New methods
+	    void SessionCreatedL( CBSSession* aSession );
+	    void SessionDied( CBSSession* aSession );
+    
+		TBool MatchSessionL( const TDesC& aApplicationId,
+							 const TDesC& aBrandId,
+							 TLanguage aLanguageId,
+							 CBSSession* aSession,
+							 TInt aReserved = 0 );
+							 
+		TBool MatchSessionUninstallL( const TDesC& aApplicationId,
+								 const TDesC& aBrandId, CBSSession* aSession);
+								 							 
+	    void RegisterFileForSessionL( CBSSession* aSession, 
+	    							  const TDesC& aFile,
+	    							  TBool aVersioned );
+
+		TArray<CBSServer::CBSFileMapping*> RegisteredFiles();
+		
+		TBool FileStillInUse( CBSSession* aSession,
+							  const TDesC& aFile );
+
+		void BrandUpdatedL( const TDesC& aApplicationId,
+							const TDesC& aBrandId,
+							TLanguage aLanguageId,
+							CBSSession* aSession,
+							TInt aReserved );
+        /**
+         * Displays the info for each open session - except for the one that 
+         * called this method.
+         *
+         * @param aSession the session that called this method
+         * @param aErrorCode a system-wide errorcode which is simply displayed
+         *        by this method
+         */
+        void DisplaySessionInfoL( CBSSession* aSession, TInt aErrorCode );
+
+	private: // New methods
+		void UnRegisterSessionL( CBSSession* aSession );
+
+		
+		void CleanupFileL( const TDesC& aFile );
+	    
+	    void InitializeL();
+	    
+    private:    //Data
+        TInt iSessionCount;
+        RPointerArray<CBSSession> iSessions;
+        RBSObjOwningPtrArray<CBSFileMapping> iFileMapping;
+        CBSStorageManager*		iStorageManager;
+        CBSInstallHandler*      iInstallHandler;
+        
+        // Own. Observer for backup and restore events
+        CBSBackupObserver*      iBackupObserver;
+    };
+
+#endif      //  __CBSSERVER_H__
+
+
+//  END OF FILE
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/brandingserver/bsserver/cbssession.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,1733 @@
+/*
+* 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: CBSSession.cpp
+*
+*/
+
+
+//  INCLUDE FILES
+#include <e32base.h>
+#include <apgcli.h>
+
+#include "cbssession.h"
+#include "cbsserver.h"
+#include "debugtrace.h"
+#include "cbsbrandhandler.h"
+#include "cbsstoragemanager.h"
+#include "cbsstorage.h"
+#include "cbsbitmap.h"
+//#include "cbselement.h"
+#include "rbsobjowningptrarray.h"
+#include "bselementfactory.h"
+#include "bsimportconstants.h"
+#include <badesca.h>
+#include <s32buf.h>
+#include <s32mem.h>
+#include <utf.h>
+#include <e32property.h>
+
+// ==============================================================
+// ======================== SESSION =============================
+// ==============================================================
+
+// Two-phased constructor.
+CBSSession* CBSSession::NewL()
+    {
+    TRACE( T_LIT("CBSSession::NewL begin") );
+    CBSSession* self = new( ELeave ) CBSSession();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    TRACE( T_LIT("CBSSession::NewL end") );
+    return self;
+    }
+
+// Symbian OS default constructor can leave.
+void CBSSession::ConstructL()
+	{
+	}
+
+
+// destructor
+CBSSession::~CBSSession()
+    {
+    TRACE( T_LIT("CBSSession[%d]::~CBSSession()"), this );
+
+    if( Server() )
+        {
+        Server()->SessionDied( this );
+        }
+	delete iText;
+	delete iBuffer;
+	delete iBranding;
+	delete iSeveralData;
+
+	delete iApplicationId;
+	delete iBrandId;
+	delete iDefaultBrandId;
+	
+#ifdef __WINSCW__
+	if( iStorageManager )
+		{
+		iStorageManager->WriteIbyFiles();
+		}
+#endif
+	delete iStorageManager;
+    delete iSessionInfo;
+
+    }
+
+
+// C++ default constructor can NOT contain any code, that
+// might leave.
+//
+CBSSession::CBSSession()
+    {
+    }
+
+// ---------------------------------------------------------
+// CBSSession::CreateL
+//
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+void CBSSession::CreateL()
+    {
+    TRACE( T_LIT("CBSSession[%d]::CreateL()"), this );
+    Server()->SessionCreatedL( this );
+    }
+
+// ---------------------------------------------------------
+// CBSSession::ServiceL
+//
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+void CBSSession::ServiceL( const RMessage2 &aMessage )
+    {
+
+    /*if( !iSessionInfo )
+        {
+        TRAPD( err, ExtractInfoL( aMessage ) );
+        TRACE( T_LIT("CBSSession::ServiceL() ExtractInfoL returned with [%d]"), err );
+        }
+	*/
+    if( DispatchMessageL( aMessage ) )
+        {
+        if( !iMessageCompleted )
+        	{
+        	aMessage.Complete( KErrNone );
+        	}
+        }
+    }
+
+// ---------------------------------------------------------
+// CBSSession::ServiceError
+//
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+void CBSSession::ServiceError( const RMessage2& aMessage,
+                                      TInt aError )
+    {
+    aMessage.Complete( aError );
+    }
+
+// ---------------------------------------------------------
+// CBSSession::HandleBackupStateL
+//
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+void CBSSession::HandleBackupStateL( TBackupState aState )
+    {
+	iIsBackup = ETrue ;	
+    switch( aState )
+        {
+        case EBackupNotActive: // backup is complete
+            {
+            // release session lock
+            iBackupActive = EFalse;
+            if( iStorageManager )
+                {
+                iStorageManager->ReleaseLockL();
+                }
+                
+			// Sending backup active state change event after unlocking it
+			if( iObserverActive )
+				{
+				iObserverMessage.Complete( KErrNone );
+				iObserverActive = EFalse;
+				}
+
+            break;
+            }
+        case EBackupActive: // backup activated
+            {
+
+            // Lock session. Branding data is not available until
+            // backup is completed.
+            iBackupActive = ETrue;
+
+			// Sending backup active state change event before locking it
+			if( iObserverActive )
+				{
+				iObserverMessage.Complete( KErrNone );
+				iObserverActive = EFalse;
+				}
+
+            if( iStorageManager )
+                {
+                iStorageManager->LockStorage();
+                }
+            break;
+            }
+        default:
+            {
+            // unknown state
+            }
+        }
+
+        
+    }
+
+// ---------------------------------------------------------
+// CBSSession::DispatchMessageL
+//
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+TBool CBSSession::DispatchMessageL( const RMessage2& aMessage )
+    {
+    TRACE( T_LIT("CBrandingSession[%d]::DispatchMessageL() %d"),
+                  this, aMessage.Function() );
+	iMessageCompleted = EFalse;
+    TBool msgNeedsToBeCompleted = ETrue;
+    
+    if( iBackupActive )
+        {
+        // if backup is active, we don't take requests.
+        // We could take some requests which do not require disk
+        // operations. This is not a good solution and a better one should be
+        // investigated. I'm running out of time.
+        TInt msg = aMessage.Function() ; 
+        if( msg == EBSObserveGetChange ||
+        	msg == EBSObserveGetBackupState ||
+        	msg == EBSObserveBrand)
+        	{
+        	//allow to do the operation	
+        	}
+        else
+    	    {
+	       	User::Leave( KErrNotReady );	
+        	}
+        
+        }
+    
+    switch( aMessage.Function() )
+        {
+        case EBSInitInstall:
+        	{
+        	InitUpdateL( aMessage, EBSTxInstall );
+        	break;
+        	}
+        case EBSInitUninstall:
+        	{
+        	InitUpdateL( aMessage, EBSTxUninstall );
+        	break;
+        	}
+        case EBSInitAppend:
+        	{
+        	InitUpdateL( aMessage, EBSTxAppend );
+        	break;
+        	}
+        case EBSInitReplace:
+        	{
+        	InitUpdateL( aMessage, EBSTxReplace );
+        	break;
+        	}
+        case EBSInitAccess:
+        	{
+        	InitAccessL( aMessage );
+        	break;
+        	}
+        case EBSPrepareText:
+            {
+			GetTextL( aMessage );
+            break;
+            }
+        case EBSGetText:
+            {
+            if( iText )
+            	{
+            	aMessage.WriteL( 2, *iText );	
+            	}
+			else
+				{
+				aMessage.WriteL( 2, KNullDesC() );
+				}
+            break;
+            }
+
+		case EBSIsBrandUpdateRequired:
+			isBrandUpdateRequiredL (aMessage);
+			break;
+
+        case EBSGetInt:
+            {
+			GetIntL( aMessage );
+            break;
+            }
+
+        case EBSPrepareBuffer:
+            {
+			GetBufferL( aMessage );
+            break;
+            }
+            
+        case EBSGetBuffer:
+            {
+            if( iBuffer )
+            	{
+            	aMessage.WriteL( 2, *iBuffer );	
+            	}
+			else
+				{
+				aMessage.WriteL( 2, KNullDesC8() );
+				}
+            break;
+            }
+            
+        case EBSGetFile:
+            {
+ 			GetFileL( aMessage );
+            break;
+            }
+
+        case EBSPrepareSeveral:
+        	{
+			PrepareSeveralL( aMessage );
+        	break;
+        	}
+
+        case EBSGetSeveral:
+        	{
+			GetSeveralL( aMessage );
+        	break;
+        	}
+
+        case EBSPrepareStructure:
+        	{
+			PrepareStructureL( aMessage );
+        	break;
+        	}
+
+        case EBSGetStructure:
+    		{
+			GetStructureL( aMessage );
+    		break;
+    		}
+
+        case EBSStartTransaction:
+        	{
+			StartTransactionL( aMessage );
+        	break;
+        	}
+        	
+        case EBSStopTransaction:
+        	{
+        	StopTransactionL( aMessage );
+        	break;
+        	}
+        case EBSCancelTransaction:
+        	{
+        	CancelTransactionL( aMessage );
+        	break;
+        	}
+
+        case EBSInstall:
+        	{
+        	InstallL( aMessage );
+        	break;
+        	}
+
+        case EBSReplace:
+        	{
+        	ReplaceL( aMessage );
+        	break;
+        	}
+
+        case EBSAppend:
+        	{
+        	AppendL( aMessage );
+        	break;
+        	}
+
+        case EBSRemoveBrand:
+        	{
+        	RemoveBrandL( aMessage );
+        	break;
+        	}
+        case EBSRemoveApplication:
+        	{
+        	RemoveApplicationL( aMessage );
+        	break;
+        	}
+        	
+        case EBSObserveBrand:
+        	{
+        	if( iObserverActive )
+        		{
+        		// complete the old observer request with KErrCancel
+        		iObserverMessage.Complete( KErrCancel );
+        		}
+        	iObserverMessage = aMessage;
+        	iObserverActive = ETrue;
+        	msgNeedsToBeCompleted = EFalse;
+        	break;
+        	}
+
+        case EBSObserveGetNewVersion:
+        	{
+        	TInt newVersion = GetNewVersionL();
+			TPckgC<TInt> pack( newVersion );
+			aMessage.WriteL( 0, pack );
+        	break;
+        	}
+        	
+		// Get what change happen        	
+        case EBSObserveGetChange:
+        	{
+			TPckgC<TInt> pack( iIsBackup );
+			aMessage.WriteL( 0, pack );
+        	break ;
+        	}
+        	
+        // Get the backup state
+        case EBSObserveGetBackupState:
+        	{
+			TPckgC<TInt> pack( iBackupActive );
+			aMessage.WriteL( 0, pack );
+        	break ;	
+        	}
+        	
+        default:
+            {
+            User::Leave( KErrNotSupported );
+            break;
+            }
+        }
+
+    return msgNeedsToBeCompleted;
+    }
+
+
+// ---------------------------------------------------------
+// CBSSession::InitUpdateL
+//
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+void CBSSession::InitUpdateL( const RMessage2 &aMessage, TTransactionType aType)
+	{
+    TRACE( T_LIT("CBSSession::InitUpdateL: begin TTransactionType[%d] "),aType );
+	
+	// get the application id
+	TInt bufferSize( aMessage.GetDesLength( 0 ) );
+
+    HBufC8* appId = HBufC8::NewLC( bufferSize );
+	TPtr8 appPtr = appId->Des();
+	aMessage.ReadL( 0, appPtr );
+
+	HBufC* tmpAppId = CnvUtfConverter::ConvertToUnicodeFromUtf8L( *appId );
+	CleanupStack::PopAndDestroy( appId );
+	
+	delete iApplicationId;
+	iApplicationId = tmpAppId;
+
+	// get the brand id
+	bufferSize = aMessage.GetDesLength( 1 );
+    HBufC8* streamBuf = HBufC8::NewLC( bufferSize );
+	TPtr8 streamPtr = streamBuf->Des();
+	aMessage.ReadL( 1, streamPtr );
+
+	RDesReadStream stream;
+	CleanupClosePushL( stream );
+	stream.Open( streamPtr );
+	
+	TInt descriptorLength = stream.ReadInt16L();
+	HBufC8* brandId = HBufC8::NewLC( descriptorLength );
+	TPtr8 brandPtr = brandId->Des();
+	stream.ReadL( brandPtr, descriptorLength );
+
+	HBufC* tmpBrandId = CnvUtfConverter::ConvertToUnicodeFromUtf8L( *brandId );
+	CleanupStack::PopAndDestroy( brandId );
+	delete iBrandId;
+	iBrandId = tmpBrandId;
+	
+	descriptorLength = stream.ReadInt16L();
+	HBufC8* defaultBrandId = HBufC8::NewLC( descriptorLength );
+	TPtr8 defaultPtr = defaultBrandId->Des();
+	stream.ReadL( defaultPtr, descriptorLength );
+	
+	HBufC* tmpDefaultBrandId = CnvUtfConverter::ConvertToUnicodeFromUtf8L( *defaultBrandId );
+	CleanupStack::PopAndDestroy( defaultBrandId );
+	delete iDefaultBrandId;
+	iDefaultBrandId = tmpDefaultBrandId;
+	
+	CleanupStack::PopAndDestroy( 2, streamBuf ); // stream, streamBuf
+
+
+	// get the language id
+	iLanguageId = (TLanguage)aMessage.Int2();
+
+	// get the version
+	iReserved = aMessage.Int3();
+
+	// Check if brand is discarded and client is trying to access/append/replace on that
+	// give error message saying brand not found so that client will not use that brand
+	if(aType == EBSTxAccess || aType == EBSTxAppend || aType == EBSTxReplace )
+	{
+		if(!iStorageManager)
+		{
+			iStorageManager = CBSStorageManager::NewL( this, *iApplicationId );	
+		}
+		
+		TBool brandDiscarded = EFalse ;
+		brandDiscarded = iStorageManager->CheckBrandDiscarded(*iApplicationId, *iBrandId) ;
+		
+		if(brandDiscarded)
+		{
+			TRACE( T_LIT("CBSSession::InitUpdateL: Brand discarded!->LeaveWith KErrNotFound") );
+			///Server()->DisplaySessionInfoL( this, KErrNotFound );
+			//User::Leave( KErrNotFound );	
+			iBrandId->Des().Copy( *iDefaultBrandId );
+		}
+	}
+
+	if( aType == EBSTxAppend )
+		{
+		PrepareAppendL();
+		}
+	else if( aType == EBSTxReplace )
+		{
+		PrepareReplaceL();
+		}
+	else if(aType == EBSTxUninstall)
+		{
+		if( !iStorageManager )
+			{
+			iStorageManager = CBSStorageManager::NewL( this, *iApplicationId );
+			}
+		// if any client is accessing same brand leave with KErrInUse.
+		// check if the brand has any active clients
+		TBool brandActive = EFalse;
+		CBSServer* server = Server();
+		if( server )
+			{
+			brandActive = server->MatchSessionUninstallL( *iApplicationId, *iBrandId,
+												 			this);					
+			}
+			
+		if(brandActive)
+			{
+			TRACE( T_LIT("CBSSession::InitUpdateL: UnInstallation aborted -> LeaveWith KErrInUse") );
+			//Server()->DisplaySessionInfoL( this,KErrInUse);
+			//when changing this errorcode: please read the note in 
+			//UninstallL() ( installer.cpp )
+			User::Leave( KErrInUse );
+			}
+		}
+	else if( aType == EBSTxInstall )
+		{
+		if( !iStorageManager )
+			{
+			iStorageManager = CBSStorageManager::NewL( this, *iApplicationId );
+			}
+			
+		HBufC* drive = HBufC::NewLC(3);
+		TRAPD( err, iStorageManager->GetNewestVersionL( *iApplicationId,
+												   	      *iBrandId,
+										   		    	  iLanguageId ) );
+		if( ( err == KErrNotFound ) || ( err == KErrPathNotFound ) )
+			{
+			CleanupStack::PopAndDestroy(drive);
+			// this brand is not yet there, which is the correct situation here
+			// for starting install. We can just ignore this error
+			}
+			
+		else if( !err )
+			{
+			// there was no error, therefore this brand already exists in the ROM
+			// (Z drive).
+			// we leave with KErrAlreadyExists
+			if( 0 == (drive->Des().Compare(KBSZDrive)) )
+				{
+				CleanupStack::PopAndDestroy(drive);		
+			    User::Leave( KErrAlreadyExists );
+				}
+			else
+				{
+				//PopAndDestroy drive as it is not needed any longer.
+				CleanupStack::PopAndDestroy(drive);
+
+				// if any client is accessing same brand leave with KErrInUse.
+				// check if the brand has any active clients
+				TBool brandActive = EFalse;
+				CBSServer* server = Server();
+				if( server )
+					{
+					brandActive = server->MatchSessionL( *iApplicationId, *iBrandId,
+													 iLanguageId, this, iReserved );					
+					}
+
+				if(brandActive == EFalse)
+					{	
+					TRACE( T_LIT("CBSSession::InitUpdateL: Brand not used -> remove") );
+					iStorageManager->RemoveBrandL( *iApplicationId, *iBrandId,
+													iLanguageId, iReserved );
+					}
+				else
+					{
+					TRACE( T_LIT("CBSSession::InitUpdateL: Installation aborted->LeaveWith KErrInUse") );
+					//Server()->DisplaySessionInfoL( this,KErrInUse);
+					//when changing this errorcode: please read the note in 
+					//UninstallL() ( installer.cpp )
+					User::Leave( KErrInUse );
+					}
+				}
+			}
+		else
+			{
+			CleanupStack::PopAndDestroy(drive);	
+			// some other error
+			TRACE( T_LIT("CBSSession::InitUpdateL: ERROR aType[%d] LeaveWith[%d]"),aType,err );
+			User::Leave( err );
+			}
+		}
+		
+	
+	iInitialized = ETrue;
+
+    TRACE( T_LIT("Server initialized") );
+	}
+
+
+
+// ---------------------------------------------------------
+// CBSSession::PrepareAppendL
+//
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+void CBSSession::PrepareAppendL()
+	{
+	if( !iStorageManager )
+		{
+		iStorageManager = CBSStorageManager::NewL( this, *iApplicationId );
+		}
+		
+	RFile brandHandle;
+	iStorageManager->BrandHandleL( *iApplicationId,
+								   *iBrandId, iLanguageId, brandHandle, iReserved );
+	CleanupClosePushL( brandHandle );
+	RFileReadStream oldStream;
+	oldStream.Attach( brandHandle );
+	CleanupClosePushL( oldStream );
+	TInt version = oldStream.ReadInt16L();
+
+	TInt count = oldStream.ReadInt16L();
+	
+	if( !iStorageManager->Storage() )
+		{
+		iStorageManager->CreateStorageL();
+		}
+	for( TInt i = 0; i < count; i++ )
+		{
+		MBSElement* element = InternalizeElementL( oldStream, ETrue );
+		CleanupDeletePushL( element );
+		// transfers ownership
+		iStorageManager->Storage()->AppendElementsL( element );
+		CleanupStack::Pop(); // element
+		}
+
+	iStorageManager->Storage()->SetVersion( iReserved );
+	iStorageManager->Storage()->SetStorageIdL( *iBrandId );
+	iStorageManager->Storage()->SetApplicationIdL( *iApplicationId );
+	iStorageManager->Storage()->SetLanguageL( iLanguageId );
+
+	CleanupStack::PopAndDestroy( 2 ); // oldStream, brandHandle
+	iAppending = ETrue;
+	}
+// ---------------------------------------------------------
+// CBSSession::PrepareReplaceL
+//
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+void CBSSession::PrepareReplaceL()
+	{
+	PrepareAppendL();
+	}
+	
+// ---------------------------------------------------------
+// CBSSession::InitAccessL
+//
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+void CBSSession::InitAccessL( const RMessage2 &aMessage )
+	{
+	InitUpdateL( aMessage, EBSTxAccess );
+	
+	iBranding = CBSBrandHandler::NewL( *iApplicationId, *iBrandId, *iDefaultBrandId,
+										iLanguageId, this, iReserved );
+
+
+	iAccessInit = ETrue;
+    TRACE( T_LIT("Access initialized") );
+	}
+
+
+// ---------------------------------------------------------
+// CBSSession::GetTextL
+//
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+void CBSSession::GetTextL( const RMessage2 &aMessage )
+	{
+	if( !iAccessInit )
+		{
+		User::Leave( KErrNotReady );
+		}
+	TInt idSize( aMessage.GetDesLength( 0 ) );
+
+    HBufC8* idBuffer = HBufC8::NewLC( idSize );
+	TPtr8 ptrId = idBuffer->Des();
+	aMessage.ReadL( 0, ptrId );
+
+    HBufC* temp = iBranding->GetTextL( ptrId );
+    delete iText;
+    iText = temp;
+
+    CleanupStack::PopAndDestroy( idBuffer );
+    TPckgC<TInt> pack( iText->Size() );
+    aMessage.WriteL( 1, pack );
+    TRACE( T_LIT("aMessage.WriteL( 1, %d );"), iText->Size() );
+	}
+
+void CBSSession :: isBrandUpdateRequiredL (const RMessage2 &aMessage)
+{
+	if( !iAccessInit )
+		{
+		User::Leave( KErrNotReady );
+		}
+	TInt updateRequired = iBranding->isBrandUpdateRequiredL ();
+//	iValue = updateRequired;
+	TPckgC <TInt> pack (updateRequired);
+	aMessage.WriteL( 0, pack );
+}
+// ---------------------------------------------------------
+// CBSSession::GetIntL
+//
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+void CBSSession::GetIntL( const RMessage2 &aMessage )
+	{
+	if( !iInitialized )
+		{
+		User::Leave( KErrNotReady );
+		}
+	TInt idSize( aMessage.GetDesLength( 0 ) );
+
+	HBufC8* idBuffer = HBufC8::NewLC( idSize );
+	TPtr8 ptrId = idBuffer->Des();
+	aMessage.ReadL( 0, ptrId );
+
+	iValue = iBranding->GetIntL( ptrId );
+	TPckgC<TInt> pack( iValue );
+	aMessage.WriteL( 1, pack );
+	CleanupStack::PopAndDestroy( idBuffer );
+	}
+
+// ---------------------------------------------------------
+// CBSSession::GetBufferL
+//
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+void CBSSession::GetBufferL( const RMessage2 &aMessage )
+	{
+	if( !iAccessInit )
+		{
+		User::Leave( KErrNotReady );
+		}
+	TInt idSize( aMessage.GetDesLength( 0 ) );
+
+    HBufC8* idBuffer = HBufC8::NewLC( idSize );
+	TPtr8 ptrId = idBuffer->Des();
+	aMessage.ReadL( 0, ptrId );
+
+    HBufC8* temp = iBranding->GetBufferL( ptrId );
+    delete iBuffer;
+    iBuffer = temp;
+
+    CleanupStack::PopAndDestroy( idBuffer );
+    TPckgC<TInt> pack( iBuffer->Size() );
+    aMessage.WriteL( 1, pack );
+    TRACE( T_LIT("aMessage.WriteL( 1, %d );"), iBuffer->Size() );
+	}
+
+
+// ---------------------------------------------------------
+// CBSSession::GetFileL
+//
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+void CBSSession::GetFileL( const RMessage2 &aMessage )
+	{
+    TRACE( T_LIT("CBSSession::GetFileL begin") );
+    if( !iInitialized )
+		{
+		User::Leave( KErrNotReady );
+		}
+	TInt idSize( aMessage.GetDesLength( 2 ) );
+	HBufC8* idBuffer = HBufC8::NewLC( idSize );
+	TPtr8 ptrId = idBuffer->Des();
+	aMessage.ReadL( 2, ptrId );
+
+	RFile file;
+    iBranding->GetFileL( ptrId, file );
+
+	CleanupStack::PopAndDestroy( idBuffer );
+
+	User::LeaveIfError( file.TransferToClient( aMessage, 0 ) );
+
+	iMessageCompleted = ETrue;
+
+	file.Close();
+	TRACE( T_LIT("CBSSession::GetFileL end") );
+	}
+
+
+// ---------------------------------------------------------
+// CBSSession::InternalizeElementIdsL
+//
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+void CBSSession::InternalizeElementIdsL( RReadStream& aStream, RBSObjOwningPtrArray<HBufC8>& aArray )
+	{
+	TInt count = aStream.ReadInt16L();
+	
+	for(TInt i = 0; i < count; i++ )
+		{
+		TInt length = aStream.ReadInt16L();
+		HBufC8* id = HBufC8::NewLC( length );
+		TPtr8 ptrId = id->Des();
+		aStream.ReadL( ptrId, length );
+		aArray.AppendL( id );
+		CleanupStack::Pop( id );
+		}
+	}
+
+// ---------------------------------------------------------
+// CBSSession::PrepareTextL
+//
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+void CBSSession::PrepareSeveralL( const RMessage2 &aMessage )
+	{
+	if( !iInitialized )
+		{
+		User::Leave( KErrNotReady );
+		}
+		
+	TInt msgSize( aMessage.GetDesLength( 1 ) );
+
+    HBufC8* idBuffer = HBufC8::NewLC( msgSize );
+	TPtr8 ptrId = idBuffer->Des();
+	aMessage.ReadL( 1, ptrId );
+
+	RDesReadStream idStream;
+	CleanupClosePushL( idStream );
+	idStream.Open( ptrId );
+
+	RBSObjOwningPtrArray<HBufC8> idArray;
+	CleanupClosePushL( idArray );
+	
+	InternalizeElementIdsL( idStream, idArray );
+
+
+	MBSElement* texts = iBranding->GetSeveralL( idArray );
+
+	CleanupStack::PopAndDestroy(); // idArray
+	CleanupStack::PopAndDestroy(); // idStream
+	CleanupStack::PopAndDestroy();  // idBuffer
+
+	CleanupDeletePushL( texts );
+
+	// FIXME magic number
+	CBufFlat* data = CBufFlat::NewL( 2000 );
+	CleanupStack::PushL( data );
+
+	RBufWriteStream writeStream;
+	CleanupClosePushL( writeStream );
+	writeStream.Open( *data );
+
+	texts->ExternalizeL( writeStream );	
+
+	CleanupStack::PopAndDestroy(); // writeStream
+	
+	delete iSeveralData;
+	iSeveralData = data;
+	CleanupStack::Pop( data );
+
+	CleanupStack::PopAndDestroy(); // texts
+
+	delete iBuffer;
+	iBuffer = NULL;
+	iBuffer = iSeveralData->Ptr(0).AllocL();
+
+	delete iSeveralData;
+	iSeveralData = NULL;
+	TPckgC<TInt> pack( iBuffer->Size() );
+	TRACE( T_LIT("DispatchMessageL - EPlatSecPrepareSeveral writing size %d"), iBuffer->Size() );
+    aMessage.WriteL( 0, pack );
+
+	}
+
+// ---------------------------------------------------------
+// CBSSession::GetSeveralTextL
+//
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+void CBSSession::GetSeveralL( const RMessage2 &aMessage )
+	{
+	if( !iInitialized )
+		{
+		User::Leave( KErrNotReady );
+		}
+	aMessage.WriteL( 0, *iBuffer );
+
+	delete iBuffer;
+	iBuffer = NULL;
+	}
+
+
+// ---------------------------------------------------------
+// CBSSession::PrepareStructureL
+//
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+void CBSSession::PrepareStructureL( const RMessage2 &aMessage )
+	{
+	if( !iInitialized )
+		{
+		User::Leave( KErrNotReady );
+		}
+	TInt idSize( aMessage.GetDesLength( 1 ) );
+
+	RBSObjOwningPtrArray<MBSElement> valueArray;
+	CleanupClosePushL( valueArray );
+
+    HBufC8* idBuffer = HBufC8::NewLC( idSize );
+	TPtr8 ptrId = idBuffer->Des();
+	aMessage.ReadL( 1, ptrId );
+
+
+	MBSElement* extElement = iBranding->GetStructureL( ptrId );
+	CleanupDeletePushL( extElement );
+	// FIXME magic number
+	CBufFlat* data = CBufFlat::NewL( 2000 );
+	CleanupStack::PushL( data );
+
+	RBufWriteStream writeStream;
+	CleanupClosePushL( writeStream );
+	writeStream.Open( *data );
+
+	extElement->ExternalizeL( writeStream );
+
+	CleanupStack::PopAndDestroy(); // writeStream
+
+	delete iSeveralData;
+	iSeveralData = data;
+	CleanupStack::Pop( data );
+
+	CleanupStack::PopAndDestroy( extElement );
+
+	delete iBuffer;
+	iBuffer = NULL;
+	iBuffer = iSeveralData->Ptr(0).AllocL();
+
+	delete iSeveralData;
+	iSeveralData = NULL;
+	TPckgC<TInt> pack( iBuffer->Size() );
+	TRACE( T_LIT("DispatchMessageL - EPlatSecPrepareSeveral writing size %d"), iBuffer->Size() );
+    aMessage.WriteL( 0, pack );
+
+
+	CleanupStack::PopAndDestroy(idBuffer);
+
+	CleanupStack::PopAndDestroy(); // valueArray
+
+	}
+
+// ---------------------------------------------------------
+// CBSSession::GetStructureL
+//
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+void CBSSession::GetStructureL( const RMessage2 &aMessage )
+	{
+	if( !iInitialized )
+		{
+		User::Leave( KErrNotReady );
+		}
+	aMessage.WriteL( 0, *iBuffer );
+
+	delete iBuffer;
+	iBuffer = NULL;
+	}
+
+
+
+// ---------------------------------------------------------
+// CBSSession::InstallL
+//
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+void CBSSession::InstallL( const RMessage2 &aMessage )
+	{
+	TRACE( T_LIT( "CBSSession::InstallL begin") );
+	if( !iInitialized || !iStorageManager )
+		{
+		User::Leave( KErrNotReady );
+		}
+
+	if( !iStorageManager->Storage() )
+		{
+		iStorageManager->CreateStorageL();
+		}
+	
+	iStorageManager->ConnectTransactionL( *iApplicationId,
+										  *iBrandId, iLanguageId, EFalse, iReserved );
+
+	TInt msgSize( aMessage.GetDesLength( 0 ) );
+
+    HBufC8* buffer = HBufC8::NewLC( msgSize );
+	TPtr8 ptr = buffer->Des();
+	aMessage.ReadL( 0, ptr );
+
+	RDesReadStream stream;
+	CleanupClosePushL( stream );
+	stream.Open( ptr );
+
+	MBSElement* element = InternalizeElementL( stream );
+	CleanupDeletePushL( element );
+
+	iStorageManager->Storage()->SetVersion( iReserved );
+	iStorageManager->Storage()->SetStorageIdL( *iBrandId );
+	iStorageManager->Storage()->SetApplicationIdL( *iApplicationId );
+	iStorageManager->Storage()->SetLanguageL( iLanguageId );
+	// transfers ownership
+	iStorageManager->Storage()->AppendElementsL( element );
+
+	CleanupStack::Pop(); // element 
+	CleanupStack::PopAndDestroy( 2, buffer );
+	iWriteNeeded = ETrue;
+	TRACE( T_LIT( "CBSSession::InstallL end") );
+	}
+
+// ---------------------------------------------------------
+// CBSSession::ReplaceL
+//
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+void CBSSession::ReplaceL( const RMessage2 &aMessage )
+	{
+	TRACE( T_LIT( "CBSSession::ReplaceL begin") );
+	if( !iInitialized || !iStorageManager )
+		{
+		User::Leave( KErrNotReady );
+		}
+		
+	iStorageManager->ConnectTransactionL( *iApplicationId,
+										  *iBrandId, iLanguageId, EFalse, iReserved );
+
+	TInt msgSize( aMessage.GetDesLength( 0 ) );
+
+    HBufC8* buffer = HBufC8::NewLC( msgSize );
+	TPtr8 ptr = buffer->Des();
+	aMessage.ReadL( 0, ptr );
+
+	RDesReadStream stream;
+	CleanupClosePushL( stream );
+	stream.Open( ptr );
+
+	MBSElement* element = InternalizeElementL( stream );
+	CleanupDeletePushL( element );
+
+	// transfers ownership
+	iStorageManager->Storage()->ReplaceElementL( element );
+
+	CleanupStack::Pop(); // element 
+	CleanupStack::PopAndDestroy( 2, buffer );
+	iWriteNeeded = ETrue;
+	TRACE( T_LIT( "CBSSession::ReplaceL end") );
+	}
+
+
+// ---------------------------------------------------------
+// CBSSession::AppendL
+//
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+void CBSSession::AppendL( const RMessage2 &aMessage )
+	{
+	TRACE( T_LIT( "CBSSession::AppendL begin") );
+	if( !iInitialized || !iStorageManager )
+		{
+		User::Leave( KErrNotReady );
+		}
+	
+	iStorageManager->ConnectTransactionL( *iApplicationId,
+										  *iBrandId, iLanguageId, EFalse, iReserved );
+
+	TInt msgSize( aMessage.GetDesLength( 0 ) );
+
+    HBufC8* buffer = HBufC8::NewLC( msgSize );
+	TPtr8 ptr = buffer->Des();
+	aMessage.ReadL( 0, ptr );
+
+	RDesReadStream stream;
+	CleanupClosePushL( stream );
+	stream.Open( ptr );
+
+	MBSElement* element = InternalizeElementL( stream );
+	CleanupDeletePushL( element );
+
+	iStorageManager->Storage()->SetVersion( iReserved );
+	iStorageManager->Storage()->SetStorageIdL( *iBrandId );
+	iStorageManager->Storage()->SetApplicationIdL( *iApplicationId );
+	iStorageManager->Storage()->SetLanguageL( iLanguageId );
+	// transfers ownership
+	iStorageManager->Storage()->AppendElementsL( element );
+
+	CleanupStack::Pop(); // element 
+	CleanupStack::PopAndDestroy( 2, buffer );
+	iWriteNeeded = ETrue;
+    TRACE( T_LIT( "CBSSession::AppendL end") );
+	}
+
+// ---------------------------------------------------------
+// CBSSession::StartTransactionL
+//
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+void CBSSession::StartTransactionL( const RMessage2& /*aMessage*/ )
+	{
+	if( !iStorageManager )
+		{
+		iStorageManager = CBSStorageManager::NewL( this, *iApplicationId );
+		}
+	// if we are appending or replacing, we don't need to 
+	// create storage
+	if( !iAppending )
+		{
+		iStorageManager->CreateStorageL();	
+		}
+	}
+
+
+// ---------------------------------------------------------
+// CBSSession::CancelTransactionL
+//
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+void CBSSession::CancelTransactionL( const RMessage2 &aMessage )
+	{
+	// get the application id
+	TInt bufferSize( aMessage.GetDesLength( 0 ) );
+
+    HBufC8* appId = HBufC8::NewLC( bufferSize );
+	TPtr8 appPtr = appId->Des();
+	aMessage.ReadL( 0, appPtr );
+
+
+	// get the brand id
+	bufferSize = aMessage.GetDesLength( 1 );
+    HBufC8* brandId = HBufC8::NewLC( bufferSize );
+	TPtr8 brandPtr = brandId->Des();
+	aMessage.ReadL( 1, brandPtr );
+
+	// get the language id
+	TLanguage language = (TLanguage)aMessage.Int2();
+
+	// get the version
+	TInt version = aMessage.Int3();
+	
+	
+	HBufC* tmpBrandId = CnvUtfConverter::ConvertToUnicodeFromUtf8L( *brandId );
+	CleanupStack::PopAndDestroy( brandId );
+	CleanupStack::PushL( tmpBrandId );
+	HBufC* tmpAppId = CnvUtfConverter::ConvertToUnicodeFromUtf8L( *appId );
+	CleanupStack::PushL( tmpAppId );
+	
+	// check if the transaction is correct	
+	iStorageManager->ConnectTransactionL( *tmpAppId,
+										  *tmpBrandId, iLanguageId,
+										  EFalse, iReserved );
+
+	CleanupStack::PopAndDestroy( 2, tmpBrandId ); // tmpBrandId, tmpAppId
+	CleanupStack::PopAndDestroy( appId );
+	// cancel the transaction
+	iStorageManager->CancelTransactionL();
+	iWriteNeeded = EFalse;
+	}
+
+// ---------------------------------------------------------
+// CBSSession::StopTransactionL
+//
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+void CBSSession::StopTransactionL( const RMessage2 &aMessage )
+	{
+	if( !iStorageManager )
+		{
+		// transaction not found
+		User::Leave( KErrNotFound );
+		}
+	if( iAppending )
+		{
+		// find next available version number
+		TInt nextVersion = iStorageManager->NextAvailableVersionL();
+		iStorageManager->SetVersion( nextVersion );
+		iStorageManager->Storage()->SetVersion( nextVersion );
+		}
+		
+	if( iWriteNeeded )
+		{
+		iReserved = iStorageManager->WriteStorageFilesL();	
+		iWriteNeeded = EFalse;
+		}
+	
+	delete iStorageManager;
+	iStorageManager = NULL;
+	
+	TPckgC<TInt> pack( iReserved );
+	aMessage.WriteL( 0, pack );
+	
+	}
+
+
+// ---------------------------------------------------------
+// CBSSession::InternalizeElementL
+//
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+MBSElement* CBSSession::InternalizeElementL( RReadStream& aStream, TBool aAppending /*= EFalse*/ )
+	{
+	MBSElement* returnValue = NULL;
+
+	TBSElementType type = (TBSElementType)aStream.ReadInt16L();
+	TInt idSize = aStream.ReadInt16L();
+	HBufC8* elementId = HBufC8::NewLC( idSize );
+	TPtr8 elementIdPtr = elementId->Des();
+	aStream.ReadL( elementIdPtr, idSize );
+
+
+	switch( type )
+		{
+		case EBSInt:
+			{
+			TInt intData = aStream.ReadInt16L();
+			returnValue = BSElementFactory::CreateBSElementL( *elementId,
+															   EBSInt,
+															   intData );
+			break;
+			}
+		case EBSText:
+			{
+			TInt textSize = aStream.ReadInt16L();
+			HBufC* textData = HBufC::NewLC( textSize );
+
+			TPtr textPtr = textData->Des();
+			aStream.ReadL( textPtr, textSize );
+
+			returnValue = BSElementFactory::CreateBSElementL( *elementId,
+															   type,
+															   *textData );
+
+			CleanupStack::Pop( textData );
+			break;
+			}
+
+		case EBSFile: 
+			{
+			TInt nameSize = aStream.ReadInt16L();
+			HBufC* fileName = HBufC::NewLC( nameSize );
+
+			TPtr filePtr = fileName->Des();
+			aStream.ReadL( filePtr, nameSize );
+			
+			if( !aAppending )
+				{
+				// we are installing, so the filename is pointing to a file
+				// that has to be installed
+				// Install file and get the filename without path
+				HBufC* strippedName = iStorageManager->InstallFileLC( *fileName );
+				returnValue = BSElementFactory::CreateBSElementL( *elementId,
+																   type,
+																   *strippedName );
+				CleanupStack::Pop( strippedName );
+				CleanupStack::PopAndDestroy( fileName );
+				}
+			else
+				{
+				// we are appending, so this is really the filename
+				returnValue = BSElementFactory::CreateBSElementL( *elementId,
+																   type,
+																   *fileName );
+				CleanupStack::Pop( fileName );
+				}
+			break;
+			}
+			
+		case EBSList:
+			{
+			RBSObjOwningPtrArray<MBSElement> listData;
+			CleanupClosePushL( listData );
+			TInt listCount = aStream.ReadInt16L();
+			for( TInt i = 0; i < listCount; i++ )
+				{
+				MBSElement* listElement = InternalizeElementL( aStream );
+				CleanupDeletePushL( listElement );
+				listData.AppendL( listElement );
+				CleanupStack::Pop(); // listElement
+				}
+
+			returnValue = BSElementFactory::CreateBSElementL( *elementId,
+															   EBSList,
+															   listData );
+			CleanupStack::Pop(); //  listData
+			break;
+			}
+		case EBSBuffer:
+			{
+			TInt bufferSize = aStream.ReadInt16L();
+			HBufC8* buffer = HBufC8::NewLC( bufferSize );
+
+			TPtr8 buffPtr = buffer->Des();
+			aStream.ReadL( buffPtr, bufferSize );
+
+			returnValue = BSElementFactory::CreateBSElementL( *elementId,
+															   EBSBuffer,
+															   *buffer );
+
+			CleanupStack::Pop( buffer );
+			break;
+			}
+		case EBSBitmap:
+			{
+			TInt length = aStream.ReadInt16L();
+			HBufC8* fileId = HBufC8::NewLC( length );
+			
+			TPtr8 fileIdPtr = fileId->Des();
+			aStream.ReadL( fileIdPtr, length );
+			
+			TInt bitmapId = aStream.ReadInt16L();
+			TInt maskId = aStream.ReadInt16L();
+			TInt skinId = aStream.ReadInt16L();
+			TInt skinMaskId = aStream.ReadInt16L();
+
+
+			CBSBitmap* bitmap = CBSBitmap::NewLC( bitmapId,
+												  maskId,
+												  skinId,
+												  skinMaskId,
+												  fileIdPtr );
+													  
+			returnValue = BSElementFactory::CreateBSElementL( *elementId, 
+															  EBSBitmap,
+															  bitmap );
+			CleanupStack::Pop( bitmap ); 
+			CleanupStack::PopAndDestroy( fileId );
+			break;
+			}
+
+		default:
+			{
+			User::Leave( KErrArgument );
+			break;
+			}
+		}
+
+	CleanupStack::PopAndDestroy( elementId );
+
+	return returnValue;
+	}
+
+
+// ---------------------------------------------------------
+// CBSSession::MatchSessionL
+//
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+TBool CBSSession::MatchSessionL( const TDesC& aApplicationId,
+								 const TDesC& aBrandId,
+								 TLanguage aLanguageId,
+							 	 TInt aReserved )
+	{
+	TBool returnValue = EFalse;
+	if( iApplicationId && iBrandId )
+		{
+		if( ( 0 == iApplicationId->Compare( aApplicationId ) ) &&
+		   ( 0 == iBrandId->Compare( aBrandId ) ) &&
+		   ( iLanguageId == aLanguageId ) && 
+		   ( iReserved == aReserved ))
+			{
+			returnValue = ETrue;
+			}
+		}
+	
+	return returnValue;
+	}
+
+// ---------------------------------------------------------
+// CBSSession::MatchSessionL
+//
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+TBool CBSSession::MatchSessionUninstallL( const TDesC& aApplicationId,
+								 const TDesC& aBrandId)
+	{
+	TBool returnValue = EFalse;
+	if( iApplicationId && iBrandId )
+		{
+		if( ( 0 == iApplicationId->Compare( aApplicationId ) ) &&
+		   ( 0 == iBrandId->Compare( aBrandId ) ) )
+			{
+			returnValue = ETrue;
+			}
+		}
+	
+	return returnValue;
+	}
+// ---------------------------------------------------------
+// CBSSession::BrandUpdatedL
+//
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+void CBSSession::BrandUpdatedL( const TDesC& aApplicationId,
+								 const TDesC& aBrandId,
+								 TLanguage aLanguageId,
+							 	 TInt /*aReserved*/ )
+	{
+	TRACE( T_LIT( "CBSSession::BrandUpdatedL begin aAppId[%S] aBrandId[%S]"), &aApplicationId, &aBrandId );
+	iIsBackup = EFalse ; 
+	if( iApplicationId && iBrandId )
+		{
+		if( ( 0 == iApplicationId->Compare( aApplicationId ) ) &&
+		   ( 0 == iBrandId->Compare( aBrandId ) ) &&
+		   ( iLanguageId == aLanguageId ) )
+			{
+			// this event is for us 
+			// complete the observer request from client
+			if( iObserverActive )
+				{
+				iObserverMessage.Complete( KErrNone );
+				iObserverActive = EFalse;
+				}
+			}
+		}
+	TRACE( T_LIT( "CBSSession::BrandUpdatedL end") );
+	}
+
+
+// ---------------------------------------------------------
+// CBSSession::RemoveBrandL
+//
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+void CBSSession::RemoveBrandL( const RMessage2& /*aMessage*/ )
+	{
+	TRACE( T_LIT( "CBSSession::RemoveBrandL begin") );
+	if( !iInitialized || !iStorageManager )
+		{
+		User::Leave( KErrNotReady );
+		}
+
+	iStorageManager->RemoveBrandL( *iApplicationId, *iBrandId,
+								   iLanguageId, iReserved );
+	
+	
+	
+	TRACE( T_LIT( "CBSSession::RemoveBrandL end") );
+	}
+
+// ---------------------------------------------------------
+// CBSSession::RemoveApplicationL
+//
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+void CBSSession::RemoveApplicationL( const RMessage2& /*aMessage*/ )
+	{
+	TRACE( T_LIT( "CBSSession::RemoveApplicationL begin") );
+	if( !iInitialized || !iStorageManager )
+		{
+		User::Leave( KErrNotReady );
+		}
+	iStorageManager->RemoveApplicationL( *iApplicationId );
+	TRACE( T_LIT( "CBSSession::RemoveApplicationL end") );
+	}
+	
+// ---------------------------------------------------------
+// CBSSession::GetNewVersionL
+//
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//	
+TInt CBSSession::GetNewVersionL()
+	{
+	if( !iStorageManager )
+		{
+		iStorageManager = CBSStorageManager::NewL( this, KNullDesC );
+		}
+
+	return iStorageManager->GetNewestVersionL( *iApplicationId, *iBrandId, iLanguageId );
+	}
+	
+
+// CBSSessionInfo
+CBSSession::CBSSessionInfo* CBSSession::CBSSessionInfo::NewL( const TDesC& aFileName, 
+	    		                                              const TDesC& aCaption,
+	    		                                              TThreadId aThreadId, 
+	    		                                              TProcessId aProcessId )
+	{
+	CBSSessionInfo* self = new( ELeave ) CBSSessionInfo( aThreadId, aProcessId );
+	CleanupStack::PushL( self );
+	self->ConstructL( aFileName, aCaption );
+	CleanupStack::Pop( self );
+	return self;
+	}
+void CBSSession::CBSSessionInfo::ConstructL( const TDesC& aFileName, const TDesC& aCaption )
+	{	
+	iFileName = aFileName.AllocL();
+	iCaption = aCaption.AllocL();
+	}
+CBSSession::CBSSessionInfo::CBSSessionInfo( TThreadId aThreadId, TProcessId aProcessId  )
+: iThreadId( aThreadId ),
+  iProcessId( aProcessId )
+	{
+	}
+CBSSession::CBSSessionInfo::~CBSSessionInfo()
+	{
+	delete iFileName;
+	delete iCaption;
+	}
+
+const TDesC& CBSSession::CBSSessionInfo::FileName()
+	{
+	return *iFileName;
+	}
+const TDesC& CBSSession::CBSSessionInfo::Caption()
+	{
+	return *iCaption;
+	}
+
+TThreadId CBSSession::CBSSessionInfo::ThreadId()
+	{
+	return iThreadId;
+	}
+TProcessId CBSSession::CBSSessionInfo::ProcessId()
+	{
+	return iProcessId;
+	}
+
+
+// ---------------------------------------------------------------------------
+// CBSSession::ExtractInfoL
+// Extracts some information from the specified RMessage2 and saves it.
+// ---------------------------------------------------------------------------
+//
+void CBSSession::ExtractInfoL( const RMessage2& aMessage )
+    {
+	TRACE( T_LIT( "CBSSession::ExtractInfoL begin") );
+	//Collect all necessary data
+	RThread thread;
+	TInt getProcessErr,getClientThreadErr;
+	getClientThreadErr = aMessage.Client( thread );
+	CleanupClosePushL( thread );
+    
+	if ( KErrNone == getClientThreadErr )
+	    {
+	    TRACE( T_LIT( "CBSSession::ExtractInfoL Client retrieved OK") );
+	    TThreadId threadId = thread.Id();
+	    RProcess process;
+	    getProcessErr = thread.Process( process );
+	    CleanupClosePushL( process );
+	    if ( getProcessErr == KErrNone )
+	        {
+	        TRACE( T_LIT( "CBSSession::ExtractInfoL Processfilename retrieved OK") );
+	        TFileName fileName = process.FileName();	        
+	        TParsePtrC parser( fileName );	        
+	        TPtrC processFileNameAndExt( parser.NameAndExt() );
+	        
+	        RApaLsSession session;
+	        TInt connectErr = session.Connect();
+	        User :: LeaveIfError (connectErr);
+	        session.GetAllApps();	        
+	        CleanupClosePushL( session );
+	        
+	        TApaAppInfo info;	        
+	        TPtrC captionPtr( KNullDesC );
+	        TPtrC printCaptionPtr( KNullDesC );
+	        TPtrC fullName( KNullDesC );
+	        while ( KErrNone == session.GetNextApp( info ) )
+	            {
+	            fullName.Set( info.iFullName );
+	            printCaptionPtr.Set( info.iCaption );	            
+	            if( KErrNotFound != fullName.Find( processFileNameAndExt ) )
+	                {	                
+	                captionPtr.Set( info.iCaption );
+	                TRACE( T_LIT( "CBSSession::ExtractInfoL caption saved: %S"),&captionPtr );
+	                break;
+	                }	            
+	            }	        
+	        
+	        CBSSessionInfo* temp = 
+	            CBSSessionInfo::NewL( processFileNameAndExt,
+	                                  captionPtr,
+	                                  threadId, 
+	                                  process.Id() );
+	        TRACE( T_LIT( "CBSSession::ExtractInfoL SessionInfo object creation OK") );
+	        delete iSessionInfo;
+	        iSessionInfo = NULL;
+	        iSessionInfo = temp;	        
+	        CleanupStack::PopAndDestroy( &session );
+	        }
+	    CleanupStack::PopAndDestroy( &process );
+	    }    
+    CleanupStack::PopAndDestroy( &thread );    
+    TRACE( T_LIT( "CBSSession::ExtractInfoL end") );
+    }
+
+
+// ---------------------------------------------------------------------------
+// CBSSession::FileName
+// ---------------------------------------------------------------------------
+//
+const TDesC& CBSSession::FileName()
+	{
+	TRACE( T_LIT( "CBSSession::FileName begin") );
+	if ( iSessionInfo )
+	    {
+	    TRACE( T_LIT( "CBSSession::FileName SessionInfo exists") );
+	    return iSessionInfo->FileName();
+	    }
+	else
+	    {
+	    TRACE( T_LIT( "CBSSession::FileName SessionInfo does not exist") );
+	    return KNullDesC;
+	    }
+	}
+
+// ---------------------------------------------------------------------------
+// CBSSession::Caption
+// ---------------------------------------------------------------------------
+//	
+const TDesC& CBSSession::Caption()
+	{
+	TRACE( T_LIT( "CBSSession::Caption begin") );
+	if ( iSessionInfo )
+	    {
+	    TRACE( T_LIT( "CBSSession::Caption SessionInfo exists") );
+	    return iSessionInfo->Caption();
+	    }
+	else
+	    {
+	    TRACE( T_LIT( "CBSSession::Caption SessionInfo does not exist") );
+	    return KNullDesC;
+	    }
+	}	
+
+
+// ---------------------------------------------------------------------------
+// CBSSession::ThreadId
+// ---------------------------------------------------------------------------
+//		
+TInt CBSSession::ThreadId( TThreadId& aThreadId )
+	{
+	TRACE( T_LIT( "CBSSession::ThreadId begin") );
+	TInt err( KErrNotFound );
+	if ( iSessionInfo )
+	    {	    
+	    TRACE( T_LIT( "CBSSession::ThreadId SessionInfo exists") );
+	    aThreadId = iSessionInfo->ThreadId();
+	    err = KErrNone;
+	    }
+	return err;
+	}
+
+
+// ---------------------------------------------------------------------------
+// CBSSession::ProcessId
+// ---------------------------------------------------------------------------
+//	
+TInt CBSSession::ProcessId( TProcessId& aProcessId )
+	{
+	TRACE( T_LIT( "CBSSession::ProcessId begin") );
+	TInt err( KErrNotFound );
+	if ( iSessionInfo )
+	    {	    
+	    TRACE( T_LIT( "CBSSession::ProcessId SessionInfo exists") );
+	    aProcessId = iSessionInfo->ProcessId();
+	    err = KErrNone;
+	    }
+	return err;
+	}
+
+
+// ---------------------------------------------------------------------------
+// CBSSession::InfoAvailable
+// ---------------------------------------------------------------------------
+//	
+TBool CBSSession::InfoAvailable()
+    {
+    return iSessionInfo ? ETrue : EFalse;
+    }
+
+// END OF FILE
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/brandingserver/bsserver/cbssession.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,461 @@
+/*
+* 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: cbssession.h
+*
+*/
+
+
+#ifndef __CBSSESSION_H__
+#define __CBSSESSION_H__
+
+#include <e32base.h>
+#include <s32mem.h>
+#include "rbsobjowningptrarray.h"
+#include "bsserverdefs.h"
+#include "mbsbackupobserver.h"
+
+class CBSServer;
+class CBSBrandHandler;
+class MBSElement;
+class CBSStorageManager;
+
+/**
+ * Service side session.
+ *
+ * @lib
+ * @since
+ */
+ class CBSSession : public CSession2,
+                    public MBSBackupObserver
+    {
+    
+    
+    public:
+    	
+    	/**
+    	 * Class for encapsulating the session information.
+    	 */
+    	NONSHARABLE_CLASS( CBSSessionInfo ): public CBase
+    		{
+    		public:
+	    		
+	    		/**
+	    		 * Creates a new CBSSessionInfo
+	    		 *
+	    		 * @param aFileName the filename of the process, that created 
+	    		 *        this session
+	    		 * @param aCaption a caption of the process, that created this 
+	    		 *        session
+	    		 * @param aThreadId thread id where this session was created
+	    		 * @param aProcessId processId of the process, that created 
+	    		 *        this session
+	    		 * @return a new CBSSessionInfo instance
+	    		 */
+	    		static CBSSessionInfo* NewL( const TDesC& aFileName, 
+	    		                             const TDesC& aCaption,
+	    		                             TThreadId aThreadId,
+	    		                             TProcessId aProcessId );
+        	    /**
+                 * Destructor.
+                 */  		
+	    		~CBSSessionInfo();
+	    		
+    		private: 
+
+                /**
+                 * Symbian second-phase constructor
+                 *
+	    		 * @param aFileName the filename of the process, that created 
+	    		 *        this session
+	    		 * @param aCaption a caption of the process, that created this 
+	    		 *        session
+                 */                    
+	    		void ConstructL( const TDesC& aFileName, 
+	    		                 const TDesC& aCaption );
+
+                /**
+                 * Constructor.
+	    		 *
+	    		 * @param aThreadId thread id where this session was created
+	    		 * @param aProcessId processId of the process, that created 
+	    		 *        this session
+                 */
+	    		CBSSessionInfo( TThreadId aThreadId, TProcessId aProcessId );
+			
+			public: 
+
+			    /**
+                 * Returns the filename of the process, that created this 
+                 * session.
+                 *
+                 * @return a filename
+                 */ 
+				const TDesC& FileName();
+
+			    /**
+                 * Returns the caption of the process, that created this 
+	    		 * session.
+                 *
+                 * @return a caption
+                 */ 
+				const TDesC& Caption();
+
+			    /**
+                 * Returns the thread id where this session was created.
+                 *
+                 * @return a thread id
+                 */ 
+				TThreadId ThreadId();
+				
+			    /**
+                 * Returns the processId of the process, that created 
+	    		 * this session.
+                 *
+                 * @return a process id
+                 */ 
+				TProcessId ProcessId();
+				
+			private: // data
+				
+                /**
+                 * Filename
+                 * Own.
+                 */
+				HBufC* 		iFileName;
+
+                /**
+                 * Caption
+                 * Own.
+                 */
+			  	HBufC*      iCaption;
+			  	
+                /**
+                 * Thread Id.
+                 */
+			  	TThreadId  	iThreadId;
+
+                /**
+                 * Process Id.
+                 */
+			  	TProcessId  iProcessId;			  	
+    		};      
+    
+    
+    public:     // Constructors and destructors
+        static CBSSession* NewL();
+        virtual ~CBSSession();
+
+
+    protected:  // C++ constructors
+    	/**
+        * C++ default constructor.
+        */
+        CBSSession();
+
+        /**
+        * Symbian OS constructor
+        */
+		void ConstructL();
+
+    public:     // Methods derived from CSession2
+    	/**
+    	* From CSession2
+    	*/
+        void CreateL();
+    	/**
+    	* From CSession2
+    	*/
+        void ServiceL( const RMessage2 &aMessage );
+    	/**
+    	* From CSession2
+    	*/
+        void ServiceError( const RMessage2& aMessage,
+                           TInt aError );
+		
+    public:     // From MBSBackupObserver
+    
+    	/*
+    	* @see MBSBackupObserver
+    	*/
+		void HandleBackupStateL( TBackupState aState );
+
+	public: // New methods
+		
+        /**
+        *
+        */
+        CBSServer* Server() { return (CBSServer*) CSession2::Server(); }
+
+
+		TBool MatchSessionL( const TDesC& aApplicationId,
+							 const TDesC& aBrandId,
+							 TLanguage aLanguageId,
+							 TInt aReserved );
+							 
+		TBool MatchSessionUninstallL( const TDesC& aApplicationId,
+								 const TDesC& aBrandId);
+								 
+		void BrandUpdatedL( const TDesC& aApplicationId,
+							 const TDesC& aBrandId,
+							 TLanguage aLanguageId,
+							 TInt aReserved );
+
+
+
+	    /**
+         * Returns the filename of the process, that created this 
+         * session.
+         *
+         * @return a filename
+         */ 
+		const TDesC& FileName();
+
+	    /**
+         * Returns the caption of the process, that created this 
+		 * session.
+         *
+         * @return a caption
+         */ 
+		const TDesC& Caption();
+
+	    /**
+         * Returns the thread id where this session was created.
+         *
+         * @return a thread id
+         */ 
+		TInt ThreadId( TThreadId& aThreadId );
+		
+	    /**
+         * Returns the processId of the process, that created 
+		 * this session.
+         *
+         * @return a process id
+         */
+        TInt ProcessId( TProcessId& aProcessId );
+
+        /**
+         * Returns, if the session info for this object is available.
+         *
+         * @return ETrue, if information about this object is available;
+         *         EFalse otherwise
+         */
+        TBool InfoAvailable();
+
+        
+    private:    // New methods
+
+        /**
+		*  Dispatch clients message
+		*
+		*  @since
+		*  @param aMessage client's message
+        */
+        TBool DispatchMessageL( const RMessage2 &aMessage );
+
+
+		/**
+		* Initializes the server
+		* @param aMessage client's message
+		*/
+        void InitUpdateL( const RMessage2 &aMessage, TTransactionType aType );
+
+		/**
+		* Initializes the server
+		* @param aMessage client's message
+		*/
+        void InitAccessL( const RMessage2 &aMessage );
+
+
+		/**
+		* Get text type branding item
+		* @param aMessage client's message
+		*/
+        void GetTextL( const RMessage2 &aMessage );
+
+		/**
+		* Get text type branding item
+		* @param aMessage client's message
+		*/
+        void GetBufferL( const RMessage2 &aMessage );
+
+		/**
+		* Get integer type branding item
+		* @param aMessage client's message
+		*/
+        void GetIntL( const RMessage2 &aMessage );
+
+		/**
+		* Get file type branding item
+		* @param aMessage client's message
+		*/
+        void GetFileL( const RMessage2 &aMessage );
+
+		/**
+		* Prepares several textual type branding items.
+		* These have to be fetched with GetSeveralText.
+		* @param aMessage client's message
+		*/
+        void PrepareSeveralL( const RMessage2 &aMessage );
+
+		/**
+		* Gets the several textual branding items
+		* previously prepared.
+		* @param aMessage client's message
+		*/
+        void GetSeveralL( const RMessage2 &aMessage );
+
+
+		/**
+		* Prepares several structure type branding items.
+		* These have to be fetched with GetStructure.
+		* @param aMessage client's message
+		*/
+        void PrepareStructureL( const RMessage2 &aMessage );
+
+		/**
+		* Gets the several structure type branding items
+		* previously prepared.
+		* @param aMessage client's message
+		*/
+        void GetStructureL( const RMessage2 &aMessage );
+
+		void isBrandUpdateRequiredL (const RMessage2 &aMessage);
+
+
+
+		/**
+		* 
+		* 
+		* @param aMessage client's message
+		*/
+        void InstallL( const RMessage2 &aMessage );
+
+		/**
+		* 
+		* 
+		* @param aMessage client's message
+		*/
+        void ReplaceL( const RMessage2 &aMessage );
+
+
+		/**
+		* 
+		* 
+		* @param aMessage client's message
+		*/
+        void AppendL( const RMessage2 &aMessage );
+		
+		/**
+		* 
+		* 
+		* @param aMessage client's message
+		*/
+		MBSElement* InternalizeElementL( RReadStream& aStream, TBool aAppending = EFalse );
+
+
+		/**
+		* Cancels the transaction
+		*/
+        void StartTransactionL( const RMessage2 &aMessage );
+
+
+		/**
+		* Cancels the transaction
+		*/
+        void CancelTransactionL( const RMessage2 &aMessage );
+
+		/**
+		* Finishes the transaction
+		*/
+        void StopTransactionL( const RMessage2 &aMessage );
+
+
+		/**
+		* Internalize element ids
+		*/
+        void InternalizeElementIdsL( RReadStream& aStream, RBSObjOwningPtrArray<HBufC8>& aArray );
+
+		/**
+		* 
+		* 
+		* @param aMessage client's message
+		*/
+        void RemoveBrandL( const RMessage2 &aMessage );
+
+
+		/**
+		* 
+		* 
+		* @param aMessage client's message
+		*/
+        void RemoveApplicationL( const RMessage2 &aMessage );
+
+		void PrepareAppendL();
+		
+		void PrepareReplaceL();
+		
+		TInt GetNewVersionL();
+
+
+        /**
+         * Extracts some information from the specified RMessage2
+         * and saves it.
+         *
+         * @param aMessage a message from a client
+         */
+        void ExtractInfoL( const RMessage2& aMessage );
+
+    private:    // Data
+    	TBool iInitialized;
+    	TBool iAppending;
+    	TBool iAccessInit;
+    	TBool iWriteNeeded;
+    	
+    	// is backup process currently active
+    	TBool iBackupActive;
+    	
+    	HBufC* iBrandId;
+    	HBufC* iDefaultBrandId;
+    	HBufC* iApplicationId;
+    	TLanguage iLanguageId;
+    
+        TInt iValue;
+        HBufC* iText;
+        CBSBrandHandler* iBranding;
+        CBufFlat* iSeveralData;
+        HBufC8*		iBuffer;
+        TBool iMessageCompleted;
+        
+        CBSStorageManager* iStorageManager;
+        
+        TBool iObserverActive;
+        RMessage2 iObserverMessage;
+        
+        // To send backup event to client
+        TBool iIsBackup ;
+		TInt iReserved;
+        
+        /**
+         * Contains information about this object.
+         * Own.
+         */
+        CBSSessionInfo* iSessionInfo;
+		
+    };
+
+#endif      //  __CBSSESSION_H__
+
+
+//  END OF FILE
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/brandingserver/bsserver/cbsstorage.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,373 @@
+/*
+* Copyright (c) 2006-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:  Stores element data and writes it to stream
+*
+*/
+
+
+#include "cbsstorage.h"
+#include "bsimportconstants.h"
+#include "debugtrace.h"
+
+
+#include <s32strm.h>
+#include <utf.h>
+#include <mbselement.h>
+
+//#include "mbsimportlogger.h"
+//#include "importlogwriter.h"
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// CBSStorage::NewL
+// ---------------------------------------------------------------------------
+//
+CBSStorage* CBSStorage::NewL()
+    {
+    CBSStorage* self = NewLC();
+    CleanupStack::Pop();
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CBSStorage::NewLC
+// ---------------------------------------------------------------------------
+//
+CBSStorage* CBSStorage::NewLC()
+    {
+    CBSStorage* self = new (ELeave) CBSStorage();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CBSStorage::ConstructL
+// ---------------------------------------------------------------------------
+//
+void CBSStorage::ConstructL()
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// CBSStorage::CBSStorage
+// ---------------------------------------------------------------------------
+//
+CBSStorage::CBSStorage()
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// CBSStorage::~CBSStorage
+// ---------------------------------------------------------------------------
+//
+CBSStorage::~CBSStorage()
+    {
+    iElements.Close();
+    delete iAppId;
+    delete iStorageId;
+    delete iLanguage;
+    delete iFilename;
+    }
+
+// ---------------------------------------------------------------------------
+// CBSStorage::AppendElement
+// ---------------------------------------------------------------------------
+//
+void CBSStorage::AppendElementsL( MBSElement* aElement )
+    {
+    if( !aElement )
+        {
+		// Ignore empty
+	    return;
+        }
+
+	TPtrC8 id = aElement->ElementId();
+	
+	// check if the id is unique
+	TInt count = iElements.Count();
+	
+	for( TInt i = 0; i < count; i++ )
+		{
+		if( 0 == iElements[i]->ElementId().Compare( id ) )
+			{
+			// duplicate found
+			User::Leave( KErrAlreadyExists );
+			}
+		}
+
+	iElements.AppendL( aElement );
+    }
+
+
+// ---------------------------------------------------------------------------
+// CBSStorage::ReplacesElementL
+// ---------------------------------------------------------------------------
+//
+void CBSStorage::ReplaceElementL( MBSElement* aElement )
+	{
+    if( !aElement )
+        {
+		// Ignore empty
+	    return;
+        }
+
+	TPtrC8 id = aElement->ElementId();
+	
+	// check if the id is unique
+	TInt count = iElements.Count();
+	
+	for( TInt i = 0; i < count; i++ )
+		{
+		if( 0 == iElements[i]->ElementId().Compare( id ) )
+			{
+			// item found
+			MBSElement* element = iElements[i];
+			iElements.Remove( i );
+			delete element;
+			// put the new element
+			iElements.AppendL( aElement );
+			return;
+			}
+		}
+	// the element was not found from this storage
+	User::Leave( KErrNotFound );
+	}
+
+
+// ---------------------------------------------------------------------------
+// CBSStorage::ElementCount
+// ---------------------------------------------------------------------------
+//
+TInt CBSStorage::ElementCount()
+    {
+    return iElements.Count();
+    }
+
+// ---------------------------------------------------------------------------
+// CBSStorage::ExternalizeL
+// ---------------------------------------------------------------------------
+//
+void CBSStorage::ExternalizeL( RWriteStream& aWriteStream )
+    {
+    if( !VerifyHeader() || !VerifyDataL( iElements ) )
+        {
+        // Header not complete. Will not write to stream
+        User::Leave( KErrCorrupt );
+        }
+    // Write header
+    aWriteStream.WriteInt16L( iVersion );
+
+    // Write elements 
+    TInt count = iElements.Count();
+    aWriteStream.WriteInt16L( count );
+    for( TInt i = 0; i < count; i++ )
+        {
+        iElements[i]->ExternalizeL( aWriteStream );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CBSStorage::SetVersion
+// ---------------------------------------------------------------------------
+//
+void CBSStorage::SetVersion( TInt aVersion )
+    {
+    iVersion = aVersion;
+    }
+
+// ---------------------------------------------------------------------------
+// CBSStorage::SetApplicationIdL
+// ---------------------------------------------------------------------------
+//
+void CBSStorage::SetApplicationIdL( const TDesC& aAppId )
+    {
+    HBufC* tmp = aAppId.AllocL();
+    
+    delete iAppId;
+    iAppId = tmp;
+    }
+
+// ---------------------------------------------------------------------------
+// CBSStorage::SetStorageIdL
+// ---------------------------------------------------------------------------
+//
+void CBSStorage::SetStorageIdL( const TDesC& aStorageId )
+    {
+    HBufC* tmp = aStorageId.AllocL();
+    delete iStorageId;
+    iStorageId = tmp;
+    }
+
+// ---------------------------------------------------------------------------
+// CBSStorage::SetLanguageL
+// ---------------------------------------------------------------------------
+//
+void CBSStorage::SetLanguageL( TLanguage aLanguage )
+    {
+    TBuf<KLangBufLength> buffer;
+    buffer.AppendNum( aLanguage );
+    
+    HBufC* tmp = buffer.AllocL();
+    delete iLanguage;
+    iLanguage = tmp;
+    }
+
+// ---------------------------------------------------------------------------
+// CBSStorage::VerifyHeader
+// ---------------------------------------------------------------------------
+//
+TBool CBSStorage::VerifyHeader()
+    {
+    // not checking version as it is been consider not to use. - Pankaj - 31 may 07
+    //return ( iAppId && iStorageId && iVersion > 0 && iLanguage );
+    return ( iAppId && iStorageId && iLanguage );
+    }
+
+
+// ---------------------------------------------------------------------------
+// CBSStorage::VerifyDataL
+// ---------------------------------------------------------------------------
+//
+TBool CBSStorage::VerifyDataL( TArray<MBSElement*> aArray,
+                                    TBool aIgnoreEmptyID /* = EFalse */ )
+    {
+    // Check that elements have unique ID's in their own namespace
+    TInt count = aArray.Count();
+    for( TInt i = 0; i < count; i++ )
+        {
+        // Verify inside list elements
+        if( aArray[i]->ElementType() == EBSList )
+            {
+            TArray<MBSElement*> listArray = aArray[i]->GetStructureL();
+            if( !VerifyDataL( listArray, ETrue ) )
+                {
+                return EFalse;
+                }
+            }
+
+        if( aIgnoreEmptyID &&
+            aArray[i]->ElementId().CompareC( KNullDesC8() ) == 0 )
+            {
+            // ignore empty id
+            continue;
+            }
+
+        // Check that sibling elements have unique ID
+        for( TInt j = i + 1; j < count; j++ )
+            {
+            if( aArray[i]->ElementId().CompareC( aArray[j]->ElementId() ) == 0 )
+                {
+                // convert elementID to 16-bit for event logger
+                TPtrC8 id( aArray[i]->ElementId() );
+                HBufC* conv = HBufC::NewLC( id.Length() );
+                TPtr uniptr( conv->Des() );
+                CnvUtfConverter::ConvertToUnicodeFromUtf8( uniptr, id );
+                TRACE( T_LIT("ERROR: Found duplicate element ID (%S)!"), &uniptr );
+                CleanupStack::PopAndDestroy();
+                return EFalse;
+                }
+            }
+        }
+
+    // All elements ok
+    return ETrue;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CBSStorage::VerifyDataL
+// ---------------------------------------------------------------------------
+//
+TBool CBSStorage::VerifyDataL( RBSObjOwningPtrArray<MBSElement>& aArray,
+                                    TBool aIgnoreEmptyID /* = EFalse */ )
+    {
+    return VerifyDataL( aArray.Array(), aIgnoreEmptyID );
+    }
+
+
+// ---------------------------------------------------------------------------
+// CBSStorage::ProposeFileNameL
+// ---------------------------------------------------------------------------
+//
+TPtrC CBSStorage::ProposeFileNameL()
+    {
+    if( !iFilename )
+        {
+        User::Leave( KErrNotReady );
+        }
+    return iFilename->Des();
+    }
+
+// ---------------------------------------------------------------------------
+// CBSStorage::ProposeFileNameL
+// ---------------------------------------------------------------------------
+//
+TPtrC CBSStorage::ProposedDirL()
+    {
+    if( !iFilename )
+        {
+        User::Leave( KErrNotReady );
+        }
+    return iDir;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CBSStorage::GetListOfFiles()
+// ---------------------------------------------------------------------------
+//
+void CBSStorage::GetListOfFilesL( RArray<TPtrC>& aFileList )
+    {
+    CleanupClosePushL(aFileList);
+    TInt count = iElements.Count();
+    for( TInt i = 0; i < count; i++ )
+        {
+        AppendFilesL( iElements[i], aFileList );
+        }
+    CleanupStack::Pop(&aFileList);
+    }
+
+// ---------------------------------------------------------------------------
+// CBSStorage::AppendFiles()
+// ---------------------------------------------------------------------------
+//
+void CBSStorage::AppendFilesL( MBSElement* aElement, RArray<TPtrC>& aFileList )
+    {
+    if( !aElement )
+        {
+        // invalid element
+        return;
+        }
+
+    TBSElementType type = aElement->ElementType();
+    if( EBSList == type )
+        {
+        TArray<MBSElement*> list = aElement->GetStructureL();
+
+        TInt count = list.Count();
+        for( TInt i = 0; i < count; i++ )
+            {
+            AppendFilesL( list[i], aFileList );
+            }
+        }
+    else if( EBSFile == type )
+        {
+        TPtrC ptr( aElement->TextDataL() );
+        aFileList.Append( aElement->TextDataL() );
+        }
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/brandingserver/bsserver/cbsstorage.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,171 @@
+/*
+* Copyright (c) 2006-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:  Stores element data and writes it to stream
+*
+*/
+
+
+#ifndef CBSSTORAGE_H
+#define CBSSTORAGE_H
+
+#include <e32base.h>
+
+#include "rbsobjowningptrarray.h"
+
+class MBSElement;
+class RWriteStream;
+class MBSImportLogger;
+
+
+/**
+ *  Stores element data and writes it to stream
+ *
+ *  @lib brandimporter.exe
+ *  @since S60 v3.2
+ */
+class CBSStorage : public CBase
+{
+public:
+
+    static CBSStorage* NewL();
+
+    static CBSStorage* NewLC();
+
+    ~CBSStorage();
+
+    /**
+     * Set version of brand storage
+     *
+     * @since S60 3.2
+     * @param aVersion version
+     */
+    void SetVersion( TInt aVersion );
+
+    /**
+     * Set application ID of brand storage
+     *
+     * @since S60 3.2
+     * @param aAppId application ID
+     * @return none
+     */
+    void SetApplicationIdL( const TDesC& aAppId );
+
+    /**
+     * Set storage ID of brand storage
+     *
+     * @since S60 3.2
+     * @param aStorageId storage ID
+     * @return none
+     */
+    void SetStorageIdL( const TDesC& aStorageId );
+
+    /**
+     * Set language of brand storage
+     *
+     * @since S60 3.2
+     * @param aLanguage language
+     * @return none
+     */
+    void SetLanguageL( TLanguage aLanguage );
+
+    /**
+     * Store element to storage. Storage takes the ownership of element.
+     *
+     * @since S60 3.2
+     * @param aElement element to store.
+     * @return General Symbian errorcode.
+     */
+    void AppendElementsL( MBSElement* aElement );
+
+    /**
+     * Return the count of elements in storage
+     *
+     * @since S60 3.2
+     * @return count of elements
+     */
+    TInt ElementCount();
+
+    /**
+     * Externalize storage into stream
+     *
+     * @since S60 3.2
+     * @param aWriteStream output stream
+     * @return none
+     */
+    void ExternalizeL( RWriteStream& aWriteStream );
+
+    /**
+     * Replaces an element in the storage
+     *
+     * @since S60 3.2
+     * @param aElement the element to be replaced
+     */
+    void ReplaceElementL( MBSElement* aElement );
+	
+
+    TPtrC ProposeFileNameL();
+    TPtrC ProposedDirL();
+    void GetListOfFilesL( RArray<TPtrC>& aFileList );
+
+private:
+
+    CBSStorage();
+
+    void ConstructL();
+
+    /**
+     * Check that header information is complete
+     *
+     * @since S60 3.2
+     * @return ETrue  - header information ok
+     *         EFalse - header information missing or incomplete
+     */
+    TBool VerifyHeader();
+
+    TBool VerifyDataL( TArray<MBSElement*> aArray,
+                      TBool aIgnoreEmptyID = EFalse );
+	TBool VerifyDataL( RBSObjOwningPtrArray<MBSElement>& aArray,
+                      TBool aIgnoreEmptyID = EFalse );
+
+    void HandleIfErrorL( TInt aError, const TDesC& aText );
+
+    void AppendFilesL( MBSElement* aElement, RArray<TPtrC>& aFileList );
+
+private: // Data
+
+    // Own. Array of stored elements.
+    RBSObjOwningPtrArray<MBSElement> iElements;
+
+    // Own. Proposed file name
+    HBufC* iFilename;
+
+    // Proposed directory (points to iFilename)
+    TPtrC iDir;
+
+    // HEADER DATA
+
+    // Version number of storage
+    TInt iVersion;
+
+    // Own. Language ID of storage
+    HBufC* iLanguage;
+
+    // Own. Application ID of storage
+    HBufC* iAppId;
+
+    // Own. Storage ID.of storage
+    HBufC* iStorageId;
+};
+
+#endif //CBSSTORAGE_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/brandingserver/bsserver/cbsstoragemanager.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,1424 @@
+/*
+* Copyright (c) 2006-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:  Stores element data and writes it to stream
+*
+*/
+
+
+#include <s32strm.h>
+#include <s32file.h>
+#include <f32file.h>
+
+#include <bautils.h>
+#include <utf.h>
+
+
+#include "bsimportconstants.h"
+#include "cbsstoragemanager.h"
+#include "cbsstorage.h"
+#ifdef __WINSCW__
+#include "cbsibywriter.h"
+#endif
+#include "cbsserver.h"
+#include "cbssession.h"
+#include "mbsupdater.h"
+//#include "importlogwriter.h"
+#include "debugtrace.h"
+
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// CBSStorageManager::NewL
+// ---------------------------------------------------------------------------
+//
+CBSStorageManager* CBSStorageManager::NewL( CBSSession* aSession, const TDesC& aAppId )
+    {
+    CBSStorageManager* self = NewLC( aSession, aAppId );
+    CleanupStack::Pop();
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CBSStorageManager::NewLC
+// ---------------------------------------------------------------------------
+//
+CBSStorageManager* CBSStorageManager::NewLC( CBSSession* aSession, const TDesC& aAppId )
+    {
+    CBSStorageManager* self =
+        new (ELeave) CBSStorageManager();
+    CleanupStack::PushL( self );
+    self->ConstructL( aSession, aAppId );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CBSStorageManager::ConstructL
+// ---------------------------------------------------------------------------
+//
+void CBSStorageManager::ConstructL( CBSSession* aSession, const TDesC& aAppId )
+    {
+    TRACE( T_LIT( "CBSStorageManager::ConstructL begin aAppId[%S]"), &aAppId );
+    User::LeaveIfError( iFs.Connect() );
+ 
+// RFs::ShareProtected() needs to be called for the session 
+// used to open the handle that is going to be shared.
+// ShareProtected() was called to a wrong Fs-session in 
+// CBSBrandHandler::GetFileL().
+    User::LeaveIfError( iFs.ShareProtected() );
+    
+    iFs.CreatePrivatePath( EDriveC );
+    
+    iSession = aSession;
+    
+    
+#ifdef __WINSCW__        
+    if( !iWriter )
+    	{
+    	iWriter = CBSIBYWriter::NewL();
+    	}
+    if( aAppId.Compare( KNullDesC ) )
+    	{
+    	HBufC* temp = HBufC::NewL( KBSIbyDirectory().Length() +
+    							   aAppId.Length() +
+    							   KBSIbyExtension().Length() );
+		TPtr ptr( temp->Des() );
+		ptr.Append( KBSIbyDirectory );
+		ptr.Append( aAppId );
+		ptr.Append( KBSIbyExtension );
+		delete iIbyFile;
+		iIbyFile = temp;
+	    iWriter->InitIbyFileL( iFs, *iIbyFile );
+    	}
+#endif
+    TRACE( T_LIT( "CBSStorageManager::ConstructL end") );
+    }
+
+// ---------------------------------------------------------------------------
+// CBSStorageManager::CBSStorageManager
+// ---------------------------------------------------------------------------
+//
+CBSStorageManager::CBSStorageManager() :
+    iCurrent( KErrNotFound )
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// CBSStorageManager::~CBSStorageManager
+// ---------------------------------------------------------------------------
+//
+CBSStorageManager::~CBSStorageManager()
+    {
+    TRACE( T_LIT( "CBSStorageManager::~CBSStorageManager begin") );
+    iStorages.ResetAndDestroy();
+    iFs.Close();
+
+	delete iAppId;
+	delete iBrandId;
+	delete iLanguageId;
+    delete iFilename;
+    
+    #ifdef __WINSCW__
+    delete iWriter;
+    #endif
+    
+    delete iIbyFile;
+    TRACE( T_LIT( "CBSStorageManager::~CBSStorageManager end") );
+    }
+
+// ---------------------------------------------------------------------------
+// CBSStorageManager::InitTransactionL
+// ---------------------------------------------------------------------------
+//
+void CBSStorageManager::ConnectTransactionL(const TDesC& aAppId,
+				    					  const TDesC& aBrandId,
+				    					  TLanguage aLanguageId,
+    					   				  TBool aAppending, /*= EFalse*/
+    					   				  TInt aReserved /*=0*/)
+	{
+	TRACE( T_LIT( "CBSStorageManager::ConnectTransactionL begin AppId[%S],BrandId[%S]"),&aAppId, &aBrandId );
+	if( iActive )
+		{
+		TBool transactionOk = ETrue;
+		
+		transactionOk = iReserved == aReserved;
+
+		if( transactionOk )
+			{
+			transactionOk = iLanguageIdNum == aLanguageId;
+			}
+
+		if( transactionOk )
+			{
+			transactionOk != iAppId->Compare( aAppId );
+			}
+		
+		if( transactionOk )
+			{
+			transactionOk != iBrandId->Compare( aBrandId );
+			}
+			
+		if( !transactionOk )
+			{
+			User::Leave( KErrArgument );
+			}
+		// the same transaction as is ongoing
+		return;
+		}
+	iActive = ETrue;
+	
+    HBufC* tmpAppId = aAppId.AllocL();
+    delete iAppId;
+    iAppId = tmpAppId;
+    
+    HBufC* tmpBrandId = aBrandId.AllocL();
+    delete iBrandId;
+    iBrandId = tmpBrandId;
+    
+    iLanguageIdNum = aLanguageId;
+    
+    TBuf<KLangBufLength> buffer;
+    if( aLanguageId < 10 )
+    	{
+    	// we want two digit languageid
+    	buffer.AppendNum( KLeadingZero );
+    	}
+    buffer.AppendNum( aLanguageId );
+    HBufC* tmp = buffer.AllocL();
+    delete iLanguageId;
+    iLanguageId = tmp;
+    
+    iReserved = aReserved;
+    
+    HBufC* tempFile = ConstructFileNameL();
+    delete iFilename;
+    iFilename = tempFile;
+    
+    iAppending = aAppending;
+	TRACE( T_LIT( "CBSStorageManager::ConnectTransactionL end") );
+	}
+
+
+// ---------------------------------------------------------------------------
+// CBSStorageManager::CancelTransactionL
+// ---------------------------------------------------------------------------
+//
+void CBSStorageManager::CancelTransactionL()
+	{
+	TRACE( T_LIT( "CBSStorageManager::CancelTransactionL begin") );
+	if( !iActive )
+		{
+		User::Leave( KErrNotFound );
+		}
+	// this closes the transaction
+	CleanupTransaction();
+	TRACE( T_LIT( "CBSStorageManager::CancelTransactionL end") );
+	}
+
+// ---------------------------------------------------------------------------
+// CBSStorageManager::ConstructFileNameL()
+// ---------------------------------------------------------------------------
+//
+HBufC* CBSStorageManager::ConstructFileNameL( TInt aReserved /* = 0 */ )
+    {
+    HBufC* fileName = NULL;
+    if( iAppId && iBrandId && iLanguageId )
+        {
+        fileName = ConstructFileNameL( *iAppId, *iBrandId, iLanguageIdNum, aReserved );
+        }
+    return fileName;
+    }
+
+// ---------------------------------------------------------------------------
+// CBSStorageManager::ConstructFileNameL()
+// ---------------------------------------------------------------------------
+//
+HBufC* CBSStorageManager::ConstructFileNameL( const TDesC& aAppId,
+										      const TDesC& aBrandId,
+										      TLanguage aLanguage,
+										      TInt aReserved /* = 0 */ )
+    {
+	HBufC* fileName = NULL;
+
+    TBuf<KLangBufLength> langBuf;
+	if (aLanguage >= 100)
+		User::LeaveIfError (KErrNotFound);
+    if( aLanguage < 10 )
+    	{
+    	// we want two digit languageid
+    	langBuf.AppendNum( KLeadingZero );
+    	}
+    langBuf.AppendNum( aLanguage );
+    
+    TInt length = aAppId.Length() + aBrandId.Length() +
+                  KDefFileName().Length() + KDirSeparator().Length() * 2 +
+                  langBuf.Length() + KDot().Length() * 3 + KMaxVersionLenght;
+	fileName = HBufC::NewLC( length );
+    
+    TPtr file( fileName->Des() );
+
+    // [application_id]\[brand_id]\[def_filename][language_id]
+    //
+    
+    file.Append( aAppId );
+    file.Append( KDirSeparator );
+    file.Append( aBrandId );
+    file.Append( KDirSeparator );
+    iDir.Set( file.Left( file.Length() ) );
+    file.Append( KDefFileName );
+    file.Append( langBuf );
+    if( aReserved > 0 )
+    	{
+	    TBuf<KMaxVersionLenght> versionBuffer;
+	    versionBuffer.AppendNum( aReserved );
+	    file.Append( KDot() );
+    	file.Append( versionBuffer );
+    	}
+
+    if( fileName )
+    	{
+    	CleanupStack::Pop( fileName );
+    	}
+    return fileName;
+    }
+
+// ---------------------------------------------------------------------------
+// CBSStorageManager::CreateStorageL
+// ---------------------------------------------------------------------------
+//
+void CBSStorageManager::CreateStorageL()
+    {
+    CBSStorage* tmp = CBSStorage::NewL();
+    iStorages.Append( tmp );
+    iCurrent = iStorages.Find( tmp );
+    }
+
+// ---------------------------------------------------------------------------
+// CBSStorageManager::StorageCount
+// ---------------------------------------------------------------------------
+//
+TInt CBSStorageManager::StorageCount()
+    {
+    return iStorages.Count();
+    }
+
+// ---------------------------------------------------------------------------
+// CBSStorageManager::Storage
+// ---------------------------------------------------------------------------
+//
+CBSStorage* CBSStorageManager::Storage( TInt aIndex )
+    {
+    return iStorages[ aIndex ];
+    }
+
+// ---------------------------------------------------------------------------
+// CBSStorageManager::Storage
+// ---------------------------------------------------------------------------
+//
+CBSStorage* CBSStorageManager::Storage()
+    {
+    if( iStorages.Count() > 0 )
+    	{
+    	return iStorages[ iCurrent ];	
+    	}
+    return NULL;
+    }
+
+// ---------------------------------------------------------------------------
+// CBSStorageManager::WriteStorageFilesL
+// ---------------------------------------------------------------------------
+//
+TInt CBSStorageManager::WriteStorageFilesL()
+    {
+    TRACE( T_LIT( "CBSStorageManager::WriteStorageFilesL begin") );
+    if( !iActive )
+    	{
+    	User::Leave( KErrNotFound );
+    	}
+    TInt count = iStorages.Count();
+    for( TInt i = 0; i < count; i++ )
+        {
+        // get the private path
+        TBuf<KMaxPath> path;
+        User::LeaveIfError( iFs.PrivatePath( path ) );
+        
+        // construct absolute filename
+        HBufC* fullname = FullFileNameLC( *iFilename, ETrue );
+
+        TParse filestorename;
+        iFs.Parse( *fullname, filestorename );
+
+	    RFileWriteStream outstream;
+
+		TInt currentVersion = iReserved;
+		TInt newVersion = iReserved;
+		// check if the brand has any active clients
+		TBool brandActive = ETrue;
+		if( iSession )
+			{
+			CBSServer* server = iSession->Server();
+			if( server )
+				{
+				brandActive = server->MatchSessionL( *iAppId, *iBrandId,
+													 iLanguageIdNum, iSession, currentVersion );					
+				}
+			}
+
+		if( BaflUtils::FileExists( iFs, filestorename.FullName() ) )
+			{
+			currentVersion = ReadVersionL( filestorename.FullName() );
+			
+			if( iReserved == KBSAutomaticVersionUpdate && brandActive )
+				{
+
+				// the brand has active clients
+				// check if there is already a versioned file for this version
+				HBufC* fileName = FindAvailableVersionL( currentVersion + 1, newVersion );
+				CleanupStack::PushL( fileName);
+				
+				HBufC* newName = FullFileNameLC( *fileName, ETrue );
+
+		        iFs.Parse( *newName, filestorename );
+		        
+				if( BaflUtils::FileExists( iFs, filestorename.FullName() ) )
+					{
+					// the file already exists
+					User::Leave( KErrAlreadyExists );
+					}
+				CleanupStack::PopAndDestroy( 2, fileName ); // newName, fileName
+				}
+				
+			else if( ( iReserved == currentVersion ) )
+				{
+				// this version is already installed
+				User::Leave( KErrAlreadyExists );
+				}
+				
+			else
+				{
+				// check if the current version brand is active
+				brandActive = iSession->Server()->MatchSessionL( *iAppId, *iBrandId,
+													 iLanguageIdNum, iSession, currentVersion );
+				// new version
+				if( brandActive )
+					{
+					// brand is active
+					// check if there is already a versioned file for this version
+					HBufC* fileName = ConstructFileNameL( iReserved );
+					CleanupStack::PushL( fileName );
+					
+			        HBufC* newName = FullFileNameLC( *fileName, ETrue );
+			        
+			        iFs.Parse( *newName, filestorename );
+			        			        
+					if( BaflUtils::FileExists( iFs, filestorename.FullName() ) )
+						{
+						// the file already exists
+						User::Leave( KErrAlreadyExists );
+						}
+					CleanupStack::PopAndDestroy( 2, fileName ); // newName, fileName
+					}
+				}
+			}
+			
+ 
+		// write a new brand file
+		
+	    // Construct the output file & stream.
+	    iFs.MkDirAll( filestorename.DriveAndPath() );
+
+        TInt err = outstream.Replace( iFs, filestorename.FullName(), EFileWrite );
+
+
+        if( err )
+            {
+			TRACE( T_LIT("ERROR: Cannot create branding file: '%S'"), fullname );
+
+            User::Leave( err );
+            }
+
+        CleanupClosePushL( outstream );
+		
+		if( iReserved == KBSAutomaticVersionUpdate )
+			{
+			// set the next version
+			iStorages[i]->SetVersion( newVersion );
+			iReserved = newVersion;
+			}
+		
+        // Write data to file
+        TRAPD( extError, iStorages[i]->ExternalizeL( outstream ) );
+		if( extError && !iAppending )
+			{
+			// there was an error externalizing the data and we are installing
+			// delete the file, since it's not complete
+			iFs.Delete( filestorename.DriveAndPath() );
+			}
+		User::LeaveIfError( extError );
+
+
+#ifdef __WINSCW__
+        // Add to IBY file
+        iWriter->SetFileItemL( *fullname, *fullname );
+#endif
+            
+        CleanupStack::PopAndDestroy( 2 ); // fullname, outstream
+
+
+		// existing brand modified --> inform server 
+		if( iSession )
+			{
+			CBSServer* server = iSession->Server();
+			if( server )
+				{
+				server->BrandUpdatedL( *iAppId, *iBrandId,
+									   iLanguageIdNum, iSession, iReserved );					
+				}
+			}
+        }
+    
+    // this closes the transaction
+	CleanupTransaction();
+	TRACE( T_LIT( "CBSStorageManager::WriteStorageFilesL end") );
+	return iReserved;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CBSStorageManager::ReadVersionL
+// ---------------------------------------------------------------------------
+//
+TInt CBSStorageManager::ReadVersionL( const TDesC& aFilename )
+	{
+    RFile handle;
+    User::LeaveIfError( handle.Open( iFs, aFilename, EFileRead ) );
+    CleanupClosePushL( handle );
+	RFileReadStream stream;
+	stream.Attach( handle );
+	CleanupClosePushL( stream );
+	TInt version = stream.ReadInt16L();
+	CleanupStack::PopAndDestroy( 2 ); // stream, handle
+	return version;
+	}
+
+// ---------------------------------------------------------------------------
+// CBSStorageManager::FindAvailableVersionL
+// ---------------------------------------------------------------------------
+//	
+HBufC* CBSStorageManager::FindAvailableVersionL( TInt /*aCurrentVersion*/, TInt& aNewVersion )
+	{
+	HBufC* fileName =  NULL;
+	TInt newVersion = GetNewestVersionL( *iAppId, *iBrandId, iLanguageIdNum );
+	aNewVersion = newVersion++;
+	fileName = ConstructFileNameL( aNewVersion );
+	
+	return fileName;
+	}
+
+
+// ---------------------------------------------------------------------------
+// CBSStorageManager::CleanupTransaction
+// ---------------------------------------------------------------------------
+//
+void CBSStorageManager::CleanupTransaction()
+	{
+	iActive = EFalse;
+	delete iAppId;
+	iAppId = NULL;
+	delete iBrandId;
+	iBrandId = NULL;
+	delete iLanguageId;
+	iLanguageId = NULL;
+    delete iFilename;
+    iFilename = NULL;
+
+    iStorages.ResetAndDestroy();
+	}
+
+
+TInt CBSStorageManager :: isActualBrandInstalledL ( const TDesC& aAppId, const TDesC& aBrandId, TLanguage aLanguage)
+{
+	TInt actualBrandInstalled = -1;
+	HBufC *actualBrandFileName = ConstructFileNameL(aAppId, aBrandId, aLanguage);
+	CleanupStack::PushL( actualBrandFileName );
+	HBufC* newName = FullFileNameLC( *actualBrandFileName , ETrue );
+	if (newName)
+		{
+		RFile handle;
+		TInt err = handle.Open( iFs, *newName, EFileShareAny );
+		if (KErrNone == err)
+			{
+			actualBrandInstalled = 1;
+			handle.Close ();
+			}
+		}
+	
+	CleanupStack::PopAndDestroy (2);
+	return actualBrandInstalled;
+}
+// ---------------------------------------------------------------------------
+// CBSStorageManager::BrandHandleL
+// ---------------------------------------------------------------------------
+//
+void CBSStorageManager::BrandHandleL( const TDesC& aAppId,
+									  const TDesC& aBrandId,
+									  TLanguage aLanguageId,
+									  RFile& aFile,
+									  TInt aReserved )
+	{
+    TRACE( T_LIT( "CBSStorageManager::BrandHandleL begin AppId[%S],BrandId[%S]"),&aAppId, &aBrandId );
+    TBuf<KLangBufLength> langBuf;
+	if (aLanguageId >= 100)
+		User::LeaveIfError( KErrNotFound );
+    if( aLanguageId < 10 )
+    	{
+    	// we want two digit languageid
+    	langBuf.AppendNum( KLeadingZero );
+    	}
+    langBuf.AppendNum( aLanguageId );
+    
+    TInt length = aAppId.Length() + aBrandId.Length() +
+                  KDefFileName().Length() + KDirSeparator().Length() * 2 +
+                  langBuf.Length();
+                  
+	HBufC* fileName = HBufC::NewLC( length );
+	
+    TPtr filePtr( fileName->Des() );
+
+    // [application_id]\[brand_id]\[def_filename][language_id]
+    //
+    filePtr.Append( aAppId );
+    filePtr.Append( KDirSeparator );
+    filePtr.Append( aBrandId );
+    filePtr.Append( KDirSeparator );
+
+    TPtrC directory;
+    directory.Set( filePtr.Left( filePtr.Length() ) );
+    
+    filePtr.Append( KDefFileName );
+    filePtr.Append( langBuf );
+
+	HBufC* fullname  = FullFileNameLC( filePtr );
+
+    RFile handle;
+
+	TBool versioned = EFalse;
+
+	TParse findname;
+	iFs.Parse( *fullname, findname );
+
+	TFileName fullPtr = fullname->Des();
+
+
+	// seems like nearestlanguagefile is only 
+	// searching from z-drive by default, unless 
+	// some other drive is explicitely defined
+	// for that reason we first try from
+	// default drive and then force c-drive if
+	// not found.
+	BaflUtils::NearestLanguageFile( iFs, fullPtr );
+
+	TInt currentVersion = 0;
+	TRAPD( err, currentVersion = ReadVersionL( fullPtr ) );
+	if( ( err == KErrNotFound ) || ( err == KErrPathNotFound ) )
+		{
+		// not found, we try forcing c-drive
+		HBufC* driveForced  = FullFileNameLC( filePtr, ETrue );
+		TFileName forcedPtr = driveForced->Des();
+		BaflUtils::NearestLanguageFile( iFs, forcedPtr );
+		TRAP( err, currentVersion = ReadVersionL( forcedPtr ) );
+		
+		if( err == KErrPathNotFound )
+			{
+			// switching the error code to be more clear
+			err = KErrNotFound;
+			}
+		User::LeaveIfError( err );
+		
+		// this file was found, we can use this
+		CleanupStack::Pop( driveForced );
+		CleanupStack::PopAndDestroy( fullname );
+		fullname = driveForced;
+		CleanupStack::PushL( fullname );
+		}
+	else
+		{
+		User::LeaveIfError( err );
+		}
+	err = KErrNone;
+	if( currentVersion != aReserved ) 
+		{
+		// not the base version, check if we have a versioned file for this
+		HBufC* versionedName = ConstructFileNameL( aAppId, aBrandId, 
+												   aLanguageId, aReserved );
+		CleanupStack::PushL( versionedName );
+		HBufC* fullVersionedName  = FullFileNameLC( *versionedName, ETrue );
+		
+		err = handle.Open( iFs, *fullVersionedName, EFileShareAny );
+		CleanupStack::Pop( fullVersionedName );
+		CleanupStack::PopAndDestroy( versionedName );
+		CleanupStack::PopAndDestroy( fullname );
+		fullname = fullVersionedName;
+		CleanupStack::PushL( fullname );
+		versioned = ETrue;
+		}
+	else
+		{
+		err = handle.Open( iFs, *fullname, EFileShareAny );
+		}
+
+	if( err == KErrBadName )
+		{
+		// change bad name to not found
+		err = KErrNotFound;
+		}
+	User::LeaveIfError( err );
+    
+    aFile = handle;
+    
+    if( iSession )
+    	{
+    	CBSServer* server = iSession->Server();
+    	if( server )
+    		{
+    		server->RegisterFileForSessionL( iSession, *fullname, versioned );
+    		}
+    	}
+    
+    CleanupStack::PopAndDestroy( 2, fileName ); // fullname, fileName
+	TRACE( T_LIT( "CBSStorageManager::BrandHandleL end") );
+	}
+	
+// ---------------------------------------------------------------------------
+// CBSStorageManager::FileElementHandleL
+// ---------------------------------------------------------------------------
+//
+void CBSStorageManager::FileElementHandleL( const TDesC& aAppId,
+						     const TDesC& aBrandId,
+						     const TDesC& aFileName,
+						     const TDesC& aLanguageBuf,
+						     RFile& aFile )
+	{
+    TRACE( T_LIT( "CBSStorageManager::FileElementHandleL begin AppId[%S],BrandId[%S],Filename[%S]"),&aAppId, &aBrandId, &aFileName );
+// Modified file name format: "r[n].filename.ext",
+// where "n" is the language code.
+// Format used to be "filename.ext.r[n]".
+    HBufC* internalFn = HBufC::NewLC( aFileName.Length() 
+        + KBSFileLangSuffix().Length()
+        + aLanguageBuf.Length()
+        + KDot().Length() );
+    TPtr pInternalFn( internalFn->Des() );    
+    pInternalFn.Append( KBSFileLangSuffix() );
+    pInternalFn.Append( aLanguageBuf );	
+    pInternalFn.Append( KDot() );
+    pInternalFn.Append( aFileName );
+    
+    TInt length = aAppId.Length() 
+        + aBrandId.Length() 
+        + pInternalFn.Length()  
+        + ( KDirSeparator().Length() * 3 )
+        + KFileElementStore().Length();
+                  
+	HBufC* fileName = HBufC::NewL( length ); // replaced NewLC with NewL
+	
+    TPtr filePtr( fileName->Des() );
+
+    // [application_id]\[brand_id]\files\[aFilename]
+    //
+    filePtr.Append( aAppId );
+    filePtr.Append( KDirSeparator );
+    filePtr.Append( aBrandId );
+    filePtr.Append( KDirSeparator );
+    filePtr.Append( KFileElementStore );
+    filePtr.Append( KDirSeparator );
+    filePtr.Append( pInternalFn ); 
+
+    CleanupStack::PopAndDestroy( internalFn );
+    internalFn = NULL;
+    pInternalFn.Set( 0, 0, 0 );
+    
+    CleanupStack::PushL( fileName );
+	HBufC* fullname = FullFileNameLC( filePtr );
+    
+// Make a TPtr instead of TFileName because after mod, "fullPtr"
+// does not need to be passed to BaflUtils::NearestLanguageFile()
+// old implementation:  TFileName fullPtr = fullname->Des();
+    TPtr fullPtr( fullname->Des() );
+    
+	
+//  A few thoughts about language suffix of files:
+// NOTE: NOT about brand file (e.g. "brandfile.bin.r99" ),
+// but about other files which belong to the branding package, 
+// since language suffix added by branding server to a
+// mif-file is not acceptable later when calling 
+// AknIconUtils::CreateIconLC() on the mif-file.
+// Skipped call to BaflUtils::NearestLanguageFile() because "XSP MOD" 
+// moves language code from suffix to prefix.
+// NearestLanguageFile()-call could be replaced by an op where 
+// manager seeks a file only from c and z, or from all drives,
+// but does so only for file matching to current or requested  
+// language. Meaning will not try to get the nearest language 
+// file but the matching one.
+// If nearest language file is actually needed, then 
+// manager could for example implement a seek-function similar to 
+// BaflUtils::NearestLanguageFile(), but with the difference that
+// it will inspect file prefix instead of suffix.
+
+
+    RFile handle;
+// RFs::ShareProtected() needs to be called for the Fs-session 
+// used to open the handle that is about to be shared.
+// ShareProtected() was called to a wrong Fs session in 
+// CBSBrandHandler::GetFileL()!
+	TInt err = handle.Open( iFs, fullPtr, EFileShareReadersOnly );
+	if( err == KErrPathNotFound )
+		{
+		// not found, we try forcing c-drive
+		HBufC* driveForced  = FullFileNameLC( filePtr, ETrue );
+		
+		TFileName forcedPtr = driveForced->Des();
+
+		
+		err = handle.Open( iFs, forcedPtr, EFileShareReadersOnly );
+		User::LeaveIfError( err );
+		// this file was found, we can use this
+		CleanupStack::Pop( driveForced );
+		CleanupStack::PopAndDestroy( fullname );
+		fullname = driveForced;
+		CleanupStack::PushL( fullname );
+		}
+	else
+		{
+		User::LeaveIfError( err );
+		}
+
+    CleanupStack::PopAndDestroy( 2, fileName ); // fullname, fileName
+    aFile = handle;
+	TRACE( T_LIT( "CBSStorageManager::FileElementHandleL end") );
+	}
+	
+	
+// ---------------------------------------------------------------------------
+// CBSStorageManager::FullFileNameLC
+// ---------------------------------------------------------------------------
+//
+HBufC* CBSStorageManager::FullFileNameLC( const TDesC& aFilename, TBool aForceCDrive /*= EFalse*/ )
+	{
+    // get the private path
+    TBuf<KMaxPath> path;
+    User::LeaveIfError( iFs.PrivatePath( path ) );
+
+    // construct absolute filename
+    HBufC* fullname = HBufC::NewLC( KBSCDrive().Length() + aFilename.Length() + path.Length() + 
+    								KBSDataStore().Length() + KDirSeparator().Length() );
+    TPtr fullPtr( fullname->Des() );
+    fullPtr.Append( KBSCDrive );
+    fullPtr.Append( path );
+    fullPtr.Append( KBSDataStore );
+    fullPtr.Append( KDirSeparator );
+    fullPtr.Append( aFilename );
+    
+	TParse filename;
+	iFs.Parse( fullPtr, filename );
+	
+	if( !aForceCDrive )
+		{
+		// C-drive not explicitely requested
+		if( !BaflUtils::FileExists( iFs, fullPtr ) )
+			{
+			// the file does not exist in C-drive, so 
+			// we have to return a path to Z-drive
+			fullPtr.Zero();
+		    fullPtr.Append( KBSZDrive );
+		    fullPtr.Append( path );
+		    fullPtr.Append( KBSDataStore );
+		    fullPtr.Append( KDirSeparator );
+		    fullPtr.Append( aFilename );
+			}
+		}
+	
+    return fullname;
+	}
+	
+// ---------------------------------------------------------------------------
+// CBSStorageManager::CleanupFileL
+// ---------------------------------------------------------------------------
+//
+void CBSStorageManager::CleanupFileL( const TDesC& aFileName )
+	{
+	TRACE( T_LIT( "CBSStorageManager::CleanupFileL begin") );
+	// we have a versioned file we need to clean up
+	// get the file name without the version information
+	if( !IsBaseFileL( aFileName) )
+		{
+		// this is not a basefile
+		// we need to check if basefile should be replaced
+		// with this one
+		TPtrC baseFile = FilenameWithoutVersion( aFileName );
+		TInt version = ReadVersionL( aFileName );
+		TInt baseVersion = ReadVersionL( baseFile );
+		if( version > baseVersion )
+			{
+			// newer version --> replace basefile
+			TInt err = iFs.Replace( aFileName, baseFile);
+			User::LeaveIfError( err );
+			}
+		else
+			{
+			// same or older version --> delete
+			TInt err = iFs.Delete( aFileName );
+			User::LeaveIfError( err );
+			}
+		}
+	else
+		{
+		// this is a basefile
+		// we need to check if there are any newer versioned files
+		// that are not in use
+		
+		TParse filename;
+		iFs.Parse( aFileName, filename );
+		TPtrC driveAndPath = filename.DriveAndPath();
+		
+		HBufC* nameWithDrive = HBufC::NewLC( aFileName.Length() + KBSCDrive().Length() );
+		TPtr nameWithDrivePtr = nameWithDrive->Des();
+
+		nameWithDrivePtr.Append( aFileName );
+		
+		CDir* files = NULL;
+		CDir* directories = NULL;
+		
+		User::LeaveIfError( iFs.GetDir( driveAndPath, KEntryAttNormal, ESortByName, files, directories ) );
+
+		CleanupStack :: PushL (files);
+		CleanupStack :: PushL (directories);
+		
+		TInt count = files->Count();
+		for( TInt i = 0; i < count; i++ )
+			{
+			const TEntry file = (*files)[ i ];
+			TBufC<KMaxFileName> name = file.iName;
+			
+			HBufC* fullName = HBufC::NewLC( driveAndPath.Length() + name.Length() );
+			TPtr fullPtr = fullName->Des();
+			
+			fullPtr.Append( driveAndPath );
+			fullPtr.Append( name );
+			
+			TPtrC strippedName = FilenameWithoutVersion( *fullName );
+			
+			if( 0 == strippedName.Compare( nameWithDrivePtr ) )
+				{
+				// there is a versioned file, that might be newer
+				// than the basefile
+				TInt baseVersion = ReadVersionL( nameWithDrivePtr );
+				
+				TInt versionedVersion = ReadVersionL( fullPtr );
+				if( versionedVersion > baseVersion )
+					{
+					// versioned file newer than base file
+					// check if the versioned file is still in use
+					if( !iSession->Server()->FileStillInUse( iSession, fullPtr ) )
+						{
+						// the file is not in use, we can replace the basefile
+						// with the versioned file
+						TInt err = iFs.Replace( fullPtr, nameWithDrivePtr );
+						User::LeaveIfError( err );
+						}
+					}
+				}
+			CleanupStack::PopAndDestroy( fullName );
+			}
+		
+		CleanupStack :: PopAndDestroy (directories);
+		CleanupStack :: PopAndDestroy (files);
+		CleanupStack :: PopAndDestroy (nameWithDrive);
+		}
+	TRACE( T_LIT( "CBSStorageManager::CleanupFileL end") );
+	}
+
+// ---------------------------------------------------------------------------
+// CBSStorageManager::FilenameWithoutVersionL
+// ---------------------------------------------------------------------------
+//
+TPtrC CBSStorageManager::FilenameWithoutVersion( const TDesC& aFileName )
+	{
+	TParse filename;
+	iFs.Parse( aFileName, filename );
+	TPtrC extension = filename.Ext();
+	TPtrC strippedName = aFileName.Left( aFileName.Length() - ( extension.Length() ) );
+	return strippedName;
+	}
+
+
+// ---------------------------------------------------------------------------
+// CBSStorageManager::IsBaseFileL
+// ---------------------------------------------------------------------------
+//
+TBool CBSStorageManager::IsBaseFileL( const TDesC& aFileName )
+	{
+	TBool returnValue = ETrue;
+	TPtrC fileName = FilenameWithoutVersion( aFileName );
+	if( BaflUtils::FileExists( iFs, fileName ) )
+		{
+		// file with one extension stripped out exists
+		// --> the file was not a base file
+		returnValue = EFalse;
+		}
+	return returnValue;
+	}
+
+// ---------------------------------------------------------------------------
+// CBSStorageManager::InstallFile
+// ---------------------------------------------------------------------------
+//
+HBufC* CBSStorageManager::InstallFileLC( const TDesC& aFileName )
+	{
+	TRACE( T_LIT( "CBSStorageManager::InstallFileLC begin") );
+	if( !iAppId || !iBrandId )
+		{
+		User::Leave( KErrNotReady );
+		}
+	TParse filename;
+	iFs.Parse( aFileName, filename );
+	
+    TInt length = iAppId->Length() + iBrandId->Length() +
+                  aFileName.Length() + KDirSeparator().Length() * 3
+                  + KFileElementStore().Length() + iLanguageId->Length()
+                  + KDot().Length() + KBSFileLangSuffix().Length();
+                  
+	HBufC* fileName = HBufC::NewLC( length );
+	
+    TPtr filePtr( fileName->Des() );
+
+    filePtr.Append( *iAppId );
+    filePtr.Append( KDirSeparator );
+    filePtr.Append( *iBrandId );
+    filePtr.Append( KDirSeparator );
+    filePtr.Append( KFileElementStore );
+    filePtr.Append( KDirSeparator );
+    filePtr.Append( KBSFileLangSuffix() );
+	filePtr.Append( *iLanguageId );
+    filePtr.Append( KDot() ); 
+    filePtr.Append( filename.NameAndExt() ); 
+	
+	HBufC* fullname  = FullFileNameLC( filePtr, ETrue );
+    
+    TParse directory;
+    iFs.Parse( *fullname, directory );
+    TPtrC ptr = directory.DriveAndPath();
+    TInt dirError = iFs.MkDirAll( directory.DriveAndPath() );
+    if( dirError == KErrAlreadyExists )
+    	{
+    	// ignore already exists
+    	dirError = KErrNone;
+    	}
+    User::LeaveIfError( dirError );
+    
+    CFileMan* fileMan = CFileMan::NewL( iFs );
+    CleanupStack::PushL( fileMan );
+    
+    // copy the file, no overwriting
+	TInt err = fileMan->Copy( aFileName, *fullname, 1 );
+	User::LeaveIfError( err );
+		
+#ifdef __WINSCW__
+        // Add to IBY file
+        iWriter->SetFileItemL( *fullname, *fullname );
+#endif
+
+    CleanupStack::PopAndDestroy( 3, fileName ); // fileMan, fullname, fileName	
+
+
+	HBufC* returnValue = filename.NameAndExt().AllocLC();
+	TRACE( T_LIT( "CBSStorageManager::InstallFileLC end") );
+	return returnValue;
+	}
+
+
+// ---------------------------------------------------------------------------
+// CBSStorageManager::RemoveBrandL
+// ---------------------------------------------------------------------------
+//
+void CBSStorageManager::RemoveBrandL(  const TDesC& aAppId,
+									   const TDesC& aBrandId,
+									   TLanguage aLanguageId,
+									   TInt aReserved )
+	{
+    TRACE( T_LIT( "CBSStorageManager::RemoveBrandL begin") );
+    HBufC* fileName = ConstructFileNameL( aAppId,
+						       			  aBrandId,
+						       			  aLanguageId,
+						       			  aReserved );
+	CleanupStack::PushL( fileName );
+		
+    HBufC* fullname = FullFileNameLC( *fileName, ETrue );
+
+	TParse parseName;
+	iFs.Parse( *fullname, parseName );
+	
+	TPtrC directory = parseName.DriveAndPath();
+
+    CFileMan* fileMan = CFileMan::NewL( iFs );
+    CleanupStack::PushL( fileMan );
+    
+    // delete all files under this brand and language
+	TInt err = fileMan->RmDir( directory );
+	TRACE( T_LIT( "CBSStorageManager::RemoveBrandL dir='%S' err=%d "), &directory, err );
+	
+	//in case the removal of the entire brand failed because the brand was 
+	//in use, we set this brand as discarded (since parts of the package 
+	//might have been removed)
+    if ( KErrInUse  == err ) 
+        {
+        MarkBrandAsDiscardedL( aAppId, aBrandId );
+        }
+	
+	User::LeaveIfError( err );
+
+	CleanupStack::PopAndDestroy( 3, fileName );
+	TRACE( T_LIT( "CBSStorageManager::RemoveBrandL end ") );
+	}
+
+// ---------------------------------------------------------------------------
+// CBSStorageManager::RemoveApplicationL
+// ---------------------------------------------------------------------------
+//
+void CBSStorageManager::RemoveApplicationL( const TDesC& aAppId )
+	{
+    TRACE( T_LIT( "CBSStorageManager::RemoveApplicationL begin") );
+    TInt length = aAppId.Length() + 
+                  KDefFileName().Length() + KDirSeparator().Length();
+                  
+
+	HBufC* fileName = HBufC::NewLC( length );
+    
+    TPtr file( fileName->Des() );
+
+    file.Append( aAppId );
+    file.Append( KDirSeparator );
+    
+    HBufC* fullName = FullFileNameLC( *fileName, ETrue );
+    
+    CFileMan* fileMan = CFileMan::NewL( iFs );
+    CleanupStack::PushL( fileMan );
+    
+    // delete all files under this brand and language
+	TInt err = fileMan->RmDir( *fullName );
+	User::LeaveIfError( err ); 
+    
+    CleanupStack::PopAndDestroy( 3, fileName );
+    TRACE( T_LIT( "CBSStorageManager::RemoveApplicationL end") );
+	}
+
+
+// ---------------------------------------------------------------------------
+// CBSStorageManager::NextAvailableVersionL
+// ---------------------------------------------------------------------------
+//
+TInt CBSStorageManager::NextAvailableVersionL()
+	{
+	TRACE( T_LIT( "CBSStorageManager::NextAvailableVersionL begin") );
+	TInt returnValue = 0;
+	
+	if( iAppId && iBrandId )
+		{
+		TInt newVersion = 0;
+		TRAPD( err, newVersion = GetNewestVersionL( *iAppId, *iBrandId, iLanguageIdNum ) );
+		if( err == KErrNotFound )
+			{
+			// ignore not found -> we default to 1
+			err = KErrNone;
+			returnValue = iReserved;
+			}
+		else
+			{
+			returnValue = newVersion + 1;
+			}
+		User::LeaveIfError( err );
+		}
+    TRACE( T_LIT( "CBSStorageManager::NextAvailableVersionL end") );
+	return returnValue;
+	}
+
+
+// ---------------------------------------------------------------------------
+// CBSStorageManager::NextAvailableVersionL
+// ---------------------------------------------------------------------------
+//
+void CBSStorageManager::SetVersion( TInt aReserved )
+	{
+	iReserved = aReserved;
+	}
+
+
+// ---------------------------------------------------------------------------
+// CBSStorageManager::GetCurrentVersionL
+// ---------------------------------------------------------------------------
+//
+TInt CBSStorageManager::GetNewestVersionL( const TDesC& aAppId,
+										   const TDesC& aBrandId,
+										   TLanguage aLanguageId,
+										   TPtr* aDrive /*= KNullDesC()*/ )
+	{
+    TRACE( T_LIT( "CBSStorageManager::GetNewestVersionL begin") );
+    HBufC* fileName = ConstructFileNameL( aAppId, aBrandId, aLanguageId );
+	CleanupStack::PushL( fileName );
+
+
+	// FullFileNameLC returns the file from C-drive if it exists there
+	// and if not, then from ROM
+    HBufC* fullFileName = FullFileNameLC( *fileName );
+
+	TParse parse;
+	iFs.Parse( *fullFileName, parse );
+	TPtrC driveAndPath = parse.DriveAndPath();
+	
+	CDir* files = NULL;
+	CDir* directories = NULL;
+	
+	TInt err = iFs.GetDir( driveAndPath, KEntryAttNormal, ESortByName, files, directories );
+	if(KErrNone == err )
+		{
+		if(aDrive)
+			{
+			(*aDrive).Copy(KBSZDrive);	
+			}
+	    
+		}
+	if( err == KErrPathNotFound )
+		{
+		// not found from Z-drive, try from C-drive
+		CleanupStack::PopAndDestroy( fullFileName );
+		fullFileName = FullFileNameLC( *fileName, ETrue );
+		driveAndPath.Set( parse.DriveAndPath() );
+		err = iFs.GetDir( driveAndPath, KEntryAttNormal, ESortByName, files, directories );
+		if(KErrNone == err )
+			{
+			if(aDrive)
+				{
+			    (*aDrive).Copy(KBSCDrive);
+				}
+			}
+		if( err == KErrPathNotFound )
+			{
+			// switching error code to make it more clear
+			err = KErrNotFound;
+			}
+		// as we are leaving here cleanup the stack
+		CleanupStack::PopAndDestroy( 2, fileName ); // fullFileName, fileName
+		User::LeaveIfError( err );
+		}
+	
+	// get the base file version
+	TInt returnValue = ReadVersionL( *fullFileName );
+	
+	TInt count = files->Count();
+	for( TInt i = 0; i < count; i++ )
+		{
+		const TEntry file = (*files)[ i ];
+		TBufC<KMaxFileName> name = file.iName;
+		
+		HBufC* fullName = HBufC::NewLC( driveAndPath.Length() + name.Length() );
+		TPtr fullPtr = fullName->Des();
+		
+		fullPtr.Append( driveAndPath );
+		fullPtr.Append( name );
+		
+		TPtrC strippedName = FilenameWithoutVersion( *fullName );
+		
+		if( 0 == strippedName.Compare( *fullFileName ) )
+			{
+			// there is a versioned file, that might be newer
+			// than the basefile
+			TInt versionedVersion = ReadVersionL( fullPtr );
+			if( versionedVersion > returnValue )
+				{
+				// versioned file newer than base file
+				returnValue = versionedVersion;
+				}
+			}
+		CleanupStack::PopAndDestroy( fullName );
+		}
+
+	CleanupStack::PopAndDestroy( 2, fileName ); // fullFileName, fileName
+    
+    TRACE( T_LIT( "CBSStorageManager::GetNewestVersionL end") );
+	return returnValue;
+	}
+
+
+// ---------------------------------------------------------------------------
+// CBSStorageManager::WriteIbyFiles
+// ---------------------------------------------------------------------------
+//
+TInt CBSStorageManager::WriteIbyFiles()
+	{
+	TInt err = KErrNone;
+#ifdef __WINSCW__	
+	if( !iWriter )
+		{
+		return KErrNone;
+		}
+
+    TRAP( err, iWriter->WriteIBYFileL( iFs, *iIbyFile ) );
+    delete iIbyFile;
+    iIbyFile = NULL;
+    delete iWriter;
+    iWriter = NULL;
+	
+#endif	
+	return err;
+	}
+
+// ---------------------------------------------------------------------------
+// CBSStorageManager::LockStorage
+// ---------------------------------------------------------------------------
+//
+void CBSStorageManager::LockStorage()
+    {
+    TRACE( T_LIT( "CBSStorageManager::LockStorage begin") );
+    // This will disable all filehandles, so that clients can't use them
+    iFs.Close();
+    TRACE( T_LIT( "CBSStorageManager::LockStorage end") );
+    }
+    
+// ---------------------------------------------------------------------------
+// CBSStorageManager::ReleaseLockL
+// ---------------------------------------------------------------------------
+//
+void CBSStorageManager::ReleaseLockL()
+    {
+    TRACE( T_LIT( "CBSStorageManager::ReleaseLockL begin") );
+    User::LeaveIfError( iFs.Connect() );
+    TRACE( T_LIT( "CBSStorageManager::ReleaseLockL end") );
+    }
+    
+// ---------------------------------------------------------------------------
+// CBSStorageManager::CheckBrandDiscarded
+// ---------------------------------------------------------------------------
+//
+TBool CBSStorageManager::CheckBrandDiscarded(const TDesC& aAppId,
+							const TDesC& aBrandId)
+{
+	TBool flag = EFalse ;
+	
+	HBufC *fileName = ConstructDiscardBrandFileNameL(aAppId, aBrandId) ;
+	CleanupStack::PushL(fileName);
+	HBufC *fullPath = FullDiscardBrandFileNameLC( *fileName ) ;
+	
+	// crate a flag file
+	RFile file;
+	TInt err = file.Open(iFs, *fullPath, EFileWrite);
+	if(err == KErrNone)
+	{
+		// file exists.
+		file.Close() ;
+		flag = ETrue ;
+	}
+	
+	CleanupStack::PopAndDestroy(fullPath) ;
+	CleanupStack::PopAndDestroy(fileName) ;
+	return flag ;
+}
+
+// ---------------------------------------------------------------------------
+// CBSStorageManager::ConstructDiscardBrandFileNameL
+// ---------------------------------------------------------------------------
+//
+HBufC* CBSStorageManager::ConstructDiscardBrandFileNameL( const TDesC& aAppId,
+										      const TDesC& aBrandId )
+    {
+	HBufC* fileName = NULL;
+
+    TInt length = aAppId.Length() + aBrandId.Length() +
+                  KDiscardBrandFileName().Length() + KDirSeparator().Length() * 2 ;
+	fileName = HBufC::NewLC( length );
+    
+    TPtr file( fileName->Des() );
+
+    // [application_id]\[brand_id]\discardedbrand.txt
+    file.Append( aAppId );
+    file.Append( KDirSeparator );
+    file.Append( aBrandId );
+    file.Append( KDirSeparator );
+    file.Append( KDiscardBrandFileName );
+
+    if( fileName )
+    	{
+    	CleanupStack::Pop( fileName );
+    	}
+    	
+    return fileName;
+    }
+    
+// ---------------------------------------------------------------------------
+// CBSStorageManager::FullDiscardBrandFileNameLC
+// ---------------------------------------------------------------------------
+//
+HBufC* CBSStorageManager::FullDiscardBrandFileNameLC( TDesC& aFilename )
+	{
+    // get the private path
+    TBuf<KMaxPath> path;
+    RFs fs ;
+    User::LeaveIfError( fs.Connect() );
+    CleanupClosePushL(fs);
+    User::LeaveIfError( fs.PrivatePath( path ) );
+
+    // construct absolute filename
+    HBufC* fullname = HBufC::NewLC( KBSCDrive().Length() + aFilename.Length() + path.Length() + 
+    								KBSDataStore().Length() + KDirSeparator().Length() );
+    TPtr fullPtr( fullname->Des() );
+    fullPtr.Append( KBSCDrive );
+    fullPtr.Append( path );
+    fullPtr.Append( KBSDataStore );
+    fullPtr.Append( KDirSeparator );
+    fullPtr.Append( aFilename );
+    
+	CleanupStack::Pop(); // fullname
+	CleanupStack::PopAndDestroy() ; //fs
+	CleanupStack::PushL(fullname) ;
+	
+    return fullname;
+	}
+
+// ---------------------------------------------------------------------------
+// CBSStorageManager::MarkBrandAsDiscardedL
+// ---------------------------------------------------------------------------
+//
+void CBSStorageManager::MarkBrandAsDiscardedL( const TDesC& aAppId,
+			  			                       const TDesC& aBrandId )
+    {
+	TRACE( T_LIT( "CBSStorageManager::MarkBrandAsDiscardedL begin app='%S' brand='%S'"), &aAppId, &aBrandId );
+	
+	HBufC *fileName = ConstructDiscardBrandFileNameL( aAppId, aBrandId ) ;
+	CleanupStack::PushL( fileName );
+	HBufC *fullPath = FullDiscardBrandFileNameLC( *fileName ) ;
+    TRACE( T_LIT( "CBSStorageManager::MarkBrandAsDiscardedL discardedfile='%S'"), &fullPath );
+	
+	// create flag file
+	RFile file;	
+	TInt err = file.Replace( iFs, *fullPath, EFileWrite );
+	TRACE( T_LIT( "CBSStorageManager::MarkBrandAsDiscardedL discarded file creation result='%d'"), err );
+	file.Close();
+	
+	CleanupStack::PopAndDestroy( fullPath );
+	fullPath = NULL;
+	CleanupStack::PopAndDestroy( fileName );
+	fileName = NULL;
+	
+	TRACE( T_LIT( "CBSStorageManager::MarkBrandAsDiscardedL begin") );	
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/brandingserver/bsserver/cbsstoragemanager.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,225 @@
+/*
+* Copyright (c) 2006-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:  Storage handler
+*
+*/
+
+
+#ifndef CBSSTORAGEMANAGER_H
+#define CBSSTORAGEMANAGER_H
+
+#include <e32base.h>
+#include <f32file.h>
+
+class CBSSession;
+class CBSIBYWriter;
+class MBSElement;
+class CBSStorage;
+class RWriteStream;
+
+
+/**
+ *  Storage handler
+ *
+ *  @lib .exe
+ *  @since S60 v3.2
+ */
+class CBSStorageManager : public CBase
+{
+public:
+
+    static CBSStorageManager* NewL( CBSSession* aSession, const TDesC& aAppId );
+
+    static CBSStorageManager* NewLC( CBSSession* aSession, const TDesC& aAppId );
+
+    ~CBSStorageManager();
+
+
+    /**
+     * Initializes the transaction to the
+     * storagemanager
+     *
+     * @since S60 3.2
+     * @return none
+     */
+    void ConnectTransactionL(const TDesC& aAppId,
+    					   const TDesC& aBrandId,
+    					   TLanguage aLanguageId,
+    					   TBool aAppending = EFalse,
+    					   TInt aReserved = 0 );
+
+
+    /**
+     * Create a new storage and set it to current.
+     *
+     * @since S60 3.2
+     * @return none
+     */
+    void CreateStorageL();
+
+    /**
+     * Return the count of storages
+     *
+     * @since S60 3.2
+     * @return count of elements
+     */
+    TInt StorageCount();
+
+    /**
+     * Get stored storage at index or current storage.
+     *
+     * @since S60 3.2
+     * @param aIndex index of storage to fetch.
+     * @return Stored storage
+     */
+    CBSStorage* Storage( TInt aIndex );
+    CBSStorage* Storage();
+
+    /**
+     * Externalize storage files into file system
+     *
+     * @since S60 3.2
+     * @param aFs filesystem handle
+     * @param aBaseDir Base directory for writing
+     * @return the new brand version
+     */
+    TInt WriteStorageFilesL();
+
+	void CancelTransactionL();
+
+    void BrandHandleL( const TDesC& aAppId,
+					   const TDesC& aBrandId,
+					   TLanguage aLanguageId,
+					   RFile& aFile, 
+					   TInt aReserved );
+
+    void FileElementHandleL( const TDesC& aAppId,
+						     const TDesC& aBrandId,
+						     const TDesC& aFileName,
+						     const TDesC& aLanguageBuf,
+						     RFile& aFile );
+
+    void CleanupFileL( const TDesC& aFileName );
+
+	TPtrC FilenameWithoutVersion( const TDesC& aFileName );
+
+    /**
+     * Externalize storage files into file system
+     *
+     * @since S60 3.2
+     * @param aFileName the name of the installed file
+     * 		  including path
+     * @return the filename without path component
+     */
+	HBufC* InstallFileLC( const TDesC& aFileName );
+
+	void RemoveBrandL(  const TDesC& aAppId,
+						const TDesC& aBrandId,
+						TLanguage aLanguageId,
+						TInt aReserved = 0);
+
+	void RemoveApplicationL(  const TDesC& aAppId );
+
+	TInt NextAvailableVersionL();
+	void SetVersion( TInt aVersionId );
+
+	TInt GetNewestVersionL( const TDesC& aAppId,
+							const TDesC& aBrandId,
+							TLanguage aLanguageId,
+						    TPtr* aDrive = NULL);
+	TInt WriteIbyFiles();
+    
+    void LockStorage();
+    
+    void ReleaseLockL();
+    
+    TBool CheckBrandDiscarded(const TDesC& aAppId,
+							const TDesC& aBrandId) ;
+	static HBufC* ConstructDiscardBrandFileNameL( const TDesC& aAppId,
+										      const TDesC& aBrandId );
+										      
+	static HBufC* FullDiscardBrandFileNameLC( TDesC& aFilename ) ;
+							
+    TInt isActualBrandInstalledL ( const TDesC& aAppId, const TDesC& aBrandId, TLanguage aLanguage);
+private:
+
+    CBSStorageManager();
+
+    void ConstructL( CBSSession* aSession, const TDesC& aAppId );
+    
+    HBufC* ConstructFileNameL( TInt aVersion = 0 );
+    
+    HBufC* ConstructFileNameL( const TDesC& aAppId,
+						       const TDesC& aBrandId,
+						       TLanguage aLanguage,
+						       TInt aReserved = 0 );
+    
+	void CleanupTransaction();
+	
+	HBufC* FullFileNameLC( const TDesC& aFilename, TBool aForceCDrive = EFalse );
+	
+	TInt ReadVersionL( const TDesC& aFilename );
+	
+	HBufC* FindAvailableVersionL( TInt aCurrentVersion, TInt& aNewVersion );
+
+	TBool IsBaseFileL( const TDesC& aFileName );
+
+	
+	/**
+     * Mark a brand package as discarded. Future attempts to create an 
+     * access to this brand package will fail.
+     *
+     * @since S60 3.2
+     * @param aAppId a application id
+     * @param aBrandId a brand id
+     */
+	void MarkBrandAsDiscardedL( const TDesC& aAppId,
+		                        const TDesC& aBrandId );
+
+private: // Data
+
+    // Own. Array of stored storages.
+    RPointerArray<CBSStorage> iStorages;
+
+    // Index of currently active storage
+    TInt iCurrent;
+
+    // IBY writer
+    CBSIBYWriter* iWriter;
+    
+    RFs		iFs;
+    TBool	iActive;
+    
+    HBufC* iAppId;
+	HBufC* iBrandId;
+	HBufC*  iLanguageId;
+	TLanguage iLanguageIdNum;
+	
+    // Own. Proposed file name
+    HBufC* iFilename;
+
+    // Proposed directory (points to iFilename)
+    TPtrC iDir;
+	
+	// doesn't own: the server
+	CBSSession* iSession;
+	
+	TBool iAppending;
+	
+	HBufC* iIbyFile;
+	TInt  iReserved;
+	
+};
+
+#endif //CBSSTORAGEMANAGER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/brandingserver/bwins/bsclientu.def	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,21 @@
+EXPORTS
+	??1CBSBitmap@@UAE@XZ @ 1 NONAME ; CBSBitmap::~CBSBitmap(void)
+	??1CBSFactory@@UAE@XZ @ 2 NONAME ; CBSFactory::~CBSFactory(void)
+	?BitmapFileId@CBSBitmap@@QBEABVTDesC8@@XZ @ 3 NONAME ; class TDesC8 const & CBSBitmap::BitmapFileId(void) const
+	?BitmapId@CBSBitmap@@QBEHXZ @ 4 NONAME ; int CBSBitmap::BitmapId(void) const
+	?BitmapMaskId@CBSBitmap@@QBEHXZ @ 5 NONAME ; int CBSBitmap::BitmapMaskId(void) const
+	?CreateAccessL@CBSFactory@@QAEPAVMBSAccess@@ABVTDesC8@@W4TLanguage@@HH@Z @ 6 NONAME ; class MBSAccess * CBSFactory::CreateAccessL(class TDesC8 const &, enum TLanguage, int, int)
+	?CreateAccessLC@CBSFactory@@QAEPAVMBSAccess@@ABVTDesC8@@W4TLanguage@@HH@Z @ 7 NONAME ; class MBSAccess * CBSFactory::CreateAccessLC(class TDesC8 const &, enum TLanguage, int, int)
+	?CreateBSElementL@BSElementFactory@@SAPAVMBSElement@@ABVTDesC8@@W4TBSElementType@@0@Z @ 8 NONAME ; class MBSElement * BSElementFactory::CreateBSElementL(class TDesC8 const &, enum TBSElementType, class TDesC8 const &)
+	?CreateBSElementL@BSElementFactory@@SAPAVMBSElement@@ABVTDesC8@@W4TBSElementType@@AAV?$RBSObjOwningPtrArray@VMBSElement@@@@@Z @ 9 NONAME ; class MBSElement * BSElementFactory::CreateBSElementL(class TDesC8 const &, enum TBSElementType, class RBSObjOwningPtrArray<class MBSElement> &)
+	?CreateBSElementL@BSElementFactory@@SAPAVMBSElement@@ABVTDesC8@@W4TBSElementType@@ABVTDesC16@@@Z @ 10 NONAME ; class MBSElement * BSElementFactory::CreateBSElementL(class TDesC8 const &, enum TBSElementType, class TDesC16 const &)
+	?CreateBSElementL@BSElementFactory@@SAPAVMBSElement@@ABVTDesC8@@W4TBSElementType@@H@Z @ 11 NONAME ; class MBSElement * BSElementFactory::CreateBSElementL(class TDesC8 const &, enum TBSElementType, int)
+	?CreateBSElementL@BSElementFactory@@SAPAVMBSElement@@ABVTDesC8@@W4TBSElementType@@PAVCBSBitmap@@@Z @ 12 NONAME ; class MBSElement * BSElementFactory::CreateBSElementL(class TDesC8 const &, enum TBSElementType, class CBSBitmap *)
+	?CreateUpdaterL@CBSFactory@@QAEPAVMBSUpdater@@XZ @ 13 NONAME ; class MBSUpdater * CBSFactory::CreateUpdaterL(void)
+	?CreateUpdaterLC@CBSFactory@@QAEPAVMBSUpdater@@XZ @ 14 NONAME ; class MBSUpdater * CBSFactory::CreateUpdaterLC(void)
+	?NewL@CBSBitmap@@SAPAV1@HHHHABVTDesC8@@@Z @ 15 NONAME ; class CBSBitmap * CBSBitmap::NewL(int, int, int, int, class TDesC8 const &)
+	?NewL@CBSFactory@@SAPAV1@ABVTDesC8@@0@Z @ 16 NONAME ; class CBSFactory * CBSFactory::NewL(class TDesC8 const &, class TDesC8 const &)
+	?NewLC@CBSBitmap@@SAPAV1@HHHHABVTDesC8@@@Z @ 17 NONAME ; class CBSBitmap * CBSBitmap::NewLC(int, int, int, int, class TDesC8 const &)
+	?SkinIdMajor@CBSBitmap@@QBEHXZ @ 18 NONAME ; int CBSBitmap::SkinIdMajor(void) const
+	?SkinIdMinor@CBSBitmap@@QBEHXZ @ 19 NONAME ; int CBSBitmap::SkinIdMinor(void) const
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/brandingserver/eabi/bsclientu.def	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,25 @@
+EXPORTS
+	_ZN10CBSFactory13CreateAccessLERK6TDesC89TLanguageii @ 1 NONAME
+	_ZN10CBSFactory14CreateAccessLCERK6TDesC89TLanguageii @ 2 NONAME
+	_ZN10CBSFactory14CreateUpdaterLEv @ 3 NONAME
+	_ZN10CBSFactory15CreateUpdaterLCEv @ 4 NONAME
+	_ZN10CBSFactory4NewLERK6TDesC8S2_ @ 5 NONAME
+	_ZN16BSElementFactory16CreateBSElementLERK6TDesC814TBSElementTypeP9CBSBitmap @ 6 NONAME
+	_ZN16BSElementFactory16CreateBSElementLERK6TDesC814TBSElementTypeR20RBSObjOwningPtrArrayI10MBSElementE @ 7 NONAME
+	_ZN16BSElementFactory16CreateBSElementLERK6TDesC814TBSElementTypeRK7TDesC16 @ 8 NONAME
+	_ZN16BSElementFactory16CreateBSElementLERK6TDesC814TBSElementTypeS2_ @ 9 NONAME
+	_ZN16BSElementFactory16CreateBSElementLERK6TDesC814TBSElementTypei @ 10 NONAME
+	_ZN9CBSBitmap4NewLEiiiiRK6TDesC8 @ 11 NONAME
+	_ZN9CBSBitmap5NewLCEiiiiRK6TDesC8 @ 12 NONAME
+	_ZNK9CBSBitmap11SkinIdMajorEv @ 13 NONAME
+	_ZNK9CBSBitmap11SkinIdMinorEv @ 14 NONAME
+	_ZNK9CBSBitmap12BitmapFileIdEv @ 15 NONAME
+	_ZNK9CBSBitmap12BitmapMaskIdEv @ 16 NONAME
+	_ZNK9CBSBitmap8BitmapIdEv @ 17 NONAME
+	_ZTI10CBSFactory @ 18 NONAME ; #<TI>#
+	_ZTI19CBSIconFileProvider @ 19 NONAME ; #<TI>#
+	_ZTI9RBSClient @ 20 NONAME ; #<TI>#
+	_ZTV10CBSFactory @ 21 NONAME ; #<VT>#
+	_ZTV19CBSIconFileProvider @ 22 NONAME ; #<VT>#
+	_ZTV9RBSClient @ 23 NONAME ; #<VT>#
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/brandingserver/group/backup_registration.xml	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,11 @@
+<?xml version="1.0" standalone="yes"?>
+
+<!-- Backup registration file for Branding Server -->
+
+<backup_registration version="1.0">
+	<passive_backup delete_before_restore="no">
+		<include_directory name="\"/>		
+	</passive_backup>
+	<proxy_data_manager SID="0x10202BE9"/>
+	<restore requires_reboot="no"/>
+</backup_registration>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/brandingserver/group/bld.inf	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,49 @@
+/*
+* 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: branding server BLD.INF which builds, tools and also server and client.
+*
+*/
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_MMPFILES
+bsclient.mmp
+bsserver.mmp
+../tools/bsimport/group/importer.mmp
+../tools/bsimport/group/installer.mmp
+
+PRJ_EXPORTS
+// Headers exported to source tree
+../inc/cbsfactory.h          		MW_LAYER_PLATFORM_EXPORT_PATH(cbsfactory.h)
+../inc/mbsaccess.h          		MW_LAYER_PLATFORM_EXPORT_PATH(mbsaccess.h)
+../inc/mbsupdater.h          		MW_LAYER_PLATFORM_EXPORT_PATH(mbsupdater.h)
+../inc/mbselement.h          		MW_LAYER_PLATFORM_EXPORT_PATH(mbselement.h)
+../inc/cbsbitmap.h          		MW_LAYER_PLATFORM_EXPORT_PATH(cbsbitmap.h)
+../inc/bselementfactory.h          	MW_LAYER_PLATFORM_EXPORT_PATH(bselementfactory.h)
+../inc/tbselementiterator.h    		MW_LAYER_PLATFORM_EXPORT_PATH(tbselementiterator.h)
+../inc/rbsobjowningptrarray.h  		MW_LAYER_PLATFORM_EXPORT_PATH(rbsobjowningptrarray.h)
+../inc/rbsobjowningptrarray.inl		MW_LAYER_PLATFORM_EXPORT_PATH(rbsobjowningptrarray.inl)
+../inc/mbsbrandchangeobserver.h		MW_LAYER_PLATFORM_EXPORT_PATH(mbsbrandchangeobserver.h)
+../inc/mbsbackuprestorestateobserver.h	MW_LAYER_PLATFORM_EXPORT_PATH(mbsbackuprestorestateobserver.h)
+
+../group/backup_registration.xml 	z:/private/102828dd/backup_registration.xml
+
+// Exporting iby file
+
+../rom/brandingserver.iby           CORE_MW_LAYER_IBY_EXPORT_PATH(brandingserver.iby)
+
+// Exporting stubsis file
+../sis/bsstub.sis           /epoc32/data/z/system/install/bsstub.sis
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/brandingserver/group/bsclient.mmp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,55 @@
+/*
+* 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: Branding server client component project descripton file.
+*
+*/
+#include            "bsuids.h"
+#include <platform_paths.hrh>
+#include <data_caging_paths_strings.hrh>
+
+TARGET              bsclient.dll
+TARGETTYPE          dll
+UID                 KStaticInterfaceDllUid2 KBrandingClientUid3
+CAPABILITY          CAP_CLIENT_DLL
+VENDORID            VID_DEFAULT
+
+
+SOURCEPATH          ../bsclient
+SOURCE              cbsclient.cpp
+SOURCE              bsprocessstarter.cpp
+SOURCE		    cbsfactory.cpp
+SOURCE		    cbsaccess.cpp
+SOURCE		    cbsupdater.cpp
+SOURCE		    cbselement.cpp
+SOURCE		    bselementfactory.cpp
+SOURCE		    cbsbitmap.cpp
+SOURCE			cbsbrandobserver.cpp
+SOURCE			cbsiconfileprovider.cpp
+
+
+USERINCLUDE         ../group
+USERINCLUDE         ../bsserver
+USERINCLUDE         ../bsclient
+
+APP_LAYER_SYSTEMINCLUDE
+
+
+LIBRARY             euser.lib
+LIBRARY             efsrv.lib
+LIBRARY		    flogger.lib
+LIBRARY	  	    estor.lib
+LIBRARY aknskins.lib    
+LIBRARY aknicon.lib //avkon icons
+LIBRARY cone.lib
+LIBRARY charconv.lib 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/brandingserver/group/bsserver.mmp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,67 @@
+/*
+* 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: Branding server, server comopnent project description file.
+*
+*/
+#include        "bsuids.h"
+#include <platform_paths.hrh>
+#include <data_caging_paths_strings.hrh>
+
+TARGET          bsserver.exe
+TARGETTYPE      exe
+
+
+UID             0x0 KBrandingSrvUid3
+VENDORID        VID_DEFAULT
+CAPABILITY      CAP_SERVER
+TARGETPATH      /system/libs
+
+
+SOURCEPATH  ../bsserver
+SOURCE      cbsserver.cpp
+SOURCE      cbssession.cpp
+SOURCE	    cbsbrandhandler.cpp
+SOURCE	    cbsibywriter.cpp
+SOURCE	    cbsstoragemanager.cpp
+SOURCE	    cbsstorage.cpp
+SOURCE      cbsinstallhandler.cpp
+SOURCE      cbsbackupobserver.cpp
+
+SOURCEPATH	../bsclient
+SOURCE		cbselement.cpp
+SOURCE		cbsbitmap.cpp
+SOURCE		bselementfactory.cpp
+
+
+
+USERINCLUDE     ../group
+USERINCLUDE     ../bsserver
+USERINCLUDE     ../bsclient
+USERINCLUDE     ../inc
+
+APP_LAYER_SYSTEMINCLUDE
+
+
+
+LIBRARY         euser.lib
+LIBRARY         flogger.lib
+LIBRARY         efsrv.lib
+
+LIBRARY			bafl.lib
+LIBRARY			estor.lib
+LIBRARY         charconv.lib
+
+// for install handler
+LIBRARY         apgrfx.lib
+LIBRARY         apparc.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/brandingserver/group/bsuids.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,34 @@
+/*
+* 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: BRANDINGSERVER UIDs
+*
+*/
+#ifndef     __BRANDINGUIDS_H
+#define     __BRANDINGUIDS_H
+
+//Uid2:s
+#define KStaticInterfaceDllUid2         0x1000008d // CSI: 8 # 
+
+
+//Uid3:s
+#define KBrandingClientUid3            0x102828DE // CSI: 8 # 
+#define KBrandingSrvUid3               0x102828DD // CSI: 8 # 
+
+
+#endif // __BRANDINGUIDS_H
+
+
+//  END OF FILE
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/brandingserver/group/debugtrace.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,162 @@
+/*
+* 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: Debug Traces.
+*
+*/
+#ifndef __DEBUGTRACE_H__
+#define __DEBUGTRACE_H__
+
+//  INCLUDES
+#include  "e32std.h"
+
+//  DEFINES
+//Undefine: tracing disabled
+//Define 1: Traces goes to file log
+//Define 2: Traces goes to RDebug output
+//Define 3: Trace goes both file and RDebug output
+#undef TRACE_MODE
+//#define TRACE_MODE 3
+
+
+
+// -----------------------------------------------------------------------------
+// Trace definitions
+// -----------------------------------------------------------------------------
+#ifdef TRACE_MODE
+
+    //  INCLUDES
+    #include <flogger.h>
+    #include <e32svr.h>
+
+    // CONSTANTS
+    _LIT( KTraceLogDir, "BS" );
+    _LIT( KTraceLogFile, "BS.log" );
+
+     //TRACE INDIRECTION
+    #define T_LIT(s) _L(s) // CSI: 78 # See above
+    #define TRACE Trace::Emit
+    #define IF_TRACE_ON( aStatement ) aStatement
+#endif  // TRACE_MODE
+
+
+//-----------------------------------------------------------------------------
+// Empty trace definitions
+//-----------------------------------------------------------------------------
+#ifndef TRACE_MODE
+    struct TEmptyTraceString { };
+    #define T_LIT(s) TEmptyTraceString()
+    #define IF_TRACE_ON( aStatement )
+
+    inline void TRACE(TEmptyTraceString){}
+
+    template<class T1>
+    inline void TRACE(TEmptyTraceString,T1){}
+
+    template<class T1,class T2>
+    inline void TRACE(TEmptyTraceString,T1,T2){}
+
+    template<class T1,class T2,class T3>
+    inline void TRACE(TEmptyTraceString,T1,T2,T3){}
+
+    template<class T1,class T2,class T3,class T4>
+    inline void TRACE(TEmptyTraceString,T1,T2,T3,T4){}
+
+    template<class T1,class T2,class T3,class T4,class T5>
+    inline void TRACE(TEmptyTraceString,T1,T2,T3,T4,T5){}
+
+    template<class T1,class T2,class T3,class T4,class T5,class T6>
+    inline void TRACE(TEmptyTraceString,T1,T2,T3,T4,T5,T6){}
+
+    template<class T1,class T2,class T3,class T4,class T5,class T6,class T7>
+    inline void TRACE(TEmptyTraceString,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 TRACE(TEmptyTraceString,T1,T2,T3,T4,T5,T6,T7,T8){}
+
+#endif  // TRACE_MODE
+
+
+
+
+// -----------------------------------------------------------------------------
+// Trace implementation
+// -----------------------------------------------------------------------------
+#ifdef TRACE_MODE
+    #include <flogger.h>
+    #include <e32svr.h>
+
+    // TARGET WARNING
+    #if !defined(_DEBUG)
+
+    #if defined(__CW32__)
+    #pragma message("Trace logging on.") // CSI: 68 # See above
+    #else
+    //ARMCC warning
+    #endif
+    #endif
+
+    namespace Trace
+        {
+        class TOverflowHandler : public TDes16Overflow
+            {
+            inline void Overflow( TDes16& /*aDes*/ ) {}
+            };
+
+        inline void Emit( TRefByValue<const TDesC> aFmt, ... )
+            {
+            //Format the log line
+            TBuf< 250 > buffer;
+            buffer.Append( _L("[") ); // CSI: 78 # See above
+            buffer.Append( RThread().Name() );
+            buffer.Append( _L("] ") ); // CSI: 78 # See above
+
+            TOverflowHandler overflowHandler;
+
+            VA_LIST list;
+            VA_START( list, aFmt );
+            buffer.AppendFormatList( aFmt, list, &overflowHandler );
+
+            TInt theTraceMode = TRACE_MODE;
+
+            //Send trace to file
+            if( ( theTraceMode == 1 ) ||
+                ( theTraceMode == 3 ) )
+                {
+                RFileLogger logger;
+                if( logger.Connect() == KErrNone )
+                    {
+                    logger.SetDateAndTime( EFalse, ETrue );
+                    logger.CreateLog( KTraceLogDir,
+                                      KTraceLogFile,
+                                      EFileLoggingModeAppend );
+
+                    logger.Write( buffer );
+                    logger.CloseLog();
+                    logger.Close();
+                    }
+                }
+
+            //Send trace to default debug output
+            if( ( theTraceMode == 2 ) ||
+                ( theTraceMode == 3 ) )
+                {
+                RDebug::Print( _L("%S"), &buffer );
+                }
+            }
+        }
+#endif //TRACE_MODE
+
+#endif //__DEBUGTRACE_H__
+
+//  END OF FILE
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/brandingserver/inc/bselementfactory.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,91 @@
+/*
+* 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: bselementfactory.h 
+*
+*/
+
+
+#ifndef __BSELEMENTFACTORY_H
+#define __BSELEMENTFACTORY_H
+
+#include <e32std.h>
+#include <mbselement.h>
+
+
+class CBSElement;
+
+
+/**
+ * Factory for creating branding elements
+ *
+ * @since
+ */
+class BSElementFactory
+    {
+    public:
+
+    	/*
+    	* Create integer type element.
+    	* @param aElementId id of the element
+    	* @param aElementType type of the element
+    	* @param aElementData the element data
+    	*/
+		IMPORT_C static MBSElement* CreateBSElementL( const TDesC8& aElementId,
+											 TBSElementType aElementType,
+											 TInt aElementData );
+
+    	/*
+    	* Create text or file type element.
+    	* @param aElementId id of the element
+    	* @param aElementType type of the element
+    	* @param aElementData the element data, if the element is file type
+    	*		 then this should contain the file name
+    	*/
+		IMPORT_C static MBSElement* CreateBSElementL( const TDesC8& aElementId,
+											 TBSElementType aElementType,
+											 const TDesC& aElementData );
+
+    	/*
+    	* Create buffer type element.
+    	* @param aElementId id of the element
+    	* @param aElementType type of the element
+    	* @param aElementData the element data
+    	*/
+		IMPORT_C static MBSElement* CreateBSElementL( const TDesC8& aElementId,
+											 TBSElementType aElementType,
+											 const TDesC8& aElementData );
+
+    	/*
+    	* Create bitmap type element.
+    	* @param aElementId id of the element
+    	* @param aElementType type of the element
+    	* @param aElementData the element data
+    	*/
+		IMPORT_C static MBSElement* CreateBSElementL( const TDesC8& aElementId,
+											 TBSElementType aElementType,
+											 CBSBitmap* aElementData );
+
+    	/*
+    	* Create an element containing a list of other elements.
+    	* @param aElementId id of the element
+    	* @param aElementType type of the element
+    	* @param aElementData the element data
+    	*/
+		IMPORT_C static MBSElement* CreateBSElementL( const TDesC8& aElementId,
+											 TBSElementType aElementType,
+											 RBSObjOwningPtrArray<MBSElement>& aElementData );
+
+    };
+
+#endif //__BSELEMENTFACTORY_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/brandingserver/inc/cbsbitmap.h	Wed Nov 03 09:32:20 2010 +0530
@@ -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: cbsbitmap.h
+*
+*/
+
+
+
+#ifndef __CBSBITMAP_H__
+#define __CBSBITMAP_H__
+
+#include <e32std.h>
+
+/**
+ *
+ */
+NONSHARABLE_CLASS( CBSBitmap ): public CBase
+    {
+	public:
+		/**
+		* Two-phased constructor.
+		* @param aBitmapId the bitmap id
+		* @param aBitmapMaskId the bitmap mask id
+		* @param aSkinId the skin id
+		* @param aSkinMaskId the skin mask id
+		* @param aBitmapFileId the bitmap file id
+		*/
+		IMPORT_C static CBSBitmap* NewL( TInt aBitmapId,
+								TInt aBitmapMaskId,
+								TInt aSkinIdMajor,
+								TInt aSkinIdMinor,
+								const TDesC8& aBitmapFileId );
+
+		/**
+		* Two-phased constructor.
+		* @see NewL
+		*/
+		IMPORT_C static CBSBitmap* NewLC( TInt aBitmapId,
+								 TInt aBitmapMaskId,
+								 TInt aSkinIdMajor,
+								 TInt aSkinIdMinor,
+								 const TDesC8& aBitmapFileId );
+
+		// destructor
+    	IMPORT_C virtual ~CBSBitmap();
+
+	private:
+		/**
+		* @see NewL
+		*/
+		CBSBitmap( TInt aBitmapId,
+				   TInt aBitmapMaskId,
+				   TInt aSkinIdMajor,
+				   TInt aSkinIdMinor );
+
+		/**
+		* @see NewL
+		*/
+    	void ConstructL( const TDesC8& aBitmapFileId );
+
+	public:
+		/**
+		* Getter for bitmap id
+		* @return the bitmap id
+		*/
+		IMPORT_C TInt BitmapId() const;
+
+		/**
+		* Getter for bitmap mask id
+		* @return the bitmap mask id
+		*/
+		IMPORT_C TInt BitmapMaskId() const;
+
+		/**
+		* Getter for skin id
+		* @return the skin id
+		*/
+		IMPORT_C TInt SkinIdMajor() const;
+
+		/**
+		* Getter for skin mask id
+		* @return the skin mask id
+		*/
+		IMPORT_C TInt SkinIdMinor() const;
+
+		/**
+		* Getter for bitmap file id
+		* @return bitmap file id
+		*/
+		IMPORT_C const TDesC8& BitmapFileId() const;
+
+
+	private: // data
+		TInt	iBitmapId;
+	    TInt	iBitmapMaskId;
+	    TInt	iSkinIdMajor;
+	    TInt	iSkinIdMinor;
+	    HBufC8*	iBitmapFileId;
+    };
+
+#endif      //  __CBSBITMAP_H__
+
+
+//  END OF FILE
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/brandingserver/inc/cbsfactory.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,111 @@
+/*
+* 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: cbsfactory.h
+*
+*/
+
+#ifndef __CBSFACTORY_H
+#define __CBSFACTORY_H
+
+//  INCLUDES
+#include <e32base.h>
+
+// FORWARD DECLARATIONS
+class MBSAccess;
+class MBSUpdater;
+class RBSClient;
+
+
+// CLASS DECLARATION
+
+class CBSFactory : public CBase
+    {
+
+	public:
+
+		/**
+		* Two-phased constructor.
+		* @param aDefaultBrandId the default brand id for branding interfaces
+		* 		 that are created through this factory. If this parameter
+		*        is given the branding items will be taken from the given
+		*		 default brand if they are not found from the wanted brand.
+		*        brand.
+		* @param aApplicationId application id
+		*/
+		IMPORT_C static CBSFactory* NewL( const TDesC8& aDefaultBrandId,
+										  const TDesC8& aApplicationId );
+
+		// destructor
+    	IMPORT_C virtual ~CBSFactory();
+
+	private:
+
+		// constructor
+		CBSFactory();
+
+    	void ConstructL( const TDesC8& aDefaultBrandId, const TDesC8& aApplicationId );
+
+
+    public:
+
+		/**
+		* Creates a brand access interface
+		* @param aBrandId the brand to be used with this interface instance
+		* @param aLanguageId the language id to be used with this interface instance
+		* @param aCacheData should the interface cache the branding data
+		* @param aReserved for further use		
+		* @return the access interface
+		*/
+		IMPORT_C MBSAccess* CreateAccessL( const TDesC8& aBrandId,
+											 TLanguage aLanguageId,
+        					  		   		 TBool aCacheData = EFalse,
+        					  		   		 TInt aReserved = 0 );
+
+		/**
+		* Creates a brand access interface
+		* @param aBrandId the brand to be used with this interface instance
+		* @param aLanguageId the language id to be used with this interface instance
+		* @param aCacheData should the interface cache the branding data
+		* @param aReserved for further use				
+		* @return the access interface
+		*/
+		IMPORT_C MBSAccess* CreateAccessLC( const TDesC8& aBrandId,
+											 TLanguage aLanguageId,
+        					  		   		 TBool aCacheData = EFalse,
+        					  		   		 TInt aReserved = 0 );
+
+		/**
+		* Creates a brand update interface
+		* @return the interface
+		*/
+		IMPORT_C MBSUpdater* CreateUpdaterL();
+
+		/**
+		* Creates a brand update interface
+		* @return the interface
+		*/
+		IMPORT_C MBSUpdater* CreateUpdaterLC();
+
+
+	private: // data
+		HBufC8* 	iDefaultBrand;
+		bool		iUseDefaultBrand;
+		HBufC8*  iApplicationId;
+		RBSClient* iServerKeepAlive;
+
+    };
+
+#endif      // __CBSFACTORY_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/brandingserver/inc/mbsaccess.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,143 @@
+/*
+* 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: MBSAccess
+*
+*/
+
+
+
+#ifndef __MBSACCESS_H
+#define __MBSACCESS_H
+
+#include <e32std.h>
+#include <mbselement.h>
+#include <bamdesca.h>
+#include <f32file.h>
+
+
+// forward declarations
+class MBSBrandChangeObserver;
+class MBSBackupRestoreStateObserver;
+class CFbsBitmap;
+
+/**
+ * An interface for getting branding information
+ *
+ * @since
+ */
+class MBSAccess
+    {
+    public:
+
+    	/*
+    	* Get text type item
+    	* @param aId ID of the item
+    	* @return the text item
+    	*/
+        virtual HBufC* GetTextL( const TDesC8& aId ) = 0;
+
+    	/*
+    	* Get text type item
+    	* @param aId ID of the item
+    	* @return the text item
+    	*/
+        virtual HBufC* GetTextLC( const TDesC8& aId ) = 0;
+
+    	/*
+    	* Get 8-bit data type item
+    	* @param aId ID of the item
+    	* @return the data buffer item
+    	*/
+        virtual HBufC8* GetBufferL( const TDesC8& aId ) = 0;
+
+    	/*
+    	* Get 8-bit data type item
+    	* @param aId ID of the item
+    	* @return the data buffer item
+    	*/
+        virtual HBufC8* GetBufferLC( const TDesC8& aId ) = 0;
+
+    	/*
+    	* Get integer type item
+    	* @param aId ID of the item
+    	* @return the integer item
+    	*/
+        virtual TInt GetIntL( const TDesC8& aId ) = 0;
+
+
+    	/*
+    	* Get an array of items
+    	* @param aIds ID's of the items
+    	* @return the items
+    	*/
+        virtual MBSElement* GetSeveralL( MDesC8Array& aIds ) = 0;
+
+
+    	/*
+    	* Get a file item
+    	* @param aId ID of the item
+    	* @param aFile on return will contain an open file handle
+    	*        to the file
+    	*/
+        virtual void GetFileL( const TDesC8& aId,
+        					   RFile& aFile ) = 0;
+
+    	/*
+    	* Get a structure type item
+    	* @param aIds ID of the item
+    	* @return structure branding element
+    	*/
+        virtual MBSElement* GetStructureL( const TDesC8& aId ) = 0;
+
+    	/*
+    	* Register to observer brand data updates
+    	* @param aObserver the observer interface
+    	*/
+        virtual void RegisterObserverL( MBSBrandChangeObserver* aObserver, MBSBackupRestoreStateObserver* aBackupObserver ) = 0;
+
+    	/*
+    	* Unregister a brand data update observer
+    	* @param aObserver the observer interface
+    	*/
+        virtual void UnRegisterObserverL( MBSBrandChangeObserver* aObserver, MBSBackupRestoreStateObserver *aBackupObserver ) = 0;
+
+    	/*
+    	* Get a bitmap type item.
+    	* Note that this method supports skins, but as skin support
+    	* requires CONE, it will only try to load skin bitmaps if
+    	* CONE is available. Else it will only load normal bitmaps.
+    	* @param aBitmapId the ID of the bitmap item itself
+    	* @param aBitmap on return will contain the bitmap
+    	* @param aMask on return will contain the mask
+    	*/
+		virtual void GetBitmapL( const TDesC8& aBitmapId,
+								 CFbsBitmap*& aBitmap,
+								 CFbsBitmap*& aMask ) = 0;
+
+
+	virtual TInt isBrandUpdateRequiredL () = 0;
+        /*
+        * Closes the handle to server and deletes the object.
+        */
+		virtual void Close() = 0;
+
+	protected:
+
+    	/*
+    	* Destructor
+    	*/
+    	virtual ~MBSAccess() {};
+    };
+
+#endif //__MBSACCESS_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/brandingserver/inc/mbsbackupobserver.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,51 @@
+/*
+* Copyright (c) 2006-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:  Backup and Restore observer interface
+*
+*/
+
+
+#ifndef __MBSBACKUPOBSERVER_H
+#define __MBSBACKUPOBSERVER_H
+
+#include <e32base.h>
+
+/**
+ * Observer interface for backup and restore events
+ * @since S60 v3.2
+ */
+NONSHARABLE_CLASS( MBSBackupObserver )
+    {
+    public:
+    
+        // Backup and restore states
+        enum TBackupState
+        	{
+        	EBackupNotActive,
+        	EBackupActive
+        	};
+
+    	/*
+    	* Hanlder method to receive observer events
+    	* @param aEvent new state of backup and restore
+    	*/
+		virtual void HandleBackupStateL( TBackupState aState ) = 0;
+		
+		/*
+		* Destructor
+		*/
+	    virtual ~MBSBackupObserver() {};
+    };
+
+#endif //__MBSBACKUPOBSERVER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/brandingserver/inc/mbsbackuprestorestateobserver.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,50 @@
+/*
+* 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: MBS Backup restore observer definition.
+*
+*/
+
+
+
+#ifndef __MBSBACKUPRESTORESTATEOBSERVER_H
+#define __MBSBACKUPRESTORESTATEOBSERVER_H
+
+#include <e32std.h>
+
+
+/**
+ * An interface through which client gets information
+ * about available brand data updates.
+ *
+ * @since
+ */
+class MBSBackupRestoreStateObserver
+    {
+    public:
+
+    	/*
+    	* Gets called when backup restore operation begins or ends
+    	* Client can then decide wether to store accessing date or not
+    	* @return ETrue if observer should continue observing
+    	*/
+		virtual TBool BackupRestoreActivated(TInt activeState) = 0 ;
+
+protected:
+    	/*
+    	* Destructor
+    	*/
+    	virtual ~MBSBackupRestoreStateObserver() {};
+    };
+
+#endif //__MBSBACKUPRESTORESTATEOBSERVER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/brandingserver/inc/mbsbrandchangeobserver.h	Wed Nov 03 09:32:20 2010 +0530
@@ -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: MBSBrandChangeObserver 
+*
+*/
+
+
+
+#ifndef __MBSBRANDCHANGEOBSERVER_H
+#define __MBSBRANDCHANGEOBSERVER_H
+
+#include <e32std.h>
+
+
+/**
+ * An interface through which client gets information
+ * about available brand data updates.
+ *
+ * @since
+ */
+class MBSBrandChangeObserver
+    {
+    public:
+
+    	/*
+    	* Gets called when brand data update is available.
+    	* Client can then decide wether to use the old one
+    	* or the updated one.
+    	* @return ETrue if observer should continue observing
+    	*/
+        virtual TBool BrandUpdateAvailable( TInt aNewVersion ) = 0;
+
+
+protected:
+    	/*
+    	* Destructor
+    	*/
+    	virtual ~MBSBrandChangeObserver() {};
+    };
+
+#endif //__MBSBRANDCHANGEOBSERVER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/brandingserver/inc/mbselement.h	Wed Nov 03 09:32:20 2010 +0530
@@ -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: MBSElement.h
+*
+*/
+
+
+#ifndef __MBSELEMENT_H
+#define __MBSELEMENT_H
+
+#include <e32std.h>
+#include <rbsobjowningptrarray.h>
+
+enum TBSElementType
+	{
+	EBSInt,
+	EBSText,
+	EBSList,
+	EBSBuffer,
+	EBSBitmap,
+	EBSFile
+	};
+
+/**
+ * Class encapsulating the structure type branding items
+ *
+ * @since
+ */
+
+class RWriteStream;
+class CBSBitmap;
+
+NONSHARABLE_CLASS( MBSElement )
+    {
+
+    public:
+
+    	/*
+    	* Element type
+    	* @return the element type
+    	*/
+		virtual TBSElementType ElementType() = 0;
+
+    	/*
+    	* Element id
+    	* @return the element id
+    	*/
+		virtual const TDesC8& ElementId() = 0;
+
+    	/*
+    	* Integer data
+    	* Panics if trying to get wrong type data.
+    	* @return the integer data of the item
+    	*/
+		virtual TInt IntDataL() = 0;
+
+    	/*
+    	* Text data
+    	* Panics if trying to get wrong type data.
+    	* @return the text data of the item
+    	*/
+		virtual const TDesC& TextDataL() = 0;
+
+    	/*
+    	* 8-bit buffer data
+    	* Panics if trying to get wrong type data.
+    	* @return the text data of the item
+    	*/
+		virtual const TDesC8& BufferDataL() = 0;
+
+    	/*
+    	* Bitmap data
+    	* Panics if trying to get wrong type data.
+    	* @return the text data of the item
+    	*/
+        virtual const CBSBitmap& BitmapDataL() = 0;
+
+    	/*
+    	* Structure data
+    	* Panics if trying to get wrong type data.
+    	* @return the list data
+    	*/
+    	virtual TArray<MBSElement*> GetStructureL() = 0;
+
+		/*
+		* Finds the first entry from the list of a list type element with
+		* the given element id. Note that if there are several subelements
+		* with the same elementId then TBrandingElementIterator should be
+		* used to iterate through them.
+		* @param aElementId elementId of the subelement to be found.
+		* @return the subelement
+		*/
+		virtual const MBSElement& FindSubEntryL( const TDesC& aElementId ) = 0;
+
+        /*
+        * Writes the internal state to stream.
+        * @param aWriteStream output stream;
+        */
+        virtual void ExternalizeL( RWriteStream& aWriteStream ) = 0;
+
+        /*
+        * Deletes the element.
+        */
+		virtual void Close() = 0;
+
+		/*
+		* Destructor
+		*/
+	    virtual ~MBSElement() {};
+
+    };
+
+
+
+
+#endif //__MBSELEMENT_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/brandingserver/inc/mbsupdater.h	Wed Nov 03 09:32:20 2010 +0530
@@ -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: MBSUpdater
+ *
+*/
+
+
+
+ #ifndef __MBSUPDATER_H
+ #define __MBSUPDATER_H
+
+ #include <e32std.h>
+ #include <mbselement.h>
+
+class MBSBackupRestoreStateObserver ;
+
+const TInt KBSAutomaticVersionUpdate = -1;
+
+ /**
+  * An interface for updating branding information
+  *
+  * @since
+  */
+ class MBSUpdater
+     {
+     public:
+
+		enum TUpdateTransactionType
+			{
+			EUpdateInstall = 1,
+			EUpdateAppend,
+			EUpdateReplace,
+			EUpdateUninstall
+			};
+
+		//*** TRANSACTION HANDLING ***//
+
+     	/*
+     	* Start transaction for installing a brand.
+     	* @param aApplicationId id of the application
+     	* @param aBrandId id of the brand
+     	* @param aLanguageId languageid of the brand
+     	* @param aReserved for further use
+     	*/
+        virtual void StartTransactionL( const TDesC8& aBrandId,
+         								TLanguage aLanguageId,
+         								TUpdateTransactionType aType = EUpdateInstall,
+         								TInt aReserved = 0 ) = 0;
+
+     	/*
+     	* Stop brand installation transaction.
+     	* Calling this will indicate that the brand has
+     	* been updated completely and it will be taken
+     	* into use.
+     	* @return new version of the installed/updated brand
+     	*/
+		virtual TInt StopTransactionL() = 0;
+
+     	/*
+     	* Cancels brand installation transaction.
+     	* All the elements updated in this transaction
+     	* will be discarded.
+     	*/
+		virtual void CancelTransactionL() = 0;
+
+
+		//*** BRAND REMOVING ***//
+		
+     	/*
+     	* Removes all brand data from the specified brand.
+     	*/
+		virtual void RemoveBrandL( const TDesC8& aApplicationId,
+								   const TDesC8& aBrandId ) = 0;
+
+     	/*
+     	* Removes all brand data from the specified application.
+     	*/
+		virtual void RemoveBrandsL( const TDesC8& aApplicationId ) = 0;
+
+
+		//*** BRAND INSTALLING ***//
+
+
+    	/*
+    	* Insert text type item into the new brand
+    	* @param aId ID of the item
+    	* @param aText the text item
+    	*/
+        virtual void InsertTextL( const TDesC8& aId, const TDesC& aText ) = 0;
+
+    	/*
+    	* Insert 8-bit data type item into the new brand
+    	* @param aId ID of the item
+    	* @param aBuffer the data item
+    	*/
+        virtual void InsertBufferL( const TDesC8& aId, const TDesC8& aBuffer ) = 0;
+
+    	/*
+    	* Insert integer type item into the new brand
+    	* @param aId ID of the item
+    	* @param aInt the integer item
+    	*/
+        virtual void InsertIntL( const TDesC8& aId, TInt aInt ) = 0;
+
+    	/*
+    	* Insert a file type item into the new brand.
+    	* Note that the this is only the id and file name pair,
+    	* the file itself has to be imported separately.
+    	* @param aId ID of the item
+    	* @param aFile the integer item
+    	*/
+        virtual void InsertFileL( const TDesC8& aId,
+        					   	  const TDesC& aFileName ) = 0;
+
+     	/*
+     	* Inserts an element into the brand that is being installed.
+     	* @param aElement the element
+     	*/
+        virtual void InsertElementL( MBSElement* aElement ) = 0;
+
+
+
+
+
+		//*** BRAND UPDATING - replacing ***//
+
+
+    	/*
+    	* Insert text type item into the new brand
+    	* @param aId ID of the item
+    	* @param aText the text item
+    	*/
+        virtual void ReplaceTextL( const TDesC8& aId, const TDesC& aText ) = 0;
+
+    	/*
+    	* Insert 8-bit data type item into the new brand
+    	* @param aId ID of the item
+    	* @param aBuffer the data item
+    	*/
+        virtual void ReplaceBufferL( const TDesC8& aId, const TDesC8& aBuffer ) = 0;
+
+    	/*
+    	* Insert integer type item into the new brand
+    	* @param aId ID of the item
+    	* @param aInt the integer item
+    	*/
+        virtual void ReplaceIntL( const TDesC8& aId, TInt aInt ) = 0;
+
+    	/*
+    	* Insert a file type item into the new brand.
+    	* Note that the this is only the id and file name pair,
+    	* the file itself has to be imported separately.
+    	* @param aId ID of the item
+    	* @param aFile the integer item
+    	*/
+        virtual void ReplaceFileL( const TDesC8& aId,
+        					   	  const TDesC& aFileName ) = 0;
+
+     	/*
+     	* Inserts an element into the brand that is being installed.
+     	* @param aElement the element
+     	*/
+        virtual void ReplaceElementL( MBSElement* aElement ) = 0;
+
+
+
+		//*** BRAND UPDATING - appending ***//
+
+
+    	/*
+    	* Insert text type item into the new brand
+    	* @param aId ID of the item
+    	* @param aText the text item
+    	*/
+        virtual void AppendTextL( const TDesC8& aId, const TDesC& aText ) = 0;
+
+    	/*
+    	* Insert 8-bit data type item into the new brand
+    	* @param aId ID of the item
+    	* @param aBuffer the data item
+    	*/
+        virtual void AppendBufferL( const TDesC8& aId, const TDesC8& aBuffer ) = 0;
+
+    	/*
+    	* Insert integer type item into the new brand
+    	* @param aId ID of the item
+    	* @param aInt the integer item
+    	*/
+        virtual void AppendIntL( const TDesC8& aId, TInt aInt ) = 0;
+
+    	/*
+    	* Insert a file type item into the new brand.
+    	* Note that the this is only the id and file name pair,
+    	* the file itself has to be imported separately.
+    	* @param aId ID of the item
+    	* @param aFile the integer item
+    	*/
+        virtual void AppendFileL( const TDesC8& aId,
+        					   	  const TDesC& aFileName ) = 0;
+
+     	/*
+     	* Inserts an element into the brand that is being installed.
+     	* @param aElement the element
+     	*/
+        virtual void AppendElementL( MBSElement* aElement ) = 0;
+
+
+        /*
+        * Closes the handle to server and deletes the object.
+        */
+		virtual void Close() = 0;
+		
+    	/*
+    	* Register to observer backup restore state change
+    	* @param aObserver the observer interface
+    	*/
+        virtual void RegisterObserverL( MBSBackupRestoreStateObserver* aBackupObserver ) = 0;
+		
+    	/*
+    	* Unregister a backup restore state change observer
+    	* @param aObserver the observer interface
+    	*/
+        virtual void UnRegisterObserverL( MBSBackupRestoreStateObserver* aObserver ) = 0;
+		
+
+	protected:
+     	/*
+     	* Destructor
+     	*/
+     	virtual ~MBSUpdater() {};
+     };
+
+ #endif //__MBSUPDATER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/brandingserver/inc/rbsobjowningptrarray.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,64 @@
+/*
+* 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: RBSOBJOWNINGPTRaRRAY.H
+*
+*/
+
+#ifndef _RBSOBJOWNINGPTRARRAY_H
+#define _RBSOBJOWNINGPTRARRAY_H
+
+#include <e32std.h>
+
+
+
+/**
+ * Templated array of pointers. Array owns the pointed objects
+ * and overwrites the normal RPointerArray::Close()
+ * behaviour to destroy objects, before reseting the
+ * array contents.
+ *
+ * Array is used with Presence Framework interface objects.
+ *
+ * @since S60 v3.2
+ */
+template< class T >
+class RBSObjOwningPtrArray : public RPointerArray<T>
+    {
+ public:
+
+    /**
+     * Default C++ constructor.
+     */
+    inline RBSObjOwningPtrArray();
+
+
+    /**
+     * Overwritten Close().
+     *
+     * Calls ResetAndDestroy() to delete holded objects
+     * before reseting array contents. Thus array can be
+     * pushed on the cleanup stack with CleanupClosePushL().
+     */
+    inline void Close();
+    };
+
+
+
+
+#include "rbsobjowningptrarray.inl"
+
+#endif // _RBSOBJOWNINGPTRARRAY_H
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/brandingserver/inc/rbsobjowningptrarray.inl	Wed Nov 03 09:32:20 2010 +0530
@@ -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: rbsobjowningptrarray.inl
+*
+*/
+
+
+#include <e32base.h>
+
+// -----------------------------------------------------------------------------
+// RBSObjOwningPtrArray<T>::RBSObjOwningPtrArray() implementation.
+//
+// -----------------------------------------------------------------------------
+//
+template <class T>
+inline RBSObjOwningPtrArray<T>::RBSObjOwningPtrArray()
+    {
+    }
+
+
+// -----------------------------------------------------------------------------
+// RBSObjOwningPtrArray<T>::Close() implementation.
+// Calls ResetAndDestroy() to destroy holded objects.
+// -----------------------------------------------------------------------------
+//
+template <class T>
+inline void RBSObjOwningPtrArray<T>::Close()
+    {
+    RPointerArray<T>::ResetAndDestroy();
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/brandingserver/inc/tbselementiterator.h	Wed Nov 03 09:32:20 2010 +0530
@@ -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: tbselementiterator.h
+*
+*/
+
+
+
+#ifndef TBSELEMENTITERATOR_H
+#define TBSELEMENTITERATOR_H
+
+#include <mbselement.h>
+
+// CLASS DECLARATION
+
+/**
+*
+*
+*  @lib
+*  @since
+*/
+
+class MBSElement;
+
+
+class TBSElementIterator
+    {
+    public: // New functions
+
+		IMPORT_C MBSElement& Next();
+
+        /**
+        * C++ default constructor.
+        */
+        IMPORT_C TBSElementIterator( const TDesC& aElementId );
+
+    private:
+    	TInt iIndex;
+    	const TDesC& iElementId;
+    	};
+
+#endif      // TBSELEMENTITERATOR_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/brandingserver/inc/tbsmdescarrayadapter.h	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  One value adapter for MDesCArray.
+*
+*/
+
+#ifndef TBSMDESCARRAYADAPTER_H__
+#define TBSMDESCARRAYADAPTER_H__
+
+//  INCLUDES
+#include <E32Std.h>
+#include <BaDesCa.h>
+
+
+// CLASS DECLARATION
+/**
+ * One value adapter for MDesCArray.
+ *
+ * @since 3.0
+ */
+class TBSMDesCArrayAdapter : public MDesCArray
+    {
+    public: //Constructor & destructor
+
+        /**
+         * C++ constructor.
+         * Takes the descriptor to adapt.
+         */
+        IMPORT_C TBSMDesCArrayAdapter( const TDesC& aDesc );
+
+
+    public: //From MDesCArray
+
+        IMPORT_C TInt MdcaCount() const;
+        IMPORT_C TPtrC MdcaPoint( TInt aIndex ) const;
+
+
+    private: //Data
+
+        //OWN: Adapted descriptor
+        TPtrC   iDesc;
+    };
+
+
+#endif      //TBSMDESCARRAYADAPTER_H__
+
+//  End of File
+
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/brandingserver/rom/brandingserver.iby	Wed Nov 03 09:32:20 2010 +0530
@@ -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: Branding Server IBY
+*
+*/
+#ifndef __BS_IBY__
+#define __BS_IBY__
+
+#include <data_caging_paths_for_iby.hrh>
+
+
+// branding client
+file=ABI_DIR\BUILD_DIR\bsclient.dll          SHARED_LIB_DIR\bsclient.dll
+// branding server
+file=ABI_DIR\BUILD_DIR\bsserver.exe          PROGRAMS_DIR\bsserver.exe
+
+// Add bsinstall.exe to rom to get xml importing working.
+file=ABI_DIR\BUILD_DIR\bsinstall.exe          PROGRAMS_DIR\bsinstall.exe
+
+// backup registration file
+data=ZPRIVATE\102828dd\backup_registration.xml	private\102828dd\backup_registration.xml
+
+// stubsis file
+data=DATAZ_/system/install/bsstub.sis    system/install/bsstub.sis
+
+#endif // __BS_IBY__
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/brandingserver/sis/bs.pkg	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,34 @@
+;
+; 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: 
+;
+;Language
+&EN
+
+;Header
+#{"BS"}, (0x102828DE), 1, 5, 0, TYPE=SA, RU
+
+;Localised VendorID
+%{"Nokia"}
+
+;VendorID
+:"Nokia"
+
+;Supports Series 60 v 5.2; Needs to be updated when platform is changed
+(0x20022E6D ), 0, 0, 0, {"Series60ProductID"}
+
+;binaries
+"\EPOC32\RELEASE\ARMV5\UREL\bsserver.exe"-"!:\sys\bin\bsserver.exe"
+"\EPOC32\RELEASE\ARMV5\UREL\bsclient.dll"-"!:\sys\bin\bsclient.dll"
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/brandingserver/sis/bsstub.pkg	Wed Nov 03 09:32:20 2010 +0530
@@ -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: 
+;
+;
+; Package file for presencefw SIS stub in ROM
+; and a ximp framework upgrade SIS.
+; Including the stub in ROM enables components
+; defined in stub to be updated by SIS installer.
+; When adding or removing components from presencefw
+; please update this pkg file and create an updated
+; stub to group directory.
+;
+; To create SIS stub: makesis -s ximpfw_upgrade.pkg ximpfwstub.sis
+; Copy ximpfwstub.sis to z:\system\install\ximpfwstub.sis
+; or use abld export to export it automatically.
+;
+
+;Language
+&EN
+
+;Header
+#{"BS"}, (0x102828DE), 1, 0, 0, TYPE=SA, RU
+
+
+;Localised VendorID
+%{"Nokia"}
+
+;VendorID
+:"Nokia"
+
+;binaries
+""-"z:\sys\bin\bsserver.exe"
+""-"z:\sys\bin\bsclient.dll"
+
+
Binary file brandingserver/sis/bsstub.sis has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/brandingserver/sis/metadata.xml	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,56 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ad:metadata xmlns="http://nokia.com/arrow/repository/ia_component" xmlns:ad="http://nokia.com/arrow/application_metadata">
+    <iaSearchCriteria>ABC:ABC</iaSearchCriteria>
+    <!--
+    The appResources element contains all the language metadata of one IAC.
+    IAC may have one or more language-specific component names
+    and descriptions inside appResource element.
+
+    Language ID 1 should be always defined as this is the default language
+    in case other languages supported by the client cannot be found.
+    -->
+    <appResources>
+        <appResource>
+            <!-- Language ID -->
+            <language>1</language>
+            <!-- Name in given language -->
+            <iacName>BrandingServer</iacName>
+            <!-- Description in given language -->
+            <iacDescription>Update for BrandingServer</iacDescription>
+        </appResource>
+    </appResources>
+    <!-- Specifies for what versions of what platform this component is for. -->
+    <swPlatformDep>
+    <!-- platform code -->
+        <platform>S60</platform>
+        <versionFrom>
+            <!--
+            platform version number separated in major and minor number (i.e.
+            3.0 has 3 as major and 0 as minor)
+            -->
+            <major>5</major>
+            <minor>0</minor>
+            <!--
+            date-element can be used to pinpoint platform version number to even
+            more specific one. It is not currently used in the system.
+            -->
+            <date>
+                <year>2007</year>
+                <week>1</week>
+            </date>
+        </versionFrom>
+        <!-- the latest platform version this component is for -->
+        <versionTo>
+            <major>5</major>
+            <minor>2</minor>
+            <date>
+                <year>2009</year>
+                <week>52</week>
+            </date>
+        </versionTo>
+    </swPlatformDep>
+    <!-- specifies dependencies to other IACs -->
+    <interDeps>
+    </interDeps>
+<firmwareDependencies xmlns="http://nokia.com/arrow/repository/ia_component" xmlns:ad="http://nokia.com/arrow/application_metadata"/>
+</ad:metadata>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/brandingserver/tools/bsimport/group/bld.inf	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,22 @@
+/*
+* 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: bld.inf file project inclusions.
+*
+*/
+// BLD.INF
+
+PRJ_MMPFILES
+
+importer.mmp
+installer.mmp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/brandingserver/tools/bsimport/group/brandimporter_UID_.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,21 @@
+/*
+* 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: UID file
+*
+*/
+// Makmake-generated uid source file
+#include <e32cmn.h>
+#pragma data_seg(".SYMBIAN")
+__EMULATOR_IMAGE_HEADER2(0x1000007a,0x00000000,0x00000000,EPriorityForeground,0x000bf030u,0x00000000u,0x00000000,0x101fb657,0x00010000,0)
+#pragma data_seg()
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/brandingserver/tools/bsimport/group/importer.mmp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,51 @@
+/*
+* Copyright (c) 2006-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 project bsimport
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+TARGET          bsimport.exe
+TARGETTYPE      exe
+UID             0x1000008d 0x102828DF
+
+CAPABILITY      CAP_APPLICATION
+VENDORID        VID_DEFAULT
+
+SOURCEPATH      ../src
+SOURCE          importer.cpp
+SOURCE          cbsimportstorage.cpp
+SOURCE          cbsimportmanager.cpp
+SOURCE          cbsimportxmlparser.cpp
+SOURCE          cbsimportfilereader.cpp
+SOURCE          cbsimportstoragemanager.cpp
+
+// INCLUDE DIRS
+USERINCLUDE     ../inc
+
+APP_LAYER_SYSTEMINCLUDE
+
+// LIBRARIES
+LIBRARY         euser.lib
+LIBRARY         xmlparser.lib
+LIBRARY         efsrv.lib
+LIBRARY         xmldom.lib
+LIBRARY         charconv.lib
+LIBRARY         avkon.lib
+LIBRARY         estor.lib       // RWriteStream
+LIBRARY         flogger.lib
+LIBRARY         bafl.lib
+LIBRARY         bsclient.lib    // branding server
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/brandingserver/tools/bsimport/group/installer.mmp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,53 @@
+/*
+* Copyright (c) 2006-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 project bsinstall
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+TARGET          bsinstall.exe
+TARGETTYPE      exe
+UID             0x1000008d 0x102828E1
+
+CAPABILITY      CAP_APPLICATION
+VENDORID        VID_DEFAULT
+
+SOURCEPATH      ../src
+SOURCE          installer.cpp
+SOURCE          cbsimportstorage.cpp
+SOURCE          cbsimportmanager.cpp
+SOURCE          cbsimportxmlparser.cpp
+SOURCE          cbsimportfilereader.cpp
+SOURCE          cbsimportstoragemanager.cpp
+SOURCE          bsbrandremover.cpp
+
+// INCLUDE DIRS
+USERINCLUDE     ../inc
+
+APP_LAYER_SYSTEMINCLUDE
+
+// LIBRARIES
+LIBRARY         euser.lib
+LIBRARY         xmlparser.lib
+LIBRARY         efsrv.lib
+LIBRARY         xmldom.lib
+LIBRARY         charconv.lib
+LIBRARY         avkon.lib
+LIBRARY         estor.lib       // RWriteStream
+LIBRARY         flogger.lib
+LIBRARY         bafl.lib
+LIBRARY         bsclient.lib    // branding server
+LIBRARY         cone.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/brandingserver/tools/bsimport/inc/cbsimportconstants.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,67 @@
+/*
+* 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: Constants header file
+*
+*/
+// CONSTANTS
+
+// default build language
+_LIT( KDefaultLanguage,     "SC" );
+
+// Characters to strip from xml text values
+_LIT( KCommonControlCharacters, "\n\t\r" );
+_LIT( KEndl,                    "\n\r" );
+
+// === Directory & file constants =============================================
+_LIT( KDirSeparator,        "\\" );
+_LIT( KDefFileName,         "brandfile.bin.r" );
+_LIT( KDefEventLogDir,      "BSImport" );
+_LIT( KDefEventLogFile,     "BS_event_log.txt" );
+
+
+// === XML tags ===============================================================
+_LIT( KBrandingTag,         "branding" );
+_LIT( KBrandTag,            "brand" );
+_LIT( KBrandIDTag,          "brand_id" );
+_LIT( KBrandLanguageTag,    "brand_language_id" );
+_LIT( KBrandVersionTag,     "brand_version" );
+_LIT( KBrandAppIdTag,       "application_id" );
+_LIT( KBrandElementTag,     "element" );
+_LIT( KElementValueTag,     "element_value" );
+
+// Element attributes
+// e.g. <element type="integer" id="id1">
+//
+_LIT( KElementTypeName,     "type" );
+_LIT( KElementTypeID,       "id" );
+
+// Element type attributes
+_LIT( KElementTypeList,     "list" );
+_LIT( KElementTypeBitmap,   "bitmap" );
+_LIT( KElementTypeBuffer,   "buffer" );
+_LIT( KElementTypeInt,      "integer" );
+_LIT( KElementTypeText,     "text" );
+_LIT( KElementTypeFile,     "file" );
+
+// Bitmap element XML tags
+_LIT( KBitmapIdTag,         "bitmap_id" );
+_LIT( KBitmapFileIdTag,     "bitmap_file_id" ); /// XSP MOD
+_LIT( KBitmapMaskIdTag,     "mask_id" );
+_LIT( KBitmapSkinIdTag,     "skin_id_major" );
+_LIT( KBitmapSkinMaskIdTag, "skin_id_minor" );
+
+// File element XML tags
+_LIT( KFileFileNameTag,     "file_name" );
+
+// end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/brandingserver/tools/bsimport/inc/cbsimportfilereader.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,163 @@
+/*
+* Copyright (c) 2006-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:  Import reader opens and reads the XML file to CMDXMLDocument 
+
+*                object
+
+*
+*/
+
+
+#ifndef CBSIMPORTFILEREADER_H
+
+#define CBSIMPORTFILEREADER_H
+
+
+
+#include <e32base.h>
+
+#include <gmxmlparser.h>
+
+
+
+class CMDXMLDocument;
+
+class CActiveScheduler;
+
+
+
+/**
+
+ *  Import reader opens and reads the XML file to CMDXMLDocument object
+
+ *
+
+ *  @lib brandimporter.exe
+
+ *  @since S60 v3.2
+
+ */
+
+class CBSImportFileReader : public CBase,
+
+                            public MMDXMLParserObserver
+
+    {
+
+public:
+
+
+
+    static CBSImportFileReader* NewL( TBool aUseScheduler );
+
+    
+
+    static CBSImportFileReader* NewLC( TBool aUseScheduler );
+
+    
+
+    ~CBSImportFileReader();
+
+
+
+    /**
+
+     * Reads XML file to CMDXMLDocument object
+
+     *
+
+     * @since S60 v3.2
+
+     * @param aFs file system handle
+
+     * @param aFileName XML file to read
+
+     */
+
+    CMDXMLDocument* ReadXMLFileL( RFs& aFs, const TDesC& aFileName );
+
+    
+
+private:
+
+
+
+    void ConstructL();
+
+
+
+    CBSImportFileReader( TBool aUseScheduler );
+
+
+
+// from base class MMDXMLParserObserver
+
+
+
+    /**
+
+     * From MMDXMLParserObserver.
+
+     * Writes text to log
+
+     *
+
+     * @since S60 v3.2
+
+     * @param aText text to write
+
+     */
+
+    void ParseFileCompleteL();
+
+            
+
+private: // Data
+
+    
+
+    // Own. XML parser
+
+    CMDXMLParser* iParser;
+
+    
+
+    // Own. XML document from parser
+
+    CMDXMLDocument* iDocument;
+
+
+
+    // Own. ActiveScheduler
+
+    CActiveScheduler* iScheduler;
+
+
+
+    // Own. Scheduler waiter. Used when we can't use scheduler directly.    
+
+    CActiveSchedulerWait* iWaiter;
+
+    
+
+    // Wheter we use CActiveScheduler or CActiveSchedulerWait
+
+    TBool iUseScheduler;
+
+    };
+
+
+
+#endif //CBSIMPORTFILEREADER_H
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/brandingserver/tools/bsimport/inc/cbsimportmanager.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,69 @@
+/*
+* Copyright (c) 2006-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:  Import manager handles the reading, parsing and writing of
+*                Brand data.
+*
+*/
+
+#ifndef CBSIMPORTMANAGER_H
+#define CBSIMPORTMANAGER_H
+
+#include <e32base.h>
+#include <f32file.h>
+
+class CMDXMLDocument;
+class MDesCArray;
+
+/**
+ *  Import manager handles the reading, parsing and writing of
+ *  Brand data.
+ *
+ *  @lib brandimporter.exe
+ *  @since S60 v3.2
+ */
+class CBSImportManager : public CBase
+{
+public:
+
+    static CBSImportManager* NewL();
+    
+    static CBSImportManager* NewLC();
+    
+    ~CBSImportManager();
+
+    /**
+     * Import XML file and write binary brand file from it.
+     * Overloaded function takes multiple xml files.
+     *
+     * @since S60 v3.2
+     * @param aSrcFile source xml file
+     * @return none
+     */
+    void ImportFileL( const TDesC& aSrcFile );
+    void ImportFileL( const MDesCArray& aSrcFiles );
+
+private:
+
+    void ConstructL();
+    
+    CBSImportManager();
+
+private: // data
+        
+    // Own. Filesystem handle
+    RFs iFs;
+    
+};
+
+#endif //CBSIMPORTMANAGER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/brandingserver/tools/bsimport/inc/cbsimportstorage.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,221 @@
+/*
+* Copyright (c) 2006-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:  Stores element data and writes it to stream
+*
+*/
+
+
+#ifndef CBSIMPORTSTORAGE_H
+#define CBSIMPORTSTORAGE_H
+
+#include <e32base.h>
+
+class MBSElement;
+class RWriteStream;
+
+
+/**
+ *  Stores element data and writes it to stream
+ *
+ *  @lib brandimporter.exe
+ *  @since S60 v3.2
+ */
+class CBSImportStorage : public CBase
+{
+public:
+
+    static CBSImportStorage* NewL();
+    
+    static CBSImportStorage* NewLC();
+    
+    ~CBSImportStorage();
+    
+    /**
+     * Set version of brand storage
+     *
+     * @since S60 3.2
+     * @param aVersion version
+     */
+    void SetVersion( TInt aVersion );
+    
+    /**
+     * Set application ID of brand storage
+     *
+     * @since S60 3.2
+     * @param aAppId application ID
+     * @return none
+     */
+    void SetApplicationIdL( const TDesC& aAppId );
+    
+    /**
+     * Set storage ID of brand storage
+     *
+     * @since S60 3.2
+     * @param aStorageId storage ID
+     * @return none
+     */
+    void SetStorageIdL( const TDesC& aStorageId );
+    
+    /**
+     * Set language of brand storage
+     *
+     * @since S60 3.2
+     * @param aLanguage language
+     * @return none
+     */
+    void SetLanguageL( TLanguage aLanguage );
+    
+    /**
+     * Store element to storage. Storage takes the ownership of element.
+     *
+     * @since S60 3.2
+     * @param aElement element to store.
+     * @return General Symbian errorcode. 
+     */
+    TInt AppendElement( MBSElement* aElement );
+    
+    /**
+     * Return the count of elements in storage
+     *
+     * @since S60 3.2
+     * @return count of elements
+     */
+    TInt ElementCount();
+
+    /**
+     * Return one element
+     *
+     * @since S60 3.2
+     * @return requested element
+     */
+    MBSElement* Element( TInt aIndex );
+    
+    /**
+     * Externalize storage into stream
+     *
+     * @since S60 3.2
+     * @param aWriteStream output stream
+     * @return none
+     */
+    void ExternalizeL( RWriteStream& aWriteStream );
+    void FlushToServerL();
+
+    /**
+     * Gives a full filename which is constructed from header data
+     *
+     * @since S60 3.2
+     * @return filename
+     */
+    TPtrC ProposeFileNameL();
+
+    /**
+     * Scan through all elements in storage and find EFile items.
+     * Appends all found items to aFileList array.
+     *
+     * @since S60 3.2
+     * @param aFileList filelist array
+     */
+    void GetListOfFiles( RArray<TPtrC>& aFileList );
+
+    /**
+     * Compare storages header data to another storage.
+     *
+     * @since S60 3.2
+     * @param aStorage storage to compare
+     * @return ETrue  - storages match
+     *         EFalse - storages don't match
+     */
+    TBool Compare( const CBSImportStorage* aStorage ) const;
+    
+    /**
+     * Take content of one storage into this storage. Will delete
+     * elements in aStorage!
+     *
+     * @since S60 3.2
+     * @param aStorage storage to append
+     */
+    void TakeElements( CBSImportStorage* aStorage );
+
+private:
+
+    CBSImportStorage();
+
+    void ConstructL();
+    
+    /**
+     * Check that header information is complete
+     *
+     * @since S60 3.2
+     * @return ETrue  - header information ok
+     *         EFalse - header information missing or incomplete
+     */
+    TBool VerifyHeader();
+
+    /**
+     * Check that data information is correct.
+     *  - verify that elements have unique ID's
+     *
+     * @since S60 3.2
+     * @param aArray array of elements to check
+     * @param aIgnoreEmptyID ETrue: empty id's are considered as unique
+     *                       EFalse: 2 empty id's will fail this check
+     * @return ETrue  - data ok.
+     *         EFalse - bad data.
+     */
+    TBool VerifyDataL( TArray<MBSElement*> aArray, 
+                       TBool aIgnoreEmptyID = EFalse );
+    
+    /**
+     * Creates a filename from given header data.
+     * \[application_id]\[brand_id]\[def_filename][language_id]
+     *
+     * @since S60 3.2
+     */
+    void ConstructFileNameL();
+    
+    
+    /**
+     * Check element for EFile items.
+     * Appends all found items to aFileList array.
+     *
+     * @since S60 3.2
+     * @param aElement element to check
+     * @param aFileList filelist array
+     */
+    void AppendFiles( MBSElement* aElement, RArray<TPtrC>& aFileList );
+    
+private: // Data
+
+    // Own. Array of stored elements.
+    RPointerArray<MBSElement> iElements;
+    
+    // Own. Proposed file name
+    HBufC* iFilename;
+    
+    // HEADER DATA
+    
+    // Version number of storage
+    TInt iVersion;
+    
+    // Language ID of storage
+    TLanguage iLanguage;
+    
+    // Own. Application ID of storage
+    HBufC8* iAppId;
+    
+    // Own. Storage ID.of storage
+    HBufC8* iStorageId;
+};
+
+#endif //CBSIMPORTSTORAGE_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/brandingserver/tools/bsimport/inc/cbsimportstoragemanager.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,103 @@
+/*
+* Copyright (c) 2006-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:  Storage handler
+*
+*/
+
+
+#ifndef CBSIMPORTSTORAGEMANAGER_H
+#define CBSIMPORTSTORAGEMANAGER_H
+
+#include <e32base.h>
+
+class CBSImportStorage;
+class RWriteStream;
+class RFs;
+
+/**
+ *  Storage handler
+ *
+ *  @lib brandimporter.exe
+ *  @since S60 v3.2
+ */
+class CBSImportStorageManager : public CBase
+{
+public:
+
+    static CBSImportStorageManager* NewL();
+    
+    static CBSImportStorageManager* NewLC();
+    
+    ~CBSImportStorageManager();
+
+    /**
+     * Create a new storage and set it to current.
+     *
+     * @since S60 3.2
+     * @return none
+     */
+    void CreateStorageL();
+    
+    /**
+     * Return the count of storages
+     *
+     * @since S60 3.2
+     * @return count of elements
+     */
+    TInt StorageCount();
+
+    /**
+     * Get stored storage at index or current storage.
+     *
+     * @since S60 3.2
+     * @param aIndex index of storage to fetch. 
+     * @return Stored storage
+     */
+    CBSImportStorage* Storage( TInt aIndex );
+    CBSImportStorage* Storage();
+    
+    /**
+     * Write stored data to Branding server
+     *
+     * @since S60 3.2
+     * @return none
+     */
+    void WriteDataToServerL();
+    
+    
+private:
+
+    CBSImportStorageManager();
+
+    void ConstructL();
+    
+    /**
+     * Merge storages with same header data
+     *
+     * @since S60 3.2
+     * @return none
+     */
+    void MergeStorages();
+    
+private: // Data
+
+    // Own. Array of stored storages.
+    RPointerArray<CBSImportStorage> iStorages;
+    
+    // Index of currently active storage
+    TInt iCurrent;
+    
+};
+
+#endif //CBSIMPORTSTORAGEMANAGER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/brandingserver/tools/bsimport/inc/cbsimportxmlparser-1.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,16 @@
+/*
+* Copyright (c) 2006-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:  Parses XML content and stores data to storage*
+*/
+#ifndef CBSIMPORTXMLPARSER_H#define CBSIMPORTXMLPARSER_H// INCLUDE FILES#include <e32base.h>#include <f32file.h>#include <GMXMLDocument.h>#include <rbsobjowningptrarray.h>#include <mbselement.h>class CMDXMLNode;class CBSImportStorageManager;// CLASS DEFINITIONclass CBSImportXMLParser : public CBase    {private: // Definitions    struct TImportBitmap        {        TInt iBitmapId;        TInt iBitmapMaskId;        TInt iSkinId;        TInt iSkinMaskId;        };    enum TXMLBaseTagTypes        {        EBrandUnknown,        EBrandAppID,        EBrandID,        EBrandLanguage,        EBrandVersion,        EBrandElement        };        public:    static CBSImportXMLParser* NewL( CBSImportStorageManager* aStorage );        static CBSImportXMLParser* NewLC( CBSImportStorageManager* aStorage );    ~CBSImportXMLParser();    /**     * Parse XML document and store data to storage     *     * @since S60 3.2     * @param aDocument XML document to parse     * @return none     */    void ParseDocumentL( CMDXMLDocument& aDocument );private:    CBSImportXMLParser( CBSImportStorageManager* aStorage );        void ConstructL();        /**     * Parses full the base element <branding> and it's child elements.     *     * @since S60 v3.2     * @param aElement to parse     */    void ParseDocumentBaseL( CMDXMLNode* aElement );        /**     * Analyzes a child node of <branding> and stores the value to storage.     * Ignores undetected XML nodes.     *     * @since S60 v3.2     * @param aElement to parse     */    void AnalyzeNodeL( CMDXMLNode* aNode );        /**     * Converts a given node to TXMLBaseTagTypes. This can handle all     * child nodes of <branding>     *     * @since S60 v3.2     * @param aNode node to check     * @return corresponding TXMLBaseTagTypes value (or EBrandUnknown).     */    TXMLBaseTagTypes SolveTagTypeL( CMDXMLNode* aNode );    /**     * Parses full <element> node. Returns a newly constructed MBSElement     * from the content of teh node.      * Ownership is transferred!     *     * @since S60 v3.2     * @param aNode <element> node     * @return Concrete element constructed from node.      */    MBSElement* ParseBrandElementL( CMDXMLNode* aNode );        /**     * Converts elements type attribute value to TBSElementType      * (see MBSElement).     *     * @since S60 v3.2     * @param aType value of type attribute     * @return corresponding TBrandingElementType value or KErrNotFound.     */    TInt SolveElementType( const TDesC& aType );    /**     * Search a child node with name inside another node. Returns the first match     *     * @since S60 v3.2     * @param aNode parent node to search      * @param aTagName Child nodes name     * @return found node or NULL if not found;     */    CMDXMLNode* SearchChild( CMDXMLNode* aNode, const TDesC& aChildName );    /**     * Parse value from <element_value> tag. Leaves if parse fails.     * Ownership is transferred to caller (NodeTextLC)     *     * @since S60 3.2     * @param aNode XML node to parse. should be <element_value>.     * @return value from <element_value>     */    HBufC* NodeTextLC( CMDXMLNode* elNode );    TInt   NodeIntL  ( CMDXMLNode* elNode );        /**     * Parse <element> tag for given value type. Leaves if parsing fails.     *     * @since S60 3.2     * @param aNode XML node to parse     * @param aValue Parsed value     * @return none     */    void DoParseIntegerL( CMDXMLNode* aNode, TInt& aValue );    void DoParseTextL   ( CMDXMLNode* aNode, HBufC*& aText );    void DoParseFileL   ( CMDXMLNode* aNode, HBufC*& aText );    void DoParseListL   ( CMDXMLNode* aNode, RBSObjOwningPtrArray<MBSElement>& aElementArray );    void DoParseBitmapL ( CMDXMLNode* aNode, CBSBitmap*& aBitmap );    private: // Data        // Not owned. Storage where to put parsed elements    CBSImportStorageManager* iStorage;    };#endif //CBSIMPORTXMLPARSER_H
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/brandingserver/tools/bsimport/inc/cbsimportxmlparser.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,317 @@
+/*
+* Copyright (c) 2006-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:  Parses XML content and stores data to storage
+
+*
+*/
+
+
+#ifndef CBSIMPORTXMLPARSER_H
+
+#define CBSIMPORTXMLPARSER_H
+
+
+
+// INCLUDE FILES
+
+#include <e32base.h>
+
+#include <f32file.h>
+
+#include <gmxmldocument.h>
+
+#include <rbsobjowningptrarray.h>
+
+#include <mbselement.h>
+
+
+
+class CMDXMLNode;
+
+class CBSImportStorageManager;
+
+
+
+// CLASS DEFINITION
+
+class CBSImportXMLParser : public CBase
+
+    {
+
+private: // Definitions
+
+
+
+    struct TImportBitmap
+
+        {
+
+        TInt iBitmapId;
+
+        TInt iBitmapMaskId;
+
+        TInt iSkinId;
+
+        TInt iSkinMaskId;
+
+        };
+
+
+
+    enum TXMLBaseTagTypes
+
+        {
+
+        EBrandUnknown,
+
+        EBrandAppID,
+
+        EBrandID,
+
+        EBrandLanguage,
+
+        EBrandVersion,
+
+        EBrandElement
+
+        };
+
+        
+
+public:
+
+
+
+    static CBSImportXMLParser* NewL( CBSImportStorageManager* aStorage );
+
+    
+
+    static CBSImportXMLParser* NewLC( CBSImportStorageManager* aStorage );
+
+
+
+    ~CBSImportXMLParser();
+
+
+
+    /**
+
+     * Parse XML document and store data to storage
+
+     *
+
+     * @since S60 3.2
+
+     * @param aDocument XML document to parse
+
+     * @return none
+
+     */
+
+    void ParseDocumentL( CMDXMLDocument& aDocument );
+
+
+
+private:
+
+
+
+    CBSImportXMLParser( CBSImportStorageManager* aStorage );
+
+    
+
+    void ConstructL();
+
+    
+
+    /**
+
+     * Parses full the base element <branding> and it's child elements.
+
+     *
+
+     * @since S60 v3.2
+
+     * @param aElement to parse
+
+     */
+
+    void ParseDocumentBaseL( CMDXMLNode* aElement );
+
+    
+
+    /**
+
+     * Analyzes a child node of <branding> and stores the value to storage.
+
+     * Ignores undetected XML nodes.
+
+     *
+
+     * @since S60 v3.2
+
+     * @param aElement to parse
+
+     */
+
+    void AnalyzeNodeL( CMDXMLNode* aNode );
+
+    
+
+    /**
+
+     * Converts a given node to TXMLBaseTagTypes. This can handle all
+
+     * child nodes of <branding>
+
+     *
+
+     * @since S60 v3.2
+
+     * @param aNode node to check
+
+     * @return corresponding TXMLBaseTagTypes value (or EBrandUnknown).
+
+     */
+
+    TXMLBaseTagTypes SolveTagTypeL( CMDXMLNode* aNode );
+
+
+
+    /**
+
+     * Parses full <element> node. Returns a newly constructed MBSElement
+
+     * from the content of teh node. 
+
+     * Ownership is transferred!
+
+     *
+
+     * @since S60 v3.2
+
+     * @param aNode <element> node
+
+     * @return Concrete element constructed from node. 
+
+     */
+
+    MBSElement* ParseBrandElementL( CMDXMLNode* aNode );
+
+    
+
+    /**
+
+     * Converts elements type attribute value to TBSElementType 
+
+     * (see MBSElement).
+
+     *
+
+     * @since S60 v3.2
+
+     * @param aType value of type attribute
+
+     * @return corresponding TBrandingElementType value or KErrNotFound.
+
+     */
+
+    TInt SolveElementType( const TDesC& aType );
+
+
+
+    /**
+
+     * Search a child node with name inside another node. Returns the first match
+
+     *
+
+     * @since S60 v3.2
+
+     * @param aNode parent node to search 
+
+     * @param aTagName Child nodes name
+
+     * @return found node or NULL if not found;
+
+     */
+
+    CMDXMLNode* SearchChild( CMDXMLNode* aNode, const TDesC& aChildName );
+
+
+
+    /**
+
+     * Parse value from <element_value> tag. Leaves if parse fails.
+
+     * Ownership is transferred to caller (NodeTextLC)
+
+     *
+
+     * @since S60 3.2
+
+     * @param aNode XML node to parse. should be <element_value>.
+
+     * @return value from <element_value>
+
+     */
+
+    HBufC* NodeTextLC( CMDXMLNode* elNode );
+
+    TInt   NodeIntL  ( CMDXMLNode* elNode );
+
+    
+
+    /**
+
+     * Parse <element> tag for given value type. Leaves if parsing fails.
+
+     *
+
+     * @since S60 3.2
+
+     * @param aNode XML node to parse
+
+     * @param aValue Parsed value
+
+     * @return none
+
+     */
+
+    void DoParseIntegerL( CMDXMLNode* aNode, TInt& aValue );
+
+    void DoParseTextL   ( CMDXMLNode* aNode, HBufC*& aText );
+
+    void DoParseFileL   ( CMDXMLNode* aNode, HBufC*& aText );
+
+    void DoParseListL   ( CMDXMLNode* aNode, RBSObjOwningPtrArray<MBSElement>& aElementArray );
+
+    void DoParseBitmapL ( CMDXMLNode* aNode, CBSBitmap*& aBitmap );
+
+    
+
+private: // Data
+
+    
+
+    // Not owned. Storage where to put parsed elements
+
+    CBSImportStorageManager* iStorage;
+
+    };
+
+
+
+#endif //CBSIMPORTXMLPARSER_H
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/brandingserver/tools/bsimport/inc/importlogwriter.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,127 @@
+/*
+* Copyright (c) 2006-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:  Log writer macros
+*
+*/
+
+
+
+/*
+*
+*  Description:
+*
+*     Logging tools. Uniforms style to write debug data to
+*     file with RFileLogger.
+*
+*     Usage:
+*
+*       following directory must be manually done before logging
+*       (no directory, not logs).
+*           Epoc32\Winscw\c\logs\bsimport\
+*
+*
+*     2.Printing:
+*
+*       // normal string                                  output:
+*       IMPORT_DP( D_IMPORT_LIT( "Some text." ) );                >> CHAT: Some text.
+*       IMPORT_DP( D_PLAIN_LIT( "Some text." ) );               >> Some text.
+*       IMPORT_DP_TXT( "Some text." );                          >> CHAT: Some text.
+*
+*       // string with variables
+*       TInt index( 99 );
+*       _LIT( KExample, "Example" );
+*       IMPORT_DP( D_IMPORT_LIT( "Some text: %d" ), 100 );        >> CHAT: Some text: 100
+*       IMPORT_DP( D_IMPORT_LIT( "Some text: %d" ), index );      >> CHAT: Some text: 99
+*       IMPORT_DP( D_IMPORT_LIT( "Some text: %S" ), &KExample );  >> CHAT: Some text: Example
+*
+*       IMPORT_DP( D_PLAIN_LIT( "Some text: %d" ), 100 );       >> Some text: 100
+*       IMPORT_DP( D_PLAIN_LIT( "Some text: %d" ), index );     >> Some text: 99
+*       IMPORT_DP( D_PLAIN_LIT( "Some text: %S" ), &KExample ); >> Some text: Example
+*
+*
+*     3.Known issues:
+*
+*       - If you use macros from .mmp file remember to abld makefile <target> to
+*         change flags from project.
+*       - In statements like IMPORT_DP( D_IMPORT_LIT("Some text: %S"), &KExample );
+*         parameters causes still some code to generated in release builds.
+*         Propably it is best to #ifdef all debugprint blocks
+*         with CHAT_ENABLE_DEBUG_PRINT statement.
+*
+* ============================================================================
+*/
+
+
+#ifndef __IMPORTLOGWRITER_H__
+#define __IMPORTLOGWRITER_H__
+
+
+// no include files if no debug printing --> faster compile time
+// INCLUDES
+#include <e32std.h>
+#include <e32svr.h>
+#include <flogger.h>
+
+/**
+ * Depending if the build is UNICODE or not, define the
+ * helper macros that insert CHAT prefix.
+ */
+#ifdef _UNICODE
+    //#define IMPORT_TOKEN_PASTING( s ) L##s
+    //#define IMPORT_TO_UNICODE( s ) CHAT_TOKEN_PASTING( s )
+    #define IMPORT_DEBUG_STR( m ) L##m
+#else
+    #define IMPORT_DEBUG_STR "CHAT: "
+#endif // _UNICODE
+
+
+/**
+ * Helper macro for defining debug strings with plain debug text.
+ */
+#define D_PLAIN_LIT( s ) _L( s )    // CSI: 78 # Debug print
+
+
+/**
+ * Helper macro for defining debug strings with "CHAT:" prefix.
+ */
+#define D_IMPORT_LIT( s ) TPtrC( ( const TText * ) L ## s )
+
+
+/**
+ * Method to handle file writing
+ */
+inline void ImportDebugWriteFormat( TRefByValue<const TDesC> aFmt,... )
+    {
+    _LIT( KDir,     "BSImport" );
+    _LIT( KName,    "Importlog.txt" );
+
+    // take the ellipsis parameters
+    VA_LIST args;
+    VA_START( args,aFmt );
+    RFileLogger::WriteFormat( KDir, KName, EFileLoggingModeAppend,
+    	aFmt, args );
+    VA_END( args );
+    }
+
+/**
+ * Actual debug printters.
+ * Output to log file.
+ */
+#define IMPORT_DP ImportDebugWriteFormat
+#define IMPORT_DP_TXT( s ) ImportDebugWriteFormat( D_IMPORT_LIT( s ) )
+
+#endif  // __IMPORTLOGWRITER_H__
+
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/brandingserver/tools/bsimport/src/bsbrandremover.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,57 @@
+/*
+* Copyright (c) 2006-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:  Removes brands from branding server
+*
+*/
+
+#include <utf.h>
+
+#include <cbsfactory.h>
+#include <mbsupdater.h>
+
+#include "bsbrandremover.h"
+
+
+// ======== MEMBER FUNCTIONS ========
+    
+// ---------------------------------------------------------------------------
+// BSBrandRemover::RemoveBrand
+// ---------------------------------------------------------------------------
+//
+void BSBrandRemover::RemoveBrandL( const TDesC& aBrandId,
+                                   const TDesC& aApplicationId )
+    {
+    // 16bit -> 8bit conversion
+    HBufC8* brandBuf = HBufC8::NewLC( aBrandId.Length() );
+    HBufC8* appBuf = HBufC8::NewLC( aApplicationId.Length() );
+    TPtr8 brand( brandBuf->Des() );
+    TPtr8 app( appBuf->Des() );
+    
+    CnvUtfConverter::ConvertFromUnicodeToUtf8( brand, aBrandId );
+    CnvUtfConverter::ConvertFromUnicodeToUtf8( app, aApplicationId );
+    
+    // Remove brand
+    CBSFactory* factory = CBSFactory::NewL( brand, app );
+    CleanupStack::PushL( factory );
+    MBSUpdater* updater = factory->CreateUpdaterLC();
+    //updater->StartTransactionL( brand, ELangOther, KBSAutomaticVersionUpdate );
+    updater->StartTransactionL( brand, ELangOther, MBSUpdater::EUpdateUninstall);
+    
+    updater->RemoveBrandL( brand, app );
+    
+    updater->StopTransactionL();
+    CleanupStack::PopAndDestroy( 4 ); // updater, factory, brandBuf, appBuf
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/brandingserver/tools/bsimport/src/bsbrandremover.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,42 @@
+/*
+* Copyright (c) 2006-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:  Helper class for removing brands
+*
+*/
+
+#ifndef BSBRANDREMOVER_H
+#define BSBRANDREMOVER_H
+
+
+/**
+ *  Brand remover helper
+ *
+ *  @lib bsinstall.exe
+ *  @since S60 v3.2
+ */
+class BSBrandRemover 
+    {
+public:
+
+    /**
+     * Removes brand from branding server
+     * @aBrandId brand id of removed brand
+     * @aApplicationId application id of removed brand
+     */
+    static void RemoveBrandL( const TDesC& aBrandId,
+                              const TDesC& aApplicationId );
+
+    };
+
+#endif //CBSBRANDREMOVER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/brandingserver/tools/bsimport/src/cbsimportfilereader.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,145 @@
+/*
+* Copyright (c) 2006-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:  Import reader opens and reads the XML file to CMDXMLDocument 
+*                object
+*
+*/
+
+
+#include <f32file.h>
+#include <gmxmldocument.h>
+
+#include "cbsimportfilereader.h"
+#include "importlogwriter.h"
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// CBSImportManager::NewL
+// ---------------------------------------------------------------------------
+//
+CBSImportFileReader* CBSImportFileReader::NewL( TBool aUseScheduler )
+    {
+    CBSImportFileReader* self = NewLC( aUseScheduler );
+    CleanupStack::Pop();
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CBSImportManager::NewLC
+// ---------------------------------------------------------------------------
+//
+CBSImportFileReader* CBSImportFileReader::NewLC( TBool aUseScheduler )
+    {
+    CBSImportFileReader* self = new (ELeave) CBSImportFileReader( aUseScheduler );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CBSImportManager::ConstructL
+// ---------------------------------------------------------------------------
+//
+void CBSImportFileReader::ConstructL()
+    {
+	if( iUseScheduler )
+	    {
+    	// Install active scheduler
+    	iScheduler = new (ELeave) CActiveScheduler();
+    	CActiveScheduler::Install( iScheduler );
+	    }
+    else
+        {
+        iWaiter = new (ELeave) CActiveSchedulerWait();
+        }
+    
+    // Create XML parser
+    iParser = CMDXMLParser::NewL( this );
+    }
+    
+// ---------------------------------------------------------------------------
+// CBSImportManager::~CBSImportFileReader
+// ---------------------------------------------------------------------------
+//
+CBSImportFileReader::~CBSImportFileReader()
+    {
+    delete iParser;
+    delete iDocument;
+    delete iWaiter;
+    delete iScheduler;
+	if( iUseScheduler )
+	    {
+	    CActiveScheduler::Install( NULL );
+	    }
+    }
+
+// ---------------------------------------------------------------------------
+// CBSImportManager::CBSImportFileReader
+// ---------------------------------------------------------------------------
+//
+CBSImportFileReader::CBSImportFileReader( TBool aUseScheduler ) :
+    iUseScheduler( aUseScheduler )
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// CBSImportManager::ReadXMLFileL
+// ---------------------------------------------------------------------------
+//
+CMDXMLDocument* CBSImportFileReader::ReadXMLFileL( RFs& aFs, const TDesC& aFileName )
+    {
+    RFile file;
+    TInt err = file.Open( aFs, aFileName, EFileRead );
+    if( err )
+        {
+        IMPORT_DP( D_IMPORT_LIT( "ERROR: Unable to open XML file (%S)!" ), &aFileName );
+        User::Leave( err );
+        }
+
+    // takes ownership of file
+    err = iParser->ParseFile( file );
+    if( err )
+        {
+        IMPORT_DP( D_IMPORT_LIT( "ERROR: Unable to read XML file (%S)!" ), &aFileName );
+        User::Leave( err );
+        }
+    
+    // Start waiting, so that parser can start working
+	// Code scanner warning active object called without checking whether it is active
+	// or cancelling it first (id:10 )
+    // The active object cannot be active at this point.
+    // Code scanner warning using CActiveScheduler::Start (Id:3)
+    // It is required to use here
+    iUseScheduler ? CActiveScheduler::Start() : iWaiter->Start(); // CSI: 10,3 # See above
+    
+    CMDXMLDocument* tmp = iDocument;
+    iDocument = NULL;
+    return tmp;
+    }
+
+// ---------------------------------------------------------------------------
+// From class MMDXMLParserObserver.
+// CBSImportManager::ParseFileCompleteL
+// ---------------------------------------------------------------------------
+//
+void CBSImportFileReader::ParseFileCompleteL()
+    {
+    iDocument = iParser->DetachXMLDoc();
+    // Codescanner warning using CActiveScheduler::Start (Id:4)
+    // It is required to use here
+    iUseScheduler ? CActiveScheduler::Stop() : iWaiter->AsyncStop(); // CSI: 4 # See above
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/brandingserver/tools/bsimport/src/cbsimportmanager.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,157 @@
+/*
+* Copyright (c) 2006-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:  Import manager handles the reading, parsing and writing of
+*                Brand data.
+*
+*/
+
+
+#include <s32file.h>
+#include <cbsfactory.h>
+#include <mbsupdater.h>
+#include <bamdesca.h>
+
+#include "cbsimportmanager.h"
+#include "cbsimportxmlparser.h"
+#include "cbsimportfilereader.h"
+#include "cbsimportstoragemanager.h"
+#include "cbsimportconstants.h"
+#include "importlogwriter.h"
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// CBSImportManager::NewL
+// ---------------------------------------------------------------------------
+//
+CBSImportManager* CBSImportManager::NewL()
+    {
+    CBSImportManager* self = NewLC();
+    CleanupStack::Pop();
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CBSImportManager::NewLC
+// ---------------------------------------------------------------------------
+//
+CBSImportManager* CBSImportManager::NewLC()
+    {
+    CBSImportManager* self = new (ELeave) CBSImportManager();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CBSImportManager::ConstructL
+// ---------------------------------------------------------------------------
+//
+void CBSImportManager::ConstructL()
+    {
+    // Open filesystem handle
+    User::LeaveIfError( iFs.Connect() );
+    }
+    
+// ---------------------------------------------------------------------------
+// CBSImportManager::~CBSImportManager
+// ---------------------------------------------------------------------------
+//
+CBSImportManager::~CBSImportManager()
+    {
+    iFs.Close();
+    }
+
+// ---------------------------------------------------------------------------
+// CBSImportManager::CBSImportManager
+// ---------------------------------------------------------------------------
+//
+CBSImportManager::CBSImportManager()
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// CBSImportManager::ImportFileL
+// ---------------------------------------------------------------------------
+//
+void CBSImportManager::ImportFileL( const TDesC& aSrcFile )
+    {
+    // Read XML File
+    IMPORT_DP( D_IMPORT_LIT("Reading XML file: %S"), &aSrcFile );
+    
+    CBSImportFileReader* reader = CBSImportFileReader::NewLC( ETrue );
+    CMDXMLDocument* document = reader->ReadXMLFileL( iFs, aSrcFile );
+    CleanupStack::PopAndDestroy(reader);
+    IMPORT_DP( D_IMPORT_LIT("Reading done") );
+	
+	CleanupStack::PushL(document);
+
+    // Parse XML file
+    IMPORT_DP( D_IMPORT_LIT("Parsing XML content...") );
+    CBSImportStorageManager* storage = CBSImportStorageManager::NewLC();
+    
+    CBSImportXMLParser* parser = CBSImportXMLParser::NewLC( storage );
+    parser->ParseDocumentL( *document );  
+        
+    CleanupStack::PopAndDestroy( parser );
+    IMPORT_DP( D_IMPORT_LIT("Parsing done.") );
+
+    // Write output files
+    IMPORT_DP( D_IMPORT_LIT("Writing Branding files...") );
+    storage->WriteDataToServerL();
+    IMPORT_DP( D_IMPORT_LIT("Writing done.") );
+
+    // Cleanup
+    CleanupStack::PopAndDestroy( 2 , document ); // storage , document
+    }
+
+// ---------------------------------------------------------------------------
+// CBSImportManager::ImportFileL
+// ---------------------------------------------------------------------------
+//
+void CBSImportManager::ImportFileL( const MDesCArray& aSrcFiles )
+    {
+    // Read XML Files
+    CBSImportStorageManager* storage = CBSImportStorageManager::NewLC();
+    CBSImportXMLParser* parser = CBSImportXMLParser::NewLC( storage );
+    CBSImportFileReader* reader = CBSImportFileReader::NewLC( ETrue );
+
+    TInt count = aSrcFiles.MdcaCount();
+    for( TInt i = 0; i < count; i++ )
+        {
+        TPtrC file( aSrcFiles.MdcaPoint( i ) );
+        IMPORT_DP( D_IMPORT_LIT("Reading XML file: %S"), &file );
+        CMDXMLDocument* document = reader->ReadXMLFileL( iFs, file );
+        IMPORT_DP( D_IMPORT_LIT("Reading done") );
+        CleanupStack::PushL(document);
+
+        // Parse XML file
+        IMPORT_DP(D_IMPORT_LIT("Parsing XML content..."));
+        parser->ParseDocumentL(*document);  
+        IMPORT_DP( D_IMPORT_LIT("Parsing done.") );
+		CleanupStack::PopAndDestroy(document);
+        }
+    
+    CleanupStack::PopAndDestroy( 2, parser ); // reader, parser
+    
+    // Write output files
+    IMPORT_DP( D_IMPORT_LIT("Writing branding data to server...") );
+    storage->WriteDataToServerL();
+    IMPORT_DP( D_IMPORT_LIT("Writing done.") );
+
+    // Cleanup
+    CleanupStack::PopAndDestroy( storage );
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/brandingserver/tools/bsimport/src/cbsimportstorage.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,297 @@
+/*
+* Copyright (c) 2006-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:  Stores element data and writes it to stream
+*
+*/
+
+
+#include <s32strm.h>
+#include <utf.h>
+#include <cbsfactory.h>
+#include <mbsupdater.h>
+#include <mbselement.h>
+
+#include "cbsimportstorage.h"
+#include "cbsimportconstants.h"
+#include "importlogwriter.h"
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// CBSImportStorage::NewL
+// ---------------------------------------------------------------------------
+//
+CBSImportStorage* CBSImportStorage::NewL()
+    {
+    CBSImportStorage* self = NewLC();
+    CleanupStack::Pop();
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CBSImportStorage::NewLC
+// ---------------------------------------------------------------------------
+//
+CBSImportStorage* CBSImportStorage::NewLC()
+    {
+    CBSImportStorage* self = new (ELeave) CBSImportStorage();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CBSImportStorage::ConstructL
+// ---------------------------------------------------------------------------
+//
+void CBSImportStorage::ConstructL()
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// CBSImportStorage::CBSImportStorage
+// ---------------------------------------------------------------------------
+//
+CBSImportStorage::CBSImportStorage()
+    {
+    }
+    
+// ---------------------------------------------------------------------------
+// CBSImportStorage::~CBSImportStorage
+// ---------------------------------------------------------------------------
+//
+CBSImportStorage::~CBSImportStorage()
+    {
+    iElements.ResetAndDestroy();
+    delete iAppId;
+    delete iStorageId;
+    delete iFilename;
+    }
+
+// ---------------------------------------------------------------------------
+// CBSImportStorage::AppendElement
+// ---------------------------------------------------------------------------
+//
+TInt CBSImportStorage::AppendElement( MBSElement* aElement )
+    {
+    if( aElement )
+        {
+        return iElements.Append( aElement );
+        }
+    // Ignore empty
+    return KErrNone;
+    }
+
+// ---------------------------------------------------------------------------
+// CBSImportStorage::ElementCount
+// ---------------------------------------------------------------------------
+//
+TInt CBSImportStorage::ElementCount()
+    {
+    return iElements.Count();
+    }
+    
+// ---------------------------------------------------------------------------
+// CBSImportStorage::Element
+// ---------------------------------------------------------------------------
+//
+MBSElement* CBSImportStorage::Element( TInt aIndex )
+    {
+    return iElements[ aIndex ];
+    }
+
+// ---------------------------------------------------------------------------
+// CBSImportStorage::FlushtoServerL
+// ---------------------------------------------------------------------------
+//
+void CBSImportStorage::FlushToServerL()
+    {
+    if( !VerifyHeader() || !VerifyDataL( iElements.Array() ) )
+        {
+        // Header not complete. Will not flush
+        User::Leave( KErrCorrupt );
+        }
+
+    // Create access to server
+    CBSFactory* factory = CBSFactory::NewL( *iStorageId, *iAppId );
+    CleanupStack::PushL( factory );
+    MBSUpdater* updater = factory->CreateUpdaterLC();
+    //updater->StartTransactionL( *iStorageId, iLanguage, iVersion );
+    updater->StartTransactionL( *iStorageId, iLanguage );
+    
+    // Flush data
+    TInt count = iElements.Count();
+    for( TInt i = 0; i < count; i++ )
+        {
+        TRAPD( err, updater->InsertElementL( iElements[i] ) );
+        if( err == KErrAlreadyExists )
+            {
+            err = KErrNone;
+            TRAP( err, updater->ReplaceElementL( iElements[i] ) );
+            }
+        User::LeaveIfError( err );
+        }
+    
+    // Cleanup
+    updater->StopTransactionL();
+    CleanupStack::PopAndDestroy( 2 ); // factory, updater
+    }
+    
+// ---------------------------------------------------------------------------
+// CBSImportStorage::SetVersion
+// ---------------------------------------------------------------------------
+//
+void CBSImportStorage::SetVersion( TInt aVersion )
+    {
+    iVersion = aVersion;
+    }
+
+// ---------------------------------------------------------------------------
+// CBSImportStorage::SetApplicationIdL
+// ---------------------------------------------------------------------------
+//
+void CBSImportStorage::SetApplicationIdL( const TDesC& aAppId )
+    {
+    HBufC8* id = HBufC8::NewLC( aAppId.Length() );
+    TPtr8 idPtr( id->Des() );
+    CnvUtfConverter::ConvertFromUnicodeToUtf8( idPtr, aAppId );
+    CleanupStack::Pop( id );
+    delete iAppId;
+    iAppId = id;   
+    }
+
+// ---------------------------------------------------------------------------
+// CBSImportStorage::SetStorageIdL
+// ---------------------------------------------------------------------------
+//
+void CBSImportStorage::SetStorageIdL( const TDesC& aStorageId )
+    {
+    HBufC8* id = HBufC8::NewLC( aStorageId.Length() );
+    TPtr8 idPtr( id->Des() );
+    CnvUtfConverter::ConvertFromUnicodeToUtf8( idPtr, aStorageId );
+    CleanupStack::Pop( id );
+    delete iStorageId;
+    iStorageId = id;   
+    }
+
+// ---------------------------------------------------------------------------
+// CBSImportStorage::SetLanguageL
+// ---------------------------------------------------------------------------
+//
+void CBSImportStorage::SetLanguageL( TLanguage aLanguage )
+    {
+    iLanguage = aLanguage;
+    }
+
+// ---------------------------------------------------------------------------
+// CBSImportStorage::VerifyHeader
+// ---------------------------------------------------------------------------
+//
+TBool CBSImportStorage::VerifyHeader()
+    {
+    // not checking version as it is been consider not to use. - Pankaj - 31 may 07
+    //return ( iAppId && iStorageId && iVersion > 0 && iLanguage >= ELangTest );
+    return ( iAppId && iStorageId && iLanguage >= ELangTest  );
+    
+    }
+
+
+// ---------------------------------------------------------------------------
+// CBSImportStorage::VerifyDataL
+// ---------------------------------------------------------------------------
+//
+TBool CBSImportStorage::VerifyDataL( TArray<MBSElement*> aArray, 
+                                     TBool aIgnoreEmptyID /* = EFalse */ )
+    {
+    // Check that elements have unique ID's in their own namespace
+    TInt count = aArray.Count();
+    for( TInt i = 0; i < count; i++ )
+        {
+        // Verify inside list elements
+        if( aArray[i]->ElementType() == EBSList )
+            {
+            if( !VerifyDataL( aArray[i]->GetStructureL(), ETrue ) )
+                {
+                return false;
+                }
+            }
+
+        if( aIgnoreEmptyID && 
+            aArray[i]->ElementId().CompareC( KNullDesC8() ) == 0 )
+            {
+            // ignore empty id
+            continue;
+            }
+        
+        // Check that sibling elements have unique ID
+        for( TInt j = i + 1; j < count; j++ ) 
+            {
+            if( aArray[i]->ElementId().CompareC( aArray[j]->ElementId() ) == 0 )
+                {
+                // convert elementID to 16-bit for event logger
+                TPtrC8 id( aArray[i]->ElementId() );
+                HBufC* conv = HBufC::NewLC( id.Length() );
+                TPtr uniptr( conv->Des() );
+                CnvUtfConverter::ConvertToUnicodeFromUtf8( uniptr, id );                
+                IMPORT_DP( D_IMPORT_LIT("ERROR: Found duplicate element ID (%S)!"), &uniptr );
+                CleanupStack::PopAndDestroy();
+                return false;
+                }
+            }
+        }
+    
+    // All elements ok
+    return true;
+    }
+
+// ---------------------------------------------------------------------------
+// CBSImportStorage::Compare
+// ---------------------------------------------------------------------------
+//
+TInt CBSImportStorage::Compare( const CBSImportStorage* aStorage ) const
+    {
+    if( iVersion != aStorage->iVersion || iLanguage != aStorage->iLanguage )
+        {
+        // no match
+        return EFalse;
+        }
+    if( iAppId->Compare( aStorage->iAppId->Des() ) != 0 )
+        {
+        // no match
+        return EFalse;
+        }
+    if( iStorageId->Compare( aStorage->iStorageId->Des() ) != 0 )
+        {
+        // no match
+        return EFalse;
+        }
+    // they match
+    return ETrue;
+    }
+    
+// ---------------------------------------------------------------------------
+// CBSImportStorage::TakeElementsL
+// ---------------------------------------------------------------------------
+//
+void CBSImportStorage::TakeElements( CBSImportStorage* aStorage )
+    {
+    TInt count = aStorage->iElements.Count();
+    for( TInt i = 0; i < count; i++ )
+        {
+        iElements.Append( aStorage->iElements[i] );
+        }
+    aStorage->iElements.Reset();
+    }
+    
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/brandingserver/tools/bsimport/src/cbsimportstoragemanager.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,159 @@
+/*
+* Copyright (c) 2006-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:  Stores element data and writes it to stream
+*
+*/
+
+
+#include <s32strm.h>
+#include <s32file.h>
+#include <f32file.h>
+#include <bautils.h>
+#include <cbsfactory.h>
+#include <mbsupdater.h>
+
+#include "cbsimportstoragemanager.h"
+#include "cbsimportstorage.h"
+#include "importlogwriter.h"
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// CBSImportStorageManager::NewL
+// ---------------------------------------------------------------------------
+//
+CBSImportStorageManager* CBSImportStorageManager::NewL()
+    {
+    CBSImportStorageManager* self = NewLC();
+    CleanupStack::Pop();
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CBSImportStorageManager::NewLC
+// ---------------------------------------------------------------------------
+//
+CBSImportStorageManager* CBSImportStorageManager::NewLC()
+    {
+    CBSImportStorageManager* self = 
+        new (ELeave) CBSImportStorageManager();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CBSImportStorageManager::ConstructL
+// ---------------------------------------------------------------------------
+//
+void CBSImportStorageManager::ConstructL()
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// CBSImportStorageManager::CBSImportStorageManager
+// ---------------------------------------------------------------------------
+//
+CBSImportStorageManager::CBSImportStorageManager() : 
+    iCurrent( KErrNotFound )
+    {
+    }
+    
+// ---------------------------------------------------------------------------
+// CBSImportStorageManager::~CBSImportStorageManager
+// ---------------------------------------------------------------------------
+//
+CBSImportStorageManager::~CBSImportStorageManager()
+    {
+    iStorages.ResetAndDestroy();
+    }
+
+// ---------------------------------------------------------------------------
+// CBSImportStorageManager::CreateStorageL
+// ---------------------------------------------------------------------------
+//
+void CBSImportStorageManager::CreateStorageL()
+    {
+    CBSImportStorage* tmp = CBSImportStorage::NewL();
+    iStorages.Append( tmp );
+    iCurrent = iStorages.Find( tmp );
+    }
+
+// ---------------------------------------------------------------------------
+// CBSImportStorageManager::StorageCount
+// ---------------------------------------------------------------------------
+//
+TInt CBSImportStorageManager::StorageCount()
+    {
+    return iStorages.Count();
+    }
+
+// ---------------------------------------------------------------------------
+// CBSImportStorageManager::Storage
+// ---------------------------------------------------------------------------
+//
+CBSImportStorage* CBSImportStorageManager::Storage( TInt aIndex )
+    {
+    return iStorages[ aIndex ];
+    }
+
+// ---------------------------------------------------------------------------
+// CBSImportStorageManager::Storage
+// ---------------------------------------------------------------------------
+//
+CBSImportStorage* CBSImportStorageManager::Storage()
+    {
+    return iStorages[ iCurrent ];
+    }
+
+// ---------------------------------------------------------------------------
+// CBSImportStorageManager::WriteDataToServerL
+// ---------------------------------------------------------------------------
+//
+void CBSImportStorageManager::WriteDataToServerL()
+    {
+    // Merge storages
+    MergeStorages();
+    
+    // Flush each storage
+    TInt count = iStorages.Count();
+    for( TInt i = 0; i < count; i++ )
+        {
+        iStorages[i]->FlushToServerL();
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CBSImportStorageManager::MergeStoragesL
+// ---------------------------------------------------------------------------
+//
+void CBSImportStorageManager::MergeStorages()
+    {
+    for( TInt i = 0; i < iStorages.Count(); i++ )
+        {
+        for( TInt j = i + 1; j < iStorages.Count(); j++ )
+            {
+            if( iStorages[i]->Compare( iStorages[j] ) )
+                {
+                // they have same header data -> merge them
+                iStorages[i]->TakeElements( iStorages[j] );
+                delete iStorages[j];
+                iStorages.Remove( j );
+                j--; // correct index
+                }
+            }
+        }
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/brandingserver/tools/bsimport/src/cbsimportxmlparser.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,779 @@
+/*
+* Copyright (c) 2006-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:  Parses XML content and stores data to storage
+*
+*/
+
+
+#include <e32cons.h>
+#include <gmxmlelement.h>
+#include <gmxmltext.h>
+#include <utf.h>
+#include <AknUtils.h>
+#include <bselementfactory.h>
+#include <cbsbitmap.h>
+
+#include "cbsimportxmlparser.h"
+#include "cbsimportstoragemanager.h"
+#include "cbsimportstorage.h"
+#include "cbsimportconstants.h"
+#include "importlogwriter.h"
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// CBSImportXMLParser::NewL
+// ---------------------------------------------------------------------------
+//
+CBSImportXMLParser* CBSImportXMLParser::NewL( CBSImportStorageManager* aStorage )
+    {
+    CBSImportXMLParser* self = NewLC( aStorage );
+    CleanupStack::Pop();
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CBSImportXMLParser::NewLC
+// ---------------------------------------------------------------------------
+//
+CBSImportXMLParser* CBSImportXMLParser::NewLC( CBSImportStorageManager* aStorage )
+    {
+    CBSImportXMLParser* self = new (ELeave) CBSImportXMLParser( aStorage );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CBSImportXMLParser::ConstructL
+// ---------------------------------------------------------------------------
+//
+void CBSImportXMLParser::ConstructL()
+    {
+    }
+    
+// ---------------------------------------------------------------------------
+// CBSImportXMLParser::~CBSImportXMLParser
+// ---------------------------------------------------------------------------
+//
+CBSImportXMLParser::~CBSImportXMLParser()
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// CBSImportXMLParser::CBSImportXMLParser
+// ---------------------------------------------------------------------------
+//
+CBSImportXMLParser::CBSImportXMLParser( CBSImportStorageManager* aStorage ) :
+    iStorage( aStorage )
+    {
+    }
+    
+// ---------------------------------------------------------------------------
+// CBSImportXMLParser::ParseDocumentL
+// ---------------------------------------------------------------------------
+//
+void CBSImportXMLParser::ParseDocumentL( CMDXMLDocument& aDocument )
+    {
+    if( !iStorage )
+        {
+        // No storage --> can't continue
+        User::Leave( KErrNotReady );
+        }
+
+    CMDXMLElement* element = aDocument.DocumentElement();
+    ParseDocumentBaseL( element );
+    }
+
+// ---------------------------------------------------------------------------
+// CBSImportXMLParser::ParseDocumentBaseL
+// ---------------------------------------------------------------------------
+//
+void CBSImportXMLParser::ParseDocumentBaseL( CMDXMLNode* aElement )
+    {
+    if( aElement->HasChildNodes() )
+        {
+        // Verify that <branding> element is the first one
+        CMDXMLNode* brandingNode = aElement->FirstChild();
+        if( !brandingNode->HasChildNodes() )
+            {
+            IMPORT_DP_TXT("ERROR: empty <branding> tag found" );
+            User::Leave( KErrCorrupt ); 
+            }
+
+        // Parse through all <brand> elements
+        CMDXMLNode* brandNode = brandingNode->FirstChild();
+        while( brandNode )
+            {
+            if( 0 == brandNode->NodeName().CompareC( KBrandTag ) )
+                {
+                if( !brandNode->HasChildNodes() )
+                    {
+                    IMPORT_DP_TXT("ERROR: empty <brand> tag found" );
+                    User::Leave( KErrCorrupt ); 
+                    }
+
+                // Create a new storage for each <brand> element
+                iStorage->CreateStorageL();
+
+                // Scan through all elements inside <brand> tags
+                // and store them to storage
+                CMDXMLNode* kidNode = brandNode->FirstChild();
+                while( kidNode )
+                    {
+                    TRAPD( err, AnalyzeNodeL( kidNode ) );
+                    if( err )
+                        {
+                        IMPORT_DP( D_IMPORT_LIT("ERROR: Error parsing content of <brand> (%d)"), err );
+                        User::Leave( err ); 
+                        }
+                    kidNode = kidNode->NextSibling();
+                    }
+                }
+            
+            // move to next brand package
+            brandNode = brandNode->NextSibling();
+            }
+        }
+    else
+        {
+        // no elements in file --> corrupt
+        IMPORT_DP_TXT("ERROR: Empty XML content" );
+        User::Leave( KErrCorrupt ); 
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CBSImportXMLParser::AnalyzeNodeL
+// ---------------------------------------------------------------------------
+//
+void CBSImportXMLParser::AnalyzeNodeL( CMDXMLNode* aNode )
+    {
+    switch( SolveTagTypeL( aNode ) )
+        {
+        case EBrandID:
+            {
+            if( aNode->HasChildNodes() )
+                {
+                HBufC* id = NodeTextLC( aNode );
+                iStorage->Storage()->SetStorageIdL( *id );
+                CleanupStack::PopAndDestroy();
+                }
+            else
+                {
+                IMPORT_DP_TXT("WARNING: BrandID has no value" );
+                User::Leave( KErrNotFound ); 
+                }
+            break;
+            }
+        case EBrandAppID:
+            {
+            if( aNode->HasChildNodes() )
+                {
+                HBufC* id = NodeTextLC( aNode );
+                iStorage->Storage()->SetApplicationIdL( *id );
+                CleanupStack::PopAndDestroy();
+                }
+            else
+                {
+                IMPORT_DP_TXT("WARNING: ApplicationID has no value" );
+                User::Leave( KErrNotFound ); 
+                }
+            break;
+            }
+        case EBrandLanguage:
+            {
+            if( aNode->HasChildNodes() )
+                {
+                TInt lang = ELangTest;
+                TRAPD( err, lang = NodeIntL( aNode ) );
+                if( err )
+                    {
+                    // not a number. Check if language is "SC"
+                    HBufC* langBuf = NodeTextLC( aNode );
+                    TPtr langText( langBuf->Des() );
+                    langText.UpperCase();
+                    if( 0 != langText.CompareC( KDefaultLanguage ) ) 
+                        {
+                        IMPORT_DP_TXT("ERROR: Language field has invalid value (has to be a number or 'SC')" );
+                        User::Leave( KErrArgument );
+                        }
+                    CleanupStack::PopAndDestroy( langBuf );
+                    }
+                iStorage->Storage()->SetLanguageL( (TLanguage)lang );
+                }
+            else
+                {
+                IMPORT_DP_TXT("WARNING: Language field has no value" );
+                User::Leave( KErrNotFound ); 
+                }
+            break;
+            }
+        case EBrandVersion:
+            {
+            if( aNode->HasChildNodes() )
+                {
+                iStorage->Storage()->SetVersion( NodeIntL( aNode ) );
+                }
+            else
+                {
+                IMPORT_DP_TXT("WARNING: Version field has no value" );
+                User::Leave( KErrNotFound ); 
+                }
+            break;
+            }
+        case EBrandElement:
+            {
+            if( aNode->HasChildNodes() )
+                {
+                iStorage->Storage()->AppendElement( ParseBrandElementL( aNode ) );
+                }
+            else
+                {
+                IMPORT_DP_TXT("WARNING: Empty <element> tag found" );
+                User::Leave( KErrNotFound ); 
+                }
+            break;
+            }
+        case EBrandUnknown: // flowthrough
+        default:
+            {
+            TPtrC ptr( aNode->NodeName() );
+            IMPORT_DP( D_IMPORT_LIT("WARNING: Unknown XML tag encountered: <%S>"), &ptr );
+            break;
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CBSImportXMLParser::SolveTagTypeL
+// ---------------------------------------------------------------------------
+//
+CBSImportXMLParser::TXMLBaseTagTypes CBSImportXMLParser::SolveTagTypeL( CMDXMLNode* aNode )
+    {
+    TPtrC node( aNode->NodeName() );
+    if( 0 == node.CompareF( KBrandElementTag ) )
+        return EBrandElement;
+    
+    if( 0 == node.CompareF( KBrandIDTag ) )
+        return EBrandID;
+
+    if( 0 == node.CompareF( KBrandLanguageTag ) )
+        return EBrandLanguage;
+
+    if( 0 == node.CompareF( KBrandVersionTag ) )
+        return EBrandVersion;
+    
+    if( 0 == node.CompareF( KBrandAppIdTag ) )
+        return EBrandAppID;
+    
+    return EBrandUnknown;
+    }
+
+// ---------------------------------------------------------------------------
+// CBSImportXMLParser::ParseBrandElementL
+// ---------------------------------------------------------------------------
+//
+MBSElement* CBSImportXMLParser::ParseBrandElementL( CMDXMLNode* aNode )
+    {
+    if( !aNode->HasChildNodes() || 
+        0 != aNode->NodeName().CompareC( KBrandElementTag ))
+        {
+        // invalid element block
+        User::Leave( KErrCorrupt );
+        }
+    
+    // Check <element> tag attributes
+    CMDXMLElement* elNode = (CMDXMLElement*)(aNode);
+    TInt elType( KErrNotFound );
+    HBufC8* elID = NULL;
+    TInt attrNum = elNode->NumAttributes();
+    for( TInt i = 0; i < attrNum; i++ )
+        {
+        TPtrC name;
+        TPtrC value;
+        elNode->AttributeDetails( i, name, value );
+        
+        // <element ... type="xxx" ...>
+        if( 0 == name.CompareC( KElementTypeName ) ) 
+            {
+            elType = SolveElementType( value );
+            }
+        // <element ... id="xxx" ...>
+        else if( 0 == name.CompareC( KElementTypeID ) && !elID )
+            {
+            elID = HBufC8::NewL( value.Length() );
+            CleanupStack::PushL( elID );
+            TPtr8 ptrID( elID->Des() );
+            CnvUtfConverter::ConvertFromUnicodeToUtf8( ptrID, value );
+            }
+        }
+    
+    // Verify type
+    if( elType == KErrNotFound )
+        {
+        // Element type missing!
+        IMPORT_DP_TXT("ERROR: Element's 'type' attribute is missing!" );
+        User::Leave( KErrCorrupt );
+        }
+    
+    // Create empty ID if element didn't have one
+    if( !elID )
+        {
+        elID = KNullDesC8().AllocL();
+        CleanupStack::PushL( elID );
+        }
+    
+    // Parse element according to type
+    MBSElement* elem = NULL;
+    switch( elType )
+        {
+        case EBSInt:
+            {
+            TInt intValue;
+            TRAPD( err, DoParseIntegerL( elNode, intValue ) )
+            if( !err )
+                {
+                TPtr8 ptr( elID->Des() );
+                // Codescanner warning: neglected to put variable on cleanup stack (id:35)
+                // This method cannot leave after this line
+                elem = BSElementFactory::CreateBSElementL( ptr, EBSInt, intValue ); // CSI: 35 # See above
+                }
+            else
+                {
+                IMPORT_DP_TXT("ERROR: Invalid value in integer element!" );
+                User::Leave( err );
+                }
+            break;
+            }
+        case EBSFile:
+            {
+            HBufC* text = NULL;
+            TRAPD( err, DoParseFileL( elNode, text ) )
+            if( !err )
+                {
+                TPtr8 ptr( elID->Des() );
+                CleanupStack::PushL( text );
+                elem = BSElementFactory::CreateBSElementL( ptr, EBSFile, *text );
+                CleanupStack::PopAndDestroy( text );
+                }
+            else
+                {
+                IMPORT_DP_TXT("ERROR: Invalid value in file element!" );
+                User::Leave( err );
+                }
+
+            break;
+            }
+        case EBSBuffer:
+        case EBSText:
+            {
+            HBufC* text = NULL;
+            TRAPD( err, DoParseTextL( elNode, text ) )
+            if( !err )
+                {
+                TPtr8 ptr( elID->Des() );
+                CleanupStack::PushL( text );
+                
+                if( EBSText == elType ) // 16-bit descriptor
+                    {
+                    // Element takes ownership of text
+                    elem = BSElementFactory::CreateBSElementL( ptr, EBSText, *text );
+                    }
+                else // EBuffer: 8-bit descriptor
+                    {
+                    // convert to 8-bit
+                    HBufC8* conv = HBufC8::NewLC( text->Length() );
+                    TPtr8 ptrconv( conv->Des() );
+                    CnvUtfConverter::ConvertFromUnicodeToUtf8( ptrconv, *text );
+                    elem = BSElementFactory::CreateBSElementL( ptr, EBSBuffer, *conv );
+                    CleanupStack::PopAndDestroy( conv );
+                    }
+                CleanupStack::PopAndDestroy( text );
+                }
+            else
+                {
+                // Error parsing text element
+                IMPORT_DP_TXT("ERROR: Invalid value in text element!" );
+                User::Leave( err );
+                }
+            break;
+            }
+        case EBSList:
+            {
+            RBSObjOwningPtrArray<MBSElement> elementArray;
+            CleanupClosePushL( elementArray );
+            TRAPD( err, DoParseListL( aNode, elementArray ) );
+            if( !err )
+                {
+                // Create list element
+                TPtr8 ptr( elID->Des() );
+                // Codescanner warning: neglected to put variable on cleanup stack (id:35)
+                // This method cannot leave after this line
+                elem = BSElementFactory::CreateBSElementL( ptr, EBSList, elementArray ); // CSI: 35 # See above
+                CleanupStack::Pop(); // elementArray
+                }
+            else
+                {
+                IMPORT_DP_TXT("ERROR: List element parse failed!" );
+                User::Leave( err );
+                }
+            break;
+            }
+        case EBSBitmap:
+            {
+            CBSBitmap* bitmap = NULL;
+            TRAPD( err, DoParseBitmapL( elNode, bitmap ) )
+            if( !err )
+                {
+                CleanupStack::PushL( bitmap );
+                // Create list element
+                TPtr8 ptr( elID->Des() );
+                elem = BSElementFactory::CreateBSElementL( ptr, EBSBitmap, bitmap );
+                CleanupStack::Pop( bitmap );
+                }
+            break;
+            }
+        default:
+            {
+            // Invalid element type
+            break;
+            }
+        }
+
+    // return parsed element
+    CleanupStack::PopAndDestroy( elID );
+    return elem;
+    }
+
+// ---------------------------------------------------------------------------
+// CBSImportXMLParser::SolveElementType
+// ---------------------------------------------------------------------------
+//
+TInt CBSImportXMLParser::SolveElementType( const TDesC& aType )
+    {
+    if( 0 == aType.CompareC( KElementTypeList ) )
+        return EBSList;
+
+    if( 0 == aType.CompareC( KElementTypeBitmap ) )
+        return EBSBitmap;
+
+    if( 0 == aType.CompareC( KElementTypeBuffer ) )
+        return EBSBuffer;
+
+    if( 0 == aType.CompareC( KElementTypeInt ) )
+        return EBSInt;
+    
+    if( 0 == aType.CompareC( KElementTypeText ) )
+        return EBSText;
+    
+    if( 0 == aType.CompareC( KElementTypeFile ) )
+        return EBSFile;
+    
+    return KErrNotFound;
+    }
+
+// ---------------------------------------------------------------------------
+// CBSImportXMLParser::DoParseIntegerL
+// ---------------------------------------------------------------------------
+//
+void CBSImportXMLParser::DoParseIntegerL( CMDXMLNode* aNode, TInt& aValue )
+    {
+    // Integer element has only one child element. e.g:
+    // <element_value>
+    //  12345
+    // </element_value>
+    //
+    CMDXMLNode* kidNode = aNode->FirstChild();
+    while( kidNode )
+        {
+        if( 0 == KElementValueTag().CompareC( kidNode->NodeName() ) )
+            {
+            aValue = NodeIntL( kidNode );
+            return;
+            }
+        kidNode = kidNode->NextSibling();
+        }
+    User::Leave( KErrNotFound );
+    }
+
+// ---------------------------------------------------------------------------
+// CBSImportXMLParser::DoParseTextL
+// ---------------------------------------------------------------------------
+//
+void CBSImportXMLParser::DoParseTextL( CMDXMLNode* aNode, HBufC*& aText )
+    {
+    // Text element has only one valuable child element. e.g:
+    // <element_value>
+    //  some important text
+    // </element_value>
+    //
+    CMDXMLNode* kidNode = SearchChild( aNode, KElementValueTag );
+    if( kidNode )
+        {
+        aText = NodeTextLC( kidNode );
+        CleanupStack::Pop( aText );
+        return;
+        }
+    
+    // didn't find a valid value
+    IMPORT_DP_TXT( "ERROR: Text element is missing it's value" );
+    User::Leave( KErrNotFound );
+    }
+
+// ---------------------------------------------------------------------------
+// CBSImportXMLParser::DoParseFileL
+// ---------------------------------------------------------------------------
+//
+void CBSImportXMLParser::DoParseFileL( CMDXMLNode* aNode, HBufC*& aText )
+    {
+    // File element has only one valuable text value element. e.g:
+    // <element_value>
+    //   <file_name> c:\data\file.txt </file_name>
+    // </element_value>
+    //
+    CMDXMLNode* kidNode = SearchChild( aNode, KElementValueTag );
+    if( kidNode )
+        {
+        // check <file_name> tag
+        CMDXMLNode* subKidNode = SearchChild( kidNode, KFileFileNameTag );
+        if( subKidNode )
+            {
+            // Get filename from tag
+            aText = NodeTextLC( subKidNode );
+            CleanupStack::Pop( aText );
+            return;
+            }
+        }
+
+    // didn't find a valid value
+    IMPORT_DP_TXT( "ERROR: File element is missing it's value" );
+    User::Leave( KErrNotFound );
+    }
+
+// ---------------------------------------------------------------------------
+// CBSImportXMLParser::DoParseListL
+// ---------------------------------------------------------------------------
+//
+void CBSImportXMLParser::DoParseListL( 
+    CMDXMLNode* aNode, 
+    RBSObjOwningPtrArray<MBSElement>& aElementArray )
+    {
+    // Scan trough elements inside this list element
+    // <element_value>
+    //  <element ...>
+    //   ...
+    //  </element>
+    //  <element ...>
+    //   ...
+    //  </element>
+    // </element_value>
+    //
+    CMDXMLNode* kidNode = SearchChild( aNode, KElementValueTag );
+    if( kidNode )
+        {
+        CMDXMLNode* subKidNode = kidNode->FirstChild();
+        while( subKidNode )
+            {
+            // verify that this really is <element> node.
+            if( 0 == subKidNode->NodeName().CompareC( KBrandElementTag ) )
+                {
+                MBSElement* el = ParseBrandElementL( subKidNode );
+                if( el )
+                    {
+                    aElementArray.Append( el );
+                    }
+                }
+            subKidNode = subKidNode->NextSibling();
+            }
+        }
+    else
+        {
+        // No elements found inside list!
+        IMPORT_DP_TXT( "ERROR: List element is missing it's value" );
+        User::Leave( KErrNotFound );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CBSImportXMLParser::DoParseBitmapL
+// ---------------------------------------------------------------------------
+//
+void CBSImportXMLParser::DoParseBitmapL( 
+    CMDXMLNode* aNode, 
+    CBSBitmap*& aBitmap )
+    {
+/// XSP MOD: added support for <bitmap_file_id>
+    // Bitmap element has 5 child elements. e.g:
+    // <element_value>
+    //  <bitmap_file_id>
+    //  <bitmap_id> 65 </bitmap_id>
+    //  <mask_id> 66 </mask_id>
+    //  <skin_id_major> 190 </skin_id_major>
+    //  <skin_id_minor> 191 </skin_id_minor>
+    // </element_value>
+    //
+    TInt bmpId = KErrNotFound;
+    TInt bmpMaskId = KErrNotFound;
+    TInt skinId = KErrNotFound;
+    TInt skinMaskId = KErrNotFound;
+    HBufC8* fileId = NULL;
+    
+    CMDXMLNode* kidNode = SearchChild( aNode, KElementValueTag );
+    if( kidNode )
+        {
+        CMDXMLNode* subKidNode = kidNode->FirstChild();
+        TInt readCheck = 0;
+        while( subKidNode )
+            {
+            TPtrC ptr = subKidNode->NodeName();
+            if( 0 == KBitmapIdTag().CompareC( subKidNode->NodeName() ) )
+                {
+                bmpId = NodeIntL( subKidNode );
+                readCheck |= 0x1;
+                }
+            else if( 0 == KBitmapMaskIdTag().CompareC( subKidNode->NodeName() ) )
+                {
+                bmpMaskId = NodeIntL( subKidNode );
+                readCheck |= 0x2;
+                }
+            else if( 0 == KBitmapSkinIdTag().CompareC( subKidNode->NodeName() ) )
+                {
+                skinId = NodeIntL( subKidNode );
+                readCheck |= 0x4;
+                }
+            else if( 0 == KBitmapSkinMaskIdTag().CompareC( subKidNode->NodeName() ) )
+                {
+                skinMaskId = NodeIntL( subKidNode );
+                readCheck |= 0x8;
+                }
+/// XSP MOD: added support for madatory KBitmapFileIdTag field                
+            else if( 0 == KBitmapFileIdTag().CompareC( subKidNode->NodeName() ) )
+                {
+                // Ignore following file id elements if 
+                // bitmap element has more than one of them.
+                if ( !fileId )
+                    {
+                    HBufC* tmp = NodeTextLC( subKidNode );
+                	fileId = CnvUtfConverter::ConvertFromUnicodeToUtf8L( *tmp );
+                	CleanupStack::PopAndDestroy( tmp );
+                	tmp = NULL;
+                    CleanupStack::PushL( fileId );
+                    readCheck |= 0x10;
+                    }
+                }
+
+            subKidNode = subKidNode->NextSibling();
+            }
+        
+        if( readCheck != 0x1F )/// XSP MOD:check that all 5 values were found
+            {
+            // Some bitmap elements are missing!
+            IMPORT_DP_TXT( "ERROR: Bitmap element is missing some mandatory values" );
+            User::Leave( KErrNotFound );
+            }
+        
+        // create bitmap
+        TPtrC8 pFileId( KNullDesC8 );
+        if ( fileId )
+            {
+            pFileId.Set( *fileId );
+            }
+        aBitmap = CBSBitmap::NewL( bmpId, bmpMaskId, skinId, skinMaskId, pFileId );
+        if ( fileId )
+            {
+            CleanupStack::PopAndDestroy( fileId );
+            fileId = NULL;
+            }
+        }
+    else
+        {
+        IMPORT_DP_TXT( "ERROR: Bitmap element is missing it's value" );
+        User::Leave( KErrNotFound );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CBSImportXMLParser::NodeTextLC
+// ---------------------------------------------------------------------------
+//
+HBufC* CBSImportXMLParser::NodeTextLC( CMDXMLNode* aNode )
+    {
+    CMDXMLNode* kidNode = aNode->FirstChild();
+    if( !kidNode )
+        {
+        // empty content
+        return KNullDesC().AllocLC();
+        }
+        
+    if( kidNode->HasChildNodes() )
+        {
+        // not a valid text element!
+        User::Leave( KErrCorrupt );        
+        }
+
+    HBufC* text = static_cast<CMDXMLText*>(kidNode)->Data().AllocL();
+    CleanupStack::PushL( text );
+    
+    // Remove extra characters from text
+    TPtr ptr( text->Des() );
+    AknTextUtils::StripCharacters( ptr, KCommonControlCharacters );
+    ptr.TrimAll();
+    
+    return text;
+    }
+
+// ---------------------------------------------------------------------------
+// CBSImportXMLParser::NodeIntL
+// ---------------------------------------------------------------------------
+//
+TInt CBSImportXMLParser::NodeIntL( CMDXMLNode* aNode )
+    {
+    CMDXMLNode* kidNode = aNode->FirstChild();
+    if( !kidNode || kidNode->HasChildNodes() )
+        {
+        // not a valid text element!
+        User::Leave( KErrCorrupt );        
+        }
+
+    TLex lex( static_cast<CMDXMLText*>(kidNode)->Data() );
+    TInt value;
+    User::LeaveIfError( lex.Val( value ) );
+    return value;
+    }
+
+// ---------------------------------------------------------------------------
+// CBSImportXMLParser::FindTag
+// ---------------------------------------------------------------------------
+//
+CMDXMLNode* CBSImportXMLParser::SearchChild( CMDXMLNode* aNode, const TDesC& aChildName )
+    {
+    if( aNode->HasChildNodes() )
+        {
+        CMDXMLNode* kidNode = aNode->FirstChild();
+        while( kidNode )
+            {
+            if( 0 == aChildName.CompareC( kidNode->NodeName() ) )
+                {
+                // found it
+                return kidNode;
+                }
+            kidNode = kidNode->NextSibling();
+            }
+        }
+    // not found
+    return NULL;
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/brandingserver/tools/bsimport/src/importer.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,234 @@
+/*
+* Copyright (c) 2006-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:  Global methods for brandimporter
+*
+*/
+
+
+#include <e32base.h>
+#include <e32cons.h>
+#include <bacline.h>
+#include <badesca.h>
+
+#include "cbsimportmanager.h"
+#include "importlogwriter.h"
+
+namespace
+{
+
+// CONSTANTS
+//
+_LIT( KProcessName,         "BSImport" );
+_LIT( KTxtTitle,            "BrandServer XML importer" );
+_LIT( KTxtFormatFailed,     "\nimport failed: leave code = %d" );
+_LIT( KTxtOK,               "\nok");
+_LIT( KTxtPressAnyKey,      "\n [press any key]" );
+_LIT( KInstallFiles,        "*.xml");
+_LIT( KDirSeparator,        "\\" );
+
+// SETTING SWITCHES (use uppercase)
+//
+_LIT( KInputDir,           "-D" );
+
+}
+
+// ======== GLOBAL FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// DeleteRPtrArray
+// ---------------------------------------------------------------------------
+//
+LOCAL_C void DeleteRPtrArray( TAny* aArray )
+    {
+    RPointerArray<HBufC>* array = static_cast< RPointerArray<HBufC>* >(aArray);
+    TInt count = array->Count();
+    for( TInt i = 0; i < count; i++ )
+        {
+        delete (*array)[i];
+        }
+    array->Reset();
+    }
+    
+// ---------------------------------------------------------------------------
+// ParseInstallableBrandsL
+// ---------------------------------------------------------------------------
+//
+LOCAL_C void ParseInstallableBrandsL( RFs& aFs, 
+                                      RPointerArray<HBufC>& aFiles, 
+                                      const TDesC& aDirectory )
+    {
+    // list import content
+    TParse file;
+    file.Set( KInstallFiles, &aDirectory, NULL );
+    
+    CDir* dir = NULL;
+    User::LeaveIfError( 
+        aFs.GetDir( file.FullName(), KEntryAttNormal, ESortNone, dir ) );
+    CleanupStack::PushL( dir );
+    
+    // create array of files (with full path)
+    TInt count = dir->Count();
+    for( TInt i = 0; i < count; i++ )
+        {
+        file.Set( (*dir)[i].iName, &aDirectory, NULL );
+        aFiles.Append( file.FullName().AllocL() );
+        }
+
+    CleanupStack::PopAndDestroy( dir );
+    }
+
+// ---------------------------------------------------------------------------
+// ParseCommandLineArgumentsL
+// ---------------------------------------------------------------------------
+//
+LOCAL_C void ParseCommandLineArgumentsL( RPointerArray<HBufC>& aFiles, 
+                                         CConsoleBase* aConsole )
+    {
+	// Get arguments
+	CCommandLineArguments *pCmd = CCommandLineArguments::NewL();
+    CleanupStack::PushL( pCmd );
+
+	// check arguments
+	if( pCmd->Count() == 1 )
+	    {
+    	aConsole->Printf( _L("Error: No files to import!\nGive import files as arguments") ); // CSI: 78 # See above
+    	aConsole->Printf( KTxtPressAnyKey );
+    	aConsole->Getch();
+    	User::Leave( KErrArgument );
+	    }
+
+    // open file session
+    // Codescanner warning: use of non-pointer/reference RFs
+    // this code cannot get file server handle from anywhere so it has to be created here
+    RFs fs; // CSI: 76 # See above
+    User::LeaveIfError( fs.Connect() );
+    CleanupClosePushL( fs );
+	    
+	// Check all arguments for switches
+	// Skip first argument since it only contains the name of the executable
+	TInt i = 0;
+	while( ++i < pCmd->Count() )
+	    {
+        RBuf arg;
+	    arg.CreateL( pCmd->Arg( i ) );
+	    arg.CleanupClosePushL();
+	    arg.UpperCase();
+	    
+		// Input directory: "-D [directory]"
+		if ( arg.CompareF( KInputDir ) == 0 ) 
+			{
+            if( pCmd->Count() > i + 1 )
+                {
+                // get all files from given directory
+                TPath path( pCmd->Arg( i + 1 ) );
+                if( path.Right( 1 ).Compare( KDirSeparator ) != 0 )
+                    {
+                    path.Append( KDirSeparator );
+                    }
+                ParseInstallableBrandsL( fs, aFiles, path );
+                i++; // skip to next argument
+                }
+            else
+                {
+                // no content after -d switch
+    			aConsole->Printf( _L("Argument missing after '-d' switch") ); // CSI: 78 # debug print
+    			aConsole->Printf( KTxtPressAnyKey );
+    			aConsole->Getch();
+    			User::Leave( KErrArgument );
+                }
+			}
+	    else  // argument is just plain file - add it.
+	        {
+	        aFiles.Append( pCmd->Arg( i ).AllocL() );
+	        }
+	    
+	    CleanupStack::PopAndDestroy(); // arg
+	    }
+
+    CleanupStack::PopAndDestroy( 2 ); // pCmd, fs
+    }
+
+// ---------------------------------------------------------------------------
+// MainL
+// ---------------------------------------------------------------------------
+//
+LOCAL_C void MainL( CConsoleBase* aConsole )
+    {
+    // Read settings
+    RPointerArray<HBufC> files;
+    CleanupStack::PushL( TCleanupItem( DeleteRPtrArray, &files ) );
+    ParseCommandLineArgumentsL( files, aConsole );
+
+    // convert PointerArray to MDesCArray
+    TInt count = files.Count();
+    CDesCArrayFlat* importArray = new (ELeave) CDesCArrayFlat( count );
+    CleanupStack::PushL( importArray );
+    for( TInt i = 0; i < count; i++ )
+        {
+        importArray->AppendL( files[i]->Des() );
+        }
+            
+    // Do import
+    CBSImportManager* importer = CBSImportManager::NewLC();
+    importer->ImportFileL( *importArray );
+    CleanupStack::PopAndDestroy( 3 ); //importer, importarray, files
+	} 
+
+// ---------------------------------------------------------------------------
+// doMainL
+// ---------------------------------------------------------------------------
+//
+LOCAL_C TInt doMainL()
+    {
+	CConsoleBase* console = Console::NewL( KTxtTitle, TSize( KConsFullScreen, KConsFullScreen ) );
+	CleanupStack::PushL( console );
+	TRAPD( error, MainL( console ) );
+	if( error )
+	    {
+	    IMPORT_DP( D_IMPORT_LIT( "ERROR importing brand: %d" ), error );
+		console->Printf( KTxtFormatFailed, error );
+	    }
+	else
+        {
+    	console->Printf( KTxtOK );
+        }
+	
+	// Pause for development use. 
+	// Disable this when releasing
+	//-----------------------------------------------------
+	console->Printf( KTxtPressAnyKey );
+	//-----------------------------------------------------
+	
+	CleanupStack::PopAndDestroy(); // console
+    return error;
+    }
+
+// ---------------------------------------------------------------------------
+// Main function of the application executable.
+// ---------------------------------------------------------------------------
+//
+GLDEF_C TInt E32Main()
+    {
+	__UHEAP_MARK;
+    IMPORT_DP_TXT("----- NEW IMPORT SESSION ------( IMPORTER )---");
+	CTrapCleanup* cleanup = CTrapCleanup::New();
+	TInt returnCode( KErrNone );
+    User::RenameThread( KProcessName );
+	TRAPD( error, returnCode = doMainL() );
+    IMPORT_DP_TXT("-----------------------------------------------");
+	__ASSERT_ALWAYS( !error, User::Panic( KProcessName, error ) );
+	delete cleanup;
+	__UHEAP_MARKEND;
+	return returnCode;
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/brandingserver/tools/bsimport/src/installer.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,265 @@
+/*
+* Copyright (c) 2006-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:  Global methods for brandinstaller
+*
+*/
+
+
+#include <e32base.h>
+#include <eikenv.h>
+#include <f32file.h>
+#include <e32property.h>
+#include <bautils.h>
+
+#include "cbsimportmanager.h"
+#include "importlogwriter.h"
+#include "bsbrandremover.h"
+
+namespace
+{
+
+// CONSTANTS
+//
+_LIT( KProcessName,         "BSInstall" );
+
+// Search these files for processing
+_LIT( KInstallFiles,        "*.xml" );
+
+// Path to installed xml files inside own private folder. 
+_LIT( KInstallPath,         "import\\" );
+_LIT( KInstallDrive,        "C:" );
+
+// separators for uninstalled brands
+_LIT( KLineFeed,            "\n" );
+_LIT( KBrandSeparator,      "$" );
+
+// Pub & sub keys for uninstall buffer
+const TInt  KBrandingServerUid  = 0x102828DD;
+const TUint KUninstallKey       = 0x01;
+}
+
+// ======== GLOBAL FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// DeleteRPtrArray
+// ---------------------------------------------------------------------------
+//
+LOCAL_C void DeleteRPtrArray( TAny* aArray )
+    {
+    RPointerArray<HBufC>* array = static_cast< RPointerArray<HBufC>* >(aArray);
+    TInt count = array->Count();
+    for( TInt i = 0; i < count; i++ )
+        {
+        delete (*array)[i];
+        }
+    array->Reset();
+    }
+    
+// ---------------------------------------------------------------------------
+// ParseInstallableBrandsL
+// ---------------------------------------------------------------------------
+//
+LOCAL_C void ParseInstallableBrandsL( RFs& aFs, RPointerArray<HBufC>& aFiles )
+    {
+    IMPORT_DP_TXT("ParseInstallableBrandsL begin");
+    // list import content
+    CDir* dir = NULL;
+    TPath privatePath;
+    aFs.PrivatePath( privatePath );
+    privatePath.Insert( 0, KInstallDrive );
+    privatePath.Append( KInstallPath );
+    
+    if (!BaflUtils::FolderExists(aFs, privatePath))
+        {
+        User::LeaveIfError(aFs.MkDirAll(privatePath));
+        }
+    
+    TFileName find( privatePath );
+    find.Append( KInstallFiles );
+    User::LeaveIfError( 
+        aFs.GetDir( find, KEntryAttNormal, ESortNone, dir ) );
+    CleanupStack::PushL( dir );
+    
+    // create array of files (as text)
+    TInt count = dir->Count();
+    for( TInt i = 0; i < count; i++ )
+        {
+        TFileName file( privatePath );
+        file.Append( (*dir)[i].iName );
+        aFiles.Append( file.AllocL() );
+        }
+
+    CleanupStack::PopAndDestroy( dir );
+    IMPORT_DP_TXT("ParseInstallableBrandsL end");
+    }
+
+// ---------------------------------------------------------------------------
+// Uninstall
+// ---------------------------------------------------------------------------
+//
+LOCAL_C void UninstallL()
+    {
+    
+    // Get uninstalled brands
+    HBufC* dataBuf = HBufC::NewLC( RProperty::KMaxPropertySize );
+    
+    HBufC* newDataBuf = HBufC::NewLC( RProperty::KMaxPropertySize );
+    TPtr newData( newDataBuf->Des() );
+    TBool error( EFalse );
+    
+    TPtr data( dataBuf->Des() );
+    RProperty::Get( TUid::Uid( KBrandingServerUid ), KUninstallKey, data );
+    
+    //IMPORT_DP( D_IMPORT_LIT( "Property data='%S'" ), &data );
+    
+    TPtrC processing( data );
+    while( processing.Length() > 0 )
+        {
+        // get first brand from buffer
+        TInt pos = processing.Find( KLineFeed );
+        TPtrC brand( (pos >= 0) ? processing.Left( pos ) : processing );
+        if( pos == KErrNotFound )
+            {
+            // this was last item. reset process.
+            processing.Set( KNullDesC );
+            }
+        else
+            {
+            // cut out the brand part from processing
+            processing.Set( processing.Mid( brand.Length() + 1 ) );
+            }
+        
+        // divide brand
+        TInt sepPos = brand.Find( KBrandSeparator );
+        if( sepPos != KErrNotFound )
+            {
+            // remove brand
+            TRAPD( err, BSBrandRemover::RemoveBrandL( 
+                brand.Left( sepPos ), brand.Mid( sepPos + 1 ) ) );
+            //If the brand removal failed and due to a KErrInUse errorcode, 
+            //it must not be deleted from the property-->try to delete next
+            //time again! in any other case, we simply delete the un-
+            //uninstallation string from the RProperty.
+            //NOTE also: Since we check here for an errorcode that is (probably)
+            //raised in CBSSession.cpp by calling User::Leave, it has to be 
+            //considered whether the condition of the following if statement 
+            //has to be updated or not, if the errorcode of that User::Leave
+            //in CBSSession.cpp is modified.
+            if ( KErrInUse == err )
+                {
+                error = ETrue;
+                if( newData.Length() > 0 )
+                    {
+                    newData.Append( KLineFeed );
+                    }
+                newData.Append( brand );                
+                }
+            }
+        }
+    
+    // Reset uninstall buffer
+    if ( error )
+        {
+        if( newData.Length() <= RProperty::KMaxPropertySize )
+            {
+            User::LeaveIfError( RProperty::Set( TUid::Uid( KBrandingServerUid ), 
+                                                KUninstallKey, 
+                                                newData ) );            
+            }
+        }
+    else
+        {
+    	RProperty::Set( TUid::Uid( KBrandingServerUid ), 
+                        KUninstallKey, 
+                        KNullDesC );        
+        }    
+    CleanupStack::PopAndDestroy( newDataBuf );
+    CleanupStack::PopAndDestroy( dataBuf );    
+    
+    IMPORT_DP_TXT("UninstallL end");
+    }
+
+// ---------------------------------------------------------------------------
+// MainL
+// ---------------------------------------------------------------------------
+//
+LOCAL_C void MainL()
+    {
+	IMPORT_DP_TXT("MainL begin");
+	// Codescanner warning: User of non-pointer/refer3ence RFs (Id:76)
+	// this code cannot get file server handle from anywhere, so it has to be
+	// created here
+    RFs fs; // CSI: 76 # See above
+    User::LeaveIfError( fs.Connect() );
+    CleanupClosePushL( fs );
+    
+    // Uninstall removed brands
+    TRAP_IGNORE( UninstallL() );
+    
+    // find new xml files
+    RPointerArray<HBufC> files;
+    CleanupStack::PushL( TCleanupItem( DeleteRPtrArray, &files ) );
+    ParseInstallableBrandsL( fs, files);
+    
+    // convert PointerArray to MDesCArray
+	
+    TInt count = files.Count();
+    if(count)
+    	{
+    
+	    // Do install
+	    CBSImportManager* installer = CBSImportManager::NewLC();
+	    
+	    for( TInt i = 0; i < count; i++ )
+	        {
+	        TRAPD( err, installer->ImportFileL( *(files[i]) ) );
+	        // only delete the xml file if the installation succeeded; ignore errors.
+	        // If there is a reason to save these files, then change this to 
+	        // move operation.
+	        if ( KErrNone == err )
+	            {
+	            fs.Delete( *(files[i]) );
+	            }	        
+	        }
+    
+	    //User::LeaveIfError( err ); //TODO: should we still leave at this point? 
+	    CleanupStack::PopAndDestroy( installer ); 
+	    
+		} 
+	CleanupStack::PopAndDestroy( 2 ); // files,  fs
+    IMPORT_DP_TXT("MainL end");
+    }
+
+// ---------------------------------------------------------------------------
+// Main function of the application executable.
+// ---------------------------------------------------------------------------
+//
+GLDEF_C TInt E32Main()
+    {
+	__UHEAP_MARK;
+	CTrapCleanup* cleanup = CTrapCleanup::New();
+	TInt returnCode( KErrNone );
+    IMPORT_DP_TXT("----- NEW IMPORT SESSION ------( INSTALLER )---");
+    User::RenameThread( KProcessName );
+	TRAPD( error, MainL() );
+	if( error )
+	    {
+	    IMPORT_DP( D_IMPORT_LIT( "ERROR installing brand: %d" ), error );
+	    }
+    IMPORT_DP_TXT("-----------------------------------------------");
+	__ASSERT_ALWAYS( !error, User::Panic( KProcessName, error ) );
+	delete cleanup;
+	__UHEAP_MARKEND;
+	return returnCode;
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/brandingserver/tools/makefile/import.mk	Wed Nov 03 09:32:20 2010 +0530
@@ -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: make file
+#
+
+
+# ----------------------------------------------------------------------------
+# Application ID
+# This should be the same string as is used as the application ID
+# of this application in the brand data.
+# This is used for cleaning the brand data when calling abld clean.
+#
+# !!IMPORTANT!!
+#
+# Note that all the brands for this application will be wiped!
+# If this is not wanted, change the rule in CLEAN to do_nothing, but
+# then you will get errors when recompiling, since the same brand data
+# cannot be entered twice.
+# ----------------------------------------------------------------------------
+
+APPID=app_id
+
+
+# ----------------------------------------------------------------------------
+# Brand ID
+# Name of the created brand
+# ----------------------------------------------------------------------------
+BRAND=default
+
+# ----------------------------------------------------------------------------
+# Brand version
+# ----------------------------------------------------------------------------
+VERSION=1
+
+# ----------------------------------------------------------------------------
+# Source directory of the brand XML:s.
+# Just put every XML you want to import into this directory.
+# Note that this directory is for emulator, so c-drive is pointing to
+# \epoc32\winscw\c.
+# ----------------------------------------------------------------------------
+SOURCEDIR=c:\xml
+
+
+# ----------------------------------------------------------------------------
+# Directory to clean when abld clean is called
+# ----------------------------------------------------------------------------
+CLEANED_DIR=\epoc32\winscw\c\private\102828dd\data\$(APPID)
+
+# ----------------------------------------------------------------------------
+# Language definition
+# This should stay unchanged. Build script will change this when needed
+# ----------------------------------------------------------------------------
+LANGUAGE=sc
+
+# ----------------------------------------------------------------------------
+# empty rules 
+# ----------------------------------------------------------------------------
+do_nothing :
+	@rem do_nothing
+
+# ----------------------------------------------------------------------------
+# Build rules 
+# ----------------------------------------------------------------------------
+
+MAKMAKE : do_nothing
+
+# ----------------------------------------------------------------------------
+# Resources
+# Runs the parsers and importer. Note that this will cause an error when
+# compiling more than once with the same brand data without calling abld
+# clean in between
+#
+# Note! Edit these to suit our application
+# ----------------------------------------------------------------------------
+RESOURCE : 
+	perl -- \s60\brandingserver\tools\xml\loc2xml.pl \S60\someapp\Group\someapp.loc \epoc32\winscw\c\xml\someapp_loc_$(LANGUAGE).xml $(BRAND) $(APPID) $(LANGUAGE) $(VERSION)
+	perl -- \s60\brandingserver\tools\xml\mbg2xml.pl \epoc32\include\someapp.mbg \epoc32\winscw\c\xml\someapp_gfx.xml $(BRAND) $(APPID) SC $(VERSION)
+	\epoc32\release\winscw\udeb\bsimport.exe -dtextshell -- -D $(SOURCEDIR)
+
+# ----------------------------------------------------------------------------
+# Build
+# ----------------------------------------------------------------------------
+BLD : do_nothing
+
+# ----------------------------------------------------------------------------
+# Cleans all brand data for the given application.
+# ----------------------------------------------------------------------------
+CLEAN : 
+	if exist $(CLEANED_DIR) rd /S /Q $(CLEANED_DIR)
+	
+
+LIB : do_nothing
+
+CLEANLIB : do_nothing
+
+FREEZE : do_nothing
+
+SAVESPACE : do_nothing
+
+RELEASABLES :
+	do_nothing
+	
+FINAL : do_nothing
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/brandingserver/tools/sis/brand-example.pkg	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,71 @@
+;
+; Copyright (c) 2006-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:  Example PKG file for branding installer
+;
+
+; -------- general --------
+
+; Languages
+&EN
+
+; Package header (one name for each supported language)
+#{"?Example Brand 1?"}, (0x102828E0), 1, 0, 0
+
+; Localised Vendor name
+%{"Nokia"}
+
+; Unique Vendor name
+:"Nokia"
+
+; -------- files --------
+
+;------------------------------------------------------------------------------
+; Brand XML Data
+;
+; Add branding XML files here. All xml files must go to:
+; "c:\private\102828E1\import\"
+;------------------------------------------------------------------------------
+;
+"import_data\brand_data.xml"            -"c:\private\102828E1\import\brand.xml"
+
+
+;------------------------------------------------------------------------------
+; Brand files
+;
+; Add physical brand files here. Files should go to:
+; "c:\private\102828DD\import\", but any publicly readable directory is valid.
+;------------------------------------------------------------------------------
+;
+"import_data\file.jpg"                  -"c:\private\102828DD\import\file.jpg"
+
+
+;------------------------------------------------------------------------------
+; Brand installer notifier
+;
+; This file notifies the server to install new brands! This file also contains
+; the information of which brands to remove when this sis package is
+; uninstalled. Content of this file is not important, and it's adviced to
+; leave it empty. Only the name of the file makes the difference.
+;
+; NOTE! name of this file needs to be unique. Use version section in the file
+; below to install updates to previous packages.
+;
+; HINT! Sis package can contain multiple install files. it's possible to
+; install and remove multiple brands with single sis file.
+;
+; Format of this file: "[brand_id]$[application_id]$[version].install".
+; version part is optional.
+;------------------------------------------------------------------------------
+;
+"import_data\install.txt"  -"c:\private\102828DD\import\install\brand_id$app_id$001.install"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/brandingserver/tools/sis/import_data/brand_data.xml	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<branding>
+    <brand>
+        <application_id>APP_ID</application_id>
+        <brand_id>BRAND_ID</brand_id>
+        <brand_language_id>99</brand_language_id>
+        <brand_version>1</brand_version>
+        
+        <element  id="nam" type="integer">
+        <element_value>10</element_value>
+        </element>
+        
+        <element  id="example_file" type="file">
+        <element_value>
+        <file_name>c:\private\102828DD\import\file.jpg</file_name>
+        </element_value>
+        </element>
+    </brand>
+ </branding>
+		
\ No newline at end of file
Binary file brandingserver/tools/sis/import_data/file.JPG has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/brandingserver/tools/sis/import_data/install.txt	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,16 @@
+#
+# 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: install.txt
+#
+#
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/brandingserver/tools/sis/make-example.cmd	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,22 @@
+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: Example to make the brand sis file
+rem
+
+@echo off
+call t:\epoc32\tools\makesis brand-example.pkg
+call t:\epoc32\tools\signsis brand-example.sis brand.sis rd.cer rd-key.pem
+del brand-example.sis
+ren brand.sis brand-example.sis
+pause
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/brandingserver/tools/xml/loc2xml.pl	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,142 @@
+#
+# Copyright (c) 2006-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:  Converts loc file into branding xml file
+#
+
+#------------------------------------------------------------------------------
+# Trim string
+#------------------------------------------------------------------------------
+#
+sub trim($)
+{
+	my $string = shift;
+	$string =~ s/^[ ]+//;
+	$string =~ s/[ ]+$//;
+	return $string;
+}
+
+
+#------------------------------------------------------------------------------
+# Prints usage information
+#------------------------------------------------------------------------------
+#
+sub UsageInformation
+{
+    print <<EOF;
+LOC2XML.PL
+converts loc file into branding xml file. XML file is overwritten!
+
+Usage:
+loc2xml.pl [in file:loc] [out file:xml] [brand_id] [application_id]
+           [language id] [version]
+EOF
+
+    exit;
+}
+
+#------------------------------------------------------------------------------
+# Reads LOC file and constructs associative array
+#------------------------------------------------------------------------------
+#
+sub ReadLocFile
+{
+# Parse LOC file
+my $infile = shift;
+open(INPUT, $infile) || die "Can't open file: '$infile'";   # Open the file
+my %array = ();
+
+while( <INPUT> )
+    {
+    $_ = trim( $_ );
+    if( /^\#define\s+qtn.+\s+\".+\"/i )
+        {
+        # find ID
+        /(qtn[\w\d_]+)/i;
+        $id = $1;
+        $id =~ s/_//g;      # remove all '_' chars
+
+        #find value
+        /\"(.+)\"/i;
+        $value = $1;
+
+        $array{$id} = $value;
+#        print "$id \t: \'$value\'\n\r"
+        }
+    }
+close(INPUT);			    # Close the file
+
+return %array;
+}
+
+#------------------------------------------------------------------------------
+# Write XML file from given array
+#------------------------------------------------------------------------------
+#
+sub WriteXmlFile
+{
+my %strings = @_;
+open( OUTPUT, ">$ARGV[1]" ) || die "Can't open file: '$ARGV[1]'";
+
+
+print OUTPUT <<EOF;
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<branding>
+    <brand>
+        <application_id>$ARGV[3]</application_id>
+        <brand_id>$ARGV[2]</brand_id>
+        <brand_language_id>$ARGV[4]</brand_language_id>
+        <brand_version>$ARGV[5]</brand_version>
+
+EOF
+
+while( ($key, $value) = each(%strings) )
+    {
+    print OUTPUT <<EOF;
+        <element id="$key" type="text">
+         <element_value>$value</element_value>
+        </element>
+
+EOF
+    }
+
+print OUTPUT "    </brand>\n";
+print OUTPUT "</branding>\n";
+
+close( OUTPUT );
+}
+
+#------------------------------------------------------------------------------
+# Main function
+#------------------------------------------------------------------------------
+#
+
+# Check parameters
+my $count = @ARGV;
+if( $count != 6 )
+    {
+    UsageInformation();
+    }
+
+# Parse LOC file
+my %strings = &ReadLocFile( $ARGV[0] );
+
+# Write XML file
+WriteXmlFile( %strings );
+
+# Done!
+my @list = %strings;
+$count = @list / 2;
+print "Processed succesfully $count strings."
+
+# end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/brandingserver/tools/xml/mbg2xml.pl	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,298 @@
+#
+# Copyright (c) 2006-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:  Converts mbg file into branding xml file
+#
+
+# SETUP
+#
+my $skinidconstants   = 'epoc32\include\middleware\aknsconstants.h';
+my $skiniddefinitions = 'epoc32\include\middleware\aknsconstants.hrh';
+my $version =           'v0.1';
+
+# GLOBALS
+#
+
+# these hashes store the data for each bitmap.
+# each data can be accessed with same key value.
+my %bitmaps = ();       # bitmapname => bitmap id
+my %masks = ();         # bitmapname => mask id
+my %skinidmajor = ();   # bitmapname => major skin id
+my %skinidminor = ();   # bitmapname => minor skin id
+
+my $commonpart;         # common part of every mbg
+
+#------------------------------------------------------------------------------
+# Trim string
+#------------------------------------------------------------------------------
+#
+sub trim($)
+{
+	my $string = shift;
+	$string =~ s/^[ ]+//;
+	$string =~ s/[ ]+$//;
+	return $string;
+}
+
+#------------------------------------------------------------------------------
+# Determines, validates, and returns EPOCROOT.
+#------------------------------------------------------------------------------
+#
+sub getEpocroot
+{
+    my $epocroot = $ENV{EPOCROOT};
+    die "ERROR: Must set the EPOCROOT environment variable.\n"
+	if (!defined($epocroot));
+    $epocroot =~ s-/-\\-go;	# for those working with UNIX shells
+    die "ERROR: EPOCROOT must be an absolute path, " .
+	"not containing a drive letter.\n" if ($epocroot !~ /^\\/);
+    die "ERROR: EPOCROOT must not be a UNC path.\n" if ($epocroot =~ /^\\\\/);
+    die "ERROR: EPOCROOT must end with a backslash.\n" if ($epocroot !~ /\\$/);
+    die "ERROR: EPOCROOT must specify an existing directory.\n"
+	if (!-d $epocroot);
+    return $epocroot;
+}
+
+#------------------------------------------------------------------------------
+# Prints usage information
+#------------------------------------------------------------------------------
+#
+sub UsageInformation
+{
+    print <<EOF;
+MBG2XML.PL $version
+------------------------
+converts mbg file into branding xml file. Seeks skin ids for all the
+found bitmaps. Script needs to be executed on the same drive as the
+development platform.
+
+NOTE! XML file is overwritten!
+
+Usage:
+mbg2xml.pl [in file:mbg] [out file:xml] [brand_id] [application_id]
+           [language id] [version] [bitmap file extension (MBM, MIF..)]
+
+EOF
+
+    exit;
+}
+
+#------------------------------------------------------------------------------
+# Parse Avkon skin id file and find ids
+#------------------------------------------------------------------------------
+#
+sub ParseAvkonSkinFile
+{
+# read file
+print "\nParsing file: ".&getEpocroot.$skinidconstants;
+open( F, &getEpocroot.$skinidconstants ) || die "Can't open avkon skin file!";
+my @readbuffer = <F>;
+close( F );
+my $longbuf = join( "", @readbuffer );
+
+# try to find each bitmap from file
+foreach $item( keys( %bitmaps ) )
+    {
+    $searchitem = $item;
+    $searchitem =~ s/$commonpart//;
+    $searchitem =~ s/_//g;
+    $_ = $longbuf;
+    #print "\n - Seaching: ".$searchitem." = \t";
+    if( /static\s+const\s+TAknsItemID\s+KAknsIID($searchitem)\s*=\s*{\s*(\w+)\s*,\s*(\w+)\s*}\s*;/i )
+        {
+        #print $2." - ".$3;
+        $skinidmajor{$item} = $2;
+        $skinidminor{$item} = $3;
+        }
+    else
+        {
+        #print "not found";
+        }
+    }
+}
+
+#------------------------------------------------------------------------------
+# Parse Avkon skin id definition file and find values for ids
+#------------------------------------------------------------------------------
+#
+sub ParseAvkonSkinDefFile
+{
+# read file
+print "\nParsing file: ".&getEpocroot.$skiniddefinitions;
+open( F, &getEpocroot.$skiniddefinitions ) || die "Can't open avkon skin def file!";
+my @readbuffer = <F>;
+close( F );
+
+my $longbuf = join( "", @readbuffer );
+
+# Parse major ids
+print "\nParsing major skin ids";
+while( ( $key, $id ) = each( %skinidmajor ) )
+    {
+    $searchitem = $id;
+    $_ = $longbuf;
+    #print "\n - Seaching: ".$searchitem." = \t";
+    if( /\s+$searchitem\s*=\s*([a-fx0-9]+)/i )
+        {
+        #print $1;
+        $skinidmajor{$key} = hex($1);
+        }
+    else
+        {
+        #print "not found";
+        }
+    }
+
+# Parse minor ids
+print "\nParsing minor skin ids";
+while( ( $key, $id ) = each( %skinidminor ) )
+    {
+    $searchitem = $id;
+    $_ = $longbuf;
+    #print "\n - Seaching: ".$searchitem." = \t";
+    if( /\s+$searchitem\s*=\s*([a-fx0-9]+)/i )
+        {
+        #print $1;
+        $skinidminor{$key} = hex($1);
+        }
+    else
+        {
+        #print "not found";
+        }
+    }
+
+}
+
+#------------------------------------------------------------------------------
+# Reads MBG file and constructs associative array
+#------------------------------------------------------------------------------
+#
+sub ReadMbgFile
+{
+# Parse LOC file
+my $infile = shift;
+open(INPUT, $infile) || die "Can't open file: '$infile'";   # Open the file
+
+
+while( <INPUT> )
+    {
+    $_ = trim( $_ );
+    if( /^\s*(E[\w_]*) [=] ([0-9]+),/i )
+        {
+        $_ = $1;
+        $value = $2;
+        if( /(E[\w_]*)_mask/ )
+            {
+            $masks{$1} = $value;
+            }
+        else
+            {
+            $bitmaps{$1} = $value;
+            }
+        #$id =~ s/_//g;      # remove all '_' chars
+        }
+    elsif( /^\s*(E[\w]*)LastElement\s*/ )
+        {
+        print "\nCommon part for bitmaps: '$1'\n";
+        $commonpart = $1;
+        }
+    }
+close(INPUT);			    # Close the file
+}
+
+#------------------------------------------------------------------------------
+# Write branding XML file
+#------------------------------------------------------------------------------
+#
+sub WriteXmlFile
+{
+my %strings = @_;
+$len = length $ARGV[0];
+$bitmap_file_id = substr($ARGV[0], 0,  $len - 4);
+$bitmap_file = $bitmap_file_id . "." . $ARGV[6];
+$bitmap_file_id = $bitmap_file_id . "_" . $ARGV[6];
+
+open( OUTPUT, ">$ARGV[1]" ) || die "Can't open file: '$ARGV[1]'";
+
+print OUTPUT <<EOF;
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<branding>
+    <brand>
+        <application_id>    $ARGV[3]</application_id>
+        <brand_id>          $ARGV[2]</brand_id>
+        <brand_language_id> $ARGV[4]</brand_language_id>
+        <brand_version>     $ARGV[5]</brand_version>
+        <element type="file" id=\"$bitmap_file_id\">
+        	<element_value>
+                <file_name>c:\\private\\102828DD\\import\\$bitmap_file</file_name>
+        	</element_value>
+        </element>
+
+EOF
+
+
+while( ($key, $value) = each(%bitmaps) )
+    {
+    # strip underscores
+    $modifkey = $key;
+    $modifkey =~ s/_//g;
+
+    print OUTPUT <<EOF;
+        <element id="$modifkey" type="bitmap">
+        	<element_value>
+        		<bitmap_file_id> $bitmap_file_id</bitmap_file_id>
+        		<bitmap_id>      $value </bitmap_id>
+        		<mask_id>        $masks{$key} </mask_id>
+        		<skin_id_major> $skinidmajor{$key} </skin_id_major>
+        		<skin_id_minor>   $skinidminor{$key} </skin_id_minor>
+         	</element_value>
+        </element>
+
+EOF
+    }
+
+print OUTPUT "    </brand>\n";
+print OUTPUT "</branding>\n";
+
+close( OUTPUT );
+}
+
+#------------------------------------------------------------------------------
+# Main function
+#------------------------------------------------------------------------------
+#
+
+# Check parameters
+my $count = @ARGV;
+if( $count != 7 )
+    {
+    UsageInformation();
+    }
+
+# Parse MBG file for bitmaps
+print "\nParsing input file: $ARGV[0]";
+ReadMbgFile( $ARGV[0] );
+
+# Parse avkon skin files and find skin id's for all the found bitmaps
+ParseAvkonSkinFile();
+ParseAvkonSkinDefFile();
+
+# Write XML file
+WriteXmlFile();
+
+# Done!
+my @list = %bitmaps;
+$count = @list / 2;
+print "\n\nProcessed succesfully $count bitmaps.\nDone!\n"
+
+# end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/brandingserver/tools/xml/xml2h.pl	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,111 @@
+#
+# Copyright (c) 2006-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:  Writes a header file based on brand xml file
+#
+
+#------------------------------------------------------------------------------
+# Prints usage information
+#------------------------------------------------------------------------------
+#
+sub UsageInformation
+{
+    print <<EOF;
+XML2h.PL
+Finds all element id's in brand XML file and writes a C++ header file based on
+them. Destination file is overwritten!
+
+Usage:
+xml2h.pl [in file:xml] [out file:h]
+EOF
+
+    exit;
+}
+
+#------------------------------------------------------------------------------
+# Reads XML file and finds element id's
+#------------------------------------------------------------------------------
+#
+sub ReadXMLFile
+{
+    # Parse XML file
+    open( INPUT, $ARGV[0] ) || die "ERROR: Can't open file: '$ARGV[0]'";
+
+    # join lines
+    my $xmlcontent = join( "", <INPUT> );
+    close(INPUT);
+
+    # remove all comments
+    $xmlcontent =~ s/<!--[.\s]*-->//g;
+
+    # find elements id's
+    $_ = $xmlcontent;
+    my @elements = /<.*element[. ]* id="([\w\d_]+)".*>/g;
+
+    #debug print
+#   foreach $item (@elements) print "$item\n";
+    return @elements;
+}
+
+#------------------------------------------------------------------------------
+# Write Header file
+#------------------------------------------------------------------------------
+#
+sub WriteHeaderFile
+{
+    my @ids = @_;
+    open( OUTPUT, ">$ARGV[1]" ) || die "Can't open file: '$ARGV[1]'";
+
+    # Write header
+    print OUTPUT <<EOF;
+// Branding item header file created with XML2H. DO NOT MODIFY!
+
+EOF
+
+    # Write items
+    foreach $item (@ids)
+        {
+        $const = $item;
+        substr( $const, 0, 1 ) =~ tr/[a-z]/[A-Z]/;
+        print OUTPUT <<EOF;
+_LIT8( K$const, \t"$item");
+EOF
+        }
+
+    print OUTPUT "\n//End of file\n";
+    close( OUTPUT );
+}
+
+#------------------------------------------------------------------------------
+# Main function
+#------------------------------------------------------------------------------
+#
+
+# Check parameters
+my $count = @ARGV;
+if( $count != 2 )
+    {
+    UsageInformation();
+    }
+
+# Parse XML file
+my @ids = ReadXMLFile();
+
+# Write XML file
+WriteHeaderFile( @ids );
+
+# Done!
+$count = @ids;
+print "Processed succesfully $count elements."
+
+# end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/group/bld.inf	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,33 @@
+/*
+* 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 configuration file for dbus
+
+// Project platforms
+PRJ_PLATFORMS
+WINSCW ARMV5
+
+// Project exports
+
+// MMP files for project components
+PRJ_MMPFILES
+#include "../imsrv_plat/group/bld.inf"
+#include "../ximpfw/group/bld.inf"
+#include "../imservices/group/bld.inf"
+#include "../brandingserver/group/bld.inf"
+
+PRJ_TESTMMPFILES
+
Binary file imservices/data/200195A9.txt has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/group/bld.inf	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,36 @@
+/*
+* 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:  logs generation file
+*
+*/
+// Project configuration file for dbus
+
+// Project platforms
+PRJ_PLATFORMS
+WINSCW ARMV5
+
+#include <platform_paths.hrh>
+
+// Project exports
+
+// MMP files for project components
+PRJ_MMPFILES
+#include "../imfeatureplugin/group/bld.inf"
+#include "../searchfeatureplugin/group/bld.inf"
+#include "../xmppsettingsapi/group/bld.inf"
+#include "../xmppsettingsfetcher/group/bld.inf"
+#include "../instantmessagingcache/group/bld.inf"
+
+PRJ_TESTMMPFILES
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/imfeatureplugin/bwins/imdatamodelhooku.def	Wed Nov 03 09:32:20 2010 +0530
@@ -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/imservices/imfeatureplugin/bwins/imdatamodelu.def	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,18 @@
+EXPORTS
+	??1CConversationSubscriptionItem@@UAE@XZ @ 1 NONAME ; CConversationSubscriptionItem::~CConversationSubscriptionItem(void)
+	?CleanExpired@CImDataCache@@QAEXXZ @ 2 NONAME ; void CImDataCache::CleanExpired(void)
+	?CleanResources@CImDataCache@@QAEXAAVMXIMPPscContext@@@Z @ 3 NONAME ; void CImDataCache::CleanResources(class MXIMPPscContext &)
+	?ConversationSubscriptionItemLC@CImDataCache@@QAEAAVCConversationSubscriptionItem@@XZ @ 4 NONAME ; class CConversationSubscriptionItem & CImDataCache::ConversationSubscriptionItemLC(void)
+	?IdentityImp@CImConversationInfoImp@@QBEABVCXIMPIdentityImp@@XZ @ 5 NONAME ; class CXIMPIdentityImp const & CImConversationInfoImp::IdentityImp(void) const
+	?InternalizeL@CImConversationInfoImp@@QAEXAAVRReadStream@@@Z @ 6 NONAME ; void CImConversationInfoImp::InternalizeL(class RReadStream &)
+	?NewFromStreamLC@CImConversationInfoImp@@SAPAVCXIMPApiDataObjBase@@AAVRReadStream@@@Z @ 7 NONAME ; class CXIMPApiDataObjBase * CImConversationInfoImp::NewFromStreamLC(class RReadStream &)
+	?NewL@CImApiDataObjFactoryAccessor@@SAPAV1@XZ @ 8 NONAME ; class CImApiDataObjFactoryAccessor * CImApiDataObjFactoryAccessor::NewL(void)
+	?NewL@CImConversationInfoImp@@SAPAV1@XZ @ 9 NONAME ; class CImConversationInfoImp * CImConversationInfoImp::NewL(void)
+	?NewL@CImDataCache@@SAPAV1@AAVMXIMPHost@@@Z @ 10 NONAME ; class CImDataCache * CImDataCache::NewL(class MXIMPHost &)
+	?NewL@CImObjectFactoryImp@@SAPAV1@XZ @ 11 NONAME ; class CImObjectFactoryImp * CImObjectFactoryImp::NewL(void)
+	?NewLC@CImConversationEventImp@@SAPAV1@PAVCImConversationInfoImp@@@Z @ 12 NONAME ; class CImConversationEventImp * CImConversationEventImp::NewLC(class CImConversationInfoImp *)
+	?NewLC@CImConversationInfoImp@@SAPAV1@XZ @ 13 NONAME ; class CImConversationInfoImp * CImConversationInfoImp::NewLC(void)
+	?RemoveMe@?$@VCConversationSubscriptionItem@@@CImDataCache@@CAXAAPAV1@PAV1@@Z @ 14 NONAME ; void CImDataCache::RemoveMe<class CConversationSubscriptionItem>(class CConversationSubscriptionItem * &, class CConversationSubscriptionItem *)
+	?SetConversationInfoL@CConversationSubscriptionItem@@QAEXPAVCImConversationInfoImp@@@Z @ 15 NONAME ; void CConversationSubscriptionItem::SetConversationInfoL(class CImConversationInfoImp *)
+	?SetIdentity@CImConversationInfoImp@@QAEXPAVCXIMPIdentityImp@@@Z @ 16 NONAME ; void CImConversationInfoImp::SetIdentity(class CXIMPIdentityImp *)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/imfeatureplugin/bwins/imecomhooku.def	Wed Nov 03 09:32:20 2010 +0530
@@ -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/imservices/imfeatureplugin/bwins/immanageru.def	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,3 @@
+EXPORTS
+	?NewL@CImFeaturesImp@@SAPAV1@PAVMXIMPContext@@@Z @ 1 NONAME ; class CImFeaturesImp * CImFeaturesImp::NewL(class MXIMPContext *)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/imfeatureplugin/bwins/imoperationshooku.def	Wed Nov 03 09:32:20 2010 +0530
@@ -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/imservices/imfeatureplugin/bwins/imoperationu.def	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,6 @@
+EXPORTS
+	??0COperationLaunchCleaner@@QAE@XZ @ 1 NONAME ; COperationLaunchCleaner::COperationLaunchCleaner(void)
+	??0COperationReceiveMessage@@QAE@XZ @ 2 NONAME ; COperationReceiveMessage::COperationReceiveMessage(void)
+	??0COperationSendMessage@@QAE@XZ @ 3 NONAME ; COperationSendMessage::COperationSendMessage(void)
+	?NewL@CImOperationFactory@@SAPAV1@XZ @ 4 NONAME ; class CImOperationFactory * CImOperationFactory::NewL(void)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/imfeatureplugin/bwins/improcessorhooku.def	Wed Nov 03 09:32:20 2010 +0530
@@ -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/imservices/imfeatureplugin/bwins/improcessoru.def	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,5 @@
+EXPORTS
+	?NewL@CProtocolDataHostImp@@SAPAV1@AAVMXIMPHost@@@Z @ 1 NONAME ; class CProtocolDataHostImp * CProtocolDataHostImp::NewL(class MXIMPHost &)
+	?NewL@CProtocolImConversationDataHostImp@@SAPAV1@AAVMXIMPHost@@@Z @ 2 NONAME ; class CProtocolImConversationDataHostImp * CProtocolImConversationDataHostImp::NewL(class MXIMPHost &)
+	?NewLC@CProtocolDataHostImp@@SAPAV1@AAVMXIMPHost@@@Z @ 3 NONAME ; class CProtocolDataHostImp * CProtocolDataHostImp::NewLC(class MXIMPHost &)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/imfeatureplugin/eabi/imdatamodelhooku.def	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,3 @@
+EXPORTS
+	_Z24ImplementationGroupProxyRi @ 1 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/imfeatureplugin/eabi/imdatamodelu.def	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,28 @@
+EXPORTS
+	_ZN12CImDataCache12CleanExpiredEv @ 1 NONAME
+	_ZN12CImDataCache14CleanResourcesER15MXIMPPscContext @ 2 NONAME
+	_ZN12CImDataCache30ConversationSubscriptionItemLCEv @ 3 NONAME
+	_ZN12CImDataCache4NewLER9MXIMPHost @ 4 NONAME
+	_ZN12CImDataCache8RemoveMeI29CConversationSubscriptionItemEEvRPT_S3_ @ 5 NONAME
+	_ZN19CImObjectFactoryImp4NewLEv @ 6 NONAME
+	_ZN22CImConversationInfoImp11SetIdentityEP16CXIMPIdentityImp @ 7 NONAME
+	_ZN22CImConversationInfoImp12InternalizeLER11RReadStream @ 8 NONAME
+	_ZN22CImConversationInfoImp15NewFromStreamLCER11RReadStream @ 9 NONAME
+	_ZN22CImConversationInfoImp4NewLEv @ 10 NONAME
+	_ZN22CImConversationInfoImp5NewLCEv @ 11 NONAME
+	_ZN23CImConversationEventImp5NewLCEP22CImConversationInfoImp @ 12 NONAME
+	_ZN28CImApiDataObjFactoryAccessor4NewLEv @ 13 NONAME
+	_ZN29CConversationSubscriptionItem20SetConversationInfoLEP22CImConversationInfoImp @ 14 NONAME
+	_ZN29CConversationSubscriptionItemD0Ev @ 15 NONAME
+	_ZN29CConversationSubscriptionItemD1Ev @ 16 NONAME
+	_ZN29CConversationSubscriptionItemD2Ev @ 17 NONAME
+	_ZNK22CImConversationInfoImp11IdentityImpEv @ 18 NONAME
+	_ZTI12CImDataCache @ 19 NONAME ; #<TI>#
+	_ZTI19CImObjectFactoryImp @ 20 NONAME ; #<TI>#
+	_ZTI29CConversationSubscriptionItem @ 21 NONAME ; #<TI>#
+	_ZTV12CImDataCache @ 22 NONAME ; #<VT>#
+	_ZTV19CImObjectFactoryImp @ 23 NONAME ; #<VT>#
+	_ZTV29CConversationSubscriptionItem @ 24 NONAME ; #<VT>#
+	_ZThn28_N29CConversationSubscriptionItemD0Ev @ 25 NONAME ; #<thunk>#
+	_ZThn28_N29CConversationSubscriptionItemD1Ev @ 26 NONAME ; #<thunk>#
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/imfeatureplugin/eabi/imecomhooku.def	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,3 @@
+EXPORTS
+	_Z24ImplementationGroupProxyRi @ 1 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/imfeatureplugin/eabi/immanageru.def	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,3 @@
+EXPORTS
+	_ZN14CImFeaturesImp4NewLEP12MXIMPContext @ 1 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/imfeatureplugin/eabi/imoperationshooku.def	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,3 @@
+EXPORTS
+	_Z24ImplementationGroupProxyRi @ 1 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/imfeatureplugin/eabi/imoperationu.def	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,15 @@
+EXPORTS
+	_ZN19CImOperationFactory4NewLEv @ 1 NONAME
+	_ZN21COperationSendMessageC1Ev @ 2 NONAME
+	_ZN21COperationSendMessageC2Ev @ 3 NONAME
+	_ZN23COperationLaunchCleanerC1Ev @ 4 NONAME
+	_ZN23COperationLaunchCleanerC2Ev @ 5 NONAME
+	_ZN24COperationReceiveMessageC1Ev @ 6 NONAME
+	_ZN24COperationReceiveMessageC2Ev @ 7 NONAME
+	_ZTI21COperationSendMessage @ 8 NONAME ; #<TI>#
+	_ZTI23COperationLaunchCleaner @ 9 NONAME ; #<TI>#
+	_ZTI24COperationReceiveMessage @ 10 NONAME ; #<TI>#
+	_ZTV21COperationSendMessage @ 11 NONAME ; #<VT>#
+	_ZTV23COperationLaunchCleaner @ 12 NONAME ; #<VT>#
+	_ZTV24COperationReceiveMessage @ 13 NONAME ; #<VT>#
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/imfeatureplugin/eabi/improcessorhooku.def	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,3 @@
+EXPORTS
+	_Z24ImplementationGroupProxyRi @ 1 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/imfeatureplugin/eabi/improcessoru.def	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,7 @@
+EXPORTS
+	_ZN20CProtocolDataHostImp4NewLER9MXIMPHost @ 1 NONAME
+	_ZN20CProtocolDataHostImp5NewLCER9MXIMPHost @ 2 NONAME
+	_ZN34CProtocolImConversationDataHostImp4NewLER9MXIMPHost @ 3 NONAME
+	_ZTI34CProtocolImConversationDataHostImp @ 4 NONAME ; #<TI>#
+	_ZTV34CProtocolImConversationDataHostImp @ 5 NONAME ; #<VT>#
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/imfeatureplugin/group/bld.inf	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  Build information file for project IM Feature Plugin
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+../rom/imfeatureplugin.iby						 CORE_MW_LAYER_IBY_EXPORT_PATH(imfeatureplugin.iby)
+// ROM SIS stubs
+../sis/imfeaturepluginstub.sis	             /epoc32/data/z/system/install/imfeaturepluginstub.sis
+
+PRJ_MMPFILES
+../srcimdatamodel/group/imdatamodel.mmp
+../srcimdatamodel/group/imdatamodelhook.mmp
+../srcimfrontend/group/immanager.mmp
+../srcimfrontend/group/imecomhook.mmp
+../srcimoperations/group/imoperation.mmp
+../srcimoperations/group/imoperationshook.mmp
+../srcimprocessor/group/improcessor.mmp
+../srcimprocessor/group/improcessorhook.mmp
+
+PRJ_TESTMMPFILES
+
+PRJ_TESTEXPORTS
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/imfeatureplugin/group/imdlluids.hrh	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,73 @@
+/*
+* 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:  XIMP Framework IM DLL uids
+*
+*/
+
+#ifndef IMDLLUIDS_HRH
+#define IMDLLUIDS_HRH
+
+
+// -----------------------------------------------------------------------------
+// Common dll uids
+// -----------------------------------------------------------------------------
+//
+#define XIMP_IM_DLL_UID_STATIC_INTERFACE                   0x1000008d
+#define XIMP_IM_DLL_UID_ECOM_PLUGIN                        0x10009D8D
+
+// -----------------------------------------------------------------------------
+// Common UID 3 for the XIMP Framework dlls.
+// -----------------------------------------------------------------------------
+//
+#define XIMP_IM_DLL_UID_COMMON                             0x10282DD8
+// -----------------------------------------------------------------------------
+// ECOM implementation UID
+// -----------------------------------------------------------------------------
+//
+#define XIMP_ECOM_IMPLEMENTATION_UID_IM_INTERFACE   				0x2000B5ED
+
+//#define XIMP_ECOM_IMPL_UID_IM_CACHE_INTERFACE       				0x2000B5EE
+
+// Factory interface for internal data structures
+#define XIMP_ECOM_IMPL_UID_IM_DATAMODEL_INTERFACE   				0x2000B5EF
+
+#define XIMP_ECOM_IMPL_UID_IM_PROCESSOR_INTERFACE   				0x20015A10
+#define XIMP_ECOM_IMPL_UID_IM_OPERATION_INTERFACE   				0x20015A0F
+
+// -----------------------------------------------------------------------------
+// Other dll uids
+// -----------------------------------------------------------------------------
+//
+#define XIMP_DLL_UID_IM_HOOK                      					0x2000B5F0
+#define XIMP_DLL_UID_IM_MANAGER                   					0x2000B5F1
+#define XIMP_DLL_UID_IM_DATAMODEL_HOOK            					0x2000B5F2
+//#define XIMP_DLL_UID_IM_CACHE_HOOK                					0x2000B5F3
+#define XIMP_DLL_UID_IM_PROCESSOR	            					0x2000B5F4
+#define XIMP_DLL_UID_IM_PROCESSOR_HOOK            					0x20015A12
+#define XIMP_DLL_UID_IM_OPERATIONS_HOOK            					0x20015A13
+
+
+#define XIMP_DLL_UID_IM_OPERATION           						0x20015A11
+
+
+//#define XIMP_ECOM_IMPLEMENTATION_UID_IM_INTERFACE 		0x2000B5EA
+//#define XIMP_DLL_UID_IM_HOOK                      			0x2000B5EB
+//#define XIMP_DLL_UID_IM_MANAGER                   			0x2000B5EC
+
+
+
+
+#endif // IMDLLUIDS_HRH
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/imfeatureplugin/rom/imfeatureplugin.iby	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,39 @@
+/*
+* 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: IBY file for imfeatureplugin
+*
+*/
+
+#ifndef __IMFEATUREPLUGIN_IBY__
+#define __IMFEATUREPLUGIN_IBY__
+
+// imfeature plugin : (ximpfw.iby contains commented dlls, remove from there)
+//dlls
+file=ABI_DIR/BUILD_DIR/immanager.dll        SHARED_LIB_DIR/immanager.dll
+file=ABI_DIR/BUILD_DIR/imdatamodel.dll        SHARED_LIB_DIR/imdatamodel.dll
+file=ABI_DIR/BUILD_DIR/imoperation.dll        SHARED_LIB_DIR/imoperation.dll
+file=ABI_DIR/BUILD_DIR/improcessor.dll        SHARED_LIB_DIR/improcessor.dll
+
+//ECom hook
+ECOM_PLUGIN( imecomhook.dll, imecomhook.rsc) 
+ECOM_PLUGIN( imdatamodelhook.dll, imdatamodelhook.rsc) 
+ECOM_PLUGIN( imoperationshook.dll, imoperationshook.rsc) 
+ECOM_PLUGIN( improcessorhook.dll, improcessorhook.rsc) 
+
+// stub SIS, provides support for SIS upgrading
+data=DATAZ_/system/install/imfeaturepluginstub.sis    system/install/imfeaturepluginstub.sis
+
+#endif
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/imfeatureplugin/sis/imfeatureplugin.pkg	Wed Nov 03 09:32:20 2010 +0530
@@ -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: 
+;
+;Language
+&EN
+
+;Header
+#{"imfeatureplugin"}, (0x2000B5F1), 1, 1, 0, TYPE=SA, RU
+
+;Supports Series 60 v 5.2; Needs to be updated when platform is changed
+(0x20022E6D ), 0, 0, 0, {"Series60ProductID"}
+
+;Localised VendorID
+%{"Nokia"}
+
+;VendorID
+:"Nokia"
+
+
+;imfeatureplugin libs
+"\EPOC32\RELEASE\ARMV5\UREL\imdatamodelhook.dll"              -"!:\sys\bin\imdatamodelhook.dll"
+"\EPOC32\RELEASE\ARMV5\UREL\imdatamodel.dll"              -"!:\sys\bin\imdatamodel.dll"
+"\EPOC32\RELEASE\ARMV5\UREL\immanager.dll"              -"!:\sys\bin\immanager.dll"
+"\EPOC32\RELEASE\ARMV5\UREL\imecomhook.dll"              -"!:\sys\bin\imecomhook.dll"
+"\EPOC32\RELEASE\ARMV5\UREL\imoperationshook.dll"              -"!:\sys\bin\imoperationshook.dll"
+"\EPOC32\RELEASE\ARMV5\UREL\imoperation.dll"              -"!:\sys\bin\imoperation.dll"
+"\EPOC32\RELEASE\ARMV5\UREL\improcessorhook.dll"              -"!:\sys\bin\improcessorhook.dll"
+"\EPOC32\RELEASE\ARMV5\UREL\improcessor.dll"              -"!:\sys\bin\improcessor.dll"
+"\EPOC32\DATA\Z\Resource\Plugins\imdatamodelhook.rsc"             -"!:\Resource\Plugins\imdatamodelhook.rsc"
+"\EPOC32\DATA\Z\Resource\Plugins\imecomhook.rsc"             -"!:\Resource\Plugins\imecomhook.rsc"
+"\EPOC32\DATA\Z\Resource\Plugins\imoperationshook.rsc"             -"!:\Resource\Plugins\imoperationshook.rsc"
+"\EPOC32\DATA\Z\Resource\Plugins\improcessorhook.rsc"             -"!:\Resource\Plugins\improcessorhook.rsc"
+
+; end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/imfeatureplugin/sis/imfeaturepluginstub.pkg	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,42 @@
+;
+; 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: 
+;
+;Language
+&EN
+
+;Header
+#{"imfeatureplugin"}, (0x2000B5F1), 1, 0, 0, TYPE=SA
+
+;Localised VendorID
+%{"Nokia"}
+
+;VendorID
+:"Nokia"
+
+;imfeature plugin
+""							-"z:\sys\bin\imdatamodelhook.dll"
+""							-"z:\resource\plugins\imdatamodelhook.rsc"
+""							-"z:\sys\bin\imdatamodel.dll"
+""							-"z:\sys\bin\immanager.dll"
+""							-"z:\sys\bin\imecomhook.dll"
+""							-"z:\resource\plugins\imecomhook.rsc"
+""							-"z:\sys\bin\imoperationshook.dll"
+""							-"z:\resource\plugins\imoperationshook.rsc"
+""							-"z:\sys\bin\imoperation.dll"
+""							-"z:\sys\bin\improcessorhook.dll"
+""							-"z:\resource\plugins\improcessorhook.rsc"
+""							-"z:\sys\bin\improcessor.dll"
+
+; end of file
Binary file imservices/imfeatureplugin/sis/imfeaturepluginstub.sis has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/imfeatureplugin/sis/metadata.xml	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,72 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ad:metadata xmlns="http://nokia.com/arrow/repository/ia_component" xmlns:ad="http://nokia.com/arrow/application_metadata">
+    <iaSearchCriteria>ABC:ABC</iaSearchCriteria>
+    <!--
+    The appResources element contains all the language metadata of one IAC.
+    IAC may have one or more language-specific component names
+    and descriptions inside appResource element.
+
+    Language ID 1 should be always defined as this is the default language
+    in case other languages supported by the client cannot be found.
+    -->
+    <appResources>
+        <appResource>
+            <!-- Language ID -->
+            <language>1</language>
+            <!-- Name in given language -->
+            <iacName>IMFeaturePlugin</iacName>
+            <!-- Description in given language -->
+            <iacDescription>Update for IMFeaturePlugin</iacDescription>
+        </appResource>
+    </appResources>
+    <!-- Specifies for what versions of what platform this component is for. -->
+    <swPlatformDep>
+    <!-- platform code -->
+        <platform>S60</platform>
+        <versionFrom>
+            <!--
+            platform version number separated in major and minor number (i.e.
+            3.0 has 3 as major and 0 as minor)
+            -->
+            <major>5</major>
+            <minor>2</minor>
+            <!--
+            date-element can be used to pinpoint platform version number to even
+            more specific one. It is not currently used in the system.
+            -->
+            <date>
+                <year>2007</year>
+                <week>1</week>
+            </date>
+        </versionFrom>
+        <!-- the latest platform version this component is for -->
+        <versionTo>
+            <major>5</major>
+            <minor>2</minor>
+            <date>
+                <year>2009</year>
+                <week>52</week>
+            </date>
+        </versionTo>
+    </swPlatformDep>
+    <!-- specifies dependencies to other IACs -->
+    <interDeps>
+        <interDep>
+        <!-- SISX UID of the package this component is dependent of -->
+        <sisxUid>0x2000B5F1</sisxUid>
+            <!-- the earliest version this component is dependent of -->
+            <versionFrom>
+                <major>1</major>
+                <minor>0</minor>
+                <build>0</build>
+            </versionFrom>
+            <!-- the latest version this component is dependent of -->
+            <versionTo>
+                <major>2</major>
+                <minor>2</minor>
+                <build>2</build>
+            </versionTo>
+        </interDep>
+    </interDeps>
+<firmwareDependencies xmlns="http://nokia.com/arrow/repository/ia_component" xmlns:ad="http://nokia.com/arrow/application_metadata"/>
+</ad:metadata>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/imfeatureplugin/srcimdatamodel/apidataobjfactory.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,37 @@
+/*
+* 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:  MApiDataObjFactory Declaration
+*
+*/
+
+
+
+#ifndef M_APIOBJFACTORY_H
+#define M_APIOBJFACTORY_H
+
+#include <e32std.h>
+
+class CXIMPApiDataObjBase;
+
+class MApiDataObjFactory
+    {  
+public:
+    
+    virtual CXIMPApiDataObjBase* NewFromStreamLC( TInt32 aDataObjInterfaceId,
+                                                            RReadStream& aStream ) = 0;
+    
+    };
+
+#endif // M_APIOBJFACTORY_H
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/imfeatureplugin/srcimdatamodel/group/bld.inf	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,32 @@
+/*
+* 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:  Build information file for project IM Feature Plugin
+*
+*/
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+PRJ_MMPFILES
+imdatamodel.mmp
+imdatamodelhook.mmp
+
+
+PRJ_TESTMMPFILES
+
+PRJ_TESTEXPORTS
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/imfeatureplugin/srcimdatamodel/group/imdatamodel.mmp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,80 @@
+/*
+* 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:  Project definition file for IM Feature Plugin
+*
+*/
+
+#include <platform_paths.hrh>
+#include <data_caging_paths.hrh>
+#include "../../group/imdlluids.hrh"
+
+TARGET                  imdatamodel.dll
+TARGETTYPE              dll
+UID                     XIMP_IM_DLL_UID_STATIC_INTERFACE XIMP_IM_DLL_UID_COMMON                    
+
+CAPABILITY              CAP_GENERAL_DLL
+VENDORID                VID_DEFAULT
+
+VERSION      10.0
+
+// ---------------------------------------------------------------------------
+SOURCEPATH              ../imconversation
+// ---------------------------------------------------------------------------
+// Subscription items
+SOURCE                  conversationsubscriptionitem.cpp
+
+// API data objects
+SOURCE                  imconversationinfoimp.cpp
+
+// API data events
+SOURCE                  imconversationeventimp.cpp
+
+
+
+// ---------------------------------------------------------------------------
+SOURCEPATH              ../../srcimdatamodel
+// ---------------------------------------------------------------------------
+SOURCE                  imdatacacheimp.cpp
+SOURCE                  imobjectfactoryimp.cpp
+//SOURCE                  ximpimsubscriptionitembase.cpp
+SOURCE                  imapidataobjfactory.cpp
+SOURCE                  imeventcodec.cpp
+SOURCE                  imapidataobjfactoryaccessor.cpp
+
+
+USERINCLUDE             ../../srcimdatamodel
+USERINCLUDE             ../../srcimdatamodel/imconversation
+USERINCLUDE             ../../group
+
+
+MW_LAYER_SYSTEMINCLUDE
+
+
+LIBRARY                 euser.lib
+LIBRARY                 bafl.lib
+LIBRARY                 estor.lib
+LIBRARY                 ximputils.lib
+LIBRARY                 ximpdatamodel.lib
+LIBRARY                 ecom.lib
+LIBRARY         		flogger.lib
+
+//EXPORTUNFROZEN
+
+#if defined( ARMCC )
+DEFFILE ../../eabi/ 
+#elif defined ( WINSCW )
+deffile ../../bwins/ 
+#endif
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/imfeatureplugin/srcimdatamodel/group/imdatamodelhook.mmp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,59 @@
+/*
+* 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:  Project definition file for IM Feature Plugin
+*
+*/
+
+
+#include <platform_paths.hrh>
+#include <data_caging_paths.hrh>
+#include "../../group/imdlluids.hrh"
+
+
+TARGET                  imdatamodelhook.dll
+CAPABILITY              CAP_ECOM_PLUGIN
+TARGETTYPE              PLUGIN
+UID                     XIMP_IM_DLL_UID_ECOM_PLUGIN XIMP_DLL_UID_IM_DATAMODEL_HOOK                  
+VENDORID                VID_DEFAULT
+
+VERSION      10.0
+
+SOURCEPATH              ../imdatamodelhook
+START RESOURCE          imdatamodelhook.rss
+TARGET                  imdatamodelhook.rsc
+END
+
+
+SOURCEPATH              ../imdatamodelhook
+SOURCE                  imdatamodelhook.cpp
+
+
+USERINCLUDE             ../../group
+USERINCLUDE             ../imdatamodelhook
+USERINCLUDE             ../../srcimdatamodel
+
+
+MW_LAYER_SYSTEMINCLUDE
+
+
+LIBRARY                 euser.lib
+LIBRARY                 imdatamodel.lib
+LIBRARY                 ecom.lib
+
+
+#if defined( ARMCC )
+DEFFILE ../../eabi/ 
+#elif defined ( WINSCW )
+deffile ../../bwins/ 
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/imfeatureplugin/srcimdatamodel/imapidataobjfactory.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  Base class for API implementations.
+*
+*/
+
+#include "imapidataobjfactory.h"
+#include "ximpapidataobjbase.h"
+
+#include <s32strm.h>
+
+
+// ============================ MEMBER FUNCTIONS =============================
+
+
+// ---------------------------------------------------------------------------
+// CImEventCodec::NewL()
+// ---------------------------------------------------------------------------
+//
+CImApiDataObjFactory* CImApiDataObjFactory::NewL()
+    {
+    CImApiDataObjFactory* self = new( ELeave ) CImApiDataObjFactory() ;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CImEventCodec::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void CImApiDataObjFactory::ConstructL()
+    {
+    }
+
+
+/**
+ * Method to instantiate new data object object
+ * of requested type and construct it from the stream.
+ *
+ * @param aDataObjInterfaceId
+ * @return Data object constructor function.
+ */
+CXIMPApiDataObjBase* CImApiDataObjFactory::NewFromStreamLC( 
+            TInt32 aDataObjInterfaceId,
+            RReadStream& aStream )
+    {
+    return NewDataObjectFromStreamLC( aDataObjInterfaceId, aStream );
+    }
+
+// ---------------------------------------------------------------------------
+// CImApiDataObjFactory::CImApiDataObjFactory()
+// ---------------------------------------------------------------------------
+//
+CImApiDataObjFactory::CImApiDataObjFactory()
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// CImApiDataObjFactory::~CImApiDataObjFactory()
+// ---------------------------------------------------------------------------
+//
+CImApiDataObjFactory::~CImApiDataObjFactory()
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// ImApiDataObjFactory::InternalizeL
+// ---------------------------------------------------------------------------
+//
+void CImApiDataObjFactory::InternalizeL( 
+        RReadStream& aStream,
+        RImReqParamArray& aArray )
+    {
+    TInt32 arrLen = aStream.ReadInt32L();
+
+    for ( TInt i = 0; i < arrLen; i++ )
+        {
+        SImReqParam param;
+        param.iParamType = aStream.ReadInt32L();
+        CXIMPApiDataObjBase* dataObject = NewDataObjectFromStreamLC( param.iParamType, aStream );
+        param.iParam = dataObject;
+        aArray.AppendL( param );
+        CleanupStack::Pop( dataObject );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// ImApiDataObjFactory::ExternalizeL
+// ---------------------------------------------------------------------------
+//
+void CImApiDataObjFactory::ExternalizeL( 
+            RWriteStream& aWs,
+            const RImReqParamArray& aArray )
+    {
+    // write array length
+    aWs.WriteInt32L( aArray.Count() );
+
+    for ( TInt i = 0; i < aArray.Count(); i++ )
+        {
+        // trust the type within the param struct
+        aWs.WriteInt32L( aArray[ i ].iParamType );
+
+        // write the actual object
+        CXIMPApiDataObjBase* theBase = aArray[ i ].iParam;
+        theBase->ExternalizeL( aWs );
+        }
+
+    aWs.CommitL();
+    }
+
+// ---------------------------------------------------------------------------
+// ImApiDataObjFactory::InternalizeLC
+// ---------------------------------------------------------------------------
+//
+CXIMPApiDataObjBase* CImApiDataObjFactory::InternalizeLC(
+        RReadStream& aStream )
+    {
+    TInt32 objType = aStream.ReadInt32L();
+    CXIMPApiDataObjBase* dataObject = NewDataObjectFromStreamLC( objType, aStream );
+    return dataObject;
+    }
+
+// ---------------------------------------------------------------------------
+// ImApiDataObjFactory::ExternalizeL
+// ---------------------------------------------------------------------------
+//
+void CImApiDataObjFactory::ExternalizeL(
+        RWriteStream& aWs,
+        const CXIMPApiDataObjBase& aDataObj )
+    {
+    aWs.WriteInt32L( aDataObj.Base().GetInterfaceId() );
+    aDataObj.ExternalizeL( aWs );
+    aWs.CommitL();
+    }
+
+
+// End of file
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/imfeatureplugin/srcimdatamodel/imapidataobjfactory.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,125 @@
+/*
+* 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:  Codec to pack and unpack data objects.
+*
+*/
+
+#ifndef IMAPIDATAOBJFACTORY_H
+#define IMAPIDATAOBJFACTORY_H
+
+#include <e32base.h>
+#include "imtypehelpers.h"
+#include "ximpapidataobjbase.h"
+
+// internal interface for the factory
+#include "apidataobjfactory.h"
+
+class RReadStream;
+class RWriteStream;
+
+
+/**
+ * Codec to pack and unpack data object arrays.
+ *
+ * @lib ximpdatamodel.dll
+ * @since S60 v3.2
+ */
+NONSHARABLE_CLASS( CImApiDataObjFactory ) : public CBase,
+                                                  public MApiDataObjFactory
+    {
+public:
+
+    static CImApiDataObjFactory* NewL();
+    
+    // From base class
+    CXIMPApiDataObjBase* NewFromStreamLC( TInt32 aDataObjInterfaceId,
+                                          RReadStream& aStream );
+    /**
+     * Unpacks a request parameter array from a 
+     * descriptor back to array format.
+     * @param aDataObjArrayData The packed array
+     * @param aArray The array which to fill
+     */
+    static void InternalizeL( 
+            RReadStream& aStream,
+            RImReqParamArray& aArray
+            );
+
+    /**
+     * Packs a given request parameter array into 
+     * a stream.
+     * @param aWs The stream to pack into
+     * @param aArray The array to pack
+     */    
+    static void ExternalizeL( 
+            RWriteStream& aWs,
+            const RImReqParamArray& aArray
+            );
+
+    /**
+     * Internalize a CXIMPApiDataObjBase-derived object
+     * from the given stream, ownership is returned to the caller.
+     * @param aStream The stream
+     * @return The object instance
+     */
+    static CXIMPApiDataObjBase* InternalizeLC(
+            RReadStream& aStream );
+
+    /**
+     * Externalize a CXIMPApiDataObjBase-derived object
+     * to the given stream.
+     * @param aWs The write stream
+     * @param aDataObj The data object
+     */
+    static void ExternalizeL(
+            RWriteStream& aWs,
+            const CXIMPApiDataObjBase& aDataObj );
+    
+
+    /*
+     * Packs a given array into a stream.
+     * @param aStream The stream
+     * @param aArray The array
+     */
+    template< class INFOIMP>    
+        static inline void InternalizeL( 
+                RReadStream& aStream,
+                RPointerArray<INFOIMP>& aArray
+                );
+
+    /**
+     * Unpacks an array of info fields back to array format.
+     * @param aWs The stream
+     * @param aArray The array which to fill
+     */
+    template< class INFOIMP >
+        static inline void ExternalizeL( 
+                RWriteStream& aWs,
+                const RPointerArray<INFOIMP>& aArray
+                );
+
+
+    ~CImApiDataObjFactory();
+private:
+
+    CImApiDataObjFactory();
+
+    void ConstructL();
+
+    };
+
+// template methods need inline implementation
+#include "imapidataobjfactory.inl"
+
+#endif // IMAPIDATAOBJFACTORY_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/imfeatureplugin/srcimdatamodel/imapidataobjfactory.inl	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,187 @@
+/*
+* 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:  Inline methods for codec to pack and unpack data objects.
+*
+*/
+
+
+#include <e32base.h>
+
+#include "imtypehelpers.h"
+#include "imobjectfactory.h"
+#include "ximpapidataobjbase.h"
+#include "imconversationinfoimp.h"
+
+
+//DATA TYPES
+
+
+// ============================ MEMBER FUNCTIONS =============================
+
+/**
+ * Type definition for exact API data object constructor signature.
+ */
+typedef CXIMPApiDataObjBase* (*TApiDataObjConstructor)( RReadStream& );
+
+
+
+/**
+ * Structure for mapping data object interface IDs to
+ * to corect API data object constructors.
+ */
+struct SApiDataObjConstructorMap
+    {
+    //Interface id
+    TInt32    iInterfaceId;
+
+    //Function pointer to data object interface implementation
+    TApiDataObjConstructor iConstructorPtr;
+    } ;
+
+
+
+/**
+ * Helper macro to initialise KApiDataObjConstructorTable members.
+ *
+ * Macro forces that each data object implementation class to have static
+ * NewFromStreamLC() member function to instantiate the object.
+ *
+ * See TApiDataObjConstructor type definition for exact constructor
+ * signature.
+ */
+#define CONSTRUCTOR_ENTRY( TheImplementedIf, TheClass ) \
+    { TheImplementedIf::KInterfaceId, TheClass::NewFromStreamLC } \
+
+/**
+ * Constructor function mapping for data object interface implementations.
+ *
+ * When new data object types are implemented, add them here.
+ */
+
+const SApiDataObjConstructorMap KApiDataObjConstructorTable[] =
+    {
+    CONSTRUCTOR_ENTRY( MImConversationInfo, CImConversationInfoImp ),
+    };
+
+
+/**
+ * Count of constructor mappings.
+ */
+const TInt KApiDataObjConstructorCount 	= sizeof( KApiDataObjConstructorTable )
+                                       / sizeof( SApiDataObjConstructorMap );
+
+
+
+// ============================ HELPER FUNCTIONS =============================
+
+
+namespace {
+
+    /**
+     * Helper function to locate constructor function for
+     * data object interface ID.
+     *
+     * @param aDataObjInterfaceId The data object interface ID.
+     * @return Data object constructor function.
+     */
+    TApiDataObjConstructor ConstructorForInterface( TInt32 aDataObjInterfaceId )
+    {
+        //Locate correct constructor
+        for( TInt ix = 0; ix < KApiDataObjConstructorCount; ix++ )
+        {
+           const SApiDataObjConstructorMap map = KApiDataObjConstructorTable[ ix ];
+            if( map.iInterfaceId == aDataObjInterfaceId )
+            {
+                return map.iConstructorPtr;
+            } 
+        }
+
+
+        //If assertion below fails, check that data object implementation
+        //class implementing requested data object interface (aDataObjInterfaceId)
+        //is registered to KApiDataObjConstructorTable
+        __ASSERT_DEBUG( EFalse,
+                User::Panic( _L("ImObjectFactory"), KErrUnknown ) );
+
+        return NULL;
+    }
+
+    /**
+     * Helper function to instantiate new data object object
+     * of requested type and construct it from the stream.
+     *
+     * @param aDataObjInterfaceId
+     * @return Data object constructor function.
+     */
+    CXIMPApiDataObjBase* NewDataObjectFromStreamLC( TInt32 aDataObjInterfaceId,
+            RReadStream& aStream )
+    {
+        TApiDataObjConstructor newFromStreamLC = NULL;
+
+        //Locate correct constructor for interface ID
+        newFromStreamLC = ConstructorForInterface( aDataObjInterfaceId );
+
+        //Instantiate the object
+        CXIMPApiDataObjBase* dataObject = newFromStreamLC( aStream );
+
+        return dataObject;
+    }
+
+} // namespace
+
+// ---------------------------------------------------------------------------
+// ImApiDataObjFactory::InternalizeL
+// ---------------------------------------------------------------------------
+//
+template< class INFOIMP >
+inline void CImApiDataObjFactory::InternalizeL( 
+        RReadStream& aStream,
+        RPointerArray<INFOIMP>& aArray )
+    {
+    TInt32 arrLen = aStream.ReadInt32L();
+
+    for ( TInt i = 0; i < arrLen; i++ )
+        {
+        TInt paramType = aStream.ReadInt32L();
+        INFOIMP* infoObj = ( INFOIMP* ) NewDataObjectFromStreamLC( paramType, aStream );
+        aArray.AppendL( infoObj );
+        CleanupStack::Pop( infoObj );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// ImApiDataObjFactory::ExternalizeL
+// ---------------------------------------------------------------------------
+//
+template <class INFOIMP>
+inline void CImApiDataObjFactory::ExternalizeL( 
+        RWriteStream& aWs,
+        const RPointerArray<INFOIMP>& aArray )
+    {
+    aWs.WriteInt32L( aArray.Count() ); // array length
+
+    for ( TInt i = 0; i < aArray.Count(); i++ )
+        {
+        INFOIMP* infoField = aArray[ i ];
+
+        // write the type
+        aWs.WriteInt32L( infoField->Base().GetInterfaceId() );
+
+        // write the actual object
+        infoField->ExternalizeL( aWs );
+        }
+
+    aWs.CommitL();
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/imfeatureplugin/srcimdatamodel/imapidataobjfactoryaccessor.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,99 @@
+/*
+* 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:  Base class for API implementations.
+*
+*/
+
+#include "imapidataobjfactoryaccessor.h"
+#include "imeventcodec.h"
+#include "imapidataobjfactory.h"
+
+//DATA TYPES
+
+
+// ============================ MEMBER FUNCTIONS =============================
+
+// ---------------------------------------------------------------------------
+// CImApiDataObjFactoryAccessor::NewL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CImApiDataObjFactoryAccessor* CImApiDataObjFactoryAccessor::NewL()
+    {
+    CImApiDataObjFactoryAccessor* self = new( ELeave ) CImApiDataObjFactoryAccessor() ;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CImApiDataObjFactoryAccessor::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void CImApiDataObjFactoryAccessor::ConstructL()
+    {
+    // FIXME: would be probably better to have the Event Codec and other factories as singleton
+    iImEventCodec = CImEventCodec::NewL();    
+    iImApiDataObjFactory = CImApiDataObjFactory::NewL();
+    }
+
+
+// ---------------------------------------------------------------------------
+// CImApiDataObjFactoryAccessor::CImApiDataObjFactoryAccessor()
+// ---------------------------------------------------------------------------
+//
+CImApiDataObjFactoryAccessor::CImApiDataObjFactoryAccessor()
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// CImApiDataObjFactoryAccessor::~CImApiDataObjFactoryAccessor()
+// ---------------------------------------------------------------------------
+//
+CImApiDataObjFactoryAccessor::~CImApiDataObjFactoryAccessor()
+    {
+    delete iImEventCodec;
+    delete iImApiDataObjFactory;
+    }
+
+    
+// ---------------------------------------------------------------------------
+// CImApiDataObjFactoryAccessor::EventCodec()
+// ---------------------------------------------------------------------------
+//
+MEventCodec& CImApiDataObjFactoryAccessor::EventCodec()
+    {
+    return *iImEventCodec;
+    }
+
+// ---------------------------------------------------------------------------
+// CImApiDataObjFactoryAccessor::ApiDataObjFactory()
+// ---------------------------------------------------------------------------
+//
+MApiDataObjFactory& CImApiDataObjFactoryAccessor::ApiDataObjFactory()
+    {
+    return *iImApiDataObjFactory;
+    }
+
+
+
+// End of file
+
+
+
+
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/imfeatureplugin/srcimdatamodel/imapidataobjfactoryaccessor.h	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  Codec to pack and unpack data objects.
+*
+*/
+
+#ifndef IMAPIDATAOBJFACTORYACCESSOR_H
+#define IMAPIDATAOBJFACTORYACCESSOR_H
+
+#include "apidataobjfactoryaccessor.h"
+
+class MEventCodec;
+class CImEventCodec;
+class MApiDataObjFactory;
+class CImApiDataObjFactory;
+class MApiDataObjFactoryAccessor;
+/**
+ * Class to access the different object factories in the datamodel
+ *
+ * @lib ximpdatamodel.dll
+ * @since S60 v3.2
+ */
+NONSHARABLE_CLASS( CImApiDataObjFactoryAccessor ) : public MApiDataObjFactoryAccessor
+    {
+public:
+    IMPORT_C static CImApiDataObjFactoryAccessor* NewL();
+    
+    MApiDataObjFactory& ApiDataObjFactory();
+    
+    MEventCodec& EventCodec();
+    
+    ~CImApiDataObjFactoryAccessor();
+
+private:
+
+    CImApiDataObjFactoryAccessor();
+    void ConstructL();
+    
+//data
+private:
+    // Own
+    CImEventCodec* iImEventCodec;
+    
+    // Own
+    CImApiDataObjFactory* iImApiDataObjFactory;
+
+    };
+
+#endif // IMAPIDATAOBJFACTORYACCESSOR_H
+
+
+
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/imfeatureplugin/srcimdatamodel/imapiobjbase.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,59 @@
+/*
+* 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:  Base class for XIMP API implementations.
+*
+*/
+
+#ifndef IMAPIOBJBASE_H
+#define IMAPIOBJBASE_H
+
+
+/**
+ * IM plugin class implementation UIDs.
+ *
+ * These do not have to be "real" Symbian UIDs, but such ID's,
+ * that they do not overlap with XIMP or IM Plugin API interface IDs.
+ */
+ 
+// 90xx - ximp related
+// 91xx - im related
+// 92xx - instant messaging related
+
+
+const TInt KArrayGranularity( 2 );
+
+// IM plugin events
+#define IMIMP_CLSID_CPROTOCOLIMCONVERSATIONDATAHOST     9200
+
+// Im datamodel classes
+#define IMIMP_CLSID_CIMDATACACHE                		9210
+#define IMIMP_CLSID_CIMCONVERSATIONINFOIMP				9211
+#define IMIMP_CLSID_CIMCONVERSATIONEVENTIMP				9212
+#define IMIMP_CLSID_CIMOBJECTFACTORYIMP					9213
+#define IMIMP_CLSID_CIMOPERATIONFACTORYIMP				9214
+// Im plugin host environment classes
+#define IMIMP_CLSID_CPROTOCOLIMDATAHOSTIMP				9230
+
+
+// IM Management classes
+
+#define IMIMP_CLSID_CIMSEARCHIMP    	        		9240
+#define IMIMP_CLSID_CONVERSATIONIMP            			9241
+#define IMIMP_CLSID_CIMGROUPSIMP						9242
+#define IMIMP_CLSID_CIMINVITATIONIMP					9243
+#define IMIMP_CLSID_CIMFEATURESIMP						9244
+
+
+
+#endif // IMAPIOBJBASE_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/imfeatureplugin/srcimdatamodel/imconversation/conversationsubscriptionitem.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,111 @@
+/*
+* 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:  IM Service Connection Conversation subscription implementation.
+*
+*/
+
+
+#include <badesca.h>
+
+#include "ximpimitemparent.h"
+//#include "ximppanics.h"
+//#include "ximppsccontext.h"
+//#include "ximpobjecthelpers.h"
+#include "imtypehelpers.h"
+#include "imconversationeventimp.h"
+//#include "ximpidentityimp.h"
+//#include "ximpdatasubscriptionstateimp.h"
+#include "conversationsubscriptionitem.h"
+
+// ---------------------------------------------------------------------------
+// CConversationSubscriptionItem::CConversationSubscriptionItem()
+// ---------------------------------------------------------------------------
+//
+CConversationSubscriptionItem::CConversationSubscriptionItem( MXIMPItemParentBase& aParent )
+: CXIMPSubscriptionItemBase( aParent )
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// CConversationSubscriptionItem::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void CConversationSubscriptionItem::ConstructL()
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// CConversationSubscriptionItem::NewL()
+// ---------------------------------------------------------------------------
+//
+CConversationSubscriptionItem* CConversationSubscriptionItem::NewLC( MXIMPItemParentBase& aParent )
+    {
+    CConversationSubscriptionItem* self = new( ELeave ) CConversationSubscriptionItem( aParent );
+    CleanupClosePushL( *self );
+    self->ConstructL();
+    return self;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CConversationSubscriptionItem::~CConversationSubscriptionItem()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CConversationSubscriptionItem::~CConversationSubscriptionItem()
+    {
+    MXIMPIMItemParent* imCache = static_cast<MXIMPIMItemParent*>(iParent.GetInterface(IM_ITEM_PARENT));
+    imCache->RemoveMe( this );
+    }
+
+// ---------------------------------------------------------------------------
+// From MXIMPSubscriptionItem class.
+// CConversationSubscriptionItem::SynthesiseSubscriptionEventTo()
+// ---------------------------------------------------------------------------
+//
+void CConversationSubscriptionItem::SynthesiseSubscriptionEventToL(
+        MXIMPPscContext* aContext, TBool /*aForceEvent*/ )
+    {
+
+    CImConversationEventImp* newEvent = CImConversationEventImp::NewLC( iConvinfo );      
+    if( newEvent )
+        {
+         MXIMPIMItemParent* imCache = static_cast<MXIMPIMItemParent*>(iParent.GetInterface(IM_ITEM_PARENT));
+        //static_cast<MXIMPIMItemParent&>(iParent).AddEventL( *newEvent, aContext ); 
+         imCache->AddEventL( *newEvent, aContext ); 
+        }
+    CleanupStack::PopAndDestroy( newEvent ); //newEvent
+    }
+
+
+// ---------------------------------------------------------------------------
+// CConversationSubscriptionItem::SetNewListL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CConversationSubscriptionItem::SetConversationInfoL(CImConversationInfoImp* aConvinfo)
+    {
+    iConvinfo = aConvinfo;
+    }
+// ---------------------------------------------------------------------------
+// CGroupListSubscriptionItem::CleanExpired()
+// ---------------------------------------------------------------------------
+//
+void CConversationSubscriptionItem::CleanExpired()
+    {
+    
+    }
+ 
+    
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/imfeatureplugin/srcimdatamodel/imconversation/conversationsubscriptionitem.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,104 @@
+/*
+* 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:  IM Service Connection IM conversation subscription implementation.
+*
+*/
+
+#ifndef CPSCCONVERSATIONSUBSCRIPTIONITEM_H
+#define CPSCCONVERSATIONSUBSCRIPTIONITEM_H
+
+#include <e32base.h>
+#include "ximpsubscriptionitem.h"
+#include "imtypehelpers.h"
+#include "ximpsubscriptionitembase.h"
+
+class MXIMPIMItemParent;
+class MXIMPPscContext;
+class CXIMPPscContext;
+class CDesC16Array;
+class CImConversationInfoImp;
+class MImConversationInfo;
+/**
+ * PSC group list subscription implementation
+ *
+ * @since S60 v3.2
+ */
+class CConversationSubscriptionItem : public CXIMPSubscriptionItemBase
+    {
+
+public: // Construction and destruction
+
+    /**
+     * Construction
+     * @param aParent. Parent has to be informed when this object is deleted by RemoveMe method.
+     */
+    static CConversationSubscriptionItem* NewLC( MXIMPItemParentBase& aParent );
+
+    /**
+     * Destruction
+     * - Remember to inform parent about delete.
+     */
+    IMPORT_C virtual ~CConversationSubscriptionItem();
+
+private: // Construction and destruction
+
+    /**
+     * Construction
+     * @param aParent. Parent has to be informed when this object is deleted by RemoveMe method.
+     */
+    CConversationSubscriptionItem( MXIMPItemParentBase& aParent );
+
+    /**
+     * Construction
+     */
+    void ConstructL();
+
+public: // New methods
+
+    /**
+     * Resolves deltas from new list and replaces old current.
+     * Ownership is transferred!
+     * @param aList New blocklist.
+     */
+    void  SetConversationInfoL(CImConversationInfoImp* aImMessage);
+public: // From MXIMPSubscriptionItem
+
+    /**
+     * @see MXIMPSubscriptionItem
+     */
+    void SynthesiseSubscriptionEventToL( MXIMPPscContext* aContext, TBool aForceEvent );
+private: // From CXIMPSubscriptionItemBase
+
+    /**
+     * @see CXIMPSubscriptionItemBase
+     */
+    void CleanExpired();
+
+private : 
+     /**
+     *  conversation info :Not owned
+     */
+	
+    CImConversationInfoImp* iConvinfo;
+    
+    //MXIMPItemParentBase& iParent;
+
+    };
+
+
+/* ======================================================================== */
+
+
+
+#endif // CPSCCONVERSATIONSUBSCRIPTIONITEM_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/imfeatureplugin/srcimdatamodel/imconversation/imconversationeventimp.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,162 @@
+/*
+* 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:  MImConversationEvent API object implementation.
+ *
+*/
+
+#include "imconversationeventimp.h"
+#include "ximpapiobjbase.h"
+#include "ximpapieventbase.h"
+#include "imconversationinfoimp.h"
+#include <ximpbase.h>
+//#include "ximpobjecthelpers.h"
+// ---------------------------------------------------------------------------
+// CImConversationEventImp::NewLC()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CImConversationEventImp* CImConversationEventImp::NewLC(CImConversationInfoImp* aConvinfo)
+    {
+    CImConversationEventImp* self = new( ELeave ) CImConversationEventImp();
+    CleanupStack::PushL( self );
+    self->ConstructL( aConvinfo );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CImConversationEventImp::NewFromStreamLC()
+// ---------------------------------------------------------------------------
+//
+CXIMPApiEventBase* CImConversationEventImp::NewFromStreamLC( RReadStream& aStream )
+    {
+    CImConversationEventImp* self = new( ELeave ) CImConversationEventImp;
+    CleanupStack::PushL( self );
+    self->ConstructL( aStream );
+    return self;
+    }
+// ---------------------------------------------------------------------------
+// CImConversationEventImp::EqualsContent
+// ---------------------------------------------------------------------------
+//
+TBool CImConversationEventImp::EqualsContent( 
+    const CXIMPApiEventBase& /*aOtherInstance */) const 
+    {
+    return ETrue;
+    }
+
+// ---------------------------------------------------------------------------
+// From class CXIMPApiEventBase
+// CImConversationEventImp::ExternalizeL
+// ---------------------------------------------------------------------------
+//
+void CImConversationEventImp::ExternalizeL( RWriteStream& aStream ) const
+    {
+    iConvInfo->ExternalizeL( aStream );
+    }
+
+
+// ---------------------------------------------------------------------------
+// CImConversationEventImp::~CImConversationEventImp()
+// ---------------------------------------------------------------------------
+//
+CImConversationEventImp::~CImConversationEventImp()
+    {
+   		delete iConvInfo;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CImConversationEventImp::CImConversationEventImp()
+// ---------------------------------------------------------------------------
+//
+CImConversationEventImp::CImConversationEventImp()
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// CImConversationEventImp::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void CImConversationEventImp::ConstructL(CImConversationInfoImp* aConvinfo)
+    {
+    iConvInfo = aConvinfo; // ownership is transfered here, need to delete iConvInfo
+    }
+
+
+// ---------------------------------------------------------------------------
+// CImConversationEventImp::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void CImConversationEventImp::ConstructL( RReadStream& aStream )
+    {
+    iConvInfo=CImConversationInfoImp::NewL();
+    iConvInfo->InternalizeL( aStream );
+    }
+
+// ---------------------------------------------------------------------------
+// Implement supported interface access.
+// ---------------------------------------------------------------------------
+//
+XIMPIMP_IF_BASE_GET_INTERFACE_BEGIN( CImConversationEventImp,
+                                     MImConversationEvent )
+    XIMPIMP_IF_BASE_GET_CLASS( CXIMPApiEventBase, this )
+XIMPIMP_IF_BASE_GET_INTERFACE_END()
+
+XIMPIMP_IF_BASE_GET_CONST_INTERFACE_BEGIN( CImConversationEventImp,
+                                           MImConversationEvent )
+    XIMPIMP_IF_BASE_GET_CONST_CLASS( CXIMPApiEventBase, this ) 
+XIMPIMP_IF_BASE_GET_INTERFACE_END()
+
+
+
+// ---------------------------------------------------------------------------
+// Implement methods from base event interface and base event class
+// ---------------------------------------------------------------------------
+//
+XIMPIMP_IMPLEMENT_EVENT_BASE_METHODS( CImConversationEventImp,
+                                      MImConversationEvent )
+
+
+
+
+// ---------------------------------------------------------------------------
+// CImConversationEventImp::InternalizeL( )
+// ---------------------------------------------------------------------------
+//
+
+void CImConversationEventImp::InternalizeL(  RReadStream& aStream ) 
+    { 
+    iConvInfo->InternalizeL( aStream );     
+    }
+
+// ---------------------------------------------------------------------------
+// CImConversationEventImp::NewTextMessage()
+// ---------------------------------------------------------------------------
+//  	 
+const MImConversationInfo& CImConversationEventImp:: NewTextMessage( TInt /*aIndex*/ ) const 
+	{
+	return *iConvInfo;
+	}
+    
+// ---------------------------------------------------------------------------
+// CImConversationEventImp::NewTextMessageCount()
+// ---------------------------------------------------------------------------
+//    
+    
+TInt CImConversationEventImp::NewTextMessageCount() const
+	 {
+	 return 1;	// since the count is always 1 
+	 }
+// End of file
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/imfeatureplugin/srcimdatamodel/imconversation/imconversationeventimp.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,124 @@
+/*
+* 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:  MImConversationEvent API object implementation.
+ *
+*/
+
+#ifndef CIMCONVERSATIONEVENTIMP_H
+#define CIMCONVERSATIONEVENTIMP_H
+
+#include  <s32strm.h>
+#include "ximpapieventbase.h"
+#include <imconversationevent.h>
+//#include "ximpdatasubscriptionstateimp.h"
+#include "imapiobjbase.h"
+
+
+class RReadStream;
+class CXIMPIdentityImp;
+class CImConversationInfoImp;
+class CXIMPDataSubscriptionStateImp;
+
+
+/**
+ * MImConversationEvent API object implementation.
+ *
+ * @lib Imdatamodel.dll
+ *
+ */
+NONSHARABLE_CLASS( CImConversationEventImp ): public CXIMPApiEventBase,public MImConversationEvent
+    {
+public:
+    /** The class ID. */
+    enum { KClassId = IMIMP_CLSID_CIMCONVERSATIONEVENTIMP };
+
+public:
+    /**
+     * Exported instantiation method for initializing
+     * new event object.
+     */
+    IMPORT_C static CImConversationEventImp* NewLC(
+            CImConversationInfoImp* aConvinfo
+            );
+
+    /**
+     * Instantiation method for event automation.
+     * Method signature must be exactly this to work
+     * with event delivery automation system.
+     *
+     * Event implementation must be registered to
+     * ImEventCodec KImEventConstructorTable.
+     */
+    static CXIMPApiEventBase* NewFromStreamLC( RReadStream& aStream );
+
+    virtual ~CImConversationEventImp();
+
+private:
+    CImConversationEventImp();
+
+    void ConstructL( CImConversationInfoImp* aConvinfo );
+            
+
+    void ConstructL( RReadStream& aStream );
+
+    
+
+    /**
+     * Helper for internalize
+     */
+    void InternalizeL( RReadStream& aStream ) ;
+            
+
+
+public: // From API base interfaces
+
+    /**
+     * Implementation of MXIMPBase interface methods
+     * @see MXIMPBase
+     */
+      XIMPIMP_DECLARE_IF_BASE_METHODS
+
+    /**
+     * Implementation of MImEventBase interface and
+     * CImApiEventBase methods
+     *
+     * @see MImEventBase
+     * @see CImApiEventBase
+     */
+   	XIMPIMP_DECLARE_EVENT_BASE_METHODS
+
+
+public: // From MImConversationEvent
+	/**
+     * 
+     * @see MImConversationEvent
+     */
+
+     TInt NewTextMessageCount() const;
+	 const MImConversationInfo& NewTextMessage( TInt aIndex ) const ;
+
+    
+
+private: // data
+
+	/**
+     * Conversation Info
+     * Own.
+     */
+     CImConversationInfoImp* iConvInfo;
+
+    };
+
+
+#endif // CIMCONVERSATIONEVENTIMP_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/imfeatureplugin/srcimdatamodel/imconversation/imconversationinfoimp.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,247 @@
+/*
+* 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:  MImConversationInfo API object implementation.
+*
+*/
+
+#include "imconversationinfoimp.h"
+#include "ximpidentityimp.h"
+#include "ximprbufhelpers.h"
+//#include "ximpobjecthelpers.h"
+
+// ============================ MEMBER FUNCTIONS =============================
+
+// ---------------------------------------------------------------------------
+// CImConversationInfoImp::NewLC()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CImConversationInfoImp* CImConversationInfoImp::NewLC()
+    {
+    CImConversationInfoImp* self = new( ELeave ) CImConversationInfoImp;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CImConversationInfoImp::NewL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CImConversationInfoImp* CImConversationInfoImp::NewL()
+    {
+    CImConversationInfoImp* self = NewLC();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CImConversationInfoImp::NewFromStreamLC()
+// ---------------------------------------------------------------------------
+//
+XIMPIMP_IMPLEMENT_DATAOBJ_NEWFROMSTREAM( CImConversationInfoImp )
+
+// ---------------------------------------------------------------------------
+// Implement supported interface access.
+// ---------------------------------------------------------------------------
+//
+XIMPIMP_IF_BASE_GET_INTERFACE_BEGIN( CImConversationInfoImp, MImConversationInfo )
+XIMPIMP_IF_BASE_GET_INTERFACE_END()
+XIMPIMP_IF_BASE_GET_CONST_INTERFACE_BEGIN( CImConversationInfoImp, MImConversationInfo )
+XIMPIMP_IF_BASE_GET_INTERFACE_END()
+
+// ---------------------------------------------------------------------------
+// CImConversationInfoImp::~CImConversationInfoImp()
+// ---------------------------------------------------------------------------
+//
+CImConversationInfoImp::~CImConversationInfoImp()
+    {
+    iTextMessage.Close();
+    if(iIdentity != NULL)
+	    {
+	    delete iIdentity;	
+	    }
+    if(iRecipients != NULL)
+    	{
+    	iRecipients->Reset();
+		delete iRecipients;   
+    	}
+    
+    }
+
+// ---------------------------------------------------------------------------
+// CImConversationInfoImp::CImConversationInfoImp()
+// ---------------------------------------------------------------------------
+//
+CImConversationInfoImp::CImConversationInfoImp()
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// CImConversationInfoImp::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void CImConversationInfoImp::ConstructL()
+    {
+    iTextMessage.CreateL( 0 );
+    iRecipients = new( ELeave ) CDesCArrayFlat( KArrayGranularity );
+    iIdentity = CXIMPIdentityImp::NewLC();
+    CleanupStack::Pop( iIdentity );
+    }
+
+// ---------------------------------------------------------------------------
+// CImConversationInfoImp::ExternalizeL()
+// ---------------------------------------------------------------------------
+//
+void CImConversationInfoImp::ExternalizeL( RWriteStream& aStream ) const
+    {
+    iIdentity->ExternalizeL( aStream );
+    XIMPRBuf16Helper::ExternalizeL( iTextMessage, aStream );
+    for(TInt index=0;index<iRecipients->MdcaCount();index++)
+		{
+			RBuf16 userId;			
+			userId.Create(iRecipients->MdcaPoint(index));
+	    	XIMPRBuf16Helper::ExternalizeL(userId, aStream );
+	    	userId.Close();
+		}    
+    }
+
+// ---------------------------------------------------------------------------
+// CImConversationInfoImp::InternalizeL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CImConversationInfoImp::InternalizeL( RReadStream& aStream )
+    {
+    iIdentity->InternalizeL( aStream );
+    XIMPRBuf16Helper::InternalizeL( iTextMessage, aStream ); 
+    TInt length = 0;
+    
+    TRAP_IGNORE(length = aStream.ReadInt32L());    
+    for ( TInt i = 0; i < length; i++ )
+        {
+        	RBuf16 userId; 	
+   			XIMPRBuf16Helper::GrowIfNeededL( userId, length );
+   			aStream.ReadL( userId, length );
+			iRecipients->AppendL(userId);
+			userId.Close();
+			TRAPD(leavecode,length = aStream.ReadInt32L());
+			if(leavecode != KErrNone) // if end of the Stream leavecode = KErrEof(-25)
+   				break;
+		} 
+    }
+  
+    
+// ---------------------------------------------------------------------------
+// From MImConversationInfo class.
+// CImConversationInfoImp::GroupId()
+// ---------------------------------------------------------------------------
+//
+const MXIMPIdentity& CImConversationInfoImp::MessageId() const
+    {
+    return *iIdentity;
+    }
+
+
+// ---------------------------------------------------------------------------
+// From MImConversationInfo class.
+// CImConversationInfoImp::TextMessage()
+// ---------------------------------------------------------------------------
+//
+const TDesC16& CImConversationInfoImp::TextMessage() const
+    {
+    return iTextMessage;
+    }
+    
+// ---------------------------------------------------------------------------
+// From MImConversationInfo class.
+// CImConversationInfoImp::RecipientL() 
+// ---------------------------------------------------------------------------
+//
+const MDesCArray& CImConversationInfoImp::RecipientL() const
+    {
+    return *iRecipients;
+    }
+
+// ---------------------------------------------------------------------------
+// From MImConversationInfo class.
+// CImConversationInfoImp::SetMessageIdL()
+// ---------------------------------------------------------------------------
+//
+void CImConversationInfoImp::SetMessageIdL( MXIMPIdentity* aIdentity )
+    {
+    CXIMPIdentityImp* identityImp =
+    TXIMPGetImpClassOrPanic< CXIMPIdentityImp>::From( *aIdentity );
+
+    delete iIdentity;
+    iIdentity = identityImp; 
+    }
+  
+
+// ---------------------------------------------------------------------------
+// From MImConversationInfo class.
+// CImConversationInfoImp::SetTextMessageL()
+// ---------------------------------------------------------------------------
+//
+void CImConversationInfoImp::SetTextMessageL( 
+    const TDesC16& aTextMessage )
+    {
+    HBufC16* TextMessageBuf = aTextMessage.AllocL();
+    iTextMessage.Close();
+    iTextMessage.Assign( TextMessageBuf );
+    }
+ 
+// ---------------------------------------------------------------------------
+// From MImConversationInfo class.
+// CImConversationInfoImp::SetRecipientL() recipient
+// ---------------------------------------------------------------------------
+//
+void CImConversationInfoImp::SetRecipientL(const MDesCArray* aRecipients) 
+    {
+	    for(TInt index=0;index<aRecipients->MdcaCount();index++)
+		{
+			HBufC* userId = aRecipients->MdcaPoint( index ).AllocL();
+			CleanupStack::PushL( userId );
+	    	iRecipients->AppendL(*userId);
+	    	CleanupStack::PopAndDestroy( userId ); // buf
+		}
+    }
+// ---------------------------------------------------------------------------
+// CImConversationInfoImp::Identity
+// ---------------------------------------------------------------------------
+//
+EXPORT_C const CXIMPIdentityImp& CImConversationInfoImp::IdentityImp() const
+    {
+    return *iIdentity;
+    }
+// ---------------------------------------------------------------------------
+// CImConversationInfoImp::SetIdentityL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CImConversationInfoImp::SetIdentity( CXIMPIdentityImp* aIdentity )
+    {
+    delete iIdentity;
+    iIdentity = aIdentity;
+    }
+// ---------------------------------------------------------------------------
+// CImConversationInfoImp::EqualsContent()
+// ---------------------------------------------------------------------------
+//
+TBool CImConversationInfoImp::EqualsContent( 
+    const CXIMPApiDataObjBase& /*aOtherInstance*/ ) const
+    {
+    return ETrue;
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/imfeatureplugin/srcimdatamodel/imconversation/imconversationinfoimp.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,139 @@
+/*
+* 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:  MImConversationInfo API object implementation.
+*
+*/
+
+#ifndef CIMCONVERSATIONINFOIMP_H
+#define CIMCONVERSATIONINFOIMP_H
+
+
+#include <s32strm.h>
+#include <badesca.h>
+#include <imconversationinfo.h>
+#include "ximpapidataobjbase.h"
+#include "imapiobjbase.h"
+
+
+class CImConversationInfoImp;
+class CXIMPIdentityImp;
+/**
+ * MImConversationInfo API object implementation.
+ *
+ * @lib Imdatamodel.dll
+ *
+ */
+NONSHARABLE_CLASS( CImConversationInfoImp ): public CXIMPApiDataObjBase,public MImConversationInfo
+    {
+    public:
+    /** The class ID. */
+    enum { KClassId = IMIMP_CLSID_CIMCONVERSATIONINFOIMP };
+
+public:
+    IMPORT_C static CImConversationInfoImp* NewLC();
+    IMPORT_C static CImConversationInfoImp* NewL();
+    virtual ~CImConversationInfoImp();
+
+private:
+
+    CImConversationInfoImp();
+    void ConstructL();
+    
+public: // From CXIMPApiDataObjBase
+
+    /**
+     * @see CXIMPApiDataObjBase
+     */
+    XIMPIMP_DECLARE_DATAOBJ_BASE_METHODS
+    XIMPIMP_DECLARE_IF_BASE_METHODS
+    
+public: // From MImConversationInfo
+
+	const MXIMPIdentity& MessageId() const;  	
+	const TDesC16& TextMessage() const;
+	const MDesCArray&  RecipientL() const;
+/*	const TDesC16& TextMessageSubject() const;
+	const TMessageTypes& MessageType() const;
+	const TDesC16& ContentMessage() const;
+	const TInt DeliveryReportResult() const;
+	const TDesC16& DeliveryReportDescription() const;
+	const MXIMPIdentity& ExtConvId() const;
+	const TDesC16& ExtConvGroupId() const;
+	const MXIMPIdentity& BlockedEntityId() const;
+	const TDesC16& BlockedEntityDisplayName() const;
+*/	
+	
+	void SetMessageIdL( MXIMPIdentity* aIdentity );
+	void SetTextMessageL( const TDesC16& aMessage );
+	void SetRecipientL(const MDesCArray* aRecipients);
+	
+	/*void SetMessageSubjectL( const TDesC16& aMessageSubject );	
+	void SetMessageTypeL( const TDesC16& aMessageType );
+	void SetContentMessageL( const TDesC16& aContMessage );
+	void SetExtConvIdL( MXIMPIdentity* aExIdentity );
+  	void SetDeliveryReportResultL( const TInt aResult );
+  	void SetDeliveryReportDescriptionL( const TDesC16& aDescription );
+	void SetExtConvGroupIdL( const TDesC16& aGroupId );
+  	void SetBlockedEntityIdL( MXIMPIdentity* aBlkIdentity );
+  	void SetBlockedEntityDisplayNameL( const TDesC16& aDisplayName );            
+      */                          
+public: // New functions
+
+    /**
+     * Internalizes object data from given stream.
+     * @param aStream Stream to read.
+     */
+    IMPORT_C void InternalizeL( RReadStream& aStream );
+
+    /**
+     * Set identity
+     */
+    IMPORT_C void SetIdentity( CXIMPIdentityImp* aIdentity );
+
+    /**
+     * TLinearOrder for ordering based on stored group id,
+     * when this class is used within an RPointerArray or derivatives.
+     */
+    IMPORT_C static TInt IdLinearOrder(
+            const CImConversationInfoImp& aA,
+            const CImConversationInfoImp& aB );
+
+    /**
+     * Access to identity object
+     * @return Identity
+     */
+    IMPORT_C const CXIMPIdentityImp& IdentityImp() const;
+
+private: // data
+
+    /**
+     * Identity
+     */
+    CXIMPIdentityImp* iIdentity;
+
+    /**
+     * TextMessage
+     */
+    RBuf16 iTextMessage;
+    
+    /**
+     * Receipient(s) of the Message
+     */
+    CDesCArray* iRecipients ;
+    
+
+    };
+
+
+#endif // CIMCONVERSATIONINFOIMP_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/imfeatureplugin/srcimdatamodel/imdatacacheimp.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,171 @@
+/*
+* 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:  IM Service Connection data cache implementation.
+ *
+*/
+
+
+#include <badesca.h>
+#include <e32cmn.h>
+
+#include "imdatacacheimp.h"
+//#include "ximpidentityimp.h"
+//#include "ximpobjecthelpers.h"
+#include "ximphost.h"
+//#include "ximppsccontext.h"
+//#include "ximpoperationdefs.h"
+#include "ximpapieventbase.h"
+//#include "ximptrace.h"
+#include "conversationsubscriptionitem.h"
+#include "imconversationeventimp.h"
+
+// ---------------------------------------------------------------------------
+// CImDataCache::CImDataCache()
+// ---------------------------------------------------------------------------
+//
+CImDataCache::CImDataCache( MXIMPHost& aHost )
+:iHost( aHost )
+    {
+    }
+// ---------------------------------------------------------------------------
+// CImDataCache::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void CImDataCache::ConstructL()
+    {
+      
+    }
+// ---------------------------------------------------------------------------
+// CImDataCache::NewL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CImDataCache* CImDataCache::NewL( MXIMPHost& aHost )
+    {
+  	CImDataCache* self = new( ELeave ) CImDataCache( aHost );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self; 
+    }
+// ---------------------------------------------------------------------------
+// CImDataCache::~CImDataCache()
+// ---------------------------------------------------------------------------
+//
+CImDataCache::~CImDataCache()
+    {
+
+    }
+// ---------------------------------------------------------------------------
+// CImDataCache::RemoveMe
+// ---------------------------------------------------------------------------
+//
+template< class Type >
+EXPORT_C void CImDataCache::RemoveMe( Type*& aItem, Type* aChild )
+    {
+    if( aChild == aItem )
+        {
+        aItem = NULL;
+        }
+    }
+// ---------------------------------------------------------------------------
+// CImDataCache::AddEventL
+// ---------------------------------------------------------------------------
+//
+void CImDataCache::AddEventL( CXIMPApiEventBase& aEvent, MXIMPPscContext* aContext )
+    {
+    iHost.AddEventL( aEvent, aContext );
+    }
+
+// ---------------------------------------------------------------------------
+// CImDataCache::RegisterExpiringItemL
+// ---------------------------------------------------------------------------
+//
+void CImDataCache::RegisterExpiringItemL( CXIMPSubscriptionItemBase* /*aExpireItem*/ )
+    {
+    
+    }
+// ---------------------------------------------------------------------------
+// CImDataCache::UnregisterExpiringItemL
+// ---------------------------------------------------------------------------
+//
+void CImDataCache::UnregisterExpiringItem( CXIMPSubscriptionItemBase* /*aExpireItem*/ )
+    {
+ 
+    }
+// ---------------------------------------------------------------------------
+// CImDataCache::ItemLC
+// ---------------------------------------------------------------------------
+//
+template< class Type >
+Type& CImDataCache::ItemLC( Type*& aItem )
+    {
+   if( !aItem )
+        {
+        aItem = Type::NewLC( *this );
+        }
+    else
+        {
+        User::LeaveIfError( aItem->Open() );
+        CleanupClosePushL( *aItem );
+        }
+	return *aItem;
+    }
+// ---------------------------------------------------------------------------
+// CImDataCache::CleanResources
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CImDataCache::CleanResources( MXIMPPscContext& /*aContext*/ )
+    {
+
+    }
+// ---------------------------------------------------------------------------
+// CImDataCache::CleanExpired
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CImDataCache::CleanExpired()
+    {
+    
+    }
+// ---------------------------------------------------------------------------
+// CImDataCache::RemoveMe
+// ---------------------------------------------------------------------------
+//    
+void CImDataCache::RemoveMe( CConversationSubscriptionItem* aChild )
+    {
+   RemoveMe< CConversationSubscriptionItem >( 
+                                    iConversationSubscriptionItem, aChild ); 
+    }
+// ---------------------------------------------------------------------------
+// CImDataCache::ConversationSubscriptionItemLC
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CConversationSubscriptionItem& CImDataCache::ConversationSubscriptionItemLC()
+    {
+    return ItemLC< CConversationSubscriptionItem >( iConversationSubscriptionItem );
+    }
+    
+TAny* CImDataCache::GetInterface(TInt aInterfaceId)  
+	{
+		if(aInterfaceId == IM_ITEM_PARENT)
+			{
+			return static_cast<MXIMPIMItemParent*>(this) ;	
+			}
+		else
+			{
+			User::Panic( _L("CXIMPIMCache"), KErrExtensionNotSupported );
+			}
+		return NULL ;
+	}
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/imfeatureplugin/srcimdatamodel/imdatacacheimp.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,142 @@
+/*
+* 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:  IM data cache implementation.
+*
+*/
+
+#ifndef CIMDATACACHEIMP_H
+#define CIMDATACACHEIMP_H
+
+#include "ximpapiobjbase.h"
+#include "imapiobjbase.h"
+//#include "ximpitemparent.h"
+#include "ximpimitemparent.h"
+#include "imtypehelpers.h"
+//#include "ximpoperationdefs.h"
+#include "ximpapieventbase.h"
+
+class MXIMPHost;
+class CConversationSubscriptionItem;
+class CXIMPIdentityImp;
+class MXIMPPscContext;
+class CXIMPIMSubscriptionItemBase;
+class MXIMPStatus;
+class MXIMPIdentity;
+class MXIMPDataSubscriptionState;
+class CXIMPDataSubscriptionStateImp;
+
+
+/**
+ * PSC Im Data Cache implementation.
+ *
+ * @since S60 v3.2
+ */
+class CImDataCache : public CBase,
+                           public MXIMPIMItemParent
+    {
+public: // Definitions
+
+    /** The class ID. */
+    enum { KClassId = IMIMP_CLSID_CIMDATACACHE };
+
+
+public: // Construction and destruction
+
+    /**
+     * Construction
+     */
+    IMPORT_C static CImDataCache* NewL( MXIMPHost& aHost );
+
+    /**
+     * Destruction
+     */
+    virtual ~CImDataCache();
+
+private:
+
+    CImDataCache( MXIMPHost& aHost );
+    void ConstructL();
+    
+private:   // MXIMPIMItemParentBase
+
+	TAny* GetInterface(TInt aInterfaceId);
+    // Expiring items
+    void RegisterExpiringItemL( CXIMPSubscriptionItemBase* aExpireItem );
+    void UnregisterExpiringItem( CXIMPSubscriptionItemBase* aExpireItem );
+    
+private: // From MXIMPIMItemParent
+
+    /**
+     * @see MXIMPIMItemParent
+     */
+    void RemoveMe( CConversationSubscriptionItem* aChild );
+
+    // Other methods
+    void AddEventL( CXIMPApiEventBase& aEvent, MXIMPPscContext* aContext );
+
+public: // New methods
+
+    /**
+     * - If CConversationSubscriptionItem is not found, data cache
+     *   initializes new one and returns ownership to caller
+     * - If CConversationSubscriptionItem is found, data cache increases
+     *   refcount by one, and returns the old object
+     */
+	IMPORT_C CConversationSubscriptionItem& ConversationSubscriptionItemLC();
+    /**
+     * Clean resources concerning context.
+     */
+    IMPORT_C void CleanResources( MXIMPPscContext& aContext );
+
+    /**
+     *
+     */
+    IMPORT_C void CleanExpired();
+    
+private: // Helper methods
+
+    /**
+     * Template method for removeMe when one subscription item is target.
+     * @param aItem Reference to subscription item pointer to remove.
+     * @param Pointer of item to remove.
+     */
+    template< class Type >
+    IMPORT_C static void RemoveMe( Type*& aItem, Type* aChild );
+
+    
+    /**
+     * Templated item instance creation. If item is not found it is created.
+     * @param aItem Reference to pointer where new item should be saved.
+     * @return Reference to item created.
+     */
+    template< class Type > 
+    Type& ItemLC( Type*& aItem );
+
+   
+    
+private: // Data
+
+    /**
+     * Access to host.
+     */
+    MXIMPHost& iHost;
+
+    /**
+     * Does not own. Removed when RemoveMe called.
+     */
+ 	CConversationSubscriptionItem* iConversationSubscriptionItem;
+ 
+    };
+
+#endif // CIMDATACACHEIMP_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/imfeatureplugin/srcimdatamodel/imdatamodelhook/imdatamodelhook.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,46 @@
+/*
+* 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:  XIMP Framework's IM  Data Model Hook implementation.
+*
+*/
+
+
+#include "imdlluids.hrh"
+#include "imapidataobjfactoryaccessor.h"
+#include <ecom/implementationproxy.h>
+#include <e32base.h>
+
+
+// ---------------------------------------------------------------------------
+// Key value pair table to identify correct constructor
+// function for the requested interface.
+// ---------------------------------------------------------------------------
+//
+const TImplementationProxy ImplementationTable[] =
+    {
+    IMPLEMENTATION_PROXY_ENTRY( XIMP_ECOM_IMPL_UID_IM_DATAMODEL_INTERFACE,
+                                CImApiDataObjFactoryAccessor::NewL )
+    };
+
+
+// ---------------------------------------------------------------------------
+// Exported function to return the implementation proxy table
+// ---------------------------------------------------------------------------
+//
+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/imservices/imfeatureplugin/srcimdatamodel/imdatamodelhook/imdatamodelhook.rss	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,52 @@
+/*
+* 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:  ECom registery info for ECom hook
+*
+*/
+
+
+#include <ecom/registryinfov2.rh>
+#include "imdlluids.hrh"
+#include <immanagementifids.hrh>
+#include <ximpfeaturepluginifids.hrh>
+
+// ---------------------------------------------------------------------------
+// ECom registery info for XIMP IM Manager ECom hook
+// ---------------------------------------------------------------------------
+//
+RESOURCE REGISTRY_INFO theInfo
+    {
+    resource_format_version = RESOURCE_FORMAT_VERSION_2;
+    dll_uid = XIMP_DLL_UID_IM_DATAMODEL_HOOK;
+
+    interfaces =
+        {
+        INTERFACE_INFO
+            {
+            interface_uid = XIMP_ECOM_IF_UID_PROTOCOL_DATAMODEL_CODEC_INTERFACE;
+            implementations =
+                {
+                IMPLEMENTATION_INFO
+                    {
+                    implementation_uid = XIMP_ECOM_IMPL_UID_IM_DATAMODEL_INTERFACE;
+                    version_no         = 1;
+                    display_name       = "S60 Default XIMP";
+                    default_data       = XIMP_ECOM_DEFAULT_DATA_IM_INTERFACE;
+                    opaque_data        = "";
+                    }
+                };
+            }
+        };
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/imfeatureplugin/srcimdatamodel/imeventcodec.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,251 @@
+/*
+* 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:  Base class for API implementations.
+*
+*/
+
+#include "imeventcodec.h"
+#include "imconversationeventimp.h"
+#include "ximpapieventbase.h"
+#include <s32strm.h>
+#include <s32mem.h>
+
+/**
+ * Type definition for exact API event constructor signature.
+ */
+typedef CXIMPApiEventBase* (*TApiEventConstructor)( RReadStream& );
+
+/**
+ * Structure for mapping event interface IDs to
+ * to corect API event constructors.
+ */
+struct SApiEventConstructorMap
+    {
+    //Interface id
+    TInt32    iInterfaceId;
+
+    //Function pointer to event interface implementation
+    TApiEventConstructor iConstructorPtr;
+    } ;
+
+/**
+ * Helper macro to initialise KApiEventConstructorTable members.
+ *
+ * Macro forces that each event implementation class to have static
+ * NewFromStreamLC() memeber function to instantiate the object.
+ *
+ * See TApiEventConstructor type definition for exact constructor
+ * signature.
+ */
+#define CONSTRUCTOR_ENTRY( TheImplementedIf, TheClass ) \
+    { TheImplementedIf::KInterfaceId, TheClass::NewFromStreamLC } \
+
+
+/**
+ * Constructor function mapping for event interface implementations.
+ *
+ * When new event types are implemented, add them here.
+ */
+
+const SApiEventConstructorMap KApiEventConstructorTable[] =
+    {
+		CONSTRUCTOR_ENTRY( MImConversationEvent, CImConversationEventImp ),
+    };
+
+
+/**
+ * Count of constructor mappings.
+ */
+const TInt KApiEventConstructorCount = sizeof( KApiEventConstructorTable )
+                                        / sizeof( SApiEventConstructorMap );
+
+
+
+// ============================ HELPER FUNCTIONS =============================
+
+
+/**
+ * Helper function to locate constructor function for
+ * event interface ID.
+ *
+ * @param aEventInterfaceId The event interface ID.
+ * @return Event object constructor function.
+ */
+TApiEventConstructor ConstructorForInterface( TInt32 aEventInterfaceId )
+    {
+    //Locate correct constructor
+    for( TInt ix = 0; ix < KApiEventConstructorCount; ix++ )
+        {
+     const SApiEventConstructorMap map = KApiEventConstructorTable[ ix ];
+        if( map.iInterfaceId == aEventInterfaceId )
+            {
+            return map.iConstructorPtr;
+            }  
+        }
+    return NULL;
+    }
+
+
+/**
+ * Helper function to instantiate new event object
+ * of requested type and construct it from the stream.
+ *
+ * @param aEventInterfaceId
+ * @return Event object constructor function.
+ */
+CXIMPApiEventBase* NewEventObjectFromStreamLC( TInt32 aEventInterfaceId,
+                                               RReadStream& aStream )
+    {
+    TApiEventConstructor newFromStreamLC = NULL;
+
+    //Locate correct constructor for interface ID
+    newFromStreamLC = ConstructorForInterface( aEventInterfaceId );
+
+    if( ! newFromStreamLC )
+	    {
+	    return 	NULL;
+	    }
+    //Instantiate the object
+    CXIMPApiEventBase* eventObject = newFromStreamLC( aStream );
+
+    return eventObject;    
+    }
+
+
+// ============================ MEMBER FUNCTIONS =============================
+
+
+// ---------------------------------------------------------------------------
+// CImEventCodec::NewL()
+// ---------------------------------------------------------------------------
+//
+CImEventCodec* CImEventCodec::NewL()
+    {
+    CImEventCodec* self = new( ELeave ) CImEventCodec() ;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CImEventCodec::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void CImEventCodec::ConstructL()
+    {
+    }
+// ---------------------------------------------------------------------------
+// CImEventCodec::CImEventCodec()
+// ---------------------------------------------------------------------------
+//
+CImEventCodec::CImEventCodec()
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// CImEventCodec::~CImEventCodec()
+// ---------------------------------------------------------------------------
+//
+CImEventCodec::~CImEventCodec()
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// CImEventCodec::PackL()
+// ---------------------------------------------------------------------------
+//
+HBufC8* CImEventCodec::PackL( CXIMPApiEventBase& aEventObj,
+                                        TInt32& aTypeOfEvent )
+    {
+    CBufFlat* buffer = CBufFlat::NewL( 10 ); // initial granularity to 10
+    CleanupStack::PushL( buffer );
+
+    RBufWriteStream ws;
+    CleanupClosePushL( ws );
+    ws.Open( *buffer ); // CSI: 65 #
+
+    //Ask real event type through the event base interface
+    TInt32 eventIfId = aEventObj.Base().GetInterfaceId();
+
+    //And write both event type and data
+    ws.WriteInt32L( eventIfId );
+    aEventObj.ExternalizeL( ws );
+    ws.CommitL();
+    CleanupStack::PopAndDestroy();  //ws
+
+    HBufC8* heapBuf = buffer->Ptr( 0 ).AllocL();
+
+    CleanupStack::PopAndDestroy( buffer );
+
+
+    aTypeOfEvent = eventIfId;
+    return heapBuf;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CImEventCodec::PackL()
+// ---------------------------------------------------------------------------
+//
+void CImEventCodec::PackL( CXIMPApiEventBase& aEventObj,
+                                     TInt32& aTypeOfEvent,
+                                     CBufFlat* aBuffer )
+    {
+    RBufWriteStream ws;
+    CleanupClosePushL( ws );
+    ws.Open( *aBuffer ); // CSI: 65 #
+
+    //Ask real event type through the event base interface
+    TInt32 eventIfId = aEventObj.Base().GetInterfaceId();
+
+    //And write both event type and data
+    ws.WriteInt32L( eventIfId );
+    aEventObj.ExternalizeL( ws );
+    ws.CommitL();
+    CleanupStack::PopAndDestroy( );  //ws
+    
+    aTypeOfEvent = eventIfId;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CImEventCodec::UnPackL()
+// ---------------------------------------------------------------------------
+//
+CXIMPApiEventBase* CImEventCodec::UnPackL( const TDesC8& aEventData,
+                                                     TInt32& aTypeOfEvent )
+    {
+    RDesReadStream rs;
+    rs.Open( aEventData ); // CSI: 65 #
+    CleanupClosePushL( rs );
+
+    TInt32 eventIfId = rs.ReadInt32L();
+    CXIMPApiEventBase* eventObject = NewEventObjectFromStreamLC( eventIfId, rs );
+    if( eventObject )
+	    {
+	    CleanupStack::Pop( eventObject ); //eventObject	
+	    }
+    
+    CleanupStack::PopAndDestroy(  ); // rs
+
+
+    aTypeOfEvent = eventIfId;
+    return eventObject;
+    }
+
+
+// End of file
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/imfeatureplugin/srcimdatamodel/imeventcodec.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,104 @@
+/*
+* 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:  Codec to pack and unpack event objects.
+*
+*/
+
+#ifndef IMEVENTCODEC_H
+#define IMEVENTCODEC_H
+
+#include <e32base.h>
+
+#include "eventcodec.h"
+
+class CXIMPApiEventBase;
+class RReadStream;
+
+
+/**
+ * Codec to pack and unpack event objects.
+ *
+ * @lib ximpdatamodel.dll
+ * @since S60 v3.2
+ */
+NONSHARABLE_CLASS( CImEventCodec ): public MEventCodec
+    {
+    
+public:
+    static CImEventCodec* NewL();
+    
+    ~CImEventCodec();
+    
+    
+    /**
+     * packs and allocates memory for the  
+     * event object and event type
+     *
+     * @param aEventObj  
+     * event object derived from CXIMPApiEventBase
+     * 
+     * @param aTypeOfEvent 
+     * holds  type of the event after execution from aEventObj
+     * 
+     * @return
+     * heap allocated which contains both
+     * event and event type
+     */
+    HBufC8* PackL( CXIMPApiEventBase& aEventObj,
+                                   TInt32& aTypeOfEvent );
+                                   
+    /**
+     * packs  
+     * event object and event type into the buffer
+     *
+     * @param aEventObj  
+     * event object derived from CXIMPApiEventBase
+     * 
+     * @param aTypeOfEvent 
+     * holds  type of the event after execution from aEventObj 
+     * 
+     * @param
+     * buffer to be packed  with
+     * event and event type
+     */                               
+                                   
+    void PackL( CXIMPApiEventBase& aEventObj,
+                         TInt32& aTypeOfEvent,
+                         CBufFlat* aBuffer );
+
+    /**
+     *
+     * @param aEventData
+     * data desc which has the event type and id
+     *
+     * @param aTypeOfEvent 
+     * holds  type of the event after execution from aEventData 
+     *
+     * @return new eventbase object constructed from aEventData
+     *
+     */
+    CXIMPApiEventBase* UnPackL( const TDesC8& aEventData,
+                                                TInt32& aTypeOfEvent );
+protected:
+    void ConstructL();
+
+private:
+
+    CImEventCodec();
+
+
+    };
+
+
+#endif // IMEVENTCODEC_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/imfeatureplugin/srcimdatamodel/imobjectfactoryimp.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,110 @@
+/*
+* 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:  Implementation of ImManagement
+ *
+*/
+
+
+//#include "ximpstatusimp.h"
+//#include "ximprestrictedobjectcollectionimp.h"
+//#include "ximpobjectcollectionimp.h"
+//#include "ximpidentityimp.h"
+//#include "ximpdatasubscriptionstateimp.h"
+#include "imobjectfactoryimp.h"
+#include "imconversationinfoimp.h"
+
+
+// ============================ MEMBER FUNCTIONS =============================
+
+// ---------------------------------------------------------------------------
+// CImObjectFactoryImp::NewL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CImObjectFactoryImp* CImObjectFactoryImp::NewL()
+    {
+    CImObjectFactoryImp* self = new( ELeave ) CImObjectFactoryImp;
+    return self;
+    
+    }
+
+// ---------------------------------------------------------------------------
+// Implement supported interface access.
+// ---------------------------------------------------------------------------
+//
+XIMPIMP_IF_BASE_GET_INTERFACE_BEGIN( CImObjectFactoryImp, 
+                                     MImObjectFactory )
+XIMPIMP_IF_BASE_GET_INTERFACE_END()
+
+
+XIMPIMP_IF_BASE_GET_CONST_INTERFACE_BEGIN( CImObjectFactoryImp, 
+                                           MImObjectFactory )
+XIMPIMP_IF_BASE_GET_INTERFACE_END()
+
+// ---------------------------------------------------------------------------
+// CImObjectFactoryImp::~CImObjectFactoryImp()
+// ---------------------------------------------------------------------------
+//
+CImObjectFactoryImp::~CImObjectFactoryImp()
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// CImObjectFactoryImp::CImObjectFactoryImp()
+// ---------------------------------------------------------------------------
+//
+CImObjectFactoryImp::CImObjectFactoryImp()
+    {
+    }
+    
+    
+// ---------------------------------------------------------------------------
+// CImObjectFactoryImp::NewImConversationInfoLC()
+// ---------------------------------------------------------------------------
+//
+MImConversationInfo* CImObjectFactoryImp::NewImConversationInfoLC()
+    {
+    return CImConversationInfoImp::NewLC();
+    }
+ // ---------------------------------------------------------------------------
+// CImObjectFactoryImp::NewImGroupInfoLC()
+// ---------------------------------------------------------------------------
+//
+//MImGroupInfo* CImObjectFactoryImp::NewImGroupInfoLC()
+    //{
+    //return CImConversationInfoImp::NewLC();
+    //}
+    
+    
+// ---------------------------------------------------------------------------
+// CImObjectFactoryImp::NewImInvitationInfoLC()
+// ---------------------------------------------------------------------------
+//
+//MImInvitationInfo* CImObjectFactoryImp::NewImInvitationInfoLC()
+    //{
+    //return CImConversationInfoImp::NewLC();
+    //}
+    
+ // ---------------------------------------------------------------------------
+// CImObjectFactoryImp::NewImSearchInfoLC()
+// ---------------------------------------------------------------------------
+//
+//MImSearchInfo* CImObjectFactoryImp::NewImSearchInfoLC()
+    //{
+    //return CImConversationInfoImp::NewLC();
+    //}   
+    
+    
+    
+ 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/imfeatureplugin/srcimdatamodel/imobjectfactoryimp.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,73 @@
+/*
+* 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:  Implementation of MImObjectFactory
+ *
+*/
+
+#ifndef CIMOBJECTFACTORYIMP_H
+#define CIMOBJECTFACTORYIMP_H
+
+#include <imobjectfactory.h>
+#include "ximpapiobjbase.h"
+#include "imapiobjbase.h"
+
+class MImGroupInfo;
+class MImConversationInfo;
+class MImInvitationInfo;
+class MImSearchInfo;
+
+/**
+ * MImObjectFactory API object implementation.
+ *
+ * @lib immanager.dll
+ * @since S60 v3.2
+ */
+class CImObjectFactoryImp: public CXIMPApiObjBase,
+                                 public MImObjectFactory
+    {
+    public:
+    /** The class ID. */
+    enum { KClassId = IMIMP_CLSID_CIMOBJECTFACTORYIMP };
+
+
+public:
+
+    IMPORT_C static CImObjectFactoryImp* NewL();
+    ~CImObjectFactoryImp();
+
+private:
+    CImObjectFactoryImp();
+
+
+
+public: // From MXIMPBase
+
+    /**
+     * Implementation of MXIMPBase interface methods
+     * @see MXIMPBase
+     */
+    XIMPIMP_DECLARE_IF_BASE_METHODS
+
+
+public: //From MImObjectFactory
+
+	MImConversationInfo* NewImConversationInfoLC();
+    //MImGroupInfo* NewImGroupInfoLC();    
+    //MImInvitationInfo* NewImInvitationInfoLC();
+    //MImSearchInfo* NewImSearchInfoLC();
+   
+    };
+
+
+#endif // CIMOBJECTFACTORYIMP_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/imfeatureplugin/srcimdatamodel/imtypehelpers.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,48 @@
+/*
+* 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:  Typedef helpers for really long typenames.
+ *
+*/
+
+#ifndef IMTYPEHELPERS_H
+#define IMTYPEHELPERS_H
+
+#include "ximpapiobjbase.h"
+#include "imapiobjbase.h"
+#include <e32base.h>
+
+class CXIMPApiDataObjBase;
+
+// Key for opening up the typedefs:
+//
+// R(Xyz)Array = RXIMPObjOwningPtrArray<xyz>
+// Im = IM
+// GrpInfo = GroupInfo
+// GrpMemInfo = GroupMemberInfo
+// WatLstInfo = WatcherListInfo
+//
+// When adding new types, follow these conventions.
+//
+
+struct SImReqParam
+    {
+    CXIMPApiDataObjBase* iParam;
+    TInt iParamType;
+    };
+
+typedef RArray<SImReqParam> RImReqParamArray;
+
+#endif // IMTYPEHELPERS_H
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/imfeatureplugin/srcimdatamodel/ximpimitemparent.h	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  Item parent interface.
+*
+*/
+
+#ifndef CXIMPIMITEMPARENT_H
+#define CXIMPIMITEMPARENT_H
+
+#include <ximpitemparentbase.h>
+
+class CConversationSubscriptionItem;
+class CXIMPIMSubscriptionItemBase;
+class CXIMPApiEventBase;
+class MXIMPPscContext;
+class CXIMPIdentityImp;
+class CXIMPConfigurationItemBase;
+
+//FIX ME
+#define IM_ITEM_PARENT	0xE0000008
+
+/**
+ * Item parent interface.
+ *
+ * @since S60 v3.2
+ */
+class MXIMPIMItemParent : public MXIMPItemParentBase
+    {
+    
+	public:
+		enum { KInterfaceId = IM_ITEM_PARENT};
+	
+	public: // Definitions
+
+    /**
+     * Remove item
+     * @param aChild Item pointer to remove.
+     */
+    virtual void RemoveMe( CConversationSubscriptionItem* aChild ) = 0;
+
+    /**
+     * Add event
+     */
+    virtual void AddEventL( CXIMPApiEventBase& aEvent, MXIMPPscContext* aContext ) = 0;
+
+    
+protected: // Destruction
+    
+    /**
+     * Object cannot be delted through this interface
+     */
+    virtual ~MXIMPIMItemParent(){}
+    };
+
+/* ======================================================================== */
+
+
+
+#endif // CXIMPIMITEMPARENT_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/imfeatureplugin/srcimdatamodel/ximpimsubscriptionitembase.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,460 @@
+/*
+* 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:  IM Service Connection subscription item base implementation.
+*
+*/
+
+
+#include "ximpimsubscriptionitembase.h"
+#include "ximpimitemparent.h"
+#include "ximppanics.h"
+//#include "ximppsccontext.h"
+//#include "ximpdatasubscriptionstateimp.h"
+//#include "ximpobjecthelpers.h"
+
+//#include "ximptrace.h"
+
+const TInt KXIMPContentAutoExpiryTime = 15; // Seconds
+
+
+// ---------------------------------------------------------------------------
+// CXIMPIMSubscriptionItemBase::OrderOfContexts()
+// ---------------------------------------------------------------------------
+//
+TInt CXIMPIMSubscriptionItemBase::OrderOfContexts( const MXIMPPscContext& aFirst,
+                                                 const MXIMPPscContext& aSecond )
+    {
+    if( &aFirst < &aSecond )
+        {
+        return -1;
+        }
+    else if( &aFirst == &aSecond )
+        {
+        return 0;
+        }
+    else
+        {
+        return 1;
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CXIMPIMSubscriptionItemBase::OrderOfItems()
+// ---------------------------------------------------------------------------
+//
+TInt CXIMPIMSubscriptionItemBase::OrderOfItems( const CXIMPIMSubscriptionItemBase& aFirst,
+                                              const CXIMPIMSubscriptionItemBase& aSecond )
+    {
+    if( &aFirst < &aSecond )
+        {
+        return -1;
+        }
+    else if( &aFirst == &aSecond )
+        {
+        return 0;
+        }
+    else
+        {
+        return 1;
+        }
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPIMSubscriptionItemBase::CXIMPIMSubscriptionItemBase()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CXIMPIMSubscriptionItemBase::CXIMPIMSubscriptionItemBase( MXIMPIMItemParent& aParent )
+: iParent( aParent )
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// CXIMPIMSubscriptionItemBase::BaseConstructL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CXIMPIMSubscriptionItemBase::BaseConstructL()
+    {
+    iSubscriptionState = CXIMPDataSubscriptionStateImp::NewL();
+    }
+
+// ---------------------------------------------------------------------------
+// CXIMPIMSubscriptionItemBase::~CXIMPIMSubscriptionItemBase()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CXIMPIMSubscriptionItemBase::~CXIMPIMSubscriptionItemBase()
+    {
+    __ASSERT_ALWAYS( !CountOfSubscribers(),
+                     User::Panic( NXIMPPrivPanic::KCategory, NXIMPPrivPanic::EArrayCountNotValid ) );
+    iContexts.Close();
+    iPreContexts.Close();
+    iItems.Close();
+    iPreItems.Close();
+
+    delete iSubscriptionState;
+    }
+
+// ---------------------------------------------------------------------------
+// CXIMPIMSubscriptionItemBase::SubscriptionStatus()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CXIMPIMSubscriptionItemBase::TSubscriptionStatus
+           CXIMPIMSubscriptionItemBase::SubscriptionStatus( MXIMPPscContext* aContext )
+    {
+    // Calculate situation
+    TInt count = iContexts.Count() + iItems.Count();
+    
+    if( count == 0 )
+        {
+        return ENotSubscribedAtAll;
+        }
+    if( IsContext( aContext ) )
+        {
+        if( count == 1 )
+            {
+            return ESubscribedForCtxOnly;
+            }
+        return ESubscribedForCtxAndOthers;
+        }
+    return ESubscribedForOtherCtxOnly;
+    }
+
+// ---------------------------------------------------------------------------
+// CXIMPIMSubscriptionItemBase::AddSubscriberL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CXIMPIMSubscriptionItemBase::AddSubscriberL( MXIMPPscContext* aContext )
+    {
+    TLinearOrder< MXIMPPscContext > order( OrderOfContexts );
+    if( IsContext( aContext ) )
+        {
+        User::Leave( KErrAlreadyExists );
+        }
+    TInt index = iPreContexts.FindInOrder( aContext, order );
+    if( index != KErrNotFound )
+        {
+        User::Leave( KErrAlreadyExists );
+        }
+
+    iPreContexts.InsertInOrderL( aContext, order );
+    User::LeaveIfError( Open() );
+    ChangeStatusAfterAdd();
+    }
+
+// ---------------------------------------------------------------------------
+// CXIMPIMSubscriptionItemBase::RemoveSubscriber()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CXIMPIMSubscriptionItemBase::RemoveSubscriber( MXIMPPscContext* aContext )
+    {
+    TLinearOrder< MXIMPPscContext > order( OrderOfContexts );
+    TInt index = iContexts.FindInOrder( aContext, order );
+    TInt preIndex = iPreContexts.FindInOrder( aContext, order );
+    if( index >= 0 )
+        {
+        iContexts.Remove( index );
+        ChangeStatusAfterRemove();
+        Close();
+        }
+    else if( preIndex >= 0 )
+        {
+        iPreContexts.Remove( preIndex );
+        ChangeStatusAfterRemove();
+        Close();
+        }
+    else
+        {
+        iParent.UnregisterExpiringItem( this );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CXIMPIMSubscriptionItemBase::AddSubscriberL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CXIMPIMSubscriptionItemBase::AddSubscriberL( CXIMPIMSubscriptionItemBase* aItem )
+    {
+    TLinearOrder< CXIMPIMSubscriptionItemBase > order( OrderOfItems );
+    TInt index = iItems.FindInOrder( aItem, order );
+    if( index != KErrNotFound )
+        {
+        return;
+        }
+    index = iPreItems.FindInOrder( aItem, order );
+    if( index != KErrNotFound )
+        {
+        return;
+        }
+
+    iPreItems.InsertInOrderL( aItem, order );
+    User::LeaveIfError( Open() );
+    ChangeStatusAfterAdd();
+    }
+
+// ---------------------------------------------------------------------------
+// CXIMPIMSubscriptionItemBase::RemoveSubscriber()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CXIMPIMSubscriptionItemBase::RemoveSubscriber( CXIMPIMSubscriptionItemBase* aItem )
+    {
+    TLinearOrder< CXIMPIMSubscriptionItemBase > order( OrderOfItems );
+    TInt index = iItems.FindInOrder( aItem, order );
+    TInt preIndex = iPreItems.FindInOrder( aItem, order );
+    if( index >= 0 )
+        {
+        iItems.Remove( index );
+        ChangeStatusAfterRemove();
+        Close();
+        }
+    else if( preIndex >= 0 )
+        {
+        iPreItems.Remove( index );
+        ChangeStatusAfterRemove();
+        Close();
+        }
+    else
+        {
+        iParent.UnregisterExpiringItem( this );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CXIMPIMSubscriptionItemBase::ForceClose()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CXIMPIMSubscriptionItemBase::ForceClose()
+    {
+    TInt count = iContexts.Count();
+    for( TInt a = 0; a < count; ++a )
+        {
+        // RemoveSubscriber removes first one every time.
+        RemoveSubscriber( iContexts[ 0 ] );
+        }
+    count = iItems.Count();
+    for( TInt a = 0; a < count; ++a )
+        {
+        RemoveSubscriber( iItems[ 0 ] );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CXIMPIMSubscriptionItemBase::CleanIfExpired()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TBool CXIMPIMSubscriptionItemBase::CleanIfExpired()
+    {
+    TTime timeNow;
+    timeNow.UniversalTime();
+    TBool expired =
+        ( iExpireTime + TTimeIntervalSeconds( KXIMPContentAutoExpiryTime ) ) < timeNow;
+    if( expired )
+        {
+        CleanExpired();
+        }
+    return expired;
+    }
+
+// ---------------------------------------------------------------------------
+// CXIMPIMSubscriptionItemBase::UpdateSubscriptionStateL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CXIMPIMSubscriptionItemBase::UpdateSubscriptionStateL( TSubscriptionEvent aUpdateState )
+    {
+    switch( aUpdateState )
+        {
+        case ECompleteDataReceived:
+            {
+            if( CountOfSubscribers() == 0 )
+                {
+                UpdateExpirationL();
+                }
+            break;
+            }
+        default:
+            {
+            User::Panic( NXIMPPrivPanic::KCategory, NXIMPPrivPanic::ESubscriptionItemLogicError );
+            break;
+            }
+        }
+    }
+    
+
+// ---------------------------------------------------------------------------
+// CXIMPIMSubscriptionItemBase::DataSubscriptionState()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C const MXIMPDataSubscriptionState& CXIMPIMSubscriptionItemBase::DataSubscriptionState()
+    {
+    return *iSubscriptionState;
+    }
+
+// ---------------------------------------------------------------------------
+// CXIMPIMSubscriptionItemBase::ContextCount()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CXIMPIMSubscriptionItemBase::ContextCount() const
+    {
+    return iContexts.Count();
+    }
+
+// ---------------------------------------------------------------------------
+// CXIMPIMSubscriptionItemBase::Context()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C MXIMPPscContext& CXIMPIMSubscriptionItemBase::Context( TInt aIndex )
+    {
+    return *iContexts[ aIndex ];
+    }
+
+// ---------------------------------------------------------------------------
+// CXIMPIMSubscriptionItemBase::Context()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TBool CXIMPIMSubscriptionItemBase::IsContext( MXIMPPscContext* aContext ) const
+    {
+    TLinearOrder< MXIMPPscContext > order( OrderOfContexts );
+    return iContexts.FindInOrder( aContext, order ) != KErrNotFound;
+    }
+
+// ---------------------------------------------------------------------------
+// CXIMPIMSubscriptionItemBase::SynthesiseSubscriptionEventToAllCtxsL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CXIMPIMSubscriptionItemBase::SynthesiseSubscriptionEventToAllCtxsL()
+    {
+    //TRACE( _L("CXIMPIMSubscriptionItemBase::SynthesiseSubscriptionEventToAllCtxsL()" ) );
+    RPointerArray< MXIMPPscContext > contextArray;
+    CleanupClosePushL( contextArray );
+    TLinearOrder< MXIMPPscContext > order( OrderOfContexts );
+
+    TInt contextCount = iContexts.Count();
+    for( TInt a = 0; a < contextCount; ++a )
+        {
+        contextArray.InsertInOrderL( iContexts[ a ], order );
+        }
+
+    TInt itemCount = iItems.Count();
+    for( TInt a = 0; a < itemCount; ++a )
+        {
+        TInt contextCount = iItems[ a ]->ContextCount();
+        for( TInt b = 0; b < contextCount; ++b )
+            {
+            TInt error = contextArray.InsertInOrder( &iItems[ a ]->Context( b ), order );
+            if( error != KErrNotFound )
+                {
+                User::LeaveIfError( error );
+                }
+            }
+        }
+
+    TInt count = contextArray.Count();
+    for( TInt a = 0; a < count; ++a )
+        {
+        SynthesiseSubscriptionEventToL( contextArray[ a ], ETrue );
+        }
+    CleanupStack::PopAndDestroy(); // contextArray
+    }
+
+// ---------------------------------------------------------------------------
+// CXIMPIMSubscriptionItemBase::ActivateSubscriberL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CXIMPIMSubscriptionItemBase::ActivateSubscriberL( MXIMPPscContext* aContext )
+    {
+    TLinearOrder< MXIMPPscContext > order( OrderOfContexts );
+    TInt index = iPreContexts.FindInOrder( aContext, order );
+    if( index != KErrNotFound && index < iPreContexts.Count())
+        {
+        iContexts.InsertInOrderL( iPreContexts[ index ], order );
+        iPreContexts.Remove( index );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CXIMPIMSubscriptionItemBase::ActivateSubscriberL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CXIMPIMSubscriptionItemBase::ActivateSubscriberL( CXIMPIMSubscriptionItemBase* aItem )
+    {
+    TLinearOrder< CXIMPIMSubscriptionItemBase > order( OrderOfItems );
+    TInt index = iPreItems.FindInOrder( aItem, order );
+    if( index != KErrNotFound && index < iPreItems.Count())
+        {
+        iItems.InsertInOrderL( iPreItems[ index ], order );
+        iPreItems.Remove( index );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CXIMPIMSubscriptionItemBase::Status()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CXIMPIMSubscriptionItemBase::SetDataSubscriptionStateL( CXIMPDataSubscriptionStateImp& aNewState )
+    {
+    // Some handle logic for terminating subscribers, data expiration etc. missing.
+    delete iSubscriptionState;
+    iSubscriptionState = &aNewState;
+    }
+
+// ---------------------------------------------------------------------------
+// CXIMPIMSubscriptionItemBase::Status()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CXIMPDataSubscriptionStateImp* CXIMPIMSubscriptionItemBase::StatusLC( MXIMPPscContext* /*aContext*/ ) const
+    {
+    // not implemented as of now
+    }
+
+// ---------------------------------------------------------------------------
+// CXIMPIMSubscriptionItemBase::UpdateExpirationL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CXIMPIMSubscriptionItemBase::UpdateExpirationL()
+    {
+    if( CountOfSubscribers() == 0 )
+        {
+        iParent.RegisterExpiringItemL( this );
+        }
+    iExpireTime.UniversalTime();
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPIMSubscriptionItemBase::ChangeStatusAfterRemove()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CXIMPIMSubscriptionItemBase::ChangeStatusAfterRemove()
+    {
+    // not implemented as of now
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPIMSubscriptionItemBase::ChangeStatusAfterAdd()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CXIMPIMSubscriptionItemBase::ChangeStatusAfterAdd()
+    {
+	// not implemented as of now
+    }
+
+// ---------------------------------------------------------------------------
+// CXIMPIMSubscriptionItemBase::CountOfSubscribers()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CXIMPIMSubscriptionItemBase::CountOfSubscribers()
+    {
+    return iItems.Count() + iPreItems.Count() + iContexts.Count() + iPreContexts.Count();
+    }
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/imfeatureplugin/srcimdatamodel/ximpimsubscriptionitembase.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,243 @@
+/*
+* 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:  IM Service Connection subscription item base.
+*
+*/
+
+#ifndef CXIMPPSCSUBSCRIPTIONITEMBASE_H
+#define CXIMPPSCSUBSCRIPTIONITEMBASE_H
+
+#include <e32base.h>
+#include <ximpdatasubscriptionstate.h>
+#include "ximpsubscriptionitem.h"
+
+
+class MXIMPIMItemParent;
+class MXIMPPscContext;
+class CXIMPDataSubscriptionStateImp;
+
+/**
+ * PSC subscription implementation
+ *
+ * @since S60 v3.2
+ */
+class CXIMPIMSubscriptionItemBase : public CObject, public MXIMPSubscriptionItem
+    {
+public: // Definitions
+
+    /**
+     * Subscription status
+     */
+    enum TSubscriptionStatus
+        {
+        ENotSubscribedAtAll,
+        ESubscribedForOtherCtxOnly,
+        ESubscribedForCtxOnly,
+        ESubscribedForCtxAndOthers
+        };
+
+    /**
+     * Subscription update event.
+     * Update subscription based on event.
+     */
+    enum TSubscriptionEvent
+        {
+        ECompleteDataReceived
+        };
+	/**
+     * For linear ordering by pointers
+     */
+    static TInt OrderOfContexts( const MXIMPPscContext& aFirst,
+                                 const MXIMPPscContext& aSecond );
+
+    /**
+     * For linear ordering by pointers
+     */
+    static TInt OrderOfItems( const CXIMPIMSubscriptionItemBase& aFirst,
+                              const CXIMPIMSubscriptionItemBase& aSecond );
+
+protected: // Construction and destruction
+
+    /**
+     * Destruction
+     * - Remember to inform parent about delete.
+     */
+    IMPORT_C virtual ~CXIMPIMSubscriptionItemBase();
+
+public: // Construction and destruction
+
+    /**
+     * Construction
+     * @param aParent. Parent has to be informed when this object is deleted by RemoveMe method.
+     */
+    IMPORT_C CXIMPIMSubscriptionItemBase( MXIMPIMItemParent& aParent );
+
+    /**
+     * Base construction. Must be called from inherited classes ConstructL
+     */
+    IMPORT_C void BaseConstructL();
+
+
+public: // New methods
+
+    IMPORT_C TSubscriptionStatus SubscriptionStatus( MXIMPPscContext* aContext );
+
+    /**
+     * Add subscriber for item.
+     * @param aContext. Context to be added.
+     */
+    IMPORT_C void AddSubscriberL( MXIMPPscContext* aContext );
+
+    /**
+     * Remove subscriber from item
+     * @param aContext. Context to be removed.
+     */
+    IMPORT_C void RemoveSubscriber( MXIMPPscContext* aContext );
+
+    /**
+     * Add subscriber for item.
+     * @param aItem. Item to be added.
+     */
+    IMPORT_C void AddSubscriberL( CXIMPIMSubscriptionItemBase* aItem );
+
+    /**
+     * Remove subscriber from item
+     * @param aContext. Item to be removed.
+     */
+    IMPORT_C void RemoveSubscriber( CXIMPIMSubscriptionItemBase* aItem );
+
+    /**
+     * Activate subscriber for item.
+     * @param aItem. Item to be activated.
+     */
+    IMPORT_C void ActivateSubscriberL( CXIMPIMSubscriptionItemBase* aItem );
+
+    /**
+     * Call RemoveSubscriber for all contexts registered to item.
+     */
+    IMPORT_C void ForceClose();
+
+    /**
+     * Clean item if expired.
+     * @return ETrue if expired and cleaned.EFalse if not.
+     */
+    IMPORT_C TBool CleanIfExpired();
+
+    /**
+     * Update subscription based on event happened.
+     * @param aUpdateState. Event which happened.
+     */
+    IMPORT_C void UpdateSubscriptionStateL( TSubscriptionEvent aUpdateState );
+    
+    /**
+     *
+     */
+    IMPORT_C const MXIMPDataSubscriptionState& DataSubscriptionState();
+        
+    /**
+     * Count of subscribed contexts.
+     */
+    IMPORT_C TInt ContextCount() const;
+
+    /**
+     * Reference to context in index.
+     */
+    IMPORT_C MXIMPPscContext& Context( TInt aIndex );
+
+    /**
+     * Can context be found from contexts.
+     */
+    IMPORT_C TBool IsContext( MXIMPPscContext* aContext ) const;
+
+public: // From MXIMPSubscriptionItem
+
+    /**
+     * @see MXIMPSubscriptionItem
+     */
+    IMPORT_C void SynthesiseSubscriptionEventToAllCtxsL();
+
+    /**
+     * @see MXIMPSubscriptionItem
+     */
+    IMPORT_C void ActivateSubscriberL( MXIMPPscContext* aContext );
+        
+    /**
+     * @see MXIMPSubscriptionItem
+     */
+    IMPORT_C void SetDataSubscriptionStateL( CXIMPDataSubscriptionStateImp& aNewState );
+
+public: // Helpers
+
+    /**
+     * Status for context
+     */
+    IMPORT_C CXIMPDataSubscriptionStateImp* StatusLC( MXIMPPscContext* aContext ) const;
+
+    /**
+     * Update time to new expire time.
+     */
+    IMPORT_C void UpdateExpirationL();
+
+    /**
+     * Change status after subscriber is added/removed.
+     */
+    IMPORT_C void ChangeStatusAfterAdd();
+    IMPORT_C void ChangeStatusAfterRemove();
+
+    /**
+     * Count of subscribers. Items counted as 1.
+     */
+    IMPORT_C TInt CountOfSubscribers();
+
+protected: // New interface methods.
+
+    /**
+     * Clean data because expiration
+     */
+    virtual void CleanExpired() = 0;
+
+protected: // Data
+
+    /**
+     * Parent object to inform when object is deleted.
+     * Used also for sending events.
+     */
+    MXIMPIMItemParent& iParent;
+
+
+    /**
+     * Subscribed contexts.
+     */
+    RPointerArray< MXIMPPscContext > iContexts;
+    RPointerArray< MXIMPPscContext > iPreContexts;
+    RPointerArray< CXIMPIMSubscriptionItemBase > iItems;
+    RPointerArray< CXIMPIMSubscriptionItemBase > iPreItems;
+
+    /**
+     * Current IM info status.
+     */
+    CXIMPDataSubscriptionStateImp* iSubscriptionState;
+
+    /**
+     * Time when ready for expire.
+     */
+    TTime iExpireTime;
+    };
+
+
+/* ======================================================================== */
+
+
+
+#endif // CXIMPPSCSUBSCRIPTIONITEMBASE_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/imfeatureplugin/srcimfrontend/group/bld.inf	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,32 @@
+/*
+* 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:  Build information file for project IM Feature Plugin
+*
+*/
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+PRJ_MMPFILES
+immanager.mmp
+imecomhook.mmp
+
+
+PRJ_TESTMMPFILES
+
+PRJ_TESTEXPORTS
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/imfeatureplugin/srcimfrontend/group/imecomhook.mmp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,61 @@
+/*
+* 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:  Project definition file for IM Feature Plugin
+*
+*/
+
+#include <platform_paths.hrh>
+#include <data_caging_paths.hrh>
+#include "../../group/imdlluids.hrh"
+
+
+TARGET                  imecomhook.dll
+CAPABILITY              CAP_ECOM_PLUGIN
+TARGETTYPE              PLUGIN
+UID                     XIMP_IM_DLL_UID_ECOM_PLUGIN XIMP_DLL_UID_IM_HOOK
+VENDORID                VID_DEFAULT
+
+VERSION      10.0
+
+SOURCEPATH              ../srcecomhook
+START RESOURCE          imecomhook.rss
+TARGET                  imecomhook.rsc
+END
+
+
+SOURCEPATH              ../srcecomhook
+SOURCE                  imecomhook.cpp
+
+
+USERINCLUDE             ../srcecomhook
+USERINCLUDE             ../srcimmanager
+USERINCLUDE             ../../srcimdatamodel
+USERINCLUDE             ../../group
+
+
+
+MW_LAYER_SYSTEMINCLUDE
+
+
+LIBRARY                 euser.lib
+LIBRARY                 immanager.lib
+LIBRARY                 ecom.lib
+
+
+
+#if defined( ARMCC )
+DEFFILE ../../eabi/ 
+#elif defined ( WINSCW )
+deffile ../../bwins/ 
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/imfeatureplugin/srcimfrontend/group/immanager.mmp	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  Project definition file for IM Manager
+*
+*/
+
+#include <platform_paths.hrh>
+#include <data_caging_paths.hrh>
+#include "../../group/imdlluids.hrh"
+
+
+TARGET                  immanager.dll
+TARGETTYPE              dll
+UID                     XIMP_IM_DLL_UID_STATIC_INTERFACE XIMP_DLL_UID_IM_MANAGER                                     
+
+CAPABILITY              CAP_GENERAL_DLL
+VENDORID                VID_DEFAULT
+
+VERSION      10.0
+
+SOURCEPATH              ../srcimmanager
+
+
+SOURCE                  imconversationimp.cpp
+SOURCE                  imfeaturesimp.cpp
+
+
+SOURCEPATH              ../../srcutils
+SOURCE                   imlogutils.cpp
+
+
+USERINCLUDE             ../../group
+
+
+USERINCLUDE             ../../srcutils
+USERINCLUDE             ../../srcimdatamodel
+USERINCLUDE             ../../srcimoperations
+USERINCLUDE             ../srcimmanager
+USERINCLUDE             ../../srcimdatamodel/imconversation
+
+MW_LAYER_SYSTEMINCLUDE
+
+
+
+LIBRARY                 euser.lib
+LIBRARY                 ecom.lib
+LIBRARY                 bafl.lib
+LIBRARY                 estor.lib
+LIBRARY                 ximputils.lib
+LIBRARY                 ximpdatamodel.lib
+LIBRARY                 imdatamodel.lib
+LIBRARY                 ximpsrvclient.lib
+LIBRARY                 flogger.lib
+
+
+//EXPORTUNFROZEN
+
+
+#if defined( ARMCC )
+DEFFILE ../../eabi/ 
+#elif defined ( WINSCW )
+deffile ../../bwins/ 
+#endif
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/imfeatureplugin/srcimfrontend/srcecomhook/imecomhook.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,46 @@
+/*
+* 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:  XIMP Framework's IM Manager Ecom Hook implementation.
+*
+*/
+
+
+#include "imdlluids.hrh"
+#include "imfeaturesimp.h"
+#include <ecom/implementationproxy.h>
+#include <e32base.h>
+
+
+// ---------------------------------------------------------------------------
+// Key value pair table to identify correct constructor
+// function for the requested interface.
+// ---------------------------------------------------------------------------
+//
+const TImplementationProxy ImplementationTable[] =
+    {
+    IMPLEMENTATION_PROXY_ENTRY( XIMP_ECOM_IMPLEMENTATION_UID_IM_INTERFACE,
+                                CImFeaturesImp::NewL )
+    };
+
+
+// ---------------------------------------------------------------------------
+// Exported function to return the implementation proxy table
+// ---------------------------------------------------------------------------
+//
+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/imservices/imfeatureplugin/srcimfrontend/srcecomhook/imecomhook.rss	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,52 @@
+/*
+* 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:  ECom registery info for ECom hook
+*
+*/
+
+
+#include <ecom/registryinfov2.rh>
+#include <immanagementifids.hrh>
+#include "imdlluids.hrh"
+
+
+// ---------------------------------------------------------------------------
+// ECom registery info for XIMP IM Manager ECom hook
+// ---------------------------------------------------------------------------
+//
+RESOURCE REGISTRY_INFO theInfo
+    {
+    resource_format_version = RESOURCE_FORMAT_VERSION_2;
+    dll_uid = XIMP_DLL_UID_IM_HOOK;
+
+    interfaces =
+        {
+        INTERFACE_INFO
+            {
+            interface_uid = XIMP_ECOM_IF_UID_IM_INTERFACE;
+            implementations =
+                {
+                IMPLEMENTATION_INFO
+                    {
+                    implementation_uid = XIMP_ECOM_IMPLEMENTATION_UID_IM_INTERFACE;
+                    version_no         = 1;
+                    display_name       = "S60 Default XIMP";
+                    default_data       = XIMP_ECOM_DEFAULT_DATA_IM_INTERFACE;
+                    opaque_data        = "";
+                    }
+                };
+            }
+        };
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/imfeatureplugin/srcimfrontend/srcimmanager/imconversationimp.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,164 @@
+/*
+* 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:  Implementation of MImConversationImp
+*
+*/
+
+
+#include "imconversationimp.h"
+#include "ximpobjecthelpers.h"
+#include "imoperationdefs.h"
+//#include "ximpidentityimp.h"
+#include "ximpcontextinternal.h"
+#include "imconversationinfoimp.h"
+
+// ============================ MEMBER FUNCTIONS =============================
+
+// ---------------------------------------------------------------------------
+// CImConversationImp::NewL()
+// ---------------------------------------------------------------------------
+//
+
+CImConversationImp* CImConversationImp::NewL( MXIMPContextInternal& aContext )
+	{
+		XImLogger::Log(_L("CImConversationImp::NewL Started"));
+		CImConversationImp* self = new( ELeave ) CImConversationImp( aContext );    
+		XImLogger::Log(_L("CImConversationImp::NewL Completed"));
+		return self;
+	}
+
+
+// ---------------------------------------------------------------------------
+// Implement supported interface access.
+// ---------------------------------------------------------------------------
+//
+XIMPIMP_IF_BASE_GET_INTERFACE_BEGIN( CImConversationImp, 
+                                     MImConversation )
+XIMPIMP_IF_BASE_GET_INTERFACE_END()
+
+
+XIMPIMP_IF_BASE_GET_CONST_INTERFACE_BEGIN( CImConversationImp, 
+                                           MImConversation )
+XIMPIMP_IF_BASE_GET_INTERFACE_END()
+
+
+
+// ---------------------------------------------------------------------------
+// CImConversationImp::~CImConversationImp()
+// ---------------------------------------------------------------------------
+//	
+CImConversationImp::~CImConversationImp()
+    {
+		XImLogger::Log(_L("CImConversationImp::~CImConversationImp Started - Completed"));
+	}
+// ---------------------------------------------------------------------------
+// CImConversationImp::CImConversationImp()
+// ---------------------------------------------------------------------------
+//    
+CImConversationImp::CImConversationImp(MXIMPContextInternal& aContext )
+    : iContext( aContext )
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// CImConversationImp::PackConvInfoLC()
+// ---------------------------------------------------------------------------
+//
+HBufC8* CImConversationImp::PackConvInfoLC(const MImConversationInfo& aImMessage )
+    {
+    XImLogger::Log(_L("CImConversationImp::PackConvInfoLC Started"));
+    const CImConversationInfoImp* convImp = 
+    TXIMPGetImpClassOrPanic< const CImConversationInfoImp >::From( aImMessage );    
+    HBufC8* pack = TXIMPObjectPacker< const CImConversationInfoImp >::PackL( *convImp );
+    CleanupStack::PushL( pack );
+    XImLogger::Log(_L("CImConversationImp::PackConvInfoLC Completed"));
+    return pack;
+    } 
+ 
+// ---------------------------------------------------------------------------
+// CImConversationImp::SendMessageL()
+// ---------------------------------------------------------------------------
+//    
+TXIMPRequestId  CImConversationImp::SendMessageL( const MImConversationInfo& aImMessage)
+   {
+	XImLogger::Log(_L("CImConversationImp::SendMessageL Started"));
+    HBufC8* infoPack = PackConvInfoLC( aImMessage );
+    TXIMPRequestId reqId = iContext.QueueOperationL( NImOps::ESendImMessage, *infoPack );
+    CleanupStack::PopAndDestroy( infoPack );
+    XImLogger::Log(_L("CImConversationImp::SendMessageL Completed"));
+    return reqId;
+    }
+    
+// ---------------------------------------------------------------------------
+// CImConversationImp::ForwardMessageL()
+// ---------------------------------------------------------------------------
+//    
+    
+//TXIMPRequestId  CImConversationImp::ForwardMessageL( const MImConversationInfo& /*aImMessage*/)
+//	{
+//  }
+
+// ---------------------------------------------------------------------------
+// CImConversationImp::SendMessageToGroupL()
+// ---------------------------------------------------------------------------
+//    
+//TXIMPRequestId CImConversationImp::SendMessageToGroupL( const MImConversationInfo& /*aImMessage*/,
+//			                                        const TDesC* /*aGroupId*/ )
+//	{
+//	}
+
+// ---------------------------------------------------------------------------
+// CImConversationImp::BlockUsersL()
+// ---------------------------------------------------------------------------
+//	    
+//TXIMPRequestId CImConversationImp::BlockUsersL(const MDesCArray* /*aUserIds*/ )
+//    {
+//    }
+
+// ---------------------------------------------------------------------------
+// CImConversationImp::UnBlockUsersL()
+// ---------------------------------------------------------------------------
+//    
+//TXIMPRequestId CImConversationImp::UnBlockUsersL(const MDesCArray* /*aUserIds*/)
+//    {
+//	}
+
+// ---------------------------------------------------------------------------
+// CImConversationImp::GetBlockedUsersListL()
+// ---------------------------------------------------------------------------
+//			                                           
+//TXIMPRequestId CImConversationImp::GetBlockedUsersListL(void )
+//	{
+//	}
+
+// ---------------------------------------------------------------------------
+// CImConversationImp::GetMessageListL()
+// ---------------------------------------------------------------------------
+//	
+//TXIMPRequestId CImConversationImp::GetMessageListL( const MXIMPIdentity& /*aImMessageId*/,
+//			    								   	   const TDesC* /*aGroupId*/,
+//			    								   	   const TInt /*aMessageCount*/,
+//			                                           TBool /*aDeliveryReportWanted*/)
+//	{
+//	}
+
+// ---------------------------------------------------------------------------
+// CImConversationImp::RejectMessageL()
+// ---------------------------------------------------------------------------
+//	                                        
+//TXIMPRequestId CImConversationImp::RejectMessageL( const MXIMPIdentity& /*aImMessageId*/)
+//	{
+//	}
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/imfeatureplugin/srcimfrontend/srcimmanager/imconversationimp.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,95 @@
+/*
+* 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:  Implementation of MImConversationImp
+*
+*/
+
+#ifndef CIMCONVERSATIONIMP_H
+#define CIMCONVERSATIONIMP_H
+
+#include <imconversation.h>
+#include "imlogutils.h"
+#include "imapiobjbase.h"
+#include "ximpapiobjbase.h"
+// FORWARD DECLARATIONS
+class MXIMPContextInternal;
+
+/**
+ * MImConversation API object implementation.
+ *
+ * @lib Immanager.dll
+ *
+ */
+NONSHARABLE_CLASS( CImConversationImp ): public CXIMPApiObjBase,public MImConversation
+    {
+    public:
+    /** The class ID. */
+    enum { KClassId = IMIMP_CLSID_CONVERSATIONIMP };
+
+
+public:
+    static CImConversationImp* NewL( MXIMPContextInternal& aContext );
+    ~CImConversationImp();
+
+
+public:
+    CImConversationImp( MXIMPContextInternal& aContext );
+
+
+public: // From MXIMPBase
+
+    /**
+     * Implementation of MXIMPBase interface methods
+     * @see MXIMPBase
+     */
+  XIMPIMP_DECLARE_IF_BASE_METHODS
+
+
+public: //From MImConversation
+
+   		TXIMPRequestId  SendMessageL( const MImConversationInfo& aImMessage);
+	    //TXIMPRequestId  ForwardMessageL( const MImConversationInfo& aImMessage);
+	    //TXIMPRequestId SendMessageToGroupL( const MImConversationInfo& aImMessage,
+		//	                                        const TDesC* aGroupId );
+	    
+	    //TXIMPRequestId BlockUsersL(const MDesCArray* aUserIds );
+	    
+	    //TXIMPRequestId UnBlockUsersL(const MDesCArray* aUserIds );
+				                                           
+		//TXIMPRequestId GetBlockedUsersListL(void );
+		
+		//TXIMPRequestId GetMessageListL( const MXIMPIdentity& aImMessageId,
+		//		    								   	   const TDesC* aGroupId,
+		//		    								   	   const TInt aMessageCount,
+		//		                                           TBool aDeliveryReportWanted);
+		                                        
+    	//TXIMPRequestId RejectMessageL( const MXIMPIdentity& aImMessageId);
+													
+	
+private: //Helpers
+
+	HBufC8* PackConvInfoLC(const MImConversationInfo& aImMessage );
+private: // data
+
+    /**
+     * Context session proxy for accessing context server.
+     * Ref.
+     */
+    MXIMPContextInternal& iContext;
+
+
+    };
+
+
+#endif // CIMCONVERSATIONIMP_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/imfeatureplugin/srcimfrontend/srcimmanager/imfeaturesimp.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,148 @@
+/*
+* 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:  Implementation of MImFeatures
+ *
+*/
+
+
+#include <ximpcontext.h>
+#include "imapiobjbase.h"
+//#include "ximpidentityimp.h"
+#include "ximpcontextinternal.h"
+#include "imfeaturesimp.h"
+#include "imconversationimp.h"
+#include "imobjectfactoryimp.h"
+
+
+
+
+// ============================ MEMBER FUNCTIONS =============================
+
+// ---------------------------------------------------------------------------
+// CImFeaturesImp::NewL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CImFeaturesImp* CImFeaturesImp::NewL(MXIMPContext* aContext)
+    {
+    CImFeaturesImp* self = new( ELeave ) CImFeaturesImp();
+    CleanupStack::PushL( self );
+    self->ConstructL(aContext);
+    CleanupStack::Pop();
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// Implement supported interface access.
+// ---------------------------------------------------------------------------
+//
+
+XIMPIMP_IF_BASE_GET_INTERFACE_BEGIN( CImFeaturesImp, 
+                                     MImFeatures )
+XIMPIMP_IF_BASE_GET_INTERFACE_END()
+
+
+XIMPIMP_IF_BASE_GET_CONST_INTERFACE_BEGIN( CImFeaturesImp, 
+                                           MImFeatures )
+XIMPIMP_IF_BASE_GET_INTERFACE_END()
+
+// ---------------------------------------------------------------------------
+// CImFeaturesImp::~CImFeaturesImp()
+// ---------------------------------------------------------------------------
+//
+CImFeaturesImp::~CImFeaturesImp()
+    {
+    delete iImConv;
+    delete iImObjFactory;
+    iCtxInternal = NULL;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CImFeaturesImp::CImFeaturesImp( CXIMPContextClientProxy& aCtxProxy )
+// ---------------------------------------------------------------------------
+//
+CImFeaturesImp::CImFeaturesImp()
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// CImFeaturesImp::SetCtxL(MXIMPContext* aContext)
+// ---------------------------------------------------------------------------
+//
+void CImFeaturesImp::SetCtxL(MXIMPContext* aContext)
+    {
+    if(!aContext)
+        User::Leave(KErrArgument);
+    iCtxInternal = TXIMPGetInterface<MXIMPContextInternal>::From(*aContext,EReturnNullIfUnknown);
+                       
+    }
+
+// ---------------------------------------------------------------------------
+// CImFeaturesImp::ConstructL(MXIMPContext* aContext)
+// ---------------------------------------------------------------------------
+//
+void CImFeaturesImp::ConstructL(MXIMPContext* aContext)
+    {
+    SetCtxL(aContext);
+    iImObjFactory = CImObjectFactoryImp::NewL();
+    iImConv = CImConversationImp::NewL( *iCtxInternal );
+
+    }
+
+
+// ---------------------------------------------------------------------------
+// CImFeaturesImp::ImObjectFactory()
+// ---------------------------------------------------------------------------
+ MImObjectFactory& CImFeaturesImp::ImObjectFactory() const
+    {
+    return *iImObjFactory;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CImFeaturesImp::ImConversation()
+// ---------------------------------------------------------------------------
+//
+ MImConversation& CImFeaturesImp::ImConversation() const
+    {
+    return *iImConv;
+    }
+
+// ---------------------------------------------------------------------------
+// CImFeaturesImp::ImGroups() 
+// ---------------------------------------------------------------------------
+//
+// MImGroups& CImFeaturesImp::ImGroups() const
+//    {
+    //return *iImConv;
+//    }
+    
+ // ---------------------------------------------------------------------------
+// CImFeaturesImp::ImInvtation() 
+// ---------------------------------------------------------------------------
+//
+// MImInvitation& CImFeaturesImp::ImInvtation() const
+//    {
+    //return *iImConv;
+//    }
+  
+   // ---------------------------------------------------------------------------
+// CImFeaturesImp::ImSearch() 
+// ---------------------------------------------------------------------------
+//
+// MImSearch& CImFeaturesImp::ImSearch() const
+//    {
+    //return *iImConv;
+//    }  
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/imfeatureplugin/srcimfrontend/srcimmanager/imfeaturesimp.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,98 @@
+/*
+* 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:  Implementation of MXIMPContext
+*
+*/
+
+#ifndef CIMFEATURESIMP_H
+#define CIMFEATURESIMP_H
+
+#include <imfeatures.h>
+#include "ximpapiobjbase.h"
+#include "imapiobjbase.h"
+
+class CImConversationImp;
+class CImObjectFactoryImp;
+class MXIMPContext;
+class MXIMPContextInternal;
+
+
+/**
+ * MXIMPContext API object implementation.
+ *
+ * @lib ximpmanager.dll
+ * @since S60 v3.2
+ */
+NONSHARABLE_CLASS( CImFeaturesImp ):  public MImFeatures,
+                                            public CXIMPApiObjBase
+    {
+    public:
+    /** The class ID. */
+    enum { KClassId = IMIMP_CLSID_CIMFEATURESIMP };
+
+
+public:
+
+    IMPORT_C static CImFeaturesImp* NewL( MXIMPContext* aContext );
+    virtual ~CImFeaturesImp();
+
+
+private:
+
+    CImFeaturesImp();
+    void SetCtxL(MXIMPContext* aContext);
+    void ConstructL(MXIMPContext* aContext);
+
+
+public: // From MXIMPBase
+
+    /**
+     * Implementation of MXIMPBase interface methods
+     * @see MXIMPBase
+     */
+    XIMPIMP_DECLARE_IF_BASE_METHODS
+
+
+public: //From MImFeatures
+
+   
+    MImObjectFactory& ImObjectFactory() const;
+    MImConversation& ImConversation() const;
+    //MImGroups& ImGroups() const;
+    //MImInvitation& ImInvtation() const;
+    //MImSearch& ImSearch() const;
+
+
+
+private: // data
+
+    /**
+     * Context for having a connection context server.
+     */
+    MXIMPContextInternal* iCtxInternal;
+    
+
+    /**
+     * Object factory sub interface.
+     */
+    CImObjectFactoryImp* iImObjFactory;
+
+    /**
+     * Im Conversation management sub interface.
+     */
+    CImConversationImp* iImConv;
+    };
+
+
+#endif // CIMFEATURESIMP_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/imfeatureplugin/srcimoperations/group/bld.inf	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,32 @@
+/*
+* 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:  Build information file for project IM Feature Plugin
+*
+*/
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+PRJ_MMPFILES
+
+imoperation.mmp
+imoperationshook.mmp
+
+PRJ_TESTMMPFILES
+
+PRJ_TESTEXPORTS
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/imfeatureplugin/srcimoperations/group/imoperation.mmp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,83 @@
+/*
+* 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:  Project definition file for IM Feature Plugin
+*
+*/
+
+#include <platform_paths.hrh>
+#include <data_caging_paths.hrh>
+#include "../../group/imdlluids.hrh"
+
+
+TARGET                  imoperation.dll
+TARGETTYPE              dll
+UID                     XIMP_IM_DLL_UID_STATIC_INTERFACE XIMP_DLL_UID_IM_OPERATION                  
+
+CAPABILITY              CAP_GENERAL_DLL
+VENDORID                VID_DEFAULT
+
+VERSION      10.0
+
+// ---------------------------------------------------------------------------
+SOURCEPATH              ../../srcimoperations
+// ---------------------------------------------------------------------------
+SOURCE                  operationlaunchcleaner.cpp
+
+SOURCE                  imoperationfactoryimp.cpp
+
+// ---------------------------------------------------------------------------
+SOURCEPATH              ../imconversation
+// ---------------------------------------------------------------------------
+// Client - 
+SOURCE                  operationsendmessage.cpp
+SOURCE                  operationreceivemessage.cpp
+// Adaptation - 
+
+
+// ---------------------------------------------------------------------------
+SOURCEPATH              ../../srcutils
+// ---------------------------------------------------------------------------
+SOURCE                  imlogutils.cpp 
+
+
+USERINCLUDE             ../../srcutils
+USERINCLUDE             ../../srcimdatamodel
+USERINCLUDE             ../../srcimdatamodel/imconversation
+USERINCLUDE             ../../srcimprocessor
+USERINCLUDE             ../../srcimoperations
+USERINCLUDE             ../imconversation
+
+
+MW_LAYER_SYSTEMINCLUDE
+
+LIBRARY                 euser.lib
+LIBRARY                 ecom.lib
+LIBRARY                 estor.lib
+LIBRARY                 ximputils.lib
+LIBRARY                 imdatamodel.lib
+LIBRARY                 ximpprocessor.lib
+LIBRARY                 improcessor.lib
+LIBRARY                 flogger.lib 
+
+//EXPORTUNFROZEN
+
+               
+#if defined( ARMCC )
+DEFFILE ../../eabi/ 
+#elif defined ( WINSCW )
+deffile ../../bwins/ 
+#endif
+
+// End of file
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/imfeatureplugin/srcimoperations/group/imoperationshook.mmp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,61 @@
+/*
+* 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:  Project definition file for IM Feature Plugin
+*
+*/
+
+
+#include <platform_paths.hrh>
+#include <data_caging_paths.hrh>
+#include "../../group/imdlluids.hrh"
+
+
+TARGET                  imoperationshook.dll
+CAPABILITY              CAP_ECOM_PLUGIN
+TARGETTYPE              PLUGIN
+UID                     XIMP_IM_DLL_UID_ECOM_PLUGIN XIMP_DLL_UID_IM_OPERATIONS_HOOK                  
+VENDORID                VID_DEFAULT
+
+VERSION      10.0
+
+SOURCEPATH              ../imoperationshook
+START RESOURCE          imoperationshook.rss
+TARGET                  imoperationshook.rsc
+END
+
+
+SOURCEPATH              ../imoperationshook
+SOURCE                  imoperationshook.cpp
+
+
+USERINCLUDE             ../imoperationshook
+USERINCLUDE             ../../srcimoperations
+USERINCLUDE             ../../srcimdatamodel
+
+
+
+
+MW_LAYER_SYSTEMINCLUDE
+
+
+LIBRARY                 euser.lib
+LIBRARY                 imoperation.lib
+LIBRARY                 ecom.lib
+
+
+#if defined( ARMCC )
+DEFFILE ../../eabi/ 
+#elif defined ( WINSCW )
+deffile ../../bwins/ 
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/imfeatureplugin/srcimoperations/imconversation/operationreceivemessage.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,149 @@
+/*
+* 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:  Concrete im receive message operation
+ *
+*/
+
+
+#include <badesca.h>
+#include <ximpprotocolconnection.h>
+#include <protocolimfeatures.h>
+#include <protocolimconversation.h>
+#include "imconversationinfoimp.h"
+#include "operationreceivemessage.h"
+//#include "ximpoperationbase.h"
+//#include "ximpidentityimp.h"
+#include "conversationsubscriptionitem.h"
+#include "imdatacacheimp.h"
+
+#include "ximpobjecthelpers.h"
+#include "ximprestrictedobjectcollection.h"
+#include "ximphost.h"
+//#include "ximpstatusimp.h"
+//#include "ximprequestcompleteeventimp.h"
+#include "protocolimdatahostimp.h"
+#include "imlogutils.h"
+
+#include "protocolimdatahost.h"
+
+//#include "ximpsubscriptionitem.h"
+//#include "ximppsccontextimp.h"
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// COperationReceiveMessage::COperationReceiveMessage()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C COperationReceiveMessage::COperationReceiveMessage()
+    {
+    XImLogger::Log(_L("COperationReceiveMessage::COperationReceiveMessage Started"));
+    XImLogger::Log(_L("COperationReceiveMessage::COperationReceiveMessage Completed"));
+    }
+
+
+// ---------------------------------------------------------------------------
+// COperationReceiveMessage::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void COperationReceiveMessage::ConstructL( const TDesC8& /*aParamPck */)
+    {
+    XImLogger::Log(_L("COperationReceiveMessage::ConstructL Started"));   
+    XImLogger::Log(_L("COperationReceiveMessage::ConstructL Completed"));
+    }
+
+// ---------------------------------------------------------------------------
+// COperationReceiveMessage::~COperationReceiveMessage()
+// ---------------------------------------------------------------------------
+//
+COperationReceiveMessage::~COperationReceiveMessage()
+    {
+    XImLogger::Log(_L("COperationReceiveMessage::~COperationReceiveMessage Started"));
+    delete iConvInfo;
+    XImLogger::Log(_L("COperationReceiveMessage::~COperationReceiveMessage Completed"));
+    }
+
+
+// ---------------------------------------------------------------------------
+// COperationReceiveMessage::ProcessL()
+// ---------------------------------------------------------------------------
+//
+void COperationReceiveMessage::ProcessL()
+    {
+	XImLogger::Log(_L("COperationReceiveMessage::ProcessL Started"));
+	CXIMPOperationBase::ProcessL();
+	MXIMPBase* object = NULL;
+	TBool force =  ETrue; 
+	
+	//iObjCollection->GetByType( object, MImConversationInfo::KInterfaceId );
+	MXIMPRestrictedObjectCollection *objCollection = CXIMPOperationBase::GetObjCollection() ;
+	
+	objCollection->GetByType( object, MImConversationInfo::KInterfaceId );
+	
+	if( object )
+		{  
+		iConvInfo = TXIMPGetImpClassOrPanic< CImConversationInfoImp >::From( *object );	
+		}
+	else
+		{
+		User::Leave( KErrArgument );
+		}
+		
+			
+	//CConversationSubscriptionItem& conversationItem = 
+	//iMyHost->ImDataAccess().ImDataCache().ConversationSubscriptionItemLC();
+	
+	//CConversationSubscriptionItem& conversationItem = 
+	//	iMyHost->GetProtocolHost(0).ImDataCache().ConversationSubscriptionItemLC() ;
+	
+	MProtocolImDataHost* imProtocolHost = 
+					static_cast <MProtocolImDataHost*> (iMyHost->GetProtocolHost(MProtocolImDataHost::KInterfaceId) );
+	
+	CConversationSubscriptionItem& conversationItem = 
+			imProtocolHost->ImDataCache().ConversationSubscriptionItemLC() ;
+	
+	conversationItem.SetConversationInfoL( iConvInfo ); 
+	
+	iConvInfo = NULL; // set to NULL since ownership is transfered
+
+	//conversationItem.SynthesiseSubscriptionEventToL( iContext, force );
+	conversationItem.SynthesiseSubscriptionEventToL( CXIMPOperationBase::GetContext(), force );
+	
+	CleanupStack::PopAndDestroy(); // conversationItem
+	iMyHost->HandleAdaptationRequestCompleted( iReqId, KErrNone );
+	XImLogger::Log(_L("COperationReceiveMessage::ProcessL Completed"));
+	}
+
+// ---------------------------------------------------------------------------
+// COperationReceiveMessage::RequestCompleted()
+// ---------------------------------------------------------------------------
+//
+void COperationReceiveMessage::RequestCompletedL()
+    {
+    XImLogger::Log(_L("COperationReceiveMessage::RequestCompletedL Started"));
+    CXIMPOperationBase::RequestCompletedL();
+	XImLogger::Log(_L("COperationReceiveMessage::RequestCompletedL Completed"));
+    }
+
+// ---------------------------------------------------------------------------
+// COperationReceiveMessage::Type()
+// ---------------------------------------------------------------------------
+//
+TInt COperationReceiveMessage::Type() const
+    {
+    return NImOps::EHandleReceiveMessage;
+    }
+
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/imfeatureplugin/srcimoperations/imconversation/operationreceivemessage.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,65 @@
+/*
+* 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:  Im receive message operation
+ *
+*/
+
+#ifndef C_OPERATIONRECEIVEMESSAGE_H
+#define C_OPERATIONRECEIVEMESSAGE_H
+
+#include <e32base.h>
+#include <ximpbase.h>
+
+#include "ximpoperationbase.h"
+#include "imoperationdefs.h"
+
+class CImConversationInfoImp;
+
+/**
+ * Im receive message operation
+ *
+ * @lib imoperation.lib
+ * @since S60
+ */
+class COperationReceiveMessage : public CXIMPOperationBase
+    {
+
+    public:
+        
+        IMPORT_C COperationReceiveMessage();
+
+        void ConstructL( const TDesC8& aParamPck );
+
+        ~COperationReceiveMessage();
+
+    public: // from CXIMPOperationBase
+        
+        void ProcessL();
+
+        void RequestCompletedL();
+        
+        TInt Type() const;
+  
+    private: // data
+    
+        /**
+         * convinfo
+         */
+        CImConversationInfoImp* iConvInfo;
+        
+        
+    };
+
+
+#endif // C_OPERATIONRECEIVEMESSAGE_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/imfeatureplugin/srcimoperations/imconversation/operationsendmessage.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,115 @@
+/*
+* 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:  Concrete im send message operation
+ *
+*/
+
+
+
+#include <ximpprotocolconnection.h>
+#include <cprotocolimfeatures.h>
+#include <protocolimconversation.h>
+#include "imconversationinfoimp.h"
+#include "operationsendmessage.h"
+#include "ximpobjecthelpers.h"
+//#include "ximprestrictedobjectcollectionimp.h"
+//#include "ximphost.h"
+//#include "ximpstatusimp.h"
+//#include "ximprequestcompleteeventimp.h"
+#include "protocolimdatahostimp.h"
+#include "imlogutils.h"
+#include <badesca.h>
+
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// COperationSendMessage::COperationSendMessage()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C COperationSendMessage::COperationSendMessage()
+    {
+    }
+// ---------------------------------------------------------------------------
+// COperationSendMessage::ConstructL
+// ---------------------------------------------------------------------------
+//
+void COperationSendMessage::ConstructL( const TDesC8& aParamPck )
+    {
+    XImLogger::Log(_L("COperationSendMessage::ConstructL Started"));
+    CImConversationInfoImp* convInfo = CImConversationInfoImp::NewLC();
+    TXIMPObjectPacker< CImConversationInfoImp >::UnPackL( *convInfo,
+            aParamPck );
+    CleanupStack::Pop( convInfo );
+    iConvInfo = convInfo;
+    XImLogger::Log(_L("COperationSendMessage::ConstructL Completed"));
+    }
+
+// ---------------------------------------------------------------------------
+// COperationSendMessage::~COperationSendMessage()
+// ---------------------------------------------------------------------------
+//
+COperationSendMessage::~COperationSendMessage()
+    {
+    XImLogger::Log(_L("COperationSendMessage::~COperationSendMessage Started"));
+    delete iConvInfo;
+    XImLogger::Log(_L("COperationSendMessage::~COperationSendMessage Completed"));
+    }
+
+
+// ---------------------------------------------------------------------------
+// COperationSendMessage::ProcessL()
+// ---------------------------------------------------------------------------
+//
+void COperationSendMessage::ProcessL()
+    {
+	XImLogger::Log(_L("COperationSendMessage::ProcessL Started"));
+	CXIMPOperationBase::ProcessL();
+	
+	// Call to Adaptation.
+	//MProtocolImConversation& imconversation = iMyHost->GetConnection().ProtocolImFeatures()->ImConversation();
+	
+	
+	// Pankaj : added to support dynamic resolution
+	CProtocolImFeatures* imProtocolFeature =static_cast< CProtocolImFeatures*> (iMyHost->GetConnection().GetProtocolInterface(CProtocolImFeatures::KInterfaceId));
+	
+	MProtocolImConversation& imconversation = imProtocolFeature->ImConversation() ; 
+	
+	
+ 	imconversation.DoSendMessageL(*iConvInfo,iReqId );
+    XImLogger::Log(_L("COperationSendMessage::ProcessL Completed"));
+    }
+
+// ---------------------------------------------------------------------------
+// COperationSendMessage::RequestCompleted()
+// ---------------------------------------------------------------------------
+//
+void COperationSendMessage::RequestCompletedL()
+    {
+    XImLogger::Log(_L("COperationSendMessage::RequestCompletedL Started"));
+    CXIMPOperationBase::RequestCompletedL();
+    XImLogger::Log(_L("COperationSendMessage::RequestCompletedL Completed"));
+    }
+
+// ---------------------------------------------------------------------------
+// COperationSendMessage::Type()
+// ---------------------------------------------------------------------------
+//
+TInt COperationSendMessage::Type() const
+    {
+    return NImOps::ESendImMessage;
+    }
+
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/imfeatureplugin/srcimoperations/imconversation/operationsendmessage.h	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  Im send message operation
+ *
+*/
+
+#ifndef C_OPERATIONSENDMESSAGE_H
+#define C_OPERATIONSENDMESSAGE_H
+
+#include <e32base.h>
+#include <ximpbase.h>
+
+#include "ximpoperationbase.h"
+#include "imoperationdefs.h"
+
+class CImConversationInfoImp;
+
+/**
+ * Im send message operation
+ *
+ * @lib imoperation.lib
+ * @since S60
+ */
+class COperationSendMessage : public CXIMPOperationBase
+    {
+
+    public:
+        
+        IMPORT_C COperationSendMessage();
+
+        void ConstructL( const TDesC8& aParamPck );
+
+        ~COperationSendMessage();
+
+    public: // from CXIMPOperationBase
+        
+        void ProcessL();
+
+        void RequestCompletedL();
+        
+        TInt Type() const;
+        
+    private: // data
+    
+        /**
+         * convinfo
+         */
+        CImConversationInfoImp* iConvInfo;
+    };
+
+
+#endif // C_OPERATIONSENDMESSAGE_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/imfeatureplugin/srcimoperations/imoperationdefs.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,50 @@
+/*
+* 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:  XIMP framework im operation definitions.
+ *
+*/
+
+#ifndef IMOPERATIONDEFS_H
+#define IMOPERATIONDEFS_H
+
+#include <e32std.h>
+
+// TODO: use ranges for operations types, that will make sure that
+// the core, Presence and IM operations won't overlap
+
+/**
+ * PSC operations.
+ */
+namespace NImOps
+    {
+    enum TImOpTypes
+        {
+        // -----------------------------------------------
+        // From client
+        //
+        ESendImMessage = 200,                          // 200
+        ESendImMessageToGroup,                         // 201
+        EHandleSentMessage,       
+        EHandleReceiveMessage,      
+        ESynthesiseImSubscription = 280,
+        EIMCleaner = 290            
+        };
+    }
+
+#endif  //IMOPERATIONDEFS_H
+
+
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/imfeatureplugin/srcimoperations/imoperationfactoryimp.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,116 @@
+/*
+* 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:  Im Service Connection operation factory
+ *
+*/
+
+
+#include "imoperationfactoryimp.h"
+#include "imoperationdefs.h"
+#include "operationlaunchcleaner.h"
+//#include "ximpoperationbase.h"
+//#include "ximppanics.h"
+#include "imlogutils.h"
+#include "operationsendmessage.h"
+#include "operationreceivemessage.h"
+using namespace NImOps;
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CXIMPOperationFactory::NewL()
+// Singleton access method.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CImOperationFactory* CImOperationFactory::NewL()
+    {
+    XImLogger::Log(_L("CImOperationFactory::NewL Started"));
+    CImOperationFactory* self = new ( ELeave ) CImOperationFactory();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    XImLogger::Log(_L("CImOperationFactory::NewL Completed"));
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CXIMPOperationFactory::CXIMPOperationFactory()
+// -----------------------------------------------------------------------------
+//
+CImOperationFactory::CImOperationFactory()
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CXIMPOperationFactory::~CXIMPOperationFactory()
+// -----------------------------------------------------------------------------
+//
+CImOperationFactory::~CImOperationFactory()
+    {
+    XImLogger::Log(_L("CImOperationFactory::~CImOperationFactory Started"));
+    XImLogger::Log(_L("CImOperationFactory::~CImOperationFactory Completed"));
+    }
+
+
+// -----------------------------------------------------------------------------
+// CXIMPOperationFactory::ConstructL()
+// -----------------------------------------------------------------------------
+//
+void CImOperationFactory::ConstructL()
+    {
+    XImLogger::Log(_L("CImOperationFactory::ConstructL Started"));
+    XImLogger::Log(_L("CImOperationFactory::ConstructL Completed"));
+    }
+
+
+// -----------------------------------------------------------------------------
+// CXIMPOperationFactory::CreateOperationL()
+// -----------------------------------------------------------------------------
+//
+CXIMPOperationBase* CImOperationFactory::CreateOperationL( TInt aOperation )
+{
+	XImLogger::Log(_L("CImOperationFactory::CreateOperationL Started"));
+	CXIMPOperationBase* op = NULL;
+    NImOps::TImOpTypes operation = ( NImOps::TImOpTypes ) aOperation;
+    switch( operation )
+        {
+        case ESendImMessage:
+            {
+            XImLogger::Log(_L("CImOperationFactory::CreateOperationL  = ESendImMessage"));
+            op = new ( ELeave ) COperationSendMessage();
+            break;
+            }
+        case EIMCleaner:
+            {
+            XImLogger::Log(_L("CImOperationFactory::CreateOperationL  = EIMCleaner"));
+            op = new ( ELeave ) COperationLaunchCleaner();
+            break;
+            }
+        case EHandleReceiveMessage: 
+            {
+            XImLogger::Log(_L("CImOperationFactory::CreateOperationL  = EHandleReceiveMessage"));
+            op = new ( ELeave ) COperationReceiveMessage();
+            break;	
+            }
+        default:
+        	{
+            break;
+            }
+        }
+    XImLogger::Log(_L("CImOperationFactory::CreateOperationL Completed"));
+   return op;
+}
+// End of file
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/imfeatureplugin/srcimoperations/imoperationfactoryimp.h	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  Im Service Connection operation factory
+ *
+*/
+
+
+#ifndef IMCOPERATIONFACTORYIMP_H
+#define IMCOPERATIONFACTORYIMP_H
+
+
+#include <e32base.h>
+class CXIMPOperationBase;
+#include "imapiobjbase.h"
+#include <ximpoperationfactory1.h>
+
+/**
+ * Operation factory
+ * Class is owned by and handled as singleton by CXIMPGlobals.
+ *
+ * @lib imoperation.dll
+ * @since S60 v4.0
+ */
+
+NONSHARABLE_CLASS(CImOperationFactory): public MXIMPOperationFactory1
+    {
+    
+    public:
+    /** The class ID. */
+    //enum { KClassId = IMIMP_CLSID_CIMOPERATIONFACTORYIMP };
+    
+    
+    
+    public: // Construction and desctruction
+
+        IMPORT_C static CImOperationFactory* NewL();
+
+        virtual ~CImOperationFactory();
+
+    private: // Construction
+
+        /**
+         * C++ default constructor.
+         */
+        CImOperationFactory();
+
+        /**
+         * Symbian 2nd phase constructor
+         */
+        void ConstructL();
+
+
+    public: // From MXIMPOperationFactory1
+
+		/**
+		 * @see MXIMPOperationFactory1
+	 	 */
+		CXIMPOperationBase* CreateOperationL( TInt aOperation );
+
+    private:    // Data
+
+    };
+
+#endif      // IMCOPERATIONFACTORYIMP_H
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/imfeatureplugin/srcimoperations/imoperationshook/imoperationshook.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,44 @@
+/*
+* 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:  XIMP Framework's IM  Processor Hook implementation.
+*
+*/
+
+
+#include <imdlluids.hrh>
+#include <ecom/implementationproxy.h>
+#include <e32base.h>
+#include "imoperationfactoryimp.h"
+// ---------------------------------------------------------------------------
+// Key value pair table to identify correct constructor
+// function for the requested interface.
+// ---------------------------------------------------------------------------
+//
+const TImplementationProxy ImplementationTable[] =
+    {
+    IMPLEMENTATION_PROXY_ENTRY( XIMP_ECOM_IMPL_UID_IM_OPERATION_INTERFACE,
+                                CImOperationFactory::NewL)
+    };
+
+
+// ---------------------------------------------------------------------------
+// Exported function to return the implementation proxy table
+// ---------------------------------------------------------------------------
+//
+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/imservices/imfeatureplugin/srcimoperations/imoperationshook/imoperationshook.rss	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,54 @@
+/*
+* 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:  ECom registery info for ECom hook
+*
+*/
+
+
+#include <ecom/registryinfov2.rh>
+#include <ximpfeaturepluginifids.hrh>
+#include "imdlluids.hrh"
+#include <immanagementifids.hrh>
+#include <improtocolpluginhostifids.hrh>
+
+
+// ---------------------------------------------------------------------------
+// ECom registery info for XIMP IM Manager ECom hook
+// ---------------------------------------------------------------------------
+//
+RESOURCE REGISTRY_INFO theInfo
+    {
+    resource_format_version = RESOURCE_FORMAT_VERSION_2;
+    dll_uid = XIMP_DLL_UID_IM_OPERATIONS_HOOK;
+
+    interfaces =
+        {
+        INTERFACE_INFO
+            {
+            interface_uid = XIMP_ECOM_IF_UID_OPERATIONS_INTERFACE;
+            implementations =
+                {
+                IMPLEMENTATION_INFO
+                    {
+                    implementation_uid = XIMP_ECOM_IMPL_UID_IM_OPERATION_INTERFACE;
+                    version_no         = 1;
+                    display_name       = "S60 Default XIMP";
+                    default_data       = XIMP_ECOM_DEFAULT_DATA_IM_EVENT_CODEC;
+                    opaque_data        = "";
+                    }
+                };
+            }
+        };
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/imfeatureplugin/srcimoperations/operationlaunchcleaner.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,100 @@
+/*
+* 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:  Internal operation for launching cleaner
+ *
+*/
+
+
+#include "operationlaunchcleaner.h"
+#include "protocolimdatahostimp.h"
+#include "imdatacacheimp.h"
+#include "ximphost.h"
+#include "imlogutils.h"
+// ============================ MEMBER FUNCTIONS =============================
+
+// ---------------------------------------------------------------------------
+// COperationLaunchCleaner::COperationLaunchCleaner()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C COperationLaunchCleaner::COperationLaunchCleaner()
+    {
+    }
+// ---------------------------------------------------------------------------
+// COperationLaunchCleaner::~COperationLaunchCleaner()
+// ---------------------------------------------------------------------------
+//
+COperationLaunchCleaner::~COperationLaunchCleaner()
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// COperationLaunchCleaner::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void COperationLaunchCleaner::ConstructL( const TDesC8& /*aParamPck*/ )
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// COperationLaunchCleaner::ProcessL()
+// ---------------------------------------------------------------------------
+//
+void COperationLaunchCleaner::ProcessL()
+    {
+    
+    XImLogger::Log(_L("COperationLaunchCleaner::ProcessL Started"));
+	CXIMPOperationBase::ProcessL();
+    
+    // modified by pankaj
+    //iMyHost->ImDataAccess().ImDataCache().CleanExpired();
+    MProtocolImDataHost* imProtocolHost = 
+					static_cast <MProtocolImDataHost*> (iMyHost->GetProtocolHost(MProtocolImDataHost::KInterfaceId) );
+	imProtocolHost->ImDataCache().CleanExpired() ;
+    
+    iMyHost->HandleInternalRequestCompleted( iReqId, KErrNone );
+    XImLogger::Log(_L("COperationLaunchCleaner::ProcessL Completed"));
+    }
+
+// ---------------------------------------------------------------------------
+// COperationLaunchCleaner::RequestCompleted()
+// ---------------------------------------------------------------------------
+//
+void COperationLaunchCleaner::RequestCompletedL()
+    {
+    XImLogger::Log(_L("COperationLaunchCleaner::RequestCompletedL Started"));
+    CXIMPOperationBase::RequestCompletedL();
+    XImLogger::Log(_L("COperationLaunchCleaner::RequestCompletedL Completed"));
+    }
+// ---------------------------------------------------------------------------
+// COperationLaunchCleaner::Type()
+// ---------------------------------------------------------------------------
+//
+TInt COperationLaunchCleaner::Type() const
+    {
+    return NImOps::EIMCleaner;
+    }
+
+// ---------------------------------------------------------------------------
+// COperationLaunchCleaner::EndOperation()
+// ---------------------------------------------------------------------------
+//
+void COperationLaunchCleaner::EndOperation()
+    {
+    XImLogger::Log(_L("COperationLaunchCleaner::EndOperation Started"));
+    CXIMPOperationBase::EndOperation();
+    iMyHost->StartCleanerTimer();
+    XImLogger::Log(_L("COperationLaunchCleaner::EndOperation Completed"));
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/imfeatureplugin/srcimoperations/operationlaunchcleaner.h	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  Internal operation for launching cleaner
+ *
+*/
+
+#ifndef COPERATIONLAUNCHCLEANER_H
+#define COPERATIONLAUNCHCLEANER_H
+
+
+#include <e32base.h>
+#include <ximpbase.h>
+#include "ximpoperationbase.h"
+#include "imoperationdefs.h"
+
+
+/**
+ * Internal synthesise own subscription event operation
+ *
+ * @lib impoperations.lib
+ * @since S60 v4.0
+ */
+class COperationLaunchCleaner : public CXIMPOperationBase
+    {
+    public:
+
+        IMPORT_C COperationLaunchCleaner();
+
+        void ConstructL( const TDesC8& aParamPck );
+
+        ~COperationLaunchCleaner();
+
+
+    public: // from CXIMPOperationBase
+
+        void ProcessL();
+
+        void RequestCompletedL();
+
+        TInt Type() const;
+        
+        void EndOperation();
+
+    private: // data
+    
+    };
+
+
+#endif // COPERATIONLAUNCHCLEANER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/imfeatureplugin/srcimprocessor/group/bld.inf	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,32 @@
+/*
+* 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:  Build information file for project IM Feature Plugin
+*
+*/
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+PRJ_MMPFILES
+improcessor.mmp
+improcessorhook.mmp
+
+
+PRJ_TESTMMPFILES
+
+PRJ_TESTEXPORTS
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/imfeatureplugin/srcimprocessor/group/improcessor.mmp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,72 @@
+/*
+* 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:  Project definition file for IM Feature Plugin
+*
+*/
+
+#include <platform_paths.hrh>
+#include <data_caging_paths.hrh>
+#include "../../group/imdlluids.hrh"
+
+
+TARGET                  improcessor.dll
+TARGETTYPE              dll
+UID                     XIMP_IM_DLL_UID_STATIC_INTERFACE XIMP_DLL_UID_IM_PROCESSOR     
+
+CAPABILITY              CAP_GENERAL_DLL
+VENDORID                VID_DEFAULT
+
+VERSION      10.0
+
+SOURCEPATH              ../../srcimprocessor
+SOURCE                  protocoldatahostimp.cpp
+SOURCE					protocolimdatahostimp.cpp
+
+SOURCEPATH              ../imconversationdatahost
+SOURCE                  protocolimconversationdatahostimp.cpp
+
+SOURCEPATH              ../../srcutils
+SOURCE                   imlogutils.cpp
+
+
+
+USERINCLUDE             ../../group
+USERINCLUDE             ../../srcimprocessor
+USERINCLUDE             ../../srcimoperations
+USERINCLUDE             ../../srcimdatamodel
+USERINCLUDE             ../../srcutils
+USERINCLUDE             ../imconversationdatahost
+
+MW_LAYER_SYSTEMINCLUDE
+
+
+LIBRARY                 euser.lib
+LIBRARY                 ecom.lib
+LIBRARY                 estor.lib
+LIBRARY                 centralrepository.lib
+LIBRARY                 bafl.lib
+LIBRARY                 ximputils.lib
+LIBRARY                 ximpdatamodel.lib
+LIBRARY                 imdatamodel.lib
+LIBRARY					flogger.lib
+
+//EXPORTUNFROZEN
+
+#if defined( ARMCC )
+DEFFILE ../../eabi/ 
+#elif defined ( WINSCW )
+deffile ../../bwins/ 
+#endif
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/imfeatureplugin/srcimprocessor/group/improcessorhook.mmp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,61 @@
+/*
+* 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:  Project definition file for IM Feature Plugin
+*
+*/
+
+
+#include <platform_paths.hrh>
+#include <data_caging_paths.hrh>
+#include "../../group/imdlluids.hrh"
+
+
+TARGET                  improcessorhook.dll
+CAPABILITY              CAP_ECOM_PLUGIN
+TARGETTYPE              PLUGIN
+UID                     XIMP_IM_DLL_UID_ECOM_PLUGIN XIMP_DLL_UID_IM_PROCESSOR_HOOK                  
+VENDORID                VID_DEFAULT
+
+VERSION      10.0
+
+SOURCEPATH              ../improcessorhook
+START RESOURCE          improcessorhook.rss
+TARGET                  improcessorhook.rsc
+END
+
+
+SOURCEPATH              ../improcessorhook
+SOURCE                  improcessorhook.cpp
+
+
+USERINCLUDE             ../../group
+USERINCLUDE             ../improcessorhook
+USERINCLUDE             ../../srcimdatamodel
+USERINCLUDE             ../../srcimprocessor
+
+
+
+MW_LAYER_SYSTEMINCLUDE
+
+
+LIBRARY                 euser.lib
+LIBRARY                 improcessor.lib
+LIBRARY                 ecom.lib
+
+
+#if defined( ARMCC )
+DEFFILE ../../eabi/ 
+#elif defined ( WINSCW )
+deffile ../../bwins/ 
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/imfeatureplugin/srcimprocessor/imconversationdatahost/protocolimconversationdatahostimp.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,172 @@
+/*
+* 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:  Implementation for managing cached Invite information.
+*
+*/
+
+
+#include <ximpobjectcollection.h>
+#include <ximpidentity.h>
+#include <ximpdatasubscriptionstate.h>
+#include <ximpstatus.h>
+//#include "ximprestrictedobjectcollectionimp.h"
+//#include "ximpoperationbase.h"
+//#include "ximpglobals.h"
+//#include "ximpoperationfactory.h"
+#include "ximphost.h"
+#include "imdatacacheimp.h"
+#include "imoperationdefs.h"
+//#include "ximptrace.h"
+#include "imlogutils.h"
+#include "protocolimdatahostimp.h"
+#include "protocolimconversationdatahostimp.h"
+#include <imconversationinfo.h>
+
+
+// ============================ MEMBER FUNCTIONS ============================= 
+
+
+// ---------------------------------------------------------------------------
+// CProtocolImConversationDataHostImp::CProtocolImConversationDataHostImp()
+// ---------------------------------------------------------------------------
+//
+CProtocolImConversationDataHostImp::CProtocolImConversationDataHostImp( MXIMPHost& aHost )
+:iHost( aHost )
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// CProtocolImConversationDataHostImp::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void CProtocolImConversationDataHostImp::ConstructL()
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// CProtocolImConversationDataHostImp::NewL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CProtocolImConversationDataHostImp* CProtocolImConversationDataHostImp::NewL( MXIMPHost& aHost )
+    {
+    CProtocolImConversationDataHostImp* self = new( ELeave ) CProtocolImConversationDataHostImp( aHost );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// Implement supported interface access.
+// ---------------------------------------------------------------------------
+//
+XIMPIMP_IF_BASE_GET_INTERFACE_BEGIN( CProtocolImConversationDataHostImp,
+                                     MProtocolImConversationDataHost )
+XIMPIMP_IF_BASE_GET_INTERFACE_END()
+
+
+XIMPIMP_IF_BASE_GET_CONST_INTERFACE_BEGIN( CProtocolImConversationDataHostImp,
+                                           MProtocolImConversationDataHost )
+XIMPIMP_IF_BASE_GET_INTERFACE_END()
+
+// ---------------------------------------------------------------------------
+// CProtocolImConversationDataHostImp::~CProtocolImConversationDataHostImp()
+// ---------------------------------------------------------------------------
+//
+CProtocolImConversationDataHostImp::~CProtocolImConversationDataHostImp()
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// CProtocolImConversationDataHostImp::HandleSentMessageL()
+// ---------------------------------------------------------------------------
+//
+//TXIMPRequestId CProtocolImConversationDataHostImp::HandleSentMessageL(MXIMPIdentity* /*aMessageId*/)
+//    {
+//    }
+    
+// ---------------------------------------------------------------------------
+// CProtocolImConversationDataHostImp::HandleNewTextMessageL()
+// ---------------------------------------------------------------------------
+//
+TXIMPRequestId CProtocolImConversationDataHostImp::HandleNewTextMessageL( MImConversationInfo* aImMessage)
+    {
+    XImLogger::Log(_L("CProtocolImConversationDataHostImp::HandleNewTextMessageL Started"));
+	XImLogger::Log(_L("CProtocolImConversationDataHostImp::HandleNewTextMessageL Completed"));
+    return iHost.AddNewOperationL( NImOps::EHandleReceiveMessage, aImMessage );
+    }
+    
+// ---------------------------------------------------------------------------
+// CProtocolImConversationDataHostImp::HandleNewContentMessageL()
+// ---------------------------------------------------------------------------
+//  
+//TXIMPRequestId CProtocolImConversationDataHostImp::HandleNewContentMessageL(  MXIMPIdentity* /*aMessageId*/,
+//                                           const TDesC& /*aSender*/,   
+//                                           const TDesC& /*aScreenName*/, 
+//                                           const MDesCArray& /*aRecipients*/,
+//                                           const MDesCArray& /*aScreenNames*/,                  
+//                                           const TDesC& /*aContentType*/, 
+//                                           const TDesC8& /*aContent*/)
+//    {
+//    XImLogger::Log(_L("CProtocolImConversationDataHostImp::HandleNewContentMessageL Started"));
+//	XImLogger::Log(_L("CProtocolImConversationDataHostImp::HandleNewContentMessageL Completed"));		
+//    }
+    
+// ---------------------------------------------------------------------------
+// CProtocolImConversationDataHostImp::HandleBlockedListResponseL()
+// ---------------------------------------------------------------------------
+//  
+//TXIMPRequestId CProtocolImConversationDataHostImp::HandleBlockedListResponseL( const MDesCArray* /*aBlockedList*/,
+//                                              TBool /*aBlockedListInUse*/,
+//                                              const MDesCArray* /*aGrantedList*/,
+//                                              TBool /*aGrantedListInUse*/)
+//    {
+//    XImLogger::Log(_L("CProtocolImConversationDataHostImp::HandleBlockedListResponseL Started"));
+//	XImLogger::Log(_L("CProtocolImConversationDataHostImp::HandleBlockedListResponseL Completed"));		
+//    }
+    
+// ---------------------------------------------------------------------------
+// CProtocolImConversationDataHostImp::HandleForwardMessageCompletionL()
+// ---------------------------------------------------------------------------
+//  
+//TXIMPRequestId CProtocolImConversationDataHostImp::HandleForwardMessageCompletionL(MXIMPIdentity* /*aMessageId*/)
+//    {
+//    XImLogger::Log(_L("CProtocolImConversationDataHostImp::HandleForwardMessageCompletionL Started"));
+//	XImLogger::Log(_L("CProtocolImConversationDataHostImp::HandleForwardMessageCompletionL Completed"));		
+//    }
+
+// ---------------------------------------------------------------------------
+// CProtocolImConversationDataHostImp::HandleGetMessageListL()
+// ---------------------------------------------------------------------------
+//     
+//TXIMPRequestId CProtocolImConversationDataHostImp::HandleGetMessageListL( /*MImFtpPluginObjectCollection* aMessageList */)
+//{
+//    XImLogger::Log(_L("CProtocolImConversationDataHostImp::HandleForwardMessageCompletionL Started"));
+//	XImLogger::Log(_L("CProtocolImConversationDataHostImp::HandleForwardMessageCompletionL Completed"));		
+	
+//}
+// ---------------------------------------------------------------------------
+// CProtocolImConversationDataHostImp::HandleRejectMessageL()
+// ---------------------------------------------------------------------------
+//  
+//TXIMPRequestId CProtocolImConversationDataHostImp::HandleRejectMessageL( MXIMPIdentity* /*aMessageId*/)
+//{
+//    XImLogger::Log(_L("CProtocolImConversationDataHostImp::HandleForwardMessageCompletionL Started"));
+//	XImLogger::Log(_L("CProtocolImConversationDataHostImp::HandleForwardMessageCompletionL Completed"));		
+	
+//}
+
+//End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/imfeatureplugin/srcimprocessor/imconversationdatahost/protocolimconversationdatahostimp.h	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  Implementation for managing cached Invite information.
+*
+*/
+
+#ifndef CPROTOCOLIMCONVERSATIONDATAHOSTIMP_H
+#define CPROTOCOLIMCONVERSATIONDATAHOSTIMP_H
+
+#include <protocolimconversationdatahost.h>
+
+#include "ximpapiobjbase.h"
+#include "imapiobjbase.h"
+//#include "ximpitemparent.h"
+#include "imtypehelpers.h"
+//#include "ximpoperationdefs.h"
+
+class MXIMPHost;
+class MXIMPObjectCollection;
+/**
+ * Implementation for managing cached Invitation information
+ *
+ * @since S60 
+ */
+class CProtocolImConversationDataHostImp : public CXIMPApiObjBase,
+                                           public MProtocolImConversationDataHost
+    {
+public: // Definitions
+
+    /** The class ID. */
+    enum { KClassId = IMIMP_CLSID_CPROTOCOLIMCONVERSATIONDATAHOST };
+
+public: // Construction and destruction
+
+    /**
+     * Construction
+     */
+    IMPORT_C static CProtocolImConversationDataHostImp* NewL( MXIMPHost& aHost );
+
+    /**
+     * Destruction
+     */
+    virtual ~CProtocolImConversationDataHostImp();
+
+private:
+
+    CProtocolImConversationDataHostImp( MXIMPHost& aHost );
+    void ConstructL();
+
+public: // From MXIMPBase
+
+    /**
+     * Implementation of MXIMPBase interface methods
+     * @see MXIMPBase
+     */
+    XIMPIMP_DECLARE_IF_BASE_METHODS
+
+public: //From CProtocolImConversationDataHost
+	
+	//TXIMPRequestId HandleSentMessageL(MXIMPIdentity* aMessageId);
+    TXIMPRequestId HandleNewTextMessageL( MImConversationInfo* aImMessage);
+    //TXIMPRequestId HandleNewContentMessageL(  MXIMPIdentity* aMessageId,
+    //                                       const TDesC& aSender,   
+    //                                       const TDesC& aScreenName, 
+    //                                       const MDesCArray& aRecipients,
+    //                                       const MDesCArray& aScreenNames,                  
+    //                                       const TDesC& aContentType, 
+    //                                       const TDesC8& aContent);
+    // TXIMPRequestId HandleBlockedListResponseL( const MDesCArray* aBlockedList,
+    //                                          TBool aBlockedListInUse,
+    //                                          const MDesCArray* aGrantedList,
+    //                                          TBool aGrantedListInUse);
+    //TXIMPRequestId HandleForwardMessageCompletionL(MXIMPIdentity* aMessageId);
+	//TXIMPRequestId HandleGetMessageListL( /*MImFtpPluginObjectCollection* aMessageList */);
+    //TXIMPRequestId HandleRejectMessageL( MXIMPIdentity* aMessageId);
+  
+ private: // Data
+
+    /**
+     * Access to host.
+     */
+    MXIMPHost& iHost;
+    };
+
+
+
+
+#endif // CPROTOCOLIMCONVERSATIONDATAHOSTIMP_H
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/imfeatureplugin/srcimprocessor/improcessorhook/improcessorhook.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,46 @@
+/*
+* 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:  XIMP Framework's IM  Processor Hook implementation.
+*
+*/
+
+
+#include <imdlluids.hrh>
+//#include "imapidataobjfactoryaccessor.h"
+#include <ecom/implementationproxy.h>
+#include <e32base.h>
+#include "protocoldatahostimp.h"
+
+// ---------------------------------------------------------------------------
+// Key value pair table to identify correct constructor
+// function for the requested interface.
+// ---------------------------------------------------------------------------
+//
+const TImplementationProxy ImplementationTable[] =
+    {
+    IMPLEMENTATION_PROXY_ENTRY( XIMP_ECOM_IMPL_UID_IM_PROCESSOR_INTERFACE,
+                                CProtocolDataHostImp::NewL)
+    };
+
+
+// ---------------------------------------------------------------------------
+// Exported function to return the implementation proxy table
+// ---------------------------------------------------------------------------
+//
+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/imservices/imfeatureplugin/srcimprocessor/improcessorhook/improcessorhook.rss	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,54 @@
+/*
+* 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:  ECom registery info for ECom hook
+*
+*/
+
+
+#include <ecom/registryinfov2.rh>
+#include "imdlluids.hrh"
+#include <immanagementifids.hrh>
+#include <improtocolpluginhostifids.hrh>
+#include <ximpfeaturepluginifids.hrh>
+
+
+// ---------------------------------------------------------------------------
+// ECom registery info for XIMP IM Manager ECom hook
+// ---------------------------------------------------------------------------
+//
+RESOURCE REGISTRY_INFO theInfo
+    {
+    resource_format_version = RESOURCE_FORMAT_VERSION_2;
+    dll_uid = XIMP_DLL_UID_IM_PROCESSOR_HOOK;
+
+    interfaces =
+        {
+        INTERFACE_INFO
+            {
+            interface_uid = XIMP_ECOM_IF_UID_PROTOCOL_DATA_HOST_INTERFACE;
+            implementations =
+                {
+                IMPLEMENTATION_INFO
+                    {
+                    implementation_uid = XIMP_ECOM_IMPL_UID_IM_PROCESSOR_INTERFACE;
+                    version_no         = 1;
+                    display_name       = "S60 Default XIMP";
+                    default_data       = XIMP_ECOM_DEFAULT_DATA_IM_EVENT_CODEC;
+                    opaque_data        = "";
+                    }
+                };
+            }
+        };
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/imfeatureplugin/srcimprocessor/protocoldatahostimp.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  Im connection host
+ *
+*/
+
+
+//#include <protocolimdatahost.h>
+#include <ximpprotocolconnection.h>
+#include <cprotocolimfeatures.h>
+#include <imobjectfactory.h>
+#include <protocolimconversationdatahost.h>
+#include "ximpapiobjbase.h"
+#include "imapiobjbase.h"
+#include "imobjectfactoryimp.h"
+
+#include "protocoldatahostimp.h"
+#include "protocolimdatahostimp.h"
+#include "protocolimconversationdatahostimp.h"
+//#include "ximpprotocolrequestcompleteeventimp.h"
+#include "imlogutils.h"
+#include <ximpoperationbase.h>
+#include "imoperationdefs.h"
+
+// ======== MEMBER FUNCTIONS ========
+
+
+// This should be variated. Branding variation can be one
+// possibility. One is to leave adaptation deside how soon
+// cleanup will be done.
+// Now 5 sec used for testing purposes. Better value could be
+// some minutes.
+
+// ---------------------------------------------------------------------------
+// CProtocolDataHostImp::CProtocolDataHostImp()
+// ---------------------------------------------------------------------------
+//
+CProtocolDataHostImp::CProtocolDataHostImp( MXIMPHost& aHost )
+:iHost( aHost )
+    {
+    XImLogger::Log(_L("CProtocolDataHostImp::CProtocolDataHostImp Started"));
+    XImLogger::Log(_L("CProtocolDataHostImp::CProtocolDataHostImp Completed"));
+    }
+
+
+// ---------------------------------------------------------------------------
+// CProtocolDataHostImp::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void CProtocolDataHostImp::ConstructL()
+    {
+    XImLogger::Log(_L("CProtocolDataHostImp::ConstructL Started"));
+    
+    //iImObjFactory = CImObjectFactoryImp::NewL();
+    //iConvDataHost = CProtocolImConversationDataHostImp::NewL( iHost );
+    iImDataHost = CProtocolImDataHostImp::NewL(iHost) ;
+    XImLogger::Log(_L("CProtocolDataHostImp::ConstructL Completed"));
+    }
+
+
+// ---------------------------------------------------------------------------
+// CProtocolDataHostImp::NewLC()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CProtocolDataHostImp* CProtocolDataHostImp::NewLC( MXIMPHost& aHost )
+    {
+    XImLogger::Log(_L("CProtocolDataHostImp::NewLC Started"));
+    CProtocolDataHostImp* self = new( ELeave ) CProtocolDataHostImp( aHost );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    XImLogger::Log(_L("CProtocolDataHostImp::NewLC Completed"));
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CProtocolDataHostImp::NewL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CProtocolDataHostImp* CProtocolDataHostImp::NewL( MXIMPHost& aHost )
+    {
+    XImLogger::Log(_L("CProtocolDataHostImp::NewL Started"));
+    CProtocolDataHostImp* self = new( ELeave ) CProtocolDataHostImp( aHost );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    XImLogger::Log(_L("CProtocolDataHostImp::NewL Completed"));
+    return self;
+    }
+// ---------------------------------------------------------------------------
+// CProtocolDataHostImp::~CProtocolDataHostImp()
+// ---------------------------------------------------------------------------
+//
+CProtocolDataHostImp::~CProtocolDataHostImp()
+    {
+    XImLogger::Log(_L("CProtocolDataHostImp::~CProtocolDataHostImp Started"));
+    
+    //delete iImObjFactory;
+    //delete iConvDataHost;
+    delete iImDataHost ;
+    XImLogger::Log(_L("CProtocolDataHostImp::~CProtocolDataHostImp Completed"));
+    }
+
+// ---------------------------------------------------------------------------
+// CProtocolDataHostImp::SetHostToProtocol()
+// ---------------------------------------------------------------------------
+//
+void CProtocolDataHostImp::SetHostToProtocol()
+	{
+	CProtocolImFeatures* imProtocolFeature = static_cast< CProtocolImFeatures*> 
+							(iHost.GetConnection().GetProtocolInterface(CProtocolImFeatures::KInterfaceId) );
+	
+	if(imProtocolFeature)
+		{
+		imProtocolFeature->SetHost(*iImDataHost);	
+		}
+	}
+
+// ---------------------------------------------------------------------------
+// CProtocolDataHostImp::GetInterface()
+// ---------------------------------------------------------------------------
+//
+TAny* CProtocolDataHostImp::GetInterface(TInt aInterfaceId)
+	{
+	if(aInterfaceId == MProtocolImDataHost::KInterfaceId )
+		return iImDataHost ;
+	else
+		return NULL ;
+	
+	}
+
+// ---------------------------------------------------------------------------
+// CProtocolDataHostImp::GetInterface()
+// ---------------------------------------------------------------------------
+//
+TInt CProtocolDataHostImp::GetCleanupOperation() 
+	{
+	return NImOps::EIMCleaner ;
+	}
+// End of file
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/imfeatureplugin/srcimprocessor/protocoldatahostimp.h	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  Im connection host
+ *
+*/
+
+#ifndef CPROTOCOLDATAHOSTIMP_H
+#define CPROTOCOLDATAHOSTIMP_H
+
+#include <e32base.h>
+//#include <ximpprotocolconnectionhost.h>
+//#include <ximpcontext.h>
+#include <ximpbase.h>
+#include <protocoldatahost.h>
+#include "imapiobjbase.h"
+#include "ximpapiobjbase.h"
+//#include "ximpitemparent.h"
+#include "ximphost.h"
+//#include "ximpoperationdefs.h"
+//#include "ximprequestidbuilder.h"
+
+
+class MXIMPHost;
+class MImObjectFactory;
+class CImObjectFactoryImp;
+
+class CXIMPPscContext;
+class MImDataCache;
+class CImDataCache;
+class CXIMPContextStateEventImp;
+class CPeriodic;
+class MXIMPProtocolConnection;
+class CProtocolImConversationDataHostImp;
+class CXIMPOperationBase ;
+
+class CProtocolImDataHostImp ;
+
+/**
+ * Im connection host.
+ *
+ * @lib ximpprocessor.lib
+ * @since S60 v3.2
+ */
+//class CProtocolImDataHostImp : public CXIMPApiObjBase,
+//                                     public MProtocolImDataHost
+NONSHARABLE_CLASS(CProtocolDataHostImp): public MProtocolDataHost
+    {
+public:
+    /** The class ID. */
+    enum { KClassId = IMIMP_CLSID_CPROTOCOLIMDATAHOSTIMP };
+
+public:
+
+    IMPORT_C static CProtocolDataHostImp* NewL( MXIMPHost& aHost );
+
+    IMPORT_C static CProtocolDataHostImp* NewLC( MXIMPHost& aHost );
+
+    virtual ~CProtocolDataHostImp();
+
+private:
+
+    CProtocolDataHostImp( MXIMPHost& aHost );
+    void ConstructL();
+
+public: // From MXIMPBase
+
+    /**
+     * Implementation of MXIMPBase interface methods
+     * @see MXIMPBase
+     */
+    //XIMPIMP_DECLARE_IF_BASE_METHODS
+
+
+public: // MProtocolImDataHost
+   
+    void SetHostToProtocol() ; 
+    TAny* GetInterface(TInt aInterfaceId) ;
+    TInt GetCleanupOperation() ;
+
+
+private: // data
+	// not owned
+    MXIMPHost& iHost;
+    
+    //CImObjectFactoryImp* iImObjFactory;
+    
+    //CProtocolImConversationDataHostImp* iConvDataHost;
+    
+    CProtocolImDataHostImp *iImDataHost ;
+
+    };
+
+
+#endif // CPROTOCOLDATAHOSTIMP_H
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/imfeatureplugin/srcimprocessor/protocolimdatahostimp.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,200 @@
+/*
+* 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:  Im connection host
+ *
+*/
+
+
+#include <protocolimdatahost.h>
+#include <ximpprotocolconnection.h>
+#include <protocolimfeatures.h>
+#include <imobjectfactory.h>
+#include <protocolimconversationdatahost.h>
+#include "ximpapiobjbase.h"
+#include "imapiobjbase.h"
+#include "imobjectfactoryimp.h"
+#include "imdatacacheimp.h"
+#include "protocolimdatahostimp.h"
+#include "protocolimconversationdatahostimp.h"
+//#include "ximpprotocolrequestcompleteeventimp.h"
+#include "imlogutils.h"
+#include "imdatacacheimp.h"
+
+
+
+// ======== MEMBER FUNCTIONS ========
+
+
+// This should be variated. Branding variation can be one
+// possibility. One is to leave adaptation deside how soon
+// cleanup will be done.
+// Now 5 sec used for testing purposes. Better value could be
+// some minutes.
+
+// ---------------------------------------------------------------------------
+// CProtocolImDataHostImp::CProtocolImDataHostImp()
+// ---------------------------------------------------------------------------
+//
+CProtocolImDataHostImp::CProtocolImDataHostImp( MXIMPHost& aHost )
+:iHost( aHost )
+    {
+    XImLogger::Log(_L("CProtocolImDataHostImp::CProtocolImDataHostImp Started"));
+    XImLogger::Log(_L("CProtocolImDataHostImp::CProtocolImDataHostImp Completed"));
+    }
+
+
+// ---------------------------------------------------------------------------
+// CProtocolImDataHostImp::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void CProtocolImDataHostImp::ConstructL()
+    {
+    XImLogger::Log(_L("CProtocolImDataHostImp::ConstructL Started"));
+    iConvDataHost = CProtocolImConversationDataHostImp::NewL( iHost );
+    iImObjFactory = CImObjectFactoryImp::NewL();
+    iImDataCache = CImDataCache::NewL( iHost );
+    
+    XImLogger::Log(_L("CProtocolImDataHostImp::ConstructL Completed"));
+    }
+
+
+// ---------------------------------------------------------------------------
+// CProtocolImDataHostImp::NewLC()
+// ---------------------------------------------------------------------------
+//
+CProtocolImDataHostImp* CProtocolImDataHostImp::NewLC( MXIMPHost& aHost )
+    {
+    XImLogger::Log(_L("CProtocolImDataHostImp::NewLC Started"));
+    CProtocolImDataHostImp* self = new( ELeave ) CProtocolImDataHostImp( aHost );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    XImLogger::Log(_L("CProtocolImDataHostImp::NewLC Completed"));
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CProtocolImDataHostImp::NewL()
+// ---------------------------------------------------------------------------
+//
+CProtocolImDataHostImp* CProtocolImDataHostImp::NewL( MXIMPHost& aHost )
+    {
+    XImLogger::Log(_L("CProtocolImDataHostImp::NewL Started"));
+    CProtocolImDataHostImp* self = new( ELeave ) CProtocolImDataHostImp( aHost );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    XImLogger::Log(_L("CProtocolImDataHostImp::NewL Completed"));
+    return self;
+    }
+// ---------------------------------------------------------------------------
+// CProtocolImDataHostImp::~CProtocolImDataHostImp()
+// ---------------------------------------------------------------------------
+//
+CProtocolImDataHostImp::~CProtocolImDataHostImp()
+    {
+    XImLogger::Log(_L("CProtocolImDataHostImp::~CProtocolImDataHostImp Started"));
+    delete iConvDataHost;
+    delete iImDataCache;
+    delete iImObjFactory;
+    XImLogger::Log(_L("CProtocolImDataHostImp::~CProtocolImDataHostImp Completed"));
+    }
+
+// ---------------------------------------------------------------------------
+// Implement supported interface access.
+// ---------------------------------------------------------------------------
+//
+//XIMPIMP_IF_BASE_GET_INTERFACE_BEGIN( CProtocolImDataHostImp, MProtocolImDataHost )
+//XIMPIMP_IF_BASE_GET_INTERFACE_END()
+//XIMPIMP_IF_BASE_GET_CONST_INTERFACE_BEGIN( CProtocolImDataHostImp, MProtocolImDataHost )
+//XIMPIMP_IF_BASE_GET_INTERFACE_END()
+
+
+// ---------------------------------------------------------------------------
+// CProtocolImDataHostImp::ImObjectFactory()
+// ---------------------------------------------------------------------------
+//
+MImObjectFactory& CProtocolImDataHostImp::ImObjectFactory()
+    {
+    XImLogger::Log(_L("CProtocolImDataHostImp::ImObjectFactory Started"));
+    XImLogger::Log(_L("CProtocolImDataHostImp::ImObjectFactory Completed"));
+    return *iImObjFactory;
+    }
+
+// ---------------------------------------------------------------------------
+// CProtocolImDataHostImp::ConversationDataHost()
+// ---------------------------------------------------------------------------
+//
+MProtocolImConversationDataHost& CProtocolImDataHostImp::ConversationDataHost()
+    {
+    XImLogger::Log(_L("CProtocolImDataHostImp::ConversationDataHost Started"));
+    XImLogger::Log(_L("CProtocolImDataHostImp::ConversationDataHost Completed"));
+    return *iConvDataHost;
+    }
+
+// ---------------------------------------------------------------------------
+// CProtocolImDataHostImp::SearchDataHost()
+// ---------------------------------------------------------------------------
+//
+//MProtocolImSearchDataHost& CProtocolImDataHostImp::SearchDataHost()
+//    {
+//    XImLogger::Log(_L("CProtocolImDataHostImp::ConversationDataHost Started"));
+    //return *iSearchDataHost;
+//    XImLogger::Log(_L("CProtocolImDataHostImp::ConversationDataHost Completed"));
+//    }
+
+// ---------------------------------------------------------------------------
+// CProtocolImDataHostImp::GroupDataHost()
+// ---------------------------------------------------------------------------
+// 
+//MProtocolImGroupDataHost& CProtocolImDataHostImp::GroupDataHost()
+//    {
+//    XImLogger::Log(_L("CProtocolImDataHostImp::ConversationDataHost Started"));
+    //return *iGroupDataHost;
+//    XImLogger::Log(_L("CProtocolImDataHostImp::ConversationDataHost Completed"));
+//    }
+    
+// ---------------------------------------------------------------------------
+// CProtocolImDataHostImp::InvitationDataHost()
+// ---------------------------------------------------------------------------
+//
+//MProtocolImInvitationDataHost& CProtocolImDataHostImp::InvitationDataHost()
+//    {
+//    XImLogger::Log(_L("CProtocolImDataHostImp::ConversationDataHost Started"));
+    //return *iInvitationDataHost;
+//    XImLogger::Log(_L("CProtocolImDataHostImp::ConversationDataHost Completed"));
+//    }
+
+
+// ---------------------------------------------------------------------------
+// CProtocolImDataHostImp::ConversationDataAccess()
+// ---------------------------------------------------------------------------
+//
+CProtocolImConversationDataHostImp& CProtocolImDataHostImp::ConversationDataAccess()
+    {
+    return *iConvDataHost;
+    }
+    
+// ---------------------------------------------------------------------------
+// CProtocolDataHostImp::ImDataCache()
+// ---------------------------------------------------------------------------
+//
+CImDataCache& CProtocolImDataHostImp::ImDataCache()
+    {
+    return *iImDataCache;
+    }
+
+
+    
+// End of file
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/imfeatureplugin/srcimprocessor/protocolimdatahostimp.h	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  Im connection host
+ *
+*/
+
+#ifndef CPROTOCOLIMDATAHOSTIMP_H
+#define CPROTOCOLIMDATAHOSTIMP_H
+
+#include <e32base.h>
+#include <ximpprotocolconnectionhost.h>
+#include <ximpcontext.h>
+#include <ximpbase.h>
+#include <protocolimdatahost.h>
+#include "imapiobjbase.h"
+#include "ximpapiobjbase.h"
+//#include "ximpitemparent.h"
+#include "ximphost.h"
+//#include "ximpoperationdefs.h"
+//#include "ximprequestidbuilder.h"
+
+
+class MXIMPHost;
+class MImObjectFactory;
+class CImObjectFactoryImp;
+
+class CXIMPPscContext;
+class MImDataCache;
+class CImDataCache;
+class CXIMPContextStateEventImp;
+class CPeriodic;
+class MXIMPProtocolConnection;
+class CProtocolImConversationDataHostImp;
+class MProtocolImConversationDataHost;
+class CProtocolImGroupDataHostImp;
+class CProtocolImInvitationDataHostImp;
+class CProtocolImSearchDataHostImp;
+
+
+/**
+ * Im connection host.
+ *
+ * @lib ximpprocessor.lib
+ * @since S60 v3.2
+ */
+//class CProtocolImDataHostImp : public CXIMPApiObjBase,
+//                                     public MProtocolImDataHost
+NONSHARABLE_CLASS(CProtocolImDataHostImp): public MProtocolImDataHost
+    {
+public:
+    /** The class ID. */
+    enum { KClassId = IMIMP_CLSID_CPROTOCOLIMDATAHOSTIMP };
+
+public:
+
+    static CProtocolImDataHostImp* NewL( MXIMPHost& aHost );
+
+    static CProtocolImDataHostImp* NewLC( MXIMPHost& aHost );
+
+    virtual ~CProtocolImDataHostImp();
+
+private:
+
+    CProtocolImDataHostImp( MXIMPHost& aHost );
+    void ConstructL();
+
+public: // From MXIMPBase
+
+    /**
+     * Implementation of MXIMPBase interface methods
+     * @see MXIMPBase
+     */
+    //XIMPIMP_DECLARE_IF_BASE_METHODS
+
+
+public: // MProtocolImDataHost
+   
+    MImObjectFactory& ImObjectFactory();
+
+    MProtocolImConversationDataHost& ConversationDataHost();
+
+    //MProtocolImGroupDataHost& GroupDataHost();
+
+    //MProtocolImInvitationDataHost& InvitationDataHost();
+
+    //MProtocolImSearchDataHost& SearchDataHost();
+    
+    CProtocolImConversationDataHostImp& ConversationDataAccess() ;
+    
+    
+    CImDataCache& ImDataCache();
+   
+
+private: // data
+
+	//not owned
+    MXIMPHost& iHost;
+
+    /**
+     * Data cache
+     */
+ 	CImDataCache* iImDataCache;
+
+    /**
+     * Data hosts
+     */
+    CImObjectFactoryImp* iImObjFactory;
+    CProtocolImConversationDataHostImp* iConvDataHost;
+    CProtocolImGroupDataHostImp* iGroupDataHost;
+    CProtocolImInvitationDataHostImp* iInvitationDataHost;
+    CProtocolImSearchDataHostImp* iSearchDataHost;
+
+
+    };
+
+
+#endif // CPROTOCOLIMDATAHOSTIMP_H
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/imfeatureplugin/srcutils/imlogutils.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,40 @@
+/*
+* 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:file for generating XImLogger
+*
+*/
+
+
+
+// INCLUDE FILES
+#include "imlogutils.h"
+
+// CONSTANTS
+const TInt KLogBufferLength = 256;
+_LIT(KImLogDir, "ximpim");
+_LIT(KImLogFile, "im.txt");
+
+void XImLogger::Log(TRefByValue<const TDesC> aFmt,...)
+    {
+#ifdef _DEBUG
+    VA_LIST list;
+    VA_START(list, aFmt);
+    // Print to log file
+    TBuf<KLogBufferLength> buf;
+    buf.FormatList(aFmt, list);
+    RFileLogger::Write(KImLogDir, KImLogFile, EFileLoggingModeAppend, buf);
+#endif
+    }
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/imfeatureplugin/srcutils/imlogutils.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,49 @@
+/*
+* 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: header for IM logs 
+*
+*/
+
+
+
+#ifndef IMLOGUTILS_H
+#define IMLOGUTILS_H
+
+//  INCLUDES
+#include <e32std.h>
+#include <flogger.h>
+
+
+/**
+*  Debug log writer
+*  @lib 
+*  
+*/
+class XImLogger
+    {
+    public: // New functions
+        
+        /**
+        * Writes log to log file
+        * @param 
+        * @return 
+        */
+	    static void Log(TRefByValue<const TDesC> aFmt,...);
+
+
+    };
+
+#endif      // IMLOGUTILS_H   
+           
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/instantmessagingcache/group/backup_registration.xml	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,11 @@
+<?xml version="1.0" standalone="yes"?>
+
+<!-- Backup registration file for imcache Server -->
+
+<backup_registration version="1.0">
+	<passive_backup delete_before_restore="yes">
+		<include_directory name="\"/>		
+	</passive_backup>
+	<proxy_data_manager SID="0x10202BE9"/>
+	<restore requires_reboot="no"/>
+</backup_registration>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/instantmessagingcache/group/bld.inf	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,32 @@
+/*
+* 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:  build definition file
+*
+*/
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+../rom/instantmessagingcache.iby						 	CORE_MW_LAYER_IBY_EXPORT_PATH(instantmessagingcache.iby)
+
+// ROM SIS stubs
+../sis/imcachestub.sis	             /epoc32/data/z/system/install/imcachestub.sis
+// module include
+#include "../imcacheserver/group/bld.inf"
+#include "../imcacheclient/group/bld.inf"
+
+// end of file
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/instantmessagingcache/imcacheclient/bwins/imcacheclientu.def	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,6 @@
+EXPORTS
+	?CreateUpdaterL@CIMCacheFactory@@QAEPAVMIMCacheUpdater@@HABVTDesC16@@H@Z @ 1 NONAME ; class MIMCacheUpdater * CIMCacheFactory::CreateUpdaterL(int, class TDesC16 const &, int)
+	?Release@CIMCacheFactory@@SAXXZ @ 2 NONAME ; void CIMCacheFactory::Release(void)
+	?InstanceL@CIMCacheFactory@@SAPAV1@XZ @ 3 NONAME ; class CIMCacheFactory * CIMCacheFactory::InstanceL(void)
+	?CreateAccessorL@CIMCacheFactory@@QAEPAVMIMCacheAccessor@@HABVTDesC16@@@Z @ 4 NONAME ; class MIMCacheAccessor * CIMCacheFactory::CreateAccessorL(int, class TDesC16 const &)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/instantmessagingcache/imcacheclient/eabi/imcacheclientu.def	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,10 @@
+EXPORTS
+	_ZN15CIMCacheFactory14CreateUpdaterLEiRK7TDesC16i @ 1 NONAME
+	_ZN15CIMCacheFactory15CreateAccessorLEiRK7TDesC16 @ 2 NONAME
+	_ZN15CIMCacheFactory7ReleaseEv @ 3 NONAME
+	_ZN15CIMCacheFactory9InstanceLEv @ 4 NONAME
+	_ZTI14CIMCacheClient @ 5 NONAME ; #<TI>#
+	_ZTI15CIMCacheFactory @ 6 NONAME ; #<TI>#
+	_ZTV14CIMCacheClient @ 7 NONAME ; #<VT>#
+	_ZTV15CIMCacheFactory @ 8 NONAME ; #<VT>#
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/instantmessagingcache/imcacheclient/group/bld.inf	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,26 @@
+/*
+* 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:  build definition file
+*
+*/
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_MMPFILES
+imcacheclient.mmp
+
+// end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/instantmessagingcache/imcacheclient/group/imcacheclient.mmp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,55 @@
+/*
+* 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:  mmp file
+*
+*/
+
+
+#include <platform_paths.hrh>
+#include <data_caging_paths.hrh>
+#include "../../inc/imcacheuids.h"
+
+TARGET              imcacheclient.dll 
+TARGETTYPE          dll
+UID                 KStaticInterfaceDllUid2 KIMCacheClientUid3
+CAPABILITY          CAP_CLIENT_DLL
+VENDORID            VID_DEFAULT
+
+VERSION      10.0
+SOURCEPATH          ../src
+
+SOURCE		    	cimcachefactory.cpp
+SOURCE		    	cimcacheupdater.cpp
+SOURCE		    	cimcacheaccessor.cpp
+SOURCE              cimcacheclient.cpp
+SOURCE              imcacheprocessstarter.cpp
+SOURCE				cimcacheeventhandler.cpp
+SOURCE				cimcacheaccesseventhandler.cpp
+
+
+USERINCLUDE         ../inc
+USERINCLUDE         ../../inc
+
+APP_LAYER_SYSTEMINCLUDE
+
+
+LIBRARY         euser.lib
+LIBRARY         efsrv.lib
+LIBRARY		    flogger.lib
+LIBRARY	  	    estor.lib
+LIBRARY 		cone.lib
+LIBRARY 		charconv.lib 
+
+
+// end of file
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/instantmessagingcache/imcacheclient/inc/cimcacheaccesseventhandler.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,138 @@
+/*
+* 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:  cache message change observer
+*
+*/
+
+
+#ifndef __CIMCACHEACCESSEVENTHANDLER_H__
+#define __CIMCACHEACCESSEVENTHANDLER_H__
+
+#include <e32std.h>
+#include <e32base.h>
+#include <s32mem.h>
+
+#include <imcachedefs.h>
+
+class MIMCacheClient;
+class MIMCacheEventHandler;
+
+/**
+ * a class to listen to server cache message change
+ */
+NONSHARABLE_CLASS( CIMCacheAccessEventHandler ): public CActive
+    {
+	public:
+		/**
+		* Two-phased constructor.
+		* @param aRegistrar ,client refence
+		* @param aHandler a handler to send data to ui client
+		*/
+		static CIMCacheAccessEventHandler* NewL( MIMCacheClient& aRegistrar ,
+										   MIMCacheEventHandler& aHandler );
+		/**
+		*  ~CIMCacheAccessEventHandler.
+		*/
+    	virtual ~CIMCacheAccessEventHandler();
+
+    public: // From CActive
+
+		/**
+		*  RunL
+		*/
+        void RunL();  
+        
+        /**
+		*  DoCancel
+		*/
+		void DoCancel();
+		
+		 /**
+          *  RunError
+          */
+        TInt RunError( TInt /* aError */);
+		        
+		
+		
+		
+			
+	public : // new functions
+			/**
+			*  UnRegisterObserver from server
+			*/
+			void UnRegisterObserver();
+	private:
+	
+		/**
+		* default CIMCacheAccessEventHandler
+		* @param aRegistrar ,client refence
+		* @param aHandler a handler to send data to ui client
+		*/
+		CIMCacheAccessEventHandler( MIMCacheClient& aRegistrar, 
+							  MIMCacheEventHandler& aHandler);
+		/**
+		*  default ConstructL
+		*/
+    	void ConstructL();
+    	
+   		
+        /**
+         * Gets called when data update is available.
+         * Client can then decide wether to use the old one
+         * @param aBuffer structure of SIMCacheMessageData type
+         */
+    	void GetBufferChatDataL();
+    	
+
+        /**
+         * Gets called when data update is available.
+         * extract the chat data and send to client
+         * @param aChatDataBuffer ,buffer containing number of chat data
+         * @param aMore, indicate that there is still pending packets
+         */
+    	void InternalizeChatDataL( TPtr8 aChatDataBuffer , TBool& aMore );
+    	
+
+        /**
+        * Gets called when data update is available.
+        * get data buffer from server
+        * @param aEventType, type of data
+        */  
+        void GetBufferedChatItemL( TIMCacheEventType aEventType );
+        
+        /**
+        * read the stream and write into buffer
+        * @param aEventType, type of data
+        * @param aChatItemBuffer structure of SIMCacheContactData type
+        */
+            
+        void InternalizeChatItemL( TIMCacheEventType aEventType, 
+                                   TPtr8 aChatItemBuffer );
+   
+	private: // data
+	
+		// doesn't own: registrar
+		MIMCacheClient& iRegistrar;
+		// owned , need to observer to server or not
+		TBool iContinueObserving ;
+		// client side observer event 
+		MIMCacheEventHandler& iAccessHandler;
+		
+    };
+
+#endif      //  __CIMCACHEACCESSEVENTHANDLER_H__
+
+
+//  END OF FILE
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/instantmessagingcache/imcacheclient/inc/cimcacheaccessor.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,151 @@
+/*
+* 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:  class declaration for accessing the cache
+*
+*/
+
+
+
+#ifndef __CIMCACHEACCESSOR_H__
+#define __CIMCACHEACCESSOR_H__
+
+#include <e32base.h>
+#include "mimcacheaccessor.h"
+#include "cimcacheclient.h"
+
+class MIMCacheEventHandler;
+
+/**
+ * write right class declaration
+ */
+ 
+NONSHARABLE_CLASS( CIMCacheAccessor ): public CBase,
+								 public MIMCacheAccessor
+    {
+	public:
+		/**
+		* Two-phased constructor.
+		* @param aServiceId, service id to used
+		* @param aUserId, user id who is conversing
+		*/
+		static CIMCacheAccessor* NewL(TInt aServiceId,
+										const TDesC& aUserId );
+		/**
+		* virtual destructor.
+		*/
+    	virtual ~CIMCacheAccessor();
+
+		
+	private:
+	
+		/**
+		* ConstructL.
+		* @param aUserId, user id who is conversing
+		*/
+		
+    	void ConstructL( const TDesC& aUserId );
+    	
+    	/**
+		* default constructor.
+		* @param aServiceId, service id to used
+		*/
+		CIMCacheAccessor(TInt aServiceId);
+
+	
+	private: // from MIMCacheAccessor
+
+		/**
+    	* Register to observer instantmessagingcache data updates
+    	* @param aObserver the observer interface
+    	*/
+        void RegisterObserverL( MIMCacheEventHandler& aObserver );
+
+    	/**
+    	* Unregister a instantmessagingcache data update observer
+    	* @param aObserver the observer interface
+    	*/
+        void UnRegisterObserver( MIMCacheEventHandler& aObserver);
+        	
+       
+       	/**
+    	* to get the unread message count from server
+    	* @param aOwnUserId , logged in user id
+    	* @return number of unread msg count
+    	*/
+       TInt GetUnreadMessageCountL(const TDesC& aBuddyId );
+		
+		 /**
+    	* to get the all unread message count from server
+    	* @param , aOwnUserId logged in user id
+    	* @return number of all unread msg count
+    	*/
+        TInt GetAllUnreadMessageCountL();		
+			 						
+		/**
+         * check if already conversation opened
+         * @param aServiceId, serviceid to use
+         * @param aOwnUserId, own user id 
+         * @param aRecipientId, the selected user id with whom conversation is started
+         * @return ETrue if already exist else EFlase.
+         */
+        TBool IsConversationExistL( const TDesC& aBuddyId )  ;
+        
+        /**
+        * closes conversation and commit operation
+        * @param aServiceId service id.
+        * @param aOwnId own user id.
+        * @param aRecipientId recipient's user id.
+        */
+        void CloseConversationL( const TDesC& aBuddyId );
+        
+        
+        /**
+        * get the chat list corresponding to service
+        * @param aServiceId service id
+        * @return Array of chats
+        */
+        RArray<SIMCacheChatItem> GetChatListL( const TInt aServiceId  ); 
+   
+	private :
+		/**
+         * default constructor.
+         * @param aServiceId, service id to used
+         */
+        void InternalizeChatListL( RArray<SIMCacheChatItem>& aChatArray, TPtr8 aChatListBuffer, TBool& aMore );
+        	 
+    public : // new api
+    	
+       /**
+		* return the serviceid
+		*/
+    	TInt ServiceId() const ;	        
+		
+	private: // data
+
+		// owned , user id
+		HBufC* iUserId;
+		
+		// not owned , client
+		CIMCacheClient iClient;
+		
+		// owned, service id
+		TInt iServiceId;
+	
+    };
+
+#endif      //  __CIMCACHEUPDATER_H__
+
+
+//  END OF FILE
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/instantmessagingcache/imcacheclient/inc/cimcacheclient.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,218 @@
+/*
+* 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:  client class to connect to server
+*
+*/
+
+
+
+#ifndef __CIMCACHECLIENT_H__
+#define __CIMCACHECLIENT_H__
+
+#include <e32base.h>
+#include <imcachedefs.h>
+#include "mimcacheclient.h"
+
+class MIMCacheEventHandler;
+class CIMCacheEventHandler;
+class MIMCacheEventHandler;
+class CIMCacheAccessEventHandler;
+/**
+ * CIMCacheClient ClientServer 
+  */
+class CIMCacheClient : public CBase,
+					   public RSessionBase,
+					   public MIMCacheClient
+    {
+    
+    public:     // Constructor and destructor
+    	/*
+    	* CIMCacheClient
+       	*/
+         CIMCacheClient();
+        
+        /*
+    	* ~CIMCacheClient
+       	*/
+        ~CIMCacheClient();
+
+
+    public:     // New methods
+
+		/**
+    	* Connect
+       	*/
+        TInt Connect();      
+       
+       	/**
+    	* Register to observer converstaionitems data updates
+    	* @param aObserver the observer interface
+    	*/
+        void RegisterUpdateObserverL( MIMCacheEventHandler& aObserver );
+
+    	/**
+    	* Unregister a converstaionitems data update observer
+    	* @param aObserver the observer interface
+    	*/
+        void UnRegisterUpdateObserver( MIMCacheEventHandler& aObserver );
+		/**
+    	* Register to observer converstaionitems data access
+    	* @param aObserver the observer interface
+    	*/
+        void RegisterAccessObserverL( MIMCacheEventHandler& aObserver );
+
+    	/**
+    	* Unregister a converstaionitems data access observer
+    	* @param aObserver the observer interface
+    	*/
+        void UnRegisterAccessObserver( MIMCacheEventHandler& aObserver);
+
+		/**
+    	* start the transaction and perform the operation
+    	* @param aOperationType , operation to perform
+    	*/
+        TInt StartTransactionL( EIMCacheOperations aOperationType );
+        
+		/**
+    	* start the transaction and perform the operation 
+    	* @param aText ,text to send to server
+		* @param aOperationType operation to perform
+    	*/
+		void StartTransactionL( EIMCacheOperations aOperationType,
+								const TDesC& aText
+								) ;
+									   
+		/**
+    	* start the transaction and perform the operation 
+    	* @param aServiceId service id to use
+		* @param aUserId user id to use
+		* @param aOperationType operation to perform
+    	*/
+		void StartTransactionL(	EIMCacheOperations aOperationType ,
+								TInt aServiceId,
+								const TDesC& aText
+								);
+        
+       	/**
+    	* start the transaction and perform the operation 
+    	* @param aServiceId service id to use
+		* @param aSender user id to use
+		* @param aRecipient,recipient user id
+		* @param aOperationType operation to perform
+    	*/						
+		void StartTransactionL( EIMCacheOperations aOperationType,
+								TInt aServiceId,
+								const TDesC& aText1 ,
+						   	  	const TDesC& aText2
+						   		) ;
+									   		
+		 
+		/**
+    	* to get the all unread message count from server
+    	* @param , aOwnUserId logged in user id
+    	* @return number of unread msg count
+    	*/
+		TInt GetInformationL(EIMCacheOperations aOperationType , TInt aServiceId,const TDesC& aBuddyId );
+		
+	   /**
+    	* to get the count from server
+        * @param aOperationType operation to perform
+    	* @param aServiceId, service id used
+    	* @param , aOwnUserId logged in user id
+    	* @return number of all unread msg count
+    	*/
+        TInt GetInformationL(EIMCacheOperations aOperationType, TInt aServiceId );	
+      
+		
+		/**
+    	* to get the list of availabe chats from server
+       	* @param aServiceId, service id used
+       	* @return list buffer
+    	*/
+	    TPtr8 GetChatListL( const TInt& aServiceId = -1);
+									   										   		
+private: 
+		
+		/**
+    	* CreateArgumentsL pack the given parameters 
+    	* @param aServiceId service id to use
+		* @param aUserId user id to use
+		* @param aText,a text to send 
+		* @return TIpcArgs, packed arguments
+	   	*/									   		
+		TIpcArgs CreateArgumentsL( TInt aServiceId, const TDesC& aText1  ,
+									   const TDesC& aText2  );
+									   
+	   	/**
+    	* CreateArgumentsL pack the given parameters  
+    	* @param aServiceId service id to use
+		* @param aUserId user id to use
+		* @return TIpcArgs, packed arguments
+    	*/	
+        TIpcArgs CreateArgumentsL( TInt aServiceId ,
+								  const TDesC& aText  );
+		
+
+
+
+public: // MIMCacheClient
+
+		/**
+    	* Registeres the cache update observer to server
+    	* @param aStatus status message to regisetr
+		* @param aRight,right is operations
+    	*/
+        void RegisterObserverToServerL( TRequestStatus& aStatus,EIMCacheOperations aRight ) ;
+        
+       
+        /**
+    	* unRegisteres the cache update  observer to server
+    	* @param aStatus status message to regisetr
+		* @param aRight,right is operations
+    	*/
+        void UnRegisterObserverToServerL(  TRequestStatus& aStatus, EIMCacheOperations aRight ) ;
+        
+        /**
+         * cancels any outstanding requests pending from the server
+         * @param aStatus status message to regisetr
+         * @param aRight,right is operations
+         */
+        void CancelRequestL( TRequestStatus& aStatus, EIMCacheOperations aRight);
+         
+        /**
+        * Gets called when data update is available.
+        * Client can then decide wether to use the old one
+        * @param aRight, operations
+        * @param abuuferptr 
+        */
+        TPtr8 GetBufferedDataL(EIMCacheOperations aOperationType );
+       
+	private:
+		
+		 // owned , a array for all client who has 
+		 // register update data change event 
+		 CIMCacheEventHandler* iUpdateObserver;
+		 // owned , a array for all client who has 
+		 // register update data change event 
+		 CIMCacheAccessEventHandler* iAccessObserver;
+		 //owned buffer to get chats from server.
+		 HBufC8* iChatBuffer;
+		
+    };
+
+#endif      //  __CIMCACHECLIENT_H__
+
+
+//  END OF FILE
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/instantmessagingcache/imcacheclient/inc/cimcacheeventhandler.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,134 @@
+/*
+* 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:  cache message change observer
+*
+*/
+
+
+#ifndef __CIMCACHEEVENTHANDLER_H__
+#define __CIMCACHEEVENTHANDLER_H__
+
+#include <e32std.h>
+#include <e32base.h>
+#include <s32mem.h>
+
+#include <imcachedefs.h>
+
+class MIMCacheClient;
+class MIMCacheEventHandler;
+
+/**
+ * a class to listen to server cache message change
+ */
+NONSHARABLE_CLASS( CIMCacheEventHandler ): public CActive
+    {
+	public:
+		/**
+		* Two-phased constructor.
+		* @param aRegistrar ,client refence
+		* @param aHandler a handler to send data to ui client
+		*/
+		static CIMCacheEventHandler* NewL( MIMCacheClient& aRegistrar ,
+													 MIMCacheEventHandler& aHandler  );
+		/**
+		*  ~CIMCacheEventHandler.
+		*/
+    	virtual ~CIMCacheEventHandler();
+
+    public: // From CActive
+
+		/**
+		*  RunL
+		*/
+        void RunL();  
+        
+        /**
+		*  DoCancel
+		*/
+		void DoCancel();
+		
+		 /**
+          *  RunError
+          */
+		TInt RunError( TInt /* aError */);
+		
+			
+	public : // new functions
+			/**
+			*  UnRegisterObserver from server
+			*/
+			void UnRegisterObserver();
+	private:
+	
+		/**
+		* default CIMCacheEventHandler
+		* @param aRegistrar ,client refence
+		* @param aHandler a handler to send data to ui client
+		*/
+		CIMCacheEventHandler( MIMCacheClient& aRegistrar, 
+							  MIMCacheEventHandler& aHandler );
+		/**
+		*  default ConstructL
+		*/
+    	void ConstructL();
+    	
+    	/**
+    	* Gets called when data update is available.
+    	* get data buffer from server
+    	*/
+    	void GetBufferChatDataL() ;
+      
+      	/**
+    	* Gets called when data update is available.
+    	* extract the data and send to client
+    	* @param aChatDataBuffer structure of SIMCacheMessageData type
+    	* @param aMore indicate more packets pending at server side
+    	*/
+    	void InternalizeChatDataL( TPtr8 aChatDataBuffer , 
+    							   TBool& aMore );
+		
+    	/**
+    	* Gets called when data update is available.
+    	* get data buffer from server
+		* @param aEventType, type of data
+    	*/	
+        void GetBufferedChatItemL( TIMCacheEventType aEventType );
+        
+        /**
+    	* read the stream and write into buffer
+    	* @param aEventType, type of data
+    	* @param aChatItemBuffer structure of SIMCacheContactData type
+       	*/
+          	
+    	void InternalizeChatItemL( TIMCacheEventType aEventType, 
+    							   TPtr8 aChatItemBuffer );
+	
+	private: // data
+	
+			
+		// doesn't own: registrar
+		MIMCacheClient& iRegistrar;
+		// owned , need to observer to server or not
+		TBool iContinueObserving ;
+		// client side observer event 
+		MIMCacheEventHandler& iUpdateHandler;
+	
+		
+    };
+
+#endif      //  __CIMCACHEEVENTHANDLER_H__
+
+
+//  END OF FILE
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/instantmessagingcache/imcacheclient/inc/cimcacheupdater.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,167 @@
+/*
+* 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:  class declaration for updating the cache
+*
+*/
+
+
+
+#ifndef __CIMCACHEUPDATER_H__
+#define __CIMCACHEUPDATER_H__
+
+#include <e32base.h>
+#include "mimcacheupdater.h"
+#include "cimcacheclient.h"
+
+class MIMCacheEventHandler;
+
+/**
+ * write right class declaration
+ */
+ 
+NONSHARABLE_CLASS( CIMCacheUpdater ): public CBase,
+								 public MIMCacheUpdater
+    {
+	public:
+		/**
+		* Two-phased constructor.
+		* @param aServiceId, service id to used
+		* @param aUserId, user id who is conversing
+		*/
+		static CIMCacheUpdater* NewL(TInt aServiceId,
+									const TDesC& aUserId,
+									TBool aRegistrationNeeded );
+		/**
+		* virtual destructor.
+		*/
+    	virtual ~CIMCacheUpdater();
+
+		
+	private:
+	
+		/**
+		* ConstructL.
+		* @param aUserId, user id who is conversing
+		*/
+		
+    	void ConstructL( const TDesC& aUserId, TBool aRegistrationNeeded );
+    	
+    	/**
+		* default constructor.
+		* @param aServiceId, service id to used
+		*/
+		CIMCacheUpdater(TInt aServiceId);
+		
+		/**
+		* default constructor.
+		* @param aServiceId, service id to used
+		*/
+		void InternalizeChatListL( RArray<SIMCacheChatItem>& aChatArray, TPtr8 aChatListBuffer, TBool& aMore );
+
+	private: // from MIMCacheUpdater
+
+		/**
+    	* Register to observer instantmessagingcache data updates
+    	* @param aObserver the observer interface
+    	*/
+        void RegisterObserverL( MIMCacheEventHandler& aObserver );
+
+    	/**
+    	* Unregister a instantmessagingcache data update observer
+    	* @param aObserver the observer interface
+    	*/
+        void UnRegisterObserver( MIMCacheEventHandler& aObserver);
+        
+				
+		/**
+        * start a new conversation 
+        * @param aBuddyId a recipient user id
+        */
+		void StartNewConversationL(const TDesC& aBuddyId ) ;
+		
+		/**
+        * append the new recieve message
+        * @param aSender a sender user id
+        * @param aRecipient a recipient user id
+        * @param aText a text to append
+        */
+		void AppendReceiveMessageL( const TDesC& aBuddyId, 
+								   const TDesC& aText ) ;
+		
+		/**
+        * append the new send message
+        * @param aText a text to append
+        */
+		void AppendSendMessageL(const TDesC& aText ) ;
+		
+		/**
+        * append the normal information message
+        * @param aBuddyId buddy id.
+        * @param aText a text to append
+        */
+		void AppendMessageL(const TDesC& aBuddyId, const TDesC& aText) ;
+		
+		
+		/**
+		* closes conversation and commit operation
+		* @param aServiceId service id.
+		* @param aBuddyId buddy id.
+		* @param aRecipientId recipient's user id.
+		*/
+		void CloseConversationL( const TDesC& aBuddyId ) ;
+		
+		/*
+		 * close all conversation in service Id
+		 */
+		void CloseAllConversationL();
+		
+		/**
+        * Deactivate all open conversations and commit operation
+        */
+		TInt DeactivateConversationL() ;
+		
+      	
+		/**
+        * get the chat list corresponding to service
+        * @param aServiceId service id
+        * @return Array of chats
+        */
+		RArray<SIMCacheChatItem> GetChatListL( const TInt aServiceId  ); 
+		
+		
+    public : // new api
+    	
+       /**
+		* return the serviceid
+		*/
+    	TInt ServiceId() const ;	        
+		
+	private: // data
+
+		// owned , user id
+		HBufC* iUserId;
+		
+		// not owned , client
+		CIMCacheClient iClient;
+		
+		// owned, service id
+		TInt iServiceId;
+	
+    };
+
+#endif      //  __CIMCACHEUPDATER_H__
+
+
+//  END OF FILE
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/instantmessagingcache/imcacheclient/inc/imcacheprocessstarter.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,92 @@
+/*
+* 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:  start the server
+*
+*/
+
+
+
+#ifndef __IMCACHEPROCESSSTARTER_H__
+#define __IMCACHEPROCESSSTARTER_H__
+
+#include <e32std.h>
+
+/**
+ * Generic process starter.
+ */
+class IMCacheProcessStarter
+    {
+    public:     // New methods
+
+		/**
+    	* read full path for client 
+    	* @param aExeName the , name of server exe
+    	* @param aFullExePath path of server exe
+    	*/
+        static void FullExePathForClientLocation(
+                        const TDesC& aExeName,
+                        TFileName& aFullExePath );
+
+		/**
+    	* StartInstance the instance of server
+    	* @param aFullExePath path of server exe
+    	* @param aCommand the , to excute 
+    	* @param aParams, starter parameter
+    	*/
+        static TInt StartInstance(
+                        const TDesC& aFullExePath,
+                        const TDesC& aCommand
+                        );
+		
+		/**
+    	* connect to the server
+    	* @param aFullExePath path of server exe
+    	* @param aCommand the , to excute 
+       	* @param aSessionToConnect, sesion to be used
+		* @param aServerName, server  name 
+		* @param aClientVersion, client version
+		* @param aAsyncMessageSlots, slots number
+		*/
+        static TInt ConnectToServer(
+                        const TDesC& aFullExePath,
+                        const TDesC& aCommand,
+                        RSessionBase& aSessionToConnect,
+                        const TDesC& aServerName,
+                        const TVersion& aClientVersion,
+                        TInt aAsyncMessageSlots );
+
+
+
+    private:    // Helpers
+    
+    	/**
+    	* DoStartInstance
+        * @param aFullExePath path of server exe
+        * @param aCommand the , to excute 
+    	* @param aParams, starter parameter
+    	*/
+        static TInt DoStartInstance(
+                        const TDesC& aFullExePath,
+                        const TDesC& aCommand );
+                        
+        
+
+    };
+
+#endif      //  __IMCACHEPROCESSSTARTER_H__
+
+
+//END OF FILE
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/instantmessagingcache/imcacheclient/inc/mimcacheclient.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,75 @@
+/*
+* 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:  message change observer
+*
+*/
+
+
+
+#ifndef __MIMCACHECLIENT_H
+#define __MIMCACHECLIENT_H
+
+#include <e32std.h>
+#include <imcachedefs.h>
+
+/**
+ * An interface through which client gets information
+ * about available  data updates.
+ *
+ * @since
+ */
+class MIMCacheClient
+    {
+    public:
+    
+    	
+		/**
+    	* Registeres the cache update observer to server
+    	* @param aStatus status message to regisetr
+		* @param aRight, operations
+    	*/
+        virtual void RegisterObserverToServerL( TRequestStatus& aStatus, EIMCacheOperations aRight ) = 0;
+        
+        /**
+    	* unRegisteres the cache update  observer to server
+    	* @param aStatus status message to regisetr
+		* @param aRight, operations
+    	*/
+        virtual void UnRegisterObserverToServerL( TRequestStatus& aStatus, EIMCacheOperations aRight ) = 0 ;
+              
+        /**
+        * Gets called when data update is available.
+        * Client can then decide wether to use the old one
+        * @param aRight, operations
+        * @param abuuferptr 
+        */
+        virtual TPtr8 GetBufferedDataL(EIMCacheOperations aOperationType ) = 0 ;
+        
+        /**
+         * cancels any outstanding requests pending from the server
+         * @param aStatus status message to regisetr
+         * @param aRight,right is operations
+         */
+        virtual void CancelRequestL( TRequestStatus& aStatus, EIMCacheOperations aRight) = 0;
+         
+protected:
+    	/**
+    	* Destructor
+    	*/
+    	virtual ~MIMCacheClient() {};
+    };
+
+#endif //__MIMCACHECLIENT_H
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/instantmessagingcache/imcacheclient/src/cimcacheaccesseventhandler.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,348 @@
+/*
+* 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:  cache message change observer
+*
+*/
+
+
+//  INCLUDE FILES
+
+#include "cimcacheaccesseventhandler.h"
+#include "mimcacheclient.h"
+#include "mimcacheeventhandler.h"
+// logs
+#include "imcachedebugtrace.h"
+
+// -----------------------------------------------------------------------------
+// CIMCacheAccessEventHandler::NewL
+// -----------------------------------------------------------------------------
+//
+CIMCacheAccessEventHandler* CIMCacheAccessEventHandler::NewL( 
+								MIMCacheClient& aRegistrar, 
+								MIMCacheEventHandler& aHandler )
+    {
+    TRACE( T_LIT("CIMCacheAccessEventHandler::NewL() begin") );
+	CIMCacheAccessEventHandler* self = new ( ELeave ) CIMCacheAccessEventHandler( aRegistrar ,aHandler ) ;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );  //self
+	TRACE( T_LIT("CIMCacheAccessEventHandler::NewL() end") );
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CIMCacheAccessEventHandler::ConstructL
+// -----------------------------------------------------------------------------
+//
+void CIMCacheAccessEventHandler::ConstructL()
+    {
+    TRACE( T_LIT("CIMCacheAccessEventHandler::ConstructL() begin") );
+    iContinueObserving = ETrue ;
+   	CActiveScheduler::Add( this );
+	iRegistrar.RegisterObserverToServerL( iStatus ,EIMCacheObserveMessageAccessRegister );
+	SetActive();
+	TRACE( T_LIT("CIMCacheAccessEventHandler::ConstructL() end") );
+    }
+
+// -----------------------------------------------------------------------------
+// CIMCacheAccessEventHandler::~CIMCacheAccessEventHandler
+// -----------------------------------------------------------------------------
+//
+CIMCacheAccessEventHandler::~CIMCacheAccessEventHandler()
+	{
+	TRACE( T_LIT("CIMCacheAccessEventHandler::~CIMCacheAccessEventHandler() begin") );
+	Cancel();
+	TRACE( T_LIT("CIMCacheAccessEventHandler::~CIMCacheAccessEventHandler() end") );
+	}
+
+// -----------------------------------------------------------------------------
+// CIMCacheAccessEventHandler::CIMCacheAccessEventHandler(
+// -----------------------------------------------------------------------------
+//
+CIMCacheAccessEventHandler::CIMCacheAccessEventHandler(
+								 MIMCacheClient& aRegistrar , 
+								 MIMCacheEventHandler& aHandler) :
+	CActive( CActive::EPriorityIdle ),
+  	iRegistrar( aRegistrar ),
+  	iAccessHandler( aHandler )
+ 	{
+ 	TRACE( T_LIT("CIMCacheAccessEventHandler::CIMCacheAccessEventHandler()") );
+	}
+// -----------------------------------------------------------------------------
+// CIMCacheAccessEventHandler::RunL
+// -----------------------------------------------------------------------------
+//
+void CIMCacheAccessEventHandler::RunL()
+	{
+	TRACE( T_LIT("CIMCacheAccessEventHandler::RunL() begin") );
+	TRACE( T_LIT("CIMCacheAccessEventHandler::RunL() iStatus code = "),iStatus.Int()  );
+	
+	switch( iStatus.Int() )
+		{
+		case EIMOperationUnreadMessage :
+		    {
+		    TRACE( T_LIT("CIMCacheAccessEventHandler::RunL() EIMOperationUnreadMessage") );
+			GetBufferChatDataL();	            
+		    break;
+		    }
+	    case EIMOperationUnreadChange :
+	        {
+	        // message data available get the data   
+	        GetBufferedChatItemL(EIMCacheUnreadChange);  
+	        break;
+	        }
+	    case EIMOperationChatStarted :
+	        {
+	        // message data available get the data   
+	        GetBufferedChatItemL(EIMCacheChatStarted);  
+	        break;  
+	        }  
+		case EIMOperationChatDeleted :
+			{
+			// message data available get the data   
+            GetBufferedChatItemL(EIMCacheChatClosed );  
+			break;	
+			} 
+	   case EIMOperationAllChatDeleted:
+		    {
+		    iAccessHandler.HandleIMCacheEventL( EIMCacheAllChatClosed, NULL );
+		    break;
+		    }
+       case EIMOperationUnRegistered:
+            {
+            TRACE(T_LIT(
+                    "CIMCacheEventHandler::RunL() EIMOperationUnRegistered"));
+            iContinueObserving = EFalse;
+            break;
+            }
+        case KErrServerTerminated:
+            {
+            // This case handles when the server terminated status is set.
+            // This is scenario is typically scene when imcache server is uninstalled.
+            UnRegisterObserver();
+            DoCancel();
+            break;
+            }
+		default :
+		    {
+		    TRACE( T_LIT("CIMCacheEventHandler::RunL() default") );
+		    break;	
+		    }
+		}	
+
+	TRACE( T_LIT("CIMCacheAccessEventHandler::RunL() iContinueObserving iContinueObserving = %d") ,iContinueObserving);
+		// Comment: cancel operation is changes as synchronous. iContinueObserving from event
+	// can not really be trusted since complete code might be different if leave has occured 
+	// for example. Cancel is handled here as generic cancel.
+	// check need to continue observing to server
+	if( iContinueObserving && KErrCancel != iStatus.Int() )
+		{
+		iRegistrar.RegisterObserverToServerL( iStatus ,EIMCacheObserveMessageAccessRegister );
+		SetActive();
+		}
+	TRACE( T_LIT("CIMCacheAccessEventHandler::RunL() end") );
+	}
+// -----------------------------------------------------------------------------
+// CIMCacheAccessEventHandler::DoCancel
+// -----------------------------------------------------------------------------
+//	
+void CIMCacheAccessEventHandler::DoCancel()
+	{
+	TRACE( T_LIT("CIMCacheAccessEventHandler::DoCancel() ") );
+		// Comment: set to EFalse here since we can not trust other changes. See
+	// comments in RunL
+	iContinueObserving = EFalse;
+	if( IsActive() )
+        {
+        TRAP_IGNORE(iRegistrar.CancelRequestL( iStatus ,EIMCacheCancelRequest ));
+        }
+	}
+
+// ---------------------------------------------------------
+// CIMCacheAccessEventHandler::RunError()
+// ---------------------------------------------------------
+//
+TInt CIMCacheAccessEventHandler::RunError( TInt /* aError */)
+    {
+    TRACE( T_LIT("CVIMPSTEngineCVListener::RunError() start"));
+    return KErrNone;
+    }
+// -----------------------------------------------------------------------------
+// CIMCacheAccessEventHandler::UnRegisterObserver
+// -----------------------------------------------------------------------------
+//		
+void CIMCacheAccessEventHandler::UnRegisterObserver()
+	{
+	TRACE( T_LIT("CIMCacheAccessEventHandler::UnRegisterObserver() begin") );
+	if( IsActive() )
+		{
+		TRACE( T_LIT("CIMCacheAccessEventHandler::UnRegisterObserver() active") );
+		TRAP_IGNORE(iRegistrar.UnRegisterObserverToServerL( iStatus ,EIMCacheObserveMessageAccessUnRegister ));
+		}
+	TRACE( T_LIT("CIMCacheAccessEventHandler::UnRegisterObserver() end") );	
+	}
+
+// -----------------------------------------------------------------------------
+// CIMCacheAccessEventHandler::GetBufferChatDataL
+// -----------------------------------------------------------------------------
+//
+void CIMCacheAccessEventHandler::GetBufferChatDataL() 
+    {
+    TRACE( T_LIT("CIMCacheAccessEventHandler::GetBufferChatDataL() begin") );
+   
+    TBool more = ETrue;
+    while(more)
+        {
+        TPtr8 bufferPtr = iRegistrar.GetBufferedDataL( EIMCacheGetBufferedPackets  );
+        InternalizeChatDataL( bufferPtr , more );
+        }
+    TRACE( T_LIT("CIMCacheAccessEventHandler::GetBufferChatDataL() end") );
+    }
+
+// -----------------------------------------------------------------------------
+// CIMCacheAccessEventHandler::InternalizeChatDataL
+// -----------------------------------------------------------------------------     
+void CIMCacheAccessEventHandler::InternalizeChatDataL( TPtr8 aChatDataBuffer , TBool& aMore )
+    {
+    TRACE( T_LIT("CIMCacheAccessEventHandler::InternalizeChatDataL() Start") );
+    if( 0 == aChatDataBuffer.Length())
+          {
+          TRACE( T_LIT("CIMCacheAccessEventHandler::InternalizeChatItemL() aChatDataBuffer is zeor, hence returning ") );
+          return;
+          }
+	RDesReadStream readAllStream ;
+	RDesReadStream readStream ;    
+
+	readAllStream.Open( aChatDataBuffer );
+	CleanupClosePushL(readAllStream);
+
+	TInt messageCount = readAllStream.ReadInt16L();
+
+	for( TInt i=0; i< messageCount; i++)
+		{
+		SIMCacheMessageData chatData =
+		    {
+		    TIMCacheMessageType(0),
+		    };
+		        
+		TInt size = readAllStream.ReadInt16L() ;
+		HBufC8* mBuffer  = HBufC8::NewLC( size );
+		TPtr8 mBufferPtr = mBuffer->Des();
+		        
+		readAllStream.ReadL( mBufferPtr , size );
+
+		readStream.Open( *mBuffer );        
+		CleanupClosePushL(readStream) ;
+
+		chatData.iMessageType   = static_cast<TIMCacheMessageType>( readStream.ReadInt16L() );
+		chatData.iMessagerType  = static_cast<TIMCacheMessagerType>( readStream.ReadInt16L() );
+		chatData.iContentType   = static_cast<TIMCacheContentType>( readStream.ReadInt16L() );
+		chatData.iTime          = static_cast<TReal64>( readStream.ReadReal64L() );
+
+		TInt buddyLength = readStream.ReadInt16L();
+		HBufC* buddy     = HBufC::NewLC( buddyLength );
+		TPtr buddyPtr    = buddy->Des();
+		readStream.ReadL( buddyPtr , buddyLength );
+		chatData.iBuddyId = buddy;
+
+		TInt textSize = readStream.ReadInt16L();
+		HBufC* text  = HBufC::NewLC( textSize );
+		TPtr textPtr = text->Des(); 
+		readStream.ReadL( textPtr , textSize);            
+		chatData.iText = text;
+		
+		iAccessHandler.HandleIMCacheEventL(EIMCacheUnreadMessage , &chatData);
+		
+		CleanupStack::PopAndDestroy(4);//close read stream, delete mBuffer, text, buddy 
+		}
+
+	aMore = static_cast<TBool>( readAllStream.ReadInt16L() );
+
+	CleanupStack::PopAndDestroy();//readAllStream.     
+    
+    TRACE( T_LIT("CIMCacheAccessEventHandler::InternalizeChatDataL() End") );
+    }
+  
+// -----------------------------------------------------------------------------
+// CIMCacheAccessEventHandler::GetBufferedChatItemL
+// -----------------------------------------------------------------------------
+//
+void CIMCacheAccessEventHandler::GetBufferedChatItemL( TIMCacheEventType aEventType )
+    {
+    TRACE( T_LIT("CIMCacheAccessEventHandler::GetBufferedChatItemL() begin") );
+    
+    TPtr8 bufferPtr = iRegistrar.GetBufferedDataL( EIMCacheGetBufferedPackets );
+    
+    InternalizeChatItemL( aEventType, bufferPtr );
+    
+    TRACE( T_LIT("CIMCacheAccessEventHandler::GetBufferedChatItemL() end") );
+    }
+// -----------------------------------------------------------------------------
+// CIMCacheAccessEventHandler::InternalizeChatItemL
+// -----------------------------------------------------------------------------
+//
+void CIMCacheAccessEventHandler::InternalizeChatItemL( TIMCacheEventType aEventType, 
+                                                 TPtr8 aContactBuffer )
+    {
+    TRACE( T_LIT("CIMCacheAccessEventHandler::InternalizeChatItemL() begin") );   
+    if( 0 == aContactBuffer.Length())
+           {
+           TRACE( T_LIT("CIMCacheAccessEventHandler::InternalizeChatItemL() aChatDataBuffer is zeor, hence returning ") );
+           return;
+           }
+    RDesReadStream readAllStream ;
+    RDesReadStream readStream ;    
+    
+    readAllStream.Open( aContactBuffer );
+    CleanupClosePushL(readAllStream);
+    
+    TInt messageCount = readAllStream.ReadInt16L();
+    
+    for( TInt i=0; i< messageCount; i++)
+        {
+        SIMCacheChatItem chatItem =
+          {
+          0,
+          };
+                
+        TInt size = readAllStream.ReadInt16L() ;
+        HBufC8* mBuffer  = HBufC8::NewLC( size );
+        TPtr8 mBufferPtr = mBuffer->Des();
+                
+        readAllStream.ReadL( mBufferPtr , size );
+        
+        readStream.Open( *mBuffer );        
+        CleanupClosePushL(readStream) ;
+        
+        chatItem.iServiceId  = static_cast<TInt>( readStream.ReadInt16L() );
+        
+        TInt textSize = readStream.ReadInt16L();
+        HBufC* buddyId = HBufC::NewLC( textSize );
+        TPtr buddyIdPtr = buddyId->Des(); 
+        readStream.ReadL( buddyIdPtr , textSize);
+        
+        chatItem.iBuddyId = buddyId;
+        
+        iAccessHandler.HandleIMCacheEventL( aEventType , &chatItem );
+      
+        CleanupStack::PopAndDestroy(3);//buddyId , close read stream, delete mBuffer.      
+                  
+        }
+    CleanupStack::PopAndDestroy();//readAllStream.    
+    TRACE( T_LIT("CIMCacheAccessEventHandler::InternalizeChatItemL() End") );
+    }
+
+ 
+//  end of file
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/instantmessagingcache/imcacheclient/src/cimcacheaccessor.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,248 @@
+/*
+* 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:  access right class implemetation
+*
+*/
+
+
+//  INCLUDE FILES
+#include "cimcacheaccessor.h"
+#include <imcachedefs.h>
+#include <s32mem.h>
+// logs
+#include "imcachedebugtrace.h"
+
+// -----------------------------------------------------------------------------
+// CIMCacheAccessor::NewL()
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CIMCacheAccessor* CIMCacheAccessor::NewL(TInt aServiceId,
+											const TDesC& aSenderId  )
+    {
+    TRACE( T_LIT("CIMCacheAccessor::NewL begin") );
+    CIMCacheAccessor* self = new ( ELeave ) CIMCacheAccessor( aServiceId ) ;
+    CleanupStack::PushL( self );
+    self->ConstructL( aSenderId );
+    CleanupStack::Pop( self );  //self
+    TRACE( T_LIT("CIMCacheAccessor::NewL end") );
+    return self;
+    }
+// -----------------------------------------------------------------------------
+// CIMCacheAccessor::ConstructL()
+// Symbian OS default constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CIMCacheAccessor::ConstructL( const TDesC& aSenderId  )
+    {
+    TRACE( T_LIT("CIMCacheAccessor::ConstructL begin") );
+    iUserId = aSenderId.AllocL();
+    User::LeaveIfError( iClient.Connect() );
+    iClient.StartTransactionL( EIMCacheInitAccess,
+    							iServiceId,
+    						    *iUserId
+								 );
+								 
+    TRACE( T_LIT("CIMCacheAccessor::ConstructL end") );
+    }
+// -----------------------------------------------------------------------------
+// CIMCacheAccessor::~CIMCacheAccessor()
+// Destructor
+// -----------------------------------------------------------------------------
+//
+CIMCacheAccessor::~CIMCacheAccessor()
+    {
+    TRACE( T_LIT("CIMCacheAccessor::~CIMCacheAccessor begin") );
+    delete iUserId;
+    //do not close the client session here. since there is also updater class which is closing the session
+    //moved this part of code which is common to both udpater and Accessor i.e, client ~CIMCacheClient()
+    //iClient.Close();    
+    TRACE( T_LIT("CIMCacheAccessor::~CIMCacheAccessor end") );
+    }
+// -----------------------------------------------------------------------------
+// CIMCacheAccessor::CIMCacheAccessor()
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CIMCacheAccessor::CIMCacheAccessor(TInt aServiceId )
+	:iServiceId( aServiceId )
+	{
+	TRACE( T_LIT("CIMCacheAccessor::CIMCacheAccessor ") );
+	}
+
+// -----------------------------------------------------------------------------
+// CIMCacheAccessor::ServiceId()
+// -----------------------------------------------------------------------------
+//
+TInt CIMCacheAccessor::ServiceId() const 
+	{
+	return iServiceId;	
+	}
+
+// -----------------------------------------------------------------------------
+// CIMCacheAccess::RegisterObserverL()
+// -----------------------------------------------------------------------------
+//
+void CIMCacheAccessor::RegisterObserverL( MIMCacheEventHandler& aObserver  )
+	{
+	TRACE( T_LIT("CIMCacheAccess::RegisterObserverL begin") );
+	// update case ETrue says CV is active
+	// cch need not to register
+	iClient.RegisterAccessObserverL( aObserver  );
+	TRACE( T_LIT("CIMCacheAccess::RegisterObserverL end") );
+	}
+
+// -----------------------------------------------------------------------------
+// CIMCacheAccess::UnRegisterObserverL()
+// -----------------------------------------------------------------------------
+//
+void CIMCacheAccessor::UnRegisterObserver( MIMCacheEventHandler& aObserver )
+	{
+	TRACE( T_LIT("CIMCacheAccess::UnRegisterObserverL begin") );
+	iClient.UnRegisterAccessObserver( aObserver );
+	TRACE( T_LIT("CIMCacheAccess::UnRegisterObserverL end") );
+	}
+// -----------------------------------------------------------------------------
+// CIMCacheAccess::GetUnreadMessageCountL()
+// -----------------------------------------------------------------------------
+//
+TInt CIMCacheAccessor::GetUnreadMessageCountL(const TDesC& aBuddyId)
+	{
+	TRACE( T_LIT("CIMCacheAccess::GetUnreadMessageCount") );
+	if( !aBuddyId.Length() )
+		{
+		User::Leave( KErrArgument )	;
+		}
+	return iClient.GetInformationL(EIMCacheGetUnreadCount, iServiceId,aBuddyId );
+	}
+//-----------------------------------------------------------------------------
+// CIMCacheAccessor::IsConversationExistL
+// ( Other items commented in header )
+//-----------------------------------------------------------------------------    
+TBool CIMCacheAccessor::IsConversationExistL( const TDesC& aBuddyId ) 
+	{
+	TRACE( T_LIT("CIMCacheAccess::IsConversationExistL Start ") );
+	if( !aBuddyId.Length() )
+		{
+		User::Leave( KErrArgument )	;
+		}
+	TBool ret = iClient.GetInformationL(EIMCacheIsConversationExist,iServiceId, aBuddyId );
+	TRACE( T_LIT("CIMCacheAccess::IsConversationExistL End ") );
+	return ret;  
+  	}
+  
+  // -----------------------------------------------------------------------------
+// CIMCacheAccess::GetAllUnreadMessageCountL()
+// -----------------------------------------------------------------------------
+//
+TInt CIMCacheAccessor::GetAllUnreadMessageCountL()
+	{
+	TRACE( T_LIT("CIMCacheAccess::GetAllUnreadMessageCountL") );
+	return iClient.GetInformationL( EIMCacheGetAllUnreadCount,iServiceId );
+	}	
+
+	
+// -----------------------------------------------------------------------------
+// CIMCacheAccessor::CloseConversationL()
+// -----------------------------------------------------------------------------
+//
+void CIMCacheAccessor::CloseConversationL( const TDesC& aBuddyId )
+    {
+    TRACE( T_LIT("CIMCacheAccessor::CloseConversationL begin") ); 
+    if( !aBuddyId.Length() )
+		{
+		User::Leave( KErrArgument )	;
+		}
+    iClient.StartTransactionL( EIMCacheCloseConversation,
+    						   iServiceId, 
+                               aBuddyId                               
+                                );
+    TRACE( T_LIT("CIMCacheAccessor::CloseConversationL end") );
+    }
+ 
+// -----------------------------------------------------------------------------
+// CIMCacheAccessor::GetChatListL()
+// -----------------------------------------------------------------------------
+//
+RArray<SIMCacheChatItem> CIMCacheAccessor::GetChatListL( const TInt aServiceId  )
+    {
+    TRACE( T_LIT("CIMCacheUpdater::GetChatListL") );    
+    RArray<SIMCacheChatItem> chatListArray;//array to hold chat item
+    TBool more = EFalse;
+    TPtr8 bufferPtr =  iClient.GetChatListL( aServiceId );
+    InternalizeChatListL( chatListArray, bufferPtr, more );
+    
+    while( more)
+        {
+        bufferPtr = iClient.GetBufferedDataL( EIMCacheGetBufferedPackets );
+        InternalizeChatListL( chatListArray, bufferPtr, more );
+        }
+    return chatListArray;
+    }
+    
+// -----------------------------------------------------------------------------
+// CIMCacheAccessor::InternalizeChatListL
+// -----------------------------------------------------------------------------
+//
+void CIMCacheAccessor::InternalizeChatListL(RArray<SIMCacheChatItem>& aChatArray, TPtr8 aChatListBuffer ,TBool& aMore )
+    {
+    TRACE( T_LIT("CIMCacheAccessor::InternalizeChatListL() begin") );   
+    
+    RDesReadStream readAllStream ;
+    RDesReadStream readStream ;    
+    
+    readAllStream.Open( aChatListBuffer );
+    CleanupClosePushL(readAllStream);
+    
+    TInt messageCount = readAllStream.ReadInt16L();
+    
+    for( TInt i=0; i< messageCount; i++)
+        {
+        SIMCacheChatItem chatItem =
+          {
+          0,
+          };
+                
+        TInt size = readAllStream.ReadInt16L() ;
+        HBufC8* mBuffer  = HBufC8::NewLC( size );
+        TPtr8 mBufferPtr = mBuffer->Des();
+                
+        readAllStream.ReadL( mBufferPtr , size );
+        
+        readStream.Open( *mBuffer );        
+        CleanupClosePushL(readStream) ;
+        
+        chatItem.iServiceId  = static_cast<TInt>( readStream.ReadInt16L() );
+        
+        TInt textSize = readStream.ReadInt16L();
+        HBufC* buddyId = HBufC::NewLC( textSize );
+        TPtr buddyIdPtr = buddyId->Des(); 
+        readStream.ReadL( buddyIdPtr , textSize);
+        
+        chatItem.iBuddyId = buddyId;
+        CleanupStack::Pop(buddyId); // ownership to structure variable
+        aChatArray.Insert(chatItem, 0);
+        CleanupStack::PopAndDestroy(2);//close read stream, delete mBuffer.      
+                   
+        }
+
+    aMore = static_cast<TBool>( readAllStream.ReadInt16L() );
+    CleanupStack::PopAndDestroy();//readAllStream.    
+    TRACE( T_LIT("CIMCacheAccessor::InternalizeChatListL() End") );
+    }
+ 
+//  END OF FILE
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/instantmessagingcache/imcacheclient/src/cimcacheclient.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,373 @@
+/*
+* 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:  client class implementation to connect to server
+*
+*/
+
+
+
+//  INCLUDE FILES
+#include "cimcacheclient.h"
+
+#include "imcacheprocessstarter.h"
+#include <imcachedefs.h>
+#include "mimcacheclient.h"
+// logs
+#include "imcachedebugtrace.h"
+#include "cimcacheeventhandler.h"
+
+#include "cimcacheaccesseventhandler.h"
+
+// ==============================================================
+// ======================== CLIENT ==============================
+// ==============================================================
+
+// Destructor
+CIMCacheClient::~CIMCacheClient()
+	{
+	TRACE( T_LIT("CIMCacheClient::~CIMCacheClient() begin") );
+	if( iUpdateObserver )
+		{
+		delete iUpdateObserver;
+		}
+	
+	if( iAccessObserver )
+		{
+		delete iAccessObserver;
+		}
+    if( iChatBuffer )
+        {
+        delete iChatBuffer;
+        }
+    //finally close the session.
+    RSessionBase::Close();
+	#if _BullseyeCoverage
+	cov_write();
+	#endif
+	TRACE( T_LIT("CIMCacheClient::~CIMCacheClient() end") );
+	}
+// -----------------------------------------------------------------------------
+// CIMCacheClient::CIMCacheClient()
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CIMCacheClient::CIMCacheClient( )
+	{
+    TRACE( T_LIT("CIMCacheClient::CIMCacheClient()") );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CIMCacheClient::Connect()
+// -----------------------------------------------------------------------------
+//
+TInt CIMCacheClient::Connect()
+    {
+    TRACE( T_LIT("CIMCacheClient::Connect() begin") );
+    TFileName fullExePath;
+    IMCacheProcessStarter::FullExePathForClientLocation( EIMCacheServerExe,
+                                                 fullExePath );
+
+	TRACE( T_LIT("CIMCacheClient::Connect() end") );
+    return IMCacheProcessStarter::ConnectToServer( fullExePath,
+                                            KNullDesC,
+                                            *this,
+                                            KIMCacheServerName,
+                                            TVersion( KIMCacheVersionMajor,
+                                                      KIMCacheVersionMinor,
+                                                      KIMCacheVersionBuild ),
+                                            KIMCacheMsgSlotCount );
+    
+    }
+
+// -----------------------------------------------------------------------------
+// CIMCacheClient::RegisterObserverL()
+// -----------------------------------------------------------------------------
+//
+void CIMCacheClient::RegisterUpdateObserverL( MIMCacheEventHandler& aObserver )
+	{
+	TRACE( T_LIT("CIMCacheClient::RegisterUpdateObserverL() begin") );
+
+	CIMCacheEventHandler* tempObserver = CIMCacheEventHandler::NewL(  *this , aObserver );
+
+	if( iUpdateObserver )
+		{
+		delete iUpdateObserver;
+		iUpdateObserver = NULL;
+		}
+
+	iUpdateObserver = tempObserver;
+	TRACE( T_LIT("CIMCacheClient::RegisterUpdateObserverL() end") );
+	}
+
+// -----------------------------------------------------------------------------
+// CIMCacheClient::UnRegisterUpdateObserver()
+// -----------------------------------------------------------------------------
+//
+void CIMCacheClient::UnRegisterUpdateObserver( MIMCacheEventHandler& /*aObserver*/)
+	{
+	TRACE( T_LIT("CIMCacheClient::UnRegisterUpdateObserver() begin") );
+	
+	iUpdateObserver->UnRegisterObserver();
+
+    TRACE( T_LIT("CIMCacheClient::UnRegisterUpdateObserver() end") );
+	}
+
+// -----------------------------------------------------------------------------
+// CIMCacheClient::RegisterAccessObserverL()
+// -----------------------------------------------------------------------------
+//
+void CIMCacheClient::RegisterAccessObserverL( MIMCacheEventHandler& aObserver )
+	{
+	TRACE( T_LIT("CIMCacheClient::RegisterUpdateObserverL() begin") );
+
+	CIMCacheAccessEventHandler* tempObserver = CIMCacheAccessEventHandler::NewL(  *this , aObserver );
+
+	if( iAccessObserver )
+		{
+		delete iAccessObserver;
+		iAccessObserver = NULL;
+		}
+
+	iAccessObserver = tempObserver;
+	TRACE( T_LIT("CIMCacheClient::RegisterUpdateObserverL() end") );
+	}
+
+// -----------------------------------------------------------------------------
+// CIMCacheClient::UnRegisterAccessObserver()
+// -----------------------------------------------------------------------------
+//
+void CIMCacheClient::UnRegisterAccessObserver( MIMCacheEventHandler& /*aObserver*/)
+	{
+	TRACE( T_LIT("CIMCacheClient::UnRegisterUpdateObserver() begin") );
+	
+	iAccessObserver->UnRegisterObserver();
+
+    TRACE( T_LIT("CIMCacheClient::UnRegisterUpdateObserver() end") );
+	}
+// -----------------------------------------------------------------------------
+// CIMCacheClient::RegisterObserverToServerL()
+// -----------------------------------------------------------------------------
+//
+void CIMCacheClient::RegisterObserverToServerL( TRequestStatus& aStatus , EIMCacheOperations aRight)
+	{
+	TRACE( T_LIT("CIMCacheClient::RegisterObserverToServerL() begin") );
+	TIpcArgs args;
+	SendReceive( aRight, args, aStatus );
+	TRACE( T_LIT("CIMCacheClient::RegisterObserverToServerL() end") );
+	}
+
+// -----------------------------------------------------------------------------
+// CIMCacheClient::UnRegisterObserverToServerL()
+// -----------------------------------------------------------------------------
+//
+void CIMCacheClient::UnRegisterObserverToServerL( TRequestStatus& aStatus, EIMCacheOperations aRight)
+	{
+	TRACE( T_LIT("CIMCacheClient::UnRegisterObserverToServerL() begin") );
+	TIpcArgs args;
+	TInt err = SendReceive( aRight, args );
+	User::LeaveIfError( err );
+	TRACE( T_LIT("CIMCacheClient::UnRegisterObserverToServerL() end") );
+	}
+// -----------------------------------------------------------------------------
+// CIMCacheClient::CancelRequestL()
+// -----------------------------------------------------------------------------
+//
+void CIMCacheClient::CancelRequestL( TRequestStatus& aStatus, EIMCacheOperations aRight)
+    {
+    TRACE( T_LIT("CIMCacheClient::CancelRequestL() begin") );
+    TIpcArgs args;
+    TInt err = SendReceive( aRight, args );
+    User::LeaveIfError( err );
+    TRACE( T_LIT("CIMCacheClient::CancelRequestL() end") );
+    }
+// -----------------------------------------------------------------------------
+// CIMCacheClient::StartTransactionL()
+// -----------------------------------------------------------------------------
+//
+void CIMCacheClient::StartTransactionL( EIMCacheOperations aOperationType,
+									   TInt aServiceId ,
+									   const TDesC& aText
+									   )
+	{
+	TRACE( T_LIT("CIMCacheClient::StartTransactionL() begin") );
+	TIpcArgs args = CreateArgumentsL( aServiceId, aText );
+ 	TInt err = SendReceive( aOperationType, args );
+    User::LeaveIfError( err );
+    TRACE( T_LIT("CIMCacheClient::StartTransactionL() end") );
+	}
+
+
+// -----------------------------------------------------------------------------
+// CIMCacheClient::StartTransactionL()
+// -----------------------------------------------------------------------------
+//
+void CIMCacheClient::StartTransactionL(EIMCacheOperations aOperationType,
+										const TDesC& aText
+									   )
+	{
+	TRACE( T_LIT("CIMCacheClient::StartTransactionL() begin") );
+	TIpcArgs args;
+    args.Set( 0,  &aText );
+   	TInt err = SendReceive( aOperationType, args );
+    User::LeaveIfError( err );
+    TRACE( T_LIT("CIMCacheClient::StartTransactionL() end") );
+	}
+// -----------------------------------------------------------------------------
+// CIMCacheClient::StartTransactionL()
+// -----------------------------------------------------------------------------
+//
+void CIMCacheClient::StartTransactionL(	EIMCacheOperations aOperationType,
+										TInt aServiceId,
+										const TDesC& aText1 ,
+										const TDesC& aText2 
+									   	)
+	{
+	TRACE( T_LIT("CIMCacheClient::StartTransactionL() begin") );
+	TIpcArgs args = CreateArgumentsL(aServiceId, aText1, aText2 );
+ 	TInt err = SendReceive( aOperationType, args );
+    User::LeaveIfError( err );
+    TRACE( T_LIT("CIMCacheClient::StartTransactionL() end") );
+	}
+	
+// -----------------------------------------------------------------------------
+// CIMCacheClient::StopTransactionL()
+// -----------------------------------------------------------------------------
+//
+TInt CIMCacheClient::StartTransactionL(EIMCacheOperations aOperationType )
+	{
+	TRACE( T_LIT("CIMCacheClient::StopTransactionL() begin") );
+	TRACE( T_LIT(" aOperationType = %d  "),aOperationType );
+	TInt err = SendReceive( aOperationType );
+    TRACE( T_LIT("CIMCacheClient::StopTransactionL() end") );
+	return err;
+	}
+
+// -----------------------------------------------------------------------------
+// CIMCacheClient::CreateArgumentsL()
+// -----------------------------------------------------------------------------
+//
+TIpcArgs CIMCacheClient::CreateArgumentsL( TInt aServiceId ,
+									   const TDesC& aText  )
+	{
+	TRACE( T_LIT("CIMCacheClient::CreateArgumentsL() begin") );
+	// set the arguments for the message
+	TIpcArgs args;
+    args.Set( 0,  aServiceId );
+    args.Set( 1,  &aText );
+    TRACE( T_LIT("CIMCacheClient::CreateArgumentsL() end") );
+    return args;
+	}
+
+ // -----------------------------------------------------------------------------
+// CIMCacheClient::CreateArgumentsL()
+// -----------------------------------------------------------------------------
+//
+TIpcArgs CIMCacheClient::CreateArgumentsL(TInt aServiceId, 
+										const TDesC& aText1  ,
+									   const TDesC& aText2  )
+	{
+	TRACE( T_LIT("CIMCacheClient::CreateArgumentsL() begin") );
+	// set the arguments for the message
+	TIpcArgs args(aServiceId);
+    args.Set( 1,  &aText1 );
+    args.Set( 2,  &aText2 );
+    TRACE( T_LIT("CIMCacheClient::CreateArgumentsL() end") );
+    return args;
+	}
+
+
+// -----------------------------------------------------------------------------
+// CIMCacheClient::GetInformationL()
+// -----------------------------------------------------------------------------
+//
+TInt CIMCacheClient::GetInformationL(EIMCacheOperations aOperationType, TInt aServiceId,const TDesC& aBuddyId )
+	{
+	TRACE( T_LIT("CIMCacheClient::GetInformationL start") );
+	TInt returnValue = 0;
+	TIpcArgs args(aServiceId);
+	args.Set( 1,  &aBuddyId );
+    TPckg<TInt> pack( returnValue );
+    args.Set(2, &pack );
+    TInt err = SendReceive( aOperationType, args );
+    User::LeaveIfError( err );
+    TRACE( T_LIT("CIMCacheClient::GetInformationL() end") );
+	return returnValue;
+	}
+
+ // -----------------------------------------------------------------------------
+// CIMCacheClient::GetCountL()
+// -----------------------------------------------------------------------------
+//
+TInt CIMCacheClient::GetInformationL(EIMCacheOperations aOperationType, TInt aServiceId )
+	{
+	TRACE( T_LIT("CIMCacheClient::GetInformationL") );
+	TInt returnValue = 0;
+	TIpcArgs args(aServiceId);
+        
+    TPckg<TInt> pack( returnValue );
+    args.Set(1, &pack );
+    TInt err = SendReceive( aOperationType, args );
+    User::LeaveIfError( err );
+    TRACE( T_LIT("CIMCacheClient::GetInformationL() end") );
+	return returnValue;
+	}	
+// -----------------------------------------------------------------------------
+// CIMCacheClient::GetContactBufferL()
+// -----------------------------------------------------------------------------
+//
+TPtr8 CIMCacheClient::GetBufferedDataL(EIMCacheOperations aOperationType )
+    {
+    TRACE( T_LIT("CIMCacheClient::GetContactBufferL() begin") );
+    
+    if(!iChatBuffer)//if not allocated allocate.
+        {
+        iChatBuffer = HBufC8::NewL(KMaxSize);
+        }
+    TPtr8 chatBufferPtr = iChatBuffer->Des();
+    TIpcArgs msgArgs;
+    msgArgs.Set( 0, &chatBufferPtr );
+    
+    TInt err = SendReceive( aOperationType, msgArgs );
+    User::LeaveIfError( err );
+  
+    TRACE( T_LIT("CIMCacheClient::GetContactBufferL() end") );
+    
+    return iChatBuffer->Des();
+    }
+    
+// -----------------------------------------------------------------------------
+// CIMCacheClient::GetChatListL()
+// -----------------------------------------------------------------------------    
+TPtr8 CIMCacheClient::GetChatListL( const TInt& aServiceId /*= -1*/ )
+    {
+    
+    if(!iChatBuffer)//if not allocated allocate.
+        {
+        iChatBuffer = HBufC8::NewL(KMaxSize);
+        }
+    TPtr8 ptr = iChatBuffer->Des();
+     
+    TIpcArgs msgArgs( aServiceId );//at 0.
+    msgArgs.Set( 1, &ptr  );
+    
+    TInt err = SendReceive( EIMCacheGetChatList, msgArgs );
+    User::LeaveIfError( err );
+  
+  	return iChatBuffer->Des();
+    }
+    
+// end of file
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/instantmessagingcache/imcacheclient/src/cimcacheeventhandler.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,360 @@
+/*
+* 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:  cache message change observer
+*
+*/
+
+
+//  INCLUDE FILES
+
+#include "cimcacheeventhandler.h"
+#include "mimcacheclient.h"
+#include "mimcacheeventhandler.h"
+// logs
+#include "imcachedebugtrace.h"
+
+// -----------------------------------------------------------------------------
+// CIMCacheEventHandler::NewL
+// -----------------------------------------------------------------------------
+//
+CIMCacheEventHandler* CIMCacheEventHandler::NewL( 
+								MIMCacheClient& aRegistrar, 
+								MIMCacheEventHandler& aHandler)
+    {
+    TRACE( T_LIT("CIMCacheEventHandler::NewL() begin") );
+	CIMCacheEventHandler* self = new ( ELeave ) CIMCacheEventHandler( aRegistrar ,aHandler ) ;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );  //self
+	TRACE( T_LIT("CIMCacheEventHandler::NewL() end") );
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CIMCacheEventHandler::ConstructL
+// -----------------------------------------------------------------------------
+//
+void CIMCacheEventHandler::ConstructL()
+    {
+    TRACE( T_LIT("CIMCacheEventHandler::ConstructL() begin") );
+    iContinueObserving = ETrue ;
+   	CActiveScheduler::Add( this );
+	iRegistrar.RegisterObserverToServerL( iStatus ,EIMCacheObserveMessageUpdateRegister );
+	SetActive();
+	TRACE( T_LIT("CIMCacheEventHandler::ConstructL() end") );
+    }
+
+// -----------------------------------------------------------------------------
+// CIMCacheEventHandler::~CIMCacheEventHandler
+// -----------------------------------------------------------------------------
+//
+CIMCacheEventHandler::~CIMCacheEventHandler()
+	{
+	TRACE( T_LIT("CIMCacheEventHandler::~CIMCacheEventHandler() begin") );
+	Cancel();
+	TRACE( T_LIT("CIMCacheEventHandler::~CIMCacheEventHandler() end") );
+	}
+
+// -----------------------------------------------------------------------------
+// CIMCacheEventHandler::CIMCacheEventHandler(
+// -----------------------------------------------------------------------------
+//
+CIMCacheEventHandler::CIMCacheEventHandler(
+								 MIMCacheClient& aRegistrar , 
+								 MIMCacheEventHandler& aHandler ) :
+	CActive( CActive::EPriorityIdle ),
+  	iRegistrar( aRegistrar ),
+  	iUpdateHandler( aHandler )
+ 	{
+ 	TRACE( T_LIT("CIMCacheEventHandler::CIMCacheEventHandler()") );
+	}
+// -----------------------------------------------------------------------------
+// CIMCacheEventHandler::RunL
+// -----------------------------------------------------------------------------
+//
+void CIMCacheEventHandler::RunL()
+	{
+	TRACE( T_LIT("CIMCacheEventHandler::RunL() begin") );
+	TRACE( T_LIT("CIMCacheEventHandler::RunL() iStatus code = "),iStatus.Int()  );
+
+	switch( iStatus.Int() )
+		{
+		case EIMOperationUnreadMessage :
+		case EIMOperationDataAvailable :
+		case EIMOperationMessageAdded :
+			{
+			// message data available get the data	
+            GetBufferChatDataL();
+			break;	
+			}
+	   case EIMOperationCompleted :
+	   		{
+	   		iUpdateHandler.HandleIMCacheEventL( EIMCacheRequestCompleted, NULL );	
+	   		}
+	    case EIMOperationChatStarted :
+		    {
+		    iUpdateHandler.HandleIMCacheEventL( EIMCacheRequestCompleted, NULL );
+		    break;	
+		    }
+		case EIMOperationUnreadChange:
+			{
+			iUpdateHandler.HandleIMCacheEventL( EIMCacheRequestCompleted, NULL );
+			break;	
+			}
+		case EIMOperationChatAdded :
+			{
+			// chat information
+		    GetBufferedChatItemL(EIMCacheNewChat);
+			break;	
+			}
+		case EIMOperationChatDeleted :
+			{
+			// message data available get the data	
+            GetBufferedChatItemL(EIMCacheChatClosed );		
+			break;	
+			}
+		 case EIMOperationAllChatDeleted:
+		     {
+		     iUpdateHandler.HandleIMCacheEventL( EIMCacheAllChatClosed, NULL );
+		     break;
+		     }
+		case EIMOperationUnRegistered:
+			{
+			TRACE( T_LIT("CIMCacheEventHandler::RunL() EIMOperationUnRegistered") );
+			iContinueObserving = EFalse;	
+			break;	
+			}
+		case KErrServerTerminated:
+            {
+            // This case handles when the server terminated status is set.
+            // This is scenario is typically scene when imcache server is uninstalled.
+
+            UnRegisterObserver();
+            DoCancel();
+            break;
+            }
+
+		default :
+		    {
+		    TRACE( T_LIT("CIMCacheEventHandler::RunL() default") );
+		    break;	
+		    }
+		}	
+		
+	// Comment: cancel operation is changes as synchronous. iContinueObserving from event
+	// can not really be trusted since complete code might be different if leave has occured 
+	// for example. Cancel is handled here as generic cancel.
+	TRACE( T_LIT("CIMCacheEventHandler::RunL() iContinueObserving iContinueObserving = %d") ,iContinueObserving);
+	// check need to continue observing to server
+	if( iContinueObserving && KErrCancel != iStatus.Int() )
+		{
+		iRegistrar.RegisterObserverToServerL( iStatus ,EIMCacheObserveMessageUpdateRegister );
+		SetActive();
+		}
+	TRACE( T_LIT("CIMCacheEventHandler::RunL() end") );
+	}
+// -----------------------------------------------------------------------------
+// CIMCacheEventHandler::DoCancel
+// -----------------------------------------------------------------------------
+//	
+void CIMCacheEventHandler::DoCancel()
+	{
+	TRACE( T_LIT("CIMCacheEventHandler::DoCancel() ") );
+	// Comment: set to EFalse here since we can not trust other changes. See
+	// comments in RunL
+	iContinueObserving = EFalse;
+	if( IsActive() )
+        {
+        TRAP_IGNORE(iRegistrar.CancelRequestL( iStatus ,EIMCacheCancelRequest ));
+        }
+	}
+// ---------------------------------------------------------
+// CIMCacheEventHandler::RunError()
+// ---------------------------------------------------------
+//
+TInt CIMCacheEventHandler::RunError( TInt /* aError */)
+    {
+    TRACE( T_LIT("CVIMPSTEngineCVListener::RunError() start"));
+    return KErrNone;
+    }
+// -----------------------------------------------------------------------------
+// CIMCacheEventHandler::UnRegisterObserver
+// -----------------------------------------------------------------------------
+//		
+void CIMCacheEventHandler::UnRegisterObserver()
+	{
+	TRACE( T_LIT("CIMCacheEventHandler::UnRegisterObserver() begin") );
+	if( IsActive() )
+		{
+		TRACE( T_LIT("CIMCacheEventHandler::UnRegisterObserver() active") );
+		TRAP_IGNORE(iRegistrar.UnRegisterObserverToServerL( iStatus ,EIMCacheObserveMessageUpdateUnRegister ));
+		}
+	TRACE( T_LIT("CIMCacheEventHandler::UnRegisterObserver() end") );	
+	}
+// -----------------------------------------------------------------------------
+// CIMCacheEventHandler::GetBufferChatDataL
+// -----------------------------------------------------------------------------
+//
+void CIMCacheEventHandler::GetBufferChatDataL( ) 
+    {
+    TRACE( T_LIT("CIMCacheEventHandler::GetBufferChatDataL() begin") );
+	TBool more = ETrue;
+    while(more)
+        {
+        TPtr8 bufferPtr = iRegistrar.GetBufferedDataL( EIMCacheGetBufferedPackets );
+        InternalizeChatDataL( bufferPtr , more );
+        }
+    TRACE( T_LIT("CIMCacheEventHandler::GetBufferChatDataL() end") );
+    }
+// -----------------------------------------------------------------------------
+// CIMCacheEventHandler::InternalizeChatDataL
+// -----------------------------------------------------------------------------     
+void CIMCacheEventHandler::InternalizeChatDataL( TPtr8 aChatDataBuffer , TBool& aMore )
+    {
+    TRACE( T_LIT("CIMCacheEventHandler::InternalizeChatDataL() Start") );
+    if( 0 == aChatDataBuffer.Length())
+        {
+        TRACE( T_LIT("CIMCacheEventHandler::InternalizeChatDataL()  aChatDataBuffer is zeor, hence returning ") );
+        return;
+        }
+   	RDesReadStream readAllStream ;
+	RDesReadStream readStream ;    
+
+	readAllStream.Open( aChatDataBuffer );
+	CleanupClosePushL(readAllStream);
+
+	TInt messageCount = readAllStream.ReadInt16L();
+
+	for( TInt i=0; i< messageCount; i++)
+		{
+		SIMCacheMessageData chatData =
+		    {
+		    TIMCacheMessageType(0),
+		    };
+		        
+		TInt size = readAllStream.ReadInt16L() ;
+		HBufC8* mBuffer  = HBufC8::NewLC( size );
+		TPtr8 mBufferPtr = mBuffer->Des();
+		        
+		readAllStream.ReadL( mBufferPtr , size );
+
+		readStream.Open( *mBuffer );        
+		CleanupClosePushL(readStream) ;
+
+		chatData.iMessageType   = static_cast<TIMCacheMessageType>( readStream.ReadInt16L() );
+		chatData.iMessagerType  = static_cast<TIMCacheMessagerType>( readStream.ReadInt16L() );
+		chatData.iContentType   = static_cast<TIMCacheContentType>( readStream.ReadInt16L() );
+		chatData.iTime          = static_cast<TReal64>( readStream.ReadReal64L() );
+
+		TInt buddyLength = readStream.ReadInt16L();
+		HBufC* buddy     = HBufC::NewLC( buddyLength );
+		TPtr buddyPtr    = buddy->Des();
+		readStream.ReadL( buddyPtr , buddyLength );
+		chatData.iBuddyId = buddy;
+
+		TInt textSize = readStream.ReadInt16L();
+		HBufC* text  = HBufC::NewLC( textSize );
+		TPtr textPtr = text->Des(); 
+		readStream.ReadL( textPtr , textSize);            
+		chatData.iText = text;
+		
+		iUpdateHandler.HandleIMCacheEventL(EIMCacheNewMessage , &chatData);
+		
+		CleanupStack::PopAndDestroy(4);//close read stream, delete mBuffer, text, buddy 
+		}
+
+	aMore = static_cast<TBool>( readAllStream.ReadInt16L() );
+
+	CleanupStack::PopAndDestroy();//readAllStream.    
+	
+    TRACE( T_LIT("CIMCacheEventHandler::InternalizeChatDataL() End") );
+    }
+
+// -----------------------------------------------------------------------------
+// CIMCacheEventHandler::GetBufferedChatItemL
+// -----------------------------------------------------------------------------
+//
+void CIMCacheEventHandler::GetBufferedChatItemL( TIMCacheEventType aEventType )
+    {
+    TRACE( T_LIT("CIMCacheAccessEventHandler::GetBufferedChatItemL() begin") );
+    
+    TPtr8 bufferPtr = iRegistrar.GetBufferedDataL( EIMCacheGetBufferedPackets );
+    
+    InternalizeChatItemL( aEventType, bufferPtr );
+    
+    TRACE( T_LIT("CIMCacheAccessEventHandler::GetBufferedChatItemL() end") );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CIMCacheEventHandler::InternalizeChatItemL
+// -----------------------------------------------------------------------------
+//
+void CIMCacheEventHandler::InternalizeChatItemL( TIMCacheEventType aEventType, 
+                                                 TPtr8 aContactBuffer )
+    {
+    TRACE( T_LIT("CIMCacheClient::InternalizeChatItemL() begin") );   
+    if( 0 == aContactBuffer.Length())
+          {
+          TRACE( T_LIT("CIMCacheEventHandler::InternalizeChatDataL()  aChatDataBuffer is zeor, hence returning ") );
+          return;
+          }
+    RDesReadStream readAllStream ;
+    RDesReadStream readStream ;    
+    
+    readAllStream.Open( aContactBuffer );
+    CleanupClosePushL(readAllStream);
+    
+    TInt messageCount = readAllStream.ReadInt16L();
+    
+    for( TInt i=0; i< messageCount; i++)
+        {
+        SIMCacheChatItem chatItem =
+          {
+          0,
+          };
+                
+        TInt size = readAllStream.ReadInt16L() ;
+        HBufC8* mBuffer  = HBufC8::NewLC( size );
+        TPtr8 mBufferPtr = mBuffer->Des();
+                
+        readAllStream.ReadL( mBufferPtr , size );
+        
+        readStream.Open( *mBuffer );        
+        CleanupClosePushL(readStream) ;
+        
+        chatItem.iServiceId  = static_cast<TInt>( readStream.ReadInt16L() );
+        
+        TInt textSize = readStream.ReadInt16L();
+        HBufC* buddyId = HBufC::NewLC( textSize );
+        TPtr buddyIdPtr = buddyId->Des(); 
+        readStream.ReadL( buddyIdPtr , textSize);
+        
+        chatItem.iBuddyId = buddyId;
+        
+        iUpdateHandler.HandleIMCacheEventL( aEventType , &chatItem );
+      
+        CleanupStack::PopAndDestroy(3);//buddyId , close read stream, delete mBuffer.      
+                  
+        }
+ 
+    CleanupStack::PopAndDestroy();//readAllStream.    
+    
+    TRACE( T_LIT("CIMCacheClient::InternalizeChatItemL() End") );
+    }
+
+
+
+//  end of file
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/instantmessagingcache/imcacheclient/src/cimcachefactory.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,205 @@
+/*
+* 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:  factory class to create access and updateer class implementation
+*
+*/
+
+
+
+// INCLUDE FILES
+#include    "cimcachefactory.h"
+
+#include	"cimcacheupdater.h"
+#include	"mimcacheupdater.h"
+#include	"cimcacheaccessor.h"
+#include	"mimcacheaccessor.h"
+#include	"cimcacheclient.h"
+// logs
+#include    "imcachedebugtrace.h"
+
+// ============================ MEMBER FUNCTIONS ===============================
+ // -----------------------------------------------------------------------------
+// CIMCacheFactory::Instance
+//see whether there is an instance in the TLS
+//if not create the instance and set the same in TLS
+// -----------------------------------------------------------------------------
+//
+ EXPORT_C CIMCacheFactory* CIMCacheFactory::InstanceL()
+    {
+     TRACE( T_LIT("CIMCacheFactory::InstanceL begin") );
+     CIMCacheFactory *factory = static_cast<CIMCacheFactory*>( Dll::Tls() );
+    
+     if ( ! factory )
+        {
+        // no existing instance, create a new one
+        factory = CIMCacheFactory::NewL();
+        CleanupStack::PushL( factory );
+        User::LeaveIfError( Dll::SetTls( static_cast<TAny*>( factory ) ) );
+        CleanupStack::Pop( factory );
+        }
+     TRACE( T_LIT("CIMCacheFactory::InstanceL end") );
+     factory->IncrementReference();
+     return factory;
+    }    
+ // -----------------------------------------------------------------------------
+// CIMCacheFactory::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CIMCacheFactory* CIMCacheFactory::NewL()
+	{
+    TRACE( T_LIT("CIMCacheFactory::NewL begin") );
+    CIMCacheFactory* self = new ( ELeave ) CIMCacheFactory() ;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );  //self
+    TRACE( T_LIT("CIMCacheFactory::NewL end") );
+    return self;
+	}
+
+// -----------------------------------------------------------------------------
+// CIMCacheFactory::Release()
+// -----------------------------------------------------------------------------
+// 	       
+EXPORT_C void CIMCacheFactory::Release()
+    {
+    TRACE( T_LIT("CIMCacheFactory::Release start") );
+    //if any instance in TLS get the same and delete it    
+    CIMCacheFactory *factory = static_cast<CIMCacheFactory*>( Dll::Tls() );
+    if ( factory &&  !(factory->DecrementReference()))
+    if ( factory )
+        {
+        delete factory;
+        Dll::SetTls( NULL );
+        }
+    TRACE( T_LIT("CIMCacheFactory::Release end") );
+    }
+// -----------------------------------------------------------------------------
+// CIMCacheFactory::IncrementReference()
+// -----------------------------------------------------------------------------
+//
+void CIMCacheFactory::IncrementReference()
+    {
+    TRACE( T_LIT("CIMCacheFactory::IncrementReference ") );
+    iReferenceCount++;   
+    }
+
+// -----------------------------------------------------------------------------
+// CPresenceCacheServer::DecrementReference()
+// -----------------------------------------------------------------------------
+//
+TInt CIMCacheFactory::DecrementReference()
+    {
+    TRACE( T_LIT("CIMCacheFactory::DecrementReference ") );
+    iReferenceCount--; 
+    return iReferenceCount;    
+    }
+    
+// -----------------------------------------------------------------------------
+// CIMCacheFactory::CIMCacheFactory()
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+// 
+CIMCacheFactory::CIMCacheFactory()
+	{
+	}
+
+// -----------------------------------------------------------------------------
+// CIMCacheFactory::~CIMCacheFactory()
+// Symbian OS desstructor 
+// -----------------------------------------------------------------------------
+//
+CIMCacheFactory::~CIMCacheFactory()
+	{
+	TRACE( T_LIT("CIMCacheFactory::~CIMCacheFactory start") );
+	iUpdaterArray.ResetAndDestroy();
+	iAccessorArray.ResetAndDestroy();
+	delete iServerKeepAlive;
+	TRACE( T_LIT("CIMCacheFactory::~CIMCacheFactory end") );
+	}
+// -----------------------------------------------------------------------------
+// CIMCacheFactory::ConstructL()
+// Symbian OS default constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CIMCacheFactory::ConstructL( )
+	{
+	TRACE( T_LIT("CIMCacheFactory::ConstructL start") );
+	iServerKeepAlive = new(ELeave) CIMCacheClient(); // CSI: 74 # this needs to be like this
+	TRACE( T_LIT("CIMCacheFactory::ConstructL end") );
+	}
+
+// -----------------------------------------------------------------------------
+// CIMCacheFactory::CreateUpdaterL()
+// -----------------------------------------------------------------------------
+//
+EXPORT_C MIMCacheUpdater* CIMCacheFactory::CreateUpdaterL(TInt aServiceId,
+															const TDesC& aUserId ,
+															TBool aRegistrationNeeded )
+    {
+    TRACE( T_LIT("CIMCacheFactory::CreateAccessL begin") );
+    
+    CIMCacheUpdater* updater = NULL;
+
+	TInt count = iUpdaterArray.Count();
+	for( TInt i = 0; i < count; ++i )
+		{
+		if( iUpdaterArray[i]->ServiceId() == aServiceId )
+			{
+			updater = iUpdaterArray[i];
+			break;
+			}
+		}
+	if( !updater ) 
+		{
+		updater = CIMCacheUpdater::NewL( aServiceId, aUserId, aRegistrationNeeded );
+		iUpdaterArray.Append(updater);
+		}
+		
+    TRACE( T_LIT("CIMCacheFactory::CreateAccessL end") );
+    return updater;
+    }
+
+// -----------------------------------------------------------------------------
+// CIMCacheFactory::CreateAccessorL()
+// -----------------------------------------------------------------------------
+//
+EXPORT_C MIMCacheAccessor* CIMCacheFactory::CreateAccessorL(TInt aServiceId,
+															const TDesC& aUserId  )
+    {
+    TRACE( T_LIT("CIMCacheFactory::CreateAccessL begin") );
+    
+    CIMCacheAccessor* accessor = NULL;
+
+	TInt count = iAccessorArray.Count();
+	for( TInt i = 0; i < count; ++i )
+		{
+		if( iAccessorArray[i]->ServiceId() == aServiceId )
+			{
+			accessor = iAccessorArray[i];
+			break;
+			}
+		}
+	if( !accessor ) 
+		{
+		accessor = CIMCacheAccessor::NewL( aServiceId, aUserId );
+		iAccessorArray.Append(accessor);
+		}
+		
+    TRACE( T_LIT("CIMCacheFactory::CreateAccessL end") );
+    return accessor;
+    }
+//  End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/instantmessagingcache/imcacheclient/src/cimcacheupdater.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,318 @@
+/*
+* 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:  write right class implemetation
+*
+*/
+
+//  INCLUDE FILES
+#include "cimcacheupdater.h"
+
+#include <imcachedefs.h>
+// logs
+#include "imcachedebugtrace.h"
+
+#include <e32base.h>
+#include <s32mem.h>
+
+//Received message maximum length is 400 character if received message is 
+//longer than 400 character truncate it to 400 character
+//This must always be in sync with imcvuiapp KReceiveMsgMaxLength
+const TInt KReceiveMsgMaxLength = 400; 
+_LIT(KPercentage, "%");
+// -----------------------------------------------------------------------------
+// CIMCacheUpdater::NewL()
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CIMCacheUpdater* CIMCacheUpdater::NewL(TInt aServiceId,
+											const TDesC& aSenderId ,TBool aRegistrationNeeded )
+    {
+    TRACE( T_LIT("CIMCacheUpdater::NewL begin") );
+    CIMCacheUpdater* self = new ( ELeave ) CIMCacheUpdater( aServiceId ) ;
+    CleanupStack::PushL( self );
+    self->ConstructL( aSenderId, aRegistrationNeeded );
+    CleanupStack::Pop( self );  //self
+    TRACE( T_LIT("CIMCacheUpdater::NewL end") );
+    return self;
+    }
+// -----------------------------------------------------------------------------
+// CIMCacheUpdater::ConstructL()
+// Symbian OS default constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CIMCacheUpdater::ConstructL( const TDesC& aSenderId ,TBool aRegistrationNeeded )
+    {
+    TRACE( T_LIT("CIMCacheUpdater::ConstructL begin") );
+    iUserId = aSenderId.AllocL();
+    User::LeaveIfError( iClient.Connect() );
+    EIMCacheOperations opration = EIMCacheInitUpdate;
+    if( aRegistrationNeeded )
+	    {
+	    opration = EIMCacheInitConvesation;	
+	    }
+    iClient.StartTransactionL(opration, iServiceId, *iUserId );
+	TRACE( T_LIT("CIMCacheUpdater::ConstructL end") );
+    }
+// -----------------------------------------------------------------------------
+// CIMCacheUpdater::~CIMCacheUpdater()
+// Destructor
+// -----------------------------------------------------------------------------
+//
+CIMCacheUpdater::~CIMCacheUpdater()
+    {
+    TRACE( T_LIT("CIMCacheUpdater::~CIMCacheUpdater begin") );
+    delete iUserId;
+    //do not close the client session here. since there is also accessor class which is closing the session
+    //moved this part of code which is common to both udpater and Accessor i.e, client ~CIMCacheClient()
+    //iClient.Close();
+    TRACE( T_LIT("CIMCacheUpdater::~CIMCacheUpdater end") );
+    }
+// -----------------------------------------------------------------------------
+// CIMCacheUpdater::CIMCacheUpdater()
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CIMCacheUpdater::CIMCacheUpdater(TInt aServiceId )
+	:iServiceId( aServiceId )
+	{
+	TRACE( T_LIT("CIMCacheUpdater::CIMCacheUpdater ") );
+	}
+
+
+// -----------------------------------------------------------------------------
+// CIMCacheUpdater::StartNewConversationL()
+// -----------------------------------------------------------------------------
+//
+void CIMCacheUpdater::StartNewConversationL(const TDesC& aBuddyId )
+	{
+	TRACE( T_LIT("CIMCacheUpdater::StartNewConversationL begin") );
+	if( !aBuddyId.Length() )
+		{
+		User::Leave( KErrArgument )	;
+		}
+	iClient.StartTransactionL(EIMCacheStartNewConversation, iServiceId , aBuddyId  );
+	
+	TRACE( T_LIT("CIMCacheUpdater::StartNewConversationL end") );
+	}
+	
+// -----------------------------------------------------------------------------
+// CIMCacheUpdater::AppendReceiveMessageL()
+// -----------------------------------------------------------------------------
+//
+void CIMCacheUpdater::AppendReceiveMessageL( const TDesC& aBuddyId, 
+											 const TDesC& aText )
+    {
+    TRACE( T_LIT("CIMCacheUpdater::AppendReceiveMessageL begin") );	
+    if( !aBuddyId.Length() )
+        {
+        User::Leave( KErrArgument )	;
+        }
+    TInt len = aText.Length();
+    HBufC* bigmsg = NULL;
+    bigmsg = HBufC::NewLC(KReceiveMsgMaxLength + 1) ; // 1 for  %
+    if( bigmsg )
+        {
+        TRACE( T_LIT("Inside if( bigmsg )") );
+        TPtr bigmsgPtr = bigmsg->Des();
+        //If message is more than 400 character take only first 400 character
+        //rest of the message will be lost
+        bigmsgPtr.Append( aText.Left( KReceiveMsgMaxLength ) ); 
+        if( len > KReceiveMsgMaxLength)
+            {
+            //append % as 401st character to identify on UI that it is a 
+            //long message which is truncated        
+            bigmsgPtr.Append(KPercentage); 
+            }
+
+        iClient.StartTransactionL(EIMCacheAppendReceiveMessage, iServiceId, aBuddyId , bigmsgPtr );
+
+        CleanupStack::PopAndDestroy(bigmsg); // bigmsg
+        }
+	TRACE( T_LIT("CIMCacheUpdater::AppendReceiveMessageL end") );
+	}
+// -----------------------------------------------------------------------------
+// CIMCacheUpdater::AppendSendMessageL()
+// -----------------------------------------------------------------------------
+//
+void CIMCacheUpdater::AppendSendMessageL(const TDesC& aText )
+	{
+  	TRACE( T_LIT("CIMCacheUpdater::AppendSendMessageL begin") );
+  	
+	iClient.StartTransactionL( EIMCacheAppendSendMessage , aText);	
+	TRACE( T_LIT("CIMCacheUpdater::AppendSendMessageL end") );
+	}
+
+// -----------------------------------------------------------------------------
+// CIMCacheUpdater::AppendMessageL()
+// -----------------------------------------------------------------------------
+//
+void CIMCacheUpdater::AppendMessageL(const TDesC& aBuddyId, const TDesC& aText )
+	{
+  	TRACE( T_LIT("CIMCacheUpdater::AppendMessageL begin") );
+	if( !aBuddyId.Length() )
+		{
+		User::Leave( KErrArgument )	;
+		}
+	iClient.StartTransactionL(EIMCacheAppendMessage, iServiceId, aBuddyId, aText);	
+	TRACE( T_LIT("CIMCacheUpdater::AppendMessageL end") );
+	}
+
+// -----------------------------------------------------------------------------
+// CIMCacheUpdater::CloseConversation()
+// -----------------------------------------------------------------------------
+//
+void CIMCacheUpdater::CloseConversationL( const TDesC& aBuddyId )
+    {
+    TRACE( T_LIT("CIMCacheUpdater::CloseConversationL begin") ); 
+    
+	if( !aBuddyId.Length() )
+		{
+		User::Leave( KErrArgument )	;
+		}
+    iClient.StartTransactionL( EIMCacheCloseConversation,
+								iServiceId, 
+								aBuddyId                                
+								);
+    TRACE( T_LIT("CIMCacheUpdater::CloseConversationL end") );
+   }
+
+// -----------------------------------------------------------------------------
+// CIMCacheUpdater::CloseConversation()
+// -----------------------------------------------------------------------------
+//
+void CIMCacheUpdater::CloseAllConversationL()
+    {
+    TRACE( T_LIT("CIMCacheUpdater::CloseAllConversationL begin") ); 
+    iClient.StartTransactionL( EIMCacheCloseAllConversation );
+    TRACE( T_LIT("CIMCacheUpdater::CloseAllConversationL end") );
+    }
+// -----------------------------------------------------------------------------
+// CIMCacheUpdater::DeactivateConversationL()
+// -----------------------------------------------------------------------------
+//
+TInt CIMCacheUpdater::DeactivateConversationL( )
+	{
+	TRACE( T_LIT("CIMCacheUpdater::DeactivateConversationL begin") );
+	
+	TInt error = iClient.StartTransactionL( EIMCacheDeactivateConversation );
+								 
+	TRACE( T_LIT("CIMCacheUpdater::DeactivateAllConversationsL end") );
+	return error;
+	}
+// -----------------------------------------------------------------------------
+// CIMCacheUpdater::ServiceId()
+// -----------------------------------------------------------------------------
+//
+TInt CIMCacheUpdater::ServiceId() const 
+	{
+	return iServiceId;	
+	}
+
+// -----------------------------------------------------------------------------
+// CIMCacheAccess::RegisterObserverL()
+// -----------------------------------------------------------------------------
+//
+void CIMCacheUpdater::RegisterObserverL( MIMCacheEventHandler& aObserver  )
+	{
+	TRACE( T_LIT("CIMCacheAccess::RegisterObserverL begin") );
+	// update case ETrue says CV is active
+	// cch need not to register
+	iClient.RegisterUpdateObserverL( aObserver  );
+	TRACE( T_LIT("CIMCacheAccess::RegisterObserverL end") );
+	}
+
+// -----------------------------------------------------------------------------
+// CIMCacheAccess::UnRegisterObserverL()
+// -----------------------------------------------------------------------------
+//
+void CIMCacheUpdater::UnRegisterObserver( MIMCacheEventHandler& aObserver )
+	{
+	TRACE( T_LIT("CIMCacheAccess::UnRegisterObserverL begin") );
+	iClient.UnRegisterUpdateObserver( aObserver );
+	TRACE( T_LIT("CIMCacheAccess::UnRegisterObserverL end") );
+	}	
+  
+// -----------------------------------------------------------------------------
+// CIMCacheAccess::GetChatListL()
+// -----------------------------------------------------------------------------
+//
+RArray<SIMCacheChatItem> CIMCacheUpdater::GetChatListL( const TInt aServiceId  )
+	{
+	TRACE( T_LIT("CIMCacheUpdater::GetChatListL") );	
+	RArray<SIMCacheChatItem> chatListArray;//array to hold chat item
+	TBool more = EFalse;
+	TPtr8 bufferPtr =  iClient.GetChatListL( aServiceId );
+	InternalizeChatListL( chatListArray, bufferPtr, more );
+	
+	while( more)
+		{
+		bufferPtr = iClient.GetBufferedDataL( EIMCacheGetBufferedPackets );
+		InternalizeChatListL( chatListArray, bufferPtr, more );
+		}
+	return chatListArray;
+	}
+    
+// -----------------------------------------------------------------------------
+// CIMCacheUpdater::InternalizeChatListL
+// -----------------------------------------------------------------------------
+//
+void CIMCacheUpdater::InternalizeChatListL(RArray<SIMCacheChatItem>& aChatArray, TPtr8 aChatListBuffer ,TBool& aMore )
+    {
+    TRACE( T_LIT("CIMCacheUpdater::InternalizeChatListL() begin") );   
+    
+    RDesReadStream readAllStream ;
+    RDesReadStream readStream ;    
+    
+    readAllStream.Open( aChatListBuffer );
+    CleanupClosePushL(readAllStream);
+    
+    TInt messageCount = readAllStream.ReadInt16L();
+    
+    for( TInt i=0; i< messageCount; i++)
+        {
+        SIMCacheChatItem chatItem =
+          {
+          0,
+          };
+                
+        TInt size = readAllStream.ReadInt16L() ;
+        HBufC8* mBuffer  = HBufC8::NewLC( size );
+        TPtr8 mBufferPtr = mBuffer->Des();
+                
+        readAllStream.ReadL( mBufferPtr , size );
+        
+        readStream.Open( *mBuffer );        
+        CleanupClosePushL(readStream) ;
+        
+        chatItem.iServiceId  = static_cast<TInt>( readStream.ReadInt16L() );
+        
+        TInt textSize = readStream.ReadInt16L();
+        HBufC* buddyId = HBufC::NewLC( textSize );
+        TPtr buddyIdPtr = buddyId->Des(); 
+        readStream.ReadL( buddyIdPtr , textSize);
+        
+        chatItem.iBuddyId = buddyId;
+        CleanupStack::Pop(buddyId); // ownership to structure variable
+        aChatArray.Insert(chatItem, 0);
+        CleanupStack::PopAndDestroy(2);//close read stream, delete mBuffer.                
+        }
+    aMore = static_cast<TBool>( readAllStream.ReadInt16L() );
+    
+    CleanupStack::PopAndDestroy();//readAllStream.    
+    
+    TRACE( T_LIT("CIMCacheUpdater::InternalizeChatListL() End") );
+    }
+
+//  END OF FILE
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/instantmessagingcache/imcacheclient/src/imcacheprocessstarter.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,266 @@
+/*
+* 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:  start the server
+*
+*/
+
+
+#include "imcacheprocessstarter.h"
+// logs
+#include "imcachedebugtrace.h"
+// system includes
+#include <e32std.h>
+#include <f32file.h>
+
+
+// CONSTANTS
+_LIT( KEka2ExeDir,"\\sys\\bin\\");
+_LIT( KEka2LaunchMutexExt, "[lMtx]" );
+const TInt KEka2SrvConnTries = 7;
+const TInt KEka2SrvConnInitialRetryWait = 500; //MicroSeconds => 0.0005s
+
+
+// ==============================================================
+// ====================== HELPER CLASS ==========================
+// ==============================================================
+
+/**
+ * RSessionBase accessor to give to the ProcessStarter
+ * access to RSessionBase::CreateSession().
+ */
+class REka2SessionBaseAccessor : public RSessionBase
+    {
+    public: // Constructor
+        inline REka2SessionBaseAccessor()
+            {
+            }
+
+    public: // New functions
+
+        /**
+         * Public access to RSessionBase::CreateSession().
+         */
+        inline TInt CreateSession( const TDesC& aServer,
+                                   const TVersion& aVersion,
+                                   TInt aAsyncMessageSlots )
+            {
+            return RSessionBase::CreateSession( aServer,
+                                                aVersion,
+                                                aAsyncMessageSlots );
+            }
+    };
+
+
+// ==============================================================
+// ====================== PROCESSSTARTER ========================
+// ==============================================================
+
+// --------------------------------------------------------------
+// IMCacheProcessStarter::FullExePathForClientLocation()
+// --------------------------------------------------------------
+//
+void IMCacheProcessStarter::FullExePathForClientLocation(
+    const TDesC& aExeName,
+    TFileName& aFullExePath )
+    {
+	TRACE( T_LIT("IMCacheProcessStarter::FullExePathForClientLocation begin") );
+    //Get drive (C:) where this client code is installed
+        {
+        TFileName tmp;
+        Dll::FileName( tmp );
+        aFullExePath.Copy( TParsePtrC( tmp ).Drive() );
+        }
+
+    //Build the rest from the exe path
+    aFullExePath.Append( KEka2ExeDir );
+    aFullExePath.Append( aExeName );
+    TRACE( T_LIT("IMCacheProcessStarter::FullExePathForClientLocation end") );
+    }
+
+// --------------------------------------------------------------
+// IMCacheProcessStarter::StartInstance()
+// --------------------------------------------------------------
+//
+TInt IMCacheProcessStarter::StartInstance(
+    const TDesC& aFullExePath,
+    const TDesC& aCommand )
+    {
+    TRACE( T_LIT("IMCacheProcessStarter::StartInstance begin") );
+    RMutex launchMutex;
+    TInt error = KErrNotFound;
+
+        {
+        // Dynamic mutex name used to allow code share
+        TName launchMutexName( TParsePtrC( aFullExePath ).Name() );
+        launchMutexName.Append( KEka2LaunchMutexExt );
+
+        // Open or Create mutex to serialize to access to server startup code.
+        // (race condition safe way)
+        while( error == KErrNotFound )
+            {
+            error = launchMutex.CreateGlobal( launchMutexName );
+            if( error != KErrAlreadyExists )
+                {
+                break;
+                }
+            error = launchMutex.OpenGlobal( launchMutexName );
+            }
+
+        if( error != KErrNone )
+            {
+            TRACE( T_LIT("IMCacheProcessStarter::StartInstance end") );
+            return error;
+            }
+        }
+
+
+    launchMutex.Wait();
+
+    //Serialized access
+    error = IMCacheProcessStarter::DoStartInstance( aFullExePath,
+                                             aCommand );
+
+    launchMutex.Signal();
+    launchMutex.Close();
+	TRACE( T_LIT("IMCacheProcessStarter::StartInstance end") );
+    return error;
+    }
+
+// --------------------------------------------------------------
+// IMCacheProcessStarter::ConnectToServer()
+// --------------------------------------------------------------
+//
+TInt IMCacheProcessStarter::ConnectToServer(
+    const TDesC& aFullExePath,
+    const TDesC& aCommand,
+    RSessionBase& aSessionToConnect,
+    const TDesC& aServerName,
+    const TVersion& aClientVersion,
+    TInt aAsyncMessageSlots )
+    {
+    TRACE( T_LIT("IMCacheProcessStarter::ConnectToServer begin") );
+    if( aSessionToConnect.Handle() != KNullHandle )
+        {
+        return KErrInUse;
+        }
+
+    TInt err = KErrNone;
+    TInt startupWait = KEka2SrvConnInitialRetryWait;
+
+    //Server connect and launch loop
+    for( TInt trie = 0 ; trie < KEka2SrvConnTries ; trie++ )
+        {
+        REka2SessionBaseAccessor acc;
+        err = acc.CreateSession( aServerName,
+                                 aClientVersion,
+                                 aAsyncMessageSlots );
+
+        if( err == KErrNone )
+            {
+            //session ownership is now on client
+            aSessionToConnect = acc;
+            return KErrNone;
+            }
+
+        else if( ( err == KErrNotFound ) ||
+                 ( err == KErrServerTerminated ) )
+            {
+            //Server missing or died when connecting
+            //Start a new server
+            err = IMCacheProcessStarter::StartInstance( aFullExePath,
+                                                 aCommand );
+
+            //If process exist already, then all is fine
+            //(some other process started it between the origical connect and launch trie)
+            if( err == KErrAlreadyExists )
+                {
+                err = KErrNone;
+                }
+
+            //If server process start failed, bail out.
+            if( err != KErrNone )
+                {
+                return err;
+                }
+
+            //If this is 2nd or subsequent try,
+            //give some time for server to startup
+            if( trie > 0 )
+                {
+                // Code scanner warning : Use of User::After (id:92)
+                // it is required to be used here
+                User::After( startupWait ); // CSI: 92 # See above
+                startupWait = 2 * startupWait;
+                }
+            }
+
+        else
+            {
+            //Server process start failed. Bail out.
+            return err;
+            }
+        }
+	TRACE( T_LIT("IMCacheProcessStarter::ConnectToServer end") );
+    return err;
+    }
+
+// --------------------------------------------------------------
+// IMCacheProcessStarter::DoStartServerInstance()
+// --------------------------------------------------------------
+//
+TInt IMCacheProcessStarter::DoStartInstance(
+    const TDesC& aFullExePath,
+    const TDesC& aCommand )
+    {
+    TRACE( T_LIT("IMCacheProcessStarter::DoStartInstance begin") );
+    TInt error = KErrNone;
+
+    //Create process
+    RProcess process;
+    error = process.Create( aFullExePath, aCommand );
+
+    if( error == KErrNone )
+        {
+       
+            TRequestStatus rendezvousStatus;
+            process.Rendezvous( rendezvousStatus );
+
+            process.Resume();
+            // Codescanner warning: user of User::WaitForRequest (Id:94)
+            // it is required to use at server startup
+            User::WaitForRequest( rendezvousStatus ); // CSI: 94 # See above
+            error = rendezvousStatus.Int();
+
+            if( process.ExitType() != EExitPending )
+                {
+                //Something failed in server startup
+                //Force the error code to be always something
+                //else than KErrNone
+                if( error == KErrNone )
+                    {
+                    error = KErrServerTerminated;
+                    }
+                }
+           
+        }
+
+    process.Close();
+	TRACE( T_LIT("IMCacheProcessStarter::DoStartInstance end") );
+    return error;
+    }
+
+// END OF FILE
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/instantmessagingcache/imcacheserver/group/bld.inf	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,29 @@
+/*
+* 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:  build definition file
+*
+*/
+
+
+#include <platform_paths.hrh>
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_MMPFILES
+imcacheserver.mmp
+
+
+
+
+// end of file
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/instantmessagingcache/imcacheserver/group/imcacheserver.mmp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,58 @@
+/*
+* 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:  mmp file
+*
+*/
+
+
+#include <platform_paths.hrh>
+#include <data_caging_paths.hrh>
+#include "../../inc/imcacheuids.h"
+
+
+TARGET          imcacheserver.exe
+TARGETTYPE      exe
+
+UID             KStaticInterfaceDllUid2 KIMCacheServerUid3
+VENDORID        VID_DEFAULT
+CAPABILITY      CAP_SERVER
+TARGETPATH      /system/libs
+
+VERSION      10.0
+
+SOURCEPATH      ../src
+
+SOURCE      	cimcacheserver.cpp
+SOURCE      	cimcachesession.cpp
+SOURCE			ccacheserveractivehelper.cpp
+SOURCE			timcachemessagefactory.cpp
+SOURCE			cimcachemessageheader.cpp
+SOURCE			cimcachemessagebase.cpp
+SOURCE			cimcachebufferarray.cpp
+
+USERINCLUDE     ../inc
+USERINCLUDE     ../../inc
+
+APP_LAYER_SYSTEMINCLUDE
+
+LIBRARY         euser.lib
+LIBRARY         flogger.lib
+LIBRARY         charconv.lib
+LIBRARY     	commonengine.lib
+LIBRARY         rsfwmountman.lib
+LIBRARY 		estor.lib 
+LIBRARY     	ecom.lib 
+
+// end of file
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/instantmessagingcache/imcacheserver/inc/ccacheserveractivehelper.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,229 @@
+/*
+* 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:  instantmessagingcache server class declaration
+*
+*/
+
+#ifndef __CIMCACHESERVERACTIVEHELPER_H__
+#define __CIMCACHESERVERACTIVEHELPER_H__
+
+#include <e32base.h>
+
+#include <imcachedefs.h>
+#include <cinstantmsgindicator.h>
+
+// FORWARD DECLARATIONS
+class CIMCacheServer;
+class TIMCacheMessageFactory;
+class MIMCacheMessageHeader;
+class CIMCacheMessageBase;
+
+
+/**
+* This class is used by CIMCacheServer for dividing long running async.
+* tasks into smaller units. The instantmessagingcache session itself was not made 
+* active, since that results in c++ ambiguousness problems in CCacheServerActiveHelper
+* @since S60 v5.0
+*/    
+class CCacheServerActiveHelper : public CBase
+	{
+	public: // public functions
+	
+	    /**
+        * Default 1st phase factory method.
+        * Creates an instance of CCacheServerActiveHelper
+        * @return created instance of the CCacheServerActiveHelper
+        */
+        static CCacheServerActiveHelper* NewL(CIMCacheServer& aServer);
+        
+        /**
+        * Destruct
+        */
+        ~CCacheServerActiveHelper( );
+        
+        	
+	private: // private functions
+        
+        /**
+        * Constructor
+        * @param aServer, server reference
+        */
+        CCacheServerActiveHelper(CIMCacheServer& aServer); 
+
+        /**
+        * ConstructL
+        */
+		void ConstructL();
+		
+		/**
+        * PackAndNotifyRecievedMessageL pack and notify about recieve message
+        * @param aMsgHeader, header reference
+        * @param aRecievedMsg, message reference
+        */
+		void PackAndNotifyRecievedMessageL(MIMCacheMessageHeader* aMsgHeader,
+											CIMCacheMessageBase* aRecievedMsg);
+
+		/**
+        * PackAndNotifyEventL pack and notify about message
+        * @param aNotification, type of change
+        * @param aMsgHeader, header reference
+        * @param aMessage, message reference
+        */
+		void PackAndNotifyEventL( TIMCacheOperationsCode aNotification, 
+                                  TInt aServiceId,
+								  MIMCacheMessageHeader * aMsgHeader = NULL,
+								  CIMCacheMessageBase* aMessage = NULL );
+
+		/**
+        * find and give the chat header pointer
+        * @param aServiceId, service id
+        * @param aBuddyId, buddy id
+        * @return chat header ,if not found NULL
+        */
+		MIMCacheMessageHeader* ChatHeaderL(const TInt& aServiceId, const TDesC& aBuddyId );
+		
+		 /**
+          * Loads all the plugins
+          */
+		 void LoadPluginL( );
+		 
+		 /**
+          * publishes the message info to the plugins
+          * @param aSenderId, buddy id
+          * @param aServiceId, service id
+          * @Param aCloseConversation indicates that the event came from closing the ocnversation.
+          */
+		 void  PublishMessageInfoL(const TDesC& aSenderId,TInt aServiceId,
+		                            TBool aCloseConversation = EFalse );
+
+    										
+public:	
+     	/**
+        * reset all header chat started flag to EFalse
+        */
+    	void ResetHeaderInoformation();
+        /**
+        * gets unread message count corresponding to a particular sender
+        */
+		void GetUnreadMessageCountL(const RMessage2& aMessage );
+		
+		/**
+        * gets all unread message count from all open conversations
+        */
+		void GetAllUnreadMessageCountL(const RMessage2& aMessage );		
+
+		/**
+		* start the new conversation
+		*/
+        void StartNewConversationL( const RMessage2 &aMessage );
+
+		/**
+		* append the revieve new messgae 
+		*/
+        void AppendReceiveMessageL( const RMessage2 &aMessage );
+
+		/**
+		* append the new send messgae  
+		*/
+        void AppendSendMessageL( const RMessage2 &aMessage );
+        
+        /**
+		* append the information messgae  
+		*/
+        void AppendMessageL( const RMessage2 &aMessage );
+        
+	        
+        /**
+        * close conversations overloaded method.
+        */
+        void CloseConversationL( const RMessage2 &aMessage );
+
+        /**
+         * close All conversations availabe in service.
+         */
+        void CloseAllConversationL( TInt aServiceId );
+        
+		/**
+		* Deactivate ongoing conversation
+		*/
+        void DeactivateConversationL();
+			
+		/**
+		* check if conversation already exist write ETrue if exist at 3rd index of message
+		*/
+		void CheckConversationExistL( const RMessage2 &aMessage );
+		
+      
+		/**
+        * find the add contact header at given index
+        * @return contact header , NULL if not found
+        */
+		MIMCacheMessageHeader* ChatHeaderAt( TInt aIndex );
+
+		/**
+        * total contact header counts
+        * @return the count
+        */
+		TInt ChatHeadersCount() ;
+		
+		/**
+        * return array of chat headers corresponding to given service
+        * @param aServiceId, service id
+        * @param aServiceHeaderArray, filled with the headers corresponding to aServiceId,: out parameter.
+        * @return array of chat headers
+        */
+		void GetServiceChatHeaderArrayL(TInt aServiceId , RPointerArray<MIMCacheMessageHeader>& aServiceHeaderArray );
+private:
+        /**
+         * Internal class used as a wrapper around a plugin
+         * and its uid.
+         */
+        class CPluginInfo : public CBase
+            {
+            public: // Constructor & Destructor
+                CPluginInfo( CInstantMsgIndicator* aPlugin, TUid aUid );
+                ~CPluginInfo();
+
+            public: // New functions
+                CInstantMsgIndicator& Plugin();
+            private: // Data
+                CInstantMsgIndicator* iPlugin;
+                TUid iPluginUid;
+            };		
+private :		
+        /**
+        * pointer to CIMCacheServer& aServer doesnt own
+        */
+		CIMCacheServer& iServer;
+		
+		// owned, main cache array		
+		RPointerArray<MIMCacheMessageHeader> iHeaderArray;
+		
+		// not owned, active conversation header
+		MIMCacheMessageHeader* iActiveHeader;
+		
+		//owned, pointer to msg factory
+		TIMCacheMessageFactory* iMessageFactory;
+		
+        // takes ownership of the plugins
+        RPointerArray<CPluginInfo> iPluginInfo; 
+	
+	};
+	
+#endif      //  __CIMCACHESERVERACTIVEHELPER_H__
+
+
+//  END OF FILE
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/instantmessagingcache/imcacheserver/inc/cimcachebufferarray.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,92 @@
+/*
+* 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:  a message class declaration 
+*
+*/
+
+
+#ifndef CIMIMCACHEBUFFERARRAY_H
+#define CIMIMCACHEBUFFERARRAY_H
+
+#include <e32base.h>
+#include <badesca.h>
+#include <imcachedefs.h>
+
+//	FORWARD CLASS DECLERATIONS
+// CLASS DECLARATION
+// Definitions
+
+/**
+ *  Message Base class
+ */
+class CIMCacheBufferArray : public CBase
+	{
+                      	
+    public: // Construction
+    
+    	
+		/**
+		 * Construction
+		  * @param aData, text message
+		 * @return Pointer to new created instance of CIMCacheBufferArray
+		 */
+		static CIMCacheBufferArray* NewL( const TDesC8& aPacketBuffer ,TIMCacheOperationsCode aOperationCode );
+
+		
+		/**
+		 * Destruction
+		 */
+		~CIMCacheBufferArray();
+		
+	private : // Construction
+	
+		/**
+		 * Constructor
+		 */
+		CIMCacheBufferArray( TIMCacheOperationsCode aOperationCode );
+		
+		/**
+		 * two phase construction
+		 */
+		void ConstructL( const TDesC8& aPacketBuffer );
+
+public:  
+	
+			
+		/**
+         * operatuin code stored
+         * @return operation code
+         */
+		TIMCacheOperationsCode OperationCode();
+		
+		/**
+         * Message
+         * @return  message
+         */
+		const TDesC8& PacketData();
+	                 
+                                            
+	protected: // Member variables
+		    
+	    // owned, message buffer
+		HBufC8*	 iPacketBuffer;
+		
+		// owns : to identify type of message packed
+		TIMCacheOperationsCode iOperationCode;
+       
+	}; 
+
+#endif      // CIMIMCACHEMESSAGEBASE_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/instantmessagingcache/imcacheserver/inc/cimcachemessagebase.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,144 @@
+/*
+* 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:  a message class declaration 
+*
+*/
+
+
+#ifndef CIMIMCACHEMESSAGEBASE_H
+#define CIMIMCACHEMESSAGEBASE_H
+
+#include <e32base.h>
+#include <badesca.h>
+#include <imcachedefs.h>
+
+//	FORWARD CLASS DECLERATIONS
+// CLASS DECLARATION
+// Definitions
+
+/**
+ *  Message Base class
+ */
+class CIMCacheMessageBase : public CBase
+	{
+                      	
+    public: // Construction
+    
+    	
+		/**
+		 * Construction
+		  * @param aData, text message
+		 * @return Pointer to new created instance of CIMCacheMessageBase
+		 */
+		static CIMCacheMessageBase* NewL( 
+		                             const TDesC& aData );
+
+		
+		/**
+		 * Destruction
+		 */
+		~CIMCacheMessageBase();
+		
+	private : // Construction
+	
+		/**
+		 * Constructor
+		 */
+		CIMCacheMessageBase();
+		
+		/**
+		 * Remember to call this one as last line of child ConstructL
+		 * @param aSender, data 
+		  */
+		void ConstructL( const TDesC& aData  );
+		
+
+public:  
+		/**
+		 * @see TimeStamp
+		* @return a time stamp
+		 */
+		const TTime& TimeStamp() const;
+
+		/**
+		 * @see MessageType
+		 * @return a message type
+		 */
+		TIMCacheMessageType MessageType() const;
+		
+		/**
+		 * @see MessagerType
+		 * @return a messager type
+		 */
+		TIMCacheMessagerType MessagerType() const;
+		
+	             
+		/**
+		 * @see Text
+		 * @return text message
+		 */
+        const TDesC& Text() const;
+       	   		
+				
+		/**
+		 * @see ContentType
+		 * @return type of content
+		 */
+		TIMCacheContentType ContentType() const;
+		
+	        
+        /**
+         * Set message type
+         * @param aNewType New message type.
+         */
+        void SetMessageType( TIMCacheMessageType aNewType );
+        
+        /**
+         * Set messager type
+         * @param aNewType New messager type.
+         */
+        void SetMessagerType( TIMCacheMessagerType aNewType );
+
+		/**
+         * Set messager read
+         */
+		void SetRead() ;
+  
+		/**
+         * IsUnread
+         * @return  ETrue if messgae is unread.
+         */
+		TBool IsUnread() const ;
+	                 
+                                            
+	protected: // Member variables
+	
+	    /// Type of message
+	    TIMCacheMessageType iMessageType;
+	    // messager type
+	    TIMCacheMessagerType iMessagerType;
+	   
+		/// Timestamp.
+ 		TTime iTime;
+ 	    /// Owns. Textual content.
+	    HBufC* iText;
+	    
+	    // owned, message is unread
+	    TBool iUnread;
+       
+	}; 
+
+#endif      // CIMIMCACHEMESSAGEBASE_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/instantmessagingcache/imcacheserver/inc/cimcachemessageheader.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,142 @@
+/*
+* 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:   a header of all convesation
+*
+*/
+
+
+#ifndef CIMCACHEMESSAGEHEADER_H
+#define CIMCACHEMESSAGEHEADER_H
+
+#include <e32base.h>
+#include "mimcachemessageheader.h"
+
+// CLASS DECLARATION
+
+/**
+ *  Message header for history data
+ *
+ *  @lib imcacheserver.exe
+ *  @since 5.0
+ */
+ 
+class CIMCacheMessageHeader : public CBase, 
+							  public MIMCacheMessageHeader
+    {
+    public: // Constructors and destructors
+
+		/**
+		 * NewL for CIMCacheMessageHeader
+         * Two-phase constructor
+		 * @param aServiceId , a service id .
+		 * @param aBuddyId a buddy. 
+		 * @return Instance of CIMCacheMessageHeader with header information.
+		 */        
+		static CIMCacheMessageHeader* NewL(TInt aServiceId, const TDesC& aBuddyId );
+
+		/**
+		 * Virtual destructor	
+		 */
+        virtual ~CIMCacheMessageHeader();
+
+    private:	// Constructors
+
+		/**
+		 * Default constructor	
+		 */
+        CIMCacheMessageHeader();
+
+		/**
+		 * ConstructL for CIMCacheMessageHeader
+		 * Part of Two-phase construction
+         * @param aServiceId , a service id .
+		 * @param aSender sender 
+		 * @param aBuddyId a recipient 
+		 */
+        void ConstructL(TInt aServiceId, const TDesC& aBuddyId );
+    
+
+	public: //new MIMCacheMessageHeader
+
+		/**
+		 *	service id
+		 *	@return a service id
+		 */
+		 TInt ServiceId() const;
+		
+		/**
+		 *	user id of recipient 
+		 *	@return recipient user id
+		 */
+		const TDesC& BuddyId() const;
+		
+		/**
+		 *	return total message count
+		 */
+		TInt MessageCount() const ;
+
+		/**
+		 * get message at given index 
+		 * @param aIndex index
+		 */
+		CIMCacheMessageBase* GetMessage(TInt aIndex ) ;
+
+		/**
+		 * append message
+		 * @param aMessge message to append
+		 */
+		void AppendMessageL(CIMCacheMessageBase* aMessge)  ; 	
+		
+		/**
+		 * UnreadMessageCount 
+		 * @return unread message count
+		 */
+        TInt UnreadMessageCount() const ; 
+        
+        /**
+        * check wheather chat started or not
+        * @return ETrue started
+        */
+        TBool IsChatStarted();
+        
+		/**
+        * set chat started 
+        * @param aStarted, a boolean value to set
+         */
+        void SetChatStarted(TBool aStarted );
+       
+      	/**
+        * mark all message read
+        */
+        void MarkAllRead();
+        
+    private:  // Data
+	
+        //owned, recipient
+		HBufC* iBuddyId;
+		
+		//service id
+		TInt iServiceId ;
+		
+		//owned,  array of all messages
+		RPointerArray< CIMCacheMessageBase > iMessageArray;
+		
+		//true if streaming is not completely done.
+		TBool iChatStarted;
+			
+	};
+
+#endif      // CIMCACHEMESSAGEHEADER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/instantmessagingcache/imcacheserver/inc/cimcacheserver.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,112 @@
+/*
+* 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:  instantmessagingcache server class declaration
+*
+*/
+
+
+#ifndef __CIMCACHESERVER_H__
+#define __CIMCACHESERVER_H__
+
+#include <e32base.h>
+#include <imcachedefs.h>
+
+// FORWARD DECLARATIONS
+class CIMCacheSession;
+class CCacheServerActiveHelper;
+class MIMCacheMessageHeader ;
+class CIMCacheMessageBase;
+/**
+ * Service server.
+ */
+NONSHARABLE_CLASS( CIMCacheServer ): public CPolicyServer
+    {
+        	
+    public:     // Execution and destructors
+         static void ExecuteL();
+        
+        virtual ~CIMCacheServer();
+
+    private:    // C++ constructor
+        CIMCacheServer();
+
+    protected:     // Methods from CPolicyServer
+
+        CSession2* NewSessionL( const TVersion& aVersion,
+                                const RMessage2& aMessage ) const;
+
+  
+    public:     //New methods
+    
+    	/**
+         * SessionCreatedL  
+         * @param aSession a session created 
+         */
+	    void SessionCreatedL( CIMCacheSession* aSession );
+	   
+	    /**
+         * SessionDied  
+         * @param aSession a session died 
+         */
+	    void SessionDied( CIMCacheSession* aSession );
+	    
+	    			
+		/**
+         * helper is owned by server class   
+         * may any session requied to access
+         * to get the same instance
+         * @return pointer to the active helper
+         */								 
+		CCacheServerActiveHelper* GetActiveHelper();
+					
+		
+		/**
+         * pack and notify msg notification  
+         * @param aChangeType , notification type
+         * @param aMsgHeader, chat header 
+         * @param aMessage , a message
+         */	
+		void PackAndNotifyEventL( TIMCacheOperationsCode aChangeType,
+                                  TInt aServiceId,
+								  MIMCacheMessageHeader* aMsgHeader = NULL, 
+								  CIMCacheMessageBase* aMessage = NULL ) ; 
+	    
+          
+
+	private: // New methods
+	
+	
+		/**
+         * initialization will be done here
+         */
+	    void InitializeL(CIMCacheServer& aServer);
+	    
+	   
+	    
+    private:    //Data
+    	// owned, session count
+        TInt iSessionCount;
+        // owned, array of all open sessions
+        RPointerArray<CIMCacheSession> iSessions;
+    	// owned, active helper	
+      	CCacheServerActiveHelper* iActiveHelper;
+    };
+
+
+#endif      //  __CIMCACHESERVER_H__
+
+
+//  END OF FILE
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/instantmessagingcache/imcacheserver/inc/cimcachesession.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,249 @@
+/*
+* 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:  cache session class declaration
+*
+*/
+
+#ifndef __CIMCACHESESSION_H__
+#define __CIMCACHESESSION_H__
+
+#include <e32base.h>
+#include <s32mem.h>
+#include <imcachedefs.h>
+
+// FARWORD DECLARATION
+class CIMCacheServer;
+class CCacheServerActiveHelper;
+class MIMCacheMessageHeader ;
+class CIMCacheMessageBase;
+class CIMCacheBufferArray;
+
+/**
+ * Service side session.
+ */
+ class CIMCacheSession : public CSession2
+    {
+    
+      
+    public:     
+    
+    	/**
+        * NewL.
+        * Constructors
+        */
+        static CIMCacheSession* NewL();
+        /**
+        * ~CIMCacheSession
+        * destructors
+        */
+        virtual ~CIMCacheSession();
+
+
+    protected:  // C++ constructors
+    	/**
+        * C++ default constructor.
+        */
+        CIMCacheSession();
+
+        /**
+        * Symbian OS constructor
+        */
+		void ConstructL();
+
+    public:     // Methods derived from CSession2
+    	/**
+    	* From CSession2
+    	*/
+        void CreateL();
+    	/**
+    	* From CSession2
+    	*/
+        void ServiceL( const RMessage2 &aMessage );
+    	/**
+    	* From CSession2
+    	*/
+        void ServiceError( const RMessage2& aMessage,
+                           TInt aError );
+		
+   
+
+	public: // New methods
+		
+        /**
+        * Server , 
+        * @return server reference
+        */
+        CIMCacheServer* Server() 
+	        { 
+	        return (CIMCacheServer*) CSession2::Server(); 
+	        }
+
+		/**
+         * pack and notify msg notification  
+         * @param aChangeType , notification type
+         * @param aMsgHeader, chat header 
+         * @param aMessage , a message
+         * @param aServiceId ,service id
+         */	
+        void PackAndNotifyEventL( TIMCacheOperationsCode aChangeType ,
+								  MIMCacheMessageHeader* aMsgHeader = NULL , 
+								  CIMCacheMessageBase* aMessage = NULL );
+       
+        /*
+         * return the service Id of session
+         */
+        TInt ServiceId() const ;
+        
+     private:    // New methods
+
+		
+        /**
+		*  Dispatch clients message
+	    *  @since
+		*  @param aMessage client's message
+        */
+        TBool DispatchMessageL( const RMessage2 &aMessage );
+
+
+		/**
+		* Initializes the server
+		* @param aMessage client's message
+		*/
+        void InitSessionL( const RMessage2& aMessage );
+        
+    
+        
+        /**
+		* reset all conversation, start flag to EFalse
+		*/
+        void ResetHeaderInoformation();
+        
+      
+		/**
+		* Externalizes all chat data
+		* @param aArray, array of buffered headers..
+		* @param aSize total size of buffered messages.
+		* @param aMore , still data is pending to be send
+		*/
+		void ExternalizeBufferedDataL(TIMCacheOperationsCode aOperationCode,
+									  RPointerArray<HBufC8>& aArray , 
+									  TInt aTotalSize , 
+									  TBool aMore = EFalse );
+	
+		/**
+		* Externalizes chat headers
+		* @param aChangeType, event type
+		* @param aMsgHeader, chat header
+		* @param aMessage , chat message
+		* @param aServiceId , serviceid
+		*/
+		void ExternalizeChatItemL( TIMCacheOperationsCode aChangeType ,
+								   TInt aServiceId = KErrNotFound );
+		
+		/**
+		* Externalizes all  chat header messages.
+		* @param aChangeType, event type
+		* @param aMsgHeader, chat header
+		*/						    
+		void SendChatListDataL( TIMCacheOperationsCode aChangeType ,
+							    MIMCacheMessageHeader* aMsgHeader );
+		
+		/**
+		* send unread change notification
+		* @param aMsgHeader, chat header
+		* @param aMessage , chat message
+		*/					    
+		void SendUnreadChangeNotificationL(MIMCacheMessageHeader* aMsgHeader, 
+										   CIMCacheMessageBase* aMessage );
+		
+		/**
+		* Externalizes single chat item.
+		* @param aMsgHeader, chat header
+		*/								   
+		void ExternalizeSingleChatItemL( TIMCacheOperationsCode aChangeType, MIMCacheMessageHeader* aMsgHeader );
+		
+		
+		/**
+		* Externalizes single chat messages.
+		* @param aMsgHeader, chat header
+		* @param aMessage , chat message
+		*/
+		void ExternalizeSingleChatDataL(TIMCacheOperationsCode aChangeType,
+										MIMCacheMessageHeader* aChatHeader, 
+										CIMCacheMessageBase* aMessage );
+		
+		/**
+		* Externalizes all  chat messages in a message header
+		* @param aChangeType, event type
+		* @param aMsgHeader, chat header
+		*/
+		void ExternalizeChatDataL(TIMCacheOperationsCode aChangeType ,MIMCacheMessageHeader* aChatHeader );
+		
+		/**
+		* write data to stream
+		* @param aChatHeader, chat header
+		* @param aSize total size of buffered messages.
+		* @return a HBufC8 stream buffer pointer
+		*/
+		HBufC8* GetPackedChatItemBufferL(MIMCacheMessageHeader* aChatHeader, TInt& aSize);
+		
+		/**
+		* write data to stream 
+		* @param aMsg, message
+		* @param aMsgHeader, chat header
+		* @param aSize total size of buffered messages.
+		* @return a HBufC8 stream buffer pointer
+		*/
+		HBufC8* GetPackedChatDataBufferL(CIMCacheMessageBase* aMsg , 
+										 MIMCacheMessageHeader* aActiveHeader ,
+										 const TInt aSize);
+		/**
+		* do request complete 
+		* @param aChangeType, type of request
+		*/								 
+	//	void DoRequestComplete( TIMCacheOperationsCode aChangeType );								 	
+    private:    // Data
+    	//owned, message completed state
+    	TBool iMessageCompleted;
+             	
+        //does observer is active
+        TBool iObserverActive;
+        
+        //msg observer
+        RMessage2 iObserverMessage;
+                        
+		// not owned, active helper
+		CCacheServerActiveHelper* iHelper;
+	
+		// owns, pending packets to be sent to ui client
+		RPointerArray<CIMCacheBufferArray> iPacketsArray;
+	
+    	// read only right initialized
+		TBool iAccessorInitialized;
+		// conversation r/w initialized
+		TBool iConvesationInitialized;
+		
+		// owns : add request fetch completed or not
+		TBool iOpenChatFetchCompleted;		   
+		
+		// service id for this session
+		TInt iServiceId;
+	
+		};
+
+#endif      //  __CIMCACHESESSION_H__
+
+
+//  END OF FILE
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/instantmessagingcache/imcacheserver/inc/mimcachemessagefactory.h	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  factory helper class declaration  
+*
+*/
+
+
+#ifndef __MIMCACHEMESSAGEFACTORY_H__
+#define __MIMCACHEMESSAGEFACTORY_H__
+
+//INCLUDES
+
+#include <e32std.h>
+
+//	FORWARD DECLERATIONS
+
+class CIMCacheMessageBase;
+class MIMCacheMessageHeader;
+
+// CLASS DECLARATION
+
+/**
+ *  Interface for creator of MCAIMCacheMessages.
+ *  imcacheserver.exe
+ *  @since 5.0
+ */
+class MIMCacheMessageFactory
+    {
+	protected:
+
+		/**
+		 * Destructor.
+		 */
+		virtual ~MIMCacheMessageFactory() {};
+
+    public: // Interface
+
+	
+		/**
+		 *	Creates cahe message header
+		 *	@since 5.0
+		 *  @param aServiceId service Id
+         *  @param aBuddyId sender.
+         * 	@return Instance to MIMCacheMessageHeader
+		 */
+		virtual MIMCacheMessageHeader* CreateIMCacheMessageHeaderL(TInt aServiceId, const TDesC& aBuddyId ) = 0;
+								 
+	    /**
+         *  Creates cashe message
+         *  @param aSender sender of message.
+         *  @param aRecipient recipient of message.
+         *  @param aData content data.
+         *  @return Instance to CIMCacheMessageBase
+         */
+         virtual CIMCacheMessageBase* CreateCacheMessageL(
+                                        const TDesC& aData ) = 0;
+                                        
+	    /**
+         *  Find Index
+         *  @param aArray array
+         *  @param aRecipient recipient of message.
+         *  @param aServiceId service Id
+         *  @param aSender sender.
+         */
+         virtual TInt FindHeaderIndexL( RPointerArray<MIMCacheMessageHeader>& aArray, 
+										TInt aServiceId,
+										const TDesC& aBuddyId ) = 0 ;
+    };
+
+#endif      // __MIMCACHEMESSAGEFACTORY_H__
+
+// End of File
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/instantmessagingcache/imcacheserver/inc/mimcachemessageheader.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,105 @@
+/*
+* 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:   base call of header class
+*
+*/
+
+
+#ifndef MIMCACHEMESSAGEHEADER_H
+#define MIMCACHEMESSAGEHEADER_H
+
+//INCLUDES
+
+#include <e32std.h>
+#include <e32base.h>
+
+//FORWARD DECLARATIONS
+class CIMCacheMessageBase;
+
+// CLASS DECLARATION
+
+/**
+ *  Interface for header information of history file
+ *  @lib imcacheserver.exe
+ *  @since 5.0
+ */
+class MIMCacheMessageHeader
+    {
+	public:
+
+		/**
+		 * Destructor.
+		 */
+		virtual ~MIMCacheMessageHeader() {};
+
+    public: // Interface
+	
+		/**
+		 *	service id
+		 *	@return a service id
+		 */
+		 virtual TInt ServiceId() const = 0;
+
+		/**
+		 *	user id of recipient 
+		 *	@return recipient user id
+		 */
+		virtual const TDesC& BuddyId() const = 0;
+		
+		/**
+		 *	return total message count
+		 */
+		virtual TInt MessageCount() const = 0 ;
+		
+		/**
+		 * get message at given index 
+		 * @param aIndex index
+		 */
+		virtual CIMCacheMessageBase* GetMessage(TInt aIndex )  = 0;
+	
+		/**
+		 * append message
+		 * @param aMessge message to append
+		 */
+        virtual void AppendMessageL(CIMCacheMessageBase* aMessge)  = 0 ; 
+     
+     	/**
+		 * UnreadMessageCount 
+		 * @return unread message count
+		 */
+        virtual TInt UnreadMessageCount() const = 0 ;  
+        
+         /**
+        * check wheather chat started or not
+        * @return ETrue started
+        */
+        virtual TBool IsChatStarted() = 0 ;
+        
+        /**
+        * set chat started 
+        * @param aStarted, a boolean value to set
+         */
+        virtual void SetChatStarted(TBool aStarted ) = 0 ;
+       
+      	/**
+        * mark all message read
+        */
+        virtual void MarkAllRead() = 0 ;
+             
+
+	    };
+
+#endif      // MIMCACHEMESSAGEHEADER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/instantmessagingcache/imcacheserver/inc/timcachemessagefactory.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,82 @@
+/*
+* 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:  factory helper class declaration  
+*
+*/
+
+
+#ifndef TIMCHACHEMESSAGEFACTORY_H
+#define TIMCHACHEMESSAGEFACTORY_H
+
+//INCLUDES
+
+#include <e32std.h>
+#include "mimcachemessagefactory.h"
+
+//  FORWARD DECLERATIONS
+
+class MIMCacheMessageHeader;
+class CIMCacheMessageBase;
+// CLASS DECLARATION
+
+/**
+ *  Implementation for creator of MCAIMCacheMessages.
+ *
+ *  T-class, because there is no dynamic member variables and because
+ *  there is no other class which suites in this case.
+ *  Class methods cannot be static, because pointer to MIMCacheMessageFactory
+ *  is passed to client.
+ */
+class TIMCacheMessageFactory : public MIMCacheMessageFactory
+    {
+    public: // Interface
+
+        
+        /**
+		 *	Creates cahe message header
+		 *	@since 5.0
+		 *  @param aServiceId service Id
+         *  @param aBuddyId sender.
+         *	@return Instance to MIMCacheMessageHeader
+		 */
+        MIMCacheMessageHeader* CreateIMCacheMessageHeaderL(TInt aServiceId, 
+        													const TDesC& aBuddyId );
+        
+         
+         /**
+         *  Creates cashe message
+         *  @param aSender sender of message.
+         *  @param aRecipient recipient of message.
+         *  @param aData content data.
+         *  @return Instance to CIMCacheMessageBase
+         */
+        CIMCacheMessageBase* CreateCacheMessageL(const TDesC& aData );
+                                        
+                                        
+        /**
+         *  Find Index
+         *  @param aArray array
+         *  @param aRecipient recipient of message.
+         *  @param aServiceId service Id
+         */
+        TInt FindHeaderIndexL( RPointerArray<MIMCacheMessageHeader>& aArray, 
+								TInt aServiceId,
+		 						const TDesC& aBuddyId );
+	                               
+        
+    };
+
+#endif      // TIMCHACHEMESSAGEFACTORY_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/instantmessagingcache/imcacheserver/src/ccacheserveractivehelper.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,778 @@
+/*
+* 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:  active helper for server ,owns the main cache arrray 
+*
+*/
+
+ // INCLUDE FILES
+#include "ccacheserveractivehelper.h"
+
+#include "cimcachesession.h"
+#include <imcachedefs.h>
+#include "mimcachemessageheader.h"
+#include "cimcacheserver.h"
+#include "timcachemessagefactory.h"
+#include "cimcachemessageheader.h"
+#include "cimcachemessagebase.h"
+#include <ecom/ecom.h>
+ //logs
+#include "imcachedebugtrace.h"
+// ---------------------------------------------------------------------------
+// CCacheServerActiveHelper::NewL()
+// ---------------------------------------------------------------------------
+//
+CCacheServerActiveHelper* CCacheServerActiveHelper::NewL(CIMCacheServer& aServer)
+    {
+    TRACE( T_LIT( "CCacheServerActiveHelper::NewL begin") );
+    CCacheServerActiveHelper* self = new(ELeave) CCacheServerActiveHelper(aServer);
+    CleanupStack::PushL( self );
+    self->ConstructL( );
+    CleanupStack::Pop( self );
+    TRACE( T_LIT( "CCacheServerActiveHelper::NewL end") );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CCacheServerActiveHelper::~CCacheServerActiveHelper()
+// ---------------------------------------------------------------------------
+//
+CCacheServerActiveHelper::~CCacheServerActiveHelper( )
+    {
+    TRACE( T_LIT( "CCacheServerActiveHelper::~CCacheServerActiveHelper begin") );
+      
+    iHeaderArray.ResetAndDestroy();  
+    //all items are there in iHeaderArray so no need to call ResetAndDestroy
+    iPluginInfo.ResetAndDestroy();
+    iPluginInfo.Close();
+    TRACE( T_LIT( "CCacheServerActiveHelper::~CCacheServerActiveHelper end") );
+    }
+
+
+// ---------------------------------------------------------------------------
+// CCacheServerActiveHelper::CCacheServerActiveHelper()
+// ---------------------------------------------------------------------------
+//
+CCacheServerActiveHelper::CCacheServerActiveHelper(CIMCacheServer& aServer ) 
+                                                    :iServer(aServer )
+                                                      
+    {
+    TRACE( T_LIT( "CCacheServerActiveHelper::CCacheServerActiveHelper begin") );
+	TRACE( T_LIT( "CCacheServerActiveHelper::CCacheServerActiveHelper end") );
+    }
+
+// ---------------------------------------------------------------------------
+// CCacheServerActiveHelper::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void CCacheServerActiveHelper::ConstructL()
+    {
+    TRACE( T_LIT( "CCacheServerActiveHelper::ConstructL begin") );
+	iMessageFactory = new ( ELeave ) TIMCacheMessageFactory;
+	LoadPluginL( );
+	TRACE( T_LIT( "CCacheServerActiveHelper::ConstructL end") );
+    }
+ 
+// ---------------------------------------------------------------------------
+// CCacheServerActiveHelper::ResetHeaderInoformation()
+// ---------------------------------------------------------------------------
+//
+void CCacheServerActiveHelper::ResetHeaderInoformation()
+                                                      
+    {
+    TRACE( T_LIT( "CCacheServerActiveHelper::ResetHeaderInoformation begin") );
+    TInt count = iHeaderArray.Count() ;
+    for ( TInt i= 0; i< count; i++ )
+	    {
+	    MIMCacheMessageHeader* header = iHeaderArray[ i ];
+	    header->SetChatStarted(EFalse);
+	    }
+   	TRACE( T_LIT( "CCacheServerActiveHelper::ResetHeaderInoformation end") );
+    }
+// ---------------------------------------------------------
+// CCacheServerActiveHelper::GetUnreadMessageCountL
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+void CCacheServerActiveHelper::GetUnreadMessageCountL(const RMessage2& aMessage )
+	{
+	TRACE( T_LIT( "CCacheServerActiveHelper::GetUnreadMessageCountL	start") );
+		// at zero place service id was appended
+	TInt sericeId = aMessage.Int0();
+	
+	// at index 1 sender was appended
+	TInt bufferSize( aMessage.GetDesLength( 1 ) );
+	HBufC* buddyId = HBufC::NewLC( bufferSize );
+	TPtr buddyIdPtr = buddyId->Des();
+	aMessage.ReadL( 1, buddyIdPtr );
+
+	TInt headerIndex = iMessageFactory->FindHeaderIndexL(iHeaderArray, sericeId, buddyIdPtr );
+	TInt unreadCount = 0;
+	if( headerIndex != KErrNotFound ) //if match is found
+		{
+		MIMCacheMessageHeader* newHeader = iHeaderArray[ headerIndex ];
+		
+		unreadCount = newHeader->UnreadMessageCount();
+	
+		}
+	TPckgC<TInt> pack( unreadCount );
+   	aMessage.WriteL( 2, pack );
+   		
+    CleanupStack::PopAndDestroy(buddyId);
+    TRACE( T_LIT( "CCacheServerActiveHelper::GetUnreadMessageCountL	end") );
+	}
+// ---------------------------------------------------------
+// CCacheServerActiveHelper::GetAllUnreadMessageCountL
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+void CCacheServerActiveHelper::GetAllUnreadMessageCountL(const RMessage2& aMessage )
+	{
+	TRACE( T_LIT( "CCacheServerActiveHelper::GetAllUnreadMessageCountL	start") );
+		// at zero place service id was appended
+	TInt sericeId = aMessage.Int0();
+	
+	TInt unreadCount = 0;
+	
+	TInt headerCount = iHeaderArray.Count();
+	
+	for( TInt i=0; i< headerCount; i++ )
+		{
+		// note in this case reciepient is own user id 
+		MIMCacheMessageHeader* header = iHeaderArray[i];
+		if( header->ServiceId() == sericeId ) 	
+			{
+			unreadCount = unreadCount + header->UnreadMessageCount();	
+			}
+		}
+
+	TPckgC<TInt> pack( unreadCount );
+   	aMessage.WriteL( 1, pack );
+   		
+      
+    TRACE( T_LIT( "CCacheServerActiveHelper::GetAllUnreadMessageCountL	end") );
+	}
+// ---------------------------------------------------------
+// CCacheServerActiveHelper::StartNewConversationL
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+void CCacheServerActiveHelper::StartNewConversationL( const RMessage2& aMessage )
+	{
+	TRACE( T_LIT( "CCacheServerActiveHelper::StartNewConversationL	start") );
+	// at zero place service id was appended
+	TInt sericeId = aMessage.Int0();
+	
+	// at index 1 sender was appended
+	TInt bufferSize( aMessage.GetDesLength( 1 ) );
+	HBufC* buddyId = HBufC::NewLC( bufferSize );
+	TPtr buddyIdPtr = buddyId->Des();
+	aMessage.ReadL( 1, buddyIdPtr );
+	
+	TInt messageCount = 0;
+	
+	MIMCacheMessageHeader* chatHeader = ChatHeaderL( sericeId, buddyIdPtr );
+	
+	if( chatHeader == NULL ) //if match is not found
+		{
+		TRACE( T_LIT( "CCacheServerActiveHelper::StartNewConversationL	Fresh conversation") );
+		chatHeader = iMessageFactory->CreateIMCacheMessageHeaderL(sericeId, buddyIdPtr );
+		// insert always on top
+		iHeaderArray.InsertL(chatHeader , 0);
+		
+		iActiveHeader = chatHeader;
+		
+		chatHeader->SetChatStarted(ETrue);
+		
+		PackAndNotifyEventL( EIMOperationChatStarted, sericeId, iActiveHeader , NULL );	
+		}
+	else  if( !chatHeader->IsChatStarted() ) //if match is found
+		{
+		TRACE( T_LIT( "CCacheServerActiveHelper::StartNewConversationL	existing conversation") );
+		
+		chatHeader->SetChatStarted(ETrue);
+		
+		iActiveHeader = chatHeader ;
+		
+		iActiveHeader->MarkAllRead();
+		
+		messageCount = iActiveHeader->MessageCount();
+
+		if( messageCount ) 
+			{
+			PackAndNotifyEventL(EIMOperationFetchAll, sericeId, iActiveHeader, NULL );
+			// still fetching is not completed, until EIMOperationCompleted 
+			}
+		TRACE( T_LIT( "CCacheServerActiveHelper::StartNewConversationL start fetching") );
+		}
+	else
+		{
+		iActiveHeader = chatHeader;
+		
+		iActiveHeader->MarkAllRead();
+		
+		PackAndNotifyEventL(EIMOperationUnreadChange, sericeId, iActiveHeader , NULL );
+		// once request is completed, mark as fetch completed
+		}
+	// if there are no unread messages then reset the status pane indicator.
+	TInt unreadCount = 0;
+	TInt currentContactUnReadCount = 0;
+    TInt headerCount = iHeaderArray.Count();
+    TInt id = 0;
+    for( TInt i=0; i< headerCount; i++ )
+        {
+        // note in this case reciepient is own user id 
+        MIMCacheMessageHeader* header = iHeaderArray[i];
+        if( header->ServiceId() == sericeId )   
+            {
+			if(buddyId->Compare(iHeaderArray[i]->BuddyId()) == 0)
+				{
+				currentContactUnReadCount = header->UnreadMessageCount();
+				}
+            if(header->UnreadMessageCount()) 
+               	{
+				id = i;
+            	}
+            
+            }
+        }
+    
+    if(!currentContactUnReadCount)
+        {
+		PublishMessageInfoL(iHeaderArray[id]->BuddyId(),sericeId);
+        }
+    
+	CleanupStack::PopAndDestroy(buddyId);
+	
+    TRACE( T_LIT( "CCacheServerActiveHelper::StartNewConversationL	end") );
+	}
+
+
+// ---------------------------------------------------------
+// CCacheServerActiveHelper::AppendReceiveMessageL
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+void CCacheServerActiveHelper::AppendReceiveMessageL( const RMessage2 &aMessage )
+	{
+	TRACE( T_LIT( "CCacheServerActiveHelper::AppendReceiveMessageL	start") );
+	// at zero pace service id was apended
+	TInt sericeId = aMessage.Int0();
+	
+	// at index 1 sender was appended
+	TInt bufferSize( aMessage.GetDesLength( 1 ) );
+	HBufC* buddyId = HBufC::NewLC( bufferSize );
+	TPtr buddyIdPtr = buddyId->Des();
+	aMessage.ReadL( 1, buddyIdPtr );
+	
+	// at index 2 text was appended
+	bufferSize = aMessage.GetDesLength( 2 ) ;
+	HBufC* text = HBufC::NewLC( bufferSize );
+	TPtr textPtr = text->Des();
+	aMessage.ReadL( 2, textPtr );
+	
+	TRACE( T_LIT( "CCacheServerActiveHelper::AppendReceiveMessageL Msg %S"), &textPtr );
+	
+	MIMCacheMessageHeader* chatHeader = ChatHeaderL( sericeId, buddyIdPtr );
+	
+	CIMCacheMessageBase* newmessage = NULL;
+	      
+	if( chatHeader == NULL ) //if match is not found
+		{
+		TRACE( T_LIT( "CCacheServerActiveHelper::AppendReceiveMessageL	Fresh conversation") );
+		chatHeader = iMessageFactory->CreateIMCacheMessageHeaderL(sericeId, buddyIdPtr);
+		// insert always on top
+		iHeaderArray.InsertL(chatHeader , 0);
+		
+		newmessage = iMessageFactory->CreateCacheMessageL( textPtr );
+		newmessage->SetMessageType( EIMCMessagePTOP );
+		newmessage->SetMessagerType( EIMCMessageReceived );
+		
+		chatHeader->AppendMessageL(newmessage);
+		
+		PublishMessageInfoL(*buddyId,sericeId);
+		
+		// no notification so for this is for servicetab
+		// here need to notify for all session
+		// fresh conversation started
+				
+		PackAndNotifyEventL( EIMOperationChatAdded,	sericeId, chatHeader ,newmessage );		
+	
+		}
+	else  // chat found
+		{
+		TRACE( T_LIT( "CCacheServerActiveHelper::AppendReceiveMessageL	existing conversation") );
+		// this is called from network side 
+		// here we dont know about ui client wheather this active conversation is active or not. 
+			
+		newmessage = iMessageFactory->CreateCacheMessageL( textPtr );
+		newmessage->SetMessageType( EIMCMessagePTOP );
+		newmessage->SetMessagerType( EIMCMessageReceived );
+		chatHeader->AppendMessageL(newmessage);
+	
+		// notify all registeed session about this changed
+		// this has happened on active conversation
+				
+		if( chatHeader == iActiveHeader )
+			{
+			//cv tab is active notify it.
+			PackAndNotifyEventL( EIMOperationMessageAdded, sericeId, chatHeader, newmessage );
+			}
+		else 
+			{
+			PublishMessageInfoL(*buddyId,sericeId);
+			//cv tab is not active notify it.
+			PackAndNotifyEventL( EIMOperationUnreadMessage, sericeId, chatHeader , newmessage );	
+			}
+		}	
+	CleanupStack::PopAndDestroy(2);//text,buddyId
+	//	else TODO mark unread messagesinto buffer
+	TRACE( T_LIT( "CCacheServerActiveHelper::AppendReceiveMessageL	end") );
+	}
+// ---------------------------------------------------------
+// CCacheServerActiveHelper::AppendSendMessageL
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+void CCacheServerActiveHelper::AppendSendMessageL( const RMessage2 &aMessage )
+	{
+	TRACE( T_LIT( "CCacheServerActiveHelper::AppendSendMessageL	start") );
+	
+	// at index 0 text was appended
+	TInt bufferSize = aMessage.GetDesLength( 0 ) ;
+	HBufC* text = HBufC::NewLC( bufferSize );
+	TPtr textPtr = text->Des();
+	aMessage.ReadL( 0, textPtr );
+	
+	TRACE( T_LIT( "CCacheServerActiveHelper::AppendSendMessageL Msg %S"), &textPtr );
+	
+	if( iActiveHeader )
+		{
+		CIMCacheMessageBase* message = iMessageFactory->CreateCacheMessageL( textPtr );
+		message->SetMessageType( EIMCMessagePTOP );
+		message->SetMessagerType( EIMCMessageSent );
+		message->SetRead();	
+		
+		iActiveHeader->AppendMessageL(message);
+		}
+	CleanupStack::PopAndDestroy(text); // text
+	
+	TRACE( T_LIT( "CCacheServerActiveHelper::AppendSendMessageL	end") );
+	}
+
+// ---------------------------------------------------------
+// CCacheServerActiveHelper::AppendMessageL
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+void CCacheServerActiveHelper::AppendMessageL( const RMessage2 &aMessage )
+	{
+	TRACE( T_LIT( "CCacheServerActiveHelper::AppendMessageL	start") );
+	// this is get called from active conversation only.
+	// this append the normal information message , 
+	// please note, this is not sent/recieved message
+	// at 0 place text was appended
+	// this is get called from conversation only system emssage
+	// will get addded when buddy presence changes.
+	TInt sericeId = aMessage.Int0();
+	
+	// at index 1 sender was appended
+	TInt bufferSize( aMessage.GetDesLength( 1 ) );
+	HBufC* buddyId = HBufC::NewLC( bufferSize );
+	TPtr buddyIdPtr = buddyId->Des();
+	aMessage.ReadL( 1, buddyIdPtr );
+	
+	// at index 2 text was appended
+	bufferSize = aMessage.GetDesLength( 2 ) ;
+	HBufC* text = HBufC::NewLC( bufferSize );
+	TPtr textPtr = text->Des();
+	aMessage.ReadL( 2, textPtr );
+	
+	TRACE( T_LIT( "CCacheServerActiveHelper::AppendSendMessageL Msg %S"), &textPtr );
+	
+	MIMCacheMessageHeader* chatHeader = ChatHeaderL( sericeId, buddyIdPtr );
+	
+	if( chatHeader != NULL )
+		{
+		CIMCacheMessageBase* message = iMessageFactory->CreateCacheMessageL( textPtr );
+		message->SetMessageType( EIMCMessageSystem );
+		message->SetMessagerType( EIMCMessageOther );
+		message->SetRead();		
+		chatHeader->AppendMessageL(message);
+		}
+	CleanupStack::PopAndDestroy(2); //buddyId, text
+	
+	TRACE( T_LIT( "CCacheServerActiveHelper::AppendMessageL	end") );
+	}
+// ---------------------------------------------------------
+// CCacheServerActiveHelper::CloseConversationL
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+void CCacheServerActiveHelper::CloseConversationL( const RMessage2 &aMessage )
+    {
+    TRACE( T_LIT( "CCacheServerActiveHelper::CloseConversationL  start") );
+    // at zero pace service id was apended
+    TInt sericeId = aMessage.Int0();
+    
+    // at index 1 sender was appended
+    TInt bufferSize( aMessage.GetDesLength( 1 ) );
+    HBufC* buddyId = HBufC::NewLC( bufferSize );
+    TPtr buddyIdPtr = buddyId->Des();
+    aMessage.ReadL( 1, buddyIdPtr );
+
+    TInt headerIndex = iMessageFactory->FindHeaderIndexL(iHeaderArray, sericeId, buddyIdPtr ) ;
+       
+    if( headerIndex != KErrNotFound ) //if match is found
+        {
+        MIMCacheMessageHeader* msgHeader = iHeaderArray[headerIndex];
+        iHeaderArray.Remove(headerIndex);
+        if(msgHeader == iActiveHeader)
+            {
+            iActiveHeader = NULL;
+            }
+        // remove the universal indicator notification if there are no more unread messages,
+        // apart form whose conversation is closed. loop through
+        TInt headerCount = iHeaderArray.Count();
+        headerIndex = KErrNotFound;
+        for( TInt i=0; i<  headerCount; i++ )
+            {
+            // note in this case reciepient is own user id 
+            MIMCacheMessageHeader* header = iHeaderArray[i];
+            TRACE(T_LIT( "CCacheServerActiveHelper::PublishMessageInfoL UnreadMessageCount -- %d"), header->UnreadMessageCount());
+            if(  header->ServiceId() == sericeId && header->UnreadMessageCount() )   
+                {
+                // this is required in the following scenario
+                // you receive 10 new messgaes form two parties(5, each)
+                // whne you close the conversation form one, the universal indicator is still 
+                // for the other party's messages, and when clicked on universal indicator it should
+                // open the conversation view wiht the latest user id.
+                headerIndex = i;
+                }
+            }
+        // there are new messages received form only one party.
+        // hence the buddyid is required as conversation view will be openend.
+        if(KErrNone == headerIndex)
+            {
+            PublishMessageInfoL(iHeaderArray[headerIndex]->BuddyId(), sericeId, ETrue);
+            }
+        // new messages are recieved from multiple parties, hence no need of the sender id
+        // as the service tab will be opened.
+        else
+            {
+            PublishMessageInfoL(KNullDesC(), sericeId,ETrue);
+            }
+		PackAndNotifyEventL( EIMOperationChatDeleted, sericeId, msgHeader, NULL ); 
+		 
+        delete msgHeader;
+        iHeaderArray.Compress();  
+       		      
+        }  
+     CleanupStack::PopAndDestroy(buddyId); // buddyId
+     
+    TRACE( T_LIT( "CCacheServerActiveHelper::CloseConversationL  end") );
+    }
+// ---------------------------------------------------------
+// CCacheServerActiveHelper::CloseAllConversationL
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+void CCacheServerActiveHelper::CloseAllConversationL( TInt aServiceId )
+    {
+    TRACE( T_LIT( "CCacheServerActiveHelper::CloseAllConversationL  start") );
+    TBool needToNotify = EFalse;
+    for( TInt index=0; index<iHeaderArray.Count();index++ )
+        {
+        MIMCacheMessageHeader* msgHeader = iHeaderArray[index];
+        if( msgHeader->ServiceId() == aServiceId )
+            {
+            iHeaderArray.Remove(index);
+            if(msgHeader == iActiveHeader)
+                {
+                iActiveHeader = NULL;
+                }
+            delete msgHeader;
+            msgHeader = NULL;
+            iHeaderArray.Compress();
+            index = index-1;// start from same index again
+            needToNotify = ETrue;
+            }
+        }
+    if( needToNotify )
+        {
+        // remove the universal indicator notification if there it was displayed,
+        // as when you logout all the ocnversations are removed.
+        PublishMessageInfoL(KNullDesC(), aServiceId, ETrue);
+        
+        PackAndNotifyEventL( EIMOperationAllChatDeleted, aServiceId, NULL, NULL ); 
+        }
+    TRACE( T_LIT( "CCacheServerActiveHelper::CloseAllConversationL  End") );
+    }
+// ---------------------------------------------------------
+// CCacheServerActiveHelper::DeactivateConversationL
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+void CCacheServerActiveHelper::DeactivateConversationL()
+	{
+	TRACE( T_LIT( "CCacheServerActiveHelper::DeactivateConversationL	start") );
+	// this is get called from active conversation only.
+	if( iActiveHeader )
+		{
+		iActiveHeader->MarkAllRead();	
+		}
+	iActiveHeader = NULL;
+	TRACE( T_LIT( "CCacheServerActiveHelper::DeactivateConversationL	end") );
+	}
+
+// ---------------------------------------------------------
+// CCacheServerActiveHelper::CheckConversationExistL
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+void CCacheServerActiveHelper::CheckConversationExistL( const RMessage2& aMessage )
+	{
+	TRACE( T_LIT( "CCacheServerActiveHelper::CheckConversationExistL	start") );
+	// at zero place service id was appended
+	TInt sericeId = aMessage.Int0();
+	
+	// at index 1 sender was appended
+	TInt bufferSize( aMessage.GetDesLength( 1 ) );
+	HBufC* buddyId = HBufC::NewLC( bufferSize );
+	TPtr buddyIdPtr = buddyId->Des();
+	aMessage.ReadL( 1, buddyIdPtr );
+	
+	TInt headerIndex = iMessageFactory->FindHeaderIndexL(iHeaderArray, sericeId, buddyIdPtr ) ;
+	
+	TBool conversationExist = EFalse;
+	
+	if( headerIndex != KErrNotFound ) //if match is found
+		{
+	    conversationExist = ETrue;
+		}
+	TPckgC<TBool> pack( conversationExist );
+   	aMessage.WriteL(2, pack );
+    		
+	CleanupStack::PopAndDestroy(buddyId); // buddyId
+    
+    TRACE( T_LIT( "CCacheServerActiveHelper::CheckConversationExistL	end") );
+	}
+
+// ---------------------------------------------------------
+// CCacheServerActiveHelper::PackAndNotifyEventL
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+void CCacheServerActiveHelper::PackAndNotifyEventL( TIMCacheOperationsCode aNotification, 
+                                                    TInt aServiceId,
+												    MIMCacheMessageHeader* aChatHeader /*=NULL*/, 
+												    CIMCacheMessageBase* aMessage /*=NULL*/)	
+	{
+	TRACE( T_LIT( "CCacheServerActiveHelper::PackAndNotifyEventL	start") );
+	
+	iServer.PackAndNotifyEventL( aNotification, aServiceId, aChatHeader, aMessage );
+	 
+	TRACE( T_LIT( "CCacheServerActiveHelper::PackAndNotifyEventL	end") );
+	}
+	
+   
+// ---------------------------------------------------------
+// CCacheServerActiveHelper::GetServiceChatHeaderArrayL
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+void CCacheServerActiveHelper::GetServiceChatHeaderArrayL(TInt aServiceId , RPointerArray<MIMCacheMessageHeader>& aServiceHeaderArray)
+	{
+	TRACE( T_LIT( "CCacheServerActiveHelper::GetServiceChatHeaderArrayL	start") );		
+	
+	CleanupClosePushL(aServiceHeaderArray);
+   
+    if( -1 == aServiceId )
+        {
+        aServiceHeaderArray = iHeaderArray;        
+        }
+    else
+        {
+        for( TInt i= 0 ; i < iHeaderArray.Count() ; i++ )
+            {
+            MIMCacheMessageHeader* header = iHeaderArray[i];
+            if( header->ServiceId() == aServiceId )
+                {
+                aServiceHeaderArray.AppendL(header);
+                }
+            }        
+        }
+    CleanupStack::Pop(&aServiceHeaderArray);
+    TRACE( T_LIT( "CCacheServerActiveHelper::GetServiceChatHeaderArrayL    end") );
+	}
+
+// ---------------------------------------------------------
+// CCacheServerActiveHelper::ChatHeaderL
+// (other items were commented in a header).
+// ---------------------------------------------------------
+MIMCacheMessageHeader* CCacheServerActiveHelper::ChatHeaderL(const TInt& aServiceId, const TDesC& aBuddyId )
+    {
+    MIMCacheMessageHeader* header = NULL;
+    TInt headerCount = iHeaderArray.Count();
+    
+    for( TInt index = 0 ; index < headerCount ; index++ )
+        {
+        header = iHeaderArray[index];
+        if( header )
+            {
+            if( ( aServiceId == header->ServiceId() ) && ( aBuddyId.CompareC( header->BuddyId() ) == 0 ) )  
+                {
+                break;   
+                }                
+            }
+        header = NULL;
+        }
+    return header;
+    }
+// -----------------------------------------------------------------------------
+// CCacheServerActiveHelper::ChatHeaderAt
+// name of history data
+// -----------------------------------------------------------------------------
+//
+MIMCacheMessageHeader* CCacheServerActiveHelper::ChatHeaderAt( TInt aIndex ) 
+	{
+	if( aIndex >= ChatHeadersCount() )
+		{
+		return NULL;	
+		}
+	return iHeaderArray[aIndex];
+	}
+	
+// -----------------------------------------------------------------------------
+// CCacheServerActiveHelper::ChatHeadersCount
+// name of history data
+// -----------------------------------------------------------------------------
+//
+TInt CCacheServerActiveHelper::ChatHeadersCount() 
+	{
+	return iHeaderArray.Count();
+	}
+
+
+// -----------------------------------------------------------------------------
+// CCacheServerActiveHelper::PublishMessageInfoL()
+// name of history data
+// -----------------------------------------------------------------------------
+//
+void  CCacheServerActiveHelper::PublishMessageInfoL(const TDesC& aSenderId,TInt aServiceId, 
+                                                    TBool aCloseConversation /*= EFalse*/ )
+    {
+    // set/reset  the status pane indicator here
+    // based on the unread count.
+    // as we need to show the indicator only for the received messages
+    TInt unreadCount = 0;
+    TInt multipleSender = 0;
+    TInt headerCount = iHeaderArray.Count();
+    TRACE(T_LIT( "CCacheServerActiveHelper::PublishMessageInfoL headerCount -- %d"), headerCount);
+    for( TInt i=0; i< headerCount; i++ )
+        {
+        // note in this case reciepient is own user id 
+        MIMCacheMessageHeader* header = iHeaderArray[i];
+        TRACE(T_LIT( "CCacheServerActiveHelper::PublishMessageInfoL UnreadMessageCount -- %d"), header->UnreadMessageCount());
+        if( header->ServiceId() == aServiceId  && header->UnreadMessageCount() )   
+            {
+            unreadCount = unreadCount + header->UnreadMessageCount();  
+	        multipleSender ++; 
+            }
+        }
+    TRACE(T_LIT( "CCacheServerActiveHelper::PublishMessageInfoL   multipleSender -- %d"), multipleSender);
+    // Get the number of  plugins
+    const TInt count = iPluginInfo.Count();
+    // Loop though all the command handlers, If DynInitMenuPaneL leaves for one plugin, a plugin
+    // error message will be displayed and the loop will continue with
+    // the next command handler. If none of the plugins leave, there will
+    // be only one TRAP used.
+    for ( TInt index = 0; index < count; ++index )
+        {
+        //trap is required if one plugin leaves then it should continue with other plugins.
+        TRAP_IGNORE(iPluginInfo[index]->Plugin().MessageInfoL(unreadCount,aServiceId,aSenderId,multipleSender,aCloseConversation));
+        }
+    }
+ // -----------------------------------------------------------------------------
+ // CCacheServerActiveHelper::LoadPluginL
+ // -----------------------------------------------------------------------------
+ //
+ void CCacheServerActiveHelper::LoadPluginL( )
+     {
+     // plugininfo array, Owned
+     RImplInfoPtrArray pluginInfo;
+     iPluginInfo.ResetAndDestroy();
+     REComSession::ListImplementationsL( KINSTANTMSGINTERFACEUID,pluginInfo );
+     TInt pluginCount = pluginInfo.Count();
+     for ( TInt pluginIndex(0); pluginIndex < pluginCount; ++pluginIndex )
+         {
+         TUid pluginUid = pluginInfo[pluginIndex]->ImplementationUid();
+         // Creates the plugin and transfers ownership of the services
+         // object to the plugin.
+         CInstantMsgIndicator* plugin = NULL;
+         TRAPD(error, plugin = CInstantMsgIndicator::CreateImplementationL( pluginUid ));
+         
+         if(KErrNone != error)
+             {
+             // handle the error here.
+             // error loading the plugin
+             }
+         else
+             {
+             // plugin loaded sucessfully 
+             //if its here its sure that plugin is not null;
+             //add the plugin to the array
+             CPluginInfo* newPlugin = new ( ELeave ) CCacheServerActiveHelper::CPluginInfo( plugin, pluginUid);    
+             CleanupStack::PushL( newPlugin );
+             iPluginInfo.AppendL( newPlugin );
+             CleanupStack::Pop( newPlugin );
+            
+            }
+         
+         }
+     pluginInfo.ResetAndDestroy();
+     pluginInfo.Close();
+     }
+ // ----------------------------------------------------------------------------
+ // CCacheServerActiveHelper::CPluginInfo::CPluginInfo(
+ // C++ constructor
+ // (other items were commented in a header).
+ // ----------------------------------------------------------------------------
+ //
+ CCacheServerActiveHelper::CPluginInfo::CPluginInfo( 
+         CInstantMsgIndicator* aPlugin,
+                                     TUid aPluginUid )
+     : iPlugin( aPlugin ),
+       iPluginUid( aPluginUid )
+     {
+
+     }
+ // ----------------------------------------------------------------------------
+ // CCacheServerActiveHelper::CPluginInfo::~CPluginInfo(
+ // C++ destructor
+ // (other items were commented in a header).
+ // ----------------------------------------------------------------------------
+ //
+ CCacheServerActiveHelper::CPluginInfo::~CPluginInfo() 
+     {
+      delete iPlugin;
+     }
+ // -----------------------------------------------------------------------------
+ // CCacheServerActiveHelper::LoadPluginL
+ // -----------------------------------------------------------------------------
+ //
+ CInstantMsgIndicator& CCacheServerActiveHelper::CPluginInfo::Plugin()
+     {
+      return *iPlugin;
+     }   
+/// end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/instantmessagingcache/imcacheserver/src/cimcachebufferarray.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,91 @@
+/*
+* 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:  a message class implementation 
+*
+*/
+
+
+#include "cimcachebufferarray.h"
+ //logs
+#include "imcachedebugtrace.h"
+
+	
+//-----------------------------------------------------------------------------
+// CIMCacheBufferArray::NewL
+// ( Other items commented in header )
+//-----------------------------------------------------------------------------
+CIMCacheBufferArray* CIMCacheBufferArray::NewL(const TDesC8& aPacketBuffer , TIMCacheOperationsCode aOperationCode )
+	{
+	TRACE( T_LIT( "CIMCacheBufferArray::NewL begin") );
+	CIMCacheBufferArray* self = new ( ELeave ) CIMCacheBufferArray( aOperationCode );
+	CleanupStack::PushL( self );
+	self->ConstructL( aPacketBuffer );
+	CleanupStack::Pop( self );
+	TRACE( T_LIT( "CIMCacheBufferArray::NewL end") );
+	return self;
+	}
+//-----------------------------------------------------------------------------
+// CIMCacheBufferArray::CIMCacheBufferArray
+// ( Other items commented in header )
+//-----------------------------------------------------------------------------
+CIMCacheBufferArray::CIMCacheBufferArray( TIMCacheOperationsCode aOperationCode )
+	:iOperationCode ( aOperationCode )
+	{
+	TRACE( T_LIT( "CIMCacheBufferArray::CIMCacheBufferArray") );
+	}
+
+	
+//-----------------------------------------------------------------------------
+// CIMCacheBufferArray::ConstructL
+// ( Other items commented in header )
+//-----------------------------------------------------------------------------
+void CIMCacheBufferArray::ConstructL( const TDesC8& aPacketBuffer )
+    {
+    TRACE( T_LIT( "CIMCacheBufferArray::NewL start") );
+    iPacketBuffer = aPacketBuffer.AllocL();
+    TRACE( T_LIT( "CIMCacheBufferArray::NewL end") );
+    }
+	
+//-----------------------------------------------------------------------------
+// CIMCacheBufferArray::OperationCode
+// ( Other items commented in header )
+//-----------------------------------------------------------------------------
+TIMCacheOperationsCode CIMCacheBufferArray::OperationCode()
+    {
+    TRACE( T_LIT( "CIMCacheBufferArray::OperationCode") );
+   	return iOperationCode;
+    }
+    
+ //-----------------------------------------------------------------------------
+// CIMCacheBufferArray::PacketData
+// ( Other items commented in header )
+//-----------------------------------------------------------------------------
+const TDesC8& CIMCacheBufferArray::PacketData()
+    {
+    TRACE( T_LIT( "CIMCacheBufferArray::PacketData") );
+   	return *iPacketBuffer;
+    }
+//-----------------------------------------------------------------------------
+// CIMCacheBufferArray::~CIMCacheBufferArray
+// ( Other items commented in header )
+//-----------------------------------------------------------------------------
+CIMCacheBufferArray::~CIMCacheBufferArray()
+	{
+	TRACE( T_LIT( "CIMCacheBufferArray::~CIMCacheBufferArray start") );
+	delete iPacketBuffer;	
+	TRACE( T_LIT( "CIMCacheBufferArray::~CIMCacheBufferArray end") );
+	}
+
+    
+// end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/instantmessagingcache/imcacheserver/src/cimcachemessagebase.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,172 @@
+/*
+* 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:  a message class implementation 
+*
+*/
+
+
+#include "cimcachemessagebase.h"
+ //logs
+#include "imcachedebugtrace.h"
+
+	
+//-----------------------------------------------------------------------------
+// CIMCacheMessageBase::NewL
+// ( Other items commented in header )
+//-----------------------------------------------------------------------------
+CIMCacheMessageBase* CIMCacheMessageBase::NewL( 
+                                        const TDesC& aData )
+	{
+	TRACE( T_LIT( "CIMCacheMessageBase::NewL begin") );
+	CIMCacheMessageBase* self = new ( ELeave ) CIMCacheMessageBase();
+	CleanupStack::PushL( self );
+	self->ConstructL(aData );
+	CleanupStack::Pop( self );
+	TRACE( T_LIT( "CIMCacheMessageBase::NewL end") );
+	return self;
+	}
+//-----------------------------------------------------------------------------
+// CIMCacheMessageBase::CIMCacheMessageBase
+// ( Other items commented in header )
+//-----------------------------------------------------------------------------
+CIMCacheMessageBase::CIMCacheMessageBase()
+	{
+	TRACE( T_LIT( "CIMCacheMessageBase::CIMCacheMessageBase") );
+	}
+	
+	
+//-----------------------------------------------------------------------------
+// CIMCacheMessageBase::ConstructL
+// ( Other items commented in header )
+//-----------------------------------------------------------------------------
+void CIMCacheMessageBase::ConstructL(const TDesC& aData  )
+    {
+    TRACE( T_LIT( "CIMCacheMessageBase::NewL start") );
+    iText =  aData.AllocL(); 
+    iMessagerType = EIMCMessageOther;
+    iTime.HomeTime();
+    iMessageType = EIMCMessagePTOP;
+    iUnread = ETrue;
+    TRACE( T_LIT( "CIMCacheMessageBase::NewL end") );
+    }
+
+//-----------------------------------------------------------------------------
+// CIMCacheMessageBase::~CIMCacheMessageBase
+// ( Other items commented in header )
+//-----------------------------------------------------------------------------
+CIMCacheMessageBase::~CIMCacheMessageBase()
+	{
+	TRACE( T_LIT( "CIMCacheMessageBase::~CIMCacheMessageBase start") );
+	delete iText;	
+	TRACE( T_LIT( "CIMCacheMessageBase::~CIMCacheMessageBase end") );
+	}
+	
+//-----------------------------------------------------------------------------
+// CIMCacheMessageBase::TimeStamp
+// ( Other items commented in header )
+//-----------------------------------------------------------------------------
+const TTime& CIMCacheMessageBase::TimeStamp() const
+	{
+	return iTime;
+	}
+
+//-----------------------------------------------------------------------------
+// CIMCacheMessageBase::MessageType
+// ( Other items commented in header )
+//-----------------------------------------------------------------------------	
+TIMCacheMessageType CIMCacheMessageBase::MessageType() const
+	{
+	return iMessageType;
+	}
+
+//-----------------------------------------------------------------------------
+// CIMCacheMessageBase::MessagerType
+// ( Other items commented in header )
+//-----------------------------------------------------------------------------	
+TIMCacheMessagerType CIMCacheMessageBase::MessagerType() const
+	{
+	return iMessagerType;
+	}
+
+
+//-----------------------------------------------------------------------------
+// CIMCacheMessageBase::Text
+// ( Other items commented in header )
+//-----------------------------------------------------------------------------	
+const TDesC& CIMCacheMessageBase::Text() const
+    {
+    TRACE( T_LIT( "CIMCacheMessageBase::Text start") );
+    if( iText )
+        {
+        return *iText;
+        }
+    TRACE( T_LIT( "CIMCacheMessageBase::Text end") );
+    return KNullDesC;
+    }
+      
+//-----------------------------------------------------------------------------
+// CIMCacheMessageBase::SetRead
+// ( Other items commented in header )
+//-----------------------------------------------------------------------------	
+void CIMCacheMessageBase::SetRead() 
+    {
+    TRACE( T_LIT( "CIMCacheMessageBase::SetUnread start") );
+    iUnread = EFalse;
+    TRACE( T_LIT( "CIMCacheMessageBase::SetUnread end") );
+    
+    }
+
+//-----------------------------------------------------------------------------
+// CIMCacheMessageBase::IsUnread
+// ( Other items commented in header )
+//-----------------------------------------------------------------------------	
+TBool CIMCacheMessageBase::IsUnread() const
+    {
+    TRACE( T_LIT( "CIMCacheMessageBase::IsUnread ") );
+    return iUnread;
+   
+    }     
+// -----------------------------------------------------------------------------
+// CIMCacheMessageBase::SetMessageType
+// -----------------------------------------------------------------------------
+//
+void CIMCacheMessageBase::SetMessageType( TIMCacheMessageType aNewType )
+    {
+    TRACE( T_LIT( "CIMCacheMessageBase::SetMessageType start") );
+    iMessageType = aNewType;
+    TRACE( T_LIT( "CIMCacheMessageBase::SetMessageType end") );
+    }
+
+// -----------------------------------------------------------------------------
+// CIMCacheMessageBase::SetMessagerType
+// -----------------------------------------------------------------------------
+//
+void CIMCacheMessageBase::SetMessagerType( TIMCacheMessagerType aNewType )
+    {
+    TRACE( T_LIT( "CIMCacheMessageBase::SetMessagerType start") );
+    iMessagerType = aNewType;
+    TRACE( T_LIT( "CIMCacheMessageBase::SetMessagerType end") );
+    }
+
+ //-----------------------------------------------------------------------------
+// CIMCacheMessageBase::ContentType
+// ( Other items commented in header )
+//-----------------------------------------------------------------------------	
+TIMCacheContentType CIMCacheMessageBase::ContentType() const
+	{
+	return EIMCContentText;
+	}   
+
+    
+// end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/instantmessagingcache/imcacheserver/src/cimcachemessageheader.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,199 @@
+/*
+* 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:  implementation of header of all convesation
+*
+*/
+
+
+//  Include Files
+
+#include "cimcachemessageheader.h"
+
+#include "cimcachemessagebase.h"
+ //logs
+#include "imcachedebugtrace.h"
+
+
+// CONSTRUCTION
+// -----------------------------------------------------------------------------
+// CIMCacheMessageHeader::NewL
+// Static constructor
+// -----------------------------------------------------------------------------
+//
+CIMCacheMessageHeader* CIMCacheMessageHeader::NewL(TInt aServiceId, const TDesC& aBuddyId )
+    {
+    TRACE( T_LIT( "CIMCacheMessageHeader::NewL begin") );
+    CIMCacheMessageHeader* self = new (ELeave) CIMCacheMessageHeader;
+    CleanupStack::PushL(self);
+    self->ConstructL( aServiceId, aBuddyId );
+	CleanupStack::Pop();
+	TRACE( T_LIT( "CIMCacheMessageHeader::NewL end") );
+    return self;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CIMCacheMessageHeader::~CIMCacheMessageHeader
+// Destructor (virtual by CBase)
+// -----------------------------------------------------------------------------
+//
+CIMCacheMessageHeader::~CIMCacheMessageHeader()
+    {
+    TRACE( T_LIT( "CIMCacheMessageHeader::~CIMCacheMessageHeader begin") );
+	delete iBuddyId;
+	iMessageArray.ResetAndDestroy() ; // all messages
+	TRACE( T_LIT( "CIMCacheMessageHeader::~CIMCacheMessageHeader end") );
+    }
+
+// -----------------------------------------------------------------------------
+// CIMCacheMessageHeader::ConstructL
+// Second phase construct
+// -----------------------------------------------------------------------------
+//
+void CIMCacheMessageHeader::ConstructL(TInt aServiceId, const TDesC& aBuddyId )
+    {
+    TRACE( T_LIT( "CIMCacheMessageHeader::ConstructL begin") );
+	iServiceId = aServiceId;
+	iBuddyId   = aBuddyId.AllocL();
+    TRACE( T_LIT( "CIMCacheMessageHeader::ConstructL end") );
+    }
+
+// -----------------------------------------------------------------------------
+// CIMCacheMessageHeader::CIMCacheMessageHeader
+// Constructor
+// -----------------------------------------------------------------------------
+//
+CIMCacheMessageHeader::CIMCacheMessageHeader():
+    iChatStarted( EFalse)
+    {
+    TRACE( T_LIT( "CIMCacheMessageHeader::CIMCacheMessageHeader") );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CIMCacheMessageHeader::Recipient
+// name of history data
+// -----------------------------------------------------------------------------
+//
+const TDesC& CIMCacheMessageHeader::BuddyId() const
+	{
+	TRACE( T_LIT( "CIMCacheMessageHeader::Recipient begin") );
+	if( iBuddyId )
+        {
+        return *iBuddyId;
+        }
+    TRACE( T_LIT( "CIMCacheMessageHeader::Recipient end") );
+    return KNullDesC;
+	
+	}
+
+// -----------------------------------------------------------------------------
+// CIMCacheMessageHeader::ServiceId
+// name of history data
+// -----------------------------------------------------------------------------
+//
+ TInt CIMCacheMessageHeader::ServiceId() const
+	{
+	return iServiceId;
+	}
+	
+// -----------------------------------------------------------------------------
+// CIMCacheMessageHeader::MessageCount
+// name of history data
+// -----------------------------------------------------------------------------
+//
+ TInt CIMCacheMessageHeader::MessageCount() const
+	{
+	return iMessageArray.Count();
+	}
+// -----------------------------------------------------------------------------
+// CIMCacheMessageHeader::GetMessage
+// name of history data
+// -----------------------------------------------------------------------------
+//
+ CIMCacheMessageBase* CIMCacheMessageHeader::GetMessage(TInt aIndex ) 
+	{
+	return iMessageArray[aIndex];
+	}
+
+// -----------------------------------------------------------------------------
+// CIMCacheMessageHeader::AppendMessageL
+// name of history data
+// -----------------------------------------------------------------------------
+//
+void CIMCacheMessageHeader::AppendMessageL(CIMCacheMessageBase* aMessge) 
+	{
+	TRACE( T_LIT( "CIMCacheMessageHeader::AppendMessageL begin") );
+
+    iMessageArray.AppendL( aMessge );
+   	
+	TRACE( T_LIT( "CIMCacheMessageHeader::AppendMessageL end") );
+	}
+
+// -----------------------------------------------------------------------------
+// CIMCacheMessageHeader::UnreadMessageCount
+// name of history data
+// -----------------------------------------------------------------------------
+//
+TInt CIMCacheMessageHeader::UnreadMessageCount()  const
+	{
+	TRACE( T_LIT( "CIMCacheMessageHeader::UnreadMessageCount begin") );
+	TInt ret = 0;
+	TInt msgcount = iMessageArray.Count();
+	for(TInt i=0; i<msgcount; i++ )
+		{
+		CIMCacheMessageBase* msg = 	iMessageArray[i];
+		if(msg->IsUnread() )
+			{
+			ret++;	
+			}
+		}
+	TRACE( T_LIT( "CIMCacheMessageHeader::UnreadMessageCount end") );
+	return ret;
+	}
+
+// -----------------------------------------------------------------------------
+// CIMCacheMessageHeader::IsChatStarted
+// name of history data
+//-----------------------------------------------------------------------------
+TBool CIMCacheMessageHeader::IsChatStarted()
+    {
+    return iChatStarted;
+    }
+
+// -----------------------------------------------------------------------------
+// CIMCacheMessageHeader::SetChatStarted
+// name of history data
+//-----------------------------------------------------------------------------
+void CIMCacheMessageHeader::SetChatStarted(TBool aStarted )
+    {
+    iChatStarted = aStarted;
+    }
+
+ // -----------------------------------------------------------------------------
+// CIMCacheMessageHeader::MarkAllRead
+// name of history data
+//-----------------------------------------------------------------------------
+void CIMCacheMessageHeader::MarkAllRead()
+    {
+    TInt unreadCount = UnreadMessageCount();
+    TInt count = MessageCount();
+    
+    for( TInt i = count-1; i >= count- unreadCount; i--  )
+	    {
+	    iMessageArray[i]->SetRead();	
+	    }
+    }
+ 
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/instantmessagingcache/imcacheserver/src/cimcacheserver.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,288 @@
+/*
+* 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:  instantmessagingcache server class implementation
+*
+*/
+
+#define __INCLUDE_CAPABILITY_NAMES__
+#define __INCLUDE_ALL_SUPPORTED_CAPABILITIES__
+
+//  INCLUDE FILES
+#include "cimcacheserver.h"
+
+#include "ccacheserveractivehelper.h"
+#include "cimcachesession.h"
+#include "mimcachemessageheader.h"
+#include "timcachemessagefactory.h"
+#include "cimcachemessageheader.h"
+#include "cimcachemessagebase.h"
+// logs
+#include "imcachedebugtrace.h" //logs
+
+// ==============================================================
+// =============== PLATSEC POLICY CONFIGURATION =================
+// ==============================================================
+
+static const TInt KIMCachePlatSecRangeCount = 2;
+
+//Ranges for the Request values
+static const TInt KIMCachePlatSecRanges[ KIMCachePlatSecRangeCount ] =
+    {
+    0,
+    EIMCacheOperationLast
+    };
+
+
+// Element indexes for the defined ranges
+static const TUint8 KIMCachePlatSecElementsIndex[ KIMCachePlatSecRangeCount ] =
+    {
+    0,
+    CPolicyServer::ENotSupported
+    };
+
+
+// Policy elements
+static const CPolicyServer::TPolicyElement KIMCachePlatSecElements[] =
+    {
+        {
+        _INIT_SECURITY_POLICY_C2( ECapabilityReadUserData,
+                                  ECapabilityWriteUserData ),
+        CPolicyServer::EFailClient
+        }
+    };
+
+
+// The platsec policy
+static const CPolicyServer::TPolicy KIMCachePlatSecPolicy =
+    {
+    // Shortcut to the index into Elements,that is used to check a connection attempt
+    0,
+
+    // Number of ranges in the iRanges array
+    KIMCachePlatSecRangeCount,
+
+    // A pointer to an array of ordered ranges of request numbers
+    KIMCachePlatSecRanges,
+
+    // A pointer to an array of TUint8 values specifying
+    // the appropriate action to take for each range in iRanges
+    KIMCachePlatSecElementsIndex,
+
+    // A pointer to an array of distinct policy elements
+    KIMCachePlatSecElements
+    };
+
+
+// ==============================================================
+// ======================= SERVER  ==============================
+// ==============================================================
+
+// -----------------------------------------------------------------------------
+// CIMCacheServer::ExecuteL
+// -----------------------------------------------------------------------------
+//
+void CIMCacheServer::ExecuteL()
+    {
+    TRACE( T_LIT( "CIMCacheServer::ExecuteL() begin") );
+    // start scheduler
+    CActiveScheduler* pA = new( ELeave )CActiveScheduler;
+    CleanupStack::PushL( pA );
+    CActiveScheduler::Install( pA );
+
+
+    // create server
+    CIMCacheServer* server = new( ELeave ) CIMCacheServer();
+    CleanupStack::PushL( server );
+    server->InitializeL(*server);
+    server->StartL( KIMCacheServerName );
+
+
+    //Signal client that we are started
+    RProcess().Rendezvous( KErrNone );
+
+    // Execute the server
+    // Codescanner warning: using CActiveScheduler::Start (id:3)
+    // this has to be called for server starting.
+    CActiveScheduler::Start(); // CSI: 3 # See above
+
+    //Cleanup
+    CleanupStack::PopAndDestroy( server );//server
+    CleanupStack::PopAndDestroy( pA );
+    CActiveScheduler::Install( NULL );
+    TRACE( T_LIT( "CIMCacheServer::ExecuteL() end") );
+    }
+
+// -----------------------------------------------------------------------------
+// CIMCacheServer::~CIMCacheServer
+// -----------------------------------------------------------------------------
+//
+CIMCacheServer::~CIMCacheServer()
+    {
+    TRACE( T_LIT( "CIMCacheServer::~CIMCacheServer() begin") );
+   
+    iSessions.Close();
+    
+	delete iActiveHelper;
+	
+	#if _BullseyeCoverage
+    	cov_write();
+	#endif
+    TRACE( T_LIT( "CIMCacheServer::~CIMCacheServer() end") );
+    }
+
+// -----------------------------------------------------------------------------
+// CIMCacheServer::CIMCacheServer
+// -----------------------------------------------------------------------------
+//
+
+CIMCacheServer::CIMCacheServer()
+    : CPolicyServer( CActive::EPriorityStandard,
+                     KIMCachePlatSecPolicy )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CIMCacheServer::NewSessionL
+// -----------------------------------------------------------------------------
+//
+CSession2* CIMCacheServer::NewSessionL( const TVersion &aVersion,
+                                          const RMessage2& /*aMessage*/ ) const
+    {
+    TRACE( T_LIT( "CIMCacheServer::NewSessionL() begin") );
+    TVersion srvVersion( KIMCacheVersionMajor,
+                         KIMCacheVersionMinor,
+                         KIMCacheVersionBuild );
+
+	if( !User::QueryVersionSupported( aVersion, srvVersion ) )
+        {
+        User::Leave( KErrNotSupported );
+        }
+	CIMCacheSession* session = CIMCacheSession::NewL();	
+     
+    TRACE( T_LIT( "CIMCacheServer::NewSessionL() end session[%d] created"), session );
+    return session;
+    }
+
+// -----------------------------------------------------------------------------
+// CIMCacheServer::SessionCreatedL
+// -----------------------------------------------------------------------------
+//
+void CIMCacheServer::SessionCreatedL( CIMCacheSession* aSession )
+    {
+    TRACE( T_LIT( "CIMCacheServer::SessionCreatedL begin aSession[%d]"),aSession );
+    iSessionCount++;
+    TInt err = iSessions.Find( aSession );
+    if(err == KErrNotFound )
+	    {
+	    iSessions.AppendL( aSession );
+	    }
+    TRACE( T_LIT( "CIMCacheServer::SessionCreatedL() end") );
+      }
+// -----------------------------------------------------------------------------
+// CIMCacheServer::SessionDied
+// -----------------------------------------------------------------------------
+//
+void CIMCacheServer::SessionDied( CIMCacheSession* aSession )
+    {
+    TRACE( T_LIT( "CIMCacheServer::SessionDied() begin") );
+    TInt count = iSessions.Count();
+      for( TInt i = 0; i < count; i++ )
+			{
+			if( iSessions[i] == aSession )
+				{
+				iSessions.Remove( i );
+				break;
+				}
+			}
+	iSessionCount--;
+	if( iSessionCount == 0 )
+		{
+		// Codescanner warning: using CActiveScheduler::Stop ( Id: 4)
+		// it is required to stop the server
+		CActiveScheduler::Stop(); // CSI: 4 # See above
+		}
+	TRACE( T_LIT( "CIMCacheServer::SessionDied() end") );
+    }
+// -----------------------------------------------------------------------------
+// CIMCacheManager::GetActiveHelper
+// Pass pointer to toc array to client.
+// -----------------------------------------------------------------------------
+//
+CCacheServerActiveHelper* CIMCacheServer::GetActiveHelper()
+	{
+    return iActiveHelper;
+	}
+
+// -----------------------------------------------------------------------------
+// CIMCacheServer::InitializeL
+// -----------------------------------------------------------------------------
+//
+void CIMCacheServer::InitializeL(CIMCacheServer& aServer)
+    {
+    TRACE( T_LIT( "CIMCacheServer::InitializeL begin") );
+    
+    iActiveHelper = CCacheServerActiveHelper::NewL( aServer );
+    
+    TRACE( T_LIT( "CIMCacheServer::InitializeL end") );
+    }
+
+// -----------------------------------------------------------------------------
+// CIMCacheServer::PackAndNotifyEventL
+// -----------------------------------------------------------------------------
+// send notication to all if registration is valid
+ 
+void CIMCacheServer::PackAndNotifyEventL(TIMCacheOperationsCode aChangeType,
+                                         TInt aServiceId,
+										 MIMCacheMessageHeader* aChatHeader /*=NULL*/, 
+									 	 CIMCacheMessageBase* aMessage /*=NULL*/ ) 
+	{
+	TInt count = iSessions.Count();
+	for(TInt i = 0; i<count; i++ )
+		{
+		if( aServiceId == iSessions[i]->ServiceId() )
+		    {
+		    // send changes to only those session which are has same service Id
+		    iSessions[i]->PackAndNotifyEventL(aChangeType , aChatHeader, aMessage);	
+		    }
+		}
+	}
+
+
+// ==============================================================
+// ====================== ENTRY POINT ===========================
+// ==============================================================
+GLDEF_C TInt E32Main()
+    {
+    TRACE( T_LIT("E32Main - enter") );
+
+    User::RenameThread( KIMCacheServerName );
+
+    CTrapCleanup* tc = CTrapCleanup::New();
+    if( !tc )
+        {
+        return KErrNoMemory;
+        }
+
+    TRAPD( err, CIMCacheServer::ExecuteL() );
+    delete tc;
+
+    TRACE( T_LIT("E32Main - exit: %d"), err );
+    return err;
+    }
+
+
+
+//  END OF FILE
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/instantmessagingcache/imcacheserver/src/cimcachesession.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,926 @@
+/*
+* 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:  cache session class implementation
+*
+*/
+
+
+//  INCLUDE FILES
+// local includes
+#include "cimcachesession.h"
+
+#include "cimcacheserver.h"
+#include "ccacheserveractivehelper.h"
+#include "cimcachemessagebase.h"
+#include "mimcachemessageheader.h"
+// logs
+#include "imcachedebugtrace.h"
+#include "cimcachebufferarray.h"
+
+// ==============================================================
+// ======================== SESSION =============================
+// ==============================================================
+
+// ---------------------------------------------------------
+// CIMCacheSession::NewL
+// Two-phased constructor.
+// ---------------------------------------------------------
+//
+CIMCacheSession* CIMCacheSession::NewL()
+    {
+    TRACE( T_LIT("CIMCacheSession::NewL begin") );
+    CIMCacheSession* self = new( ELeave ) CIMCacheSession(  );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    TRACE( T_LIT("CIMCacheSession::NewL end") );
+    return self;
+    }
+
+// ---------------------------------------------------------
+// CIMCacheSession::NewL
+// Symbian OS default constructor can leave.
+// ---------------------------------------------------------
+//
+void CIMCacheSession::ConstructL()
+	{
+	//This T-class is heap-allocated only because we do not want to 
+	//include T-class header in header file of imcachesession.
+	}
+
+// ---------------------------------------------------------
+// CIMCacheSession::NewL
+// destructor
+// ---------------------------------------------------------
+//
+CIMCacheSession::~CIMCacheSession()
+    {
+    TRACE( T_LIT("CIMCacheSession[%d]::~CIMCacheSession() start"), this );
+    if(iObserverActive)
+        {
+        iObserverMessage.Complete( KErrCancel );
+        iObserverActive = EFalse;   
+        }
+    if( Server() )
+        {
+        Server()->SessionDied( this );
+        }
+     iPacketsArray.ResetAndDestroy();
+     
+     ResetHeaderInoformation();	
+     
+     TRACE( T_LIT("CIMCacheSession::~CIMCacheSession() end "));
+     }
+
+
+// ---------------------------------------------------------
+// CIMCacheSession::NewL
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// ---------------------------------------------------------
+//
+CIMCacheSession::CIMCacheSession():
+iOpenChatFetchCompleted( EFalse )
+	{
+ 	TRACE( T_LIT("CIMCacheSession::CIMCacheSession"));
+    }
+
+
+// ---------------------------------------------------------
+// CIMCacheSession::CreateL
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+void CIMCacheSession::CreateL()
+    {
+    TRACE( T_LIT("CIMCacheSession[%d]::CreateL()"), this );
+    Server()->SessionCreatedL( this );
+    TRACE( T_LIT( "CIMCacheSession::CreateL end") );
+    }
+
+// ---------------------------------------------------------
+// CIMCacheSession::ServiceL
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+void CIMCacheSession::ServiceL( const RMessage2 &aMessage )
+    {
+	TRACE( T_LIT("CIMCacheSession::ServiceL	, begin"));
+    if( DispatchMessageL( aMessage ) )
+        {
+        TRACE( T_LIT("CIMCacheSession::ServiceL inside  DispatchMessageL"));
+        if( !iMessageCompleted  )
+        	{
+            TRACE( T_LIT("CIMCacheSession::ServiceL inside  !iMessageCompleted"));
+        	aMessage.Complete( KErrNone );
+        	}
+        }
+    TRACE( T_LIT("CIMCacheSession::ServiceL	, end"));
+    }
+
+// ---------------------------------------------------------
+// CIMCacheSession::ServiceError
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+void CIMCacheSession::ServiceError( const RMessage2& aMessage,
+                                      TInt aError )
+    {
+    TRACE( T_LIT("CIMCacheSession::ServiceError	, begin"));
+    aMessage.Complete( aError );
+    TRACE( T_LIT("CIMCacheSession::ServiceError	, end"));
+    }
+
+
+// ---------------------------------------------------------
+// CIMCacheSession::DispatchMessageL
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+TBool CIMCacheSession::DispatchMessageL( const RMessage2& aMessage )
+    {
+    TRACE( T_LIT("CIMCacheSession[%d]::DispatchMessageL() %d"), this, aMessage.Function() );
+    
+	iMessageCompleted = EFalse;
+    TBool msgNeedsToBeCompleted = ETrue;
+    
+	  switch( aMessage.Function() )
+        {
+        // initialization operations
+        case EIMCacheInitUpdate :
+	        {
+	        TRACE( T_LIT("CIMCacheSession::DispatchMessageL EIMCacheInitUpdate") );
+	        InitSessionL( aMessage );
+	       	break;	
+	        }
+	     // initialization operations
+        case EIMCacheInitAccess :
+	        {
+	        TRACE( T_LIT("CIMCacheSession::DispatchMessageL EIMCacheInitAccess") );
+	        InitSessionL( aMessage );
+	        iAccessorInitialized = ETrue;
+        	break;	
+	        }
+	     // initialization operations
+        case EIMCacheInitConvesation :
+	        {
+	        TRACE( T_LIT("CIMCacheSession::DispatchMessageL EIMCacheInitAccess") );
+	        InitSessionL( aMessage );
+	        iConvesationInitialized = ETrue;
+        	break;	
+	        }
+	     // update right operations
+        case EIMCacheStartNewConversation :
+        	{
+        	TRACE( T_LIT("CIMCacheSession::DispatchMessageL EIMCacheStartNewConversation excuted") );
+        	iHelper->StartNewConversationL(aMessage);
+        	break;
+        	}
+      	case EIMCacheAppendSendMessage :
+        	{
+        	TRACE( T_LIT("CIMCacheSession::DispatchMessageL EIMCacheAppendSendMessage excuted") );
+        	iHelper->AppendSendMessageL(aMessage);
+        	break;
+        	}
+        case EIMCacheAppendMessage :
+        	{
+        	TRACE( T_LIT("CIMCacheSession::DispatchMessageL EIMCacheAppendMessage excuted") );
+        	iHelper->AppendMessageL(aMessage);
+        	break;
+        	}
+        case EIMCacheAppendReceiveMessage:
+        	{
+        	TRACE( T_LIT("CIMCacheSession::DispatchMessageL EIMCacheAppendReceiveMessage excuted") );
+        	iHelper->AppendReceiveMessageL(aMessage);
+        	break;
+        	}
+        case EIMCacheCloseConversation :
+            {
+            TRACE( T_LIT("CIMCacheSession::DispatchMessageL EIMCacheCloseConversation excuted") );
+            iHelper->CloseConversationL(aMessage);
+            break;
+            }
+        case EIMCacheCloseAllConversation :
+            {
+            TRACE( T_LIT("CIMCacheSession::DispatchMessageL EIMCacheCloseAllConversation excuted") );
+            iHelper->CloseAllConversationL(iServiceId);
+            break;
+            }
+        case EIMCacheDeactivateConversation:
+        	{
+        	TRACE( T_LIT("CIMCacheSession::DispatchMessageL EIMCacheDeactivateConversation excuted") );
+        	iHelper->DeactivateConversationL();
+        
+        	break;
+        	}
+       	 
+        case EIMCacheObserveMessageUpdateRegister:
+        	{
+        	TRACE( T_LIT("CIMCacheSession::DispatchMessageL EIMCacheObserveMessageUpdateRegister excuted") );
+        	if( iObserverActive )
+        		{
+        		TRACE( T_LIT("CIMCacheSession::DispatchMessageL observer already active") );
+        		// complete the old observer request with KErrCancel
+        		iObserverMessage.Complete( KErrAlreadyExists );
+        		}
+        	iObserverMessage = aMessage;
+        	iObserverActive = ETrue;
+           	msgNeedsToBeCompleted = EFalse;
+           	// check fetching still needed or not if needed pack and send again 
+			if( iPacketsArray.Count() )
+				{
+				CIMCacheBufferArray* packet = iPacketsArray[ 0 ] ;
+				if( packet->OperationCode() ==  EIMOperationFetchAll )
+					{
+					iObserverMessage.Complete( EIMOperationDataAvailable );
+					}
+				else
+					{
+					iObserverMessage.Complete( packet->OperationCode() );
+					}
+				iObserverActive = EFalse;
+				}
+			
+			break;
+        	}
+        case EIMCacheObserveMessageUpdateUnRegister :
+	        {
+	        TRACE( T_LIT("CIMCacheSession::DispatchMessageL EIMCacheObserveMessageUpdateUnRegister excuted") );
+	        if( !iObserverActive )
+        		{
+        		TRACE( T_LIT("CIMCacheSession::DispatchMessageL observer not active ") );
+        		}
+        	else
+	        	{
+	        	TRACE( T_LIT("CIMCacheSession::DispatchMessageL observer active ") );
+				iObserverMessage.Complete( EIMOperationUnRegistered );
+				iObserverActive = EFalse;		
+	        	}
+	        
+            break;	
+	        }
+	     case EIMCacheObserveMessageAccessRegister:
+        	{
+        	TRACE( T_LIT("CIMCacheSession::DispatchMessageL EIMCacheObserveMessageAccessRegister excuted") );
+        	if( iObserverActive )
+        		{
+        		TRACE( T_LIT("CIMCacheSession::DispatchMessageL observer already active") );
+        		// complete the old observer request with KErrCancel
+        		iObserverMessage.Complete( KErrAlreadyExists );
+        		}
+        	iObserverMessage = aMessage;
+        	iObserverActive = ETrue;
+            msgNeedsToBeCompleted = EFalse;
+			 if( iPacketsArray.Count() )
+				{
+				CIMCacheBufferArray* packet = iPacketsArray[ 0 ] ;
+				if( packet->OperationCode() ==  EIMOperationFetchAll )
+					{
+					iObserverMessage.Complete( EIMOperationUnreadChange );
+					}
+				else
+					{
+					iObserverMessage.Complete( packet->OperationCode() );
+					}
+				iObserverActive = EFalse;
+				}
+	     	break;
+        	}
+         case EIMCacheObserveMessageAccessUnRegister :
+	        {
+	        TRACE( T_LIT("CIMCacheSession::DispatchMessageL EIMCacheObserveMessageAccessUnRegister excuted") );
+	        if( !iObserverActive )
+        		{
+        		TRACE( T_LIT("CIMCacheSession::DispatchMessageL observer not active ") );
+        		}
+        	else
+	        	{
+	        	TRACE( T_LIT("CIMCacheSession::DispatchMessageL observer active ") );
+				iObserverMessage.Complete( EIMOperationUnRegistered );
+				iObserverActive = EFalse;		
+	        	}
+	  
+            break;	
+	        }
+       
+        case EIMCacheGetUnreadCount:
+        	{
+        	iHelper->GetUnreadMessageCountL(aMessage);
+        	break;
+        	}
+        case EIMCacheGetAllUnreadCount:
+        	{
+        	iHelper->GetAllUnreadMessageCountL(aMessage);
+        	break;
+        	}
+       	   // check for conversation 
+        case EIMCacheIsConversationExist :
+	        {
+	        TRACE( T_LIT("CIMCacheSession::DispatchMessageL EIMCacheIsConversationExist excuted ") );
+	       	iHelper->CheckConversationExistL(aMessage);
+	    	break;	
+	        }
+        // Get what change happen        	
+        case EIMCacheGetBufferedPackets:
+        	{
+        	TRACE( T_LIT("CIMCacheSession::DispatchMessageL EIMCacheGetBufferedPackets excuted") );
+        	if( iPacketsArray.Count() )
+				{
+				CIMCacheBufferArray* packet = iPacketsArray[ 0 ] ;
+				aMessage.WriteL(0, packet->PacketData() );
+				iPacketsArray.Remove(0);
+				delete packet;
+				packet = NULL;
+				iPacketsArray.Compress();
+				}
+        	break;
+        	}       
+           	
+        case EIMCacheGetChatList:
+        	{
+        	TRACE( T_LIT("CIMCacheSession::DispatchMessageL EIMCacheGetChatList executed") );
+        	//0 serviceId 
+        	//1 buffer
+        	TInt serviceId = aMessage.Int0();       	
+        	
+        	ExternalizeChatItemL( EIMOperationFetchAll , serviceId );
+        	
+        	//aMessage.WriteL( 1, *iChatDataBuffer); 
+        	TInt packetsCounts = iPacketsArray.Count();
+        
+        	if( packetsCounts )
+				{
+				CIMCacheBufferArray* packet = iPacketsArray[ 0 ] ;
+				aMessage.WriteL( 1, packet->PacketData() );	
+				iPacketsArray.Remove(0);
+				delete packet;
+				packet = NULL;
+				iPacketsArray.Compress();
+				}
+            break;	
+        	}
+        case EIMCacheCancelRequest:
+            {
+            TRACE( T_LIT("CIMCacheSession::EIMCacheCancelRequest start"));
+            if(iObserverActive)
+                {
+                TRACE( T_LIT("CIMCacheSession::EIMCacheCancelRequest Inside if"));
+                iObserverMessage.Complete( KErrCancel );
+                TRACE( T_LIT("CIMCacheSession::EIMCacheCancelRequest After iObserverMessage.Complete"));
+                iObserverActive = EFalse;   
+                }
+            TRACE( T_LIT("CIMCacheSession::EIMCacheCancelRequest End"));
+
+          
+            break;
+            }
+        default:
+            {
+            TRACE( T_LIT("CIMCacheSession::DispatchMessageL default excuted") );
+            User::Leave( KErrNotSupported );
+            break;
+            }
+        }
+	TRACE( T_LIT("CIMCacheSession::DispatchMessageL	end"));
+    return msgNeedsToBeCompleted;
+   
+    }
+ //=======================================================================
+//==========================initialization ==================================
+//========================================================================
+
+// ---------------------------------------------------------
+// CIMCacheSession::InitSessionL
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+void CIMCacheSession::InitSessionL(const RMessage2& aMessage )
+	{
+    TRACE( T_LIT("CIMCacheSession::InitSessionL:start") );
+    // at zero place service id was appended
+    iServiceId = aMessage.Int0();
+	if( Server() )
+        {
+        iHelper = Server()->GetActiveHelper();
+        }
+    TRACE( T_LIT("CIMCacheSession::InitSessionL end") );
+	} 
+
+
+// ---------------------------------------------------------
+// CIMCacheSession::InitSessionL
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+TInt CIMCacheSession::ServiceId() const
+    {
+    TRACE( T_LIT("CIMCacheSession::ServiceId:start") );
+    TRACE( T_LIT("CIMCacheSession::ServiceId end") );
+    return iServiceId;
+    } 
+// ---------------------------------------------------------------------------
+// CIMCacheSession::ResetHeaderInoformation()
+// ---------------------------------------------------------------------------
+//
+void CIMCacheSession::ResetHeaderInoformation()
+                                                      
+    {
+    TRACE( T_LIT( "CIMCacheSession::ResetHeaderInoformation begin") );
+    if( iConvesationInitialized )
+	    {
+	    iHelper->ResetHeaderInoformation();	
+	    }
+   	TRACE( T_LIT( "CIMCacheSession::ResetHeaderInoformation end") );
+    }
+ 
+ 
+// ---------------------------------------------------------
+// CIMCacheSession::PackAndNotifyEventL
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+void CIMCacheSession::PackAndNotifyEventL(TIMCacheOperationsCode aChangeType ,
+										  MIMCacheMessageHeader* aChatHeader /*=NULL*/, 
+									 	  CIMCacheMessageBase* aMessage /*=NULL*/ ) 
+
+    {	
+    TRACE( T_LIT( "CIMCacheSession::PackAndNotifyEventL() begin") );
+
+    switch( aChangeType )
+        {
+        case EIMOperationFetchAll :
+            {
+            SendChatListDataL(aChangeType, aChatHeader);
+            break;	
+            }
+        case EIMOperationUnreadChange :
+            {
+            if(  iObserverActive && iConvesationInitialized )
+                {
+                iObserverMessage.Complete( aChangeType );
+                iObserverActive = EFalse;		
+                }
+            else if( iObserverActive && iAccessorInitialized  )
+                {
+                ExternalizeSingleChatItemL(aChangeType, aChatHeader );
+                iObserverMessage.Complete( aChangeType );
+                iObserverActive = EFalse;
+                }
+            break;	
+            }
+        case EIMOperationUnreadMessage :
+            {
+            SendUnreadChangeNotificationL( aChatHeader, aMessage );
+            break;	
+            }
+        case EIMOperationChatStarted :
+            {
+            if( iObserverActive && iConvesationInitialized )
+                {
+                iObserverMessage.Complete( aChangeType );
+                iObserverActive = EFalse;		
+                }
+            else if( iObserverActive && iAccessorInitialized )
+                {
+                ExternalizeSingleChatItemL(aChangeType, aChatHeader );
+                iObserverMessage.Complete( aChangeType );
+                iObserverActive = EFalse;   
+                }
+            break;	
+            }
+        case EIMOperationChatAdded :
+            {
+            if(  iConvesationInitialized )
+                {
+                ExternalizeSingleChatItemL(aChangeType, aChatHeader);
+                if( iObserverActive )
+                    {
+                    iObserverMessage.Complete( aChangeType );
+                    iObserverActive = EFalse;	
+                    }
+                }
+            else if( iAccessorInitialized )
+                {
+                SendUnreadChangeNotificationL(aChatHeader, aMessage );
+                }
+            break;	
+            }
+        case EIMOperationMessageAdded :
+            {
+            if( iConvesationInitialized )
+                {
+                ExternalizeSingleChatDataL(aChangeType, aChatHeader , aMessage );
+                if( iObserverActive )
+                    {
+                    iObserverMessage.Complete( aChangeType );
+                    iObserverActive = EFalse;
+                    }
+                }
+            break;	
+            }
+        case EIMOperationChatDeleted :
+            {
+            if( ( iConvesationInitialized || iAccessorInitialized  ) && iObserverActive )
+                {
+                ExternalizeSingleChatItemL(aChangeType, aChatHeader );
+                }
+            if( iObserverActive )
+                {
+                iObserverMessage.Complete( aChangeType );
+                iObserverActive = EFalse;	
+                }
+            break;	
+            }
+        case EIMOperationAllChatDeleted:
+            {
+            if( ( iConvesationInitialized || iAccessorInitialized  ) && iObserverActive )
+                {
+                iObserverMessage.Complete( aChangeType );
+                iObserverActive = EFalse;   
+                }
+            break;
+            }
+        case EIMOperationCompleted :
+            {
+            if( iObserverActive && iConvesationInitialized )
+                {
+                iObserverMessage.Complete( aChangeType );
+                iObserverActive = EFalse;		
+                }
+            break;	
+            }
+
+        }
+
+    }
+// ---------------------------------------------------------
+// CIMCacheSession::SendUnreadChangeNotificationL
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+void CIMCacheSession::SendUnreadChangeNotificationL( MIMCacheMessageHeader* aMsgHeader, 
+												 	CIMCacheMessageBase* aMessage )	
+	{
+	// write the message into continuous memory stream
+	if( iAccessorInitialized  || 
+		(iConvesationInitialized && aMsgHeader->IsChatStarted()) )
+		{
+		ExternalizeSingleChatDataL(EIMOperationUnreadMessage, aMsgHeader, aMessage );
+		if( iObserverActive )
+			{
+			iObserverMessage.Complete( EIMOperationUnreadMessage );
+			iObserverActive = EFalse;	
+			}
+		}
+
+	TRACE( T_LIT( "CIMCacheSession::SendUnreadChangeNotificationL() end") );
+	}
+
+// ---------------------------------------------------------
+// CIMCacheSession::SendChatListDataL
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+void CIMCacheSession::SendChatListDataL( TIMCacheOperationsCode aChangeType ,
+									     MIMCacheMessageHeader* aMsgHeader )
+
+	{
+	
+	TRACE( T_LIT( "CIMCacheSession::SendChatListChangeNotificationL() begin") );
+   
+	// write the message into continuous memory stream
+	if( iConvesationInitialized )
+		{
+		ExternalizeChatDataL(aChangeType, aMsgHeader );
+		if( iObserverActive )
+			{
+			iObserverMessage.Complete( EIMOperationDataAvailable );
+			iObserverActive = EFalse;	
+			}
+		}
+	else if( iObserverActive && iAccessorInitialized  )
+		{
+        ExternalizeSingleChatItemL(aChangeType, aMsgHeader );
+		iObserverMessage.Complete( EIMOperationUnreadChange );
+		iObserverActive = EFalse;		
+		}
+		
+	TRACE( T_LIT( "CIMCacheSession::SendChatListChangeNotificationL() end") );
+	
+	}
+
+// ---------------------------------------------------------
+// CIMCacheSession::ExternalizeSingleChatItemL
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+void CIMCacheSession::ExternalizeSingleChatItemL( TIMCacheOperationsCode aChangeType, MIMCacheMessageHeader* aMsgHeader )
+	{
+
+	 TRACE( T_LIT( "CIMCacheSession::ExternalizeSingleChatItemL() Start") );
+
+    RPointerArray<HBufC8> bufferedHeaderArray;
+    bufferedHeaderArray.Reset();
+    
+
+    TInt availableSize = KMaxSize - 2*sizeof(TInt);//messageCount + more.
+    TRACE( T_LIT( "CIMCacheSession::ExternalizeSingleChatItemL() availableSize ---- %d"),availableSize );
+
+    TBool more = EFalse;
+
+    if( aMsgHeader != NULL )
+        {
+        TRACE( T_LIT( "CIMCacheSession::ExternalizeSingleChatItemL() inside if aMsgHeader") );
+        TInt dataSize = sizeof( TInt )+ //for service id.               
+                    sizeof( TInt )+ aMsgHeader->BuddyId().Size() ; // for buddyId length and buddyId.
+
+        availableSize = availableSize - dataSize - sizeof( dataSize );
+        TRACE( T_LIT( "CIMCacheSession::ExternalizeSingleChatItemL() inside if aMsgHeader availableSize --- %d"), availableSize );
+
+        if( availableSize > 0 )
+            {
+            HBufC8* tempBuf = GetPackedChatItemBufferL( aMsgHeader , dataSize );
+            bufferedHeaderArray.AppendL( tempBuf );
+            }
+        }
+	    
+	    ExternalizeBufferedDataL(aChangeType, bufferedHeaderArray , KMaxSize , more );
+	    TRACE( T_LIT( "CIMCacheSession::ExternalizeSingleChatItemL() after ExternalizeBufferedDataL") );
+	    bufferedHeaderArray.ResetAndDestroy(); // delete all buffered contacts.
+	    TRACE( T_LIT( "CIMCacheSession::ExternalizeSingleChatItemL() after bufferedHeaderArray.resetanddestroy") );
+	    TRACE( T_LIT( "CIMCacheSession::ExternalizeSingleChatItemL() Start") );
+	}
+// ---------------------------------------------------------
+// CIMCacheSession::ExternalizeChatItemL
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+void CIMCacheSession::ExternalizeChatItemL( TIMCacheOperationsCode aChangeType, 
+										    TInt aServiceId /*= KErrNotFound*/ )
+	{
+	
+    TRACE( T_LIT( "CIMCacheSession::ExternalizeL() begin") );
+    
+   	TInt availableSize = KMaxSize - 2*sizeof(TInt);
+   
+   	RPointerArray<HBufC8> bufferedHeaderArray;
+   	
+	TBool more = EFalse;
+	TInt i = 0;
+    if( aChangeType == EIMOperationFetchAll )
+        {
+        RPointerArray<MIMCacheMessageHeader> tempHeaderArray;
+    	iHelper->GetServiceChatHeaderArrayL( aServiceId , tempHeaderArray );
+  
+        TInt chatCount = tempHeaderArray.Count();
+         
+        for( i=0; i < chatCount; i++ )
+			{
+			MIMCacheMessageHeader* chatHeader = tempHeaderArray[ i ];
+
+			TInt dataSize = sizeof( TInt )+ //for service id.               
+			sizeof( TInt )+ chatHeader->BuddyId().Size() ; // for buddyId length and buddyId.
+
+			availableSize = availableSize - dataSize - sizeof( dataSize );
+
+			if( availableSize > 0 )
+				{
+				HBufC8* tempBuf = GetPackedChatItemBufferL( chatHeader , dataSize );
+				bufferedHeaderArray.AppendL( tempBuf );
+				}
+			else
+				{
+				more = ETrue;
+				ExternalizeBufferedDataL(aChangeType, bufferedHeaderArray , KMaxSize , more );
+				bufferedHeaderArray.ResetAndDestroy(); // delete all buffered contacts.
+				availableSize = KMaxSize - 2*sizeof(TInt);
+				//preserve information for next trial.
+				}
+			}
+        if( i == chatCount )
+            {
+            more = EFalse;
+            ExternalizeBufferedDataL(aChangeType, bufferedHeaderArray , KMaxSize , more );
+            }
+        }
+ 
+    bufferedHeaderArray.ResetAndDestroy(); // delete all buffered contacts.
+    
+    TRACE( T_LIT( "CIMCacheSession::ExternalizeL() end") );
+    }
+// ---------------------------------------------------------
+// CIMCacheSession::ExternalizeBufferedDataL
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+void CIMCacheSession::ExternalizeBufferedDataL(TIMCacheOperationsCode aOperationCode,
+											   RPointerArray<HBufC8>& aArray , 
+											   TInt aTotalSize , 
+											   TBool aMore /*= EFalse*/)
+	{
+	TRACE( T_LIT( "CIMCacheSession::ExternalizeBufferedDataL() begin") );
+	TInt appendedMsgCount = aArray.Count(); 
+	CBufFlat* flatBuf = CBufFlat::NewL(aTotalSize);//( aTotalSize + ( sizeof(TInt) * appendedMsgCount ) + sizeof(TInt) );
+	CleanupStack::PushL( flatBuf );
+	RBufWriteStream writeAllStream ;
+	CleanupClosePushL( writeAllStream );
+
+	writeAllStream.Open( *flatBuf );
+	writeAllStream.WriteInt16L( appendedMsgCount );
+	
+	for(TInt i = 0; i< appendedMsgCount ; i++ )
+		{
+		HBufC8* buf =  aArray[i];
+		writeAllStream.WriteInt16L(buf->Length());
+		writeAllStream.WriteL(*buf);			
+		}
+	
+	writeAllStream.WriteInt16L( aMore );//write more information at end.
+	
+	writeAllStream.CommitL(); 
+
+	CIMCacheBufferArray* packet = CIMCacheBufferArray::NewL( flatBuf->Ptr(0) , aOperationCode );
+	iPacketsArray.Append(packet); // ownership to array
+	
+	CleanupStack::PopAndDestroy(); // writeAllStream
+	CleanupStack::PopAndDestroy(); // flatBuf
+	
+	TRACE( T_LIT( "CIMCacheSession::ExternalizeBufferedDataL() end") );
+	
+	}  	
+ 
+// ---------------------------------------------------------
+// CIMCacheSession::ExternalizeSingleChatDataL
+// (other items were commented in a header).
+// ---------------------------------------------------------
+void CIMCacheSession::ExternalizeSingleChatDataL(TIMCacheOperationsCode aChangeType, MIMCacheMessageHeader* aChatHeader, CIMCacheMessageBase* aMessage )
+	{
+	
+	TInt availableSize = KMaxSize - 2*sizeof(TInt);//messageCount + more.
+
+	TBool more = EFalse;
+
+	if( aMessage && aChatHeader )
+		{
+		if( aChangeType == EIMOperationMessageAdded )
+			{
+			aMessage->SetRead()	;
+			}
+		RPointerArray<HBufC8> bufferedChatArray;
+			
+		TInt dataSize = sizeof( aMessage->MessageType() )+
+		                sizeof( aMessage->MessagerType() )+
+		                sizeof( aMessage->ContentType() )+
+		                sizeof( aMessage->TimeStamp().Int64() )+  
+		                sizeof( TInt )+ aChatHeader->BuddyId().Size() + // for buddy  length and buddy name
+		                sizeof( TInt )+ aMessage->Text().Size() ; // for message length and message
+		             
+		availableSize = availableSize - dataSize - sizeof( dataSize );
+		if( availableSize > 0 )
+		    {
+		     HBufC8* messageBuffer = GetPackedChatDataBufferL( aMessage , aChatHeader , dataSize );
+		     bufferedChatArray.AppendL( messageBuffer );
+		    }
+		    
+		ExternalizeBufferedDataL(aChangeType, bufferedChatArray , KMaxSize , more );
+		bufferedChatArray.ResetAndDestroy();
+		}
+	}
+
+// ---------------------------------------------------------
+// CIMCacheSession::ExternalizeChatDataL
+// (other items were commented in a header).
+// ---------------------------------------------------------
+void CIMCacheSession::ExternalizeChatDataL(TIMCacheOperationsCode aChangeType ,MIMCacheMessageHeader* aChatHeader )
+    {    
+    RPointerArray<HBufC8> bufferedChatArray;
+    bufferedChatArray.Reset();
+    
+    TInt availableSize = KMaxSize - 2*sizeof(TInt);//messageCount + more.
+   
+    TBool more = EFalse;
+     
+    if( aChangeType == EIMOperationFetchAll &&  aChatHeader )
+        { 
+        TInt messageCount = aChatHeader->MessageCount();
+    	
+   		TInt index = 0;
+        for( index = 0 ; index < messageCount  ; index++ )
+            {
+            CIMCacheMessageBase* message = aChatHeader->GetMessage(index);
+            TInt dataSize = sizeof( message->MessageType() )+
+                            sizeof( message->MessagerType() )+
+                            sizeof( message->ContentType() )+
+                            sizeof( message->TimeStamp().Int64() )+  
+                            sizeof( TInt )+ aChatHeader->BuddyId().Size() + // for buddy  length and buddy name
+                            sizeof( TInt )+ message->Text().Size() ; // for message length and message
+                         
+            availableSize = availableSize - dataSize - sizeof( dataSize );
+            if( availableSize > 0 )
+                {
+                // mark message read
+    			 message->SetRead();
+                 HBufC8* messageBuffer = GetPackedChatDataBufferL( message , aChatHeader , dataSize );
+                 bufferedChatArray.AppendL( messageBuffer );
+                 }
+            else
+                {
+                //else set information for more and message nest to last sent message i.e index
+                more = ETrue;
+                ExternalizeBufferedDataL(aChangeType, bufferedChatArray , KMaxSize , more );
+    			bufferedChatArray.ResetAndDestroy();  
+    			availableSize = KMaxSize - 2*sizeof(TInt); //messageCount + more.  
+                index--;
+                }
+            }
+        if( index == messageCount )
+			{
+			more = EFalse;
+			ExternalizeBufferedDataL(aChangeType, bufferedChatArray , KMaxSize , more );
+			}
+        }
+     bufferedChatArray.ResetAndDestroy();    
+    }
+// ---------------------------------------------------------
+// CIMCacheSession::GetPackedChatDataBufferL
+// (other items were commented in a header).
+// ---------------------------------------------------------
+HBufC8* CIMCacheSession::GetPackedChatDataBufferL(CIMCacheMessageBase* aMsg , MIMCacheMessageHeader* aActiveHeader , const TInt aSize)
+    {
+    TRACE( T_LIT( "CIMCacheSession::GetPackedChatDataBufferL() begin") );
+    
+
+    CBufFlat*   flatBuf = CBufFlat::NewL( aSize );
+    CleanupStack::PushL( flatBuf );
+
+    RBufWriteStream writeStream ;
+    CleanupClosePushL( writeStream );
+
+    writeStream.Open( *flatBuf );
+
+    writeStream.WriteInt16L( aMsg->MessageType() );  
+    writeStream.WriteInt16L( aMsg->MessagerType() );
+    writeStream.WriteInt16L( aMsg->ContentType() );   
+    writeStream.WriteReal64L( aMsg->TimeStamp().Int64() );
+    writeStream.WriteInt16L( aActiveHeader->BuddyId().Length() );    
+    writeStream.WriteL( aActiveHeader->BuddyId() );
+    writeStream.WriteInt16L( aMsg->Text().Length() );    
+    writeStream.WriteL( aMsg->Text() );
+    
+    writeStream.CommitL();
+
+    HBufC8* tempBuffer = flatBuf->Ptr(0).AllocL();
+    
+    CleanupStack::PopAndDestroy(); // flatBuf
+    CleanupStack::PopAndDestroy(); // writeStream
+    
+    TRACE( T_LIT( "CIMCacheSession::GetPackedChatDataBufferL() end") ); 
+    return tempBuffer;
+    }
+
+// ---------------------------------------------------------
+// CIMCacheSession::GetPackedChatItemBufferL
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+HBufC8* CIMCacheSession::GetPackedChatItemBufferL(MIMCacheMessageHeader* aChatHeader, TInt& aSize)
+    {
+    TRACE( T_LIT( "CIMCacheSession::GetPackedChatItemBufferL() end") );
+    
+    TInt  serviceId   = aChatHeader->ServiceId();
+    const TDesC& buddyId = aChatHeader->BuddyId();
+             
+     CBufFlat*   flatBuf = CBufFlat::NewL( aSize );
+     CleanupStack::PushL( flatBuf );
+     
+     RBufWriteStream writeStream ;
+     CleanupClosePushL( writeStream );
+     writeStream.Open( *flatBuf );
+        
+     writeStream.WriteInt16L( serviceId );
+     writeStream.WriteInt16L( buddyId.Length() );
+     writeStream.WriteL( buddyId );       
+     writeStream.CommitL();
+     
+     HBufC8* chatHeaderBuffer = flatBuf->Ptr(0).AllocL();
+    
+     CleanupStack::PopAndDestroy(2); // writeAllStream,flatBuf
+     
+     TRACE( T_LIT( "CIMCacheSession::GetPackedChatItemBufferL() end") );
+     
+     return chatHeaderBuffer;
+    }
+
+
+// end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/instantmessagingcache/imcacheserver/src/timcachemessagefactory.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,84 @@
+/*
+* 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:  factory helper class implementation  
+*
+*/
+
+
+// INCLUDE FILES
+
+#include "timcachemessagefactory.h"
+#include "cimcachemessageheader.h"
+#include "cimcachemessagebase.h"
+ //logs
+#include "imcachedebugtrace.h"
+
+
+// ================= MEMBER FUNCTIONS =======================
+
+// -----------------------------------------------------------------------------
+// TIMCacheMessageFactory::CreateIMCacheMessageHeaderL
+// Create instantmessagingcache message header
+// -----------------------------------------------------------------------------
+//
+MIMCacheMessageHeader* TIMCacheMessageFactory::CreateIMCacheMessageHeaderL(TInt aServiceId, const TDesC& aBuddyId )
+    {
+    TRACE( T_LIT( "TIMCacheMessageFactory::CreateIMCacheMessageHeaderL") );
+    return CIMCacheMessageHeader::NewL( aServiceId, aBuddyId );
+    }
+
+
+// -----------------------------------------------------------------------------
+// TIMCacheMessageFactory::CreateCacheMessageL
+// Create instantmessagingcache message header
+// -----------------------------------------------------------------------------
+//
+CIMCacheMessageBase* TIMCacheMessageFactory::CreateCacheMessageL( 
+                                        const TDesC& aData )
+	{
+	TRACE( T_LIT( "TIMCacheMessageFactory::CreateCacheMessageL") );
+	return CIMCacheMessageBase::NewL(aData)	;
+	}
+  
+ // -----------------------------------------------------------------------------
+// TIMCacheMessageFactory::FindHeaderIndexL
+// Create instantmessagingcache message header
+// -----------------------------------------------------------------------------
+//
+TInt TIMCacheMessageFactory::FindHeaderIndexL(RPointerArray<MIMCacheMessageHeader>& aArray, 
+												TInt aServiceId,
+												const TDesC& aBuddyId )
+	{
+	TRACE( T_LIT( "TIMCacheMessageFactory::FindHeaderIndexL begin") );
+	TInt count = aArray.Count();
+	TRACE( T_LIT( "TIMCacheMessageFactory::FindHeaderIndexL count = %d"),count );
+	
+	for(TInt index = 0; index <count ; index++ )
+		{
+		MIMCacheMessageHeader* header = aArray[index];
+		if(header )
+			{
+			if( ( aServiceId == header->ServiceId() ) && ( aBuddyId.CompareC( header->BuddyId() ) == 0  ) )	
+				{
+				return index;	
+				}				
+			}	
+		}
+		
+	TRACE( T_LIT( "TIMCacheMessageFactory::FindHeaderIndexL end") );		
+	return KErrNotFound;
+	}
+                     
+// end of file
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/instantmessagingcache/inc/imcachedebugtrace.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,126 @@
+/*
+* 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:  logs generation file
+*
+*/
+
+
+
+#ifndef __IMCACHEDEBUGTRACE_H__
+#define __IMCACHEDEBUGTRACE_H__
+
+//  INCLUDES
+#include  "e32std.h"
+#include <flogger.h>
+//  DEFINES
+// enable logs printing
+// into  c:\\logs\\instantmessagingcache\\instantmessagingcache.txt
+//#define IMCHACHE_ENABLE_DEBUG_LOGS
+#undef IMCHACHE_ENABLE_DEBUG_LOGS
+
+/**   
+* Usage of Log MACRO'S
+* _LIT( KExample, "Example" );
+*  TXT(s) _L(s)	
+*  IM_CV_LOGS(TXT("Some text.") );
+*  IM_CV_LOGS(TXT("Some text: %d"), 100 );
+*  IM_CV_LOGS(TXT("Some text: %S"), &KExample );
+*/
+
+_LIT( KTAdaptDebugOutputDir, "imcache" );
+_LIT( KTAdaptDebugOutputFileName, "imcache.txt" );
+const TInt KTAdaptMaxLogLineLength = 250 ;
+#define T_LIT(s) _L(s)
+#define TRACE TIMChacheLogger::WriteLog
+#define PLUGIN_UNUSED_PARAM(p) (void) p
+
+
+/**
+ * IM cache debug logger.
+ */
+class TIMChacheLogger
+    {
+    public: //Logging functions
+    	/**
+        * WriteLog, write the message into c:\\logs\\instantmessagingcache\\instantmessagingcache.txt
+        * need to create imcv folder into c:\\logs
+        * @param aFmt, list of messges to print
+        */
+		static void WriteLog( TRefByValue<const TDesC> aFmt,... );
+		
+    private: //Prohibited
+    	/**
+        * construtor
+        */
+        TIMChacheLogger();
+        /**
+        * destructor
+        */
+        ~TIMChacheLogger();
+    };
+
+#endif // __IMCACHEDEBUGTRACE_H__
+
+
+
+/**
+ * Handler used by logger to truncate the string
+ * rather than panic in case of buffer overflow.
+*/
+
+NONSHARABLE_CLASS ( TAdaptOverflowTruncate ) : public TDes16Overflow
+	{
+
+public:
+	void Overflow ( TDes16& /*aDes*/ ) {}
+	};
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// TIMChacheLogger::WriteLog()
+// -----------------------------------------------------------------------------
+//
+inline void TIMChacheLogger::WriteLog ( TRefByValue<const TDesC> aFmt, ... )
+	{
+	#ifdef IMCHACHE_ENABLE_DEBUG_LOGS
+		( void ) aFmt;//Suppress unused formal parameter warning
+		TBuf< KTAdaptMaxLogLineLength > buffer;
+		buffer.Append ( _L ( "[" ) );           // CSI: 78 #
+		buffer.Append ( RThread().Name() );
+		buffer.Append ( _L ( "] " ) );          // CSI: 78 #
+		TAdaptOverflowTruncate overflow;
+		VA_LIST list;
+		VA_START ( list, aFmt );
+		buffer.AppendFormatList ( aFmt, list, &overflow );
+		RFileLogger logger;
+
+		if ( logger.Connect() == KErrNone )
+			{
+			logger.SetDateAndTime ( ETrue, ETrue );
+			logger.CreateLog ( KTAdaptDebugOutputDir, KTAdaptDebugOutputFileName,
+			                   EFileLoggingModeAppend );
+			logger.Write ( buffer );
+			logger.CloseLog();
+			logger.Close();
+			}
+	#endif
+
+	}
+
+
+// End of File
+
+ 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/instantmessagingcache/inc/imcacheuids.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,37 @@
+/*
+* 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:  collection of all uids
+*
+*/
+
+
+#ifndef     __IMCACHEUIDS_H
+#define     __IMCACHEUIDS_H
+
+//Uid2:s
+#define KStaticInterfaceDllUid2         0x1000008d // CSI: 8 # 
+
+
+// imcacheclient Uid3
+#define KIMCacheClientUid3           	 0x20012429 // CSI: 8 # 
+// imcacheserver uid3										
+#define KIMCacheServerUid3               0x2001242A  // CSI: 8 # 
+									   
+
+#endif // __IMCACHEUIDS_H
+
+
+//  END OF FILE
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/instantmessagingcache/rom/instantmessagingcache.iby	Wed Nov 03 09:32:20 2010 +0530
@@ -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: IBY file for imcache
+*
+*/
+
+#ifndef __INSTANTMESSAGINGCACHE_IBY__
+#define __INSTANTMESSAGINGCACHE_IBY__
+
+//instant messaging cache 
+file=ABI_DIR/BUILD_DIR/imcacheserver.exe					PROGRAMS_DIR/imcacheserver.exe
+file=ABI_DIR/BUILD_DIR/imcacheclient.dll					SHARED_LIB_DIR/imcacheclient.dll
+
+// stub SIS, provides support for SIS upgrading
+data=DATAZ_/system/install/imcachestub.sis    system/install/imcachestub.sis
+
+#endif //__INSTANTMESSAGINGCACHE_IBY__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/instantmessagingcache/sis/imcache.pkg	Wed Nov 03 09:32:20 2010 +0530
@@ -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:pkg file for imcache
+;
+; imcache.pkg
+;
+;Language - standard language definitions
+&EN
+
+; standard SIS file header
+#{"IM Cache"},(0x20012429),1,1,0, TYPE=SA,RU
+
+;Supports Series 60 v 3.0
+(0x20022E6D), 0, 0, 0, {"Series60ProductID"}
+
+;Localized Vendor Name
+%{"Nokia"}
+
+;Unique Vendor name
+:"Nokia"
+
+; file to copy from imcache
+
+"\epoc32\release\armv5\urel\imcacheserver.exe"				-"!:\sys\bin\imcacheserver.exe"
+"\epoc32\release\armv5\urel\imcacheclient.dll"				-"!:\sys\bin\imcacheclient.dll"
+
+; end of file
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/instantmessagingcache/sis/imcachestub.pkg	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,32 @@
+;
+; 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: 
+;
+;Language
+&EN
+
+;Header
+#{"IM Cache"}, (0x20012429), 1, 0, 0, TYPE=SA
+
+;Localised VendorID
+%{"Nokia"}
+
+;VendorID
+:"Nokia"
+
+; instant messaging cache 
+""				      -"z:\sys\bin\imcacheserver.exe"
+""				      -"z:\sys\bin\imcacheclient.dll"
+
+; end of file
Binary file imservices/instantmessagingcache/sis/imcachestub.sis has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/instantmessagingcache/sis/metadata.xml	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,72 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ad:metadata xmlns="http://nokia.com/arrow/repository/ia_component" xmlns:ad="http://nokia.com/arrow/application_metadata">
+    <iaSearchCriteria>ABC:ABC</iaSearchCriteria>
+    <!--
+    The appResources element contains all the language metadata of one IAC.
+    IAC may have one or more language-specific component names
+    and descriptions inside appResource element.
+
+    Language ID 1 should be always defined as this is the default language
+    in case other languages supported by the client cannot be found.
+    -->
+    <appResources>
+        <appResource>
+            <!-- Language ID -->
+            <language>1</language>
+            <!-- Name in given language -->
+            <iacName>InstantMessageCache</iacName>
+            <!-- Description in given language -->
+            <iacDescription>Update for InstantMessageCache</iacDescription>
+        </appResource>
+    </appResources>
+    <!-- Specifies for what versions of what platform this component is for. -->
+    <swPlatformDep>
+    <!-- platform code -->
+        <platform>S60</platform>
+        <versionFrom>
+            <!--
+            platform version number separated in major and minor number (i.e.
+            3.0 has 3 as major and 0 as minor)
+            -->
+            <major>5</major>
+            <minor>2</minor>
+            <!--
+            date-element can be used to pinpoint platform version number to even
+            more specific one. It is not currently used in the system.
+            -->
+            <date>
+                <year>2007</year>
+                <week>1</week>
+            </date>
+        </versionFrom>
+        <!-- the latest platform version this component is for -->
+        <versionTo>
+            <major>5</major>
+            <minor>2</minor>
+            <date>
+                <year>2009</year>
+                <week>52</week>
+            </date>
+        </versionTo>
+    </swPlatformDep>
+    <!-- specifies dependencies to other IACs -->
+    <interDeps>
+        <interDep>
+        <!-- SISX UID of the package this component is dependent of -->
+        <sisxUid>0x20012429</sisxUid>
+            <!-- the earliest version this component is dependent of -->
+            <versionFrom>
+                <major>1</major>
+                <minor>0</minor>
+                <build>0</build>
+            </versionFrom>
+            <!-- the latest version this component is dependent of -->
+            <versionTo>
+                <major>2</major>
+                <minor>2</minor>
+                <build>2</build>
+            </versionTo>
+        </interDep>
+    </interDeps>
+<firmwareDependencies xmlns="http://nokia.com/arrow/repository/ia_component" xmlns:ad="http://nokia.com/arrow/application_metadata"/>
+</ad:metadata>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/instantmessagingcache/tsrc/bwins/imcache_testu.def	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,3 @@
+EXPORTS
+	?LibEntryL@@YAPAVCScriptBase@@AAVCTestModuleIf@@@Z @ 1 NONAME ; class CScriptBase * LibEntryL(class CTestModuleIf &)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/instantmessagingcache/tsrc/conf/imcache_test.cfg	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,155 @@
+/*
+* ==============================================================================
+*  Name        : imcache_test.cfg
+*  Part of     : instantmessagingcache / imcache_test
+*  Description : instantmessagingcache related test cases
+*  Version:    : % version:1 %
+*
+*  Copyright (C) 2008 Nokia Corporation.
+*  This material, including documentation and any related 
+*  computer programs, is protected by copyright controlled by 
+*  Nokia Corporation. All rights are reserved. Copying, 
+*  including reproducing, storing,  adapting or translating, any 
+*  or all of this material requires the prior written consent of 
+*  Nokia Corporation. This material also contains confidential 
+*  information which may not be disclosed to others without the 
+*  prior written consent of Nokia Corporation.
+*
+* ============================================================================
+*/
+
+[Test]
+title 1. CreateSameUpdaterL
+create imcache_test foobar
+foobar CreateSameUpdaterL 
+delete foobar
+[Endtest] 
+
+
+[Test]
+title 2. CreateDifferentUpdaterL
+create imcache_test foobar
+foobar CreateDifferentUpdaterL 
+delete foobar
+[Endtest] 
+
+
+[Test]
+title 3. CreateSameAccessorL
+create imcache_test foobar
+foobar CreateSameAccessorL 
+delete foobar
+[Endtest] 
+
+
+[Test]
+title 4. CreateDifferentAccessorL
+create imcache_test foobar
+foobar CreateDifferentAccessorL 
+delete foobar
+[Endtest] 
+
+[Test]
+title 5. StartNewConversationL
+create imcache_test foobar
+foobar StartNewConversationL 
+delete foobar
+[Endtest] 
+
+
+[Test]
+title 6. AppendSendMessageL
+create imcache_test foobar
+foobar AppendSendMessageL 
+delete foobar
+[Endtest] 
+
+
+[Test]
+title 7. AppendRecieveMessageL
+create imcache_test foobar
+foobar AppendRecieveMessageL 
+delete foobar
+[Endtest] 
+
+
+[Test]
+title 8. FetchExistingMessageL
+create imcache_test foobar
+foobar FetchExistingMessageL 
+delete foobar
+[Endtest] 
+
+[Test]
+title 9. DeactivateConversationL
+create imcache_test foobar
+foobar DeactivateConversationL 
+delete foobar
+[Endtest] 
+
+[Test]
+title 10. CloseConversationL
+create imcache_test foobar
+foobar CloseConversationL 
+delete foobar
+[Endtest] 
+
+[Test]
+title 11. GetUnreadMsgCountL
+create imcache_test foobar
+foobar GetUnreadMsgCountL 
+delete foobar
+[Endtest] 
+
+
+[Test]
+title 12. GetNewMsgNotificationtL
+create imcache_test foobar
+foobar GetNewMsgNotificationtL 
+delete foobar
+[Endtest] 
+
+[Test]
+title 13. ConversationUnExistTestL
+create imcache_test foobar
+foobar ConversationUnExistTestL 
+delete foobar
+[Endtest] 
+
+
+[Test]
+title 14. ConversationExistTestL
+create imcache_test foobar
+foobar ConversationExistTestL 
+delete foobar
+[Endtest] 
+
+[Test]
+title 15. AppendMessageL
+create imcache_test foobar
+foobar AppendMessageL 
+delete foobar
+[Endtest] 
+
+[Test]
+title 16. GetAllUnreadMsgCountL
+create imcache_test foobar
+foobar GetAllUnreadMsgCountL 
+delete foobar
+[Endtest] 
+
+[Test]
+title 17. GetChatListTestL
+create imcache_test foobar
+foobar GetChatListTestL 
+delete foobar
+[Endtest]
+
+[Test]
+title 18. AccessorCloseConversationTestL
+create imcache_test foobar
+foobar AccessorCloseConversationTestL 
+delete foobar
+[Endtest]
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/instantmessagingcache/tsrc/eabi/imcache_testu.def	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,3 @@
+EXPORTS
+	_Z9LibEntryLR13CTestModuleIf @ 1 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/instantmessagingcache/tsrc/group/bld.inf	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,57 @@
+/*
+* Copyright (c) 2002 - 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:  ?Description
+*
+*/
+
+
+
+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
+// NOTE: If using ARS requirements all export operations should be done under this.
+// 'abld test export'
+
+PRJ_TESTEXPORTS
+// Specify the source file followed by its destination here
+// copy will be used to copy the source file to its destination
+// If there's no destination then the source file will be copied
+// to the same name in /epoc32/include
+// Example: 
+/*
+/agnmodel/inc/AGMCOMON.H
+*/
+../init/TestFramework.ini /epoc32/winscw/c/TestFramework/TestFramework.ini
+../conf/imcache_test.cfg /epoc32/winscw/c/TestFramework/imcache_test.cfg	
+
+PRJ_TESTMMPFILES
+// NOTE: If using ARS requirements .mmp file operation should be done under this.
+// 'abld test build'
+imcache_test.mmp
+
+PRJ_MMPFILES
+// Specify the .mmp files required for building the important component
+// releasables.
+//
+// Specify "tidy" if the component you need to build doesn't need to be
+// released. Specify "ignore" if the MMP file exists but should be
+// ignored.
+// Example:
+
+
+
+//  End of File
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/instantmessagingcache/tsrc/group/imcache_test.mmp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,54 @@
+/*TYPE TESTCLASS*//*
+* Copyright (c) 2002 - 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:  ?Description
+*
+*/
+
+
+        // To get the OSEXT_LAYER_SYSTEMINCLUDE-definition
+#include <platform_paths.hrh>
+#include <data_caging_paths_strings.hrh>
+
+TARGET          imcache_test.dll
+TARGETTYPE      dll
+UID             0x1000008D 0x101FB3E3
+
+CAPABILITY      ALL -TCB
+
+//TARGETPATH      ?target_path
+DEFFILE         imcache_test.def
+
+SOURCEPATH      ../src
+SOURCE          imcache_test.cpp
+SOURCE          imcache_testBlocks.cpp
+
+USERINCLUDE     ../inc 
+//USERINCLUDE     ../../../../imcacheclient/inc
+//USERINCLUDE     ../../../../inc 
+
+APP_LAYER_SYSTEMINCLUDE
+
+SYSTEMINCLUDE   /epoc32/include/internal
+
+LIBRARY         euser.lib
+LIBRARY         stiftestinterface.lib
+LIBRARY         stiftestengine.lib
+// imcache
+LIBRARY			imcacheclient.lib
+
+LANG            SC
+
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/instantmessagingcache/tsrc/group/imcache_test.pkg	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,42 @@
+;
+; 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:
+;
+;Header
+#{"Testcache"}, (0x101FB3E3), 1, 2, 3, TYPE=SP
+
+;Language - standard language definitions
+&EN
+
+;Vendor ID
+:"Nokia Corporation"
+
+;Localised vendor
+%{"Vendor-EN"}
+
+;Supports Series 60 v 0.9
+[0x101F7961], 0, 0, 0, {"Series60ProductID"}
+
+;rom will not allow to update it if name is testframework, after install need to rename it to testframework.ini
+
+;INI FILE
+"..\init\testframework.ini"        			-"c:\Testframework\ttestframework.ini"
+
+;CFG FILES
+"..\conf\imcache_test.cfg"        			-"c:\Testframework\imcache_test.cfg"
+
+;imcache_test dll files
+
+"\EPOC32\RELEASE\ARMV5\UREL\imcache_test.dll" 	-"!:\sys\bin\imcache_test.dll"
+    
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/instantmessagingcache/tsrc/inc/imcache_test.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,225 @@
+/*
+* Copyright (c) 2002 - 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:  ?Description
+*
+*/
+
+
+
+#ifndef IMCACHE_TEST_H
+#define IMCACHE_TEST_H
+
+//  INCLUDES
+#include <StifLogger.h>
+#include <TestScripterInternal.h>
+#include <StifTestModule.h>
+// imcache
+#include "mimcacheeventhandler.h"
+#include "mimcacheeventhandler.h"
+#include <imcachedefs.h>
+
+// CONSTANTS
+//const ?type ?constant_var = ?constant;
+
+// MACROS
+//#define ?macro ?macro_def
+// Logging path
+_LIT( Kimcache_testLogPath, "\\logs\\testframework\\imcache_test\\" ); 
+// Log file
+_LIT( Kimcache_testLogFile, "imcache_test.txt" ); 
+_LIT( Kimcache_testLogFileWithTitle, "imcache_test_[%S].txt" );
+
+// FUNCTION PROTOTYPES
+//?type ?function_name(?arg_list);
+
+// FORWARD DECLARATIONS
+//class ?FORWARD_CLASSNAME;
+class Cimcache_test;
+class CIMCacheFactory; 
+class MIMCacheEventHandler;
+
+// DATA TYPES
+//enum ?declaration
+//typedef ?declaration
+//extern ?data_type;
+
+// CLASS DECLARATION
+
+/**
+*  Cimcache_test test class for STIF Test Framework TestScripter.
+*  ?other_description_lines
+*
+*  @lib ?library
+*  @since ?Series60_version
+*/
+NONSHARABLE_CLASS(Cimcache_test) : public CScriptBase,
+									  public MIMCacheEventHandler
+    {
+    public:  // Constructors and destructor
+
+        /**
+        * Two-phased constructor.
+        */
+        static Cimcache_test* NewL( CTestModuleIf& aTestModuleIf );
+
+        /**
+        * Destructor.
+        */
+        virtual ~Cimcache_test();
+
+    public: // New functions
+
+        /**
+        * ?member_description.
+        * @since ?Series60_version
+        * @param ?arg1 ?description
+        * @return ?description
+        */
+        //?type ?member_function( ?type ?arg1 );
+
+    public: // Functions from base classes
+
+        /**
+        * From CScriptBase Runs a script line.
+        * @since ?Series60_version
+        * @param aItem Script line containing method name and parameters
+        * @return Symbian OS error code
+        */
+        virtual TInt RunMethodL( CStifItemParser& aItem );
+
+    protected:  // New functions
+
+        /**
+        * ?member_description.
+        * @since ?Series60_version
+        * @param ?arg1 ?description
+        * @return ?description
+        */
+        //?type ?member_function( ?type ?arg1 );
+
+    protected:  // Functions from base classes
+
+        /**
+        * From ?base_class ?member_description
+        */
+        //?type ?member_function();
+
+    private:
+
+        /**
+        * C++ default constructor.
+        */
+        Cimcache_test( CTestModuleIf& aTestModuleIf );
+
+        /**
+        * By default Symbian 2nd phase constructor is private.
+        */
+        void ConstructL();
+
+        // Prohibit copy constructor if not deriving from CBase.
+        // ?classname( const ?classname& );
+        // Prohibit assigment operator if not deriving from CBase.
+        // ?classname& operator=( const ?classname& );
+
+        /**
+        * Frees all resources allocated from test methods.
+        * @since ?Series60_version
+        */
+        void Delete();
+
+        /**
+        * Test methods are listed below. 
+        */
+
+        
+        //ADD NEW METHOD DEC HERE
+        //[TestMethods] - Do not remove
+        
+        virtual TInt CreateSameUpdaterL( CStifItemParser& aItem );
+        
+        virtual TInt CreateDifferentUpdaterL( CStifItemParser& aItem );
+        
+        virtual TInt CreateSameAccessorL( CStifItemParser& aItem );
+               
+        virtual TInt CreateDifferentAccessorL( CStifItemParser& aItem );
+        
+        virtual TInt StartNewConversationL( CStifItemParser& aItem ) ;
+        
+        virtual TInt AppendSendMessageL( CStifItemParser& aItem ) ;
+        
+        virtual TInt AppendRecieveMessageL( CStifItemParser& aItem ) ;
+        
+        virtual TInt FetchExistingMessageL( CStifItemParser& aItem );
+        
+        virtual TInt DeactivateConversationL( CStifItemParser& aItem );
+
+        virtual TInt CloseConversationL( CStifItemParser& aItem );
+        
+        virtual TInt GetUnreadMsgCountL(CStifItemParser& aItem) ;
+        
+        virtual TInt GetNewMsgNotificationtL(CStifItemParser& aItem) ;
+        
+        virtual TInt ConversationUnExistTestL(CStifItemParser& aItem) ;
+        
+        virtual TInt ConversationExistTestL(CStifItemParser& aItem) ;
+        
+        virtual TInt AppendMessageL( CStifItemParser& aItem);
+        
+ 	 	virtual TInt GetAllUnreadMsgCountL( CStifItemParser& aItem);
+
+      
+        virtual TInt GetChatListTestL( CStifItemParser& aItem);
+        
+ 	 	virtual TInt AccessorCloseConversationTestL( CStifItemParser& aItem);
+
+          
+
+    public:     // MIMCacheEventHandler
+    
+    /**
+    	* Gets called when data update is available.
+    	* Client can then decide wether to use the old one
+    	* or the updated one.
+    	* @param aNewMessage, new message details
+       	*/
+         void HandleIMCacheEventL(TIMCacheEventType aEvent, TAny* aChatMessage = NULL ) ;
+        
+          	
+    protected:  // Data
+        // ?one_line_short_description_of_data
+        //?data_declaration;
+
+    private:    // Data
+     
+     	CActiveSchedulerWait iWait;
+     	
+     	TInt iMessageFetch;
+        // ?one_line_short_description_of_data
+        //?data_declaration;
+
+        // Reserved pointer for future extension
+        //TAny* iReserved;
+
+    public:     // Friend classes
+        //?friend_class_declaration;
+    protected:  // Friend classes
+        //?friend_class_declaration;
+    private:    // Friend classes
+        //?friend_class_declaration;
+
+    };
+
+#endif      // IMCACHE_TEST_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/instantmessagingcache/tsrc/init/TestFramework.ini	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,44 @@
+#
+# This is STIFTestFramework initialization file
+# Comment lines start with '#'-character.
+# See STIF TestFramework users guide.doc for instructions
+
+# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+
+[Engine_Defaults]
+
+TestReportMode= FullReport		# Possible values are: 'Empty', 'Summary', 'Environment',
+                                                               'TestCases' or 'FullReport'
+
+CreateTestReport= YES			# Possible values: YES or NO
+
+TestReportFilePath= C:\LOGS\TestFramework\
+TestReportFileName= TestReport
+
+TestReportFormat= TXT			# Possible values: TXT or HTML
+TestReportOutput= FILE			# Possible values: FILE or RDEBUG
+TestReportFileCreationMode= OVERWRITE	# Possible values: OVERWRITE or APPEND
+
+DeviceResetDllName= StifResetForNokia.dll # e.g. 'StifHWResetStub.dll' for user specific reseting
+
+[End_Defaults]
+# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+
+# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+# Module configurations start
+
+[New_Module]
+ModuleName= testscripter
+TestCaseFile= C:\testframework\imcache_test.cfg
+[End_Module]
+
+
+
+# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+
+[Logger_Defaults]
+
+[End_Logger_Defaults]
+# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+
+# End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/instantmessagingcache/tsrc/src/imcache_test.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,187 @@
+/*
+* Copyright (c) 2002 - 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:  ?Description
+*
+*/
+
+
+
+// INCLUDE FILES
+#include <StifTestInterface.h>
+#include "imcache_test.h"
+#include <SettingServerClient.h>
+
+#include    "cimcachefactory.h"
+
+// EXTERNAL DATA STRUCTURES
+//extern  ?external_data;
+
+// EXTERNAL FUNCTION PROTOTYPES  
+//extern ?external_function( ?arg_type,?arg_type );
+
+// CONSTANTS
+//const ?type ?constant_var = ?constant;
+
+// MACROS
+//#define ?macro ?macro_def
+
+// LOCAL CONSTANTS AND MACROS
+//const ?type ?constant_var = ?constant;
+//#define ?macro_name ?macro_def
+
+// MODULE DATA STRUCTURES
+//enum ?declaration
+//typedef ?declaration
+
+// LOCAL FUNCTION PROTOTYPES
+//?type ?function_name( ?arg_type, ?arg_type );
+
+// FORWARD DECLARATIONS
+//class ?FORWARD_CLASSNAME;
+
+// ============================= LOCAL FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// ?function_name ?description.
+// ?description
+// Returns: ?value_1: ?description
+//          ?value_n: ?description_line1
+//                    ?description_line2
+// -----------------------------------------------------------------------------
+//
+/*
+?type ?function_name(
+    ?arg_type arg,  // ?description
+    ?arg_type arg)  // ?description
+    {
+
+    ?code  // ?comment
+
+    // ?comment
+    ?code
+    }
+*/
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// Cimcache_test::Cimcache_test
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+Cimcache_test::Cimcache_test( 
+    CTestModuleIf& aTestModuleIf ):
+        CScriptBase( aTestModuleIf )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// Cimcache_test::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void Cimcache_test::ConstructL()
+    {
+    //Read logger settings to check whether test case name is to be
+    //appended to log file name.
+    RSettingServer settingServer;
+    TInt ret = settingServer.Connect();
+    if(ret != KErrNone)
+        {
+        User::Leave(ret);
+        }
+    // Struct to StifLogger settigs.
+    TLoggerSettings loggerSettings; 
+    // Parse StifLogger defaults from STIF initialization file.
+    ret = settingServer.GetLoggerSettings(loggerSettings);
+    if(ret != KErrNone)
+        {
+        User::Leave(ret);
+        } 
+    // Close Setting server session
+    settingServer.Close();
+
+    TFileName logFileName;
+    
+    if(loggerSettings.iAddTestCaseTitle)
+        {
+        TName title;
+        TestModuleIf().GetTestCaseTitleL(title);
+        logFileName.Format(Kimcache_testLogFileWithTitle, &title);
+        }
+    else
+        {
+        logFileName.Copy(Kimcache_testLogFile);
+        }
+
+    iLog = CStifLogger::NewL( Kimcache_testLogPath, 
+                          logFileName,
+                          CStifLogger::ETxt,
+                          CStifLogger::EFile,
+                          EFalse );
+                          
+    TestModuleIf().SetBehavior( CTestModuleIf::ETestLeaksHandles );  
+                       
+    	 
+
+    }
+
+// -----------------------------------------------------------------------------
+// Cimcache_test::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+Cimcache_test* Cimcache_test::NewL( 
+    CTestModuleIf& aTestModuleIf )
+    {
+    Cimcache_test* self = new (ELeave) Cimcache_test( aTestModuleIf );
+
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+
+    return self;
+
+    }
+
+// Destructor
+Cimcache_test::~Cimcache_test()
+    { 
+
+    // Delete resources allocated from test methods
+    Delete();
+
+    // Delete logger
+    delete iLog; 
+
+    }
+
+// ========================== OTHER EXPORTED FUNCTIONS =========================
+
+// -----------------------------------------------------------------------------
+// LibEntryL is a polymorphic Dll entry point.
+// Returns: CScriptBase: New CScriptBase derived object
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CScriptBase* LibEntryL( 
+    CTestModuleIf& aTestModuleIf ) // Backpointer to STIF Test Framework
+    {
+
+    return ( CScriptBase* ) Cimcache_test::NewL( aTestModuleIf );
+
+    }
+
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/instantmessagingcache/tsrc/src/imcache_testBlocks.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,660 @@
+/*
+* Copyright (c) 2002 - 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:  ?Description
+*
+*/
+
+
+
+// [INCLUDE FILES] - do not remove
+#include <e32svr.h>
+#include <StifParser.h>
+#include <StifTestInterface.h>
+#include "imcache_test.h"
+
+#include   "cimcachefactory.h"
+#include	"mimcacheupdater.h"
+#include	"mimcacheaccessor.h"
+#include    "mimcacheeventhandler.h"
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// Cimcache_test::Delete
+// Delete here all resources allocated and opened from test methods. 
+// Called from destructor. 
+// -----------------------------------------------------------------------------
+//
+void Cimcache_test::Delete() 
+    {
+
+    }
+
+// -----------------------------------------------------------------------------
+// Cimcache_test::RunMethodL
+// Run specified method. Contains also table of test mothods and their names.
+// -----------------------------------------------------------------------------
+//
+TInt Cimcache_test::RunMethodL( 
+    CStifItemParser& aItem ) 
+    {
+
+    static TStifFunctionInfo const KFunctions[] =
+        {  
+        // Copy this line for every implemented function.
+        // First string is the function name used in TestScripter script file.
+        // Second is the actual implementation member function. 
+        ENTRY( "CreateSameUpdaterL", Cimcache_test::CreateSameUpdaterL ),
+        ENTRY( "CreateDifferentUpdaterL", Cimcache_test::CreateDifferentUpdaterL ),
+        ENTRY( "CreateSameAccessorL", Cimcache_test::CreateSameAccessorL ),
+        ENTRY( "CreateDifferentAccessorL", Cimcache_test::CreateDifferentAccessorL ),
+        ENTRY( "StartNewConversationL", Cimcache_test::StartNewConversationL ),
+        ENTRY( "AppendSendMessageL", Cimcache_test::AppendSendMessageL ),
+        ENTRY( "AppendRecieveMessageL", Cimcache_test::AppendRecieveMessageL ),
+        ENTRY( "FetchExistingMessageL", Cimcache_test::FetchExistingMessageL),
+        ENTRY( "DeactivateConversationL", Cimcache_test::DeactivateConversationL),
+        ENTRY( "CloseConversationL", Cimcache_test::CloseConversationL ),
+        ENTRY( "GetUnreadMsgCountL", Cimcache_test::GetUnreadMsgCountL ),
+        ENTRY( "GetNewMsgNotificationtL", Cimcache_test::GetNewMsgNotificationtL ),
+        
+        ENTRY( "ConversationUnExistTestL", Cimcache_test::ConversationUnExistTestL ),
+        ENTRY( "ConversationExistTestL", Cimcache_test::ConversationExistTestL ),
+        
+        ENTRY( "AppendMessageL", Cimcache_test::AppendMessageL ),
+        ENTRY( "GetAllUnreadMsgCountL", Cimcache_test::GetAllUnreadMsgCountL ),
+        
+         
+        ENTRY( "GetChatListTestL", Cimcache_test::GetChatListTestL ),
+        ENTRY( "AccessorCloseConversationTestL", Cimcache_test::AccessorCloseConversationTestL )
+          
+        //ADD NEW ENTRY HERE
+        // [test cases entries] - Do not remove
+
+        };
+
+    const TInt count = sizeof( KFunctions ) / 
+                        sizeof( TStifFunctionInfo );
+
+    return RunInternalL( KFunctions, count, aItem );
+
+    }
+  
+
+// -----------------------------------------------------------------------------
+// Cimcache_test::CreateSameUpdaterL
+// Example test method function.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt Cimcache_test::CreateSameUpdaterL( CStifItemParser& /*aItem*/ )
+	{
+
+ 	 CIMCacheFactory* instance = CIMCacheFactory::InstanceL(); 
+	   
+	 MIMCacheUpdater* updater1 = instance->CreateUpdaterL(1, _L("testlm123@gmail.com"),ETrue );
+	 
+	 MIMCacheUpdater* updater2 = instance->CreateUpdaterL(1, _L("testlm123@gmail.com") ,ETrue);
+	 
+	 TInt error = KErrGeneral;
+	 
+	 if(updater1 == updater2 )
+		 {
+		 error = KErrNone;	
+		 }
+	 
+	 CIMCacheFactory::Release();
+	 
+	 return error;
+	}
+  
+// -----------------------------------------------------------------------------
+// Cimcache_test::CreateDifferentUpdaterL
+// Example test method function.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt Cimcache_test::CreateDifferentUpdaterL( CStifItemParser& /*aItem*/ )
+	{
+
+ 	 CIMCacheFactory* instance = CIMCacheFactory::InstanceL(); 
+	   
+	 MIMCacheUpdater* updater1 = instance->CreateUpdaterL(1, _L("testlm123@gmail.com"),ETrue );
+	 
+	 MIMCacheUpdater* updater2 = instance->CreateUpdaterL(2, _L("abc123@gmail.com") ,ETrue);
+	 
+	 TInt error = KErrGeneral;
+	 
+	 if(updater1 != updater2 )
+		 {
+		 error = KErrNone;	
+		 }
+	 
+	 CIMCacheFactory::Release();
+	 
+	 return error;
+	}
+   
+   // -----------------------------------------------------------------------------
+// Cimcache_test::CreateSameAccessorL
+// Example test method function.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt Cimcache_test::CreateSameAccessorL( CStifItemParser& /*aItem*/ )
+	{
+
+ 	 CIMCacheFactory* instance = CIMCacheFactory::InstanceL(); 
+	   
+	 MIMCacheAccessor* accessor1 = instance->CreateAccessorL(1, _L("testlm123@gmail.com") );
+	 
+	 MIMCacheAccessor* accessor2 = instance->CreateAccessorL(1, _L("testlm123@gmail.com") );
+	 
+	 TInt error = KErrGeneral;
+	 
+	 if(accessor1 == accessor2 )
+		 {
+		 error = KErrNone;	
+		 }
+	 
+	 CIMCacheFactory::Release();
+	 
+	 return error;
+	}
+  
+// -----------------------------------------------------------------------------
+// Cimcache_test::CreateDifferentAccessorL
+// Example test method function.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt Cimcache_test::CreateDifferentAccessorL( CStifItemParser& /*aItem*/ )
+	{
+
+ 	 CIMCacheFactory* instance = CIMCacheFactory::InstanceL(); 
+	   
+	 MIMCacheAccessor* accessor1 = instance->CreateAccessorL(1, _L("testlm123@gmail.com") );
+	 
+	 MIMCacheAccessor* accessor2 = instance->CreateAccessorL(2, _L("abc123@gmail.com") );
+	 
+	 TInt error = KErrGeneral;
+	 
+	 if(accessor1 != accessor2 )
+		 {
+		 error = KErrNone;	
+		 }
+	 
+	 CIMCacheFactory::Release();
+	 
+	 return error;
+	}  
+ // -----------------------------------------------------------------------------
+// Cimcache_test::StartNewConversationL
+// Example test method function.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt Cimcache_test::StartNewConversationL( CStifItemParser& /*aItem*/ )
+    {
+     CIMCacheFactory* instance = CIMCacheFactory::InstanceL(); 
+	   
+	 MIMCacheUpdater* updater = instance->CreateUpdaterL(1, _L("testlm123@gmail.com"),ETrue );
+     updater->RegisterObserverL(*this);
+ 	 updater->StartNewConversationL( _L("testui123@gmail.com") ) ;
+ 	
+	 if( !iWait.IsStarted() )
+		 {
+		 iWait.Start();	
+		 }
+	 updater->UnRegisterObserver(*this);
+	 CIMCacheFactory::Release();
+	 return KErrNone;
+    }
+    
+// -----------------------------------------------------------------------------
+// Cimcache_test::AppendSendMessageL
+// Example test method function.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt Cimcache_test::AppendSendMessageL( CStifItemParser& /*aItem*/ )
+    {
+     CIMCacheFactory* instance = CIMCacheFactory::InstanceL(); 
+	   
+	 MIMCacheUpdater* updater = instance->CreateUpdaterL(1, _L("testlm123@gmail.com") ,ETrue);
+     updater->RegisterObserverL(*this);
+ 	 updater->StartNewConversationL( _L("testui123@gmail.com") ) ;
+ 	
+	 if( !iWait.IsStarted() )
+		 {
+		 iWait.Start();	
+		 }
+	 updater->AppendSendMessageL( _L("hello this is test message appended") ) ;	
+	 updater->UnRegisterObserver(*this);
+	 CIMCacheFactory::Release();
+	 return KErrNone;
+    }
+ 
+ // -----------------------------------------------------------------------------
+// Cimcache_test::AppendRecieveMessageL
+// Example test method function.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt Cimcache_test::AppendRecieveMessageL( CStifItemParser& /*aItem*/ )
+    {
+     CIMCacheFactory* instance = CIMCacheFactory::InstanceL(); 
+	   
+	 MIMCacheUpdater* updater = instance->CreateUpdaterL(1, _L("testlm123@gmail.com"),ETrue );
+     updater->AppendReceiveMessageL( _L("testui123@gmail.com"),_L("hello this is test message appended") ) ;
+     	
+	 CIMCacheFactory::Release();
+	 return KErrNone;
+    }
+    
+  // -----------------------------------------------------------------------------
+// Cimcache_test::StartNewConversationL
+// Example test method function.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt Cimcache_test::FetchExistingMessageL( CStifItemParser& /*aItem*/ )
+    {
+     CIMCacheFactory* instance = CIMCacheFactory::InstanceL(); 
+	 TInt error = KErrNotFound;  
+	 iMessageFetch = 0;
+	 MIMCacheUpdater* updater = instance->CreateUpdaterL(1, _L("testlm123@gmail.com") ,ETrue);
+	 // tow message appended hence counter will be two.
+	 updater->AppendReceiveMessageL( _L("testui123@gmail.com"),_L("hello this is test first message appended") ) ;
+	 updater->AppendReceiveMessageL( _L("testui123@gmail.com"),_L("hello this is test second message appended") ) ;
+	  
+     updater->RegisterObserverL(*this);
+     
+ /*    if( !iWait.IsStarted() )
+          {
+          iWait.Start(); 
+          }*/
+     
+ 	 updater->StartNewConversationL( _L("testui123@gmail.com") ) ;
+	 
+	 if( !iWait.IsStarted() )
+         {
+         iWait.Start(); 
+         }
+	 updater->UnRegisterObserver(*this);
+	 CIMCacheFactory::Release();
+	if( iMessageFetch == 2) // two message should be fetched
+		{
+		error = KErrNone;	
+		}
+	 return error;
+    }
+
+// -----------------------------------------------------------------------------
+// Cimcache_test::DeactivateConversationL
+// Example test method function.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt Cimcache_test::DeactivateConversationL( CStifItemParser& /*aItem*/ )
+    {
+     CIMCacheFactory* instance = CIMCacheFactory::InstanceL(); 
+	   
+	 MIMCacheUpdater* updater = instance->CreateUpdaterL(1, _L("testlm123@gmail.com"),ETrue );
+     updater->RegisterObserverL(*this);
+ 	 updater->StartNewConversationL( _L("testui123@gmail.com") ) ;
+ 	
+	 if( !iWait.IsStarted() )
+		 {
+		 iWait.Start();	
+		 }
+     // close the active conversation
+	 updater->DeactivateConversationL();
+	 
+	 updater->UnRegisterObserver(*this);
+	 CIMCacheFactory::Release();
+	 return KErrNone;
+    }
+// -----------------------------------------------------------------------------
+// Cimcache_test::CloseConversationL
+// Example test method function.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt Cimcache_test::CloseConversationL( CStifItemParser& /*aItem*/ )
+    {
+     CIMCacheFactory* instance = CIMCacheFactory::InstanceL(); 
+	   
+	 MIMCacheUpdater* updater = instance->CreateUpdaterL(1, _L("testlm123@gmail.com"),ETrue );
+     updater->RegisterObserverL(*this);
+
+ 	 updater->StartNewConversationL( _L("testui123@gmail.com") ) ;
+ 	
+	 if( !iWait.IsStarted() )
+		 {
+		 iWait.Start();	
+		 }
+     // close the active conversation
+	 updater->CloseConversationL( _L("testui123@gmail.com") );
+	 
+	   if( !iWait.IsStarted() )
+         {
+         iWait.Start(); 
+         }
+	 
+	 updater->UnRegisterObserver(*this);
+	 CIMCacheFactory::Release();
+	 return KErrNone;
+    }
+
+
+// -----------------------------------------------------------------------------
+// Cimcache_test::GetUnreadMsgCountL
+// Example test method function.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt Cimcache_test::GetUnreadMsgCountL(CStifItemParser& /*aItem*/) 
+	{
+	 CIMCacheFactory* instance = CIMCacheFactory::InstanceL(); 
+	   
+	 MIMCacheAccessor* accessor = instance->CreateAccessorL(1, _L("testlm123@gmail.com") );
+	 
+	 MIMCacheUpdater* updater = instance->CreateUpdaterL(1, _L("testlm123@gmail.com"), ETrue );
+     updater->AppendReceiveMessageL( _L("testui123@gmail.com"),_L("hello this is test message appended") ) ;
+ 	 TInt count = accessor->GetUnreadMessageCountL( _L("testui123@gmail.com") );
+	 CIMCacheFactory::Release();
+	 if(count == 1)
+		 {
+		 return KErrNone;	
+		 }
+	 return KErrArgument;
+	}
+
+
+// -----------------------------------------------------------------------------
+// Cimcache_test::GetUnreadMsgCountChangeL
+// Example test method function.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt Cimcache_test::GetAllUnreadMsgCountL(CStifItemParser& /*aItem*/) 
+	{
+	 CIMCacheFactory* instance = CIMCacheFactory::InstanceL(); 
+	   
+	 MIMCacheAccessor* accessor = instance->CreateAccessorL(1, _L("testlm123@gmail.com") );
+	 
+	 MIMCacheUpdater* updater = instance->CreateUpdaterL(1, _L("testlm123@gmail.com"), ETrue );
+     updater->AppendReceiveMessageL( _L("testui123@gmail.com"),_L("hello this is test message appended") ) ;
+     updater->AppendReceiveMessageL( _L("meco1111@gmail.com"),_L("i am fine here") ) ;
+     
+ 	 TInt count = accessor->GetAllUnreadMessageCountL( );
+	 CIMCacheFactory::Release();
+	 if(count == 2)
+		 {
+		 return KErrNone;	
+		 }
+	 return KErrArgument;
+	}
+// -----------------------------------------------------------------------------
+// Cimcache_test::ConversationUnExistTestL
+// Example test method function.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt Cimcache_test::ConversationUnExistTestL(CStifItemParser& /*aItem*/) 
+	{
+	 CIMCacheFactory* instance = CIMCacheFactory::InstanceL(); 
+	 MIMCacheUpdater* updater = instance->CreateUpdaterL(1, _L("testlm123@gmail.com"), ETrue );
+	 updater->RegisterObserverL(*this);
+	 
+	 updater->StartNewConversationL( _L("testui123@gmail.com") ) ;
+	  	
+	 	 if( !iWait.IsStarted() )
+	 		 {
+	 		 iWait.Start();	
+	 		 }
+	 	 
+	 updater->CloseAllConversationL();	
+	 	 
+	 MIMCacheAccessor* accessor = instance->CreateAccessorL(1, _L("testlm123@gmail.com") );
+	// not yest conversation open so must be EFalse here
+ 	 TBool ret = accessor->IsConversationExistL(_L("testui123@gmail.com") );
+ 	 updater->UnRegisterObserver(*this);
+	 CIMCacheFactory::Release();
+	 
+	 if(!ret)
+		 {
+		 return KErrNone;	
+		 }
+	 return KErrArgument;
+	}
+
+// -----------------------------------------------------------------------------
+// Cimcache_test::ConversationExistTestL
+// Example test method function.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt Cimcache_test::ConversationExistTestL(CStifItemParser& /*aItem*/) 
+	{
+    CIMCacheFactory* instance = CIMCacheFactory::InstanceL(); 
+		 
+	MIMCacheUpdater* updater = instance->CreateUpdaterL(1, _L("testlm123@gmail.com"), ETrue );
+	updater->RegisterObserverL(*this);
+	updater->StartNewConversationL( _L("testui123@gmail.com") ) ;
+	
+	if( !iWait.IsStarted() )
+		 {
+		 iWait.Start();	
+		 }
+	   
+	 MIMCacheAccessor* accessor = instance->CreateAccessorL(1, _L("testlm123@gmail.com") );
+	//  conversation already open so must be ETrue here
+ 	 TBool ret = accessor->IsConversationExistL( _L("testui123@gmail.com") );
+ 	 
+ 	 updater->UnRegisterObserver(*this);
+ 	 	 
+	 CIMCacheFactory::Release();
+	 
+	 if(ret)
+		 {
+		 return KErrNone;	
+		 }
+	 return KErrArgument;
+	}
+
+// -----------------------------------------------------------------------------
+// Cimcache_test::AppendMessageL
+// Example test method function.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt Cimcache_test::AppendMessageL( CStifItemParser& /*aItem*/ )
+    {
+     CIMCacheFactory* instance = CIMCacheFactory::InstanceL(); 
+	   
+	 MIMCacheUpdater* updater = instance->CreateUpdaterL(1, _L("testlm123@gmail.com") ,ETrue);
+     updater->RegisterObserverL(*this);
+ 	 updater->StartNewConversationL( _L("testui123@gmail.com") ) ;
+ 	
+	 if( !iWait.IsStarted() )
+		 {
+		 iWait.Start();	
+		 }
+	 updater->AppendMessageL(_L("testui123@gmail.com"), _L("this is system or information message message") ) ;	
+	 updater->UnRegisterObserver(*this);
+	 CIMCacheFactory::Release();
+	 return KErrNone;
+    }
+ 		
+// -----------------------------------------------------------------------------
+// Cimcache_test::GetUnreadMsgCountL
+// Example test method function.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt Cimcache_test::GetNewMsgNotificationtL(CStifItemParser& /*aItem*/) 
+	{
+	 CIMCacheFactory* instance = CIMCacheFactory::InstanceL(); 
+	 MIMCacheAccessor* accessor = instance->CreateAccessorL(1, _L("testlm123@gmail.com") );
+	 accessor->RegisterObserverL(*this);
+	 MIMCacheUpdater* updater = instance->CreateUpdaterL(1, _L("testlm123@gmail.com"),ETrue);
+     updater->AppendReceiveMessageL( _L("testui123@gmail.com"),_L("hello this is new message notification") ) ;
+     
+     if( !iWait.IsStarted() )
+		 {
+		 iWait.Start();	
+		 }
+	 accessor->UnRegisterObserver(*this);	 
+	 
+ 	 CIMCacheFactory::Release();
+	
+	 return KErrNone;
+	}
+
+// -----------------------------------------------------------------------------
+// Cimcache_test::GetChatListTestL
+// Example test method function.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt Cimcache_test::GetChatListTestL( CStifItemParser& /*aItem*/)
+	{
+	TInt error = KErrGeneral;
+	
+	CIMCacheFactory* instance = CIMCacheFactory::InstanceL();
+    MIMCacheUpdater* updater = instance->CreateUpdaterL(1, _L("testlm123@gmail.com"), EFalse );    
+    
+    updater->AppendReceiveMessageL( _L("testui123@gmail.com"),_L("hello this is new message notification 1 ") ) ;
+    updater->AppendReceiveMessageL( _L("abc123@gmail.com"),_L("hello this is new message notification 2 ") ) ;
+    updater->AppendReceiveMessageL( _L("testgizmo123@gmail.com"),_L("hello this is new message notification 3 ") ) ;
+   
+    
+    RArray<SIMCacheChatItem> listArray = updater->GetChatListL( 1 );
+    
+    if( listArray.Count() == 3 ) // total 3 chat created in server
+	    {
+	    error = KErrNone;	
+	    }
+
+    CIMCacheFactory::Release();  
+    
+	return error;
+	}
+// -----------------------------------------------------------------------------
+// Cimcache_test::AccessorCloseConversationTestL
+// Example test method function.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//      
+TInt Cimcache_test::AccessorCloseConversationTestL( CStifItemParser& /*aItem*/)
+	{
+	TInt error = KErrGeneral;
+
+	CIMCacheFactory* instance = CIMCacheFactory::InstanceL(); 
+	
+	MIMCacheUpdater* updater = instance->CreateUpdaterL(1, _L("testlm123@gmail.com"),EFalse );    
+    updater->AppendReceiveMessageL( _L("testui123@gmail.com"),_L("hello this is new message notification 1 ") ) ;
+  	
+	MIMCacheAccessor* accessor = instance->CreateAccessorL(1, _L("testlm123@gmail.com") );
+	accessor->RegisterObserverL(*this);
+	
+	if( accessor->IsConversationExistL(_L("testui123@gmail.com") ) )
+		{
+			// close the active conversation
+		accessor->CloseConversationL( _L("testui123@gmail.com") );
+			
+		if( !iWait.IsStarted() )
+			 {
+			 iWait.Start(); 
+			 }
+		error = KErrNone;
+		}
+
+	accessor->UnRegisterObserver(*this);
+	
+	CIMCacheFactory::Release();
+
+	return error;
+	}
+
+// -----------------------------------------------------------------------------
+// Cimcache_test::HandleIMCacheNewMessageEventL
+// Example test method function.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+
+void Cimcache_test::HandleIMCacheEventL( TIMCacheEventType aEventType, TAny* /*aChatMessage*/  )
+	{
+	switch( aEventType )
+		{
+		case EIMCacheUnreadMessage :
+				{
+				if( iWait.IsStarted() )
+					 {
+					 iWait.AsyncStop();	
+					 }	
+				break;
+				}
+			case EIMCacheUnreadChange :
+				{
+				if( iWait.IsStarted() )
+					 {
+					 iWait.AsyncStop();	
+					 }
+				break;
+				}
+			
+			case EIMCacheRequestCompleted :
+				{
+				if( iWait.IsStarted() )
+					 {
+					 iWait.AsyncStop();	
+					 }
+				break;
+				}
+			case EIMCacheNewMessage :
+				{
+				iMessageFetch++;
+                if( iWait.IsStarted() /*&& iMessageFetch == 2 */)
+                    {
+                    iWait.AsyncStop(); 
+                    }
+				break;
+				}
+			case EIMCacheNewChat:
+			    {
+	             if( iWait.IsStarted() )
+                     {
+                     iWait.AsyncStop(); 
+                     }
+                break;
+			    }
+			case EIMCacheChatClosed:
+			    {
+	              if( iWait.IsStarted() )
+                     {
+                     iWait.AsyncStop(); 
+                     }
+			    break;
+			    }
+						
+		}
+	}
+// ========================== OTHER EXPORTED FUNCTIONS =========================
+// None
+
+// end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/searchfeatureplugin/bwins/searchdatamodelhooku.def	Wed Nov 03 09:32:20 2010 +0530
@@ -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/imservices/searchfeatureplugin/bwins/searchdatamodelu.def	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,32 @@
+EXPORTS
+	??1CSearchSubscriptionItem@@UAE@XZ @ 1 NONAME ; CSearchSubscriptionItem::~CSearchSubscriptionItem(void)
+	?CleanExpired@CSearchDataCache@@QAEXXZ @ 2 NONAME ; void CSearchDataCache::CleanExpired(void)
+	?CleanResources@CSearchDataCache@@QAEXAAVMXIMPPscContext@@@Z @ 3 NONAME ; void CSearchDataCache::CleanResources(class MXIMPPscContext &)
+	?InfoLinearOrder@CSearchInfoImp@@SAHABV1@0@Z @ 4 NONAME ; int CSearchInfoImp::InfoLinearOrder(class CSearchInfoImp const &, class CSearchInfoImp const &)
+	?InternalizeL@CSearchElementImp@@QAEXAAVRReadStream@@@Z @ 5 NONAME ; void CSearchElementImp::InternalizeL(class RReadStream &)
+	?InternalizeL@CSearchInfoImp@@QAEXAAVRReadStream@@@Z @ 6 NONAME ; void CSearchInfoImp::InternalizeL(class RReadStream &)
+	?NewFromStreamLC@CSearchElementImp@@SAPAVCXIMPApiDataObjBase@@AAVRReadStream@@@Z @ 7 NONAME ; class CXIMPApiDataObjBase * CSearchElementImp::NewFromStreamLC(class RReadStream &)
+	?NewFromStreamLC@CSearchInfoImp@@SAPAVCXIMPApiDataObjBase@@AAVRReadStream@@@Z @ 8 NONAME ; class CXIMPApiDataObjBase * CSearchInfoImp::NewFromStreamLC(class RReadStream &)
+	?NewL@CSearchApiDataObjFactoryAccessor@@SAPAV1@XZ @ 9 NONAME ; class CSearchApiDataObjFactoryAccessor * CSearchApiDataObjFactoryAccessor::NewL(void)
+	?NewL@CSearchDataCache@@SAPAV1@AAVMXIMPHost@@@Z @ 10 NONAME ; class CSearchDataCache * CSearchDataCache::NewL(class MXIMPHost &)
+	?NewL@CSearchElementImp@@SAPAV1@XZ @ 11 NONAME ; class CSearchElementImp * CSearchElementImp::NewL(void)
+	?NewL@CSearchInfoImp@@SAPAV1@XZ @ 12 NONAME ; class CSearchInfoImp * CSearchInfoImp::NewL(void)
+	?NewL@CSearchObjectFactoryImp@@SAPAV1@XZ @ 13 NONAME ; class CSearchObjectFactoryImp * CSearchObjectFactoryImp::NewL(void)
+	?NewLC@CSearchElementImp@@SAPAV1@XZ @ 14 NONAME ; class CSearchElementImp * CSearchElementImp::NewLC(void)
+	?NewLC@CSearchEventImp@@SAPAV1@AAVCXIMPIdentityImp@@PAV?$RXIMPObjOwningPtrArray@VCSearchInfoImp@@@@@Z @ 15 NONAME ; class CSearchEventImp * CSearchEventImp::NewLC(class CXIMPIdentityImp &, class RXIMPObjOwningPtrArray<class CSearchInfoImp> *)
+	?NewLC@CSearchInfoImp@@SAPAV1@XZ @ 16 NONAME ; class CSearchInfoImp * CSearchInfoImp::NewLC(void)
+	?RemoveMe@?$@VCSearchSubscriptionItem@@@CSearchDataCache@@CAXAAPAV1@PAV1@@Z @ 17 NONAME ; void CSearchDataCache::RemoveMe<class CSearchSubscriptionItem>(class CSearchSubscriptionItem * &, class CSearchSubscriptionItem *)
+	?SearchSubscriptionItemLC@CSearchDataCache@@QAEAAVCSearchSubscriptionItem@@XZ @ 18 NONAME ; class CSearchSubscriptionItem & CSearchDataCache::SearchSubscriptionItemLC(void)
+	?SetSearchIdL@CSearchSubscriptionItem@@QAEXAAVCXIMPIdentityImp@@@Z @ 19 NONAME ; void CSearchSubscriptionItem::SetSearchIdL(class CXIMPIdentityImp &)
+	?SetSearchResults@CSearchSubscriptionItem@@QAEXPAV?$RXIMPObjOwningPtrArray@VCSearchInfoImp@@@@@Z @ 20 NONAME ; void CSearchSubscriptionItem::SetSearchResults(class RXIMPObjOwningPtrArray<class CSearchInfoImp> *)
+	??1CSearchKeysSubscriptionItem@@UAE@XZ @ 21 NONAME ; CSearchKeysSubscriptionItem::~CSearchKeysSubscriptionItem(void)
+	?RemoveMe@?$@VCSearchKeysSubscriptionItem@@@CSearchDataCache@@CAXAAPAV1@PAV1@@Z @ 22 NONAME ; void CSearchDataCache::RemoveMe<class CSearchKeysSubscriptionItem>(class CSearchKeysSubscriptionItem * &, class CSearchKeysSubscriptionItem *)
+	?SearchKeysSubscriptionItemLC@CSearchDataCache@@QAEAAVCSearchKeysSubscriptionItem@@XZ @ 23 NONAME ; class CSearchKeysSubscriptionItem & CSearchDataCache::SearchKeysSubscriptionItemLC(void)
+	?InternalizeL@CSearchKeyInfoImp@@QAEXAAVRReadStream@@@Z @ 24 NONAME ; void CSearchKeyInfoImp::InternalizeL(class RReadStream &)
+	?LinearOrder@CSearchKeyInfoImp@@SAHABV1@0@Z @ 25 NONAME ; int CSearchKeyInfoImp::LinearOrder(class CSearchKeyInfoImp const &, class CSearchKeyInfoImp const &)
+	?NewFromStreamLC@CSearchKeyInfoImp@@SAPAVCXIMPApiDataObjBase@@AAVRReadStream@@@Z @ 26 NONAME ; class CXIMPApiDataObjBase * CSearchKeyInfoImp::NewFromStreamLC(class RReadStream &)
+	?NewL@CSearchKeyInfoImp@@SAPAV1@XZ @ 27 NONAME ; class CSearchKeyInfoImp * CSearchKeyInfoImp::NewL(void)
+	?NewLC@CSearchKeyInfoImp@@SAPAV1@XZ @ 28 NONAME ; class CSearchKeyInfoImp * CSearchKeyInfoImp::NewLC(void)
+	?NewLC@CSearchKeysEventImp@@SAPAV1@PAV?$RXIMPObjOwningPtrArray@VCSearchKeyInfoImp@@@@@Z @ 29 NONAME ; class CSearchKeysEventImp * CSearchKeysEventImp::NewLC(class RXIMPObjOwningPtrArray<class CSearchKeyInfoImp> *)
+	?SetKeyInfoArray@CSearchKeysSubscriptionItem@@QAEXPAV?$RXIMPObjOwningPtrArray@VCSearchKeyInfoImp@@@@@Z @ 30 NONAME ; void CSearchKeysSubscriptionItem::SetKeyInfoArray(class RXIMPObjOwningPtrArray<class CSearchKeyInfoImp> *)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/searchfeatureplugin/bwins/searchecomhooku.def	Wed Nov 03 09:32:20 2010 +0530
@@ -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/imservices/searchfeatureplugin/bwins/searchmanageru.def	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,3 @@
+EXPORTS
+	?NewL@CSearchFeatureImp@@SAPAV1@PAVMXIMPContext@@@Z @ 1 NONAME ; class CSearchFeatureImp * CSearchFeatureImp::NewL(class MXIMPContext *)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/searchfeatureplugin/bwins/searchoperationshooku.def	Wed Nov 03 09:32:20 2010 +0530
@@ -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/imservices/searchfeatureplugin/bwins/searchoperationu.def	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,7 @@
+EXPORTS
+	??0COperationHandleSearchResult@@QAE@XZ @ 1 NONAME ; COperationHandleSearchResult::COperationHandleSearchResult(void)
+	??0COperationSearch@@QAE@XZ @ 2 NONAME ; COperationSearch::COperationSearch(void)
+	?NewL@CSearchOperationFactory@@SAPAV1@XZ @ 3 NONAME ; class CSearchOperationFactory * CSearchOperationFactory::NewL(void)
+	??0COperationGetSearchKeys@@QAE@XZ @ 4 NONAME ; COperationGetSearchKeys::COperationGetSearchKeys(void)
+	??0COperationHandleSearchKeys@@QAE@XZ @ 5 NONAME ; COperationHandleSearchKeys::COperationHandleSearchKeys(void)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/searchfeatureplugin/bwins/searchprocessorhooku.def	Wed Nov 03 09:32:20 2010 +0530
@@ -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/imservices/searchfeatureplugin/bwins/searchprocessoru.def	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,6 @@
+EXPORTS
+	?NewL@CProtocolDataHostImp@@SAPAV1@AAVMXIMPHost@@@Z @ 1 NONAME ; class CProtocolDataHostImp * CProtocolDataHostImp::NewL(class MXIMPHost &)
+	?NewL@CProtocolSearchFeatureDataHostImp@@SAPAV1@AAVMXIMPHost@@@Z @ 2 NONAME ; class CProtocolSearchFeatureDataHostImp * CProtocolSearchFeatureDataHostImp::NewL(class MXIMPHost &)
+	?NewLC@CProtocolDataHostImp@@SAPAV1@AAVMXIMPHost@@@Z @ 3 NONAME ; class CProtocolDataHostImp * CProtocolDataHostImp::NewLC(class MXIMPHost &)
+	?SearchDataCache@CProtocolSearchDataHostImp@@QAEAAVCSearchDataCache@@XZ @ 4 NONAME ; class CSearchDataCache & CProtocolSearchDataHostImp::SearchDataCache(void)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/searchfeatureplugin/eabi/searchdatamodelhooku.def	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,3 @@
+EXPORTS
+	_Z24ImplementationGroupProxyRi @ 1 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/searchfeatureplugin/eabi/searchdatamodelu.def	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,48 @@
+EXPORTS
+	_ZN14CSearchInfoImp12InternalizeLER11RReadStream @ 1 NONAME
+	_ZN14CSearchInfoImp15InfoLinearOrderERKS_S1_ @ 2 NONAME
+	_ZN14CSearchInfoImp15NewFromStreamLCER11RReadStream @ 3 NONAME
+	_ZN14CSearchInfoImp4NewLEv @ 4 NONAME
+	_ZN14CSearchInfoImp5NewLCEv @ 5 NONAME
+	_ZN15CSearchEventImp5NewLCER16CXIMPIdentityImpP22RXIMPObjOwningPtrArrayI14CSearchInfoImpE @ 6 NONAME
+	_ZN16CSearchDataCache12CleanExpiredEv @ 7 NONAME
+	_ZN16CSearchDataCache14CleanResourcesER15MXIMPPscContext @ 8 NONAME
+	_ZN16CSearchDataCache24SearchSubscriptionItemLCEv @ 9 NONAME
+	_ZN16CSearchDataCache4NewLER9MXIMPHost @ 10 NONAME
+	_ZN16CSearchDataCache8RemoveMeI23CSearchSubscriptionItemEEvRPT_S3_ @ 11 NONAME
+	_ZN17CSearchElementImp12InternalizeLER11RReadStream @ 12 NONAME
+	_ZN17CSearchElementImp15NewFromStreamLCER11RReadStream @ 13 NONAME
+	_ZN17CSearchElementImp4NewLEv @ 14 NONAME
+	_ZN17CSearchElementImp5NewLCEv @ 15 NONAME
+	_ZN23CSearchObjectFactoryImp4NewLEv @ 16 NONAME
+	_ZN23CSearchSubscriptionItem12SetSearchIdLER16CXIMPIdentityImp @ 17 NONAME
+	_ZN23CSearchSubscriptionItem16SetSearchResultsEP22RXIMPObjOwningPtrArrayI14CSearchInfoImpE @ 18 NONAME
+	_ZN23CSearchSubscriptionItemD0Ev @ 19 NONAME
+	_ZN23CSearchSubscriptionItemD1Ev @ 20 NONAME
+	_ZN23CSearchSubscriptionItemD2Ev @ 21 NONAME
+	_ZN32CSearchApiDataObjFactoryAccessor4NewLEv @ 22 NONAME
+	_ZTI16CSearchDataCache @ 23 NONAME ; #<TI>#
+	_ZTI23CSearchObjectFactoryImp @ 24 NONAME ; #<TI>#
+	_ZTI23CSearchSubscriptionItem @ 25 NONAME ; #<TI>#
+	_ZTV16CSearchDataCache @ 26 NONAME ; #<VT>#
+	_ZTV23CSearchObjectFactoryImp @ 27 NONAME ; #<VT>#
+	_ZTV23CSearchSubscriptionItem @ 28 NONAME ; #<VT>#
+	_ZThn28_N23CSearchSubscriptionItemD0Ev @ 29 NONAME ; #<thunk>#
+	_ZThn28_N23CSearchSubscriptionItemD1Ev @ 30 NONAME ; #<thunk>#
+	_ZN16CSearchDataCache28SearchKeysSubscriptionItemLCEv @ 31 NONAME
+	_ZN16CSearchDataCache8RemoveMeI27CSearchKeysSubscriptionItemEEvRPT_S3_ @ 32 NONAME
+	_ZN17CSearchKeyInfoImp11LinearOrderERKS_S1_ @ 33 NONAME
+	_ZN17CSearchKeyInfoImp12InternalizeLER11RReadStream @ 34 NONAME
+	_ZN17CSearchKeyInfoImp15NewFromStreamLCER11RReadStream @ 35 NONAME
+	_ZN17CSearchKeyInfoImp4NewLEv @ 36 NONAME
+	_ZN17CSearchKeyInfoImp5NewLCEv @ 37 NONAME
+	_ZN19CSearchKeysEventImp5NewLCEP22RXIMPObjOwningPtrArrayI17CSearchKeyInfoImpE @ 38 NONAME
+	_ZN27CSearchKeysSubscriptionItem15SetKeyInfoArrayEP22RXIMPObjOwningPtrArrayI17CSearchKeyInfoImpE @ 39 NONAME
+	_ZN27CSearchKeysSubscriptionItemD0Ev @ 40 NONAME
+	_ZN27CSearchKeysSubscriptionItemD1Ev @ 41 NONAME
+	_ZN27CSearchKeysSubscriptionItemD2Ev @ 42 NONAME
+	_ZTI27CSearchKeysSubscriptionItem @ 43 NONAME ; #<TI>#
+	_ZTV27CSearchKeysSubscriptionItem @ 44 NONAME ; #<VT>#
+	_ZThn28_N27CSearchKeysSubscriptionItemD0Ev @ 45 NONAME ; #<thunk>#
+	_ZThn28_N27CSearchKeysSubscriptionItemD1Ev @ 46 NONAME ; #<thunk>#
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/searchfeatureplugin/eabi/searchecomhooku.def	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,3 @@
+EXPORTS
+	_Z24ImplementationGroupProxyRi @ 1 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/searchfeatureplugin/eabi/searchmanageru.def	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,3 @@
+EXPORTS
+	_ZN17CSearchFeatureImp4NewLEP12MXIMPContext @ 1 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/searchfeatureplugin/eabi/searchoperationshooku.def	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,3 @@
+EXPORTS
+	_Z24ImplementationGroupProxyRi @ 1 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/searchfeatureplugin/eabi/searchoperationu.def	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,19 @@
+EXPORTS
+	_ZN16COperationSearchC1Ev @ 1 NONAME
+	_ZN16COperationSearchC2Ev @ 2 NONAME
+	_ZN23CSearchOperationFactory4NewLEv @ 3 NONAME
+	_ZN28COperationHandleSearchResultC1Ev @ 4 NONAME
+	_ZN28COperationHandleSearchResultC2Ev @ 5 NONAME
+	_ZTI16COperationSearch @ 6 NONAME ; #<TI>#
+	_ZTI28COperationHandleSearchResult @ 7 NONAME ; #<TI>#
+	_ZTV16COperationSearch @ 8 NONAME ; #<VT>#
+	_ZTV28COperationHandleSearchResult @ 9 NONAME ; #<VT>#
+	_ZN23COperationGetSearchKeysC1Ev @ 10 NONAME
+	_ZN23COperationGetSearchKeysC2Ev @ 11 NONAME
+	_ZN26COperationHandleSearchKeysC1Ev @ 12 NONAME
+	_ZN26COperationHandleSearchKeysC2Ev @ 13 NONAME
+	_ZTI23COperationGetSearchKeys @ 14 NONAME ; #<TI>#
+	_ZTI26COperationHandleSearchKeys @ 15 NONAME ; #<TI>#
+	_ZTV23COperationGetSearchKeys @ 16 NONAME ; #<VT>#
+	_ZTV26COperationHandleSearchKeys @ 17 NONAME ; #<VT>#
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/searchfeatureplugin/eabi/searchprocessorhooku.def	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,3 @@
+EXPORTS
+	_Z24ImplementationGroupProxyRi @ 1 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/searchfeatureplugin/eabi/searchprocessoru.def	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,8 @@
+EXPORTS
+	_ZN20CProtocolDataHostImp4NewLER9MXIMPHost @ 1 NONAME
+	_ZN20CProtocolDataHostImp5NewLCER9MXIMPHost @ 2 NONAME
+	_ZN26CProtocolSearchDataHostImp15SearchDataCacheEv @ 3 NONAME
+	_ZN33CProtocolSearchFeatureDataHostImp4NewLER9MXIMPHost @ 4 NONAME
+	_ZTI33CProtocolSearchFeatureDataHostImp @ 5 NONAME ; #<TI>#
+	_ZTV33CProtocolSearchFeatureDataHostImp @ 6 NONAME ; #<VT>#
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/searchfeatureplugin/group/bld.inf	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,40 @@
+/*
+* 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:  Build information file for project Search Feature Plugin
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+../rom/searchfeatureplugin.iby						 CORE_MW_LAYER_IBY_EXPORT_PATH(searchfeatureplugin.iby)
+
+PRJ_MMPFILES
+../srcsearchdatamodel/group/searchdatamodel.mmp
+../srcsearchdatamodel/group/searchdatamodelhook.mmp
+../srcsearchfrontend/group/searchmanager.mmp
+../srcsearchfrontend/group/searchecomhook.mmp
+../srcsearchprocessor/group/searchprocessor.mmp
+../srcsearchprocessor/group/searchprocessorhook.mmp
+../srcsearchoperations/group/searchoperation.mmp
+../srcsearchoperations/group/searchoperationshook.mmp
+
+PRJ_TESTMMPFILES
+
+PRJ_TESTEXPORTS
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/searchfeatureplugin/group/searchdlluids.hrh	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,62 @@
+/*
+* 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:  XIMP Framework SEARCH Feature plugin DLL uids
+*
+*/
+
+
+#ifndef SEARCHDLLUIDS_HRH
+#define SEARCHDLLUIDS_HRH
+
+
+// -----------------------------------------------------------------------------
+// Common dll uids
+// -----------------------------------------------------------------------------
+//
+#define XIMP_SEARCH_DLL_UID_STATIC_INTERFACE                   			0x1000008d
+#define XIMP_SEARCH_DLL_UID_ECOM_PLUGIN                        			0x10009D8D
+
+
+// -----------------------------------------------------------------------------
+// ECOM implementation UID
+// -----------------------------------------------------------------------------
+//
+#define XIMP_ECOM_IMPLEMENTATION_UID_SEARCH_INTERFACE   				0x2001846F
+#define XIMP_ECOM_IMPL_UID_SEARCH_DATAMODEL_INTERFACE   				0x20018470
+#define XIMP_ECOM_IMPL_UID_SEARCH_PROCESSOR_INTERFACE   				0x20018471
+#define XIMP_ECOM_IMPL_UID_SEARCH_OPERATION_INTERFACE   				0x20018472
+
+//-------------------------------------------------------------------------------------
+// HOOK uids 
+//------------------------------------------------------------------------------------
+
+#define XIMP_DLL_UID_SEARCH_HOOK                      					0x20018473
+#define XIMP_DLL_UID_SEARCH_DATAMODEL_HOOK            					0x20018474
+#define XIMP_DLL_UID_SEARCH_PROCESSOR_HOOK            					0x20018475
+#define XIMP_DLL_UID_SEARCH_OPERATIONS_HOOK            					0x20018476
+
+//-------------------------------------------------------------------------------------
+// Dll  uids 
+//------------------------------------------------------------------------------------
+
+#define XIMP_DLL_UID_SEARCH_MANAGER                   					0x20018477
+#define XIMP_DLL_UID_SEARCH_PROCESSOR	            					0x20018478
+#define XIMP_DLL_UID_SEARCH_OPERATION                   				0x20018479
+#define XIMP_DLL_UID_SEARCH_DATAMODEL                             		0x2001847A
+
+
+
+#endif // SEARCHDLLUIDS_HRH
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/searchfeatureplugin/rom/searchfeatureplugin.iby	Wed Nov 03 09:32:20 2010 +0530
@@ -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:IBY file for search feature plugin
+*
+*/
+
+#ifndef __SEARCHFEATUREPLUGIN_IBY__
+#define __SEARCHFEATUREPLUGIN_IBY__
+
+// searchfeature plugin :
+//dlls
+file=ABI_DIR\BUILD_DIR\searchmanager.dll          SHARED_LIB_DIR\searchmanager.dll
+file=ABI_DIR\BUILD_DIR\searchdatamodel.dll        SHARED_LIB_DIR\searchdatamodel.dll
+file=ABI_DIR\BUILD_DIR\searchoperation.dll        SHARED_LIB_DIR\searchoperation.dll
+file=ABI_DIR\BUILD_DIR\searchprocessor.dll        SHARED_LIB_DIR\searchprocessor.dll
+
+//ECom hook
+ECOM_PLUGIN( searchecomhook.dll, searchecomhook.rsc) 
+ECOM_PLUGIN( searchdatamodelhook.dll, searchdatamodelhook.rsc) 
+ECOM_PLUGIN( searchoperationshook.dll, searchoperationshook.rsc) 
+ECOM_PLUGIN( searchprocessorhook.dll, searchprocessorhook.rsc) 
+
+#endif
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/searchfeatureplugin/srcsearchdatamodel/apidataobjfactory.h	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  MApiDataObjFactory Declaration
+*
+*/
+
+
+
+#ifndef M_APIOBJFACTORY_H
+#define M_APIOBJFACTORY_H
+
+#include <e32std.h>
+
+class CXIMPApiDataObjBase;
+
+class MApiDataObjFactory
+    {  
+	public:
+	/**
+     * instantiation method from the stream.
+     *
+     * @param [in] aDataObjInterfaceId
+     *		interface id of the object to be constructed.
+     *
+     * @param [in] aStream
+     *        read stream from which the object is instantiated.
+     *
+     *
+	 * @return CXIMPApiDataObjBase object.
+	 * 
+	 * 
+     */
+	    
+	 virtual CXIMPApiDataObjBase* NewFromStreamLC( TInt32 aDataObjInterfaceId,
+	                                                            RReadStream& aStream ) = 0;
+    
+    };
+
+#endif // M_APIOBJFACTORY_H
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/searchfeatureplugin/srcsearchdatamodel/group/bld.inf	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,32 @@
+/*
+* 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:  Build information file for project Search Feature Plugin 
+*
+*/
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+PRJ_MMPFILES
+searchdatamodel.mmp
+searchdatamodelhook.mmp
+
+
+PRJ_TESTMMPFILES
+
+PRJ_TESTEXPORTS
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/searchfeatureplugin/srcsearchdatamodel/group/searchdatamodel.mmp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,77 @@
+/*
+* 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:  Project definition file for search Feature Plugin
+*
+*/
+
+#include <platform_paths.hrh>
+#include <data_caging_paths.hrh>
+#include "../../group/searchdlluids.hrh"
+
+TARGET                  searchdatamodel.dll
+TARGETTYPE              dll
+UID                     XIMP_SEARCH_DLL_UID_STATIC_INTERFACE  XIMP_DLL_UID_SEARCH_DATAMODEL                   
+
+CAPABILITY              CAP_GENERAL_DLL
+VENDORID                VID_DEFAULT
+
+VERSION      10.0
+// ---------------------------------------------------------------------------
+SOURCEPATH              ../search
+// ---------------------------------------------------------------------------
+
+SOURCE  				searchsubscriptionitem.cpp
+SOURCE                  searchelementimp.cpp
+SOURCE  				searcheventimp.cpp
+SOURCE  				searchinfoimp.cpp
+SOURCE  				searchkeyinfoimp.cpp
+SOURCE  				searchkeyseventimp.cpp
+SOURCE  				searchkeysubscriptionitem.cpp
+// ---------------------------------------------------------------------------
+SOURCEPATH              ../../srcsearchdatamodel
+// ---------------------------------------------------------------------------
+SOURCE                  searchdatacacheimp.cpp
+SOURCE                  searchobjectfactoryimp.cpp
+
+SOURCE                  searchapidataobjfactory.cpp
+SOURCE                  searcheventcodec.cpp
+SOURCE                  searchapidataobjfactoryaccessor.cpp
+
+
+
+USERINCLUDE             ../../srcsearchdatamodel
+USERINCLUDE             ../../srcsearchdatamodel/search
+USERINCLUDE             ../../group
+
+
+MW_LAYER_SYSTEMINCLUDE
+
+
+LIBRARY                 euser.lib
+LIBRARY                 bafl.lib
+LIBRARY                 estor.lib
+LIBRARY                 ximputils.lib
+LIBRARY                 ximpdatamodel.lib
+LIBRARY                 ecom.lib
+LIBRARY         		flogger.lib
+
+
+#if defined( ARMCC )
+DEFFILE ../../eabi/ 
+#elif defined ( WINSCW )
+deffile ../../bwins/ 
+#endif
+
+// End of file
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/searchfeatureplugin/srcsearchdatamodel/group/searchdatamodelhook.mmp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,59 @@
+/*
+* 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:  Project definition file for search Feature Plugin
+*
+*/
+
+
+#include <platform_paths.hrh>
+#include <data_caging_paths.hrh>
+#include "../../group/searchdlluids.hrh"
+
+
+TARGET                  searchdatamodelhook.dll
+CAPABILITY              CAP_ECOM_PLUGIN
+TARGETTYPE              PLUGIN
+UID                     XIMP_SEARCH_DLL_UID_ECOM_PLUGIN  XIMP_DLL_UID_SEARCH_DATAMODEL_HOOK                  
+VENDORID                VID_DEFAULT
+
+VERSION      10.0
+
+SOURCEPATH              ../searchdatamodelhook
+START RESOURCE          searchdatamodelhook.rss
+TARGET                  searchdatamodelhook.rsc
+END
+
+
+SOURCEPATH              ../searchdatamodelhook
+SOURCE                  searchdatamodelhook.cpp
+
+
+USERINCLUDE             ../../group
+USERINCLUDE             ../searchdatamodelhook
+USERINCLUDE             ../../srcsearchdatamodel
+
+
+MW_LAYER_SYSTEMINCLUDE
+
+
+LIBRARY                 euser.lib
+LIBRARY                 searchdatamodel.lib
+LIBRARY                 ecom.lib
+
+
+#if defined( ARMCC )
+DEFFILE ../../eabi/ 
+#elif defined ( WINSCW )
+deffile ../../bwins/ 
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/searchfeatureplugin/srcsearchdatamodel/search/searchelementimp.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,203 @@
+/*
+* 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:  Msearchelement  implementation.
+*
+*/
+
+
+#include <ximpobjecthelpers.h>
+#include "searchelementimp.h"
+#include "ximpidentityimp.h"
+#include "ximprbufhelpers.h"
+
+
+// ============================ MEMBER FUNCTIONS =============================
+
+// ---------------------------------------------------------------------------
+// CSearchElementImp::NewLC()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CSearchElementImp* CSearchElementImp::NewLC()
+    {
+    CSearchElementImp* self = new( ELeave ) CSearchElementImp;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CSearchElementImp::NewL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CSearchElementImp* CSearchElementImp::NewL()
+    {
+    CSearchElementImp* self = NewLC();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CSearchElementImp::NewFromStreamLC()
+// ---------------------------------------------------------------------------
+//
+XIMPIMP_IMPLEMENT_DATAOBJ_NEWFROMSTREAM( CSearchElementImp )
+
+// ---------------------------------------------------------------------------
+// Implement supported interface access.
+// ---------------------------------------------------------------------------
+//
+XIMPIMP_IF_BASE_GET_INTERFACE_BEGIN( CSearchElementImp, MSearchElement )
+XIMPIMP_IF_BASE_GET_INTERFACE_END()
+XIMPIMP_IF_BASE_GET_CONST_INTERFACE_BEGIN( CSearchElementImp, MSearchElement )
+XIMPIMP_IF_BASE_GET_INTERFACE_END()
+
+// ---------------------------------------------------------------------------
+// CSearchElementImp::~CSearchElementImp()
+// ---------------------------------------------------------------------------
+//
+CSearchElementImp::~CSearchElementImp()
+    {
+    delete iIdentity;
+    iIdentity=NULL;
+    delete iLabelIdentity;
+    iLabelIdentity=NULL;
+    }
+
+// ---------------------------------------------------------------------------
+// CSearchElementImp::CSearchElementImp()
+// ---------------------------------------------------------------------------
+//
+CSearchElementImp::CSearchElementImp()
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// CSearchElementImp::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void CSearchElementImp::ConstructL()
+    {
+    iIdentity = CXIMPIdentityImp::NewLC();
+    CleanupStack::Pop( iIdentity );
+    iLabelIdentity = CXIMPIdentityImp::NewLC();
+    CleanupStack::Pop( iLabelIdentity );
+    }
+
+// ---------------------------------------------------------------------------
+// CSearchElementImp::ExternalizeL()
+// ---------------------------------------------------------------------------
+//
+void CSearchElementImp::ExternalizeL( RWriteStream& aStream ) const
+    {
+    iIdentity->ExternalizeL(aStream);
+    iLabelIdentity->ExternalizeL(aStream);
+    aStream.WriteInt32L(iSearchKey);
+    }
+
+// ---------------------------------------------------------------------------
+// CSearchElementImp::InternalizeL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CSearchElementImp::InternalizeL( RReadStream& aStream )
+    {
+    iIdentity->InternalizeL(aStream);
+    iLabelIdentity->InternalizeL(aStream);
+   	iSearchKey=aStream.ReadInt32L();
+    }
+  
+    
+
+
+// ---------------------------------------------------------------------------
+// CSearchElementImp::EqualsContent()
+// ---------------------------------------------------------------------------
+//
+TBool CSearchElementImp::EqualsContent( 
+    const CXIMPApiDataObjBase& /*aOtherInstance*/ ) const
+    {
+    return ETrue;
+    }
+ // ---------------------------------------------------------------------------
+// CSearchElementImp::SetRequestL
+// ---------------------------------------------------------------------------
+//
+void CSearchElementImp::SetRequestL( MXIMPIdentity& aSearchStringId,
+        										  TSearchKey aKey )
+                                   				  
+    {
+    if ( EReadLabel == aKey ) // if client trys to set EReadLabel then leave
+        {
+        User::Leave(  KErrArgument );
+        }
+    const CXIMPIdentityImp* identityImp =
+    			TXIMPGetImpClassOrPanic< CXIMPIdentityImp>::From( aSearchStringId );
+    						
+    delete iIdentity;
+    iIdentity=NULL;
+    iIdentity =TXIMPObjectCloner< CXIMPIdentityImp>::CloneL(*identityImp );
+    						
+    iSearchKey=aKey;
+   
+    }
+
+// ---------------------------------------------------------------------------
+// CSearchElementImp::SetRequestL
+// ---------------------------------------------------------------------------
+//
+void CSearchElementImp::SetRequestL( MXIMPIdentity& aSearchStringId,
+                                     MXIMPIdentity& aLabelId )
+                                                  
+    {
+    const CXIMPIdentityImp* identityImp =
+                TXIMPGetImpClassOrPanic< CXIMPIdentityImp>::From( aSearchStringId );
+                            
+    delete iIdentity;
+    iIdentity=NULL;
+    iIdentity =TXIMPObjectCloner< CXIMPIdentityImp>::CloneL(*identityImp );
+    
+    const CXIMPIdentityImp* labelIdentity = TXIMPGetImpClassOrPanic< CXIMPIdentityImp>::From( aLabelId );                      
+    delete iLabelIdentity;
+    iLabelIdentity=NULL;
+    iLabelIdentity =TXIMPObjectCloner< CXIMPIdentityImp>::CloneL(*labelIdentity );
+    iSearchKey = EReadLabel ; // make sure that if label is there then key is EReadLabel
+   
+    }
+// ---------------------------------------------------------------------------
+// CSearchElementImp::GetSearchId
+// ---------------------------------------------------------------------------
+//    
+MXIMPIdentity& CSearchElementImp::GetSearchId() const
+    {
+    return *iIdentity;	
+    }
+// ---------------------------------------------------------------------------
+// CSearchElementImp::GetSearchLabel
+// ---------------------------------------------------------------------------
+//    
+MXIMPIdentity& CSearchElementImp::GetSearchLabel() const
+    {
+    return *iLabelIdentity;  
+    }
+// ---------------------------------------------------------------------------
+// CSearchElementImp ::GetSearchKey
+// ---------------------------------------------------------------------------
+//        
+TSearchKey CSearchElementImp::GetSearchKey() const
+   {
+   return (TSearchKey)iSearchKey;
+   }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/searchfeatureplugin/srcsearchdatamodel/search/searchelementimp.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,129 @@
+/*
+* 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:  Msearchelement  implementation.
+*
+*/
+
+#ifndef CSEARCHELEMENTIMP_H
+#define CSEARCHELEMENTIMP_H
+
+
+#include <s32strm.h>
+#include <badesca.h>
+#include <searchelement.h>
+#include "ximpapidataobjbase.h"
+#include "searchapiobjbase.h"
+
+
+class CSearchElementImp;
+class CXIMPIdentityImp;
+/**
+ * MSearchElement  implementation.
+ *
+ * @lib searchdatamodel.dll
+ */
+NONSHARABLE_CLASS( CSearchElementImp ): public CXIMPApiDataObjBase,public MSearchElement
+    {
+    public:
+    /** The class ID. */
+    enum { KClassId = IMP_CLSID_CSEARCHELEMENTIMP };
+
+	public:
+	 	/**
+    	 * Construction :NewLC
+     	 */
+	    IMPORT_C static CSearchElementImp* NewLC();
+	    /**
+    	 * Construction :NewL
+     	 */
+	    IMPORT_C static CSearchElementImp* NewL();
+	    /**
+         * Destructor
+         */
+	    virtual ~CSearchElementImp();
+
+	private:
+		/**
+	     * constructor
+	     */
+	    CSearchElementImp();
+	    /**
+	     * 2nd phase constructor
+	     */
+	    void ConstructL();
+	    
+	public: // From CXIMPApiDataObjBase
+
+	    /**
+	     * @see CXIMPApiDataObjBase
+	     */
+	    XIMPIMP_DECLARE_DATAOBJ_BASE_METHODS
+	    XIMPIMP_DECLARE_IF_BASE_METHODS
+	    
+	                         
+	public: // New functions
+
+	    /**
+	     * Internalizes object data from given stream.
+	     * @param aStream Stream to read.
+	     */
+	   IMPORT_C void InternalizeL( RReadStream& aStream );
+	   
+ 		/**
+	     * 
+	     * @see MSearchElement
+	     */
+	    void SetRequestL( MXIMPIdentity& aSearchId,TSearchKey aKey) ;
+	    /**
+         * 
+         * @see MSearchElement
+         */
+	    void SetRequestL( MXIMPIdentity& aSearchId, MXIMPIdentity& aLabelId) ;  
+	    /**
+         * 
+         * @see MSearchElement
+         */
+	    MXIMPIdentity&  GetSearchLabel() const;
+	    
+	   	/**
+	     * 
+	     * @see MSearchElement
+	     */   
+	    MXIMPIdentity&  GetSearchId() const;
+	   
+	   	/**
+	     * 
+	     * @see MSearchElement
+	     */     
+	    TSearchKey  GetSearchKey() const;  
+	     
+	private:
+	    /**
+         * CXIMPIdentityImp for search id :  owned
+         */
+	    CXIMPIdentityImp* iIdentity; 
+	    /**
+         * CXIMPIdentityImp for label :   owned
+         */
+	    CXIMPIdentityImp* iLabelIdentity; 
+	    /**
+         * search key
+         */
+	    TInt iSearchKey;
+	    
+	   
+    };
+
+
+#endif // CSEARCHELEMENTIMP_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/searchfeatureplugin/srcsearchdatamodel/search/searcheventimp.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,215 @@
+/*
+* 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:  MSearchEvent API object implementation.
+ *
+*/
+
+#include "searcheventimp.h"
+#include "ximpapiobjbase.h"
+#include "ximpapieventbase.h"
+#include "searchinfoimp.h"
+#include <ximpbase.h>
+#include "ximpobjecthelpers.h"
+#include "ximpidentityimp.h"
+// ---------------------------------------------------------------------------
+// CSearchEventImp::NewLC()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CSearchEventImp* CSearchEventImp::NewLC(CXIMPIdentityImp& aGroupId,
+            									RSearchInfoImpArray* aSearchResults)
+    {
+    CSearchEventImp* self = new( ELeave ) CSearchEventImp();
+    CleanupStack::PushL( self );
+    self->ConstructL( aGroupId,	aSearchResults );
+            
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CSearchEventImp::NewFromStreamLC()
+// ---------------------------------------------------------------------------
+//
+CXIMPApiEventBase* CSearchEventImp::NewFromStreamLC( RReadStream& aStream )
+    {
+    CSearchEventImp* self = new( ELeave ) CSearchEventImp;
+    CleanupStack::PushL( self );
+    self->ConstructL( aStream );
+    return self;
+    }
+// ---------------------------------------------------------------------------
+// CSearchEventImp::EqualsContent
+// ---------------------------------------------------------------------------
+//
+TBool CSearchEventImp::EqualsContent( 
+    const CXIMPApiEventBase& /*aOtherInstance*/ ) const 
+    {
+    return ETrue;
+    }
+
+// ---------------------------------------------------------------------------
+// From class CXIMPApiEventBase
+// CSearchEventImp::ExternalizeL
+// ---------------------------------------------------------------------------
+//
+void CSearchEventImp::ExternalizeL( RWriteStream& aStream ) const
+    {
+    iSearchId->ExternalizeL( aStream );
+    WriteArrayToStreamL( *iSearchResults, aStream );
+    }
+
+
+// ---------------------------------------------------------------------------
+// CSearchEventImp::~CSearchEventImp()
+// ---------------------------------------------------------------------------
+//
+CSearchEventImp::~CSearchEventImp()
+    {
+    delete iSearchId;
+    delete iSearchResults;
+    iSearchResults=NULL;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CSearchEventImp::CSearchEventImp()
+// ---------------------------------------------------------------------------
+//
+CSearchEventImp::CSearchEventImp()
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// CSearchEventImp::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void CSearchEventImp::ConstructL(CXIMPIdentityImp& aSearchId,
+            						RSearchInfoImpArray* aSearchResults)
+    {
+    iSearchId=&aSearchId;   // ownership is transfered here, need to delete 
+    iSearchResults=aSearchResults; // ownership is transfered here, need to delete 
+    }
+
+
+// ---------------------------------------------------------------------------
+// CSearchEventImp::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void CSearchEventImp::ConstructL( RReadStream& aStream )
+    {
+    iConstructedFromStream = ETrue;
+    iSearchId = CXIMPIdentityImp::NewLC();
+    CleanupStack::Pop( 1 ); // iSearchId
+    iSearchResults = new ( ELeave ) RSearchInfoImpArray;
+    InternalizeL( aStream );
+    }
+
+// ---------------------------------------------------------------------------
+// Implement supported interface access.
+// ---------------------------------------------------------------------------
+//
+XIMPIMP_IF_BASE_GET_INTERFACE_BEGIN( CSearchEventImp,
+                                     MSearchEvent )
+    XIMPIMP_IF_BASE_GET_CLASS( CXIMPApiEventBase, this )
+XIMPIMP_IF_BASE_GET_INTERFACE_END()
+
+XIMPIMP_IF_BASE_GET_CONST_INTERFACE_BEGIN( CSearchEventImp,
+                                           MSearchEvent )
+    XIMPIMP_IF_BASE_GET_CONST_CLASS( CXIMPApiEventBase, this ) 
+XIMPIMP_IF_BASE_GET_INTERFACE_END()
+
+
+
+// ---------------------------------------------------------------------------
+// Implement methods from base event interface and base event class
+// ---------------------------------------------------------------------------
+//
+XIMPIMP_IMPLEMENT_EVENT_BASE_METHODS( CSearchEventImp,
+                                      MSearchEvent )
+
+
+
+// ---------------------------------------------------------------------------
+// CSearchEventImp::SearchCount()
+// ---------------------------------------------------------------------------
+//	
+ TInt CSearchEventImp::SearchResultCount() const 
+	 {
+	 return iSearchResults->Count();	
+	 }
+// ---------------------------------------------------------------------------
+// CSearchEventImp::Search()
+// ---------------------------------------------------------------------------
+//	 
+ const MSearchInfo& CSearchEventImp::SearchResult( TInt aIndex ) const 
+	 {
+	 return *(*iSearchResults)[ aIndex ]; 	
+	 
+	 }
+
+// ---------------------------------------------------------------------------
+// CSearchEventImp::Search()
+// ---------------------------------------------------------------------------
+//
+    
+  const MXIMPIdentity& CSearchEventImp::SearchId() const 
+	  {
+	  return *iSearchId;	
+	  }
+    // ---------------------------------------------------------------------------
+// CSearchEventImp::WriteArrayToStreamL()
+// ---------------------------------------------------------------------------
+//
+void CSearchEventImp::WriteArrayToStreamL(
+        RSearchInfoImpArray& aArray, RWriteStream& aStream ) const
+    {
+    TInt count = aArray.Count();
+    aStream.WriteInt32L( count );
+        {
+        for( TInt a = 0; a < count; ++a )
+            {
+            aArray[ a ]->ExternalizeL( aStream );
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CSearchEventImp::FillArrayFromStreamL
+// ---------------------------------------------------------------------------
+//
+void CSearchEventImp::FillArrayFromStreamL(
+        RSearchInfoImpArray& aArray,
+        RReadStream& aStream )
+    {
+    TInt count = aStream.ReadInt32L();
+    for( TInt a = 0; a < count; ++a )
+        {
+        // the stream MUST be in order (since it was externalized by this class)
+        CSearchInfoImp* newInfo = CSearchInfoImp::NewLC();
+        newInfo->InternalizeL( aStream );
+        aArray.AppendL( newInfo ); // trap here if there is  any error in the append
+        CleanupStack::Pop(); // newInfo
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CSearchEventImp::InternalizeL( )
+// ---------------------------------------------------------------------------
+//
+
+void CSearchEventImp::InternalizeL(  RReadStream& aStream ) 
+    { 
+    iSearchId->InternalizeL( aStream ); 
+    FillArrayFromStreamL( *iSearchResults, aStream );  
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/searchfeatureplugin/srcsearchdatamodel/search/searcheventimp.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,156 @@
+/*
+* 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:  MSearchEvent API object implementation.
+ *
+*/
+
+#ifndef CSEARCHEVENTIMP_H
+#define CSEARCHEVENTIMP_H
+
+#include  <s32strm.h>
+#include "ximpapieventbase.h"
+#include <searchevent.h>
+#include "searchapiobjbase.h"
+#include "searchtypehelpers.h"
+
+class RReadStream;
+class CXIMPIdentityImp;
+class CSearchInfoImp;
+class MXIMPIdentity;
+/**
+ * MSearchEvent API object implementation.
+ *
+ * @lib searchdatamodel.dll
+ */
+NONSHARABLE_CLASS( CSearchEventImp ): public CXIMPApiEventBase,public MSearchEvent
+    {
+	public:
+	    /** The class ID. */
+	    enum { KClassId = IMP_CLSID_CSEARCHEVENTIMP  };
+
+	public:
+	    /**
+	     * Exported instantiation method for initializing
+	     * new event object.
+	     */
+	    IMPORT_C static CSearchEventImp* NewLC( CXIMPIdentityImp& aSearchId,
+                                	            RSearchInfoImpArray* aSearchResults );
+     
+	    /**
+	     * Instantiation method for event automation.
+	     * Method signature must be exactly this to work
+	     * with event delivery automation system.
+	     *
+	     * Event implementation must be registered to
+	     * SearchEventCodec KApiEventConstructorTable.
+	     */
+	    static CXIMPApiEventBase* NewFromStreamLC( RReadStream& aStream );
+	    
+		/**
+         * Destructor
+         */
+	    virtual ~CSearchEventImp();
+
+	private:
+		/**
+	     * constructor
+	     */
+	    CSearchEventImp();
+	    
+	    /**
+	     * 2nd phase constructor
+	     */
+	    void ConstructL( CXIMPIdentityImp& aSearchId,
+	            		RSearchInfoImpArray* aSearchResults );
+	            
+		/**
+	     * 2nd phase constructor
+	     */
+	    void ConstructL( RReadStream& aStream );
+
+	    
+
+	    /**
+	     * Helper for internalize
+	     */
+	    void InternalizeL( RReadStream& aStream ) ;
+	     /**
+	     * Helper for externalize
+	     */        
+		void WriteArrayToStreamL(RSearchInfoImpArray& aArray, RWriteStream& aStream ) const;
+		
+	    /**
+	     * Helper for internalize
+	     */
+	    void FillArrayFromStreamL( RSearchInfoImpArray& aArray,
+	            RReadStream& aStream );
+	    
+
+	public: // From API base interfaces
+
+	    /**
+	     * Implementation of MXIMPBase interface methods
+	     * @see MXIMPBase
+	     */
+	      XIMPIMP_DECLARE_IF_BASE_METHODS
+
+	    /**
+	     * Implementation of MSearchEventBase interface and
+	     * CSearchApiEventBase methods
+	     *
+	     */
+	   	XIMPIMP_DECLARE_EVENT_BASE_METHODS
+
+
+	public: // From MSearchEvent
+		/**
+	     * 
+	     * @see MSearchEvent
+	     */
+	 	virtual TInt SearchResultCount() const ;
+	    
+	    
+	    /**
+	     * Gets the searched result by index.
+	     *
+	     * @param [in] aIndex
+	     *        The index of the search.
+	     *
+	     * @return The searched result from given index.
+	     */
+	    virtual const MSearchInfo& SearchResult( TInt aIndex ) const ;
+	    /**
+	     * 
+	     * @see MSearchEvent
+	     */
+	    virtual const MXIMPIdentity& SearchId() const;
+	    
+	private: // data
+
+		/**
+	     * Search Info array 
+	     * Own.
+	     */
+	     RSearchInfoImpArray* iSearchResults;
+	     
+	     /**
+         * CXIMPIdentityImp :  owned
+         */
+		 CXIMPIdentityImp*    iSearchId ;
+		 
+		 TBool iConstructedFromStream;
+    };
+
+
+#endif // CSEARCHEVENTIMP_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/searchfeatureplugin/srcsearchdatamodel/search/searchinfoimp.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,210 @@
+/*
+* 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:  MsearchInfo API object implementation.
+*
+*/
+
+#include "searchinfoimp.h"
+#include "ximpidentityimp.h"
+#include "ximprbufhelpers.h"
+#include "ximpobjecthelpers.h"
+
+// ============================ MEMBER FUNCTIONS =============================
+
+// ---------------------------------------------------------------------------
+// CSearchInfoImp::NewLC()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CSearchInfoImp* CSearchInfoImp::NewLC()
+    {
+    CSearchInfoImp* self = new( ELeave ) CSearchInfoImp;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CSearchInfoImp::NewL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CSearchInfoImp* CSearchInfoImp::NewL()
+    {
+    CSearchInfoImp* self = NewLC();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CSearchInfoImp::NewFromStreamLC()
+// ---------------------------------------------------------------------------
+//
+XIMPIMP_IMPLEMENT_DATAOBJ_NEWFROMSTREAM( CSearchInfoImp )
+
+// ---------------------------------------------------------------------------
+// Implement supported interface access.
+// ---------------------------------------------------------------------------
+//
+XIMPIMP_IF_BASE_GET_INTERFACE_BEGIN( CSearchInfoImp, MSearchInfo )
+XIMPIMP_IF_BASE_GET_INTERFACE_END()
+XIMPIMP_IF_BASE_GET_CONST_INTERFACE_BEGIN( CSearchInfoImp, MSearchInfo )
+XIMPIMP_IF_BASE_GET_INTERFACE_END()
+
+// ---------------------------------------------------------------------------
+// CSearchInfoImp::~CSearchInfoImp()
+// ---------------------------------------------------------------------------
+//
+CSearchInfoImp::~CSearchInfoImp()
+    {
+    iFirstname.Close();
+    iLastname.Close();
+    iEmailId.Close();
+    }
+
+// ---------------------------------------------------------------------------
+// CSearchInfoImp::CSearchInfoImp()
+// ---------------------------------------------------------------------------
+//
+CSearchInfoImp::CSearchInfoImp()
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// CSearchInfoImp::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void CSearchInfoImp::ConstructL()
+    {
+    iFirstname.CreateL( 0 );
+    iLastname.CreateL( 0 );
+    iEmailId.CreateL( 0 );
+    }
+
+// ---------------------------------------------------------------------------
+// CSearchInfoImp::ExternalizeL()
+// ---------------------------------------------------------------------------
+//
+void CSearchInfoImp::ExternalizeL( RWriteStream& aStream ) const
+    {
+  
+    XIMPRBuf16Helper::ExternalizeL( iFirstname, aStream );
+    XIMPRBuf16Helper::ExternalizeL( iLastname, aStream );
+    XIMPRBuf16Helper::ExternalizeL( iEmailId, aStream ); 
+    }
+
+// ---------------------------------------------------------------------------
+// CSearchInfoImp::InternalizeL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CSearchInfoImp::InternalizeL( RReadStream& aStream )
+    {
+    XIMPRBuf16Helper::InternalizeL( iFirstname, aStream );
+    XIMPRBuf16Helper::InternalizeL( iLastname, aStream );
+    XIMPRBuf16Helper::InternalizeL( iEmailId, aStream );
+     
+    }
+  
+
+
+// ---------------------------------------------------------------------------
+// From MSearchInfo class.
+// CSearchInfoImp::GetFieldInfo()
+// ---------------------------------------------------------------------------
+//
+const TDesC16& CSearchInfoImp::GetFieldInfo(TInfoType aType) const
+    {
+     switch(aType)
+	     {
+	   	 case EFirstName:
+		   	 {
+		   	 return iFirstname;	
+		   	 }
+	   	 case ELastName:
+		   	 {
+		   	 return iLastname;	
+		   	 }
+	   	 case EEmailAddress:
+		   	 {
+		   	 return iEmailId;	
+		   	 }
+	     default :
+	         {
+	         return KNullDesC();
+	         }
+	     }
+    }
+    
+
+
+// ---------------------------------------------------------------------------
+// From MsearchInfo class.
+// CSearchInfoImp::SetFieldInfoL()
+// ---------------------------------------------------------------------------
+//
+void CSearchInfoImp::SetFieldInfoL(const TDesC16& aFieldInfo ,TInfoType aType) 
+    
+    {
+    switch(aType)
+	     {
+	   	 case EFirstName:
+		   	 {
+		   	 HBufC16* buf = aFieldInfo.AllocL();
+    		 iFirstname.Close();
+    		 iFirstname.Assign( buf );
+		   	 break;
+		   	 }
+	   	 case ELastName:
+		   	 {
+		   	 HBufC16* buf= aFieldInfo.AllocL();
+    		 iLastname.Close();
+             iLastname.Assign( buf );
+		   	 break;	
+		   	 }
+	   	 case EEmailAddress:
+		   	 {
+		   	 HBufC16* buf = aFieldInfo.AllocL();
+    		 iEmailId.Close();
+    		 iEmailId.Assign( buf );
+		   	 break;	
+		   	 }
+	   
+	     }
+   
+    }
+ 
+
+// ---------------------------------------------------------------------------
+// CSearchInfoImp::EqualsContent()
+// ---------------------------------------------------------------------------
+//
+TBool CSearchInfoImp::EqualsContent( 
+    const CXIMPApiDataObjBase& /*aOtherInstance*/ ) const
+    {
+    return ETrue; 
+    }
+// ---------------------------------------------------------------------------
+// CSearchInfoImp:: InfoLinearOrder
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CSearchInfoImp::InfoLinearOrder(
+        const CSearchInfoImp& /*aA*/,
+        const CSearchInfoImp& /*aB*/ )
+    {
+    // Just returns 1 so that the results are appended as they come from server.
+    return 1;
+    }
+    
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/searchfeatureplugin/srcsearchdatamodel/search/searchinfoimp.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,120 @@
+/*
+* 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:  MsearchInfo API object implementation.
+*
+*/
+
+#ifndef CSEARCHINFOIMP_H
+#define CSEARCHINFOIMP_H
+
+
+#include <s32strm.h>
+#include <badesca.h>
+#include <searchinfo.h>
+#include "ximpapidataobjbase.h"
+#include "searchapiobjbase.h"
+
+
+class CSearchInfoImp;
+class CXIMPIdentityImp;
+/**
+ * MsearchInfo API object implementation.
+ *
+ * @lib searchdatamodel.dll
+ */
+NONSHARABLE_CLASS( CSearchInfoImp ): public CXIMPApiDataObjBase,public MSearchInfo
+    {
+    public:
+    /** The class ID. */
+    enum { KClassId = IMP_CLSID_CSEARCHINFOIMP };
+
+	public:
+		/**
+    	 * Construction :NewLC
+     	 */
+	    IMPORT_C static CSearchInfoImp* NewLC();
+	    /**
+    	 * Construction :NewL
+     	 */
+	    IMPORT_C static CSearchInfoImp* NewL();
+	    
+	    /**
+         * Destructor
+         */
+	    virtual ~CSearchInfoImp();
+
+	private:
+		/**
+	     * constructor
+	     */
+	    CSearchInfoImp();
+	    
+	    /**
+	     * 2nd phase constructor
+	     */
+	    void ConstructL();
+	    
+	public: // From CXIMPApiDataObjBase
+
+	    /**
+	     * @see CXIMPApiDataObjBase
+	     */
+	    XIMPIMP_DECLARE_DATAOBJ_BASE_METHODS
+	    XIMPIMP_DECLARE_IF_BASE_METHODS
+
+	                         
+	public: // New functions
+
+	    /**
+	     * Internalizes object data from given stream.
+	     * @param aStream Stream to read.
+	     */
+	    IMPORT_C void InternalizeL( RReadStream& aStream );
+	    
+	    /**
+	     * 
+	     * @see MSearchInfo
+	     */
+	   const TDesC16& GetFieldInfo(TInfoType aType ) const;
+
+		/**
+	     * 
+	     * @see MSearchInfo
+	     */
+	   void SetFieldInfoL(const TDesC16& aFieldInfo, TInfoType aType) ;
+	   
+		/**
+	     * returns the order of elements
+	     * @  return '1' always here  : 
+	     */
+	   IMPORT_C  static TInt InfoLinearOrder(const CSearchInfoImp& aA,
+	        						 const CSearchInfoImp& aB ) ;
+	        
+
+	private: // data
+
+	    
+	    /**
+	     *  buffers : all owned 
+	     */
+	    RBuf16 iFirstname; // owned
+	    
+	    RBuf16 iLastname;  // owned
+	    
+	    RBuf16 iEmailId;   // owned
+	    
+    };
+
+
+#endif // CSEARCHINFOIMP_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/searchfeatureplugin/srcsearchdatamodel/search/searchkeyinfoimp.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,198 @@
+/*
+* 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:  Msearchkeyinfo API object implementation.
+*
+*/
+
+#include "searchkeyinfoimp.h"
+#include "ximprbufhelpers.h"
+#include "ximpobjecthelpers.h"
+
+// ============================ MEMBER FUNCTIONS =============================
+
+// ---------------------------------------------------------------------------
+// CSupportedSearchKeyImp::NewLC()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CSearchKeyInfoImp* CSearchKeyInfoImp::NewLC()
+    {
+    CSearchKeyInfoImp* self = new( ELeave ) CSearchKeyInfoImp;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CSearchKeyInfoImp::NewL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CSearchKeyInfoImp* CSearchKeyInfoImp::NewL()
+    {
+    CSearchKeyInfoImp* self = NewLC();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CSearchKeyInfoImp::NewFromStreamLC()
+// ---------------------------------------------------------------------------
+//
+XIMPIMP_IMPLEMENT_DATAOBJ_NEWFROMSTREAM( CSearchKeyInfoImp )
+
+// ---------------------------------------------------------------------------
+// Implement supported interface access.
+// ---------------------------------------------------------------------------
+//
+XIMPIMP_IF_BASE_GET_INTERFACE_BEGIN( CSearchKeyInfoImp, MSearchKeyInfo )
+XIMPIMP_IF_BASE_GET_INTERFACE_END()
+XIMPIMP_IF_BASE_GET_CONST_INTERFACE_BEGIN( CSearchKeyInfoImp, MSearchKeyInfo )
+XIMPIMP_IF_BASE_GET_INTERFACE_END()
+
+// ---------------------------------------------------------------------------
+// CSearchKeyInfoImp::~CSearchKeyInfoImp()
+// ---------------------------------------------------------------------------
+//
+CSearchKeyInfoImp::~CSearchKeyInfoImp()
+    {
+    iLabel.Close();
+    }
+
+// ---------------------------------------------------------------------------
+// CSearchKeyInfoImp::CSearchKeyInfoImp()
+// ---------------------------------------------------------------------------
+//
+CSearchKeyInfoImp::CSearchKeyInfoImp()
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// CSearchKeyInfoImp::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void CSearchKeyInfoImp::ConstructL()
+    {
+    iLabel.CreateL( 0 );
+    }
+
+// ---------------------------------------------------------------------------
+// CSearchKeyInfoImp::ExternalizeL()
+// ---------------------------------------------------------------------------
+//
+void CSearchKeyInfoImp::ExternalizeL( RWriteStream& aStream ) const
+    {
+    aStream.WriteInt32L( iKeyType );
+    aStream.WriteInt32L( iKey );
+    XIMPRBuf16Helper::ExternalizeL( iLabel, aStream );
+    }
+
+// ---------------------------------------------------------------------------
+// CSearchKeyInfoImp::InternalizeL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CSearchKeyInfoImp::InternalizeL( RReadStream& aStream )
+    {
+    iKeyType = aStream.ReadInt32L(); 
+    iKey = aStream.ReadInt32L(); 
+    XIMPRBuf16Helper::InternalizeL( iLabel, aStream );
+    }
+  
+
+
+// ---------------------------------------------------------------------------
+// 
+// CSearchKeyInfoImp::Key()
+// ---------------------------------------------------------------------------
+//
+TSearchKey CSearchKeyInfoImp::Key() const
+    {
+    return (TSearchKey)iKey;
+    }
+    
+
+
+// ---------------------------------------------------------------------------
+// CSearchKeyInfoImp::SetKey
+// ---------------------------------------------------------------------------
+//
+void CSearchKeyInfoImp::SetKey(TSearchKey aKey) 
+    
+    {
+    iKey = aKey;
+    }
+// ---------------------------------------------------------------------------
+// 
+// CSearchKeyInfoImp::Key()
+// ---------------------------------------------------------------------------
+//
+TKeyType CSearchKeyInfoImp::Type() const
+    {
+    return (TKeyType)iKeyType;
+    }
+    
+
+
+// ---------------------------------------------------------------------------
+// CSearchKeyInfoImp::SetKey
+// ---------------------------------------------------------------------------
+//
+void CSearchKeyInfoImp::SetType(TKeyType  aType) 
+    
+    {
+    iKeyType = aType;
+    }
+
+// ---------------------------------------------------------------------------
+// CSearchKeyInfoImp::Label()
+// ---------------------------------------------------------------------------
+//
+const TDesC16& CSearchKeyInfoImp::Label() const
+    {
+    return iLabel;
+    }
+ 
+// ---------------------------------------------------------------------------.
+// CSearchKeyInfoImp::SetLabelL()
+// ---------------------------------------------------------------------------
+//
+void CSearchKeyInfoImp::SetLabelL(const TDesC16& aLabel) 
+    
+    {
+    iLabel.Close();
+    iLabel.Assign(  aLabel.AllocL() );
+    }
+// ---------------------------------------------------------------------------
+// CSearchKeyInfoImp::EqualsContent()
+// ---------------------------------------------------------------------------
+//
+TBool CSearchKeyInfoImp::EqualsContent( 
+    const CXIMPApiDataObjBase& /*aOtherInstance*/ ) const
+    {
+    return ETrue; 
+    }
+// ---------------------------------------------------------------------------
+// CSearchKeyInfoImp::LinearOrder
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CSearchKeyInfoImp::LinearOrder(
+        const CSearchKeyInfoImp& /*aA*/,
+       const CSearchKeyInfoImp& /*aB*/ )
+    {
+    // Just returns 1 so that the Keys are appended as they come from server.
+    return 1;
+    }
+    
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/searchfeatureplugin/srcsearchdatamodel/search/searchkeyinfoimp.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,125 @@
+/*
+* 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:  MSupportedSearchKey API object implementation.
+*
+*/
+
+#ifndef CSEARCHKEYINFOIMP_H
+#define CSEARCHKEYINFOIMP_H
+
+
+#include <s32strm.h>
+#include <badesca.h>
+#include <searchkeyinfo.h>
+#include "ximpapidataobjbase.h"
+#include "searchapiobjbase.h"
+
+
+/**
+ * MSearchKeyInfo API object implementation.
+ *
+ * @lib searchdatamodel.dll
+ */
+NONSHARABLE_CLASS( CSearchKeyInfoImp ): public CXIMPApiDataObjBase, public MSearchKeyInfo
+    {
+    public:
+    /** The class ID. */
+    enum { KClassId = IMP_CLSID_CSEARCHKEY_INFO_IMP };
+
+	public:
+		/**
+    	 * Construction :NewLC
+     	 */
+	    IMPORT_C static CSearchKeyInfoImp* NewLC();
+	    /**
+    	 * Construction :NewL
+     	 */
+	    IMPORT_C static CSearchKeyInfoImp* NewL();
+	    
+	    /**
+         * Destructor
+         */
+	    virtual ~CSearchKeyInfoImp();
+
+	private:
+		/**
+	     * constructor
+	     */
+	    CSearchKeyInfoImp();
+	    
+	    /**
+	     * 2nd phase constructor
+	     */
+	    void ConstructL();
+	    
+	public: // From CXIMPApiDataObjBase
+
+	    /**
+	     * @see CXIMPApiDataObjBase
+	     */
+	    XIMPIMP_DECLARE_DATAOBJ_BASE_METHODS
+	    XIMPIMP_DECLARE_IF_BASE_METHODS
+
+	                         
+	public: // from  MSearchKeyInfo
+
+	    /**
+	     * Internalizes object data from given stream.
+	     * @param aStream Stream to read.
+	     */
+	    IMPORT_C void InternalizeL( RReadStream& aStream );
+	    
+	    /**
+	     * 
+	     * @see MSearchKeyInfo
+	     */
+	    TSearchKey Key() const ; 
+	     void SetKey( TSearchKey aKey) ;
+	     
+	    /**
+         * 
+         * @see MSearchKeyInfo
+         */
+	     TKeyType  Type()const ;
+	     void SetType(TKeyType aType);
+	     
+	     /**
+          * 
+          * @see MSearchKeyInfo
+          */
+	     const TDesC16&  Label() const;
+	     void  SetLabelL(const TDesC16& aLabel);
+	     
+		/**
+	     * returns the order of elements
+	     * @  return '1' always here  : 
+	     */
+	   IMPORT_C  static TInt LinearOrder(  const CSearchKeyInfoImp& aA,
+	        						       const CSearchKeyInfoImp& aB  ) ;
+	        
+
+	private: // data
+
+	    // key
+	    TInt iKey;
+	    
+	    //key type
+	    TInt iKeyType;
+	    
+	    //Lablel : owned
+	    RBuf16 iLabel; 
+    };
+
+
+#endif // CSEARCHKEYINFOIMP_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/searchfeatureplugin/srcsearchdatamodel/search/searchkeyseventimp.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,197 @@
+/*
+* 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:  MSearchEvent API object implementation.
+ *
+*/
+
+#include "searchkeyseventimp.h"
+#include "ximpapiobjbase.h"
+#include "ximpapieventbase.h"
+
+#include <ximpbase.h>
+#include "ximpobjecthelpers.h"
+#include "searchkeyinfoimp.h"
+
+// ---------------------------------------------------------------------------
+// CSearchKeysEventImp::NewLC()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CSearchKeysEventImp* CSearchKeysEventImp::NewLC( RSearchKeyInfoImpArray* aKeyInfoArray  )
+    {
+    CSearchKeysEventImp* self = new( ELeave ) CSearchKeysEventImp();
+    CleanupStack::PushL( self );
+    self->ConstructL( aKeyInfoArray );           
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CSearchKeysEventImp::NewFromStreamLC()
+// ---------------------------------------------------------------------------
+//
+CXIMPApiEventBase* CSearchKeysEventImp::NewFromStreamLC( RReadStream& aStream )
+    {
+    CSearchKeysEventImp* self = new( ELeave ) CSearchKeysEventImp;
+    CleanupStack::PushL( self );
+    self->ConstructL( aStream );
+    return self;
+    }
+// ---------------------------------------------------------------------------
+// CSearchKeysEventImp::EqualsContent
+// ---------------------------------------------------------------------------
+//
+TBool CSearchKeysEventImp::EqualsContent( 
+    const CXIMPApiEventBase& /*aOtherInstance*/ ) const 
+    {
+    return ETrue;
+    }
+
+// ---------------------------------------------------------------------------
+// From class CXIMPApiEventBase
+// CSearchKeysEventImp::ExternalizeL
+// ---------------------------------------------------------------------------
+//
+void CSearchKeysEventImp::ExternalizeL( RWriteStream& aStream ) const
+    {
+    WriteArrayToStreamL( *iInfoArray, aStream );
+    }
+
+
+// ---------------------------------------------------------------------------
+// CSearchKeysEventImp::~CSearchKeysEventImp()
+// ---------------------------------------------------------------------------
+//
+CSearchKeysEventImp::~CSearchKeysEventImp()
+    {
+    delete iInfoArray;
+    iInfoArray = NULL;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CSearchKeysEventImp::CSearchKeysEventImp()
+// ---------------------------------------------------------------------------
+//
+CSearchKeysEventImp::CSearchKeysEventImp()
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// CSearchKeysEventImp::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void CSearchKeysEventImp::ConstructL( RSearchKeyInfoImpArray* aKeyInfoArray  )
+    {
+    iInfoArray = aKeyInfoArray ; // ownership is transfered here, need to delete 
+    }
+
+
+// ---------------------------------------------------------------------------
+// CSearchKeysEventImp::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void CSearchKeysEventImp::ConstructL( RReadStream& aStream )
+    {
+    iInfoArray = new ( ELeave) RSearchKeyInfoImpArray;
+    InternalizeL( aStream );
+    }
+
+// ---------------------------------------------------------------------------
+// Implement supported interface access.
+// ---------------------------------------------------------------------------
+//
+XIMPIMP_IF_BASE_GET_INTERFACE_BEGIN( CSearchKeysEventImp, 
+                                            MSearchKeysEvent )
+                                     
+XIMPIMP_IF_BASE_GET_CLASS( CXIMPApiEventBase, this )
+XIMPIMP_IF_BASE_GET_INTERFACE_END()
+
+XIMPIMP_IF_BASE_GET_CONST_INTERFACE_BEGIN( CSearchKeysEventImp,
+        MSearchKeysEvent )
+    XIMPIMP_IF_BASE_GET_CONST_CLASS( CXIMPApiEventBase, this ) 
+XIMPIMP_IF_BASE_GET_INTERFACE_END()
+
+
+
+// ---------------------------------------------------------------------------
+// Implement methods from base event interface and base event class
+// ---------------------------------------------------------------------------
+//
+XIMPIMP_IMPLEMENT_EVENT_BASE_METHODS( CSearchKeysEventImp,
+                                      MSearchKeysEvent )
+
+
+
+// ---------------------------------------------------------------------------
+// CSearchKeysEventImp::SupportedKeysCount()
+// ---------------------------------------------------------------------------
+//	
+ TInt CSearchKeysEventImp::InfoCount() const 
+	 {
+	 return iInfoArray->Count();	
+	 }
+// ---------------------------------------------------------------------------
+// CSearchKeysEventImp::SupportedKey()
+// ---------------------------------------------------------------------------
+//	 
+ const MSearchKeyInfo& CSearchKeysEventImp::SearchKeyInfo( TInt aIndex ) const 
+	 {
+	 return *(*iInfoArray)[ aIndex ]; 	
+	 
+	 }
+
+
+// ---------------------------------------------------------------------------
+// CSearchEventImp::FillArrayFromStreamL
+// ---------------------------------------------------------------------------
+//	
+void CSearchKeysEventImp::FillArrayFromStreamL( RSearchKeyInfoImpArray& aKeyInfoArray, 
+        						   				RReadStream& aStream )
+    {
+    TInt count = aStream.ReadInt32L();
+    for( TInt a = 0; a < count; ++a )
+        {
+        // the stream MUST be in order (since it was externalized by this class)
+        CSearchKeyInfoImp* newInfo = CSearchKeyInfoImp::NewLC();
+        newInfo->InternalizeL( aStream );
+        aKeyInfoArray.AppendL( newInfo ); // trap here if there is  any error in the append
+        CleanupStack::Pop(); // newInfo
+        }
+    }
+// ---------------------------------------------------------------------------
+// CSearchEventImp::WriteArrayToStreamL()
+// ---------------------------------------------------------------------------
+//
+void CSearchKeysEventImp::WriteArrayToStreamL( RSearchKeyInfoImpArray& aKeyInfoArray, 
+        						   			   RWriteStream& aStream  ) const
+    {
+    TInt count = aKeyInfoArray.Count();
+    aStream.WriteInt32L( count );
+     
+    for( TInt a = 0; a < count; ++a )
+        {
+        aKeyInfoArray[ a ]->ExternalizeL( aStream );
+        }
+    }
+
+
+// ---------------------------------------------------------------------------
+// CSearchKeysEventImp::InternalizeL( )
+// ---------------------------------------------------------------------------
+//
+
+void CSearchKeysEventImp::InternalizeL(  RReadStream& aStream ) 
+    { 
+    FillArrayFromStreamL( *iInfoArray, aStream );  
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/searchfeatureplugin/srcsearchdatamodel/search/searchkeyseventimp.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,144 @@
+/*
+* 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:  MSearchKeysEvent object implementation.
+ *
+*/
+
+#ifndef CSEARCHKEYSEVENTIMP_H
+#define CSEARCHKEYSEVENTIMP_H
+
+#include  <s32strm.h>
+#include "ximpapieventbase.h"
+#include <searchkeysevent.h>
+#include "searchapiobjbase.h"
+#include "searchtypehelpers.h"
+
+class RReadStream;
+
+class CSearchKeyInfoImp;
+
+/**
+ * MSearchKeysEvent API object implementation.
+ *
+ * @lib searchdatamodel.dll
+ */
+NONSHARABLE_CLASS( CSearchKeysEventImp ): public CXIMPApiEventBase,
+                                             public MSearchKeysEvent
+    {
+	public:
+	    /** The class ID. */
+	    enum { KClassId = IMP_CLSID_CSEARCHKEYSEVENTIMP  };
+
+	public:
+	    /**
+	     * Exported instantiation method for initializing
+	     * new event object.
+	     */
+	    IMPORT_C static CSearchKeysEventImp* NewLC( RSearchKeyInfoImpArray* aKeyInfoArray );
+	            
+
+	    /**
+	     * Instantiation method for event automation.
+	     * Method signature must be exactly this to work
+	     * with event delivery automation system.
+	     *
+	     * Event implementation must be registered to
+	     * SearchEventCodec KApiEventConstructorTable.
+	     */
+	    static CXIMPApiEventBase* NewFromStreamLC( RReadStream& aStream );
+	    
+		/**
+         * Destructor
+         */
+	     virtual ~CSearchKeysEventImp();
+	     
+	public: // From MSearchKeysEvent
+        /**
+         * 
+         * @see MSearchKeysEvent
+         */
+         TInt  InfoCount() const;
+         /**
+          * 
+          * @see MSearchKeysEvent
+          */ 
+		 const MSearchKeyInfo& SearchKeyInfo( TInt aIndex ) const;
+		 
+
+	private:
+		/**
+	     * constructor
+	     */
+	    CSearchKeysEventImp();
+	    
+	    /**
+	     * 2nd phase constructor
+	     */
+	    void ConstructL( RSearchKeyInfoImpArray* aKeyInfoArray );							
+	            
+		/**
+	     * 2nd phase constructor
+	     */
+	    void ConstructL( RReadStream& aStream );
+  
+
+	    /**
+	     *  internalize method 
+	     */
+	    void InternalizeL( RReadStream& aStream ) ;
+        
+	    /**
+         * Helper for externalize
+         */
+        void WriteArrayToStreamL( RSearchKeyInfoImpArray& aKeyInfoArray,
+        						  RWriteStream& aStream ) const;
+        
+        /**
+         * Helper for internalize
+         */
+        void FillArrayFromStreamL( RSearchKeyInfoImpArray& aKeyInfoArray, 
+        						   RReadStream& aStream );
+        
+        
+			
+
+	public: // From API base interfaces
+
+	    /**
+	     * Implementation of MXIMPBase interface methods
+	     * @see MXIMPBase
+	     */
+	      XIMPIMP_DECLARE_IF_BASE_METHODS
+
+	    /**
+	     * Implementation of MSearchEventBase interface and
+	     * CSearchApiEventBase methods
+	     *
+	     */
+	   	XIMPIMP_DECLARE_EVENT_BASE_METHODS
+
+
+	
+	private: // data
+
+       /**
+        * RSupportedSearchKeyImpArray :  owned
+        */
+	    RSearchKeyInfoImpArray* iInfoArray;
+	    
+	
+    };
+
+
+#endif // CSEARCHKEYSEVENTIMP_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/searchfeatureplugin/srcsearchdatamodel/search/searchkeyssubscriptionitem.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,101 @@
+/*
+* 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:  Search Keys  subscription.
+*
+*/
+
+#ifndef CSEARCHKEYSSUBSCRIPTIONITEM_H
+#define CSEARCHKEYSSUBSCRIPTIONITEM_H
+
+#include <e32base.h>
+#include "ximpsubscriptionitembase.h"
+#include "searchtypehelpers.h"
+
+
+class MXIMPItemParentBase;
+class MXIMPPscContext;
+class CXIMPPscContext;
+
+
+/**
+ * search  subscription implementation
+ *
+ * @lib searchdatamodel.dll
+ */
+class CSearchKeysSubscriptionItem : public CXIMPSubscriptionItemBase
+    {
+
+	public: // Construction and destruction
+
+	    /**
+	     * Construction
+	     * @param aParent. Parent has to be informed when this object is deleted by RemoveMe method.
+	     */
+	    static CSearchKeysSubscriptionItem* NewLC( MXIMPItemParentBase& aParent );
+
+	    /**
+	     * Destruction
+	     * - Remember to inform parent about delete.
+	     */
+	    IMPORT_C virtual ~CSearchKeysSubscriptionItem();
+
+	private: // Construction and destruction
+
+	    /**
+	     * Construction
+	     * @param aParent. Parent has to be informed when this object is deleted by RemoveMe method.
+	     */
+	    CSearchKeysSubscriptionItem( MXIMPItemParentBase& aParent );
+
+	    /**
+	     * Construction
+	     */
+	    void ConstructL();
+
+	public : 
+	    /**
+         *  Set the search key info array 
+         *  takes ownership and will be transfered to search keys  event
+         */ 
+		IMPORT_C void SetKeyInfoArray( RSearchKeyInfoImpArray* aKeyInfoArray);
+		
+		
+	public: // From MXIMPSubscriptionItem
+
+	    /**
+	     * @see MXIMPSubscriptionItem
+	     */
+	    void SynthesiseSubscriptionEventToL( MXIMPPscContext* aContext, TBool aForceEvent );
+	private: // From CXIMPIMSubscriptionItemBase
+
+	    /**
+	     * @see CXIMPIMSubscriptionItemBase
+	     */
+	    void CleanExpired();
+
+	private : // data
+	
+	    /**
+         * RSearchKeyInfoImpArray : Not owned
+         */	    
+	    RSearchKeyInfoImpArray* iKeyInfoArray;
+	    
+    };
+
+
+/* ======================================================================== */
+
+
+
+#endif // CSEARCHKEYSSUBSCRIPTIONITEM_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/searchfeatureplugin/srcsearchdatamodel/search/searchkeysubscriptionitem.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,115 @@
+/*
+* 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:  Search Keys  subscription implementation.
+*
+*/
+
+
+#include <badesca.h>
+#include "ximpitemparentbase.h"
+#include "ximppanics.h"
+#include "ximppsccontext.h"
+#include "ximpobjecthelpers.h"
+
+#include "ximpidentityimp.h"
+#include "searchkeyssubscriptionitem.h"
+
+#include "searchitemparent.h"
+#include "searchkeyseventimp.h"
+// ---------------------------------------------------------------------------
+// CSearchKeysSubscriptionItem::CSearchKeysSubscriptionItem()
+// ---------------------------------------------------------------------------
+//
+CSearchKeysSubscriptionItem::CSearchKeysSubscriptionItem( MXIMPItemParentBase& aParent )
+: CXIMPSubscriptionItemBase( aParent )
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// CSearchKeysSubscriptionItem::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void CSearchKeysSubscriptionItem::ConstructL()
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// CSearchKeysSubscriptionItem::NewL()
+// ---------------------------------------------------------------------------
+//
+CSearchKeysSubscriptionItem* CSearchKeysSubscriptionItem::NewLC( MXIMPItemParentBase& aParent )
+    {
+    CSearchKeysSubscriptionItem* self = new( ELeave ) CSearchKeysSubscriptionItem( aParent );
+    CleanupClosePushL( *self );
+    self->ConstructL();
+    return self;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CSearchKeysSubscriptionItem::~CSearchKeysSubscriptionItem()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CSearchKeysSubscriptionItem::~CSearchKeysSubscriptionItem()
+    {
+    
+    MSearchItemParent* searchCache = static_cast<MSearchItemParent*>
+                                     (iParent.GetInterface(SEARCH_ITEM_PARENT));
+    searchCache->RemoveMe( this ); 
+
+    }
+
+// ---------------------------------------------------------------------------
+// CSearchSubscriptionItem::SetKeyInfoArray()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CSearchKeysSubscriptionItem::SetKeyInfoArray(RSearchKeyInfoImpArray* aKeyInfoArray)
+    {
+    iKeyInfoArray = aKeyInfoArray;
+    }
+
+// ---------------------------------------------------------------------------
+// From MXIMPSubscriptionItem class.
+// CSearchKeysSubscriptionItem::SynthesiseSubscriptionEventToL()
+// ---------------------------------------------------------------------------
+//
+void CSearchKeysSubscriptionItem::SynthesiseSubscriptionEventToL(
+        MXIMPPscContext* aContext, TBool /*aForceEvent*/ )
+    {
+
+    CSearchKeysEventImp* newEvent = CSearchKeysEventImp::NewLC( iKeyInfoArray );      
+    if( newEvent )
+        {
+        MSearchItemParent* searchCache = static_cast<MSearchItemParent*>(iParent.GetInterface(SEARCH_ITEM_PARENT));
+        searchCache->AddEventL( *newEvent, aContext ); 
+        CleanupStack::PopAndDestroy( newEvent ); //newEvent    
+        }
+    
+    }
+
+
+    
+// --------- ------------------------------------------------------------------
+// CGroupListSubscriptionItem::CleanExpired()
+// ---------------------------------------------------------------------------
+//
+void CSearchKeysSubscriptionItem::CleanExpired()
+    {
+    
+    }
+ 
+    
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/searchfeatureplugin/srcsearchdatamodel/search/searchsubscriptionitem.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,122 @@
+/*
+* 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:   Search subscription implementation.
+*
+*/
+
+
+#include <badesca.h>
+#include "ximpitemparentbase.h"
+#include "ximppanics.h"
+#include "ximppsccontext.h"
+#include "ximpobjecthelpers.h"
+#include "searchtypehelpers.h"
+#include "searcheventimp.h"
+#include "ximpidentityimp.h"
+#include "searchsubscriptionitem.h"
+
+#include "searchitemparent.h"
+
+// ---------------------------------------------------------------------------
+// CSearchSubscriptionItem::CSearchSubscriptionItem()
+// ---------------------------------------------------------------------------
+//
+CSearchSubscriptionItem::CSearchSubscriptionItem( MXIMPItemParentBase& aParent )
+: CXIMPSubscriptionItemBase( aParent )
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// CSearchSubscriptionItem::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void CSearchSubscriptionItem::ConstructL()
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// CSearchSubscriptionItem::NewL()
+// ---------------------------------------------------------------------------
+//
+CSearchSubscriptionItem* CSearchSubscriptionItem::NewLC( MXIMPItemParentBase& aParent )
+    {
+    CSearchSubscriptionItem* self = new( ELeave ) CSearchSubscriptionItem( aParent );
+    CleanupClosePushL( *self );
+    self->ConstructL();
+    return self;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CSearchSubscriptionItem::~CSearchSubscriptionItem()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CSearchSubscriptionItem::~CSearchSubscriptionItem()
+    {
+    
+    MSearchItemParent* searchCache = static_cast<MSearchItemParent*>
+                                     (iParent.GetInterface(SEARCH_ITEM_PARENT));
+    searchCache->RemoveMe( this ); 
+
+    }
+
+// ---------------------------------------------------------------------------
+// From MXIMPSubscriptionItem class.
+// CSearchSubscriptionItem::SynthesiseSubscriptionEventTo()
+// ---------------------------------------------------------------------------
+//
+void CSearchSubscriptionItem::SynthesiseSubscriptionEventToL(
+        MXIMPPscContext* aContext, TBool /*aForceEvent*/ )
+    {
+
+    CSearchEventImp* newEvent = CSearchEventImp::NewLC(*iSearchId, iSearchResults);      
+    if( newEvent )
+        {
+        MSearchItemParent* searchCache = static_cast<MSearchItemParent*>(iParent.GetInterface(SEARCH_ITEM_PARENT));
+        searchCache->AddEventL( *newEvent, aContext ); 
+        CleanupStack::PopAndDestroy( newEvent ); //newEvent*/     
+        }
+    
+    }
+
+
+// ---------------------------------------------------------------------------
+// CSearchSubscriptionItem::SetNewListL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CSearchSubscriptionItem::SetSearchResults(RSearchInfoImpArray* aSearchResults)
+    {
+    iSearchResults =aSearchResults;
+    }
+// ---------------------------------------------------------------------------
+// CSearchSubscriptionItem::SetNewListL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CSearchSubscriptionItem::SetSearchIdL(CXIMPIdentityImp& aSearchId)
+    {
+    iSearchId = &aSearchId;
+    }    
+// --------- ------------------------------------------------------------------
+// CGroupListSubscriptionItem::CleanExpired()
+// ---------------------------------------------------------------------------
+//
+void CSearchSubscriptionItem::CleanExpired()
+    {
+    
+    }
+ 
+    
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/searchfeatureplugin/srcsearchdatamodel/search/searchsubscriptionitem.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,110 @@
+/*
+* 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:   Search subscription implementation.
+*
+*/
+
+#ifndef CSEARCHSUBSCRIPTIONITEM_H
+#define CSEARCHSUBSCRIPTIONITEM_H
+
+#include <e32base.h>
+#include "ximpsubscriptionitembase.h"
+#include "searchtypehelpers.h"
+
+
+class MXIMPItemParentBase;
+class MXIMPPscContext;
+class CXIMPPscContext;
+
+class CSearchInfoImp;
+class MSearchInfo;
+/**
+ * search  subscription implementation
+ *
+ * @lib searchdatamodel.dll
+ */
+class CSearchSubscriptionItem : public CXIMPSubscriptionItemBase
+    {
+
+	public: // Construction and destruction
+
+	    /**
+	     * Construction
+	     * @param aParent. Parent has to be informed when this object is deleted by RemoveMe method.
+	     */
+	    static CSearchSubscriptionItem* NewLC( MXIMPItemParentBase& aParent );
+
+	    /**
+	     * Destruction
+	     * - Remember to inform parent about delete.
+	     */
+	    IMPORT_C virtual ~CSearchSubscriptionItem();
+
+	private: // Construction and destruction
+
+	    /**
+	     * Construction
+	     * @param aParent. Parent has to be informed when this object is deleted by RemoveMe method.
+	     */
+	    CSearchSubscriptionItem( MXIMPItemParentBase& aParent );
+
+	    /**
+	     * Construction
+	     */
+	    void ConstructL();
+
+	public: // New methods
+
+	    /**
+         *  Set the search results  takes ownership and given to search event
+         */
+	    IMPORT_C void  SetSearchResults(RSearchInfoImpArray*  aSearchResults);
+	    /**
+         *  Set the search id   takes ownership and given to search event
+         */
+	    IMPORT_C void SetSearchIdL( CXIMPIdentityImp& aSearchId );
+	    
+	public: // From MXIMPSubscriptionItem
+
+	    /**
+	     * @see MXIMPSubscriptionItem
+	     */
+	    void SynthesiseSubscriptionEventToL( MXIMPPscContext* aContext, TBool aForceEvent );
+	private: // From CXIMPIMSubscriptionItemBase
+
+	    /**
+	     * @see CXIMPIMSubscriptionItemBase
+	     */
+	    void CleanExpired();
+
+	private : 
+	     /**	
+	     *  Search info array :Not owned
+	     */
+		
+	    RSearchInfoImpArray* iSearchResults;
+	    
+	    /**	
+	     *  identity  :Not owned
+	     */
+	    CXIMPIdentityImp*    iSearchId ;
+
+    };
+
+
+/* ======================================================================== */
+
+
+
+#endif // CPSCSearchSUBSCRIPTIONITEM_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/searchfeatureplugin/srcsearchdatamodel/searchapidataobjfactory.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  Base class for API implementations.
+*
+*/
+
+#include "searchapidataobjfactory.h"
+#include "ximpapidataobjbase.h"
+
+#include <s32strm.h>
+
+
+// ============================ MEMBER FUNCTIONS =============================
+
+
+// ---------------------------------------------------------------------------
+// CImEventCodec::NewL()
+// ---------------------------------------------------------------------------
+//
+CSearchApiDataObjFactory* CSearchApiDataObjFactory::NewL()
+    {
+    CSearchApiDataObjFactory* self = new( ELeave ) CSearchApiDataObjFactory() ;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CImEventCodec::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void CSearchApiDataObjFactory::ConstructL()
+    {
+    }
+
+
+/**
+ * Method to instantiate new data object object
+ * of requested type and construct it from the stream.
+ *
+ * @param aDataObjInterfaceId
+ * @return Data object constructor function.
+ */
+CXIMPApiDataObjBase* CSearchApiDataObjFactory::NewFromStreamLC( 
+            TInt32 aDataObjInterfaceId,
+            RReadStream& aStream )
+    {
+    return NewDataObjectFromStreamLC( aDataObjInterfaceId, aStream );
+    }
+
+// ---------------------------------------------------------------------------
+// CSearchApiDataObjFactory::CSearchApiDataObjFactory()
+// ---------------------------------------------------------------------------
+//
+CSearchApiDataObjFactory::CSearchApiDataObjFactory()
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// CSearchApiDataObjFactory::~CSearchApiDataObjFactory()
+// ---------------------------------------------------------------------------
+//
+CSearchApiDataObjFactory::~CSearchApiDataObjFactory()
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// ImApiDataObjFactory::InternalizeL
+// ---------------------------------------------------------------------------
+//
+void CSearchApiDataObjFactory::InternalizeL( 
+        RReadStream& aStream,
+        RSearchReqParamArray& aArray )
+    {
+    TInt32 arrLen = aStream.ReadInt32L();
+
+    for ( TInt i = 0; i < arrLen; i++ )
+        {
+        SSearchReqParam param;
+        param.iParamType = aStream.ReadInt32L();
+        CXIMPApiDataObjBase* dataObject = NewDataObjectFromStreamLC( param.iParamType, aStream );
+        param.iParam = dataObject;
+        aArray.AppendL( param );
+        CleanupStack::Pop( dataObject );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// ImApiDataObjFactory::ExternalizeL
+// ---------------------------------------------------------------------------
+//
+void CSearchApiDataObjFactory::ExternalizeL( 
+            RWriteStream& aWs,
+            const RSearchReqParamArray& aArray )
+    {
+    // write array length
+    aWs.WriteInt32L( aArray.Count() );
+
+    for ( TInt i = 0; i < aArray.Count(); i++ )
+        {
+        // trust the type within the param struct
+        aWs.WriteInt32L( aArray[ i ].iParamType );
+
+        // write the actual object
+        CXIMPApiDataObjBase* theBase = aArray[ i ].iParam;
+        theBase->ExternalizeL( aWs );
+        }
+
+    aWs.CommitL();
+    }
+
+// ---------------------------------------------------------------------------
+// ImApiDataObjFactory::InternalizeLC
+// ---------------------------------------------------------------------------
+//
+CXIMPApiDataObjBase* CSearchApiDataObjFactory::InternalizeLC(
+        RReadStream& aStream )
+    {
+    TInt32 objType = aStream.ReadInt32L();
+    CXIMPApiDataObjBase* dataObject = NewDataObjectFromStreamLC( objType, aStream );
+    return dataObject;
+    }
+
+// ---------------------------------------------------------------------------
+// ImApiDataObjFactory::ExternalizeL
+// ---------------------------------------------------------------------------
+//
+void CSearchApiDataObjFactory::ExternalizeL(
+        RWriteStream& aWs,
+        const CXIMPApiDataObjBase& aDataObj )
+    {
+    aWs.WriteInt32L( aDataObj.Base().GetInterfaceId() );
+    aDataObj.ExternalizeL( aWs );
+    aWs.CommitL();
+    }
+
+
+// End of file
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/searchfeatureplugin/srcsearchdatamodel/searchapidataobjfactory.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,132 @@
+/*
+* 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:  MApiDataObjFactory implementation.
+*
+*/
+
+#ifndef SEARCHAPIDATAOBJFACTORY_H
+#define SEARCHAPIDATAOBJFACTORY_H
+
+#include <e32base.h>
+#include "ximpapidataobjbase.h"
+#include "searchtypehelpers.h"
+// internal interface for the factory
+#include "apidataobjfactory.h"
+
+class RReadStream;
+class RWriteStream;
+
+
+/**
+ * Codec to pack and unpack data object arrays.
+ *
+ * @lib ximpdatamodel.dll
+ * @since S60 v3.2
+ */
+NONSHARABLE_CLASS( CSearchApiDataObjFactory ) : public CBase,
+                                                  public MApiDataObjFactory
+    {
+public:
+
+    static CSearchApiDataObjFactory* NewL();
+    
+    // From base class see @ MApiDataObjFactory
+    CXIMPApiDataObjBase* NewFromStreamLC( TInt32 aDataObjInterfaceId,
+                                          RReadStream& aStream );
+    /**
+     * Unpacks a request parameter array from a 
+     * descriptor back to array format.
+     * @param aDataObjArrayData The packed array
+     * @param aArray The array which to fill
+     */
+    static void InternalizeL( 
+            RReadStream& aStream,
+            RSearchReqParamArray& aArray
+            );
+
+    /**
+     * Packs a given request parameter array into 
+     * a stream.
+     * @param aWs The stream to pack into
+     * @param aArray The array to pack
+     */    
+    static void ExternalizeL( 
+            RWriteStream& aWs,
+            const RSearchReqParamArray& aArray
+            );
+
+    /**
+     * Internalize a CXIMPApiDataObjBase-derived object
+     * from the given stream, ownership is returned to the caller.
+     * @param aStream The stream
+     * @return The object instance
+     */
+    static CXIMPApiDataObjBase* InternalizeLC(
+            RReadStream& aStream );
+
+    /**
+     * Externalize a CXIMPApiDataObjBase-derived object
+     * to the given stream.
+     * @param aWs The write stream
+     * @param aDataObj The data object
+     */
+    static void ExternalizeL(
+            RWriteStream& aWs,
+            const CXIMPApiDataObjBase& aDataObj );
+    
+
+    /*
+     * Packs a given array into a stream.
+     * @param aStream The stream
+     * @param aArray The array
+     */
+    template< class INFOIMP>    
+        static inline void InternalizeL( 
+                RReadStream& aStream,
+                RPointerArray<INFOIMP>& aArray
+                );
+
+    /**
+     * Unpacks an array of info fields back to array format.
+     * @param aWs The stream
+     * @param aArray The array which to fill
+     */
+    template< class INFOIMP >
+        static inline void ExternalizeL( 
+                RWriteStream& aWs,
+                const RPointerArray<INFOIMP>& aArray
+                );
+
+	/**
+     * Destructor
+     */
+    ~CSearchApiDataObjFactory();
+    
+private:
+	/**
+     * Constructor
+     */
+    CSearchApiDataObjFactory();
+    
+	/**
+     * ConstructL
+     */
+    void ConstructL();
+
+    };
+
+// template methods need inline implementation
+#include "searchapidataobjfactory.inl"
+
+#endif // SEARCHAPIDATAOBJFACTORY
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/searchfeatureplugin/srcsearchdatamodel/searchapidataobjfactory.inl	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,188 @@
+/*
+* 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:  Inline methods for codec to pack and unpack data objects.
+*
+*/
+
+
+#include <e32base.h>
+#include <ximpapidataobjbase.h>
+
+#include "searchtypehelpers.h"
+#include "searchobjectfactory.h"
+
+
+#include "searchinfoimp.h"
+
+//DATA TYPES
+
+
+// ============================ MEMBER FUNCTIONS =============================
+
+/**
+ * Type definition for exact API data object constructor signature.
+ */
+typedef CXIMPApiDataObjBase* (*TApiDataObjConstructor)( RReadStream& );
+
+
+
+/**
+ * Structure for mapping data object interface IDs to
+ * to corect API data object constructors.
+ */
+struct SApiDataObjConstructorMap
+    {
+    //Interface id
+    TInt32    iInterfaceId;
+
+    //Function pointer to data object interface implementation
+    TApiDataObjConstructor iConstructorPtr;
+    } ;
+
+
+
+/**
+ * Helper macro to initialise KApiDataObjConstructorTable members.
+ *
+ * Macro forces that each data object implementation class to have static
+ * NewFromStreamLC() member function to instantiate the object.
+ *
+ * See TApiDataObjConstructor type definition for exact constructor
+ * signature.
+ */
+#define CONSTRUCTOR_ENTRY( TheImplementedIf, TheClass ) \
+    { TheImplementedIf::KInterfaceId, TheClass::NewFromStreamLC } \
+
+/**
+ * Constructor function mapping for data object interface implementations.
+ *
+ * When new data object types are implemented, add them here.
+ */
+
+const SApiDataObjConstructorMap KApiDataObjConstructorTable[] =
+    {
+    CONSTRUCTOR_ENTRY( MSearchInfo, CSearchInfoImp  ),
+    };
+
+
+/**
+ * Count of constructor mappings.
+ */
+const TInt KApiDataObjConstructorCount 	= sizeof( KApiDataObjConstructorTable )
+                                       / sizeof( SApiDataObjConstructorMap );
+
+
+
+// ============================ HELPER FUNCTIONS =============================
+
+
+namespace {
+
+    /**
+     * Helper function to locate constructor function for
+     * data object interface ID.
+     *
+     * @param aDataObjInterfaceId The data object interface ID.
+     * @return Data object constructor function.
+     */
+    TApiDataObjConstructor ConstructorForInterface( TInt32 aDataObjInterfaceId )
+    {
+        //Locate correct constructor
+        for( TInt ix = 0; ix < KApiDataObjConstructorCount; ix++ )
+        {
+           const SApiDataObjConstructorMap map = KApiDataObjConstructorTable[ ix ];
+            if( map.iInterfaceId == aDataObjInterfaceId )
+            {
+                return map.iConstructorPtr;
+            } 
+        }
+
+
+        //If assertion below fails, check that data object implementation
+        //class implementing requested data object interface (aDataObjInterfaceId)
+        //is registered to KApiDataObjConstructorTable
+        __ASSERT_DEBUG( EFalse,
+                User::Panic( _L("ImObjectFactory"), KErrUnknown ) );
+
+        return NULL;
+    }
+
+    /**
+     * Helper function to instantiate new data object object
+     * of requested type and construct it from the stream.
+     *
+     * @param aDataObjInterfaceId
+     * @return Data object constructor function.
+     */
+    CXIMPApiDataObjBase* NewDataObjectFromStreamLC( TInt32 aDataObjInterfaceId,
+            RReadStream& aStream )
+    {
+        TApiDataObjConstructor newFromStreamLC = NULL;
+
+        //Locate correct constructor for interface ID
+        newFromStreamLC = ConstructorForInterface( aDataObjInterfaceId );
+
+        //Instantiate the object
+        CXIMPApiDataObjBase* dataObject = newFromStreamLC( aStream );
+
+        return dataObject;
+    }
+
+} // namespace
+
+// ---------------------------------------------------------------------------
+// SearchApiDataObjFactory::InternalizeL
+// ---------------------------------------------------------------------------
+//
+template< class INFOIMP >
+inline void CSearchApiDataObjFactory::InternalizeL( 
+        RReadStream& aStream,
+        RPointerArray<INFOIMP>& aArray )
+    {
+    TInt32 arrLen = aStream.ReadInt32L();
+
+    for ( TInt i = 0; i < arrLen; i++ )
+        {
+        TInt paramType = aStream.ReadInt32L();
+        INFOIMP* infoObj = ( INFOIMP* ) NewDataObjectFromStreamLC( paramType, aStream );
+        aArray.AppendL( infoObj );
+        CleanupStack::Pop( infoObj );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// SearchApiDataObjFactory::ExternalizeL
+// ---------------------------------------------------------------------------
+//
+template <class INFOIMP>
+inline void CSearchApiDataObjFactory::ExternalizeL( 
+        RWriteStream& aWs,
+        const RPointerArray<INFOIMP>& aArray )
+    {
+    aWs.WriteInt32L( aArray.Count() ); // array length
+
+    for ( TInt i = 0; i < aArray.Count(); i++ )
+        {
+        INFOIMP* infoField = aArray[ i ];
+
+        // write the type
+        aWs.WriteInt32L( infoField->Base().GetInterfaceId() );
+
+        // write the actual object
+        infoField->ExternalizeL( aWs );
+        }
+
+    aWs.CommitL();
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/searchfeatureplugin/srcsearchdatamodel/searchapidataobjfactoryaccessor.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,98 @@
+/*
+* 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:  Base class for API implementations.
+*
+*/
+
+#include "searchapidataobjfactoryaccessor.h"
+#include "searcheventcodec.h"
+#include "searchapidataobjfactory.h"
+
+//DATA TYPES
+
+
+// ============================ MEMBER FUNCTIONS =============================
+
+// ---------------------------------------------------------------------------
+// CSearchApiDataObjFactoryAccessor::NewL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CSearchApiDataObjFactoryAccessor* CSearchApiDataObjFactoryAccessor::NewL()
+    {
+    CSearchApiDataObjFactoryAccessor* self = new( ELeave ) CSearchApiDataObjFactoryAccessor() ;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CSearchApiDataObjFactoryAccessor::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void CSearchApiDataObjFactoryAccessor::ConstructL()
+    {
+    iEventCodec = CSearchEventCodec::NewL();    
+    iSearchApiDataObjFactory = CSearchApiDataObjFactory::NewL();
+    }
+
+
+// ---------------------------------------------------------------------------
+// CSearchApiDataObjFactoryAccessor::CSearchApiDataObjFactoryAccessor()
+// ---------------------------------------------------------------------------
+//
+CSearchApiDataObjFactoryAccessor::CSearchApiDataObjFactoryAccessor()
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// CSearchApiDataObjFactoryAccessor::~CSearchApiDataObjFactoryAccessor()
+// ---------------------------------------------------------------------------
+//
+CSearchApiDataObjFactoryAccessor::~CSearchApiDataObjFactoryAccessor()
+    {
+    delete iEventCodec;
+    delete iSearchApiDataObjFactory;
+    }
+
+    
+// ---------------------------------------------------------------------------
+// CSearchApiDataObjFactoryAccessor::EventCodec()
+// ---------------------------------------------------------------------------
+//
+MEventCodec& CSearchApiDataObjFactoryAccessor::EventCodec()
+    {
+    return *iEventCodec;
+    }
+
+// ---------------------------------------------------------------------------
+// CSearchApiDataObjFactoryAccessor::ApiDataObjFactory()
+// ---------------------------------------------------------------------------
+//
+MApiDataObjFactory& CSearchApiDataObjFactoryAccessor::ApiDataObjFactory()
+    {
+    return *iSearchApiDataObjFactory;
+    }
+
+
+
+// End of file
+
+
+
+
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/searchfeatureplugin/srcsearchdatamodel/searchapidataobjfactoryaccessor.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,82 @@
+/*
+* 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:  Class to access the different object factories in the datamodel
+*
+*/
+
+#ifndef SEARCHAPIDATAOBJFACTORYACCESSOR_H
+#define SEARCHAPIDATAOBJFACTORYACCESSOR_H
+
+#include <apidataobjfactoryaccessor.h>
+
+class MEventCodec;
+class CSearchEventCodec;
+class MApiDataObjFactory;
+class CSearchApiDataObjFactory;
+class MApiDataObjFactoryAccessor;
+/**
+ * Class to access the different object factories in the datamodel
+ *
+ * @lib searchdatamodel.dll
+ * 
+ */
+NONSHARABLE_CLASS( CSearchApiDataObjFactoryAccessor ) : public MApiDataObjFactoryAccessor
+    	{
+		public:
+		    /**
+		     ** NewL method 
+		     **/
+		    IMPORT_C static CSearchApiDataObjFactoryAccessor* NewL();
+		    
+		    /**
+		     * Returns the feature plugin specific event codec object
+		     */
+ 			MEventCodec& EventCodec() ;
+    
+		    /**
+		     * Returns the feature plugin specific api object data factory object
+		     */    
+		    MApiDataObjFactory& ApiDataObjFactory();
+		    /**
+		     * destructor
+		     */
+		    ~CSearchApiDataObjFactoryAccessor();
+
+		private:
+            /**
+		     * constructor
+		     */
+		    CSearchApiDataObjFactoryAccessor();
+		    /**
+		     * construcL 
+		     */
+		    void ConstructL();
+    
+		//data
+		private:
+		// Own
+		   CSearchEventCodec* iEventCodec;
+
+		// Own
+		 CSearchApiDataObjFactory* iSearchApiDataObjFactory;
+
+	    };
+
+#endif // SEARCHAPIDATAOBJFACTORYACCESSOR_H
+
+
+
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/searchfeatureplugin/srcsearchdatamodel/searchapiobjbase.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,54 @@
+/*
+* 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:  class ids
+*
+*/
+
+#ifndef SEARCHAPIOBJBASE_H
+#define SEARCHAPIOBJBASE_H
+
+
+/**
+ * search  plugin class implementation UIDs.
+ *
+ * These do not have to be "real" Symbian UIDs, but such ID's,
+ * that they do not overlap with XIMP or IM Plugin API interface IDs.
+ */
+ 
+// 90xx - ximp related
+// 91xx - im related
+// 92xx - instant messaging related
+// 93xx - search related
+
+
+const TInt KArrayGranularity( 2 );
+
+#define  IMP_CLSID_CSEARCHFEATUREIMP                   	9300
+#define  IMP_CLSID_CSEARCHIMP    	        			9301
+
+#define IMP_CLSID_CSEARCHOBJECTFACTORYIMP			    9302
+#define IMP_CLSID_CSEARCHINFOIMP                    	9303
+#define IMP_CLSID_CSEARCHEVENTIMP                   	9304
+#define IMP_CLSID_CPROTOCOLIMDATAHOSTIMP              	9305
+
+#define IMP_CLSID_CSEARCHOPERATIONFACTORYIMP          	9306
+#define IMP_CLSID_CSEARCHDATACACHE                      9307
+#define IMP_CLSID_CSEARCHELEMENTIMP                     9308
+#define IMP_CLSID_CPROTOCOLSEARCHDATAHOSTIMP            9309
+#define IMP_CLSID_CPROTOCOLSEARCHFEATUREDATAHOST        9310
+
+
+#define IMP_CLSID_CSEARCHKEY_INFO_IMP                   9311
+#define IMP_CLSID_CSEARCHKEYSEVENTIMP                   9312
+#endif // SEARCHAPIOBJBASE_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/searchfeatureplugin/srcsearchdatamodel/searchdatacacheimp.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,187 @@
+/*
+* 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:  search data cache implementation.
+ *
+*/
+
+
+#include <badesca.h>
+#include <e32cmn.h>
+#include <ximphost.h>
+#include <ximpapieventbase.h>
+
+#include "searchkeyssubscriptionitem.h"
+#include "searchdatacacheimp.h"
+#include "searchsubscriptionitem.h"
+#include "searcheventimp.h"
+
+// ---------------------------------------------------------------------------
+// CSearchDataCache ::CSearchDataCache ()
+// ---------------------------------------------------------------------------
+//
+CSearchDataCache ::CSearchDataCache ( MXIMPHost& aHost )
+:iHost( aHost )
+    {
+    }
+// ---------------------------------------------------------------------------
+// CSearchDataCache ::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void CSearchDataCache ::ConstructL()
+    {
+      
+    }
+// ---------------------------------------------------------------------------
+// CSearchDataCache ::NewL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CSearchDataCache * CSearchDataCache ::NewL( MXIMPHost& aHost )
+    {
+  	CSearchDataCache * self = new( ELeave ) CSearchDataCache ( aHost );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self; 
+    }
+// ---------------------------------------------------------------------------
+// CSearchDataCache ::~CSearchDataCache ()
+// ---------------------------------------------------------------------------
+//
+CSearchDataCache ::~CSearchDataCache ()
+    {
+
+    }
+// ---------------------------------------------------------------------------
+// CSearchDataCache ::RemoveMe
+// ---------------------------------------------------------------------------
+//
+template< class Type >
+EXPORT_C void CSearchDataCache ::RemoveMe( Type*& aItem, Type* aChild )
+    {
+    if( aChild == aItem )
+        {
+        aItem = NULL;
+        }
+    }
+// ---------------------------------------------------------------------------
+// CSearchDataCache ::AddEventL
+// ---------------------------------------------------------------------------
+//
+void CSearchDataCache ::AddEventL( CXIMPApiEventBase& aEvent, MXIMPPscContext* aContext )
+    {
+    iHost.AddEventL( aEvent, aContext );
+    }
+
+// ---------------------------------------------------------------------------
+// CSearchDataCache ::RegisterExpiringItemL
+// ---------------------------------------------------------------------------
+//
+void CSearchDataCache ::RegisterExpiringItemL( CXIMPSubscriptionItemBase* /*aExpireItem*/ )
+    {
+    
+    }
+// ---------------------------------------------------------------------------
+// CSearchDataCache ::UnregisterExpiringItemL
+// ---------------------------------------------------------------------------
+//
+void CSearchDataCache ::UnregisterExpiringItem( CXIMPSubscriptionItemBase* /*aExpireItem*/ )
+    {
+ 
+    }
+// ---------------------------------------------------------------------------
+// CSearchDataCache ::ItemLC
+// ---------------------------------------------------------------------------
+//
+template< class Type >
+Type& CSearchDataCache ::ItemLC( Type*& aItem )
+    {
+   if( !aItem )
+        {
+        aItem = Type::NewLC( *this );
+        }
+    else
+        {
+        User::LeaveIfError( aItem->Open() );
+        CleanupClosePushL( *aItem );
+        }
+	return *aItem;
+    }
+// ---------------------------------------------------------------------------
+// CSearchDataCache ::CleanResources
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CSearchDataCache ::CleanResources( MXIMPPscContext& /*aContext*/ )
+    {
+
+    }
+// ---------------------------------------------------------------------------
+// CSearchDataCache ::CleanExpired
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CSearchDataCache ::CleanExpired()
+    {
+    
+    }
+// ---------------------------------------------------------------------------
+// CSearchDataCache ::RemoveMe
+// ---------------------------------------------------------------------------
+//    
+void CSearchDataCache ::RemoveMe( CSearchSubscriptionItem* aChild )
+    {
+   	RemoveMe< CSearchSubscriptionItem >( 
+                                    iSearchSubscriptionItem, aChild ); 
+    }
+// ---------------------------------------------------------------------------
+// CSearchDataCache ::CSearchSubscriptionItemLC
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CSearchSubscriptionItem& CSearchDataCache ::SearchSubscriptionItemLC()
+    {
+    return ItemLC< CSearchSubscriptionItem >( iSearchSubscriptionItem );
+    }
+// ---------------------------------------------------------------------------
+// CSearchDataCache ::RemoveMe
+// ---------------------------------------------------------------------------
+//    
+void CSearchDataCache ::RemoveMe( CSearchKeysSubscriptionItem* aChild )
+    {
+   	RemoveMe< CSearchKeysSubscriptionItem >( 
+                                    iSearchKeySubscriptionItem, aChild ); 
+    }
+// ---------------------------------------------------------------------------
+// CSearchDataCache ::CSearchKeysSubscriptionItemLC
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CSearchKeysSubscriptionItem& CSearchDataCache ::SearchKeysSubscriptionItemLC()
+    {
+    return ItemLC< CSearchKeysSubscriptionItem >( iSearchKeySubscriptionItem );
+    }    
+// ---------------------------------------------------------------------------
+// CSearchDataCache ::GetInterface
+// ---------------------------------------------------------------------------
+//    
+TAny* CSearchDataCache ::GetInterface(TInt aInterfaceId)  
+	{
+		if(aInterfaceId == SEARCH_ITEM_PARENT)
+			{
+			return static_cast<MSearchItemParent*>(this) ;	
+			}
+		else
+			{
+			User::Panic( _L("CXIMPIMCache"), KErrExtensionNotSupported );
+			return NULL; // this line never gets executed :Just to remove warning
+			}			
+	}
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/searchfeatureplugin/srcsearchdatamodel/searchdatacacheimp.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,164 @@
+/*
+* 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:  SEARCH data cache implementation.
+*
+*/
+
+#ifndef CSEARCHDATACACHEIMP_H
+#define CSEARCHDATACACHEIMP_H
+
+#include <ximpapiobjbase.h>
+#include "searchapiobjbase.h"
+
+#include "searchitemparent.h"
+#include "searchtypehelpers.h"
+
+
+class MXIMPHost;
+class CCSearchSubscriptionItem;
+class CXIMPIdentityImp;
+class MXIMPPscContext;
+class CXIMPSubscriptionItemBase;
+class MXIMPStatus;
+class MXIMPIdentity;
+class CSearchKeysSubscriptionItem;
+/**
+ * search  data cache implementation
+ *
+ * @lib searchdatamodel.dll
+ */
+class CSearchDataCache : public CBase,
+                     	public MSearchItemParent
+    {
+public: // Definitions
+
+    /** The class ID. */
+    enum { KClassId = IMP_CLSID_CSEARCHDATACACHE };
+
+
+public: // Construction and destruction
+
+    /**
+     * Construction
+     */
+    IMPORT_C static CSearchDataCache  * NewL( MXIMPHost& aHost );
+
+    /**
+     * Destruction
+     */
+    virtual ~CSearchDataCache  ();
+
+private:
+ 	/**
+     * construction
+     */
+    CSearchDataCache  ( MXIMPHost& aHost );
+     /**
+     * leaving constructor
+     */
+    void ConstructL();
+    
+private:   // MXIMPItemParentBase
+	/**
+     * @see MXIMPItemParentBase
+     */
+
+	TAny* GetInterface(TInt aInterfaceId);
+    /**
+     * @see MXIMPItemParentBase
+     */
+    void RegisterExpiringItemL( CXIMPSubscriptionItemBase* aExpireItem );
+    /**
+     * @see MXIMPItemParentBase
+     */
+    void UnregisterExpiringItem( CXIMPSubscriptionItemBase* aExpireItem );
+    
+private: // From MSearchItemParent
+
+    /**
+     * @see MSearchItemParent
+     */
+    void RemoveMe( CSearchSubscriptionItem* aChild );
+    
+    void RemoveMe( CSearchKeysSubscriptionItem* aChild );
+    
+	/**
+     * @see MSearchItemParent
+     */
+    void AddEventL( CXIMPApiEventBase& aEvent, MXIMPPscContext* aContext );
+
+public: // New methods
+
+    /**
+     * - If CSearchSubscriptionItem is not found, data cache
+     *   initializes new one and returns ownership to caller
+     * - If CSearchSubscriptionItem is found, data cache increases
+     *   refcount by one, and returns the old object
+     */
+	IMPORT_C CSearchSubscriptionItem& SearchSubscriptionItemLC();
+	
+	/**
+     * - If CSearchKeysSubscriptionItem is not found, data cache
+     *   initializes new one and returns ownership to caller
+     * - If CSearchKeysSubscriptionItem is found, data cache increases
+     *   refcount by one, and returns the old object
+     */
+	IMPORT_C CSearchKeysSubscriptionItem& SearchKeysSubscriptionItemLC();
+	
+    /**
+     * Clean resources concerning context.
+     */
+    IMPORT_C void CleanResources( MXIMPPscContext& aContext );
+
+    /**
+     *
+     */
+    IMPORT_C void CleanExpired();
+    
+private: // Helper methods
+
+    /**
+     * Template method for removeMe when one subscription item is target.
+     * @param aItem Reference to subscription item pointer to remove.
+     * @param Pointer of item to remove.
+     */
+    template< class Type >
+    IMPORT_C static void RemoveMe( Type*& aItem, Type* aChild );
+
+    
+    /**
+     * Templated item instance creation. If item is not found it is created.
+     * @param aItem Reference to pointer where new item should be saved.
+     * @return Reference to item created.
+     */
+    template< class Type > 
+    Type& ItemLC( Type*& aItem );
+
+   
+    
+private: // Data
+
+    /**
+     * Access to host. not owned
+     */
+    MXIMPHost& iHost;
+
+    /**
+     * Does not own. Removed when RemoveMe called.
+     */
+ 	CSearchSubscriptionItem* iSearchSubscriptionItem;
+ 	CSearchKeysSubscriptionItem* iSearchKeySubscriptionItem;
+    };
+
+#endif // CSearchDataCache  IMP_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/searchfeatureplugin/srcsearchdatamodel/searchdatamodelhook/searchdatamodelhook.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,46 @@
+/*
+* 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:  XIMP Framework's search  Data Model Hook implementation.
+*
+*/
+
+
+#include <searchdlluids.hrh>
+#include "searchapidataobjfactoryaccessor.h"
+#include <ecom/implementationproxy.h>
+#include <e32base.h>
+
+
+// ---------------------------------------------------------------------------
+// Key value pair table to identify correct constructor
+// function for the requested interface.
+// ---------------------------------------------------------------------------
+//
+const TImplementationProxy ImplementationTable[] =
+    {
+    IMPLEMENTATION_PROXY_ENTRY( XIMP_ECOM_IMPL_UID_SEARCH_DATAMODEL_INTERFACE,
+                                CSearchApiDataObjFactoryAccessor::NewL )
+    };
+
+
+// ---------------------------------------------------------------------------
+// Exported function to return the implementation proxy table
+// ---------------------------------------------------------------------------
+//
+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/imservices/searchfeatureplugin/srcsearchdatamodel/searchdatamodelhook/searchdatamodelhook.rss	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,52 @@
+/*
+* 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:  ECom registery info for ECom hook
+*
+*/
+
+
+#include <ecom/registryinfov2.rh>
+#include <searchdlluids.hrh>
+#include <searchmanagementifids.hrh>
+#include <ximpfeaturepluginifids.hrh>
+
+// ---------------------------------------------------------------------------
+// ECom registery info for XIMP search data model  ECom hook
+// ---------------------------------------------------------------------------
+//
+RESOURCE REGISTRY_INFO theInfo
+    {
+    resource_format_version = RESOURCE_FORMAT_VERSION_2;
+    dll_uid = XIMP_DLL_UID_SEARCH_DATAMODEL_HOOK;
+
+    interfaces =
+        {
+        INTERFACE_INFO
+            {
+            interface_uid = XIMP_ECOM_IF_UID_PROTOCOL_DATAMODEL_CODEC_INTERFACE;
+            implementations =
+                {
+                IMPLEMENTATION_INFO
+                    {
+                    implementation_uid = XIMP_ECOM_IMPL_UID_SEARCH_DATAMODEL_INTERFACE;
+                    version_no         = 1;
+                    display_name       = "S60 Default XIMP";
+                    default_data       = XIMP_ECOM_DEFAULT_DATA_SEARCH_INTERFACE;
+                    opaque_data        = "";
+                    }
+                };
+            }
+        };
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/searchfeatureplugin/srcsearchdatamodel/searcheventcodec.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,253 @@
+/*
+* 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:  Base class for API implementations.
+*
+*/
+
+#include <s32strm.h>
+#include <s32mem.h>
+#include "searcheventcodec.h"
+#include "searcheventimp.h"
+#include "ximpapieventbase.h"
+#include "searchkeyseventimp.h"
+
+/**
+ * Type definition for exact API event constructor signature.
+ */
+typedef CXIMPApiEventBase* (*TApiEventConstructor)( RReadStream& );
+
+/**
+ * Structure for mapping event interface IDs to
+ * to corect API event constructors.
+ */
+struct SApiEventConstructorMap
+    {
+    //Interface id
+    TInt32    iInterfaceId;
+
+    //Function pointer to event interface implementation
+    TApiEventConstructor iConstructorPtr;
+    } ;
+
+/**
+ * Helper macro to initialise KApiEventConstructorTable members.
+ *
+ * Macro forces that each event implementation class to have static
+ * NewFromStreamLC() memeber function to instantiate the object.
+ *
+ * See TApiEventConstructor type definition for exact constructor
+ * signature.
+ */
+#define CONSTRUCTOR_ENTRY( TheImplementedIf, TheClass ) \
+    { TheImplementedIf::KInterfaceId, TheClass::NewFromStreamLC } \
+
+
+/**
+ * Constructor function mapping for event interface implementations.
+ *
+ * When new event types are implemented, add them here.
+ */
+
+const SApiEventConstructorMap KApiEventConstructorTable[] =
+    {
+		CONSTRUCTOR_ENTRY( MSearchEvent, CSearchEventImp ),
+		CONSTRUCTOR_ENTRY( MSearchKeysEvent, CSearchKeysEventImp )
+    };
+
+
+/**
+ * Count of constructor mappings.
+ */
+const TInt KApiEventConstructorCount = sizeof( KApiEventConstructorTable )
+                                        / sizeof( SApiEventConstructorMap );
+
+
+
+// ============================ HELPER FUNCTIONS =============================
+
+
+/**
+ * Helper function to locate constructor function for
+ * event interface ID.
+ *
+ * @param aEventInterfaceId The event interface ID.
+ * @return Event object constructor function.
+ */
+TApiEventConstructor ConstructorForInterface( TInt32 aEventInterfaceId )
+    {
+    //Locate correct constructor
+    for( TInt ix = 0; ix < KApiEventConstructorCount; ix++ )
+        {
+     const SApiEventConstructorMap map = KApiEventConstructorTable[ ix ];
+        if( map.iInterfaceId == aEventInterfaceId )
+            {
+            return map.iConstructorPtr;
+            }  
+        }
+    return NULL;
+    }
+
+
+/**
+ * Helper function to instantiate new event object
+ * of requested type and construct it from the stream.
+ *
+ * @param aEventInterfaceId
+ * @return Event object constructor function.
+ */
+CXIMPApiEventBase* NewEventObjectFromStreamLC( TInt32 aEventInterfaceId,
+                                               RReadStream& aStream )
+    {
+    TApiEventConstructor newFromStreamLC = NULL;
+
+    //Locate correct constructor for interface ID
+    newFromStreamLC = ConstructorForInterface( aEventInterfaceId );
+
+    if( ! newFromStreamLC )
+	    {
+	    return 	NULL;
+	    }
+    //Instantiate the object
+    CXIMPApiEventBase* eventObject = newFromStreamLC( aStream );
+
+    return eventObject;    
+    }
+
+
+// ============================ MEMBER FUNCTIONS =============================
+
+
+// ---------------------------------------------------------------------------
+// CSearchEventCodec::NewL()
+// ---------------------------------------------------------------------------
+//
+CSearchEventCodec* CSearchEventCodec::NewL()
+    {
+    CSearchEventCodec* self = new( ELeave ) CSearchEventCodec() ;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CSearchEventCodec::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void CSearchEventCodec::ConstructL()
+    {
+    }
+// ---------------------------------------------------------------------------
+// CSearchEventCodec::CSearchEventCodec()
+// ---------------------------------------------------------------------------
+//
+CSearchEventCodec::CSearchEventCodec()
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// CSearchEventCodec::~CSearchEventCodec()
+// ---------------------------------------------------------------------------
+//
+CSearchEventCodec::~CSearchEventCodec()
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// CSearchEventCodec::PackL()
+// ---------------------------------------------------------------------------
+//
+HBufC8* CSearchEventCodec::PackL( CXIMPApiEventBase& aEventObj,
+                                        TInt32& aTypeOfEvent )
+    {
+    CBufFlat* buffer = CBufFlat::NewL( 10 ); // initial granularity to 10
+    CleanupStack::PushL( buffer );
+
+    RBufWriteStream ws;
+    CleanupClosePushL( ws );
+    ws.Open( *buffer ); // CSI: 65 #
+
+    //Ask real event type through the event base interface
+    TInt32 eventIfId = aEventObj.Base().GetInterfaceId();
+
+    //And write both event type and data
+    ws.WriteInt32L( eventIfId );
+    aEventObj.ExternalizeL( ws );
+    ws.CommitL();
+    CleanupStack::PopAndDestroy();  //ws
+
+    HBufC8* heapBuf = buffer->Ptr( 0 ).AllocL();
+
+    CleanupStack::PopAndDestroy( buffer );
+
+
+    aTypeOfEvent = eventIfId;
+    return heapBuf;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CSearchEventCodec::PackL()
+// ---------------------------------------------------------------------------
+//
+void CSearchEventCodec::PackL( CXIMPApiEventBase& aEventObj,
+                                     TInt32& aTypeOfEvent,
+                                     CBufFlat* aBuffer )
+    {
+    RBufWriteStream ws;
+    CleanupClosePushL( ws );
+    ws.Open( *aBuffer ); // CSI: 65 #
+
+    //Ask real event type through the event base interface
+    TInt32 eventIfId = aEventObj.Base().GetInterfaceId();
+
+    //And write both event type and data
+    ws.WriteInt32L( eventIfId );
+    aEventObj.ExternalizeL( ws );
+    ws.CommitL();
+    CleanupStack::PopAndDestroy( );  //ws
+    
+    aTypeOfEvent = eventIfId;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CSearchEventCodec::UnPackL()
+// ---------------------------------------------------------------------------
+//
+CXIMPApiEventBase* CSearchEventCodec::UnPackL( const TDesC8& aEventData,
+                                                     TInt32& aTypeOfEvent )
+    {
+    RDesReadStream rs;
+    rs.Open( aEventData ); // CSI: 65 #
+    CleanupClosePushL( rs );
+
+    TInt32 eventIfId = rs.ReadInt32L();
+    CXIMPApiEventBase* eventObject = NewEventObjectFromStreamLC( eventIfId, rs );
+    if( eventObject )
+	    {
+	    CleanupStack::Pop( eventObject ); //eventObject	
+	    }
+    
+    CleanupStack::PopAndDestroy(  ); // rs
+
+
+    aTypeOfEvent = eventIfId;
+    return eventObject;
+    }
+
+
+// End of file
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/searchfeatureplugin/srcsearchdatamodel/searcheventcodec.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,103 @@
+/*
+* 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:  Codec to pack and unpack event objects.
+*
+*/
+
+#ifndef SEARCHEVENTCODEC_H
+#define SEARCHEVENTCODEC_H
+
+#include <e32base.h>
+
+#include "eventcodec.h"
+
+class CXIMPApiEventBase;
+class RReadStream;
+
+
+/**
+ * Codec to pack and unpack event objects.
+ *
+ * @lib searchdatamodel.dll
+ */
+NONSHARABLE_CLASS( CSearchEventCodec ): public MEventCodec
+    {
+    
+public:
+    static CSearchEventCodec* NewL();
+    
+    ~CSearchEventCodec();
+    
+    
+    /**
+     * packs and allocates memory for the  
+     * event object and event type
+     *
+     * @param aEventObj  
+     * event object derived from CXIMPApiEventBase
+     * 
+     * @param aTypeOfEvent 
+     * holds  type of the event after execution from aEventObj
+     * 
+     * @return
+     * heap allocated which contains both
+     * event and event type
+     */
+    HBufC8* PackL( CXIMPApiEventBase& aEventObj,
+                                   TInt32& aTypeOfEvent );
+                                   
+    /**
+     * packs  
+     * event object and event type into the buffer
+     *
+     * @param aEventObj  
+     * event object derived from CXIMPApiEventBase
+     * 
+     * @param aTypeOfEvent 
+     * holds  type of the event after execution from aEventObj 
+     * 
+     * @param
+     * buffer to be packed  with
+     * event and event type
+     */                               
+                                   
+    void PackL( CXIMPApiEventBase& aEventObj,
+                         TInt32& aTypeOfEvent,
+                         CBufFlat* aBuffer );
+
+    /**
+     *
+     * @param aEventData
+     * data desc which has the event type and id
+     *
+     * @param aTypeOfEvent 
+     * holds  type of the event after execution from aEventData 
+     *
+     * @return new eventbase object constructed from aEventData
+     *
+     */
+    CXIMPApiEventBase* UnPackL( const TDesC8& aEventData,
+                                                TInt32& aTypeOfEvent );
+protected:
+    void ConstructL();
+
+private:
+
+    CSearchEventCodec();
+
+
+    };
+
+
+#endif // SEARCHEVENTCODEC_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/searchfeatureplugin/srcsearchdatamodel/searchitemparent.h	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  Item parent interface.
+*
+*/
+
+#ifndef CSEARCHITEMPARENT_H
+#define CSEARCHITEMPARENT_H
+
+#include <ximpitemparentbase.h>
+
+
+class CXIMPApiEventBase;
+class MXIMPPscContext;
+class CSearchSubscriptionItem;
+class CSearchKeysSubscriptionItem;
+
+
+#define SEARCH_ITEM_PARENT	0xE000000A
+
+/**
+ * Item parent interface.
+ *
+ * 
+ */
+class MSearchItemParent : public MXIMPItemParentBase
+    {
+    
+	public:
+		enum { KInterfaceId = SEARCH_ITEM_PARENT};
+	
+	public: // Definitions
+
+    /**
+     * Remove item
+     * @param aChild Item pointer to remove.
+     */
+    virtual void RemoveMe( CSearchSubscriptionItem* aChild ) = 0;
+    
+    virtual void RemoveMe( CSearchKeysSubscriptionItem* aChild ) = 0;
+
+    /**
+     * Add event to event pump
+     */
+    virtual void AddEventL( CXIMPApiEventBase& aEvent, MXIMPPscContext* aContext ) = 0;
+
+    
+protected: // Destruction
+    
+    /**
+     * Object cannot be delted through this interface
+     */
+    virtual ~MSearchItemParent(){}
+    };
+
+/* ======================================================================== */
+
+
+
+#endif // CXIMPIMITEMPARENT_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/searchfeatureplugin/srcsearchdatamodel/searchobjectfactoryimp.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,99 @@
+/*
+* 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:  Implementation of objectfactory
+ *
+*/
+
+
+
+#include "searchobjectfactoryimp.h"
+
+#include "searchelementimp.h"
+#include "searchinfoimp.h"
+#include "searchkeyinfoimp.h"
+
+
+// ============================ MEMBER FUNCTIONS =============================
+
+// ---------------------------------------------------------------------------
+// CSearchObjectFactoryImp::NewL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CSearchObjectFactoryImp* CSearchObjectFactoryImp::NewL()
+    {
+    CSearchObjectFactoryImp* self = new( ELeave ) CSearchObjectFactoryImp;
+    return self;
+    
+    }
+
+// ---------------------------------------------------------------------------
+// Implement supported interface access.
+// ---------------------------------------------------------------------------
+//
+XIMPIMP_IF_BASE_GET_INTERFACE_BEGIN( CSearchObjectFactoryImp, 
+                                     MSearchObjectFactory )
+XIMPIMP_IF_BASE_GET_INTERFACE_END()
+
+
+XIMPIMP_IF_BASE_GET_CONST_INTERFACE_BEGIN( CSearchObjectFactoryImp, 
+                                           MSearchObjectFactory )
+XIMPIMP_IF_BASE_GET_INTERFACE_END()
+
+// ---------------------------------------------------------------------------
+// CSearchObjectFactoryImp::~CSearchObjectFactoryImp()
+// ---------------------------------------------------------------------------
+//
+CSearchObjectFactoryImp::~CSearchObjectFactoryImp()
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// CSearchObjectFactoryImp::CSearchObjectFactoryImp()
+// ---------------------------------------------------------------------------
+//
+CSearchObjectFactoryImp::CSearchObjectFactoryImp()
+    {
+    }
+    
+    
+
+ // ---------------------------------------------------------------------------
+// CSearchObjectFactoryImp::NewSearchElementLC()
+// ---------------------------------------------------------------------------
+//
+MSearchElement* CSearchObjectFactoryImp::NewSearchElementLC()
+    {
+    return CSearchElementImp::NewLC();
+    }   
+    
+  // ---------------------------------------------------------------------------
+// CSearchObjectFactoryImp::NewSearchInfoLC()
+// ---------------------------------------------------------------------------
+//
+MSearchInfo* CSearchObjectFactoryImp::NewSearchInfoLC()
+    {
+    return CSearchInfoImp::NewLC();
+    }    
+
+// ---------------------------------------------------------------------------
+// CSearchObjectFactoryImp::NewSupportedSearchKeyLC()
+// ---------------------------------------------------------------------------
+//
+ MSearchKeyInfo* CSearchObjectFactoryImp::NewSearchKeyInfoLC()
+   {
+   return CSearchKeyInfoImp::NewLC();
+   }    
+    
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/searchfeatureplugin/srcsearchdatamodel/searchobjectfactoryimp.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,79 @@
+/*
+* 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:  Implementation of MSearchObjectFactory
+ *
+*/
+
+#ifndef CSEARCHOBJECTFACTORYIMP_H
+#define CSEARCHOBJECTFACTORYIMP_H
+
+#include <searchobjectfactory.h>
+#include "ximpapiobjbase.h"
+#include "searchapiobjbase.h"
+
+
+/**
+ * MSearchObjectFactory API object implementation.
+ *
+ * @lib searchdatamodel.dll
+ * 
+ */
+class CSearchObjectFactoryImp: public CXIMPApiObjBase,
+							   public MSearchObjectFactory
+    {
+    public:
+    /** The class ID. */
+    enum { KClassId = IMP_CLSID_CSEARCHOBJECTFACTORYIMP };
+
+
+public:
+
+    IMPORT_C static CSearchObjectFactoryImp* NewL();
+    ~CSearchObjectFactoryImp();
+
+private:
+    CSearchObjectFactoryImp();
+
+
+
+public: // From MXIMPBase
+
+    /**
+     * Implementation of MXIMPBase interface methods
+     * @see MXIMPBase
+     */
+    XIMPIMP_DECLARE_IF_BASE_METHODS
+
+
+public: //From MSearchObjectFactory
+	/**
+     * Implementation of  MSearchObjectFactory interface method
+     * @see  MSearchObjectFactory
+     */
+    MSearchElement* NewSearchElementLC();
+    /**
+     * Implementation of  MSearchObjectFactory interface method
+     * @see  MSearchObjectFactory
+     */
+    MSearchInfo* NewSearchInfoLC();
+    /**
+     * Implementation of  MSearchObjectFactory interface method
+     * @see  MSearchObjectFactory
+     */
+    MSearchKeyInfo* NewSearchKeyInfoLC();
+   
+    };
+
+
+#endif // CSEARCHOBJECTFACTORYIMP_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/searchfeatureplugin/srcsearchdatamodel/searchtypehelpers.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,52 @@
+/*
+* 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:  Typedef helpers for really long typenames.
+ *
+*/
+
+#ifndef SEARCHTYPEHELPERS_H
+#define SEARCHTYPEHELPERS_H
+
+#include "ximpapiobjbase.h"
+#include "searchapiobjbase.h"
+#include <e32base.h>
+
+class CXIMPApiDataObjBase;
+class CSearchInfoImp;
+class CSearchKeyInfoImp;
+
+// Key for opening up the typedefs:
+//
+// R(Xyz)Array = RXIMPObjOwningPtrArray<xyz>
+// Im = IM
+// GrpInfo = GroupInfo
+// GrpMemInfo = GroupMemberInfo
+// WatLstInfo = WatcherListInfo
+//
+// When adding new types, follow these conventions.
+//
+
+struct SSearchReqParam
+    {
+    CXIMPApiDataObjBase* iParam;
+    TInt iParamType;
+    };
+
+typedef RArray<SSearchReqParam> RSearchReqParamArray;
+typedef RXIMPObjOwningPtrArray<CSearchInfoImp> RSearchInfoImpArray;
+typedef RXIMPObjOwningPtrArray<CSearchKeyInfoImp> RSearchKeyInfoImpArray;
+
+#endif // SEARCHTYPEHELPERS_H
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/searchfeatureplugin/srcsearchfrontend/group/bld.inf	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,32 @@
+/*
+* 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:  Build information file for project Search Feature Plugin
+*
+*/
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+PRJ_MMPFILES
+searchmanager.mmp
+searchecomhook.mmp
+
+
+PRJ_TESTMMPFILES
+
+PRJ_TESTEXPORTS
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/searchfeatureplugin/srcsearchfrontend/group/searchecomhook.mmp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,61 @@
+/*
+* 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:  Project definition file for Search  Manager ECom Hook
+*
+*/
+
+#include <platform_paths.hrh>
+#include <data_caging_paths.hrh>
+#include "../../group/searchdlluids.hrh"
+
+
+TARGET                  searchecomhook.dll
+CAPABILITY              CAP_ECOM_PLUGIN
+TARGETTYPE              PLUGIN
+UID                     XIMP_SEARCH_DLL_UID_ECOM_PLUGIN XIMP_DLL_UID_SEARCH_HOOK
+VENDORID                VID_DEFAULT
+
+VERSION      10.0
+
+SOURCEPATH              ../srcecomhook
+START RESOURCE          searchecomhook.rss
+TARGET                  searchecomhook.rsc
+END
+
+
+SOURCEPATH              ../srcecomhook
+SOURCE                  searchecomhook.cpp
+
+
+USERINCLUDE             ../srcecomhook
+USERINCLUDE             ../srcsearchmanager
+USERINCLUDE             ../../srcsearchdatamodel
+USERINCLUDE             ../../group
+
+
+
+MW_LAYER_SYSTEMINCLUDE
+
+
+LIBRARY                 euser.lib
+LIBRARY                 searchmanager.lib
+LIBRARY                 ecom.lib
+
+
+
+#if defined( ARMCC )
+DEFFILE ../../eabi/ 
+#elif defined ( WINSCW )
+deffile ../../bwins/ 
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/searchfeatureplugin/srcsearchfrontend/group/searchmanager.mmp	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  Project definition file for search Manager
+*
+*/
+
+#include <platform_paths.hrh>
+#include <data_caging_paths.hrh>
+#include "../../group/searchdlluids.hrh"
+
+
+TARGET                  searchmanager.dll
+TARGETTYPE              dll
+UID                     XIMP_SEARCH_DLL_UID_STATIC_INTERFACE XIMP_DLL_UID_SEARCH_MANAGER                                     
+
+CAPABILITY              CAP_GENERAL_DLL
+VENDORID                VID_DEFAULT
+
+VERSION      10.0
+
+SOURCEPATH              ../srcsearchmanager
+
+
+SOURCE                  searchimp.cpp
+SOURCE                  searchfeatureimp.cpp
+
+
+SOURCEPATH              ../../srcutils
+SOURCE                   searchlogutils.cpp
+
+
+USERINCLUDE             ../../group
+
+
+USERINCLUDE             ../../srcutils
+USERINCLUDE             ../../srcsearchdatamodel
+USERINCLUDE             ../../srcsearchoperations
+USERINCLUDE             ../srcsearchmanager
+USERINCLUDE             ../../srcsearchdatamodel/search
+
+MW_LAYER_SYSTEMINCLUDE
+
+
+
+LIBRARY                 euser.lib
+LIBRARY                 ecom.lib
+LIBRARY                 bafl.lib
+LIBRARY                 estor.lib
+LIBRARY                 ximputils.lib
+LIBRARY                 ximpdatamodel.lib
+LIBRARY                 searchdatamodel.lib
+LIBRARY                 ximpsrvclient.lib
+LIBRARY                 flogger.lib
+
+
+//EXPORTUNFROZEN
+
+
+#if defined( ARMCC )
+DEFFILE ../../eabi/ 
+#elif defined ( WINSCW )
+deffile ../../bwins/ 
+#endif
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/searchfeatureplugin/srcsearchfrontend/srcecomhook/searchecomhook.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,46 @@
+/*
+* 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:  XIMP Framework's SEARCH  Manager Ecom Hook implementation.
+*
+*/
+
+
+#include <searchdlluids.hrh>
+#include "searchfeatureimp.h"
+#include <ecom/implementationproxy.h>
+#include <e32base.h>
+
+
+// ---------------------------------------------------------------------------
+// Key value pair table to identify correct constructor
+// function for the requested interface.
+// ---------------------------------------------------------------------------
+//
+const TImplementationProxy ImplementationTable[] =
+    {
+    IMPLEMENTATION_PROXY_ENTRY( XIMP_ECOM_IMPLEMENTATION_UID_SEARCH_INTERFACE,
+                                CSearchFeatureImp::NewL )
+    };
+
+
+// ---------------------------------------------------------------------------
+// Exported function to return the implementation proxy table
+// ---------------------------------------------------------------------------
+//
+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/imservices/searchfeatureplugin/srcsearchfrontend/srcecomhook/searchecomhook.rss	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,52 @@
+/*
+* 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:  ECom registery info for ECom hook
+*
+*/
+
+
+#include <ecom/registryinfov2.rh>
+#include <searchmanagementifids.hrh>
+#include <searchdlluids.hrh>
+
+
+// ---------------------------------------------------------------------------
+// ECom registery info for XIMP SEARCH Manager ECom hook
+// ---------------------------------------------------------------------------
+//
+RESOURCE REGISTRY_INFO theInfo
+    {
+    resource_format_version = RESOURCE_FORMAT_VERSION_2;
+    dll_uid = XIMP_DLL_UID_SEARCH_HOOK;
+
+    interfaces =
+        {
+        INTERFACE_INFO
+            {
+            interface_uid = XIMP_ECOM_IF_UID_SEARCH_INTERFACE;
+            implementations =
+                {
+                IMPLEMENTATION_INFO
+                    {
+                    implementation_uid = XIMP_ECOM_IMPLEMENTATION_UID_SEARCH_INTERFACE ;
+                    version_no         = 1;
+                    display_name       = "S60 Default XIMP";
+                    default_data       = XIMP_ECOM_DEFAULT_DATA_SEARCH_INTERFACE;
+                    opaque_data        = "";
+                    }
+                };
+            }
+        };
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/searchfeatureplugin/srcsearchfrontend/srcsearchmanager/searchfeatureimp.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,122 @@
+/*
+* 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:  Implementation of MsearchFeature
+ *
+*/
+
+
+#include <ximpcontext.h>
+#include "searchapiobjbase.h"
+
+#include "ximpcontextinternal.h"
+#include "searchfeatureimp.h"
+
+#include "searchimp.h"
+#include "searchobjectfactoryimp.h"
+
+
+
+// ============================ MEMBER FUNCTIONS =============================
+
+// ---------------------------------------------------------------------------
+// CSearchFeatureImp::NewL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CSearchFeatureImp* CSearchFeatureImp::NewL(MXIMPContext* aContext)
+    {
+    CSearchFeatureImp* self = new( ELeave ) CSearchFeatureImp();
+    CleanupStack::PushL( self );
+    self->ConstructL(aContext);
+    CleanupStack::Pop();
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// Implement supported interface access.
+// ---------------------------------------------------------------------------
+//
+
+XIMPIMP_IF_BASE_GET_INTERFACE_BEGIN( CSearchFeatureImp, 
+                                     MSearchFeature )
+XIMPIMP_IF_BASE_GET_INTERFACE_END()
+
+
+XIMPIMP_IF_BASE_GET_CONST_INTERFACE_BEGIN( CSearchFeatureImp, 
+                                           MSearchFeature)
+XIMPIMP_IF_BASE_GET_INTERFACE_END()
+
+// ---------------------------------------------------------------------------
+// CSearchFeatureImp::~CSearchFeatureImp()
+// ---------------------------------------------------------------------------
+//
+CSearchFeatureImp::~CSearchFeatureImp()
+    {
+    delete iSearch;
+    delete iSearchObjFactory;
+    iCtxInternal = NULL;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CSearchFeatureImp::CSearchFeatureImp( CXIMPContextClientProxy& aCtxProxy )
+// ---------------------------------------------------------------------------
+//
+CSearchFeatureImp::CSearchFeatureImp()
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// CSearchFeatureImp::SetCtxL(MXIMPContext* aContext)
+// ---------------------------------------------------------------------------
+//
+void CSearchFeatureImp::SetCtxL(MXIMPContext* aContext)
+    {
+    if(!aContext)
+        User::Leave(KErrArgument);
+    iCtxInternal = TXIMPGetInterface<MXIMPContextInternal>::From(*aContext,EReturnNullIfUnknown);
+                       
+    }
+
+// ---------------------------------------------------------------------------
+// CSearchFeatureImp::ConstructL(MXIMPContext* aContext)
+// ---------------------------------------------------------------------------
+//
+void CSearchFeatureImp::ConstructL(MXIMPContext* aContext)
+    {
+    SetCtxL(aContext);
+    iSearchObjFactory = CSearchObjectFactoryImp::NewL();
+    iSearch = CSearchImp::NewL( *iCtxInternal );
+
+    }
+
+
+// ---------------------------------------------------------------------------
+// CSearchFeatureImp::SearchObjectFactory()
+// ---------------------------------------------------------------------------
+ MSearchObjectFactory& CSearchFeatureImp::SearchObjectFactory() const
+    {
+    return *iSearchObjFactory;
+    }
+
+
+
+   // ---------------------------------------------------------------------------
+// CSearchFeatureImp::Search() 
+// ---------------------------------------------------------------------------
+//
+ MSearch& CSearchFeatureImp::Search() const
+    {
+    return *iSearch;
+    }  
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/searchfeatureplugin/srcsearchfrontend/srcsearchmanager/searchfeatureimp.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,118 @@
+/*
+* 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:  Implementation of MsearchFeature
+*
+*/
+
+#ifndef CSEARCHFEATUREIMP_H
+#define CSEARCHFEATUREIMP_H
+
+#include <searchfeature.h>
+#include <ximpapiobjbase.h>
+#include "searchapiobjbase.h"
+
+
+class MXIMPContext;
+class MXIMPContextInternal;
+class CSearchObjectFactoryImp;
+class CSearchImp;
+
+/**
+ * MSearchFeature  implementation.
+ *
+ * @lib searchmanager.dll
+ */
+NONSHARABLE_CLASS( CSearchFeatureImp ):public MSearchFeature,
+										public CXIMPApiObjBase
+										  
+                                          
+    {
+    public:
+    /** The class ID. */
+    enum { KClassId = IMP_CLSID_CSEARCHFEATUREIMP };
+
+
+	public:
+	
+        /**
+    	 * Construction :NewL
+     	 */
+	    IMPORT_C static CSearchFeatureImp* NewL( MXIMPContext* aContext );
+	    /**
+         * Destructor
+         */
+	    virtual ~CSearchFeatureImp();
+
+
+	private:
+        /**
+         * Destructor
+         */
+	    CSearchFeatureImp();
+	   	/**
+         * inertnal context setting 
+         */
+	    void SetCtxL(MXIMPContext* aContext);
+		/**
+	     * constructor
+	     */
+	    void ConstructL(MXIMPContext* aContext);
+
+
+	public: // From MXIMPBase
+
+	    /**
+	     * Implementation of MXIMPBase interface methods
+	     * @see MXIMPBase
+	     */
+	    XIMPIMP_DECLARE_IF_BASE_METHODS
+
+
+	public: //From MSearchFeature
+		/**
+	     * 
+	     * @see MSearchFeature
+	     */
+	   
+	    MSearchObjectFactory& SearchObjectFactory() const;
+	    
+	   	/**
+	     * 
+	     * @see MSearchFeature
+	     */
+	    MSearch&  Search() const;
+
+
+
+	private: // data
+
+	    /**
+	     * Context for having a connection context server.
+	     */
+	    MXIMPContextInternal* iCtxInternal;
+	    
+
+	    /**
+	     * Object factory sub interface : OWNED
+	     */
+	    CSearchObjectFactoryImp* iSearchObjFactory;
+
+	    /**
+	     * SERACH  sub interface. : OWNED
+	     */
+	    CSearchImp* iSearch;
+    };
+
+
+#endif // CSEARCHFEATUREIMP_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/searchfeatureplugin/srcsearchfrontend/srcsearchmanager/searchimp.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,146 @@
+/*
+* 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:  Implementation of MSearch
+*
+*/
+
+
+
+#include <ximpobjecthelpers.h>
+#include <ximpidentityimp.h>
+#include <ximpcontextinternal.h>
+
+#include "searchoperationdefs.h"
+#include "searchimp.h"
+#include "searchelementimp.h"
+
+
+
+// ============================ MEMBER FUNCTIONS =============================
+
+// ---------------------------------------------------------------------------
+// CSearchImp::NewL()
+// ---------------------------------------------------------------------------
+//
+
+ CSearchImp* CSearchImp::NewL( MXIMPContextInternal& aContext )
+	{
+	XSearchLogger::Log(_L("CSearchImp::NewL Started"));
+	CSearchImp* self = new( ELeave ) CSearchImp( aContext );    
+	XSearchLogger::Log(_L("CSearchImp::NewL Completed"));
+	return self;
+	}
+
+
+// ---------------------------------------------------------------------------
+// Implement supported interface access.
+// ---------------------------------------------------------------------------
+//
+	XIMPIMP_IF_BASE_GET_INTERFACE_BEGIN( CSearchImp, 
+	                                     MSearch )
+	XIMPIMP_IF_BASE_GET_INTERFACE_END()
+
+
+	XIMPIMP_IF_BASE_GET_CONST_INTERFACE_BEGIN( CSearchImp, 
+	                                           MSearch )
+	XIMPIMP_IF_BASE_GET_INTERFACE_END()
+
+
+
+// ---------------------------------------------------------------------------
+// CSearchImp::~CSearchImp()
+// ---------------------------------------------------------------------------
+//	
+CSearchImp::~CSearchImp()
+    {
+	XSearchLogger::Log(_L("CSearchImp::~CSearchImp Started - Completed"));
+	}
+// ---------------------------------------------------------------------------
+// CSearchImp::CSearchImp()
+// ---------------------------------------------------------------------------
+//    
+CSearchImp::CSearchImp(MXIMPContextInternal& aContext )
+    : iContext( aContext )
+    {
+    }
+
+
+ // ---------------------------------------------------------------------------
+// CSearchImp::SearchL
+// ---------------------------------------------------------------------------
+//
+ TXIMPRequestId CSearchImp::SearchL( const MXIMPIdentity& aSearchId,
+    								 const RPointerArray< MSearchElement >& aObjs,
+                                    		   TInt aSearchLimit )
+    {
+     
+	CBufFlat* buffer = CBufFlat::NewL( 10 );
+    CleanupStack::PushL( buffer );
+
+    RBufWriteStream ws;
+    CleanupClosePushL( ws );
+    ws.Open( *buffer ); // CSI: 65 # Does not return a value
+
+
+  // identity
+    const CXIMPIdentityImp* identityImp =
+        TXIMPGetImpClassOrPanic< const CXIMPIdentityImp >::From( aSearchId );
+    identityImp->ExternalizeL( ws );
+    
+  
+    
+    // Get count of objects
+    TInt objCount( aObjs.Count() );
+    // write the count
+    ws.WriteInt32L( objCount );
+    // objects
+    for ( TInt count(0); count < objCount; count++ )
+        {
+        const CSearchElementImp* eleImp = 
+	    TXIMPGetImpClassOrPanic< const CSearchElementImp >::From( *aObjs[count] );
+        eleImp->ExternalizeL( ws );
+        }
+
+    // write the Search Limit
+    ws.WriteInt32L( aSearchLimit );
+    
+    ws.CommitL();
+    CleanupStack::PopAndDestroy();  //ws
+
+    HBufC8* packedBuf = buffer->Ptr( 0 ).AllocL();
+    CleanupStack::PopAndDestroy( buffer );
+    CleanupStack::PushL( packedBuf );
+    
+
+    // Queue the operation
+    TXIMPRequestId reqId =
+        iContext.QueueOperationL( NSearchOps::ESearch, *packedBuf );
+    CleanupStack::PopAndDestroy( packedBuf );
+
+                                 
+    return reqId ;
+    } 
+ 
+ // ---------------------------------------------------------------------------
+// CSearchImp::GetSearchKeysL
+// ---------------------------------------------------------------------------
+//
+ TXIMPRequestId CSearchImp::GetSearchKeysL()
+    {  
+    return iContext.QueueOperationL( NSearchOps::EGetSearchKeys , KNullDesC8);
+    } 
+
+// end of file
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/searchfeatureplugin/srcsearchfrontend/srcsearchmanager/searchimp.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,95 @@
+/*
+* 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:  Implementation of MSerach
+*
+*/
+
+#ifndef CSEARCHIMP_H
+#define CSEARCHIMP_H
+
+#include <search.h>
+#include <ximpobjectcollection.h>
+#include <ximpapiobjbase.h>
+
+#include "searchapiobjbase.h"
+#include "searchlogutils.h"
+
+
+// FORWARD DECLARATIONS
+class MXIMPContextInternal;
+class MSearchElement;
+
+/**
+ * MSearch  implementation.
+ *
+ * @lib searchmanager.dll
+ */
+NONSHARABLE_CLASS( CSearchImp ): public CXIMPApiObjBase,public MSearch
+    {
+    public:
+	    /** The class ID. */
+	    enum { KClassId = IMP_CLSID_CSEARCHIMP  };
+
+	public:
+	   	/**
+    	 * Construction :NewL
+     	 */
+	    static CSearchImp* NewL( MXIMPContextInternal& aContext );
+	    
+		/**
+         * Destructor
+         */
+	    ~CSearchImp();
+
+	public:
+	    /**
+	     * constructor
+	     */
+	    CSearchImp( MXIMPContextInternal& aContext );
+
+
+	public: // From MXIMPBase
+
+	    /**
+	     * Implementation of MXIMPBase interface methods
+	     * @see MXIMPBase
+	     */
+	  	 XIMPIMP_DECLARE_IF_BASE_METHODS
+	  	 
+		/**
+	     * 
+	     * @see MSearch
+	     */
+	 	TXIMPRequestId SearchL( const MXIMPIdentity& aSearchId,
+	    						const RPointerArray< MSearchElement >& aObjs,
+	                            TInt aSearchLimit ) ;
+	  	/**
+         * 
+         * @see MSearch
+         */								  											
+		TXIMPRequestId GetSearchKeysL() ;
+		
+	private: // data
+
+	    /**
+	     * Context session proxy for accessing context server.
+	     * Ref. : not owned 
+	     */
+	    MXIMPContextInternal& iContext;
+
+
+    };
+
+
+#endif // CSEARCHIMP_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/searchfeatureplugin/srcsearchoperations/group/bld.inf	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,32 @@
+/*
+* 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:  Build information file for project Search  Feature plugin
+*
+*/
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+PRJ_MMPFILES
+
+searchoperation.mmp
+searchoperationshook.mmp
+
+PRJ_TESTMMPFILES
+
+PRJ_TESTEXPORTS
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/searchfeatureplugin/srcsearchoperations/group/searchoperation.mmp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,84 @@
+/*
+* 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:  Project definition file for search Feature Plugin operations
+*
+*/
+
+#include <platform_paths.hrh>
+#include <data_caging_paths.hrh>
+#include "../../group/searchdlluids.hrh"
+
+
+TARGET                  searchoperation.dll
+TARGETTYPE              dll
+UID                     XIMP_SEARCH_DLL_UID_STATIC_INTERFACE XIMP_DLL_UID_SEARCH_OPERATION                 
+
+CAPABILITY              CAP_GENERAL_DLL
+VENDORID                VID_DEFAULT
+
+VERSION      10.0
+// ---------------------------------------------------------------------------
+SOURCEPATH              ../../srcsearchoperations
+// ---------------------------------------------------------------------------
+//SOURCE                  operationlaunchcleaner.cpp
+
+SOURCE                 searchoperationfactoryimp.cpp
+
+// ---------------------------------------------------------------------------
+SOURCEPATH              ../searchop
+// ---------------------------------------------------------------------------
+// Client - 
+SOURCE                  operationsearch.cpp
+SOURCE                  operationhandlesearchresult.cpp
+SOURCE                  operationgetsearchkeys.cpp
+SOURCE                  operationhandlesearchkeys.cpp
+// Adaptation - 
+
+
+// ---------------------------------------------------------------------------
+SOURCEPATH              ../../srcutils
+// ---------------------------------------------------------------------------
+SOURCE                  searchlogutils.cpp 
+
+
+USERINCLUDE             ../../srcutils
+USERINCLUDE             ../../srcsearchdatamodel
+USERINCLUDE             ../../srcsearchdatamodel/search
+USERINCLUDE             ../../srcsearchprocessor
+USERINCLUDE             ../../srcsearchoperations
+USERINCLUDE             ../searchop
+
+
+
+MW_LAYER_SYSTEMINCLUDE
+
+LIBRARY                 euser.lib
+LIBRARY                 ecom.lib
+LIBRARY                 estor.lib
+LIBRARY                 ximputils.lib
+LIBRARY                 searchdatamodel.lib
+LIBRARY                 ximpdatamodel.lib
+LIBRARY                 ximpprocessor.lib
+LIBRARY                 searchprocessor.lib
+LIBRARY                 flogger.lib 
+
+               
+#if defined( ARMCC )
+DEFFILE ../../eabi/ 
+#elif defined ( WINSCW )
+deffile ../../bwins/ 
+#endif
+
+// End of file
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/searchfeatureplugin/srcsearchoperations/group/searchoperationshook.mmp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,61 @@
+/*
+* 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:  Project definition file for search Feature Plugin operations hook
+*
+*/
+
+
+#include <platform_paths.hrh>
+#include <data_caging_paths.hrh>
+#include "../../group/searchdlluids.hrh"
+
+
+TARGET                  searchoperationshook.dll
+CAPABILITY              CAP_ECOM_PLUGIN
+TARGETTYPE              PLUGIN
+UID                     XIMP_SEARCH_DLL_UID_ECOM_PLUGIN XIMP_DLL_UID_SEARCH_OPERATIONS_HOOK                  
+VENDORID                VID_DEFAULT
+
+VERSION      10.0
+
+SOURCEPATH              ../searchoperationshook
+START RESOURCE          searchoperationshook.rss
+TARGET                  searchoperationshook.rsc
+END
+
+
+SOURCEPATH              ../searchoperationshook
+SOURCE                  searchoperationshook.cpp
+
+
+USERINCLUDE             ../searchoperationshook
+USERINCLUDE             ../../srcsearchoperations
+USERINCLUDE             ../../srcsearchdatamodel
+
+
+
+
+MW_LAYER_SYSTEMINCLUDE
+
+
+LIBRARY                 euser.lib
+LIBRARY                 searchoperation.lib
+LIBRARY                 ecom.lib
+
+
+#if defined( ARMCC )
+DEFFILE ../../eabi/ 
+#elif defined ( WINSCW )
+deffile ../../bwins/ 
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/searchfeatureplugin/srcsearchoperations/searchop/operationgetsearchkeys.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,104 @@
+/*
+* 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:  Concrete get search keys  operation
+ *
+*/
+
+
+
+#include <ximpprotocolconnection.h>
+#include <protocolsearchfeature.h>
+#include <protocolsearch.h>
+#include "operationgetsearchkeys.h"
+#include "ximphost.h"
+
+#include <ximprequestcompleteevent.h>
+#include "protocolsearchdatahostimp.h"
+#include "searchlogutils.h"
+
+
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// COperationGetSearchKeys::COperationGetSearchKeys()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C COperationGetSearchKeys::COperationGetSearchKeys()
+    {
+    }
+// ---------------------------------------------------------------------------
+// COperationGetSearchKeys::ConstructL
+// ---------------------------------------------------------------------------
+//
+void COperationGetSearchKeys::ConstructL( const TDesC8& /*aParamPck*/)
+    {
+    XSearchLogger::Log(_L("COperationGetSearchKeys::ConstructL "));
+    }
+
+// ---------------------------------------------------------------------------
+// COperationGetSearchKeys::~COperationGetSearchKeys()
+// ---------------------------------------------------------------------------
+//
+COperationGetSearchKeys::~COperationGetSearchKeys()
+    {
+    XSearchLogger::Log(_L("COperationGetSearchKeys::~COperationGetSearchKeys Start- End"));
+    }
+
+
+// ---------------------------------------------------------------------------
+// COperationGetSearchKeys::ProcessL()
+// ---------------------------------------------------------------------------
+//
+void COperationGetSearchKeys::ProcessL()
+    {
+	XSearchLogger::Log(_L("COperationGetSearchKeys::ProcessL Started"));
+	CXIMPOperationBase::ProcessL();
+	// Call to Adaptation.
+	MProtocolSearchFeature* srhFeature =static_cast< MProtocolSearchFeature*> 
+										(iMyHost->GetConnection().GetProtocolInterface(MProtocolSearchFeature::KInterfaceId));
+	if( srhFeature )
+		{
+	    srhFeature->Search().DoGetSearchKeysL( iReqId );		
+		}
+    else 
+	    {
+	    User::Leave(KErrNotSupported);	 // if NULL leave : not supported by protocol plugin
+	    }
+   
+    XSearchLogger::Log(_L("COperationGetSearchKeys::ProcessL Completed"));
+    }
+
+// ---------------------------------------------------------------------------
+// COperationGetSearchKeys::RequestCompleted()
+// ---------------------------------------------------------------------------
+//
+void COperationGetSearchKeys::RequestCompletedL()
+    {
+    XSearchLogger::Log(_L("COperationGetSearchKeys::RequestCompletedL Started"));
+    CXIMPOperationBase::RequestCompletedL();
+    XSearchLogger::Log(_L("COperationGetSearchKeys::RequestCompletedL Completed"));
+    }
+
+// ---------------------------------------------------------------------------
+// COperationGetSearchKeys::Type()
+// ---------------------------------------------------------------------------
+//
+TInt COperationGetSearchKeys::Type() const
+    {
+    return NSearchOps::EGetSearchKeys;
+    }
+
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/searchfeatureplugin/srcsearchoperations/searchop/operationgetsearchkeys.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,74 @@
+/*
+* 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:  get search keys operation header
+ *
+*/
+
+#ifndef C_OPERATIONGETSEARCHKEYS_H
+#define C_OPERATIONGETSEARCHKEYS_H
+
+#include <e32base.h>
+#include <ximpbase.h>
+
+#include "ximpoperationbase.h"
+#include "searchoperationdefs.h"
+
+
+/**
+ * get search keys operation class 
+ *
+ * @lib searchoperation.dll
+ */
+class COperationGetSearchKeys : public CXIMPOperationBase
+    {
+
+    public:
+        /**
+	     * constructor
+	     */
+        IMPORT_C COperationGetSearchKeys();
+     
+        /**
+	     * 2nd phase constructor
+	     */
+        void ConstructL( const TDesC8& aParamPck );
+        
+       /**
+         * Destructor
+         */
+        ~COperationGetSearchKeys();
+
+    public: // from CXIMPOperationBase
+        /**
+	     * 
+	     * @see CXIMPOperationBase 
+	     */
+        void ProcessL();
+        
+        /**
+	     * 
+	     * @see CXIMPOperationBase 
+	     */
+        void RequestCompletedL();
+        
+        /**
+	     * 
+	     * @see CXIMPOperationBase 
+	     */
+        TInt Type() const;
+        
+    };
+
+
+#endif // C_OPERATIONGETSEARCHKEYS_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/searchfeatureplugin/srcsearchoperations/searchop/operationhandlesearchkeys.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,148 @@
+/*
+* 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:  Concrete handle search keys from protocol plugin operation
+ *
+*/
+
+
+#include <badesca.h>
+#include <ximpprotocolconnection.h>
+#include <protocolsearchfeature.h>
+
+#include <ximppsccontext.h>
+
+#include "searchinfoimp.h"
+#include "operationhandlesearchkeys.h"
+#include "ximpoperationbase.h"
+
+#include "searchdatacacheimp.h"
+
+#include "ximpobjecthelpers.h"
+#include "ximprestrictedobjectcollectionimp.h"
+#include "ximpobjectcollectionimp.h"
+#include "ximphost.h"
+
+#include "protocolsearchdatahostimp.h"
+#include "searchlogutils.h"
+#include "searchdatacacheimp.h"
+
+#include "ximpsubscriptionitem.h"
+#include "searchkeyinfoimp.h"
+#include "searchkeyssubscriptionitem.h"
+
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// COperationHandleSearchKeys::COperationHandleSearchKeys()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C COperationHandleSearchKeys::COperationHandleSearchKeys()
+    {
+    XSearchLogger::Log(_L("COperationHandleSearchKeys::COperationHandleSearchKeys Started"));
+    XSearchLogger::Log(_L("COperationHandleSearchKeys::COperationHandleSearchKeys Completed"));
+    }
+
+
+// ---------------------------------------------------------------------------
+// COperationHandleSearchKeys::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void COperationHandleSearchKeys::ConstructL( const TDesC8& /*aParamPck */)
+    {
+    XSearchLogger::Log(_L("COperationHandleSearchKeys::ConstructL Started")); 
+    iKeyInfoArray=new ( ELeave ) RSearchKeyInfoImpArray;  
+    XSearchLogger::Log(_L("COperationHandleSearchKeys::ConstructL Completed"));
+    }
+
+// ---------------------------------------------------------------------------
+// COperationHandleSearchKeys::~COperationHandleSearchKeys()
+// ---------------------------------------------------------------------------
+//
+COperationHandleSearchKeys::~COperationHandleSearchKeys()
+    {
+    XSearchLogger::Log(_L("COperationHandleSearchKeys::~COperationHandleSearchKeys Started"));
+   
+    XSearchLogger::Log(_L("COperationHandleSearchKeys::~COperationHandleSearchKeys Completed"));
+    }
+
+
+// ---------------------------------------------------------------------------
+// COperationHandleSearchKeys::ProcessL()
+// ---------------------------------------------------------------------------
+//
+void COperationHandleSearchKeys::ProcessL()
+    {
+	XSearchLogger::Log(_L("COperationHandleSearchKeys::ProcessL Started"));
+	CXIMPOperationBase::ProcessL();
+	MXIMPBase* object = NULL;
+	TBool force =  ETrue; 
+	CXIMPOperationBase::GetObjCollection()->GetByType( object, MXIMPObjectCollection::KInterfaceId );
+	
+	if( object )
+		{  
+		MXIMPObjectCollection* objectCollection = static_cast<MXIMPObjectCollection*>(object->GetInterface(MXIMPObjectCollection::KInterfaceId,MXIMPBase::EPanicIfUnknown)) ;
+        
+        CleanupStack::PushL( objectCollection );
+       
+        TLinearOrder< CSearchKeyInfoImp > order( ( CSearchKeyInfoImp::LinearOrder ));
+        TXIMPObjectMover< MSearchKeyInfo, CSearchKeyInfoImp >::
+                                   MoveFromCollectionToArrayL( *objectCollection, *iKeyInfoArray, order );
+        CleanupStack::Pop( objectCollection ); 
+        delete  objectCollection;
+		}
+	else
+		{
+		User::Leave( KErrArgument );
+		}
+		
+    
+ 	CProtocolSearchDataHostImp* srchProtocolHost = 
+					static_cast <CProtocolSearchDataHostImp*> (iMyHost->GetProtocolHost(MProtocolSearchDataHost::KInterfaceId) );
+	
+	CSearchKeysSubscriptionItem& searchKeySubsItem = 
+			 srchProtocolHost->SearchDataCache().SearchKeysSubscriptionItemLC() ;
+    			
+
+	searchKeySubsItem.SetKeyInfoArray( iKeyInfoArray ); // ownership trasferred	
+	iKeyInfoArray=NULL;
+
+	searchKeySubsItem.SynthesiseSubscriptionEventToL( CXIMPOperationBase::GetContext(), force  );
+	CleanupStack::PopAndDestroy(); // searchKeySubsItem 
+	iMyHost->HandleAdaptationRequestCompleted( iReqId, KErrNone );
+	XSearchLogger::Log(_L("COperationHandleSearchKeys::ProcessL Completed"));
+	}
+
+// ---------------------------------------------------------------------------
+// COperationHandleSearchKeys::RequestCompleted()
+// ---------------------------------------------------------------------------
+//
+void COperationHandleSearchKeys::RequestCompletedL()
+    {
+    XSearchLogger::Log(_L("COperationHandleSearchKeys::RequestCompletedL Started"));
+    CXIMPOperationBase::RequestCompletedL();
+	XSearchLogger::Log(_L("COperationHandleSearchKeys::RequestCompletedL Completed"));
+    }
+
+// ---------------------------------------------------------------------------
+// COperationHandleSearchKeys::Type()
+// ---------------------------------------------------------------------------
+//
+TInt COperationHandleSearchKeys::Type() const
+    {
+    return NSearchOps::EHandleSearchKeys;
+    }
+
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/searchfeatureplugin/srcsearchoperations/searchop/operationhandlesearchkeys.h	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  handle search keys  operation
+ *
+*/
+
+#ifndef C_OPERATIONHANDLESEARCHKEYS_H
+#define C_OPERATIONHANDLESEARCHKEYS_H
+
+#include <e32base.h>
+#include <ximpbase.h>
+
+#include <ximpoperationbase.h>
+#include "searchoperationdefs.h"
+
+#include "searchinfoimp.h"
+
+#include "searchtypehelpers.h"
+/**
+ * handle search keys operation
+ *
+ * @lib searchoperation.dll
+ */
+class COperationHandleSearchKeys : public CXIMPOperationBase
+    {
+
+    public:
+        /**
+	     * constructor
+	     */
+        IMPORT_C COperationHandleSearchKeys();
+        
+        /**
+	     * 2nd phase constructor
+	     */
+        void ConstructL( const TDesC8& aParamPck );
+        
+        /**
+         * Destructor
+         */
+        ~COperationHandleSearchKeys();
+
+    public: // from CXIMPOperationBase
+        /**
+	     * 
+	     * @see CXIMPOperationBase 
+	     */
+        void ProcessL();
+        
+        /**
+	     * 
+	     * @see CXIMPOperationBase 
+	     */
+        void RequestCompletedL();
+        
+        /**
+	     * 
+	     * @see CXIMPOperationBase 
+	     */
+        TInt Type() const;
+  
+    private: // data
+    
+        /**
+         * RSearchKeyInfoImpArray : Not owned
+         */
+        RSearchKeyInfoImpArray* iKeyInfoArray;
+        
+ 
+    };
+
+
+#endif // C_OPERATIONHANDLESEARCHKEYS_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/searchfeatureplugin/srcsearchoperations/searchop/operationhandlesearchresult.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,166 @@
+/*
+* 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:  Concrete handle search result operation
+ *
+*/
+
+
+#include <badesca.h>
+#include <ximpprotocolconnection.h>
+#include <protocolsearchfeature.h>
+
+#include <ximppsccontext.h>
+
+#include "searchinfoimp.h"
+#include "operationhandlesearchresult.h"
+#include "ximpoperationbase.h"
+#include "ximpidentityimp.h"
+#include "searchsubscriptionitem.h"
+#include "searchdatacacheimp.h"
+
+#include "ximpobjecthelpers.h"
+#include "ximprestrictedobjectcollectionimp.h"
+#include "ximpobjectcollectionimp.h"
+#include "ximphost.h"
+
+#include "protocolsearchdatahostimp.h"
+#include "searchlogutils.h"
+#include "searchdatacacheimp.h"
+
+#include "ximpsubscriptionitem.h"
+
+#include "searchsubscriptionitem.h"
+
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// COperationHandleSearchResult::COperationHandleSearchResult()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C COperationHandleSearchResult::COperationHandleSearchResult()
+    {
+    XSearchLogger::Log(_L("COperationHandleSearchResult::COperationHandleSearchResult Started"));
+    XSearchLogger::Log(_L("COperationHandleSearchResult::COperationHandleSearchResult Completed"));
+    }
+
+
+// ---------------------------------------------------------------------------
+// COperationHandleSearchResult::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void COperationHandleSearchResult::ConstructL( const TDesC8& /*aParamPck */)
+    {
+    XSearchLogger::Log(_L("COperationHandleSearchResult::ConstructL Started")); 
+    iSearchResults=new ( ELeave ) RSearchInfoImpArray;  
+    XSearchLogger::Log(_L("COperationHandleSearchResult::ConstructL Completed"));
+    }
+
+// ---------------------------------------------------------------------------
+// COperationHandleSearchResult::~COperationHandleSearchResult()
+// ---------------------------------------------------------------------------
+//
+COperationHandleSearchResult::~COperationHandleSearchResult()
+    {
+    XSearchLogger::Log(_L("COperationHandleSearchResult::~COperationHandleSearchResult Started"));
+   
+    XSearchLogger::Log(_L("COperationHandleSearchResult::~COperationHandleSearchResult Completed"));
+    }
+
+
+// ---------------------------------------------------------------------------
+// COperationHandleSearchResult::ProcessL()
+// ---------------------------------------------------------------------------
+//
+void COperationHandleSearchResult::ProcessL()
+    {
+	XSearchLogger::Log(_L("COperationHandleSearchResult::ProcessL Started"));
+	CXIMPOperationBase::ProcessL();
+	MXIMPBase* object = NULL;
+	TBool force =  ETrue; 
+	CXIMPOperationBase::GetObjCollection()->GetByType( object, MXIMPIdentity::KInterfaceId );
+	
+	if( object )
+		{  
+		iSearchId = TXIMPGetImpClassOrPanic< CXIMPIdentityImp  >::From( *object );	
+		}
+	else
+		{
+		User::Leave( KErrArgument );
+		}
+		
+	object = NULL;
+    CXIMPOperationBase::GetObjCollection()->GetByType( object, MXIMPObjectCollection::KInterfaceId );
+    if( object )
+        {
+        
+        MXIMPObjectCollection* objectCollection = static_cast<MXIMPObjectCollection*>(object->GetInterface(MXIMPObjectCollection::KInterfaceId,MXIMPBase::EPanicIfUnknown)) ;
+        
+       // CXIMPObjectCollectionImp* objectCollection = 
+      	//				   TXIMPGetImpClassOrPanic< CXIMPObjectCollectionImp >::From( *object );
+        CleanupStack::PushL( objectCollection );
+       
+        TLinearOrder< CSearchInfoImp > order( ( CSearchInfoImp::InfoLinearOrder ));
+        TXIMPObjectMover< MSearchInfo, CSearchInfoImp >::
+                                   MoveFromCollectionToArrayL( *objectCollection, *iSearchResults, order );
+        CleanupStack::Pop( objectCollection ); 
+        delete  objectCollection;
+         
+        }
+    else
+        {
+        User::Leave( KErrArgument );
+        }
+    
+   	CProtocolSearchDataHostImp* srchProtocolHost = 
+					static_cast <CProtocolSearchDataHostImp*> (iMyHost->GetProtocolHost(MProtocolSearchDataHost::KInterfaceId) );
+	
+	CSearchSubscriptionItem& searchSubsItem = 
+			 srchProtocolHost->SearchDataCache().SearchSubscriptionItemLC() ;
+    			
+
+	searchSubsItem.SetSearchResults(iSearchResults); // ownership trasferred
+	searchSubsItem.SetSearchIdL(*iSearchId);// ownership trasferred
+	
+	iSearchResults=NULL;
+	iSearchId=NULL;
+	
+	searchSubsItem.SynthesiseSubscriptionEventToL( CXIMPOperationBase::GetContext(), force  );
+	CleanupStack::PopAndDestroy(); // searchItem
+	iMyHost->HandleAdaptationRequestCompleted( iReqId, KErrNone );
+	XSearchLogger::Log(_L("COperationHandleSearchResult::ProcessL Completed"));
+	}
+
+// ---------------------------------------------------------------------------
+// COperationHandleSearchResult::RequestCompleted()
+// ---------------------------------------------------------------------------
+//
+void COperationHandleSearchResult::RequestCompletedL()
+    {
+    XSearchLogger::Log(_L("COperationHandleSearchResult::RequestCompletedL Started"));
+    CXIMPOperationBase::RequestCompletedL();
+	XSearchLogger::Log(_L("COperationHandleSearchResult::RequestCompletedL Completed"));
+    }
+
+// ---------------------------------------------------------------------------
+// COperationHandleSearchResult::Type()
+// ---------------------------------------------------------------------------
+//
+TInt COperationHandleSearchResult::Type() const
+    {
+    return NSearchOps::EHandleSearchResults;
+    }
+
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/searchfeatureplugin/srcsearchoperations/searchop/operationhandlesearchresult.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,91 @@
+/*
+* 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:  handle search result operation
+ *
+*/
+
+#ifndef C_OPERATIONHANDLESEARCHRESULT_H
+#define C_OPERATIONHANDLESEARCHRESULT_H
+
+#include <e32base.h>
+#include <ximpbase.h>
+
+#include <ximpoperationbase.h>
+#include "searchoperationdefs.h"
+
+#include "searchinfoimp.h"
+
+#include "searchtypehelpers.h"
+/**
+ * handle search result operation
+ *
+ * @lib searchoperation.dll
+ */
+class COperationHandleSearchResult : public CXIMPOperationBase
+    {
+
+    public:
+        /**
+	     * constructor
+	     */
+        IMPORT_C COperationHandleSearchResult();
+        
+        /**
+	     * 2nd phase constructor
+	     */
+        void ConstructL( const TDesC8& aParamPck );
+        
+        /**
+         * Destructor
+         */
+        ~COperationHandleSearchResult();
+
+    public: // from CXIMPOperationBase
+        /**
+	     * 
+	     * @see CXIMPOperationBase 
+	     */
+        void ProcessL();
+        
+        /**
+	     * 
+	     * @see CXIMPOperationBase 
+	     */
+        void RequestCompletedL();
+        
+        /**
+	     * 
+	     * @see CXIMPOperationBase 
+	     */
+        TInt Type() const;
+  
+    private: // data
+    
+        /**
+         * CXIMPIdentityImp : Not owned
+         */
+ 
+        CXIMPIdentityImp* iSearchId;
+         
+        /**
+         * RSearchInfoImpArray : Not owned
+         */
+  
+        RSearchInfoImpArray* iSearchResults;
+        
+        
+    };
+
+
+#endif // C_OPERATIONHANDLESEARCHRESULT_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/searchfeatureplugin/srcsearchoperations/searchop/operationsearch.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,139 @@
+/*
+* 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:  Concrete search operation
+ *
+*/
+
+
+
+#include <ximpprotocolconnection.h>
+#include <protocolsearchfeature.h>
+#include <protocolsearch.h>
+#include "searchelementimp.h"
+#include "operationsearch.h"
+#include "ximpobjecthelpers.h"
+#include <ximprestrictedobjectcollection.h>
+#include "ximphost.h"
+
+#include <ximprequestcompleteevent.h>
+#include "protocolsearchdatahostimp.h"
+#include "searchlogutils.h"
+#include <badesca.h>
+
+#include <ximpidentityimp.h> 
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// COperationSearch::COperationSearch()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C COperationSearch::COperationSearch()
+    {
+    }
+// ---------------------------------------------------------------------------
+// COperationSearch::ConstructL
+// ---------------------------------------------------------------------------
+//
+void COperationSearch::ConstructL( const TDesC8& aParamPck )
+    {
+    XSearchLogger::Log(_L("COperationSearch::ConstructL Started"));
+    
+ 	RDesReadStream rs;
+    CleanupClosePushL( rs );
+    rs.Open( aParamPck ); // CSI: 65 #
+    
+    
+    iSearchId = CXIMPIdentityImp::NewLC();
+    CleanupStack::Pop( iSearchId );
+    iSearchId->InternalizeL( rs );
+
+    // read the object count
+    TInt objCount( rs.ReadInt32L() );
+
+	for ( TInt count = 0; count < objCount; count++ )
+        {
+		// instantiate new object
+	    CSearchElementImp* theObject = CSearchElementImp::NewLC();
+	    // extract its data
+	    theObject->InternalizeL( rs );
+	    // append it to the object array
+	    iSearchList.AppendL( theObject );
+	    CleanupStack::Pop( theObject ); // theObject
+		}
+		
+    iSearchLimit = rs.ReadInt32L();
+    CleanupStack::PopAndDestroy(); // rs
+    
+   	                                                      
+    XSearchLogger::Log(_L("COperationSearch::ConstructL Completed"));
+    }
+
+// ---------------------------------------------------------------------------
+// COperationSearch::~COperationSearch()
+// ---------------------------------------------------------------------------
+//
+COperationSearch::~COperationSearch()
+    {
+    XSearchLogger::Log(_L("COperationSearch::~COperationSearch Started"));
+    delete iSearchId;
+   	iSearchList.ResetAndDestroy();
+    XSearchLogger::Log(_L("COperationSearch::~COperationSearch Completed"));
+    }
+
+
+// ---------------------------------------------------------------------------
+// COperationSearch::ProcessL()
+// ---------------------------------------------------------------------------
+//
+void COperationSearch::ProcessL()
+    {
+	XSearchLogger::Log(_L("COperationSearch::ProcessL Started"));
+	CXIMPOperationBase::ProcessL();
+	// Call to Adaptation.
+	MProtocolSearchFeature* srhFeature =static_cast< MProtocolSearchFeature*> 
+										(iMyHost->GetConnection().GetProtocolInterface(MProtocolSearchFeature::KInterfaceId));
+	if( srhFeature )
+	    {
+	    srhFeature->Search().DoSearchL(*iSearchId, iSearchList,iSearchLimit,iReqId );
+	    }
+	else
+	    {
+	    User::Leave( KErrNotSupported ); // if NULL leave : not supported by protocol plugin
+	    }
+    XSearchLogger::Log(_L("COperationSearch::ProcessL Completed"));
+    }
+
+// ---------------------------------------------------------------------------
+// COperationSearch::RequestCompleted()
+// ---------------------------------------------------------------------------
+//
+void COperationSearch::RequestCompletedL()
+    {
+    XSearchLogger::Log(_L("COperationSearch::RequestCompletedL Started"));
+    CXIMPOperationBase::RequestCompletedL();
+    XSearchLogger::Log(_L("COperationSearch::RequestCompletedL Completed"));
+    }
+
+// ---------------------------------------------------------------------------
+// COperationSearch::Type()
+// ---------------------------------------------------------------------------
+//
+TInt COperationSearch::Type() const
+    {
+    return NSearchOps::ESearch;
+    }
+
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/searchfeatureplugin/srcsearchoperations/searchop/operationsearch.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,93 @@
+/*
+* 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:  search operation
+ *
+*/
+
+#ifndef C_OPERATIONSEARCH_H
+#define C_OPERATIONSEARCH_H
+
+#include <e32base.h>
+#include <ximpbase.h>
+
+#include "ximpoperationbase.h"
+#include "searchoperationdefs.h"
+
+#include <searchelement.h>
+
+class MsearchElement;
+class CSearchElementImp;
+class CXIMPIdentityImp;
+/**
+ * search operation
+ *
+ * @lib searchoperation.dll
+ */
+class COperationSearch : public CXIMPOperationBase
+    {
+
+    public:
+        /**
+	     * constructor
+	     */
+        IMPORT_C COperationSearch();
+     
+        /**
+	     * 2nd phase constructor
+	     */
+        void ConstructL( const TDesC8& aParamPck );
+        
+       /**
+         * Destructor
+         */
+        ~COperationSearch();
+
+    public: // from CXIMPOperationBase
+        /**
+	     * 
+	     * @see CXIMPOperationBase 
+	     */
+        void ProcessL();
+        
+        /**
+	     * 
+	     * @see CXIMPOperationBase 
+	     */
+        void RequestCompletedL();
+        
+        /**
+	     * 
+	     * @see CXIMPOperationBase 
+	     */
+        TInt Type() const;
+        
+    private: // data
+    
+        /**
+         * array of MSearchElement : Owned
+         */
+        RPointerArray<MSearchElement> iSearchList;
+        /**
+         * CXIMPIdentityImp : Owned
+         */
+        CXIMPIdentityImp* iSearchId;
+        
+        /**
+         * serachlimit
+         */
+        TInt iSearchLimit;
+    };
+
+
+#endif // C_OPERATIONSEARCH_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/searchfeatureplugin/srcsearchoperations/searchoperationdefs.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,43 @@
+/*
+* 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:  XIMP framework SEARCH operation definitions.
+ *
+*/
+
+#ifndef SEARCHOPERATIONDEFS_H
+#define SEARCHOPERATIONDEFS_H
+
+#include <e32std.h>
+
+
+
+namespace NSearchOps
+    {
+    enum TSearchOpTypes
+        {
+        
+        ESearch = 300,                          
+        EHandleSearchResults,
+        ESearchCleaner,
+		EGetSearchKeys, 
+		EHandleSearchKeys
+        };
+    }
+
+#endif  //SEARCHOPERATIONDEFS_H
+
+
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/searchfeatureplugin/srcsearchoperations/searchoperationfactoryimp.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  Search Service  operation factory
+ *
+*/
+
+
+#include "searchoperationfactoryimp.h"
+
+#include "searchlogutils.h"
+#include "searchoperationdefs.h"
+#include "operationsearch.h"
+#include "operationhandlesearchresult.h"
+#include "operationgetsearchkeys.h"
+#include "operationhandlesearchkeys.h"
+
+using namespace NSearchOps;
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CXIMPOperationFactory::NewL()
+// 
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CSearchOperationFactory* CSearchOperationFactory::NewL()
+    {
+    XSearchLogger::Log(_L("CSearchOperationFactory::NewL Started"));
+    CSearchOperationFactory* self = new ( ELeave ) CSearchOperationFactory();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    XSearchLogger::Log(_L("CSearchOperationFactory::NewL Completed"));
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CXIMPOperationFactory::CXIMPOperationFactory()
+// -----------------------------------------------------------------------------
+//
+CSearchOperationFactory::CSearchOperationFactory()
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CXIMPOperationFactory::~CXIMPOperationFactory()
+// -----------------------------------------------------------------------------
+//
+CSearchOperationFactory::~CSearchOperationFactory()
+    {
+    XSearchLogger::Log(_L("CSearchOperationFactory::~CSearchOperationFactory Started"));
+    XSearchLogger::Log(_L("CSearchOperationFactory::~CSearchOperationFactory Completed"));
+    }
+
+
+// -----------------------------------------------------------------------------
+// CXIMPOperationFactory::ConstructL()
+// -----------------------------------------------------------------------------
+//
+void CSearchOperationFactory::ConstructL()
+    {
+    XSearchLogger::Log(_L("CSearchOperationFactory::ConstructL Started"));
+    XSearchLogger::Log(_L("CSearchOperationFactory::ConstructL Completed"));
+    }
+
+
+// -----------------------------------------------------------------------------
+// CXIMPOperationFactory::CreateOperationL()
+// -----------------------------------------------------------------------------
+//
+CXIMPOperationBase* CSearchOperationFactory::CreateOperationL( TInt aOperation )
+	{
+	XSearchLogger::Log(_L("CSearchOperationFactory::CreateOperationL Started"));
+	CXIMPOperationBase* op = NULL;
+    NSearchOps::TSearchOpTypes operation = ( NSearchOps::TSearchOpTypes ) aOperation;
+    switch( operation )
+        {
+        case ESearch:
+            {
+            XSearchLogger::Log(_L("CSearchOperationFactory::CreateOperationL  = ESearch"));
+            op = new ( ELeave ) COperationSearch();
+            break;
+            }
+        case EHandleSearchResults:
+            {
+            XSearchLogger::Log(_L("CSearchOperationFactory::CreateOperationL  = EHandleSearchResults"));
+            op = new ( ELeave ) COperationHandleSearchResult();
+            break;
+            }
+      case EGetSearchKeys:
+            {
+            XSearchLogger::Log(_L("CSearchOperationFactory::CreateOperationL  = EGetSearchKeys"));
+            op = new ( ELeave ) COperationGetSearchKeys();
+            break;
+            }
+      case EHandleSearchKeys:
+            {
+            XSearchLogger::Log(_L("CSearchOperationFactory::CreateOperationL  = EHandleSearchKeys"));
+            op = new ( ELeave ) COperationHandleSearchKeys();
+            break;
+            }      
+        default:
+        	{
+            break;
+            }
+        }
+    XSearchLogger::Log(_L("CSearchOperationFactory::CreateOperationL Completed"));
+   	return op;
+	}
+// End of file
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/searchfeatureplugin/srcsearchoperations/searchoperationfactoryimp.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,80 @@
+/*
+* 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:  Search Service  operation factory
+ *
+*/
+
+
+#ifndef SEARCHOPERATIONFACTORYIMP_H
+#define SEARCHOPERATIONFACTORYIMP_H
+
+
+#include <e32base.h>
+#include <ximpoperationfactory1.h>
+#include "searchapiobjbase.h"
+
+class CXIMPOperationBase;
+
+/**
+ * Operation factory
+ *
+ * @lib searchoperation.dll
+ */
+
+NONSHARABLE_CLASS(CSearchOperationFactory): public MXIMPOperationFactory1
+    {
+    
+    public:
+    /** The class ID. */
+    enum { KClassId = IMP_CLSID_CSEARCHOPERATIONFACTORYIMP };
+    
+        
+    public: // Construction and desctruction
+    
+    	/**
+    	 * Construction :NewL
+     	 */
+        IMPORT_C static CSearchOperationFactory* NewL();
+        
+       /**
+         * Destructor
+         */
+        virtual ~CSearchOperationFactory();
+
+    private: // Construction
+
+        /**
+         * C++ default constructor.
+         */
+        CSearchOperationFactory();
+
+        /**
+         * Symbian 2nd phase constructor
+         */
+        void ConstructL();
+
+
+    public: // From MXIMPOperationFactory1
+
+		/**
+		 * @see MXIMPOperationFactory1
+	 	 */
+		CXIMPOperationBase* CreateOperationL( TInt aOperation );
+
+   
+
+    };
+
+#endif      // SEARCHCOPERATIONFACTORYIMP_H
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/searchfeatureplugin/srcsearchoperations/searchoperationshook/searchoperationshook.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,44 @@
+/*
+* 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:  XIMP Framework's search operations Hook implementation.
+*
+*/
+
+
+#include <searchdlluids.hrh>
+#include <ecom/implementationproxy.h>
+#include <e32base.h>
+#include "searchoperationfactoryimp.h"
+// ---------------------------------------------------------------------------
+// Key value pair table to identify correct constructor
+// function for the requested interface.
+// ---------------------------------------------------------------------------
+//
+const TImplementationProxy ImplementationTable[] =
+    {
+    IMPLEMENTATION_PROXY_ENTRY( XIMP_ECOM_IMPL_UID_SEARCH_OPERATION_INTERFACE,
+                                CSearchOperationFactory::NewL)
+    };
+
+
+// ---------------------------------------------------------------------------
+// Exported function to return the implementation proxy table
+// ---------------------------------------------------------------------------
+//
+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/imservices/searchfeatureplugin/srcsearchoperations/searchoperationshook/searchoperationshook.rss	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,54 @@
+/*
+* 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:  ECom registery info for ECom serach operation hook
+*
+*/
+
+
+#include <ecom/registryinfov2.rh>
+#include <ximpfeaturepluginifids.hrh>
+#include <searchdlluids.hrh>
+#include <searchmanagementifids.hrh>
+
+
+
+// ---------------------------------------------------------------------------
+// ECom registery info for XIMP search operation ECom hook
+// ---------------------------------------------------------------------------
+//
+RESOURCE REGISTRY_INFO theInfo
+    {
+    resource_format_version = RESOURCE_FORMAT_VERSION_2;
+    dll_uid = XIMP_DLL_UID_SEARCH_OPERATIONS_HOOK;
+
+    interfaces =
+        {
+        INTERFACE_INFO
+            {
+            interface_uid = XIMP_ECOM_IF_UID_OPERATIONS_INTERFACE;
+            implementations =
+                {
+                IMPLEMENTATION_INFO
+                    {
+                    implementation_uid = XIMP_ECOM_IMPL_UID_SEARCH_OPERATION_INTERFACE;
+                    version_no         = 1;
+                    display_name       = "S60 Default XIMP";
+                    default_data       = "default";
+                    opaque_data        = "";
+                    }
+                };
+            }
+        };
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/searchfeatureplugin/srcsearchoperations/ximpobjectcollectionimp.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,176 @@
+/*
+* 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:  Object collection implementation.
+ *
+*/
+
+#ifndef XIMPOBJECTCOLLECTIONIMP_H
+#define XIMPOBJECTCOLLECTIONIMP_H
+
+#include "ximpapiobjbase.h"
+#include <e32std.h>
+#include <ximpobjectcollection.h> 
+
+
+/**
+ * Object collection implementation.
+ *
+ * @see MXIMPObjectCollection
+ * @ingroup ximpdatamodelapi
+ * @since S60 v3.2
+ */
+class CXIMPObjectCollectionImp : public CXIMPApiObjBase,
+    public MXIMPObjectCollection
+    {
+
+private: // helper class
+
+    class CXIMPCollectionElement : public CBase
+        {
+        public:
+
+            static CXIMPCollectionElement* NewL( CXIMPApiObjBase* aObject, const TDesC8& aName );
+            ~CXIMPCollectionElement();
+
+            /**
+             * Get the stored object. Ownership transferred
+             * to the caller.
+             * @param The stored object
+             */
+            CXIMPApiObjBase* GetObject();
+
+        private:
+
+            CXIMPCollectionElement();
+            void ConstructL( CXIMPApiObjBase* aObject, const TDesC8& aName );
+
+        public:
+            // owns: the object
+            CXIMPApiObjBase* iObject;
+
+            // owns: the name (always valid, but can be empty)
+            HBufC8* iName;
+        };
+
+public:
+
+    /** The class ID. */
+    enum { KClassId = XIMPIMP_CLSID_CXIMPOBJECTCOLLECTIONIMP };
+
+public:
+
+    IMPORT_C static CXIMPObjectCollectionImp* NewLC();
+    IMPORT_C static CXIMPObjectCollectionImp* NewL();
+
+public:
+
+    /**
+     * Destruction
+     */
+    ~CXIMPObjectCollectionImp();
+
+
+private:
+
+    CXIMPObjectCollectionImp();
+
+
+public: // From MXIMPBase
+
+    /**
+     * Implementation of MXIMPBase interface methods
+     * @see MXIMPBase
+     */
+    XIMPIMP_DECLARE_IF_BASE_METHODS
+
+public: // from MXIMPObjectCollection
+
+    // object lookup
+
+    /**
+     * @see MXIMPObjectCollection
+     */
+    void LookupByType(
+            const MXIMPBase*& aObject,
+            TInt32 aInterfaceId ) const; 
+
+    /**
+     * @see MXIMPObjectCollection
+     */
+    void LookupByTypeAndName(
+                const MXIMPBase*& aObject,
+                TInt32 aInterfaceId,
+                const TDesC8& aMatch ) const;
+
+    // set management
+
+    /**
+     * @see MXIMPObjectCollection
+     */
+    void AddObjectL(
+                MXIMPBase* aObject );
+
+    /**
+     * @see MXIMPObjectCollection
+     */
+    void AddObjectWithNameL(
+                MXIMPBase* aObject,
+                const TDesC8& aName );
+
+
+    /**
+     * @see MXIMPObjectCollection
+     */
+    TBool GetByType(
+                MXIMPBase*& aObject,
+                TInt32 aInterfaceId );
+
+    /**
+     * @see MXIMPObjectCollection
+     */
+    TBool GetByTypeAndName(
+                MXIMPBase*& aObject,
+                TInt32 aInterfaceId,
+                const TDesC8& aMatch );
+
+private: // helpers
+
+    /**
+     * Find the index of the least recently used
+     * object. Since the internal array is LIFO,
+     * we walk the array forwards to find the index of 
+     * least recently used object.
+     * @param aObject The object from which to start
+     * @return The index
+     */
+    TInt FindLRUIndex( const MXIMPBase*& aObject ) const;
+
+    /**
+     * Validate a given name. Checks that wildcard characters do not exist.
+     * @return KErrNone if the name is OK, KErrBadName otherwise
+     */
+    TInt ValidateName( const TDesC8& aName ) const;
+
+private: // data
+
+    /**
+     * OWN: Objects
+     */
+    RXIMPObjOwningPtrArray< CXIMPCollectionElement > iCollection;
+
+    };
+
+
+#endif // XIMPOBJECTCOLLECTIONIMP_H
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/searchfeatureplugin/srcsearchoperations/ximprequestcompleteeventimp.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,149 @@
+/*
+* 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:  MXIMPRequestCompleteEvent API object implementation.
+*
+*/
+
+#ifndef CXIMPREQUESTCOMPLETEEVENTIMP_H
+#define CXIMPREQUESTCOMPLETEEVENTIMP_H
+
+#include "ximpapieventbase.h"
+#include "ximptypehelpers.h"
+#include <ximprequestcompleteevent.h>
+
+class RWriteStream;
+class RReadStream;
+class CXIMPStatusImp;
+class MXIMPStatus;
+class CXIMPApiDataObjBase;
+
+
+/**
+ * MXIMPRequestCompleteEvent API object implementation.
+ *
+ * @lib ximpdatamodel.dll
+ * @since S60 v3.2
+ */
+NONSHARABLE_CLASS( CXIMPRequestCompleteEventImp ): 
+    public CXIMPApiEventBase,
+    public MXIMPRequestCompleteEvent
+    {
+    public:
+        /** The class ID. */
+        enum { KClassId = XIMPIMP_CLSID_CXIMPREQUESTCOMPLETEEVENTIMP };
+
+public:
+
+    /**
+     * Exported instantiation method for initializing
+     * new event object.
+     */
+    IMPORT_C static CXIMPRequestCompleteEventImp* NewL();
+    IMPORT_C static CXIMPRequestCompleteEventImp* NewLC(
+            TXIMPRequestId& aRequestId, TInt aDefaultErrorValue = KErrNone );
+
+
+    /**
+     * Instantiation method for event automation.
+     * Method signature must be exactly this to work
+     * with event delivery automation system.
+     *
+     * Event implementation must be registered to
+     * XIMPEventCodec KXIMPEventConstructorTable.
+     */
+    static CXIMPApiEventBase* NewFromStreamLC( RReadStream& aStream );
+
+
+    virtual ~CXIMPRequestCompleteEventImp();
+
+private:
+    CXIMPRequestCompleteEventImp( TXIMPRequestId& aRequestId );
+    CXIMPRequestCompleteEventImp();
+    void ConstructL( TInt aDefaultErrorValue );
+    void ConstructL( RReadStream& aStream );
+    
+public: // From MXIMPRequestCompleteEvent
+
+    /**
+     * Implementation of MXIMPRequestCompleteEvent interface methods
+     * @see MXIMPRequestCompleteEvent
+     */
+    const TXIMPRequestId& RequestId() const;
+    const MXIMPStatus& CompletionResult() const;    
+    const MXIMPBase* LookupCompletionDataByType( TInt32 aInterfaceId ) const;
+
+
+public:
+
+    /** 
+     * Set request id
+     * @param aRequestId New requestId.
+     */
+    IMPORT_C void SetRequestId( const TXIMPRequestId& aRequestId );
+
+    /**
+     * Add data object as a parameter to this event. Ownership
+     * transferred.
+     * @param aObj The fully constructed data object to add
+     */ 
+    IMPORT_C void AppendParamL( CXIMPApiDataObjBase* aObj );
+    
+    
+    IMPORT_C CXIMPStatusImp& CompletionResultImp();    
+
+public: // From API base interfaces
+
+    /**
+     * Implementation of MXIMPBase interface methods
+     * @see MXIMPBase
+     */
+    XIMPIMP_DECLARE_IF_BASE_METHODS
+
+
+    /**
+     * Implementation of MXIMPEventBase interface and
+     * CXIMPApiEventBase methods
+     *
+     * @see MXIMPEventBase
+     * @see CXIMPApiEventBase
+     */
+    XIMPIMP_DECLARE_EVENT_BASE_METHODS
+
+private: // data
+
+    /**
+     * Completed request.
+     * Own.
+     */
+    TXIMPRequestId iReqId;
+
+
+    /**
+     * Request result.
+     * This is set to KErrNoMemory for default value.
+     * Reason for that is error handling in low memory situation
+     * CXIMPEventCapsule will send KErrNoMemory version of event if
+     * event cannot be updated because of low memory.
+     * Own.
+     */
+    CXIMPStatusImp* iResult;
+    
+    /**
+     * Array of params
+     */
+    RPrReqParamArray iParamArray;
+    };
+
+
+#endif // CXIMPREQUESTCOMPLETEEVENTIMP_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/searchfeatureplugin/srcsearchoperations/ximprestrictedobjectcollectionimp.h	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  MXIMPRestrictedObjectCollection implementation
+*
+*/
+
+#ifndef CXIMPRESTRICTEDOBJECTCOLLECTIONIMP_H
+#define CXIMPRESTRICTEDOBJECTCOLLECTIONIMP_H
+
+#include <e32std.h>
+#include <ximprestrictedobjectcollection.h>
+#include "ximpapiobjbase.h"
+
+
+/**
+ *
+ * @since S60 v3.2
+ */
+class CXIMPRestrictedObjectCollectionImp : public CXIMPApiObjBase,
+                                           public MXIMPRestrictedObjectCollection
+    {
+public:
+
+    /** The class ID. */
+    enum { KClassId = XIMPIMP_CLSID_CXIMPRESTRICTEDOBJECTCOLLECTIONIMP };
+    
+public:
+    
+    /*
+     * Construction of instance
+     * @param aObjectOwning. ETrue objects are owned by instance.
+     *                       EFalse objects are not owned by instance.
+     *                       Default = ETrue
+     */
+    IMPORT_C static CXIMPRestrictedObjectCollectionImp* NewLC( TBool aObjectOwning = ETrue );
+
+    /*
+     * Construction of instance
+     * @param aObjectOwning. ETrue objects are owned by instance.
+     *                       EFalse objects are not owned by instance.
+     *                       Default = ETrue
+     */
+    IMPORT_C static CXIMPRestrictedObjectCollectionImp* NewL( TBool aObjectOwning = ETrue );
+    
+
+public:
+
+    /**
+     * Destruction
+     */
+    ~CXIMPRestrictedObjectCollectionImp();
+
+
+private:
+
+    /**
+     * Construction
+     * @param aObjectOwning. ETrue objects are owned by instance.
+     *                       EFalse objects are not owned by instance.
+     */
+    CXIMPRestrictedObjectCollectionImp( TBool aObjectOwning );
+
+
+public: // From MXIMPBase
+
+    /**
+     * Implementation of MXIMPBase interface methods
+     * @see MXIMPBase
+     */
+    XIMPIMP_DECLARE_IF_BASE_METHODS
+
+public: // From MXIMPRestrictedObjectCollection
+
+    void LookupByType( const MXIMPBase*& aObject, TInt32 aInterfaceId ) const;
+    void AddOrReplaceTypeL( MXIMPBase* aObject );
+    void GetByType( MXIMPBase*& aObject, TInt32 aInterfaceId );
+
+
+
+public: // New methods
+
+    /**
+     * Set object ownership
+     * @param aObjectOwning. ETrue objects are owned by instance.
+     *                       EFalse objects are not owned by instance.
+     *                       Default = ETrue
+     */
+    IMPORT_C void SetObjectOwnership( TBool aObjectOwning = ETrue );
+
+private: // Helpers
+    static TInt OrderIfIdAndApiObject( const TInt32* aIfId, 
+                                       const CXIMPApiObjBase& aRhs );
+
+    static TInt OrderApiObjects( const CXIMPApiObjBase& aLhs, 
+                                 const CXIMPApiObjBase& aRhs );
+
+
+
+private: // data
+
+    /**
+     * Owning of objects. ETrue, Owns, EFalse does not own.
+     */
+    TBool iOwnObjects;
+
+    /**
+     * OWN: Check iOwnObjects
+     */
+    RXIMPObjOwningPtrArray< CXIMPApiObjBase > iApiObjects;
+    
+    };
+
+
+#endif // CXIMPRESTRICTEDOBJECTCOLLECTIONIMP_H
+
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/searchfeatureplugin/srcsearchprocessor/group/bld.inf	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,32 @@
+/*
+* 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:  Build information file for project Search Feature Plugin
+*
+*/
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+PRJ_MMPFILES
+searchprocessor.mmp
+searchprocessorhook.mmp
+
+
+PRJ_TESTMMPFILES
+
+PRJ_TESTEXPORTS
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/searchfeatureplugin/srcsearchprocessor/group/searchprocessor.mmp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,73 @@
+/*
+* 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:  Project definition file for search Feature Plugin processor 
+*
+*/
+
+#include <platform_paths.hrh>
+#include <data_caging_paths.hrh>
+#include "../../group/searchdlluids.hrh"
+
+
+TARGET                  searchprocessor.dll
+TARGETTYPE              dll
+UID                     XIMP_SEARCH_DLL_UID_STATIC_INTERFACE XIMP_DLL_UID_SEARCH_PROCESSOR    
+
+CAPABILITY              CAP_GENERAL_DLL
+VENDORID                VID_DEFAULT
+
+VERSION      10.0
+
+SOURCEPATH              ../../srcsearchprocessor
+SOURCE                  protocoldatahostimp.cpp
+SOURCE				   protocolsearchdatahostimp.cpp
+
+SOURCEPATH              ../searchdatahost
+SOURCE                  protocolsearchfeaturedatahostimp.cpp
+
+SOURCEPATH              ../../srcutils
+SOURCE                   searchlogutils.cpp
+
+
+
+USERINCLUDE             ../../group
+USERINCLUDE             ../../srcsearchprocessor
+USERINCLUDE             ../../srcsearchoperations
+USERINCLUDE             ../../srcsearchdatamodel
+USERINCLUDE             ../../srcutils
+USERINCLUDE             ../searchdatahost
+
+
+MW_LAYER_SYSTEMINCLUDE
+
+
+LIBRARY                 euser.lib
+LIBRARY                 ecom.lib
+LIBRARY                 estor.lib
+LIBRARY                 centralrepository.lib
+LIBRARY                 bafl.lib
+LIBRARY                 ximputils.lib
+LIBRARY                 ximpdatamodel.lib
+LIBRARY                 searchdatamodel.lib
+LIBRARY					flogger.lib
+
+//EXPORTUNFROZEN
+
+#if defined( ARMCC )
+DEFFILE ../../eabi/ 
+#elif defined ( WINSCW )
+deffile ../../bwins/ 
+#endif
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/searchfeatureplugin/srcsearchprocessor/group/searchprocessorhook.mmp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,61 @@
+/*
+* 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:  Project definition file for search Feature Plugin processor hook
+*
+*/
+
+
+#include <platform_paths.hrh>
+#include <data_caging_paths.hrh>
+#include "../../group/searchdlluids.hrh"
+
+
+TARGET                  searchprocessorhook.dll
+CAPABILITY              CAP_ECOM_PLUGIN
+TARGETTYPE              PLUGIN
+UID                     XIMP_SEARCH_DLL_UID_ECOM_PLUGIN XIMP_DLL_UID_SEARCH_PROCESSOR_HOOK                 
+VENDORID                VID_DEFAULT
+
+VERSION      10.0
+
+SOURCEPATH              ../searchprocessorhook
+START RESOURCE          searchprocessorhook.rss
+TARGET                  searchprocessorhook.rsc
+END
+
+
+SOURCEPATH              ../searchprocessorhook
+SOURCE                  searchprocessorhook.cpp
+
+
+USERINCLUDE             ../../group
+USERINCLUDE             ../searchprocessorhook
+USERINCLUDE             ../../srcsearchdatamodel
+USERINCLUDE             ../../srcsearchprocessor
+
+
+
+MW_LAYER_SYSTEMINCLUDE
+
+
+LIBRARY                 euser.lib
+LIBRARY                 searchprocessor.lib
+LIBRARY                 ecom.lib
+
+
+#if defined( ARMCC )
+DEFFILE ../../eabi/ 
+#elif defined ( WINSCW )
+deffile ../../bwins/ 
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/searchfeatureplugin/srcsearchprocessor/protocoldatahostimp.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,152 @@
+/*
+* 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 of protocol data host
+ *
+*/
+
+
+
+#include <ximpprotocolconnection.h>
+#include <protocolsearchfeature.h>
+#include <searchobjectfactory.h>
+#include <ximpoperationbase.h>
+
+#include "ximpapiobjbase.h"
+#include "searchapiobjbase.h"
+#include "searchobjectfactoryimp.h"
+
+#include "protocoldatahostimp.h"
+#include "protocolsearchdatahostimp.h"
+#include "protocolsearchfeaturedatahostimp.h"
+#include "searchlogutils.h"
+
+#include "searchoperationdefs.h"
+
+// ======== MEMBER FUNCTIONS ========
+
+
+// This should be variated. Branding variation can be one
+// possibility. One is to leave adaptation deside how soon
+// cleanup will be done.
+// Now 5 sec used for testing purposes. Better value could be
+// some minutes.
+
+// ---------------------------------------------------------------------------
+// CProtocolDataHostImp::CProtocolDataHostImp()
+// ---------------------------------------------------------------------------
+//
+CProtocolDataHostImp::CProtocolDataHostImp( MXIMPHost& aHost )
+:iHost( aHost )
+    {
+    XSearchLogger::Log(_L("CProtocolDataHostImp::CProtocolDataHostImp Started"));
+    XSearchLogger::Log(_L("CProtocolDataHostImp::CProtocolDataHostImp Completed"));
+    }
+
+
+// ---------------------------------------------------------------------------
+// CProtocolDataHostImp::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void CProtocolDataHostImp::ConstructL()
+    {
+    XSearchLogger::Log(_L("CProtocolDataHostImp::ConstructL Started"));
+    iSearchDataHost = CProtocolSearchDataHostImp::NewL(iHost) ;
+    XSearchLogger::Log(_L("CProtocolDataHostImp::ConstructL Completed"));
+    }
+
+
+// ---------------------------------------------------------------------------
+// CProtocolDataHostImp::NewLC()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CProtocolDataHostImp* CProtocolDataHostImp::NewLC( MXIMPHost& aHost )
+    {
+    XSearchLogger::Log(_L("CProtocolDataHostImp::NewLC Started"));
+    CProtocolDataHostImp* self = new( ELeave ) CProtocolDataHostImp( aHost );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    XSearchLogger::Log(_L("CProtocolDataHostImp::NewLC Completed"));
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CProtocolDataHostImp::NewL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CProtocolDataHostImp* CProtocolDataHostImp::NewL( MXIMPHost& aHost )
+    {
+    XSearchLogger::Log(_L("CProtocolDataHostImp::NewL Started"));
+    CProtocolDataHostImp* self = new( ELeave ) CProtocolDataHostImp( aHost );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    XSearchLogger::Log(_L("CProtocolDataHostImp::NewL Completed"));
+    return self;
+    }
+// ---------------------------------------------------------------------------
+// CProtocolDataHostImp::~CProtocolDataHostImp()
+// ---------------------------------------------------------------------------
+//
+CProtocolDataHostImp::~CProtocolDataHostImp()
+    {
+    XSearchLogger::Log(_L("CProtocolDataHostImp::~CProtocolDataHostImp Started"));
+    delete iSearchDataHost ;
+    XSearchLogger::Log(_L("CProtocolDataHostImp::~CProtocolDataHostImp Completed"));
+    }
+
+// ---------------------------------------------------------------------------
+// CProtocolDataHostImp::SetHostToProtocol()
+// ---------------------------------------------------------------------------
+//
+void CProtocolDataHostImp::SetHostToProtocol()
+	{
+	MProtocolSearchFeature* searchProtocolFeature = static_cast< MProtocolSearchFeature*> 
+							(iHost.GetConnection().GetProtocolInterface(MProtocolSearchFeature::KInterfaceId) );
+	
+	if(searchProtocolFeature )
+		{
+		searchProtocolFeature->SetHost(*iSearchDataHost);	
+		}
+	
+	}
+
+// ---------------------------------------------------------------------------
+// CProtocolDataHostImp::GetInterface()
+// ---------------------------------------------------------------------------
+//
+TAny* CProtocolDataHostImp::GetInterface(TInt aInterfaceId)
+	{
+	if(aInterfaceId == MProtocolSearchDataHost::KInterfaceId )
+		{
+		return iSearchDataHost ;	
+		}
+	
+	else
+		{
+		return NULL ;	
+		}
+		
+	}
+
+// ---------------------------------------------------------------------------
+// CProtocolDataHostImp::GetCleanupOperation()
+// ---------------------------------------------------------------------------
+//
+TInt CProtocolDataHostImp::GetCleanupOperation() 
+	{
+	return NSearchOps::ESearchCleaner ; // return cleaner operation : 
+	                                    // BUT NO CLEANING IS IMPLEMENTED IN SERACH PLUGIN ( NOT REQUIRED)
+	}
+// End of file
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/searchfeatureplugin/srcsearchprocessor/protocoldatahostimp.h	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  protcol datahost imp header
+ *
+*/
+
+#ifndef CPROTOCOLDATAHOSTIMP_H
+#define CPROTOCOLDATAHOSTIMP_H
+
+#include <e32base.h>
+#include <ximpbase.h>
+#include <protocoldatahost.h>
+#include "searchapiobjbase.h"
+#include "ximpapiobjbase.h"
+
+#include "ximphost.h"
+
+class MXIMPHost;
+class MImObjectFactory;
+class CImObjectFactoryImp;
+
+class CXIMPPscContext;
+class MImDataCache;
+class CImDataCache;
+class CXIMPContextStateEventImp;
+class CPeriodic;
+class MXIMPProtocolConnection;
+class CProtocolImConversationDataHostImp;
+class CXIMPOperationBase ;
+
+class CProtocolSearchDataHostImp ;
+
+/**
+ * protocol data host for serach
+ *
+ * @lib searchprocessor.dll
+ */
+
+NONSHARABLE_CLASS(CProtocolDataHostImp): public MProtocolDataHost
+    {
+    
+	public:
+	    /** The class ID. */
+	    enum { KClassId = IMP_CLSID_CPROTOCOLSEARCHDATAHOSTIMP };
+
+	public:
+        /**
+    	 * Construction :NewL
+     	 */
+	    IMPORT_C static CProtocolDataHostImp* NewL( MXIMPHost& aHost );
+	    
+		/**
+    	 * Construction :NewL
+     	 */
+	    IMPORT_C static CProtocolDataHostImp* NewLC( MXIMPHost& aHost );
+	    
+	    /**
+         * Destructor
+         */
+	    virtual ~CProtocolDataHostImp();
+
+	private:
+        /**
+	     * constructor
+	     */
+	    CProtocolDataHostImp( MXIMPHost& aHost );
+	    
+	    /**
+	     * 2nd phase constructor
+	     */
+	    void ConstructL();
+
+	public: // MProtocolDataHost 
+	    /**
+	     * 
+	     * @see MProtocolDataHost 
+	     */
+	    void SetHostToProtocol() ; 
+	    /**
+	     * 
+	     * @see MProtocolDataHost 
+	     */
+	    TAny* GetInterface(TInt aInterfaceId) ;
+	    /**
+	     * 
+	     * @see MProtocolDataHost 
+	     */
+	    
+	    TInt GetCleanupOperation() ;
+
+
+	private: 
+		/**
+	     * Access to host. Not owned
+	     */
+	    MXIMPHost& iHost;
+	    /**
+	     * CProtocolSearchDataHostImp : owned
+	     */
+	    CProtocolSearchDataHostImp *iSearchDataHost ;
+
+    };
+
+
+#endif // CPROTOCOLDATAHOSTIMP_H
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/searchfeatureplugin/srcsearchprocessor/protocolsearchdatahostimp.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,150 @@
+/*
+* 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:  searchdata host 
+ *
+*/
+
+
+
+#include <ximpprotocolconnection.h>
+#include <protocolimfeatures.h>
+#include <searchobjectfactory.h>
+#include <protocolsearchfeaturedatahost.h>
+#include "ximpapiobjbase.h"
+#include "searchapiobjbase.h"
+#include "searchobjectfactoryimp.h"
+#include "searchdatacacheimp.h"
+#include "protocolsearchdatahostimp.h"
+#include "protocolsearchfeaturedatahostimp.h"
+
+#include "searchlogutils.h"
+
+
+
+
+// ======== MEMBER FUNCTIONS ========
+
+
+// This should be variated. Branding variation can be one
+// possibility. One is to leave adaptation deside how soon
+// cleanup will be done.
+// Now 5 sec used for testing purposes. Better value could be
+// some minutes.
+
+// ---------------------------------------------------------------------------
+// CProtocolSearchDataHostImp::CProtocolSearchDataHostImp()
+// ---------------------------------------------------------------------------
+//
+CProtocolSearchDataHostImp::CProtocolSearchDataHostImp( MXIMPHost& aHost )
+:iHost( aHost )
+    {
+    XSearchLogger::Log(_L("CProtocolSearchDataHostImp::CProtocolSearchDataHostImp Started"));
+    XSearchLogger::Log(_L("CProtocolSearchDataHostImp::CProtocolSearchDataHostImp Completed"));
+    }
+
+
+// ---------------------------------------------------------------------------
+// CProtocolSearchDataHostImp::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void CProtocolSearchDataHostImp::ConstructL()
+    {
+    XSearchLogger::Log(_L("CProtocolSearchDataHostImp::ConstructL Started"));
+    
+    iSearchObjFactory= CSearchObjectFactoryImp::NewL();
+    iSrchFeatureDataHost=CProtocolSearchFeatureDataHostImp::NewL(iHost);
+    iSearchDataCache= CSearchDataCache::NewL(iHost);
+    
+    XSearchLogger::Log(_L("CProtocolSearchDataHostImp::ConstructL Completed"));
+    }
+
+
+// ---------------------------------------------------------------------------
+// CProtocolSearchDataHostImp::NewLC()
+// ---------------------------------------------------------------------------
+//
+CProtocolSearchDataHostImp* CProtocolSearchDataHostImp::NewLC( MXIMPHost& aHost )
+    {
+    XSearchLogger::Log(_L("CProtocolSearchDataHostImp::NewLC Started"));
+    CProtocolSearchDataHostImp* self = new( ELeave ) CProtocolSearchDataHostImp( aHost );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    XSearchLogger::Log(_L("CProtocolSearchDataHostImp::NewLC Completed"));
+    return self;
+    
+    }
+
+// ---------------------------------------------------------------------------
+// CProtocolSearchDataHostImp::NewL()
+// ---------------------------------------------------------------------------
+//
+CProtocolSearchDataHostImp* CProtocolSearchDataHostImp::NewL( MXIMPHost& aHost )
+    {
+    XSearchLogger::Log(_L("CProtocolSearchDataHostImp::NewL Started"));
+    CProtocolSearchDataHostImp* self = new( ELeave ) CProtocolSearchDataHostImp( aHost );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    XSearchLogger::Log(_L("CProtocolSearchDataHostImp::NewL Completed"));
+    return self;
+    
+    }
+// ---------------------------------------------------------------------------
+// CProtocolSearchDataHostImp::~CProtocolSearchDataHostImp()
+// ---------------------------------------------------------------------------
+//
+CProtocolSearchDataHostImp::~CProtocolSearchDataHostImp()
+    {
+    XSearchLogger::Log(_L("CProtocolSearchDataHostImp::~CProtocolSearchDataHostImp Started"));
+    delete iSearchDataCache;
+    delete iSrchFeatureDataHost; 
+    delete iSearchObjFactory;
+    XSearchLogger::Log(_L("CProtocolSearchDataHostImp::~CProtocolSearchDataHostImp Completed"));
+    }
+
+
+// ---------------------------------------------------------------------------
+// CProtocolSearchDataHostImp::ImObjectFactory()
+// ---------------------------------------------------------------------------
+//
+MSearchObjectFactory&  CProtocolSearchDataHostImp::SearchObjectFactory()
+    {
+    XSearchLogger::Log(_L("CProtocolSearchDataHostImp::SearchObjectFactory Started"));
+    return *iSearchObjFactory;
+    }
+
+
+
+
+// ---------------------------------------------------------------------------
+// CProtocolSearchDataHostImp::ConversationDataAccess()
+// ---------------------------------------------------------------------------
+//
+MProtocolSearchFeatureDataHost& CProtocolSearchDataHostImp::SearchFeatureDataAccess()
+    {
+    return *iSrchFeatureDataHost;
+    }
+// ---------------------------------------------------------------------------
+// CProtocolSearchDataHostImp::ConversationDataAccess()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C  CSearchDataCache& CProtocolSearchDataHostImp::SearchDataCache()
+	{
+	return *iSearchDataCache;	
+	}
+
+
+    
+// End of file
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/searchfeatureplugin/srcsearchprocessor/protocolsearchdatahostimp.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,132 @@
+/*
+* 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:  searchdata host header
+ *
+*/
+
+#ifndef CPROTOCOLSEARCHDATAHOSTIMP_H
+#define CPROTOCOLSEARCHDATAHOSTIMP_H
+
+#include <e32base.h>
+#include <ximpprotocolconnectionhost.h>
+#include <ximpcontext.h>
+#include <ximpbase.h>
+#include <protocolsearchdatahost.h>
+
+#include "searchapiobjbase.h"
+#include "ximpapiobjbase.h"
+#include "ximphost.h"
+
+
+class MXIMPHost;
+class MSearchObjectFactory;
+class CSearchObjectFactoryImp;
+
+class CXIMPPscContext;
+class MSearchDataCache;
+class CSearchDataCache;
+class CXIMPContextStateEventImp;
+class CPeriodic;
+class MXIMPProtocolConnection;
+
+class CProtocolSearchFeatureDataHostImp;
+
+class MProtocolSearchFeatureDataHost;
+
+
+
+	/**
+	 * SearchData  host.
+	 *
+	 * @lib searchprocessor.dll
+	 */
+
+NONSHARABLE_CLASS(CProtocolSearchDataHostImp)  : public MProtocolSearchDataHost
+    	{
+		public:
+		    /** The class ID. */
+		    enum { KClassId = IMP_CLSID_CPROTOCOLSEARCHDATAHOSTIMP };
+		
+		public:
+		
+	    	/**
+	    	 * Construction :NewL
+	     	 */
+		    static CProtocolSearchDataHostImp* NewL( MXIMPHost& aHost );
+		    
+		    /**
+	    	 * Construction :NewL
+	     	 */
+		    static CProtocolSearchDataHostImp* NewLC( MXIMPHost& aHost );
+		    
+	       /**
+	         * Destructor
+	         */
+		    virtual ~CProtocolSearchDataHostImp();
+		
+		private:
+		    /**
+		     * constructor
+		     */
+		    CProtocolSearchDataHostImp( MXIMPHost& aHost );
+		    
+		    /**
+		     * 2nd phase constructor
+		     */
+		    void ConstructL();
+	
+		public: // MProtocolSearchDataHost
+		   /**
+		     * 
+		     * @see MProtocolSearchDataHost
+		     */
+		   MSearchObjectFactory& SearchObjectFactory();
+		   
+		   /**
+		     * 
+		     * @see MProtocolSearchDataHost
+		     */
+		   MProtocolSearchFeatureDataHost& SearchFeatureDataAccess() ;
+		   
+		   /**
+		     * returns the  searchdatacache
+		     *
+		     * @return  reference to CSearchDataCache : ownershipr not transfered
+		     */
+		   IMPORT_C CSearchDataCache& SearchDataCache();
+		
+		private: // data
+			/**
+		     * Access to host. Not owned
+		     */
+		    MXIMPHost& iHost;
+		    
+			/**
+		     * CProtocolSearchFeatureDataHostImp : owned
+		     */
+		  CSearchObjectFactoryImp* iSearchObjFactory;
+		  	/**
+		     * CProtocolSearchFeatureDataHostImp : owned
+		     */
+		  CProtocolSearchFeatureDataHostImp* iSrchFeatureDataHost;
+		  	/**
+		     * CProtocolSearchFeatureDataHostImp : owned
+		     */
+		  CSearchDataCache* iSearchDataCache;
+
+    	};
+
+
+#endif // CCPROTOCOLSEARCHDATAHOSTIMP_H
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/searchfeatureplugin/srcsearchprocessor/searchdatahost/protocolsearchfeaturedatahostimp.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,110 @@
+/*
+* 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:  Searchdatafeature  datahost.
+*
+*/
+
+
+#include <ximpobjectcollection.h>
+#include <ximpidentity.h>
+#include <ximpdatasubscriptionstate.h>
+#include <ximpstatus.h>
+
+#include "ximphost.h"
+#include "searchdatacacheimp.h"
+#include "searchoperationdefs.h"
+#include "searchlogutils.h"
+#include "protocolsearchdatahostimp.h"
+#include "protocolsearchfeaturedatahostimp.h"
+
+
+
+// ============================ MEMBER FUNCTIONS ============================= 
+
+
+// ---------------------------------------------------------------------------
+// CProtocolSearchFeatureDataHostImp::CProtocolSearchFeatureDataHostImp()
+// ---------------------------------------------------------------------------
+//
+CProtocolSearchFeatureDataHostImp::CProtocolSearchFeatureDataHostImp( MXIMPHost& aHost )
+:iHost( aHost )
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// CProtocolSearchFeatureDataHostImp::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void CProtocolSearchFeatureDataHostImp::ConstructL()
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// CProtocolSearchFeatureDataHostImp::NewL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CProtocolSearchFeatureDataHostImp* CProtocolSearchFeatureDataHostImp::NewL( MXIMPHost& aHost )
+    {
+    CProtocolSearchFeatureDataHostImp* self = new( ELeave ) CProtocolSearchFeatureDataHostImp( aHost );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// Implement supported interface access.
+// ---------------------------------------------------------------------------
+//
+XIMPIMP_IF_BASE_GET_INTERFACE_BEGIN( CProtocolSearchFeatureDataHostImp,
+                                     MProtocolSearchFeatureDataHost )
+XIMPIMP_IF_BASE_GET_INTERFACE_END()
+
+
+XIMPIMP_IF_BASE_GET_CONST_INTERFACE_BEGIN( CProtocolSearchFeatureDataHostImp,
+                                           MProtocolSearchFeatureDataHost )
+XIMPIMP_IF_BASE_GET_INTERFACE_END()
+
+// ---------------------------------------------------------------------------
+// CProtocolSearchFeatureDataHostImp::~CProtocolSearchFeatureDataHostImp()
+// ---------------------------------------------------------------------------
+//
+CProtocolSearchFeatureDataHostImp::~CProtocolSearchFeatureDataHostImp()
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// CProtocolSearchFeatureDataHostImp::HandleSearchResultsL
+// ---------------------------------------------------------------------------
+//     
+TXIMPRequestId CProtocolSearchFeatureDataHostImp::HandleSearchResultsL(MXIMPIdentity* aSearchId,
+    										    					MXIMPObjectCollection* aSearchResults)
+	{
+    XSearchLogger::Log(_L("CProtocolSearchFeatureDataHostImp::HandleSearchResultsL Started"));
+    return iHost.AddNewOperationL( NSearchOps::EHandleSearchResults,aSearchId,aSearchResults);
+	
+	}
+// ---------------------------------------------------------------------------
+// CProtocolSearchFeatureDataHostImp::HandleSearchKeysL
+// ---------------------------------------------------------------------------
+//
+TXIMPRequestId CProtocolSearchFeatureDataHostImp::HandleSearchKeysL( MXIMPObjectCollection* aSearchKeyInfos )
+    {
+    XSearchLogger::Log(_L("CProtocolSearchFeatureDataHostImp::HandleSearchKeysL  Started"));
+    return iHost.AddNewOperationL( NSearchOps::EHandleSearchKeys, aSearchKeyInfos  );
+    
+    }	
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/searchfeatureplugin/srcsearchprocessor/searchdatahost/protocolsearchfeaturedatahostimp.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,103 @@
+/*
+* 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:   Searchdatafeature  datahost.
+*
+*/
+
+#ifndef CPROTOCOLSEARCHFEATUREDATAHOSTIMP_H
+#define CPROTOCOLSEARCHFEATUREDATAHOSTIMP_H
+
+#include <protocolsearchfeaturedatahost.h>
+
+#include "ximpapiobjbase.h"
+#include "searchapiobjbase.h"
+#include "searchtypehelpers.h"
+
+class MXIMPHost;
+class MXIMPObjectCollection;
+
+
+/**
+ * Implementation for managing cached Invitation information
+ *
+ * @lib searchprocessor.dll
+ */
+class CProtocolSearchFeatureDataHostImp : public CXIMPApiObjBase,
+                                          public MProtocolSearchFeatureDataHost
+    {
+	public: // Definitions
+
+	    /** The class ID. */
+	    enum { KClassId = IMP_CLSID_CPROTOCOLSEARCHFEATUREDATAHOST };
+
+	public: // Construction and destruction
+
+	    /**
+	     * Construction :NewL
+	     */
+	    IMPORT_C static CProtocolSearchFeatureDataHostImp* NewL( MXIMPHost& aHost );
+
+	    /**
+	     * Destruction
+	     */
+	    virtual ~CProtocolSearchFeatureDataHostImp();
+
+	private:
+	 	/**
+	     * constructor
+	     */
+	    CProtocolSearchFeatureDataHostImp( MXIMPHost& aHost );
+	    /**
+	     * 2nd phase constructor
+	     */
+	    void ConstructL();
+	    
+
+	public: // From MXIMPBase
+
+	    /**
+	     * Implementation of MXIMPBase interface methods
+	     * @see MXIMPBase
+	     */
+	    XIMPIMP_DECLARE_IF_BASE_METHODS
+	    
+
+	public: //From MProtocolSearchFeatureDataHost
+		/**
+	     * 
+	     * @see MProtocolSearchFeatureDataHost
+	     */
+
+	  	TXIMPRequestId HandleSearchResultsL( MXIMPIdentity* aSearchId,
+	    								     MXIMPObjectCollection* aSearchResults );
+		
+	  	/**
+         * 
+         * @see MProtocolSearchFeatureDataHost
+         */
+	  	TXIMPRequestId HandleSearchKeysL( MXIMPObjectCollection* aSearchKeyInfos  ) ;   											    
+	 
+	private: // Data
+
+	    /**
+	     * Access to host. Not owned
+	     */
+	    MXIMPHost& iHost;
+    };
+
+
+
+
+#endif // CPROTOCOLSEARCHFEATUREDATAHOSTIMP_H
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/searchfeatureplugin/srcsearchprocessor/searchprocessorhook/searchprocessorhook.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,45 @@
+/*
+* 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:  XIMP Framework's Search  Processor Hook implementation.
+*
+*/
+
+
+#include <searchdlluids.hrh>
+#include <ecom/implementationproxy.h>
+#include <e32base.h>
+#include "protocoldatahostimp.h"
+
+// ---------------------------------------------------------------------------
+// Key value pair table to identify correct constructor
+// function for the requested interface.
+// ---------------------------------------------------------------------------
+//
+const TImplementationProxy ImplementationTable[] =
+    {
+    IMPLEMENTATION_PROXY_ENTRY( XIMP_ECOM_IMPL_UID_SEARCH_PROCESSOR_INTERFACE,
+                                CProtocolDataHostImp::NewL)
+    };
+
+
+// ---------------------------------------------------------------------------
+// Exported function to return the implementation proxy table
+// ---------------------------------------------------------------------------
+//
+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/imservices/searchfeatureplugin/srcsearchprocessor/searchprocessorhook/searchprocessorhook.rss	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,53 @@
+/*
+* 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:  ECom registery info for ECom hook
+*
+*/
+
+
+#include <ecom/registryinfov2.rh>
+#include <searchdlluids.hrh>
+#include <searchmanagementifids.hrh>
+#include <ximpfeaturepluginifids.hrh>
+
+
+// ---------------------------------------------------------------------------
+// ECom registery info for Search processor ECom hook
+// ---------------------------------------------------------------------------
+//
+RESOURCE REGISTRY_INFO theInfo
+    {
+    resource_format_version = RESOURCE_FORMAT_VERSION_2;
+    dll_uid = XIMP_DLL_UID_SEARCH_PROCESSOR_HOOK;
+
+    interfaces =
+        {
+        INTERFACE_INFO
+            {
+            interface_uid = XIMP_ECOM_IF_UID_PROTOCOL_DATA_HOST_INTERFACE;
+            implementations =
+                {
+                IMPLEMENTATION_INFO
+                    {
+                    implementation_uid = XIMP_ECOM_IMPL_UID_SEARCH_PROCESSOR_INTERFACE;
+                    version_no         = 1;
+                    display_name       = "S60 Default XIMP";
+                    default_data       = "";
+                    opaque_data        = "";
+                    }
+                };
+            }
+        };
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/searchfeatureplugin/srcutils/searchlogutils.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,40 @@
+/*
+* 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:Implementation for XSearchLogger
+*
+*/
+
+
+
+// INCLUDE FILES
+#include "searchlogutils.h"
+
+// CONSTANTS
+const TInt KLogBufferLength = 256;
+_LIT(KImLogDir, "searchplugin");
+_LIT(KImLogFile, "search.txt");
+
+void XSearchLogger::Log(TRefByValue<const TDesC> aFmt,...)
+    {
+#ifdef _DEBUG
+    VA_LIST list;
+    VA_START(list, aFmt);
+    // Print to log file
+    TBuf<KLogBufferLength> buf;
+    buf.FormatList(aFmt, list);
+    RFileLogger::Write(KImLogDir, KImLogFile, EFileLoggingModeAppend, buf);
+#endif
+    }
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/searchfeatureplugin/srcutils/searchlogutils.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,49 @@
+/*
+* 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:  Log util header
+*
+*/
+
+
+
+#ifndef SEARCHLOGUTILS_H
+#define SEARCHLOGUTILS_H
+
+//  INCLUDES
+#include <e32std.h>
+#include <flogger.h>
+
+
+/**
+*  Debug log writer
+*  
+*  
+*/
+class XSearchLogger
+    {
+    public: // New functions
+        
+        /**
+        * Writes log to log file
+        * @param 
+        * @return 
+        */
+	    static void Log(TRefByValue<const TDesC> aFmt,...);
+
+
+    };
+
+#endif      // SEARCHLOGUTILS_H
+           
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/xmppsettingsapi/bwins/xmppsettingsapiu.def	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,15 @@
+EXPORTS
+	??1CXmppSettingsApi@@UAE@XZ @ 1 NONAME ; CXmppSettingsApi::~CXmppSettingsApi(void)
+	?CreateSettingsRecordL@CXmppSettingsApi@@QAEXAAK@Z @ 2 NONAME ; void CXmppSettingsApi::CreateSettingsRecordL(unsigned long &)
+	?DefaultSettingsRecordL@CXmppSettingsApi@@QAEXAAK@Z @ 3 NONAME ; void CXmppSettingsApi::DefaultSettingsRecordL(unsigned long &)
+	?GetParamL@CXmppSettingsApi@@QAEXKABVTDesC16@@AAH@Z @ 4 NONAME ; void CXmppSettingsApi::GetParamL(unsigned long, class TDesC16 const &, int &)
+	?GetParamL@CXmppSettingsApi@@QAEXKABVTDesC16@@AAVTDes16@@@Z @ 5 NONAME ; void CXmppSettingsApi::GetParamL(unsigned long, class TDesC16 const &, class TDes16 &)
+	?GetRepositoryKeyL@CXmppSettingsApi@@QAEXKABVTDesC16@@HAAK@Z @ 6 NONAME ; void CXmppSettingsApi::GetRepositoryKeyL(unsigned long, class TDesC16 const &, int, unsigned long &)
+	?GetSettingsRecordIdArrayL@CXmppSettingsApi@@QAEXAAV?$RArray@K@@@Z @ 7 NONAME ; void CXmppSettingsApi::GetSettingsRecordIdArrayL(class RArray<unsigned long> &)
+	?NewL@CXmppSettingsApi@@SAPAV1@XZ @ 8 NONAME ; class CXmppSettingsApi * CXmppSettingsApi::NewL(void)
+	?NewLC@CXmppSettingsApi@@SAPAV1@XZ @ 9 NONAME ; class CXmppSettingsApi * CXmppSettingsApi::NewLC(void)
+	?RemoveParamL@CXmppSettingsApi@@QAEXKABVTDesC16@@@Z @ 10 NONAME ; void CXmppSettingsApi::RemoveParamL(unsigned long, class TDesC16 const &)
+	?RemoveSettingsRecordL@CXmppSettingsApi@@QAEXK@Z @ 11 NONAME ; void CXmppSettingsApi::RemoveSettingsRecordL(unsigned long)
+	?SetParamL@CXmppSettingsApi@@QAEXKABVTDesC16@@0@Z @ 12 NONAME ; void CXmppSettingsApi::SetParamL(unsigned long, class TDesC16 const &, class TDesC16 const &)
+	?SetParamL@CXmppSettingsApi@@QAEXKABVTDesC16@@H@Z @ 13 NONAME ; void CXmppSettingsApi::SetParamL(unsigned long, class TDesC16 const &, int)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/xmppsettingsapi/eabi/xmppsettingsapiu.def	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,23 @@
+EXPORTS
+	_ZN16CXmppSettingsApi12RemoveParamLEmRK7TDesC16 @ 1 NONAME
+	_ZN16CXmppSettingsApi17GetRepositoryKeyLEmRK7TDesC16iRm @ 2 NONAME
+	_ZN16CXmppSettingsApi21CreateSettingsRecordLERm @ 3 NONAME
+	_ZN16CXmppSettingsApi21RemoveSettingsRecordLEm @ 4 NONAME
+	_ZN16CXmppSettingsApi22DefaultSettingsRecordLERm @ 5 NONAME
+	_ZN16CXmppSettingsApi25GetSettingsRecordIdArrayLER6RArrayImE @ 6 NONAME
+	_ZN16CXmppSettingsApi4NewLEv @ 7 NONAME
+	_ZN16CXmppSettingsApi5NewLCEv @ 8 NONAME
+	_ZN16CXmppSettingsApi9GetParamLEmRK7TDesC16R6TDes16 @ 9 NONAME
+	_ZN16CXmppSettingsApi9GetParamLEmRK7TDesC16Ri @ 10 NONAME
+	_ZN16CXmppSettingsApi9SetParamLEmRK7TDesC16S2_ @ 11 NONAME
+	_ZN16CXmppSettingsApi9SetParamLEmRK7TDesC16i @ 12 NONAME
+	_ZN16CXmppSettingsApiD0Ev @ 13 NONAME
+	_ZN16CXmppSettingsApiD1Ev @ 14 NONAME
+	_ZN16CXmppSettingsApiD2Ev @ 15 NONAME
+	_ZTI16CXmppSettingsApi @ 16 NONAME ; #<TI>#
+	_ZTI19CXmppSettingsColumn @ 17 NONAME ; #<TI>#
+	_ZTI19CXmppSettingsRecord @ 18 NONAME ; #<TI>#
+	_ZTV16CXmppSettingsApi @ 19 NONAME ; #<VT>#
+	_ZTV19CXmppSettingsColumn @ 20 NONAME ; #<VT>#
+	_ZTV19CXmppSettingsRecord @ 21 NONAME ; #<VT>#
+
Binary file imservices/xmppsettingsapi/group/1020E334.txt has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/xmppsettingsapi/group/bld.inf	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  bld.inf file for project XMPP Settings API
+*
+*/
+
+
+#include <platform_paths.hrh>
+//
+// Platforms
+//
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+#ifdef FF_MECO_XMPP
+../rom/xmppsettingsapi.iby						 CORE_MW_LAYER_IBY_EXPORT_PATH(xmppsettingsapi.iby)
+1020E334.txt                					 /epoc32/data/z/private/10202be9/1020E334.txt				//temporary
+1020E334.txt                					 /epoc32/release/winscw/udeb/z/private/10202be9/1020E334.txt	//temporary
+
+1020E334.txt                					 /epoc32/release/winscw/urel/z/private/10202be9/1020E334.txt	//temporary
+#endif
+
+PRJ_MMPFILES
+xmppsettingsapi.mmp
+//#include "../internal/testui/group/bld.inf"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/xmppsettingsapi/group/xmppsettingsapi.mmp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,44 @@
+/*
+* 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:  Project definition file for project XMPP Settings API
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+TARGET                  jabbersettings.dll
+TARGETTYPE              DLL
+UID                     0x1000008d 0x200100BB
+
+CAPABILITY      		CAP_ECOM_PLUGIN
+
+VENDORID                VID_DEFAULT
+
+VERSION      10.0
+
+SOURCEPATH              ../src
+SOURCE                  xmppsettingsapi.cpp
+SOURCE                  xmppsettingscolumn.cpp
+SOURCE                  xmppsettingsrecord.cpp
+
+USERINCLUDE             ../inc
+
+MW_LAYER_SYSTEMINCLUDE
+
+LIBRARY                 euser.lib
+LIBRARY                 centralrepository.lib
+DEBUGLIBRARY            flogger.lib
+
+DEFFILE                 xmppsettingsapi.def
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/xmppsettingsapi/inc/xmppsettingscolumn.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,106 @@
+/*
+* 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:  This class handles columns.
+*
+*/
+
+
+
+
+#ifndef C_XMPPSETTINGSCOLUMN_H
+#define C_XMPPSETTINGSCOLUMN_H
+
+#include <e32base.h>
+
+class CRepository;
+
+/**
+ *  This class handles columns.
+ *
+ *  This class contains all methods needed to read and write columns table.
+ *
+ *
+ *  @lib jabbersettings.lib
+ *  @since S60 5.0
+ */
+class CXmppSettingsColumn: public CBase
+    {
+
+public:
+	
+		/**
+     * Two-phased constructor.         
+     * @return Instance of this class
+     */ 
+    static CXmppSettingsColumn* NewL( CRepository& aRepository );
+
+    static CXmppSettingsColumn* NewLC( CRepository& aRepository );
+
+	  /**
+	   * Destructor
+	   */
+    virtual ~CXmppSettingsColumn();
+
+    /**
+     * This method checks that does this column exist. If it does not, it
+     * creates it (if requested. Otherwise it leaves.
+     *
+     * @since S60 5.0
+     * @param aAttrName Column name.
+     * @param aCreateColumnIfNotExist Should new column be created if it is
+     *                         not found.
+     * @param aColKey onn return contains the key of the column.
+     */
+    void GetColumnKeyL( const TDesC& aAttrName,
+                        TBool aCreateColumnIfNotExist,
+                        TUint32& aColKey );
+
+    /**
+     * Tries to find columns key by it is name (value).
+     *
+     * @since S60 5.0
+     * @param aColumnName Name of the column.
+     * @param aColumnKey on return contains the columns key.
+     */
+    void FindByNameL( const TDesC& aColumnName,
+                      TUint32& aColumnKey );
+
+private:
+		
+		/**
+		 * Default Contructor
+		 */
+    CXmppSettingsColumn( CRepository& aRepository );
+		
+    void ConstructL();
+
+    /**
+     * This method resolves next free key to be used as column key.
+     *
+     * @since S60 5.0
+     * @param aColKey On return contains next free column key.
+     */
+    void NextFreeSlotL( TUint32& aColKey );
+
+private: // data
+
+    /**
+     * Handle to the Central Repository. Doesnt Own.
+     */
+    CRepository& iRepository;
+
+    };
+
+
+#endif // C_XMPPSETTINGSCOLUMN_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/xmppsettingsapi/inc/xmppsettingsrecord.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,125 @@
+/*
+* 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:  This class is used for data table manipulations.
+*
+*/
+
+
+
+
+#ifndef C_XMPPSETTINGSRECORD_H
+#define C_XMPPSETTINGSRECORD_H
+
+#include <e32base.h>
+
+class CRepository;
+
+/**
+ *  This class is used for data table manipulations.
+ *
+ *  This class contains all methods needed to read and write to settings id
+ *  table.
+ *
+ *
+ *  @lib jabbersettings.lib
+ *  @since S60 5.0
+ */
+class CXmppSettingsRecord: public CBase
+    {
+
+public:
+		
+		/**
+     * Two-phased constructor.         
+     * @return Instance of this class
+     */
+    static CXmppSettingsRecord* NewL( CRepository& aRepository );
+
+    static CXmppSettingsRecord* NewLC( CRepository& aRepository );
+		
+		/**
+	   * Destructor
+	   */
+    virtual ~CXmppSettingsRecord();
+
+    /**
+     * This method checks does this setting id exist. Leaves with
+     * KErrNotFound if it does not.
+     *
+     * @since S60 5.0
+     * @param aSettingsRecordId Setting id.
+     * @param aSettingsRecordKey If setting id is found, this contains the setting
+     *                    key on return.
+     */
+    void FindSettingsRecordKeyL( TUint32 aSettingsRecordId,
+                                 TUint32& aSettingsRecordKey );
+
+    /**
+     * This method fids all setting keys.
+     *
+     * @since S60 5.0
+     * @@param aSettingsRecordKeys On return contains all setting keys.
+     */
+    void GetSettingsRecordkeysL( RArray<TUint32>& aResults );
+
+    /**
+     * This method creates unique setting id.
+     *
+     * @since S60 5.0
+     * @param aNewSettingId On return contains new setting id.
+     */
+    void CreateSettingsRecordIdL( TUint32& aNewSettingId );
+
+private:
+
+		/**
+		 * Default Contructor
+		 */
+    CXmppSettingsRecord( CRepository& aRepository );
+
+    void ConstructL();
+
+    /**
+     * This method returns next available slot for settings record. It can
+     * be new index or it can use deleted slot.
+     *
+     * @since S60 5.0
+     * @param aFreeKey On return contains the next free key.
+     */
+    void NextFreeSlotL( TUint32& aFreeKey );
+
+    /**
+     * This method fids all setting keys. It fills the internal array with
+     * unique ids.
+     *
+     * @since S60 5.0
+     */
+    void GetSettingsRecordkeysL();
+
+private: // Data
+
+    /**
+     * Handle to the Central Repository.
+     */
+    CRepository& iRepository;
+
+    /**
+     * Contains setting id keys.
+     */
+    RArray<TUint32> iSettingsRecordKeyArray;
+
+    };
+
+
+#endif // C_XMPPSETTINGSRECORD_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/xmppsettingsapi/rom/xmppsettingsapi.iby	Wed Nov 03 09:32:20 2010 +0530
@@ -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: iby file for XMPPSetting 
+*
+*/
+
+#ifndef __XMPPSETTINGSAPI_IBY__
+#define __XMPPSETTINGSAPI_IBY__
+
+//xmpp settings
+
+file=ABI_DIR\BUILD_DIR\jabbersettings.dll          			SHARED_LIB_DIR\jabbersettings.dll
+
+#endif
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/xmppsettingsapi/src/xmppsettingsapi.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,419 @@
+/*
+* 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:  This class handles dynamic name-value pair storing.
+*                Notice that "setting id"-is parameter used by users of this
+*                lib. The "Setting key" is used for Central Repository
+*                operations.
+*
+*/
+
+
+
+#include <centralrepository.h>
+
+//XMPP includes
+// #include "GFLOGger.h"
+#include "xmppservicesettingsapi.h"
+
+#include "xmppsettingsapicommon.h"
+#include "xmppsettingscolumn.h"
+#include "xmppsettingsrecord.h"
+
+const TUint32 KMaxDescLength = 255;
+
+// ======== MEMBER FUNCTIONS ========
+
+
+CXmppSettingsApi::CXmppSettingsApi()
+    {
+
+    }
+
+
+void CXmppSettingsApi::ConstructL()
+    {
+    iRepository = CRepository::NewL( KXmppSettingsApiCenRep );
+    iRecords = CXmppSettingsRecord::NewL( *iRepository );
+    iColumns = CXmppSettingsColumn::NewL( *iRepository );
+    }
+
+
+EXPORT_C CXmppSettingsApi* CXmppSettingsApi::NewL()
+    {
+    CXmppSettingsApi* self = CXmppSettingsApi::NewLC();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+
+EXPORT_C CXmppSettingsApi* CXmppSettingsApi::NewLC()
+    {
+    CXmppSettingsApi* self = new( ELeave ) CXmppSettingsApi;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+
+EXPORT_C CXmppSettingsApi::~CXmppSettingsApi()
+    {
+    delete iRepository;
+    delete iRecords;
+    delete iColumns;
+    }
+
+
+// ---------------------------------------------------------------------------
+// This method creates new setting record.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CXmppSettingsApi::CreateSettingsRecordL(
+    TUint32& aSettingsRecordId )
+    {
+   // GFLOG1("CXmppSettingsApi::CreateSettingsRecordL - IN");
+
+    RArray<TUint32> array;
+    CleanupClosePushL( array );
+
+    iRecords->GetSettingsRecordkeysL( array );
+
+    if( 0 == array.Count() )
+        {
+        RBuf tmp;
+        tmp.CreateL( KMaxDescLength );
+
+        TInt error = iRepository->Get( KXmppKeyColumnTable,
+                                       tmp );
+        tmp.Close();
+       // GFLOG2("CXmppSettingsApi::CreateSettingsrecord - error: %d",error);
+        if ( error )
+            {
+           // GFLOG1("CXmppSettingsApi::CreateSettingsrecord - first time ever!");
+           // GFLOG1("CXmppSettingsApi::CreateSettingsrecord - creating KColSettingId");
+
+            // create column for KColSettingId.
+            User::LeaveIfError( iRepository->Create( KXmppKeyColumnTable,
+                                                     KColSettingId() ) );
+
+           // GFLOG1("CXmppSettingsApi::CreateSettingsrecord - Initialize settingId record");
+            // Initialize settingId record. Initial value is zero
+            User::LeaveIfError( iRepository->Create( KCurrentSettingIdIndex,
+                                                     0 ) );
+            }
+        }
+
+    iRecords->CreateSettingsRecordIdL( aSettingsRecordId );
+
+    CleanupStack::PopAndDestroy( &array );
+
+   // GFLOG1("CXmppSettingsApi::CreateSettingsRecordL - OUT");
+    }
+
+// ---------------------------------------------------------------------------
+// This method removes settings record from the central repository.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CXmppSettingsApi::RemoveSettingsRecordL(
+    TUint32 aSettingsRecordId )
+    {
+   // GFLOG1("CXmppSettingsApi::RemoveSettingsRecordL - IN");
+
+    TUint32 settingKey( 0 );
+    // First, check that this setting id does exist
+    iRecords->FindSettingsRecordKeyL( aSettingsRecordId,
+                                      settingKey );
+
+    TUint32 key( KXmppKeyDataTable | settingKey );
+
+    TUint32 errorKey(0);
+
+    User::LeaveIfError( iRepository->Delete( key, KXmppMaskColumns, errorKey ) );
+
+   // GFLOG2("CXmppSettingsApi::RemoveSettingStorageL - errorKey: 0x%08x",errorKey);
+   // GFLOG2("CXmppSettingsApi::RemoveSettingStorageL - errorKey: %d",errorKey);
+   // GFLOG1("CXmppSettingsApi::RemoveSettingsRecordL - OUT");
+    }
+
+// ---------------------------------------------------------------------------
+// This method returns the default settings record (the first).
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CXmppSettingsApi::DefaultSettingsRecordL(
+    TUint32& aSettingsRecordId)
+    {
+   // GFLOG1("CXmppSettingsApi::DefaultSettingsRecordL - IN");
+    RArray<TUint32> crArray;
+    CleanupClosePushL( crArray );
+
+    iRecords->GetSettingsRecordkeysL( crArray );
+
+    TInt settingId( 0 );
+
+    if( crArray.Count() > 0 )
+        {
+        User::LeaveIfError( iRepository->Get( crArray[0], settingId ) );
+        }
+    
+
+    CleanupStack::PopAndDestroy( &crArray );
+
+    aSettingsRecordId = settingId;
+
+   // GFLOG1("CXmppSettingsApi::DefaultSettingsRecordL - OUT");
+    }
+
+// ---------------------------------------------------------------------------
+// This method returns all setting id.s
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CXmppSettingsApi::GetSettingsRecordIdArrayL(
+    RArray<TUint32>& aArray )
+    {
+   // GFLOG1("CXmppSettingsApi::GetSettingsRecordIdArrayL - IN");
+
+    RArray<TUint32> crArray;
+    CleanupClosePushL( crArray );
+
+    iRecords->GetSettingsRecordkeysL( crArray );
+
+    TInt id( 0 );
+    for ( TInt i=0; i < crArray.Count(); i++ )
+        {
+        User::LeaveIfError( iRepository->Get( crArray[i], id ) );
+        aArray.Append( id );
+        }
+
+    CleanupStack::PopAndDestroy( &crArray );
+   // GFLOG1("CXmppSettingsApi::GetSettingsRecordIdArrayL - OUT");
+    }
+
+// ---------------------------------------------------------------------------
+// This method sets the parameter. If column does not exist. it creates new
+// one.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CXmppSettingsApi::SetParamL(
+    TUint32 aSettingsRecordId,
+    const TDesC& aAttrName,
+    const TDesC& aAttrValue )
+    {
+   // GFLOG1("CXmppSettingsApi::SetParamL - IN");
+    // GFLOG4("    CXmppSettingsApi::SetParamL - aSettingsRecordId: %d: PARAM[ %S ][ %S ]",aSettingsRecordId,&aAttrName,&aAttrValue);
+    TUint32 theKey( 0 );
+
+    GetColumnKeyL( aSettingsRecordId,
+                  aAttrName,
+                  ETrue, // create column if not found.
+                  theKey );
+
+    RBuf buf;
+    buf.CreateL( KMaxDescLength );
+
+    // We do this just make sure that the key exists. Overflow is just one of
+    // the indicators.
+    TInt error = iRepository->Get( theKey, buf );
+
+    buf.Close();
+
+    // If column is not created for this setting id, then create it (to SETTING-table).
+    if ( error != KErrNotFound &&
+         error != KErrNone &&
+         error != KErrOverflow )
+        {
+       // GFLOG1("CXmppSettingsApi::SetParamL - leaving...");
+        User::Leave( error );
+        }
+    else if ( error == KErrNotFound )
+        {
+       // GFLOG1("CXmppSettingsApi::SetParamL - Creating new column..");
+        User::LeaveIfError( iRepository->Create( theKey, aAttrValue ) );
+        }
+    else
+        {
+       // GFLOG1("CXmppSettingsApi::SetParamL - Setting value to the column..");
+        // And finally, set the value to the column id in the setting id's row ( SETTING-table).
+        User::LeaveIfError( iRepository->Set( theKey, aAttrValue ) );
+        }
+
+   // GFLOG1("CXmppSettingsApi::SetParamL - OUT");
+    }
+
+// ---------------------------------------------------------------------------
+// This method sets the parameter. If column does not exist. it creates new
+// one.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CXmppSettingsApi::SetParamL(
+    TUint32 aSettingsRecordId,
+    const TDesC& aAttrName,
+    TInt aAttrValue )
+    {
+   // GFLOG1("CXmppSettingsApi::SetParamL - IN");
+    // GFLOG4("    CXmppSettingsApi::SetParamL - aSettingsRecordId: %d: PARAM[ %S ][ %d ]",aSettingsRecordId,&aAttrName,aAttrValue);
+    TUint32 theKey( 0 );
+
+    GetColumnKeyL( aSettingsRecordId,
+                  aAttrName,
+                  ETrue,
+                  theKey );
+
+    TInt paramValue( 0 );
+
+    TInt error = iRepository->Get( theKey, paramValue );
+
+    // If column is not created for this setting id, then create it (to SETTING-table).
+    if ( error != KErrNotFound &&
+         error != KErrNone )
+        {
+       // GFLOG1("CXmppSettingsApi::SetParamL - leaving...");
+        User::Leave( error );
+        }
+    else if ( error == KErrNotFound )
+        {
+       // GFLOG1("CXmppSettingsApi::SetParamL - Creating new column..");
+        User::LeaveIfError( iRepository->Create( theKey, aAttrValue ) );
+        }
+    else
+        {
+       // GFLOG1("CXmppSettingsApi::SetParamL - Setting value to the column..");
+        // And finally, set the value to the column id in the setting id's row ( SETTING-table).
+        User::LeaveIfError( iRepository->Set( theKey, aAttrValue ) );
+        }
+   // GFLOG1("CXmppSettingsApi::SetParamL - OUT");
+    }
+
+// ---------------------------------------------------------------------------
+// This method gets the value. If column does not exits it leaves.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CXmppSettingsApi::GetParamL(
+    TUint32 aSettingsRecordId,
+    const TDesC& aAttrName,
+    TDes& aAttrValue )
+    {
+   // GFLOG1("CXmppSettingsApi::GetParamL - IN");
+    // GFLOG3("    CXmppSettingsApi::GetParamL - aSettingsRecordId: %d: PARAM[ %S ]",aSettingsRecordId,&aAttrName);
+    TUint32 theKey( 0 );
+
+    GetColumnKeyL( aSettingsRecordId,
+                  aAttrName,
+                  EFalse, // Don't create column but leave if not found.
+                  theKey );
+
+    User::LeaveIfError( iRepository->Get( theKey, aAttrValue ) );
+   // GFLOG1("CXmppSettingsApi::GetParamL - OUT");
+    }
+
+// ---------------------------------------------------------------------------
+// This method gets the value. If column does not exits it leaves.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CXmppSettingsApi::GetParamL(
+    TUint32 aSettingsRecordId,
+    const TDesC& aAttrName,
+    TInt& aAttrValue )
+    {
+   // GFLOG1("CXmppSettingsApi::GetParamL - IN");
+    // GFLOG3("    CXmppSettingsApi::GetParamL - aSettingsRecordId: %d: PARAM[ %S ]",aSettingsRecordId,&aAttrName);
+    TUint32 theKey( 0 );
+
+    GetColumnKeyL( aSettingsRecordId,
+                  aAttrName,
+                  EFalse, // Don't create column but leave if not found.
+                  theKey );
+
+    User::LeaveIfError( iRepository->Get( theKey, aAttrValue ) );
+   // GFLOG1("CXmppSettingsApi::GetParamL - OUT");
+    }
+
+// ---------------------------------------------------------------------------
+// This method removes the value of the param from given settings record.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CXmppSettingsApi::RemoveParamL(
+    TUint32 aSettingsRecordId,
+    const TDesC& aAttrName )
+    {
+   // GFLOG1("CXmppSettingsApi::RemoveParamL - IN");
+    TUint32 settingKey( 0 );
+    // First, check that this setting id does exist
+    iRecords->FindSettingsRecordKeyL( aSettingsRecordId,
+                                      settingKey );
+
+    TUint32 colKey( 0 );
+
+    // Find out the id of the column (and does the column exist)
+    iColumns->FindByNameL( aAttrName,
+                                 colKey );
+
+   // GFLOG1("CXmppSettingsApi::RemoveParamL - Delete item");
+    TUint32 removeKey( settingKey | colKey );
+
+   // GFLOG2("CXmppSettingsApi::RemoveParamL - colKey:        0x%08x", colKey );
+   // GFLOG2("CXmppSettingsApi::RemoveParamL - settingKey:    0x%08x", settingKey );
+   // GFLOG2("CXmppSettingsApi::RemoveParamL - removeKey:     0x%08x", removeKey );
+
+    User::LeaveIfError( iRepository->Delete( removeKey ) );
+   // GFLOG1("CXmppSettingsApi::RemoveParamL - OUT");
+    }
+
+
+// ---------------------------------------------------------------------------
+// Do-method for all the SetParam-methods.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CXmppSettingsApi::GetRepositoryKeyL(
+    TUint32 aSettingsRecordId,
+    const TDesC& aAttrName,
+    TBool aCreateColumnIfNotExist,
+    TUint32& aTheKey )
+    {
+	 GetColumnKeyL( aSettingsRecordId,
+                  aAttrName,
+                  aCreateColumnIfNotExist , // create column if not found.
+                  aTheKey );
+    }
+    
+// PRIVATE
+
+
+// ---------------------------------------------------------------------------
+// Do-method for all the SetParam-methods.
+// ---------------------------------------------------------------------------
+//
+void CXmppSettingsApi::GetColumnKeyL(
+    TUint32 aSettingsRecordId,
+    const TDesC& aAttrName,
+    TBool aCreateColumnIfNotExist,
+    TUint32& aTheKey )
+    {
+
+    TUint32 settingKey( 0 );
+    // First, check that this setting id does exist.
+    iRecords->FindSettingsRecordKeyL( aSettingsRecordId,
+                                      settingKey );
+
+    // Try to find Column number from the COLUMN-TABLE.
+    TUint32 col( 0 );
+    iColumns->GetColumnKeyL( aAttrName,
+                            aCreateColumnIfNotExist,
+                            col );
+
+    // Find that is column already created to this setting id in SETTING-table.
+
+    aTheKey = KXmppKeyDataTable | settingKey | col;
+
+   // GFLOG2("CXmppSettingsApi::GetColumnKey - table | settingKey | aTheKey: 0x%08x", aTheKey);
+
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/xmppsettingsapi/src/xmppsettingscolumn.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,191 @@
+/*
+* 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:  This class handles columns.
+*
+*/
+
+
+#include <centralrepository.h>
+
+//XMPP includes
+//#include "// GFLOGger.h"
+
+#include "xmppsettingscolumn.h"
+#include "xmppsettingsapicommon.h"
+
+// ======== MEMBER FUNCTIONS ========
+
+CXmppSettingsColumn::CXmppSettingsColumn(
+    CRepository& aRepository ):
+    iRepository( aRepository )
+    {
+
+    }
+
+
+void CXmppSettingsColumn::ConstructL()
+    {
+
+    }
+
+
+CXmppSettingsColumn* CXmppSettingsColumn::NewL(
+    CRepository& aRepository )
+    {
+    CXmppSettingsColumn* self = CXmppSettingsColumn::NewLC( aRepository );
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+
+CXmppSettingsColumn* CXmppSettingsColumn::NewLC(
+    CRepository& aRepository )
+    {
+    CXmppSettingsColumn* self
+        = new( ELeave ) CXmppSettingsColumn( aRepository );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+
+CXmppSettingsColumn::~CXmppSettingsColumn()
+    {
+
+    }
+
+
+// ---------------------------------------------------------------------------
+// Checks does given column exist. If not, it creates new entry.
+// ---------------------------------------------------------------------------
+//
+void CXmppSettingsColumn::GetColumnKeyL(
+    const TDesC& aAttrName,
+    TBool aCreateColumnIfNotExist,
+    TUint32& aColKey )
+    {
+    TRAPD( error, FindByNameL( aAttrName,
+                               aColKey ) );
+
+    // LOGERR("CXmppSettingsColumn::GetColumnKeyL - error: %d",error);
+
+    // Column was not found, but user want's to create new one.
+    if ( error == KErrNotFound  && aCreateColumnIfNotExist )
+        {
+       // GFLOG1("CXmppSettingsColumn::GetColumnKeyL - column is not found => Create new");
+        //create new
+        TUint32 newColKey( 0 );
+        NextFreeSlotL( newColKey );
+       // GFLOG2("CXmppSettingsColumn::GetColumnKeyL - newColKey: 0x%08x",newColKey);
+
+        // Set column name to COLUMN-table.
+        User::LeaveIfError( iRepository.Create( newColKey, aAttrName ) );
+        aColKey = newColKey;
+        }
+    // Column was not found, but user does not want to create new.
+    else if( error == KErrNotFound  && !aCreateColumnIfNotExist )
+        {
+       // GFLOG1("CXmppSettingsColumn::GetColumnKeyL - column is not found => New not wanted - leaving");
+        User::Leave( KErrNotFound );
+        }
+    // other error occured -> Leave.
+    else if ( error != KErrNone )
+        {
+       // GFLOG1("CXmppSettingsColumn::GetColumnKeyL - error occured - leaving");
+        User::Leave( error );
+        }
+    // Col found.
+    else
+        {
+        // Everything ok.
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Tries to find a column key by searching with the column name.
+// ---------------------------------------------------------------------------
+//
+void CXmppSettingsColumn::FindByNameL(
+    const TDesC& aColumnName,
+    TUint32& aColumnKey )
+    {
+
+    RArray<TUint32> keys;
+    CleanupClosePushL( keys );
+
+    TInt error( KErrNone );
+
+    error = iRepository.FindEqL( KXmppKeyColumnTable,
+                                 KXmppMaskColumns,
+                                 aColumnName,
+                                 keys );
+
+    // LOGERR("CXmppSettingsColumn::FindByNameL - error: %d", error);
+    User::LeaveIfError ( error );
+
+   // GFLOG1("CXmppSettingsColumn::FindByColumnName - column found.");
+    aColumnKey = keys[0];
+
+
+//    DEBUG_BLOCK( 
+    
+    if ( keys.Count() > 1 )
+                    {
+                    // this should not happen. if it does, it is bug in somewhere in this component.
+                   // GFLOG1("CXmppSettingsColumn::FindByColumnName - WHAAAAT! TO MANY RESULTS -> LEAVE!");
+                    User::Leave( KErrGeneral );
+                    }
+ //               );
+    CleanupStack::PopAndDestroy( &keys );
+
+    }
+
+
+// PRIVATE METHODS
+
+
+// ---------------------------------------------------------------------------
+// Returns the next free setting slot.
+// ---------------------------------------------------------------------------
+//
+void CXmppSettingsColumn::NextFreeSlotL(
+    TUint32& aColKey )
+    {
+
+    RArray<TUint32> results;
+    CleanupClosePushL( results );
+
+    // First, find all rows and get count.
+    TInt error = iRepository.FindL( KXmppKeyColumnTable,
+                                    KXmppMaskColumns,
+                                    results );
+
+    TInt count = results.Count();
+   // GFLOG2("CXmppSettingsColumn::NextFreeSlotL - count: %d",count);
+    CleanupStack::PopAndDestroy( &results );
+
+    if ( count > 0 )
+        {
+        // Count can be used as new key
+        aColKey = count;
+        }
+    else
+        {
+        // First column ever
+        aColKey = 0;
+        }
+
+   // GFLOG2("CXmppSettingsColumn::NextFreeSlotL - aColKey: 0x%08x",aColKey);
+
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/xmppsettingsapi/src/xmppsettingsrecord.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,204 @@
+/*
+* 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:  This class is used for data table manipulations.
+*
+*/
+
+
+#include <centralrepository.h>
+
+//XMPP includes
+// #include "// GFLOGger.h"
+
+#include "xmppsettingsrecord.h"
+#include "xmppsettingsapicommon.h"
+
+// ======== MEMBER FUNCTIONS ========
+
+CXmppSettingsRecord::CXmppSettingsRecord(
+    CRepository& aRepository ):
+    iRepository( aRepository )
+    {
+
+    }
+
+CXmppSettingsRecord* CXmppSettingsRecord::NewL(
+    CRepository& aRepository )
+    {
+    CXmppSettingsRecord* self = CXmppSettingsRecord::NewLC( aRepository );
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+CXmppSettingsRecord* CXmppSettingsRecord::NewLC(
+    CRepository& aRepository )
+    {
+    CXmppSettingsRecord* self
+        = new( ELeave ) CXmppSettingsRecord( aRepository );
+    CleanupStack::PushL( self );
+    return self;
+    }
+
+
+CXmppSettingsRecord::~CXmppSettingsRecord()
+    {
+   // GFLOG1("CXmppSettingsRecord::~CXmppSettingsRecord");
+    iSettingsRecordKeyArray.Reset();
+    iSettingsRecordKeyArray.Close();
+    }
+
+
+// ---------------------------------------------------------------------------
+// Finds settingsRecord key. Leaves if not found.
+// ---------------------------------------------------------------------------
+//
+void CXmppSettingsRecord::FindSettingsRecordKeyL(
+    TUint32 aSettingsRecordId,
+    TUint32& aSettingsRecordKey )
+    {
+    GetSettingsRecordkeysL();
+
+    TInt counter( iSettingsRecordKeyArray.Count() );
+    TInt key = KErrNotFound;
+	for (TInt i = 0; i< counter; i++)
+		{
+		TInt id( 0 );
+		User::LeaveIfError( iRepository.Get( iSettingsRecordKeyArray[i],
+		                        id ) );
+		if ( id == aSettingsRecordId )            
+			{	
+			key = iSettingsRecordKeyArray[i];          
+			break;
+			}
+		}
+	 aSettingsRecordKey = key;
+
+    }
+
+// ---------------------------------------------------------------------------
+// returns list of all id keys.
+// ---------------------------------------------------------------------------
+//
+void CXmppSettingsRecord::GetSettingsRecordkeysL(
+    RArray<TUint32>& aResults )
+    {
+    GetSettingsRecordkeysL();
+
+    TInt count( iSettingsRecordKeyArray.Count() );
+    for ( TInt i=0; i < count; i++ )
+        {
+        aResults.Append( iSettingsRecordKeyArray[i] );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// This method creates new settings id.
+// ---------------------------------------------------------------------------
+//
+void CXmppSettingsRecord::CreateSettingsRecordIdL(
+    TUint32& aNewSettingId )
+    {
+   // GFLOG1("CXmppSettingsRecord::CreateSettingsRecordIdL - IN");
+
+    TUint32 nextFreeSlot( 0 );
+
+    NextFreeSlotL( nextFreeSlot );
+
+    TInt settingId( 0 );
+
+    TInt error( iRepository.Get( KCurrentSettingIdIndex, settingId ) );
+    // LOGERR("CXmppSettingsRecord::CreateSettingsRecordIdL - iRepository.Get( KCurrentSettingIdIndex ) - error: %d", error);
+
+    if ( !error )
+        {
+        settingId++;
+        // GFLOG3("CXmppSettingsRecord::CreateSettingsRecordIdL - nextFreeSlot: 0x%08x, settingId: %d",nextFreeSlot, settingId);
+        error = iRepository.Create( nextFreeSlot, settingId );
+        // LOGERR("CXmppSettingsRecord::CreateSettingsRecordIdL - iRepository.Create( nextFreeSlot ) - error: %d", error);
+        if ( !error )
+            {
+            error = iRepository.Set( KCurrentSettingIdIndex, settingId );
+            aNewSettingId = settingId;
+            }
+        }
+    User::LeaveIfError( error );
+   // GFLOG1("CXmppSettingsRecord::CreateSettingsRecordIdL - OUT");
+    }
+
+
+// PRIVATE
+
+
+// ---------------------------------------------------------------------------
+// returns next free slot key.
+// ---------------------------------------------------------------------------
+//
+void CXmppSettingsRecord::NextFreeSlotL(
+    TUint32& aFreekey )
+    {
+    // First, find all rows and get count.
+    const TUint32 shift = 0x00010000;
+
+    GetSettingsRecordkeysL();
+
+    const TInt count( iSettingsRecordKeyArray.Count() );
+   // GFLOG2("CXmppSettingsRecord::NextFreeSlotL - count: %d",count);
+
+    if ( count == 0 )
+        {
+        aFreekey = KXmppKeyDataTable;
+        }
+    // check for free slots
+    else
+        {
+        TBool foundFreeSlot( EFalse );
+
+        // go through all indexes and try to find free one.
+        for ( TInt i=0; i < count; i++ )
+            {
+            TUint32 tmpKey( KXmppKeyDataTable | ( i * shift ) );
+            TInt answer( iSettingsRecordKeyArray.Find( tmpKey ) );
+
+            if ( answer == KErrNotFound )
+                {
+                foundFreeSlot = ETrue;
+                aFreekey = tmpKey;
+                break;
+                }
+            }
+       if ( !foundFreeSlot )
+            {
+           // GFLOG1("CXmppSettingsRecord::NextFreeSlotL - no free slots, creating new");
+            aFreekey = KXmppKeyDataTable | ( count * shift );
+            }
+        }
+   // GFLOG2("CXmppSettingsRecord::NextFreeSlotL - aFreekey: 0x%08x",aFreekey);
+
+    }
+
+// ---------------------------------------------------------------------------
+// Find all unique settings ids.
+// ---------------------------------------------------------------------------
+//
+void CXmppSettingsRecord::GetSettingsRecordkeysL()
+    {
+    iSettingsRecordKeyArray.Reset();
+
+    TInt error = iRepository.FindL( KXmppKeyDataTable,
+                                    KXmppMaskAllRows,
+                                    iSettingsRecordKeyArray );
+
+   // GFLOG2("CXmppSettingsRecord::GetSettingsRecordkeysL - iSettingsRecordKeyArray.Count(): %d",iSettingsRecordKeyArray.Count());
+
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/xmppsettingsapi/tsrc/bmarm/xmppsettings_apiU.DEF	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,3 @@
+EXPORTS
+	LibEntryL__FR13CTestModuleIf @ 1 NONAME R3UNUSED ; LibEntryL(CTestModuleIf &)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/xmppsettingsapi/tsrc/bwins/xmppsettings_apiu.def	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,3 @@
+EXPORTS
+	?LibEntryL@@YAPAVCScriptBase@@AAVCTestModuleIf@@@Z @ 1 NONAME ; class CScriptBase * __cdecl LibEntryL(class CTestModuleIf &)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/xmppsettingsapi/tsrc/eabi/xmppsettings_apiu.def	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,3 @@
+EXPORTS
+	_Z9LibEntryLR13CTestModuleIf @ 1 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/xmppsettingsapi/tsrc/group/bld.inf	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,54 @@
+/*
+* 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:
+*
+*/
+
+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_TESTEXPORTS
+// NOTE: If using ARS requirements all export operations should be done under this.
+// 'abld test export'
+
+PRJ_EXPORTS
+// Specify the source file followed by its destination here
+// copy will be used to copy the source file to its destination
+// If there's no destination then the source file will be copied
+// 
+// Example: 
+/*
+
+*/
+../init/TestFramework.ini /epoc32/winscw/c/TestFramework/TestFramework.ini
+../conf/xmppsettings_api.cfg /epoc32/winscw/c/TestFramework/xmppsettings_api.cfg	
+PRJ_TESTMMPFILES
+
+	xmppsettings_api.mmp
+
+
+// Specify the .mmp files required for building the important component
+// releasables.
+//
+// Specify "tidy" if the component you need to build doesn't need to be
+// released. Specify "ignore" if the MMP file exists but should be
+// ignored.
+// Example:
+//
+
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/xmppsettingsapi/tsrc/group/xmppsettings_api.mmp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,77 @@
+/*TYPE TESTCLASS*/
+/*
+* 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: MMP file for STIF Test Framework's TestScripter 
+* testclass test module.
+*
+*/
+
+#include <platform_paths.hrh>
+
+TARGET          xmppsettings_api.dll
+TARGETTYPE      dll
+UID             0x1000008D 0x101FB3E3
+
+CAPABILITY      ALL -TCB
+/* Remove comments and replace 0x00000000 with correct vendor id */
+// VENDORID     0x00000000
+/* Remove comments and replace 0x00000000 with correct secure id */
+// SECUREID     0x00000000
+
+//TARGETPATH      ?target_path
+DEFFILE         xmppsettings_api.def
+
+USERINCLUDE     ../inc 
+
+OS_LAYER_SYSTEMINCLUDE
+APP_LAYER_SYSTEMINCLUDE
+MW_LAYER_SYSTEMINCLUDE
+SOURCEPATH      ../src
+
+SOURCE          xmppsettings_api.cpp
+SOURCE          xmppsettings_apiBlocks.cpp
+
+//RESOURCE        resource_file
+//RESOURCE        resource_file2
+
+LIBRARY         euser.lib
+LIBRARY         stiftestinterface.lib
+LIBRARY         stiftestengine.lib
+LIBRARY         jabbersettings.lib
+LIBRARY         centralrepository.lib
+LANG            SC
+
+/*
+START WINS      
+?wins_specific_information
+END
+
+START MARM
+?marm_specific_information
+END
+*/
+// Other possible keywords:
+ 
+// DOCUMENT     ?file, that is not compiled, but added to MSVC project workspace (i.e. release notes)
+/*
+START BITMAP ?target
+TARGETPATH   ?emulated_path_on_target_machine
+HEADER
+SOURCE       ?color_depth ?source_bitmap
+END
+*/
+// DEFFILE ?filename
+// AIF ?filename
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/xmppsettingsapi/tsrc/group/xmppsettings_api.pkg	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,66 @@
+;
+; 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:
+;
+; 	Installation file for STIF
+;
+
+; Languages
+&EN
+
+; Provide value for uid
+#{"STIF"},(0x00000000),1,1,0,TYPE=SA
+
+; Series60 product id for S60 3.0
+[0x101F7961], 0, 0, 0, {"Series60ProductID"}
+
+; Localised Vendor name
+%{"Nokia"}
+
+; Unique Vendor name
+:"Nokia"
+
+; Logo
+; None
+
+; Package signature - Optional
+; None
+
+; Start of Package body
+
+; Condition blocks
+; None
+
+; Options list
+; None
+
+;INI FILE
+"..\init\testframework.ini"        			-"c:\Testframework\ttestframework.ini"
+
+;CFG FILES
+"..\conf\xmppsettings_api.cfg"        			-"c:\Testframework\xmppsettings_api.cfg"
+
+; Install files
+"\epoc32\release\armv5\udeb\xmppsettings_api.dll"   -   "!:\Sys\Bin\xmppsettings_api.dll"
+  
+; Embedded SIS 
+; None
+
+; End of Package body
+
+; PKG dependencies
+; None
+
+; PKG capabilities
+; None
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/xmppsettingsapi/tsrc/group/xmppsettings_api_DoxyFile.txt	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,241 @@
+#/*TYPE TESTCLASS*/
+#/*
+#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: MMP file for STIF Test Framework's TestScripter 
+# testclass test module.
+#
+#*/
+
+# Doxyfile 1.4.1
+
+#---------------------------------------------------------------------------
+# Project related configuration options
+#---------------------------------------------------------------------------
+PROJECT_NAME           = xmppsettings_api
+PROJECT_NUMBER         = 
+OUTPUT_DIRECTORY       = \xmppsettings_api\
+CREATE_SUBDIRS         = NO
+OUTPUT_LANGUAGE        = English
+USE_WINDOWS_ENCODING   = YES
+BRIEF_MEMBER_DESC      = YES
+REPEAT_BRIEF           = YES
+ABBREVIATE_BRIEF       = 
+ALWAYS_DETAILED_SEC    = NO
+INLINE_INHERITED_MEMB  = NO
+FULL_PATH_NAMES        = NO
+STRIP_FROM_PATH        = 
+STRIP_FROM_INC_PATH    = 
+SHORT_NAMES            = NO
+JAVADOC_AUTOBRIEF      = NO
+MULTILINE_CPP_IS_BRIEF = NO
+DETAILS_AT_TOP         = NO
+INHERIT_DOCS           = YES
+DISTRIBUTE_GROUP_DOC   = NO
+TAB_SIZE               = 8
+ALIASES                = 
+OPTIMIZE_OUTPUT_FOR_C  = YES
+OPTIMIZE_OUTPUT_JAVA   = NO
+SUBGROUPING            = YES
+#---------------------------------------------------------------------------
+# Build related configuration options
+#---------------------------------------------------------------------------
+EXTRACT_ALL            = YES
+EXTRACT_PRIVATE        = NO
+EXTRACT_STATIC         = NO
+EXTRACT_LOCAL_CLASSES  = NO
+EXTRACT_LOCAL_METHODS  = NO
+HIDE_UNDOC_MEMBERS     = NO
+HIDE_UNDOC_CLASSES     = NO
+HIDE_FRIEND_COMPOUNDS  = NO
+HIDE_IN_BODY_DOCS      = NO
+INTERNAL_DOCS          = YES
+CASE_SENSE_NAMES       = YES
+HIDE_SCOPE_NAMES       = NO
+SHOW_INCLUDE_FILES     = YES
+INLINE_INFO            = YES
+SORT_MEMBER_DOCS       = YES
+SORT_BRIEF_DOCS        = NO
+SORT_BY_SCOPE_NAME     = NO
+GENERATE_TODOLIST      = NO
+GENERATE_TESTLIST      = NO
+GENERATE_BUGLIST       = NO
+GENERATE_DEPRECATEDLIST= YES
+ENABLED_SECTIONS       = 
+MAX_INITIALIZER_LINES  = 30
+SHOW_USED_FILES        = YES
+SHOW_DIRECTORIES       = YES
+FILE_VERSION_FILTER    = 
+#---------------------------------------------------------------------------
+# configuration options related to warning and progress messages
+#---------------------------------------------------------------------------
+QUIET                  = NO
+WARNINGS               = YES
+WARN_IF_UNDOCUMENTED   = YES
+WARN_IF_DOC_ERROR      = YES
+WARN_NO_PARAMDOC       = NO
+WARN_FORMAT            = "$file:$line: $text"
+WARN_LOGFILE           = 
+#---------------------------------------------------------------------------
+# configuration options related to the input files
+#---------------------------------------------------------------------------
+INPUT                  = \xmppsettings_api\
+FILE_PATTERNS          = *.h \
+                         *.rh \
+                         *.hrh
+RECURSIVE              = YES
+EXCLUDE                = 
+EXCLUDE_SYMLINKS       = NO
+EXCLUDE_PATTERNS       = 
+EXAMPLE_PATH           = 
+EXAMPLE_PATTERNS       = 
+EXAMPLE_RECURSIVE      = NO
+IMAGE_PATH             = 
+INPUT_FILTER           = 
+FILTER_PATTERNS        = 
+FILTER_SOURCE_FILES    = NO
+#---------------------------------------------------------------------------
+# configuration options related to source browsing
+#---------------------------------------------------------------------------
+SOURCE_BROWSER         = NO
+INLINE_SOURCES         = NO
+STRIP_CODE_COMMENTS    = YES
+REFERENCED_BY_RELATION = YES
+REFERENCES_RELATION    = YES
+VERBATIM_HEADERS       = YES
+#---------------------------------------------------------------------------
+# configuration options related to the alphabetical class index
+#---------------------------------------------------------------------------
+ALPHABETICAL_INDEX     = NO
+COLS_IN_ALPHA_INDEX    = 5
+IGNORE_PREFIX          = 
+#---------------------------------------------------------------------------
+# configuration options related to the HTML output
+#---------------------------------------------------------------------------
+GENERATE_HTML          = NO
+HTML_OUTPUT            = html
+HTML_FILE_EXTENSION    = .html
+HTML_HEADER            = 
+HTML_FOOTER            = 
+HTML_STYLESHEET        = 
+HTML_ALIGN_MEMBERS     = YES
+GENERATE_HTMLHELP      = YES
+CHM_FILE               = 
+HHC_LOCATION           = 
+GENERATE_CHI           = NO
+BINARY_TOC             = YES
+TOC_EXPAND             = YES
+DISABLE_INDEX          = YES
+ENUM_VALUES_PER_LINE   = 4
+GENERATE_TREEVIEW      = YES
+TREEVIEW_WIDTH         = 250
+#---------------------------------------------------------------------------
+# configuration options related to the LaTeX output
+#---------------------------------------------------------------------------
+GENERATE_LATEX         = NO
+LATEX_OUTPUT           = latex
+LATEX_CMD_NAME         = latex
+MAKEINDEX_CMD_NAME     = makeindex
+COMPACT_LATEX          = NO
+PAPER_TYPE             = a4wide
+EXTRA_PACKAGES         = 
+LATEX_HEADER           = 
+PDF_HYPERLINKS         = NO
+USE_PDFLATEX           = NO
+LATEX_BATCHMODE        = NO
+LATEX_HIDE_INDICES     = NO
+#---------------------------------------------------------------------------
+# configuration options related to the RTF output
+#---------------------------------------------------------------------------
+GENERATE_RTF           = YES
+RTF_OUTPUT             = Doc
+COMPACT_RTF            = YES
+RTF_HYPERLINKS         = YES
+RTF_STYLESHEET_FILE    = 
+RTF_EXTENSIONS_FILE    = 
+#---------------------------------------------------------------------------
+# configuration options related to the man page output
+#---------------------------------------------------------------------------
+GENERATE_MAN           = NO
+MAN_OUTPUT             = man
+MAN_EXTENSION          = .3
+MAN_LINKS              = NO
+#---------------------------------------------------------------------------
+# configuration options related to the XML output
+#---------------------------------------------------------------------------
+GENERATE_XML           = NO
+XML_OUTPUT             = xml
+XML_SCHEMA             = 
+XML_DTD                = 
+XML_PROGRAMLISTING     = YES
+#---------------------------------------------------------------------------
+# configuration options for the AutoGen Definitions output
+#---------------------------------------------------------------------------
+GENERATE_AUTOGEN_DEF   = NO
+#---------------------------------------------------------------------------
+# configuration options related to the Perl module output
+#---------------------------------------------------------------------------
+GENERATE_PERLMOD       = NO
+PERLMOD_LATEX          = NO
+PERLMOD_PRETTY         = YES
+PERLMOD_MAKEVAR_PREFIX = 
+#---------------------------------------------------------------------------
+# Configuration options related to the preprocessor   
+#---------------------------------------------------------------------------
+ENABLE_PREPROCESSING   = YES
+MACRO_EXPANSION        = YES
+EXPAND_ONLY_PREDEF     = NO
+SEARCH_INCLUDES        = YES
+INCLUDE_PATH           = 
+INCLUDE_FILE_PATTERNS  = 
+PREDEFINED             = NONSHARABLE_CLASS
+EXPAND_AS_DEFINED      = 
+SKIP_FUNCTION_MACROS   = YES
+#---------------------------------------------------------------------------
+# Configuration::additions related to external references   
+#---------------------------------------------------------------------------
+TAGFILES               = 
+GENERATE_TAGFILE       = 
+ALLEXTERNALS           = NO
+EXTERNAL_GROUPS        = YES
+PERL_PATH              = /usr/bin/perl
+#---------------------------------------------------------------------------
+# Configuration options related to the dot tool   
+#---------------------------------------------------------------------------
+CLASS_DIAGRAMS         = YES
+HIDE_UNDOC_RELATIONS   = YES
+HAVE_DOT               = NO
+CLASS_GRAPH            = YES
+COLLABORATION_GRAPH    = YES
+GROUP_GRAPHS           = YES
+UML_LOOK               = NO
+TEMPLATE_RELATIONS     = YES
+INCLUDE_GRAPH          = YES
+INCLUDED_BY_GRAPH      = YES
+CALL_GRAPH             = NO
+GRAPHICAL_HIERARCHY    = YES
+DIRECTORY_GRAPH        = YES
+DOT_IMAGE_FORMAT       = png
+DOT_PATH               = 
+DOTFILE_DIRS           = 
+MAX_DOT_GRAPH_WIDTH    = 1024
+MAX_DOT_GRAPH_HEIGHT   = 1024
+MAX_DOT_GRAPH_DEPTH    = 0
+DOT_TRANSPARENT        = NO
+DOT_MULTI_TARGETS      = NO
+GENERATE_LEGEND        = YES
+DOT_CLEANUP            = YES
+#---------------------------------------------------------------------------
+# Configuration::additions related to the search engine   
+#---------------------------------------------------------------------------
+SEARCHENGINE           = NO
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/xmppsettingsapi/tsrc/group/xmppsettings_api_nrm.mmp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,75 @@
+/*TYPE TESTCLASS*/
+/*
+* 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: MMP file for STIF Test Framework's TestScripter 
+* testclass test module.
+*
+*/
+
+#include <platform_paths.hrh>
+
+TARGET          xmppsettings_api.dll
+TARGETTYPE      dll
+UID             0x1000008D 0x101FB3E3
+
+CAPABILITY      ALL -TCB
+/* Remove comments and replace 0x00000000 with correct vendor id */
+// VENDORID     0x00000000
+/* Remove comments and replace 0x00000000 with correct secure id */
+// SECUREID     0x00000000
+
+//TARGETPATH      ?target_path
+DEFFILE         xmppsettings_api.def
+
+USERINCLUDE     ../inc 
+
+OS_LAYER_SYSTEMINCLUDE
+
+SOURCEPATH      ../src
+
+SOURCE          xmppsettings_api.cpp
+SOURCE          xmppsettings_apiBlocks.cpp
+
+//RESOURCE        resource_file
+//RESOURCE        resource_file2
+
+LIBRARY         euser.lib
+LIBRARY         stiftestinterface.lib
+LIBRARY         stiftestengine.lib
+
+LANG            SC
+
+/*
+START WINS      
+?wins_specific_information
+END
+
+START MARM
+?marm_specific_information
+END
+*/
+// Other possible keywords:
+ 
+// DOCUMENT     ?file, that is not compiled, but added to MSVC project workspace (i.e. release notes)
+/*
+START BITMAP ?target
+TARGETPATH   ?emulated_path_on_target_machine
+HEADER
+SOURCE       ?color_depth ?source_bitmap
+END
+*/
+// DEFFILE ?filename
+// AIF ?filename
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/xmppsettingsapi/tsrc/inc/xmppsettings_api.h	Wed Nov 03 09:32:20 2010 +0530
@@ -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: STIF testclass declaration
+*
+*/
+
+#ifndef XMPPSETTINGS_API_H
+#define XMPPSETTINGS_API_H
+
+//  INCLUDES
+#include <StifLogger.h>
+#include <TestScripterInternal.h>
+#include <StifTestModule.h>
+#include <TestclassAssert.h>
+
+// CONSTANTS
+//const ?type ?constant_var = ?constant;
+
+// MACROS
+//#define ?macro ?macro_def
+#define TEST_CLASS_VERSION_MAJOR 0
+#define TEST_CLASS_VERSION_MINOR 0
+#define TEST_CLASS_VERSION_BUILD 0
+
+// Logging path
+_LIT( Kxmppsettings_apiLogPath, "\\logs\\testframework\\xmppsettings_api\\" ); 
+// Log file
+_LIT( Kxmppsettings_apiLogFile, "xmppsettings_api.txt" ); 
+_LIT( Kxmppsettings_apiLogFileWithTitle, "xmppsettings_api_[%S].txt" );
+
+// FUNCTION PROTOTYPES
+//?type ?function_name(?arg_list);
+
+// FORWARD DECLARATIONS
+//class ?FORWARD_CLASSNAME;
+class CXmppSettingsApi;
+class Cxmppsettings_api;
+
+// DATA TYPES
+//enum ?declaration
+//typedef ?declaration
+//extern ?data_type;
+
+// CLASS DECLARATION
+
+/**
+*  Cxmppsettings_api test class for STIF Test Framework TestScripter.
+*  ?other_description_lines
+*
+*  @lib ?library
+*  @since ?Series60_version
+*/
+NONSHARABLE_CLASS(Cxmppsettings_api) : public CScriptBase
+    {
+    public:  // Constructors and destructor
+
+        /**
+        * Two-phased constructor.
+        */
+        static Cxmppsettings_api* NewL( CTestModuleIf& aTestModuleIf );
+
+        /**
+        * Destructor.
+        */
+        virtual ~Cxmppsettings_api();
+
+    public: // New functions
+
+        /**
+        * ?member_description.
+        * @since ?Series60_version
+        * @param ?arg1 ?description
+        * @return ?description
+        */
+        //?type ?member_function( ?type ?arg1 );
+
+    public: // Functions from base classes
+
+        /**
+        * From CScriptBase Runs a script line.
+        * @since ?Series60_version
+        * @param aItem Script line containing method name and parameters
+        * @return Symbian OS error code
+        */
+        virtual TInt RunMethodL( CStifItemParser& aItem );
+
+    protected:  // New functions
+
+        /**
+        * ?member_description.
+        * @since ?Series60_version
+        * @param ?arg1 ?description
+        * @return ?description
+        */
+        //?type ?member_function( ?type ?arg1 );
+
+    protected:  // Functions from base classes
+
+        /**
+        * From ?base_class ?member_description
+        */
+        //?type ?member_function();
+
+    private:
+
+        /**
+        * C++ default constructor.
+        */
+        Cxmppsettings_api( CTestModuleIf& aTestModuleIf );
+
+        /**
+        * By default Symbian 2nd phase constructor is private.
+        */
+        void ConstructL();
+
+        // Prohibit copy constructor if not deriving from CBase.
+        // ?classname( const ?classname& );
+        // Prohibit assigment operator if not deriving from CBase.
+        // ?classname& operator=( const ?classname& );
+
+        /**
+        * Frees all resources allocated from test methods.
+        * @since ?Series60_version
+        */
+        void Delete();
+
+        /**
+        * Test methods are listed below. 
+        */
+
+        /**
+        * Example test method.
+        * @since ?Series60_version
+        * @param aItem Script line containing parameters.
+        * @return Symbian OS error code.
+        */
+        
+        void ResetRepository();
+        virtual TInt Test_CreateSettingsRecordL( CStifItemParser& aItem );
+        virtual TInt Test_DefaultSettingsRecord( CStifItemParser& aItem );
+        virtual TInt Test_GetSettingsRecordIdArray(CStifItemParser& aItem );
+        virtual TInt Test_SetParamInt(CStifItemParser& aItem );
+        virtual TInt Test_SetParamLDes(CStifItemParser& aItem );
+        virtual TInt Test_GetParamInt(CStifItemParser& aItem );
+        virtual TInt Test_GetParamLDes(CStifItemParser& aItem );
+        virtual TInt Test_RemoveSettingsRecord(CStifItemParser& aItem );
+        virtual TInt Test_RemoveParam(CStifItemParser& aItem );
+       
+        /**
+         * Method used to log version of test class
+         */
+        void SendTestClassVersion();
+
+        //ADD NEW METHOD DEC HERE
+        //[TestMethods] - Do not remove
+
+    public:     // Data
+        // ?one_line_short_description_of_data
+        //?data_declaration;
+        TInt iXmppSettingId;
+           TInt iXmppSnapId;
+           TInt iXmppServerPort;
+           TInt iMessageToneVolume;
+           TInt iLastRegistrationError;
+
+           TBool iPublishOnThePhoneStatus;
+           TBool iRoamingWarning;
+           TBool iAllowBuddyReq;
+           TBool iAutoLogin;
+           TBool iDefaultProfile;
+
+           HBufC* iMessageTone;
+           HBufC* iSnapName;
+           HBufC* iSettingsName;
+           HBufC* iStackVersion;
+           HBufC* iXmppServerAddress;
+           HBufC* iUsername;
+           HBufC* iPassword;
+           HBufC* iConnectionServer1;
+           HBufC* iConnectionServer2;
+           TUint32 iSettingId;
+           RArray<TUint32> iSettingIdArray;
+           
+           CXmppSettingsApi* iApi;
+
+           
+
+
+    protected:  // Data
+        // ?one_line_short_description_of_data
+        //?data_declaration;
+
+    private:    // Data
+        
+        // ?one_line_short_description_of_data
+        //?data_declaration;
+
+        // Reserved pointer for future extension
+        //TAny* iReserved;
+
+    public:     // Friend classes
+        //?friend_class_declaration;
+    protected:  // Friend classes
+        //?friend_class_declaration;
+    private:    // Friend classes
+        //?friend_class_declaration;
+
+    };
+
+#endif      // XMPPSETTINGS_API_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/xmppsettingsapi/tsrc/init/TestFramework.ini	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,45 @@
+#
+# This is STIFTestFramework initialization file
+# Comment lines start with '#'-character.
+# See STIF TestFramework users guide.doc for instructions
+
+# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+
+[Engine_Defaults]
+
+TestReportMode= FullReport		# Possible values are: 'Empty', 'Summary', 'Environment',
+                                                               'TestCases' or 'FullReport'
+
+CreateTestReport= YES			# Possible values: YES or NO
+
+TestReportFilePath= C:\LOGS\TestFramework\
+TestReportFileName= TestReport
+
+TestReportFormat= TXT			# Possible values: TXT or HTML
+TestReportOutput= FILE			# Possible values: FILE or RDEBUG
+TestReportFileCreationMode= OVERWRITE	# Possible values: OVERWRITE or APPEND
+
+DeviceResetDllName= StifResetForNokia.dll # e.g. 'StifHWResetStub.dll' for user specific reseting
+
+[End_Defaults]
+# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+
+# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+# Module configurations start
+
+[New_Module]
+ModuleName= testscripter
+TestCaseFile= C:\testframework\xmppsettings_api.cfg
+[End_Module]
+
+
+
+
+# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+
+[Logger_Defaults]
+
+[End_Logger_Defaults]
+# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+
+# End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/xmppsettingsapi/tsrc/src/xmppsettings_api.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,254 @@
+/*
+* 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: This file contains testclass implementation.
+*
+*/
+
+// INCLUDE FILES
+#include <StifTestInterface.h>
+#include "xmppsettings_api.h"
+#include <SettingServerClient.h>
+#include<xmppservicesettingsapi.h>
+
+// EXTERNAL DATA STRUCTURES
+//extern  ?external_data;
+
+// EXTERNAL FUNCTION PROTOTYPES  
+//extern ?external_function( ?arg_type,?arg_type );
+
+// CONSTANTS
+//const ?type ?constant_var = ?constant;
+
+// MACROS
+//#define ?macro ?macro_def
+
+// LOCAL CONSTANTS AND MACROS
+//const ?type ?constant_var = ?constant;
+//#define ?macro_name ?macro_def
+
+// MODULE DATA STRUCTURES
+//enum ?declaration
+//typedef ?declaration
+
+// LOCAL FUNCTION PROTOTYPES
+//?type ?function_name( ?arg_type, ?arg_type );
+
+// FORWARD DECLARATIONS
+//class ?FORWARD_CLASSNAME;
+
+// ============================= LOCAL FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// ?function_name ?description.
+// ?description
+// Returns: ?value_1: ?description
+//          ?value_n: ?description_line1
+//                    ?description_line2
+// -----------------------------------------------------------------------------
+//
+/*
+?type ?function_name(
+    ?arg_type arg,  // ?description
+    ?arg_type arg)  // ?description
+    {
+
+    ?code  // ?comment
+
+    // ?comment
+    ?code
+    }
+*/
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// Cxmppsettings_api::Cxmppsettings_api
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+Cxmppsettings_api::Cxmppsettings_api( 
+    CTestModuleIf& aTestModuleIf ):
+        CScriptBase( aTestModuleIf )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// Cxmppsettings_api::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void Cxmppsettings_api::ConstructL()
+    {
+        iXmppSettingId = 0;
+        iXmppSnapId = 15;
+        
+        iXmppServerPort = 5223;
+        iMessageToneVolume = 7;
+        iLastRegistrationError = KErrNone;
+
+        iPublishOnThePhoneStatus = ETrue;
+        iRoamingWarning = ETrue;
+        iAllowBuddyReq = ETrue;
+        iAutoLogin = EFalse;
+        iDefaultProfile = ETrue;
+        
+        iApi = CXmppSettingsApi::NewL();
+         iMessageTone = HBufC::NewL( 50 );
+        iMessageTone->Des().Copy( _L("c:\\system\\tones\\diipadaapa.wav") );
+        
+       // LOGARG16("messagetone path: %S", iMessageTone);
+        
+        iSnapName = HBufC::NewL( 50 );
+        iSnapName->Des().Copy( _L("Internet") );
+        
+        iSettingsName = HBufC::NewL( 50 );
+        iSettingsName->Des().Copy( _L("XMPP-SETTING 1") );
+        
+        iStackVersion = HBufC::NewL( 50 );
+        iStackVersion->Des().Copy( _L("XMPP STACK V1.021 build 127") );
+        
+        iXmppServerAddress = HBufC::NewL( 50 );
+        iXmppServerAddress->Des().Copy( _L("chat.gizmoproject.com") );
+        
+        iUsername = HBufC::NewL( 50 );
+        iUsername->Des().Copy( _L("lassi") );
+        
+        iPassword = HBufC::NewL( 50 );
+        iPassword->Des().Copy( _L("lassi123") );
+        
+        iConnectionServer1 = HBufC::NewL( 50 );
+        iConnectionServer1->Des().Copy( _L("Con.Server.gizmo.com") );
+        
+        iConnectionServer2 = HBufC::NewL( 50 );
+        iConnectionServer2->Des().Copy( _L("Con2.Server.gizmo.com") );
+        
+        
+
+    //Read logger settings to check whether test case name is to be
+    //appended to log file name.
+    RSettingServer settingServer;
+    TInt ret = settingServer.Connect();
+    if(ret != KErrNone)
+        {
+        User::Leave(ret);
+        }
+    // Struct to StifLogger settigs.
+    TLoggerSettings loggerSettings; 
+    // Parse StifLogger defaults from STIF initialization file.
+    ret = settingServer.GetLoggerSettings(loggerSettings);
+    if(ret != KErrNone)
+        {
+        User::Leave(ret);
+        } 
+    // Close Setting server session
+    settingServer.Close();
+
+    TFileName logFileName;
+    
+    if(loggerSettings.iAddTestCaseTitle)
+        {
+        TName title;
+        TestModuleIf().GetTestCaseTitleL(title);
+        logFileName.Format(Kxmppsettings_apiLogFileWithTitle, &title);
+        }
+    else
+        {
+        logFileName.Copy(Kxmppsettings_apiLogFile);
+        }
+
+    iLog = CStifLogger::NewL( Kxmppsettings_apiLogPath, 
+                          logFileName,
+                          CStifLogger::ETxt,
+                          CStifLogger::EFile,
+                          EFalse );
+    
+    SendTestClassVersion();
+    }
+
+// -----------------------------------------------------------------------------
+// Cxmppsettings_api::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+Cxmppsettings_api* Cxmppsettings_api::NewL( 
+    CTestModuleIf& aTestModuleIf )
+    {
+    Cxmppsettings_api* self = new (ELeave) Cxmppsettings_api( aTestModuleIf );
+
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+
+    return self;
+
+    }
+
+// Destructor
+Cxmppsettings_api::~Cxmppsettings_api()
+    { 
+
+    // Delete resources allocated from test methods
+    Delete();
+        delete iMessageTone;
+        delete iSnapName;
+        delete iSettingsName;
+        delete iStackVersion;
+        delete iXmppServerAddress;
+        delete iUsername;
+        delete iPassword;
+        delete iConnectionServer1;
+        delete iConnectionServer2;
+        delete iApi;
+    // Delete logger
+    delete iLog; 
+
+    }
+
+//-----------------------------------------------------------------------------
+// Cxmppsettings_api::SendTestClassVersion
+// Method used to send version of test class
+//-----------------------------------------------------------------------------
+//
+void Cxmppsettings_api::SendTestClassVersion()
+	{
+	TVersion moduleVersion;
+	moduleVersion.iMajor = TEST_CLASS_VERSION_MAJOR;
+	moduleVersion.iMinor = TEST_CLASS_VERSION_MINOR;
+	moduleVersion.iBuild = TEST_CLASS_VERSION_BUILD;
+	
+	TFileName moduleName;
+	moduleName = _L("xmppsettings_api.dll");
+
+	TBool newVersionOfMethod = ETrue;
+	TestModuleIf().SendTestModuleVersion(moduleVersion, moduleName, newVersionOfMethod);
+	}
+
+// ========================== OTHER EXPORTED FUNCTIONS =========================
+
+// -----------------------------------------------------------------------------
+// LibEntryL is a polymorphic Dll entry point.
+// Returns: CScriptBase: New CScriptBase derived object
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CScriptBase* LibEntryL( 
+    CTestModuleIf& aTestModuleIf ) // Backpointer to STIF Test Framework
+    {
+
+    return ( CScriptBase* ) Cxmppsettings_api::NewL( aTestModuleIf );
+
+    }
+
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/xmppsettingsapi/tsrc/src/xmppsettings_apiBlocks.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,543 @@
+/*
+* 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: This file contains testclass implementation.
+*
+*/
+
+// [INCLUDE FILES] - do not remove
+#include <e32svr.h>
+#include <StifParser.h>
+#include <StifTestInterface.h>
+#include "xmppsettings_api.h"
+#include <xmppservicesettingsapi.h>
+#include<centralrepository.h>
+
+// EXTERNAL DATA STRUCTURES
+//extern  ?external_data;
+const TUid  KXmppSettingsApiCenRep         ={0x1020e334};
+_LIT( KParamName, "XMPP-PARAM-NUMBER-0x%08d");
+_LIT( KParamValue16, "param value - 0x%08d");
+// EXTERNAL FUNCTION PROTOTYPES  
+//extern ?external_function( ?arg_type,?arg_type );
+
+// CONSTANTS
+//const ?type ?constant_var = ?constant;
+
+// MACROS
+//#define ?macro ?macro_def
+
+// LOCAL CONSTANTS AND MACROS
+//const ?type ?constant_var = ?constant;
+//#define ?macro_name ?macro_def
+
+// MODULE DATA STRUCTURES
+//enum ?declaration
+//typedef ?declaration
+
+// LOCAL FUNCTION PROTOTYPES
+//?type ?function_name( ?arg_type, ?arg_type );
+
+// FORWARD DECLARATIONS
+//class ?FORWARD_CLASSNAME;
+
+// ============================= LOCAL FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// ?function_name ?description.
+// ?description
+// Returns: ?value_1: ?description
+//          ?value_n: ?description_line1
+//                    ?description_line2
+// -----------------------------------------------------------------------------
+//
+/*
+?type ?function_name(
+    ?arg_type arg,  // ?description
+    ?arg_type arg)  // ?description
+    {
+
+    ?code  // ?comment
+
+    // ?comment
+    ?code
+    }
+*/
+void Cxmppsettings_api::ResetRepository()
+    {
+    CRepository* rep = CRepository::NewL( KXmppSettingsApiCenRep );
+    User::LeaveIfError( rep->Reset() );
+    delete rep;
+    }
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// Cxmppsettings_api::Delete
+// Delete here all resources allocated and opened from test methods. 
+// Called from destructor. 
+// -----------------------------------------------------------------------------
+//
+void Cxmppsettings_api::Delete() 
+    {
+
+    }
+
+// -----------------------------------------------------------------------------
+// Cxmppsettings_api::RunMethodL
+// Run specified method. Contains also table of test mothods and their names.
+// -----------------------------------------------------------------------------
+//
+TInt Cxmppsettings_api::RunMethodL( 
+    CStifItemParser& aItem ) 
+    {
+
+    static TStifFunctionInfo const KFunctions[] =
+        {  
+        // Copy this line for every implemented function.
+        // First string is the function name used in TestScripter script file.
+        // Second is the actual implementation member function. 
+        ENTRY( "Test_CreateSettingsRecordL", Cxmppsettings_api::Test_CreateSettingsRecordL ),
+        ENTRY( "Test_DefaultSettingsRecord", Cxmppsettings_api::Test_DefaultSettingsRecord ),
+        ENTRY( "Test_GetSettingsRecordIdArray", Cxmppsettings_api::Test_GetSettingsRecordIdArray ),
+        ENTRY( "Test_SetParamInt", Cxmppsettings_api::Test_SetParamInt ),
+        ENTRY( "Test_SetParamLDes", Cxmppsettings_api::Test_SetParamLDes ),
+        ENTRY( "Test_GetParamInt", Cxmppsettings_api::Test_GetParamInt ),
+        ENTRY( "Test_GetParamLDes", Cxmppsettings_api::Test_GetParamLDes ),
+        ENTRY( "Test_RemoveSettingsRecord", Cxmppsettings_api::Test_RemoveSettingsRecord ),
+        ENTRY( "Test_RemoveParam", Cxmppsettings_api::Test_RemoveParam ),
+
+        
+        //ADD NEW ENTRY HERE
+        // [test cases entries] - Do not remove
+
+        };
+
+    const TInt count = sizeof( KFunctions ) / 
+                        sizeof( TStifFunctionInfo );
+
+    return RunInternalL( KFunctions, count, aItem );
+
+    }
+
+// -----------------------------------------------------------------------------
+// Cxmppsettings_api::ExampleL
+// Example test method function.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt Cxmppsettings_api::Test_CreateSettingsRecordL( CStifItemParser& aItem )
+    {
+    
+    ResetRepository();
+     iApi->CreateSettingsRecordL( iSettingId );
+     if(0==iSettingId)
+         {
+         return KErrGeneral;
+         }
+    
+    RArray<TUint32> array;
+
+    iApi->GetSettingsRecordIdArrayL( array );
+    TInt arraycount = array.Count();
+    if(0==arraycount)
+        {
+        return KErrGeneral;
+        }
+    if(iSettingId!=array[0])
+        {
+        return KErrGeneral;
+        }
+    array.Reset();
+    array.Close();
+    ResetRepository();
+    TInt count = 5;
+    for (TInt i=0; i< count; i++ )
+        {
+        iApi->CreateSettingsRecordL( iSettingId ) ;
+        }
+    iApi->GetSettingsRecordIdArrayL( array );
+    arraycount = array.Count();
+    if(count!=arraycount)
+        {
+        return KErrGeneral;
+        }
+    array.Reset();
+    array.Close();
+    ResetRepository();
+    return KErrNone;
+        }
+
+TInt Cxmppsettings_api::Test_DefaultSettingsRecord( CStifItemParser& aItem )
+    {
+    ResetRepository();
+    iApi->CreateSettingsRecordL( iSettingId );
+    TUint32 settingId;
+    iApi->DefaultSettingsRecordL( settingId );
+    if(settingId!=iSettingId)
+        {
+        return KErrGeneral;
+        }
+    ResetRepository();
+    return KErrNone;
+    
+    }
+
+TInt Cxmppsettings_api::Test_GetSettingsRecordIdArray( CStifItemParser& aItem )
+    {
+    
+    ResetRepository();
+     iApi->CreateSettingsRecordL( iSettingId );
+     if(0==iSettingId)
+         {
+         return KErrGeneral;
+         }
+    
+    RArray<TUint32> array;
+
+    iApi->GetSettingsRecordIdArrayL( array );
+    TInt arraycount = array.Count();
+    if(0==arraycount)
+        {
+        return KErrGeneral;
+        }
+    if(iSettingId!=array[0])
+        {
+        return KErrGeneral;
+        }
+    array.Reset();
+    array.Close();
+    ResetRepository();
+    TInt count = 5;
+    for (TInt i=0; i< count; i++ )
+        {
+        iApi->CreateSettingsRecordL( iSettingId ) ;
+        }
+    iApi->GetSettingsRecordIdArrayL( array );
+    arraycount = array.Count();
+    if(count!=arraycount)
+        {
+        return KErrGeneral;
+        }
+    array.Reset();
+    array.Close();
+    ResetRepository();
+    return KErrNone;
+        }
+TInt Cxmppsettings_api::Test_SetParamInt( CStifItemParser& aItem )
+    {
+    ResetRepository();
+    iApi->CreateSettingsRecordL( iSettingId );
+
+    _LIT( KParamName, "XMPP-PARAM-NUMBER-0x%08d");
+
+    TInt count = 128; // 0xFF
+    TInt err;
+   for (TInt i=0; i < count; i++ )
+    {
+    HBufC* paramName = HBufC::NewL( KParamName().Length()+20 );
+    paramName->Des().AppendFormat( KParamName(), i );
+
+    TInt paramValue(i);
+
+    TRAP(err,iApi->SetParamL( iSettingId, *paramName, paramValue));
+    if(err!=KErrNone)
+        {
+        ResetRepository();
+        return KErrGeneral;
+        }
+
+    delete paramName;
+    }
+    ResetRepository();
+    return KErrNone;
+    }
+
+TInt Cxmppsettings_api::Test_SetParamLDes( CStifItemParser& aItem )
+    {
+    TInt err;
+    ResetRepository();
+    iApi->CreateSettingsRecordL( iSettingId );
+
+    TInt count = 128; // 0xFF
+
+    for (TInt i=0; i < count; i++ )
+        {
+        HBufC* paramName = HBufC::NewL( KParamName().Length()+20 );
+        paramName->Des().AppendFormat( KParamName(), i );
+
+        HBufC* paramValue = HBufC::NewL( KParamValue16().Length()+20 );
+        paramValue->Des().AppendFormat( KParamValue16(), i );
+
+        TRAP(err,iApi->SetParamL( iSettingId, *paramName, *paramValue));
+        if(err!=KErrNone)
+           {
+            ResetRepository();
+            delete paramName;
+            delete paramValue;
+            return KErrGeneral;
+                }
+
+        delete paramName;
+        delete paramValue;
+        }
+    ResetRepository();
+    return KErrNone;
+    
+    }
+
+TInt Cxmppsettings_api::Test_GetParamInt( CStifItemParser& aItem )
+    {
+    ResetRepository();
+    iApi->CreateSettingsRecordL( iSettingId );
+
+    _LIT( KParamName, "XMPP-PARAM-NUMBER-0x%08d");
+
+    TInt count = 128; // 0xFF
+    TInt err;
+   for (TInt i=0; i < count; i++ )
+    {
+    HBufC* paramName = HBufC::NewL( KParamName().Length()+20 );
+    paramName->Des().AppendFormat( KParamName(), i );
+
+    TInt paramValue(i);
+
+    TRAP(err,iApi->SetParamL( iSettingId, *paramName, paramValue));
+    if(err!=KErrNone)
+        {
+        ResetRepository();
+        return KErrGeneral;
+        }
+
+    delete paramName;
+    }
+   for ( TInt i=0; i < count; i++ )
+           {
+           HBufC* paramName = HBufC::NewL( KParamName().Length()+20 );
+           paramName->Des().AppendFormat( KParamName(), i );
+
+           TInt paramValue(0);
+
+           iApi->GetParamL( iSettingId,*paramName,paramValue);
+
+           if( i!= paramValue)
+               {
+               return KErrGeneral;
+               }
+
+           delete paramName;
+           }
+    ResetRepository();
+    return KErrNone;
+    }
+    
+TInt Cxmppsettings_api::Test_GetParamLDes( CStifItemParser& aItem )
+    {
+    ResetRepository();
+    iApi->CreateSettingsRecordL( iSettingId );
+
+    _LIT( KParamName, "XMPP-PARAM-NUMBER-0x%08d");
+
+    TInt count = 128; // 0xFF
+    TInt err;
+   for (TInt i=0; i < count; i++ )
+    {
+    HBufC* paramName = HBufC::NewL( KParamName().Length()+20 );
+    paramName->Des().AppendFormat( KParamName(), i );
+
+    HBufC* paramValue = HBufC::NewL( KParamValue16().Length()+20 );
+    paramValue->Des().AppendFormat( KParamValue16(), i );
+
+    TRAP(err,iApi->SetParamL( iSettingId, *paramName, *paramValue));
+    if(err!=KErrNone)
+       {
+        ResetRepository();
+        delete paramName;
+        delete paramValue;
+        return KErrGeneral;
+            }
+
+    delete paramName;
+    delete paramValue;
+    }
+   for ( TInt i=0; i < count; i++ )
+           {
+           HBufC* paramName = HBufC::NewL( KParamName().Length()+20 );
+           paramName->Des().AppendFormat( KParamName(), i );
+
+           HBufC* paramValue = HBufC::NewL( KParamValue16().Length()+20 );
+           paramValue->Des().AppendFormat( KParamValue16(), i );
+
+           RBuf buf;
+           buf.CreateL( 255 );
+
+           TRAP(err,iApi->GetParamL( iSettingId,*paramName, buf) );
+           
+           if(err!=KErrNone)
+               {
+               return KErrGeneral;
+               }
+           //*paramValue, buf, ;
+
+           delete paramName;
+           delete paramValue;
+
+           buf.Close();
+           }
+    ResetRepository();
+    return KErrNone;
+    }
+
+TInt Cxmppsettings_api::Test_RemoveSettingsRecord( CStifItemParser& aItem )
+    {
+    ResetRepository();
+    iApi->CreateSettingsRecordL( iSettingId );
+    iApi->RemoveSettingsRecordL( iSettingId );
+
+    RArray<TUint32> array;
+
+    iApi->GetSettingsRecordIdArrayL( array );
+    TInt arraycount = array.Count();
+    if(1==arraycount)
+        {
+        return KErrGeneral;
+        }
+
+    array.Reset();
+
+    iSettingId = 0;
+
+    ResetRepository();
+
+    TInt count = 128;
+
+    for (TInt i=1; i< count; i++ )
+        {
+        iApi->CreateSettingsRecordL( iSettingId);
+        }
+
+    // because cen rep is reseted after every test, indexes should start
+    // from zero and go up to count. So its safe to assume that these
+    // indexes exist :)
+
+    iApi->RemoveSettingsRecordL( 1 );
+    iApi->RemoveSettingsRecordL( 55 );
+    iApi->RemoveSettingsRecordL( 123 );
+    iApi->RemoveSettingsRecordL( 96 ) ;
+    iApi->RemoveSettingsRecordL( 2 );
+
+    iApi->GetSettingsRecordIdArrayL( array );
+    arraycount = array.Count();
+    if((count-6)!=arraycount)
+        {
+        return KErrGeneral;
+        }
+
+    for( TInt i=0; i < array.Count(); i++ )
+        {
+         iApi->RemoveSettingsRecordL( array[i] );
+        }
+
+    array.Reset();
+    iApi->GetSettingsRecordIdArrayL( array );
+    if( 0!=(array.Count()))
+        {
+        return KErrGeneral;
+        }
+    array.Reset();
+    array.Close();
+    ResetRepository();
+    return KErrNone;
+      
+    }
+TInt Cxmppsettings_api::Test_RemoveParam( CStifItemParser& aItem )
+    {
+
+
+    ResetRepository();
+    iApi->CreateSettingsRecordL( iSettingId );
+
+    _LIT( KParamName, "XMPP-PARAM-NUMBER-0x%08d");
+
+    TInt count = 128; // 0xFF
+    TInt err;
+   for (TInt i=0; i < count; i++ )
+    {
+    HBufC* paramName = HBufC::NewL( KParamName().Length()+20 );
+    paramName->Des().AppendFormat( KParamName(), i );
+
+    TInt paramValue(i);
+
+    TRAP(err,iApi->SetParamL( iSettingId, *paramName, paramValue));
+    if(err!=KErrNone)
+        {
+        ResetRepository();
+        return KErrGeneral;
+        }
+
+    delete paramName;
+    }
+   
+    count = 128; // 0xFF
+
+    TInt param = 56;
+
+        HBufC* paramName = HBufC::NewL( KParamName().Length()+20 );
+        paramName->Des().AppendFormat( KParamName(), param );
+
+        iApi->RemoveParamL( iSettingId,*paramName);
+        TInt paramvalue;
+        
+        TRAP(err,iApi->GetParamL( iSettingId,*paramName,paramvalue));
+        if(err!= -1)
+            {
+            return KErrGeneral;
+            }
+        iApi->SetParamL( iSettingId,*paramName,12345);
+        delete paramName;
+
+    for (TInt i=0; i < count; i++ )
+        {
+        HBufC* paramName = HBufC::NewL( KParamName().Length() + 20 );
+        paramName->Des().AppendFormat( KParamName(), i );
+
+        iApi->RemoveParamL( iSettingId,*paramName);
+
+        delete paramName;
+        }
+
+
+    ResetRepository();
+    return KErrNone;
+    
+    
+    }
+// -----------------------------------------------------------------------------
+// Cxmppsettings_api::?member_function
+// ?implementation_description
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+/*
+TInt Cxmppsettings_api::?member_function(
+   CItemParser& aItem )
+   {
+
+   ?code
+
+   }
+*/
+
+// ========================== OTHER EXPORTED FUNCTIONS =========================
+// None
+
+//  [End of File] - Do not remove
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/xmppsettingsfetcher/bwins/xmppsettingsfetcheru.def	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,17 @@
+EXPORTS
+	?ConnMgrBus@CXmppParameters@@QAEABVTDesC16@@XZ @ 1 NONAME ; class TDesC16 const & CXmppParameters::ConnMgrBus(void)
+	?ConnMgrPath@CXmppParameters@@QAEABVTDesC16@@XZ @ 2 NONAME ; class TDesC16 const & CXmppParameters::ConnMgrPath(void)
+	?IapId@CXmppParameters@@QAEJXZ @ 3 NONAME ; long CXmppParameters::IapId(void)
+	?NewL@CXmppParameters@@SAPAV1@XZ @ 4 NONAME ; class CXmppParameters * CXmppParameters::NewL(void)
+	?Passwd@CXmppParameters@@QAEABVTDesC16@@XZ @ 5 NONAME ; class TDesC16 const & CXmppParameters::Passwd(void)
+	?Protocol@CXmppParameters@@QAEABVTDesC16@@XZ @ 6 NONAME ; class TDesC16 const & CXmppParameters::Protocol(void)
+	?ProxyPort@CXmppParameters@@QAEJXZ @ 7 NONAME ; long CXmppParameters::ProxyPort(void)
+	?ProxyServer@CXmppParameters@@QAEABVTDesC16@@XZ @ 8 NONAME ; class TDesC16 const & CXmppParameters::ProxyServer(void)
+	?ReadSettingsL@CXmppSettingsFetcher@@SAHKAAVCXmppParameters@@@Z @ 9 NONAME ; int CXmppSettingsFetcher::ReadSettingsL(unsigned long, class CXmppParameters &)
+	?Resource@CXmppParameters@@QAEABVTDesC16@@XZ @ 10 NONAME ; class TDesC16 const & CXmppParameters::Resource(void)
+	?ServerAddress@CXmppParameters@@QAEABVTDesC16@@XZ @ 11 NONAME ; class TDesC16 const & CXmppParameters::ServerAddress(void)
+	?ServerPort@CXmppParameters@@QAEJXZ @ 12 NONAME ; long CXmppParameters::ServerPort(void)
+	?SettingsId@CXmppParameters@@QAEKXZ @ 13 NONAME ; unsigned long CXmppParameters::SettingsId(void)
+	?Ssl@CXmppParameters@@QAEHXZ @ 14 NONAME ; int CXmppParameters::Ssl(void)
+	?UserName@CXmppParameters@@QAEABVTDesC16@@XZ @ 15 NONAME ; class TDesC16 const & CXmppParameters::UserName(void)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/xmppsettingsfetcher/eabi/xmppsettingsfetcheru.def	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,19 @@
+EXPORTS
+	_ZN15CXmppParameters10ServerPortEv @ 1 NONAME
+	_ZN15CXmppParameters10SettingsIdEv @ 2 NONAME
+	_ZN15CXmppParameters11ProxyServerEv @ 3 NONAME
+	_ZN15CXmppParameters13ServerAddressEv @ 4 NONAME
+	_ZN15CXmppParameters3SslEv @ 5 NONAME
+	_ZN15CXmppParameters4NewLEv @ 6 NONAME
+	_ZN15CXmppParameters5IapIdEv @ 7 NONAME
+	_ZN15CXmppParameters6PasswdEv @ 8 NONAME
+	_ZN15CXmppParameters8ResourceEv @ 9 NONAME
+	_ZN15CXmppParameters8UserNameEv @ 10 NONAME
+	_ZN15CXmppParameters9ProxyPortEv @ 11 NONAME
+	_ZN20CXmppSettingsFetcher13ReadSettingsLEmR15CXmppParameters @ 12 NONAME
+	_ZTI15CXmppParameters @ 13 NONAME ; #<TI>#
+	_ZTV15CXmppParameters @ 14 NONAME ; #<VT>#
+	_ZN15CXmppParameters10ConnMgrBusEv @ 15 NONAME
+	_ZN15CXmppParameters11ConnMgrPathEv @ 16 NONAME
+	_ZN15CXmppParameters8ProtocolEv @ 17 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/xmppsettingsfetcher/group/bld.inf	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,34 @@
+/*
+* Copyright (c) 2007-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:  fetches the xmpp settings from the settings store
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+#ifdef FF_MECO_XMPP
+../rom/xmppsettingsfetcher.iby						 CORE_MW_LAYER_IBY_EXPORT_PATH(xmppsettingsfetcher.iby)
+#endif
+
+PRJ_MMPFILES
+
+xmppsettingsfetcher.mmp
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/xmppsettingsfetcher/group/xmppsettingsfetcher.mmp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,41 @@
+/*
+* Copyright (c) 2007-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:  fetches the xmpp settings from the settings store
+*
+*/
+
+
+# include <platform_paths.hrh>
+TARGET          xmppsettingsfetcher.dll
+TARGETTYPE      DLL
+UID             0x1000008d  0x20010124
+
+CAPABILITY      CAP_ECOM_PLUGIN
+VENDORID     	VID_DEFAULT
+
+VERSION      10.0
+
+SOURCEPATH      ../src
+SOURCE          xmppsettingsfetcher.cpp
+SOURCE			xmppparameters.cpp
+
+USERINCLUDE     ../inc 
+
+
+ MW_LAYER_SYSTEMINCLUDE
+
+LIBRARY     euser.lib
+LIBRARY		jabbersettings.lib
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/xmppsettingsfetcher/inc/xmppparameters.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,312 @@
+/*
+* Copyright (c) 2007-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:  stores the parameters needed for xmpp
+*
+*/
+
+#ifndef __CXMPPPARAMETERS_H__
+#define __CXMPPPARAMETERS_H__
+
+//  INCLUDES
+#include <e32base.h>
+
+// FORWARD DECLARATIONS
+
+const TUint32 KMaxLength = 127;
+
+/**
+ * CXmppParameters
+ *
+ * parameters for xmpp
+ *
+ */
+class CXmppParameters: public CBase
+    {
+public:
+		
+	 /**
+	  * Two Phase Constructor
+	  */
+    IMPORT_C static CXmppParameters* NewL();
+    
+   /**
+    * Destructor
+    */
+    virtual ~CXmppParameters();
+
+
+private:
+		
+	 /**
+	  * Default Constructor
+	  */	
+    CXmppParameters();
+    void ConstructL();
+
+
+public: 
+
+    /**
+     * Sets the value of the member variable iIapId
+     *
+     * @param aIapId value to set
+     */
+	void SetIapId(TInt32 aIapId);
+
+    /**
+     * Sets the value of the member variable iSettingsId
+     *
+     * @param aSettingsId value to set
+     */
+	void SetSettingsId(TUint32 aSettingsId);
+
+    /**
+     * Sets the value of the member variable iServerAddress
+     *
+     * @param aServerAddress value to set
+     */
+	void SetServerAddress(const TDesC& aServerAddress);
+
+    /**
+     * Sets the value of the member variable iUserName
+     *
+     * @param aUserName value to set
+     */
+	void SetUserName(const TDesC& aUserName);
+
+    /**
+     * Sets the value of the member variable iPassword
+     *
+     * @param aPassword value to set
+     */
+	void SetPasswd(const TDesC& aPassword);
+
+    /**
+     * Sets the value of the member variable iResource
+     *
+     * @param aResource value to set
+     */
+	void SetResource(const TDesC& aResource);
+
+    /**
+     * Sets the value of the member variable iProxyServer
+     *
+     * @param aProxyServer value to set
+     */
+	void SetProxyServer(const TDesC& aProxyServer);
+
+    /**
+     * Sets the value of the member variable iServerPort
+     *
+     * @param aServerPort value to set
+     */
+	void SetServerPort(TInt32 aServerPort);
+
+    /**
+     * Sets the value of the member variable iProxyPort
+     *
+     * @param aProxyPort value to set
+     */
+	void SetProxyPort(TInt32 aProxyPort);
+
+    /**
+     * Sets the value of the member variable iSsl
+     *
+     * @param aSsl value to set
+     */
+	void SetSsl(TBool aSsl);
+	
+	/**
+     * Sets the value of the member variable iConnMgrBus
+     *
+     * @param aSsl value to set
+     */
+	void CXmppParameters::SetConnMgrBus(const TDesC& aConnMgrBus);
+	
+	/**
+     * Sets the value of the member variable iConnMgrPath
+     *
+     * @param aSsl value to set
+     */
+	void CXmppParameters::SetConnMgrPath(const TDesC& aConnMgrPath);
+	
+	/**
+     * Sets the value of the member variable iProtocol
+     *
+     * @param aSsl value to set
+     */
+	void CXmppParameters::SetProtocol(const TDesC& aProtocol);
+
+    /**
+     * Returns the value of the member variable iIapId
+     *
+     * @param None
+     */
+	IMPORT_C TInt32 IapId();
+
+    /**
+     * Returns the value of the member variable iSettingsId
+     *
+     * @param None
+     */
+	IMPORT_C TUint32 SettingsId();
+
+    /**
+     * Returns the value of the member variable iServerAddress
+     *
+     * @param None
+     */
+    IMPORT_C const TDesC& ServerAddress();
+
+    /**
+     * Returns the value of the member variable iUserName
+     *
+     * @param None
+     */
+    IMPORT_C const TDesC& UserName();
+
+    /**
+     * Returns the value of the member variable iPassword
+     *
+     * @param None
+     */
+    IMPORT_C const TDesC& Passwd();
+
+    /**
+     * Returns the value of the member variable iResource
+     *
+     * @param None
+     */
+    IMPORT_C const TDesC& Resource();
+
+    /**
+     * Returns the value of the member variable iProxyServer
+     *
+     * @param None
+     */
+    IMPORT_C const TDesC& ProxyServer();
+
+    /**
+     * Returns the value of the member variable iServerPort
+     *
+     * @param None
+     */
+	IMPORT_C TInt32 ServerPort();
+
+    /**
+     * Returns the value of the member variable iProxyPort
+     *
+     * @param None
+     */
+	IMPORT_C TInt32 ProxyPort();
+
+    /**
+     * Returns the value of the member variable iSsl
+     *
+     * @param None
+     */
+	IMPORT_C TBool Ssl();
+	
+	/**
+     * Returns the value of the member variable iConnMgrBus
+     *
+     * @param None
+     */
+	IMPORT_C const TDesC& CXmppParameters::ConnMgrBus();
+	
+	/**
+     * Returns the value of the member variable iConnMgrPath
+     *
+     * @param None
+     */
+	IMPORT_C const TDesC& CXmppParameters::ConnMgrPath();
+	
+	/**
+     * Returns the value of iProtocol
+     *
+     * @param None
+     */
+	IMPORT_C const TDesC& CXmppParameters::Protocol();
+	
+private: // data
+
+    /**
+     * IapId to use for the xmpp connection
+     */
+    TInt32 iIapId;
+
+    /**
+     * settingsid in the xmpp settings store
+     */
+    TInt32 iSettingsId;
+    
+    /**
+     * xmpp server to connect to
+     */
+    HBufC* iServerAddress;
+
+    /**
+     * username to use for the xmpp connection
+     */
+    HBufC* iUserName;
+
+    /**
+     * password of the user
+     */
+    HBufC* iPassword;
+
+    /**
+     * resource to use for the xmpp connection
+     */
+    HBufC* iResource;
+
+    /**
+     * proxy server to use for the xmpp connection
+     */
+    HBufC* iProxyServer;
+
+    /**
+     * port number to connect to in the xmpp server
+     */
+    TInt32 iServerPort;
+
+    /**
+     * port number of the proxy server to connect to
+     */
+    TInt32 iProxyPort;
+
+    /**
+     * indicates whether to use ssl or not for the connection
+     */
+    TBool iSsl;
+    
+    /**
+    * Connection manager bus : Protocol specific
+    */
+    HBufC* iConnMgrBus;
+	
+	/**
+    * Connection manager path : Protocol specific
+    */
+    HBufC* iConnMgrPath;
+    
+    /**
+    * Protocol name
+    */
+    HBufC* iProtocol;
+   };
+
+
+#endif // __CXMPPSETTINGSFETCHER_H__
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/xmppsettingsfetcher/inc/xmppsettingsfetcher.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,49 @@
+/*
+* Copyright (c) 2007-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:  fetches xmpp settings from settings store 
+*
+*/
+
+#ifndef __CXMPPSETTINGSFETCHER_H__
+#define __CXMPPSETTINGSFETCHER_H__
+
+//  INCLUDES
+#include <e32base.h>
+
+// FORWARD DECLARATIONS
+class CXmppParameters;
+
+/**
+ * CXmppSettingsFetcher
+ *
+ * Fetches settings from the xmpp settings store
+ *
+ */
+class CXmppSettingsFetcher : public CBase
+    {
+
+public: 
+    /**
+     * Reads the settings corresponding to the settingsid from
+     *   the xmpp settings store and stores them to the out parameter
+     *
+     * @param aSettingsId provided settingsid
+     * @param aParams settings read from the store are stored in this parameter
+     */
+	IMPORT_C static TInt ReadSettingsL( TUint32 aSettingsId, CXmppParameters& aParams );
+
+   };
+
+
+#endif // __CXMPPSETTINGSFETCHER_H__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/xmppsettingsfetcher/rom/xmppsettingsfetcher.iby	Wed Nov 03 09:32:20 2010 +0530
@@ -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: IBY file for XMPP setting fetcher
+*
+*/
+
+#ifndef __XMPPSETTINGSFETCHER_IBY__
+#define __XMPPSETTINGSFETCHER_IBY__
+
+//xmpp settings
+
+file=ABI_DIR\BUILD_DIR\xmppsettingsfetcher.dll          			SHARED_LIB_DIR\xmppsettingsfetcher.dll
+
+#endif
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/xmppsettingsfetcher/src/xmppparameters.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,323 @@
+/*
+* Copyright (c) 2007-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:  stores the parameters needed for xmpp
+*
+*/
+
+#include "xmppparameters.h"
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// CXmppParameters::CXmppParameters
+// ---------------------------------------------------------------------------
+//
+CXmppParameters::CXmppParameters()
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXmppParameters::ConstructL
+// ---------------------------------------------------------------------------
+//
+void CXmppParameters::ConstructL()
+    {
+    iServerAddress = HBufC::NewL(KMaxLength);
+    iUserName = HBufC::NewL(KMaxLength);
+    iPassword = HBufC::NewL(KMaxLength);
+    iResource = HBufC::NewL(KMaxLength);
+    iProxyServer = HBufC::NewL(KMaxLength);
+    
+    iConnMgrBus = HBufC::NewL(KMaxLength);
+    iConnMgrPath = HBufC::NewL(KMaxLength);
+    iProtocol = HBufC::NewL(KMaxLength);
+    
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXmppParameters::NewL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CXmppParameters* CXmppParameters::NewL()
+    {
+ 
+    CXmppParameters* self = new( ELeave )
+                            CXmppParameters();
+                            
+    CleanupStack::PushL( self );
+    
+    self->ConstructL();
+    CleanupStack::Pop( self );
+	
+    return self;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXmppParameters::~CXmppParameters
+// ---------------------------------------------------------------------------
+//
+CXmppParameters::~CXmppParameters()
+    {
+    delete iServerAddress;
+    delete iUserName;
+    delete iPassword;
+    delete iResource;
+    delete iProxyServer;
+    
+    delete iProtocol;
+    delete iConnMgrPath;
+    delete iConnMgrBus;
+    // before destory cancel each of the active objects request
+    }
+    
+// ---------------------------------------------------------------------------
+// CXmppParameters::SetIapId
+// ---------------------------------------------------------------------------
+//
+void CXmppParameters::SetIapId(TInt32 aIapId)
+    {
+    iIapId = aIapId;
+    }
+    
+// ---------------------------------------------------------------------------
+// CXmppParameters::SetSettingsId
+// ---------------------------------------------------------------------------
+//
+void CXmppParameters::SetSettingsId(TUint32 aSettingsId)
+    {
+    iSettingsId = aSettingsId;
+    }
+    
+// ---------------------------------------------------------------------------
+// CXmppParameters::SetServerAddress
+// ---------------------------------------------------------------------------
+//
+void CXmppParameters::SetServerAddress(const TDesC& aServerAddress)
+    {
+    iServerAddress->Des().Copy(aServerAddress);
+    }
+
+// ---------------------------------------------------------------------------
+// CXmppParameters::SetUsername
+// ---------------------------------------------------------------------------
+//
+void CXmppParameters::SetUserName(const TDesC& aUserName)
+    {
+    iUserName->Des().Copy(aUserName);
+    }
+
+// ---------------------------------------------------------------------------
+// CXmppParameters::SetPasswd
+// ---------------------------------------------------------------------------
+//
+void CXmppParameters::SetPasswd(const TDesC& aPassword)
+    {
+    iPassword->Des().Copy(aPassword);
+    }
+
+// ---------------------------------------------------------------------------
+// CXmppParameters::SetResource
+// ---------------------------------------------------------------------------
+//
+void CXmppParameters::SetResource(const TDesC& aResource)
+    {
+    iResource->Des().Copy(aResource);
+    }
+
+// ---------------------------------------------------------------------------
+// CXmppParameters::SetProxyServer
+// ---------------------------------------------------------------------------
+//
+void CXmppParameters::SetProxyServer(const TDesC& aProxyServer)
+    {
+    iProxyServer->Des().Copy(aProxyServer);
+    }
+    
+// ---------------------------------------------------------------------------
+// CXmppParameters::SetServerPort
+// ---------------------------------------------------------------------------
+//
+void CXmppParameters::SetServerPort(TInt32 aServerPort)
+    {
+    iServerPort = aServerPort;
+    }
+
+// ---------------------------------------------------------------------------
+// CXmppParameters::SetProxyPort
+// ---------------------------------------------------------------------------
+//
+void CXmppParameters::SetProxyPort(TInt32 aProxyPort)
+    {
+    iProxyPort = aProxyPort;
+    }
+
+// ---------------------------------------------------------------------------
+// CXmppParameters::SetSsl
+// ---------------------------------------------------------------------------
+//
+void CXmppParameters::SetSsl(TBool aSsl)
+    {
+    iSsl = aSsl;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXmppParameters::SetProxyServer
+// ---------------------------------------------------------------------------
+//
+void CXmppParameters::SetConnMgrBus(const TDesC& aConnMgrBus)
+    {
+    iConnMgrBus->Des().Copy(aConnMgrBus);
+    }
+    
+// ---------------------------------------------------------------------------
+// CXmppParameters::SetProxyServer
+// ---------------------------------------------------------------------------
+//
+void CXmppParameters::SetConnMgrPath(const TDesC& aConnMgrPath)
+    {
+    iConnMgrPath->Des().Copy(aConnMgrPath);
+    }
+    
+// ---------------------------------------------------------------------------
+// CXmppParameters::SetProxyServer
+// ---------------------------------------------------------------------------
+//
+void CXmppParameters::SetProtocol(const TDesC& aProtocol)
+    {
+    iProtocol->Des().Copy(aProtocol);
+    }        
+// ---------------------------------------------------------------------------
+// CXmppParameters::IapId
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt32 CXmppParameters::IapId()
+    {
+    return iIapId;
+    }
+    
+// ---------------------------------------------------------------------------
+// CXmppParameters::SettingsId
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TUint32 CXmppParameters::SettingsId()
+    {
+    return iSettingsId;
+    }
+    
+// ---------------------------------------------------------------------------
+// CXmppParameters::ServerAddress
+// ---------------------------------------------------------------------------
+//
+EXPORT_C const TDesC& CXmppParameters::ServerAddress()
+    {
+    return *iServerAddress;
+    }
+
+// ---------------------------------------------------------------------------
+// CXmppParameters::Username
+// ---------------------------------------------------------------------------
+//
+EXPORT_C const TDesC& CXmppParameters::UserName()
+    {
+    return *iUserName;
+    }
+
+// ---------------------------------------------------------------------------
+// CXmppParameters::Passwd
+// ---------------------------------------------------------------------------
+//
+EXPORT_C const TDesC& CXmppParameters::Passwd()
+    {
+    return *iPassword;
+    }
+
+// ---------------------------------------------------------------------------
+// CXmppParameters::Resource
+// ---------------------------------------------------------------------------
+//
+EXPORT_C const TDesC& CXmppParameters::Resource()
+    {
+    return *iResource;
+    }
+
+// ---------------------------------------------------------------------------
+// CXmppParameters::ProxyServer
+// ---------------------------------------------------------------------------
+//
+EXPORT_C const TDesC& CXmppParameters::ProxyServer()
+    {
+    return *iProxyServer;
+    }
+    
+// ---------------------------------------------------------------------------
+// CXmppParameters::ServerPort
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt32 CXmppParameters::ServerPort()
+    {
+    return iServerPort;
+    }
+
+// ---------------------------------------------------------------------------
+// CXmppParameters::ProxyPort
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt32 CXmppParameters::ProxyPort()
+    {
+    return iProxyPort;
+    }
+
+// ---------------------------------------------------------------------------
+// CXmppParameters::Ssl
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TBool CXmppParameters::Ssl()
+    {
+    return iSsl;
+    }
+
+// ---------------------------------------------------------------------------
+// CXmppParameters::ConnMgrBus
+// ---------------------------------------------------------------------------
+//
+EXPORT_C const TDesC& CXmppParameters::ConnMgrBus()
+    {
+    return *iConnMgrBus;
+    }
+
+// ---------------------------------------------------------------------------
+// CXmppParameters::ConnMgrPath
+// ---------------------------------------------------------------------------
+//
+EXPORT_C const TDesC& CXmppParameters::ConnMgrPath()
+    {
+    return *iConnMgrPath;
+    }
+
+// ---------------------------------------------------------------------------
+// CXmppParameters::Protocol
+// ---------------------------------------------------------------------------
+//
+EXPORT_C const TDesC& CXmppParameters::Protocol()
+    {
+    return *iProtocol;
+    }
+
+
+// End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/xmppsettingsfetcher/src/xmppsettingsfetcher.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,136 @@
+/*
+* Copyright (c) 2007-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:  fetches xmpp settings from settings store 
+*
+*/
+
+#include "xmppsettingsfetcher.h"
+#include "xmppservicesettingsapi.h"
+
+#include "xmppparameters.h"
+#include <xmppparams.h>
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// CXmppSettingsFetcher::ReadSettings
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CXmppSettingsFetcher::ReadSettingsL( TUint32 aSettingsId, CXmppParameters& aParams )
+    {
+    TBool settingsFound = EFalse;
+    RArray<TUint32> settingIdArray;
+    CXmppSettingsApi* api = CXmppSettingsApi::NewLC();
+
+	CleanupClosePushL( settingIdArray );
+    api->GetSettingsRecordIdArrayL( settingIdArray );
+
+	//first store the settingsid
+	aParams.SetSettingsId(aSettingsId);
+
+    for ( TInt i=0; i<settingIdArray.Count(); i++ )
+        {
+        if (settingIdArray[i] == aSettingsId ) //settings id we are looking for
+        	{
+        	//settings with integer values
+	        TInt paramValueInt(0);
+	        api->GetParamL( settingIdArray[i], 
+	        					XmppParams::KXmppParamServerPort(), 
+	        					paramValueInt );
+			aParams.SetServerPort(paramValueInt);
+				                                                    
+	        api->GetParamL( settingIdArray[i],
+	        					XmppParams::KXmppParamHttpsProxyServerPort(),
+								paramValueInt );
+			aParams.SetProxyPort(paramValueInt);
+
+	        api->GetParamL( settingIdArray[i],
+	        					XmppParams::KXmppParamSnapId(),
+								paramValueInt );
+			aParams.SetIapId(paramValueInt);
+
+        	//settings with boolean values
+			TBool paramValueBool(EFalse);
+	        api->GetParamL( settingIdArray[i],
+	        					XmppParams::KXmppParamOldSSLRequired(),
+								paramValueBool );
+			aParams.SetSsl(paramValueBool);
+			
+        	//settings with descriptor values
+	        RBuf paramValueBuf;
+	        paramValueBuf.CreateL( KMaxLength );
+			paramValueBuf.CleanupClosePushL();
+
+	        api->GetParamL( settingIdArray[i],
+	        					XmppParams::KXmppParamXmppServerAddress(),
+								paramValueBuf );
+			aParams.SetServerAddress(paramValueBuf);
+	        paramValueBuf.Zero();
+
+	        api->GetParamL( settingIdArray[i],
+								XmppParams::KXmppParamUsername(),
+	                            paramValueBuf );
+			aParams.SetUserName(paramValueBuf);
+	        paramValueBuf.Zero();
+
+	        api->GetParamL( settingIdArray[i],
+	        					XmppParams::KXmppParamPassword(),
+	                            paramValueBuf );
+			aParams.SetPasswd(paramValueBuf);
+	        paramValueBuf.Zero();
+
+	        api->GetParamL( settingIdArray[i],
+	        					XmppParams::KXmppParamResource(),
+	                            paramValueBuf );
+			aParams.SetResource(paramValueBuf);
+	        paramValueBuf.Zero();
+
+	        api->GetParamL( settingIdArray[i],
+	        					XmppParams::KXmppParamHttpsProxyServerAddress(),
+	                            paramValueBuf );
+			aParams.SetProxyServer(paramValueBuf);
+			paramValueBuf.Zero();
+
+	        api->GetParamL( settingIdArray[i],
+	        					XmppParams::KXmppParamConnMgrBus(),
+	                            paramValueBuf );
+			aParams.SetConnMgrBus(paramValueBuf);
+			paramValueBuf.Zero();
+
+	        api->GetParamL( settingIdArray[i],
+	        					XmppParams::KXmppParamConnMgrPath(),
+	                            paramValueBuf );
+			aParams.SetConnMgrPath(paramValueBuf);
+			paramValueBuf.Zero();
+
+	        api->GetParamL( settingIdArray[i],
+	        					XmppParams::KXmppParamProtocol(),
+	                            paramValueBuf );
+			aParams.SetProtocol(paramValueBuf);
+
+	        CleanupStack::PopAndDestroy( &paramValueBuf );
+			settingsFound = ETrue;
+	        break;
+        	}
+        }
+
+    CleanupStack::PopAndDestroy( &settingIdArray );
+    CleanupStack::PopAndDestroy( api );
+    if(!settingsFound)
+    	return KErrNotFound;
+    return KErrNone;
+    }
+
+// End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/xmppsettingsfetcher/tsrc/xmppsettingsfetchermt/bmarm/xmppsettingsfetchermtu.def	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,4 @@
+EXPORTS
+	LibEntryL__Fv @ 1 NONAME R3UNUSED ; LibEntryL(void)
+	SetRequirements__FRP16CTestModuleParamRUl @ 2 NONAME R3UNUSED ; SetRequirements(CTestModuleParam *&, unsigned long &)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/xmppsettingsfetcher/tsrc/xmppsettingsfetchermt/bwins/xmppsettingsfetchermtu.def	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,4 @@
+EXPORTS
+	?LibEntryL@@YAPAVCTestModuleBase@@XZ @ 1 NONAME ; class CTestModuleBase * __cdecl LibEntryL(void)
+	?SetRequirements@@YAHAAPAVCTestModuleParam@@AAK@Z @ 2 NONAME ; int __cdecl SetRequirements(class CTestModuleParam * &,unsigned long &)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/xmppsettingsfetcher/tsrc/xmppsettingsfetchermt/eabi/xmppsettingsfetchermtu.def	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,4 @@
+EXPORTS
+	_Z9LibEntryLv @ 1 NONAME
+	_Z15SetRequirementsRP16CTestModuleParamRm @ 2 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/xmppsettingsfetcher/tsrc/xmppsettingsfetchermt/group/bld.inf	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,57 @@
+/*
+* Copyright (c) 2002 - 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:  bld.inf
+*
+*/
+
+
+
+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_TESTEXPORTS
+// NOTE: If using ARS requirements all export operations should be done under this.
+// 'abld test export'
+
+PRJ_EXPORTS
+// Specify the source file followed by its destination here
+// copy will be used to copy the source file to its destination
+// If there's no destination then the source file will be copied
+// to the same name in /epoc32/include
+
+../init/TestFramework.ini /epoc32/winscw/c/TestFramework/TestFramework.ini
+
+PRJ_TESTMMPFILES
+// NOTE: If using ARS requirements .mmp file operation should be done under this.
+// 'abld test build'
+xmppsettingsfetchermt.mmp
+PRJ_MMPFILES
+// Specify the .mmp files required for building the important component
+// releasables.
+//
+// Specify "tidy" if the component you need to build doesn't need to be
+// released. Specify "ignore" if the MMP file exists but should be
+// ignored.
+// Example:
+/*
+/agnmodel/group/agnmodel.mmp
+#if defined(MARM)
+/agnmodel/group/agsvexe.mmp
+#endif
+*/
+
+
+//  End of File
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/xmppsettingsfetcher/tsrc/xmppsettingsfetchermt/group/xmppsettingfetcher_test.pkg	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,48 @@
+;
+; 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: xmppsettingfetcher_test.pkg
+;
+;Header
+#{"XmppSettingFetcher"}, (0x10202BE9), 1, 2, 3, TYPE=SP
+
+;Language - standard language definitions
+&EN
+
+;Vendor ID
+:"Nokia Corporation"
+
+;Localised vendor
+%{"Vendor-EN"}
+
+;Supports Series 60 v 0.9
+[0x101F7961], 0, 0, 0, {"Series60ProductID"}
+
+
+;rom will not allow to update it if name is testframework, after install need to rename it to testframework.ini
+;INI FILE
+"..\init\testframework.ini"        			-"c:\Testframework\ttestframework.ini"
+
+
+
+; Install keyspace in Central Repository private data cage
+"..\init\10282CE5.txt"                             -"c:\private\10202be9\10282CE5.txt"
+"..\init\1020E334.txt"                             -"c:\private\10202be9\1020E334.txt"
+"..\init\200195A9.txt"                             -"c:\private\10202be9\200195A9.txt"
+"..\init\2001B288.txt"                             -"c:\private\10202be9\2001B288.txt"
+
+
+;xmppsettingsfetchermt dll files
+
+"\EPOC32\RELEASE\ARMV5\UREL\xmppsettingsfetchermt.dll" 	-"!:\sys\bin\xmppsettingsfetchermt.dll"
+    
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/xmppsettingsfetcher/tsrc/xmppsettingsfetchermt/group/xmppsettingsfetchermt.mmp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,81 @@
+/*
+* Copyright (c) 2002 - 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:  xmppsettingsfetchermt.mmp
+*
+*/
+
+
+#if defined(__S60_)
+#include <platform_paths.hrh>
+#endif
+
+TARGET          xmppsettingsfetchermt.dll
+TARGETTYPE      dll
+UID             0x1000008D 0x101FB3E7
+
+//CAPABILITY      ALL -TCB
+CAPABILITY      CAP_ECOM_PLUGIN
+
+/* Remove comments and replace 0x00000000 with correct vendor id */
+// VENDORID     0x00000000
+/* Remove comments and replace 0x00000000 with correct secure id */
+// SECUREID     0x00000000
+
+//TARGETPATH      ?target_path
+DEFFILE         xmppsettingsfetchermt.def
+
+SOURCEPATH      ../src
+SOURCE          xmppsettingsfetchermt.cpp
+SOURCE          xmppsettingsfetchermtCases.cpp
+
+//RESOURCE        resource_file
+//RESOURCE        resource_file2
+
+USERINCLUDE     ../inc 
+USERINCLUDE     ../../../inc 
+
+MW_LAYER_SYSTEMINCLUDE
+
+
+
+
+LIBRARY         euser.lib
+LIBRARY         stiftestinterface.lib
+LIBRARY         stiftestengine.lib
+LIBRARY         jabbersettings.lib
+LIBRARY         xmppsettingsfetcher.lib
+
+LANG            SC
+
+/*
+START WINS      
+?wins_specific_information
+END
+
+START MARM
+?marm_specific_information
+END
+*/
+// Other possible keywords:
+ 
+// DOCUMENT     ?file, that is not compiled, but added to MSVC project workspace (i.e. release notes)
+/*
+START BITMAP ?target
+TARGETPATH   ?emulated_path_on_target_machine
+HEADER
+SOURCE       ?color_depth ?source_bitmap
+END
+*/
+// DEFFILE ?filename
+// AIF ?filename// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/xmppsettingsfetcher/tsrc/xmppsettingsfetchermt/inc/xmppsettingsfetchermt.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,372 @@
+/*
+* Copyright (c) 2002 - 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:  xmppsettingsfetchermt test module.
+*
+*/
+
+
+
+#ifndef XMPPSETTINGSFETCHERMT_H
+#define XMPPSETTINGSFETCHERMT_H
+
+// INCLUDES
+#include "StifTestModule.h"
+#include <StifLogger.h>
+#include "xmppparams.h"
+#include <xmppservicesettingsapi.h>
+
+// CONSTANTS
+//const ?type ?constant_var = ?constant;
+
+// MACROS
+//#define ?macro ?macro_def
+
+// Logging path
+_LIT( KxmppsettingsfetchermtLogPath, "\\logs\\testframework\\xmppsettingsfetchermt\\" ); 
+// Log file
+_LIT( KxmppsettingsfetchermtLogFile, "xmppsettingsfetchermt.txt" ); 
+_LIT( KxmppsettingsfetchermtLogFileWithTitle, "xmppsettingsfetchermt_[%S].txt" );
+
+#define GETPTR &
+#define ENTRY(str,func) {_S(str), GETPTR func,0,0,0}
+#define FUNCENTRY(func) {_S(#func), GETPTR func,0,0,0}
+#define OOM_ENTRY(str,func,a,b,c) {_S(str), GETPTR func,a,b,c}
+#define OOM_FUNCENTRY(func,a,b,c) {_S(#func), GETPTR func,a,b,c}
+
+// FUNCTION PROTOTYPES
+//?type ?function_name(?arg_list);
+
+// FORWARD DECLARATIONS
+//class ?FORWARD_CLASSNAME;
+class Cxmppsettingsfetchermt;
+class CXmppParameters;
+// DATA TYPES
+//enum ?declaration
+enum TTestCase
+    {
+    EPositiveTest,
+    EDescriptorTest,
+    EIntegerTest
+    };
+//typedef ?declaration
+//extern ?data_type;
+// A typedef for function that does the actual testing,
+// function is a type 
+// TInt Cxmppsettingsfetchermt::<NameOfFunction> ( TTestResult& aResult )
+typedef TInt (Cxmppsettingsfetchermt::* TestFunction)(TTestResult&);
+
+// CLASS DECLARATION
+
+/**
+*  An internal structure containing a test case name and
+*  the pointer to function doing the test
+*
+*  @lib ?library
+*  @since ?Series60_version
+*/
+class TCaseInfoInternal
+    {
+    public:
+        const TText*    iCaseName;
+        TestFunction    iMethod;
+        TBool           iIsOOMTest;
+        TInt            iFirstMemoryAllocation;
+        TInt            iLastMemoryAllocation;
+    };
+
+// CLASS DECLARATION
+
+/**
+*  A structure containing a test case name and
+*  the pointer to function doing the test
+*
+*  @lib ?library
+*  @since ?Series60_version
+*/
+class TCaseInfo
+    {
+    public:
+        TPtrC iCaseName;
+        TestFunction iMethod;
+        TBool           iIsOOMTest;
+        TInt            iFirstMemoryAllocation;
+        TInt            iLastMemoryAllocation;
+
+    TCaseInfo( const TText* a ) : iCaseName( (TText*) a )
+        {
+        };
+
+    };
+
+
+    _LIT( KTestcasePassed, "test case passed" );
+    _LIT( KTestcaseFailed, "test case failed" );
+    _LIT( KVerificationFailed, "Verification of data failed" );
+
+	//parameter values to set
+	const TInt port = 2020;
+    const TBool httpsProxyPort = 19;
+	const TInt iapId = 3;
+	
+	_LIT( KXmppServerAddress , "Test.Server.com");
+	_LIT( KUsername , "user@server.com");
+	_LIT( KPassword , "password");
+    
+// gabble specific things
+	_LIT( KResouceText , "resource");
+	_LIT( KHttpsProxyServerAddressText , "proxy.server.com");
+	_LIT( KAliasText , "alias");
+	_LIT( KConnMgrBus, "org.freedesktop.Telepathy.ConnectionManager.gabble" );
+	_LIT( KConnMgrPath, "/org/freedesktop/Telepathy/ConnectionManager/gabble" );
+	_LIT( KParamProtocol , "jabber" );
+    const TBool oldSSL = ETrue;
+    const TBool resigter = EFalse;
+
+// values for error cases
+	_LIT( KNullUsername , ""); //empty string
+	const TInt portNegative = -20;
+	const TInt iapIdZero = 0;
+
+    
+
+// CLASS DECLARATION
+
+/**
+*  This a xmppsettingsfetchermt class.
+*  ?other_description_lines
+*
+*  @lib ?library
+*  @since ?Series60_version
+*/
+NONSHARABLE_CLASS(Cxmppsettingsfetchermt) : public CTestModuleBase
+    {
+    public:  // Constructors and destructor
+
+
+        /**
+        * Two-phased constructor.
+        */
+        static Cxmppsettingsfetchermt* NewL();
+
+        /**
+        * Destructor.
+        */
+        virtual ~Cxmppsettingsfetchermt();
+
+    public: // New functions
+
+        /**
+        * ?member_description.
+        * @since ?Series60_version
+        * @param ?arg1 ?description
+        * @return ?description
+        */
+        //?type ?member_function( ?type ?arg1 );
+
+    public: // Functions from base classes
+
+        /**
+        * From CTestModuleBase InitL is used to initialize the 
+        *       xmppsettingsfetchermt. It is called once for every instance of 
+        *       TestModulexmppsettingsfetchermt after its creation.
+        * @since ?Series60_version
+        * @param aIniFile Initialization file for the test module (optional)
+        * @param aFirstTime Flag is true when InitL is executed for first 
+        *               created instance of xmppsettingsfetchermt.
+        * @return Symbian OS error code
+        */
+        TInt InitL( TFileName& aIniFile, TBool aFirstTime );
+
+        /**
+        * From CTestModuleBase GetTestCasesL is used to inquiry test cases 
+        *   from xmppsettingsfetchermt. 
+        * @since ?Series60_version
+        * @param aTestCaseFile Test case file (optional)
+        * @param aTestCases  Array of TestCases returned to test framework
+        * @return Symbian OS error code
+        */
+        TInt GetTestCasesL( const TFileName& aTestCaseFile, 
+                            RPointerArray<TTestCaseInfo>& aTestCases );
+
+        /**
+        * From CTestModuleBase RunTestCaseL is used to run an individual 
+        *   test case. 
+        * @since ?Series60_version
+        * @param aCaseNumber Test case number
+        * @param aTestCaseFile Test case file (optional)
+        * @param aResult Test case result returned to test framework (PASS/FAIL)
+        * @return Symbian OS error code (test case execution error, which is 
+        *           not reported in aResult parameter as test case failure).
+        */   
+        TInt RunTestCaseL( const TInt aCaseNumber, 
+                           const TFileName& aTestCaseFile,
+                           TTestResult& aResult );
+
+        /**
+        * From CTestModuleBase; OOMTestQueryL is used to specify is particular
+        * test case going to be executed using OOM conditions
+        * @param aTestCaseFile Test case file (optional)
+        * @param aCaseNumber Test case number (optional)
+        * @param aFailureType OOM failure type (optional)
+        * @param aFirstMemFailure The first heap memory allocation failure value (optional)
+        * @param aLastMemFailure The last heap memory allocation failure value (optional)
+        * @return TBool
+        */
+        virtual TBool OOMTestQueryL( const TFileName& /* aTestCaseFile */, 
+                                     const TInt /* aCaseNumber */, 
+                                     TOOMFailureType& aFailureType, 
+                                     TInt& /* aFirstMemFailure */, 
+                                     TInt& /* aLastMemFailure */ );
+
+        /**
+        * From CTestModuleBase; OOMTestInitializeL may be used to initialize OOM
+        * test environment
+        * @param aTestCaseFile Test case file (optional)
+        * @param aCaseNumber Test case number (optional)
+        * @return None
+        */
+        virtual void OOMTestInitializeL( const TFileName& /* aTestCaseFile */, 
+                                    const TInt /* aCaseNumber */ ); 
+
+        /**
+        * From CTestModuleBase; OOMHandleWarningL
+        * @param aTestCaseFile Test case file (optional)
+        * @param aCaseNumber Test case number (optional)
+        * @param aFailNextValue FailNextValue for OOM test execution (optional)
+        * @return None
+        *
+        * User may add implementation for OOM test warning handling. Usually no
+        * implementation is required.           
+        */
+        virtual void OOMHandleWarningL( const TFileName& /* aTestCaseFile */,
+                                        const TInt /* aCaseNumber */, 
+                                        TInt& /* aFailNextValue */); 
+
+        /**
+        * From CTestModuleBase; OOMTestFinalizeL may be used to finalize OOM
+        * test environment
+        * @param aTestCaseFile Test case file (optional)
+        * @param aCaseNumber Test case number (optional)
+        * @return None
+        *
+        */
+        virtual void OOMTestFinalizeL( const TFileName& /* aTestCaseFile */, 
+                                       const TInt /* aCaseNumber */ );
+
+    protected:  // New functions
+
+        /**
+        * ?member_description.
+        * @since ?Series60_version
+        * @param ?arg1 ?description
+        * @return ?description
+        */
+        //?type ?member_function( ?type ?arg1 );
+
+    protected:  // Functions from base classes
+
+        /**
+        * From ?base_class ?member_description
+        */
+        //?type ?member_function();
+
+    private:
+
+        /**
+        * C++ default constructor.
+        */
+        Cxmppsettingsfetchermt();
+
+        /**
+        * By default Symbian 2nd phase constructor is private.
+        */
+        void ConstructL();
+
+        // Prohibit copy constructor if not deriving from CBase.
+        // ?classname( const ?classname& );
+        // Prohibit assigment operator if not deriving from CBase.
+        // ?classname& operator=( const ?classname& );
+
+        /**
+        * Function returning test case name and pointer to test case function.
+        * @since ?Series60_version
+        * @param aCaseNumber test case number
+        * @return TCaseInfo 
+        */
+        const TCaseInfo Case ( const TInt aCaseNumber ) const;
+
+        /**
+        * [test case declarations] - do not remove
+        */
+        //ADD NEW METHOD DEC HERE"
+
+        /**
+        * Positive test case.
+        * @since ?Series60_version
+        * @param aResult Test case result (PASS/FAIL)
+        * @return Symbian OS error code (test case execution error 
+        *   that is not returned as test case result in aResult)
+        */
+        TInt SetAndReadSettingsL( TTestResult& aResult );
+        TInt ReadUnexistingSettingsL( TTestResult& aResult );
+        TInt ReadIncompleteSettingsL( TTestResult& aResult );
+        TInt ReadDescSettingsL( TTestResult& aResult );
+        TInt ReadIntSettingsL( TTestResult& aResult );
+
+		void WriteSettingsL( CXmppSettingsApi* aApi, TUint32 aSettingId, TTestCase aTestCase );
+		TBool VerifySettingsL( CXmppParameters* aXmppParams, TUint32 settingId, TTestCase aTestCase );
+		void WriteIncompleteSettingsL( CXmppSettingsApi* aApi, TUint32 aSettingId );
+
+    public:     // Data
+        // ?one_line_short_description_of_data
+        //?data_declaration;
+
+    protected:  // Data
+        // ?one_line_short_description_of_data
+        //?data_declaration;
+
+    private:    // Data
+        // Pointer to test (function) to be executed
+        TestFunction iMethod;
+
+        // Pointer to logger
+        CStifLogger * iLog; 
+
+        // Normal logger
+        CStifLogger* iStdLog;
+
+        // Test case logger
+        CStifLogger* iTCLog;
+
+        // Flag saying if test case title should be added to log file name
+        TBool iAddTestCaseTitleToLogName;
+
+        // ?one_line_short_description_of_data
+        //?data_declaration;
+
+        // Reserved pointer for future extension
+        //TAny* iReserved;
+
+    public:     // Friend classes
+        //?friend_class_declaration;
+    protected:  // Friend classes
+        //?friend_class_declaration;
+    private:    // Friend classes
+        //?friend_class_declaration;
+
+    };
+
+#endif      // XMPPSETTINGSFETCHERMT_H
+
+// End of File
Binary file imservices/xmppsettingsfetcher/tsrc/xmppsettingsfetchermt/init/1020E334.txt has changed
Binary file imservices/xmppsettingsfetcher/tsrc/xmppsettingsfetchermt/init/10282CE5.txt has changed
Binary file imservices/xmppsettingsfetcher/tsrc/xmppsettingsfetchermt/init/200195A9.txt has changed
Binary file imservices/xmppsettingsfetcher/tsrc/xmppsettingsfetchermt/init/2001B288.txt has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/xmppsettingsfetcher/tsrc/xmppsettingsfetchermt/init/TestFramework.ini	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,199 @@
+#
+# This is STIF initialization file
+# Comment lines start with '#'-character.
+# See STIF TestFramework users guide.doc for instructions
+
+# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+# Set following test engine settings:
+#	- Set Test Reporting mode. TestReportMode's possible values are:
+#		+ 'Summary': Summary of the tested test cases.
+#		+ 'Environment': Hardware and software info.
+#		+ 'TestCases': Test case report.
+#		+ 'FullReport': Set of all above ones.
+#		+ Example 'TestReportMode= Summary TestCases'
+#
+# 	- CreateTestReport setting controls report creation mode
+#		+ YES, Test report will created.
+#		+ NO, No Test report.
+#
+# 	- File path indicates the base path of the test report.
+# 	- File name indicates the name of the test report.
+#
+# 	- File format indicates the type of the test report.
+#		+ TXT, Test report file will be txt type, for example 'TestReport.txt'.
+#		+ HTML, Test report will be html type, for example 'TestReport.html'.
+#   + XML, Test report will be xml type, for example 'TestReport.xml'.
+#          Note, that xml format is available only when output is set to FILE.
+#
+# 	- File output indicates output source of the test report.
+#		+ FILE, Test report logging to file.
+#		+ RDEBUG, Test report logging to using rdebug.
+#
+# 	- File Creation Mode indicates test report overwriting if file exist.
+#		+ OVERWRITE, Overwrites if the Test report file exist.
+#		+ APPEND, Continue logging after the old Test report information if
+#                 report exist.
+# 	- Sets a device reset module's dll name(Reboot).
+#		+ If Nokia specific reset module is not available or it is not correct one
+#		  StifHWResetStub module may use as a template for user specific reset
+#		  module.
+# 	- Sets STIF test measurement disable options. e.g. pluging1 and pluging2 disablation
+#		DisableMeasurement= stifmeasurementplugin01 stifmeasurementplugin02
+#
+
+[Engine_Defaults]
+
+TestReportMode= FullReport    # Possible values are: 'Empty', 'Summary', 'Environment',
+                                                     'TestCases' or 'FullReport'
+
+CreateTestReport= YES         # Possible values: YES or NO
+
+TestReportFilePath= C:\LOGS\TestFramework\
+TestReportFileName= TestReport
+
+TestReportFormat= TXT         # Possible values: TXT, HTML or XML
+TestReportOutput= FILE        # Possible values: FILE or RDEBUG
+TestReportFileCreationMode= OVERWRITE # Possible values: OVERWRITE or APPEND
+
+DeviceResetDllName= StifResetForNokia.dll # e.g. 'StifHWResetStub.dll' for user specific reseting
+
+DisableMeasurement= stifmeasurementdisablenone  # Possible values are:
+              # 'stifmeasurementdisablenone', 'stifmeasurementdisableall'
+              # 'stifmeasurementplugin01', 'stifmeasurementplugin02',
+              # 'stifmeasurementplugin03', 'stifmeasurementplugin04',
+              # 'stifmeasurementplugin05' or 'stifbappeaprofiler'
+
+Timeout= 0                    # Default timeout value for each test case. In milliseconds
+#UITestingSupport= YES        # Possible values: YES or NO
+#SeparateProcesses= YES       # Possible values: YES or NO (default: NO)
+[End_Defaults]
+# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+
+
+
+# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+# Module configurations start
+# Modules are added between module tags
+# tags. Module name is specified after ModuleName= tag, like
+# ModuleName= XXXXXXXXX
+# Modules might have initialisation file, specified as
+# IniFile= c:\testframework\YYYYYY
+# Modules might have several configuration files, like
+# TestCaseFile= c:\testframework\NormalCases.txt
+# TestCaseFile= c:\testframework\SmokeCases.txt
+# TestCaseFile= c:\testframework\ManualCases.txt
+
+# (TestCaseFile is synonym for old term ConfigFile)
+
+# Following case specifies demo module settings. Demo module
+# does not read any settings from file, so tags 
+# IniFile and TestCaseFile are not used.
+# In the simplest case it is enough to specify only the
+# name of the test module when adding new test module
+
+[New_Module]
+ModuleName= xmppsettingsfetchermt.dll
+[End_Module]
+
+
+# Load testmoduleXXX, optionally with initialization file and/or test case files
+#[New_Module]
+#ModuleName= testmodulexxx
+
+#TestModuleXXX used initialization file
+#IniFile= c:\testframework\init.txt
+
+#TestModuleXXX used configuration file(s)
+#TestCaseFile= c:\testframework\testcases1.cfg
+#TestCaseFile= c:\testframework\testcases2.cfg
+#TestCaseFile= c:\testframework\manualtestcases.cfg
+
+#[End_Module]
+# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+
+
+
+# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+# Set STIF logging overwrite parameters for Logger.
+# 	Hardware and emulator environment logging path and styles can
+# 	be configured from here to overwrite the Logger's implemented values.
+#	
+#	Settings description:
+#	- Indicates option for creation log directory/directories. If log directory/directories
+#         is/are not created by user they will make by software.
+#		+ YES, Create log directory/directories if not allready exist.
+#		+ NO, Log directory/directories not created. Only created one is used.
+#
+#	- Overwrite emulator path setting.
+#		+ Example: If 'EmulatorBasePath= C:\LOGS\TestFramework\' and in code is defined 
+#		           Logger's path 'D:\\LOGS\\Module\\' with those definition the path
+#		           will be 'C:\LOGS\TestFramework\LOGS\Module\'
+#
+#	- Overwrite emulator's logging format.
+#		+ TXT, Log file(s) will be txt type(s), for example 'Module.txt'.
+#		+ HTML, Log file(s) will be html type(s), for example 'Module.html'.
+#
+#	- Overwrited emulator logging output source.
+#		+ FILE, Logging to file(s).
+#		+ RDEBUG, Logging to using rdebug(s).
+#
+#	- Overwrite hardware path setting (Same description as above in emulator path).
+#	- Overwrite hardware's logging format(Same description as above in emulator format).
+#	- Overwrite hardware's logging output source(Same description as above in emulator output).
+#
+#	- File Creation Mode indicates file overwriting if file exist.
+#		+ OVERWRITE, Overwrites if file(s) exist.
+#		+ APPEND, Continue logging after the old logging information if file(s) exist.
+#
+#	- Will thread id include to the log filename.
+#		+ YES, Thread id to log file(s) name, Example filename 'Module_b9.txt'.
+#		+ NO, No thread id to log file(s), Example filename 'Module.txt'.
+#
+#	- Will time stamps include the to log file.
+#		+ YES, Time stamp added to each line in log file(s). Time stamp is 
+#                 for example'12.Nov.2003 115958    LOGGING INFO'
+#		+ NO, No time stamp(s).
+#
+#	- Will line breaks include to the log file.
+#		+ YES, Each logging event includes line break and next log event is in own line.
+#		+ NO, No line break(s).
+#
+#	- Will event ranking include to the log file.
+#		+ YES, Event ranking number added to each line in log file(s). Ranking number
+#                 depends on environment's tics, for example(includes time stamp also)
+#                 '012   12.Nov.2003 115958    LOGGING INFO'
+#		+ NO, No event ranking.
+#
+#	- Will write log file in unicode format.
+#		+ YES, Log file will be written in unicode format
+#		+ NO, Log will be written as normal, not unicode, file.
+#
+
+[Logger_Defaults]
+
+#NOTE: If you want to set Logger using next setting(s) remove comment(s)'#'
+#NOTE: TestEngine and TestServer logging settings cannot change here
+
+#CreateLogDirectories= YES    # Possible values: YES or NO
+
+#EmulatorBasePath= C:\LOGS\TestFramework\
+#EmulatorFormat= HTML         # Possible values: TXT or HTML
+#EmulatorOutput= FILE         # Possible values: FILE or RDEBUG
+
+#HardwareBasePath= D:\LOGS\TestFramework\
+#HardwareFormat= HTML         # Possible values: TXT or HTML
+#HardwareOutput= FILE         # Possible values: FILE or RDEBUG
+
+#FileCreationMode= OVERWRITE  # Possible values: OVERWRITE or APPEND
+
+#ThreadIdToLogFile= YES       # Possible values: YES or NO
+#WithTimeStamp= YES           # Possible values: YES or NO
+#WithLineBreak= YES           # Possible values: YES or NO
+#WithEventRanking= YES        # Possible values: YES or NO
+
+#FileUnicode= YES             # Possible values: YES or NO
+#AddTestCaseTitle= YES        # Possible values: YES or NO
+[End_Logger_Defaults]
+# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+
+# End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/xmppsettingsfetcher/tsrc/xmppsettingsfetchermt/src/xmppsettingsfetchermt.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,418 @@
+/*
+* Copyright (c) 2002 - 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:  xmppsettingsfetchermt class member functions
+*
+*/
+
+
+
+// [INCLUDE FILES] - do not remove
+#include <StifTestInterface.h>
+#include "xmppsettingsfetchermt.h"
+#include <SettingServerClient.h>
+
+// EXTERNAL DATA STRUCTURES
+//extern  ?external_data;
+
+// EXTERNAL FUNCTION PROTOTYPES  
+//extern ?external_function( ?arg_type,?arg_type );
+
+// CONSTANTS
+//const ?type ?constant_var = ?constant;
+
+// MACROS
+//#define ?macro ?macro_def
+
+// LOCAL CONSTANTS AND MACROS
+//const ?type ?constant_var = ?constant;
+//#define ?macro_name ?macro_def
+
+// MODULE DATA STRUCTURES
+//enum ?declaration
+//typedef ?declaration
+
+// LOCAL FUNCTION PROTOTYPES
+//?type ?function_name( ?arg_type, ?arg_type );
+
+// FORWARD DECLARATIONS
+//class ?FORWARD_CLASSNAME;
+
+// ============================= LOCAL FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// ?function_name ?description.
+// ?description
+// Returns: ?value_1: ?description
+//          ?value_n: ?description_line1
+//                    ?description_line2
+// -----------------------------------------------------------------------------
+//
+/*
+?type ?function_name(
+    ?arg_type arg,  // ?description
+    ?arg_type arg)  // ?description
+    {
+
+    ?code  // ?comment
+
+    // ?comment
+    ?code
+    }
+*/
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// Cxmppsettingsfetchermt::Cxmppsettingsfetchermt
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+Cxmppsettingsfetchermt::Cxmppsettingsfetchermt()
+    {
+
+    }
+
+// -----------------------------------------------------------------------------
+// Cxmppsettingsfetchermt::ConstructL
+// Symbian 2nd phase constructor can leave.
+//
+// Note: If OOM test case uses STIF Logger, then STIF Logger must be created
+// with static buffer size parameter (aStaticBufferSize). Otherwise Logger 
+// allocates memory from heap and therefore causes error situations with OOM 
+// testing. For more information about STIF Logger construction, see STIF Users 
+// Guide.
+// -----------------------------------------------------------------------------
+//
+void Cxmppsettingsfetchermt::ConstructL()
+    {
+    //Read logger settings to check whether test case name is to be
+    //appended to log file name.
+    RSettingServer settingServer;
+    TInt ret = settingServer.Connect();
+    if(ret != KErrNone)
+        {
+        User::Leave(ret);
+        }
+    // Struct to StifLogger settigs.
+    TLoggerSettings loggerSettings; 
+    // Parse StifLogger defaults from STIF initialization file.
+    ret = settingServer.GetLoggerSettings(loggerSettings);
+    if(ret != KErrNone)
+        {
+        User::Leave(ret);
+        } 
+    // Close Setting server session
+    settingServer.Close();
+    iAddTestCaseTitleToLogName = loggerSettings.iAddTestCaseTitle;
+
+    iStdLog = CStifLogger::NewL( KxmppsettingsfetchermtLogPath, 
+                          KxmppsettingsfetchermtLogFile);
+    iLog = iStdLog;
+
+    // Sample how to use logging
+    _LIT( KLogStart, "xmppsettingsfetchermt logging starts!" );
+    iLog->Log( KLogStart );
+
+    }
+
+// -----------------------------------------------------------------------------
+// Cxmppsettingsfetchermt::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+Cxmppsettingsfetchermt* Cxmppsettingsfetchermt::NewL()
+    {
+    Cxmppsettingsfetchermt* self = new (ELeave) Cxmppsettingsfetchermt;
+
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+
+    return self;
+
+    }
+
+// Destructor
+Cxmppsettingsfetchermt::~Cxmppsettingsfetchermt()
+    {
+    iLog = NULL;
+    delete iStdLog;
+    iStdLog = NULL;
+    delete iTCLog;
+    iTCLog = NULL;
+    }
+
+// -----------------------------------------------------------------------------
+// Cxmppsettingsfetchermt::InitL
+// InitL is used to initialize the Test Module.
+// -----------------------------------------------------------------------------
+//
+TInt Cxmppsettingsfetchermt::InitL( 
+    TFileName& /*aIniFile*/, 
+    TBool /*aFirstTime*/ )
+    {
+    return KErrNone;
+
+    }
+
+// -----------------------------------------------------------------------------
+// Cxmppsettingsfetchermt::GetTestCasesL
+// GetTestCases is used to inquire test cases from the Test Module. Test
+// cases are stored to array of test cases. The Test Framework will be 
+// the owner of the data in the RPointerArray after GetTestCases return
+// and it does the memory deallocation. 
+// -----------------------------------------------------------------------------
+//
+TInt Cxmppsettingsfetchermt::GetTestCasesL( 
+    const TFileName& /*aConfig*/, 
+    RPointerArray<TTestCaseInfo>& aTestCases )
+    {
+
+    // Loop through all test cases and create new
+    // TTestCaseInfo items and append items to aTestCase array    
+    for( TInt i = 0; Case(i).iMethod != NULL; i++ )
+        {
+
+        // Allocate new TTestCaseInfo from heap for a testcase definition.
+        TTestCaseInfo* newCase = new( ELeave ) TTestCaseInfo();
+
+        // PushL TTestCaseInfo to CleanupStack.    
+        CleanupStack::PushL( newCase );
+
+        // Set number for the testcase.
+        // When the testcase is run, this comes as a parameter to RunTestCaseL.
+        newCase->iCaseNumber = i;
+
+        // Set title for the test case. This is shown in UI to user.
+        newCase->iTitle.Copy( Case(i).iCaseName );
+
+        // Append TTestCaseInfo to the testcase array. After appended 
+        // successfully the TTestCaseInfo object is owned (and freed) 
+        // by the TestServer. 
+        User::LeaveIfError(aTestCases.Append ( newCase ) );
+
+        // Pop TTestCaseInfo from the CleanupStack.
+        CleanupStack::Pop( newCase );
+
+        }
+
+    return KErrNone;
+
+    }
+
+// -----------------------------------------------------------------------------
+// Cxmppsettingsfetchermt::RunTestCaseL
+// RunTestCaseL is used to run an individual test case specified 
+// by aTestCase. Test cases that can be run may be requested from 
+// Test Module by GetTestCases method before calling RunTestCase.
+// -----------------------------------------------------------------------------
+//
+TInt Cxmppsettingsfetchermt::RunTestCaseL( 
+    const TInt aCaseNumber,   
+    const TFileName& /*aConfig*/,
+    TTestResult& aResult )
+    {
+
+    // Return value
+    TInt execStatus = KErrNone;
+
+    // Get the pointer to test case function
+    TCaseInfo tmp = Case ( aCaseNumber );
+
+    _LIT( KLogStartTC, "Starting testcase [%S]" );
+    iLog->Log( KLogStartTC, &tmp.iCaseName);
+
+    // Check that case number was valid
+    if ( tmp.iMethod != NULL )
+        {
+        //Open new log file with test case title in file name
+        if(iAddTestCaseTitleToLogName)
+            {
+            //Delete test case logger if exists
+            if(iTCLog)
+                {
+                delete iTCLog;
+                iTCLog = NULL;
+                }
+
+            TFileName logFileName;
+            TName title;
+            TestModuleIf().GetTestCaseTitleL(title);
+        
+            logFileName.Format(KxmppsettingsfetchermtLogFileWithTitle, &title);
+
+            iTCLog = CStifLogger::NewL(KxmppsettingsfetchermtLogPath, 
+                                       logFileName);
+            iLog = iTCLog;                                       
+            }
+
+        // Valid case was found, call it via function pointer
+        iMethod = tmp.iMethod;        
+        //execStatus  = ( this->*iMethod )( aResult );
+        TRAPD(err, execStatus  = ( this->*iMethod )( aResult ));
+        if(iAddTestCaseTitleToLogName)
+            {
+            //Restore standard log and destroy test case logger
+            iLog = iStdLog;
+            delete iTCLog; //Close test case log
+            iTCLog = NULL;
+            }
+        User::LeaveIfError(err);
+        }
+    else
+        {
+        // Valid case was not found, return error.
+        execStatus = KErrNotFound;
+        }
+
+    // Return case execution status (not the result of the case execution)
+    return execStatus;
+
+    }
+
+// -----------------------------------------------------------------------------
+// Cxmppsettingsfetchermt::OOMTestQueryL
+// Used to check if a particular test case should be run in OOM conditions and 
+// which memory allocations should fail.    
+// -----------------------------------------------------------------------------
+//
+TBool Cxmppsettingsfetchermt::OOMTestQueryL( 
+                                const TFileName& /* aTestCaseFile */, 
+                                const TInt aCaseNumber, 
+                                TOOMFailureType& /* aFailureType */, 
+                                TInt& aFirstMemFailure, 
+                                TInt& aLastMemFailure ) 
+    {
+    _LIT( KLogOOMTestQueryL, "Cxmppsettingsfetchermt::OOMTestQueryL" );
+    iLog->Log( KLogOOMTestQueryL );     
+
+    aFirstMemFailure = Case( aCaseNumber ).iFirstMemoryAllocation;
+    aLastMemFailure = Case( aCaseNumber ).iLastMemoryAllocation;
+
+    return Case( aCaseNumber ).iIsOOMTest;
+
+    }
+
+// -----------------------------------------------------------------------------
+// Cxmppsettingsfetchermt::OOMTestInitializeL
+// Used to perform the test environment setup for a particular OOM test case. 
+// Test Modules may use the initialization file to read parameters for Test 
+// Module initialization but they can also have their own configure file or 
+// some other routine to initialize themselves.  
+//
+// NOTE: User may add implementation for OOM test environment initialization.
+// Usually no implementation is required.
+// -----------------------------------------------------------------------------
+//
+void Cxmppsettingsfetchermt::OOMTestInitializeL( 
+                                const TFileName& /* aTestCaseFile */, 
+                                const TInt /* aCaseNumber */ )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// Cxmppsettingsfetchermt::OOMHandleWarningL
+// In some cases the heap memory allocation should be skipped, either due to
+// problems in the OS code or components used by the code being tested, or even 
+// inside the tested components which are implemented this way on purpose (by 
+// design), so it is important to give the tester a way to bypass allocation 
+// failures.
+//
+// NOTE: User may add implementation for OOM test warning handling. Usually no
+// implementation is required.
+// -----------------------------------------------------------------------------
+//
+void Cxmppsettingsfetchermt::OOMHandleWarningL( 
+                                const TFileName& /* aTestCaseFile */,
+                                const TInt /* aCaseNumber */, 
+                                TInt& /* aFailNextValue */ )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// Cxmppsettingsfetchermt::OOMTestFinalizeL
+// Used to perform the test environment cleanup for a particular OOM test case.
+//
+// NOTE: User may add implementation for OOM test environment finalization.
+// Usually no implementation is required.
+// -----------------------------------------------------------------------------
+//
+void Cxmppsettingsfetchermt::OOMTestFinalizeL( 
+                                const TFileName& /* aTestCaseFile */, 
+                                const TInt /* aCaseNumber */ )
+    {
+    }
+
+// ========================== OTHER EXPORTED FUNCTIONS =========================
+
+// -----------------------------------------------------------------------------
+// LibEntryL is a polymorphic Dll entry point
+// Returns: CTestModuleBase*: Pointer to Test Module object
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CTestModuleBase* LibEntryL()
+    {
+    return Cxmppsettingsfetchermt::NewL();
+
+    }
+
+// -----------------------------------------------------------------------------
+// SetRequirements handles test module parameters(implements evolution
+// version 1 for test module's heap and stack sizes configuring).
+// Returns: TInt: Symbian error code.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt SetRequirements( CTestModuleParam*& /*aTestModuleParam*/, 
+                                TUint32& /*aParameterValid*/ )
+    {
+
+    /* --------------------------------- NOTE ---------------------------------
+    USER PANICS occurs in test thread creation when:
+    1) "The panic occurs when the value of the stack size is negative."
+    2) "The panic occurs if the minimum heap size specified is less
+       than KMinHeapSize".
+       KMinHeapSize: "Functions that require a new heap to be allocated will
+       either panic, or will reset the required heap size to this value if
+       a smaller heap size is specified".
+    3) "The panic occurs if the minimum heap size specified is greater than
+       the maximum size to which the heap can grow".
+    Other:
+    1) Make sure that your hardware or Symbian OS is supporting given sizes.
+       e.g. Hardware might support only sizes that are divisible by four.
+    ------------------------------- NOTE end ------------------------------- */
+
+    // Normally STIF uses default heap and stack sizes for test thread, see:
+    // KTestThreadMinHeap, KTestThreadMinHeap and KStackSize.
+    // If needed heap and stack sizes can be configured here by user. Remove
+    // comments and define sizes.
+
+/*
+    aParameterValid = KStifTestModuleParameterChanged;
+
+    CTestModuleParamVer01* param = CTestModuleParamVer01::NewL();
+    // Stack size
+    param->iTestThreadStackSize= 16384; // 16K stack
+    // Heap sizes
+    param->iTestThreadMinHeap = 4096;   // 4K heap min
+    param->iTestThreadMaxHeap = 1048576;// 1M heap max
+
+    aTestModuleParam = param;
+*/
+    return KErrNone;
+
+    }
+
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imservices/xmppsettingsfetcher/tsrc/xmppsettingsfetchermt/src/xmppsettingsfetchermtCases.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,514 @@
+/*
+* Copyright (c) 2002 - 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:  xmppsettingsfetchermtCases.cpp
+*
+*/
+
+
+
+// [INCLUDE FILES] - do not remove
+#include <e32math.h>
+#include "xmppsettingsfetchermt.h"
+#include "xmppsettingsfetcher.h"
+#include "xmppparameters.h"
+
+// EXTERNAL DATA STRUCTURES
+//extern  ?external_data;
+
+// EXTERNAL FUNCTION PROTOTYPES  
+//extern ?external_function( ?arg_type,?arg_type );
+
+// CONSTANTS
+//const ?type ?constant_var = ?constant;
+
+// MACROS
+//#define ?macro ?macro_def
+
+// LOCAL CONSTANTS AND MACROS
+//const ?type ?constant_var = ?constant;
+//#define ?macro_name ?macro_def
+
+// MODULE DATA STRUCTURES
+//enum ?declaration
+//typedef ?declaration
+
+// LOCAL FUNCTION PROTOTYPES
+//?type ?function_name( ?arg_type, ?arg_type );
+
+// FORWARD DECLARATIONS
+//class ?FORWARD_CLASSNAME;
+
+// ============================= LOCAL FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// ?function_name ?description.
+// ?description
+// Returns: ?value_1: ?description
+//          ?value_n: ?description_line1
+//                    ?description_line2
+// -----------------------------------------------------------------------------
+//
+/*
+?type ?function_name(
+    ?arg_type arg,  // ?description
+    ?arg_type arg)  // ?description
+    {
+
+    ?code  // ?comment
+
+    // ?comment
+    ?code
+    }
+*/
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// Cxmppsettingsfetchermt::Case
+// Returns a test case by number.
+//
+// This function contains an array of all available test cases 
+// i.e pair of case name and test function. If case specified by parameter
+// aCaseNumber is found from array, then that item is returned.
+// 
+// The reason for this rather complicated function is to specify all the
+// test cases only in one place. It is not necessary to understand how
+// function pointers to class member functions works when adding new test
+// cases. See function body for instructions how to add new test case.
+// -----------------------------------------------------------------------------
+//
+const TCaseInfo Cxmppsettingsfetchermt::Case ( 
+    const TInt aCaseNumber ) const 
+     {
+
+    /**
+    * To add new test cases, implement new test case function and add new 
+    * line to KCases array specify the name of the case and the function 
+    * doing the test case
+    * In practice, do following
+    * 1) Make copy of existing test case function and change its name
+    *    and functionality. Note that the function must be added to 
+    *    xmppsettingsfetchermt.cpp file and to xmppsettingsfetchermt.h 
+    *    header file.
+    *
+    * 2) Add entry to following KCases array either by using:
+    *
+    * 2.1: FUNCENTRY or ENTRY macro
+    * ENTRY macro takes two parameters: test case name and test case 
+    * function name.
+    *
+    * FUNCENTRY macro takes only test case function name as a parameter and
+    * uses that as a test case name and test case function name.
+    *
+    * Or
+    *
+    * 2.2: OOM_FUNCENTRY or OOM_ENTRY macro. Note that these macros are used
+    * only with OOM (Out-Of-Memory) testing!
+    *
+    * OOM_ENTRY macro takes five parameters: test case name, test case 
+    * function name, TBool which specifies is method supposed to be run using
+    * OOM conditions, TInt value for first heap memory allocation failure and 
+    * TInt value for last heap memory allocation failure.
+    * 
+    * OOM_FUNCENTRY macro takes test case function name as a parameter and uses
+    * that as a test case name, TBool which specifies is method supposed to be
+    * run using OOM conditions, TInt value for first heap memory allocation 
+    * failure and TInt value for last heap memory allocation failure. 
+    */ 
+
+    static TCaseInfoInternal const KCases[] =
+        {
+        // [test cases entries] - do not remove
+        
+        // NOTE: When compiled to GCCE, there must be Classname::
+        // declaration in front of the method name, e.g. 
+        // Cxmppsettingsfetchermt::PrintTest. Otherwise the compiler
+        // gives errors.
+        
+        ENTRY( "write and read valid settings", Cxmppsettingsfetchermt::SetAndReadSettingsL ),
+        ENTRY( "read unexisting settings", Cxmppsettingsfetchermt::ReadUnexistingSettingsL ),
+        ENTRY( "write and read incomplete settings", Cxmppsettingsfetchermt::ReadIncompleteSettingsL ),
+        ENTRY( "descriptor values test", Cxmppsettingsfetchermt::ReadDescSettingsL ),
+        ENTRY( "integer values test", Cxmppsettingsfetchermt::ReadIntSettingsL ),
+
+//        FUNCENTRY( Cxmppsettingsfetchermt::PrintTest ),
+
+        // Example how to use OOM functionality
+        //OOM_ENTRY( "Loop test with OOM", Cxmppsettingsfetchermt::LoopTest, ETrue, 2, 3),
+        //OOM_FUNCENTRY( Cxmppsettingsfetchermt::PrintTest, ETrue, 1, 3 ),
+        };
+
+    // Verify that case number is valid
+    if( (TUint) aCaseNumber >= sizeof( KCases ) / 
+                               sizeof( TCaseInfoInternal ) )
+        {
+        // Invalid case, construct empty object
+        TCaseInfo null( (const TText*) L"" );
+        null.iMethod = NULL;
+        null.iIsOOMTest = EFalse;
+        null.iFirstMemoryAllocation = 0;
+        null.iLastMemoryAllocation = 0;
+        return null;
+        } 
+
+    // Construct TCaseInfo object and return it
+    TCaseInfo tmp ( KCases[ aCaseNumber ].iCaseName );
+    tmp.iMethod = KCases[ aCaseNumber ].iMethod;
+    tmp.iIsOOMTest = KCases[ aCaseNumber ].iIsOOMTest;
+    tmp.iFirstMemoryAllocation = KCases[ aCaseNumber ].iFirstMemoryAllocation;
+    tmp.iLastMemoryAllocation = KCases[ aCaseNumber ].iLastMemoryAllocation;
+    return tmp;
+
+    }
+
+// -----------------------------------------------------------------------------
+// Cxmppsettingsfetchermt::LoopTest
+// Another printing to UI test.
+// -----------------------------------------------------------------------------
+//
+TInt Cxmppsettingsfetchermt::SetAndReadSettingsL( TTestResult& aResult )
+    {
+    TUint32 settingId = 0;
+    CXmppSettingsApi* api = CXmppSettingsApi::NewLC();
+
+    TRAPD( error, api->CreateSettingsRecordL( settingId ) );
+    User::LeaveIfError( error );
+	
+	WriteSettingsL( api, settingId, EPositiveTest );
+    CleanupStack::PopAndDestroy( api );
+	
+    CXmppParameters* xmppParams = CXmppParameters::NewL();
+    CleanupStack::PushL( xmppParams );
+    CXmppSettingsFetcher::ReadSettingsL( settingId, *xmppParams );
+    
+    //verify that all settings read are correct
+    TBool verify = VerifySettingsL( xmppParams, settingId, EPositiveTest );
+    CleanupStack::PopAndDestroy( xmppParams );
+    
+    // Sets test case result and description(Maximum size is KStifMaxResultDes)
+    if(verify)
+    	aResult.SetResult( KErrNone, KTestcasePassed );
+    else
+    	aResult.SetResult( KErrGeneral, KVerificationFailed );
+
+    // Case was executed
+    return KErrNone;
+    }
+
+
+TInt Cxmppsettingsfetchermt::ReadUnexistingSettingsL( TTestResult& aResult )
+    {
+    CXmppParameters* xmppParams = CXmppParameters::NewL();
+    CleanupStack::PushL( xmppParams );
+    CXmppSettingsFetcher::ReadSettingsL( 9999, *xmppParams ); //assuming 9999 records have not been created :)
+    
+    // Sets test case result and description(Maximum size is KStifMaxResultDes)
+    CleanupStack::PopAndDestroy( xmppParams );
+	aResult.SetResult( KErrNone, KTestcasePassed );
+
+    // Case was executed
+    return KErrNone;
+    }
+
+
+TInt Cxmppsettingsfetchermt::ReadIncompleteSettingsL( TTestResult& aResult )
+    {
+    TUint32 settingId = 0;
+    CXmppSettingsApi* api = CXmppSettingsApi::NewLC();
+
+    TRAPD( error, api->CreateSettingsRecordL( settingId ) );
+    User::LeaveIfError( error );
+	
+	WriteIncompleteSettingsL( api, settingId );
+    CleanupStack::PopAndDestroy( api );
+	
+    CXmppParameters* xmppParams = CXmppParameters::NewL();
+    CleanupStack::PushL( xmppParams );
+    TRAP( error, CXmppSettingsFetcher::ReadSettingsL( settingId, *xmppParams ) );
+    CleanupStack::PopAndDestroy( xmppParams );
+    
+    // Sets test case result and description(Maximum size is KStifMaxResultDes)
+    if( error == KErrNotFound )
+    	aResult.SetResult( KErrNone, KTestcasePassed );
+    else
+    	aResult.SetResult( KErrGeneral, KTestcaseFailed );
+
+    // Case was executed
+    return KErrNone;
+    }
+
+
+TInt Cxmppsettingsfetchermt::ReadDescSettingsL( TTestResult& aResult )
+    {
+    TUint32 settingId = 0;
+    CXmppSettingsApi* api = CXmppSettingsApi::NewLC();
+
+    TRAPD( error, api->CreateSettingsRecordL( settingId ) );
+    User::LeaveIfError( error );
+	
+	WriteSettingsL( api, settingId, EDescriptorTest );
+    CleanupStack::PopAndDestroy( api );
+	
+    CXmppParameters* xmppParams = CXmppParameters::NewL();
+    CleanupStack::PushL( xmppParams );
+    CXmppSettingsFetcher::ReadSettingsL( settingId, *xmppParams );
+    
+    //verify that all settings read are correct
+    TBool verify = VerifySettingsL( xmppParams, settingId, EDescriptorTest );
+    CleanupStack::PopAndDestroy( xmppParams );
+    
+    // Sets test case result and description(Maximum size is KStifMaxResultDes)
+    if(verify)
+    	aResult.SetResult( KErrNone, KTestcasePassed );
+    else
+    	aResult.SetResult( KErrGeneral, KVerificationFailed );
+
+    // Case was executed
+    return KErrNone;
+    }
+
+
+TInt Cxmppsettingsfetchermt::ReadIntSettingsL( TTestResult& aResult )
+    {
+    TUint32 settingId = 0;
+    CXmppSettingsApi* api = CXmppSettingsApi::NewLC();
+
+    TRAPD( error, api->CreateSettingsRecordL( settingId ) );
+    User::LeaveIfError( error );
+	
+	WriteSettingsL( api, settingId, EIntegerTest );
+    CleanupStack::PopAndDestroy( api );
+	
+    CXmppParameters* xmppParams = CXmppParameters::NewL();
+    CleanupStack::PushL( xmppParams );
+    CXmppSettingsFetcher::ReadSettingsL( settingId, *xmppParams );
+    
+    //verify that all settings read are correct
+    TBool verify = VerifySettingsL( xmppParams, settingId, EIntegerTest );
+    CleanupStack::PopAndDestroy( xmppParams );
+    
+    // Sets test case result and description(Maximum size is KStifMaxResultDes)
+    if(verify)
+    	aResult.SetResult( KErrNone, KTestcasePassed );
+    else
+    	aResult.SetResult( KErrGeneral, KVerificationFailed );
+
+    // Case was executed
+    return KErrNone;
+    }
+
+
+void Cxmppsettingsfetchermt::WriteSettingsL( CXmppSettingsApi* aApi, TUint32 aSettingId, TTestCase aTestCase )
+{
+	TInt error = KErrNone;
+	
+    TRAP( error, aApi->SetParamL( aSettingId,
+                                              XmppParams::KXmppParamHttpsProxyServerPort(),
+                                              httpsProxyPort ) );
+	if( aTestCase == EIntegerTest )	//integer test
+		{
+	    TRAP( error, aApi->SetParamL( aSettingId,
+	                                              XmppParams::KXmppParamServerPort(),
+	                                              portNegative ) ); //negative value
+	    TRAP( error, aApi->SetParamL( aSettingId,
+	                                              XmppParams::KXmppParamSnapId(),
+	                                              iapIdZero ) ); //zero
+		}
+	else
+		{
+	    TRAP( error, aApi->SetParamL( aSettingId,
+	                                              XmppParams::KXmppParamServerPort(),
+	                                              port ) );
+	    TRAP( error, aApi->SetParamL( aSettingId,
+	                                              XmppParams::KXmppParamSnapId(),
+	                                              iapId ) );
+		}	
+
+    // buffers
+    TRAP( error, aApi->SetParamL( aSettingId,
+                                              XmppParams::KXmppParamXmppServerAddress(),
+                                              KXmppServerAddress ) );
+
+	if( aTestCase == EDescriptorTest )	//descriptor test
+		{
+	    TRAP( error, aApi->SetParamL( aSettingId,
+	                                              XmppParams::KXmppParamUsername(),
+	                                              KNullUsername ) ); //empty string
+	    TRAP( error, aApi->SetParamL( aSettingId,
+	                                              XmppParams::KXmppParamPassword(),
+	                                              KNullDesC ) ); //null descriptor
+		}
+    else
+	    {
+	    TRAP( error, aApi->SetParamL( aSettingId,
+	                                              XmppParams::KXmppParamUsername(),
+	                                              KUsername ) );
+	    TRAP( error, aApi->SetParamL( aSettingId,
+	                                              XmppParams::KXmppParamPassword(),
+	                                              KPassword ) );
+	    }
+
+	// gabble specific things.........
+    TRAP( error, aApi->SetParamL( aSettingId,
+                                              XmppParams::KXmppParamResource(),
+                                              KResouceText ) );
+    TRAP( error, aApi->SetParamL( aSettingId,
+                                              XmppParams::KXmppParamHttpsProxyServerAddress(),
+                                              KHttpsProxyServerAddressText ) );
+    TRAP( error, aApi->SetParamL( aSettingId,
+                                              XmppParams::KXmppParamAlais(),
+                                              KAliasText ) );
+    TRAP( error, aApi->SetParamL( aSettingId,
+                                              XmppParams::KXmppParamOldSSLRequired(),
+                                              oldSSL ) );
+    TRAP( error, aApi->SetParamL( aSettingId,
+                                              XmppParams::KXmppParamRegisterRequired(),
+                                              resigter ) );
+    TRAP( error, aApi->SetParamL( aSettingId,
+                                  XmppParams::KXmppParamConnMgrBus(),
+                                  KConnMgrBus ) );
+                                  
+    TRAP( error, aApi->SetParamL( aSettingId,
+                                  XmppParams::KXmppParamConnMgrPath(),
+                                  KConnMgrPath ));
+    
+    TRAP( error, aApi->SetParamL( aSettingId,
+                                              XmppParams::KXmppParamProtocol(),
+                                              KParamProtocol ));
+
+    }
+
+
+TBool Cxmppsettingsfetchermt::VerifySettingsL( CXmppParameters* aXmppParams, TUint32 aSettingsId, TTestCase aTestCase )
+{
+	switch (aTestCase)
+		{
+		case EPositiveTest:
+			if ( 
+				( aXmppParams->SettingsId() == aSettingsId ) &&
+				( aXmppParams->ServerPort() == port ) &&
+				( aXmppParams->ProxyPort() == httpsProxyPort ) &&
+				( aXmppParams->IapId() == iapId ) &&
+				( aXmppParams->ServerAddress() == KXmppServerAddress ) &&
+				( aXmppParams->UserName() == KUsername ) &&
+				( aXmppParams->Passwd() == KPassword ) &&
+				( aXmppParams->Resource() == KResouceText ) &&
+				( aXmppParams->ProxyServer() == KHttpsProxyServerAddressText ) &&
+				( aXmppParams->Ssl() == oldSSL )
+			   )
+				return ETrue;
+			else
+				return EFalse;	
+		case EDescriptorTest:
+			if ( 
+				( aXmppParams->SettingsId() == aSettingsId ) &&
+				( aXmppParams->ServerPort() == port ) &&
+				( aXmppParams->ProxyPort() == httpsProxyPort ) &&
+				( aXmppParams->IapId() == iapId ) &&
+				( aXmppParams->ServerAddress() == KXmppServerAddress ) &&
+				( aXmppParams->UserName() == KNullUsername ) && //empty string
+				( aXmppParams->Passwd() == KNullDesC ) && //null descriptor
+				( aXmppParams->Resource() == KResouceText ) &&
+				( aXmppParams->ProxyServer() == KHttpsProxyServerAddressText ) &&
+				( aXmppParams->Ssl() == oldSSL )
+			   )
+				return ETrue;
+			else
+				return EFalse;	
+		case EIntegerTest:
+			if ( 
+				( aXmppParams->SettingsId() == aSettingsId ) &&
+				( aXmppParams->ServerPort() == portNegative ) && //negative
+				( aXmppParams->ProxyPort() == httpsProxyPort ) && 
+				( aXmppParams->IapId() == iapIdZero ) && //zero
+				( aXmppParams->ServerAddress() == KXmppServerAddress ) &&
+				( aXmppParams->UserName() == KUsername ) &&
+				( aXmppParams->Passwd() == KPassword ) &&
+				( aXmppParams->Resource() == KResouceText ) &&
+				( aXmppParams->ProxyServer() == KHttpsProxyServerAddressText ) &&
+				( aXmppParams->Ssl() == oldSSL )
+			   )
+				return ETrue;
+			else
+				return EFalse;	
+		}
+	return EFalse;
+ }
+
+
+void Cxmppsettingsfetchermt::WriteIncompleteSettingsL( CXmppSettingsApi* aApi, TUint32 aSettingId )
+{
+	TInt error = KErrNone;
+	
+    TRAP( error, aApi->SetParamL( aSettingId,
+                                              XmppParams::KXmppParamServerPort(),
+                                              port ) );
+
+    // buffers
+    TRAP( error, aApi->SetParamL( aSettingId,
+                                              XmppParams::KXmppParamXmppServerAddress(),
+                                              KXmppServerAddress ) );
+    TRAP( error, aApi->SetParamL( aSettingId,
+                                              XmppParams::KXmppParamUsername(),
+                                              KUsername ) );
+    TRAP( error, aApi->SetParamL( aSettingId,
+                                              XmppParams::KXmppParamPassword(),
+                                              KPassword ) );
+	// gabble specific things.........
+    TRAP( error, aApi->SetParamL( aSettingId,
+                                              XmppParams::KXmppParamHttpsProxyServerAddress(),
+                                              KHttpsProxyServerAddressText ) );
+    TRAP( error, aApi->SetParamL( aSettingId,
+                                              XmppParams::KXmppParamOldSSLRequired(),
+                                              oldSSL ) );
+    }
+
+// -----------------------------------------------------------------------------
+// ?classname::?member_function
+// ?implementation_description
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+/*
+?type ?classname::?member_function(
+   ?arg_type arg,
+   ?arg_type arg )
+   {
+
+   ?code
+
+   }
+*/
+
+// ========================== OTHER EXPORTED FUNCTIONS =========================
+
+// -----------------------------------------------------------------------------
+// ?function_name implements...
+// ?implementation_description.
+// Returns: ?value_1: ?description
+//          ?value_n: ?description
+//                    ?description
+// -----------------------------------------------------------------------------
+//
+/*
+?type  ?function_name(
+    ?arg_type arg,  // ?description
+    ?arg_type arg )  // ?description
+    {
+
+    ?code
+
+    }
+*/
+//  [End of File] - do not remove
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/group/bld.inf	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,53 @@
+/*
+* 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:  Includes all the Domain API specific bld.inf files, which 
+*                export files.
+*
+*/
+
+
+
+#include "../ximp_core_data_model_api/group/bld.inf"
+#include "../ximp_presence_protocol_plugin_host_api/group/bld.inf"
+#include "../ximp_presence_data_model_api/group/bld.inf"
+#include "../ximp_presence_protocol_plugin_api/group/bld.inf"
+#include "../ximp_presence_management_api/group/bld.inf"
+#include "../ximp_core_protocol_plugin_host_api/group/bld.inf"
+#include "../ximp_core_management_api/group/bld.inf"
+#include "../ximp_presence_base_api/group/bld.inf"
+#include "../ximp_core_protocol_plugin_api/group/bld.inf"
+#include "../ximp_core_base_api/group/bld.inf"
+#include "../ximp_presence_cache_api/group/bld.inf"
+#include "../ximp_core_feature_plugin_api/group/bld.inf"
+
+#include "../ximp_im_protocol_plugin_host_api/group/bld.inf"
+#include "../ximp_im_data_model_api/group/bld.inf"
+#include "../ximp_im_protocol_plugin_api/group/bld.inf"
+#include "../ximp_im_management_api/group/bld.inf"
+#include "../ximp_im_base_api/group/bld.inf"
+
+#include "../ximp_search_protocol_plugin_host_api/group/bld.inf"
+#include "../ximp_search_data_model_api/group/bld.inf"
+#include "../ximp_search_protocol_plugin_api/group/bld.inf"
+#include "../ximp_search_management_api/group/bld.inf"
+#include "../ximp_search_base_api/group/bld.inf"
+
+#include "../xmpp_settings_api/group/bld.inf"
+#include "../im_cache_client_api/group/bld.inf"
+#include "../im_cache_server_api/group/bld.inf"
+#include "../presence_avabilitytext/group/bld.inf"
+
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/im_cache_client_api/group/bld.inf	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,33 @@
+/*
+* 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:  File that exports the files belonging to 
+:                XIMP IM Base API
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+../inc/imcachedefs.h     		MW_LAYER_PLATFORM_EXPORT_PATH(imcachedefs.h)
+../inc/mimcacheaccessor.h     	MW_LAYER_PLATFORM_EXPORT_PATH(mimcacheaccessor.h)
+../inc/mimcacheeventhandler.h  	MW_LAYER_PLATFORM_EXPORT_PATH(mimcacheeventhandler.h)
+../inc/mimcacheupdater.h     	MW_LAYER_PLATFORM_EXPORT_PATH(mimcacheupdater.h)
+../inc/cimcachefactory.h     	MW_LAYER_PLATFORM_EXPORT_PATH(cimcachefactory.h)
+
+//end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/im_cache_client_api/im_cache_client_api.metaxml	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,14 @@
+<?xml version="1.0" ?>
+<api id="e507ff109e225de10d3dc2a0b4c68ea8" dataversion="1.0">
+<name>im_cache_client_api</name>
+<description>This is a API that provides read and write to the instant messaging cache. Client can write the information using adapter APIs and read from cache using accessor APIs.</description>
+<type>c++</type>
+<subsystem>instantmessagingcache</subsystem>
+<libs><lib name="imcacheclient.lib"/>
+</libs>
+<release category="domain" sinceversion=""/>
+<attributes>
+<htmldocprovided>yes</htmldocprovided>
+<adaptation>no</adaptation>
+</attributes>
+</api>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/im_cache_client_api/inc/cimcachefactory.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,126 @@
+/*
+* 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:  factory class to create access and updateer class
+*
+*/
+
+
+
+#ifndef __CIMCACHEFACTORY_H
+#define __CIMCACHEFACTORY_H
+
+//  INCLUDES
+#include <e32base.h>
+
+// FORWARD DECLARATIONS
+class MIMCacheUpdater;
+class CIMCacheClient;
+class CIMCacheUpdater;
+class MIMCacheAccessor;
+class CIMCacheAccessor;
+// CLASS DECLARATION
+
+class CIMCacheFactory : public CBase
+    {
+
+	public:
+    	
+    	/**
+		* read the instance from tls if exist or create return
+	    * if exist instace return or create return
+		*/
+    	IMPORT_C static CIMCacheFactory* InstanceL() ;
+    	
+       /**
+		* release the all instaces create by client factory
+		* @param aApplicationId application id
+		*/
+	    	
+    	IMPORT_C static void  Release();
+
+	private:
+	
+		/**
+		* two phase construction
+	    * return the new of CIMCacheFactory 
+		*/
+		 static CIMCacheFactory* NewL();
+
+		/**
+		* destructor
+	   	*/
+		 ~CIMCacheFactory();
+
+		/**
+		* default constructor
+	   	*/
+		 CIMCacheFactory();
+		
+		/**
+		* ConstructL
+	   	*/
+    	 void ConstructL();
+    	 
+    	 /**
+    	  * IncrementReference.
+    	  * Increments the count of the imcache factory reference.
+    	  */
+    	 void IncrementReference();
+
+    	 /**
+    	  * DecrementReference.
+    	  * Decrements the count of the imcache factory reference.
+    	  * @return - Current Reference Count
+     	  */
+    	 TInt DecrementReference();
+
+ public:
+   		/**
+		* Creates a updater interface
+		* @param aServiceId ,the service id to be used with this interface instance
+		* @param aUserId the aUserId to be used with this interface instance
+		* @param aRegistrationNeeded , used for register ,iunregister e
+		* @return the access interface
+		*/
+		IMPORT_C MIMCacheUpdater* CreateUpdaterL(TInt aServiceId,
+												const TDesC& aUserId ,
+												TBool aRegistrationNeeded );
+	
+		/**
+		* Creates a accessor interface
+		* @param aServiceId ,the service id to be used with this interface instance
+		* @param aUserId the aUserId to be used with this interface instance
+		* @return the access interface
+		*/
+		EXPORT_C MIMCacheAccessor* CreateAccessorL(TInt aServiceId,
+													const TDesC& aUserId  );
+	private: // data
+		
+		// owned , instantmessagingcache client
+		CIMCacheClient* iServerKeepAlive;
+		
+		// owned , array to hold updater instaces  
+		RPointerArray<CIMCacheUpdater> iUpdaterArray;
+		
+		// owned , array to hold accessor instaces  
+		RPointerArray<CIMCacheAccessor> iAccessorArray;
+		
+		// Owns : factory reference count
+		TInt iReferenceCount;
+
+    };
+
+#endif      // __CIMCACHEFACTORY_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/im_cache_client_api/inc/imcachedefs.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,226 @@
+/*
+* 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:  constanst declaration files
+*
+*/
+
+
+
+#ifndef __IMCACHEDEFS_H__
+#define __IMCACHEDEFS_H__
+#include <e32std.h>
+
+const TInt KMaxSize( 1024 );
+/** 
+* Different message types
+*/
+enum TIMCacheMessageType
+	{
+	EIMCMessagePTOP,
+	EIMCMessageSystem,
+	EIMCMessageInvalid
+	};
+
+
+/**
+* Direction of message. Coming or going or other.
+*/
+enum TIMCacheMessagerType
+	{
+	EIMCMessageSent,
+	EIMCMessageReceived,
+	EIMCMessageOther
+	};
+
+/**
+* Different message content types
+*/
+enum TIMCacheContentType
+	{
+	EIMCContentText,
+	EIMCContentOther,
+	EIMCContentInvalid
+	};	
+
+/**
+* struct for send and recieve message details
+*/
+struct SIMCacheMessageData
+	{
+	TIMCacheMessageType  	iMessageType;
+	TIMCacheMessagerType	iMessagerType;
+	TIMCacheContentType		iContentType;
+	TTime 	  				iTime;
+	HBufC* 					iBuddyId;
+	HBufC*	 				iText;
+	};
+
+/**
+* struct to contain newly added/removed chat details.
+*/
+struct SIMCacheChatItem
+    {
+    TInt    iServiceId;
+    HBufC*  iBuddyId;
+    };
+
+typedef TPckgBuf<SIMCacheMessageData> TIMCacheMessageBuf;
+/**
+ *
+ *cahce versions
+ */
+const TInt KIMCacheVersionMajor = 1;
+const TInt KIMCacheVersionMinor = 1;
+const TInt KIMCacheVersionBuild = 1;
+
+/**
+ *cache server exe name
+ *
+ */
+_LIT( EIMCacheServerExe, "imcacheserver.exe" );
+
+
+/**
+ *cache server name
+ *
+ */
+_LIT( KIMCacheServerName, "imcacheserver" );
+
+
+/**
+ *
+ *
+ */
+const TUint KIMCacheMsgSlotCount = 4;
+
+/**
+ * transaction types
+ */
+enum TTransactionType
+	{
+	EIMCacheTxAppend,
+	EIMCacheTxReplace,
+	EIMCacheTxAccess
+	};
+
+/**
+ * operation to perform
+ * 
+ */
+enum EIMCacheOperations
+    {
+    // begining operation boundary for client-server
+    EIMCacheOperationFirst = 0,
+    
+    // access API 
+    EIMCacheInitUpdate , 
+    EIMCacheInitAccess ,
+    EIMCacheInitConvesation,
+       // update  
+    EIMCacheStartNewConversation,
+    EIMCacheAppendReceiveMessage,
+    EIMCacheAppendSendMessage,
+    EIMCacheAppendMessage,	
+    EIMCacheCloseConversation, 
+    EIMCacheCloseAllConversation,
+    
+    EIMCacheDeactivateConversation, 
+    // access
+    EIMCacheGetUnreadCount,
+    EIMCacheGetAllUnreadCount,
+    EIMCacheIsConversationExist,
+    EIMCacheGetAllConversation,
+	// observer operation
+	// for already stored messages
+	EIMCacheObserveMessageUpdateRegister,
+	EIMCacheObserveMessageUpdateUnRegister,
+	
+	EIMCacheObserveMessageAccessRegister,
+	EIMCacheObserveMessageAccessUnRegister,
+
+	//new/deleted chat items
+	EIMCacheGetBufferedPackets,
+	
+	//GetChatItemList
+	EIMCacheGetChatList,
+	EIMCacheCancelRequest,
+	
+	// this is last operation boundary supported by client-server ( range has been set )
+	// do not add any operation after this
+    EIMCacheOperationLast
+    
+    };
+
+/**
+ * operation error code
+ * 
+ */
+enum TIMCacheOperationsCode
+    {
+   	EIMOPerationBase = -1000,
+    // update  
+    EIMOperationCompleted,
+	EIMOperationAborted,
+    // observer operation
+	EIMOperationRegistered,
+	EIMOperationUnRegistered,
+	
+	EIMOperationDataAvailable,
+	EIMOperationUnreadChange,
+	EIMOperationUnreadMessage,
+	
+	EIMOperationDataUnAvailable,
+	EIMOperationSessionDied,
+	EIMOperationCacheDataChaned,
+	EIMOperationConversationClosed,
+	EIMOperationFetchAll,
+	EIMOperationChatAdded,
+	EIMOperationMessageAdded,
+	EIMOperationChatDeleted,
+	EIMOperationAllChatDeleted,
+	EIMOperationChatStarted
+	};
+
+/**
+ * operation to perform
+ * 
+ */
+enum TIMCacheEventType
+    {
+    EIMCacheRequestCompleted = 0,
+   	EIMCacheNewMessage ,
+   	EIMCacheUnreadMessage,
+   	EIMCacheUnreadChange,
+   	EIMCacheNewChat,
+   	EIMCacheChatStarted,
+   	EIMCacheChatClosed,
+   	EIMCacheAllChatClosed
+    };
+/**
+ * 
+ * 
+ */
+enum TIMCacheChatListOperation
+    {
+    EIMChatId,
+    EIMChatList
+    };
+
+#endif  //__IMCACHEDEFS_H__
+
+// END OF FILE
+
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/im_cache_client_api/inc/mimcacheaccessor.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,95 @@
+/*
+* 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:  base class declaration for accessing the cache
+*
+*/
+
+
+
+#ifndef __MIMCACHEACCESSOR_H
+#define __MIMCACHEACCESSOR_H
+ 
+#include "imcachedefs.h"
+
+class MIMCacheEventHandler;
+ /**
+  * An interface for updating conversation information
+  *
+  * @since 5.0
+  */
+ class MIMCacheAccessor
+     {
+     public:
+     
+ 		/**
+    	* Register to observer conversation data updates
+    	* @param aObserver the observer interface
+    	*/
+        virtual void RegisterObserverL( MIMCacheEventHandler& aObserver ) = 0;
+
+    	/**
+    	* Unregister a conversation data update observer
+    	* @param aObserver the observer interface
+    	*/
+        virtual void UnRegisterObserver( MIMCacheEventHandler& aObserver ) = 0;
+		
+       	/**
+    	* to get the unread message count from server
+    	* @param aOwnUserId , logged in user id
+    	* @return number of unread msg count
+    	*/
+		virtual TInt GetUnreadMessageCountL( const TDesC& aBuddyId ) = 0;
+		
+	   /**
+    	* to get the all unread message count from server
+    	* @param , aOwnUserId logged in user id
+    	* @return number of all unread msg count
+    	*/
+        virtual TInt GetAllUnreadMessageCountL() = 0 ;
+        						
+		 /**
+         * check if already conversation opened
+         * @param aServiceId, serviceid to use
+         * @param aOwnUserId, own user id 
+         * @param aRecipientId, the selected user id with whom conversation is started
+         * @return ETrue if already exist else EFlase.
+         */
+        virtual TBool IsConversationExistL( const TDesC& aBuddyId ) = 0 ;	
+
+		/**
+		* closes conversation and commit operation
+		* @param aServiceId service id.
+		* @param aOwnId own user id.
+		* @param aRecipientId recipient's user id.
+		*/
+		virtual void CloseConversationL( const TDesC& aBuddyId ) = 0;
+		
+		  
+        /**
+        * get the chat list corresponding to service
+        * @param aServiceId service id
+        * @return Array of chats
+        */
+		virtual RArray<SIMCacheChatItem> GetChatListL( const TInt aServiceId  ) = 0 ; 
+		                           
+       
+		 
+	protected:
+     	/**
+     	* Destructor
+     	*/
+     	virtual ~MIMCacheAccessor() {};
+     };
+
+ #endif //__MIMCACHEUPDATER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/im_cache_client_api/inc/mimcacheeventhandler.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,57 @@
+/*
+* 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:  client side obssrver class message change observer
+*
+*/
+
+
+
+#ifndef __MIMCACHEEVENTHANDLER_H
+#define __MIMCACHEEVENTHANDLER_H
+
+#include <e32std.h>
+#include "imcachedefs.h"
+
+
+/**
+ * An interface through which client gets information
+ * about available  data updates.
+ *
+ * @since
+ */
+class MIMCacheEventHandler
+    {
+    public:
+           
+    	/**
+    	* Gets called when data update is available.
+    	* Client can then decide wether to use the old one
+    	* or the updated one.
+    	* @param aNewMessage, new message details
+       	*/
+        virtual void HandleIMCacheEventL(TIMCacheEventType aEvent, TAny* aChatMessage = NULL ) = 0;
+     
+  	
+protected:
+    	/**
+    	* Destructor
+    	*/
+    	virtual ~MIMCacheEventHandler() {};
+    };
+   
+ 
+    
+#endif //__MIMCACHEEVENTHANDLER_H
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/im_cache_client_api/inc/mimcacheupdater.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,111 @@
+/*
+* 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:  base class declaration for updating the cache
+*
+*/
+
+
+
+#ifndef __MIMCACHEUPDATER_H
+#define __MIMCACHEUPDATER_H
+ 
+#include "imcachedefs.h"
+
+class MIMCacheEventHandler;
+ /**
+  * An interface for updating conversation information
+  *
+  * @since 5.0
+  */
+ class MIMCacheUpdater
+     {
+     public:
+     
+ 		/**
+    	* Register to observer conversation data updates
+    	* @param aObserver the observer interface
+    	*/
+        virtual void RegisterObserverL( MIMCacheEventHandler& aObserver ) = 0;
+
+    	/**
+    	* Unregister a conversation data update observer
+    	* @param aObserver the observer interface
+    	*/
+        virtual void UnRegisterObserver( MIMCacheEventHandler& aObserver ) = 0;
+
+		
+		/**
+        * start a new conversation 
+        * @param aRecipient a recipient user id
+        */
+		virtual void StartNewConversationL(const TDesC& aBuddyId ) = 0;
+		
+		/**
+        * append the new recieve message
+        * @param aBuddyId a sender user id
+        * @param aText a text to append
+        */
+		virtual void AppendReceiveMessageL(const TDesC& aBuddyId,
+										   const TDesC& aText ) = 0;
+		
+		/**
+        * append the new send message
+        * @param aText a text to append
+        */
+		virtual void AppendSendMessageL(const TDesC& aText ) = 0;
+		
+		/**
+        * append the normal information message message
+        * @param aBuddyId buddy id.
+        * @param aText a text to append
+        */
+		virtual void AppendMessageL(const TDesC& aBuddyId, const TDesC& aText)  = 0 ;
+		
+		
+		/**
+		* closes conversation and commit operation
+		* @param aServiceId service id.
+		* @param aRecipientId recipient's user id.
+		*/
+		virtual void CloseConversationL( const TDesC& aBuddyId ) = 0;
+		
+		
+		/*
+		 * close all conversation in service Id
+		 */
+		virtual void CloseAllConversationL() = 0 ;
+		
+	
+		/**
+        * clos conversation and commit operation
+        */
+		virtual TInt DeactivateConversationL() = 0;
+		
+		                               
+			
+		/**
+        * get the chat list corresponding to service
+        * @param aServiceId service id
+        * @return Array of chats
+        */
+		virtual RArray<SIMCacheChatItem> GetChatListL( const TInt aServiceId  ) = 0 ; 
+	 
+	protected:
+     	/**
+     	* Destructor
+     	*/
+     	virtual ~MIMCacheUpdater() {};
+     };
+
+ #endif //__MIMCACHEUPDATER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/im_cache_client_api/tsrc/bwins/imcache_testu.def	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,3 @@
+EXPORTS
+	?LibEntryL@@YAPAVCScriptBase@@AAVCTestModuleIf@@@Z @ 1 NONAME ; class CScriptBase * LibEntryL(class CTestModuleIf &)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/im_cache_client_api/tsrc/conf/imcache_test.cfg	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,156 @@
+/*
+* ==============================================================================
+*  Name        : imcache_test.cfg
+*  Part of     : instantmessagingcache / imcache_test
+*  Description : instantmessagingcache related test cases
+*  Version:    : % version:1 %
+*
+*  Copyright (C) 2008 Nokia Corporation.
+*  This material, including documentation and any related 
+*  computer programs, is protected by copyright controlled by 
+*  Nokia Corporation. All rights are reserved. Copying, 
+*  including reproducing, storing,  adapting or translating, any 
+*  or all of this material requires the prior written consent of 
+*  Nokia Corporation. This material also contains confidential 
+*  information which may not be disclosed to others without the 
+*  prior written consent of Nokia Corporation.
+*
+* ============================================================================
+*/
+
+[Test]
+title 1. CreateSameUpdaterL
+create imcache_test foobar
+foobar CreateSameUpdaterL 
+delete foobar
+[Endtest] 
+
+
+[Test]
+title 2. CreateDifferentUpdaterL
+create imcache_test foobar
+foobar CreateDifferentUpdaterL 
+delete foobar
+[Endtest] 
+
+
+[Test]
+title 3. CreateSameAccessorL
+create imcache_test foobar
+foobar CreateSameAccessorL 
+delete foobar
+[Endtest] 
+
+
+[Test]
+title 4. CreateDifferentAccessorL
+create imcache_test foobar
+foobar CreateDifferentAccessorL 
+delete foobar
+[Endtest] 
+
+[Test]
+title 5. StartNewConversationL
+create imcache_test foobar
+foobar StartNewConversationL 
+delete foobar
+[Endtest] 
+
+
+[Test]
+title 6. AppendSendMessageL
+create imcache_test foobar
+foobar AppendSendMessageL 
+delete foobar
+[Endtest] 
+
+
+[Test]
+title 7. AppendRecieveMessageL
+create imcache_test foobar
+foobar AppendRecieveMessageL 
+delete foobar
+[Endtest] 
+
+
+[Test]
+title 8. FetchExistingMessageL
+create imcache_test foobar
+foobar FetchExistingMessageL 
+delete foobar
+[Endtest] 
+
+[Test]
+title 9. DeactivateConversationL
+create imcache_test foobar
+foobar DeactivateConversationL 
+delete foobar
+[Endtest] 
+
+[Test]
+title 10. CloseConversationL
+create imcache_test foobar
+foobar CloseConversationL 
+delete foobar
+[Endtest] 
+
+[Test]
+title 11. GetUnreadMsgCountL
+create imcache_test foobar
+foobar GetUnreadMsgCountL 
+delete foobar
+[Endtest] 
+
+
+[Test]
+title 12. GetNewMsgNotificationtL
+create imcache_test foobar
+foobar GetNewMsgNotificationtL 
+delete foobar
+[Endtest] 
+
+[Test]
+title 13. ConversationUnExistTestL
+create imcache_test foobar
+foobar ConversationUnExistTestL 
+delete foobar
+[Endtest] 
+
+
+[Test]
+title 14. ConversationExistTestL
+create imcache_test foobar
+foobar ConversationExistTestL 
+delete foobar
+[Endtest] 
+
+[Test]
+title 15. AppendMessageL
+create imcache_test foobar
+foobar AppendMessageL 
+delete foobar
+[Endtest] 
+
+[Test]
+title 16. GetAllUnreadMsgCountL
+create imcache_test foobar
+foobar GetAllUnreadMsgCountL 
+delete foobar
+[Endtest] 
+
+
+[Test]
+title 17. GetChatListTestL
+create imcache_test foobar
+foobar GetChatListTestL 
+delete foobar
+[Endtest]
+
+[Test]
+title 18. AccessorCloseConversationTestL
+create imcache_test foobar
+foobar AccessorCloseConversationTestL 
+delete foobar
+[Endtest]
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/im_cache_client_api/tsrc/conf/test.xml	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,158 @@
+<?xml version="1.0"?>
+<test>
+    <id>1001</id>
+    <name>MeCo Nightly Testing--IM Cache</name>
+    <target>
+        <device rank="none" alias="DEFAULT">
+            <property name="HARNESS" value="STIF" />
+            <property name="TYPE" value="Devlon" />
+            <property name="HOST" value="2IND00855.NOE.Nokia.com" />
+        </device>
+    </target> 
+    <plan id="1.1" name="MeCo Test Plan-IM Cache" harness="STIF" enabled="true" passrate="100">
+        <session id="1.1.1" name="session" harness="STIF" enabled="true" passrate="100">
+            <set id="1.1.1.1" name="set" harness="STIF" enabled="true" passrate="100">
+                <target>
+                    <device rank="master" alias="DEFAULT"/>
+                </target>
+                <case id="1.1.1.1.1" name="Test Case 1" harness="STIF" enabled="true" passrate="100">
+                    <flash target-alias="DEFAULT" images="Build\MeCo.fpsx" />
+                    <flash target-alias="DEFAULT" images="Build\MeCo_udaerase.fpsx" />  
+                    <step id="1.1.1.1.1.1" name="Create CTC log dir" harness="STIF" enabled="true" passrate="100" significant="false">
+                        <command>makedir</command>
+                        <params>
+                            <param dir="c:\data\ctc\"/>
+                        </params>
+                    </step>
+                    
+                    <step id="1.1.1.1.1.2" name="Access point related files" harness="STIF" enabled="true" passrate="100" significant="false">
+                        <command>execute</command>
+                        <params>
+                            <param file="z:\sys\bin\pretester.exe"/>
+                        </params>
+                    </step>
+                                      
+                    
+                    <step id="1.1.1.1.1.3" name="CTC start" harness="STIF" enabled="true" passrate="100" significant="false">
+                        <command>execute</command>
+                        <params>
+                            <param file="z:\sys\bin\ctcman.exe"/>
+                        </params>
+                    </step>
+                    
+                    <step id="1.1.1.1.1.4" name="Create STIF log dir" harness="STIF" enabled="true" passrate="100" significant="false">
+                        <command>makedir</command>
+                        <params>
+                            <param dir="c:\logs\imcv"/>
+                        </params>
+                    </step>
+                                        
+                    <step id="1.1.1.1.1.5" name="Install testmodule DLL" harness="STIF" enabled="true" passrate="100" significant="false">
+                        <command>install</command>
+                        <params>
+                        	  <param type="binary"/>
+                            <param src="imcache_test.dll"/>
+                            <param dst="c:\sys\bin\imcache_test.dll"/>
+                            
+                        </params> 
+                    </step> 
+                    
+                  <step id="1.1.1.1.1.6" name="Install testmodule DLL" harness="STIF" enabled="true" passrate="100" significant="false">
+                        <command>install</command>
+                        <params>
+                        	  <param type="binary"/>
+                            <param src="system.conf"/>
+                            <param dst="c:\data\dbus\system.conf "/>
+                            
+                        </params> 
+                    </step> 
+                              
+                         
+                         <step id="1.1.1.1.1.7" name="Install TESTFRAMEWORK.INI FILE" harness="STIF" enabled="true" passrate="100" significant="false">
+                        <command>install</command>
+                        <params>
+                            <param src="testframework.ini"/>
+                            <param dst="c:\testframework\testframework.ini"/>
+                            <!--param component-path="ATS3Drop"/-->
+                        </params> 
+                    </step>     
+                              
+                    <step id="1.1.1.1.1.8" name="Install .cfg FILE" harness="STIF" enabled="true" passrate="100" significant="false">
+                        <command>install</command>
+                        <params>
+                            <param src="imcache_test.cfg"/>
+                            <param dst="c:\testframework\imcache_test.cfg"/>
+                            <!--param component-path="ATS3Drop"/-->
+                        </params> 
+                    </step>     
+                    
+                   
+                    		                
+		                <step id="1.1.1.1.1.9" name="Module Test Result for IM Cache " harness="STIF" enabled="true" passrate="100" significant="true">
+		                    <command>run-cases</command>
+		                    <params>
+		        							<param module="Testscripter"/>
+		        							<param testcase-file="c:\testframework\imcache_test.cfg"/>
+		        							<param filter="*"/>
+		        							<param timeout="6000"/>
+		                    </params>
+		                </step>
+		                
+		                
+                    <step id="1.1.1.1.1.10" name="Save CTC data" harness="STIF" enabled="true" passrate="100" significant="false">
+                        <command>execute</command>
+                        <params>
+                            <param parameters="writefile"/>
+                            <param file="z:\sys\bin\ctcman.exe"/>
+                        </params>
+                    </step>
+                    <step id="1.1.1.1.1.11" name="Fetch and clean CTC data" harness="STIF" enabled="true" passrate="100" significant="false">
+                        <command>fetch-log</command>
+                        <params>
+                            <param delete="true"/>
+                            <param path="c:\data\ctc\ctcdata.txt"/>                        
+                        </params>
+                    </step>
+                    <step id="1.1.1.1.1.12" name="Fetch Test module Logs" harness="STIF" enabled="true" passrate="100" significant="false">
+                        <command>fetch-log</command>
+                        <params>
+				  							    <param type="text"/>
+				  							    <param delete="true"/>
+				  							    <param path="C:\Logs\TestFramework\*"/>
+                        </params>
+                    </step>            
+                    <step id="1.1.1.1.1.13" name="Fetch Test module Logs-IM Cache" harness="STIF" enabled="true" passrate="100" significant="false">
+                        <command>fetch-log</command>
+                        <params>
+				  							    <param type="text"/>
+				  							    <param delete="true"/>
+				  							    <param path="C:\Logs\imcv\*"/>
+                        </params>
+                    </step>                               
+                </case>
+            </set>
+        </session>
+    </plan>
+    <files>
+        
+        
+        <file>armv5_urel\imcache_test.dll</file>
+        <file>armv5_urel\system.conf</file>
+        <file>armv5_urel\TestFramework.ini</file>
+        <file>armv5_urel\imcache_test.cfg</file>
+        <file>build\MeCo.fpsx</file>  
+        <file>build\MeCo_udaerase.fpsx</file>              
+    </files>
+    
+     <postAction>
+					<type>FileStoreAction</type>
+							<params>
+							<param name="to-folder" value="\\filerblr\sp\Test_Drops\meco\Log\imcache_test"/>
+							<param name="zip" value="false"/>
+							</params>
+			</postAction>
+    <report media="email">
+        <type>STIF_COMPONENT_REPORT_ALL_CASES</type>
+        <to>ram.chauhan@nokia.com</to>
+    </report>
+</test>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/im_cache_client_api/tsrc/eabi/imcache_testu.def	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,3 @@
+EXPORTS
+	_Z9LibEntryLR13CTestModuleIf @ 1 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/im_cache_client_api/tsrc/group/bld.inf	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,57 @@
+/*
+* Copyright (c) 2002 - 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:  ?Description
+*
+*/
+
+
+
+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_TESTEXPORTS
+// NOTE: If using ARS requirements all export operations should be done under this.
+// 'abld test export'
+
+PRJ_EXPORTS
+// Specify the source file followed by its destination here
+// copy will be used to copy the source file to its destination
+// If there's no destination then the source file will be copied
+// to the same name in /epoc32/include
+// Example: 
+/*
+/agnmodel/inc/AGMCOMON.H
+*/
+../init/TestFramework.ini /epoc32/winscw/c/TestFramework/TestFramework.ini
+../conf/imcache_test.cfg /epoc32/winscw/c/TestFramework/imcache_test.cfg	
+
+PRJ_TESTMMPFILES
+// NOTE: If using ARS requirements .mmp file operation should be done under this.
+// 'abld test build'
+imcache_test.mmp
+
+PRJ_MMPFILES
+// Specify the .mmp files required for building the important component
+// releasables.
+//
+// Specify "tidy" if the component you need to build doesn't need to be
+// released. Specify "ignore" if the MMP file exists but should be
+// ignored.
+// Example:
+
+
+
+//  End of File
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/im_cache_client_api/tsrc/group/imcache_test.mmp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,54 @@
+/*TYPE TESTCLASS*//*
+* Copyright (c) 2002 - 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:  ?Description
+*
+*/
+
+
+        // To get the OSEXT_LAYER_SYSTEMINCLUDE-definition
+#include <platform_paths.hrh>
+#include <data_caging_paths_strings.hrh>
+
+TARGET          imcache_test.dll
+TARGETTYPE      dll
+UID             0x1000008D 0x101FB3E3
+
+CAPABILITY      ALL -TCB
+
+//TARGETPATH      ?target_path
+DEFFILE         imcache_test.def
+
+SOURCEPATH      ../src
+SOURCE          imcache_test.cpp
+SOURCE          imcache_testBlocks.cpp
+
+USERINCLUDE     ../inc 
+//USERINCLUDE     ../../../../imcacheclient/inc
+//USERINCLUDE     ../../../../inc 
+
+APP_LAYER_SYSTEMINCLUDE
+
+SYSTEMINCLUDE   /epoc32/include/internal
+
+LIBRARY         euser.lib
+LIBRARY         stiftestinterface.lib
+LIBRARY         stiftestengine.lib
+// imcache
+LIBRARY			imcacheclient.lib
+
+LANG            SC
+
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/im_cache_client_api/tsrc/group/imcache_test.pkg	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,42 @@
+;
+; 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:
+;
+;Header
+#{"Testcache"}, (0x101FB3E3), 1, 2, 3, TYPE=SP
+
+;Language - standard language definitions
+&EN
+
+;Vendor ID
+:"Nokia Corporation"
+
+;Localised vendor
+%{"Vendor-EN"}
+
+;Supports Series 60 v 0.9
+[0x101F7961], 0, 0, 0, {"Series60ProductID"}
+
+;rom will not allow to update it if name is testframework, after install need to rename it to testframework.ini
+
+;INI FILE
+"..\init\testframework.ini"        			-"c:\Testframework\ttestframework.ini"
+
+;CFG FILES
+"..\conf\imcache_test.cfg"        			-"c:\Testframework\imcache_test.cfg"
+
+;imcache_test dll files
+
+"\EPOC32\RELEASE\ARMV5\UREL\imcache_test.dll" 	-"!:\sys\bin\imcache_test.dll"
+    
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/im_cache_client_api/tsrc/inc/imcache_test.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,225 @@
+/*
+* Copyright (c) 2002 - 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:  ?Description
+*
+*/
+
+
+
+#ifndef IMCACHE_TEST_H
+#define IMCACHE_TEST_H
+
+//  INCLUDES
+#include <StifLogger.h>
+#include <TestScripterInternal.h>
+#include <StifTestModule.h>
+// imcache
+#include "mimcacheeventhandler.h"
+#include "mimcacheeventhandler.h"
+#include <imcachedefs.h>
+
+// CONSTANTS
+//const ?type ?constant_var = ?constant;
+
+// MACROS
+//#define ?macro ?macro_def
+// Logging path
+_LIT( Kimcache_testLogPath, "\\logs\\testframework\\imcache_test\\" ); 
+// Log file
+_LIT( Kimcache_testLogFile, "imcache_test.txt" ); 
+_LIT( Kimcache_testLogFileWithTitle, "imcache_test_[%S].txt" );
+
+// FUNCTION PROTOTYPES
+//?type ?function_name(?arg_list);
+
+// FORWARD DECLARATIONS
+//class ?FORWARD_CLASSNAME;
+class Cimcache_test;
+class CIMCacheFactory; 
+class MIMCacheEventHandler;
+
+// DATA TYPES
+//enum ?declaration
+//typedef ?declaration
+//extern ?data_type;
+
+// CLASS DECLARATION
+
+/**
+*  Cimcache_test test class for STIF Test Framework TestScripter.
+*  ?other_description_lines
+*
+*  @lib ?library
+*  @since ?Series60_version
+*/
+NONSHARABLE_CLASS(Cimcache_test) : public CScriptBase,
+									  public MIMCacheEventHandler
+    {
+    public:  // Constructors and destructor
+
+        /**
+        * Two-phased constructor.
+        */
+        static Cimcache_test* NewL( CTestModuleIf& aTestModuleIf );
+
+        /**
+        * Destructor.
+        */
+        virtual ~Cimcache_test();
+
+    public: // New functions
+
+        /**
+        * ?member_description.
+        * @since ?Series60_version
+        * @param ?arg1 ?description
+        * @return ?description
+        */
+        //?type ?member_function( ?type ?arg1 );
+
+    public: // Functions from base classes
+
+        /**
+        * From CScriptBase Runs a script line.
+        * @since ?Series60_version
+        * @param aItem Script line containing method name and parameters
+        * @return Symbian OS error code
+        */
+        virtual TInt RunMethodL( CStifItemParser& aItem );
+
+    protected:  // New functions
+
+        /**
+        * ?member_description.
+        * @since ?Series60_version
+        * @param ?arg1 ?description
+        * @return ?description
+        */
+        //?type ?member_function( ?type ?arg1 );
+
+    protected:  // Functions from base classes
+
+        /**
+        * From ?base_class ?member_description
+        */
+        //?type ?member_function();
+
+    private:
+
+        /**
+        * C++ default constructor.
+        */
+        Cimcache_test( CTestModuleIf& aTestModuleIf );
+
+        /**
+        * By default Symbian 2nd phase constructor is private.
+        */
+        void ConstructL();
+
+        // Prohibit copy constructor if not deriving from CBase.
+        // ?classname( const ?classname& );
+        // Prohibit assigment operator if not deriving from CBase.
+        // ?classname& operator=( const ?classname& );
+
+        /**
+        * Frees all resources allocated from test methods.
+        * @since ?Series60_version
+        */
+        void Delete();
+
+        /**
+        * Test methods are listed below. 
+        */
+
+        
+        //ADD NEW METHOD DEC HERE
+        //[TestMethods] - Do not remove
+        
+        virtual TInt CreateSameUpdaterL( CStifItemParser& aItem );
+        
+        virtual TInt CreateDifferentUpdaterL( CStifItemParser& aItem );
+        
+        virtual TInt CreateSameAccessorL( CStifItemParser& aItem );
+               
+        virtual TInt CreateDifferentAccessorL( CStifItemParser& aItem );
+        
+        virtual TInt StartNewConversationL( CStifItemParser& aItem ) ;
+        
+        virtual TInt AppendSendMessageL( CStifItemParser& aItem ) ;
+        
+        virtual TInt AppendRecieveMessageL( CStifItemParser& aItem ) ;
+        
+        virtual TInt FetchExistingMessageL( CStifItemParser& aItem );
+        
+        virtual TInt DeactivateConversationL( CStifItemParser& aItem );
+
+        virtual TInt CloseConversationL( CStifItemParser& aItem );
+        
+        virtual TInt GetUnreadMsgCountL(CStifItemParser& aItem) ;
+        
+        virtual TInt GetNewMsgNotificationtL(CStifItemParser& aItem) ;
+        
+        virtual TInt ConversationUnExistTestL(CStifItemParser& aItem) ;
+        
+        virtual TInt ConversationExistTestL(CStifItemParser& aItem) ;
+        
+        virtual TInt AppendMessageL( CStifItemParser& aItem);
+        
+ 	 	virtual TInt GetAllUnreadMsgCountL( CStifItemParser& aItem);
+
+      
+        virtual TInt GetChatListTestL( CStifItemParser& aItem);
+        
+ 	 	virtual TInt AccessorCloseConversationTestL( CStifItemParser& aItem);
+
+           
+
+    public:     // MIMCacheEventHandler
+    
+    /**
+    	* Gets called when data update is available.
+    	* Client can then decide wether to use the old one
+    	* or the updated one.
+    	* @param aNewMessage, new message details
+       	*/
+         void HandleIMCacheEventL(TIMCacheEventType aEvent, TAny* aChatMessage = NULL ) ;
+        
+          	
+    protected:  // Data
+        // ?one_line_short_description_of_data
+        //?data_declaration;
+
+    private:    // Data
+     
+     	CActiveSchedulerWait iWait;
+     	
+     	TInt iMessageFetch;
+        // ?one_line_short_description_of_data
+        //?data_declaration;
+
+        // Reserved pointer for future extension
+        //TAny* iReserved;
+
+    public:     // Friend classes
+        //?friend_class_declaration;
+    protected:  // Friend classes
+        //?friend_class_declaration;
+    private:    // Friend classes
+        //?friend_class_declaration;
+
+    };
+
+#endif      // IMCACHE_TEST_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/im_cache_client_api/tsrc/init/TestFramework.ini	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,44 @@
+#
+# This is STIFTestFramework initialization file
+# Comment lines start with '#'-character.
+# See STIF TestFramework users guide.doc for instructions
+
+# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+
+[Engine_Defaults]
+
+TestReportMode= FullReport		# Possible values are: 'Empty', 'Summary', 'Environment',
+                                                               'TestCases' or 'FullReport'
+
+CreateTestReport= YES			# Possible values: YES or NO
+
+TestReportFilePath= C:\LOGS\TestFramework\
+TestReportFileName= TestReport
+
+TestReportFormat= TXT			# Possible values: TXT or HTML
+TestReportOutput= FILE			# Possible values: FILE or RDEBUG
+TestReportFileCreationMode= OVERWRITE	# Possible values: OVERWRITE or APPEND
+
+DeviceResetDllName= StifResetForNokia.dll # e.g. 'StifHWResetStub.dll' for user specific reseting
+
+[End_Defaults]
+# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+
+# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+# Module configurations start
+
+[New_Module]
+ModuleName= testscripter
+TestCaseFile= C:\testframework\imcache_test.cfg
+[End_Module]
+
+
+
+# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+
+[Logger_Defaults]
+
+[End_Logger_Defaults]
+# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+
+# End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/im_cache_client_api/tsrc/src/imcache_test.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,187 @@
+/*
+* Copyright (c) 2002 - 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:  ?Description
+*
+*/
+
+
+
+// INCLUDE FILES
+#include <StifTestInterface.h>
+#include "imcache_test.h"
+#include <SettingServerClient.h>
+
+#include    "cimcachefactory.h"
+
+// EXTERNAL DATA STRUCTURES
+//extern  ?external_data;
+
+// EXTERNAL FUNCTION PROTOTYPES  
+//extern ?external_function( ?arg_type,?arg_type );
+
+// CONSTANTS
+//const ?type ?constant_var = ?constant;
+
+// MACROS
+//#define ?macro ?macro_def
+
+// LOCAL CONSTANTS AND MACROS
+//const ?type ?constant_var = ?constant;
+//#define ?macro_name ?macro_def
+
+// MODULE DATA STRUCTURES
+//enum ?declaration
+//typedef ?declaration
+
+// LOCAL FUNCTION PROTOTYPES
+//?type ?function_name( ?arg_type, ?arg_type );
+
+// FORWARD DECLARATIONS
+//class ?FORWARD_CLASSNAME;
+
+// ============================= LOCAL FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// ?function_name ?description.
+// ?description
+// Returns: ?value_1: ?description
+//          ?value_n: ?description_line1
+//                    ?description_line2
+// -----------------------------------------------------------------------------
+//
+/*
+?type ?function_name(
+    ?arg_type arg,  // ?description
+    ?arg_type arg)  // ?description
+    {
+
+    ?code  // ?comment
+
+    // ?comment
+    ?code
+    }
+*/
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// Cimcache_test::Cimcache_test
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+Cimcache_test::Cimcache_test( 
+    CTestModuleIf& aTestModuleIf ):
+        CScriptBase( aTestModuleIf )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// Cimcache_test::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void Cimcache_test::ConstructL()
+    {
+    //Read logger settings to check whether test case name is to be
+    //appended to log file name.
+    RSettingServer settingServer;
+    TInt ret = settingServer.Connect();
+    if(ret != KErrNone)
+        {
+        User::Leave(ret);
+        }
+    // Struct to StifLogger settigs.
+    TLoggerSettings loggerSettings; 
+    // Parse StifLogger defaults from STIF initialization file.
+    ret = settingServer.GetLoggerSettings(loggerSettings);
+    if(ret != KErrNone)
+        {
+        User::Leave(ret);
+        } 
+    // Close Setting server session
+    settingServer.Close();
+
+    TFileName logFileName;
+    
+    if(loggerSettings.iAddTestCaseTitle)
+        {
+        TName title;
+        TestModuleIf().GetTestCaseTitleL(title);
+        logFileName.Format(Kimcache_testLogFileWithTitle, &title);
+        }
+    else
+        {
+        logFileName.Copy(Kimcache_testLogFile);
+        }
+
+    iLog = CStifLogger::NewL( Kimcache_testLogPath, 
+                          logFileName,
+                          CStifLogger::ETxt,
+                          CStifLogger::EFile,
+                          EFalse );
+                          
+    TestModuleIf().SetBehavior( CTestModuleIf::ETestLeaksHandles );  
+                       
+    	 
+
+    }
+
+// -----------------------------------------------------------------------------
+// Cimcache_test::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+Cimcache_test* Cimcache_test::NewL( 
+    CTestModuleIf& aTestModuleIf )
+    {
+    Cimcache_test* self = new (ELeave) Cimcache_test( aTestModuleIf );
+
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+
+    return self;
+
+    }
+
+// Destructor
+Cimcache_test::~Cimcache_test()
+    { 
+
+    // Delete resources allocated from test methods
+    Delete();
+
+    // Delete logger
+    delete iLog; 
+
+    }
+
+// ========================== OTHER EXPORTED FUNCTIONS =========================
+
+// -----------------------------------------------------------------------------
+// LibEntryL is a polymorphic Dll entry point.
+// Returns: CScriptBase: New CScriptBase derived object
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CScriptBase* LibEntryL( 
+    CTestModuleIf& aTestModuleIf ) // Backpointer to STIF Test Framework
+    {
+
+    return ( CScriptBase* ) Cimcache_test::NewL( aTestModuleIf );
+
+    }
+
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/im_cache_client_api/tsrc/src/imcache_testBlocks.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,648 @@
+/*
+* Copyright (c) 2002 - 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:  ?Description
+*
+*/
+
+
+
+// [INCLUDE FILES] - do not remove
+#include <e32svr.h>
+#include <StifParser.h>
+#include <StifTestInterface.h>
+#include "imcache_test.h"
+
+#include   "cimcachefactory.h"
+#include	"mimcacheupdater.h"
+#include	"mimcacheaccessor.h"
+#include    "mimcacheeventhandler.h"
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// Cimcache_test::Delete
+// Delete here all resources allocated and opened from test methods. 
+// Called from destructor. 
+// -----------------------------------------------------------------------------
+//
+void Cimcache_test::Delete() 
+    {
+
+    }
+
+// -----------------------------------------------------------------------------
+// Cimcache_test::RunMethodL
+// Run specified method. Contains also table of test mothods and their names.
+// -----------------------------------------------------------------------------
+//
+TInt Cimcache_test::RunMethodL( 
+    CStifItemParser& aItem ) 
+    {
+
+    static TStifFunctionInfo const KFunctions[] =
+        {  
+        // Copy this line for every implemented function.
+        // First string is the function name used in TestScripter script file.
+        // Second is the actual implementation member function. 
+        ENTRY( "CreateSameUpdaterL", Cimcache_test::CreateSameUpdaterL ),
+        ENTRY( "CreateDifferentUpdaterL", Cimcache_test::CreateDifferentUpdaterL ),
+        ENTRY( "CreateSameAccessorL", Cimcache_test::CreateSameAccessorL ),
+        ENTRY( "CreateDifferentAccessorL", Cimcache_test::CreateDifferentAccessorL ),
+        ENTRY( "StartNewConversationL", Cimcache_test::StartNewConversationL ),
+        ENTRY( "AppendSendMessageL", Cimcache_test::AppendSendMessageL ),
+        ENTRY( "AppendRecieveMessageL", Cimcache_test::AppendRecieveMessageL ),
+        ENTRY( "FetchExistingMessageL", Cimcache_test::FetchExistingMessageL),
+        ENTRY( "DeactivateConversationL", Cimcache_test::DeactivateConversationL),
+        ENTRY( "CloseConversationL", Cimcache_test::CloseConversationL ),
+        ENTRY( "GetUnreadMsgCountL", Cimcache_test::GetUnreadMsgCountL ),
+        ENTRY( "GetNewMsgNotificationtL", Cimcache_test::GetNewMsgNotificationtL ),
+        
+        ENTRY( "ConversationUnExistTestL", Cimcache_test::ConversationUnExistTestL ),
+        ENTRY( "ConversationExistTestL", Cimcache_test::ConversationExistTestL ),
+        
+        ENTRY( "AppendMessageL", Cimcache_test::AppendMessageL ),
+        ENTRY( "GetAllUnreadMsgCountL", Cimcache_test::GetAllUnreadMsgCountL ),
+          
+        ENTRY( "GetChatListTestL", Cimcache_test::GetChatListTestL ),
+        ENTRY( "AccessorCloseConversationTestL", Cimcache_test::AccessorCloseConversationTestL ),
+         
+        //ADD NEW ENTRY HERE
+        // [test cases entries] - Do not remove
+
+        };
+
+    const TInt count = sizeof( KFunctions ) / 
+                        sizeof( TStifFunctionInfo );
+
+    return RunInternalL( KFunctions, count, aItem );
+
+    }
+  
+
+// -----------------------------------------------------------------------------
+// Cimcache_test::CreateSameUpdaterL
+// Example test method function.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt Cimcache_test::CreateSameUpdaterL( CStifItemParser& /*aItem*/ )
+	{
+
+ 	 CIMCacheFactory* instance = CIMCacheFactory::InstanceL(); 
+	   
+	 MIMCacheUpdater* updater1 = instance->CreateUpdaterL(1, _L("testlm123@gmail.com"),ETrue );
+	 
+	 MIMCacheUpdater* updater2 = instance->CreateUpdaterL(1, _L("testlm123@gmail.com") ,ETrue);
+	 
+	 TInt error = KErrGeneral;
+	 
+	 if(updater1 == updater2 )
+		 {
+		 error = KErrNone;	
+		 }
+	 
+	 CIMCacheFactory::Release();
+	 
+	 return error;
+	}
+  
+// -----------------------------------------------------------------------------
+// Cimcache_test::CreateDifferentUpdaterL
+// Example test method function.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt Cimcache_test::CreateDifferentUpdaterL( CStifItemParser& /*aItem*/ )
+	{
+
+ 	 CIMCacheFactory* instance = CIMCacheFactory::InstanceL(); 
+	   
+	 MIMCacheUpdater* updater1 = instance->CreateUpdaterL(1, _L("testlm123@gmail.com"),ETrue );
+	 
+	 MIMCacheUpdater* updater2 = instance->CreateUpdaterL(2, _L("abc123@gmail.com") ,ETrue);
+	 
+	 TInt error = KErrGeneral;
+	 
+	 if(updater1 != updater2 )
+		 {
+		 error = KErrNone;	
+		 }
+	 
+	 CIMCacheFactory::Release();
+	 
+	 return error;
+	}
+   
+   // -----------------------------------------------------------------------------
+// Cimcache_test::CreateSameAccessorL
+// Example test method function.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt Cimcache_test::CreateSameAccessorL( CStifItemParser& /*aItem*/ )
+	{
+
+ 	 CIMCacheFactory* instance = CIMCacheFactory::InstanceL(); 
+	   
+	 MIMCacheAccessor* accessor1 = instance->CreateAccessorL(1, _L("testlm123@gmail.com") );
+	 
+	 MIMCacheAccessor* accessor2 = instance->CreateAccessorL(1, _L("testlm123@gmail.com") );
+	 
+	 TInt error = KErrGeneral;
+	 
+	 if(accessor1 == accessor2 )
+		 {
+		 error = KErrNone;	
+		 }
+	 
+	 CIMCacheFactory::Release();
+	 
+	 return error;
+	}
+  
+// -----------------------------------------------------------------------------
+// Cimcache_test::CreateDifferentAccessorL
+// Example test method function.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt Cimcache_test::CreateDifferentAccessorL( CStifItemParser& /*aItem*/ )
+	{
+
+ 	 CIMCacheFactory* instance = CIMCacheFactory::InstanceL(); 
+	   
+	 MIMCacheAccessor* accessor1 = instance->CreateAccessorL(1, _L("testlm123@gmail.com") );
+	 
+	 MIMCacheAccessor* accessor2 = instance->CreateAccessorL(2, _L("abc123@gmail.com") );
+	 
+	 TInt error = KErrGeneral;
+	 
+	 if(accessor1 != accessor2 )
+		 {
+		 error = KErrNone;	
+		 }
+	 
+	 CIMCacheFactory::Release();
+	 
+	 return error;
+	}  
+ // -----------------------------------------------------------------------------
+// Cimcache_test::StartNewConversationL
+// Example test method function.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt Cimcache_test::StartNewConversationL( CStifItemParser& /*aItem*/ )
+    {
+     CIMCacheFactory* instance = CIMCacheFactory::InstanceL(); 
+	   
+	 MIMCacheUpdater* updater = instance->CreateUpdaterL(1, _L("testlm123@gmail.com"),ETrue );
+     updater->RegisterObserverL(*this);
+ 	 updater->StartNewConversationL( _L("testui123@gmail.com") ) ;
+ 	
+	 if( !iWait.IsStarted() )
+		 {
+		 iWait.Start();	
+		 }
+	 updater->UnRegisterObserver(*this);
+	 CIMCacheFactory::Release();
+	 return KErrNone;
+    }
+    
+// -----------------------------------------------------------------------------
+// Cimcache_test::AppendSendMessageL
+// Example test method function.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt Cimcache_test::AppendSendMessageL( CStifItemParser& /*aItem*/ )
+    {
+     CIMCacheFactory* instance = CIMCacheFactory::InstanceL(); 
+	   
+	 MIMCacheUpdater* updater = instance->CreateUpdaterL(1, _L("testlm123@gmail.com") ,ETrue);
+     updater->RegisterObserverL(*this);
+ 	 updater->StartNewConversationL( _L("testui123@gmail.com") ) ;
+ 	
+	 if( !iWait.IsStarted() )
+		 {
+		 iWait.Start();	
+		 }
+	 updater->AppendSendMessageL( _L("hello this is test message appended") ) ;	
+	 updater->UnRegisterObserver(*this);
+	 CIMCacheFactory::Release();
+	 return KErrNone;
+    }
+ 
+ // -----------------------------------------------------------------------------
+// Cimcache_test::AppendRecieveMessageL
+// Example test method function.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt Cimcache_test::AppendRecieveMessageL( CStifItemParser& /*aItem*/ )
+    {
+     CIMCacheFactory* instance = CIMCacheFactory::InstanceL(); 
+	   
+	 MIMCacheUpdater* updater = instance->CreateUpdaterL(1, _L("testlm123@gmail.com"),ETrue );
+     updater->AppendReceiveMessageL( _L("testui123@gmail.com"),_L("hello this is test message appended") ) ;
+     	
+	 CIMCacheFactory::Release();
+	 return KErrNone;
+    }
+    
+  // -----------------------------------------------------------------------------
+// Cimcache_test::StartNewConversationL
+// Example test method function.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt Cimcache_test::FetchExistingMessageL( CStifItemParser& /*aItem*/ )
+    {
+     CIMCacheFactory* instance = CIMCacheFactory::InstanceL(); 
+	 TInt error = KErrNotFound;  
+	 MIMCacheUpdater* updater = instance->CreateUpdaterL(1, _L("testlm123@gmail.com") ,ETrue);
+	 // tow message appended hence counter will be two.
+	 updater->AppendReceiveMessageL( _L("testui123@gmail.com"),_L("hello this is test first message appended") ) ;
+	 updater->AppendReceiveMessageL( _L("testui123@gmail.com"),_L("hello this is test second message appended") ) ;
+	  
+     updater->RegisterObserverL(*this);
+     
+     if( !iWait.IsStarted() )
+          {
+          iWait.Start(); 
+          }
+     
+ 	 updater->StartNewConversationL( _L("testui123@gmail.com") ) ;
+	 
+	 if( !iWait.IsStarted() )
+         {
+         iWait.Start(); 
+         }
+	 updater->UnRegisterObserver(*this);
+	 CIMCacheFactory::Release();
+	if( iMessageFetch == 2) // two message should be fetched
+		{
+		error = KErrNone;	
+		}
+	 return error;
+    }
+
+// -----------------------------------------------------------------------------
+// Cimcache_test::DeactivateConversationL
+// Example test method function.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt Cimcache_test::DeactivateConversationL( CStifItemParser& /*aItem*/ )
+    {
+     CIMCacheFactory* instance = CIMCacheFactory::InstanceL(); 
+	   
+	 MIMCacheUpdater* updater = instance->CreateUpdaterL(1, _L("testlm123@gmail.com"),ETrue );
+     updater->RegisterObserverL(*this);
+ 	 updater->StartNewConversationL( _L("testui123@gmail.com") ) ;
+ 	
+	 if( !iWait.IsStarted() )
+		 {
+		 iWait.Start();	
+		 }
+     // close the active conversation
+	 updater->DeactivateConversationL();
+	 
+	 updater->UnRegisterObserver(*this);
+	 CIMCacheFactory::Release();
+	 return KErrNone;
+    }
+// -----------------------------------------------------------------------------
+// Cimcache_test::CloseConversationL
+// Example test method function.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt Cimcache_test::CloseConversationL( CStifItemParser& /*aItem*/ )
+    {
+     CIMCacheFactory* instance = CIMCacheFactory::InstanceL(); 
+	   
+	 MIMCacheUpdater* updater = instance->CreateUpdaterL(1, _L("testlm123@gmail.com"),ETrue );
+     updater->RegisterObserverL(*this);
+
+ 	 updater->StartNewConversationL( _L("testui123@gmail.com") ) ;
+ 	
+	 if( !iWait.IsStarted() )
+		 {
+		 iWait.Start();	
+		 }
+     // close the active conversation
+	 updater->CloseConversationL( _L("testui123@gmail.com") );
+	 
+	   if( !iWait.IsStarted() )
+         {
+         iWait.Start(); 
+         }
+	 
+	 updater->UnRegisterObserver(*this);
+	 CIMCacheFactory::Release();
+	 return KErrNone;
+    }
+
+
+// -----------------------------------------------------------------------------
+// Cimcache_test::GetUnreadMsgCountL
+// Example test method function.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt Cimcache_test::GetUnreadMsgCountL(CStifItemParser& /*aItem*/) 
+	{
+	 CIMCacheFactory* instance = CIMCacheFactory::InstanceL(); 
+	   
+	 MIMCacheAccessor* accessor = instance->CreateAccessorL(1, _L("testlm123@gmail.com") );
+	 
+	 MIMCacheUpdater* updater = instance->CreateUpdaterL(1, _L("testlm123@gmail.com"), ETrue );
+     updater->AppendReceiveMessageL( _L("testui123@gmail.com"),_L("hello this is test message appended") ) ;
+ 	 TInt count = accessor->GetUnreadMessageCountL( _L("testui123@gmail.com") );
+	 CIMCacheFactory::Release();
+	 if(count == 1)
+		 {
+		 return KErrNone;	
+		 }
+	 return KErrArgument;
+	}
+
+
+// -----------------------------------------------------------------------------
+// Cimcache_test::GetUnreadMsgCountChangeL
+// Example test method function.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt Cimcache_test::GetAllUnreadMsgCountL(CStifItemParser& /*aItem*/) 
+	{
+	 CIMCacheFactory* instance = CIMCacheFactory::InstanceL(); 
+	   
+	 MIMCacheAccessor* accessor = instance->CreateAccessorL(1, _L("testlm123@gmail.com") );
+	 
+	 MIMCacheUpdater* updater = instance->CreateUpdaterL(1, _L("testlm123@gmail.com"), ETrue );
+     updater->AppendReceiveMessageL( _L("testui123@gmail.com"),_L("hello this is test message appended") ) ;
+     updater->AppendReceiveMessageL( _L("meco1111@gmail.com"),_L("i am fine here") ) ;
+     
+ 	 TInt count = accessor->GetAllUnreadMessageCountL( );
+	 CIMCacheFactory::Release();
+	 if(count == 2)
+		 {
+		 return KErrNone;	
+		 }
+	 return KErrArgument;
+	}
+// -----------------------------------------------------------------------------
+// Cimcache_test::ConversationUnExistTestL
+// Example test method function.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt Cimcache_test::ConversationUnExistTestL(CStifItemParser& /*aItem*/) 
+	{
+	 CIMCacheFactory* instance = CIMCacheFactory::InstanceL(); 
+	   
+	 MIMCacheAccessor* accessor = instance->CreateAccessorL(1, _L("testlm123@gmail.com") );
+	// not yest conversation open so must be EFalse here
+ 	 TBool ret = accessor->IsConversationExistL(_L("testui123@gmail.com") );
+ 	 
+	 CIMCacheFactory::Release();
+	 
+	 if(!ret)
+		 {
+		 return KErrNone;	
+		 }
+	 return KErrArgument;
+	}
+
+// -----------------------------------------------------------------------------
+// Cimcache_test::ConversationExistTestL
+// Example test method function.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt Cimcache_test::ConversationExistTestL(CStifItemParser& /*aItem*/) 
+	{
+    CIMCacheFactory* instance = CIMCacheFactory::InstanceL(); 
+		 
+	MIMCacheUpdater* updater = instance->CreateUpdaterL(1, _L("testlm123@gmail.com"), ETrue );
+	updater->RegisterObserverL(*this);
+	updater->StartNewConversationL( _L("testui123@gmail.com") ) ;
+	
+	if( !iWait.IsStarted() )
+		 {
+		 iWait.Start();	
+		 }
+	   
+	 MIMCacheAccessor* accessor = instance->CreateAccessorL(1, _L("testlm123@gmail.com") );
+	//  conversation already open so must be ETrue here
+ 	 TBool ret = accessor->IsConversationExistL( _L("testui123@gmail.com") );
+ 	 
+ 	 updater->UnRegisterObserver(*this);
+ 	 	 
+	 CIMCacheFactory::Release();
+	 
+	 if(ret)
+		 {
+		 return KErrNone;	
+		 }
+	 return KErrArgument;
+	}
+
+// -----------------------------------------------------------------------------
+// Cimcache_test::AppendMessageL
+// Example test method function.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt Cimcache_test::AppendMessageL( CStifItemParser& /*aItem*/ )
+    {
+     CIMCacheFactory* instance = CIMCacheFactory::InstanceL(); 
+	   
+	 MIMCacheUpdater* updater = instance->CreateUpdaterL(1, _L("testlm123@gmail.com") ,ETrue);
+     updater->RegisterObserverL(*this);
+ 	 updater->StartNewConversationL( _L("testui123@gmail.com") ) ;
+ 	
+	 if( !iWait.IsStarted() )
+		 {
+		 iWait.Start();	
+		 }
+	 updater->AppendMessageL(_L("testui123@gmail.com"), _L("this is system or information message message") ) ;	
+	 updater->UnRegisterObserver(*this);
+	 CIMCacheFactory::Release();
+	 return KErrNone;
+    }
+ 		
+// -----------------------------------------------------------------------------
+// Cimcache_test::GetUnreadMsgCountL
+// Example test method function.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt Cimcache_test::GetNewMsgNotificationtL(CStifItemParser& /*aItem*/) 
+	{
+	 CIMCacheFactory* instance = CIMCacheFactory::InstanceL(); 
+	 MIMCacheAccessor* accessor = instance->CreateAccessorL(1, _L("testlm123@gmail.com") );
+	 accessor->RegisterObserverL(*this);
+	 MIMCacheUpdater* updater = instance->CreateUpdaterL(1, _L("testlm123@gmail.com"),ETrue);
+     updater->AppendReceiveMessageL( _L("testui123@gmail.com"),_L("hello this is new message notification") ) ;
+     
+     if( !iWait.IsStarted() )
+		 {
+		 iWait.Start();	
+		 }
+	 accessor->UnRegisterObserver(*this);	 
+	 
+ 	 CIMCacheFactory::Release();
+	
+	 return KErrNone;
+	}
+
+
+// -----------------------------------------------------------------------------
+// Cimcache_test::GetChatListTestL
+// Example test method function.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt Cimcache_test::GetChatListTestL( CStifItemParser& /*aItem*/)
+	{
+	TInt error = KErrGeneral;
+	
+	CIMCacheFactory* instance = CIMCacheFactory::InstanceL();
+    MIMCacheUpdater* updater = instance->CreateUpdaterL(1, _L("testlm123@gmail.com"), EFalse );    
+    
+    updater->AppendReceiveMessageL( _L("testui123@gmail.com"),_L("hello this is new message notification 1 ") ) ;
+    updater->AppendReceiveMessageL( _L("abc123@gmail.com"),_L("hello this is new message notification 2 ") ) ;
+    updater->AppendReceiveMessageL( _L("testgizmo123@gmail.com"),_L("hello this is new message notification 3 ") ) ;
+   
+    
+    RArray<SIMCacheChatItem> listArray = updater->GetChatListL( 1 );
+    
+    if( listArray.Count() == 3 ) // total 3 chat created in server
+	    {
+	    error = KErrNone;	
+	    }
+
+    CIMCacheFactory::Release();  
+    
+	return error;
+	}
+// -----------------------------------------------------------------------------
+// Cimcache_test::AccessorCloseConversationTestL
+// Example test method function.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//      
+TInt Cimcache_test::AccessorCloseConversationTestL( CStifItemParser& /*aItem*/)
+	{
+	TInt error = KErrGeneral;
+
+	CIMCacheFactory* instance = CIMCacheFactory::InstanceL(); 
+	
+	MIMCacheUpdater* updater = instance->CreateUpdaterL(1, _L("testlm123@gmail.com"),EFalse );    
+    updater->AppendReceiveMessageL( _L("testui123@gmail.com"),_L("hello this is new message notification 1 ") ) ;
+  	
+	MIMCacheAccessor* accessor = instance->CreateAccessorL(1, _L("testlm123@gmail.com") );
+	accessor->RegisterObserverL(*this);
+	
+	if( accessor->IsConversationExistL(_L("testui123@gmail.com") ) )
+		{
+			// close the active conversation
+		accessor->CloseConversationL( _L("testui123@gmail.com") );
+			
+		if( !iWait.IsStarted() )
+			 {
+			 iWait.Start(); 
+			 }
+		error = KErrNone;
+		}
+
+	accessor->UnRegisterObserver(*this);
+	
+	CIMCacheFactory::Release();
+
+	return error;
+	}
+
+// -----------------------------------------------------------------------------
+// Cimcache_test::HandleIMCacheNewMessageEventL
+// Example test method function.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+
+void Cimcache_test::HandleIMCacheEventL( TIMCacheEventType aEventType, TAny* /*aChatMessage*/  )
+	{
+	switch( aEventType )
+		{
+		case EIMCacheUnreadMessage :
+				{
+				if( iWait.IsStarted() )
+					 {
+					 iWait.AsyncStop();	
+					 }	
+				break;
+				}
+			case EIMCacheUnreadChange :
+				{
+				if( iWait.IsStarted() )
+					 {
+					 iWait.AsyncStop();	
+					 }
+				break;
+				}
+			
+			case EIMCacheRequestCompleted :
+				{
+				if( iWait.IsStarted() )
+					 {
+					 iWait.AsyncStop();	
+					 }
+				break;
+				}
+			case EIMCacheNewMessage :
+				{
+				iMessageFetch++;
+                if( iWait.IsStarted() && iMessageFetch == 2 )
+                    {
+                    iWait.AsyncStop(); 
+                    }
+				break;
+				}
+			case EIMCacheNewChat:
+			    {
+	             if( iWait.IsStarted() )
+                     {
+                     iWait.AsyncStop(); 
+                     }
+                break;
+			    }
+			case EIMCacheChatClosed:
+			    {
+	              if( iWait.IsStarted() )
+                     {
+                     iWait.AsyncStop(); 
+                     }
+			    break;
+			    }
+			
+		}
+	}
+// ========================== OTHER EXPORTED FUNCTIONS =========================
+// None
+
+// end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/im_cache_server_api/group/bld.inf	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,29 @@
+/*
+* 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 
+:                imcache server
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+../inc/cinstantmsgindicator.h     		MW_LAYER_PLATFORM_EXPORT_PATH(cinstantmsgindicator.h)
+
+//end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/im_cache_server_api/im_cache_server_api.metaxml	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,13 @@
+<?xml version="1.0" ?>
+<api id="863647221bb5911f41a64c87ee43d8dd" dataversion="1.0">
+<name>im_cache_server_api</name>
+<description>This is a API that providesthe interface for the plugins, the cache server passes on the infomation to the plugins.</description>
+<type>c++</type>
+<subsystem>instantmessagingcache</subsystem>
+<libs></libs>
+<release category="domain" sinceversion=""/>
+<attributes>
+<htmldocprovided>yes</htmldocprovided>
+<adaptation>no</adaptation>
+</attributes>
+</api>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/im_cache_server_api/inc/cinstantmsgindicator.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,94 @@
+/*
+* 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:  base class declaration for accessing the cache information
+*
+*/
+
+
+
+#ifndef __CINSTNATMSGINDICATOR_H
+#define __CINSTNATMSGINDICATOR_H
+// INCLUDES
+#include <e32base.h>
+#include <ecom/ecom.h>
+
+//Constants
+// interface uid for the instantmessagecache.
+const TUid KINSTANTMSGINTERFACEUID={0x20026768};
+
+// The general rule is that the (category) UID must be the same as the Security ID (the SID)
+// of the process in which the code that is performing the define operation is running. 
+// In effect, this forms a data cage, preventing a process from defining, or "occupying", 
+// another process's property. 
+// hence this is the uid of imcacheserver.
+const TUid KIMStatusProperty={0x2001242A};
+enum TIMStatusPropertyKeys
+    {
+    EIMStatusPropertyMessageCount,
+    EIMStatusPropertyServiceId,
+    EIMStatusPropertySenderId,
+    EIMMultipleSender
+    };
+
+ /**
+  * An interface for setting/resetting statuspane icon
+  *
+  * @since 5.0
+  */
+ class CInstantMsgIndicator: public CBase
+     {
+      public:
+        
+        static CInstantMsgIndicator* CreateImplementationL( TUid aUid );
+       
+        virtual ~CInstantMsgIndicator();
+     public:
+         
+         /**
+          * sets/resets the status pane indicator
+          * @param aNewMessages, new message count
+          * @param aSeriveId, service id.
+          * @param aSenderId, message sender id.
+          * @param aMultipleSender, count of number of P-2_p chats.
+          * @param aCloseConversation, indicates that this even came from closing the 
+          * conversation and hence no need to paly the tone if there were already new messages.
+          */
+ 	   virtual void MessageInfoL(TInt aNewMessages, TInt aSeriveId,const TDesC& aSenderId,
+ 	                             TInt aMultipleSenders,TBool aCloseConversation = EFalse) = 0;	
+		 
+     private:
+         /**
+          * Instance identifier key. When instance of an implementation is
+          * created by ECOM framework, the framework will assign a UID for
+          * it. The UID is used in the destructor to notify framework that
+          * this instance is being destroyed and resources can be released.
+          * Plugin implementations should leave this untouched, as the inline
+          * destructor and constructor method take care of ECom releasing.
+          */
+         TUid iDtor_ID_Key; 
+     };
+ 
+ inline CInstantMsgIndicator* CInstantMsgIndicator::CreateImplementationL( TUid aUid )
+     {
+     TAny* ptr = REComSession::CreateImplementationL( aUid, _FOFF( CInstantMsgIndicator, iDtor_ID_Key ) );
+     CInstantMsgIndicator* impl = static_cast<CInstantMsgIndicator*> (ptr);
+     return impl;
+     }
+
+ inline CInstantMsgIndicator::~CInstantMsgIndicator()
+     {
+     REComSession::DestroyedImplementation( iDtor_ID_Key );
+     }
+ 
+ #endif //__CINSTNATMSGINDICATOR_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/presence_avabilitytext/group/bld.inf	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,26 @@
+/*
+* 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:  bld.inf for presence_avalability text
+*
+*/
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+../inc/avabilitytext.h     	MW_LAYER_PLATFORM_EXPORT_PATH(avabilitytext.h)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/presence_avabilitytext/inc/avabilitytext.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,105 @@
+/*
+* 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_avalability text
+*
+*/
+#ifndef __AVABILITYTEXT_H
+#define __AVABILITYTEXT_H
+
+//availability text to be used with MPresenceBuddyInfo2::EBusy.
+//changed status values to sync with icons ids available in the branddata
+_LIT(KAwayState,"away");
+_LIT(KOnPhoneState,"onmobile");
+_LIT(KDndState,"dnd");
+
+//availability text to be used with MPresenceBuddyInfo2::EUnknownAvailability.
+_LIT(KInvisibleState,"offline");
+
+//Extension key-value to be used with MPresenceBuddyInfo2.
+//Extension Keys
+_LIT(KExtensionKey,"ExtensionKey");
+
+//Extension Values.
+_LIT8(KPendingRequestExtensionValue,"pending");
+_LIT8(KBlockedExtensionValue,"block");
+_LIT8(KServiceExtensionValue,"ServiceOut");
+_LIT8(KCallForwardExtensionValue,"CallForward");
+
+/*
+=========================Example For BUSY States =============================
+MPresenceBuddyInfo2* buddyPresInfo = MPresenceBuddyInfo2::NewLC();
+
+//This will set presence status as On phone
+buddyPresInfo->SetAvailabilityL( MPresenceBuddyInfo2::EBusy,KOnPhoneState); 
+
+//This will set presence status as Away
+buddyPresInfo->SetAvailabilityL( MPresenceBuddyInfo2::EBusy,KAwayState); 
+
+//This will set presence status as do not disture
+buddyPresInfo->SetAvailabilityL( MPresenceBuddyInfo2::EBusy,KDndState); 
+
+NOTE:: if TDesC& aAvailabilityText(second arg) is other then mentioned and 
+	   TAvailabilityValues aAvailability is MPresenceBuddyInfo2::EBusy
+	   then presence will be BUSY.
+==============================================================================
+*/
+
+/*
+=========================Example For INVISIBLE State===========================
+MPresenceBuddyInfo2* buddyPresInfo = MPresenceBuddyInfo2::NewLC();
+
+//This will set presence status as Invisible.
+buddyPresInfo->SetAvailabilityL( MPresenceBuddyInfo2::EUnknownAvailability,KInvisibleState); 
+
+NOTE:: if TDesC& aAvailabilityText(second arg) is other then mentioned and 
+	   TAvailabilityValues aAvailability is MPresenceBuddyInfo2::EUnknownAvailability
+	   then presence will be UNKNOWN.
+
+==============================================================================
+*/
+
+/*
+=========================Example For BLOCKED And PENDING State=================
+MPresenceBuddyInfo2* buddyPresInfo = MPresenceBuddyInfo2::NewLC();
+
+//This will set presence status as pending
+buddyPresInfo->SetAnyFieldL( KExtensionKey, KPendingRequestExtensionValue ); 
+
+//This will set presence status as blocked
+buddyPresInfo->SetAnyFieldL( KExtensionKey, KBlockedExtensionValue );
+
+NOTE:: if TDesC8& aValue(second arg) is other then mentioned then the(blocked)
+and pending states will not be shown
+provided the prnding and blocked state are not required at the smae time.
+==============================================================================
+*/
+
+/*
+=========================Example For ServiceOut And CallForward State=================
+MPresenceBuddyInfo2* buddyPresInfo = MPresenceBuddyInfo2::NewLC();
+
+//This will set presence status as CallForward
+buddyPresInfo->SetAnyFieldL( KExtensionKey, KCallForwardExtensionValue ); 
+
+//This will set presence status as ServiceOut
+buddyPresInfo->SetAnyFieldL( KExtensionKey, KServiceOutExtensionValue );
+
+NOTE:: if TDesC8& aValue(second arg) is other then mentioned then the(blocked)
+and pending states will not be shown
+provided the prnding and blocked state are not required at the smae time.
+==============================================================================
+*/
+#endif      //__AVABILITYTEXT_H
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_base_api/group/bld.inf	Wed Nov 03 09:32:20 2010 +0530
@@ -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 
+:                XIMP Core Base API
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+../inc/ximpbase.inl     MW_LAYER_PLATFORM_EXPORT_PATH(ximpbase.inl)
+../inc/ximpbase.h     MW_LAYER_PLATFORM_EXPORT_PATH(ximpbase.h)
+../inc/ximperrors.hrh     MW_LAYER_PLATFORM_EXPORT_PATH(ximperrors.hrh)
+../inc/ximpbaseifids.hrh     MW_LAYER_PLATFORM_EXPORT_PATH(ximpbaseifids.hrh)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_base_api/inc/ximpbase.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,411 @@
+/*
+* 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:  Base interface and related helpers for XIMPFw interfaces.
+*
+*/
+
+#ifndef XIMPBASE_H
+#define XIMPBASE_H
+
+#include <e32std.h>
+#include <ximpbaseifids.hrh>
+
+
+/**
+ * Base interface for XIMP Framework object interfaces.
+ *
+ * Base interface for XIMP Framework object interfaces.
+ * -# All other XIMP Framework object interfaces inherit
+ *    directly from MXIMPBase.
+ * -# Future extended XIMP Framework interfaces may inherit
+ *    also indirectly from MXIMPBase, by deriving from some current
+ *    XIMP Framework interface, and extending the interface
+ *    functionality with some new methods.
+ * -# Each XIMP Framework object derives only once
+ *    from MXIMPBase.
+ *
+ *
+ * MXIMPBase::GetInterface() methods allows client to
+ * discover referencies to other interfaces that the object
+ * in question supports. MXIMPBase::GetInterfaceId() method
+ * lets client to discover the objects primary interface id.
+ *
+ * @ingroup ximpfwbaseapi
+ * @since S60 v3.2
+ */
+class MXIMPBase
+    {
+public:
+
+    /** Interface ID for the MXIMPBase. */
+    enum { KInterfaceId = XIMP_IF_ID_BASE };
+
+
+public:
+
+    /**
+     * Options for interface resolving.
+     *
+     * Client gives one of these options for interface resolving,
+     * to select which way the client wants to handle possible
+     * unknown interface.
+     */
+    enum TIfGetOps
+        {
+        /**
+         * Requestes the interface resolver to signal unknown
+         * interface by returning NULL.
+         */
+        EReturnNullIfUnknown = 0,
+
+        /**
+         * Requestes the interface resolver to signal unknown
+         * interface by raising a panic.
+         */
+        EPanicIfUnknown
+        };
+
+
+
+protected:
+
+    /**
+     * Protected destructor.
+     *
+     * Concrete objects can't be
+     * deleted via base interface.
+     */
+    virtual ~MXIMPBase() {};
+
+
+
+public:
+
+
+    /**
+     * Const interface query.
+     *
+     * Interface query to access other XIMP Framework
+     * interfaces that the object in question supports.
+     * Returns const (read-only) interface. If unsupported
+     * interface type is tried to access, error is handle as
+     * defined by given aOps parameter.
+     *
+     * NOTE: Client may use method directly, and cast returned
+     * TAny pointer to requested interface type. Or client optionally
+     * use templated TXIMPGetInterface helper to encapsulate
+     * interface query and type cast.
+     *
+     * @param [in] aInterfaceId
+     *        Interface identifier identifying the interface
+     *        to retrieve.
+     *
+     * @param [in] aOps
+     *        Options for interface query.
+     *
+     * @return Pointer to the retrieved interface type.
+     *         NULL if the object in question does not support
+     *         the requested interface.
+     */
+    virtual const TAny* GetInterface(
+                    TInt32 aInterfaceId,
+                    TIfGetOps aOps ) const = 0;
+
+
+    /**
+     * Non-const interface query.
+     *
+     * Interface query to access other XIMP Framework
+     * interfaces that the object in question supports.
+     * Returns modifiable (non-const) interface. If unsupported
+     * interface type is tried to access, error is handle as
+     * defined by given aOps parameter.
+     *
+     * NOTE: Client may use method directly, and cast returned
+     * TAny pointer to requested interface type. Or client optionally
+     * use templated TXIMPGetInterface helper to encapsulate
+     * interface query and type cast.
+     *
+     * @param [in] aInterfaceId
+     *        Interface identifier identifying the interface
+     *        to retrieve.
+     *
+     * @param [in] aOps
+     *        Options for interface query.
+     *
+     * @return Pointer to the retrieved interface type.
+     *         NULL if the object in question does not support
+     *         the requested interface.
+     */
+    virtual TAny* GetInterface(
+                    TInt32 aInterfaceId,
+                    TIfGetOps aOps ) = 0;
+
+
+    /**
+     * Interface identifier access.
+     *
+     * Method to access object interface identifier.
+     * Returns always objects "primary" interface id.
+     * Primary interface id, is the interface id of the
+     * MXIMPBase derived interface that object
+     * implements.
+     *
+     * @return Object interface id.
+     */
+    virtual TInt32 GetInterfaceId() const = 0;
+
+    };
+
+
+
+/**
+ * Templated array of pointers.
+ *
+ * Templated array of pointers, array owns the pointed objects
+ * and overwrites the normal RPointerArray::Close()
+ * behaviour to destroy objects, before reseting the
+ * array contents.
+ *
+ * Array is used with XIMP Framework interface objects.
+ *
+ * @ingroup ximpfwbaseapi
+ * @since S60 v3.2
+ */
+template< class T >
+class RXIMPObjOwningPtrArray : public RPointerArray<T>
+    {
+ public:
+
+    /**
+     * Default C++ constructor.
+     */
+    inline RXIMPObjOwningPtrArray();
+
+
+    /**
+     * Overwritten Close().
+     *
+     * Calls ResetAndDestroy() to delete holded objects
+     * before reseting array contents. Thus array can be
+     * pushed on the cleanup stack with CleanupClosePushL().
+     */
+    inline void Close();
+
+
+    /**
+     * @todo
+     * R-class destrcutor. This must be removed from interface,
+     * since by Symbian OS convention, R-classes do not have destructor.
+     */
+    inline ~RXIMPObjOwningPtrArray();
+    };
+
+
+
+
+
+/**
+ * Request identifier.
+ *
+ * Request identifier to identify the asynchronous request
+ * made by client or protocoll adaptation to the XIMP Framework.
+ * Identifier type is also used to identify requests that
+ * XIMP Framework issues to Protocol Adaptation.
+ *
+ * @ingroup ximpfwbaseapi
+ * @since S60 v3.2
+ */
+class TXIMPRequestId
+    {
+public:
+    enum
+        {
+        /** The maximum size of the request id.*/
+        EMaxSize = 16
+        };
+
+public:
+
+    /**
+     * C++ default constructor.
+     *
+     * Initializes the request ID with TXIMPRequestId::Null()
+     * value.
+     */
+    inline TXIMPRequestId();
+
+
+    /**
+     * Equality operator.
+     *
+     * Tests request ID for equality with the specified request ID.
+     *
+     * @param [in] aRhs
+     *        The request ID to be compared with.
+     *
+     * @return ETrue, if request ID equals to the specified one.
+     *         Otherwise EFalse.
+     */
+    inline TBool operator==( const TXIMPRequestId& aRhs ) const;
+
+
+    /**
+     * Inequality operator.
+     *
+     * Tests this request ID for inequality with the specified request ID.
+     *
+     * @param [in] aRhs
+     *        The request ID to be compared with.
+     *
+     * @return ETrue, if request ID inequals to the specified one.
+     *         Otherwise EFalse.
+     */
+    inline TBool operator!=( const TXIMPRequestId& aRhs ) const;
+
+
+    /**
+     * Constructs a Null-valued TXIMPRequestId object.
+     *
+     * @return Null-valued TXIMPRequestId object.
+     */
+    static inline TXIMPRequestId Null();
+
+
+    /**
+     * Constructs a TXIMPRequestId object having
+     * given integer value.
+     *
+     * This method is ment for XIMP Framework
+     * client and adaptation level test code.
+     * In normal circumstances XIMP Framework
+     * fills the TXIMPRequestId contents internally.
+     *
+     * @param aValue Integer value for TXIMPRequestId.
+     *
+     * @return Integer-valued TXIMPRequestId object.
+     */
+    static inline TXIMPRequestId Init( TInt aValue );
+
+
+
+private: // data
+
+    //OWN: Request id data
+    TUint8 iRequestId[ TXIMPRequestId::EMaxSize ];
+    };
+
+
+
+
+/**
+ * Interface query and type cast helper.
+ *
+ * Templated interface query and type cast helper.
+ * Capable to retrieve const interface from const source object
+ * and non-const interface from non-const source object.
+ *
+ * Const interface usage example:
+ * @code
+ * const MXIMPBase* obj = GetObjectImplementingTheInterfaceLC();
+ *
+ * const MXimpFwTheInterface* theInterface =
+ *      TXIMPGetInterface< const MXimpFwTheInterface >::From( *obj,
+ *                                                          MXIMPBase::EPanicIfUnknown );
+ * theInterface->DoSomething();
+ * @endcode
+ *
+ *
+ * Non-const interface usage example:
+ * @code
+ * MXIMPBase* obj = GetObjectImplementingTheInterfaceLC();
+ *
+ * MXimpFwTheInterface* theInterface =
+ *      TXIMPGetInterface< MXimpFwTheInterface >::From( *obj,
+ *                                                    MXIMPBase::EPanicIfUnknown );
+ * theInterface->DoSomething();
+ * @endcode
+ *
+ * @ingroup ximpfwbaseapi
+ * @since S60 v3.2
+ */
+template< class T >
+class TXIMPGetInterface
+    {
+public:
+
+    /**
+     * Interface query and type cast.
+     *
+     * Encapsulates query of const interface from given
+     * const source object. The retrieved interface type is
+     * defined with template parameter. KInterfaceId identifier
+     * from template parameter, is used to identify
+     * the retrieved interface.
+     *
+     * @param [in] aObj
+     *        Source object from where to retrieve interface.
+     *
+     * @param [in] aOps
+     *        Options for interface resolving.
+     *        Given options are delivered directly
+     *        to MXIMPBase::GetInterface().
+     *
+     * @return Pointer to the retrieved interface.
+     *         NULL if the object in question does not support
+     *         the requested interface.
+     */
+    static inline T* From(
+                const MXIMPBase& aObj,
+                MXIMPBase::TIfGetOps aOps );
+
+
+
+    /**
+     * Interface query and type cast.
+     *
+     * Encapsulates query of interface from given source object.
+     * The retrieved interface type is defined with template
+     * parameter. KInterfaceId identifier from template parameter,
+     * is used to identify the retrieved interface.
+     *
+     * @param [in] aObj
+     *        Source object from where to retrieve interface.
+     *
+     * @param [in] aOps
+     *        Options for interface resolving.
+     *        Given options are delivered directly
+     *        to MXIMPBase::GetInterface().
+     *
+     * @return Pointer to the retrieved interface.
+     *         NULL if the object in question does not support
+     *         the requested interface.
+     */
+    static inline T* From(
+                MXIMPBase& aObj,
+                MXIMPBase::TIfGetOps aOps );
+
+
+
+private:   //Prohibited constructor
+    TXIMPGetInterface();
+    };
+
+
+#include "ximpbase.inl"
+
+#endif // XIMPBASE_H
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_base_api/inc/ximpbase.inl	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,146 @@
+/*
+* 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:  Base interface and related helpers for XIMPFw interfaces.
+*
+*/
+
+#include <e32base.h>
+
+// -----------------------------------------------------------------------------
+// RXIMPObjOwningPtrArray<T>::RXIMPObjOwningPtrArray() implementation.
+//
+// -----------------------------------------------------------------------------
+//
+template <class T>
+inline RXIMPObjOwningPtrArray<T>::RXIMPObjOwningPtrArray()
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// RXIMPObjOwningPtrArray<T>::Close() implementation.
+// Calls ResetAndDestroy() to destroy holded objects.
+// -----------------------------------------------------------------------------
+//
+template <class T>
+inline void RXIMPObjOwningPtrArray<T>::Close()
+    {
+    RPointerArray<T>::ResetAndDestroy();
+    }
+
+// -----------------------------------------------------------------------------
+// RXIMPObjOwningPtrArray<T>::~RXIMPObjOwningPtrArray()
+// @todo R-class destrcutor - will be removed from interface.
+// -----------------------------------------------------------------------------
+//
+template <class T>
+inline RXIMPObjOwningPtrArray<T>::~RXIMPObjOwningPtrArray()
+    {
+    Close();
+    }
+
+// -----------------------------------------------------------------------------
+// TXIMPRequestId::TXIMPRequestId()
+// C++ default constructor.
+// -----------------------------------------------------------------------------
+//
+inline TXIMPRequestId::TXIMPRequestId()
+    {
+    Mem::FillZ( iRequestId, TXIMPRequestId::EMaxSize );
+    }
+
+// -----------------------------------------------------------------------------
+// TXIMPRequestId::operator==()
+// Tests request ID for equality with the specified request ID.
+// -----------------------------------------------------------------------------
+//
+inline TBool TXIMPRequestId::operator==( const TXIMPRequestId& aRhs ) const
+    {
+    if ( Mem::Compare( aRhs.iRequestId,
+                       TXIMPRequestId::EMaxSize,
+                       iRequestId,
+                       TXIMPRequestId::EMaxSize ) == 0 )
+        {
+        return ETrue;
+        }
+
+    return EFalse;
+    }
+
+// -----------------------------------------------------------------------------
+// TXIMPRequestId::operator!=()
+// Tests this request ID for inequality with the specified request ID.
+// -----------------------------------------------------------------------------
+//
+inline TBool TXIMPRequestId::operator!=( const TXIMPRequestId& aRhs ) const
+    {
+    if ( Mem::Compare( aRhs.iRequestId,
+                       TXIMPRequestId::EMaxSize,
+                       iRequestId,
+                       TXIMPRequestId::EMaxSize ) != 0 )
+        {
+        return ETrue;
+        }
+
+    return EFalse;
+    }
+
+// -----------------------------------------------------------------------------
+// TXIMPRequestId::Null()
+// Returns a null-valued request ID
+// -----------------------------------------------------------------------------
+//
+inline TXIMPRequestId TXIMPRequestId::Null()
+    {
+    return TXIMPRequestId();
+    }
+
+// -----------------------------------------------------------------------------
+// TXIMPRequestId::Init()
+// Returns a integer-valued request ID
+// -----------------------------------------------------------------------------
+//
+inline TXIMPRequestId TXIMPRequestId::Init( TInt aValue )
+    {
+    TXIMPRequestId id;
+    Mem::Copy( &id.iRequestId, &aValue, sizeof( TInt ) );
+    return id;
+    }
+
+// -----------------------------------------------------------------------------
+// TXIMPGetInterface<T>::From()
+// Const interface query and type cast.
+// -----------------------------------------------------------------------------
+//
+template <class T>
+inline T* TXIMPGetInterface<T>::From( const MXIMPBase& aObj,
+                                      MXIMPBase::TIfGetOps aOps )
+    {
+    const TAny* ifPtr = aObj.GetInterface( T::KInterfaceId, aOps );
+    const T* ifTypePtr = static_cast< const T* >( ifPtr );
+    return ifTypePtr;
+    }
+
+// -----------------------------------------------------------------------------
+// TXIMPGetInterface<T>::From()
+// Non-const interface query and type cast.
+// -----------------------------------------------------------------------------
+//
+template< class T >
+inline T* TXIMPGetInterface<T>::From( MXIMPBase& aObj,
+                                      MXIMPBase::TIfGetOps aOps )
+    {
+    TAny* ifPtr = aObj.GetInterface( T::KInterfaceId, aOps );
+    T* ifTypePtr = static_cast< T* >( ifPtr );
+    return ifTypePtr;
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_base_api/inc/ximpbaseifids.hrh	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,47 @@
+/*
+* 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:  XIMP Framework Base API interface IDs.
+*
+*/
+
+#ifndef XIMPBASEIFIDS_HRH
+#define XIMPBASEIFIDS_HRH
+
+
+/**
+ * @defgroup ximpcoreapi XIMP Framework Core API
+ * @defgroup ximpfwbaseapi XIMP Framework Base API
+ * @ingroup ximpcoreapi
+ *
+ * XIMP Framework Base API declares XIMP Framework
+ * specific base structures and definitions, which are used
+ * in all other XIMP Framework APIs.
+ *
+ * XIMP Framework Base API defines abstract base interface,
+ * from where all other XIMP Framework object interfaces
+ * derive from. XIMP Framework Base API contains also common
+ * helpers for interface use, common error codes, and comon
+ * request ID structures.
+ *
+ * @since S60 v3.2
+ */
+
+
+// Interface UID for XIMPFw Base API interfaces
+#define XIMP_IF_ID_BASE                 0x10282DD5
+
+
+
+#endif // XIMPBASEIFIDS_HRH
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_base_api/inc/ximperrors.hrh	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,92 @@
+/*
+* 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:  Protocol agnostic error codes for XIMP Framework.
+*
+*/
+
+#ifndef XIMPERRORS_HRH
+#define XIMPERRORS_HRH
+
+
+
+/**
+ * XIMP Framework core error codes.
+ *
+ * Error codes returned from XIMP Framework core are either:
+ * -# System wide Symbian OS error codes (KErrNone, KErrNoMemory, etc.)
+ * -# Protocol agnostic core related error codes defined here.
+ *    These error codes have range: KXIMPErrBase ... KXIMPErrLow.
+ *
+ * @ingroup ximpfwbaseapi
+ * @since S60 v3.2
+ */
+enum
+    {
+    KXIMPErrBase = -30131,
+
+    /**
+     * Generic error code to indicate that request processing
+     * has failed on ximp protocol level to some error,
+     * which isn't mapped to any other more detailed
+     * error code.
+     */
+    KXIMPErrServiceGeneralError = KXIMPErrBase,
+
+
+    /**
+     * Error code to indicate that ximp service
+     * doesn't support the request issued by the client.
+     */
+    KXIMPErrServiceRequestTypeNotSupported = KXIMPErrBase - 1,
+
+
+    /**
+     * Error code to indicate that request handling has
+     * failed because because the ximp service is
+     * shutting down.
+     */
+    KXIMPErrServiceShutdown = KXIMPErrBase - 2,
+
+
+    /**
+     * Error code to indicate that ximp service
+     * has terminated the ximp session.
+     */
+    KXIMPErrServiceForceClosedSession = KXIMPErrBase - 3,
+
+
+    /**
+     * Error code to indicate that request handling has
+     * failed on ximp protocol level to insufficient
+     * user authentication.
+     */
+    KXIMPErrServiceAuthenticationFailed = KXIMPErrBase - 4,
+
+
+    /**
+     * Error code to indicate that request handling has
+     * timeouted on ximp protocol level.
+     */
+    KXIMPErrServicRequestTimeouted = KXIMPErrBase - 5,
+    
+    KXIMPErrLow = -30137
+    
+    // Note that presence uses codes from -30138 to -30150
+
+    };
+
+
+#endif // XIMPERRORS_HRH
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_base_api/ximp_core_base_api.metaxml	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,20 @@
+<?xml version="1.0" ?>
+<api id="ea932da914c779d12c7834b6615d31fd" dataversion="1.0">
+<name>XIMP Core Base API</name>
+<description>Contains common base interface and definitions shared between all other XIMP Framework APIs.</description>
+<type>c++</type>
+<subsystem>ximpfw</subsystem>
+<libs><lib name="ximpdatamodel.lib"/>
+<lib name="ximpoperations.lib"/>
+<lib name="ximpecomhook.lib"/>
+<lib name="ximpmanager.lib"/>
+<lib name="ximpsrvclient.lib"/>
+<lib name="ximpprocessor.lib"/>
+<lib name="ximputils.lib"/>
+</libs>
+<release category="domain" sinceversion=""/>
+<attributes>
+<htmldocprovided>yes</htmldocprovided>
+<adaptation>no</adaptation>
+</attributes>
+</api>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_data_model_api/group/bld.inf	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  File that exports the files belonging to 
+:                XIMP Core Data Model API
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+../inc/ximpprotocolinfo.h     MW_LAYER_PLATFORM_EXPORT_PATH(ximpprotocolinfo.h)
+../inc/ximpcontextclientinfo.h     MW_LAYER_PLATFORM_EXPORT_PATH(ximpcontextclientinfo.h)
+../inc/ximpobjectfactory.h     MW_LAYER_PLATFORM_EXPORT_PATH(ximpobjectfactory.h)
+../inc/ximpdatamodelifids.hrh     MW_LAYER_PLATFORM_EXPORT_PATH(ximpdatamodelifids.hrh)
+../inc/ximpserviceinfo.h     MW_LAYER_PLATFORM_EXPORT_PATH(ximpserviceinfo.h)
+../inc/ximpfeatureinfo.h     MW_LAYER_PLATFORM_EXPORT_PATH(ximpfeatureinfo.h)
+../inc/ximpstatus.h     MW_LAYER_PLATFORM_EXPORT_PATH(ximpstatus.h)
+../inc/ximpcontextstate.h     MW_LAYER_PLATFORM_EXPORT_PATH(ximpcontextstate.h)
+../inc/ximpidentity.h     MW_LAYER_PLATFORM_EXPORT_PATH(ximpidentity.h)
+../inc/ximprestrictedobjectcollection.h     MW_LAYER_PLATFORM_EXPORT_PATH(ximprestrictedobjectcollection.h)
+../inc/ximpobjectcollection.h     MW_LAYER_PLATFORM_EXPORT_PATH(ximpobjectcollection.h)
+../inc/ximpdatasubscriptionstate.h     MW_LAYER_PLATFORM_EXPORT_PATH(ximpdatasubscriptionstate.h)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_data_model_api/inc/ximpcontextclientinfo.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,89 @@
+/*
+* 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:  Interface for presence context client info object.
+*
+*/
+
+#ifndef MXIMPFWCONTEXTCLIENTINFO_H
+#define MXIMPFWCONTEXTCLIENTINFO_H
+
+#include <e32std.h>
+#include <ximpbase.h>
+#include <ximpdatamodelifids.hrh>
+
+
+class MXIMPIdentity;
+
+
+/**
+ * Interface for XIMP context client info object.
+ *
+ * XIMP context client info object presents information
+ * about single XIMP context client.
+ *
+ * @ingroup ximpdatamodelapi
+ * @since S60 v3.2
+ */
+class MXIMPContextClientInfo : public MXIMPBase
+    {
+public:
+
+    /** Interface ID for the MXIMPContextClientInfo. */
+    enum { KInterfaceId = XIMP_IF_ID_CONTEXT_CLIENT_INFO };
+
+
+public:
+
+    /**
+     * Public destructor.
+     * Objects can be deleted through this interface.
+     */
+    virtual ~MXIMPContextClientInfo() {}
+
+
+public:
+
+
+    /**
+     * Returns XIMP context client identity value.
+     *
+     * @return The XIMP context client
+     *         identity value.
+     */
+    virtual const MXIMPIdentity& ClientId() const = 0;
+
+
+
+    /**
+     * Sets XIMP context client identity value.
+     *
+     * @param [in] aIdentity
+     *        New XIMP context client identity value.
+     *        Ownership of the argument is transfered to
+     *        callee, if method succeeds without a leave.
+     *
+     * @leave KErrNoMemory if failed to allocate memory.
+     * @leave KErrArgument if NULL argument were provided.
+     */
+    virtual void SetClientIdL(
+                MXIMPIdentity* aIdentity ) = 0;
+
+
+    };
+
+
+
+#endif // MXIMPFWCONTEXTCLIENTINFO_H
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_data_model_api/inc/ximpcontextstate.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,84 @@
+/*
+* 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:  Interface for XIMP context state object.
+*
+*/
+
+#ifndef MXIMPFWCONTEXTSTATE_H
+#define MXIMPFWCONTEXTSTATE_H
+
+#include <e32std.h>
+#include <ximpbase.h>
+#include <ximpdatamodelifids.hrh>
+
+
+/**
+ * Interface for XIMP context state object.
+ *
+ * XIMP context state object presents state of the
+ * XIMP context.
+ *
+ * @ingroup ximpdatamodelapi
+ * @since S60 v3.2
+ */
+class MXIMPContextState : public MXIMPBase
+
+    {
+public:
+
+    /** Interface ID for the MXIMPContextState. */
+    enum { KInterfaceId = XIMP_IF_ID_CONTEXT_STATE };
+
+
+    /** XIMP context states. */
+    enum TState
+        {
+        /** Context is inactive */
+        EInactive = 0,
+
+        /** Context is binding to service */
+        EBinding,
+
+        /** Context is active and binded to service */
+        EActive,
+
+        /** Context is unbinding from service */
+        EUnbinding
+        };
+
+
+public:
+
+    /**
+     * Public destructor.
+     * Objects can be deleted through this interface.
+     */
+    virtual ~MXIMPContextState() {}
+
+
+public:
+
+    /**
+     * Gets the XIMP Context state value.
+     *
+     * @return The XIMP Context state value.
+     */
+    virtual TState ContextState() const = 0;
+
+    };
+
+
+#endif // MXIMPFWCONTEXTSTATE_H
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_data_model_api/inc/ximpdatamodelifids.hrh	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,60 @@
+/*
+* 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:  XIMP Framework Data Model API interface IDs.
+*
+*/
+
+#ifndef XIMPDATAMODELIFIDS_HRH
+#define XIMPDATAMODELIFIDS_HRH
+
+
+/**
+ * @defgroup ximpdatamodelapi XIMP Core Data Model API
+ * @ingroup ximpcoreapi
+ *
+ * XIMP Core Data Model API contains generic object 
+ * containers, status objects and identity objects. 
+ * API provides also abstract object factory interface
+ * to instantiate other objects.
+ *
+ * Object types declared in XIMP Core Data Model API
+ * are used both in XIMP Framework - client communication
+ * and in XIMP Framework - protocol adaptation cummunication.
+ *
+ * @since S60 v3.2
+ */
+
+// Datamodel IF id's
+// 10xx - ximp related
+// 11xx - presence related
+// 12xx - instant messaging related
+
+// Interface IDs for XIMP Data Model API interfaces
+#define XIMP_IF_ID_OBJECT_FACTORY                      1001
+#define XIMP_IF_ID_RESTRICTED_OBJECT_COLLECTION        1002
+#define XIMP_IF_ID_OBJECT_COLLECTION                   1003
+#define XIMP_IF_ID_PROTOCOL_INFO                       1004
+#define XIMP_IF_ID_SERVICE_INFO                        1005
+#define XIMP_IF_ID_FEATURE_INFO                        1006
+#define XIMP_IF_ID_CONTEXT_CLIENT_INFO                 1007
+#define XIMP_IF_ID_STATUS                              1008
+#define XIMP_IF_ID_CONTEXT_STATE                       1009
+#define XIMP_IF_ID_DATA_SUBSCRIPTION_STATE             1010
+#define XIMP_IF_ID_IDENTITY                            1011
+
+
+#endif // XIMPDATAMODELIFIDS_HRH
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_data_model_api/inc/ximpdatasubscriptionstate.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,133 @@
+/*
+* 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:  Interface for data subscription state object.
+*
+*/
+
+#ifndef MXIMPFWDATASUBSCRIPTIONSTATE_H
+#define MXIMPFWDATASUBSCRIPTIONSTATE_H
+
+#include <e32std.h>
+#include <ximpbase.h>
+#include <ximpdatamodelifids.hrh>
+
+/**
+ * Interface for data subscription state object.
+ *
+ * Data subscription state object contains information
+ * about certain data item subscription state.
+ *
+ * Protocol adaptation can use this object type to check
+ * and update item subscription state.
+ *
+ * To client direction XIMP Framework uses this
+ * object type to inform client about item current
+ * status in data change events.
+ *
+ *
+ * @ingroup ximpdatamodelapi
+ * @since S60 v3.2
+ */
+class MXIMPDataSubscriptionState : public MXIMPBase
+
+    {
+public:
+
+    /** Interface ID for the MXIMPDataSubscriptionState. */
+    enum { KInterfaceId = XIMP_IF_ID_DATA_SUBSCRIPTION_STATE };
+
+
+    /** Data subscription state enumeration. */
+    enum TSubscriptionState
+        {
+        /** Data item subscription isn't active. */
+        ESubscriptionInactive,
+
+        /** Data item subscription is active. */
+        ESubscriptionActive
+        };
+
+
+
+    /** Data state enumeration. */
+    enum TDataState
+        {
+        /** Data content isn't available. */
+        EDataUnavailable,
+
+        /** Data content is available. */
+        EDataAvailable
+        };
+
+
+public:
+
+    /**
+     * Public destructor.
+     * Objects can be deleted through this interface.
+     */
+    virtual ~MXIMPDataSubscriptionState() {}
+
+
+
+public:
+
+
+    /**
+     * Returns data subscription state.
+     *
+     * @return The data subscription state.
+     */
+    virtual TSubscriptionState SubscriptionState() const = 0;
+
+
+
+    /**
+     * Returns data state.
+     *
+     * @return The data state.
+     */
+    virtual TDataState DataState() const = 0;
+
+
+
+    /**
+     * Sets data subscription state value.
+     *
+     * @param [in] aSubscriptionState
+     *        New data subscription state value.
+     *
+     * @leave KErrNoMemory if failed to allocate memory.
+     */
+    virtual void SetSubscriptionStateL(
+                TSubscriptionState aSubscriptionState ) = 0;
+
+
+
+    /**
+     * Sets data state value.
+     *
+     * @param [in] aDataState
+     *        New data state value.
+     *
+     * @leave KErrNoMemory if failed to allocate memory.
+     */
+    virtual void SetDataStateL(
+                TDataState aDataState ) = 0;
+    };
+
+
+#endif // MXIMPFWDATASUBSCRIPTIONSTATE_H
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_data_model_api/inc/ximpfeatureinfo.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,129 @@
+/*
+* 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:  Interface for presence feature info object.
+*
+*/
+
+#ifndef MXIMPFWFEATUREINFO_H
+#define MXIMPFWFEATUREINFO_H
+
+#include <e32std.h>
+#include <bamdesca.h>
+#include <ximpbase.h>
+#include <ximpdatamodelifids.hrh>
+
+
+/**
+ * Literal feature IDs for XIMP Framework features.
+ *
+ * @ingroup ximpdatamodelapi
+ * @since S60 v3.2
+ *
+ * @todo Exact features & their IDs need to be defined.
+ */
+namespace NXIMPFeature
+    {
+    namespace Presence
+        {
+        _LIT8( KPublish,        "feat/pres/pub");
+        _LIT8( KFetch,          "feat/pres/fetch");
+        _LIT8( KSubscribe,      "feat/pres/subs");
+        _LIT8( KUnsubscribe,    "feat/pres/unsubs");
+        _LIT8( KAddContact,     "feat/pres/addcnt");
+        _LIT8( KDeleteContact,  "feat/pres/delcnt"); 
+        _LIT8( KBlock,          "feat/pres/block"); 
+        _LIT8( KUnBlock,        "feat/pres/unblock");
+        _LIT8( KAvatar,         "feat/pres/avatar");
+        }
+
+    namespace PresentityGroups
+        {
+        _LIT8( KCreate,         "feat/entgroup/create");
+        _LIT8( KDelete,         "feat/entgroup/delete");
+        }
+    namespace InstantMessage
+        {
+        _LIT8( KInstantMessage, "feat/im");
+        }
+    namespace Search
+        {
+        _LIT8( KSearch,         "feat/search");
+        }
+    }
+
+
+
+/**
+ * Interface for XIMP feature info object.
+ *
+ * @TODO Improve comments: Container used to present either XIMP Framework,
+ * Presence Protocol or Presence Context features.
+ *
+ * @ingroup ximpdatamodelapi
+ * @since S60 v3.2
+ */
+class MXIMPFeatureInfo : public MXIMPBase
+    {
+public:
+
+    /** The MXIMPFeatureInfo interface ID. */
+    enum { KInterfaceId = XIMP_IF_ID_FEATURE_INFO };
+
+
+public:
+
+
+    /**
+     * Public destructor.
+     * Objects can be deleted through this interface.
+     */
+    virtual ~MXIMPFeatureInfo() {}
+
+
+public:
+
+
+    /**
+     * Gets the list of feature IDs.
+     *
+     * @return The list of features. Depending from where
+     *         the MXIMPFeatureInfo object was retrieved,
+     *         list contains either XIMP Framework,
+     *         Presence Protocol or Presence Context features.
+     */
+    virtual const MDesC8Array& FeatureIds() const = 0;
+
+
+
+    /**
+     * Checks has the MXIMPFeatureInfo object the given feature
+     * ID or not.
+     *
+     * @param [in] aFeatureId
+     *        The feature ID which status to check.
+     *        XIMP Framework feature IDs are defined in
+     *        NXIMPFeature namespace.
+     *
+     * @return KErrNone if the ID is found from the feature ID list.
+     *         KErrNotFound if the ID is not found from feature ID list.
+     */
+    virtual TInt HasFeatureId(
+                const TDesC8& aFeatureId ) = 0;
+
+    };
+
+
+#endif // MXIMPFWFEATUREINFO_H
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_data_model_api/inc/ximpidentity.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,81 @@
+/*
+* 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:  Interface for identity object.
+*
+*/
+
+#ifndef MXIMPFWIDENTITY_H
+#define MXIMPFWIDENTITY_H
+
+#include <e32std.h>
+#include <ximpbase.h>
+#include <ximpdatamodelifids.hrh>
+
+
+/**
+ * Interface for identity object.
+ *
+ * Identity objects are used to identify
+ * presentities, presentity groups and
+ * presentity group members, XIMP framework
+ * client applications etc. entities in
+ * XIMP Framework.
+ *
+ * @ingroup ximpdatamodelapi
+ * @since S60 v3.2
+ */
+class MXIMPIdentity : public MXIMPBase
+    {
+public:
+
+    /** Interface ID for the MXIMPIdentity. */
+    enum { KInterfaceId = XIMP_IF_ID_IDENTITY };
+
+
+public:
+
+    /**
+     * Public destructor.
+     * Objects can be deleted through this interface.
+     */
+    virtual ~MXIMPIdentity() {}
+
+
+public:
+
+
+    /**
+     * Returns identity string.
+     *
+     * @return The identity string.
+     */
+    virtual const TDesC16& Identity() const = 0;
+
+
+
+    /**
+     * Sets identity.
+     *
+     * @param [in] aIdentity
+     *        Identity string.
+     *
+     * @leave KErrNoMemory if failed to allocate memory.
+     */
+    virtual void SetIdentityL(
+                const TDesC16& aIdentity ) = 0;
+
+    };
+
+
+#endif // MXIMPFWIDENTITY_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_data_model_api/inc/ximpobjectcollection.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,228 @@
+/*
+* 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:  Interface for object collection.
+*
+*/
+
+#ifndef MXIMPFWOBJECTCOLLECTION_H
+#define MXIMPFWOBJECTCOLLECTION_H
+
+#include <e32std.h>
+#include <ximpbase.h>
+#include <ximpdatamodelifids.hrh>
+
+
+
+/**
+ * Interface for object collection.
+ *
+ * Object collection is a generic container, capable to
+ * contain MXIMPBase derived objects, implemented by the
+ * XIMP Framework.
+ *
+ * Object collection can contain multiple instancies
+ * from single MXIMPBase derived object type at time.
+ * Object collection supports also attaching name to
+ * contained objects to further identify objects.
+ *
+ * Object collection supports adding and getting objects,
+ * and looking up objects by their interface type.
+ * Object collection takes the ownership of added
+ * objects.
+ *
+ * @ingroup ximpdatamodelapi
+ * @since S60 v3.2
+ */
+class MXIMPObjectCollection : public MXIMPBase
+    {
+public:
+
+    /** Interface ID for the MXIMPObjectCollection. */
+    enum { KInterfaceId = XIMP_IF_ID_OBJECT_COLLECTION };
+
+
+public:
+
+    /**
+     * Public destructor.
+     * Objects can be deleted through this interface.
+     */
+    virtual ~MXIMPObjectCollection() {}
+
+
+public: // Object lookup
+
+
+    /**
+     * Looks up the object having given interface type
+     * and zero length name. Returns the first found
+     * object.
+     *
+     * @param [in,out] aObject
+     *        Object of given interface type and zero length name
+     *        or NULL if no object having given interface type is
+     *        found.
+     *        On entry, contains the object from where to start
+     *        the lookup or NULL if lookup should be started from
+     *        beginning of the set. If object given in entry is not
+     *        found from set, lookup is started from beginning
+     *        of the set.
+     *        On return, if an matching object is found, this is
+     *        set to point to the found object, else NULL.
+     *        Found object ownership is not returned to caller.
+     *
+     * @param [in] aInterfaceId
+     *        The interface type of the object
+     *        to be looked up.
+     */
+    virtual void LookupByType(
+                const MXIMPBase*& aObject,
+                TInt32 aInterfaceId ) const = 0;
+
+
+    /**
+     * Looks up the object having given interface
+     * type and matching object name.
+     *
+     * @param [in,out] aObject
+     *        On entry, contains the object from where to start
+     *        the lookup or NULL if lookup should be started from
+     *        the beginning of the set. 
+     *        If object given in entry is not found from set, 
+     *        lookup is started from the beginning of the set.
+     *        On return, if an matching object is found, this is
+     *        set to point to the found object, else NULL.
+     *        Found object ownership is not returned to caller.
+     *
+     * @param [in] aInterfaceId
+     *        The interface type of the object
+     *        to be looked up.
+     *
+     * @param [in] aMatch
+     *        The object name match pattern. Match pattern may contain
+     *        question mark and asterisk characters ("?", "*")
+     *        resepectively to match single or multiple
+     *        characters. Object names are handled as folded
+     *        in pattern matching.
+     */
+    virtual void LookupByTypeAndName(
+                const MXIMPBase*& aObject,
+                TInt32 aInterfaceId,
+                const TDesC8& aMatch ) const = 0;
+
+
+
+public: // Set management
+
+
+    /**
+     * Adds new object to the set, and assignes zero length
+     * name for it.
+     *
+     * @param [in] aObject
+     *        New object to add to set. Takes object
+     *        ownership in success.
+     *
+     * @leave KErrNoMemory if failed to allocate memory.
+     * @leave KErrArgument if NULL argument were provided.
+     */
+    virtual void AddObjectL(
+                MXIMPBase* aObject ) = 0;
+
+
+
+    /**
+     * Adds new object to the set. Allows multiple
+     * instancies from object type.
+     *
+     * @param [in] aObject
+     *        New object to add to set. Takes object
+     *        ownership in success. NULL value not
+     *        allowed.
+     *
+     * @param [in] aName
+     *        Name for the added object. Zero length descriptor
+     *        or valid Symbian OS object name. I.e. asterisk,
+     *        question mark and single colon characters
+     *        ("*", "?", ":") are not allowed in the name.
+     *
+     * @leave KErrNoMemory if failed to allocate memory.
+     * @leave KErrArgument if NULL argument were provided.
+     * @leave KErrBadName if object name does not conform required syntax.
+     */
+    virtual void AddObjectWithNameL(
+                MXIMPBase* aObject,
+                const TDesC8& aName ) = 0;
+
+
+
+    /**
+     * Gets the object having given interface type,
+     * and removes object from the set and returns object
+     * ownership to caller. Searching is done from the beginning,
+     * i.e. least recently used order.
+     *
+     * Searches objects having zero length name
+     * and return the oldest inserted object
+     * among of those.
+     *
+     * @param [out] aObject
+     *        Object of given interface type or NULL if
+     *        no object having given interface type is found.
+     *        Object ownership is returned to caller.
+     *
+     * @param [in] aInterfaceId
+     *        The interface type of the object
+     *        to be looked up.
+     *
+     * @return ETrue, if an object was found.
+     */
+    virtual TBool GetByType(
+                MXIMPBase*& aObject,
+                TInt32 aInterfaceId ) = 0;
+
+
+    /**
+     * Gets up the object having given interface type and
+     * matching name, and removes object from the set and
+     * returns object ownership to caller. Searching is done 
+     * from the beginning, i.e. least recently used order.
+     *
+     * @param [out] aObject
+     *        Object of given interface type or NULL if
+     *        no object having given interface type is found.
+     *        Object ownership is returned to caller.
+     *
+     * @param [in] aInterfaceId
+     *        The interface type of the object
+     *        to be looked up.
+     *
+     * @param [in] aMatch
+     *        The object name match pattern. Match pattern may contain
+     *        question mark and asterisk characters ("?", "*")
+     *        resepectively to match single or multiple
+     *        characters. Names are folded in pattern matching.
+     *
+     * @return ETrue, if an object was found.
+     */
+    virtual TBool GetByTypeAndName(
+            MXIMPBase*& aObject,
+            TInt32 aInterfaceId,
+            const TDesC8& aMatch ) = 0;
+
+    };
+
+
+#endif // MXIMPFWOBJECTCOLLECTION_H
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_data_model_api/inc/ximpobjectfactory.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,127 @@
+/*
+* 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:  Interface for XIMP Framework object factory.
+*
+*/
+
+#ifndef MXIMPOBJECTFACTORY_H
+#define MXIMPOBJECTFACTORY_H
+
+#include <e32std.h>
+#include <ximpbase.h>
+#include <ximpdatamodelifids.hrh>
+
+
+class MXIMPStatus;
+class MXIMPIdentity;
+class MXIMPObjectCollection;
+class MXIMPRestrictedObjectCollection;
+class MXIMPDataSubscriptionState;
+
+
+/**
+ * Interface for XIMP Framework object factory.
+ *
+ * XIMP object factory is used to instantiate
+ * data objects declared in Data Model API.
+ *
+ * MXimpFwObjectFactory interface can be obtained from
+ * MXIMPContext or MXIMPProtocolConnectionHost
+ * interfaces.
+ *
+ * @ingroup ximpdatamodelapi
+ * @since S60 v3.2
+ */
+class MXIMPObjectFactory : public MXIMPBase
+    {
+public:
+
+    /** Interface ID for the MXimpFwObjectFactory. */
+    enum { KInterfaceId = XIMP_IF_ID_OBJECT_FACTORY };
+
+
+protected:
+
+    /**
+     * Protected destructor.
+     * Object instancies can't be deleted via this interface.
+     */
+    virtual ~MXIMPObjectFactory() {}
+
+
+
+public: // Base object types
+
+
+    /**
+     * Instantiates new status object.
+     *
+     * @return New status object instance.
+     *         Object ownership is returned to caller.
+     *
+     * @leave KErrNoMemory if failed to allocate memory.
+     */
+    virtual MXIMPStatus* NewStatusLC() = 0;
+
+
+    /**
+     * Instantiates new identity object.
+     *
+     * @return New identity object instance.
+     *         Object ownership is returned to caller.
+     *
+     * @leave KErrNoMemory if failed to allocate memory.
+     */
+    virtual MXIMPIdentity* NewIdentityLC() = 0;
+
+
+    /**
+     * Instantiates new restricted object collection object.
+     *
+     * @return New restricted object collection instance.
+     *         Object ownership is returned to caller.
+     *
+     * @leave KErrNoMemory if failed to allocate memory.
+     */
+    virtual MXIMPRestrictedObjectCollection* NewRestrictedObjectCollectionLC() = 0;
+
+
+    /**
+     * Instantiates new object collection object.
+     *
+     * @return New object collection instance.
+     *         Object ownership is returned to caller.
+     *
+     * @leave KErrNoMemory if failed to allocate memory.
+     */
+    virtual MXIMPObjectCollection* NewObjectCollectionLC() = 0;
+
+
+    /**
+     * Instantiates new data subscription state object.
+     *
+     * @return New data subscription state instance.
+     *         Object ownership is returned to caller.
+     *
+     * @leave KErrNoMemory if failed to allocate memory.
+     */
+    virtual MXIMPDataSubscriptionState* NewDataSubscriptionStateLC() = 0;
+
+
+    };
+
+#endif // MXIMPOBJECTFACTORY_H
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_data_model_api/inc/ximpprotocolinfo.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,93 @@
+/*
+* 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:  Interface for XIMP protocol info object.
+*
+*/
+
+#ifndef MXIMPFWPROTOCOLINFO_H
+#define MXIMPFWPROTOCOLINFO_H
+
+#include <e32std.h>
+#include <ximpbase.h>
+#include <ximpdatamodelifids.hrh>
+
+
+class MXIMPFeatureInfo;
+
+
+/**
+ * Interface for XIMP protocol info object.
+ *
+ * Holds information about the XIMP protocol
+ * implementation.
+ *
+ * @ingroup ximpdatamodelapi
+ * @since S60 v3.2
+ */
+class MXIMPProtocolInfo : public MXIMPBase
+    {
+public:
+
+    /** Interface ID for the MXIMPProtocolInfo. */
+    enum { KInterfaceId = XIMP_IF_ID_PROTOCOL_INFO };
+
+
+public:
+
+    /**
+     * Public destructor.
+     * Objects can be deleted through this interface.
+     */
+    virtual ~MXIMPProtocolInfo() {}
+
+
+public:
+
+    /**
+     * Returns human readable protocol display name.
+     *
+     * @return Protocol display name
+     */
+    virtual const TDesC16& DisplayName() const = 0;
+
+
+    /**
+     * Returns protocol implementation UID.
+     *
+     * @return The protocol implementation UID.
+     */
+    virtual TUid ImplementationUid() const = 0;
+
+
+    /**
+     * Retrieves XIMP Protocol features.
+     *
+     * Retrieves features supported by the XIMP Protocol.
+     * Note that XIMP Protocol may indicate here more
+     * features than what will be actually available
+     * in XIMP Context since since connected remote
+     * XIMP Service may limit available XIMP Context
+     * features.
+     *
+     * @return Features supported in XIMP Protocol.
+     *         Exact feature IDs are defined in NXIMPFeature
+     *         namespace. Object ownership is returned
+     *         to caller.
+     */
+    virtual MXIMPFeatureInfo* GetProtocolFeaturesLC() const = 0;
+
+    };
+
+
+#endif // MXIMPFWPROTOCOLINFO_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_data_model_api/inc/ximprestrictedobjectcollection.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,128 @@
+/*
+* 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:  Interface for restricted object collection.
+*
+*/
+
+#ifndef MXIMPFWRESTRICTEDOBJECTCOLLECTION_H
+#define MXIMPFWRESTRICTEDOBJECTCOLLECTION_H
+
+#include <e32std.h>
+#include <ximpbase.h>
+#include <ximpdatamodelifids.hrh>
+
+
+
+/**
+ * Interface for restricted object collection.
+ *
+ * Object collection is a generic container, capable to
+ * contain MXIMPBase derived objects, implemented by the
+ * XIMP Framework.
+ *
+ * Restricted object collection forces each contained
+ * object instance to be distinct interface type.
+ * I.e. at time there can be just single object
+ * instance of certain MXIMPBase derived type
+ * at the collection.
+ *
+ * Object collection supports adding and getting objects,
+ * and looking up objects by their interface type.
+ * Object collection takes the ownership of added
+ * objects.
+ *
+ * @ingroup ximpdatamodelapi
+ * @since S60 v3.2
+ */
+class MXIMPRestrictedObjectCollection : public MXIMPBase
+    {
+public:
+
+    /** Interface ID for the MXIMPRestrictedObjectCollection. */
+    enum { KInterfaceId = XIMP_IF_ID_RESTRICTED_OBJECT_COLLECTION };
+
+
+public:
+
+    /**
+     * Public destructor.
+     * Objects can be deleted through this interface.
+     */
+    virtual ~MXIMPRestrictedObjectCollection() {}
+
+
+
+public: // Object lookup
+
+    /**
+     * Looks up the object having given interface type.
+     *
+     * @param [out] aObject
+     *        Object of given interface type or NULL if
+     *        no object having given interface type is found.
+     *        Object ownership is not returned to caller.
+     *
+     * @param [in] aInterfaceId
+     *        The interface type of the object
+     *        to be looked up.
+     */
+    virtual void LookupByType(
+                const MXIMPBase*& aObject,
+                TInt32 aInterfaceId ) const = 0;
+
+
+
+public: // Object management
+
+
+    /**
+     * Adds new object to the set. If there exists already
+     * a object in the set with equal interface type,
+     * existing object is deleted and replaced with new one.
+     *
+     * @param [in] aObject
+     *        New object to add to set. Takes object
+     *        ownership in success.
+     *
+     * @leave KErrNoMemory if failed to allocate memory.
+     * @leave KErrArgument if NULL argument were provided.
+     */
+    virtual void AddOrReplaceTypeL(
+                MXIMPBase* aObject ) = 0;
+
+
+
+    /**
+     * Gets the object having given interface type,
+     * and removes object from the set and returns object
+     * ownership to caller.
+     *
+     * @param [out] aObject
+     *        Object of given interface type or NULL if
+     *        no object having given interface type is found.
+     *        Object ownership is returned to caller.
+     *
+     * @param [in] aInterfaceId
+     *        The interface type of the object
+     *        to be looked up.
+     */
+    virtual void GetByType(
+                MXIMPBase*& aObject,
+                TInt32 aInterfaceId ) = 0;
+
+    };
+
+
+#endif // MXIMPFWRESTRICTEDOBJECTCOLLECTION_H
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_data_model_api/inc/ximpserviceinfo.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,96 @@
+/*
+* 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:  Interface for XIMP service info object.
+*
+*/
+
+#ifndef MXIMPFWSERVICEINFO_H
+#define MXIMPFWSERVICEINFO_H
+
+#include <e32std.h>
+#include <ximpbase.h>
+#include <ximpdatamodelifids.hrh>
+
+/**
+ * Interface for XIMP service info object.
+ *
+ * Holds data that identifies the XIMP service.
+ *
+ * @ingroup ximpdatamodelapi
+ * @since S60 v3.2
+ */
+class MXIMPServiceInfo : public MXIMPBase
+    {
+public:
+
+    /** Interface ID for the MXIMPServiceInfo. */
+    enum { KInterfaceId = XIMP_IF_ID_SERVICE_INFO };
+
+
+public:
+
+    /**
+     * Public destructor.
+     * Objects can be deleted through this interface.
+     */
+    virtual ~MXIMPServiceInfo() {}
+
+
+public:
+
+    /**
+     * Gets service address.
+     *
+     * @return The service address.
+     */
+    virtual const TDesC16& ServiceAddress() const = 0;
+
+
+    /**
+     * Gets service user ID.
+     *
+     * @return The service user ID.
+     */
+    virtual const TDesC16& UserId() const = 0;
+
+
+    /**
+     * Gets service user password.
+     *
+     * @return The service user password.
+     */
+    virtual const TDesC16& Password() const = 0;
+
+
+    /**
+     * Gets Internet accesspoint ID.
+     *
+     * @return The Internet accesspoint ID.
+     */
+    virtual TInt32 IapId() const = 0;
+
+
+    /**
+     * Gets protocol implementation UID.
+     *
+     * @return The protocol implementation UID.
+     */
+    virtual TUid ProtocolImplUid() const = 0;
+
+    };
+
+
+#endif // MXIMPFWSERVICEINFO_H
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_data_model_api/inc/ximpstatus.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,125 @@
+/*
+* 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:  Interface for status object.
+*
+*/
+
+#ifndef MXIMPFWSTATUS_H
+#define MXIMPFWSTATUS_H
+
+#include <e32std.h>
+#include <ximpbase.h>
+#include <ximpdatamodelifids.hrh>
+
+
+/**
+ * Interface for status object.
+ *
+ * Status object is used in XIMP Framework API
+ * to present result code and additional textual
+ * details from request completions, context
+ * state changes and similar events.
+ *
+ * @ingroup ximpdatamodelapi
+ * @since S60 v3.2
+ */
+class MXIMPStatus : public MXIMPBase
+    {
+public:
+
+    /** Interface ID for the MXIMPStatus. */
+    enum { KInterfaceId = XIMP_IF_ID_STATUS };
+
+
+public:
+
+    /**
+     * Public destructor.
+     * Objects can be deleted through this interface.
+     */
+    virtual ~MXIMPStatus() {}
+
+
+public:
+
+    /**
+     * Gets request completion code.
+     *
+     * Result code can be:
+     *  - one of the system wide errors
+     *  - one of the ximp core specific errors defined in in ximperrors.hrh
+     *  - one of the presence specific errors defined in in presenceerrors.hrh
+     *  - error specific to the underlying communication channel
+     *
+     * @return The result code.
+     */
+    virtual TInt ResultCode() const = 0;
+
+
+    /**
+     * Gets the protocol level response code.
+     *
+     *
+     * @return Protocol level response code.
+     *         KErrNone if no protocol level response code available.
+     */
+    virtual TInt ProtocolResultCode() const = 0;
+
+
+
+    /**
+     * Get the textual result description.
+     * Textual descriptions are protocol specific.
+     *
+     * @return The textual result description.
+     *         Empty descriptor if no description available.
+     */
+    virtual const TDesC16& ProtocolResultDescription() const = 0;
+
+
+
+    /**
+     * Sets request completion code.
+     *
+     * @param [in] aCode
+     *        The result code.
+     */
+    virtual void SetResultCode(
+                TInt aCode ) = 0;
+
+
+
+    /**
+     * Sets textual result description.
+     *
+     * @param [in] aCode
+     */
+    virtual void SetProtocolResultCode(
+                TInt aCode ) = 0;
+
+
+
+    /**
+     * Sets textual result description.
+     *
+     * @param [in] aDescription
+     *        The textual result description.
+     */
+    virtual void SetProtocolResultDescriptionL(
+                const TDesC16& aDescription ) = 0;
+
+    };
+
+
+#endif // MXIMPFWSTATUS_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_data_model_api/ximp_core_data_model_api.metaxml	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,23 @@
+<?xml version="1.0" ?>
+<api id="45fafe9889c9bbe121433fe9e13f418f" dataversion="1.0">
+  <name>XIMP Core Data Model API</name>
+  <description>XIMP Framework Data Model API contains generic object containers, status objects and identity objects. API provides also abstract object factory interface to instantiate other objects.</description>
+  <type>c++</type>
+  <subsystem>ximpfw</subsystem>
+  <libs><lib name="ximpdatamodel.lib"/>
+<lib name="ximpoperations.lib"/>
+<lib name="ximpecomhook.lib"/>
+<lib name="ximpmanager.lib"/>
+<lib name="ximpsrvclient.lib"/>
+<lib name="ximpprocessor.lib"/>
+<lib name="ximputils.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/imsrv_plat/ximp_core_feature_plugin_api/group/bld.inf	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,57 @@
+/*
+* 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:  File that exports the files belonging to 
+:                XIMP core api
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+../inc/apidataobjfactoryaccessor.h     	MW_LAYER_PLATFORM_EXPORT_PATH(apidataobjfactoryaccessor.h)
+../inc/apidataobjfactoryaccessor.inl    MW_LAYER_PLATFORM_EXPORT_PATH(apidataobjfactoryaccessor.inl)
+../inc/eventcodec.h     								MW_LAYER_PLATFORM_EXPORT_PATH(eventcodec.h)
+../inc/ximpapidataobjbase.h     				MW_LAYER_PLATFORM_EXPORT_PATH(ximpapidataobjbase.h)
+../inc/ximpapieventbase.h     					MW_LAYER_PLATFORM_EXPORT_PATH(ximpapieventbase.h)
+../inc/ximpapiobjbase.h     						MW_LAYER_PLATFORM_EXPORT_PATH(ximpapiobjbase.h)
+../inc/ximpcontextinternal.h     				MW_LAYER_PLATFORM_EXPORT_PATH(ximpcontextinternal.h)
+
+../inc/ximphost.h     									MW_LAYER_PLATFORM_EXPORT_PATH(ximphost.h)
+../inc/ximphoststates.h     						MW_LAYER_PLATFORM_EXPORT_PATH(ximphoststates.h)
+
+// FIX ME : Need change
+../inc/ximpidentityimp.h     						MW_LAYER_PLATFORM_EXPORT_PATH(ximpidentityimp.h)
+
+../inc/ximpobjecthelpers.h     					MW_LAYER_PLATFORM_EXPORT_PATH(ximpobjecthelpers.h)
+../inc/ximpoperationbase.h     					MW_LAYER_PLATFORM_EXPORT_PATH(ximpoperationbase.h)
+../inc/ximpoperationdefs.h     					MW_LAYER_PLATFORM_EXPORT_PATH(ximpoperationdefs.h)
+../inc/ximpoperationfactory1.h     			MW_LAYER_PLATFORM_EXPORT_PATH(ximpoperationfactory1.h)
+../inc/ximpoperationfactory1.inl				MW_LAYER_PLATFORM_EXPORT_PATH(ximpoperationfactory1.inl)
+../inc/ximppanics.h     								MW_LAYER_PLATFORM_EXPORT_PATH(ximppanics.h)
+../inc/ximprbufhelpers.h     						MW_LAYER_PLATFORM_EXPORT_PATH(ximprbufhelpers.h)
+../inc/ximprequestidbuilder.h     			MW_LAYER_PLATFORM_EXPORT_PATH(ximprequestidbuilder.h)
+../inc/ximpsubscriptionitem.h     			MW_LAYER_PLATFORM_EXPORT_PATH(ximpsubscriptionitem.h)
+../inc/ximpobjecthelpers.inl						MW_LAYER_PLATFORM_EXPORT_PATH(ximpobjecthelpers.inl)
+../inc/ximppsccontext.h									MW_LAYER_PLATFORM_EXPORT_PATH(ximppsccontext.h)
+
+../inc/protocoldatahost.h								MW_LAYER_PLATFORM_EXPORT_PATH(protocoldatahost.h)
+../inc/protocoldatahost.inl							MW_LAYER_PLATFORM_EXPORT_PATH(protocoldatahost.inl)
+../inc/ximpitemparentbase.h							MW_LAYER_PLATFORM_EXPORT_PATH(ximpitemparentbase.h)
+../inc/ximpsubscriptionitembase.h				MW_LAYER_PLATFORM_EXPORT_PATH(ximpsubscriptionitembase.h)
+../inc/ximpfeaturepluginifids.hrh				MW_LAYER_PLATFORM_EXPORT_PATH(ximpfeaturepluginifids.hrh)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_feature_plugin_api/inc/apidataobjfactoryaccessor.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,85 @@
+/*
+* 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:  IMplementation of MApiDataObjFactoryAccessor
+*
+*/
+
+
+
+#ifndef M_APIDATAOBJFACTORYACCESSOR_H
+#define M_APIDATAOBJFACTORYACCESSOR_H
+
+#include <e32std.h>
+#include <ecom/ecom.h>
+
+class MEventCodec;
+class MApiDataObjFactory;
+
+
+/**
+ * ?one_line_short_description
+ *
+ * ?more_complete_description
+ *
+ * @lib ?library
+ * @since S60 v4.0
+ */
+class MApiDataObjFactoryAccessor
+    { 
+
+public:
+
+    inline static MApiDataObjFactoryAccessor* NewPresenceAccessorL( );
+
+    inline static MApiDataObjFactoryAccessor* NewL( TUid aImplUid );
+    
+    /**
+     * Returns the feature plugin specific event codec object
+     */
+    virtual MEventCodec& EventCodec() = 0;
+    
+    /**
+     * Returns the feature plugin specific api object data factory object
+     */    
+    virtual MApiDataObjFactory& ApiDataObjFactory() = 0;
+
+    /**
+     * dustructor
+     */    
+    inline virtual ~MApiDataObjFactoryAccessor();
+    
+    /**
+     * To get the list of implementation who implements this interface
+     */    
+	inline static void ListAllImplementationsL(RImplInfoPtrArray& aImplInfoArray) ;
+	
+protected:
+
+    /**
+     * Default constructor to zero initialize
+     * the iEcomDtorID member.
+     */
+    inline MApiDataObjFactoryAccessor();
+
+    
+                                        
+private: // Data
+
+    //OWN: ECom destructor ID
+    TUid iEcomDtorID;
+    };
+
+#include "apidataobjfactoryaccessor.inl"
+#endif // M_APIDATAOBJFACTORYACCESSOR_H
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_feature_plugin_api/inc/apidataobjfactoryaccessor.inl	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,77 @@
+/*
+* 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:  Internal Interface for event codec
+*
+*/
+
+#include <ecom/ecom.h>
+#include <ximpfeaturepluginifids.hrh>
+
+// Factory interface for internal data structures
+#define XIMP_ECOM_IMPL_UID_PRESENCE_DATAMODEL_INTERFACE   0x2000B197
+
+// -----------------------------------------------------------------------------
+// MApiDataObjFactoryAccessor::NewPresenceAccessorL( ) implementation
+// -----------------------------------------------------------------------------
+//
+inline MApiDataObjFactoryAccessor* MApiDataObjFactoryAccessor::NewPresenceAccessorL( )
+    {
+    return NewL(TUid::Uid( XIMP_ECOM_IMPL_UID_PRESENCE_DATAMODEL_INTERFACE ));
+    }
+
+// -----------------------------------------------------------------------------
+// MApiDataObjFactoryAccessor::NewL( ) implementation
+// -----------------------------------------------------------------------------
+//
+inline MApiDataObjFactoryAccessor* MApiDataObjFactoryAccessor::NewL( TUid aImplUid )
+    {
+    
+    TAny* imp = REComSession::CreateImplementationL( aImplUid,
+                                                     _FOFF( MApiDataObjFactoryAccessor, iEcomDtorID ));
+
+
+    return reinterpret_cast< MApiDataObjFactoryAccessor* >( imp );
+    }
+
+// Added : to get list of implementations plugins, this should be common for presence, im datamodels
+// -----------------------------------------------------------------------------
+// MApiDataObjFactoryAccessor::NewL( ) implementation
+// -----------------------------------------------------------------------------
+//
+inline void MApiDataObjFactoryAccessor::ListAllImplementationsL(RImplInfoPtrArray& aImplInfoArray)
+	{
+	REComSession::ListImplementationsL(TUid::Uid( XIMP_ECOM_IF_UID_PROTOCOL_DATAMODEL_CODEC_INTERFACE), aImplInfoArray);
+	}
+
+// -----------------------------------------------------------------------------
+// MApiDataObjFactoryAccessor::MApiDataObjFactoryAccessor() implementation
+// -----------------------------------------------------------------------------
+//
+inline MApiDataObjFactoryAccessor::MApiDataObjFactoryAccessor()
+    {
+    iEcomDtorID = TUid::Null();
+    }
+
+
+// -----------------------------------------------------------------------------
+// MApiDataObjFactoryAccessor::~MApiDataObjFactoryAccessor()
+// Destructor notifies the ECom from implementation destruction.
+// -----------------------------------------------------------------------------
+//
+inline MApiDataObjFactoryAccessor::~MApiDataObjFactoryAccessor()
+    {
+    REComSession::DestroyedImplementation( iEcomDtorID );
+    }
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_feature_plugin_api/inc/eventcodec.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,53 @@
+/*
+* 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:  Header for MEventCodec
+*
+*/
+
+
+
+#ifndef M_EVENTCODEC_H
+#define M_EVENTCODEC_H
+
+#include <e32std.h>
+
+class CXIMPApiEventBase;
+
+
+/**
+ * ?one_line_short_description
+ *
+ * ?more_complete_description
+ *
+ * @lib ?library
+ * @since S60 v4.0
+ */
+class MEventCodec
+    {  
+public:
+    
+    virtual HBufC8* PackL( CXIMPApiEventBase& aEventObj,
+                           TInt32& aTypeOfEvent ) = 0;
+    
+    virtual void PackL( CXIMPApiEventBase& aEventObj,
+                        TInt32& aTypeOfEvent,
+                        CBufFlat* aBuffer ) = 0;
+
+    virtual CXIMPApiEventBase* UnPackL( const TDesC8& aEventData,
+                                        TInt32& aTypeOfEvent ) = 0;
+
+    };
+
+#endif // M_EVENTCODEC_H
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_feature_plugin_api/inc/protocoldatahost.h	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  interface for protocol hosts
+ *
+*/
+
+#ifndef MPROTOCOLDATAHOST_H
+#define MPROTOCOLDATAHOST_H
+
+#include <ximpbase.h>
+#include <ximpfeaturepluginifids.hrh>
+#include <e32std.h>
+#include <ecom/ecom.h>
+
+class MXIMPHost;
+
+/**
+ * protocol host.
+ *
+ * @lib ximpprocessor.lib
+ * @since S60 v3.2
+ */
+class MProtocolDataHost 
+
+    {
+public:
+
+    enum { KInterfaceId = XIMP_ECOM_IF_UID_PROTOCOL_DATA_HOST_INTERFACE };
+
+    
+public:
+
+    /**
+     * Factory method to instantiate MImFeatures.
+     *
+     * Factory method to instantiate platform default
+     * MXIMPClient implementation through the ECom.
+     * If the default Feature isn't supported
+     * in the platform, leaves with errorcode signalled
+     * from ECom.
+     *
+     * @return The new protocol client object. Object
+     *         ownership is returned to caller.
+     */
+    static inline MProtocolDataHost* NewL( MXIMPHost& aHost );
+    
+    static inline MProtocolDataHost* NewL(TUid aImpid, MXIMPHost& aHost );
+
+    /**
+     * Public destructor.
+     * Objects can be deleted through this interface.
+     */
+    virtual inline ~MProtocolDataHost();
+    
+    /**
+     * To get list of all plugins which implements this interface
+     */
+    inline static void ListAllImplementationsL(RImplInfoPtrArray& aImplInfoArray) ;
+    
+    /**
+     * This allows hosts to set themselves to protocol plugins 
+     */
+    virtual void SetHostToProtocol() = 0 ;
+
+    /**
+     * To get the host object pointer of this interface id
+     */
+    virtual TAny* GetInterface(TInt aInterfaceId) = 0;
+    
+    /**
+     * Hosts can return the clean up id, to create cleanup operation
+     */
+    virtual TInt GetCleanupOperation() = 0;
+    
+protected:
+
+    /**
+     * Default constructor to zero initialize
+     * the iEcomDtorID member.
+     */
+    inline MProtocolDataHost();
+ 
+private: // Data
+
+    //OWN: ECom destructor ID
+    TUid iEcomDtorID;
+    };
+
+#include <protocoldatahost.inl> 
+    
+
+#endif // MPROTOCOLDATAHOST_H
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_feature_plugin_api/inc/protocoldatahost.inl	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,81 @@
+/*
+* 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:  protocol data host interface used by XIMP clients.
+*
+*/
+
+#include <ecom/ecom.h>
+
+
+// -----------------------------------------------------------------------------
+// MProtocolDataHost::NewL( MXIMPHost& aHost) implementation
+// Factory method to instantiate the platform default
+// MProtocolDataHost implementation through the ECom framework.
+// -----------------------------------------------------------------------------
+//
+inline MProtocolDataHost* MProtocolDataHost::NewL(MXIMPHost& aHost )
+    {
+    _LIT8( KIMDefaultData, "" );
+
+    TEComResolverParams resolvingParams;
+    resolvingParams.SetDataType( KIMDefaultData );
+    resolvingParams.SetWildcardMatch( ETrue );
+    TAny* imp = REComSession::CreateImplementationL( TUid::Uid( MProtocolDataHost::KInterfaceId),
+                                                     _FOFF( MProtocolDataHost, iEcomDtorID ),
+                                                     &aHost, resolvingParams );
+    return reinterpret_cast< MProtocolDataHost* >( imp );
+    }
+
+
+inline MProtocolDataHost* MProtocolDataHost::NewL( TUid aImplUid , MXIMPHost& aHost)
+	{
+    TAny* imp = REComSession::CreateImplementationL( aImplUid,
+                                                     _FOFF( MProtocolDataHost, iEcomDtorID ),&aHost);
+
+
+    return reinterpret_cast< MProtocolDataHost* >( imp );
+	}
+
+
+// -----------------------------------------------------------------------------
+// MProtocolDataHost::MProtocolDataHost() implementation
+// Zero initializes the iEcomDtorID member.
+// -----------------------------------------------------------------------------
+//
+inline MProtocolDataHost::MProtocolDataHost()
+    {
+    iEcomDtorID = TUid::Null();
+    }
+
+
+// -----------------------------------------------------------------------------
+// MProtocolDataHost::~MProtocolDataHost()
+// Destructor notifies the ECom from implementation destruction.
+// -----------------------------------------------------------------------------
+//
+inline MProtocolDataHost::~MProtocolDataHost()
+    {
+    REComSession::DestroyedImplementation( iEcomDtorID );
+    }
+
+// -----------------------------------------------------------------------------
+// MProtocolDataHost::ListAllImplementationsL()
+// To get list of implementation plugins, who implements this interface
+// -----------------------------------------------------------------------------
+//
+inline void MProtocolDataHost::ListAllImplementationsL(RImplInfoPtrArray& aImplInfoArray) 
+	{
+	REComSession::ListImplementationsL(TUid::Uid(MProtocolDataHost::KInterfaceId), aImplInfoArray);
+	}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_feature_plugin_api/inc/ximpapidataobjbase.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,96 @@
+/*
+* 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:  API data object base implementation.
+*
+*/
+
+#ifndef CXIMPAPIDATAOBJBASE_H
+#define CXIMPAPIDATAOBJBASE_H
+
+#include "ximpapiobjbase.h"
+
+class RWriteStream;
+class RReadStream;
+
+
+/**
+ * API event object base.
+ *
+ * Concrete event types must implement static
+ * NewFromStreamLC() constructor and event types
+ * must be registered to event automation system.
+ *
+ * For details, see XIMPEventCodec implementation.
+ * @lib ximpdatamodel.dll
+ * @since S60 v3.2
+ */
+class CXIMPApiDataObjBase : public CXIMPApiObjBase
+    {
+public:
+
+    enum { KClassId = XIMPIMP_CLSID_CXIMPAPIDATAOBJBASE };
+    
+public:
+
+    IMPORT_C CXIMPApiDataObjBase();
+
+    IMPORT_C virtual ~CXIMPApiDataObjBase();
+
+public:
+
+    /**
+     * Compare the content of this data object with another 
+     * data object of the same type.
+     * Volatile things (e.g. timestamps) are not compared, but things like user
+     * ids and such are.
+     * @return ETrue if the content matches.
+     */
+    virtual TBool EqualsContent( const CXIMPApiDataObjBase& aOtherInstance ) const = 0;
+
+    /**
+     * Virtual extenalize method for concrete data
+     * objects to externalize their data.
+     */
+    virtual void ExternalizeL( RWriteStream& aStream ) const = 0;
+    };
+
+
+
+/**
+ * Declares CXIMPApiDataObjBase methods for
+ * concrete event implementation class header (.h) file.
+ */
+#define XIMPIMP_DECLARE_DATAOBJ_BASE_METHODS \
+    void ExternalizeL( RWriteStream& aStream ) const; \
+    IMPORT_C static CXIMPApiDataObjBase* NewFromStreamLC( RReadStream& aStream ); \
+    virtual TBool EqualsContent( const CXIMPApiDataObjBase& aOtherInstance ) const; \
+
+#define XIMPIMP_DECLARE_DATAOBJ_BASE_PRIV_METHODS   \
+    // void ConstructL( RReadStream& aStream ); \
+
+
+/**
+  * Implements a NewFromStreamLC method
+  */
+#define XIMPIMP_IMPLEMENT_DATAOBJ_NEWFROMSTREAM( TheClass ) \
+EXPORT_C CXIMPApiDataObjBase* TheClass::NewFromStreamLC( RReadStream& aStream ) \
+    { \
+    TheClass* self = new( ELeave ) TheClass; \
+    CleanupStack::PushL( self ); \
+    self->ConstructL(); \
+    self->InternalizeL( aStream ); \
+    return self; \
+    } \
+
+#endif // CXIMPAPIDATAOBJBASE_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_feature_plugin_api/inc/ximpapieventbase.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,91 @@
+/*
+* 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:  API event object base implementation.
+*
+*/
+
+#ifndef CXIMPAPIEVENTBASE_H
+#define CXIMPAPIEVENTBASE_H
+
+#include "ximpapiobjbase.h"
+
+class RWriteStream;
+class RReadStream;
+
+
+/**
+ * API event object base.
+ *
+ * Concrete event types must implement static
+ * NewFromStreamLC() constructor and event types
+ * must be registered to event automation system.
+ *
+ * For details, see XIMPEventCodec implementation.
+ * @lib ximpdatamodel.dll
+ * @since S60 v3.2
+ */
+class CXIMPApiEventBase: public CXIMPApiObjBase
+    {
+public:
+
+    enum { KClassId = XIMPIMP_CLSID_CXIMPAPIEVENTBASE };
+    
+public:
+    IMPORT_C CXIMPApiEventBase();
+
+public:
+    IMPORT_C virtual ~CXIMPApiEventBase();
+
+public:
+
+    /**
+     * Compare the content of this event with another event of the same type.
+     * Volatile things (e.g. timestamps) are not compared, but things like user
+     * ids and such are.
+     * @return ETrue if the content matches.
+     */
+    virtual TBool EqualsContent( const CXIMPApiEventBase& aOtherInstance ) const = 0;
+
+
+    /**
+     * Virtual extenalize method for concrete event
+     * objects to externalize their data.
+     */
+    virtual void ExternalizeL( RWriteStream& aStream ) const = 0;
+    };
+
+
+
+/**
+ * Declares MXIMPEventBase and CXIMPApiEventBase methods for
+ * concrete event implementation class header (.h) file.
+ */
+#define XIMPIMP_DECLARE_EVENT_BASE_METHODS \
+    TInt32 EventInterfaceId() const; \
+    void ExternalizeL( RWriteStream& aStream ) const; \
+    TBool EqualsContent( const CXIMPApiEventBase& aOtherInstance ) const; \
+
+
+/**
+ * Implements EventInterfaceId() for MXIMPEventBase-derived
+ * implementation class (.cpp) file.
+ */
+#define XIMPIMP_IMPLEMENT_EVENT_BASE_METHODS( TheClass, TheImplementedIf ) \
+    TInt32 TheClass::EventInterfaceId() const \
+    { \
+    return TheImplementedIf::KInterfaceId; \
+    } \
+
+
+#endif // CXIMPREQUESTCOMPLETEEVENTIMP_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_feature_plugin_api/inc/ximpapiobjbase.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,422 @@
+/*
+* 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:  Base class for XIMP API implementations.
+*
+*/
+
+#ifndef XIMPAPIOBJBASE_H
+#define XIMPAPIOBJBASE_H
+
+#include <e32base.h>
+#include <ximpbase.h>
+
+
+
+/**
+ * XIMP Framework class implementation UIDs.
+ *
+ * These do not have to be "real" Symbian UIDs, but such ID's,
+ * that they do not overlap with XIMP API interface IDs.
+ */
+ 
+// 90xx - ximp related
+// 91xx - presence related
+// 92xx - instant messaging related
+
+//Data model classes
+#define XIMPIMP_CLSID_CXIMPAPIDATAOBJBASE                   9000
+#define XIMPIMP_CLSID_CXIMPAPIOBJBASE                       9001
+#define XIMPIMP_CLSID_CXIMPFEATUREINFOIMP                   9001
+#define XIMPIMP_CLSID_CXIMPIDENTITYIMP                      9003
+#define XIMPIMP_CLSID_CXIMPPROTOCOLINFOIMP                  9004
+#define XIMPIMP_CLSID_CXIMPSERVICEINFOIMP                   9005
+#define XIMPIMP_CLSID_CXIMPSTATUSIMP                        9006
+#define XIMPIMP_CLSID_CXIMPOBJECTFACTORYIMP                 9007
+#define XIMPIMP_CLSID_CXIMPAPIEVENTBASE                     9008
+#define XIMPIMP_CLSID_CXIMPRESTRICTEDOBJECTCOLLECTIONIMP    9009
+#define XIMPIMP_CLSID_CXIMPOBJECTCOLLECTIONIMP              9010
+#define XIMPIMP_CLSID_CXIMPCONTEXTCLIENTINFOIMP             9011
+#define XIMPIMP_CLSID_CXIMPCONTEXTSTATEIMP                  9012
+#define XIMPIMP_CLSID_CXIMPDATASUBSCRIPTIONSTATEIMP         9013
+
+// Plugin host environment classes
+#define XIMPIMP_CLSID_CXIMPPSCHOST                          9020
+#define XIMPIMP_CLSID_CXIMPPSCHOSTMANAGER                   9021
+
+// Management
+#define XIMPIMP_CLSID_CXIMPCLIENTIMP                        9030
+#define XIMPIMP_CLSID_CXIMPCONTEXTIMP                       9031
+
+// Events
+#define XIMPIMP_CLSID_CXIMPPROTOCOLREQUESTCOMPLETEEVENTIMP  9040
+#define XIMPIMP_CLSID_CXIMPREQUESTCOMPLETEEVENTIMP          9041
+#define XIMPIMP_CLSID_CXIMPCONTEXTSTATEEVENTIMP             9042
+
+
+/**
+ * Declares a GetInterface() and similar methods for
+ * MXIMPBase and CXIMPApiObjBase derived implementation.
+ *
+ * To be used in class header (.h) file.
+ */
+#define XIMPIMP_DECLARE_IF_BASE_METHODS \
+    MXIMPBase& Base(); \
+    TAny* GetInterface( TInt32 aInterfaceId, TIfGetOps aOps ); \
+    TInt32 GetInterfaceId() const; \
+    const TAny* GetInterface( TInt32 aInterfaceId, TIfGetOps aOps ) const; \
+    const MXIMPBase& Base() const; \
+
+
+/**
+ * Starts a non-const GetInterface() method
+ * block for CXIMPApiObjBase-derived implementation.
+ *
+ * To be used in class implementation (.cpp) file.
+ */
+#define XIMPIMP_IF_BASE_GET_INTERFACE_BEGIN( TheClass, TheImplementedIf ) \
+    MXIMPBase& TheClass::Base() \
+        { \
+        return *this; \
+        } \
+    TAny* TheClass::GetInterface( TInt32 aInterfaceId, TIfGetOps aOps ) \
+        { \
+        if( aInterfaceId == CXIMPApiObjBase::KClassId ) \
+            { \
+            CXIMPApiObjBase* classPtr = this; \
+            return classPtr; \
+            } \
+        if( aInterfaceId == TheClass::KClassId ) \
+            { \
+            TheClass* classPtr = this; \
+            return classPtr; \
+            } \
+        if( aInterfaceId == TheImplementedIf::KInterfaceId ) \
+            { \
+            TheImplementedIf* ifPtr = this; \
+            return ifPtr; \
+            } \
+
+
+/**
+ * Non-const interface return statement for GetInterface() block.
+ *
+ * To be used in class implementation (.cpp) file.
+ */
+#define XIMPIMP_IF_BASE_GET_INTERFACE( AdditionalIf, FromPtr ) \
+    if( aInterfaceId == AdditionalIf::KInterfaceId )\
+        { \
+        AdditionalIf* ifPtr = FromPtr; \
+        return ifPtr; \
+        } \
+
+
+/**
+ * Non-const class return statement for GetInterface() block.
+ *
+ * To be used in class implementation (.cpp) file.
+ */
+#define XIMPIMP_IF_BASE_GET_CLASS( AdditionalClass, FromPtr ) \
+    if( aInterfaceId == AdditionalClass::KClassId )\
+        { \
+        AdditionalClass* classPtr = FromPtr; \
+        return classPtr; \
+        } \
+
+
+/**
+ * Starts a const GetInterface() method
+ * block for CXIMPApiObjBase-derived implementation.
+ *
+ * To be used in class implementation (.cpp) file.
+ */
+#define XIMPIMP_IF_BASE_GET_CONST_INTERFACE_BEGIN( TheClass, TheImplementedIf ) \
+    TInt32 TheClass::GetInterfaceId() const \
+        { \
+        return TheImplementedIf::KInterfaceId; \
+        } \
+    const MXIMPBase& TheClass::Base() const \
+        { \
+        return *this; \
+        } \
+    const TAny* TheClass::GetInterface( TInt32 aInterfaceId, TIfGetOps aOps ) const \
+        { \
+        if( aInterfaceId == CXIMPApiObjBase::KClassId ) \
+            { \
+            const CXIMPApiObjBase* classPtr = this; \
+            return classPtr; \
+            } \
+        if( aInterfaceId == TheClass::KClassId ) \
+            { \
+            const TheClass* classPtr = this; \
+            return classPtr; \
+            } \
+        if( aInterfaceId == TheImplementedIf::KInterfaceId ) \
+            { \
+            const TheImplementedIf* ifPtr = this; \
+            return ifPtr; \
+            } \
+
+
+/**
+ * Const interface return statement for GetInterface() block.
+ *
+ * To be used in class implementation (.cpp) file.
+ */
+#define XIMPIMP_IF_BASE_GET_CONST_INTERFACE( AdditionalIf, FromPtr ) \
+    if( aInterfaceId == AdditionalIf::KInterfaceId )\
+        { \
+        const AdditionalIf* ifPtr = FromPtr; \
+        return ifPtr; \
+        } \
+
+
+/**
+ * Const class return statement for GetInterface() block.
+ *
+ * To be used in class implementation (.cpp) file.
+ */
+#define XIMPIMP_IF_BASE_GET_CONST_CLASS( AdditionalClass, FromPtr ) \
+    if( aInterfaceId == AdditionalClass::KClassId )\
+        { \
+        const AdditionalClass* classPtr = FromPtr; \
+        return classPtr; \
+        } \
+
+
+
+/**
+ * Shared definition to end the
+ * - XIMPIMP_IF_BASE_GET_INTERFACE_BEGIN and
+ * - XIMPIMP_IF_BASE_GET_CONST_INTERFACE_BEGIN
+ * statements.
+ *
+ * To be used in class implementation (.cpp) file.
+ */
+#define XIMPIMP_IF_BASE_GET_INTERFACE_END()\
+    return CXIMPApiObjBase::HandleUnknownGetInterface( aInterfaceId, aOps ); \
+    } \
+
+
+
+/**
+ * Macro for XIMP implementation to suppress warnings
+ * from unused formal parameters.
+ */
+#define XIMP_UNUSED_FORMAL_PARAM(p) (void) p
+
+
+
+/**
+ * Macro to implement the default statement 
+ * from switch-case structure with panic call. 
+ *
+ * If injected code is compiled under BullseyeCoverage, 
+ * uses BullseyeCoverage specific guards, 
+ * to exclude injected code from coverage 
+ * calcualtion. 
+ */
+#if _BullseyeCoverage
+
+#define XIMP_DEFAULT_CASE_UNSUPPORTED( aPanicReason )    \
+    "BullseyeCoverage save off";                         \
+    default:                                             \
+        {                                                \
+        NXIMPPrivPanic::Panic( aPanicReason );           \
+        break;                                           \
+        }                                                \
+    "BullseyeCoverage restore";                          \
+
+#else
+
+#define XIMP_DEFAULT_CASE_UNSUPPORTED( aPanicReason )    \
+    default:                                             \
+        {                                                \
+        NXIMPPrivPanic::Panic( aPanicReason );           \
+        break;                                           \
+        }                                                \
+
+#endif //_BullseyeCoverage
+
+
+/**
+ * Base class for all XIMP API implementations.
+ *
+ * @lib ximpdatamodel.dll
+ * @since S60 v3.2
+ */
+class CXIMPApiObjBase : public CBase
+    {
+public:
+
+    enum { KClassId = XIMPIMP_CLSID_CXIMPAPIOBJBASE };
+
+protected:
+
+    /**
+     * All XIMP Framework concrete API object
+     * implementations are derived from this class.
+     */
+    IMPORT_C CXIMPApiObjBase();
+
+
+public:
+
+    /**
+     * Virtual destructor CXIMPApiObjBase().
+     */
+    IMPORT_C virtual ~CXIMPApiObjBase();
+
+
+
+
+protected: //Protected handlers for derived classes
+
+    /**
+     * Handler for unknown interface access cases.
+     *
+     * All XIMP Framework API object implementations
+     * should call this to handle access request for
+     * unknown interface type.
+     *
+     * @param aInterfaceId
+     *        Interface identifier identifying the interface
+     *        which was tried to retrieve.
+     *
+     * @param aOps
+     *        Options for interface retrieval from client.
+     *
+     * @return NULL.
+     */
+    IMPORT_C TAny* HandleUnknownGetInterface(
+            TInt32 aInterfaceId,
+            MXIMPBase::TIfGetOps aOps ) const;
+
+
+public:
+
+    /**
+     * Access to base virtual interface.
+     *
+     * @return XIMP base virtual interface.
+     */
+    virtual MXIMPBase& Base() = 0;
+
+
+    /**
+     * Read-only access to base virtual interface.
+     *
+     * @return XIMP base virtual interface.
+     */
+    virtual const MXIMPBase& Base() const = 0;
+
+    };
+    
+    
+    
+/**
+ * Templated 
+ * 
+ *
+ * @since S60 v3.2
+ */
+template< class Type >
+class TXIMPGetImpClassOrPanic
+    {
+
+public:
+    /**
+     * 
+     */
+    static inline Type* From( MXIMPBase& aObj )
+        {
+        TAny* ifPtr = aObj.GetInterface( Type::KClassId, MXIMPBase::EPanicIfUnknown );
+        Type* ifTypePtr = static_cast< Type* >( ifPtr );
+        return ifTypePtr; 
+        }
+
+    static inline Type* From( const MXIMPBase& aObj )
+        {
+        const TAny* ifPtr = aObj.GetInterface( Type::KClassId, MXIMPBase::EPanicIfUnknown );
+        const Type* ifTypePtr = static_cast< const Type* >( ifPtr );
+        return ifTypePtr; 
+        }
+
+private:   //Prohibited constructor
+    TXIMPGetImpClassOrPanic();
+    };
+    
+
+/**
+ * Templated 
+ * 
+ *
+ * @since S60 v3.2
+ */
+template< class Type >
+class TXIMPGetImpClassOrNull
+    {
+
+public:
+    /**
+     * 
+     */
+    static inline Type* From( MXIMPBase& aObj )
+        {
+        TAny* ifPtr = aObj.GetInterface( Type::KClassId, MXIMPBase::EReturnNullIfUnknown );
+        Type* ifTypePtr = static_cast< Type* >( ifPtr );
+        return ifTypePtr; 
+        }
+
+    static inline Type* From( const MXIMPBase& aObj )
+        {
+        const TAny* ifPtr = aObj.GetInterface( Type::KClassId, MXIMPBase::EReturnNullIfUnknown );
+        const Type* ifTypePtr = static_cast< const Type* >( ifPtr );
+        return ifTypePtr; 
+        }
+
+private:   //Prohibited constructor
+    TXIMPGetImpClassOrNull();
+    };
+
+
+
+template< class Type >
+class TXIMPEqualsContent
+    {
+    public:
+        /**
+         * Call equalcontent for all items in array
+         */
+        static inline TBool Array( const RPointerArray< Type >& aObjArray, 
+                                   const RPointerArray< Type >& aOtherObjArray )
+            {
+            TInt count = aObjArray.Count();
+            if( count != aOtherObjArray.Count() )
+                {
+                return EFalse;
+                }
+            for( TInt a = 0; a < count; ++a )
+                {
+                if( !aObjArray[ a ]->EqualsContent( *aOtherObjArray[ a ] ) )
+                    {
+                    return EFalse;
+                    }
+                }
+            return ETrue;
+            }
+    private:   //Prohibited constructor
+        TXIMPEqualsContent();
+    };
+
+#endif // XIMPAPIOBJBASE_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_feature_plugin_api/inc/ximpcontextinternal.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,63 @@
+/*
+* 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:  Interface for presence context.
+*
+*/
+
+#ifndef MXIMPCONTEXTINTERNAL_H
+#define MXIMPCONTEXTINTERNAL_H
+
+#include <e32std.h>
+//#include <ximpbase.h>
+#include <ximpmanagementifids.hrh>
+
+/**
+ * Internal interface for presence context.
+ * This interface is implemented by the XIMP Framework.
+ *
+ * @ingroup ximpmanagementapi
+ * @since S60 v3.2
+ */
+class MXIMPContextInternal
+    {
+public:
+
+    /** Interface ID for the MXIMPContext. */
+    enum { KInterfaceId = XIMP_IF_ID_CONTEXT_INTERNAL };
+    
+public:
+
+    /**
+     * Public destructor.
+     * Objects can be deleted through this interface.
+     */
+    virtual ~MXIMPContextInternal() {}
+    
+    /**
+     * Issues context operation request to server.
+     *
+     * @param aOperationType In parameter identifying the operation.
+     * @param aOperationParams In parameter package for operation.
+     * @return Request ID identifying started request.
+     */
+    virtual TXIMPRequestId QueueOperationL( TInt aOperationType, 
+                                const TDesC8& aOperationParams ) = 0;
+    
+    };
+
+
+#endif // MXIMPCONTEXTINTERNAL_H
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_feature_plugin_api/inc/ximpfeaturepluginifids.hrh	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,31 @@
+/*
+* 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:  feature plugin if ids
+*
+*/
+
+#ifndef XIMPFEATUREPLUGINIFIDS_HRH
+#define XIMPFEATUREPLUGINIFIDS_HRH
+
+// datmodel
+#define XIMP_ECOM_IF_UID_PROTOCOL_DATAMODEL_CODEC_INTERFACE 0x2000B5E9
+
+// operations
+#define XIMP_ECOM_IF_UID_OPERATIONS_INTERFACE				0x20015A0D
+
+//processor
+#define XIMP_ECOM_IF_UID_PROTOCOL_DATA_HOST_INTERFACE		0x20015A0E
+
+#endif //XIMPFEATUREPLUGINIFIDS_HRH
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_feature_plugin_api/inc/ximphost.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,185 @@
+/*
+* 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 MXIMPHost
+*
+*/
+
+
+
+#ifndef M_PSCHOST_H
+#define M_PSCHOST_H
+
+#include <ximpbase.h>
+
+#include "ximphoststates.h"
+#include "ximpoperationdefs.h"
+
+class MXIMPProtocolConnection;
+class CXIMPApiEventBase;
+class MXIMPPscContext;
+class CXIMPPscContext;
+class CXIMPServiceInfoImp;
+class CPresenceDataCache;
+class CXIMPOperationBase;
+class CXIMPRestrictedObjectCollectionImp;
+class CProtocolPresenceAuthorizationDataHostImp;
+class CProtocolPresencePublishingDataHostImp;
+class CProtocolPresenceWatchingDataHostImp;
+class CProtocolPresentityGroupsDataHostImp;
+class CProtocolPresenceDataHostImp;
+class MProtocolDataHost;
+
+/**
+ * ?one_line_short_description
+ *
+ * ?more_complete_description
+ *
+ * @lib ?library
+ * @since S60 v4.0
+ */
+class MXIMPHost
+    {  
+public:
+
+    /**
+     * Mark a reference to this object.
+     */
+    virtual void Open() = 0;
+
+    /**
+     * Remove a reference to this object.
+     * Once all references are removed, the class destroys itself.
+     */
+    virtual void Close() = 0;
+
+    /**
+     * @return The currently used connection, Can be NULL if protocol not in use.
+     */
+    virtual MXIMPProtocolConnection& GetConnection() const = 0;
+
+    /**
+     * Add the given event to the event manager. The event will
+     * go to the given session.
+     * @param aEvent The event
+     * @param aContext The session context. If NULL -> send to all contexts.
+     */
+    virtual void AddEventL( CXIMPApiEventBase& aEvent, MXIMPPscContext* aContext = NULL ) = 0;
+    
+    /**
+     * Add preserved event to the event manager. The event will 
+     * go to the given session.
+     * @param aEvent The event
+     * @param aContext The session context
+     */
+    virtual void ActivateEventL( CXIMPApiEventBase& aEvent, MXIMPPscContext* aContext ) = 0;
+
+    /**
+     * Unregister session when not needed anymore.
+     * @param aContext Unregistered context.
+     */
+    virtual void UnregisterSession( CXIMPPscContext* aContext ) = 0;
+
+    /**
+     * Fake a request complete event to
+     * currently run operation.
+     * @param aResult The result
+     */
+    virtual void FakeCompleteRequest( TXIMPRequestId aReqId, TInt aResult ) = 0;
+
+    /**
+     * Request complete for adaptation operation
+     * @param aResult The result    
+     */    
+    virtual void HandleAdaptationRequestCompleted( TXIMPRequestId aReqId, TInt aResult ) = 0;
+    
+    /**
+     * Request complete for adaptation operation, related
+     * to session management
+     * @param aResult The result    
+     */    
+    virtual void HandleSessionMgmtRequestCompleted( TXIMPRequestId aReqId, TInt aResult ) = 0;
+
+    /**
+     * Request complete for internal operation
+     * @param aResult The result    
+     */    
+    virtual void HandleInternalRequestCompleted( TXIMPRequestId aReqId, TInt aResult ) = 0;
+    
+    /**
+     * Access to data cache.
+     */
+    virtual CProtocolPresenceDataHostImp& PresenceDataAccess() = 0;
+
+    /**
+     * to get corresponding protocol host from the array of hosts.
+     * @param aInterfaceId host object interface id
+     */
+	virtual TAny* GetProtocolHost(TInt aInterfaceId) = 0 ;
+
+/*    virtual CPresenceDataCache& DataAccess() = 0;
+    virtual CProtocolPresenceAuthorizationDataHostImp& AuthorizationDataAccess() = 0;
+    virtual CProtocolPresencePublishingDataHostImp& PublishingDataAccess() = 0;
+    virtual CProtocolPresenceWatchingDataHostImp& WatchingDataAccess() = 0;
+    virtual CProtocolPresentityGroupsDataHostImp& GroupsDataAccess() = 0;
+*/    
+    
+    
+    /**
+     * Add new operation to the internal queue of operations. Ownership is transferred.
+     * @param aOperation The operation to add.
+     */
+    virtual void AddNewOperationL( CXIMPOperationBase& aOperation ) = 0;
+
+    /** 
+     * Add new operation for processing.
+     */
+    virtual TXIMPRequestId AddNewOperationL( CXIMPOperationBase* aOperation ) = 0;
+        
+    /**
+     * Do forced teardown by activating all valid cached unbinds.
+     */
+    virtual void ForcedTeardownL() = 0;
+    
+    /**
+     * Start cleaner timer if not started already.
+     */
+    virtual void StartCleanerTimer() = 0;    
+
+    /**
+     * Create operation and add it to process queue.
+     */    
+    virtual TXIMPRequestId AddNewOperationL( 
+                TInt aOperation, MXIMPBase* aParam, MXIMPBase* aParam2 = NULL ) = 0;
+
+
+    /**
+     * Return the protocol ID of the host
+     */    
+
+    virtual TInt32 ProtocolUID( ) = 0;
+    
+protected:
+
+    /**
+     * Protected destructor.
+     * Instancies can't be destroyed via this interface.
+     */
+    virtual ~MXIMPHost() {};
+
+    };
+
+
+#endif // M_PSCHOST_H
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_feature_plugin_api/inc/ximphoststates.h	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  States for PSC Host FSM
+ *
+*/
+
+#ifndef PSCHOSTSTATES_H
+#define PSCHOSTSTATES_H
+
+#include <e32std.h>
+
+/**
+ * PSC host states.
+ * Used as states for the finite state machine inside the host.
+ */
+namespace NXIMPHost
+    {
+    /**
+     * States for the host (internal FSA)
+     */
+    enum THostStates
+        {
+        // actual states
+        EXIMPNotConnected = 0,   // not connected
+        EXIMPConnecting,         // connecting attempt ongoing
+        EXIMPConnected,          // connected
+        EXIMPReconnecting,       // attempting connection after nw suspend
+        EXIMPSuspended,          // nw down
+        EXIMPDisconnecting,      // disconnecting
+        
+        // helper states
+        EXIMPHelperReconnectFailed // reconnecting failed
+        };
+
+    /**
+     * Operation status, needed by host FSA state changes.
+     * Called by operations. Used to update internal state
+     * of host to determine whether network connection is up, down,
+     * inactive or network suspended. See PSC Host-Plugin FSA in design
+     * document.
+     */
+    enum THostOperationState
+        {
+        EXIMPOpNone,             // generic empty state
+        EXIMPOpBindBegin,        // bind is beginning
+        EXIMPOpBindEnd,          // bind has ended
+        EXIMPOpShareBegin,       // share is beginning
+        EXIMPOpShareEnd,         // share has ended
+        EXIMPOpUnshareBegin,     // unshare is beginning
+        EXIMPOpUnshareEnd,       // unshare has ended
+        EXIMPOpReconnectBegin,   // reconnect is beginning
+        EXIMPOpReconnectEnd,     // reconnect has ended
+        EXIMPOpUnbindBegin,      // unbind is beginning
+        EXIMPOpUnbindEnd,        // unbind has ended
+        
+        EXIMPOpSessionLostBegin,     // session lost handling is beginning
+        EXIMPOpSessionLostEnd,       // session lost handling has ended
+        EXIMPOpForcedTeardownBegin,  // forced teardown is beginning
+        EXIMPOpForcedTeardownEnd,    // forced teardown has ended
+        };
+    }
+
+#endif  // PSCHOSTSTATES_H
+
+
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_feature_plugin_api/inc/ximpidentityimp.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,126 @@
+/*
+* 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:  MXIMPIdentity API object implementation.
+*
+*/
+
+#ifndef CXIMPIDENTITYIMP_H
+#define CXIMPIDENTITYIMP_H
+
+#include "ximpapidataobjbase.h"
+//#include "presenceinfoimp.h"
+#include "ximpidentity.h"
+#include <s32strm.h>//needed?
+
+
+/**
+ * MXIMPIdentity API object implementation.
+ *
+ * @lib ximpdatamodel.dll
+ * @since S60 v3.2
+ */
+NONSHARABLE_CLASS( CXIMPIdentityImp ): public CXIMPApiDataObjBase,
+                                         public MXIMPIdentity
+    {
+public:
+    /** The class ID. */
+    enum { KClassId = XIMPIMP_CLSID_CXIMPIDENTITYIMP };
+
+public:
+
+    IMPORT_C static CXIMPIdentityImp* NewLC();
+    IMPORT_C static CXIMPIdentityImp* NewL();
+    IMPORT_C static CXIMPIdentityImp* NewLC( const TDesC16& aIdentity );
+    virtual ~CXIMPIdentityImp();
+
+private:
+
+    CXIMPIdentityImp();
+    void ConstructL();
+    void ConstructL( const TDesC16& aIdentity );
+    
+    /**
+     * @see CXIMPApiDataObjBase
+     */
+    XIMPIMP_DECLARE_DATAOBJ_BASE_PRIV_METHODS
+
+public: // From MXIMPBase
+
+    /**
+     * Implementation of MXIMPBase interface methods
+     * @see MXIMPBase
+     */
+    XIMPIMP_DECLARE_IF_BASE_METHODS
+
+    /**
+     * @see CXIMPApiDataObjBase
+     */
+    XIMPIMP_DECLARE_DATAOBJ_BASE_METHODS
+
+public: // From MXIMPIdentity
+
+    /**
+     * Implementation of MXIMPIdentity interface methods
+     * @see MXIMPIdentity
+     */
+    /*const TDesC8& PresentityUri() const;
+    const TDesC16& DisplayName() const;
+    const TDesC16& ProtocolAddress() const;
+    MPresenceInfo& PresenceInfo();*/
+
+    void SetIdentityL( const TDesC16& aIdentity );
+    const TDesC16& Identity() const;
+
+public: // New functions
+
+    /**
+     * Extenalizes object data to given stream.
+     * @param aStream Stream to write.
+     */
+    /* IMPORT_C void ExternalizeL( RWriteStream& aStream ) const; */
+
+
+    /**
+     * Internalizes object data from given stream.
+     * @param aStream Stream to read.
+     */
+    IMPORT_C void InternalizeL( RReadStream& aStream );
+
+    /**
+     * Compare identities.
+     * @param aOther Compared identity
+     * @return ETrue if identities are different. EFalse if same.
+     */
+    IMPORT_C TBool operator!=( const CXIMPIdentityImp& aOther ) const;
+
+    /**
+     * Compare identities.
+     * @param aOther Compared identity
+     * @return -1 if aOther is greater than this
+     *          0 if they are same
+     *          1 if this if greater than other.
+     */
+    IMPORT_C TInt Compare( const CXIMPIdentityImp& aOther ) const;
+
+private: // data
+
+    /**
+     *
+     */
+    RBuf16 iIdentity;
+
+    };
+
+
+#endif // CXIMPIDENTITYIMP_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_feature_plugin_api/inc/ximpitemparentbase.h	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  Item parent interface.
+*
+*/
+
+#ifndef CXIMPITEMPARENTBASE_H
+#define CXIMPITEMPARENTBASE_H
+
+class CXIMPSubscriptionItemBase;
+
+class MXIMPItemParentBase
+	{
+	public:
+	 /**
+     * Register item for expiration purposes.
+     */   
+    virtual void RegisterExpiringItemL( CXIMPSubscriptionItemBase* aExpireItem ) = 0;
+    
+    /**
+     * Unregister item from expiration purposes.
+     */
+    virtual void UnregisterExpiringItem( CXIMPSubscriptionItemBase* aExpireItem ) = 0;
+    
+    /**
+     * Get requested object
+     */
+    virtual TAny* GetInterface(TInt aInterfaceId) = 0;
+    
+protected: // Destruction
+    
+    /**
+     * Object cannot be delted through this interface
+     */
+    virtual ~MXIMPItemParentBase(){}
+
+	};
+
+
+#endif //CXIMPITEMPARENTBASE_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_feature_plugin_api/inc/ximpobjecthelpers.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,236 @@
+/*
+* 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:  Templated algorithms to simplify object handling
+*
+*/
+
+#ifndef XIMPOBJECTHELPERS_H
+#define XIMPOBJECTHELPERS_H
+
+#include <s32mem.h>
+
+
+class MXIMPObjectCollection;
+const TInt KObjectBufGranurality = 100;
+
+
+/**
+ * Templated object mover to move
+ * objects from pointer array to another.
+ *
+ * @since S60 v3.2
+ */
+template< class T1, class T2 >
+class TXIMPObjectMover
+    {
+
+public:
+    /**
+     * Templated object move method.
+     *
+     * Moves objects from one RPointerArray to another.
+     * Object types in the arrays can be different as long as
+     * source type is castable to target type.
+     *
+     * @param aSource Source array from to move.
+     * @param aTarget Target array to move.
+     */
+    static inline void MoveFromPtrArrayToL( RPointerArray< T1 >& aSource,
+                                            RPointerArray< T2 >& aTarget );
+                                            
+    /**
+     * Templated object move method.
+     *
+     * Moves objects from object collection to array.
+     * Object types in object collection 
+     * hast to be castable to target type.
+     *
+     * @param aSource Source object collection from to move.
+     * @param aTarget Target array to move.
+     */
+    static inline void MoveFromCollectionToArrayL( MXIMPObjectCollection& aSource,
+                                                   RPointerArray< T2 >& aTarget,
+                                                   TLinearOrder< T2 >& aOrder );
+
+private:   //Prohibited constructor
+    TXIMPObjectMover();
+    };
+
+/**
+ * Templated object cloner.
+ *
+ * Object type must support: NewLC(),
+ * ExternalizeL() and InternalizeL().
+ *
+ * @since S60 v3.2
+ */
+template< class T >
+class TXIMPObjectCloner
+    {
+ public:
+
+    /**
+     * Templated object clone method.
+     *
+     * Instantiates a new object and copies data from
+     * given source object with externalize / internalize
+     * to new object. Returns new object ownership to caller.
+     *
+     * @param aObj Templated object to clone.
+     *             Object type must support: NewLC(),
+     *             ExternalizeL() and InternalizeL() methods.
+     *
+     * @return New cloned object. Returns new object
+     *         ownership to caller. Object is left to
+     *         CleanupStack.
+     */
+    static inline T* CloneLC( const T& aObj );
+
+
+    /**
+     * Templated object clone method.
+     *
+     * Similar to CloneLC() but object isn't
+     * left to CleanupStack.
+     *
+     * @param aObj Templated object to clone.
+     *
+     * @return New cloned object. Returns new object
+     *         ownership to caller.
+     */
+    static inline T* CloneL( const T& aObj );
+
+
+private:   //Prohibited constructor
+    TXIMPObjectCloner();
+
+    };
+
+
+
+
+
+
+
+
+/**
+ * Templated object packer.
+ *
+ * Object type must support: NewLC(),
+ * ExternalizeL() and InternalizeL().
+ *
+ * @since S60 v3.2
+ */
+template< class T >
+class TXIMPObjectPacker
+    {
+ public:
+
+    /**
+     * Templated method to pack object.
+     *
+     * Packs given object data to flat buffer and
+     * returns buffer to caller.
+     *
+     * @param aObj Templated object to pack.
+     *             Object type must support ExternalizeL() method.
+     *
+     * @return Buffer containing externalized object data.
+     *         Buffer ownership is returned to caller.
+     */
+    static inline HBufC8* PackL( const T& aObj );
+
+
+
+    /**
+     * Templated method to unpack object.
+     *
+     * Extracts object data from given flat buffer and
+     * returns objects ownership to caller.
+     *
+     * @param aObj Object which data to internalize from package.
+     *             Concrete object type must support InternalizeL() method.
+     *
+     * @Param aPack Buffer containing object data.
+     */
+    static void UnPackL( T& aObj,
+                         const TDesC8& aPack );
+
+
+    /**
+     * Templated method to pack object array.
+     *
+     * Packs given object array data to flat buffer and
+     * returns buffer to caller.
+     *
+     * @param aObjs Array of templated objects to pack.
+     *              Concrete object type must support
+     *              ExternalizeL() method.
+     *
+     * @return Buffer containing externalized object data.
+     *         Buffer ownership is returned to caller.
+     */
+    static inline HBufC8* PackArrayL( const RPointerArray< T >& aObjs );
+
+
+    /**
+     * Templated method to unpack object array.
+     *
+     * Instantiates needed amount of new objects,
+     * extracts their data from given flat buffer and
+     * returns objects ownership to caller.
+     *
+     * @param aObjs Array where to store extracted objects.
+     *              Concrete object type must support
+     *              NewLC() and InternalizeL() methods.
+     *              Array contents are not reseted during
+     *              unpack.
+     *
+     * @Param aPack Buffer containing object data.
+     */
+    static inline void UnPackArrayL( RPointerArray< T >& aObjs,
+                                     const TDesC8& aPack );
+
+
+
+
+private:   //Prohibited constructor
+    TXIMPObjectPacker();
+
+    };
+
+
+class TXIMPHBuf8Packer
+    {
+public:
+    /**
+     * Pack array of buffers to buffer.
+     * @param aBufferArray Array of buffers to pack.
+     * @return Buffer containing buffers.
+     */
+    IMPORT_C static HBufC8* PackArrayL( const RPointerArray< HBufC8 >& aBufferArray );
+    
+    /**
+     * Unpack array of buffers to array.
+     * @param aBufferArray. Target array for new buffers. Ownhersip of items in array is transferred to caller.
+     * @param aPack Packet containing array of buffers.
+     */
+    IMPORT_C static void UnPackArrayL( RPointerArray< HBufC8 >& aBufferArray, const TDesC8& aPack  );
+    };
+
+
+#include "ximpobjecthelpers.inl"
+
+
+#endif // XIMPOBJECTHELPERS_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_feature_plugin_api/inc/ximpobjecthelpers.inl	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  Templated algorithms to simplify object handling
+*
+*/
+
+
+#include <e32base.h>
+#include <ximpbase.h>
+#include <ximpobjectcollection.h>
+
+#include "ximpapiobjbase.h"
+
+
+
+// -----------------------------------------------------------------------------
+// TXIMPObjectMover::MoveFromPtrArrayToL() implementation.
+// -----------------------------------------------------------------------------
+//
+template< class T1, class T2 >
+void TXIMPObjectMover< T1, T2>::MoveFromPtrArrayToL( RPointerArray< T1 >& aSource,
+                                                     RPointerArray< T2 >& aTarget )
+    {
+    const TInt count = aSource.Count();
+    for( TInt ix = 0; ix < count; ix++ )
+        {
+        T2* targetHolder = aSource[ 0 ];
+        aTarget.AppendL( targetHolder );
+        aSource.Remove( 0 );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// TXIMPObjectMover::MoveFromCollectionToArrayL() implementation.
+// -----------------------------------------------------------------------------
+//
+template< class T1, class T2 >
+void TXIMPObjectMover< T1, T2>::MoveFromCollectionToArrayL( MXIMPObjectCollection& aSource, 
+                                                            RPointerArray< T2 >& aTarget,
+                                                            TLinearOrder< T2 >& aOrder )
+    {
+    MXIMPBase* object = NULL;
+    while( aSource.GetByType( object, T1::KInterfaceId ) )
+        {
+        T2* instance = TXIMPGetImpClassOrPanic< T2 >::From( *object );
+        CleanupStack::PushL( instance );
+        aTarget.InsertInOrderL( instance, aOrder );
+        CleanupStack::Pop( instance );
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// TXIMPObjectCloner::CloneLC() implementation.
+// -----------------------------------------------------------------------------
+//
+template< class T >
+T* TXIMPObjectCloner<T>::CloneLC( const T& aObj )
+    {
+    T* clone = T::NewLC();
+
+    CBufSeg* buffer = CBufSeg::NewL( KObjectBufGranurality );
+    CleanupStack::PushL( buffer );
+
+    //Externalize
+    RBufWriteStream ws;
+    ws.Open( *buffer );
+    CleanupClosePushL( ws );
+    aObj.ExternalizeL( ws );
+    CleanupStack::PopAndDestroy(); // ws
+
+    //Internalize
+    RBufReadStream rs;
+    rs.Open( *buffer );
+    CleanupClosePushL( rs );
+    clone->InternalizeL( rs );
+    CleanupStack::PopAndDestroy(); // rs
+
+    CleanupStack::PopAndDestroy( buffer );
+
+    return clone;
+    }
+
+
+// -----------------------------------------------------------------------------
+// TXIMPObjectCloner::CloneL() implementation.
+// -----------------------------------------------------------------------------
+//
+template< class T >
+T* TXIMPObjectCloner<T>::CloneL( const T& aObj )
+    {
+    T* clone = TXIMPObjectCloner::CloneLC( aObj );
+    CleanupStack::Pop( clone );
+    return clone;
+    }
+
+
+// -----------------------------------------------------------------------------
+// TXIMPObjectPacker::PackL() implementation.
+// -----------------------------------------------------------------------------
+//
+template< class T >
+HBufC8* TXIMPObjectPacker<T>::PackL( const T& aObj )
+	{
+    // we don't know how large the returned descriptor is going to be
+    CBufFlat* packBuf = CBufFlat::NewL( KObjectBufGranurality );
+    CleanupStack::PushL( packBuf );
+
+    RBufWriteStream ws;
+    ws.Open( *packBuf ); // CSI: 65 #
+    CleanupClosePushL( ws );
+
+    aObj.ExternalizeL( ws );
+
+    ws.CommitL();
+    CleanupStack::PopAndDestroy(); //ws
+
+    // now CBufFlat contains the descriptor
+    HBufC8* packBufDesc = packBuf->Ptr(0).AllocL();
+
+    CleanupStack::PopAndDestroy( packBuf );
+    return packBufDesc;
+
+	}
+
+// -----------------------------------------------------------------------------
+// TXIMPObjectPacker::UnPackL() implementation.
+// -----------------------------------------------------------------------------
+//
+template< class T >
+void TXIMPObjectPacker<T>::UnPackL( T& aObj, const TDesC8& aPack )
+	{
+    if ( ! aPack.Length() )
+        {
+        // empty, don't attempt to unpack.
+        return;
+        }
+
+    RDesReadStream rs;
+    CleanupClosePushL( rs );
+    rs.Open( aPack ); // CSI: 65 #
+    aObj.InternalizeL( rs );
+    CleanupStack::PopAndDestroy(); // rs
+
+	}
+
+// -----------------------------------------------------------------------------
+// TXIMPObjectPacker::PackArrayL() implementation.
+// -----------------------------------------------------------------------------
+//
+template< class T >
+HBufC8* TXIMPObjectPacker<T>::PackArrayL( const RPointerArray< T >& aObjs )
+	{
+    CBufFlat* packBuf = CBufFlat::NewL( KObjectBufGranurality );
+    CleanupStack::PushL( packBuf );
+
+    RBufWriteStream ws;
+    ws.Open( *packBuf ); // CSI: 65 #
+    CleanupClosePushL( ws );
+
+    // Get count of objects
+    TInt objCount( aObjs.Count() );
+    // write the count
+    ws.WriteInt32L( objCount );
+    // objects
+    for ( TInt count(0); count < objCount; count++ )
+        {
+        aObjs[count]->ExternalizeL( ws );
+        }
+
+    ws.CommitL();
+    CleanupStack::PopAndDestroy(); //ws
+
+    HBufC8* packBufDesc = packBuf->Ptr(0).AllocL();
+    CleanupStack::PopAndDestroy( packBuf );
+
+    return packBufDesc;
+	}
+
+// -----------------------------------------------------------------------------
+// TXIMPObjectPacker::UnPackArrayL() implementation.
+// -----------------------------------------------------------------------------
+//
+template< class T >
+void TXIMPObjectPacker<T>::UnPackArrayL( RPointerArray< T >& aObjs,
+                                     const TDesC8& aPack )
+	{
+	// No reset
+    if ( ! aPack.Length() )
+        {
+        // empty, don't attempt to unpack
+        return;
+        }
+
+    RDesReadStream rs;
+    CleanupClosePushL( rs );
+    rs.Open( aPack ); // CSI: 65 #
+
+    // read the object count
+    TInt objCount( rs.ReadInt32L() );
+
+	for ( TInt count = 0; count < objCount; count++ )
+        {
+		// instantiate new object
+	    T* theObject = T::NewLC();
+	    // extract its data
+	    theObject->InternalizeL( rs );
+	    // append it to the object array
+	    aObjs.AppendL( theObject );
+	    CleanupStack::Pop( theObject ); // theObject
+		}
+
+    CleanupStack::PopAndDestroy(); // rs
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_feature_plugin_api/inc/ximpoperationbase.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,208 @@
+/*
+* 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:  Base class for operations
+ *
+*/
+
+#ifndef C_XIMPPSCOPERATIONBASE_H
+#define C_XIMPPSCOPERATIONBASE_H
+
+#include <e32base.h>
+
+class CXIMPRequestCompleteEventImp;
+class CXIMPRestrictedObjectCollectionImp;
+class CXIMPPscContext;
+class MXIMPHost;
+class MXIMPStatus;
+class CXIMPStatusImp;
+class MXIMPPscContext ;
+class MXIMPRestrictedObjectCollection ;
+
+
+/**
+ * Base C-class for operations
+ *
+ * @lib ximpoperation.lib
+ * @since S60 v4.0
+ */
+class CXIMPOperationBase : public CBase
+    {
+    public:
+
+        /**
+         * Call this, then BaseConstructL in derived class.
+         */
+        IMPORT_C CXIMPOperationBase();
+
+        IMPORT_C virtual ~CXIMPOperationBase();
+
+        /**
+         * @param aRequestId The request id
+         */
+        IMPORT_C void BaseConstructL( TXIMPRequestId aRequestId,
+                                    CXIMPPscContext* aContext );
+
+    public: // common services
+
+        virtual void ConstructL( const TDesC8& aParamPck ) = 0;
+
+        /**
+         * Set host for operation. ProcessL cannot be called before
+         * host is set.
+         */        
+        IMPORT_C virtual void SetHost( MXIMPHost& aMyHost );
+
+        /**
+         * Process this operation.
+         */
+        IMPORT_C virtual void ProcessL();
+
+        /**
+         * Request made by the operation has been completed.
+         */
+        IMPORT_C virtual void RequestCompletedL();
+
+        /**
+         * @return The request complete event
+         */
+        IMPORT_C virtual CXIMPRequestCompleteEventImp* GetReqCompleteEvent();
+
+        /**
+         * @return The operation type which this operation implements.
+         */
+        IMPORT_C virtual TInt Type() const;
+
+        /**
+         * @param aContext The context of operation
+         */
+        IMPORT_C virtual void SetOpL( CXIMPPscContext* aContext );
+
+        /**
+         * @param aRequestId The request id
+         */
+        IMPORT_C virtual void SetReqId( TXIMPRequestId aRequestId );
+
+        /**
+         * @return Context object of operation
+         */
+        IMPORT_C virtual CXIMPPscContext* Context();
+
+        /**
+         * @return The current request id
+         */
+        IMPORT_C virtual TXIMPRequestId RequestId() const;
+        
+        /**
+         * Set result code for operation
+         */
+        IMPORT_C virtual void SetResultCode( TInt aResultCode );
+        
+        /**
+         * Set status for operation
+         */
+        IMPORT_C virtual void SetStatus( MXIMPStatus* aStatus );
+
+        /**
+         * Set new object collection for operator.
+         */        
+        IMPORT_C virtual void SetObjectCollection( MXIMPBase* aCollection );
+
+        /**
+         * 
+         */
+        IMPORT_C virtual void BeginOperation();
+
+        /**
+         *
+         */        
+        IMPORT_C virtual void EndOperation();
+        
+        /**
+         *
+         */
+        IMPORT_C virtual MXIMPStatus& Status() const;
+        
+        
+        /**
+         *
+         */
+        IMPORT_C TBool IsServerOperation() const;
+        
+        /**
+         *
+         */
+        IMPORT_C void SetServerOperation();
+        
+         /**
+         *
+         */
+        IMPORT_C MXIMPPscContext* GetContext();
+ 
+        /**
+         *
+         */
+        IMPORT_C MXIMPRestrictedObjectCollection* GetObjCollection();
+      
+    protected: // Internal methods
+    
+        /**
+         * Create request complete event
+         */
+        IMPORT_C virtual void CreateRequestCompleteEventL();
+    
+    protected: // data
+
+        /**
+         * Req id
+         */
+        TXIMPRequestId iReqId;
+
+        /**
+         * Host of this operation. Shared owning. Use close to destroy
+         */
+        MXIMPHost* iMyHost;
+
+        /**
+         * Request complete event
+         * Owned.
+         */
+        CXIMPRequestCompleteEventImp* iReqCompleteEvent;
+
+        /**
+         * Context of operation
+         */
+        CXIMPPscContext* iContext;
+
+        /**
+         * If ETrue, operation is not active
+         */
+        TBool iNotActive;
+        
+        /**
+         * Internal state of the host
+         */
+        CXIMPStatusImp* iStatusObj;
+        
+        /**
+         * Holder for parameters. Owned
+         */
+        CXIMPRestrictedObjectCollectionImp* iObjCollection;        
+        
+        /**
+         * True if server initiated operation
+         */
+        TBool iServerOperation;
+    };
+
+#endif // C_XIMPPSCOPERATIONBASE_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_feature_plugin_api/inc/ximpoperationdefs.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,49 @@
+/*
+* 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 framework operation definitions.
+ *
+*/
+
+#ifndef XIMPOPERATIONDEFS_H
+#define XIMPOPERATIONDEFS_H
+
+#include <e32std.h>
+
+/**
+ * PSC operations.
+ */
+namespace NXIMPOps
+    {
+    enum TXIMPOpTypes
+        {
+        EPrNone = 0,     // base class
+
+        // -----------------------------------------------
+        // From client
+        //
+        EXIMPBindContext,                                // 1
+        EXIMPUnbindContext,                              // 2
+        EXIMPBindContext2,                               // 3
+
+        // Session mgmt internal
+        EXIMPForcedTeardown = 100,                // 100
+        };
+    }
+
+#endif  //XIMPOPERATIONDEFS_H
+
+
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_feature_plugin_api/inc/ximpoperationfactory1.h	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  Presence Service Connection operation factory
+ *
+*/
+
+
+#ifndef XIMPCPSCOPERATIONFACTORY1_H
+#define XIMPCPSCOPERATIONFACTORY1_H
+
+#include <e32base.h>
+#include <ecom/ecom.h>
+#include <ximpfeaturepluginifids.hrh>
+
+class CXIMPOperationBase;
+
+//#include <imdlluids.hrh>  
+ 
+/**
+ * Operation factory interface
+ *
+ * @lib ximpoperation.dll
+ * @since S60 v4.0
+ */
+class MXIMPOperationFactory1
+    {
+    
+    public:
+
+    /**
+     * ECom interface UID for the MXIMPOperationFactory1.
+     *
+     * This interface ID is used:
+     * 1) In XIMPFw ECom registration file, to declare
+     *    implemented interface. It is used also by
+     *    the MXIMPClient::NewClientL() instantiation
+     *    method, when creating MXIMPOperationFactory instance
+     *    through the ECom.
+     *
+     * 2) By clients when resolving MXIMPOperationFactory interface
+     *    through MXIMPBase::GetInterface().
+     */
+    enum { KInterfaceId = XIMP_ECOM_IF_UID_OPERATIONS_INTERFACE };
+    
+    /**
+    * To get list of implementation plugins which supports this interface
+    */
+    inline static void ListAllImplementationsL(RImplInfoPtrArray& aImplInfoArray) ;
+    
+public:
+
+    /**
+    * Object creation functions
+    */
+	inline static MXIMPOperationFactory1* NewL();
+
+    /**
+    * Object creation functions
+    */
+	inline static MXIMPOperationFactory1* NewL( TUid aImplUid );
+
+    /**
+     * Public destructor.
+     * Object can be deleted through this interface.
+     */
+    virtual inline ~MXIMPOperationFactory1();
+
+
+
+protected:
+
+    /**
+     * Default constructor to zero initialize
+     * the iEcomDtorID member.
+     */
+    inline MXIMPOperationFactory1();
+
+public: // From MXIMPOperationFactory1
+
+		/**
+		 * Create operation by operation id.
+		 * @param aOperation. Identifies operation needed to create.
+		 * @return Operation as base object.
+	 	 */
+		virtual CXIMPOperationBase* CreateOperationL( TInt aOperation ) = 0;
+		
+private: // Data
+
+    //OWN: ECom destructor ID
+    TUid iEcomDtorID;
+    };
+#include <ximpoperationfactory1.inl>
+
+#endif      // XIMPCPSCOPERATIONFACTORY1_H
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_feature_plugin_api/inc/ximpoperationfactory1.inl	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,75 @@
+/*
+* 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:  Root interface used by Presence Framework clients.
+*
+*/
+
+#include <ecom/ecom.h>
+
+
+// -----------------------------------------------------------------------------
+// MXIMPOperationFactory::NewClientL() implementation
+// Factory method to instantiate the platform default
+// MXIMPOperationFactory implementation through the ECom framework.
+// -----------------------------------------------------------------------------
+//
+inline MXIMPOperationFactory1* MXIMPOperationFactory1::NewL()
+    {
+    _LIT8( KXimpFwDefaultData, "" );
+
+    TEComResolverParams resolvingParams;
+    resolvingParams.SetDataType( KXimpFwDefaultData );
+    resolvingParams.SetWildcardMatch( ETrue );
+
+    TAny* imp = REComSession::CreateImplementationL( TUid::Uid( MXIMPOperationFactory1::KInterfaceId ),
+                                                     _FOFF( MXIMPOperationFactory1, iEcomDtorID ),
+                                                     resolvingParams );
+
+    return reinterpret_cast< MXIMPOperationFactory1* >( imp );
+    }
+
+inline MXIMPOperationFactory1* MXIMPOperationFactory1::NewL( TUid aImplUid )
+	{
+    TAny* imp = REComSession::CreateImplementationL( aImplUid,
+                                                     _FOFF( MXIMPOperationFactory1, iEcomDtorID ));
+
+
+    return reinterpret_cast< MXIMPOperationFactory1* >( imp );
+	}
+	
+// -----------------------------------------------------------------------------
+// MXIMPOperationFactory1::MXIMPOperationFactory1() implementation
+// Zero initializes the iEcomDtorID member.
+// -----------------------------------------------------------------------------
+//
+inline MXIMPOperationFactory1::MXIMPOperationFactory1()
+    {
+    iEcomDtorID = TUid::Null();
+    }
+
+
+// -----------------------------------------------------------------------------
+// MXIMPOperationFactory1::~MXIMPOperationFactory1()
+// Destructor notifies the ECom from implementation destruction.
+// -----------------------------------------------------------------------------
+//
+inline MXIMPOperationFactory1::~MXIMPOperationFactory1()
+    {
+    REComSession::DestroyedImplementation( iEcomDtorID );
+    }
+
+inline void MXIMPOperationFactory1::ListAllImplementationsL(RImplInfoPtrArray& aImplInfoArray) 
+	{
+	REComSession::ListImplementationsL(TUid::Uid(MXIMPOperationFactory1::KInterfaceId), aImplInfoArray);
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_feature_plugin_api/inc/ximppanics.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,135 @@
+/*
+* 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:  XIMP Framework panic defines.
+ *
+*/
+
+#ifndef XIMPPANICS_H
+#define XIMPPANICS_H
+
+#include <e32std.h>
+
+/**
+ * Panic category and reason codes for XIMP Framework client
+ * failures.
+ */
+namespace NXIMPPanic
+    {
+    _LIT( KCategory, "XIMPClnt" );
+
+    enum TReason
+        {
+        EOnSrvSessionImpAlreadyExists,
+        EOnSrvSessionImpNotFound,
+        EOnSrvRequestNotUnderstood,
+        EOnSrvAlreadyListeningEvents,
+        EOnSrvAlreadyHavingPrepearedData,
+        EOnSrvNoPrepearedDataToCopy,
+        EOnSrvUnknownCtxOperationType
+        };
+    }
+
+
+/**
+ * Panic category and reason codes for XIMP Framework server
+ * failures.
+ */
+namespace NXIMPPrivPanic
+    {
+    _LIT( KCategory, "XIMPPriv" );
+    enum TReason
+        {
+        ECurrentMsgAlreadyExists,                   //  0
+        ECurrentMsgNotFoundInServiceError,          //  1
+        ECurrentMsgNotValidInServiceError,          //  2
+        EMessageStillPendingOnDestruction,          //  3
+        EMessageSelfPtrAlreadyOccupied,             //  4
+        EPscEnvGlobalsExistsAlready,                //  5
+        EPscEnvGlobalsNotFound,                     //  6
+        EFrontEndEventPumpNoServerClient,           //  7
+        EPtrArrayEntryAddUndoInitialized,           //  8
+        EPtrArrayEntryReplaceUndoInitialized,       //  9
+        EInvalidOperationType,                      // 10
+        EProtocolAlreadyExistsInHost,               // 11
+        EHostMgrHostsHaveNotBeenDeleted,            // 12
+        EContextAlreadyHasAHost,                    // 13
+        EContextHasNoHost,                          // 14
+        EHostStillReferenced,                       // 15
+        EHostNegativeReferenceCount,                // 16
+        EHostCurrentOperationStillActive,           // 17
+        EInvalidSubscriptionStatus,                 // 18
+        EFakeRequestCompleteNotReady,               // 19
+        EOwnPresencePifNotSet,                      // 20
+        EArrayCountNotValid,                        // 21
+        EOwnPresencePresenceInfoDoesNotExist,       // 22
+        EInvalidSubscriptionType,                   // 23
+        ESubscriptionItemLogicError,                // 24
+        EPresentityPresencePresenceInfoDoesNotExist,// 25
+        EHostNotFound,                              // 26
+        ENoCachedUnbindsFound,                      // 27
+        EInvalidHostForProtocol,                    // 28
+        ECurrentOperationNull,                      // 29
+        EInvalidFilterType,                         // 30
+        EMatchingClientSideReqNotFound,             // 31
+
+        // invalid operation state transitions
+        EInvalidStateForSessionLost = 40,           // 40
+        EInvalidStateForOp,                         // 41
+        EInvalidStateForOpBindBegin,                // 42
+        EInvalidStateForOpBindEnd,                  // 43
+        EInvalidStateForOpShareBoth,                // 44
+        EInvalidStateForOpUnshareBoth,              // 45
+        EInvalidStateForOpReconnectBegin,           // 46
+        EInvalidStateForOpReconnectEnd,             // 47
+        EInvalidStateForOpUnbindBegin,              // 48
+        EInvalidStateForOpUnbindEnd,                // 49
+        EInvalidStateForOpSessionLostBegin,         // 50
+        EInvalidStateForOpSessionLostEnd,           // 51
+        EInvalidStateForOpTearDownBoth,             // 52
+
+        // invalid state transitions
+        EInvalidStateTransUnknown = 60,             // 60
+        EInvalidStateTransForNotConnected,          // 61
+        EInvalidStateTransForConnecting,            // 62
+        EInvalidStateTransForConnected,             // 63
+        EInvalidStateTransForReconnecting,          // 64
+        EInvalidStateTransForSuspended,             // 65
+        EInvalidStateTransForDisconnecting,         // 66
+        };
+        
+        
+    /**
+     * Panic function to trigger NXIMPPrivPanic
+     * panics.
+     */
+    IMPORT_C void Panic( TReason aReason );
+    }
+
+namespace NXIMPPlugin
+    {
+    _LIT( KCategory, "XIMPPlugin" );
+    enum TReason
+        {
+        EInvalidRequestId
+        };
+
+    }
+
+
+#endif  //ximppanics_H
+
+
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_feature_plugin_api/inc/ximppsccontext.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,67 @@
+/*
+* 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:  Context interface
+*
+*/
+
+#ifndef MXIMPPSCCONTEXT_H
+#define MXIMPPSCCONTEXT_H
+
+class CPresenceInfoFilterImp;
+class CXIMPIdentityImp;
+
+/**     
+ * Context interface.
+ *
+ * @since S60 v3.2
+ */
+class MXIMPPscContext
+    {
+
+public: // Enumerations
+
+    enum TFilterStoreType
+        {
+        EOwnPresenceFilter,
+        EPresentityPresenceFilter,
+        EPresentityGroupMemberPresenceFilter,
+        EGrantPresenceToEveryoneFilter,
+        EGrantPresenceToPresentityFilter,
+        EGrantPresenceToGroupMemberFilter
+        };
+    
+public: // Interface
+
+    /*
+     * Access to current presence interest. 
+     * @param Type of filter to access.
+     * @param aIdentity Identity to map filter. Default NULL
+     * @return Presence interest. NULL if not defined.
+     */
+    virtual CPresenceInfoFilterImp* PresenceInfoFilter( TFilterStoreType aTypeOfFilter, 
+                                                            const CXIMPIdentityImp* aIdentity = NULL ) const = 0;
+
+protected: // Destruction
+    
+    /**
+     * Object cannot be deleted through this interface
+     */
+    virtual ~MXIMPPscContext(){}
+    };
+
+/* ======================================================================== */
+
+
+
+#endif // MXIMPPSCCONTEXT_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_feature_plugin_api/inc/ximprbufhelpers.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,128 @@
+/*
+* 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:  Helpers for handling RBuf.
+*
+*/
+
+#ifndef XIMPRBUFHELPERS_H
+#define XIMPRBUFHELPERS_H
+
+#include <e32cmn.h>
+#include <s32strm.h>
+
+
+
+/**
+ * RBuf16 handling helper.
+ *
+ * @lib ximpdatamodel.dll
+ * @since S60 v3.2
+ */
+class XIMPRBuf16Helper
+    {
+public:
+
+    /**
+     * Grows RBuf hold given max length.
+     *
+     * @param aBuf RBuf reference which to grow.
+     * @param aMaxLength Needed max length.
+     */
+    IMPORT_C static void GrowIfNeededL( RBuf16& aBuf, const TInt aMaxLength );
+
+
+    /**
+     * Sets new value for RBuf.
+     *
+     * @param aBuf RBuf reference where to set.
+     *        ReAllocated if needed during the set.
+     * @param aValue Value to set.
+     */
+    IMPORT_C static void SetNewValueL( RBuf16& aBuf, const TDesC16& aValue );
+
+
+    /**
+     * Externalizes RBuf to stream.
+     *
+     * @param aBuf RBuf which to externalize.
+     * @param aStream The stream to write.
+     */
+    IMPORT_C static void ExternalizeL( const RBuf16& aBuf, RWriteStream& aStream );
+
+
+    /**
+     * Internalizes referenced RBuf from stream.
+     * ReAllocates the RBuf if needed during the internalization.
+     *
+     * @param aBuf RBuf reference where to internalize.
+     * @param aStream The stream from to read.
+     */
+    IMPORT_C static void InternalizeL( RBuf16& aBuf, RReadStream& aStream );
+
+    };
+
+
+
+/**
+ * RBuf8 handling helper.
+ *
+ * @lib ximpdatamodel.dll
+ * @since S60 v3.2
+ */
+class XIMPRBuf8Helper
+    {
+public:
+
+    /**
+     * Grows RBuf hold given max length.
+     *
+     * @param aBuf RBuf reference which to grow.
+     * @param aMaxLength Needed max length.
+     */
+    IMPORT_C static void GrowIfNeededL( RBuf8& aBuf, const TInt aMaxLength );
+
+
+    /**
+     * Sets new value for RBuf.
+     *
+     * @param aBuf RBuf reference where to set.
+     *        ReAllocated if needed during the set.
+     * @param aValue Value to set.
+     */
+    IMPORT_C static void SetNewValueL( RBuf8& aBuf, const TDesC8& aValue );
+
+
+    /**
+     * Externalizes RBuf to stream.
+     *
+     * @param aBuf RBuf which to externalize.
+     * @param aStream The stream to write.
+     */
+    IMPORT_C static void ExternalizeL( const RBuf8& aBuf, RWriteStream& aStream );
+
+
+    /**
+     * Internalizes referenced RBuf from stream.
+     * ReAllocates the RBuf if needed during the internalization.
+     *
+     * @param aBuf RBuf reference where to internalize.
+     * @param aStream The stream from to read.
+     */
+    IMPORT_C static void InternalizeL( RBuf8& aBuf, RReadStream& aStream );
+
+    };
+
+
+#endif      //XIMPRBUFHELPERS_H
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_feature_plugin_api/inc/ximprequestidbuilder.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,88 @@
+/*
+* 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:  TXIMPRequestId builder.
+ *
+*/
+
+
+
+#ifndef XIMPREQUESTIDBUILDER_H
+#define XIMPREQUESTIDBUILDER_H
+
+#include <e32base.h>
+
+class TXIMPRequestId;
+
+/**
+ * The request ID builder for XIMP internal use to
+ * construct valid TXIMPRequestId:s
+ *
+ * @since S60 v3.2
+ */
+class TXIMPRequestIdBuilder
+    {
+public:
+
+    /**
+     * C++ default constructor.
+     * Initialises all parts to to their default values.
+     */
+    IMPORT_C TXIMPRequestIdBuilder();
+
+
+    /**
+     * Sets the protocol ID part.
+     */
+    IMPORT_C void SetProtocolId( TUint32 aProtocol );
+
+
+    /**
+     * Sets the session ID part.
+     */
+    IMPORT_C void SetSessionId( TUint32 aSession );
+
+
+    /**
+     * Sets the request ID part.
+     */
+    IMPORT_C void SetRequestId( TUint32 aRequest );
+
+
+    /**
+     * Constructs a TXIMPRequestId object having
+     * valued as specified in member parts.
+     */
+    IMPORT_C TXIMPRequestId BuildRequestId() const;
+
+
+
+private: // data
+
+    //OWN: Spare value reserved for future extension.
+    TUint32 iSpare;
+
+    //OWN: Protocol id part
+    TUint32 iProtocol;
+
+    //OWN: Session id part
+    TUint32 iSession;
+
+    //OWN: Request id part
+    TUint32 iRequest;
+    };
+
+
+#endif // XIMPREQUESTIDBUILDER_H
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_feature_plugin_api/inc/ximpsubscriptionitem.h	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  Subscription item interface
+*
+*/
+
+#ifndef MXIMPPSCSUBSCRIPTIONITEM_H
+#define MXIMPPSCSUBSCRIPTIONITEM_H
+
+class MXIMPPscContext;
+class CXIMPDataSubscriptionStateImp;
+
+/**
+ * Context interface.
+ *
+ * @since S60 v3.2
+ */
+class MXIMPSubscriptionItem
+    {
+    
+public: // Interface
+
+    /**
+     * Synthesise own presence information to given context.
+     * Presence information is filtered with context pif.
+     * @param aContext. Target context for presence information.
+     */    
+    virtual void SynthesiseSubscriptionEventToL( MXIMPPscContext* aContext, TBool aForceEvent ) = 0;
+    
+    /**
+     * Synthesise presence information to all subscribed contexts.
+     */
+    virtual void SynthesiseSubscriptionEventToAllCtxsL() = 0;
+            
+    /**
+     * Activate subscriber that is added with AddSubscriberL method of subscriptionItem
+     * @param aContext. Target context.
+     */
+    virtual void ActivateSubscriberL( MXIMPPscContext* aContext ) = 0;
+
+    /**
+     * Set new subscriptionstate normally invoked by adaptation.
+     * @param aNewState New subscription state
+     */
+    virtual void SetDataSubscriptionStateL( CXIMPDataSubscriptionStateImp& aNewState ) = 0;
+        
+protected: // Destruction
+    
+    /**
+     * Object cannot be deleted through this interface
+     */
+    virtual ~MXIMPSubscriptionItem(){}
+    };
+
+/* ======================================================================== */
+
+
+
+#endif // MXIMPPSCSUBSCRIPTIONITEM_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_feature_plugin_api/inc/ximpsubscriptionitembase.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,253 @@
+/*
+* 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 Service Connection own presence subscription implementation.
+*
+*/
+
+#ifndef CXIMPPSCSUBSCRIPTIONITEMBASE_H
+#define CXIMPPSCSUBSCRIPTIONITEMBASE_H
+
+#include <e32base.h>
+#include <ximpdatasubscriptionstate.h>
+#include "ximpsubscriptionitem.h"
+
+
+class MXIMPItemParentBase;
+class MXIMPPscContext;
+class CXIMPDataSubscriptionStateImp;
+
+/**
+ * PSC subscription implementation
+ *
+ * @since S60 v3.2
+ */
+class CXIMPSubscriptionItemBase : public CObject, public MXIMPSubscriptionItem
+    {
+public: // Definitions
+
+    /**
+     * Subscription status
+     */
+    enum TSubscriptionStatus
+        {
+        ENotSubscribedAtAll,
+        ESubscribedForOtherCtxOnly,
+        ESubscribedForCtxOnly,
+        ESubscribedForCtxAndOthers
+        };
+
+    /**
+     * Subscription update event.
+     * Update subscription based on event.
+     */
+    enum TSubscriptionEvent
+        {
+        ECompleteDataReceived
+        };
+
+    /**
+     * For linear ordering by pointers
+     */
+    static TInt OrderOfContexts( const MXIMPPscContext& aFirst,
+                                 const MXIMPPscContext& aSecond );
+
+    /**
+     * For linear ordering by pointers
+     */
+    static TInt OrderOfItems( const CXIMPSubscriptionItemBase& aFirst,
+                              const CXIMPSubscriptionItemBase& aSecond );
+
+protected: // Construction and destruction
+
+    /**
+     * Destruction
+     * - Remember to inform parent about delete.
+     */
+    IMPORT_C virtual ~CXIMPSubscriptionItemBase();
+
+public: // Construction and destruction
+
+    /**
+     * Construction
+     * @param aParent. Parent has to be informed when this object is deleted by RemoveMe method.
+     */
+    IMPORT_C CXIMPSubscriptionItemBase( MXIMPItemParentBase& aParent );
+
+    /**
+     * Base construction. Must be called from inherited classes ConstructL
+     */
+    IMPORT_C void BaseConstructL();
+
+
+public: // New methods
+
+    /**
+     * Subscriptionstatus for context.
+     *
+     *   ENotSubscribedAtAll            - Subscribe not done by any context.
+     *   ESubscribedForOtherCtxOnly     - Subscribe done by others but not aContext
+     *   ESubscribedForCtxOnly          - Subscribe done by aContext only.
+     *   ESubscribedForCtxAndOthers     - Subscribe done by others and aContext.
+     *
+     * @param aContext Check subscription status for aContext.
+     */
+    IMPORT_C TSubscriptionStatus SubscriptionStatus( MXIMPPscContext* aContext );
+
+    /**
+     * Add subscriber for item.
+     * @param aContext. Context to be added.
+     */
+    IMPORT_C void AddSubscriberL( MXIMPPscContext* aContext );
+
+    /**
+     * Remove subscriber from item
+     * @param aContext. Context to be removed.
+     */
+    IMPORT_C void RemoveSubscriber( MXIMPPscContext* aContext );
+
+    /**
+     * Add subscriber for item.
+     * @param aItem. Item to be added.
+     */
+    IMPORT_C void AddSubscriberL( CXIMPSubscriptionItemBase* aItem );
+
+    /**
+     * Remove subscriber from item
+     * @param aContext. Item to be removed.
+     */
+    IMPORT_C void RemoveSubscriber( CXIMPSubscriptionItemBase* aItem );
+
+    /**
+     * Activate subscriber for item.
+     * @param aItem. Item to be activated.
+     */
+    IMPORT_C void ActivateSubscriberL( CXIMPSubscriptionItemBase* aItem );
+
+    /**
+     * Call RemoveSubscriber for all contexts registered to item.
+     */
+    IMPORT_C void ForceClose();
+
+    /**
+     * Clean item if expired.
+     * @return ETrue if expired and cleaned.EFalse if not.
+     */
+    IMPORT_C TBool CleanIfExpired();
+
+    /**
+     * Update subscription based on event happened.
+     * @param aUpdateState. Event which happened.
+     */
+    IMPORT_C void UpdateSubscriptionStateL( TSubscriptionEvent aUpdateState );
+    
+    /**
+     *
+     */
+    IMPORT_C const MXIMPDataSubscriptionState& DataSubscriptionState();
+        
+    /**
+     * Count of subscribed contexts.
+     */
+    IMPORT_C TInt ContextCount() const;
+
+    /**
+     * Reference to context in index.
+     */
+    IMPORT_C MXIMPPscContext& Context( TInt aIndex );
+
+    /**
+     * Can context be found from contexts.
+     */
+    IMPORT_C TBool IsContext( MXIMPPscContext* aContext ) const;
+
+public: // From MXIMPSubscriptionItem
+
+    /**
+     * @see MXIMPSubscriptionItem
+     */
+    IMPORT_C void SynthesiseSubscriptionEventToAllCtxsL();
+
+    /**
+     * @see MXIMPSubscriptionItem
+     */
+    IMPORT_C void ActivateSubscriberL( MXIMPPscContext* aContext );
+        
+    /**
+     * @see MXIMPSubscriptionItem
+     */
+    IMPORT_C void SetDataSubscriptionStateL( CXIMPDataSubscriptionStateImp& aNewState );
+
+public: // Helpers
+
+    /**
+     * Status for context
+     */
+    IMPORT_C CXIMPDataSubscriptionStateImp* StatusLC( MXIMPPscContext* aContext ) const;
+
+    /**
+     * Update time to new expire time.
+     */
+    IMPORT_C void UpdateExpirationL();
+
+    /**
+     * Change status after subscriber is added/removed.
+     */
+    IMPORT_C void ChangeStatusAfterAdd();
+    IMPORT_C void ChangeStatusAfterRemove();
+
+    /**
+     * Count of subscribers. Items counted as 1.
+     */
+    IMPORT_C TInt CountOfSubscribers();
+
+protected: // New interface methods.
+
+    /**
+     * Clean data because expiration
+     */
+    virtual void CleanExpired() = 0;
+
+protected: // Data
+
+    /**
+     * Parent object to inform when object is deleted.
+     * Used also for sending events.
+     */
+    MXIMPItemParentBase& iParent;
+
+    /**
+     * Subscribed contexts.
+     */
+    RPointerArray< MXIMPPscContext > iContexts;
+    RPointerArray< MXIMPPscContext > iPreContexts;
+    RPointerArray< CXIMPSubscriptionItemBase > iItems;
+    RPointerArray< CXIMPSubscriptionItemBase > iPreItems;
+
+    /**
+     * Current presence info status.
+     */
+    CXIMPDataSubscriptionStateImp* iSubscriptionState;
+
+    /**
+     * Time when ready for expire.
+     */
+    TTime iExpireTime;
+    };
+
+
+/* ======================================================================== */
+
+
+
+#endif // CXIMPPSCSUBSCRIPTIONITEMBASE_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/docs/readme.txt	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,336 @@
+Conventions for writing test cases and using decorators for them.
+
+-----------------------------------------------------------------------
+
+******************************************
+*     WHICH DECORATOR I SHOULD USE       *
+******************************************
+#1 Do no use static test decorators. Decorators are used dynamically.
+  - 1. Ok to use decorator -> Use PRFW_DECORATED_TEST
+  - 2. nok to use decorator -> Use PRFW_NOT_DECORATED_TEST
+
+
+-----------------------------------------------------------------------
+****************************************
+* HOW TO USE THE TEST CONTEXT WRAPPERS *
+****************************************
+
+Relevant files:
+testcaseutils/prfwtestcontextwrapper.h
+testcaseutils/prfwtestcontextwrappermgr.h
+testcaseutils/prfwtestcontextwrapper.cpp
+testcaseutils/prfwtestcontextwrappermgr.cpp
+   
+    >>> Feel free to remove unused stuff or add more! <<<
+
+Main idea: simplify test code by wrapping each testing "context" in one
+class which contains:
+  - prfw client
+  - prfw context (not the same as testing "context")
+  - the plugin instance
+  - event listener
+  - messenger (see below)
+  - etc.
+
+For example usage see:
+  t_sessionmng
+  pr_prfwtestprotocol
+
+Mini how-to:
+
+1. Create wrappers with wrapper manager using CreateWrapperL call.
+
+2. Then access the wrappers using GetWrapper( TInt aIndex ). The caller is
+responsible for keeping note of which index is used for what (e.g. in
+the case of two connections).
+
+3. Wrapper has methods BindL and UnbindL if you just want to get the
+   connection up:
+
+   Somewhere, e.g. Setup method:
+
+    iWrapperMgr = CPrFwTestContextWrapperMgr::NewL();
+    iWrapperMgr->CreateWrapperL();
+   
+   Bind:
+
+    CPrFwTestContextWrapper* wrapper0 = iWrapperMgr->GetWrapperL( 0 );
+    wrapper0->BindL( 0 );
+
+    // now you are "connected to network" (=faked by test plugin)
+
+   Unbind:
+    
+    CPrFwTestContextWrapper* wrapper0 = iWrapperMgr->GetWrapperL( 0 );
+    wrapper0->UnbindL();
+
+    // now you are no longer connected. 
+
+   Destructor:
+     
+    delete iWrapperMgr; 
+
+4. You can access messenger class etc. using the various Get* methods.
+
+    IMPORT_C MXIMPContext* GetContext();
+    IMPORT_C CPrFwTestStatusEventListener* GetEventListener();
+    IMPORT_C CPrFwTestMessenger* GetMessenger();
+    IMPORT_C MXIMPClient* GetClient();
+    IMPORT_C RArray<TPrFwTestStatusEventSnapshot>* GetStatusTraits();
+
+5. Other convenience methods are also provided, please see t_sessionmng
+   for illustrative code. The below method tests the bind with wait.
+   The Assert* methods are used to check if test protocol plugin was
+   correctly called.
+
+Setup:
+
+    iWrapperMgr = CPrFwTestContextWrapperMgr::NewL();
+    iWrapperMgr->CreateWrapperL();
+
+Teardown:
+
+    delete iWrapperMgr;
+
+void T_SessionMng::T_Simple_Bind_Wait_Unbind_L()
+    {
+    EUNIT_PRINT( _L("Simple context Bind/Unbind test.") );
+    EUNIT_PRINT( _L("Client side waits bind completion before issuing unbind.") );
+
+    CPrFwTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    MXIMPContext* context = wrapper->GetContext();
+    CPrFwTestStatusEventListener* eventListener = wrapper->GetEventListener();
+    CPrFwTestMessenger* messenger = wrapper->GetMessenger();
+    
+    //Do bind, wait and verify events
+    wrapper->SetupListenerL( EPrFwTestStatusEvents_BindingOk );
+    messenger->SetNoError(); 
+
+    messenger->SetPluginIndex( 0 );
+    TUid protocol = { 0x1100ff55 };
+    TXIMPRequestId reqId = context->BindToL( 
+            protocol,
+            _L("www.imps.no/wv"),
+            _L("user"),
+            _L("password"),
+            1 );
+
+    wrapper->WaitRequestAndStackEvents( reqId );
+    wrapper->VerifyEventStackL( _L8("Binding single context: ") );
+
+    AssertOpenSession( 0 );
+
+    //Verify features availability
+    MXIMPFeatureInfo* ctxFeats = context->GetContextFeaturesLC();
+    EUNIT_ASSERT_DESC( ctxFeats->FeatureIds().MdcaCount() > 0, "No features from context" );
+    CleanupStack::PopAndDestroy(); //ctxFeats
+
+    //Do unbind, wait and verify events
+    wrapper->SetupListenerL( EPrFwTestStatusEvents_UnbindingOk );
+    messenger->SetNoError();
+    reqId = context->UnbindL();
+
+    wrapper->WaitRequestAndStackEvents( reqId );
+    wrapper->VerifyEventStackL( _L8("Unbinding single context: ") );
+
+    AssertCloseSession( 0 );
+    AssertPluginDied( 0 );
+    }
+
+The Assert* methods can be found from t_sessionmng (they should be moved
+elsewhere). See below for messenger functionality.
+
+-----------------------------------------------------------------------
+***************************************************
+* HOW TO USE THE TEST CASE - PLUGIN COMMUNICATION *
+***************************************************
+
+Relevant files:
+testcaseutils/prfwtestmessaging.h    - Keys, value enumerations etc.
+testcaseutils/prfwtestmessenger.h    - Messenger header (READ THIS)
+testcaseutils/prfwtestmessenger.cpp  - Messenger implementation
+ 
+    >>> Feel free to remove unused stuff or add more! <<<
+
+For example usage see:
+  t_sessionmng
+  t_presencemng
+  pr_prfwtestprotocol
+
+The idea is:
+  - there's publish & subscribe facility to send messages from
+    test code to plugin
+  - test protocol reads the message and changes its behaviour
+    accordingly, e.g. doing a leave on next HandleRequestCompleted
+
+More details:
+
+(prfwtestmessaging.h)
+
+* TPrFwTestPropertyKeys determines the keys.
+  You can add more messages here.
+
+* TPrFwTestPropertyValues determines certain pre-defined values,
+  e.g. EPrFwPrtValSessionLostReconnect (which is used to cause the
+  plugin to signal a "session lost, try to reconnect" to the 
+  Presence Framework.
+
+* TPrFwTestMsg is the protocol message. It consists of the key specifier
+  and the value to be set. Currently only integer parameters are
+  supported.
+
+* Each CPrFwTestMessenger takes an index into the constructor. This is
+  needed to create a two-way communications channel from the test case
+  to plugin and vice versa.
+
+* Creation of messenger is handled by the wrapper (which is created via
+  wrapper manager).
+
+* MINIMAL USAGE:
+ 
+  * To set "happy path", no errors will be artificially caused:
+    SetNoError()
+
+  * To make next operation fail with some error code: 
+    SetError( TInt aErrorCOde )
+
+  * To make next operation leave:
+    SetLeave( TInt aLeaveCode )
+
+  * Call HandleLeaveL in the test protocol plugin to automatically
+    leave, if leave was requested. (So you don't have to do 
+    "GetValueFor.. if (leave){User::Leave..")
+
+  * To set a boolean-valued (1 or 0) key, use SetBoolean. Read with
+    GetBoolean. These are used to signal the calling of some method,
+    and to read whether the method was called or not.
+
+  * For generic stuff use SetValueFor and GetValueFor.
+
+NOTES:
+
+If you add more keys, BE SURE TO RESET THEM IN THE MESSENGER
+CONSTRUCTION. 
+
+If you use multiple messengers, use different indexes!!!
+
+Please see t_sessionmng and t_presencemng for details.
+
+-----------------------------------------------------------------------
+********************************************
+* HOW TO USE THE EVENT LISTENER CLASS      *
+********************************************
+
+There are 2 event listener classes implemented:
+CPrFwTestListener
+CPrFwTestStatusEventListener
+
+The context wrapper has support for the CPrFwTestStatusEventListener.
+See the description there.
+
+CPrFwTestListener is the one which is more commonly used in the test cases.
+This listener supports creating exact events to be accepted by the test case,
+including the data inside the events, so use this class to verify the data.
+The event with the expected data can be send to the test protocol using
+the filetool, see below.
+
+The usage of the listener is fairly simple:
+
+    // create the listener since not created by the wrapper
+    CPrFwTestListener* listener2 = CPrFwTestListener::NewL( context );
+    CleanupStack::PushL( listener2 );
+
+    // initialize it to accept new events
+    listener2->Reset();
+
+    // create the event which is expected, here the RequestCompleteEvent
+    // RequestID is not checked in the assertion! 
+    TXIMPRequestId reqIdDummy;
+    CXIMPRequestCompleteEventImp* evReqComplete =
+                    CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+                    
+    // add the created event to the listener, ownership is transfered
+    listener2->ExpectL( evReqComplete );
+    CleanupStack::Pop( evReqComplete );
+
+    // call the desired XIMPFW method 
+    TXIMPRequestId reqId = presPub->SubscribePresenceWatcherListL();
+
+    // Wait for events on the request
+    // Assertion is done based on the content on the event by comparing
+    // the received event with the expected one.
+    EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Subscribe failed" );
+    
+    // clean it up
+    CleanupStack::PopAndDestroy( listener2 );
+
+-----------------------------------------------------------------------
+********************************************
+* HOW TO USE THE PSEUDO-IPC FILETOOL CLASS *
+********************************************
+
+The FileTool writes given serialized objects to a directory. It can also
+internalize them. Thus with FileTool you can check whether the presence
+data you put into the framework goes through OK.
+
+Server could also be used, and in a perfect world such a thing would
+have been written with big smiles, but in reality it would take much
+much longer to create and debug than this kind of FileTool, so here's
+FileTool!
+
+Relevant files:
+testcaseutils/prfwtestfiletool.h
+testcaseutils/prfwtestfiletool.cpp
+
+As of now, the FileTool is not yet integrated to any tests.
+
+FileTool API:
+
+Let's say you choose to use index 0. If you have two connections or
+such, then you would create two FileTools with indexes 0 and 1,
+respectively.
+
+Wipe old stuff away, destroy the directory, etc.:
+  - CleanL( 0 )
+
+Create the new directory:
+  - PrepareL( 0 ) 
+
+Store an object:
+  - StoreL( 0, externalizedObjectAsTDesC8 )
+
+Get number of objects stored:
+  - numObjects = NumObjectsL( 0 )
+
+Restore an object:
+  - i is a looping from 0..NumObjectsL( 0 )-1.
+  - CXIMPApiEventBase* restored = RestoreLC( 0, i );
+  - For example in this way you can check the whole directory.
+
+After the object is restored, compare in test code side to that which it
+SHOULD HAVE been.
+
+-----------------------------------------------------------------------
+********************************************
+* HOW TO USE THE "ROBUSTNESS HELPERS"      *
+********************************************
+
+It's good to kill the servers and removing all temporary FileTool files
+when starting a test case. This ensures that there are no unexpected
+messages, events or state lingering in the server.
+
+1. Add to MMP file:
+
+  #include "..\..\tsrcutils\processmaster\pm.h"
+
+If your stuff is not in internal\tsrc, then view the pm.h contents and
+adapt it.
+
+2. Add to test case:
+
+  #include "prfwtestrobustnesstools.h"
+
+3. Add to test case SetupL as the first line:
+
+  PrfwTestRobustness::DoPreCleaning();
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/group/bld.inf	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  Build information file for test dlls and related helpers
+*
+*/
+
+
+// tsrc utils, including test mover
+//#include "../tsrcutils/bld.inf"
+
+// Test protocols
+//#include "../tsrcprotocols/bld.inf"
+
+// Module release tests
+//#include "../src/t_rootservices/bld.inf"
+//#include "../src/t_sessionmng/bld.inf"
+//#include "../src/t_presencepublishing/bld.inf"
+//#include "../src/t_presencewatching/bld.inf"
+//#include "../src/t_presencegrouplistmngt/bld.inf"
+//#include "../src/t_presencegroupmembermngt/bld.inf"
+//#include "../src/t_presencewatcherlistmngt/bld.inf"
+//#include "../src/t_presencegrantrequestmngt/bld.inf"
+//#include "../src/t_presenceauthorization/bld.inf"
+//#"../src/t_presenceblocking/bld.inf"
+//#include "../src/t_utils/bld.inf"
+//#include "../src/t_presenceall/bld.inf"
+
+PRJ_TESTMMPFILES
+../tsrcutils/testcaseutils/prfwtestcaseutils.mmp
+../tsrcutils/processmaster/prfwtestprocessmaster.mmp
+../tsrcprotocols/pr_prfwtestprotocol/pr_prfwtestprotocol.mmp
+../src/t_rootservices/t_rootservices.mmp
+../src/t_sessionmng/t_sessionmng.mmp
+../src/t_presencepublishing/t_presencepublishing.mmp
+../src/t_presencewatching/t_presencewatching.mmp
+../src/t_presencegrouplistmngt/t_presencegrouplistmngt.mmp
+../src/t_presencegroupmembermngt/t_presencegroupmembermngt.mmp
+../src/t_presencewatcherlistmngt/t_presencewatcherlistmngt.mmp
+../src/t_presencegrantrequestmngt/t_presencegrantrequestmngt.mmp
+../src/t_presenceauthorization/t_presenceauthorization.mmp
+../src/t_presenceblocking/t_presenceblocking.mmp
+../src/t_utils/t_utils.mmp
+../src/t_presenceall/t_presenceall.mmp
+
+// Export the .iby for module release tests
+PRJ_TESTEXPORTS
+ximpfwmrt.iby  /epoc32/rom/include/ximpfwmrt.iby
+#ifdef WINSCW_UDEB
+GNUMAKEFILE test_mover.make
+#endif 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/group/ximpfw_release_tests.pkg	Wed Nov 03 09:32:20 2010 +0530
@@ -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:
+;
+;Header
+#{"XIMPFW ReleaseTests"}, (0x10282DE4), 1, 0, 0
+
+;Language
+&EN
+
+;Localised VendorID
+%{"Nokia"}
+
+;VendorID
+:"Nokia"
+
+
+;Supports Series 60 v 0.9
+(0x101F6F88), 0, 0, 0,
+{"Series60ProductID"}
+
+
+;Needed test protocols and test helpers
+"\EPOC32\RELEASE\ARMV5\UREL\pr_prfwtestprotocol.dll" - "!:\sys\bin\pr_prfwtestprotocol.dll"
+"\EPOC32\DATA\Z\Resource\Plugins\pr_prfwtestprotocol.RSC"-"!:\resource\plugins\pr_prfwtestprotocol.rsc"
+"\EPOC32\RELEASE\ARMV5\UREL\prfwtestcaseutils.dll" - "!:\sys\bin\prfwtestcaseutils.dll"
+
+
+;EUnit test dlls
+"\EPOC32\RELEASE\ARMV5\UREL\t_presenceall.dll" - "!:\sys\bin\t_presenceall.dll"
+"\EPOC32\RELEASE\ARMV5\UREL\t_rootservices.dll" - "!:\sys\bin\t_rootservices.dll"
+"\EPOC32\RELEASE\ARMV5\UREL\t_sessionmng.dll" - "!:\sys\bin\t_sessionmng.dll"
+"\EPOC32\RELEASE\ARMV5\UREL\t_presencepublishing.dll" - "!:\sys\bin\t_presencepublishing.dll"
+"\EPOC32\RELEASE\ARMV5\UREL\t_presencewatching.dll" - "!:\sys\bin\t_presencewatching.dll"
+"\EPOC32\RELEASE\ARMV5\UREL\t_presencegrouplistmngt.dll" - "!:\sys\bin\t_presencegrouplistmngt.dll"
+"\EPOC32\RELEASE\ARMV5\UREL\t_presencegroupmembermngt.dll" - "!:\sys\bin\t_presencegroupmembermngt.dll"
+"\EPOC32\RELEASE\ARMV5\UREL\t_presencewatcherlistmngt.dll" - "!:\sys\bin\t_presencewatcherlistmngt.dll"
+"\EPOC32\RELEASE\ARMV5\UREL\t_presencegrantrequestmngt.dll" - "!:\sys\bin\t_presencegrantrequestmngt.dll"
+"\EPOC32\RELEASE\ARMV5\UREL\t_presenceauthorization.dll" - "!:\sys\bin\t_presenceauthorization.dll"
+"\EPOC32\RELEASE\ARMV5\UREL\t_presenceblocking.dll" - "!:\sys\bin\t_presenceblocking.dll"
+"\EPOC32\RELEASE\ARMV5\UREL\t_utils.dll" - "!:\sys\bin\t_utils.dll"
+
+;ProcessMaster
+"\EPOC32\RELEASE\ARMV5\UREL\prfwtestprocessmaster.exe" - "!:\sys\bin\prfwtestprocessmaster.exe"
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/group/ximpfwmrt.iby	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  Image description file for module release tests
+*
+*/
+
+#ifndef __prfwmrt_iby__
+#define __prfwmrt_iby__
+
+#include <bldvariant.hrh>
+
+// Test protocol (ECOM plugin)
+ECOM_PLUGIN( pr_prfwtestprotocol.dll, pr_prfwtestprotocol.rsc )
+
+// Test utils and helpers
+file=ABI_DIR\BUILD_DIR\prfwtestcaseutils.dll    SHARED_LIB_DIR\prfwtestcaseutils.dll
+
+// Test dlls
+file=ABI_DIR\BUILD_DIR\t_presenceall.dll                SHARED_LIB_DIR\t_presenceall.dll
+file=ABI_DIR\BUILD_DIR\t_rootservices.dll               SHARED_LIB_DIR\t_rootservices.dll
+file=ABI_DIR\BUILD_DIR\t_sessionmng.dll                 SHARED_LIB_DIR\t_sessionmng.dll
+file=ABI_DIR\BUILD_DIR\t_presencepublishing.dll         SHARED_LIB_DIR\t_presencepublishing.dll
+file=ABI_DIR\BUILD_DIR\t_presencewatching.dll           SHARED_LIB_DIR\t_presencewatching.dll
+file=ABI_DIR\BUILD_DIR\t_presencegrouplistmngt.dll      SHARED_LIB_DIR\t_presencegrouplistmngt.dll
+file=ABI_DIR\BUILD_DIR\t_presencegroupmembermngt.dll    SHARED_LIB_DIR\t_presencegroupmembermngt.dll
+file=ABI_DIR\BUILD_DIR\t_presencewatcherlistmngt.dll    SHARED_LIB_DIR\t_presencewatcherlistmngt.dll
+file=ABI_DIR\BUILD_DIR\t_presenceauthorization.dll      SHARED_LIB_DIR\t_presenceauthorization.dll
+file=ABI_DIR\BUILD_DIR\t_presenceblocking.dll           SHARED_LIB_DIR\t_presenceblocking.dll
+file=ABI_DIR\BUILD_DIR\t_utils.dll                      SHARED_LIB_DIR\t_utils.dll
+file=ABI_DIR\BUILD_DIR\t_presencegrantrequestmngt.dll              SHARED_LIB_DIR\t_presencegrantrequestmngt.dll
+
+//ProcessMaster
+file=ABI_DIR\BUILD_DIR\prfwtestprocessmaster.exe        SHARED_LIB_DIR\prfwtestprocessmaster.exe
+
+#endif //__prfwmrt_iby__
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/init/ximpfw_install.pkg	Wed Nov 03 09:32:20 2010 +0530
@@ -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:
+;
+;Language
+&EN
+
+;Header
+#{"XIMPFramework"}, (0x10282DDC), 1, 0, 0, TYPE=SA
+
+
+;Localised VendorID
+%{"Nokia"}
+
+;VendorID
+:"Nokia"
+
+(0x101F7961), 0, 0, 0, {"Series60ProductID"}
+
+
+;binaries
+"\EPOC32\RELEASE\ARMV5\UDEB\ximpdatamodel.dll"-"!:\sys\bin\ximpdatamodel.dll"
+"\EPOC32\RELEASE\ARMV5\UDEB\ximpoperations.dll"-"!:\sys\bin\ximpoperations.dll"
+"\EPOC32\RELEASE\ARMV5\UDEB\ximpprocessor.dll"-"!:\sys\bin\ximpprocessor.dll"
+"\EPOC32\RELEASE\ARMV5\UDEB\ximpserver.exe"-"!:\sys\bin\ximpserver.exe"
+"\EPOC32\RELEASE\ARMV5\UDEB\ximprootserver.exe"-"!:\sys\bin\ximprootserver.exe"
+"\EPOC32\RELEASE\ARMV5\UDEB\ximpsrvclient.dll"-"!:\sys\bin\ximpsrvclient.dll"
+"\EPOC32\RELEASE\ARMV5\UDEB\ximpmanager.dll"-"!:\sys\bin\ximpmanager.dll"
+"\EPOC32\RELEASE\ARMV5\UDEB\ximpecomhook.dll"-"!:\sys\bin\ximpecomhook.dll"
+"\EPOC32\RELEASE\ARMV5\UDEB\ximputils.dll"-"!:\sys\bin\ximputils.dll"
+"\EPOC32\RELEASE\ARMV5\UDEB\presencemanager.dll"-"!:\sys\bin\presencemanager.dll"
+"\EPOC32\RELEASE\ARMV5\UDEB\presencedatamodel.dll"-"!:\sys\bin\presencedatamodel.dll"
+"\EPOC32\RELEASE\ARMV5\UDEB\presenceoperation.dll"-"!:\sys\bin\presenceoperation.dll"
+"\EPOC32\RELEASE\ARMV5\UDEB\presencedatamodelhook.dll"-"!:\sys\bin\presencedatamodelhook.dll"
+"\EPOC32\RELEASE\ARMV5\UDEB\presenceecomhook.dll"-"!:\sys\bin\presenceecomhook.dll"
+"\EPOC32\RELEASE\ARMV5\UDEB\presencecacheclient.dll"-"!:\sys\bin\presencecacheclient.dll"
+"\EPOC32\RELEASE\ARMV5\UDEB\presencecacheecomhook.dll"-"!:\sys\bin\presencecacheecomhook.dll"
+"\EPOC32\RELEASE\ARMV5\UDEB\presencecacheserver.exe"-"!:\sys\bin\presencecacheserver.exe"
+"\EPOC32\RELEASE\ARMV5\UDEB\immanager.dll"-"!:\sys\bin\immanager.dll"
+"\EPOC32\RELEASE\ARMV5\UDEB\imdatamodel.dll"-"!:\sys\bin\imdatamodel.dll"
+"\EPOC32\RELEASE\ARMV5\UDEB\imoperation.dll"-"!:\sys\bin\imoperation.dll"
+"\EPOC32\RELEASE\ARMV5\UDEB\imdatamodelhook.dll"-"!:\sys\bin\imdatamodelhook.dll"
+"\EPOC32\RELEASE\ARMV5\UDEB\imecomhook.dll"-"!:\sys\bin\imecomhook.dll"
+
+;resources
+"\EPOC32\DATA\Z\Resource\Plugins\ximpecomhook.RSC"-"!:\resource\plugins\ximpecomhook.rsc"
+"\EPOC32\DATA\Z\Resource\Plugins\presenceecomhook.RSC"-"!:\resource\plugins\presenceecomhook.rsc"
+"\EPOC32\DATA\Z\Resource\Plugins\presencedatamodelhook.RSC"-"!:\resource\plugins\presencedatamodelhook.rsc"
+"\EPOC32\DATA\Z\Resource\Plugins\presencecacheecomhook.RSC"-"!:\resource\plugins\presencecacheecomhook.rsc"
+"\EPOC32\DATA\Z\Resource\Plugins\imecomhook.RSC"-"!:\resource\plugins\imecomhook.rsc"
+"\EPOC32\DATA\Z\Resource\Plugins\imdatamodelhook.RSC"-"!:\resource\plugins\imdatamodelhook.rsc"
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/init/ximpfw_upgrade.pkg	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,75 @@
+;
+; 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:
+;
+;
+; Package file for presencefw SIS stub in ROM
+; and a ximp framework upgrade SIS.
+; Including the stub in ROM enables components
+; defined in stub to be updated by SIS installer.
+; When adding or removing components from presencefw
+; please update this pkg file and create an updated
+; stub to group directory.
+;
+; To create SIS stub: makesis -s ximpfw_upgrade.pkg ximpfwstub.sis
+; Copy ximpfwstub.sis to z:\system\install\ximpfwstub.sis
+; or use abld export to export it automatically.
+;
+
+;Language
+&EN
+
+;Header
+#{"PresenceFramework"}, (0x10282DDC), 1, 0, 0, TYPE=PU
+
+
+;Localised VendorID
+%{"Nokia"}
+
+;VendorID
+:"Nokia"
+
+(0x101F7961), 0, 0, 0, {"Series60ProductID"}
+
+
+;binaries
+"\EPOC32\RELEASE\ARMV5\UREL\ximpdatamodel.dll"-"z:\sys\bin\ximpdatamodel.dll"
+"\EPOC32\RELEASE\ARMV5\UREL\ximpoperations.dll"-"z:\sys\bin\ximpoperations.dll"
+"\EPOC32\RELEASE\ARMV5\UREL\ximpprocessor.dll"-"z:\sys\bin\ximpprocessor.dll"
+"\EPOC32\RELEASE\ARMV5\UREL\ximpserver.exe"-"z:\sys\bin\ximpserver.exe"
+"\EPOC32\RELEASE\ARMV5\UREL\ximprootserver.exe"-"z:\sys\bin\ximprootserver.exe"
+"\EPOC32\RELEASE\ARMV5\UREL\ximpsrvclient.dll"-"z:\sys\bin\ximpsrvclient.dll"
+"\EPOC32\RELEASE\ARMV5\UREL\ximpmanager.dll"-"z:\sys\bin\ximpmanager.dll"
+"\EPOC32\RELEASE\ARMV5\UREL\ximpecomhook.dll"-"z:\sys\bin\ximpecomhook.dll"
+"\EPOC32\RELEASE\ARMV5\UREL\ximputils.dll"-"z:\sys\bin\ximputils.dll"
+"\EPOC32\RELEASE\ARMV5\UREL\presencemanager.dll"-"z:\sys\bin\presencemanager.dll"
+"\EPOC32\RELEASE\ARMV5\UREL\presencedatamodel.dll"-"z:\sys\bin\presencedatamodel.dll"
+"\EPOC32\RELEASE\ARMV5\UREL\presenceoperation.dll"-"z:\sys\bin\presenceoperation.dll"
+"\EPOC32\RELEASE\ARMV5\UREL\presencecacheclient.dll"-"z:\sys\bin\presencecacheclient.dll"
+"\EPOC32\RELEASE\ARMV5\UREL\presencecacheecomhook.dll"-"z:\sys\bin\presencecacheecomhook.dll"
+"\EPOC32\RELEASE\ARMV5\UREL\presencecacheserver.exe"-"z:\sys\bin\presencecacheserver.exe"
+"\EPOC32\RELEASE\ARMV5\UREL\immanager.dll"-"z:\sys\bin\immanager.dll"
+"\EPOC32\RELEASE\ARMV5\UREL\imdatamodel.dll"-"z:\sys\bin\imdatamodel.dll"
+"\EPOC32\RELEASE\ARMV5\UREL\imoperation.dll"-"z:\sys\bin\imoperation.dll"
+"\EPOC32\RELEASE\ARMV5\UREL\imdatamodelhook.dll"-"z:\sys\bin\imdatamodelhook.dll"
+"\EPOC32\RELEASE\ARMV5\UREL\imecomhook.dll"-"z:\sys\bin\imecomhook.dll"
+
+;resources
+"\EPOC32\DATA\z\Resource\Plugins\ximpecomhook.RSC"-"z:\resource\plugins\ximpecomhook.rsc"
+"\EPOC32\DATA\z\Resource\Plugins\presenceecomhook.RSC"-"z:\resource\plugins\presenceecomhook.rsc"
+"\EPOC32\DATA\z\Resource\Plugins\presencedatamodelhook.RSC"-"z:\resource\plugins\presencedatamodelhook.rsc"
+"\EPOC32\DATA\z\Resource\Plugins\presencecacheecomhook.RSC"-"z:\resource\plugins\presencecacheecomhook.rsc"
+"\EPOC32\DATA\z\Resource\Plugins\imecomhook.RSC"-"z:\resource\plugins\imecomhook.rsc"
+"\EPOC32\DATA\z\Resource\Plugins\imdatamodelhook.RSC"-"z:\resource\plugins\imdatamodelhook.rsc"
+
Binary file imsrv_plat/ximp_core_feature_plugin_api/tsrc/sis/Nokia_RnDCert_02.der has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/sis/Nokia_RnDCert_02.key	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,15 @@
+-----BEGIN RSA PRIVATE KEY-----
+MIICXQIBAAKBgQC/TDP7KKIaf5+uW4OD2iVZuUMC2a+SeQTjf6srlKcOm+CpPNXn
+uLNm/8fdEnyOIuRXPRKmqhs1n0JkxEGHynELWMTuKXbQx9SRAGUXzyneGn+IJNnO
+vOKHWgKCouX2hfI8rtkdqJpqmO460gGsMgw+lsbeyWyW9lnfLxq+ZC7sqQIDAQAB
+AoGBALmUWZE8GBaQ3P4u9WUCSd3DJkkrmXIFSULSZeH/chlwCwDjbbhArHothVzo
+REE3hEFFlERvHbplZ+mNouzy7boduvgUzbksGrbGMLJ2qO1GzWWVwV+GzOWKd3ss
+/98Gwoy5R8pjnkqUE2wP1iJFw0FjvUTKcYv/z6t3LLJ0CsoBAkEA+c7ixvsviQ3J
+s0INytCKU2bf8fqFQJi1VI82ukxNsujGTQ9upVSjuvqPvWyDvvTdrUBHqO+3qPut
+sEh01Q8aiQJBAMQKDJPVRu4ud3mwUfEavzL5EjqwG1k9VCNGYsT4FwtrHcxu1oP/
+pk6M3rIZukqomoEEnHWPMwhrK3fhBqi0OSECQQDr40VXege4FnH5OI2Hj4afHMyp
+VdQQXGMWFyopnzXblFz0lXb43cTCIiorR9XcMqNFHybLypkWE5o+lRzlt55pAkBQ
+P/zeF5Sts//cpL0mgdh7OVKpC6ZmZaCnwAx2rUhhuDu+kDDoYCLoTOps5fNI1LRK
+1GRoC3LMo3Jr5IYhUYWBAkBpCpN6k4JU/mszq98EojHerQNxk8sPqvQKUzTutohT
+1gLX9yepGayB/TtT2EEJDkWOlnTy/dvN6W3vzbJYz97x
+-----END RSA PRIVATE KEY-----
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/sis/ximpfw_release_tests.pkg	Wed Nov 03 09:32:20 2010 +0530
@@ -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: XIMP Framewor Test code Package File
+;
+;Header
+#{"XIMPFW ReleaseTests"}, (0x10282DE4), 1, 0, 0
+
+;Language
+&EN
+
+;Localised VendorID
+%{"Nokia"}
+
+;VendorID
+:"Nokia"
+
+
+;Supports Series 60 v 0.9
+(0x101F6F88), 0, 0, 0,
+{"Series60ProductID"}
+
+
+;Needed test protocols and test helpers
+"\EPOC32\RELEASE\ARMV5\UREL\pr_prfwtestprotocol.dll" - "!:\sys\bin\pr_prfwtestprotocol.dll"
+"\EPOC32\DATA\Z\Resource\Plugins\pr_prfwtestprotocol.RSC"-"!:\resource\plugins\pr_prfwtestprotocol.rsc"
+"\EPOC32\RELEASE\ARMV5\UREL\prfwtestcaseutils.dll" - "!:\sys\bin\prfwtestcaseutils.dll"
+
+
+;EUnit test dlls
+;"\EPOC32\RELEASE\ARMV5\UREL\t_presenceall.dll" - "!:\sys\bin\t_presenceall.dll"
+"\EPOC32\RELEASE\ARMV5\UREL\t_rootservices.dll" - "!:\sys\bin\t_rootservices.dll"
+"\EPOC32\RELEASE\ARMV5\UREL\t_sessionmng.dll" - "!:\sys\bin\t_sessionmng.dll"
+"\EPOC32\RELEASE\ARMV5\UREL\t_presencepublishing.dll" - "!:\sys\bin\t_presencepublishing.dll"
+"\EPOC32\RELEASE\ARMV5\UREL\t_presencewatching.dll" - "!:\sys\bin\t_presencewatching.dll"
+"\EPOC32\RELEASE\ARMV5\UREL\t_presencegrouplistmngt.dll" - "!:\sys\bin\t_presencegrouplistmngt.dll"
+"\EPOC32\RELEASE\ARMV5\UREL\t_presencegroupmembermngt.dll" - "!:\sys\bin\t_presencegroupmembermngt.dll"
+"\EPOC32\RELEASE\ARMV5\UREL\t_presencewatcherlistmngt.dll" - "!:\sys\bin\t_presencewatcherlistmngt.dll"
+"\EPOC32\RELEASE\ARMV5\UREL\t_presencegrantrequestmngt.dll" - "!:\sys\bin\t_presencegrantrequestmngt.dll"
+"\EPOC32\RELEASE\ARMV5\UREL\t_presenceauthorization.dll" - "!:\sys\bin\t_presenceauthorization.dll"
+"\EPOC32\RELEASE\ARMV5\UREL\t_presenceblocking.dll" - "!:\sys\bin\t_presenceblocking.dll"
+"\EPOC32\RELEASE\ARMV5\UREL\t_utils.dll" - "!:\sys\bin\t_utils.dll"
+
+;ProcessMaster
+"\EPOC32\RELEASE\ARMV5\UREL\prfwtestprocessmaster.exe" - "!:\sys\bin\prfwtestprocessmaster.exe"
+
Binary file imsrv_plat/ximp_core_feature_plugin_api/tsrc/sis/ximpfw_release_tests.sis has changed
Binary file imsrv_plat/ximp_core_feature_plugin_api/tsrc/sis/ximpfw_release_tests.sisx has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_eunittemplate/bld.inf	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,22 @@
+/*
+* 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 T_EunitTemplate test dll.
+*
+*/
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_TESTMMPFILES
+t_eunittemplate.mmp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_eunittemplate/t_eunittemplate.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -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:
+*
+*/
+
+#include "t_eunittemplate.h"
+#include "eunittools.h"
+#include <eunitmacros.h>
+
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// CONSTRUCTION
+T_EunitTemplate* T_EunitTemplate::NewL()
+    {
+    T_EunitTemplate* self = new( ELeave ) T_EunitTemplate;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+
+    return self;
+    }
+
+
+T_EunitTemplate::~T_EunitTemplate()
+    {
+    }
+
+
+void T_EunitTemplate::ConstructL()
+    {
+    CEUnitTestSuiteClass::ConstructL();
+    }
+
+
+T_EunitTemplate::T_EunitTemplate()
+    {
+    }
+
+
+
+// ===========================================================================
+// TEST CASE SETUP & TEARDOWN METHODS
+// ===========================================================================
+//
+void T_EunitTemplate::Setup_L()
+    {
+    }
+
+
+
+void T_EunitTemplate::Teardown()
+    {
+    }
+
+
+
+// ===========================================================================
+// TODO: Test case description & grouping
+// ===========================================================================
+//
+void T_EunitTemplate::TestSomething_L()
+    {
+    EUNIT_ASSERT( EFalse );
+    }
+
+
+
+
+// ===========================================================================
+// TEST CASE TABLE
+// ===========================================================================
+//
+EUNIT_BEGIN_TEST_TABLE(
+    T_EunitTemplate,
+    "Add test suite description here.",
+    "MODULE" )
+
+    PRFW_NOT_DECORATED_TEST(
+        "Empty test skeleton",
+        "Add tested class name here",
+        "Add tested function names here",
+        "FUNCTIONALITY ERRORHANDLING BOUNDARY",
+        Setup_L,
+        TestSomething_L,
+        Teardown )
+
+
+EUNIT_END_TEST_TABLE
+
+
+
+
+
+// ===========================================================================
+// TEST SUITE CONSTRUCTION
+// ===========================================================================
+//
+EXPORT_C MEUnitTest* CreateTestSuiteL()
+    {
+    return T_EunitTemplate::NewL();
+    }
+
+
+// end of file
+
+
+
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_eunittemplate/t_eunittemplate.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,96 @@
+/*
+* 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:
+*
+*/
+
+#ifndef T_EUNITTEMPLATE_H
+#define T_EUNITTEMPLATE_H
+
+#include <ceunittestsuiteclass.h>
+
+
+
+
+
+/**
+ * XIMP Framework Eunit tests.
+ *
+ * TODO: Add test description here.
+ *
+ * @since S60 v4.0
+ */
+class T_EunitTemplate : public CEUnitTestSuiteClass
+    {
+
+public:
+
+    /**  ?description */
+    //enum ?declaration
+
+    /**  ?description */
+    //typedef ?declaration
+
+    static T_EunitTemplate* NewL();
+    virtual ~T_EunitTemplate();
+
+private:
+
+    T_EunitTemplate();
+    void ConstructL();
+
+
+
+private:    // Test case functions
+
+    void Setup_L();
+    void Teardown();
+
+    void TestSomething_L();
+
+
+
+private:    // Test helpers
+
+
+
+
+
+private: // Test data
+
+
+    /**
+     * Eunit test case table declaration.
+     */
+    EUNIT_DECLARE_TEST_TABLE;
+
+
+    /**
+     *
+     * Own. / Not own.
+     */
+    //?type* ?member_name;
+
+    };
+
+
+#endif      //  T_EUNITTEMPLATE_H
+
+
+
+// end of file
+
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_eunittemplate/t_eunittemplate.mmp	Wed Nov 03 09:32:20 2010 +0530
@@ -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:
+*
+*/
+
+#include "../../tsrcutils/eunitcommon/eunittstdllbase.mmh"
+
+TARGET                  t_eunittemplate.dll
+CAPABILITY              ALL -TCB  
+
+
+SOURCEPATH              .
+SOURCE                  t_eunittemplate.cpp
+
+
+
+// Dependencies to system components
+//LIBRARY
+
+
+
+// end of file
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_presenceall/bld.inf	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,25 @@
+/*
+* 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 t_presenceall.dll
+*
+*/
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+PRJ_TESTMMPFILES
+t_presenceall.mmp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_presenceall/t_presenceall.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,1007 @@
+/*
+* 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:
+*
+*/
+
+
+#include "eunittools.h"
+
+
+#include <platform/digia/eunit/eunitmacros.h>
+#include <platform/digia/eunit/teunitassertioninfo.h>
+
+
+#include <ecom/ecom.h>
+#include <badesca.h>
+
+#include <ximpbase.h>
+#include <ximpclient.h>
+#include <ximpcontext.h>
+#include <ximpcontextstateevent.h>
+#include <ximprequestcompleteevent.h>
+#include <ximpstatus.h>
+#include <presencefeatures.h>
+#include <presencewatching.h>
+#include <presencepublishing.h>
+#include <presentitypresenceevent.h>
+#include <ximpobjectfactory.h>
+
+#include <presentitygroups.h>
+#include <presentitygroupinfo.h>
+#include <presentitygrouplistevent.h>
+
+
+#include <presentitygroups.h>
+#include <presentitygroupmemberinfo.h>
+#include <presentitygroupcontentevent.h>
+
+#include <presenceauthorization.h>
+#include <presenceblocklistevent.h>
+#include <presenceblockinfo.h>
+
+#include "t_presenceall.h"
+#include "prfwteststatuseventlistener.h"
+#include "prfwtestmessaging.h"
+#include "prfwtestmessenger.h"
+#include "prfwtestcontextwrappermgr.h"
+#include "prfwtestcontextwrapper.h"
+
+#include "presenceinfoimp.h"
+#include "presenceinfofilterimp.h"
+#include "prfwtestpresencedatautils.h"
+#include "ximpidentityimp.h"
+#include "presentitygroupmemberinfoimp.h"
+#include "ximpobjecthelpers.h"
+#include "prfwtestfilesrvmsg.h"
+#include "prfwtestwaithelper.h"
+#include "prfwtestlistener.h"
+
+
+#include "presentitygroupcontenteventimp.h"
+#include "ximprequestcompleteeventimp.h"
+#include "presentitygroupinfoimp.h"
+#include "presentitygrouplisteventimp.h"
+#include "presentitygroupmemberinfoimp.h"
+#include "ximprequestcompleteeventimp.h"
+#include "ximprestrictedobjectcollection.h"
+#include "ximpobjectfactoryimp.h"
+
+#include "prfwtesteventfactory.h"
+
+#include "prfwtestpresencedatautils.h"
+
+#include "ximpobjecthelpers.h"
+#include "presentitygroupinfoimp.h"
+#include "presentitygrouplisteventimp.h"
+#include "presentitygroupcontenteventimp.h"
+
+#include "prfwtestfiletool.h"
+
+
+#include "prfwtestrobustnesstools.h"
+
+_LIT8( KPrefix1, "PreA_" );
+_LIT8( KPrefix2, "PreB_" );
+_LIT8( KPrefix3, "PreC_" );
+_LIT8( KPrefix4, "PreD_" );
+
+_LIT( KPrefix5, "PreXX_" );
+_LIT( KPrefix6, "PreYY_" );
+
+_LIT( KIdentity, "TestId@hello.world" );
+
+
+_LIT( KMemberId1, "tel:user1@foo.bar" );
+_LIT( KMemberDisplayName1,  "user1" );
+
+_LIT( KMemberId2, "tel:user2@foo.bar" );
+_LIT( KMemberDisplayName2,  "user2" );
+
+_LIT( KGroupId, "PrsDemoGrp" );
+_LIT( KGroupDisplayName,  "demo group" );
+
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// CONSTRUCTION
+T_PresenceAll* T_PresenceAll::NewL()
+    {
+    T_PresenceAll* self = new( ELeave ) T_PresenceAll;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+
+    return self;
+    }
+
+
+T_PresenceAll::~T_PresenceAll()
+    {
+    }
+
+
+void T_PresenceAll::ConstructL()
+    {
+    CEUnitTestSuiteClass::ConstructL();
+    }
+
+
+T_PresenceAll::T_PresenceAll()
+    {
+    }
+
+
+
+// ===========================================================================
+// TEST CASE SETUP & TEARDOWN METHODS
+// ===========================================================================
+//
+
+void T_PresenceAll::Setup_L()
+    {
+    __UHEAP_MARK;
+    PrfwTestRobustness::DoPreCleaning();
+
+    iWrapperMgr = CXIMPTestContextWrapperMgr::NewL();
+    iWrapperMgr->CreateWrapperL();
+    }
+
+void T_PresenceAll::SetupMultiple_L()
+    {
+    PrfwTestRobustness::DoPreCleaning();
+
+    iWrapperMgr = CXIMPTestContextWrapperMgr::NewL();
+    iWrapperMgr->CreateWrapperL();
+    iWrapperMgr->CreateWrapperL();
+    iWrapperMgr->CreateWrapperL();
+    }
+
+
+void T_PresenceAll::BindL()
+    {
+    CXIMPTestContextWrapper* wrapper0 = iWrapperMgr->GetWrapperL( 0 );
+
+    wrapper0->BindL( 0 );
+    }
+
+void T_PresenceAll::BindAllL()
+    {
+    for( TInt a = 0; a < iWrapperMgr->WrapperCount(); ++a )
+        {
+        CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a );
+        wrapper->BindL( 0 );
+        }
+    }
+
+
+void T_PresenceAll::Teardown()
+    {
+    delete iWrapperMgr;
+    iWrapperMgr = NULL;
+
+    REComSession::FinalClose();
+
+    PrfwTestRobustness::DoPreCleaning();
+    User::SetJustInTime( ETrue );
+    __UHEAP_MARKEND;
+    }
+
+void T_PresenceAll::UnbindL()
+    {
+    // Do unbind
+    CXIMPTestContextWrapper* wrapper0 = iWrapperMgr->GetWrapperL( 0 );
+    wrapper0->UnbindL();
+    }
+
+void T_PresenceAll::UnbindAllL()
+    {
+    for( TInt a = 0; a < iWrapperMgr->WrapperCount(); ++a )
+        {
+        CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a );
+        wrapper->UnbindL();
+        }
+    }
+
+
+// ===========================================================================
+// TEST CASES for presentity presence subscription
+// ===========================================================================
+
+// Jani
+void T_PresenceAll::T_TMO_demo_Startup_L()
+    {
+    EUNIT_PRINT( _L("T_TMO_demo_Startup_L") );
+
+    BindL();
+
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    MXIMPContext* context = wrapper->GetContext();
+    CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+    // Tell the protocol it should act normally
+    messenger->SetNoError();
+    
+        
+    // Get the interfaces
+    MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+    MPresencePublishing& presPub = presFeat->PresencePublishing();
+    MPresenceAuthorization& presAuth = presFeat->PresenceAuthorization();
+    MPresentityGroups& presGroup = presFeat->PresentityGroups();
+    MPresenceWatching& presWatch = presFeat->PresenceWatching();
+    
+    
+    
+    //////////////////////////////////////////////////////////////////////////
+    // SUBSCRIBE OWN PRESENCE
+    //////////////////////////////////////////////////////////////////////////
+
+    // Create own presence info filter
+    CPresenceInfoFilterImp* ownPif = CPresenceInfoFilterImp::NewLC(); // << ownPif
+    ownPif->AcceptPersonFilterL( NPresenceInfo::NFieldType::KAcceptAll );
+    //ownPif->AcceptPersonFilterL( NPresenceInfo::NFieldType::KStatusMessage );
+    //ownPif->AcceptPersonFilterL( NPresenceInfo::NFieldType::KAvatar );
+
+    // Setup status event listener for RequestComplete
+    SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk );
+
+    // subscribe own presence
+    TXIMPRequestId reqId = presPub.SubscribeOwnPresenceL( *ownPif );
+    
+    // Wait for events on the request
+    wrapper->WaitRequestAndStackEvents( reqId );
+    wrapper->VerifyEventStackL( _L8("Subscribing own presence, complete with error: ") );
+
+    // verify that SubscribeOwnPresenceL was called
+    COMMONASSERT( messenger, EXIMPPlgTestSubscribeOwnPresenceCalled, "SubscribeOwnPresenceL was not called", ETrue, NULL );
+    
+    //////////////////////////////////////////////////////////////////////////
+    // SUBSCRIBE PRESENCE WATCHER LIST
+    //////////////////////////////////////////////////////////////////////////
+
+    // Setup status event listener for RequestComplete
+    SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk );
+
+    // subscribe
+    reqId = presPub.SubscribePresenceWatcherListL();
+    
+    // Wait for events on the request
+    wrapper->WaitRequestAndStackEvents( reqId );
+    wrapper->VerifyEventStackL( _L8("Subscribing presence watcher list, complete with error: ") );
+
+    COMMONASSERT( messenger, EXIMPPlgTestSubscribePresenceWatcherListCalled, "SubscribeWatcherListL was not called", ETrue, NULL );
+    
+
+    //////////////////////////////////////////////////////////////////////////
+    // SUBSCRIBE PRESENCE BLOCK LIST
+    //////////////////////////////////////////////////////////////////////////
+
+    // Setup status event listener for RequestComplete
+    SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk );
+
+    // subscribe
+    reqId = presAuth.SubscribePresenceBlockListL();
+    
+    // Wait for events on the request
+    wrapper->WaitRequestAndStackEvents( reqId );
+    wrapper->VerifyEventStackL( _L8("Subscribing presence watcher list, complete with error: ") );
+
+    // verify that SubscribeBlockListL was called
+    COMMONASSERT( messenger, EXIMPPlgTestSubscribePresenceBlockListCalled, "SubscribeBlockListL was not called", ETrue, NULL );
+    
+
+    
+    //////////////////////////////////////////////////////////////////////////
+    // SUBSCRIBE PRESENTITY GROUP LIST
+    //////////////////////////////////////////////////////////////////////////
+    
+    // Setup status event listener for RequestComplete
+    SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk );
+
+    // subscribe
+    reqId = presGroup.SubscribePresentityGroupListL();
+    
+    // Wait for events on the request
+    wrapper->WaitRequestAndStackEvents( reqId );
+    wrapper->VerifyEventStackL( _L8("Subscribing presentity group list, complete with error: ") );
+    
+    // verify that SubscribePresentityGroupListL was called
+    messenger->AssertSubscribePresentityGroupListCalled( ETrue );
+    
+    
+    //////////////////////////////////////////////////////////////////////////
+    // EMPTY GROUP LIST EVENT
+    /////////////////////////////////////////////////////////////////////////
+    // According to design, this should not be called
+    // because the group list is empty, this can be removed
+    // Create help listener
+
+/*    CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context );
+    CleanupStack::PushL( listener2 );    // << listener2    
+    
+    // Create faked server message about group list
+    SendSrvMsgL( CXIMPTestFileSrvMsg::ETestSrvMsgPresentityGroupList );
+
+    // expect empty MPresentityGroupList event.
+    CPresentityGroupListEventImp* event = XIMPTestEventFactory::CreateGroupListEventLCX(
+            KNullDesC, KNullDesC,
+            XIMPTestEventFactory::ETestPGLEmpty,
+            KNullDesC, KNullDesC,
+            MXIMPDataSubscriptionState::ESubscriptionActive,
+            MXIMPDataSubscriptionState::EDataAvailable
+            );
+
+    listener2->ExpectL( event );
+    CleanupStack::Pop( event ); // 4 more items in cleanupstack
+
+    EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "HandlePresentityGroupListL failed" );
+    CleanupStack::PopAndDestroy( 4 ); // lists
+    CleanupStack::PopAndDestroy( listener2 );   // >>> listener2
+
+*/        
+    //////////////////////////////////////////////////////////////////////////
+    // CREATE PRESENTITY GROUP
+    /////////////////////////////////////////////////////////////////////////
+    
+    // Setup status event listener for RequestComplete
+    // This will also produce HandlePresentityGroupListEvent, since the
+    // the group is subscribed
+    SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk );
+
+
+    MXIMPIdentity* groupId = context->ObjectFactory().NewIdentityLC();
+    CleanupStack::Pop(); // groupId
+    groupId->SetIdentityL( KGroupId );
+    
+    // subscribe
+    reqId = presGroup.CreatePresentityGroupL( *groupId, KGroupDisplayName );
+    
+    // Wait for events on the request
+    wrapper->WaitRequestAndStackEvents( reqId );
+    wrapper->VerifyEventStackL( _L8("CreatePresentityGroupL failed, complete with error: ") );
+    
+    // verify that SubscribePresentityGroupListL was called
+    messenger->AssertCreatePresentityGroupCalled( ETrue );
+
+    
+  
+    //////////////////////////////////////////////////////////////////////////
+    // ADD PRESENTITY GROUP MEMBER
+    ////////////////////////////////////////////////////////////////////////// 
+    
+    CXIMPTestListener* listener4 = CXIMPTestListener::NewL( context );
+    CleanupStack::PushL( listener4 );    // << listener4
+    
+    MXIMPIdentity* member = context->ObjectFactory().NewIdentityLC(); // << member
+    member->SetIdentityL( KMemberId1 );
+
+
+    // request complete
+    TXIMPRequestId reqIdDummy;
+    CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+
+    // group id
+    CXIMPIdentityImp* identity2 = CXIMPIdentityImp::NewLC( groupId->Identity() );
+    evReqComplete->AppendParamL( identity2 );
+    CleanupStack::Pop(identity2); // identity2
+
+    // id for member info
+    CXIMPIdentityImp* miId = CXIMPIdentityImp::NewLC( KMemberId1 );
+    if(*identity2 != *miId)
+        {
+        // nothing to do
+        }         
+    // member info
+    CPresentityGroupMemberInfoImp* memInfoImp =
+        CPresentityGroupMemberInfoImp::NewLC( *miId, KMemberDisplayName1 );
+    evReqComplete->AppendParamL( memInfoImp );
+    CleanupStack::Pop(memInfoImp); // memInfoImp owned by AppendParamL
+    CleanupStack::PopAndDestroy( miId ); // copy was made
+
+    listener4->ExpectL( evReqComplete );
+    CleanupStack::Pop( evReqComplete );
+
+    // do the call
+    reqId = presGroup.AddPresentityGroupMemberL(
+            *groupId, *member, KMemberDisplayName1 );
+
+    // and wait
+    EUNIT_ASSERT_DESC( KErrNone == listener4->WaitAndAssertL(), "AddPresentityGroupMemberL (not subscribed) failed" );
+
+    messenger->AssertAddPresentityGroupMemberCalled( ETrue );
+    CleanupStack::PopAndDestroy(); // >>> member
+    CleanupStack::PopAndDestroy( listener4 );// >>> listener4
+
+
+    //////////////////////////////////////////////////////////////////////////
+    // SUBSCRIBE PRESENTITY GROUP CONTENT
+    //////////////////////////////////////////////////////////////////////////    
+
+    // Setup status event listener for RequestComplete
+    SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk );
+    
+    // subscribe group content
+    MXIMPIdentity* identity = context->ObjectFactory().NewIdentityLC();
+    identity->SetIdentityL( KGroupId ); // << identity
+
+    reqId = presGroup.SubscribePresentityGroupContentL( *identity );
+    
+    // Wait for events on the request
+    wrapper->WaitRequestAndStackEvents( reqId );
+    wrapper->VerifyEventStackL( _L8("Subscribe presentity group content, complete with error: ") );
+
+    COMMONASSERT( messenger, EXIMPPlgTestSubscribePresentityGroupContentCalled, "SubscribeGroupContentL was not called", ETrue, NULL );
+    
+    //////////////////////////////////////////////////////////////////////////
+    // SUBSCRIBE PRESENTITY GROUP MEMBERS PRESENCE
+    ////////////////////////////////////////////////////////////////////////// 
+        
+    // Setup status event listener for RequestComplete
+    SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk );
+
+    // This is the group we are interested in
+    MXIMPIdentity* group = context->ObjectFactory().NewIdentityLC();
+    CleanupStack::Pop(); // group
+    group->SetIdentityL( KGroupId );
+    // Set filter for the group
+    //CPresenceInfoFilterImp* gpif = CPresenceInfoFilterImp::NewLC();
+    //gpif->AcceptPersonFilterL( NPresenceInfo::NFieldType::KStatusMessage  );
+    //gpif->AcceptPersonFilterL( NPresenceInfo::NFieldType::KAvatar );
+    
+    
+    
+    CPresenceInfoFilterImp* gpif =
+                XIMPTestPresenceDataUtils::GenerateInfoFilterLC( &KPrefix1 );
+    
+    CleanupStack::Pop(gpif); // gpif
+
+    // register interest
+    reqId = presWatch.SubscribePresentityGroupMembersPresenceL( *group, *gpif );
+
+    // Wait for events on the request
+    wrapper->WaitRequestAndStackEvents( reqId );
+    wrapper->VerifyEventStackL( _L8("Subscribe presentity group members, complete with error: ") );
+        
+    // verify that UpdateInterest was called
+    COMMONASSERT( messenger, EXIMPPlgTestSubscribePresentityGroupMembersPresesenceCalled, "SubscribePresentityGroupMembersPresenceL was not called", ETrue, NULL );
+
+    delete gpif;
+
+    
+    //////////////////////////////////////////////////////////////////////////
+    // ADD PRESENTITY GROUP MEMBER, GROUP CONTENT SUBSCRIBED
+    ////////////////////////////////////////////////////////////////////////// 
+    
+    // Setup status event listener for RequestComplete
+    // This will also produce HandlePresentityGroupMemberAddedL, since the
+    // the group is subscribed
+    SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk );
+    
+    MXIMPIdentity* member2 = context->ObjectFactory().NewIdentityLC(); // << member2
+    member2->SetIdentityL( KMemberId2 );
+
+    // do the call
+    reqId = presGroup.AddPresentityGroupMemberL(
+            *groupId, *member2, KMemberDisplayName2 );
+            
+    // Wait for events on the request
+    wrapper->WaitRequestAndStackEvents( reqId );
+    wrapper->VerifyEventStackL( _L8("AddPresentityGroupMemberL (subscribed) failed, complete with error: ") );
+
+
+    messenger->AssertAddPresentityGroupMemberCalled( ETrue );
+    CleanupStack::PopAndDestroy(); // >>> member2
+
+
+   
+    //////////////////////////////////////////////////////////////////////////
+    // GRANT PRESENTITY GROUP MEMBER
+    //////////////////////////////////////////////////////////////////////////
+
+    // This is the group we are interested in
+    MXIMPIdentity* ggroup = context->ObjectFactory().NewIdentityLC();
+    CleanupStack::Pop(); // ggroup
+    ggroup->SetIdentityL( KGroupId );
+    // Set filter for the group
+    CPresenceInfoFilterImp* ggpif = CPresenceInfoFilterImp::NewLC();
+    //ggpif->AcceptPersonFilterL( NPresenceInfo::NFieldType::KAcceptAll  );
+    CleanupStack::Pop(); // ggpif
+
+    // Setup status event listener for RequestComplete
+    SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk );
+
+    // grant for all
+    reqId = presAuth.GrantPresenceForPresentityGroupMembersL( *ggroup, *ggpif );
+
+    // Wait for events on the request
+    wrapper->WaitRequestAndStackEvents( reqId );
+    
+    // verify that UpdateInterest was called
+    COMMONASSERT( messenger, EXIMPPlgTestGrantPresenceForPresentityGroupMembersCalled, 
+        "GrantPresenceForPresentityGroupMembersL was not called", ETrue, NULL );
+        
+    delete ggpif;    
+
+
+    //////////////////////////////////////////////////////////////////////////
+    // WITHDRAW PRESENTITY GROUP MEMBER
+    //////////////////////////////////////////////////////////////////////////
+
+
+    // Setup status event listener for RequestComplete
+    SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk );
+
+    // withdraw from all
+    reqId = presAuth.WithdrawPresenceGrantFromPresentityGroupMembersL( *ggroup );
+
+    // Wait for events on the request
+    wrapper->WaitRequestAndStackEvents( reqId );
+    // verify that UpdateInterest was called
+    COMMONASSERT( messenger, EXIMPPlgTestGrantPresenceForPresentityGroupMembersCalled, 
+        "GrantPresenceForPresentityGroupMembersL was not called", ETrue, NULL );
+    
+    delete ggroup;
+            
+
+    //////////////////////////////////////////////////////////////////////////
+    // UNSUBSCRIBE PRESENTITY GROUP MEMBERS
+    ////////////////////////////////////////////////////////////////////////// 
+        
+    // Setup status event listener for RequestComplete
+    SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk );
+
+    // unregister interest
+    reqId = presWatch.UnsubscribePresentityGroupMembersPresenceL( *group );
+
+    // Wait for events on the request
+    wrapper->WaitRequestAndStackEvents( reqId );
+    wrapper->VerifyEventStackL( _L8("Unsubscribe presentity group members, complete with error: ") );
+        
+    // verify that UpdateInterest was called
+    COMMONASSERT( messenger, EXIMPPlgTestUnsubscribePresentityGroupMembersPresesenceCalled, "UnsubscribePresentityGroupMembersPresenceL was not called", ETrue, NULL );
+
+
+    
+    //////////////////////////////////////////////////////////////////////////
+    // UNSUBSCRIBE PRESENTITY GROUP CONTENT
+    ////////////////////////////////////////////////////////////////////////// 
+    
+    // Setup status event listener for RequestComplete
+    SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk );
+    
+    // unsubscribe
+    reqId = presGroup.UnsubscribePresentityGroupContentL( *identity );
+        
+    // Wait for events on the request
+    wrapper->WaitRequestAndStackEvents( reqId );
+    wrapper->VerifyEventStackL( _L8("Unsubscribe presentity group content, complete with error: ") );
+
+    // verify that UnsubscribePresentityGroupContentL was called
+    messenger->AssertUnsubscribePresentityGroupContentCalled( ETrue );
+    
+    CleanupStack::PopAndDestroy(); // >>> identity
+
+    //////////////////////////////////////////////////////////////////////////
+    // UNSUBSCRIBE PRESENCE BLOCK LIST
+    //////////////////////////////////////////////////////////////////////////
+
+    // Setup status event listener for RequestComplete
+    SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk );
+
+    // subscribe
+    reqId = presAuth.UnsubscribePresenceBlockListL();
+    
+    // Wait for events on the request
+    wrapper->WaitRequestAndStackEvents( reqId );
+    wrapper->VerifyEventStackL( _L8("Unsubscribing presence watcher list, complete with error: ") );
+
+    // verify that SubscribeBlockListL was called
+    COMMONASSERT( messenger, EXIMPPlgTestUnsubscribePresenceBlockListCalled, "UnubscribeBlockListL was not called", ETrue, NULL );
+    
+    //////////////////////////////////////////////////////////////////////////
+    // UNSUBSCRIBE PRESENTITY GROUP LIST
+    //////////////////////////////////////////////////////////////////////////
+    
+    // Setup status event listener for RequestComplete
+    SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk );
+
+    // unsubscribe
+    reqId = presGroup.UnsubscribePresentityGroupListL();
+    
+    // Wait for events on the request
+    wrapper->WaitRequestAndStackEvents( reqId );
+    wrapper->VerifyEventStackL( _L8("Unsubscribing presentity group list, complete with error: ") );
+    
+    // verify that SubscribePresentityGroupListL was called
+    messenger->AssertUnsubscribePresentityGroupListCalled( ETrue );
+   
+
+    //////////////////////////////////////////////////////////////////////////
+    // UNSUBSCRIBE PRESENCE WATCHER LIST
+    //////////////////////////////////////////////////////////////////////////
+
+    // Setup status event listener for RequestComplete
+    SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk );
+
+    // unsubscribe
+    reqId = presPub.UnsubscribePresenceWatcherListL();
+
+    // Wait for events on the request
+    wrapper->WaitRequestAndStackEvents( reqId );
+    wrapper->VerifyEventStackL( _L8("Unsubscribing presence watcher list, complete with error: ") );
+
+    // verify that UnsubscribeWatcherListL was called
+    COMMONASSERT( messenger, EXIMPPlgTestUnsubscribePresenceWatcherListCalled, "UnsubscribeWatcherListL was not called", ETrue, NULL );
+
+
+    ////////////////////////////////////////////////////////////////////////////
+    // UNSUBSCRIBE OWN PRESENCE
+    ////////////////////////////////////////////////////////////////////////////
+    // Setup status event listener for RequestComplete
+    SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk );    
+    
+    // unsubscribe own presence
+    reqId = presPub.UnsubscribeOwnPresenceL();
+    
+    // Wait for events on the request
+    wrapper->WaitRequestAndStackEvents( reqId );
+    
+    wrapper->VerifyEventStackL( _L8("Unsubscribing own presence, complete with error: ") );
+        
+    // verify that UnsubscribeOwnPresenceL was called
+    COMMONASSERT( messenger, EXIMPPlgTestUnsubscribeOwnPresenceCalled, "UnsubscribeOwnPresenceL was not called", ETrue, NULL );
+
+    CleanupStack::PopAndDestroy( ownPif ); // >>> ownPif
+    delete group;
+    delete groupId;
+   
+
+    UnbindL();
+    
+    wrapper = NULL;
+    context = NULL;
+    messenger = NULL;
+    
+
+
+    }
+
+// Grant/Withdraw from group
+void T_PresenceAll::T_GrantWithdrawGroup_L()
+    {
+    EUNIT_PRINT( _L("T_GrantWithdrawGroup_L") );
+
+    BindL();
+
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    MXIMPContext* context = wrapper->GetContext();
+    CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+    // Tell the protocol it should act normally
+    messenger->SetNoError();
+    
+        
+    // Get the interfaces
+    MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+    MPresencePublishing& presPub = presFeat->PresencePublishing();
+    MPresenceAuthorization& presAuth = presFeat->PresenceAuthorization();
+    MPresentityGroups& presGroup = presFeat->PresentityGroups();
+    MPresenceWatching& presWatch = presFeat->PresenceWatching();
+    
+    
+    
+    //////////////////////////////////////////////////////////////////////////
+    // CREATE PRESENTITY GROUP
+    /////////////////////////////////////////////////////////////////////////
+    
+    // Setup status event listener for RequestComplete
+    // This will also produce HandlePresentityGroupListEvent, since the
+    // the group is subscribed
+    SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk );
+
+
+    MXIMPIdentity* groupId = context->ObjectFactory().NewIdentityLC();
+    CleanupStack::Pop(); // groupId
+    groupId->SetIdentityL( KGroupId );
+    
+    // subscribe
+    TXIMPRequestId reqId = presGroup.CreatePresentityGroupL( *groupId, KGroupDisplayName );
+    
+    // Wait for events on the request
+    wrapper->WaitRequestAndStackEvents( reqId );
+    wrapper->VerifyEventStackL( _L8("CreatePresentityGroupL failed, complete with error: ") );
+    
+    // verify that SubscribePresentityGroupListL was called
+    messenger->AssertCreatePresentityGroupCalled( ETrue );
+
+    
+  
+    //////////////////////////////////////////////////////////////////////////
+    // ADD PRESENTITY GROUP MEMBER
+    ////////////////////////////////////////////////////////////////////////// 
+    
+    CXIMPTestListener* listener4 = CXIMPTestListener::NewL( context );
+    CleanupStack::PushL( listener4 );    // << listener4
+    
+    MXIMPIdentity* member = context->ObjectFactory().NewIdentityLC(); // << member
+    member->SetIdentityL( KMemberId1 );
+
+
+    // request complete
+    TXIMPRequestId reqIdDummy;
+    CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+
+    // group id
+    CXIMPIdentityImp* identity2 = CXIMPIdentityImp::NewLC( groupId->Identity() );
+    evReqComplete->AppendParamL( identity2 );
+    CleanupStack::Pop(); // identity2
+
+    // id for member info
+    CXIMPIdentityImp* miId = CXIMPIdentityImp::NewLC( KMemberId1 );
+    // member info
+    CPresentityGroupMemberInfoImp* memInfoImp =
+        CPresentityGroupMemberInfoImp::NewLC( *miId, KMemberDisplayName1 );
+    evReqComplete->AppendParamL( memInfoImp );
+    CleanupStack::Pop(); // memInfoImp owned by AppendParamL
+    CleanupStack::PopAndDestroy( miId ); // copy was made
+
+    listener4->ExpectL( evReqComplete );
+    CleanupStack::Pop( evReqComplete );
+
+    // do the call
+    reqId = presGroup.AddPresentityGroupMemberL(
+            *groupId, *member, KMemberDisplayName1 );
+
+    // and wait
+    EUNIT_ASSERT_DESC( KErrNone == listener4->WaitAndAssertL(), "AddPresentityGroupMemberL (not subscribed) failed" );
+
+    messenger->AssertAddPresentityGroupMemberCalled( ETrue );
+    CleanupStack::PopAndDestroy(); // >>> member
+    CleanupStack::PopAndDestroy( listener4 );// >>> listener4
+    
+    delete groupId;
+
+    //////////////////////////////////////////////////////////////////////////
+    // ADD PRESENTITY GROUP MEMBER, GROUP CONTENT SUBSCRIBED
+    ////////////////////////////////////////////////////////////////////////// 
+    
+    // Setup status event listener for RequestComplete
+    // This will also produce HandlePresentityGroupMemberAddedL, since the
+    // the group is subscribed
+    SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk );
+    
+    MXIMPIdentity* member2 = context->ObjectFactory().NewIdentityLC(); // << member2
+    member2->SetIdentityL( KMemberId2 );
+
+    // do the call
+    reqId = presGroup.AddPresentityGroupMemberL(
+            *groupId, *member2, KMemberDisplayName2 );
+            
+    // Wait for events on the request
+    wrapper->WaitRequestAndStackEvents( reqId );
+    wrapper->VerifyEventStackL( _L8("AddPresentityGroupMemberL (subscribed) failed, complete with error: ") );
+
+
+    messenger->AssertAddPresentityGroupMemberCalled( ETrue );
+    CleanupStack::PopAndDestroy(); // >>> member2
+
+
+   
+    //////////////////////////////////////////////////////////////////////////
+    // GRANT PRESENTITY GROUP MEMBER
+    //////////////////////////////////////////////////////////////////////////
+
+    // This is the group we are interested in
+    MXIMPIdentity* ggroup = context->ObjectFactory().NewIdentityLC();
+    CleanupStack::Pop(); // ggroup
+    ggroup->SetIdentityL( KGroupId );
+    // Set filter for the group
+    CPresenceInfoFilterImp* ggpif = CPresenceInfoFilterImp::NewLC();
+    ggpif->AcceptPersonFilterL( NPresenceInfo::NFieldType::KAcceptAll  );
+    CleanupStack::Pop(); // ggpif
+
+    // Setup status event listener for RequestComplete
+    SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk );
+
+    // grant for all
+    reqId = presAuth.GrantPresenceForPresentityGroupMembersL( *ggroup, *ggpif );
+
+    // Wait for events on the request
+    wrapper->WaitRequestAndStackEvents( reqId );
+    
+    // verify that UpdateInterest was called
+    COMMONASSERT( messenger, EXIMPPlgTestGrantPresenceForPresentityGroupMembersCalled, 
+        "GrantPresenceForPresentityGroupMembersL was not called", ETrue, NULL );
+    
+    delete ggpif;
+    
+
+
+    //////////////////////////////////////////////////////////////////////////
+    // WITHDRAW PRESENTITY GROUP MEMBER
+    //////////////////////////////////////////////////////////////////////////
+
+
+    // Setup status event listener for RequestComplete
+    SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk );
+
+    // withdraw from all
+    reqId = presAuth.WithdrawPresenceGrantFromPresentityGroupMembersL( *ggroup );
+
+    // Wait for events on the request
+    wrapper->WaitRequestAndStackEvents( reqId );
+    // verify that UpdateInterest was called
+    COMMONASSERT( messenger, EXIMPPlgTestGrantPresenceForPresentityGroupMembersCalled, 
+        "GrantPresenceForPresentityGroupMembersL was not called", ETrue, NULL );
+    
+    delete ggroup;        
+
+    UnbindL();
+    
+    wrapper = NULL;
+    context = NULL;
+    messenger = NULL;
+
+    }
+
+
+// ===========================================================================
+// SETUP HELPERS FOR THE LISTENER
+// ===========================================================================
+//
+void T_PresenceAll::SetupListenerReqCompleteL( CXIMPTestContextWrapper* aWrapper, TXIMPTestStatusEventTemplate aEventType )
+    {
+    RArray< TInt32 > array;
+    CleanupClosePushL( array );
+    array.Append( MXIMPContextStateEvent::KInterfaceId );
+    array.Append( MPresentityPresenceEvent::KInterfaceId );
+    aWrapper->SetupListenerReqCompleteL( aEventType, &array );
+    CleanupStack::PopAndDestroy(); // array
+    }
+
+void T_PresenceAll::SetupListenerReqCompleteAllowEventsL(  CXIMPTestContextWrapper* aWrapper, TXIMPTestStatusEventTemplate aEventType )
+    {
+    RArray< TInt32 > array;
+    CleanupClosePushL( array );
+    array.AppendL( MXIMPRequestCompleteEvent::KInterfaceId );
+    array.AppendL( MXIMPContextStateEvent::KInterfaceId );
+    array.AppendL( MPresentityPresenceEvent::KInterfaceId );
+    aWrapper->SetupListenerReqCompleteL( aEventType, &array );
+    CleanupStack::PopAndDestroy(); // array
+    }
+
+void T_PresenceAll::SendSrvMsgL(
+        const TDesC& aUri, const TDesC& aDispName,
+        TInt aMsgType )
+    {
+    // we'll use hard-coded wrapper 0 instance for now.
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+
+    // create a group info contained within the server-originated
+    // faked message
+    CXIMPIdentityImp* groupId = CXIMPIdentityImp::NewLC( aUri );
+    CPresentityGroupInfoImp* groupItem = CPresentityGroupInfoImp::NewLC( *groupId, aDispName );
+    HBufC8* packet = NULL;
+    if( aMsgType == CXIMPTestFileSrvMsg::ETestSrvMsgPresentityGroupDelete )
+        {
+        packet = TXIMPObjectPacker< CXIMPIdentityImp >::PackL( *groupId );        
+        }
+    else
+        {
+        packet = TXIMPObjectPacker< CPresentityGroupInfoImp >::PackL( *groupItem );        
+        }
+    CleanupStack::PushL( packet );
+    
+    // use filetool to send it for plugin.
+    CXIMPTestFileSrvMsg* srvMsg = CXIMPTestFileSrvMsg::NewL( aMsgType, *packet );
+    CleanupStack::PushL( srvMsg );
+    wrapper->FileTool().CleanAllL();
+    wrapper->FileTool().SrvMsgStoreL( srvMsg );
+    CleanupStack::PopAndDestroy( 4, groupId ); // srvMsg, packet, groupItem, groupId
+    }
+
+// send a faked server-originated message with empty contents
+//
+void T_PresenceAll::SendSrvMsgL( TInt aMsgType )
+    {
+    // we'll use hard-coded wrapper 0 instance for now.
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+
+    // create a server-originated faked message with empty contents
+    RXIMPObjOwningPtrArray<CPresentityGroupInfoImp> groupList;
+
+    HBufC8* packedArray = TXIMPObjectPacker<CPresentityGroupInfoImp>::PackArrayL( groupList );
+    CleanupStack::PushL( packedArray );
+
+    // use filetool to send it for plugin.
+    CXIMPTestFileSrvMsg* srvMsg = CXIMPTestFileSrvMsg::NewL( aMsgType,
+            *packedArray );
+    CleanupStack::PushL( srvMsg );
+    wrapper->FileTool().CleanAllL();
+    wrapper->FileTool().SrvMsgStoreL( srvMsg );
+    CleanupStack::PopAndDestroy( 2 ); // srvMsg, packedArray
+    }
+    
+    
+void T_PresenceAll::T_BindUnbindL()
+    {
+    EUNIT_PRINT( _L("T_BindUnbindL") );
+
+    BindL();
+
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    MXIMPContext* context = wrapper->GetContext();
+    CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+    // Tell the protocol it should act normally
+    messenger->SetNoError();
+    
+        
+    UnbindL();
+    
+    wrapper = NULL;
+    context = NULL;
+    messenger = NULL;
+    }
+// ===========================================================================
+// TEST CASE TABLE
+// ===========================================================================
+//
+EUNIT_BEGIN_TEST_TABLE(
+        T_PresenceAll,
+        "XIMP presence all tests",
+        "MODULE" )
+        
+PRFW_DECORATED_TEST(
+        "TMO_demo_Startup",
+        "",
+        "",
+        "FUNCTIONALITY",
+        Setup_L,
+        T_TMO_demo_Startup_L,
+        Teardown )
+        
+PRFW_DECORATED_TEST(
+        "BindUnbind",
+        "",
+        "",
+        "FUNCTIONALITY",
+        Setup_L,
+        T_BindUnbindL,
+        Teardown )
+        
+PRFW_DECORATED_TEST(
+        "GrantWithdrawGroup",
+        "",
+        "",
+        "FUNCTIONALITY",
+        Setup_L,
+        T_GrantWithdrawGroup_L,
+        Teardown )
+
+EUNIT_END_TEST_TABLE
+
+
+// ===========================================================================
+// TEST SUITE CONSTRUCTION
+// ===========================================================================
+//
+EXPORT_C MEUnitTest* CreateTestSuiteL()
+    {
+    return T_PresenceAll::NewL();
+    }
+
+
+// end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_presenceall/t_presenceall.h	Wed Nov 03 09:32:20 2010 +0530
@@ -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:
+*
+*/
+
+#ifndef T_PRESENCEALL_H
+#define T_PRESENCEALL_H
+
+
+//  EXTERNAL INCLUDES
+#include <platform/digia/eunit/ceunittestsuiteclass.h>
+#include <platform/digia/eunit/EUnitDecorators.h>
+
+
+#include <ximpbase.h>
+#include "prfwteststatuseventlistener.h"
+#include "prfwtestmessaging.h"
+
+class CXIMPTestContextWrapper;
+class CXIMPTestContextWrapperMgr;
+class CXIMPTestMessenger;
+
+/**
+ * XIMP Framework Eunit tests.
+ *
+ * Tests for XIMP session management services.
+ *
+ * @since S60 v4.0
+ */
+class T_PresenceAll : public CEUnitTestSuiteClass
+    {
+
+public:
+    static T_PresenceAll* NewL();
+    virtual ~T_PresenceAll();
+
+
+private:
+    T_PresenceAll();
+    void ConstructL();
+
+
+
+private:    // Test case functions
+
+    void Setup_L();
+    void SetupMultiple_L();
+    void BindL();
+    void BindAllL();
+    void Teardown();
+    void UnbindL();
+    void UnbindAllL();
+
+    void T_TMO_demo_Startup_L();
+    void T_GrantWithdrawGroup_L();
+    
+    void T_BindUnbindL();
+ 
+private:    // Test helpers
+
+void SendSrvMsgL(
+        const TDesC& aUri, const TDesC& aDispName,
+        TInt aMsgType );
+
+
+// send a faked server-originated message with empty contents
+//
+void SendSrvMsgL( TInt aMsgType );
+
+    void SetupListenerReqCompleteL( CXIMPTestContextWrapper* aWrapper, TXIMPTestStatusEventTemplate aEventType );
+    void SetupListenerReqCompleteAllowEventsL( CXIMPTestContextWrapper* aWrapper, TXIMPTestStatusEventTemplate aEventTypes );
+
+private: // Test data
+
+    /**
+     * Eunit test case table declaration.
+     */
+    EUNIT_DECLARE_TEST_TABLE;
+
+    // owned
+    CXIMPTestContextWrapperMgr* iWrapperMgr;
+
+    };
+
+
+#endif      //  t_presenceall_H
+
+
+
+// end of file
+
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_presenceall/t_presenceall.mmp	Wed Nov 03 09:32:20 2010 +0530
@@ -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:
+*
+*/
+
+#include            "../../tsrcutils/eunitcommon/eunittstdllbase.hrh"
+#include            "../../tsrcutils/processmaster/pm.h"
+
+#include<platform_paths.hrh>
+#include<eunitcaps.h>
+TARGET              t_presenceall.dll
+//CAPABILITY              ALL - TCB - DRM
+CAPABILITY      EUNIT_CAPS
+
+SOURCEPATH          .
+SOURCE              t_presenceall.cpp
+
+
+USERINCLUDE             ../../../../../ximpfw/core/srcdatamodel
+USERINCLUDE             ../../../../../ximpfw/presence/srcpresencedatamodel
+USERINCLUDE             ../../../../../ximpfw/presence/srcpresencedatamodel/presentitygroups
+USERINCLUDE             ../../../../../ximpfw/presence/srcpresencedatamodel/presencewatching
+USERINCLUDE             ../../../../../ximpfw/presence/srcpresencedatamodel/presenceauthorization
+USERINCLUDE             ../../../../../ximpfw/presence/srcpresencedatamodel/presencepublishing
+USERINCLUDE             ../../../../../ximpfw/presence/srcpresencedatamodel/presenceinfo
+USERINCLUDE             ../../../../../ximpfw/core/srcutils
+
+#if defined ( OS_LAYER_SYSTEMINCLUDE )
+OS_LAYER_SYSTEMINCLUDE
+#else
+SYSTEMINCLUDE     /epoc32/include
+#endif
+
+ #if defined ( APP_LAYER_SYSTEMINCLUDE )
+ APP_LAYER_SYSTEMINCLUDE
+ #else
+ SYSTEMINCLUDE     \epoc32\include
+ #endif
+LIBRARY             ecom.lib
+LIBRARY             bafl.lib
+LIBRARY             ximpdatamodel.lib
+LIBRARY             presencedatamodel.lib
+LIBRARY             estor.lib
+LIBRARY             ximputils.lib
+LIBRARY             eunit.lib
+LIBRARY             eunitutil.lib
+LIBRARY             euser.lib
+
+// end of file
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_presenceauthorization/bld.inf	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,25 @@
+/*
+* 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 t_presenceauthorization.dll
+*
+*/
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+PRJ_TESTMMPFILES
+t_presenceauthorization.mmp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_presenceauthorization/t_presenceauthorization.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,2064 @@
+/*
+* 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:
+*
+*/
+
+
+#include "eunittools.h"
+
+
+#include <platform/digia/eunit/eunitmacros.h>
+#include <platform/digia/eunit/teunitassertioninfo.h>
+
+#include <ecom/ecom.h>
+#include <badesca.h>
+
+#include <ximpbase.h>
+#include <ximpclient.h>
+#include <ximpcontext.h>
+#include <ximpcontextstateevent.h>
+#include <ximprequestcompleteevent.h>
+#include <ximpstatus.h>
+#include <presencefeatures.h>
+#include <presenceauthorization.h>
+#include <presencepublishing.h>
+#include <presentitypresenceevent.h>
+#include <ximpobjectfactory.h>
+
+#include "prfwtestlistener.h"
+
+#include <presentitygroups.h>
+#include <presentitygroupinfo.h>
+#include <presentitygrouplistevent.h>
+
+#include "t_presenceauthorization.h"
+#include "prfwteststatuseventlistener.h"
+#include "prfwtestmessaging.h"
+#include "prfwtestmessenger.h"
+#include "prfwtestcontextwrappermgr.h"
+#include "prfwtestcontextwrapper.h"
+
+#include "presenceinfoimp.h"
+#include "presenceinfofilterimp.h"
+#include "prfwtestpresencedatautils.h"
+#include "ximpidentityimp.h"
+#include "presentitygroupmemberinfoimp.h"
+#include "ximpobjecthelpers.h"
+#include "prfwtestfilesrvmsg.h"
+#include "prfwtestwaithelper.h"
+
+#include "prfwtestrobustnesstools.h"
+
+
+#include "presentitygroupcontenteventimp.h"
+#include "ximprequestcompleteeventimp.h"
+#include "presentitygroupinfoimp.h"
+#include "presentitygrouplisteventimp.h"
+#include "presentitygroupmemberinfoimp.h"
+#include "ximprequestcompleteeventimp.h"
+#include "ximprestrictedobjectcollection.h"
+#include "ximpobjectfactoryimp.h"
+
+_LIT8( KIdentity1, "Identity1" );
+_LIT8( KIdentity2, "Identity2" );
+_LIT8( KIdentity3, "Identity3" );
+
+_LIT( KIdentity1_16, "Identity1" );
+_LIT( KIdentity2_16, "Identity2" );
+_LIT( KIdentity3_16, "Identity3" );
+
+
+_LIT( KGroupId,  "Group" );
+_LIT( KGroupId1, "Group1" );
+_LIT( KGroupId2, "Group2" );
+
+
+_LIT( KGroupDisplayName, "GroupDisplayName" );
+
+
+_LIT8( KPrefix1, "PreA_" );
+_LIT8( KPrefix2, "PreB_" );
+_LIT8( KPrefix3, "PreC_" );
+_LIT8( KPrefix4, "PreD_" );
+
+_LIT( KIdentity, "TestId@hello.world" );
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// CONSTRUCTION
+T_PresenceAuthorization* T_PresenceAuthorization::NewL()
+    {
+    T_PresenceAuthorization* self = new( ELeave ) T_PresenceAuthorization;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+
+    return self;
+    }
+
+
+T_PresenceAuthorization::~T_PresenceAuthorization()
+    {
+    }
+
+
+void T_PresenceAuthorization::ConstructL()
+    {
+    CEUnitTestSuiteClass::ConstructL();
+    }
+
+
+T_PresenceAuthorization::T_PresenceAuthorization()
+    {
+    }
+
+
+
+// ===========================================================================
+// TEST CASE SETUP & TEARDOWN METHODS
+// ===========================================================================
+//
+
+void T_PresenceAuthorization::Setup_L()
+    {
+    PrfwTestRobustness::DoPreCleaning();
+
+    iWrapperMgr = CXIMPTestContextWrapperMgr::NewL();
+    iWrapperMgr->CreateWrapperL();
+    }
+
+void T_PresenceAuthorization::SetupMultiple_L()
+    {
+    PrfwTestRobustness::DoPreCleaning();
+
+    iWrapperMgr = CXIMPTestContextWrapperMgr::NewL();
+    iWrapperMgr->CreateWrapperL();
+    iWrapperMgr->CreateWrapperL();
+    iWrapperMgr->CreateWrapperL();
+    }
+
+
+void T_PresenceAuthorization::BindL()
+    {
+    CXIMPTestContextWrapper* wrapper0 = iWrapperMgr->GetWrapperL( 0 );
+
+    wrapper0->BindL( 0 );
+    }
+
+void T_PresenceAuthorization::BindAllL()
+    {
+    for( TInt a = 0; a < iWrapperMgr->WrapperCount(); ++a )
+        {
+        CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a );
+        wrapper->BindL( 0 );
+        }
+    }
+
+
+void T_PresenceAuthorization::Teardown()
+    {
+    delete iWrapperMgr;
+    iWrapperMgr = NULL;
+
+    REComSession::FinalClose();
+
+    PrfwTestRobustness::DoPreCleaning();
+    }
+
+void T_PresenceAuthorization::UnbindL()
+    {
+    // Do unbind
+    CXIMPTestContextWrapper* wrapper0 = iWrapperMgr->GetWrapperL( 0 );
+    wrapper0->UnbindL();
+    }
+
+void T_PresenceAuthorization::UnbindAllL()
+    {
+    for( TInt a = 0; a < iWrapperMgr->WrapperCount(); ++a )
+        {
+        CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a );
+        wrapper->UnbindL();
+        }
+    }
+
+
+// ===========================================================================
+// TEST CASES for presentity authorization
+// ===========================================================================
+
+void T_PresenceAuthorization::T_GrantPresenceForPresentity_L()
+    {
+    EUNIT_PRINT( _L("Grant presence for presentity") );
+
+// INITIALIZE
+
+    BindL();
+
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    MXIMPContext* context = wrapper->GetContext();
+    CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+    // Tell the protocol it should act normally
+    messenger->SetNoError();
+
+    // Get the interfaces
+    MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+    MPresenceAuthorization& presAuth = presFeat->PresenceAuthorization();
+
+    CXIMPIdentityImp* identity = XIMPTestPresenceDataUtils::GenerateIdentityLC( &KNullDesC8 );
+    CPresenceInfoFilterImp* pif =
+                XIMPTestPresenceDataUtils::GenerateInfoFilterLC( &KPrefix1 );
+
+// GRANT
+
+    // Setup status event listener for RequestComplete
+    SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk );
+
+    // register interest
+    TXIMPRequestId reqId = presAuth.GrantPresenceForPresentityL( *identity, *pif );
+
+    // Wait for events on the request
+    wrapper->WaitRequestAndStackEvents( reqId );
+    // verify that UpdateInterest was called
+    COMMONASSERT( messenger, EXIMPPlgTestGrantPresenceForPresentityCalled, 
+                        "GrantPresenceForPresentityL was not called", ETrue, NULL );
+
+// GRANT AGAIN
+
+    // Setup status event listener for RequestComplete
+    SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk );
+    messenger->SetValueFor( EXIMPPlgTestGrantPresenceForPresentityCalled, 0 );
+    
+    // register interest
+    reqId = presAuth.GrantPresenceForPresentityL( *identity, *pif );
+
+    // Wait for events on the request
+    wrapper->WaitRequestAndStackEvents( reqId );
+    
+    // verify that UpdateInterest was called
+    COMMONASSERT( messenger, EXIMPPlgTestGrantPresenceForPresentityCalled, 
+                        "GrantPresenceForPresentityL was not called", EFalse, 
+                        "GrantPresenceForPresentityL was called" );
+
+// WITHDRAW
+
+    SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk );
+    // register interest
+    reqId = presAuth.WithdrawPresenceGrantFromPresentityL( *identity );
+
+    // Wait for events on the request
+    wrapper->WaitRequestAndStackEvents( reqId );
+    wrapper->VerifyEventStackL( _L8("Grantin presence to presentity, complete with error: ") );
+    // verify that UpdateInterest was called
+    COMMONASSERT( messenger, EXIMPPlgTestWithdrawPresenceFromPresentityCalled, 
+                            "WithdrawPresenceForPresentityL was not called", ETrue, NULL );
+
+// DEINITIALIZE
+
+    CleanupStack::PopAndDestroy( 2, identity ); //pif, identity
+    UnbindL();
+    }
+
+// ==============================================================================================
+
+void T_PresenceAuthorization::T_WithdrawNotGrantedPresenceFromPresentity_L()
+    {
+    EUNIT_PRINT( _L("Withdraw presence from presentity not granted") );
+
+// INITIALIZE
+
+    BindL();
+
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    MXIMPContext* context = wrapper->GetContext();
+    CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+    // Tell the protocol it should act normally
+    messenger->SetNoError();
+
+    // Get the interfaces
+    MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+    MPresenceAuthorization& presAuth = presFeat->PresenceAuthorization();
+
+    CXIMPIdentityImp* identity = XIMPTestPresenceDataUtils::GenerateIdentityLC( &KNullDesC8 );
+
+// WITHDRAW
+
+    SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk );
+    // register interest
+    TXIMPRequestId reqId = presAuth.WithdrawPresenceGrantFromPresentityL( *identity );
+
+    // Wait for events on the request
+    wrapper->WaitRequestAndStackEvents( reqId );
+    wrapper->VerifyEventStackL( _L8("Grantin presence to presentity, complete with error: ") );
+    // Changed for OPAA-73BCS(
+    // verify that UpdateInterest was called
+    COMMONASSERT( messenger, EXIMPPlgTestWithdrawPresenceFromPresentityCalled, 
+                        "WithdrawPresenceForPresentityL was not called", ETrue/*EFalse*/, 
+                        "WithdrawPresenceForPresentityL was called" );
+
+// DEINITIALIZE
+
+    CleanupStack::PopAndDestroy( identity ); //identity
+    UnbindL();
+    }
+
+// ==============================================================================================
+
+
+void T_PresenceAuthorization::T_GrantPresenceForPresentityChangeId_L()
+    {
+    EUNIT_PRINT( _L("Grant presence for presentity change id") );
+
+// INITIALIZE
+
+    BindL();
+
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    MXIMPContext* context = wrapper->GetContext();
+    CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+    // Tell the protocol it should act normally
+    messenger->SetNoError();
+
+    // Get the management interface
+    // Get the interfaces
+    MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+    MPresenceAuthorization& presAuth = presFeat->PresenceAuthorization();
+
+
+    CXIMPIdentityImp* identity = XIMPTestPresenceDataUtils::GenerateIdentityLC( &KNullDesC8 );
+    CPresenceInfoFilterImp* pif =
+                XIMPTestPresenceDataUtils::GenerateInfoFilterLC( &KPrefix1 );
+
+// ID CHANGE REQUEST TO ADAPTATION
+
+    MXIMPIdentity* identityParam = context->ObjectFactory().NewIdentityLC();
+    identityParam->SetIdentityL( KIdentity );
+    
+    CXIMPIdentityImp* identityParamImp =
+             ( CXIMPIdentityImp* ) identityParam->GetInterface(
+                                        CXIMPIdentityImp::KClassId,
+                                        MXIMPBase::EPanicIfUnknown );
+    HBufC8* packedId = TXIMPObjectPacker< CXIMPIdentityImp >::PackL( *identityParamImp );
+    CleanupStack::PopAndDestroy(); // identityParam
+    CleanupStack::PushL( packedId );
+    CXIMPTestFileSrvMsg* srvMsg = CXIMPTestFileSrvMsg::NewL( CXIMPTestFileSrvMsg::ETestSrvMsgReqParamIdentity, 
+                                                             *packedId );
+    CleanupStack::PopAndDestroy( packedId );
+    CleanupStack::PushL( srvMsg );
+    wrapper->FileTool().SrvMsgStoreL( srvMsg );
+    CleanupStack::PopAndDestroy( srvMsg );
+
+    // Wait for server to handle srvmsg.
+    CXIMPTestWaitHelper* wait = CXIMPTestWaitHelper::NewL();
+    CleanupStack::PushL( wait );
+    wait->WaitForL( 2 );
+    CleanupStack::PopAndDestroy( wait );
+
+// GRANT
+
+    // Setup status event listener for RequestComplete
+    SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk );
+
+    // register interest
+    TXIMPRequestId reqId = presAuth.GrantPresenceForPresentityL( *identity, *pif );
+
+    // Wait for events on the request
+    wrapper->WaitRequestAndStackEvents( reqId );
+    // verify that UpdateInterest was called
+    COMMONASSERT( messenger, EXIMPPlgTestGrantPresenceForPresentityCalled, 
+                        "GrantPresenceForPresentityL was not called", ETrue, NULL );
+
+// DEINITIALIZE
+
+    CleanupStack::PopAndDestroy( 2, identity ); //pif, identity
+    UnbindL();
+    }
+
+// ==============================================================================================
+
+void T_PresenceAuthorization::T_WithdrawNotGrantedPresenceFromPresentity_Multiple_L()
+    {
+    EUNIT_PRINT( _L("Withdraw presence from presentity not granted multiple clients") );
+
+    BindAllL();
+
+    CXIMPIdentityImp* identity = XIMPTestPresenceDataUtils::GenerateIdentityLC( &KNullDesC8 );
+    CPresenceInfoFilterImp* pif =
+                XIMPTestPresenceDataUtils::GenerateInfoFilterLC( &KPrefix1 );
+
+// GRANT ALL BUT FIRST
+
+    TInt countOfWrappers = iWrapperMgr->WrapperCount();
+    TInt a(0);
+    for( a = countOfWrappers - 1; a >= 1; --a )
+        {
+        CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a );
+        MXIMPContext* context = wrapper->GetContext();
+        CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+        // Tell the protocol it should act normally
+        messenger->SetNoError();
+
+        // Get the interfaces
+        MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+        MPresenceAuthorization& presAuth = presFeat->PresenceAuthorization();
+
+        // Setup status event listener for RequestComplete
+        SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk );
+
+        // register interest
+        TXIMPRequestId reqId = presAuth.GrantPresenceForPresentityL( *identity, *pif );
+
+        // Wait for events on the request
+        wrapper->WaitRequestAndStackEvents( reqId );
+        // verify that UpdateInterest was called
+        COMMONASSERT( messenger, EXIMPPlgTestGrantPresenceForPresentityCalled,
+            "GrantPresenceForPresentityL was not called",
+            ( a > 1 ) ? ETrue : EFalse,
+            "GrantPresenceForPresentityL was called" );
+        }
+        
+// WITHDRAW
+        
+    for( a = 0; a < countOfWrappers; ++a )
+        {
+        CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a );
+        MXIMPContext* context = wrapper->GetContext();
+        CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+        
+        // Get the interfaces
+        MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+        MPresenceAuthorization& presAuth = presFeat->PresenceAuthorization();
+
+        // Setup status event listener for RequestComplete
+        SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); // allow events after reqcomplete
+
+        // register interest
+        TXIMPRequestId reqId = presAuth.WithdrawPresenceGrantFromPresentityL( *identity );
+
+        // Wait for events on the request
+        wrapper->WaitRequestAndStackEvents( reqId );
+        wrapper->VerifyEventStackL( _L8("Subscribing presentity presence, complete with error: ") );
+        // Changed for OPAA-73BCS8
+        // verify that UpdateInterest was called
+        COMMONASSERT( messenger, EXIMPPlgTestWithdrawPresenceFromPresentityCalled, 
+            "WithdrawPresenceForPresentityL was not called",
+            ( a < ( countOfWrappers -1 ) /*a < 2*/ ) ? EFalse : ETrue,
+            "WithdrawPresenceForPresentityL was called" );
+        }
+    
+    CleanupStack::PopAndDestroy( pif );
+    CleanupStack::PopAndDestroy( identity );
+        
+    UnbindAllL();    
+    }
+
+
+// ==============================================================================================
+
+void T_PresenceAuthorization::T_ErrFromPlg_LeaveOnGrantPresenceForPresentity_L()
+    {
+    EUNIT_PRINT( _L("Error from plug-in in grant presence for presentity") );    
+
+// INITIALIZE
+
+    BindL();
+
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    MXIMPContext* context = wrapper->GetContext();
+    CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+    // Tell the protocol it should act normally
+    messenger->SetNoError();
+
+    // Get the interfaces
+    MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+    MPresenceAuthorization& presAuth = presFeat->PresenceAuthorization();
+
+
+    CXIMPIdentityImp* identity = XIMPTestPresenceDataUtils::GenerateIdentityLC( &KNullDesC8 );
+    CPresenceInfoFilterImp* pif =
+                XIMPTestPresenceDataUtils::GenerateInfoFilterLC( &KPrefix1 );
+
+// GRANT
+
+    messenger->SetLeave( KErrAbort );
+
+    // Setup status event listener for RequestComplete
+    SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_PresentitySubscribeFailKErrAbort );
+
+    // register interest
+    TXIMPRequestId reqId = presAuth.GrantPresenceForPresentityL( *identity, *pif );
+
+    // Wait for events on the request
+    wrapper->WaitRequestAndStackEvents( reqId );
+    // verify that UpdateInterest was called
+    COMMONASSERT( messenger, EXIMPPlgTestGrantPresenceForPresentityCalled, 
+                        "GrantPresenceForPresentityL was not called", EFalse, 
+                        "GrantPresenceForPresentityL was called" );
+
+    messenger->SetLeave( KErrNone );
+
+// DEINITIALIZE
+
+    CleanupStack::PopAndDestroy( 2, identity ); //pif, identity
+    UnbindL();
+    }
+
+
+// ==============================================================================================
+
+void T_PresenceAuthorization::T_ErrFromPlg_LeaveOnWithdrawPresenceFromPresentity_L()
+    {
+    EUNIT_PRINT( _L("Error from plug-in in withdraw presence from presentity") );    
+
+// INITIALIZE
+
+    BindL();
+
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    MXIMPContext* context = wrapper->GetContext();
+    CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+    // Tell the protocol it should act normally
+    messenger->SetNoError();
+
+    // Get the interfaces
+    MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+    MPresenceAuthorization& presAuth = presFeat->PresenceAuthorization();
+
+
+    CXIMPIdentityImp* identity = XIMPTestPresenceDataUtils::GenerateIdentityLC( &KNullDesC8 );
+    CPresenceInfoFilterImp* pif =
+                XIMPTestPresenceDataUtils::GenerateInfoFilterLC( &KPrefix1 );
+
+// GRANT
+
+    // Setup status event listener for RequestComplete
+    SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk );
+
+    // register interest
+    TXIMPRequestId reqId = presAuth.GrantPresenceForPresentityL( *identity, *pif );
+
+    // Wait for events on the request
+    wrapper->WaitRequestAndStackEvents( reqId );
+    // verify that UpdateInterest was called
+    COMMONASSERT( messenger, EXIMPPlgTestGrantPresenceForPresentityCalled, 
+                        "GrantPresenceForPresentityL was not called", ETrue, 
+                        "GrantPresenceForPresentityL was called" );
+
+// WITHDRAW
+
+    messenger->SetLeave( KErrAbort );
+
+    SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_PresentitySubscribeFailKErrAbort );
+    // register interest
+    reqId = presAuth.WithdrawPresenceGrantFromPresentityL( *identity );
+
+    // Wait for events on the request
+    wrapper->WaitRequestAndStackEvents( reqId );
+    wrapper->VerifyEventStackL( _L8("Grantin presence to presentity, complete with error: ") );
+    // verify that UpdateInterest was called
+    COMMONASSERT( messenger, EXIMPPlgTestWithdrawPresenceFromPresentityCalled, 
+                        "WithdrawPresenceGrantFromPresentityL was not called", EFalse, 
+                        "WithdrawPresenceGrantFromPresentityL was called" );
+
+    messenger->SetLeave( KErrNone );
+
+// DEINITIALIZE
+
+    CleanupStack::PopAndDestroy( 2, identity ); //pif, identity
+    UnbindL();
+    }
+
+// ==============================================================================================
+
+void T_PresenceAuthorization::T_GrantPresenceForPresentity_Multiple_L()
+    {
+    EUNIT_PRINT( _L("Grant presence for presentity multiple clients") );
+
+    BindAllL();
+
+    CXIMPIdentityImp* identity = XIMPTestPresenceDataUtils::GenerateIdentityLC( &KNullDesC8 );
+    CPresenceInfoFilterImp* pif =
+                XIMPTestPresenceDataUtils::GenerateInfoFilterLC( &KPrefix1 );
+
+// GRANT
+
+    TInt countOfWrappers = iWrapperMgr->WrapperCount();
+    TInt a(0);
+    for( a = 0; a < countOfWrappers; ++a )
+        {
+        CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a );
+        MXIMPContext* context = wrapper->GetContext();
+        CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+        // Tell the protocol it should act normally
+        messenger->SetNoError();
+
+    // Get the interfaces
+    MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+    MPresenceAuthorization& presAuth = presFeat->PresenceAuthorization();
+
+
+        // Setup status event listener for RequestComplete
+        SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk );
+
+        // register interest
+        TXIMPRequestId reqId = presAuth.GrantPresenceForPresentityL( *identity, *pif );
+
+        // Wait for events on the request
+        wrapper->WaitRequestAndStackEvents( reqId );
+        // verify that UpdateInterest was called
+        COMMONASSERT( messenger, EXIMPPlgTestGrantPresenceForPresentityCalled, 
+            "GrantPresenceForPresentityL was not called",
+            ( a == 0 ) ? ETrue : EFalse,
+            "GrantPresenceForPresentityL was called" );
+        }
+        
+// GRANT AGAIN        
+
+    for( a = 0; a < countOfWrappers; ++a )
+        {
+        CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a );
+        MXIMPContext* context = wrapper->GetContext();
+        CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+        // Tell the protocol it should act normally
+        messenger->SetNoError();
+
+        // Get the interfaces
+        MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+        MPresenceAuthorization& presAuth = presFeat->PresenceAuthorization();
+
+        // Setup status event listener for RequestComplete
+        SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk );
+        messenger->SetValueFor( EXIMPPlgTestGrantPresenceForPresentityCalled, 0 );
+
+        // register interest
+        TXIMPRequestId reqId = presAuth.GrantPresenceForPresentityL( *identity, *pif );
+
+        // Wait for events on the request
+        wrapper->WaitRequestAndStackEvents( reqId );
+        // verify that UpdateInterest was called
+        COMMONASSERT( messenger, EXIMPPlgTestGrantPresenceForPresentityCalled, 
+            "GrantPresenceForPresentityL was not called", EFalse,
+            "GrantPresenceForPresentityL was called" );
+        }
+
+        
+// WITHDRAW
+        
+    for( a = 0; a < countOfWrappers; ++a )
+        {
+        CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a );
+        MXIMPContext* context = wrapper->GetContext();
+        CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+        
+    // Get the interfaces
+    MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+    MPresenceAuthorization& presAuth = presFeat->PresenceAuthorization();
+
+
+        // Setup status event listener for RequestComplete
+        SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); // allow events after reqcomplete
+
+        // register interest
+        TXIMPRequestId reqId = presAuth.WithdrawPresenceGrantFromPresentityL( *identity );
+
+        // Wait for events on the request
+        wrapper->WaitRequestAndStackEvents( reqId );
+        wrapper->VerifyEventStackL( _L8("Subscribing presentity presence, complete with error: ") );
+        // verify that UpdateInterest was called
+        COMMONASSERT( messenger, EXIMPPlgTestWithdrawPresenceFromPresentityCalled, 
+            "WithdrawPresenceForPresentityL was not called",
+            ( a < 2 ) ? EFalse : ETrue,
+            "WithdrawPresenceForPresentityL was called" );
+        }
+    
+    CleanupStack::PopAndDestroy( pif );
+    CleanupStack::PopAndDestroy( identity );
+        
+    UnbindAllL();    
+    }
+
+
+// ==============================================================================================
+
+void T_PresenceAuthorization::T_WithdrawNotGrantedPresenceFromGroupMembers_L()
+    {
+    EUNIT_PRINT( _L("Withdraw presence from group members not granted") );
+
+// INITIALIZE
+
+    BindL();
+
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    MXIMPContext* context = wrapper->GetContext();
+    CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+    // Tell the protocol it should act normally
+    messenger->SetNoError();
+
+    // Get the interfaces
+    MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+    MPresenceAuthorization& presAuth = presFeat->PresenceAuthorization();
+
+
+    CXIMPIdentityImp* identity = XIMPTestPresenceDataUtils::GenerateIdentityLC( &KNullDesC8 );
+
+// WITHDRAW
+
+    SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk );
+    // register interest
+    TXIMPRequestId reqId = presAuth.WithdrawPresenceGrantFromPresentityGroupMembersL( *identity );
+
+    // Wait for events on the request
+    wrapper->WaitRequestAndStackEvents( reqId );
+    wrapper->VerifyEventStackL( _L8("Withdraw not granted group members, complete with error: ") );
+    // Changed for OPAA-73BCS8
+    COMMONASSERT( messenger, EXIMPPlgTestWithdrawPresenceFromPresentityGroupMembersCalled, 
+                        "WithdrawPresenceGrantFromPresentityGroupMembersL was not called", ETrue/*EFalse*/, 
+                        "WithdrawPresenceGrantFromPresentityGroupMembersL was called" );
+
+// DEINITIALIZE
+
+    CleanupStack::PopAndDestroy( identity ); //identity
+    UnbindL();
+    }
+
+
+// ==============================================================================================
+
+void T_PresenceAuthorization::T_WithdrawNotGrantedPresenceFromGroupMembers_Multiple_L()
+    {
+    EUNIT_PRINT( _L("Withdraw presence from group members not granted multiple clients") );
+
+    BindAllL();
+
+    CXIMPIdentityImp* identity = XIMPTestPresenceDataUtils::GenerateIdentityLC( &KNullDesC8 );
+    CPresenceInfoFilterImp* pif =
+                XIMPTestPresenceDataUtils::GenerateInfoFilterLC( &KPrefix1 );
+
+// GRANT ALL BUT FIRST
+
+    TInt countOfWrappers = iWrapperMgr->WrapperCount();
+    TInt a(0);
+    for( a = countOfWrappers - 1; a >= 1; --a )
+        {
+        CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a );
+        MXIMPContext* context = wrapper->GetContext();
+        CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+        // Tell the protocol it should act normally
+        messenger->SetNoError();
+
+        // Get the interfaces
+        MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+        MPresenceAuthorization& presAuth = presFeat->PresenceAuthorization();
+
+
+        // Setup status event listener for RequestComplete
+        SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk );
+
+        // register interest
+        TXIMPRequestId reqId = presAuth.GrantPresenceForPresentityGroupMembersL( *identity, *pif );
+
+        // Wait for events on the request
+        wrapper->WaitRequestAndStackEvents( reqId );
+        // verify that UpdateInterest was called
+        COMMONASSERT( messenger, EXIMPPlgTestGrantPresenceForPresentityGroupMembersCalled,
+            "GrantPresenceForPresentityGroupMembersL was not called",
+            ( a > 1 ) ? ETrue : EFalse,
+            "GrantPresenceForPresentityGroupMembersL was called" );
+        }
+        
+// WITHDRAW
+        
+    for( a = 0; a < countOfWrappers; ++a )
+        {
+        CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a );
+        MXIMPContext* context = wrapper->GetContext();
+        CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+        
+        // Get the interfaces
+        MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+        MPresenceAuthorization& presAuth = presFeat->PresenceAuthorization();
+
+
+        // Setup status event listener for RequestComplete
+        SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); // allow events after reqcomplete
+
+        // register interest
+        TXIMPRequestId reqId = presAuth.WithdrawPresenceGrantFromPresentityGroupMembersL( *identity );
+
+        // Wait for events on the request
+        wrapper->WaitRequestAndStackEvents( reqId );
+        wrapper->VerifyEventStackL( _L8("Subscribing presentity presence, complete with error: ") );
+        // Changed for OPAA-73BCS8
+        // verify that UpdateInterest was called
+        COMMONASSERT( messenger, EXIMPPlgTestWithdrawPresenceFromPresentityGroupMembersCalled, 
+            "WithdrawPresenceForPresentityGroupMembersL was not called",
+            ( a < ( countOfWrappers - 1 )/*a < 2*/ ) ? EFalse : ETrue,
+            "WithdrawPresenceForPresentityGroupMembersL was called" );
+        }
+    
+    CleanupStack::PopAndDestroy( pif );
+    CleanupStack::PopAndDestroy( identity );
+        
+    UnbindAllL();    
+    }
+
+// ==============================================================================================
+
+
+void T_PresenceAuthorization::T_GrantPresenceForGroupMembers_Multiple_L()
+    {
+    EUNIT_PRINT( _L("Grant presence for group members multiple clients") );
+
+    BindAllL();
+
+    CXIMPIdentityImp* identity = XIMPTestPresenceDataUtils::GenerateIdentityLC( &KNullDesC8 );
+    CPresenceInfoFilterImp* pif =
+                XIMPTestPresenceDataUtils::GenerateInfoFilterLC( &KPrefix1 );
+
+// GRANT
+
+    TInt countOfWrappers = iWrapperMgr->WrapperCount();
+    TInt a(0);
+    for( a = 0; a < countOfWrappers; ++a )
+        {
+        CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a );
+        MXIMPContext* context = wrapper->GetContext();
+        CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+        // Tell the protocol it should act normally
+        messenger->SetNoError();
+
+        // Get the interfaces
+        MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+        MPresenceAuthorization& presAuth = presFeat->PresenceAuthorization();
+
+
+        // Setup status event listener for RequestComplete
+        SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk );
+
+        // register interest
+        TXIMPRequestId reqId = presAuth.GrantPresenceForPresentityGroupMembersL( *identity, *pif );
+
+        // Wait for events on the request
+        wrapper->WaitRequestAndStackEvents( reqId );
+        // verify that UpdateInterest was called
+        COMMONASSERT( messenger, EXIMPPlgTestGrantPresenceForPresentityGroupMembersCalled, 
+            "GrantPresenceForPresentityGroupMembersL was not called",
+            ( a == 0 ) ? ETrue : EFalse,
+            "GrantPresenceForPresentityGroupMembersL was called" );
+        }
+        
+// GRANT AGAIN        
+
+    for( a = 0; a < countOfWrappers; ++a )
+        {
+        CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a );
+        MXIMPContext* context = wrapper->GetContext();
+        CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+        // Tell the protocol it should act normally
+        messenger->SetNoError();
+
+        // Get the interfaces
+        MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+        MPresenceAuthorization& presAuth = presFeat->PresenceAuthorization();
+
+
+        // Setup status event listener for RequestComplete
+        SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk );
+        messenger->SetValueFor( EXIMPPlgTestGrantPresenceForPresentityGroupMembersCalled, 0 );        
+
+        // register interest
+        TXIMPRequestId reqId = presAuth.GrantPresenceForPresentityGroupMembersL( *identity, *pif );
+
+        // Wait for events on the request
+        wrapper->WaitRequestAndStackEvents( reqId );
+        // verify that UpdateInterest was called
+        COMMONASSERT( messenger, EXIMPPlgTestGrantPresenceForPresentityGroupMembersCalled, 
+            "GrantPresenceForPresentityGroupMembersL was not called", EFalse,
+            "GrantPresenceForPresentityGroupMembersL was called" );
+        }
+
+        
+// WITHDRAW
+        
+    for( a = 0; a < countOfWrappers; ++a )
+        {
+        CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a );
+        MXIMPContext* context = wrapper->GetContext();
+        CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+        
+    // Get the interfaces
+    MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+    MPresenceAuthorization& presAuth = presFeat->PresenceAuthorization();
+
+
+        // Setup status event listener for RequestComplete
+        SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); // allow events after reqcomplete
+
+        // register interest
+        TXIMPRequestId reqId = presAuth.WithdrawPresenceGrantFromPresentityGroupMembersL( *identity );
+
+        // Wait for events on the request
+        wrapper->WaitRequestAndStackEvents( reqId );
+        wrapper->VerifyEventStackL( _L8("Subscribing presentity presence, complete with error: ") );
+        // verify that UpdateInterest was called
+        COMMONASSERT( messenger, EXIMPPlgTestWithdrawPresenceFromPresentityGroupMembersCalled, 
+            "WithdrawPresenceForPresentityGroupMembersL was not called",
+            ( a < 2 ) ? EFalse : ETrue,
+            "WithdrawPresenceForPresentityGroupMembersL was called" );
+        }
+    
+    CleanupStack::PopAndDestroy( pif );
+    CleanupStack::PopAndDestroy( identity );
+        
+    UnbindAllL();    
+    }
+
+// ==============================================================================================
+
+void T_PresenceAuthorization::T_ErrFromPlg_LeaveOnGrantPresenceForGroupMembers_L()
+    {
+    EUNIT_PRINT( _L("Error from plug-in in grant presence for group members") );    
+
+// INITIALIZE
+
+    BindL();
+
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    MXIMPContext* context = wrapper->GetContext();
+    CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+    // Tell the protocol it should act normally
+    messenger->SetNoError();
+
+    // Get the interfaces
+    MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+    MPresenceAuthorization& presAuth = presFeat->PresenceAuthorization();
+
+    CXIMPIdentityImp* identity = XIMPTestPresenceDataUtils::GenerateIdentityLC( &KNullDesC8 );
+    CPresenceInfoFilterImp* pif =
+                XIMPTestPresenceDataUtils::GenerateInfoFilterLC( &KPrefix1 );
+
+// GRANT
+
+    messenger->SetLeave( KErrAbort );
+
+    // Setup status event listener for RequestComplete
+    SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_PresentitySubscribeFailKErrAbort );
+
+    // register interest
+    TXIMPRequestId reqId = presAuth.GrantPresenceForPresentityGroupMembersL( *identity, *pif );
+
+    // Wait for events on the request
+    wrapper->WaitRequestAndStackEvents( reqId );
+    // verify that UpdateInterest was called
+    COMMONASSERT( messenger, EXIMPPlgTestGrantPresenceForPresentityGroupMembersCalled, 
+                        "GrantPresenceForPresentityGroupMembersL was not called", EFalse, 
+                        "GrantPresenceForPresentityGroupMembersL was called" );
+
+    messenger->SetLeave( KErrNone );
+
+// DEINITIALIZE
+
+    CleanupStack::PopAndDestroy( 2, identity ); //pif, identity
+    UnbindL();
+    }
+
+// ==============================================================================================
+
+void T_PresenceAuthorization::T_ErrFromPlg_LeaveOnWithdrawPresenceFromGroupMembers_L()
+    {
+    EUNIT_PRINT( _L("Error from plug-in in withdraw presence from group members") );    
+
+// INITIALIZE
+
+    BindL();
+
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    MXIMPContext* context = wrapper->GetContext();
+    CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+    // Tell the protocol it should act normally
+    messenger->SetNoError();
+
+    // Get the interfaces
+    MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+    MPresenceAuthorization& presAuth = presFeat->PresenceAuthorization();
+
+    CXIMPIdentityImp* identity = XIMPTestPresenceDataUtils::GenerateIdentityLC( &KNullDesC8 );
+    CPresenceInfoFilterImp* pif =
+                XIMPTestPresenceDataUtils::GenerateInfoFilterLC( &KPrefix1 );
+
+// GRANT
+
+    // Setup status event listener for RequestComplete
+    SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk );
+
+    // register interest
+    TXIMPRequestId reqId = presAuth.GrantPresenceForPresentityGroupMembersL( *identity, *pif );
+
+    // Wait for events on the request
+    wrapper->WaitRequestAndStackEvents( reqId );
+    // verify that UpdateInterest was called
+    COMMONASSERT( messenger, EXIMPPlgTestGrantPresenceForPresentityGroupMembersCalled, 
+                        "GrantPresenceForPresentityGroupMembersL was not called", ETrue, 
+                        "GrantPresenceForPresentityGroupMembersL was called" );
+
+// WITHDRAW
+
+    messenger->SetLeave( KErrAbort );
+
+    SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_PresentitySubscribeFailKErrAbort );
+    // register interest
+    reqId = presAuth.WithdrawPresenceGrantFromPresentityGroupMembersL( *identity );
+
+    // Wait for events on the request
+    wrapper->WaitRequestAndStackEvents( reqId );
+    wrapper->VerifyEventStackL( _L8("Grantin presence to presentity, complete with error: ") );
+    // verify that UpdateInterest was called
+    COMMONASSERT( messenger, EXIMPPlgTestWithdrawPresenceFromPresentityGroupMembersCalled, 
+                        "WithdrawPresenceGrantFromPresentityGroupMembersL was not called", EFalse, 
+                        "WithdrawPresenceGrantFromPresentityGroupMembersL was called" );
+
+    messenger->SetLeave( KErrNone );
+
+// DEINITIALIZE
+
+    CleanupStack::PopAndDestroy( 2, identity ); //pif, identity
+    UnbindL();
+    }
+
+// ==============================================================================================
+
+// To Everyone, empty filter
+void T_PresenceAuthorization::T_GrantPresenceForEveryone_L()
+    {
+    EUNIT_PRINT( _L("Grant presence for everyone") );
+
+    BindL();
+
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    MXIMPContext* context = wrapper->GetContext();
+    CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+    // Tell the protocol it should act normally
+    messenger->SetNoError();
+
+    // Get the interfaces
+    MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+    MPresenceAuthorization& presAuth = presFeat->PresenceAuthorization();
+
+    CPresenceInfoFilterImp* pif = XIMPTestPresenceDataUtils::GenerateInfoFilterLC( &KPrefix1 );
+
+// GRANT
+
+    // Setup status event listener for RequestComplete
+    SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk );
+
+    TXIMPRequestId reqId = presAuth.GrantPresenceForEveryoneL( *pif );
+
+    // Wait for events on the request
+    wrapper->WaitRequestAndStackEvents( reqId );
+    // verify that UpdateInterest was called
+    COMMONASSERT( messenger, EXIMPPlgTestGrantPresenceForEveryoneCalled, "GrantPresenceForEveryoneL was not called", ETrue, NULL );
+
+// GRANT AGAIN
+
+    // Setup status event listener for RequestComplete
+    SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk );
+    messenger->SetValueFor( EXIMPPlgTestGrantPresenceForEveryoneCalled, 0 );    
+
+    reqId = presAuth.GrantPresenceForEveryoneL( *pif );
+
+    // Wait for events on the request
+    wrapper->WaitRequestAndStackEvents( reqId );
+    // verify that UpdateInterest was called
+    COMMONASSERT( messenger, EXIMPPlgTestGrantPresenceForEveryoneCalled, "GrantPresenceForEveryoneL was not called", EFalse, "GrantPresenceForEveryoneL was called" );
+
+// WITHDRAW
+
+    SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk );
+    // register interest
+    reqId = presAuth.WithdrawPresenceGrantFromEveryoneL();
+
+    // Wait for events on the request
+    wrapper->WaitRequestAndStackEvents( reqId );
+    wrapper->VerifyEventStackL( _L8("Granting presence to everyone, complete with error: ") );
+    // verify that UpdateInterest was called
+    COMMONASSERT( messenger, EXIMPPlgTestWithdrawPresenceFromEveryoneCalled, "WithdrawPresenceForEveryoneL was not called", ETrue, NULL );
+
+    CleanupStack::PopAndDestroy( pif ); //pif
+    UnbindL();
+    }    
+    
+// ==============================================================================================
+
+void T_PresenceAuthorization::T_ErrFromPlg_LeaveOnGrantPresenceForEveryone_L()
+    {
+    EUNIT_PRINT( _L("Error from plug-in in grant presence for everyone") );    
+
+// INITIALIZE
+
+    BindL();
+
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    MXIMPContext* context = wrapper->GetContext();
+    CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+    // Tell the protocol it should act normally
+    messenger->SetNoError();
+
+    // Get the interfaces
+    MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+    MPresenceAuthorization& presAuth = presFeat->PresenceAuthorization();
+
+    CPresenceInfoFilterImp* pif =
+                XIMPTestPresenceDataUtils::GenerateInfoFilterLC( &KPrefix1 );
+
+// GRANT
+
+    messenger->SetLeave( KErrAbort );
+
+    // Setup status event listener for RequestComplete
+    SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_PresentitySubscribeFailKErrAbort );
+
+    // register interest
+    TXIMPRequestId reqId = presAuth.GrantPresenceForEveryoneL( *pif );
+
+    // Wait for events on the request
+    wrapper->WaitRequestAndStackEvents( reqId );
+    // verify that UpdateInterest was called
+    COMMONASSERT( messenger, EXIMPPlgTestGrantPresenceForEveryoneCalled, 
+                        "GrantPresenceForEveryoneL was not called", EFalse, 
+                        "GrantPresenceForEveryoneL was called" );
+
+    messenger->SetLeave( KErrNone );
+
+// DEINITIALIZE
+
+    CleanupStack::PopAndDestroy( pif ); //pif
+    UnbindL();
+    }
+
+// ==============================================================================================
+
+void T_PresenceAuthorization::T_GrantPresenceForEveryone_Multiple_L()
+    {
+    EUNIT_PRINT( _L("Grant presence for presentity multiple clients") );
+
+    BindAllL();
+
+    CPresenceInfoFilterImp* pif =
+                XIMPTestPresenceDataUtils::GenerateInfoFilterLC( &KPrefix1 );
+
+// GRANT
+
+    TInt countOfWrappers = iWrapperMgr->WrapperCount();
+    TInt a(0);
+    for( a = 0; a < countOfWrappers; ++a )
+        {
+        CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a );
+        MXIMPContext* context = wrapper->GetContext();
+        CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+        // Tell the protocol it should act normally
+        messenger->SetNoError();
+
+        // Get the interfaces
+        MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+        MPresenceAuthorization& presAuth = presFeat->PresenceAuthorization();
+
+        // Setup status event listener for RequestComplete
+        SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk );
+
+        // register interest
+        TXIMPRequestId reqId = presAuth.GrantPresenceForEveryoneL( *pif );
+
+        // Wait for events on the request
+        wrapper->WaitRequestAndStackEvents( reqId );
+        // verify that UpdateInterest was called
+        COMMONASSERT( messenger, EXIMPPlgTestGrantPresenceForEveryoneCalled, 
+            "GrantPresenceForEveryoneL was not called",
+            ( a == 0 ) ? ETrue : EFalse,
+            "GrantPresenceForEveryoneL was called" );
+        }
+        
+// GRANT AGAIN        
+
+    for( a = 0; a < countOfWrappers; ++a )
+        {
+        CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a );
+        MXIMPContext* context = wrapper->GetContext();
+        CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+        // Tell the protocol it should act normally
+        messenger->SetNoError();
+
+        // Get the interfaces
+        MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+        MPresenceAuthorization& presAuth = presFeat->PresenceAuthorization();
+
+        // Setup status event listener for RequestComplete
+        SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk );
+        messenger->SetValueFor( EXIMPPlgTestGrantPresenceForEveryoneCalled, 0 );
+
+
+        // register interest
+        TXIMPRequestId reqId = presAuth.GrantPresenceForEveryoneL( *pif );
+
+        // Wait for events on the request
+        wrapper->WaitRequestAndStackEvents( reqId );
+        // verify that UpdateInterest was called
+        COMMONASSERT( messenger, EXIMPPlgTestGrantPresenceForEveryoneCalled, 
+            "GrantPresenceForEveryoneL was not called", EFalse,
+            "GrantPresenceForEveryoneL was called" );
+        }
+
+        
+// WITHDRAW
+        
+    for( a = 0; a < countOfWrappers; ++a )
+        {
+        CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a );
+        MXIMPContext* context = wrapper->GetContext();
+        CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+        
+    // Get the interfaces
+    MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+    MPresenceAuthorization& presAuth = presFeat->PresenceAuthorization();
+
+        // Setup status event listener for RequestComplete
+        SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); // allow events after reqcomplete
+
+        // register interest
+        TXIMPRequestId reqId = presAuth.WithdrawPresenceGrantFromEveryoneL();
+
+        // Wait for events on the request
+        wrapper->WaitRequestAndStackEvents( reqId );
+        wrapper->VerifyEventStackL( _L8("Subscribing presentity presence, complete with error: ") );
+        // verify that UpdateInterest was called
+        COMMONASSERT( messenger, EXIMPPlgTestWithdrawPresenceFromEveryoneCalled, 
+            "WithdrawPresenceGrantFromEveryoneL was not called",
+            ( a < 2 ) ? EFalse : ETrue,
+            "WithdrawPresenceGrantFromEveryoneL was called" );
+        }
+    
+    CleanupStack::PopAndDestroy( pif );
+        
+    UnbindAllL();    
+    }
+
+
+// ==============================================================================================
+
+void T_PresenceAuthorization::T_ErrFromPlg_LeaveOnWithdrawPresenceFromEveryone_L()
+    {
+    EUNIT_PRINT( _L("Error from plug-in in withdraw presence from everyone") );    
+
+// INITIALIZE
+
+    BindL();
+
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    MXIMPContext* context = wrapper->GetContext();
+    CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+    // Tell the protocol it should act normally
+    messenger->SetNoError();
+
+    // Get the interfaces
+    MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+    MPresenceAuthorization& presAuth = presFeat->PresenceAuthorization();
+
+    CPresenceInfoFilterImp* pif =
+                XIMPTestPresenceDataUtils::GenerateInfoFilterLC( &KPrefix1 );
+
+// GRANT
+
+    // Setup status event listener for RequestComplete
+    SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk );
+
+    // register interest
+    TXIMPRequestId reqId = presAuth.GrantPresenceForEveryoneL( *pif );
+
+    // Wait for events on the request
+    wrapper->WaitRequestAndStackEvents( reqId );
+    // verify that UpdateInterest was called
+    COMMONASSERT( messenger, EXIMPPlgTestGrantPresenceForEveryoneCalled, 
+                        "GrantPresenceForEveryoneL was not called", ETrue, 
+                        "GrantPresenceForEveryoneL was called" );
+
+// WITHDRAW
+
+    messenger->SetLeave( KErrAbort );
+
+    SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_PresentitySubscribeFailKErrAbort );
+    // register interest
+    reqId = presAuth.WithdrawPresenceGrantFromEveryoneL();
+
+    // Wait for events on the request
+    wrapper->WaitRequestAndStackEvents( reqId );
+    wrapper->VerifyEventStackL( _L8("Grantin presence to presentity, complete with error: ") );
+    // verify that UpdateInterest was called
+    COMMONASSERT( messenger, EXIMPPlgTestWithdrawPresenceFromPresentityCalled, 
+                        "WithdrawPresenceGrantFromEveryoneL was not called", EFalse, 
+                        "WithdrawPresenceGrantFromEveryoneL was called" );
+
+    messenger->SetLeave( KErrNone );
+
+// DEINITIALIZE
+
+    CleanupStack::PopAndDestroy( pif ); //pif
+    UnbindL();
+    }
+    
+    
+
+// ==============================================================================================
+
+void T_PresenceAuthorization::T_GrantPresenceForGroupMembers_L()
+    {
+    EUNIT_PRINT( _L("Grant presence for presentity group members") );
+
+    BindL();
+
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    MXIMPContext* context = wrapper->GetContext();
+    CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+    // Tell the protocol it should act normally
+    messenger->SetNoError();
+
+    // Get the interfaces
+    MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+    MPresenceAuthorization& presAuth = presFeat->PresenceAuthorization();
+
+    CXIMPIdentityImp* identity = XIMPTestPresenceDataUtils::GenerateIdentityLC( &KNullDesC8 );
+    CPresenceInfoFilterImp* pif =
+                XIMPTestPresenceDataUtils::GenerateInfoFilterLC( &KPrefix1 );
+
+// GRANT
+
+    // Setup status event listener for RequestComplete
+    SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk );
+
+    // register interest
+    TXIMPRequestId reqId = presAuth.GrantPresenceForPresentityGroupMembersL( *identity, *pif );
+
+    // Wait for events on the request
+    wrapper->WaitRequestAndStackEvents( reqId );
+    // verify that UpdateInterest was called
+    COMMONASSERT( messenger, EXIMPPlgTestGrantPresenceForPresentityGroupMembersCalled, "GrantPresenceForPresentityGroupMembers was not called", ETrue, NULL );
+
+    // Setup status event listener for RequestComplete
+    SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); // allow events after reqcomplete
+
+// GRANT AGAIN
+
+    // Setup status event listener for RequestComplete
+    SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk );
+    messenger->SetValueFor( EXIMPPlgTestGrantPresenceForPresentityGroupMembersCalled, 0 );
+     
+    reqId = presAuth.GrantPresenceForPresentityGroupMembersL( *identity, *pif );
+
+    // Wait for events on the request
+    wrapper->WaitRequestAndStackEvents( reqId );
+    // verify that UpdateInterest was called
+    COMMONASSERT( messenger, EXIMPPlgTestGrantPresenceForPresentityGroupMembersCalled, "GrantPresenceForPresentityGroupMembers was not called", EFalse, "GrantPresenceForPresentityGroupMembers was called" );
+
+    // Setup status event listener for RequestComplete
+    SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); // allow events after reqcomplete
+
+// WITHDRAW
+    // register interest
+    reqId = presAuth.WithdrawPresenceGrantFromPresentityGroupMembersL( *identity );
+
+    // Wait for events on the request
+    wrapper->WaitRequestAndStackEvents( reqId );
+    wrapper->VerifyEventStackL( _L8("Granting presence for presentity group members complete with error: ") );
+    // verify that UpdateInterest was called
+    COMMONASSERT( messenger, EXIMPPlgTestWithdrawPresenceFromPresentityGroupMembersCalled, "WithdrawPresenceFromPresentityGroupMembers was not called", ETrue, NULL );
+
+    CleanupStack::PopAndDestroy( 2, identity ); //pif, identity
+    UnbindL();
+    }
+
+// ==============================================================================================
+
+void T_PresenceAuthorization::T_GrantPresenceForGroupMembersChangeId_L()
+    {
+    EUNIT_PRINT( _L("Grant presence for presentity group members change id") );
+
+// INITIALIZE
+
+    BindL();
+
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    MXIMPContext* context = wrapper->GetContext();
+    CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+    // Tell the protocol it should act normally
+    messenger->SetNoError();
+
+    // Get the interfaces
+    MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+    MPresenceAuthorization& presAuth = presFeat->PresenceAuthorization();
+
+// ID CHANGE REQUEST TO ADAPTATION
+
+    MXIMPIdentity* identityParam = context->ObjectFactory().NewIdentityLC();
+    identityParam->SetIdentityL( KIdentity );
+    
+    CXIMPIdentityImp* identityParamImp =
+             ( CXIMPIdentityImp* ) identityParam->GetInterface(
+                                        CXIMPIdentityImp::KClassId,
+                                        MXIMPBase::EPanicIfUnknown );
+    HBufC8* packedId = TXIMPObjectPacker< CXIMPIdentityImp >::PackL( *identityParamImp );
+    CleanupStack::PopAndDestroy(); // identityParam
+    CleanupStack::PushL( packedId );
+    CXIMPTestFileSrvMsg* srvMsg = CXIMPTestFileSrvMsg::NewL( CXIMPTestFileSrvMsg::ETestSrvMsgReqParamIdentity, 
+                                                             *packedId );
+    CleanupStack::PopAndDestroy( packedId );
+    CleanupStack::PushL( srvMsg );
+    wrapper->FileTool().SrvMsgStoreL( srvMsg );
+    CleanupStack::PopAndDestroy( srvMsg );
+
+    // Wait for server to handle srvmsg.
+    CXIMPTestWaitHelper* wait = CXIMPTestWaitHelper::NewL();
+    CleanupStack::PushL( wait );
+    wait->WaitForL( 2 );
+    CleanupStack::PopAndDestroy( wait );
+
+// GRANT
+
+    // Setup status event listener for RequestComplete
+    SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk );
+
+    CXIMPIdentityImp* identity = XIMPTestPresenceDataUtils::GenerateIdentityLC( &KNullDesC8 );
+    CPresenceInfoFilterImp* pif =
+                XIMPTestPresenceDataUtils::GenerateInfoFilterLC( &KPrefix1 );
+
+    // register interest
+    TXIMPRequestId reqId = presAuth.GrantPresenceForPresentityGroupMembersL( *identity, *pif );
+
+    // Wait for events on the request
+    wrapper->WaitRequestAndStackEvents( reqId );
+    // verify that UpdateInterest was called
+    COMMONASSERT( messenger, EXIMPPlgTestGrantPresenceForPresentityGroupMembersCalled, "GrantPresenceForPresentityGroupMembers was not called", ETrue, NULL );
+
+// DEINITIALIZE
+
+    CleanupStack::PopAndDestroy( 2, identity ); //pif, identity
+    UnbindL();
+    }
+
+
+// ==============================================================================================
+
+void T_PresenceAuthorization::T_WithdrawNotGrantedPresenceFromEveryone_L()
+    {
+    EUNIT_PRINT( _L("Withdraw presence from everyone not granted") );
+
+// INITIALIZE
+
+    BindL();
+
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    MXIMPContext* context = wrapper->GetContext();
+    CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+    // Tell the protocol it should act normally
+    messenger->SetNoError();
+
+    // Get the interfaces
+    MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+    MPresenceAuthorization& presAuth = presFeat->PresenceAuthorization();
+
+// WITHDRAW
+
+    SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk );
+    // register interest
+    TXIMPRequestId reqId = presAuth.WithdrawPresenceGrantFromEveryoneL();
+
+    // Wait for events on the request
+    wrapper->WaitRequestAndStackEvents( reqId );
+    // Changed for OPAA-73BCS8
+    wrapper->VerifyEventStackL( _L8("Withdraw not granted everyone, complete with error: ") );
+    COMMONASSERT( messenger, EXIMPPlgTestWithdrawPresenceFromEveryoneCalled, 
+                        "WithdrawPresenceGrantFromEveryoneL was not called", ETrue /*EFalse*/, 
+                        "WithdrawPresenceGrantFromEveryoneL was called" );
+
+// DEINITIALIZE
+    UnbindL();
+    }
+
+
+// ==============================================================================================
+
+void T_PresenceAuthorization::T_WithdrawNotGrantedPresenceFromEveryone_Multiple_L()
+    {
+    EUNIT_PRINT( _L("Withdraw presence from everyone not granted multiple clients") );
+
+    BindAllL();
+
+    CPresenceInfoFilterImp* pif =
+                XIMPTestPresenceDataUtils::GenerateInfoFilterLC( &KPrefix1 );
+
+// GRANT ALL BUT FIRST
+
+    TInt countOfWrappers = iWrapperMgr->WrapperCount();
+    TInt a(0);
+    for( a = countOfWrappers - 1; a >= 1; --a )
+        {
+        CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a );
+        MXIMPContext* context = wrapper->GetContext();
+        CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+        // Tell the protocol it should act normally
+        messenger->SetNoError();
+
+        // Get the interfaces
+        MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+        MPresenceAuthorization& presAuth = presFeat->PresenceAuthorization();
+
+        // Setup status event listener for RequestComplete
+        SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk );
+
+        // register interest
+        TXIMPRequestId reqId = presAuth.GrantPresenceForEveryoneL( *pif );
+
+        // Wait for events on the request
+        wrapper->WaitRequestAndStackEvents( reqId );
+        // verify that UpdateInterest was called
+        COMMONASSERT( messenger, EXIMPPlgTestGrantPresenceForEveryoneCalled,
+            "GrantPresenceForEveryoneL was not called",
+            ( a > 1 ) ? ETrue : EFalse,
+            "GrantPresenceForEveryoneL was called" );
+        }
+        
+// WITHDRAW
+        
+    for( a = 0; a < countOfWrappers; ++a )
+        {
+        CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a );
+        MXIMPContext* context = wrapper->GetContext();
+        CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+        
+        // Get the interfaces
+        MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+        MPresenceAuthorization& presAuth = presFeat->PresenceAuthorization();
+
+        // Setup status event listener for RequestComplete
+        SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); // allow events after reqcomplete
+
+        // register interest
+        TXIMPRequestId reqId = presAuth.WithdrawPresenceGrantFromEveryoneL();
+
+        // Wait for events on the request
+        wrapper->WaitRequestAndStackEvents( reqId );
+        wrapper->VerifyEventStackL( _L8("Subscribing presentity presence, complete with error: ") );
+        // verify that UpdateInterest was called
+        // Changed for OPAA-73BCS8
+        COMMONASSERT( messenger, EXIMPPlgTestWithdrawPresenceFromEveryoneCalled, 
+            "WithdrawPresenceGrantFromEveryoneL was not called",
+            ( a < ( countOfWrappers -1 )/*a < 2^*/ ) ? EFalse : ETrue,
+            "WithdrawPresenceGrantFromEveryoneL was called" );
+        }
+    
+    CleanupStack::PopAndDestroy( pif );
+        
+    UnbindAllL();    
+    }
+
+
+// ==============================================================================================
+void T_PresenceAuthorization::T_MakeAndGrantGroup_WithdrawOneID_L()
+    {
+    EUNIT_PRINT( _L("T_MakeAndGrantGroup_WithdrawOneID_L") );
+
+    BindL();
+
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    MXIMPContext* context = wrapper->GetContext();
+    CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+    // Tell the protocol it should act normally
+    messenger->SetNoError();
+            
+    // Get the interfaces
+    MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+    MPresenceAuthorization& presAuth = presFeat->PresenceAuthorization();
+    MPresentityGroups& presGroup = presFeat->PresentityGroups();
+    
+    
+    // CREATE PRESENTITY GROUP
+    
+    // Setup status event listener for RequestComplete
+    // This will also produce HandlePresentityGroupListEvent, since the
+    // the group is subscribed
+    SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk );
+
+
+    MXIMPIdentity* groupId = context->ObjectFactory().NewIdentityLC();
+    CleanupStack::Pop(); // groupId
+    groupId->SetIdentityL( KGroupId );
+    
+    // subscribe
+    TXIMPRequestId reqId;
+    reqId = presGroup.CreatePresentityGroupL( *groupId, KGroupDisplayName );
+    
+    // Wait for events on the request
+    wrapper->WaitRequestAndStackEvents( reqId );
+    wrapper->VerifyEventStackL( _L8("CreatePresentityGroupL failed, complete with error: ") );
+    
+    // verify that SubscribePresentityGroupListL was called
+    messenger->AssertCreatePresentityGroupCalled( ETrue );
+
+    
+    // ADD PRESENTITY GROUP MEMBER 1
+    
+    CXIMPTestListener* listener4 = CXIMPTestListener::NewL( context );
+    CleanupStack::PushL( listener4 );    // << listener4
+    
+    MXIMPIdentity* member = context->ObjectFactory().NewIdentityLC(); // << member
+    member->SetIdentityL( KIdentity1_16 );
+
+
+    // request complete
+    TXIMPRequestId reqIdDummy;
+    CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+
+    // group id
+    CXIMPIdentityImp* identity2 = CXIMPIdentityImp::NewLC( groupId->Identity() );
+    evReqComplete->AppendParamL( identity2 );
+    CleanupStack::Pop(identity2); // identity2
+
+    // id for member info
+    CXIMPIdentityImp* miId = CXIMPIdentityImp::NewLC( KIdentity1_16 );
+    // member info
+    CPresentityGroupMemberInfoImp* memInfoImp =
+        CPresentityGroupMemberInfoImp::NewLC( *miId, KIdentity1_16 );
+    evReqComplete->AppendParamL( memInfoImp );
+    CleanupStack::Pop(memInfoImp); // memInfoImp owned by AppendParamL
+    CleanupStack::PopAndDestroy( miId ); // copy was made
+
+    listener4->ExpectL( evReqComplete );
+    CleanupStack::Pop( evReqComplete );
+
+    // do the call
+    reqId = presGroup.AddPresentityGroupMemberL(
+            *groupId, *member, KIdentity1_16 );
+
+    // and wait
+    EUNIT_ASSERT_DESC( KErrNone == listener4->WaitAndAssertL(), "AddPresentityGroupMemberL (not subscribed) failed" );
+
+    messenger->AssertAddPresentityGroupMemberCalled( ETrue );
+    CleanupStack::PopAndDestroy(); // >>> member
+    CleanupStack::PopAndDestroy( listener4 );// >>> listener4
+    
+    // ADD PRESENTITY GROUP MEMBER 2
+    
+    listener4 = CXIMPTestListener::NewL( context );
+    CleanupStack::PushL( listener4 );    // << listener4
+    
+    member = context->ObjectFactory().NewIdentityLC(); // << member
+    member->SetIdentityL( KIdentity2_16 );
+
+
+    // request complete
+    evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+
+    // group id
+    //delete identity2;
+    identity2 = CXIMPIdentityImp::NewLC( groupId->Identity() );
+    evReqComplete->AppendParamL( identity2 );
+    CleanupStack::Pop(identity2); // identity2
+
+    // id for member info
+    miId = CXIMPIdentityImp::NewLC( KIdentity2_16 );
+    // member info
+    memInfoImp = CPresentityGroupMemberInfoImp::NewLC( *miId, KIdentity2_16 );
+    evReqComplete->AppendParamL( memInfoImp );
+    CleanupStack::Pop(memInfoImp); // memInfoImp owned by AppendParamL
+    CleanupStack::PopAndDestroy( miId ); // copy was made
+
+    listener4->ExpectL( evReqComplete );
+    CleanupStack::Pop( evReqComplete );
+
+    // do the call
+    reqId = presGroup.AddPresentityGroupMemberL( *groupId, *member, KIdentity2_16 );
+
+    // and wait
+    EUNIT_ASSERT_DESC( KErrNone == listener4->WaitAndAssertL(), "AddPresentityGroupMemberL (not subscribed) failed" );
+
+    messenger->AssertAddPresentityGroupMemberCalled( ETrue );
+    CleanupStack::PopAndDestroy(); // >>> member
+    CleanupStack::PopAndDestroy( listener4 );// >>> listener4
+
+    // ADD PRESENTITY GROUP MEMBER 3
+    
+    //delete identity2;
+    listener4 = CXIMPTestListener::NewL( context );
+    CleanupStack::PushL( listener4 );    // << listener4
+    
+    member = context->ObjectFactory().NewIdentityLC(); // << member
+    member->SetIdentityL( KIdentity3_16 );
+
+
+    // request complete
+    evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+
+    // group id
+    identity2 = CXIMPIdentityImp::NewLC( groupId->Identity() );
+    evReqComplete->AppendParamL( identity2 );
+    CleanupStack::Pop(identity2); // identity2
+
+    // id for member info
+    miId = CXIMPIdentityImp::NewLC( KIdentity3_16 );
+    // member info
+    memInfoImp = CPresentityGroupMemberInfoImp::NewLC( *miId, KIdentity3_16 );
+    evReqComplete->AppendParamL( memInfoImp );
+    CleanupStack::Pop(memInfoImp); // memInfoImp owned by AppendParamL
+    CleanupStack::PopAndDestroy( miId ); // copy was made
+
+    listener4->ExpectL( evReqComplete );
+    CleanupStack::Pop( evReqComplete );
+
+    // do the call
+    reqId = presGroup.AddPresentityGroupMemberL(
+            *groupId, *member, KIdentity3_16 );
+
+    // and wait
+    EUNIT_ASSERT_DESC( KErrNone == listener4->WaitAndAssertL(), "AddPresentityGroupMemberL (not subscribed) failed" );
+
+    messenger->AssertAddPresentityGroupMemberCalled( ETrue );
+    CleanupStack::PopAndDestroy(); // >>> member
+    CleanupStack::PopAndDestroy( listener4 );// >>> listener4
+
+
+    // GRANT PRESENTITY GROUP MEMBER
+
+    // This is the group we are interested in
+    MXIMPIdentity* ggroup = context->ObjectFactory().NewIdentityLC();
+    CleanupStack::Pop(); // ggroup
+    ggroup->SetIdentityL( KGroupId );
+    // Set filter for the group
+    CPresenceInfoFilterImp* ggpif = CPresenceInfoFilterImp::NewLC();
+    //ggpif->AcceptPersonFilterL( NPresenceInfo::NFieldType::KAcceptAll  );
+    CleanupStack::Pop(ggpif); // ggpif
+
+    // Setup status event listener for RequestComplete
+    SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk );
+
+    // grant for all
+    reqId = presAuth.GrantPresenceForPresentityGroupMembersL( *ggroup, *ggpif );
+
+    // Wait for events on the request
+    wrapper->WaitRequestAndStackEvents( reqId );
+    
+    // verify that UpdateInterest was called
+    COMMONASSERT( messenger, EXIMPPlgTestGrantPresenceForPresentityGroupMembersCalled, 
+        "GrantPresenceForPresentityGroupMembersL was not called", ETrue, NULL );
+    delete ggroup;
+    delete ggpif;
+
+
+    // Withdraw one of group's member's ID
+    
+    MXIMPIdentity* identity = context->ObjectFactory().NewIdentityLC();
+    identity->SetIdentityL( KIdentity2_16 ); // << identity
+
+    
+    SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk );
+    // register interest
+    reqId = presAuth.WithdrawPresenceGrantFromPresentityL( *identity );
+
+    // Wait for events on the request
+    wrapper->WaitRequestAndStackEvents( reqId );
+    wrapper->VerifyEventStackL( _L8("Grantin presence to presentity, complete with error: ") );
+    
+    // Changed for OPAA-73BCS8
+    // verify that UpdateInterest was called
+    COMMONASSERT( messenger, EXIMPPlgTestWithdrawPresenceFromPresentityCalled, 
+                        "WithdrawPresenceForPresentityL was not called", ETrue/*EFalse*/, 
+                        "WithdrawPresenceForPresentityL was called" );
+                            
+    CleanupStack::PopAndDestroy(); // identity
+    delete groupId;
+
+    UnbindL();
+    
+    wrapper = NULL;
+    context = NULL;
+    messenger = NULL;
+    }
+
+
+// ===========================================================================
+// SETUP HELPERS FOR THE LISTENER
+// ===========================================================================
+//
+void T_PresenceAuthorization::SetupListenerReqCompleteL( CXIMPTestContextWrapper* aWrapper, TXIMPTestStatusEventTemplate aEventType )
+    {
+    RArray< TInt32 > array;
+    CleanupClosePushL( array );
+    array.Append( MXIMPContextStateEvent::KInterfaceId );
+    array.Append( MPresentityPresenceEvent::KInterfaceId );
+    aWrapper->SetupListenerReqCompleteL( aEventType, &array );
+    CleanupStack::PopAndDestroy(); // array
+    }
+
+void T_PresenceAuthorization::SetupListenerReqCompleteAllowEventsL(  CXIMPTestContextWrapper* aWrapper, TXIMPTestStatusEventTemplate aEventType )
+    {
+    RArray< TInt32 > array;
+    CleanupClosePushL( array );
+    array.AppendL( MXIMPRequestCompleteEvent::KInterfaceId );
+    array.AppendL( MXIMPContextStateEvent::KInterfaceId );
+    array.AppendL( MPresentityPresenceEvent::KInterfaceId );
+    aWrapper->SetupListenerReqCompleteL( aEventType, &array );
+    CleanupStack::PopAndDestroy(); // array
+    }
+
+// ===========================================================================
+// TEST CASE TABLE
+// ===========================================================================
+//
+EUNIT_BEGIN_TEST_TABLE(
+        T_PresenceAuthorization,
+        "XIMP presence authorization tests",
+        "MODULE" )
+
+PRFW_DECORATED_TEST(
+        "Grant presence for presentity",
+        "",
+        "",
+        "FUNCTIONALITY",
+        Setup_L,
+        T_GrantPresenceForPresentity_L,
+        Teardown )
+
+        
+PRFW_DECORATED_TEST(
+        "MakeAndGrantGroup_WithdrawOneID",
+        "",
+        "",
+        "FUNCTIONALITY",
+        Setup_L,
+        T_MakeAndGrantGroup_WithdrawOneID_L,
+        Teardown )
+        
+        
+PRFW_DECORATED_TEST(
+        "Grant presence for presentity multiple",
+        "",
+        "",
+        "FUNCTIONALITY",
+        SetupMultiple_L,
+        T_GrantPresenceForPresentity_Multiple_L,
+        Teardown )
+
+
+PRFW_DECORATED_TEST(
+        "Withdraw not granted presence for presentity",
+        "",
+        "",
+        "FUNCTIONALITY",
+        Setup_L,
+        T_WithdrawNotGrantedPresenceFromPresentity_L,
+        Teardown )
+
+
+PRFW_DECORATED_TEST(
+        "Grant presence for presentity change id",
+        "",
+        "",
+        "FUNCTIONALITY",
+        Setup_L,
+        T_GrantPresenceForPresentityChangeId_L,
+        Teardown )
+
+PRFW_DECORATED_TEST(
+        "Grant presence for group members change id",
+        "",
+        "",
+        "FUNCTIONALITY",
+        Setup_L,
+        T_GrantPresenceForGroupMembersChangeId_L,
+        Teardown )
+
+
+PRFW_DECORATED_TEST(
+        "Withdraw not granted presence from presentity multiple",
+        "",
+        "",
+        "FUNCTIONALITY",
+        SetupMultiple_L,
+        T_WithdrawNotGrantedPresenceFromPresentity_Multiple_L,
+        Teardown )
+
+PRFW_DECORATED_TEST(
+        "ErrorPlugin - Leave on grant",
+        "",
+        "",
+        "ERRORHANDLING",
+        Setup_L,
+        T_ErrFromPlg_LeaveOnGrantPresenceForPresentity_L,
+        Teardown )
+
+PRFW_DECORATED_TEST(
+        "ErrorPlugin - Leave on withdraw",
+        "",
+        "",
+        "ERRORHANDLING",
+        Setup_L,
+        T_ErrFromPlg_LeaveOnWithdrawPresenceFromPresentity_L,
+        Teardown )
+
+PRFW_DECORATED_TEST(
+        "Withdraw not granted presence for group members",
+        "",
+        "",
+        "FUNCTIONALITY",
+        Setup_L,
+        T_WithdrawNotGrantedPresenceFromGroupMembers_L,
+        Teardown )
+
+PRFW_DECORATED_TEST(
+        "Withdraw not granted presence for group members multiple",
+        "",
+        "",
+        "FUNCTIONALITY",
+        SetupMultiple_L,
+        T_WithdrawNotGrantedPresenceFromGroupMembers_Multiple_L,
+        Teardown )
+
+PRFW_DECORATED_TEST(
+        "Grant presence for group members",
+        "",
+        "",
+        "FUNCTIONALITY",
+        Setup_L,
+        T_GrantPresenceForGroupMembers_L,
+        Teardown )
+
+
+PRFW_DECORATED_TEST(
+        "Grant presence for group members multiple",
+        "",
+        "",
+        "FUNCTIONALITY",
+        SetupMultiple_L,
+        T_GrantPresenceForGroupMembers_Multiple_L,
+        Teardown )
+
+
+PRFW_DECORATED_TEST(
+        "ErrorPlugin - Leave on withdraw for group members",
+        "",
+        "",
+        "ERRORHANDLING",
+        Setup_L,
+        T_ErrFromPlg_LeaveOnGrantPresenceForGroupMembers_L,
+        Teardown )
+
+PRFW_DECORATED_TEST(
+        "ErrorPlugin - Leave on withdraw from group members",
+        "",
+        "",
+        "ERRORHANDLING",
+        Setup_L,
+        T_ErrFromPlg_LeaveOnWithdrawPresenceFromGroupMembers_L,
+        Teardown )
+
+PRFW_DECORATED_TEST(
+        "Grant presence for everyone",
+        "",
+        "",
+        "FUNCTIONALITY",
+        Setup_L,
+        T_GrantPresenceForEveryone_L,
+        Teardown )
+        
+PRFW_DECORATED_TEST(
+        "ErrorPlugin - Leave on grant to everyone",
+        "",
+        "",
+        "ERRORHANDLING",
+        Setup_L,
+        T_ErrFromPlg_LeaveOnGrantPresenceForEveryone_L,
+        Teardown )
+
+PRFW_DECORATED_TEST(
+        "ErrorPlugin - Leave on withdraw from everyone",
+        "",
+        "",
+        "ERRORHANDLING",
+        Setup_L,
+        T_ErrFromPlg_LeaveOnWithdrawPresenceFromEveryone_L,
+        Teardown )
+
+PRFW_DECORATED_TEST(
+        "Grant presence for everyone multiple ",
+        "",
+        "",
+        "FUNCTIONALITY",
+        SetupMultiple_L,
+        T_GrantPresenceForEveryone_Multiple_L,
+        Teardown )
+
+PRFW_DECORATED_TEST(
+        "Withdraw not granted presence from everyone",
+        "",
+        "",
+        "FUNCTIONALITY",
+        Setup_L,
+        T_WithdrawNotGrantedPresenceFromEveryone_L,
+        Teardown )
+
+PRFW_DECORATED_TEST(
+        "Withdraw not granted presence from everyone multiple",
+        "",
+        "",
+        "FUNCTIONALITY",
+        SetupMultiple_L,
+        T_WithdrawNotGrantedPresenceFromEveryone_Multiple_L,
+        Teardown )
+        
+
+EUNIT_END_TEST_TABLE
+
+
+// ===========================================================================
+// TEST SUITE CONSTRUCTION
+// ===========================================================================
+//
+EXPORT_C MEUnitTest* CreateTestSuiteL()
+    {
+    return T_PresenceAuthorization::NewL();
+    }
+
+
+
+// end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_presenceauthorization/t_presenceauthorization.h	Wed Nov 03 09:32:20 2010 +0530
@@ -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:
+*
+*/
+
+#ifndef T_PRESENCEAUTHORIZATION_H
+#define T_PRESENCEAUTHORIZATION_H
+
+
+//  EXTERNAL INCLUDES
+#include <platform/digia/eunit/ceunittestsuiteclass.h>
+#include <platform/digia/eunit/EUnitDecorators.h>
+
+#include <ximpbase.h>
+#include "prfwteststatuseventlistener.h"
+#include "prfwtestmessaging.h"
+
+class CXIMPTestContextWrapper;
+class CXIMPTestContextWrapperMgr;
+class CXIMPTestMessenger;
+
+/**
+ * XIMP Framework Eunit tests.
+ *
+ * Tests for XIMP session management services.
+ *
+ * @since S60 v4.0
+ */
+class T_PresenceAuthorization : public CEUnitTestSuiteClass
+    {
+
+public:
+    static T_PresenceAuthorization* NewL();
+    virtual ~T_PresenceAuthorization();
+
+
+private:
+    T_PresenceAuthorization();
+    void ConstructL();
+
+private:    // Test case functions
+
+    void Setup_L();
+    void SetupMultiple_L();
+    void BindL();
+    void BindAllL();
+    void Teardown();
+    void UnbindL();
+    void UnbindAllL();
+
+    void T_GrantPresenceForPresentity_L();
+    void T_GrantPresenceForPresentityChangeId_L();
+    void T_WithdrawNotGrantedPresenceFromPresentity_L();
+    void T_ErrFromPlg_LeaveOnGrantPresenceForPresentity_L();
+    void T_ErrFromPlg_LeaveOnWithdrawPresenceFromPresentity_L();
+
+    void T_GrantPresenceForPresentity_Multiple_L();
+    void T_WithdrawNotGrantedPresenceFromPresentity_Multiple_L();
+    
+    void T_GrantPresenceForGroupMembers_L();
+    void T_GrantPresenceForGroupMembersChangeId_L();
+    void T_ErrFromPlg_LeaveOnGrantPresenceForGroupMembers_L();
+    void T_ErrFromPlg_LeaveOnWithdrawPresenceFromGroupMembers_L();
+
+    void T_GrantPresenceForGroupMembers_Multiple_L();
+    void T_WithdrawNotGrantedPresenceFromGroupMembers_L();
+    void T_WithdrawNotGrantedPresenceFromGroupMembers_Multiple_L();
+
+    void T_GrantPresenceForEveryone_L();
+    void T_ErrFromPlg_LeaveOnGrantPresenceForEveryone_L();
+    void T_ErrFromPlg_LeaveOnWithdrawPresenceFromEveryone_L();
+
+    void T_GrantPresenceForEveryone_Multiple_L();
+    void T_WithdrawNotGrantedPresenceFromEveryone_L();
+    void T_WithdrawNotGrantedPresenceFromEveryone_Multiple_L();
+
+    void T_MakeAndGrantGroup_WithdrawOneID_L();
+
+private:    // Test helpers
+
+    void SetupListenerReqCompleteL( CXIMPTestContextWrapper* aWrapper, TXIMPTestStatusEventTemplate aEventType );
+    void SetupListenerReqCompleteAllowEventsL( CXIMPTestContextWrapper* aWrapper, TXIMPTestStatusEventTemplate aEventTypes );
+
+private: // Test data
+
+    /**
+     * Eunit test case table declaration.
+     */
+    EUNIT_DECLARE_TEST_TABLE;
+
+    // owned
+    CXIMPTestContextWrapperMgr* iWrapperMgr;
+    };
+
+
+#endif      //  T_PRESENCEAUTHORIZATION_H
+
+
+
+// end of file
+
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_presenceauthorization/t_presenceauthorization.mmp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,74 @@
+/*
+* 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:
+*
+*/
+
+#include            "../../tsrcutils/eunitcommon/eunittstdllbase.hrh"
+#include            "../../tsrcutils/processmaster/pm.h"
+
+#include<platform_paths.hrh>
+#include<eunitcaps.h>
+
+TARGET              t_presenceauthorization.dll
+//CAPABILITY              ALL - TCB - DRM
+CAPABILITY      EUNIT_CAPS
+
+SOURCEPATH          .
+SOURCE              t_presenceauthorization.cpp
+
+
+USERINCLUDE             ../../../../../ximpfw/core/srcdatamodel
+USERINCLUDE             ../../../../../ximpfw/presence/srcpresencedatamodel
+USERINCLUDE             ../../../../../ximpfw/presence/srcpresencedatamodel/presentitygroups
+USERINCLUDE             ../../../../../ximpfw/presence/srcpresencedatamodel/presencewatching
+USERINCLUDE             ../../../../../ximpfw/presence/srcpresencedatamodel/presenceauthorization
+USERINCLUDE             ../../../../../ximpfw/presence/srcpresencedatamodel/presencepublishing
+USERINCLUDE             ../../../../../ximpfw/presence/srcpresencedatamodel/presenceinfo
+USERINCLUDE             ../../../../../ximpfw/core/srcutils
+
+// TODO remove unnecessary
+#if defined ( OS_LAYER_SYSTEMINCLUDE )
+OS_LAYER_SYSTEMINCLUDE
+#else
+SYSTEMINCLUDE     /epoc32/include
+#endif
+
+ #if defined ( APP_LAYER_SYSTEMINCLUDE )
+ APP_LAYER_SYSTEMINCLUDE
+ #else
+ SYSTEMINCLUDE     \epoc32\include
+ #endif
+SYSTEMINCLUDE           ../../../../../ximpfw/inc/core/base
+SYSTEMINCLUDE           ../../../../../ximpfw/inc/core/datamodel
+SYSTEMINCLUDE           ../../../../../ximpfw/inc/core/protocolplugin
+SYSTEMINCLUDE           ../../../../../ximpfw/inc/core/protocolpluginhost
+SYSTEMINCLUDE           ../../../../../ximpfw/inc/presence/presencedatamodel
+SYSTEMINCLUDE           ../../../../../ximpfw/inc/presence/presencemanagement
+SYSTEMINCLUDE           ../../../../../ximpfw/inc/presence/presenceprotocolplugin
+SYSTEMINCLUDE           ../../../../../ximpfw/inc/presence/presenceprotocolpluginhost
+
+LIBRARY             ecom.lib
+LIBRARY             bafl.lib
+LIBRARY             ximpdatamodel.lib
+LIBRARY             presencedatamodel.lib
+LIBRARY             estor.lib
+LIBRARY             ximputils.lib
+LIBRARY             eunit.lib
+LIBRARY             eunitutil.lib
+LIBRARY             euser.lib
+
+// end of file
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_presenceblocking/bld.inf	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,23 @@
+/*
+* 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 t_presenceblocking.dll
+*
+*/
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_TESTMMPFILES
+t_presenceblocking.mmp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_presenceblocking/t_presenceblocking.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,1283 @@
+/*
+* 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:
+*
+*/
+
+
+#include "eunittools.h"
+
+//#include <eunitmacros.h>
+#include <platform/digia/eunit/eunitmacros.h>
+#include <platform/digia/eunit/teunitassertioninfo.h>
+
+#include <ecom/ecom.h>
+#include <badesca.h>
+
+
+#include <presencefeatures.h>
+#include <presenceauthorization.h>
+#include <presenceblocklistevent.h>
+#include <presenceblockinfo.h>
+
+
+#include <ximpclient.h>
+#include <ximpcontext.h>
+#include <presencefeatures.h>
+
+#include "t_presenceblocking.h"
+
+// blocking includes
+#include "presenceblockinfoimp.h"
+#include "presenceblocklisteventimp.h"
+
+// other datamodel and utils includes
+#include "ximpidentityimp.h"
+#include "ximpobjecthelpers.h"
+
+
+// testing tool includes
+#include "prfwtestpresencedatautils.h"
+
+#include "prfwtestmessaging.h"
+#include "prfwtestmessenger.h"
+#include "prfwtestcontextwrappermgr.h"
+#include "prfwtestcontextwrapper.h"
+
+
+#include "prfwtestfilesrvmsg.h"
+#include "prfwtestfiletool.h"
+#include "prfwtestlistener.h"
+#include "ximprequestcompleteeventimp.h"
+
+#include "prfwtestrobustnesstools.h"
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// CONSTRUCTION
+T_PresenceBlocking* T_PresenceBlocking::NewL()
+    {
+    T_PresenceBlocking* self = new( ELeave ) T_PresenceBlocking;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+
+    return self;
+    }
+
+
+T_PresenceBlocking::~T_PresenceBlocking()
+    {
+    PrfwTestRobustness::DoPreCleaning();
+    }
+
+
+void T_PresenceBlocking::ConstructL()
+    {
+    CEUnitTestSuiteClass::ConstructL();
+    }
+
+
+T_PresenceBlocking::T_PresenceBlocking()
+    {
+    }
+
+
+
+// ===========================================================================
+// TEST CASE SETUP & TEARDOWN METHODS
+// ===========================================================================
+//
+
+void T_PresenceBlocking::Setup_L()
+    {
+    PrfwTestRobustness::DoPreCleaning();
+
+    iWrapperMgr = CXIMPTestContextWrapperMgr::NewL();
+    iWrapperMgr->CreateWrapperL();
+    }
+
+void T_PresenceBlocking::SetupMultiple_L()
+    {
+    PrfwTestRobustness::DoPreCleaning();
+
+    iWrapperMgr = CXIMPTestContextWrapperMgr::NewL();
+    iWrapperMgr->CreateWrapperL();
+    iWrapperMgr->CreateWrapperL();
+    iWrapperMgr->CreateWrapperL();
+    }
+
+
+void T_PresenceBlocking::BindL()
+    {
+    CXIMPTestContextWrapper* wrapper0 = iWrapperMgr->GetWrapperL( 0 );
+
+    wrapper0->BindL( 0 );
+    }
+
+void T_PresenceBlocking::BindAllL()
+    {
+    for( TInt a = 0; a < iWrapperMgr->WrapperCount(); ++a )
+        {
+        CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a );
+        wrapper->BindL( 0 );
+        }
+    }
+
+
+void T_PresenceBlocking::Teardown()
+    {
+    delete iWrapperMgr;
+    iWrapperMgr = NULL;
+    
+    REComSession::FinalClose();
+
+    PrfwTestRobustness::DoPreCleaning();
+    }
+
+void T_PresenceBlocking::UnbindL()
+    {
+    // Do unbind
+    CXIMPTestContextWrapper* wrapper0 = iWrapperMgr->GetWrapperL( 0 );
+    wrapper0->UnbindL();
+    }
+
+void T_PresenceBlocking::UnbindAllL()
+    {
+    for( TInt a = 0; a < iWrapperMgr->WrapperCount(); ++a )
+        {
+        CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a );
+        wrapper->UnbindL();
+        }
+    }
+
+
+// ===========================================================================
+// TEST CASES for presentity presence subscription
+// ===========================================================================
+
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+// Single client, empty filter
+void T_PresenceBlocking::T_SubscribeBlockList_Single_L()
+    {
+    EUNIT_PRINT( _L("Single presence block list subscription") );
+
+    BindL();
+
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    MXIMPContext* context = wrapper->GetContext();
+    CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+    CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context );
+    CleanupStack::PushL( listener2 );
+
+    // Tell the protocol it should act normally
+    messenger->SetNoError();
+
+    // Get the interfaces
+    MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+    
+    MPresenceAuthorization& presAuth = presFeat->PresenceAuthorization();
+
+    // Setup status event listener for RequestComplete
+    // ---------------------------------------------
+    listener2->Reset();
+
+    // normal request complete
+    TXIMPRequestId reqIdDummy;  // not checked
+    CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+    listener2->ExpectL( evReqComplete );
+    CleanupStack::Pop( evReqComplete );
+    // ---------------------------------------------
+
+    // subscribe
+    // ---------------------------------------------
+    TXIMPRequestId reqId = presAuth.SubscribePresenceBlockListL();
+    EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Subscribe failed" );
+    // ---------------------------------------------
+
+    // verify that SubscribeBlockListL was called
+    COMMONASSERT( messenger, EXIMPPlgTestSubscribePresenceBlockListCalled, "SubscribeBlockListL was not called", ETrue, NULL );
+
+    // Setup status event listener for RequestComplete
+    // ---------------------------------------------
+    listener2->Reset();
+
+    evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+    listener2->ExpectL( evReqComplete );
+    CleanupStack::Pop( evReqComplete );
+    // ---------------------------------------------
+
+    // unsubscribe
+    // ---------------------------------------------
+    reqId = presAuth.UnsubscribePresenceBlockListL();
+    EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Unsubscribe failed" );
+    // ---------------------------------------------
+
+    // verify that UnsubscribeBlockListL was called
+    COMMONASSERT( messenger, EXIMPPlgTestUnsubscribePresenceBlockListCalled, "UnsubscribeBlockListL was not called", ETrue, NULL );
+
+    // Deinitiliaze event source from listener.
+    listener2->SetEventSourceL( NULL );
+
+    UnbindL();
+
+    //CleanupStack::Pop(presFeat);
+    //delete presFeat;
+    //CleanupStack::PopAndDestroy();
+    CleanupStack::PopAndDestroy( listener2 );
+    }
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+// Single client, empty filter
+void T_PresenceBlocking::T_SubscribeBlockListRefresh_Single_L()
+    {
+    EUNIT_PRINT( _L("Single presence block list subscription refresh") );
+
+    BindL();
+
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    MXIMPContext* context = wrapper->GetContext();
+    CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+    CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context );
+    CleanupStack::PushL( listener2 );
+
+    // Tell the protocol it should act normally
+    messenger->SetNoError();
+
+    // Get the interfaces
+    MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+    MPresenceAuthorization& presAuth = presFeat->PresenceAuthorization();
+
+    // Setup status event listener for RequestComplete
+    // ---------------------------------------------
+    listener2->Reset();
+
+    // normal request complete
+    TXIMPRequestId reqIdDummy;  // not checked
+    CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+    listener2->ExpectL( evReqComplete );
+    CleanupStack::Pop( evReqComplete );
+    // ---------------------------------------------
+
+    // subscribe
+    // ---------------------------------------------
+    TXIMPRequestId reqId = presAuth.SubscribePresenceBlockListL();
+    EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Subscribe failed" );
+    // ---------------------------------------------
+
+    // verify that SubscribeBlockListL was called
+    COMMONASSERT( messenger, EXIMPPlgTestSubscribePresenceBlockListCalled, "SubscribeBlockListL was not called", ETrue, NULL );
+
+    // Setup status event listener for RequestComplete
+    // ---------------------------------------------
+    listener2->Reset();
+
+    evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+    listener2->ExpectL( evReqComplete );
+    CleanupStack::Pop( evReqComplete );
+
+    RPrBlockInfoImpArray* currentList(NULL);
+    CPresenceBlockListEventImp* event = CreateBlockListEventLCX(
+        KNullDesC, KNullDesC,
+        MXIMPDataSubscriptionState::ESubscriptionActive,
+        MXIMPDataSubscriptionState::EDataUnavailable,
+        ETestPBlCurrent, currentList );
+    listener2->ExpectL( event );
+    CleanupStack::Pop(); //event 4 to go.
+    // ---------------------------------------------
+
+    // subscribe again
+    // ---------------------------------------------
+    reqId = presAuth.SubscribePresenceBlockListL();
+    EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Refresh failed" );
+    CleanupStack::PopAndDestroy( 4 ); // rest of the items.
+    // ---------------------------------------------
+
+    // Setup status event listener for RequestComplete
+    // ---------------------------------------------
+    listener2->Reset();
+
+    evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+    listener2->ExpectL( evReqComplete );
+    CleanupStack::Pop( evReqComplete );
+    // ---------------------------------------------
+
+    // unsubscribe
+    // ---------------------------------------------
+    reqId = presAuth.UnsubscribePresenceBlockListL();
+    EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Unsubscribe failed" );
+    // ---------------------------------------------
+
+    // verify that UnsubscribeBlockListL was called
+    COMMONASSERT( messenger, EXIMPPlgTestUnsubscribePresenceBlockListCalled, "UnsubscribeBlockListL was not called", ETrue, NULL );
+
+    listener2->SetEventSourceL( NULL );
+
+    UnbindL();
+
+    CleanupStack::PopAndDestroy( listener2 );
+    }
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+// Single client, empty filter
+void T_PresenceBlocking::T_SubscribeBlockList_Multiple_L()
+    {
+    EUNIT_PRINT( _L("Multiple presence block list subscription") );
+
+    BindAllL();
+
+    TInt countOfWrappers = iWrapperMgr->WrapperCount();
+    TInt a(0);
+    for( a = 0; a < countOfWrappers; ++a )
+        {
+        CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a );
+        MXIMPContext* context = wrapper->GetContext();
+        CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+        // Get the interfaces
+        MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+        MPresenceAuthorization& presAuth = presFeat->PresenceAuthorization();
+
+        CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context );
+        CleanupStack::PushL( listener2 );
+
+        // Tell the protocol it should act normally
+        messenger->SetNoError();
+
+        // expect normal request complete
+        TXIMPRequestId reqIdDummy;  // not checked
+        CXIMPRequestCompleteEventImp* evReqComplete =
+                                CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+        listener2->ExpectL( evReqComplete );
+        CleanupStack::Pop( evReqComplete );
+
+        // subscribe
+        TXIMPRequestId reqId = presAuth.SubscribePresenceBlockListL();
+
+        EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Subscribe failed" );
+
+        // verify that SubscribePresenceBlockListL was called
+        COMMONASSERT( messenger, EXIMPPlgTestSubscribePresenceBlockListCalled, "SubscribePresenceBlockListL was not called", ETrue, NULL );
+
+        CleanupStack::PopAndDestroy( listener2 );
+        }
+
+    for( a = 0; a < countOfWrappers; ++a )
+        {
+        CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a );
+        MXIMPContext* context = wrapper->GetContext();
+        CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+        // Get the interfaces
+        MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+        MPresenceAuthorization& presAuth = presFeat->PresenceAuthorization();
+
+        CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context );
+        CleanupStack::PushL( listener2 );
+
+        // Tell the protocol it should act normally
+        messenger->SetNoError();
+
+        // expect normal request complete
+        TXIMPRequestId reqIdDummy;  // not checked
+        CXIMPRequestCompleteEventImp* evReqComplete =
+                            CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+        listener2->ExpectL( evReqComplete );
+        CleanupStack::Pop( evReqComplete );
+
+        // unsubscribe
+        TXIMPRequestId reqId = presAuth.UnsubscribePresenceBlockListL();
+
+        EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Unsubscribe failed" );
+
+        // verify that EXIMPPlgTestUnsubscribeBlockListCalled was called
+        COMMONASSERT( messenger, EXIMPPlgTestUnsubscribePresenceBlockListCalled,
+                "UnsubscribePresenceBlockListL was not called",
+                ( a < 2 ) ? EFalse : ETrue,
+                "UnsubscribePresenceBlockListL was called" );
+
+        CleanupStack::PopAndDestroy( listener2 );
+        }
+
+    UnbindAllL();
+    }
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+void T_PresenceBlocking::SubscribeL()
+    {
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    MXIMPContext* context = wrapper->GetContext();
+    CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+    // Get the interfaces
+    MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+    MPresenceAuthorization& presAuth = presFeat->PresenceAuthorization();
+
+    CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context );
+    CleanupStack::PushL( listener2 );
+
+    // ------------------------------------------------------
+    // expect normal request complete
+    TXIMPRequestId reqIdDummy;  // not checked
+    CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+    listener2->ExpectL( evReqComplete );
+    CleanupStack::Pop( evReqComplete );
+    // ------------------------------------------------------
+
+    // subscribe
+    TXIMPRequestId reqId = presAuth.SubscribePresenceBlockListL();
+    EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Subscribe failed" );
+
+    COMMONASSERT( messenger, EXIMPPlgTestSubscribePresenceBlockListCalled, "SubscribeBlockListL was not called", ETrue, NULL );
+
+    CleanupStack::PopAndDestroy( listener2 );
+    }
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+void T_PresenceBlocking::UnsubscribeL()
+    {
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    MXIMPContext* context = wrapper->GetContext();
+    CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+    // Get the interfaces
+    MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+    MPresenceAuthorization& presAuth = presFeat->PresenceAuthorization();
+
+    CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context );
+    CleanupStack::PushL( listener2 );
+
+    // ------------------------------------------------------
+    // expect normal request complete
+    TXIMPRequestId reqIdDummy;  // not checked
+    CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+    listener2->ExpectL( evReqComplete );
+    CleanupStack::Pop( evReqComplete );
+    // ------------------------------------------------------
+
+    // unsubscribe
+    TXIMPRequestId reqId = presAuth.UnsubscribePresenceBlockListL();
+    EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Unsubscribe failed" );
+
+    COMMONASSERT( messenger, EXIMPPlgTestUnsubscribePresenceBlockListCalled, "UnsubscribeBlockListL was not called", ETrue, NULL );
+
+    CleanupStack::PopAndDestroy( listener2 );
+    }
+
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+void T_PresenceBlocking::T_HandlePresenceBlockList_L()
+    {
+    EUNIT_PRINT( _L("Handle presence block list.") );
+
+    // log in and subscribe a block list
+    BindL();
+    SubscribeL();
+
+    // ------------------------------------------------------
+    // some startup stuff
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    MXIMPContext* context = wrapper->GetContext();
+
+    CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context );
+    CleanupStack::PushL( listener2 );
+    // ------------------------------------------------------
+
+    // Tell the protocol it should act normally
+    wrapper->GetMessenger()->SetNoError();
+
+    // ------------------------------------------------------
+    // 1. Create faked server message about block list
+    SendSrvMsgL( CXIMPTestFileSrvMsg::ETestSrvMsgPresenceBlockList );
+
+    // ------------------------------------------------------
+    // expect current(empty) MPresenceBlockList event.
+    RPrBlockInfoImpArray* currentList(NULL);
+    CPresenceBlockListEventImp* event = CreateBlockListEventLCX(
+            KNullDesC, KNullDesC,
+            MXIMPDataSubscriptionState::ESubscriptionActive,
+            MXIMPDataSubscriptionState::EDataAvailable,
+            ETestPBlCurrent, currentList);
+
+    listener2->ExpectL( event );
+    CleanupStack::Pop( event ); // 4 more items in cleanupstack
+
+    EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "HandlePresenceBlockListL failed" );
+    CleanupStack::PopAndDestroy( 4 ); // lists
+    // ------------------------------------------------------
+
+    CleanupStack::PopAndDestroy( listener2 );
+
+    // clean it up
+    UnsubscribeL();
+    UnbindL();
+    }
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+// Single client, empty filter
+void T_PresenceBlocking::T_BlockPresence_L()
+    {
+    EUNIT_PRINT( _L("Block presence") );
+
+    BindL();
+
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    MXIMPContext* context = wrapper->GetContext();
+    CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+    CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context );
+    CleanupStack::PushL( listener2 );
+
+    // Tell the protocol it should act normally
+    messenger->SetNoError();
+
+    // Get the interfaces
+    MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+    MPresenceAuthorization& presAuth = presFeat->PresenceAuthorization();
+
+    // Setup status event listener for RequestComplete
+    // ---------------------------------------------
+    listener2->Reset();
+
+    // normal request complete
+    TXIMPRequestId reqIdDummy;  // not checked
+    CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+    listener2->ExpectL( evReqComplete );
+    CleanupStack::Pop( evReqComplete );
+
+    // subscribe
+    TXIMPRequestId reqId = presAuth.SubscribePresenceBlockListL();
+    EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Subscribe failed" );
+
+    // verify that SubscribePresenceBlockListL was called
+    COMMONASSERT( messenger, EXIMPPlgTestSubscribePresenceBlockListCalled, "SubscribePresenceBlockListL was not called", ETrue, NULL );
+
+
+    // ---------------------------------------------
+    //  1. Block presence
+
+    CXIMPIdentityImp* identity = XIMPTestPresenceDataUtils::GenerateIdentityLC( &KNullDesC8 );
+    _LIT16( KDisplayName1, "DispnameA, LoremI" );
+
+
+    // Setup status event listener for RequestComplete
+    // ---------------------------------------------
+    listener2->Reset();
+
+    evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+    listener2->ExpectL( evReqComplete );
+    CleanupStack::Pop( evReqComplete );
+
+    RPrBlockInfoImpArray* currentList(NULL);
+    CPresenceBlockListEventImp* event =
+            CreateBlockListEventLCX( identity->Identity(),
+                                     KNullDesC,
+                                     MXIMPDataSubscriptionState::ESubscriptionActive,
+                                     MXIMPDataSubscriptionState::EDataAvailable,
+                                     ETestPBlAdded, currentList );
+
+    listener2->ExpectL( event );
+    CleanupStack::Pop( event );
+
+    // block
+    reqId = presAuth.BlockPresenceForPresentityL( *identity );
+    
+    //Waqas: fixed current list in event
+    EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Block failed" );
+
+    // verify that BlockPresenceForPresentityL was called
+    COMMONASSERT( messenger, EXIMPPlgTestBlockPresenceForPresentityCalled, "BlockPresenceForPresentityL was not called", ETrue, NULL );
+
+    CleanupStack::PopAndDestroy( 4 ); // lists
+    // ---------------------------------------------
+
+
+    // ---------------------------------------------
+    //  2. Re-block
+
+    // Setup status event listener for RequestComplete
+    listener2->Reset();
+
+    evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+    listener2->ExpectL( evReqComplete );
+    CleanupStack::Pop( evReqComplete );
+
+    // we need to create current list to give to the event
+    currentList = new ( ELeave ) RPrBlockInfoImpArray; // previous is destroyed
+    CleanupDeletePushL( currentList );
+            // create the group info
+    CPresenceBlockInfoImp* blockInfoForEvent = 
+                            CPresenceBlockInfoImp::NewLC( *identity, KNullDesC );
+    currentList->AppendL( blockInfoForEvent );
+    CleanupStack::Pop( blockInfoForEvent );
+    CleanupStack::Pop( currentList );
+    
+    // now make the event
+    event = CreateBlockListEventLCX( identity->Identity(),
+                                     KNullDesC,
+                                     MXIMPDataSubscriptionState::ESubscriptionActive,
+                                     MXIMPDataSubscriptionState::EDataAvailable,
+                                     ETestPBlCurrent, currentList );
+
+    listener2->ExpectL( event );
+    CleanupStack::Pop( event );
+
+    // re-block
+    reqId = presAuth.BlockPresenceForPresentityL( *identity );
+
+    EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Block failed" );
+
+    // verify that BlockPresenceForPresentityL was called
+    COMMONASSERT( messenger, EXIMPPlgTestBlockPresenceForPresentityCalled, "BlockPresenceForPresentityL was not called", ETrue, NULL );
+
+
+    CleanupStack::PopAndDestroy( 4 ); // lists
+
+
+    // Deinitiliaze event source from listener.
+    listener2->SetEventSourceL( NULL );
+
+    UnbindL();
+    
+    CleanupStack::PopAndDestroy( identity );
+
+    CleanupStack::PopAndDestroy( listener2 );
+    
+    }
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+// Single client, empty filter
+void T_PresenceBlocking::T_CancelBlockedPresence_L()
+    {
+    EUNIT_PRINT( _L("Cancel presence block") );
+
+    BindL();
+
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    MXIMPContext* context = wrapper->GetContext();
+    CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+    CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context );
+    CleanupStack::PushL( listener2 );
+
+    // Tell the protocol it should act normally
+    messenger->SetNoError();
+
+    // Get the interfaces
+    MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+    MPresenceAuthorization& presAuth = presFeat->PresenceAuthorization();
+
+    // Setup status event listener for RequestComplete
+    // ---------------------------------------------
+    listener2->Reset();
+
+    // normal request complete
+    TXIMPRequestId reqIdDummy;  // not checked
+    CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+    listener2->ExpectL( evReqComplete );
+    CleanupStack::Pop( evReqComplete );
+    // ---------------------------------------------
+
+    // subscribe
+    // ---------------------------------------------
+    TXIMPRequestId reqId = presAuth.SubscribePresenceBlockListL();
+    EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Subscribe failed" );
+    // ---------------------------------------------
+
+    // verify that SubscribePresenceBlockListL was called
+    COMMONASSERT( messenger, EXIMPPlgTestSubscribePresenceBlockListCalled, "SubscribePresenceBlockListL was not called", ETrue, NULL );
+
+
+    CXIMPIdentityImp* identity = XIMPTestPresenceDataUtils::GenerateIdentityLC( &KNullDesC8 );
+
+    // ---------------------------------------------
+    //  1. Cancel non-existing block (no blocks)
+    
+    // Setup status event listener for RequestComplete
+    listener2->Reset();
+
+    evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+    listener2->ExpectL( evReqComplete );
+    CleanupStack::Pop( evReqComplete );
+
+    RPrBlockInfoImpArray* currentList(NULL);
+    CPresenceBlockListEventImp* event =
+            CreateBlockListEventLCX( KNullDesC,
+                                     KNullDesC,
+                                     MXIMPDataSubscriptionState::ESubscriptionActive,
+                                     MXIMPDataSubscriptionState::EDataUnavailable,
+                                     ETestPBlRemoved, currentList );
+    listener2->ExpectL( event );
+    CleanupStack::Pop( event );
+
+    // cancel nonexisting block
+    reqId = presAuth.CancelPresenceBlockFromPresentityL( *identity );
+    EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Cancel failed" );
+    // ---------------------------------------------
+
+    // verify that method was called
+    COMMONASSERT( messenger, EXIMPPlgTestCancelPresenceBlockFromPresentityCalled, "CancelPresenceBlockFromPresentityL was not called", ETrue, NULL );
+
+    CleanupStack::PopAndDestroy( 4 ); // lists
+
+    
+    // ---------------------------------------------
+    //  2. Cancel block 
+    
+
+    // Setup status event listener for RequestComplete
+    listener2->Reset();
+
+    evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+    listener2->ExpectL( evReqComplete );
+    CleanupStack::Pop( evReqComplete );
+
+    currentList = NULL;  // previous is destroyed
+    event = CreateBlockListEventLCX( identity->Identity(),
+                                     KNullDesC,
+                                     MXIMPDataSubscriptionState::ESubscriptionActive,
+                                     MXIMPDataSubscriptionState::EDataAvailable,
+                                     ETestPBlAdded, currentList );
+    listener2->ExpectL( event );
+    CleanupStack::Pop( event );
+
+    // block a presentity
+    reqId = presAuth.BlockPresenceForPresentityL( *identity );
+    // Waqas: Fixed current list in event
+    EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Block failed" );
+
+    // verify that method was called
+    COMMONASSERT( messenger, EXIMPPlgTestBlockPresenceForPresentityCalled, "BlockPresenceForPresentityL was not called", ETrue, NULL );
+    CleanupStack::PopAndDestroy( 4 ); // lists
+    // ---------------------------------------------
+
+
+    // Setup status event listener for RequestComplete
+    listener2->Reset();
+
+    evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+    listener2->ExpectL( evReqComplete );
+    CleanupStack::Pop( evReqComplete );
+
+    // we need to create current list to give to the event
+    currentList = new ( ELeave ) RPrBlockInfoImpArray; // previous is destroyed
+    CleanupDeletePushL( currentList );
+    CPresenceBlockInfoImp* blockInfoForEvent = 
+                        CPresenceBlockInfoImp::NewLC( *identity, KNullDesC );
+    currentList->AppendL( blockInfoForEvent );
+    CleanupStack::Pop( blockInfoForEvent );
+    CleanupStack::Pop( currentList );
+    
+    // now create event and give currentList to it
+    event = CreateBlockListEventLCX( identity->Identity(),
+                                     KNullDesC,
+                                     MXIMPDataSubscriptionState::ESubscriptionActive,
+                                     MXIMPDataSubscriptionState::EDataAvailable,
+                                     ETestPBlRemoved, currentList );
+    listener2->ExpectL( event );
+    CleanupStack::Pop( event );
+
+    // cancel the existing block
+    reqId = presAuth.CancelPresenceBlockFromPresentityL( *identity );
+    // Waqas: Fixed current list in event
+    EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Cancel block failed" );
+
+    // verify that method was called
+    COMMONASSERT( messenger, EXIMPPlgTestCancelPresenceBlockFromPresentityCalled, "CancelPresenceBlockFromPresentityL was not called", ETrue, NULL );
+    CleanupStack::PopAndDestroy( 4 ); // lists
+    // ---------------------------------------------
+
+
+    // ---------------------------------------------
+    //  TODO 3. Cancel block (non-existing block, other blocks exist)
+
+
+    // Deinitiliaze event source from listener.
+    listener2->SetEventSourceL( NULL );
+
+    UnbindL();
+    
+    CleanupStack::PopAndDestroy( identity );
+
+    CleanupStack::PopAndDestroy( listener2 );
+    }
+
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+void T_PresenceBlocking::T_HandlePresenceBlocked_L()
+    {
+    EUNIT_PRINT( _L("Handle presence blocked") );
+
+    // log in and subscribe a block list
+    BindL();
+    SubscribeL();
+
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    MXIMPContext* context = wrapper->GetContext();
+
+    CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context );
+    CleanupStack::PushL( listener2 );
+
+    // Tell the protocol it should act normally
+    wrapper->GetMessenger()->SetNoError();
+
+
+    CXIMPIdentityImp* identity = XIMPTestPresenceDataUtils::GenerateIdentityLC( &KNullDesC8 );
+    
+    // ------------------------------------------------------
+    // 1. Create faked server message about blocked
+    SendBlockedSrvMsgL( identity->Identity(),
+                        KNullDesC,
+                        CXIMPTestFileSrvMsg::ETestSrvMsgPresenceBlocked );
+
+    RPrBlockInfoImpArray* currentList(NULL);
+    CPresenceBlockListEventImp* event = CreateBlockListEventLCX(
+            identity->Identity(), KNullDesC,
+            MXIMPDataSubscriptionState::ESubscriptionActive,
+            MXIMPDataSubscriptionState::EDataAvailable,
+            ETestPBlAdded, currentList );
+
+    listener2->ExpectL( event );
+    CleanupStack::Pop( event ); // 4 more items in cleanupstack
+
+    // Waqas: Fixed current list handling
+    EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "HandlePresenceBlocked failed" );
+    
+    CleanupStack::PopAndDestroy( 4 ); // lists
+    // ------------------------------------------------------
+
+    CleanupStack::PopAndDestroy( identity );
+    CleanupStack::PopAndDestroy( listener2 );
+
+    // clean it up
+    UnsubscribeL();
+    UnbindL();
+    
+    }
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+void T_PresenceBlocking::T_HandlePresenceBlockCanceled_L()
+    {
+    
+    EUNIT_PRINT( _L("Handle presence block canceled") );
+
+    // log in and subscribe a block list
+    BindL();
+    SubscribeL();
+
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    MXIMPContext* context = wrapper->GetContext();
+
+    CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context );
+    CleanupStack::PushL( listener2 );
+
+    // Tell the protocol it should act normally
+    wrapper->GetMessenger()->SetNoError();
+
+
+    CXIMPIdentityImp* identity = XIMPTestPresenceDataUtils::GenerateIdentityLC( &KNullDesC8 );
+    
+    // ------------------------------------------------------
+    // 1. Cancel block (with no blocks)
+    SendCanceledSrvMsgL( identity->Identity(),
+                        KNullDesC,
+                        CXIMPTestFileSrvMsg::ETestSrvMsgPresenceBlockCanceled );
+
+    RPrBlockInfoImpArray* currentList(NULL);
+    CPresenceBlockListEventImp* event = CreateBlockListEventLCX(
+            KNullDesC, KNullDesC,
+            MXIMPDataSubscriptionState::ESubscriptionActive,
+            MXIMPDataSubscriptionState::EDataUnavailable,
+            ETestPBlRemoved, currentList );
+
+    listener2->ExpectL( event );
+    CleanupStack::Pop( event ); // 4 more items in cleanupstack
+
+    EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "HandlePresenceBlockCanceled failed" );
+    CleanupStack::PopAndDestroy( 4 ); // lists
+    // ------------------------------------------------------
+
+    CleanupStack::PopAndDestroy( identity );
+    CleanupStack::PopAndDestroy( listener2 );
+
+    // clean it up
+    UnsubscribeL();
+    UnbindL();    
+    }
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+// send a faked server-originated message with group info made
+// from the given uri and displayname
+//
+void T_PresenceBlocking::SendSrvMsgL(
+        const TDesC& aUri, const TDesC& aDispName,
+        TInt aMsgType )
+    {
+    // we'll use hard-coded wrapper 0 instance for now.
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+
+    // create a grant req info contained within the server-originated
+    // faked message
+    RXIMPObjOwningPtrArray<CPresenceBlockInfoImp> blockList;
+    CleanupClosePushL( blockList );
+
+    CXIMPIdentityImp* blockId = CXIMPIdentityImp::NewLC( aUri );
+    CPresenceBlockInfoImp* blockItem =
+                CPresenceBlockInfoImp::NewLC( *blockId, aDispName );
+    blockList.AppendL( blockItem );
+    CleanupStack::Pop( blockItem );
+    CleanupStack::PopAndDestroy( blockId );
+
+    HBufC8* packedArray =
+        TXIMPObjectPacker<CPresenceBlockInfoImp>::PackArrayL( blockList );
+    CleanupStack::PushL( packedArray );
+
+    // use filetool to send it for plugin.
+    CXIMPTestFileSrvMsg* srvMsg = CXIMPTestFileSrvMsg::NewL( aMsgType,
+            *packedArray );
+    CleanupStack::PushL( srvMsg );
+    wrapper->FileTool().CleanAllL();
+    wrapper->FileTool().SrvMsgStoreL( srvMsg );
+    CleanupStack::PopAndDestroy( 3 ); // srvMsg, packedArray, blockList
+    }
+    
+void T_PresenceBlocking::SendBlockedSrvMsgL(
+        const TDesC& aUri, const TDesC& aDispName,
+        TInt aMsgType )
+    {
+    // we'll use hard-coded wrapper 0 instance for now.
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+
+    // create a grant req info contained within the server-originated
+    // faked message
+    CXIMPIdentityImp* blockId = CXIMPIdentityImp::NewLC( aUri );
+    CPresenceBlockInfoImp* blockItem =
+                CPresenceBlockInfoImp::NewLC( *blockId, aDispName );
+
+
+    HBufC8* packedArray =
+        TXIMPObjectPacker<CPresenceBlockInfoImp>::PackL( *blockItem );
+    CleanupStack::PushL( packedArray );
+
+    // use filetool to send it for plugin.
+    CXIMPTestFileSrvMsg* srvMsg = CXIMPTestFileSrvMsg::NewL( aMsgType,
+            *packedArray );
+    CleanupStack::PushL( srvMsg );
+    wrapper->FileTool().CleanAllL();
+    wrapper->FileTool().SrvMsgStoreL( srvMsg );
+    CleanupStack::PopAndDestroy( 4 ); // blockId, blockItem, packedArray, srvMsg
+    }
+    
+void T_PresenceBlocking::SendCanceledSrvMsgL(
+        const TDesC& aUri, const TDesC& aDispName,
+        TInt aMsgType )
+    {
+    // we'll use hard-coded wrapper 0 instance for now.
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+
+    CXIMPIdentityImp* blockId = CXIMPIdentityImp::NewLC( aUri );
+
+    HBufC8* packedArray =
+        TXIMPObjectPacker<CXIMPIdentityImp>::PackL( *blockId );
+    CleanupStack::PushL( packedArray );
+
+    // use filetool to send it for plugin.
+    CXIMPTestFileSrvMsg* srvMsg = CXIMPTestFileSrvMsg::NewL( aMsgType,
+            *packedArray );
+    CleanupStack::PushL( srvMsg );
+    wrapper->FileTool().CleanAllL();
+    wrapper->FileTool().SrvMsgStoreL( srvMsg );
+    CleanupStack::PopAndDestroy( 3 ); // blockId, packedArray, srvMsg
+    }
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+// send a faked server-originated message with empty contents
+//
+void T_PresenceBlocking::SendSrvMsgL( TInt aMsgType )
+    {
+    // we'll use hard-coded wrapper 0 instance for now.
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+
+    // create a server-originated faked message with empty contents
+    RXIMPObjOwningPtrArray<CPresenceBlockInfoImp> blockList;
+
+    HBufC8* packedArray = TXIMPObjectPacker<CPresenceBlockInfoImp>::PackArrayL( blockList );
+    CleanupStack::PushL( packedArray );
+
+    // use filetool to send it for plugin.
+    CXIMPTestFileSrvMsg* srvMsg = CXIMPTestFileSrvMsg::NewL( aMsgType,
+            *packedArray );
+    CleanupStack::PushL( srvMsg );
+    wrapper->FileTool().CleanAllL();
+    wrapper->FileTool().SrvMsgStoreL( srvMsg );
+    CleanupStack::PopAndDestroy( 2 ); // srvMsg, packedArray
+    }
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+// create a block list event with given arrays
+//
+CPresenceBlockListEventImp*
+    T_PresenceBlocking::CreateBlockListEventLCX(
+        const TDesC& aUri,
+        const TDesC& aDispName,
+        MXIMPDataSubscriptionState::TSubscriptionState aSubscriptionState,
+        MXIMPDataSubscriptionState::TDataState aDataState,
+        TTestPBlOperationSpecifier aOperation,
+        RPrBlockInfoImpArray* aCurrentList)
+    {
+    // create the arrays
+
+    // new list
+    RPrBlockInfoImpArray* newList = new ( ELeave ) RPrBlockInfoImpArray;
+    CleanupDeletePushL( newList );
+
+    // current list, created by caller
+    if(!aCurrentList) // if client didnt created the list
+        aCurrentList = new ( ELeave ) RPrBlockInfoImpArray;
+    CleanupDeletePushL( aCurrentList );
+
+    // removed list
+    RPrBlockInfoImpArray* removedList = new ( ELeave ) RPrBlockInfoImpArray;
+    CleanupDeletePushL( removedList );
+
+    // updated list
+    RPrBlockInfoImpArray* updatedList = new ( ELeave ) RPrBlockInfoImpArray;
+    CleanupDeletePushL( updatedList );
+    
+	// create subscription state
+	CXIMPDataSubscriptionStateImp* subsState = CXIMPDataSubscriptionStateImp::NewLC();
+	 
+
+    // create the group info
+    CPresenceBlockInfoImp* blockInfoForEvent1 = NULL;
+            {
+            CXIMPIdentityImp* idForEvent = CXIMPIdentityImp::NewLC( aUri );
+            blockInfoForEvent1 = CPresenceBlockInfoImp::NewLC( *idForEvent, aDispName );
+            
+            CleanupStack::Pop( blockInfoForEvent1 );        
+            CleanupStack::PopAndDestroy( idForEvent ); 
+            CleanupStack::PushL( blockInfoForEvent1 );        
+            }
+
+    CPresenceBlockInfoImp* blockInfoForEvent2 = 
+            TXIMPObjectCloner< CPresenceBlockInfoImp >::CloneLC( *blockInfoForEvent1 );
+    
+    TInt count(0);
+    TBool found(EFalse);
+    TInt i(0);
+
+    // put the given group info into the specified array
+    switch ( aOperation )
+        {
+        case ETestPBlAdded:
+            {
+            newList->AppendL( blockInfoForEvent2 );
+            CleanupStack::Pop( blockInfoForEvent2 );
+            
+            aCurrentList->AppendL( blockInfoForEvent1 );
+            CleanupStack::Pop( blockInfoForEvent1 );
+            
+            break;
+            }
+
+        case ETestPBlRemoved:
+            {
+            // search the given id in current list
+            count = aCurrentList->Count();
+            for(i=0;i<count;i++)
+                {
+                // if dispname and id are same
+                if (( ((((*aCurrentList)[i])->BlockedEntityId()).Identity()) == aUri )
+                    && ( (((*aCurrentList)[i])->BlockedEntityDisplayName()) == aDispName ))
+                    {
+                    found = ETrue;
+            break;
+            }
+                }
+            if(found) // do we need to leave if error? Waqas
+            {
+                delete (*aCurrentList)[i];
+                aCurrentList->Remove(i);
+                removedList->AppendL( blockInfoForEvent2 );
+                CleanupStack::Pop( blockInfoForEvent2 );
+                }
+            else
+                CleanupStack::PopAndDestroy( blockInfoForEvent2 );
+            
+            CleanupStack::PopAndDestroy( blockInfoForEvent1 );
+            }
+            break;
+        case ETestPBlUpdated:
+            {
+            updatedList->AppendL( blockInfoForEvent2 );
+            CleanupStack::Pop( blockInfoForEvent2);
+            CleanupStack::PopAndDestroy( blockInfoForEvent1 );
+            }
+            break;
+
+        case ETestPBlCurrent:
+            {
+            // don't add, thus return what user has given
+            CleanupStack::PopAndDestroy( blockInfoForEvent2 ); // blockInfoForEvent2
+            CleanupStack::PopAndDestroy( blockInfoForEvent1 ); // blockInfoForEvent1
+            }
+            break;
+        
+        default:
+            {
+            User::Leave( KErrArgument );
+            }
+            break;
+        }
+
+	subsState->SetSubscriptionStateL(aSubscriptionState);
+    subsState->SetDataStateL(aDataState);
+	
+    // create the actual event
+    CPresenceBlockListEventImp* tmp =
+        CPresenceBlockListEventImp::NewLC(
+                newList,
+                aCurrentList,
+                removedList,
+                updatedList,
+                subsState );
+
+    // subState is owned by the event, we need to pop it out from the stack
+    CleanupStack::Pop( tmp );        
+    CleanupStack::Pop( subsState ); 
+    CleanupStack::PushL( tmp );        
+
+    /*
+     * In cleanupstack there are 5 items, FIFO
+     *   - added/new list
+     *   - current list
+     *   - removed list
+     *   - updated list
+     *   - event imp
+     */
+
+    return tmp;
+    }
+
+// ===========================================================================
+// TEST CASE TABLE
+// ===========================================================================
+//
+EUNIT_BEGIN_TEST_TABLE(
+        T_PresenceBlocking,
+        "XIMPFW presence blocking tests",
+        "MODULE" )
+
+PRFW_DECORATED_TEST(
+        "Subscribe block list",
+        "",
+        "",
+        "FUNCTIONALITY",
+        Setup_L,
+        T_SubscribeBlockList_Single_L,
+        Teardown )
+
+PRFW_DECORATED_TEST(
+        "Refresh block list subscription",
+        "",
+        "",
+        "FUNCTIONALITY",
+        Setup_L,
+        T_SubscribeBlockListRefresh_Single_L,
+        Teardown )
+
+PRFW_DECORATED_TEST(
+        "Subscribe block list, multiple",
+        "",
+        "",
+        "FUNCTIONALITY",
+        SetupMultiple_L,
+        T_SubscribeBlockList_Multiple_L,
+        Teardown )
+
+
+PRFW_DECORATED_TEST(
+        "Handle presence block list",
+        "",
+        "",
+        "FUNCTIONALITY",
+        Setup_L,
+        T_HandlePresenceBlockList_L,
+        Teardown )
+
+PRFW_DECORATED_TEST(
+        "Block presence",
+        "",
+        "",
+        "FUNCTIONALITY",
+        Setup_L,
+        T_BlockPresence_L,
+        Teardown )
+        
+PRFW_DECORATED_TEST(
+        "Cancel presence block",
+        "",
+        "",
+        "FUNCTIONALITY",
+        Setup_L,
+        T_CancelBlockedPresence_L,
+        Teardown )
+
+PRFW_DECORATED_TEST(
+        "Handle blocked and canceled blocks",
+        "",
+        "",
+        "FUNCTIONALITY",
+        Setup_L,
+        T_HandlePresenceBlocked_L,
+        Teardown )
+
+PRFW_DECORATED_TEST(
+        "Handle blocked and canceled blocks",
+        "",
+        "",
+        "FUNCTIONALITY",
+        Setup_L,
+        T_HandlePresenceBlockCanceled_L,
+        Teardown )
+
+EUNIT_END_TEST_TABLE
+
+
+// ===========================================================================
+// TEST SUITE CONSTRUCTION
+// ===========================================================================
+//
+EXPORT_C MEUnitTest* CreateTestSuiteL()
+    {
+    return T_PresenceBlocking::NewL();
+    }
+
+
+// end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_presenceblocking/t_presenceblocking.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,182 @@
+/*
+* 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:
+*
+*/
+
+#ifndef T_PRESENCEBLOCKING_H
+#define T_PRESENCEBLOCKING_H
+
+
+//#include <ceunittestsuiteclass.h>
+//  EXTERNAL INCLUDES
+#include <platform/digia/eunit/ceunittestsuiteclass.h>
+#include <platform/digia/eunit/EUnitDecorators.h>
+
+#include <ximpbase.h>
+#include "prfwteststatuseventlistener.h"
+#include "prfwtestmessaging.h"
+#include "ximpdatasubscriptionstateimp.h"
+#include "presencetypehelpers.h"
+
+class CXIMPTestContextWrapper;
+class CXIMPTestContextWrapperMgr;
+class CXIMPTestMessenger;
+class CPresenceBlockInfoImp;
+class CPresenceBlockListEventImp;
+
+/**
+ * XIMP Framework Eunit tests.
+ *
+ * Tests for XIMP session management services.
+ *
+ * @since S60 v4.0
+ */
+class T_PresenceBlocking : public CEUnitTestSuiteClass
+    {
+
+public:
+    static T_PresenceBlocking* NewL();
+    virtual ~T_PresenceBlocking();
+
+
+private:
+    T_PresenceBlocking();
+    void ConstructL();
+
+private:    // Test case functions
+
+    void Setup_L();
+    void SetupMultiple_L();
+    void BindL();
+    void BindAllL();
+    void Teardown();
+    void UnbindL();
+    void UnbindAllL();
+    void SubscribeL();
+    void UnsubscribeL();
+
+    void T_SubscribeBlockList_Single_L();
+    void T_SubscribeBlockListRefresh_Single_L();
+    void T_SubscribeBlockList_Multiple_L();
+    void T_HandlePresenceBlockList_L();
+    void T_BlockPresence_L();
+    void T_CancelBlockedPresence_L();
+    void T_HandlePresenceBlocked_L();
+    void T_HandlePresenceBlockCanceled_L();
+    
+
+private:    // Test helpers
+
+    /**
+     * Fake a server-originated (=mobile terminated) message.
+     * The message appears to adaptation and framework as if
+     * it came from the network. Uses only one group.
+     * @param aUri The URI of group
+     * @param aDispName The display name for the group
+     * @param aMsgType The message type for CXIMPTestFileSrvMsg
+     */
+    void SendSrvMsgL(
+            const TDesC& aUri, const TDesC& aDispName,
+            TInt aMsgType );
+    void SendBlockedSrvMsgL(
+            const TDesC& aUri, const TDesC& aDispName,
+            TInt aMsgType );
+    void SendCanceledSrvMsgL(
+            const TDesC& aUri, const TDesC& aDispName,
+            TInt aMsgType );
+
+    /**
+     * Fake a server-originated message with empty content.
+     * Whether to use this depends on the event you expect.
+     * @see SendSrvMsgL
+     */
+    void SendSrvMsgL( TInt aMsgType );
+
+    // @see below
+    /*
+    enum TTestPBlArraySpecifier   //Waqas: Not used anymore, use next one
+        {
+        ETestPBlNewList = 0,    // new block list
+        ETestPBlAdded,     // added block
+        ETestPBlCurrent,        // current block list
+        ETestPBlRemoved,        // removed block
+        ETestPBlUpdated,        // updated block
+        ETestPBlEmpty,          // make an empty array for empty event
+        };*/
+        
+    enum TTestPBlOperationSpecifier
+        {
+        ETestPBlAdded = 0,      // added block
+        ETestPBlCurrent,        // current block list
+        ETestPBlRemoved,        // removed block
+        ETestPBlUpdated        // updated block
+        };
+
+    /**
+     * Creates an event for adding, current, removing or updating
+     * block list. The caller provides an identity and current blocked list
+     * and depending on the provided operation an event is created. 
+     *
+     * In cleanupstack there are 4 items, FIFO:
+     *   - created list
+     *   - updated list
+     *   - deleted list
+     *   - event imp
+     *
+     * This is because this event won't take ownership to the arrays
+     * when created this way.
+     *
+     * @param aUri Uri
+     * @param aDispName Displayname
+     * @param aOperation operation for which caller wants to generates event
+     * @param aCurrentList Current blocked list provided by caller, method takes
+     *         ownership of the current list, and it is included in above 4 items. 
+     *         a NULL pointer with operation ETestPBlCurrent causes empty event. 
+     * @return The suitably filled event.     
+     */
+    CPresenceBlockListEventImp* CreateBlockListEventLCX(
+            const TDesC& aUri,
+            const TDesC& aDispName,
+            MXIMPDataSubscriptionState::TSubscriptionState aSubscriptionState,
+            MXIMPDataSubscriptionState::TDataState aDataState,
+            TTestPBlOperationSpecifier aOperation,
+            RPrBlockInfoImpArray* aCurrentList = NULL
+            );
+
+
+private: // Test data
+
+    /**
+     * Eunit test case table declaration.
+     */
+    EUNIT_DECLARE_TEST_TABLE;
+
+    // owned
+    CXIMPTestContextWrapperMgr* iWrapperMgr;
+
+    //
+    TInt iLastError;
+    RXIMPObjOwningPtrArray< CPresenceBlockInfoImp > iValidateArray;
+    };
+
+
+#endif      //  T_PRESENCEBLOCKING_H
+
+
+
+// end of file
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_presenceblocking/t_presenceblocking.mmp	Wed Nov 03 09:32:20 2010 +0530
@@ -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:
+*
+*/
+
+#include            "../../tsrcutils/eunitcommon/eunittstdllbase.hrh"
+#include            "../../tsrcutils/processmaster/pm.h"
+
+#include<platform_paths.hrh>
+#include<eunitcaps.h>
+TARGET              t_presenceblocking.dll
+//CAPABILITY              ALL - TCB - DRM
+CAPABILITY      EUNIT_CAPS
+
+SOURCEPATH          .
+SOURCE              t_presenceblocking.cpp
+
+
+USERINCLUDE             ../../../../../ximpfw/core/srcdatamodel
+USERINCLUDE             ../../../../../ximpfw/presence/srcpresencedatamodel
+USERINCLUDE             ../../../../../ximpfw/presence/srcpresencedatamodel/presentitygroups
+USERINCLUDE             ../../../../../ximpfw/presence/srcpresencedatamodel/presencewatching
+USERINCLUDE             ../../../../../ximpfw/presence/srcpresencedatamodel/presenceauthorization
+USERINCLUDE             ../../../../../ximpfw/presence/srcpresencedatamodel/presencepublishing
+USERINCLUDE             ../../../../../ximpfw/presence/srcpresencedatamodel/presenceinfo
+USERINCLUDE             ../../../../../ximpfw/core/srcutils
+
+// TODO remove unnecessary
+#if defined ( OS_LAYER_SYSTEMINCLUDE )
+OS_LAYER_SYSTEMINCLUDE
+#else
+SYSTEMINCLUDE     /epoc32/include
+#endif
+
+ #if defined ( APP_LAYER_SYSTEMINCLUDE )
+ APP_LAYER_SYSTEMINCLUDE
+ #else
+ SYSTEMINCLUDE     \epoc32\include
+ #endif
+SYSTEMINCLUDE           ../../../../../ximpfw/inc/core/base
+SYSTEMINCLUDE           ../../../../../ximpfw/inc/core/datamodel
+SYSTEMINCLUDE           ../../../../../ximpfw/inc/core/protocolplugin
+SYSTEMINCLUDE           ../../../../../ximpfw/inc/core/protocolpluginhost
+SYSTEMINCLUDE           ../../../../../ximpfw/inc/presence/presencedatamodel
+SYSTEMINCLUDE           ../../../../../ximpfw/inc/presence/presencemanagement
+SYSTEMINCLUDE           ../../../../../ximpfw/inc/presence/presenceprotocolplugin
+SYSTEMINCLUDE           ../../../../../ximpfw/inc/presence/presenceprotocolpluginhost
+
+LIBRARY             ecom.lib
+LIBRARY             bafl.lib
+LIBRARY             ximpdatamodel.lib
+LIBRARY             presencedatamodel.lib
+LIBRARY             ximputils.lib
+LIBRARY             estor.lib
+LIBRARY             eunit.lib
+LIBRARY             eunitutil.lib
+LIBRARY             euser.lib
+
+// end of file
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_presencecache/T_PresenceCache.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,978 @@
+/*
+* 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:
+*
+*/
+
+
+//  CLASS HEADER
+#include "T_PresenceCache.h"
+
+//  EXTERNAL INCLUDES
+#include <EUnitMacros.h>
+#include <EUnitDecorators.h>
+
+
+#include <presenceinfoimp.h>
+#include <presenceinfo.h>
+#include <personpresenceinfoimp.h>
+#include <presenceinfofieldimp.h>
+#include <presenceinfofield.h>
+#include <presenceinfofieldcollectionimp.h>
+#include <presenceinfofieldcollection.h>
+#include <ximpbase.h>
+#include <presenceinfofieldvaluetext.h>
+#include <presenceinfofieldvaluetextimp.h>
+#include <presencebuddyinfo.h>
+#include <presencebuddyinfolist.h>
+#include <presencecacheclient.h>
+#include <ximpidentityimp.h>
+#include <ximpidentity.h>
+#include <presenceinfofieldvaluebinary.h>
+#include <presenceinfofieldvaluebinaryimp.h>
+
+#include <presencefeeder.h>
+
+
+// Implementation files used for testing only
+#include "presencebuddyinfoimp.h"
+#include "presenceinfoimp.h"
+#include "presencebuddyinfolistimp.h"
+
+
+// CONSTANTS
+_LIT8( KIdentityField, "Identity" );
+
+_LIT( KBuddyId1sip, "sip:BuddyId1@xyz.com" );
+_LIT( KBuddyId2sip, "sip:BuddyId2@xyz.com" );
+_LIT( KBuddyId3sip, "sip:BuddyId3@xyz.com" );
+_LIT( KBuddyId1ECE, "ECE:BuddyId1@xyz.com" );
+_LIT( KBuddyId2ECE, "ECE:BuddyId2@xyz.com" );
+_LIT( KBuddyId3ECE, "ECE:BuddyId3@xyz.com" );
+_LIT( KBuddyId1MSN, "MSN:BuddyId1@xyz.com" );
+_LIT( KBuddyId2MSN, "MSN:BuddyId2@xyz.com" );
+_LIT( KBuddyId3MSN, "MSN:BuddyId3@xyz.com" );
+_LIT( KBuddyId1VoIP, "VoIP:BuddyId1@xyz.com" );
+_LIT( KBuddyId2VoIP, "VoIP:BuddyId2@xyz.com" );
+_LIT( KBuddyId3VoIP, "VoIP:BuddyId3@xyz.com" );
+_LIT( KBuddyId1ICQ, "ICQ:BuddyId1@xyz.com" );
+_LIT( KBuddyId2ICQ, "ICQ:BuddyId2@xyz.com" );
+_LIT( KBuddyId3ICQ, "ICQ:BuddyId3@xyz.com" );
+_LIT( KBuddyId1no, "no:BuddyId1@xyz.com" );
+_LIT( KBuddyId2no, "no:BuddyId2@xyz.com" );
+_LIT( KBuddyId3no, "no:BuddyId3@xyz.com" );
+
+_LIT( KBuddyId1, "BuddyId1@xyz.com" );
+_LIT( KBuddyId2, "BuddyId2@xyz.com" );
+_LIT( KBuddyId3, "BuddyId3@xyz.com" );
+
+_LIT( KText1, "KText1" );
+_LIT( KText2, "KText2" );
+_LIT( KText3, "KText3" );
+_LIT( KText4, "KText4" );
+_LIT( KText5, "KText5" );
+_LIT( KText6, "KText6" );
+
+_LIT( KService1, "sip" );
+_LIT( KService2, "ECE" );
+_LIT( KService3, "MSN" );
+_LIT( KService4, "VoIP" );
+_LIT( KService5, "ICQ" );
+_LIT( KService6, "no" );
+
+//  INTERNAL INCLUDES
+
+
+// CONSTRUCTION
+T_PresenceCache* T_PresenceCache::NewL()
+    {
+    T_PresenceCache* self = T_PresenceCache::NewLC();
+    CleanupStack::Pop();
+
+    return self;
+    }
+
+T_PresenceCache* T_PresenceCache::NewLC()
+    {
+    T_PresenceCache* self = new( ELeave ) T_PresenceCache();
+    CleanupStack::PushL( self );
+
+    self->ConstructL();
+
+    return self;
+    }
+
+// Destructor (virtual by CBase)
+T_PresenceCache::~T_PresenceCache()
+    {
+    }
+
+// Default constructor
+T_PresenceCache::T_PresenceCache()
+    {
+    }
+
+// Second phase construct
+void T_PresenceCache::ConstructL()
+    {
+    // The ConstructL from the base class CEUnitTestSuiteClass must be called.
+    // It generates the test case table.
+    CEUnitTestSuiteClass::ConstructL();
+    
+    iCoverageTesting=EFalse;
+    }
+
+//  METHODS
+
+
+void T_PresenceCache::SetupL(  )
+    {
+    __UHEAP_MARK;
+    iMPresenceCacheWriter = MPresenceCacheWriter::NewL();
+    iMPresenceCacheReader = MPresenceCacheReader::NewL();
+    
+    iPresenceFeeder = MPresenceFeeder::NewL(KService6);
+    }
+    
+
+void T_PresenceCache::Teardown(  )
+    {
+    if(iMPresenceCacheReader)
+        delete iMPresenceCacheReader;
+    delete iMPresenceCacheWriter;
+    delete iPresenceFeeder;
+    delete iExpectedNotifyContent;
+    
+    if(iPresBuddyInfoList)
+        delete iPresBuddyInfoList;
+    REComSession::FinalClose();
+    User::SetJustInTime( ETrue );
+    __UHEAP_MARKEND;
+    }
+    
+void T_PresenceCache::T__PresenceInfoL()
+    {
+    // Try to read while empty
+    MXIMPIdentity* identity = iMPresenceCacheReader->NewIdentityLC();
+    identity->SetIdentityL(KBuddyId1);
+    
+    //KErrArgument
+    MPresenceInfo* presInfoRead = iMPresenceCacheReader->PresenceInfoLC(*identity);
+    EUNIT_ASSERT_EQUALS( (TInt)presInfoRead, NULL );
+    
+    //empty read
+    identity->SetIdentityL(KBuddyId1sip);
+    presInfoRead = iMPresenceCacheReader->PresenceInfoLC(*identity);
+    EUNIT_ASSERT_EQUALS( (TInt)presInfoRead, NULL );
+    
+    // write buddy presence info
+    MPresenceBuddyInfo* buddyPresInfoWrite = 
+                        MakeBuddyPresenceInfoLC(KBuddyId1sip, KText1);
+    TInt err = iMPresenceCacheWriter->WritePresenceL(buddyPresInfoWrite);
+                                                
+    // Now read it
+    presInfoRead = iMPresenceCacheReader->PresenceInfoLC(*identity);
+    
+    
+    //Now verify it
+    const CPresenceInfoImp* actualInfo = 
+        TXIMPGetImpClassOrPanic<const CPresenceInfoImp>::From(*(buddyPresInfoWrite->PresenceInfo()));
+        
+    CPresenceInfoImp* readInfo = 
+        TXIMPGetImpClassOrPanic<CPresenceInfoImp>::From(*presInfoRead);    
+    
+    TBool same = actualInfo->EqualsContent(*readInfo);
+
+    CleanupStack::PopAndDestroy(3); //identity, buddyPresInfoWrite, presInfoRead;   
+                                                
+    EUNIT_ASSERT_EQUALS( same, ETrue );
+    }
+    
+   
+void T_PresenceCache::T_WriteReadPresenceAsyncL()
+    {
+  
+    //MPresenceBuddyInfoList* buddyInfoList = CPresenceBuddyInfoListImp::NewLC(); 
+    MPresenceBuddyInfoList* buddyInfoList =  
+                            iMPresenceCacheWriter->NewPresenceBuddyInfoListLC(KNullDesC);
+    //buddyInfoList->SetServiceNameL(KService1);
+    // write buddies in all services
+    MPresenceBuddyInfo* buddyPresInfoWrite(NULL);
+    
+    TInt err2(KErrNone);
+    
+    buddyPresInfoWrite =MakeBuddyPresenceInfoLC(KBuddyId1sip, KText1);
+    buddyInfoList->AddOrReplace(buddyPresInfoWrite);CleanupStack::Pop(1);
+    
+    buddyPresInfoWrite =MakeBuddyPresenceInfoLC(KBuddyId2sip, KText1);
+    buddyInfoList->AddOrReplace(buddyPresInfoWrite);CleanupStack::Pop(1);
+
+    buddyPresInfoWrite =MakeBuddyPresenceInfoLC(KBuddyId3sip, KText1);
+    buddyInfoList->AddOrReplace(buddyPresInfoWrite);CleanupStack::Pop(1);
+
+    buddyPresInfoWrite =MakeBuddyPresenceInfoLC(KBuddyId1ECE, KText1);
+    buddyInfoList->AddOrReplace(buddyPresInfoWrite);CleanupStack::Pop(1);
+    
+    buddyPresInfoWrite =MakeBuddyPresenceInfoLC(KBuddyId2ECE, KText1);
+    buddyInfoList->AddOrReplace(buddyPresInfoWrite);CleanupStack::Pop(1);
+
+    buddyPresInfoWrite =MakeBuddyPresenceInfoLC(KBuddyId3ECE, KText1);
+    buddyInfoList->AddOrReplace(buddyPresInfoWrite);CleanupStack::Pop(1);
+
+    buddyPresInfoWrite =MakeBuddyPresenceInfoLC(KBuddyId1MSN, KText1);
+    buddyInfoList->AddOrReplace(buddyPresInfoWrite);CleanupStack::Pop(1);
+    
+    buddyPresInfoWrite =MakeBuddyPresenceInfoLC(KBuddyId2MSN, KText1);
+    buddyInfoList->AddOrReplace(buddyPresInfoWrite);CleanupStack::Pop(1);
+
+    buddyPresInfoWrite =MakeBuddyPresenceInfoLC(KBuddyId3MSN, KText1);
+    buddyInfoList->AddOrReplace(buddyPresInfoWrite);CleanupStack::Pop(1);
+
+        
+    //Only For increasing coverage for lists
+    MXIMPIdentity* identity = CXIMPIdentityImp::NewLC();
+    identity->SetIdentityL(KBuddyId3no);
+    EUNIT_ASSERT_EQUALS( buddyInfoList->FindAndRemove(*identity), KErrNotFound);
+    EUNIT_ASSERT_EQUALS( buddyInfoList->Count(), 9);
+    buddyPresInfoWrite =MakeBuddyPresenceInfoLC(KBuddyId3no, KText1);
+    EUNIT_ASSERT_EQUALS( buddyInfoList->AddOrReplace(buddyPresInfoWrite), KErrNone);
+    
+    EUNIT_ASSERT_EQUALS( buddyInfoList->Count(), 10);
+    EUNIT_ASSERT_EQUALS( buddyInfoList->FindAndRemove(*identity), KErrNone);
+    EUNIT_ASSERT_EQUALS( buddyInfoList->Count(), 9);
+    EUNIT_ASSERT_EQUALS( buddyInfoList->FindAndRemove(*identity), KErrNotFound);
+    CleanupStack::Pop(1); // buddyPresInfoWrite
+    EUNIT_ASSERT_EQUALS( (TInt)(buddyInfoList->FindAndGet(*identity)), NULL);
+    CleanupStack::PopAndDestroy(1); // identity
+    
+    //calling async write function
+    TInt err = iMPresenceCacheWriter->WritePresenceL(buddyInfoList,this);
+    //if (err==KErrNone)
+    //    WaitComplete();
+   //Try Cancelling
+    err = iMPresenceCacheWriter->CancelWrite(); //always cancels receiving callback
+    //Write Again
+    err = iMPresenceCacheWriter->WritePresenceL(buddyInfoList,this);
+    if (err==KErrNone)
+        WaitComplete();
+    else //Try again
+        {
+        err = iMPresenceCacheWriter->WritePresenceL(buddyInfoList,this);
+        if (err==KErrNone)
+            WaitComplete();
+        }
+    EUNIT_ASSERT_EQUALS( iErrorFromHandler, KErrNone);
+    
+    
+    // read from 3rd service MSN
+    err = iMPresenceCacheReader->AllBuddiesPresenceInService(KService3, this);
+    //Try Cancelling
+    err = iMPresenceCacheReader->CancelRead();
+    // Try reading again
+    err = iMPresenceCacheReader->AllBuddiesPresenceInService(KService3, this);
+    if (err+1)
+        WaitComplete();
+    EUNIT_ASSERT_EQUALS( iErrorFromHandler, KErrNone);
+    
+        
+    //Now verify it, pick something to verify
+    CPresenceBuddyInfoImp* actualInfo(NULL);
+    CPresenceBuddyInfoImp* readInfo(NULL);
+    RPointerArray<MPresenceBuddyInfo> myArraywrite = buddyInfoList->GetObjectCollection();
+    
+    RPointerArray<MPresenceBuddyInfo> myArrayread; // wont be owned
+    
+    TBool same1(EFalse);
+    if(iPresBuddyInfoList) // if list is received, compare for 3rd service MSN
+    	{
+    	myArrayread = iPresBuddyInfoList->GetObjectCollection(); //not owned
+        //1
+        actualInfo = 
+            TXIMPGetImpClassOrPanic<CPresenceBuddyInfoImp>::From(*(myArraywrite[6]));
+            
+        readInfo = 
+            TXIMPGetImpClassOrPanic<CPresenceBuddyInfoImp>::From(*(myArrayread[0]));   
+        
+        same1 = actualInfo->EqualsContent(*readInfo);
+    	}
+    
+    
+    // read for first service sip	
+    err = iMPresenceCacheReader->AllBuddiesPresenceInService(KService1, this);
+    if (err+1)
+        WaitComplete();
+    EUNIT_ASSERT_EQUALS( iErrorFromHandler, KErrNone);
+    TBool same2(EFalse);
+    if(iPresBuddyInfoList) // if list is received, compare for 1st service SIP
+        {
+        myArrayread = iPresBuddyInfoList->GetObjectCollection(); //not owned 
+        
+        actualInfo = 
+            TXIMPGetImpClassOrPanic<CPresenceBuddyInfoImp>::From(*(myArraywrite[2]));
+            
+        readInfo = 
+            TXIMPGetImpClassOrPanic<CPresenceBuddyInfoImp>::From(*(myArrayread[2]));   
+        
+        same2 = actualInfo->EqualsContent(*readInfo);  	
+     	}
+    
+    
+    // All buddies count
+    TInt count = iMPresenceCacheReader->BuddyCountInAllServices();
+    
+    // buddies count in specific service
+    TInt count2 = iMPresenceCacheReader->BuddyCountInService(KService2);
+    
+    
+    // Testing DeletePresenceL    
+    MXIMPIdentity* identity2 = CXIMPIdentityImp::NewLC();
+    identity2->SetIdentityL(KBuddyId3MSN);
+    TInt remove = iMPresenceCacheWriter->DeletePresenceL(*identity2);
+    EUNIT_ASSERT_EQUALS( remove, KErrNone );
+    remove = iMPresenceCacheWriter->DeletePresenceL(*identity2);
+    EUNIT_ASSERT_EQUALS( remove, KErrNotFound );
+    identity2->SetIdentityL(KBuddyId3ICQ);
+    remove = iMPresenceCacheWriter->DeletePresenceL(*identity2);
+    EUNIT_ASSERT_EQUALS( remove, KErrNotFound );
+    CleanupStack::PopAndDestroy(1); //identity2;   
+
+   
+   
+    TInt serviceCount = iMPresenceCacheReader->ServicesCount();
+    
+    CleanupStack::PopAndDestroy(1); //buddyInfoList;   
+                                                
+    EUNIT_ASSERT_EQUALS( same1, ETrue );
+    EUNIT_ASSERT_EQUALS( same2, ETrue );
+    EUNIT_ASSERT_EQUALS( count, 9 );
+    EUNIT_ASSERT_EQUALS( count2, 3 );
+    EUNIT_ASSERT_EQUALS( serviceCount, 3 );
+    
+    }
+    
+    
+void T_PresenceCache::T_DeletingAndCancellingL()
+    {
+    //Empty Reading
+    MXIMPIdentity* identity = CXIMPIdentityImp::NewLC();
+    identity->SetIdentityL(KBuddyId1);
+  
+    
+    CleanupStack::PopAndDestroy(1); //identity
+    
+    //Empty counting functions
+    
+    // All buddies count
+    TInt count = iMPresenceCacheReader->BuddyCountInAllServices();
+    EUNIT_ASSERT_EQUALS( count, 0 );
+    
+    // buddies count in specific service
+    TInt count2 = iMPresenceCacheReader->BuddyCountInService(KService2);
+    EUNIT_ASSERT_EQUALS( count2, KErrNotFound );
+
+   
+    //Services count
+    TInt serviceCount = iMPresenceCacheReader->ServicesCount();
+    EUNIT_ASSERT_EQUALS( serviceCount, 0 );
+    
+    
+    //Empty async reading
+    TInt err = iMPresenceCacheReader->AllBuddiesPresenceInService(KService3, this);
+    if (err+1)
+        WaitComplete();
+    EUNIT_ASSERT_EQUALS( iErrorFromHandler, KErrNotFound);
+    
+    //Writing async and verify results// this checks cancelling also
+    T_WriteReadPresenceAsyncL();
+    
+    // Now try deleting
+    err = iMPresenceCacheWriter->DeleteService(KService3);
+    EUNIT_ASSERT_EQUALS( err, KErrNone);
+    
+    //Try deleting again
+    err = iMPresenceCacheWriter->DeleteService(KService3);
+    EUNIT_ASSERT_EQUALS( err, KErrNotFound);
+    
+    //Try reading the deleted presence
+    err = iMPresenceCacheReader->AllBuddiesPresenceInService(KService3, this);
+    if (err==KErrNone)
+        WaitComplete();
+    EUNIT_ASSERT_EQUALS( iErrorFromHandler, KErrNotFound);
+    }
+    
+void T_PresenceCache::T_PerformanceL()
+    {
+    
+    
+    
+    
+    }
+    
+void T_PresenceCache::T_RunAllL()
+    {
+    T__PresenceInfoL();    
+    T_DeleteAllCacheL();
+    
+    T_WriteReadPresenceAsyncL();
+    T_DeleteAllCacheL();
+    
+    T_DeletingAndCancellingL();
+    // let the destructor delete the cache
+    }
+    
+    
+//Utility Functions    
+MPresenceInfo* T_PresenceCache::MakePresenceInfoLC()
+    {
+    MPresenceInfo* presInfo = CPresenceInfoImp::NewLC();
+    
+    MPresenceInfoFieldValueText* value = CPresenceInfoFieldValueTextImp::NewLC();
+    value->SetTextValueL(KBuddyId1);
+    
+    MPresenceInfoField* infoField = CPresenceInfoFieldImp::NewLC();
+    infoField->SetFieldTypeL(KIdentityField);
+    infoField->SetFieldValue(value);
+    
+    
+    MPersonPresenceInfo* personPres = CPersonPresenceInfoImp::NewLC();
+    MPresenceInfoFieldCollection& fieldCol = personPres->Fields();
+    fieldCol.AddOrReplaceFieldL(infoField);
+    TInt fieldCount= fieldCol.FieldCount();
+        
+    presInfo->SetPersonPresenceL(personPres);
+    
+    CleanupStack::Pop(3);//personPres,infoField,value
+    
+    return presInfo;
+    }
+
+// Utility function but also test some code
+MPresenceBuddyInfo* T_PresenceCache::MakeBuddyPresenceInfoLC(
+                                                const TDesC& id, const TDesC& text)
+    {
+    // it sets objects differently for different flag values of iCoverageTesting
+    // just of code coverage purpose
+    if(iCoverageTesting) 
+        { // make the new 
+        iCoverageTesting = !iCoverageTesting;
+        MPresenceBuddyInfo* buddyPresInfo = iMPresenceCacheWriter->NewBuddyPresenceInfoLC();
+        MPresenceInfo* presInfo = iMPresenceCacheWriter->NewPresenceInfoLC();
+        
+        MPresenceInfoFieldValueText* value = CPresenceInfoFieldValueTextImp::NewLC();
+        value->SetTextValueL(text);
+        
+        MPresenceInfoField* infoField = CPresenceInfoFieldImp::NewLC();
+        infoField->SetFieldTypeL(KIdentityField);
+        infoField->SetFieldValue(value);
+        
+        
+        MPersonPresenceInfo* personPres = CPersonPresenceInfoImp::NewLC();
+        MPresenceInfoFieldCollection& fieldCol = personPres->Fields();
+        fieldCol.AddOrReplaceFieldL(infoField);
+        TInt fieldCount= fieldCol.FieldCount();
+            
+        presInfo->SetPersonPresenceL(personPres);
+        
+        MXIMPIdentity* identity = CXIMPIdentityImp::NewLC();
+        identity->SetIdentityL(id);
+        
+        buddyPresInfo->Set(identity, presInfo);
+        
+        CleanupStack::Pop(5);//personPres,infoField,value,buddyPresInfo, identity
+        
+        return buddyPresInfo;
+        }
+    
+    iCoverageTesting = !iCoverageTesting;    
+    MPresenceBuddyInfo* buddyPresInfo = iMPresenceCacheWriter->NewBuddyPresenceInfoLC();
+    MPresenceInfo* presInfo = iMPresenceCacheWriter->NewPresenceInfoLC();
+    
+    MPresenceInfoFieldValueText* value = CPresenceInfoFieldValueTextImp::NewLC();
+    value->SetTextValueL(text);
+    
+    MPresenceInfoField* infoField = CPresenceInfoFieldImp::NewLC();
+    infoField->SetFieldTypeL(KIdentityField);
+    infoField->SetFieldValue(value);
+    
+    
+    MPersonPresenceInfo* personPres = CPersonPresenceInfoImp::NewLC();
+    MPresenceInfoFieldCollection& fieldCol = personPres->Fields();
+    fieldCol.AddOrReplaceFieldL(infoField);
+    TInt fieldCount= fieldCol.FieldCount();
+        
+    presInfo->SetPersonPresenceL(personPres);
+    
+    MXIMPIdentity* identity = CXIMPIdentityImp::NewLC();
+    identity->SetIdentityL(id);
+    
+   
+    //Call again for the sake of code coverage
+    EUNIT_ASSERT_EQUALS( buddyPresInfo->SetBuddyId(identity), KErrNone);
+    EUNIT_ASSERT_EQUALS( buddyPresInfo->SetPresenceInfo(presInfo), KErrNone);
+    
+    CleanupStack::Pop(5);//personPres,infoField,value,buddyPresInfo, identity
+    
+    return buddyPresInfo;
+    }
+    
+void T_PresenceCache::T_DeleteAllCacheL()
+    {
+    // all service uids
+    TInt count = iMPresenceCacheReader->ServicesCount();
+    TInt err(KErrNone);
+    
+    err = iMPresenceCacheWriter->DeleteService(KService1);
+    err = iMPresenceCacheWriter->DeleteService(KService2);
+    err = iMPresenceCacheWriter->DeleteService(KService3);
+    err = iMPresenceCacheWriter->DeleteService(KService4);
+    err = iMPresenceCacheWriter->DeleteService(KService5);
+    err = iMPresenceCacheWriter->DeleteService(KService6);
+    }
+    
+void T_PresenceCache::T_MakePerformancePreconditionsL()
+    {
+    }
+
+// Buddy with status text and avater    
+MPresenceBuddyInfo*  T_PresenceCache::T_MakePerformanceBuddyLC(const TDesC& /*id*/ )
+    {
+    /*
+    MPresenceBuddyInfo* buddyPresInfo = iMPresenceCacheWriter->NewBuddyPresenceInfoLC();
+    MPresenceInfo* presInfo = iMPresenceCacheWriter->NewPresenceInfoLC();
+    
+    //Text field
+    MPresenceInfoFieldValueText* value = CPresenceInfoFieldValueTextImp::NewLC();
+    value->SetTextValueL(text);
+    
+    MPresenceInfoField* infoField = CPresenceInfoFieldImp::NewLC();
+    infoField->SetFieldTypeL(KIdentityField);
+    infoField->SetFieldValue(value);
+    
+    //Binary field
+    MPresenceInfoFieldValueBinay* value = CPresenceInfoFieldValueBinaryImp::NewLC();
+    value->SetBinaryValueL(text);
+    
+    MPresenceInfoField* infoField = CPresenceInfoFieldImp::NewLC();
+    infoField->SetFieldTypeL(KIdentityField);
+    infoField->SetFieldValue(value);
+    
+    
+    
+    MPersonPresenceInfo* personPres = CPersonPresenceInfoImp::NewLC();
+    MPresenceInfoFieldCollection& fieldCol = personPres->Fields();
+    fieldCol.AddOrReplaceFieldL(infoField);
+    TInt fieldCount= fieldCol.FieldCount();
+        
+    presInfo->SetPersonPresenceL(personPres);
+    
+    MXIMPIdentity* identity = CXIMPIdentityImp::NewLC();
+    identity->SetIdentityL(id);
+    
+    TUid serviceid;
+    serviceid.iUid = service;
+    
+    buddyPresInfo->Set(serviceid, identity, presInfo);
+    
+    CleanupStack::Pop(5);//personPres,infoField,value,buddyPresInfo, identity
+    
+    return buddyPresInfo;*/
+    }
+
+
+void T_PresenceCache::T_SubscribeBuddy1Response()
+    {    
+    // Notice: First set the initial state for User1, this is needed at least now. 
+    MPresenceBuddyInfo* initInfo = MakeBuddyPresenceInfoLC(KBuddyId1no, KText1);        
+    TInt err = iMPresenceCacheWriter->WritePresenceL(initInfo);
+    CleanupStack::PopAndDestroy(  ); // initInfo      
+    EUNIT_ASSERT_EQUALS( err, 0 );    
+        
+    err = iMPresenceCacheReader->SetObserverForSubscribedNotifications( this );   
+    EUNIT_ASSERT_EQUALS( err, 0 );    
+    
+    MXIMPIdentity* identity = CXIMPIdentityImp::NewLC();
+    identity->SetIdentityL(KBuddyId1no);
+    
+    err = iMPresenceCacheReader->SubscribePresenceBuddyChangeL( *identity);      
+    CleanupStack::PopAndDestroy(1); //identity    
+    EUNIT_ASSERT_EQUALS( err, 0 );
+    
+    // Presence feeder 
+    iExpectedNotifyStatus = KErrNone;
+    iNbrNotifys = 1;
+    iPresenceFeeder->SetAvailabilityL( KBuddyId1, MPresenceFeeder::ENotAvailable, KText2);
+        
+    // TODO: 
+    delete iExpectedNotifyContent;
+    iExpectedNotifyContent = NULL;
+    iExpectedNotifyContent = 
+        MakeBuddyPresenceInfoLC(KBuddyId1no, KText2);
+    CleanupStack::Pop(  );  // iExpectedNotifyContent
+    err = iMPresenceCacheWriter->WritePresenceL(iExpectedNotifyContent);    
+    EUNIT_ASSERT_EQUALS( err, 0 );
+    
+    iPresenceFeeder->RemoveAvailabilityL(KBuddyId2);                
+    
+    // Now we start to wait callback method HandlePresenceNotificationL  
+    WaitComplete();
+    }
+
+void T_PresenceCache::T_SubscribeBuddyAndUnsubscribe()
+    {
+    // Test few error cases first
+            
+    // Test null parameter error case
+    TInt err = iMPresenceCacheReader->SetObserverForSubscribedNotifications( NULL );   
+    EUNIT_ASSERT_EQUALS( err, KErrArgument );
+    
+    // Test subscription without callback registeration
+    MXIMPIdentity* identity = CXIMPIdentityImp::NewLC();
+    identity->SetIdentityL(KBuddyId1ECE);    
+ 
+    err = iMPresenceCacheReader->SubscribePresenceBuddyChangeL( *identity); 
+    EUNIT_ASSERT_EQUALS( err, KErrNotReady );    
+    
+    // Now make successful subscription  
+    err = iMPresenceCacheReader->SetObserverForSubscribedNotifications( this );   
+    EUNIT_ASSERT_EQUALS( err, 0 );    
+    err = iMPresenceCacheReader->SubscribePresenceBuddyChangeL( *identity);     
+    EUNIT_ASSERT_EQUALS( err, 0);
+    
+    // Make successful unsubscription    
+    iMPresenceCacheReader->UnSubscribePresenceBuddyChangeL( *identity);        
+    
+    CleanupStack::PopAndDestroy(1); //identity        
+    // Now we start to wait callback method HandlePresenceNotificationL    
+    }
+
+void T_PresenceCache::T_SubscribeBuddyManyResponses()
+    {  
+    // Notice: First set the initial state for User1, this is needed at least now. 
+    MPresenceBuddyInfo* initInfo = MakeBuddyPresenceInfoLC(KBuddyId1no, KText1);        
+    TInt err = iMPresenceCacheWriter->WritePresenceL(initInfo);
+    CleanupStack::PopAndDestroy(  ); // initInfo      
+    EUNIT_ASSERT_EQUALS( err, 0 );  
+    
+    err = iMPresenceCacheReader->SetObserverForSubscribedNotifications( this );   
+    EUNIT_ASSERT_EQUALS( err, 0 );    
+    
+    MXIMPIdentity* identity = CXIMPIdentityImp::NewLC();
+    identity->SetIdentityL(KBuddyId1no);
+    
+    err = iMPresenceCacheReader->SubscribePresenceBuddyChangeL( *identity);      
+    CleanupStack::PopAndDestroy(1); //identity    
+    EUNIT_ASSERT_EQUALS( err, 0 );
+    
+    // Presence feeder 
+    iExpectedNotifyStatus = KErrNone;
+    iNbrNotifys = 4;
+    iPresenceFeeder->SetAvailabilityL( KBuddyId1, MPresenceFeeder::ENotAvailable, KText2);
+        
+    delete iExpectedNotifyContent;
+    iExpectedNotifyContent = NULL;
+    iExpectedNotifyContent = 
+        MakeBuddyPresenceInfoLC(KBuddyId1no, KText1);
+    CleanupStack::Pop(  );  // iExpectedNotifyContent 
+    err = iMPresenceCacheWriter->WritePresenceL(iExpectedNotifyContent);    
+    EUNIT_ASSERT_EQUALS( err, 0 );
+                   
+    // Now we start to wait callback method HandlePresenceNotificationL  
+    WaitComplete();        
+    }
+    
+void T_PresenceCache::T_DeleteBeforeNotify()
+    {
+    // Notice: First set the initial state for User1, this is needed at least now. 
+    TInt err;
+    /*
+    MPresenceBuddyInfo* initInfo = MakeBuddyPresenceInfoLC( KServiceUid6, KBuddyId1, KText1);        
+    TInt err = iMPresenceCacheWriter->WritePresenceL(initInfo);
+    CleanupStack::PopAndDestroy(  ); // initInfo      
+    EUNIT_ASSERT_EQUALS( err, 0 ); */   
+        
+    err = iMPresenceCacheReader->SetObserverForSubscribedNotifications( this );   
+    EUNIT_ASSERT_EQUALS( err, 0 );    
+    
+    MXIMPIdentity* identity = CXIMPIdentityImp::NewLC();
+    identity->SetIdentityL(KBuddyId1no);
+    
+    err = iMPresenceCacheReader->SubscribePresenceBuddyChangeL( *identity);      
+    CleanupStack::PopAndDestroy(1); //identity    
+    EUNIT_ASSERT_EQUALS( err, 0 );
+    
+    // Presence feeder 
+    iExpectedNotifyStatus = KErrNone;
+    iNbrNotifys = 1;
+    
+    
+    delete iMPresenceCacheReader;
+    iMPresenceCacheReader = NULL;
+        
+    // TODO: 
+    delete iExpectedNotifyContent;
+    iExpectedNotifyContent = NULL;
+    iExpectedNotifyContent = 
+        MakeBuddyPresenceInfoLC(KBuddyId1no, KText2);
+    CleanupStack::Pop(  );  // iExpectedNotifyContent
+    err = iMPresenceCacheWriter->WritePresenceL(iExpectedNotifyContent);    
+    EUNIT_ASSERT_EQUALS( err, 0 );
+    
+    //no notification should come, since we have deleted the subscriber
+    }
+
+
+// Callback observers
+    
+void T_PresenceCache::HandlePresenceWriteL(TInt aErrorCode)
+    {
+	EUNIT_PRINT(_L("HandlePresenceWriteL"));
+	EUNIT_PRINT(_L("    aErrorCode: %d"), aErrorCode);
+    iCbReceived = ETrue;
+    iErrorFromHandler = aErrorCode;
+
+    if( iWait.IsStarted() )
+        {
+        iWait.AsyncStop();
+        }
+    }
+
+void T_PresenceCache::HandlePresenceReadL(TInt aErrorCode,
+                    MPresenceBuddyInfoList* aPresenceBuddyInfoList)
+    {
+	EUNIT_PRINT(_L("HandlePresenceReadL"));
+	EUNIT_PRINT(_L("    aErrorCode: %d"), aErrorCode);
+    iCbReceived = ETrue;
+    iErrorFromHandler = aErrorCode;
+    
+    
+    if(iPresBuddyInfoList)
+    	delete iPresBuddyInfoList; iPresBuddyInfoList=NULL;
+    iPresBuddyInfoList = aPresenceBuddyInfoList;
+    
+    if( iWait.IsStarted() )
+        {
+        iWait.AsyncStop();
+        }
+    }
+    
+// *****************************************************************************   
+                            
+void T_PresenceCache::HandlePresenceNotificationL(TInt aErrorCode,
+                            MPresenceBuddyInfo* aPresenceBuddyInfo)
+    {
+	EUNIT_PRINT(_L("HandlePresenceNotiicationL"));
+	EUNIT_PRINT(_L("    aErrorCode: %d"), aErrorCode);
+    iCbReceived = ETrue;
+    iErrorFromHandler = aErrorCode;
+    
+    // check what is expected
+    EUNIT_ASSERT_EQUALS( aErrorCode, iExpectedNotifyStatus );     
+    
+    if ( aPresenceBuddyInfo )
+        {
+        // We do not want to get anything when not expecting it.
+        TBool isNull = iExpectedNotifyContent ? EFalse : ETrue;
+        EUNIT_ASSERT_EQUALS( isNull, EFalse  ); 
+        // just check that this does not crash
+        const MXIMPIdentity* buddyId = aPresenceBuddyInfo->BuddyId();
+        // Then test the whole content 
+        TBool eq = iExpectedNotifyContent->EqualsIdentity( aPresenceBuddyInfo );  
+        EUNIT_ASSERT_EQUALS( eq, ETrue );          
+        }
+    else
+        {
+        EUNIT_PRINT(_L("  received buddyInfo is NULL"));        
+        }
+               
+    delete aPresenceBuddyInfo; 
+    
+    iNbrNotifys--;
+    
+    /* The test sequence of complicated case is
+     * sub Usr1
+     * write Usr1 -> Notify
+     * sub Usr2
+     * write Usr1 -> Notify
+     * write Usr2 -> Notify
+     * unsub Usr2
+     * write Usr2
+     * delete Usr1 -> notify(empty)
+     */
+    
+    switch ( iNbrNotifys )
+        {
+        case 3: 
+            // subscribe U2
+            {   
+            // Notice: First set the initial state for User1, this is needed at least now. 
+            MPresenceBuddyInfo* initInfo = MakeBuddyPresenceInfoLC(KBuddyId2no, KText2);        
+            TInt err = iMPresenceCacheWriter->WritePresenceL(initInfo);
+            CleanupStack::PopAndDestroy(  ); // initInfo      
+            EUNIT_ASSERT_EQUALS( err, 0 ); 
+            
+            MXIMPIdentity* identity = CXIMPIdentityImp::NewLC();
+            identity->SetIdentityL(KBuddyId2no);            
+            err = iMPresenceCacheReader->SubscribePresenceBuddyChangeL( *identity);      
+            CleanupStack::PopAndDestroy(1); //identity    
+            EUNIT_ASSERT_EQUALS( err, 0 );
+            
+            // Presence feeder 
+            iExpectedNotifyStatus = KErrNone;                
+            delete iExpectedNotifyContent;
+            iExpectedNotifyContent = NULL;
+            iExpectedNotifyContent = 
+                MakeBuddyPresenceInfoLC(KBuddyId1no, KText1);
+            CleanupStack::Pop(  );  // iExpectedNotifyContent       
+            err = iMPresenceCacheWriter->WritePresenceL(iExpectedNotifyContent);    
+            EUNIT_ASSERT_EQUALS( err, 0 );   
+            // Now we start to wait callback method HandlePresenceNotificationL               
+            }
+            break;
+        case 2: 
+            {
+            // Presence feeder 
+            iExpectedNotifyStatus = KErrNone;                
+            delete iExpectedNotifyContent;
+            iExpectedNotifyContent = NULL;
+            iExpectedNotifyContent = 
+                MakeBuddyPresenceInfoLC(KBuddyId2no, KText3);
+            CleanupStack::Pop(  );  // iExpectedNotifyContent       
+            TInt err = iMPresenceCacheWriter->WritePresenceL(iExpectedNotifyContent);    
+            EUNIT_ASSERT_EQUALS( err, 0 );   
+            // Now we start to wait callback method HandlePresenceNotificationL          
+            }
+            break;
+        case 1:
+            {
+            // Unsubscribe Usr2
+            MXIMPIdentity* identity = CXIMPIdentityImp::NewLC();
+            identity->SetIdentityL(KBuddyId2no);            
+            iMPresenceCacheReader->UnSubscribePresenceBuddyChangeL( *identity );      
+            CleanupStack::PopAndDestroy(1); //identity    
+            
+            // Write Usr2 
+            iExpectedNotifyStatus = KErrNone;                
+            delete iExpectedNotifyContent;
+            iExpectedNotifyContent = NULL;   
+            
+            // delete Usr1
+            iPresenceFeeder->RemovePresenceL(KBuddyId1no); 
+            iExpectedNotifyContent = 
+               MakeBuddyPresenceInfoLC( KBuddyId1no, KText3);
+            TInt err =  iExpectedNotifyContent->SetPresenceInfo( NULL );
+            EUNIT_ASSERT_EQUALS( err, KErrArgument ); 
+            CleanupStack::Pop(  );  // iExpectedNotifyContent            
+            
+            // Now we start to wait callback method HandlePresenceNotificationL
+            }
+            break;
+        case 0:
+        default:         
+            if( iWait.IsStarted() )
+                {
+                iWait.AsyncStop();
+                }
+            break;   
+        };
+    
+    }  
+    
+// *****************************************************************************                                  
+    
+    
+void T_PresenceCache::T_TestFeeder()
+    {
+    iPresenceFeeder->SetAvailabilityL(KBuddyId1,MPresenceFeeder::ENotAvailable,KText2);
+    iPresenceFeeder->SetAvailabilityL(KBuddyId1,MPresenceFeeder::ENotAvailable,KText2);
+    iPresenceFeeder->RemoveAvailabilityL(KBuddyId2);
+    iPresenceFeeder->RemoveAvailabilityL(KBuddyId1);
+    iPresenceFeeder->SetAvailabilityL(KBuddyId1,MPresenceFeeder::ENotAvailable,KText2);
+    iPresenceFeeder->RemovePresenceL(KBuddyId2);
+    iPresenceFeeder->RemovePresenceL(KBuddyId1);
+    iPresenceFeeder->SetAvailabilityL(KBuddyId1,MPresenceFeeder::ENotAvailable,KText2);
+    iPresenceFeeder->RemoveAllPresences();
+    }
+    
+//  TEST TABLE
+EUNIT_BEGIN_TEST_TABLE(
+    T_PresenceCache,
+    "Presence Cache module tests.",
+    "MODULE" )
+    
+EUNIT_TEST(
+    "T__PresenceInfoL",
+    "PresenceCache",
+    "T__PresenceInfoL",
+    "FUNCTIONALITY",
+    SetupL, T__PresenceInfoL, Teardown)
+    
+EUNIT_TEST(
+    "T_WriteReadPresenceAsyncL",
+    "PresenceCache",
+    "T_WriteReadPresenceAsyncL",
+    "FUNCTIONALITY",
+    SetupL, T_WriteReadPresenceAsyncL, Teardown)
+    
+EUNIT_TEST(
+	    "T_DeletingAndCancellingL",
+	    "PresenceCache",
+	    "T_DeletingAndCancellingL",
+	    "FUNCTIONALITY",
+	    SetupL, T_DeletingAndCancellingL, Teardown)    
+    
+EUNIT_TEST(
+	    "T_RunAllL",
+	    "PresenceCache",
+	    "T_RunAllL",
+	    "FUNCTIONALITY",
+	    SetupL, T_RunAllL, Teardown)
+	    
+EUNIT_TEST(
+	    "T_TestFeeder",
+	    "PresenceFeeder",
+	    "T_TestFeeder",
+	    "FUNCTIONALITY",
+	    SetupL, T_TestFeeder, Teardown)
+    
+EUNIT_TEST(
+	    "T_SubscribeBuddyAndUnsubscribe",
+	    "PresenceCache",
+	    "T_SubscribeBuddyAndUnsubscribe",
+	    "FUNCTIONALITY",
+	    SetupL, T_SubscribeBuddyAndUnsubscribe, Teardown)	    
+	    
+EUNIT_TEST(
+	    "T_SubscribeBuddy1Response",
+	    "PresenceCache",
+	    "T_SubscribeBuddy1Response",
+	    "FUNCTIONALITY",
+	    SetupL, T_SubscribeBuddy1Response, Teardown)
+        
+EUNIT_TEST(
+        "T_SubscribeBuddyManyResponses",
+        "PresenceCache",
+        "T_SubscribeBuddyManyResponses",
+        "FUNCTIONALITY",
+        SetupL, T_SubscribeBuddyManyResponses, Teardown)
+        
+EUNIT_TEST(
+        "T_DeleteBeforeNotify",
+        "PresenceCache",
+        "T_DeleteBeforeNotify",
+        "FUNCTIONALITY",
+        SetupL, T_DeleteBeforeNotify, Teardown)
+        
+EUNIT_END_TEST_TABLE
+
+//  END OF FILE
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_presencecache/T_PresenceCache.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,161 @@
+/*
+* 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:
+*
+*/
+
+
+#ifndef __T_MPRESENCECACHEREADER_H__
+#define __T_MPRESENCECACHEREADER_H__
+
+//  EXTERNAL INCLUDES
+#include <CEUnitTestSuiteClass.h>
+#include <EUnitDecorators.h>
+#include <presencecachereader.h>
+#include <presencecachewriter.h>
+#include <prescachereadhandler.h>
+#include <prescachewritehandler.h>
+
+#include <e32cmn.h>
+
+class MPresenceBuddyInfo;
+class MPresenceFeeder;
+
+
+//  INTERNAL INCLUDES
+
+
+//  FORWARD DECLARATIONS
+
+
+//  CLASS DEFINITION
+/**
+ * TODO Auto-generated EUnit test suite
+ *
+ */
+NONSHARABLE_CLASS( T_PresenceCache )
+	: public CEUnitTestSuiteClass,
+	  public MPresCacheReadHandler,
+	  public MPresCacheWriteHandler
+    {
+    public:     // Constructors and destructors
+
+        /**
+         * Two phase construction
+         */
+        static T_PresenceCache* NewL();
+        static T_PresenceCache* NewLC();
+        /**
+         * Destructor
+         */
+        ~T_PresenceCache();
+        
+    public:     // from handlers
+        void HandlePresenceWriteL(TInt aErrorCode);    
+        void HandlePresenceReadL(TInt aErrorCode,
+            MPresenceBuddyInfoList* aPresenceBuddyInfoList);
+        void HandlePresenceNotificationL(TInt aErrorCode,
+                            MPresenceBuddyInfo* aPresenceBuddyInfo);            
+            
+    private:    // Constructors and destructors
+
+        T_PresenceCache();
+        void ConstructL();
+
+    private:    // New methods
+
+         void SetupL();
+        
+         void Teardown();
+         
+         void T__PresenceInfoL();
+        
+         void T_WriteReadPresenceAsyncL();
+        
+         void T_DeletingAndCancellingL();
+         
+         void T_PerformanceL();
+         
+         void T_RunAllL();
+         
+         void T_TestFeeder();
+        
+         void T_SubscribeBuddy1Response();
+         
+         void T_SubscribeBuddyAndUnsubscribe(); 
+         
+         void T_SubscribeBuddyManyResponses();
+         
+         void T_DeleteBeforeNotify();
+         
+       
+    private:    // utilities
+         MPresenceInfo* MakePresenceInfoLC();
+         
+         MPresenceBuddyInfo* MakeBuddyPresenceInfoLC(
+                                         const TDesC& id, const TDesC& text);
+                                         
+         void T_DeleteAllCacheL();
+         
+         void T_MakePerformancePreconditionsL();
+         
+         MPresenceBuddyInfo* T_MakePerformanceBuddyLC(const TDesC& id);                  
+         
+         inline void WaitComplete();
+        
+
+    private:    // Data
+		
+        MPresenceCacheReader* iMPresenceCacheReader;
+        MPresenceCacheWriter* iMPresenceCacheWriter;
+        
+        MPresenceFeeder* iPresenceFeeder;
+        
+        
+        MPresenceBuddyInfoList* iPresBuddyInfoList;
+        
+        EUNIT_DECLARE_TEST_TABLE;
+        TUid iUid;
+        
+        TBool iCoverageTesting;
+        
+        // we will record the error from handler here
+        TInt iErrorFromHandler;
+		
+		//OWN: Active scheduler wait and Cb received indication
+        CActiveSchedulerWait iWait;
+        TBool iCbReceived;
+        
+        // expected status of next notification
+        TInt iExpectedNotifyStatus; 
+        // How many notifications are waicted until test is done.
+        TInt iNbrNotifys;
+        // Expected content of notification
+        // OWN
+        MPresenceBuddyInfo* iExpectedNotifyContent;        
+        
+    };
+    
+inline void T_PresenceCache::WaitComplete()
+    {
+    iCbReceived = EFalse;
+    if( !iCbReceived )
+        {
+        iWait.Start();
+        }
+    }
+    
+#endif      //  __T_MPRESENCECACHEREADER_H__
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_presencecache/T_PresenceCache.mmp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,72 @@
+/*
+* 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:
+*
+*/
+
+#include <platform_paths.hrh>
+
+
+TARGET          t_presencecache.dll
+TARGETTYPE      dll
+UID             0x1000af5a 0x01700000
+
+CAPABILITY              ALL -TCB 
+VENDORID                0x00000000
+
+SOURCEPATH              .
+SOURCE                  t_presencecache.cpp
+SOURCE                  t_presencecache_dllmain.cpp
+
+
+USERINCLUDE             .
+USERINCLUDE             ../../../../../ximpfw/presence/srcpresencedatamodel
+USERINCLUDE             ../../../../../ximpfw/presence/srcpresencedatamodel/presencecache
+
+SYSTEMINCLUDE           /epoc32/../../epoc32/include
+SYSTEMINCLUDE           /epoc32/../../epoc32/include/Digia/EUnit
+
+// System include folders required by the tested code
+//SYSTEMINCLUDE           ../../../inc/presence/presencecache
+SYSTEMINCLUDE           ../../../../../ximpfw/inc/presence/presencedatamodel
+
+
+//Following internal headers we are using
+SYSTEMINCLUDE           ../../../../../ximpfw/core/srcdatamodel
+SYSTEMINCLUDE           ../../../../../ximpfw/core/srcutils
+
+
+SYSTEMINCLUDE           ../../../../../ximpfw/presence/srcpresencedatamodel/presencepublishing
+SYSTEMINCLUDE           ../../../../../ximpfw/presence/srcpresencedatamodel/presenceinfo
+SYSTEMINCLUDE           ../../../../../ximpfw/presence/srcpresencedatamodel/presentitygroups
+SYSTEMINCLUDE           ../../../../../ximpfw/presence/srcpresencedatamodel
+SYSTEMINCLUDE           ../../../../../ximpfw/presence/srcpresencedatamodel/presencewatching
+SYSTEMINCLUDE           ../../../../../ximpfw/presence/srcpresencedatamodel/presenceauthorization
+SYSTEMINCLUDE           ../../../../../ximpfw/presence/srcpresencecache/presencecacheclient
+SYSTEMINCLUDE           ../../../../../ximpfw/presence/srcpresencecache/presencecacheserver
+
+MW_LAYER_SYSTEMINCLUDE
+
+LIBRARY                 EUnit.lib
+LIBRARY                 EUnitUtil.lib
+LIBRARY                 euser.lib
+LIBRARY                 ecom.lib
+LIBRARY                 presencedatamodel.lib
+LIBRARY                 ximpdatamodel.lib
+LIBRARY                 presencecacheclient.lib
+LIBRARY                 ximputils.lib
+
+LIBRARY                 presencefeeder.lib
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_presencecache/T_PresenceCache_DllMain.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -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:
+*
+*/
+
+
+//  CLASS HEADER
+#include "T_PresenceCache.h"
+
+//  EXTERNAL INCLUDES
+#include <CEUnitTestSuite.h>
+
+EXPORT_C MEUnitTest* CreateTestSuiteL()
+    {
+    return T_PresenceCache::NewL();
+    }
+
+#ifndef EKA2
+GLDEF_C TInt E32Dll( TDllReason )
+	{
+	return KErrNone;
+	}
+#endif
+
+//  END OF FILE
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_presencecache/bld.inf	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,28 @@
+/*
+* 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:
+*
+*/
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+// /epoc32/release/winscw/udeb/t_presencecache.dll	/epoc32/release/winscw/udeb/z/sys/bin/t_presencecache.dll
+
+PRJ_TESTMMPFILES
+T_PresenceCache.mmp
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_presencegrantrequestmngt/bld.inf	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,25 @@
+/*
+* 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 t_presencegrantrequestmngt.dll
+*
+*/
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+PRJ_TESTMMPFILES
+t_presencegrantrequestmngt.mmp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_presencegrantrequestmngt/t_presencegrantrequestmngt.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,913 @@
+/*
+* 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:
+*
+*/
+
+
+#include "eunittools.h"
+
+#include <platform/digia/eunit/eunitmacros.h>
+#include <platform/digia/eunit/teunitassertioninfo.h>
+
+#include <ecom/ecom.h>
+#include <badesca.h>
+
+#include <ximpbase.h>
+#include <ximpclient.h>
+#include <ximpcontext.h>
+#include <presencefeatures.h>
+#include <presenceauthorization.h>
+
+#include "t_presencegrantrequestmngt.h"
+
+#include "ximprequestcompleteeventimp.h"
+
+//#include "prfwtestpresencedatautils.h"
+
+// grant req includes
+#include "presencegrantrequestinfoimp.h"
+#include "presencegrantrequestlisteventimp.h"
+
+
+// other data model includes
+#include "ximpidentityimp.h"
+
+// utils includes
+#include "ximpobjecthelpers.h"
+
+// testing tool includes
+#include "prfwtestmessaging.h"
+#include "prfwtestmessenger.h"
+#include "prfwtestcontextwrappermgr.h"
+#include "prfwtestcontextwrapper.h"
+
+#include "prfwtestfilesrvmsg.h"
+#include "prfwtestfiletool.h"
+#include "prfwtestlistener.h"
+
+#include "prfwtestrobustnesstools.h"
+
+_LIT8( KPrefix1, "PreA_" );
+_LIT8( KPrefix2, "PreB_" );
+_LIT8( KPrefix3, "PreC_" );
+_LIT8( KPrefix4, "PreD_" );
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// CONSTRUCTION
+T_PresenceGrantRequestManagement* T_PresenceGrantRequestManagement::NewL()
+    {
+    T_PresenceGrantRequestManagement* self = new( ELeave ) T_PresenceGrantRequestManagement;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+
+    return self;
+    }
+
+
+T_PresenceGrantRequestManagement::~T_PresenceGrantRequestManagement()
+    {
+    PrfwTestRobustness::DoPreCleaning();
+    }
+
+
+void T_PresenceGrantRequestManagement::ConstructL()
+    {
+    CEUnitTestSuiteClass::ConstructL();
+    }
+
+
+T_PresenceGrantRequestManagement::T_PresenceGrantRequestManagement()
+    {
+    }
+
+
+
+// ===========================================================================
+// TEST CASE SETUP & TEARDOWN METHODS
+// ===========================================================================
+//
+
+void T_PresenceGrantRequestManagement::Setup_L()
+    {
+    PrfwTestRobustness::DoPreCleaning();
+
+    iWrapperMgr = CXIMPTestContextWrapperMgr::NewL();
+    iWrapperMgr->CreateWrapperL();
+    }
+
+void T_PresenceGrantRequestManagement::SetupMultiple_L()
+    {
+    PrfwTestRobustness::DoPreCleaning();
+
+    iWrapperMgr = CXIMPTestContextWrapperMgr::NewL();
+    iWrapperMgr->CreateWrapperL();
+    iWrapperMgr->CreateWrapperL();
+    iWrapperMgr->CreateWrapperL();
+    }
+
+
+void T_PresenceGrantRequestManagement::BindL()
+    {
+    CXIMPTestContextWrapper* wrapper0 = iWrapperMgr->GetWrapperL( 0 );
+
+    wrapper0->BindL( 0 );
+    }
+
+void T_PresenceGrantRequestManagement::BindAllL()
+    {
+    for( TInt a = 0; a < iWrapperMgr->WrapperCount(); ++a )
+        {
+        CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a );
+        wrapper->BindL( 0 );
+        }
+    }
+
+
+void T_PresenceGrantRequestManagement::Teardown()
+    {
+    delete iWrapperMgr;
+    iWrapperMgr = NULL;
+
+    REComSession::FinalClose();
+
+    PrfwTestRobustness::DoPreCleaning();
+    }
+
+void T_PresenceGrantRequestManagement::UnbindL()
+    {
+    // Do unbind
+    CXIMPTestContextWrapper* wrapper0 = iWrapperMgr->GetWrapperL( 0 );
+    wrapper0->UnbindL();
+    }
+
+void T_PresenceGrantRequestManagement::UnbindAllL()
+    {
+    for( TInt a = 0; a < iWrapperMgr->WrapperCount(); ++a )
+        {
+        CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a );
+        wrapper->UnbindL();
+        }
+    }
+
+
+// ===========================================================================
+// TEST CASES for presentity presence subscription
+// ===========================================================================
+
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+void T_PresenceGrantRequestManagement::T_SubscribeGrantRequestList_Single_L()
+    {
+    EUNIT_PRINT( _L("Single presence grant request list subscription") );
+
+    BindL();
+
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    MXIMPContext* context = wrapper->GetContext();
+    CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+    CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context );
+    CleanupStack::PushL( listener2 );
+
+    // Tell the protocol it should act normally
+    messenger->SetNoError();
+
+    // Get the interfaces
+    MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+    MPresenceAuthorization& presAuth = presFeat->PresenceAuthorization();
+
+    // ---------------------------------------------
+    // 1. Subscribe grant request list
+
+    // Setup status event listener for RequestComplete
+    listener2->Reset();
+
+    // normal request complete
+    TXIMPRequestId reqIdDummy;  // not checked
+    CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+    listener2->ExpectL( evReqComplete );
+    CleanupStack::Pop( evReqComplete );
+    // ---------------------------------------------
+
+    // subscribe
+    // ---------------------------------------------
+    TXIMPRequestId reqId = presAuth.SubscribePresenceGrantRequestListL();
+    EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Subscribe failed" );
+    // ---------------------------------------------
+
+    // verify that SubscribeGrantListL was called
+    COMMONASSERT( messenger, EXIMPPlgTestSubscribePresenceGrantRequestListCalled, "SubscribeGrantListL was not called", ETrue, NULL );
+
+
+    // ---------------------------------------------
+    // 2. refresh subscription
+    
+    // Setup status event listener for RequestComplete
+    listener2->Reset();
+
+    evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+    listener2->ExpectL( evReqComplete );
+    CleanupStack::Pop( evReqComplete );
+
+    RPrGrntReqInfoImpArray* pendingList(NULL);
+    CPresenceGrantRequestListEventImp* event = CreateGrantRequestListEventLCX(
+        KNullDesC, KNullDesC,
+        MXIMPDataSubscriptionState::ESubscriptionActive,
+        MXIMPDataSubscriptionState::EDataUnavailable,
+        ETestPGRPending, pendingList );
+    listener2->ExpectL( event );
+    CleanupStack::Pop(); //event 3 to go.
+
+    // refresh subscription
+    // ---------------------------------------------
+    reqId = presAuth.SubscribePresenceGrantRequestListL();
+    EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Refresh failed" );
+    CleanupStack::PopAndDestroy( 3 ); // rest of the items.
+
+
+    // ---------------------------------------------
+    // 3. Unsubscribe grant request list
+
+    // Setup status event listener for RequestComplete
+    listener2->Reset();
+
+    evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+    listener2->ExpectL( evReqComplete );
+    CleanupStack::Pop( evReqComplete );
+
+    // unsubscribe
+    // ---------------------------------------------
+    reqId = presAuth.UnsubscribePresenceGrantRequestListL();
+    EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Unsubscribe failed" );
+
+
+    // verify that UnsubscribeGrantListL was called
+    COMMONASSERT( messenger, EXIMPPlgTestUnsubscribePresenceGrantRequestListCalled, "UnsubscribeGrantListL was not called", ETrue, NULL );
+    
+
+    // ---------------------------------------------
+    // 4. Unsubscribe grant request list (non-subscribed)
+
+    // Setup status event listener for RequestComplete
+    listener2->Reset();
+
+    evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+    listener2->ExpectL( evReqComplete );
+    CleanupStack::Pop( evReqComplete );
+
+    // unsubscribe
+    // ---------------------------------------------
+    reqId = presAuth.UnsubscribePresenceGrantRequestListL();
+
+    EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Unsubscribe failed" );
+
+    // verify that UnsubscribeGrantListL was called
+    COMMONASSERT( messenger, EXIMPPlgTestUnsubscribePresenceGrantRequestListCalled, "UnsubscribeGrantListL was not called", ETrue, NULL );
+
+    // Deinitiliaze event source from listener.
+    listener2->SetEventSourceL( NULL );
+
+    UnbindL();
+
+    CleanupStack::PopAndDestroy( listener2 );
+    }
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+void T_PresenceGrantRequestManagement::T_SubscribeGrantRequestList_Multiple_L()
+    {
+    EUNIT_PRINT( _L("Multiple presence grant request list subscription") );
+
+    BindAllL();
+
+    TInt countOfWrappers = iWrapperMgr->WrapperCount();
+    TInt a(0);
+    for( a = 0; a < countOfWrappers; ++a )
+        {
+        CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a );
+        MXIMPContext* context = wrapper->GetContext();
+        CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+        // Get the interfaces
+        MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+        MPresenceAuthorization& presAuth = presFeat->PresenceAuthorization();
+
+        CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context );
+        CleanupStack::PushL( listener2 );
+
+        // Tell the protocol it should act normally
+        messenger->SetNoError();
+
+        // expect normal request complete
+        TXIMPRequestId reqIdDummy;  // not checked
+        CXIMPRequestCompleteEventImp* evReqComplete =
+                                CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+        listener2->ExpectL( evReqComplete );
+        CleanupStack::Pop( evReqComplete );
+
+        // subscribe
+        TXIMPRequestId reqId = presAuth.SubscribePresenceGrantRequestListL();
+
+        EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Subscribe failed" );
+
+        // verify that SubscribePresenceGrantRequestListL was called
+        COMMONASSERT( messenger, EXIMPPlgTestSubscribePresenceGrantRequestListCalled, "SubscribePresenceGrantRequestListL was not called", ETrue, NULL );
+
+        CleanupStack::PopAndDestroy( listener2 );
+        }
+
+    for( a = 0; a < countOfWrappers; ++a )
+        {
+        CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a );
+        MXIMPContext* context = wrapper->GetContext();
+        CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+        
+        // Get the interfaces
+        MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+        MPresenceAuthorization& presAuth = presFeat->PresenceAuthorization();
+
+        CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context );
+        CleanupStack::PushL( listener2 );
+
+        // Tell the protocol it should act normally
+        messenger->SetNoError();
+
+        // expect normal request complete
+        TXIMPRequestId reqIdDummy;  // not checked
+        CXIMPRequestCompleteEventImp* evReqComplete =
+                            CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+        listener2->ExpectL( evReqComplete );
+        CleanupStack::Pop( evReqComplete );
+
+        // unsubscribe
+        TXIMPRequestId reqId = presAuth.UnsubscribePresenceGrantRequestListL();
+
+        EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Unsubscribe failed" );
+
+        // verify that EXIMPPlgTestUnsubscribeGroupListCalled was called
+        COMMONASSERT( messenger, EXIMPPlgTestUnsubscribeGroupListCalled,
+                "UnsubscribePresenceGrantRequestListL was not called",
+                EFalse,
+                "UnsubscribePresenceGrantRequestListL was called" );
+
+        CleanupStack::PopAndDestroy( listener2 );
+        }
+
+    UnbindAllL();
+    }
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+void T_PresenceGrantRequestManagement::SubscribeL()
+    {
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    MXIMPContext* context = wrapper->GetContext();
+    CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+    // Get the interfaces
+    MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+    MPresenceAuthorization& presAuth = presFeat->PresenceAuthorization();
+
+    CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context );
+    CleanupStack::PushL( listener2 );
+
+    // ------------------------------------------------------
+    // expect normal request complete
+    TXIMPRequestId reqIdDummy;  // not checked
+    CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+    listener2->ExpectL( evReqComplete );
+    CleanupStack::Pop( evReqComplete );
+    // ------------------------------------------------------
+
+    // subscribe
+    TXIMPRequestId reqId = presAuth.SubscribePresenceGrantRequestListL();
+    EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Subscribe failed" );
+
+    COMMONASSERT( messenger, EXIMPPlgTestSubscribePresenceGrantRequestListCalled, "SubscribeGrantRequestListL was not called", ETrue, NULL );
+
+    CleanupStack::PopAndDestroy( listener2 );
+    }
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+void T_PresenceGrantRequestManagement::UnsubscribeL()
+    {
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    MXIMPContext* context = wrapper->GetContext();
+    CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+    // Get the interfaces
+    MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+    MPresenceAuthorization& presAuth = presFeat->PresenceAuthorization();
+
+    CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context );
+    CleanupStack::PushL( listener2 );
+
+    // ------------------------------------------------------
+    // expect normal request complete
+    TXIMPRequestId reqIdDummy;  // not checked
+    CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+    listener2->ExpectL( evReqComplete );
+    CleanupStack::Pop( evReqComplete );
+    // ------------------------------------------------------
+
+    // unsubscribe
+    TXIMPRequestId reqId = presAuth.UnsubscribePresenceGrantRequestListL();
+    EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Unsubscribe failed" );
+
+    COMMONASSERT( messenger, EXIMPPlgTestUnsubscribePresenceGrantRequestListCalled, "UnsubscribeGrantRequestListL was not called", ETrue, NULL );
+
+    CleanupStack::PopAndDestroy( listener2 );
+    }
+
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+void T_PresenceGrantRequestManagement::T_HandlePresenceGrantRequestList_L()
+    {
+    EUNIT_PRINT( _L("Handle presence grant request list.") );
+
+    // log in and subscribe a group list
+    BindL();
+    SubscribeL();
+
+    // ------------------------------------------------------
+    // some startup stuff
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    MXIMPContext* context = wrapper->GetContext();
+
+    CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context );
+    CleanupStack::PushL( listener2 );
+    // ------------------------------------------------------
+
+    // Tell the protocol it should act normally
+    wrapper->GetMessenger()->SetNoError();
+
+    // ------------------------------------------------------
+    // 1. Create faked server message about grant req list (empty)
+    SendSrvMsgL( CXIMPTestFileSrvMsg::ETestSrvMsgPresenceGrantRequestList );
+
+    // ------------------------------------------------------
+    // expect empty MPresentityGroupList event.
+
+    RPrGrntReqInfoImpArray* pendingList(NULL);
+    CPresenceGrantRequestListEventImp* event = CreateGrantRequestListEventLCX(
+            KNullDesC, KNullDesC,
+            MXIMPDataSubscriptionState::ESubscriptionActive,
+            MXIMPDataSubscriptionState::EDataAvailable,
+            ETestPGRPending, pendingList );
+
+    listener2->ExpectL( event );
+    CleanupStack::Pop( event ); // 3 more items in cleanupstack
+
+    EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "HandlePresenceGrantRequestListL failed" );
+    CleanupStack::PopAndDestroy( 3 ); // lists
+    // ------------------------------------------------------
+
+
+    _LIT16( KGrantReqUri,      "http://carpe.diem.com" );
+    _LIT16( KGrantReqDispName, "DispnameA, LoremI" );
+
+    // ------------------------------------------------------
+    // 2. Create faked server message about grant req list (new)
+    listener2->Reset();
+
+    pendingList = NULL; // previous one was destroyed
+    event = CreateGrantRequestListEventLCX( KGrantReqUri,
+                                            KGrantReqDispName,
+                                            MXIMPDataSubscriptionState::ESubscriptionActive,
+                                            MXIMPDataSubscriptionState::EDataAvailable,
+                                            ETestPGRNewReq, pendingList  );
+
+    SendSrvMsgL( KGrantReqUri,
+                     KGrantReqDispName,
+                     CXIMPTestFileSrvMsg::ETestSrvMsgPresenceGrantRequestList );
+
+    listener2->ExpectL( event );
+    CleanupStack::Pop( event ); // 3 more items in cleanupstack
+
+    // Waqas: Fixed Ticket #18
+    EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "HandlePresenceGrantRequestListL failed" );
+    
+    CleanupStack::PopAndDestroy( 3 ); // lists
+    // ------------------------------------------------------
+
+
+    CleanupStack::PopAndDestroy( listener2 );
+
+    // clean it up
+    UnsubscribeL();
+    UnbindL();
+    }
+
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+_LIT16(  KPresentUri1,      "http://lorem.ipsum.com" );
+_LIT16(  KPresentUri2,      "http://carpe.diem.com" );
+_LIT16( KPresentDispName1, "DispnameA, LoremI" );
+_LIT16( KPresentDispName2, "DispnameB, CarpeD" );
+_LIT16( KPresentProtAddr1, "ABC" );
+_LIT16( KPresentProtAddr2, "HIJ" );
+
+void T_PresenceGrantRequestManagement::T_HandlePresenceGrantRequestReceivedObsoleted_L()
+    {
+    EUNIT_PRINT( _L("Handle presence grant request received") );
+
+    BindL();
+    SubscribeL();
+
+    // ------------------------------------------------------
+    // some startup stuff
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    MXIMPContext* context = wrapper->GetContext();
+
+    CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context );
+    CleanupStack::PushL( listener2 );
+    // ------------------------------------------------------
+
+    // Tell the protocol it should act normally
+    wrapper->GetMessenger()->SetNoError();
+
+    // ------------------------------------------------------
+    // 1. Create faked server message about grant req received
+    SendSrvMsgInfoL( KPresentUri1,
+                     KPresentDispName1,
+                     CXIMPTestFileSrvMsg::ETestSrvMsgPresenceGrantRequestReceived );
+
+    // ------------------------------------------------------
+    // expect MPresenceGrantRequestList event.
+
+    CPresenceGrantRequestListEventImp* event = CreateGrantRequestListEventLCX(
+            KPresentUri1, KPresentDispName1,
+            MXIMPDataSubscriptionState::ESubscriptionActive,
+            MXIMPDataSubscriptionState::EDataAvailable,
+            ETestPGRNewReq, NULL );
+
+    listener2->ExpectL( event );
+    CleanupStack::Pop( event ); // 3 more items in cleanupstack
+
+    // Waqas: Fixed Ticket #18
+    EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "HandlePresenceGrantRequesReceivedL failed" );
+
+
+    CleanupStack::PopAndDestroy( 3 ); // lists
+    // ------------------------------------------------------
+
+
+    // ------------------------------------------------------
+    // 2. Create faked server message about grant req obsoleted
+    listener2->Reset();
+
+    SendSrvMsgInfoL( KPresentUri1,
+                     KPresentDispName1,
+                     CXIMPTestFileSrvMsg::ETestSrvMsgPresenceGrantRequestObsoleted );
+
+                     
+    // we need to create pending list to give to the event
+    RPrGrntReqInfoImpArray* pendingList = new ( ELeave ) RPrGrntReqInfoImpArray;
+    CleanupDeletePushL( pendingList );
+            // create the group info
+    CXIMPIdentityImp* idForEvent = CXIMPIdentityImp::NewLC( KPresentUri1 );
+    CPresenceGrantRequestInfoImp* grantInfoForEvent = 
+                            CPresenceGrantRequestInfoImp::NewLC( *idForEvent, KPresentDispName1 );
+    pendingList->AppendL( grantInfoForEvent );
+    CleanupStack::Pop( grantInfoForEvent );
+    CleanupStack::PopAndDestroy( idForEvent );
+    CleanupStack::Pop( pendingList );
+    
+    //Now create the event
+    event = CreateGrantRequestListEventLCX(
+            KPresentUri1, KPresentDispName1,
+            MXIMPDataSubscriptionState::ESubscriptionActive,
+            MXIMPDataSubscriptionState::EDataAvailable,
+            ETestPGRObsoleted, pendingList );
+
+    listener2->ExpectL( event );
+    CleanupStack::Pop( event ); // 3 more items in cleanupstack
+
+    // Waqas: Fixed Ticket #18
+    EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "HandlePresenceGrantRequesObsoletedL failed" );
+
+    CleanupStack::PopAndDestroy( 3 ); // lists
+    // ------------------------------------------------------
+
+    CleanupStack::PopAndDestroy( listener2 );
+
+    // clean it up
+    UnsubscribeL();
+    UnbindL();
+    }
+
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+// send a faked server-originated message with grant request list made
+// from the given uri and displayname
+//
+void T_PresenceGrantRequestManagement::SendSrvMsgL(
+        const TDesC& aUri, const TDesC& aDispName,
+        TInt aMsgType )
+    {
+    // we'll use hard-coded wrapper 0 instance for now.
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+
+    // create a grant req info contained within the server-originated
+    // faked message
+    RXIMPObjOwningPtrArray<CPresenceGrantRequestInfoImp> grantList;
+    CleanupClosePushL( grantList );
+
+    CXIMPIdentityImp* grantId = CXIMPIdentityImp::NewLC( aUri );
+    CPresenceGrantRequestInfoImp* grantItem =
+                CPresenceGrantRequestInfoImp::NewLC( *grantId, aDispName );
+    grantList.AppendL( grantItem );
+    CleanupStack::Pop( grantItem );
+    CleanupStack::PopAndDestroy( grantId );
+
+    HBufC8* packedArray =
+        TXIMPObjectPacker<CPresenceGrantRequestInfoImp>::PackArrayL( grantList );
+    CleanupStack::PushL( packedArray );
+
+    // use filetool to send it for plugin.
+    CXIMPTestFileSrvMsg* srvMsg = CXIMPTestFileSrvMsg::NewL( aMsgType,
+            *packedArray );
+    CleanupStack::PushL( srvMsg );
+    wrapper->FileTool().CleanAllL();
+    wrapper->FileTool().SrvMsgStoreL( srvMsg );
+    CleanupStack::PopAndDestroy( 3 ); // srvMsg, packedArray, grantList
+    }
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+// send a faked server-originated message with grant request info made
+// from the given uri and displayname
+//
+void T_PresenceGrantRequestManagement::SendSrvMsgInfoL(
+        const TDesC& aUri, const TDesC& aDispName,
+        TInt aMsgType )
+    {
+    // we'll use hard-coded wrapper 0 instance for now.
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+
+    CXIMPIdentityImp* grantId = CXIMPIdentityImp::NewLC( aUri );
+    CPresenceGrantRequestInfoImp* grantItem =
+                CPresenceGrantRequestInfoImp::NewLC( *grantId, aDispName );
+
+    HBufC8* packedInfo =
+        TXIMPObjectPacker<CPresenceGrantRequestInfoImp>::PackL( *grantItem );
+    CleanupStack::PushL( packedInfo );
+
+    // use filetool to send it for plugin.
+    CXIMPTestFileSrvMsg* srvMsg = CXIMPTestFileSrvMsg::NewL( aMsgType,
+            *packedInfo );
+    CleanupStack::PushL( srvMsg );
+    wrapper->FileTool().CleanAllL();
+    wrapper->FileTool().SrvMsgStoreL( srvMsg );
+    CleanupStack::PopAndDestroy( 4 ); // srvMsg, packedItem, grantItem, grantId
+    }
+
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+// send a faked server-originated message with empty contents
+//
+void T_PresenceGrantRequestManagement::SendSrvMsgL( TInt aMsgType )
+    {
+    // we'll use hard-coded wrapper 0 instance for now.
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+
+    // create a server-originated faked message with empty contents
+    RXIMPObjOwningPtrArray<CPresenceGrantRequestInfoImp> grantList;
+
+    HBufC8* packedArray = TXIMPObjectPacker<CPresenceGrantRequestInfoImp>::PackArrayL( grantList );
+    CleanupStack::PushL( packedArray );
+
+    // use filetool to send it for plugin.
+    CXIMPTestFileSrvMsg* srvMsg = CXIMPTestFileSrvMsg::NewL( aMsgType,
+            *packedArray );
+    CleanupStack::PushL( srvMsg );
+    wrapper->FileTool().CleanAllL();
+    wrapper->FileTool().SrvMsgStoreL( srvMsg );
+    CleanupStack::PopAndDestroy( 2 ); // srvMsg, packedArray
+    }
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+// create a grant request list event with given arrays
+//
+CPresenceGrantRequestListEventImp*
+    T_PresenceGrantRequestManagement::CreateGrantRequestListEventLCX(
+        const TDesC& aUri,
+        const TDesC& aDispName,
+        MXIMPDataSubscriptionState::TSubscriptionState aSubscriptionState,
+        MXIMPDataSubscriptionState::TDataState aDataState,
+        TTestPGROperation aOperation,
+        RPrGrntReqInfoImpArray* aPendingList
+        )
+    {
+    // create the arrays
+
+
+    // new list
+    RPrGrntReqInfoImpArray* newList = new ( ELeave ) RPrGrntReqInfoImpArray;
+    CleanupDeletePushL( newList );
+
+    // pending list
+    if(!aPendingList) // if client didnt created the list
+        aPendingList = new ( ELeave ) RPrGrntReqInfoImpArray;
+    CleanupDeletePushL( aPendingList );
+
+    // obsoleted list
+    RPrGrntReqInfoImpArray* obsoletedList = new ( ELeave ) RPrGrntReqInfoImpArray;
+    CleanupDeletePushL( obsoletedList );
+
+	// create subscription state
+	CXIMPDataSubscriptionStateImp* subsState = CXIMPDataSubscriptionStateImp::NewLC();
+
+    // create the group info
+    CPresenceGrantRequestInfoImp* grantInfoForEvent1 = NULL;
+            {
+            CXIMPIdentityImp* idForEvent = CXIMPIdentityImp::NewLC( aUri );
+            grantInfoForEvent1 = CPresenceGrantRequestInfoImp::NewLC( *idForEvent, aDispName );
+            CleanupStack::Pop( grantInfoForEvent1 );        
+            CleanupStack::PopAndDestroy( idForEvent ); 
+            CleanupStack::PushL( grantInfoForEvent1 );        
+            }
+    
+    CPresenceGrantRequestInfoImp* grantInfoForEvent2 = 
+            TXIMPObjectCloner< CPresenceGrantRequestInfoImp >::CloneLC( *grantInfoForEvent1 );
+    
+    TInt count(0);
+    TBool found(EFalse);
+    TInt i(0);
+   
+
+    // put the given grant info into the specified array
+    switch ( aOperation )
+        {
+        case ETestPGRNewReq:
+            {
+            newList->AppendL( grantInfoForEvent2 );
+            CleanupStack::Pop( grantInfoForEvent2 );
+            
+            aPendingList->AppendL( grantInfoForEvent1 );
+            CleanupStack::Pop( grantInfoForEvent1 );
+            
+            break;
+            }
+        case ETestPGRPending:
+            {
+            // don't add, thus return what user has given
+            CleanupStack::PopAndDestroy( grantInfoForEvent2 ); // grantInfoForEvent2
+            CleanupStack::PopAndDestroy( grantInfoForEvent1 ); // grantInfoForEvent1
+            break;
+            }
+
+        case ETestPGRObsoleted:
+            {
+            // search the given id in pending list
+            count = aPendingList->Count();
+            for(i=0;i<count;i++)
+                {
+                // if dispname and id are same
+                if (( ((((*aPendingList)[i])->RequestorId()).Identity()) == aUri )
+                    && ( (((*aPendingList)[i])->RequestorDisplayName()) == aDispName ))
+                    {
+                    found = ETrue;
+            break;
+            }
+                }
+            if(found) // do we need to leave if error? Waqas
+            {
+                delete (*aPendingList)[i];
+                aPendingList->Remove(i);
+                obsoletedList->AppendL( grantInfoForEvent2 );
+                CleanupStack::Pop( grantInfoForEvent2 );
+                }
+            else
+                CleanupStack::PopAndDestroy( grantInfoForEvent2 );
+            
+            CleanupStack::PopAndDestroy( grantInfoForEvent1 );
+            break;
+            }
+
+        default:
+            {
+            User::Leave( KErrArgument );
+            break;
+            }
+        };
+
+	subsState->SetSubscriptionStateL(aSubscriptionState);
+    subsState->SetDataStateL(aDataState);
+
+    // create the actual event
+    CPresenceGrantRequestListEventImp* tmp =
+        CPresenceGrantRequestListEventImp::NewLC(
+                newList,
+                aPendingList,
+                obsoletedList,
+                subsState );
+
+    // subState is owned by the event, we need to pop it out from the stack
+    CleanupStack::Pop( tmp );        
+    CleanupStack::Pop( subsState ); 
+    CleanupStack::PushL( tmp );        
+
+    /*
+     * In cleanupstack there are 4 items, FIFO:
+     *   - new list
+     *   - pending list
+     *   - obsoleted list
+     *   - event imp
+     */
+
+    return tmp;
+    }
+
+// ===========================================================================
+// TEST CASE TABLE
+// ===========================================================================
+//
+EUNIT_BEGIN_TEST_TABLE(
+        T_PresenceGrantRequestManagement,
+        "XIMP presence grant request management tests",
+        "MODULE" )
+
+PRFW_DECORATED_TEST(
+        "Grant request list subscription, single client",
+        "",
+        "",
+        "FUNCTIONALITY",
+        Setup_L,
+        T_SubscribeGrantRequestList_Single_L,
+        Teardown )
+
+PRFW_DECORATED_TEST(
+        "Grant request list subscription, multiple clients",
+        "",
+        "",
+        "FUNCTIONALITY",
+        SetupMultiple_L,
+        T_SubscribeGrantRequestList_Multiple_L,
+        Teardown )
+
+PRFW_DECORATED_TEST(
+        "Handle presence grant request List",
+        "",
+        "",
+        "FUNCTIONALITY",
+        Setup_L,
+        T_HandlePresenceGrantRequestList_L,
+        Teardown )
+
+PRFW_DECORATED_TEST(
+        "Handle presence grant request received and obsoleted",
+        "",
+        "",
+        "FUNCTIONALITY",
+        Setup_L,
+        T_HandlePresenceGrantRequestReceivedObsoleted_L,
+        Teardown )
+
+
+/*
+PRFW_DECORATED_TEST(
+        "New and obsolete request.",
+        "",
+        "",
+        "FUNCTIONALITY",
+        Setup_L,
+        T_HandlePresentityGroupCreateAndDelete_L,
+        Teardown )
+*/
+
+EUNIT_END_TEST_TABLE
+
+
+// ===========================================================================
+// TEST SUITE CONSTRUCTION
+// ===========================================================================
+//
+EXPORT_C MEUnitTest* CreateTestSuiteL()
+    {
+    return T_PresenceGrantRequestManagement::NewL();
+    }
+
+
+// end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_presencegrantrequestmngt/t_presencegrantrequestmngt.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,172 @@
+/*
+* 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:
+*
+*/
+
+#ifndef T_PRESENCEGRANTREQUESTMANAGEMENT_H
+#define T_PRESENCEGRANTREQUESTMANAGEMENT_H
+
+
+//  EXTERNAL INCLUDES
+#include <platform/digia/eunit/ceunittestsuiteclass.h>
+#include <platform/digia/eunit/EUnitDecorators.h>
+
+#include <ximpbase.h>
+#include "prfwteststatuseventlistener.h"
+#include "prfwtestmessaging.h"
+#include "ximpdatasubscriptionstateimp.h"
+#include "presencetypehelpers.h"
+
+class CXIMPTestContextWrapper;
+class CXIMPTestContextWrapperMgr;
+class CXIMPTestMessenger;
+class CPresenceGrantRequestInfoImp;
+class CPresenceGrantRequestListEventImp;
+
+/**
+ * XIMP Framework Eunit tests.
+ *
+ * Tests for XIMP session management services.
+ *
+ * @since S60 v4.0
+ */
+class T_PresenceGrantRequestManagement : public CEUnitTestSuiteClass
+    {
+
+public:
+    static T_PresenceGrantRequestManagement* NewL();
+    virtual ~T_PresenceGrantRequestManagement();
+
+
+private:
+    T_PresenceGrantRequestManagement();
+    void ConstructL();
+
+private:    // Test case functions
+
+    void Setup_L();
+    void SetupMultiple_L();
+    void BindL();
+    void BindAllL();
+    void Teardown();
+    void UnbindL();
+    void UnbindAllL();
+    void SubscribeL();
+    void UnsubscribeL();
+
+    void T_SubscribeGrantRequestList_Single_L();
+    void T_SubscribeGrantRequestListRefresh_Single_L();
+    void T_SubscribeGrantRequestList_Multiple_L();
+    void T_HandlePresenceGrantRequestList_L();
+    void T_HandlePresenceGrantRequestReceivedObsoleted_L();
+
+private:    // Test helpers
+
+    /**
+     * Fake a server-originated (=mobile terminated) message.
+     * The message appears to adaptation and framework as if
+     * it came from the network. Uses only one group.
+     * @param aUri The URI of group
+     * @param aDispName The display name for the group
+     * @param aMsgType The message type for CXIMPTestFileSrvMsg
+     */
+    void SendSrvMsgL(
+            const TDesC& aUri, const TDesC& aDispName,
+            TInt aMsgType );
+
+    // version for sending just the info instead of array
+    void SendSrvMsgInfoL(
+            const TDesC& aUri, const TDesC& aDispName,
+            TInt aMsgType );
+    /**
+     * Fake a server-originated message with empty content.
+     * Whether to use this depends on the event you expect.
+     * @see SendSrvMsgL
+     */
+    void SendSrvMsgL( TInt aMsgType );
+
+    // @see below
+    /*
+    enum TTestPGRArraySpecifier //Waqas: Not used anymore, use the next one
+        {
+        ETestPGRNewList = 0,    // grant request list
+        ETestPGRNewReq,         // new grant request
+        ETestPGRPending,         // new grant request
+        ETestPGRObsoleted,      // obsoleted grant request
+        ETestPGREmpty,          // make an empty array for empty event
+        };*/
+        
+    enum TTestPGROperation
+        {
+        ETestPGRNewReq = 0,     // new grant request i.e. new req comes
+        ETestPGRPending,        // new grant request i.e. subscribe to
+        ETestPGRObsoleted      // obsoleted grant request i.e. req expired                        
+        };
+
+    /**
+     * Creates an event for newRequest, pending, or obselete presence grant
+     * request list. The caller provides an identity and current presence grant
+     * request listand depending on the provided operation an event is created. 
+     *
+     * In cleanupstack there are 4 items, FIFO:
+     *   - new list
+     *   - pending list
+     *   - obsoleted list
+     *   - event imp
+     *
+     * This is because this event won't take ownership to the arrays
+     * when created this way.
+     *
+     * @param aUri Uri
+     * @param aDispName Displayname
+     * @param aOperation operation for which caller wants to generates event
+     * @param aPendingList Current pending list provided by caller, method takes
+     *         ownership of the pending list, and it is included in above 3 lists.
+     *         a NULL pointer with operation ETestPGRPending causes empty event.
+     * @return The suitably filled event.
+     */
+    CPresenceGrantRequestListEventImp* CreateGrantRequestListEventLCX(
+            const TDesC& aUri,
+            const TDesC& aDispName,
+            MXIMPDataSubscriptionState::TSubscriptionState aSubscriptionState,
+            MXIMPDataSubscriptionState::TDataState aDataState,
+            TTestPGROperation aOperation,
+            RPrGrntReqInfoImpArray* aPendingList = NULL
+            );
+
+private: // Test data
+
+    /**
+     * Eunit test case table declaration.
+     */
+    EUNIT_DECLARE_TEST_TABLE;
+
+    // owned
+    CXIMPTestContextWrapperMgr* iWrapperMgr;
+
+    //
+    TInt iLastError;
+    RXIMPObjOwningPtrArray< CPresenceGrantRequestInfoImp > iValidateArray;
+    };
+
+
+#endif      //  T_PRESENCEGRANTREQUESTMANAGEMENT_H
+
+
+
+// end of file
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_presencegrantrequestmngt/t_presencegrantrequestmngt.mmp	Wed Nov 03 09:32:20 2010 +0530
@@ -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:
+*
+*/
+
+#include            "../../tsrcutils/eunitcommon/eunittstdllbase.hrh"
+#include            "../../tsrcutils/processmaster/pm.h"
+
+#include<platform_paths.hrh>
+#include<eunitcaps.h>
+TARGET              t_presencegrantrequestmngt.dll
+//CAPABILITY              ALL - TCB - DRM
+CAPABILITY      EUNIT_CAPS
+
+SOURCEPATH          .
+SOURCE              t_presencegrantrequestmngt.cpp
+
+
+USERINCLUDE             ../../../../../ximpfw/core/srcdatamodel
+USERINCLUDE             ../../../../../ximpfw/presence/srcpresencedatamodel
+USERINCLUDE             ../../../../../ximpfw/presence/srcpresencedatamodel/presentitygroups
+USERINCLUDE             ../../../../../ximpfw/presence/srcpresencedatamodel/presencewatching
+USERINCLUDE             ../../../../../ximpfw/presence/srcpresencedatamodel/presenceauthorization
+USERINCLUDE             ../../../../../ximpfw/presence/srcpresencedatamodel/presencepublishing
+USERINCLUDE             ../../../../../ximpfw/presence/srcpresencedatamodel/presenceinfo
+USERINCLUDE             ../../../../../ximpfw/core/srcutils
+
+// TODO remove unnecessary
+#if defined ( OS_LAYER_SYSTEMINCLUDE )
+OS_LAYER_SYSTEMINCLUDE
+#else
+SYSTEMINCLUDE     /epoc32/include
+#endif
+
+ #if defined ( APP_LAYER_SYSTEMINCLUDE )
+ APP_LAYER_SYSTEMINCLUDE
+ #else
+ SYSTEMINCLUDE     \epoc32\include
+ #endif
+SYSTEMINCLUDE           ../../../../../ximpfw/inc/core/base
+SYSTEMINCLUDE           ../../../../../ximpfw/inc/core/datamodel
+SYSTEMINCLUDE           ../../../../../ximpfw/inc/core/protocolplugin
+SYSTEMINCLUDE           ../../../../../ximpfw/inc/core/protocolpluginhost
+SYSTEMINCLUDE           ../../../../../ximpfw/inc/presence/presencedatamodel
+SYSTEMINCLUDE           ../../../../../ximpfw/inc/presence/presencemanagement
+SYSTEMINCLUDE           ../../../../../ximpfw/inc/presence/presenceprotocolplugin
+SYSTEMINCLUDE           ../../../../../ximpfw/inc/presence/presenceprotocolpluginhost
+
+LIBRARY             ecom.lib
+LIBRARY             bafl.lib
+LIBRARY             ximpdatamodel.lib
+LIBRARY             presencedatamodel.lib
+LIBRARY             ximputils.lib
+LIBRARY             estor.lib
+LIBRARY                 EUnit.lib
+LIBRARY             eunitutil.lib
+LIBRARY             euser.lib
+
+// end of file
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_presencegrouplistmngt/bld.inf	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,23 @@
+/*
+* 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 t_presencegrouplistmngt.dll
+*
+*/
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_TESTMMPFILES
+t_presencegrouplistmngt.mmp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_presencegrouplistmngt/t_presencegrouplistmngt.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,1451 @@
+/*
+* 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:
+*
+*/
+
+
+#include "eunittools.h"
+
+
+
+#include <platform/digia/eunit/eunitmacros.h>
+#include <platform/digia/eunit/teunitassertioninfo.h>
+
+#include <ecom/ecom.h>
+#include <badesca.h>
+
+#include <ximpbase.h>
+#include <ximpclient.h>
+#include <ximpcontext.h>
+#include <presencefeatures.h>
+#include <presentitygroups.h>
+#include <presentitygroupinfo.h>
+#include <presentitygrouplistevent.h>
+#include <ximpobjectfactory.h>
+
+#include "ximpstatusimp.h"
+#include "ximprequestcompleteeventimp.h"
+#include "t_presencegrouplistmngt.h"
+#include "prfwteststatuseventlistener.h"
+#include "prfwtestmessaging.h"
+#include "prfwtestmessenger.h"
+#include "prfwtestcontextwrappermgr.h"
+#include "prfwtestcontextwrapper.h"
+#include "prfwtesteventfactory.h"
+
+#include "presenceinfoimp.h"
+#include "presenceinfofilterimp.h"
+#include "prfwtestpresencedatautils.h"
+#include "ximpidentityimp.h"
+#include "ximpobjecthelpers.h"
+#include "presentitygroupinfoimp.h"
+#include "presentitygrouplisteventimp.h"
+#include "presentitygroupcontenteventimp.h"
+#include "prfwtestfilesrvmsg.h"
+#include "prfwtestfiletool.h"
+#include "prfwtestlistener.h"
+
+#include "prfwtestrobustnesstools.h"
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// CONSTRUCTION
+T_PresenceGroupListManagement* T_PresenceGroupListManagement::NewL()
+    {
+    T_PresenceGroupListManagement* self = new( ELeave ) T_PresenceGroupListManagement;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+
+    return self;
+    }
+
+
+T_PresenceGroupListManagement::~T_PresenceGroupListManagement()
+    {
+    PrfwTestRobustness::DoPreCleaning();
+    }
+
+
+void T_PresenceGroupListManagement::ConstructL()
+    {
+    CEUnitTestSuiteClass::ConstructL();
+    }
+
+
+T_PresenceGroupListManagement::T_PresenceGroupListManagement()
+    {
+    }
+
+
+
+// ===========================================================================
+// TEST CASE SETUP & TEARDOWN METHODS
+// ===========================================================================
+//
+
+void T_PresenceGroupListManagement::Setup_L()
+    {
+    PrfwTestRobustness::DoPreCleaning();
+
+    iWrapperMgr = CXIMPTestContextWrapperMgr::NewL();
+    iWrapperMgr->CreateWrapperL();
+    }
+
+void T_PresenceGroupListManagement::SetupMultiple_L()
+    {
+    PrfwTestRobustness::DoPreCleaning();
+
+
+    iWrapperMgr = CXIMPTestContextWrapperMgr::NewL();
+    iWrapperMgr->CreateWrapperL();
+    iWrapperMgr->CreateWrapperL();
+    iWrapperMgr->CreateWrapperL();
+    }
+
+
+void T_PresenceGroupListManagement::BindL()
+    {
+    CXIMPTestContextWrapper* wrapper0 = iWrapperMgr->GetWrapperL( 0 );
+
+    wrapper0->BindL( 0 );
+    }
+
+void T_PresenceGroupListManagement::BindAllL()
+    {
+    for( TInt a = 0; a < iWrapperMgr->WrapperCount(); ++a )
+        {
+        CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a );
+        wrapper->BindL( 0 );
+        }
+    }
+
+
+void T_PresenceGroupListManagement::Teardown()
+    {
+    delete iWrapperMgr;
+    iWrapperMgr = NULL;
+
+    REComSession::FinalClose();
+
+    PrfwTestRobustness::DoPreCleaning();
+    }
+
+void T_PresenceGroupListManagement::UnbindL()
+    {
+    // Do unbind
+    CXIMPTestContextWrapper* wrapper0 = iWrapperMgr->GetWrapperL( 0 );
+    wrapper0->UnbindL();
+    }
+
+void T_PresenceGroupListManagement::UnbindAllL()
+    {
+    for( TInt a = 0; a < iWrapperMgr->WrapperCount(); ++a )
+        {
+        CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a );
+        wrapper->UnbindL();
+        }
+    }
+
+
+// ===========================================================================
+// TEST CASES for presentity presence subscription
+// ===========================================================================
+
+
+// Single client, empty filter
+void T_PresenceGroupListManagement::T_SubscribePresentityGroup_Single_L()
+    {
+    EUNIT_PRINT( _L("Single presentity group list subscription") );
+
+    BindL();
+
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    MXIMPContext* context = wrapper->GetContext();
+    CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+    // Get the interfaces
+    MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+    MPresentityGroups& presGroup = presFeat->PresentityGroups();
+
+
+    CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context );
+    CleanupStack::PushL( listener2 );
+
+    // Tell the protocol it should act normally
+    messenger->SetNoError();
+
+    // ---------------------------------------------
+    // normal request complete
+    TXIMPRequestId reqIdDummy;  // not checked
+    CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+    listener2->ExpectL( evReqComplete );
+    CleanupStack::Pop( evReqComplete );
+
+    // subscribe
+    TXIMPRequestId reqId = presGroup.SubscribePresentityGroupListL();
+    EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Subscribe failed" );
+    messenger->AssertSubscribePresentityGroupListCalled( ETrue );
+
+    // ---------------------------------------------
+    evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+    listener2->ExpectL( evReqComplete );
+    CleanupStack::Pop( evReqComplete );
+
+
+
+    CPresentityGroupListEventImp* event = XIMPTestEventFactory::CreateGroupListEventLCX(
+            KNullDesC, KNullDesC,
+            XIMPTestEventFactory::ETestPGLEmpty,
+            KNullDesC, KNullDesC,
+            MXIMPDataSubscriptionState::ESubscriptionInactive,
+            MXIMPDataSubscriptionState::EDataUnavailable
+            );
+
+    listener2->ExpectL( event );
+    CleanupStack::Pop( event ); // 4 more items in cleanupstack
+
+    // unsubscribe
+    // ---------------------------------------------
+    reqId = presGroup.UnsubscribePresentityGroupListL();
+    EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Unsubscribe failed" );
+    CleanupStack::PopAndDestroy( 4 ); // group list event imp
+    messenger->AssertUnsubscribePresentityGroupListCalled( ETrue );
+
+    CleanupStack::PopAndDestroy( listener2 );
+
+    UnbindL();
+    }
+
+// Single client, empty filter, error in unsubscribe
+void T_PresenceGroupListManagement::T_UnsubscribePresentityGroup_Error_Single_L()
+    {
+    EUNIT_PRINT( _L("Single presentity group list unsubscribe with error") );
+
+    BindL();
+
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    MXIMPContext* context = wrapper->GetContext();
+    CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+    // Get the interfaces
+    MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+    MPresentityGroups& presGroup = presFeat->PresentityGroups();
+
+    CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context );
+    CleanupStack::PushL( listener2 );
+
+    // Tell the protocol it should act normally
+    messenger->SetNoError();
+
+    // ---------------------------------------------
+    // subscribe
+    TXIMPRequestId reqIdDummy;  // not checked
+    CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+    listener2->ExpectL( evReqComplete );
+    CleanupStack::Pop( evReqComplete );
+
+    TXIMPRequestId reqId = presGroup.SubscribePresentityGroupListL();
+    EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Subscribe failed" );
+    messenger->AssertSubscribePresentityGroupListCalled( ETrue );
+
+    // ---------------------------------------------
+    // unsubscribe
+    messenger->SetError( KErrArgument );
+    evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+    evReqComplete->CompletionResultImp().SetResultCode( KErrArgument );
+    listener2->ExpectL( evReqComplete );
+    CleanupStack::Pop( evReqComplete );
+
+    reqId = presGroup.UnsubscribePresentityGroupListL();
+    EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Unsubscribe failed" );
+    messenger->AssertUnsubscribePresentityGroupListCalled( ETrue );
+
+    CleanupStack::PopAndDestroy( listener2 );
+
+    UnbindL();
+    }
+
+// Single client, empty filter, error in sub
+void T_PresenceGroupListManagement::T_SubscribePresentityGroup_Error_Single_L()
+    {
+    EUNIT_PRINT( _L("Single presentity group list subscribe with error") );
+
+    BindL();
+
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    MXIMPContext* context = wrapper->GetContext();
+    CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+    // Get the interfaces
+    MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+    MPresentityGroups& presGroup = presFeat->PresentityGroups();
+
+    CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context );
+    CleanupStack::PushL( listener2 );
+
+    // Tell the protocol it should act normally
+    messenger->SetError( KErrArgument );
+
+    // ---------------------------------------------
+    // subscribe
+    TXIMPRequestId reqIdDummy;  // not checked
+    CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+    evReqComplete->CompletionResultImp().SetResultCode( KErrArgument );
+    listener2->ExpectL( evReqComplete );
+    CleanupStack::Pop( evReqComplete );
+
+    TXIMPRequestId reqId = presGroup.SubscribePresentityGroupListL();
+    EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Subscribe failed" );
+    messenger->AssertSubscribePresentityGroupListCalled( ETrue );
+
+    CleanupStack::PopAndDestroy( listener2 );
+
+    UnbindL();
+    }
+
+
+// multiple clients, all subscribe + unsubscribe
+void T_PresenceGroupListManagement::T_SubscribePresentityGroup_Multiple_L()
+    {
+    EUNIT_PRINT( _L("Multiple presentity group list subscription") );
+
+    BindAllL();
+
+    TInt countOfWrappers = iWrapperMgr->WrapperCount();
+    for( TInt a = 0; a < countOfWrappers; ++a )
+        {
+        CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a );
+        MXIMPContext* context = wrapper->GetContext();
+        CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+        // Get the interfaces
+        MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+        MPresentityGroups& presGroup = presFeat->PresentityGroups();
+
+        CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context );
+        CleanupStack::PushL( listener2 );
+
+        // Tell the protocol it should act normally
+        messenger->SetNoError();
+
+        // expect normal request complete
+        TXIMPRequestId reqIdDummy;  // not checked
+        CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+        listener2->ExpectL( evReqComplete );
+        CleanupStack::Pop( evReqComplete );
+
+        // subscribe
+        TXIMPRequestId reqId = presGroup.SubscribePresentityGroupListL();
+        EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Subscribe failed" );
+        messenger->AssertSubscribePresentityGroupListCalled( ETrue );
+
+        CleanupStack::PopAndDestroy( listener2 );
+        }
+
+    for( TInt a = 0; a < countOfWrappers; ++a )
+        {
+        CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a );
+        MXIMPContext* context = wrapper->GetContext();
+        CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+        // Get the interfaces
+        MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+        MPresentityGroups& presGroup = presFeat->PresentityGroups();
+
+        CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context );
+        CleanupStack::PushL( listener2 );
+
+        // Tell the protocol it should act normally
+        messenger->SetNoError();
+
+        // expect normal request complete
+        TXIMPRequestId reqIdDummy;  // not checked
+        CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+        listener2->ExpectL( evReqComplete );
+        CleanupStack::Pop( evReqComplete );
+
+        CPresentityGroupListEventImp* event = XIMPTestEventFactory::CreateGroupListEventLCX(
+                KNullDesC, KNullDesC,
+                XIMPTestEventFactory::ETestPGLEmpty,
+                KNullDesC, KNullDesC,
+                MXIMPDataSubscriptionState::ESubscriptionInactive,
+                MXIMPDataSubscriptionState::EDataUnavailable
+                );
+
+        listener2->ExpectL( event );
+        CleanupStack::Pop( event ); // 4 more items in cleanupstack
+
+        // unsubscribe
+        TXIMPRequestId reqId = presGroup.UnsubscribePresentityGroupListL();
+        EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Unsubscribe failed" );
+        CleanupStack::PopAndDestroy( 4 ); // group list event imp
+        messenger->AssertUnsubscribePresentityGroupListCalled( a == countOfWrappers-1 ? ETrue : EFalse );
+
+        CleanupStack::PopAndDestroy( listener2 );
+        }
+
+    UnbindAllL();
+    }
+
+// Multiple clients, all subscribe and refresh
+void T_PresenceGroupListManagement::T_RefreshPresentityGroup_Multiple_L()
+    {
+    EUNIT_PRINT( _L("Multiple presentity group list subscription refresh") );
+
+    BindAllL();
+
+    // SUBSCRIBE
+    TInt countOfWrappers = iWrapperMgr->WrapperCount();
+    for( TInt a = 0; a < countOfWrappers; ++a )
+        {
+        CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a );
+        MXIMPContext* context = wrapper->GetContext();
+        CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+        // Get the interfaces
+        MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+        MPresentityGroups& presGroup = presFeat->PresentityGroups();
+
+        CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context );
+        CleanupStack::PushL( listener2 );
+
+        // Tell the protocol it should act normally
+        messenger->SetNoError();
+
+        // expect normal request complete
+        TXIMPRequestId reqIdDummy;  // not checked
+        CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+        listener2->ExpectL( evReqComplete );
+        CleanupStack::Pop( evReqComplete );
+
+        // subscribe
+        TXIMPRequestId reqId = presGroup.SubscribePresentityGroupListL();
+        EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Subscribe failed" );
+        messenger->AssertSubscribePresentityGroupListCalled( ETrue );
+
+        CleanupStack::PopAndDestroy( listener2 );
+        }
+
+    // REFRESH
+    for( TInt a = 0; a < countOfWrappers; ++a )
+        {
+        CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a );
+        MXIMPContext* context = wrapper->GetContext();
+        CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+        // Get the interfaces
+        MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+        MPresentityGroups& presGroup = presFeat->PresentityGroups();
+
+        CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context );
+        CleanupStack::PushL( listener2 );
+
+        // Tell the protocol it should act normally
+        messenger->SetNoError();
+
+        // refresh subscription
+        TXIMPRequestId reqIdDummy;  // not checked
+        CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+        listener2->ExpectL( evReqComplete );
+        CleanupStack::Pop( evReqComplete );
+
+        CPresentityGroupListEventImp* event = XIMPTestEventFactory::CreateGroupListEventLCX(
+                KNullDesC, KNullDesC,
+                XIMPTestEventFactory::ETestPGLUpdated,
+                KNullDesC, KNullDesC,
+                MXIMPDataSubscriptionState::ESubscriptionActive,
+                MXIMPDataSubscriptionState::EDataUnavailable
+                );
+
+        listener2->ExpectL( event );
+        CleanupStack::Pop( event ); // 4 more items in cleanupstack
+
+        TXIMPRequestId reqId = presGroup.SubscribePresentityGroupListL();
+        EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Subscribe failed" );
+        CleanupStack::PopAndDestroy( 4 ); // group list event imp
+        messenger->AssertSubscribePresentityGroupListCalled( ETrue );
+
+        CleanupStack::PopAndDestroy( listener2 );
+        }
+
+    // unsubscribe all
+    for( TInt a = 0; a < countOfWrappers; ++a )
+        {
+        CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a );
+        MXIMPContext* context = wrapper->GetContext();
+        CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+        // Get the interfaces
+        MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+        MPresentityGroups& presGroup = presFeat->PresentityGroups();
+        
+        CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context );
+        CleanupStack::PushL( listener2 );
+
+        // Tell the protocol it should act normally
+        messenger->SetNoError();
+
+        // expect normal request complete
+        TXIMPRequestId reqIdDummy;  // not checked
+        CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+        listener2->ExpectL( evReqComplete );
+        CleanupStack::Pop( evReqComplete );
+
+        CPresentityGroupListEventImp* event = XIMPTestEventFactory::CreateGroupListEventLCX(
+                KNullDesC, KNullDesC,
+                XIMPTestEventFactory::ETestPGLEmpty,
+                KNullDesC, KNullDesC,
+                MXIMPDataSubscriptionState::ESubscriptionInactive,
+                MXIMPDataSubscriptionState::EDataUnavailable
+                );
+
+        listener2->ExpectL( event );
+        CleanupStack::Pop( event ); // 4 more items in cleanupstack
+
+        // unsubscribe
+        TXIMPRequestId reqId = presGroup.UnsubscribePresentityGroupListL();
+        EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Unsubscribe failed" );
+        CleanupStack::PopAndDestroy( 4 ); // group list event imp
+        messenger->AssertUnsubscribePresentityGroupListCalled( a == countOfWrappers-1 ? ETrue : EFalse );
+
+        CleanupStack::PopAndDestroy( listener2 );
+        }
+
+    UnbindAllL();
+    }
+
+
+// Multiple clients, all but one subscribe and all do unsubscribe
+void T_PresenceGroupListManagement::T_SubscribeAll_One_Unsub_Multiple_L()
+    {
+    EUNIT_PRINT( _L("Multiple, all but one subscribes and all unsubscribe") );
+
+    BindAllL();
+
+    // SUBSCRIBE
+    TInt countOfWrappers = iWrapperMgr->WrapperCount();
+    TInt skipIndex = 1;
+    for( TInt a = 0; a < countOfWrappers; ++a )
+        {
+        if ( skipIndex != a )
+            {
+            CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a );
+            MXIMPContext* context = wrapper->GetContext();
+            CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+            // Get the interfaces
+            MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+            MPresentityGroups& presGroup = presFeat->PresentityGroups();
+
+            CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context );
+            CleanupStack::PushL( listener2 );
+
+            // Tell the protocol it should act normally
+            messenger->SetNoError();
+
+            // expect normal request complete
+            TXIMPRequestId reqIdDummy;  // not checked
+            CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+            listener2->ExpectL( evReqComplete );
+            CleanupStack::Pop( evReqComplete );
+
+            // subscribe
+            TXIMPRequestId reqId = presGroup.SubscribePresentityGroupListL();
+            EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Subscribe failed" );
+            messenger->AssertSubscribePresentityGroupListCalled( ETrue );
+
+            CleanupStack::PopAndDestroy( listener2 );
+            }
+        }
+
+    // unsubscribe all
+    for( TInt a = 0; a < countOfWrappers; ++a )
+        {
+        CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a );
+        MXIMPContext* context = wrapper->GetContext();
+        CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+        // Get the interfaces
+        MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+        MPresentityGroups& presGroup = presFeat->PresentityGroups();
+
+        CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context );
+        CleanupStack::PushL( listener2 );
+
+        // Tell the protocol it should act normally
+        messenger->SetNoError();
+
+        // expect normal request complete
+        TXIMPRequestId reqIdDummy;  // not checked
+        CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+        listener2->ExpectL( evReqComplete );
+        CleanupStack::Pop( evReqComplete );
+
+        CPresentityGroupListEventImp* event = XIMPTestEventFactory::CreateGroupListEventLCX(
+                KNullDesC, KNullDesC,
+                XIMPTestEventFactory::ETestPGLEmpty,
+                KNullDesC, KNullDesC,
+                MXIMPDataSubscriptionState::ESubscriptionInactive,
+                MXIMPDataSubscriptionState::EDataUnavailable
+                );
+
+        listener2->ExpectL( event );
+        CleanupStack::Pop( event ); // 4 more items in cleanupstack
+
+        // unsubscribe
+        TXIMPRequestId reqId = presGroup.UnsubscribePresentityGroupListL();
+        EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Unsubscribe failed" );
+        CleanupStack::PopAndDestroy( 4 ); // group list event imp
+
+        messenger->AssertUnsubscribePresentityGroupListCalled( a == countOfWrappers-1 ? ETrue : EFalse );
+
+        CleanupStack::PopAndDestroy( listener2 );
+        }
+
+    UnbindAllL();
+    }
+
+// Multiple clients, refresh case for one
+void T_PresenceGroupListManagement::T_RefreshPresentityGroup_One_Multiple_L()
+    {
+    EUNIT_PRINT( _L("Multiple, one context does presentity group list refresh") );
+
+    BindAllL();
+
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    MXIMPContext* context = wrapper->GetContext();
+    CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+ 
+     // Get the interfaces
+    MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+    MPresentityGroups& presGroup = presFeat->PresentityGroups();
+    
+    CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context );
+    CleanupStack::PushL( listener2 );
+
+    // Tell the protocol it should act normally
+    messenger->SetNoError();
+
+    // ---------------------------------------------
+    // subscribe
+    TXIMPRequestId reqIdDummy;  // not checked
+    CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+    listener2->ExpectL( evReqComplete );
+    CleanupStack::Pop( evReqComplete );
+
+    TXIMPRequestId reqId = presGroup.SubscribePresentityGroupListL();
+    EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Subscribe failed" );
+    messenger->AssertSubscribePresentityGroupListCalled( ETrue );
+
+    // ---------------------------------------------
+    // refresh subscribe
+
+    messenger->SetValueFor(
+            EXIMPPlgTestSubscribeGroupListCalled,
+            EFalse );
+
+    evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+    listener2->ExpectL( evReqComplete );
+    CleanupStack::Pop( evReqComplete );
+
+    CPresentityGroupListEventImp* event = XIMPTestEventFactory::CreateGroupListEventLCX(
+            KNullDesC, KNullDesC,
+            XIMPTestEventFactory::ETestPGLUpdated,
+            KNullDesC, KNullDesC,
+            MXIMPDataSubscriptionState::ESubscriptionActive,
+            MXIMPDataSubscriptionState::EDataUnavailable
+            );
+
+    listener2->ExpectL( event );
+    CleanupStack::Pop( event ); // 4 more items in cleanupstack
+
+    reqId = presGroup.SubscribePresentityGroupListL();
+    EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Subscribe refresh failed" );
+    CleanupStack::PopAndDestroy( 4 ); // group list event imp
+    messenger->AssertSubscribePresentityGroupListCalled( EFalse );
+
+    // ---------------------------------------------
+    // unsubscribe
+    evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+    listener2->ExpectL( evReqComplete );
+    CleanupStack::Pop( evReqComplete );
+
+    event = XIMPTestEventFactory::CreateGroupListEventLCX(
+            KNullDesC, KNullDesC,
+            XIMPTestEventFactory::ETestPGLEmpty,
+            KNullDesC, KNullDesC,
+            MXIMPDataSubscriptionState::ESubscriptionInactive,
+            MXIMPDataSubscriptionState::EDataUnavailable
+            );
+
+    listener2->ExpectL( event );
+    CleanupStack::Pop( event ); // 4 more items in cleanupstack
+
+    reqId = presGroup.UnsubscribePresentityGroupListL();
+    EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Unsubscribe failed" );
+    CleanupStack::PopAndDestroy( 4 ); // group list event imp
+    messenger->AssertUnsubscribePresentityGroupListCalled( ETrue );
+
+    CleanupStack::PopAndDestroy( listener2 );
+
+    UnbindAllL();
+    }
+
+
+
+void T_PresenceGroupListManagement::SubscribeL()
+    {
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    MXIMPContext* context = wrapper->GetContext();
+    CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+    // Get the interfaces
+    MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+    MPresentityGroups& presGroup = presFeat->PresentityGroups();
+
+    CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context );
+    CleanupStack::PushL( listener2 );
+
+    // ------------------------------------------------------
+    // expect normal request complete
+    TXIMPRequestId reqIdDummy;  // not checked
+    CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+    listener2->ExpectL( evReqComplete );
+    CleanupStack::Pop( evReqComplete );
+    // ------------------------------------------------------
+
+    // subscribe
+    TXIMPRequestId reqId = presGroup.SubscribePresentityGroupListL();
+    EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Subscribe failed" );
+    messenger->AssertSubscribePresentityGroupListCalled( ETrue );
+
+    CleanupStack::PopAndDestroy( listener2 );
+    }
+
+
+
+void T_PresenceGroupListManagement::SubscribeGroupL( const TDesC& aGroupId )
+    {
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    MXIMPContext* context = wrapper->GetContext();
+    CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+    // Get the interfaces
+    MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+    MPresentityGroups& presGroup = presFeat->PresentityGroups();
+
+    CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context );
+    CleanupStack::PushL( listener2 );
+
+    // ------------------------------------------------------
+    // expect normal request complete
+    TXIMPRequestId reqIdDummy;  // not checked
+    CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+    listener2->ExpectL( evReqComplete );
+    CleanupStack::Pop( evReqComplete );
+    // ------------------------------------------------------
+
+    // subscribe group content
+    MXIMPIdentity* identity = context->ObjectFactory().NewIdentityLC();
+    identity->SetIdentityL( aGroupId );
+
+    TXIMPRequestId reqId = presGroup.SubscribePresentityGroupContentL( *identity );
+    EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Subscribe content failed" );
+
+    COMMONASSERT( messenger, EXIMPPlgTestSubscribePresentityGroupContentCalled, "SubscribeGroupContentL was not called", ETrue, NULL );
+
+    CleanupStack::PopAndDestroy(); // identity
+    CleanupStack::PopAndDestroy( listener2 );
+    }
+
+
+
+void T_PresenceGroupListManagement::UnsubscribeL()
+    {
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    MXIMPContext* context = wrapper->GetContext();
+    CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+    // Get the interfaces
+    MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+    MPresentityGroups& presGroup = presFeat->PresentityGroups();
+
+    CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context );
+    CleanupStack::PushL( listener2 );
+
+    // ------------------------------------------------------
+    // expect normal request complete
+    TXIMPRequestId reqIdDummy;  // not checked
+    CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+    listener2->ExpectL( evReqComplete );
+    CleanupStack::Pop( evReqComplete );
+
+    CPresentityGroupListEventImp* event = XIMPTestEventFactory::CreateGroupListEventLCX(
+            KNullDesC, KNullDesC,
+            XIMPTestEventFactory::ETestPGLEmpty,
+            KNullDesC, KNullDesC,
+            MXIMPDataSubscriptionState::ESubscriptionInactive,
+            MXIMPDataSubscriptionState::EDataUnavailable
+            );
+
+    listener2->ExpectL( event );
+    CleanupStack::Pop( event ); // 4 more items in cleanupstack
+
+    // unsubscribe
+    TXIMPRequestId reqId = presGroup.UnsubscribePresentityGroupListL();
+    EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Unsubscribe failed" );
+    CleanupStack::PopAndDestroy( 4 ); // group list event imp
+    messenger->AssertUnsubscribePresentityGroupListCalled( ETrue );
+
+    CleanupStack::PopAndDestroy( listener2 );
+    }
+
+
+void T_PresenceGroupListManagement::UnsubscribeGroupL( const TDesC& aGroupId )
+    {
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    MXIMPContext* context = wrapper->GetContext();
+    CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+    // Get the interfaces
+    MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+    MPresentityGroups& presGroup = presFeat->PresentityGroups();
+
+    CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context );
+    CleanupStack::PushL( listener2 );
+
+    // ------------------------------------------------------
+    // expect normal request complete
+    TXIMPRequestId reqIdDummy;  // not checked
+    CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+    listener2->ExpectL( evReqComplete );
+    CleanupStack::Pop( evReqComplete );
+
+    // and a group content event, IF we have subscribed the group beforehand
+    // i.e. SubscribeGroupL has been called before this
+
+    MXIMPIdentity* identity = context->ObjectFactory().NewIdentityLC();
+    identity->SetIdentityL( aGroupId );
+
+    CPresentityGroupContentEventImp* groupCntEvent =
+        XIMPTestEventFactory::CreateGroupContentEventLCX(
+                aGroupId,
+                KNullDesC,
+                KNullDesC,
+                XIMPTestEventFactory::ETestPGLCntRemoved,
+                KNullDesC,
+                KNullDesC,
+                MXIMPDataSubscriptionState::ESubscriptionInactive,
+                MXIMPDataSubscriptionState::EDataUnavailable
+                );
+
+    listener2->ExpectL( groupCntEvent );
+    CleanupStack::Pop( groupCntEvent );
+
+    // ------------------------------------------------------
+
+    // unsubscribe
+
+    TXIMPRequestId reqId = presGroup.UnsubscribePresentityGroupContentL( *identity );
+    EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Unsubscribe group content failed" );
+    messenger->AssertUnsubscribePresentityGroupContentCalled( ETrue );
+
+    CleanupStack::PopAndDestroy( 5 ); // rest of the group content event
+    CleanupStack::PopAndDestroy(); // identity
+
+    CleanupStack::PopAndDestroy( listener2 );
+    }
+
+
+
+// Single client, empty filter
+void T_PresenceGroupListManagement::T_HandlePresentityGroupList_L()
+    {
+    EUNIT_PRINT( _L("Handle presentity group list.") );
+
+    // log in and subscribe a group list
+    BindL();
+    SubscribeL();
+
+    // ------------------------------------------------------
+    // some startup stuff
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    MXIMPContext* context = wrapper->GetContext();
+
+    CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context );
+    CleanupStack::PushL( listener2 );
+    // ------------------------------------------------------
+
+    // Tell the protocol it should act normally
+    wrapper->GetMessenger()->SetNoError();
+
+    // ------------------------------------------------------
+    // 1. Create faked server message about group list
+    SendSrvMsgL( CXIMPTestFileSrvMsg::ETestSrvMsgPresentityGroupList );
+
+    // ------------------------------------------------------
+    // expect empty MPresentityGroupList event.
+
+    CPresentityGroupListEventImp* event = XIMPTestEventFactory::CreateGroupListEventLCX(
+            KNullDesC, KNullDesC,
+            XIMPTestEventFactory::ETestPGLEmpty,
+            KNullDesC, KNullDesC,
+            MXIMPDataSubscriptionState::ESubscriptionActive,
+            MXIMPDataSubscriptionState::EDataAvailable
+            );
+
+    listener2->ExpectL( event );
+    CleanupStack::Pop( event ); // 4 more items in cleanupstack
+
+    EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "HandlePresentityGroupListL failed" );
+    CleanupStack::PopAndDestroy( 4 ); // lists
+    // ------------------------------------------------------
+
+    CleanupStack::PopAndDestroy( listener2 );
+
+    // clean it up
+    UnsubscribeL();
+    UnbindL();
+    }
+
+
+
+_LIT16(  KPresentUri1,      "http://lorem.ipsum.com" );
+_LIT16(  KPresentUri2,      "http://carpe.diem.com" );
+_LIT16( KPresentDispName1, "DispnameA, LoremI" );
+_LIT16( KPresentDispName2, "DispnameB, CarpeD" );
+_LIT16( KPresentProtAddr1, "ABC" );
+_LIT16( KPresentProtAddr2, "HIJ" );
+
+void T_PresenceGroupListManagement::T_HandlePresentityGroupCreateAndDelete_L()
+    {
+    EUNIT_PRINT( _L("Handle presentity group creation and deletion.") );
+
+    // log in and subscribe a group list
+    BindL();
+    SubscribeL();
+
+    // ------------------------------------------------------
+    // some startup stuff
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    MXIMPContext* context = wrapper->GetContext();
+
+    CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context );
+    CleanupStack::PushL( listener2 );
+    // ------------------------------------------------------
+
+    // Tell the protocol it should act normally
+    wrapper->GetMessenger()->SetNoError();
+
+    // ------------------------------------------------------
+    // 1. Create faked notification about create
+    SendSrvMsgL( KPresentUri1, KPresentDispName1,
+            CXIMPTestFileSrvMsg::ETestSrvMsgPresentityGroupCreate );
+
+    // ------------------------------------------------------
+    // expect MPresentityGroupList event.
+    CPresentityGroupListEventImp* event = XIMPTestEventFactory::CreateGroupListEventLCX(
+            KPresentUri1, KPresentDispName1,
+            XIMPTestEventFactory::ETestPGLCreated,
+
+            KPresentUri1, KPresentDispName1,
+            MXIMPDataSubscriptionState::ESubscriptionActive,
+            MXIMPDataSubscriptionState::EDataAvailable
+            );
+
+    listener2->ExpectL( event );
+    CleanupStack::Pop( event ); // 4 more items in cleanupstack
+
+    EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "HandlePresentityGroupListL failed (Creation)" );
+    CleanupStack::PopAndDestroy( 4 ); // lists
+
+    // ------------------------------------------------------
+    // Send a faked delete message
+
+    SendSrvMsgL( KPresentUri1, KPresentDispName1,
+            CXIMPTestFileSrvMsg::ETestSrvMsgPresentityGroupDelete );
+
+    // ------------------------------------------------------
+    // expect MPresentityGroupList event.
+
+    event = XIMPTestEventFactory::CreateGroupListEventLCX(
+            KPresentUri1, KNullDesC,
+            XIMPTestEventFactory::ETestPGLDeleted,
+            KNullDesC, KNullDesC,
+            MXIMPDataSubscriptionState::ESubscriptionActive,
+            MXIMPDataSubscriptionState::EDataAvailable
+            );
+
+    listener2->ExpectL( event );
+    CleanupStack::Pop( event ); // 4 more items in cleanupstack
+
+    EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "HandlePresentityGroupListL failed (Deletion)" );
+    CleanupStack::PopAndDestroy( 4 ); // lists
+    // ------------------------------------------------------
+
+    CleanupStack::PopAndDestroy( listener2 );
+
+    // unsubscribe group list and log out
+    UnsubscribeL();
+    UnbindL();
+    }
+
+// Single client, subscribed to the group, then subscribe list
+void T_PresenceGroupListManagement::T_HandlePresentityGroupList_Subscribed_L()
+    {
+    EUNIT_PRINT( _L("Handle presentity group list, subscribed to the group.") );
+
+    // log in
+    BindL();
+    SubscribeGroupL( KPresentUri1 );
+    SubscribeL();
+
+    // ------------------------------------------------------
+    // some startup stuff
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    MXIMPContext* context = wrapper->GetContext();
+
+    CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context );
+    CleanupStack::PushL( listener2 );
+    // ------------------------------------------------------
+
+    // Tell the protocol it should act normally
+    wrapper->GetMessenger()->SetNoError();
+
+    // ------------------------------------------------------
+    // 1. Create faked server message about group list
+    SendSrvMsgL( KPresentUri1,
+            KPresentDispName1,
+            CXIMPTestFileSrvMsg::ETestSrvMsgPresentityGroupCreate );
+
+    // ------------------------------------------------------
+    // expect empty MPresentityGroupList event.
+
+    CPresentityGroupListEventImp* event = XIMPTestEventFactory::CreateGroupListEventLCX(
+            KPresentUri1, KPresentDispName1,
+            XIMPTestEventFactory::ETestPGLCreated,
+            KPresentUri1, KPresentDispName1,
+            MXIMPDataSubscriptionState::ESubscriptionActive,
+            MXIMPDataSubscriptionState::EDataAvailable
+            );
+
+    listener2->ExpectL( event );
+    CleanupStack::Pop( event ); // 4 more items in cleanupstack
+
+    EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "HandlePresentityGroupListL failed" );
+    CleanupStack::PopAndDestroy( 4 ); // lists
+    // ------------------------------------------------------
+
+    CleanupStack::PopAndDestroy( listener2 );
+
+    // clean it up
+    UnsubscribeL();
+    UnsubscribeGroupL( KPresentUri1 );
+    UnbindL();
+    }
+
+void T_PresenceGroupListManagement::T_HandlePresentityGroupUpdate_L()
+    {
+    EUNIT_PRINT( _L("Handle presentity group displayname update.") );
+
+    // log in and subscribe a group list
+    BindL();
+    SubscribeL();
+
+    // ------------------------------------------------------
+    // some startup stuff
+
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    MXIMPContext* context = wrapper->GetContext();
+
+    CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context );
+    CleanupStack::PushL( listener2 );
+    // ------------------------------------------------------
+
+    // Tell the protocol it should act normally
+    wrapper->GetMessenger()->SetNoError();
+
+    // ------------------------------------------------------
+    // 1. Create faked notification about create
+    SendSrvMsgL( KPresentUri1, KPresentDispName1,
+            CXIMPTestFileSrvMsg::ETestSrvMsgPresentityGroupCreate );
+
+    // ------------------------------------------------------
+    // expect MPresentityGroupList event.
+
+    CPresentityGroupListEventImp* event = XIMPTestEventFactory::CreateGroupListEventLCX(
+            KPresentUri1, KPresentDispName1,
+            XIMPTestEventFactory::ETestPGLCreated,
+            KPresentUri1, KPresentDispName1,
+            MXIMPDataSubscriptionState::ESubscriptionActive,
+            MXIMPDataSubscriptionState::EDataAvailable
+            );
+
+    listener2->ExpectL( event );
+    CleanupStack::Pop( event ); // 4 more items in cleanupstack
+
+    EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "HandlePresentityGroupListL failed (Creation)" );
+    CleanupStack::PopAndDestroy( 4 ); // lists
+
+    // ------------------------------------------------------
+    // 4. Change displayname of group and send faked notification about
+    // update
+
+    SendSrvMsgL( KPresentUri1, KPresentDispName2,
+            CXIMPTestFileSrvMsg::ETestSrvMsgPresentityGroupUpdate );
+
+    // ------------------------------------------------------
+    // expect MPresentityGroupList event.
+
+    event = XIMPTestEventFactory::CreateGroupListEventLCX(
+            KPresentUri1, KPresentDispName2,
+            XIMPTestEventFactory::ETestPGLUpdated,
+            KPresentUri1, KPresentDispName2,
+            MXIMPDataSubscriptionState::ESubscriptionActive,
+            MXIMPDataSubscriptionState::EDataAvailable
+            );
+
+    listener2->ExpectL( event );
+    CleanupStack::Pop( event ); // 4 more items in cleanupstack
+
+    EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "HandlePresentityGroupListL failed (Update)" );
+    CleanupStack::PopAndDestroy( 4 ); // lists
+    // ------------------------------------------------------
+
+    CleanupStack::PopAndDestroy( listener2 );
+
+    // unsubscribe group list and log out
+    UnsubscribeL();
+    UnbindL();
+    }
+
+// ===========================================================================
+// SETUP HELPERS FOR THE LISTENER
+// ===========================================================================
+//
+
+// send a faked server-originated message with group info made
+// from the given uri and displayname
+//
+void T_PresenceGroupListManagement::SendSrvMsgL(
+        const TDesC& aUri, const TDesC& aDispName,
+        TInt aMsgType )
+    {
+    // we'll use hard-coded wrapper 0 instance for now.
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+
+    // create a group info contained within the server-originated
+    // faked message
+    CXIMPIdentityImp* groupId = CXIMPIdentityImp::NewLC( aUri );
+    CPresentityGroupInfoImp* groupItem = CPresentityGroupInfoImp::NewLC( *groupId, aDispName );
+    HBufC8* packet = NULL;
+    if( aMsgType == CXIMPTestFileSrvMsg::ETestSrvMsgPresentityGroupDelete )
+        {
+        packet = TXIMPObjectPacker< CXIMPIdentityImp >::PackL( *groupId );        
+        }
+    else
+        {
+        packet = TXIMPObjectPacker< CPresentityGroupInfoImp >::PackL( *groupItem );        
+        }
+    CleanupStack::PushL( packet );
+    
+    // use filetool to send it for plugin.
+    CXIMPTestFileSrvMsg* srvMsg = CXIMPTestFileSrvMsg::NewL( aMsgType, *packet );
+    CleanupStack::PushL( srvMsg );
+    wrapper->FileTool().CleanAllL();
+    wrapper->FileTool().SrvMsgStoreL( srvMsg );
+    CleanupStack::PopAndDestroy( 4, groupId ); // srvMsg, packet, groupItem, groupId
+    }
+
+// send a faked server-originated message with empty contents
+//
+void T_PresenceGroupListManagement::SendSrvMsgL( TInt aMsgType )
+    {
+    // we'll use hard-coded wrapper 0 instance for now.
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+
+    // create a server-originated faked message with empty contents
+    RXIMPObjOwningPtrArray<CPresentityGroupInfoImp> groupList;
+
+    HBufC8* packedArray = TXIMPObjectPacker<CPresentityGroupInfoImp>::PackArrayL( groupList );
+    CleanupStack::PushL( packedArray );
+
+    // use filetool to send it for plugin.
+    CXIMPTestFileSrvMsg* srvMsg = CXIMPTestFileSrvMsg::NewL( aMsgType,
+            *packedArray );
+    CleanupStack::PushL( srvMsg );
+    wrapper->FileTool().CleanAllL();
+    wrapper->FileTool().SrvMsgStoreL( srvMsg );
+    CleanupStack::PopAndDestroy( 2 ); // srvMsg, packedArray
+    }
+
+// update display name of group without having subscribed to it
+void T_PresenceGroupListManagement::T_UpdateDisplayNameL(
+        const TDesC& aGroupId,
+        const TDesC& aDispName )
+    {
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    MXIMPContext* context = wrapper->GetContext();
+    CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+    // Get the interfaces
+    MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+    MPresentityGroups& presGroup = presFeat->PresentityGroups();
+
+    wrapper->GetMessenger()->SetNoError();
+
+    CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context );
+    CleanupStack::PushL( listener2 );
+
+    MXIMPIdentity* groupId = context->ObjectFactory().NewIdentityLC();
+    groupId->SetIdentityL( aGroupId );
+
+    // ------------------------------------------------------
+    // expect request complete with a group info imp inside
+    TXIMPRequestId reqIdDummy;  // not checked
+    CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+
+    CPresentityGroupInfoImp* grpInfo = CPresentityGroupInfoImp::NewLC(
+            *groupId,
+            aDispName );
+
+    evReqComplete->AppendParamL( grpInfo );
+    CleanupStack::Pop(); // grpInfo
+
+    listener2->ExpectL( evReqComplete );
+    CleanupStack::Pop( evReqComplete );
+
+    // ------------------------------------------------------
+    // update
+    TXIMPRequestId reqId = presGroup.UpdatePresentityGroupDisplayNameL(
+            *groupId,
+            aDispName );
+
+    EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Unsubscribe group content failed" );
+
+    messenger->AssertUpdatePresentityGroupDisplayNameCalled( ETrue );
+
+    CleanupStack::PopAndDestroy(); // groupId
+    CleanupStack::PopAndDestroy( listener2 );
+    }
+
+
+// test method for updating display name of group without having subscribed
+// to it
+void T_PresenceGroupListManagement::T_UpdateDisplayName_Single_L()
+    {
+    EUNIT_PRINT( _L("Update presentity group displayname, single.") );
+
+    BindL();
+
+    T_UpdateDisplayNameL( KPresentUri1, KPresentDispName1 );
+
+    UnbindL();
+    }
+
+
+
+// Single client, unsubscribe nonsubscribed
+void T_PresenceGroupListManagement::T_UnsubNonsubscribed_Single_L()
+    {
+    EUNIT_PRINT( _L("Single unsubscribe nonsubscribed") );
+
+    BindL();
+
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    MXIMPContext* context = wrapper->GetContext();
+    CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+    // Get the interfaces
+    MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+    MPresentityGroups& presGroup = presFeat->PresentityGroups();
+
+    CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context );
+    CleanupStack::PushL( listener2 );
+
+    // Tell the protocol it should act normally
+    messenger->SetNoError();
+
+    // ---------------------------------------------
+    // unsubscribe
+    TXIMPRequestId reqIdDummy;  // not checked
+    CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+    listener2->ExpectL( evReqComplete );
+    CleanupStack::Pop( evReqComplete );
+
+    // group list event with Unsubscribed
+    CPresentityGroupListEventImp* event = XIMPTestEventFactory::CreateGroupListEventLCX(
+            KNullDesC, KNullDesC,
+            XIMPTestEventFactory::ETestPGLEmpty,
+
+            KNullDesC, KNullDesC,
+            MXIMPDataSubscriptionState::ESubscriptionInactive,
+            MXIMPDataSubscriptionState::EDataUnavailable
+            );
+
+    listener2->ExpectL( event );
+    CleanupStack::Pop( event ); // 4 more items in cleanupstack
+
+    TXIMPRequestId reqId = presGroup.UnsubscribePresentityGroupListL();
+    EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Unsubscribe failed" );
+    CleanupStack::PopAndDestroy( 4 ); // rest of the group list event
+    messenger->AssertUnsubscribePresentityGroupListCalled( EFalse );  // should not be called, no subscriptions
+
+    CleanupStack::PopAndDestroy( listener2 );
+
+    UnbindL();
+    }
+
+// ===========================================================================
+// TEST CASE TABLE
+// ===========================================================================
+//
+EUNIT_BEGIN_TEST_TABLE(
+        T_PresenceGroupListManagement,
+        "XIMP presence group list management tests",
+        "MODULE" )
+
+PRFW_DECORATED_TEST(
+        "Subscribe single presence",
+        "",
+        "",
+        "FUNCTIONALITY",
+        Setup_L,
+        T_SubscribePresentityGroup_Single_L,
+        Teardown )
+
+PRFW_DECORATED_TEST(
+        "Subscribe single presence with error",
+        "",
+        "",
+        "FUNCTIONALITY",
+        Setup_L,
+        T_SubscribePresentityGroup_Error_Single_L,
+        Teardown )
+
+PRFW_DECORATED_TEST(
+        "Unsubscribe single presence with error",
+        "",
+        "",
+        "FUNCTIONALITY",
+        Setup_L,
+        T_UnsubscribePresentityGroup_Error_Single_L,
+        Teardown )
+
+PRFW_DECORATED_TEST(
+        "Unsubscribe nonsubscribed",
+        "",
+        "",
+        "FUNCTIONALITY",
+        Setup_L,
+        T_UnsubNonsubscribed_Single_L,
+        Teardown )
+
+PRFW_DECORATED_TEST(
+        "Subscribe multiple presence",
+        "",
+        "",
+        "FUNCTIONALITY",
+        SetupMultiple_L,
+        T_SubscribePresentityGroup_Multiple_L,
+        Teardown )
+
+PRFW_DECORATED_TEST(
+        "Multiple subscribe all but one, unsub all",
+        "",
+        "",
+        "FUNCTIONALITY",
+        SetupMultiple_L,
+        T_SubscribeAll_One_Unsub_Multiple_L,
+        Teardown )
+
+PRFW_DECORATED_TEST(
+        "Single refresh multiple presence",
+        "",
+        "",
+        "FUNCTIONALITY",
+        SetupMultiple_L,
+        T_RefreshPresentityGroup_One_Multiple_L,
+        Teardown )
+
+PRFW_DECORATED_TEST(
+        "Multiple refresh presence",
+        "",
+        "",
+        "FUNCTIONALITY",
+        SetupMultiple_L,
+        T_RefreshPresentityGroup_Multiple_L,
+        Teardown )
+
+PRFW_DECORATED_TEST(
+        "Handle Presentity Group List",
+        "",
+        "",
+        "FUNCTIONALITY",
+        Setup_L,
+        T_HandlePresentityGroupList_L,
+        Teardown )
+
+PRFW_DECORATED_TEST(
+        "Handle Presentity Group List (subscribed group)",
+        "",
+        "",
+        "FUNCTIONALITY",
+        Setup_L,
+        T_HandlePresentityGroupList_Subscribed_L,
+        Teardown )
+
+PRFW_DECORATED_TEST(
+        "Create and delete group.",
+        "",
+        "",
+        "FUNCTIONALITY",
+        Setup_L,
+        T_HandlePresentityGroupCreateAndDelete_L,
+        Teardown )
+
+PRFW_DECORATED_TEST(
+        "Handle update displayname",
+        "",
+        "",
+        "FUNCTIONALITY",
+        Setup_L,
+        T_HandlePresentityGroupUpdate_L,
+        Teardown )
+
+PRFW_DECORATED_TEST(
+        "Update displayname",
+        "",
+        "",
+        "FUNCTIONALITY",
+        Setup_L,
+        T_UpdateDisplayName_Single_L,
+        Teardown )
+
+EUNIT_END_TEST_TABLE
+
+
+// ===========================================================================
+// TEST SUITE CONSTRUCTION
+// ===========================================================================
+//
+EXPORT_C MEUnitTest* CreateTestSuiteL()
+    {
+    return T_PresenceGroupListManagement::NewL();
+    }
+
+
+// end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_presencegrouplistmngt/t_presencegrouplistmngt.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,133 @@
+/*
+* 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:
+*
+*/
+
+#ifndef T_PRESENCEGROUPLISTMANAGEMENT_H
+#define T_PRESENCEGROUPLISTMANAGEMENT_H
+
+
+//  EXTERNAL INCLUDES
+#include <platform/digia/eunit/ceunittestsuiteclass.h>
+#include <platform/digia/eunit/EUnitDecorators.h>
+
+#include <ximpbase.h>
+#include "prfwteststatuseventlistener.h"
+#include "prfwtestmessaging.h"
+
+class CXIMPTestContextWrapper;
+class CXIMPTestContextWrapperMgr;
+class CXIMPTestMessenger;
+class CPresentityGroupInfoImp;
+class CPresentityGroupListEventImp;
+
+/**
+ * XIMP Framework Eunit tests.
+ *
+ * Tests for XIMP session management services.
+ *
+ * @since S60 v4.0
+ */
+class T_PresenceGroupListManagement : public CEUnitTestSuiteClass
+    {
+
+public:
+    static T_PresenceGroupListManagement* NewL();
+    virtual ~T_PresenceGroupListManagement();
+
+
+private:
+    T_PresenceGroupListManagement();
+    void ConstructL();
+
+private:    // Test case functions
+
+    void Setup_L();
+    void SetupMultiple_L();
+    void BindL();
+    void BindAllL();
+    void Teardown();
+    void UnbindL();
+    void UnbindAllL();
+    void SubscribeL();
+    void SubscribeGroupL( const TDesC& aGroupId );
+    void UnsubscribeGroupL( const TDesC& aGroupId );
+    void UnsubscribeL();
+
+    void T_SubscribePresentityGroup_Single_L();
+    void T_UnsubscribePresentityGroup_Error_Single_L();
+    void T_SubscribePresentityGroup_Error_Single_L();
+    void T_SubscribePresentityGroup_Multiple_L();
+    void T_UpdateDisplayName_Single_L();
+    void T_HandlePresentityGroupList_L();
+    void T_HandlePresentityGroupList_Subscribed_L();
+    void T_HandlePresentityGroupCreateAndDelete_L();
+    void T_HandlePresentityGroupUpdate_L();
+    void T_HandlePresentityGroupUpdate_WithHelpers_L();
+    void T_SubscribePresentityGroup_One_Multiple_L();
+    void T_RefreshPresentityGroup_One_Multiple_L();
+    void T_UnsubNonsubscribed_Single_L();
+    void T_RefreshPresentityGroup_Multiple_L();
+    void T_SubscribeAll_One_Unsub_Multiple_L();
+
+    void T_UpdateDisplayNameL( 
+            const TDesC& aGroupId, 
+            const TDesC& aDispName );
+
+private:    // Test helpers
+
+    /**
+     * Fake a server-originated (=mobile terminated) message.
+     * The message appears to adaptation and framework as if
+     * it came from the network. Uses only one group.
+     * @param aUri The URI of group
+     * @param aDispName The display name for the group
+     * @param aMsgType The message type for CXIMPTestFileSrvMsg
+     */
+    void SendSrvMsgL( 
+            const TDesC& aUri, const TDesC& aDispName,
+            TInt aMsgType );
+    
+    /**
+     * Fake a server-originated message with empty content.
+     * Whether to use this depends on the event you expect.
+     * @see SendSrvMsgL
+     */
+    void SendSrvMsgL( TInt aMsgType );
+
+private: // Test data
+
+    /**
+     * Eunit test case table declaration.
+     */
+    EUNIT_DECLARE_TEST_TABLE;
+
+    // owned
+    CXIMPTestContextWrapperMgr* iWrapperMgr;
+    
+    // 
+    TInt iLastError;
+    RXIMPObjOwningPtrArray< CPresentityGroupInfoImp > iValidateArray;
+    };
+
+
+#endif      //  T_PRESENCEGROUPLISTMANAGEMENT_H
+
+
+
+// end of file
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_presencegrouplistmngt/t_presencegrouplistmngt.mmp	Wed Nov 03 09:32:20 2010 +0530
@@ -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:
+*
+*/
+
+#include            "../../tsrcutils/eunitcommon/eunittstdllbase.hrh"
+#include            "../../tsrcutils/processmaster/pm.h"
+
+#include<platform_paths.hrh>
+#include<eunitcaps.h>
+TARGET              t_presencegrouplistmngt.dll
+//CAPABILITY              ALL - TCB - DRM
+CAPABILITY      EUNIT_CAPS
+
+SOURCEPATH          .
+SOURCE              t_presencegrouplistmngt.cpp
+
+USERINCLUDE             ../../../../../ximpfw/core/srcdatamodel
+USERINCLUDE             ../../../../../ximpfw/presence/srcpresencedatamodel
+USERINCLUDE             ../../../../../ximpfw/presence/srcpresencedatamodel/presentitygroups
+USERINCLUDE             ../../../../../ximpfw/presence/srcpresencedatamodel/presencewatching
+USERINCLUDE             ../../../../../ximpfw/presence/srcpresencedatamodel/presenceauthorization
+USERINCLUDE             ../../../../../ximpfw/presence/srcpresencedatamodel/presencepublishing
+USERINCLUDE             ../../../../../ximpfw/presence/srcpresencedatamodel/presenceinfo
+USERINCLUDE             ../../../../../ximpfw/core/srcutils
+
+// TODO remove unnecessary
+#if defined ( OS_LAYER_SYSTEMINCLUDE )
+OS_LAYER_SYSTEMINCLUDE
+#else
+SYSTEMINCLUDE     /epoc32/include
+#endif
+
+ #if defined ( APP_LAYER_SYSTEMINCLUDE )
+ APP_LAYER_SYSTEMINCLUDE
+ #else
+ SYSTEMINCLUDE     \epoc32\include
+ #endif
+ 
+SYSTEMINCLUDE           ../../../../../ximpfw/inc/core/base
+SYSTEMINCLUDE           ../../../../../ximpfw/inc/core/datamodel
+SYSTEMINCLUDE           ../../../../../ximpfw/inc/core/protocolplugin
+SYSTEMINCLUDE           ../../../../../ximpfw/inc/core/protocolpluginhost
+SYSTEMINCLUDE           ../../../../../ximpfw/inc/presence/presencedatamodel
+SYSTEMINCLUDE           ../../../../../ximpfw/inc/presence/presencemanagement
+SYSTEMINCLUDE           ../../../../../ximpfw/inc/presence/presenceprotocolplugin
+SYSTEMINCLUDE           ../../../../../ximpfw/inc/presence/presenceprotocolpluginhost
+
+
+LIBRARY             ecom.lib
+LIBRARY             bafl.lib
+LIBRARY             ximpdatamodel.lib
+LIBRARY             presencedatamodel.lib
+LIBRARY             ximputils.lib
+LIBRARY             estor.lib
+LIBRARY                 EUnit.lib
+LIBRARY             eunitutil.lib
+LIBRARY             euser.lib
+// end of file
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_presencegroupmembermngt/bld.inf	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,23 @@
+/*
+* 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 t_presencegroupmngt.dll
+ *
+*/
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_TESTMMPFILES
+t_presencegroupmembermngt.mmp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_presencegroupmembermngt/t_presencegroupmembermngt.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,2283 @@
+/*
+* 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:
+*
+*/
+
+
+#include "eunittools.h"
+
+
+#include <platform/digia/eunit/eunitmacros.h>
+#include <platform/digia/eunit/teunitassertioninfo.h>
+
+#include <ecom/ecom.h>
+#include <badesca.h>
+#include <e32std.h>
+
+#include <ximpclient.h>
+#include <ximpcontext.h>
+#include <ximpobjectfactory.h>
+#include <ximpcontextstateevent.h>
+#include <ximprequestcompleteevent.h>
+#include <ximpstatus.h>
+#include <presencefeatures.h>
+#include <presentitygroups.h>
+#include <presentitygroupmemberinfo.h>
+#include <presentitygroupcontentevent.h>
+
+
+#include "ximpeventcodec.h"
+
+#include "t_presencegroupmembermngt.h"
+#include "prfwteststatuseventlistener.h"
+#include "prfwtestmessaging.h"
+#include "prfwtestmessenger.h"
+#include "prfwtestlistener.h"
+#include "prfwtestcontextwrappermgr.h"
+#include "prfwtestcontextwrapper.h"
+#include "ximpcontextstateeventimp.h"
+#include "ximpcontextstateevent.h"
+
+#include "presenceinfoimp.h"
+#include "presenceinfofilterimp.h"
+#include "prfwtestpresencedatautils.h"
+#include "ximpidentityimp.h"
+#include "presentitygroupcontenteventimp.h"
+#include "ximprequestcompleteeventimp.h"
+#include "presentitygroupinfoimp.h"
+#include "presentitygrouplisteventimp.h"
+#include "presentitygroupmemberinfoimp.h"
+#include "ximprequestcompleteeventimp.h"
+#include "ximprestrictedobjectcollection.h"
+#include "ximpobjectfactoryimp.h"
+
+#include "prfwtestrobustnesstools.h"
+#include "ximpobjecthelpers.h"
+#include "prfwtestfilesrvmsg.h"
+#include "prfwtestfiletool.h"
+#include "prfwtestwaithelper.h"
+#include "prfwtesteventfactory.h"
+
+
+_LIT( KGroupId,   "wv:group/member@imps.com" );
+_LIT( KGroupId2,  "wv:group2/chutney@naan.com" );
+_LIT( KGroupDisplayName, "Salamapartio Z" );
+
+_LIT( KMemberId, "wv:member@imps.com" );
+_LIT( KMemberDisplayName,  "Stroustrup" );
+_LIT( KMemberDisplayName2, "Bjarne" );
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// CONSTRUCTION
+T_PresenceGroupMemberManagement* T_PresenceGroupMemberManagement::NewL()
+    {
+    T_PresenceGroupMemberManagement* self = new( ELeave ) T_PresenceGroupMemberManagement;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+
+    return self;
+    }
+
+T_PresenceGroupMemberManagement::~T_PresenceGroupMemberManagement()
+    {
+    delete iLastEvent;
+
+    if ( iASWait && iASWait->IsStarted() )
+        {
+        iASWait->AsyncStop();
+        }
+    delete iASWait;
+
+    delete iListener2;
+
+    delete iCurrentGrId;
+    }
+
+void T_PresenceGroupMemberManagement::ConstructL()
+    {
+    CEUnitTestSuiteClass::ConstructL();
+    iASWait = new ( ELeave ) CActiveSchedulerWait();
+    }
+
+
+T_PresenceGroupMemberManagement::T_PresenceGroupMemberManagement()
+    {
+    }
+
+// ===========================================================================
+// TEST CASE SETUP & TEARDOWN METHODS
+// ===========================================================================
+//
+
+void T_PresenceGroupMemberManagement::Setup_L()
+    {
+    PrfwTestRobustness::DoPreCleaning();
+
+    iWrapperMgr = CXIMPTestContextWrapperMgr::NewL();
+    iWrapperMgr->CreateWrapperL();
+
+    // must reset these to EFalse
+    iSkipSubscribe = EFalse;
+    iSkipUnsubscribe = EFalse;
+    }
+
+void T_PresenceGroupMemberManagement::SetupMultiple_L()
+    {
+    PrfwTestRobustness::DoPreCleaning();
+
+    iWrapperMgr = CXIMPTestContextWrapperMgr::NewL();
+    iWrapperMgr->CreateWrapperL();
+    iWrapperMgr->CreateWrapperL();
+    iWrapperMgr->CreateWrapperL();
+
+    // must reset these to EFalse
+    iSkipSubscribe = EFalse;
+    iSkipUnsubscribe = EFalse;
+    }
+
+// bind helper
+void T_PresenceGroupMemberManagement::BindAllL()
+    {
+    for( TInt a = 0; a < iWrapperMgr->WrapperCount(); ++a )
+        {
+        CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a );
+        wrapper->BindL( 0 );
+        }
+    }
+
+// unbind helper
+void T_PresenceGroupMemberManagement::UnbindAllL()
+    {
+    for( TInt a = 0; a < iWrapperMgr->WrapperCount(); ++a )
+        {
+        CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a );
+        wrapper->UnbindL();
+        }
+    }
+
+void T_PresenceGroupMemberManagement::TeardownTestSupport()
+    {
+    // anything NOT initialized by test case Setup method,
+    // but initialized in the test case itself, goes here
+    delete iCurrentGrId;
+    iCurrentGrId = NULL;
+
+    delete iListener2;
+    iListener2 = NULL;
+
+    delete iLastEvent;
+    iLastEvent = NULL;
+    }
+
+void T_PresenceGroupMemberManagement::Teardown()
+    {
+    TeardownTestSupport();
+    // just in case to avoid memleaks. should not have anything to
+    // delete anyway
+
+    delete iWrapperMgr;
+    iWrapperMgr = NULL;
+
+    REComSession::FinalClose();
+
+    // must reset these to EFalse
+    iSkipSubscribe = EFalse;
+    iSkipUnsubscribe = EFalse;
+
+    // it's best to nuke the servers during exit too.
+    PrfwTestRobustness::DoPreCleaning();
+    }
+
+// ===========================================================================
+// TEST CASES for presentity presence subscription
+// ===========================================================================
+
+// General test case for single member
+void T_PresenceGroupMemberManagement::T_GenericSubAndUnsubL(
+        TXIMPCallBack& aCbFuncL )
+    {
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    wrapper->BindL( 0 );
+
+    // ------------------------------------------------------
+    // some startup stuff
+    MXIMPContext* context = wrapper->GetContext();
+    CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+    // Get the interfaces
+    MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+    MPresentityGroups& presGroup = presFeat->PresentityGroups();
+
+    iListener2 = CXIMPTestListener::NewL( context );
+    // ------------------------------------------------------
+
+    // Tell the protocol it should act normally
+    wrapper->GetMessenger()->SetNoError();
+
+    iCurrentGrId = context->ObjectFactory().NewIdentityLC();
+    CleanupStack::Pop(); // iCurrentGrId
+    iCurrentGrId->SetIdentityL( KGroupId );
+
+    // ------------------------------------------------------
+    // create presentity group
+    //
+    // expect events:
+    // - request complete.
+    // NOTE: no presentitygrouplistevent as we've not subscribed the group lists
+
+    // normal request complete
+    TXIMPRequestId reqIdDummy;  // not checked
+    CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+
+    // identity + displayname
+    CPresentityGroupInfoImp* infoImp = CPresentityGroupInfoImp::NewLC( *iCurrentGrId, KGroupDisplayName );
+    evReqComplete->AppendParamL( infoImp );
+    CleanupStack::Pop( infoImp );
+
+    iListener2->ExpectL( evReqComplete );
+    CleanupStack::Pop( evReqComplete );
+
+    TXIMPRequestId reqId = presGroup.CreatePresentityGroupL( *iCurrentGrId, KGroupDisplayName );
+
+    // and wait
+    EUNIT_ASSERT_DESC( KErrNone == iListener2->WaitAndAssertL(), "CreatePresentityGroupL failed" );
+    messenger->AssertCreatePresentityGroupCalled( ETrue );
+
+    if ( ! iSkipSubscribe )
+        {
+        // ------------------------------------------------------
+        // subscribe presentity group CONTENT
+        //
+        // expect events:
+        // - request complete
+        evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+        iListener2->ExpectL( evReqComplete );
+        CleanupStack::Pop( evReqComplete );
+
+        // do the call
+        reqId = presGroup.SubscribePresentityGroupContentL( *iCurrentGrId );
+
+        // and wait
+        EUNIT_ASSERT_DESC( KErrNone == iListener2->WaitAndAssertL(), "SubscribePresentityGroupContentL failed" );
+
+        // verify that subscribe was called
+        messenger->AssertSubscribePresentityGroupContentCalled( ETrue );
+        }
+
+    // ------------------------------------------------------
+    // do the actual test. this is a function pointer because the
+    // "red tape" of each test is similar (create group, subscribe content, do
+    // actual test, unsubscribe content, delete group) - this is the variable
+    // part, the "do actual test".
+    (this->*aCbFuncL)();
+
+    if ( ! iSkipUnsubscribe )
+        {
+        // ------------------------------------------------------
+        // unsubscribe presentity group content
+        //
+        // expect events:
+        // - request complete
+        // - presentity group content event
+
+        evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+        iListener2->ExpectL( evReqComplete );
+        CleanupStack::Pop( evReqComplete );
+
+        CPresentityGroupContentEventImp* groupCntEvent =
+            XIMPTestEventFactory::CreateGroupContentEventLCX(
+                    KGroupId,
+                    KNullDesC,
+                    KNullDesC,
+                    XIMPTestEventFactory::ETestPGLCntRemoved,
+                    KNullDesC,
+                    KNullDesC,
+                    MXIMPDataSubscriptionState::ESubscriptionInactive,
+                    MXIMPDataSubscriptionState::EDataUnavailable
+                    );
+
+        iListener2->ExpectL( groupCntEvent );
+        CleanupStack::Pop( groupCntEvent ); // 5 more items in cleanupstack
+
+        // do the call
+        reqId = presGroup.UnsubscribePresentityGroupContentL( *iCurrentGrId );
+
+        // and wait
+        EUNIT_ASSERT_DESC( KErrNone == iListener2->WaitAndAssertL(), "UnsubscribePresentityGroupContentL failed" );
+        CleanupStack::PopAndDestroy( 5 ); // lists
+
+        // verify that unsubscribe was called
+        messenger->AssertUnsubscribePresentityGroupContentCalled( ETrue );
+        }
+
+    // ------------------------------------------------------
+    // delete presentity group
+    //
+    // expect events:
+    // - request complete
+    // NO presentity group content event as we've just unsubscribed it.
+
+    evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+    iListener2->ExpectL( evReqComplete );
+    CleanupStack::Pop( evReqComplete );
+
+    // do the call
+    reqId = presGroup.DeletePresentityGroupL( *iCurrentGrId );
+
+    // and wait
+    EUNIT_ASSERT_DESC( KErrNone == iListener2->WaitAndAssertL(), "DeletePresentityGroupL failed" );
+
+    // ------------------------------------------------------
+
+    // make sure the new listener is not listening for events!
+    iListener2->SetEventSourceL( NULL );
+
+    wrapper->UnbindL();
+
+    TeardownTestSupport();
+    }
+
+// ===========================================================================
+// Variant methods, this is where the actual testing happens.
+// Called by the generic subscribe and unsubscribe -method
+// ===========================================================================
+
+// ------------------------------------------------------
+// empty test variant method
+// test only the creation, subscribe and unsubcscribe
+// ------------------------------------------------------
+//
+void T_PresenceGroupMemberManagement::T_EmptyFunc()
+    {
+    // nothing
+    }
+
+// ------------------------------------------------------
+// test adding members
+// ------------------------------------------------------
+//
+void T_PresenceGroupMemberManagement::T_TestAddMembersL()
+    {
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    MXIMPContext* context = wrapper->GetContext();
+    CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+    // Get the interfaces
+    MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+    MPresentityGroups& presGroup = presFeat->PresentityGroups();
+
+    // Tell the protocol it should act normally
+    messenger->SetNoError();
+
+    // ------------------------------------------------------
+    // add presentity group member
+    //
+    // expect events:
+    // - request complete,
+    // - presentitygroupcontentevent
+
+    MXIMPIdentity* member = context->ObjectFactory().NewIdentityLC();
+    member->SetIdentityL( KMemberId );
+
+    // normal request complete
+    TXIMPRequestId reqIdDummy;  // not checked
+    CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+
+    // group id
+    CXIMPIdentityImp* identity = CXIMPIdentityImp::NewLC( iCurrentGrId->Identity() );
+    evReqComplete->AppendParamL( identity );
+    CleanupStack::Pop(); // identity
+
+    // id for member info
+    CXIMPIdentityImp* miId = CXIMPIdentityImp::NewLC( KMemberId );
+    // member info
+    CPresentityGroupMemberInfoImp* memInfoImp =
+        CPresentityGroupMemberInfoImp::NewLC( *miId, KMemberDisplayName );
+    evReqComplete->AppendParamL( memInfoImp );
+    CleanupStack::Pop(); // memInfoImp owned by AppendParamL
+    CleanupStack::PopAndDestroy( miId ); // copy was made
+
+    iListener2->ExpectL( evReqComplete );
+    CleanupStack::Pop( evReqComplete );
+
+    // group content event
+    CPresentityGroupContentEventImp* groupCntEvent =
+        XIMPTestEventFactory::CreateGroupContentEventLCX(
+                iCurrentGrId->Identity(),
+                KMemberId,
+                KMemberDisplayName,
+                XIMPTestEventFactory::ETestPGLCntAdded,
+                KMemberId,
+                KMemberDisplayName,
+                MXIMPDataSubscriptionState::ESubscriptionActive,
+                MXIMPDataSubscriptionState::EDataAvailable
+                );
+
+    iListener2->ExpectL( groupCntEvent );
+    CleanupStack::Pop( groupCntEvent ); // 5 more items in cleanupstack
+
+    // do the call
+    TXIMPRequestId reqId = presGroup.AddPresentityGroupMemberL(
+            *iCurrentGrId, *member, KMemberDisplayName );
+
+    // and wait
+    EUNIT_ASSERT_DESC( KErrNone == iListener2->WaitAndAssertL(), "AddPresentityGroupMemberL failed" );
+    CleanupStack::PopAndDestroy( 5 ); // lists from groupCntEvent
+
+    messenger->AssertAddPresentityGroupMemberCalled( ETrue );
+
+    // ------------------------------------------------------
+    CleanupStack::PopAndDestroy(); // member
+    }
+
+// ------------------------------------------------------
+// test adding members when not subscribed
+// ------------------------------------------------------
+//
+void T_PresenceGroupMemberManagement::T_TestAddMembers_NonSub_L()
+    {
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    MXIMPContext* context = wrapper->GetContext();
+    CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+    // Get the interfaces
+    MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+    MPresentityGroups& presGroup = presFeat->PresentityGroups();
+
+    // Tell the protocol it should act normally
+    messenger->SetNoError();
+
+    // ------------------------------------------------------
+    // add presentity group member
+    //
+    // expect events:
+    // - request complete,
+
+    MXIMPIdentity* member = context->ObjectFactory().NewIdentityLC();
+    member->SetIdentityL( KMemberId );
+
+    // normal request complete
+    TXIMPRequestId reqIdDummy;  // not checked
+    CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+
+    // group id
+    CXIMPIdentityImp* identity = CXIMPIdentityImp::NewLC( iCurrentGrId->Identity() );
+    evReqComplete->AppendParamL( identity );
+    CleanupStack::Pop(); // identity
+
+    // id for member info
+    CXIMPIdentityImp* miId = CXIMPIdentityImp::NewLC( KMemberId );
+    // member info
+    CPresentityGroupMemberInfoImp* memInfoImp =
+        CPresentityGroupMemberInfoImp::NewLC( *miId, KMemberDisplayName );
+    evReqComplete->AppendParamL( memInfoImp );
+    CleanupStack::Pop(); // memInfoImp owned by AppendParamL
+    CleanupStack::PopAndDestroy( miId ); // copy was made
+
+    iListener2->ExpectL( evReqComplete );
+    CleanupStack::Pop( evReqComplete );
+
+    // do the call
+    TXIMPRequestId reqId = presGroup.AddPresentityGroupMemberL(
+            *iCurrentGrId, *member, KMemberDisplayName );
+
+    // and wait
+    EUNIT_ASSERT_DESC( KErrNone == iListener2->WaitAndAssertL(), "AddPresentityGroupMemberL failed" );
+
+    messenger->AssertAddPresentityGroupMemberCalled( ETrue );
+
+    // ------------------------------------------------------
+    CleanupStack::PopAndDestroy(); // member
+    }
+
+// ------------------------------------------------------
+// test removing members
+// ------------------------------------------------------
+//
+void T_PresenceGroupMemberManagement::T_TestRemoveMembersL()
+    {
+    // add a member
+    T_TestAddMembersL();
+
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    MXIMPContext* context = wrapper->GetContext();
+    CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+    // Get the interfaces
+    MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+    MPresentityGroups& presGroup = presFeat->PresentityGroups();
+
+    // Tell the protocol it should act normally
+    messenger->SetNoError();
+
+    // ------------------------------------------------------
+    // remove presentity group member
+    //
+    // expect events:
+    // - request complete,
+    // - presentitygroupcontentevent
+
+    MXIMPIdentity* member = context->ObjectFactory().NewIdentityLC();
+    member->SetIdentityL( KMemberId );
+
+    // normal request complete
+    TXIMPRequestId reqIdDummy;  // not checked
+    CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+    iListener2->ExpectL( evReqComplete );
+    CleanupStack::Pop( evReqComplete );
+
+    // group content event
+    CPresentityGroupContentEventImp* groupCntEvent =
+        XIMPTestEventFactory::CreateGroupContentEventLCX(
+                iCurrentGrId->Identity(),
+                KMemberId,
+                KNullDesC,
+                XIMPTestEventFactory::ETestPGLCntRemoved,
+                KNullDesC,
+                KNullDesC,
+                MXIMPDataSubscriptionState::ESubscriptionActive,
+                MXIMPDataSubscriptionState::EDataAvailable
+                );
+
+    iListener2->ExpectL( groupCntEvent );
+    CleanupStack::Pop( groupCntEvent ); // 5 more items in cleanupstack
+
+    // do the call
+    TXIMPRequestId reqId = presGroup.RemovePresentityGroupMemberL(
+            *iCurrentGrId, *member );
+
+    // and wait
+    EUNIT_ASSERT_DESC( KErrNone == iListener2->WaitAndAssertL(), "RemovePresentityGroupMemberL failed" );
+    CleanupStack::PopAndDestroy( 5 ); // lists from groupCntEvent
+
+    messenger->AssertRemovePresentityGroupMemberCalled( ETrue );
+
+    // ------------------------------------------------------
+    CleanupStack::PopAndDestroy(); //member
+    }
+
+// ------------------------------------------------------
+// test removing members when non-subscribed
+// ------------------------------------------------------
+//
+void T_PresenceGroupMemberManagement::T_TestRemoveMembers_NonSub_L()
+    {
+    // add a member
+    T_TestAddMembers_NonSub_L();
+
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    MXIMPContext* context = wrapper->GetContext();
+    CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+    // Get the interfaces
+    MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+    MPresentityGroups& presGroup = presFeat->PresentityGroups();
+
+    // Tell the protocol it should act normally
+    messenger->SetNoError();
+
+    // ------------------------------------------------------
+    // remove presentity group member
+    //
+    // expect events:
+    // - request complete,
+    // - presentitygroupcontentevent
+
+    MXIMPIdentity* member = context->ObjectFactory().NewIdentityLC();
+    member->SetIdentityL( KMemberId );
+
+    // normal request complete
+    TXIMPRequestId reqIdDummy;  // not checked
+    CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+    iListener2->ExpectL( evReqComplete );
+    CleanupStack::Pop( evReqComplete );
+
+    // do the call
+    TXIMPRequestId reqId = presGroup.RemovePresentityGroupMemberL(
+            *iCurrentGrId, *member );
+
+    // and wait
+    EUNIT_ASSERT_DESC( KErrNone == iListener2->WaitAndAssertL(), "RemovePresentityGroupMemberL failed" );
+
+    messenger->AssertRemovePresentityGroupMemberCalled( ETrue );
+
+    // ------------------------------------------------------
+    CleanupStack::PopAndDestroy(); //member
+    }
+
+// test removing nonexisting members
+void T_PresenceGroupMemberManagement::T_TestRemoveMembers_NonExisting_L()
+    {
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    MXIMPContext* context = wrapper->GetContext();
+    CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+    // Get the interfaces
+    MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+    MPresentityGroups& presGroup = presFeat->PresentityGroups();
+
+    // Tell the protocol it should act normally
+    messenger->SetNoError();
+
+    // ------------------------------------------------------
+    // remove presentity group member
+    //
+    // expect events:
+    // - request complete,
+
+    MXIMPIdentity* member = context->ObjectFactory().NewIdentityLC();
+    member->SetIdentityL( KMemberId );
+
+    // normal request complete
+    TXIMPRequestId reqIdDummy;  // not checked
+    CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+    iListener2->ExpectL( evReqComplete );
+    CleanupStack::Pop( evReqComplete );
+
+    // do the call
+    TXIMPRequestId reqId = presGroup.RemovePresentityGroupMemberL(
+            *iCurrentGrId, *member );
+
+    // and wait
+    EUNIT_ASSERT_DESC( KErrNone == iListener2->WaitAndAssertL(), "RemovePresentityGroupMemberL failed" );
+
+    messenger->AssertRemovePresentityGroupMemberCalled( ETrue );
+
+    // ------------------------------------------------------
+    CleanupStack::PopAndDestroy(); //member
+    }
+
+// ------------------------------------------------------
+// test updating members
+// ------------------------------------------------------
+//
+void T_PresenceGroupMemberManagement::T_TestUpdateMembers_L()
+    {
+    // add a member
+    T_TestAddMembersL();
+
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    MXIMPContext* context = wrapper->GetContext();
+    CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+    // Get the interfaces
+    MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+    MPresentityGroups& presGroup = presFeat->PresentityGroups();
+
+    // Tell the protocol it should act normally
+    messenger->SetNoError();
+
+    // ------------------------------------------------------
+    // update presentity group member
+    //
+    // expect events:
+    // - request complete,
+    // - presentitygroupcontentevent
+
+    MXIMPIdentity* member = context->ObjectFactory().NewIdentityLC();
+    member->SetIdentityL( KMemberId );
+
+    // group content request complete
+    TXIMPRequestId reqIdDummy;  // not checked
+    CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+    CXIMPIdentityImp* identity = CXIMPIdentityImp::NewLC( iCurrentGrId->Identity() );
+    evReqComplete->AppendParamL( identity );
+    CleanupStack::Pop( identity );
+
+    CPresentityGroupMemberInfoImp* mbrInfo = CPresentityGroupMemberInfoImp::NewLC( *member, KMemberDisplayName2 );
+    evReqComplete->AppendParamL( mbrInfo );
+    CleanupStack::Pop( mbrInfo );
+
+    iListener2->ExpectL( evReqComplete );
+    CleanupStack::Pop( evReqComplete );
+
+    // group content event
+    CPresentityGroupContentEventImp* groupCntEvent =
+        XIMPTestEventFactory::CreateGroupContentEventLCX(
+                iCurrentGrId->Identity(),
+                KMemberId,
+                KMemberDisplayName2,
+                XIMPTestEventFactory::ETestPGLCntUpdated,
+                KMemberId,
+                KMemberDisplayName2,
+                MXIMPDataSubscriptionState::ESubscriptionActive,
+                MXIMPDataSubscriptionState::EDataAvailable
+                );
+
+    iListener2->ExpectL( groupCntEvent );
+    CleanupStack::Pop( groupCntEvent ); // 5 more items in cleanupstack
+
+    // do the call
+    TXIMPRequestId reqId = presGroup.UpdatePresentityGroupMemberDisplayNameL(
+            *iCurrentGrId, *member, KMemberDisplayName2 );
+
+    // and wait
+    EUNIT_ASSERT_DESC( KErrNone == iListener2->WaitAndAssertL(), "UpdatePresentityGroupMemberDisplayNameL failed" );
+    CleanupStack::PopAndDestroy( 5 ); // lists from groupCntEvent
+
+    messenger->AssertUpdatePresentityGroupMemberDisplayNameCalled( ETrue );
+
+    // ------------------------------------------------------
+    CleanupStack::PopAndDestroy();
+    }
+
+// ------------------------------------------------------
+// test updating members (nonsubscribed)
+// ------------------------------------------------------
+//
+void T_PresenceGroupMemberManagement::T_TestUpdateMembers_NonSub_L()
+    {
+    // add a member
+    T_TestAddMembers_NonSub_L();
+
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    MXIMPContext* context = wrapper->GetContext();
+    CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+    // Get the interfaces
+    MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+    MPresentityGroups& presGroup = presFeat->PresentityGroups();
+
+    // Tell the protocol it should act normally
+    messenger->SetNoError();
+
+    // ------------------------------------------------------
+    // update presentity group member
+    //
+    // expect events:
+    // - request complete,
+
+    MXIMPIdentity* member = context->ObjectFactory().NewIdentityLC();
+    member->SetIdentityL( KMemberId );
+
+    // group content request complete
+    TXIMPRequestId reqIdDummy;  // not checked
+    CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+    CXIMPIdentityImp* identity = CXIMPIdentityImp::NewLC( iCurrentGrId->Identity() );
+    evReqComplete->AppendParamL( identity );
+    CleanupStack::Pop( identity );
+
+    CPresentityGroupMemberInfoImp* mbrInfo = CPresentityGroupMemberInfoImp::NewLC( *member, KMemberDisplayName2 );
+    evReqComplete->AppendParamL( mbrInfo );
+    CleanupStack::Pop( mbrInfo );
+
+    iListener2->ExpectL( evReqComplete );
+    CleanupStack::Pop( evReqComplete );
+
+    // do the call
+    TXIMPRequestId reqId = presGroup.UpdatePresentityGroupMemberDisplayNameL(
+            *iCurrentGrId, *member, KMemberDisplayName2 );
+
+    // and wait
+    EUNIT_ASSERT_DESC( KErrNone == iListener2->WaitAndAssertL(), "UpdatePresentityGroupMemberDisplayNameL failed" );
+
+    messenger->AssertUpdatePresentityGroupMemberDisplayNameCalled( ETrue );
+
+    // ------------------------------------------------------
+    CleanupStack::PopAndDestroy();
+    }
+
+// ------------------------------------------------------
+// test updating members with non-existing id
+// ------------------------------------------------------
+//
+void T_PresenceGroupMemberManagement::T_TestUpdateMembers_NonExisting_L()
+    {
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    MXIMPContext* context = wrapper->GetContext();
+    CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+    // Get the interfaces
+    MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+    MPresentityGroups& presGroup = presFeat->PresentityGroups();
+    
+    // Tell the protocol it should act normally
+    messenger->SetNoError();
+
+    // ------------------------------------------------------
+    // update presentity group member
+    //
+    // expect events:
+    // - request complete,
+
+    MXIMPIdentity* member = context->ObjectFactory().NewIdentityLC();
+    member->SetIdentityL( KMemberId );
+
+    // group content request complete
+    TXIMPRequestId reqIdDummy;  // not checked
+    CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+    CXIMPIdentityImp* identity = CXIMPIdentityImp::NewLC( iCurrentGrId->Identity() );
+    evReqComplete->AppendParamL( identity );
+    CleanupStack::Pop( identity );
+
+    CPresentityGroupMemberInfoImp* mbrInfo = CPresentityGroupMemberInfoImp::NewLC( *member, KMemberDisplayName2 );
+    evReqComplete->AppendParamL( mbrInfo );
+    CleanupStack::Pop( mbrInfo );
+
+    iListener2->ExpectL( evReqComplete );
+    CleanupStack::Pop( evReqComplete );
+
+    // do the call
+    TXIMPRequestId reqId = presGroup.UpdatePresentityGroupMemberDisplayNameL(
+            *iCurrentGrId, *member, KMemberDisplayName2 );
+
+    // and wait
+    EUNIT_ASSERT_DESC( KErrNone == iListener2->WaitAndAssertL(), "UpdatePresentityGroupMemberDisplayNameL failed" );
+
+    messenger->AssertUpdatePresentityGroupMemberDisplayNameCalled( ETrue );
+
+    // ------------------------------------------------------
+    CleanupStack::PopAndDestroy();
+    }
+
+// ===========================================================================
+// Test case methods
+// ===========================================================================
+
+// Subscribe and unsubscribe test
+void T_PresenceGroupMemberManagement::T_SubUnsubGroupContent_Single_L()
+    {
+    EUNIT_PRINT( _L("Single presentity group content sub and unsub") );
+
+    TXIMPCallBack callback = &T_PresenceGroupMemberManagement::T_EmptyFunc;
+    T_GenericSubAndUnsubL( callback );
+    }
+
+// subscribe and unsubscribe, altered id
+void T_PresenceGroupMemberManagement::T_SubUnsubGroupContent_Altered_Single_L()
+    {
+    EUNIT_PRINT( _L("Single presentity group content sub and unsub with altered id") );
+
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    wrapper->BindL( 0 );
+
+    // ------------------------------------------------------
+    // some startup stuff
+    MXIMPContext* context = wrapper->GetContext();
+    CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+    // Get the interfaces
+    MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+    MPresentityGroups& presGroup = presFeat->PresentityGroups();
+
+    iListener2 = CXIMPTestListener::NewL( context );
+    // ------------------------------------------------------
+
+    // Tell the protocol it should act normally
+    wrapper->GetMessenger()->SetNoError();
+
+    iCurrentGrId = context->ObjectFactory().NewIdentityLC();
+    CleanupStack::Pop(); // iCurrentGrId
+    iCurrentGrId->SetIdentityL( KGroupId );
+
+    // ------------------------------------------------------
+    // create presentity group
+    //
+    // expect events:
+    // - request complete.
+    // NOTE: no presentitygrouplistevent as we've not subscribed the group lists
+
+    // normal request complete
+    TXIMPRequestId reqIdDummy;  // not checked
+    CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+
+    // identity + displayname
+    CPresentityGroupInfoImp* infoImp = CPresentityGroupInfoImp::NewLC( *iCurrentGrId, KGroupDisplayName );
+    evReqComplete->AppendParamL( infoImp );
+    CleanupStack::Pop( infoImp );
+
+    iListener2->ExpectL( evReqComplete );
+    CleanupStack::Pop( evReqComplete );
+
+    TXIMPRequestId reqId = presGroup.CreatePresentityGroupL( *iCurrentGrId, KGroupDisplayName );
+
+    // and wait
+    EUNIT_ASSERT_DESC( KErrNone == iListener2->WaitAndAssertL(), "CreatePresentityGroupL failed" );
+    messenger->AssertCreatePresentityGroupCalled( ETrue );
+
+    // ------------------------------------------------------
+    // subscribe presentity group CONTENT
+    //
+    // expect events:
+    // - request complete
+    evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+    iListener2->ExpectL( evReqComplete );
+    CleanupStack::Pop( evReqComplete );
+
+    // tell the test protocol to send back an altered id
+    MXIMPIdentity* identityParam = context->ObjectFactory().NewIdentityLC();
+    identityParam->SetIdentityL( KGroupId2 );
+
+    CXIMPIdentityImp* identityParamImp =
+             ( CXIMPIdentityImp* ) identityParam->GetInterface(
+                                        CXIMPIdentityImp::KClassId,
+                                        MXIMPBase::EPanicIfUnknown );
+    HBufC8* packedId = TXIMPObjectPacker< CXIMPIdentityImp >::PackL( *identityParamImp );
+    CleanupStack::PopAndDestroy(); // identityParam
+    CleanupStack::PushL( packedId );
+    CXIMPTestFileSrvMsg* srvMsg = CXIMPTestFileSrvMsg::NewL( CXIMPTestFileSrvMsg::ETestSrvMsgReqParamIdentity,
+                                                             *packedId );
+    CleanupStack::PopAndDestroy( packedId );
+    CleanupStack::PushL( srvMsg );
+    wrapper->FileTool().SrvMsgStoreL( srvMsg );
+    CleanupStack::PopAndDestroy( srvMsg );
+
+    // Wait for server to handle srvmsg.
+    User::After( 2 );
+    // now the adaptation should know how to answer
+
+    // do the call
+    reqId = presGroup.SubscribePresentityGroupContentL( *iCurrentGrId );
+
+    // and wait
+    EUNIT_ASSERT_DESC( KErrNone == iListener2->WaitAndAssertL(), "SubscribePresentityGroupContentL failed" );
+
+    // verify that subscribe was called
+    messenger->AssertSubscribePresentityGroupContentCalled( ETrue );
+
+    // ------------------------------------------------------
+
+    // make sure the new listener is not listening for events!
+    iListener2->SetEventSourceL( NULL );
+
+    wrapper->UnbindL();
+
+    TeardownTestSupport();
+    }
+
+// subscribe and unsubscribe, altered id is the same
+void T_PresenceGroupMemberManagement::T_SubUnsubGroupContent_AlteredSame_Single_L()
+    {
+    EUNIT_PRINT( _L("Single presentity group content sub and unsub with altered but same id") );
+
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    wrapper->BindL( 0 );
+
+    // ------------------------------------------------------
+    // some startup stuff
+    MXIMPContext* context = wrapper->GetContext();
+    CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+    // Get the interfaces
+    MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+    MPresentityGroups& presGroup = presFeat->PresentityGroups();
+
+    iListener2 = CXIMPTestListener::NewL( context );
+    // ------------------------------------------------------
+
+    // Tell the protocol it should act normally
+    wrapper->GetMessenger()->SetNoError();
+
+    iCurrentGrId = context->ObjectFactory().NewIdentityLC();
+    CleanupStack::Pop(); // iCurrentGrId
+    iCurrentGrId->SetIdentityL( KGroupId );
+
+    // ------------------------------------------------------
+    // create presentity group
+    //
+    // expect events:
+    // - request complete.
+    // NOTE: no presentitygrouplistevent as we've not subscribed the group lists
+
+    // normal request complete
+    TXIMPRequestId reqIdDummy;  // not checked
+    CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+
+    // identity + displayname
+    CPresentityGroupInfoImp* infoImp = CPresentityGroupInfoImp::NewLC( *iCurrentGrId, KGroupDisplayName );
+    evReqComplete->AppendParamL( infoImp );
+    CleanupStack::Pop( infoImp );
+
+    iListener2->ExpectL( evReqComplete );
+    CleanupStack::Pop( evReqComplete );
+
+    TXIMPRequestId reqId = presGroup.CreatePresentityGroupL( *iCurrentGrId, KGroupDisplayName );
+
+    // and wait
+    EUNIT_ASSERT_DESC( KErrNone == iListener2->WaitAndAssertL(), "CreatePresentityGroupL failed" );
+    messenger->AssertCreatePresentityGroupCalled( ETrue );
+
+    // ------------------------------------------------------
+    // subscribe presentity group CONTENT
+    //
+    // expect events:
+    // - request complete
+    evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+    iListener2->ExpectL( evReqComplete );
+    CleanupStack::Pop( evReqComplete );
+
+    // tell the test protocol to send back an altered id
+    MXIMPIdentity* identityParam = context->ObjectFactory().NewIdentityLC();
+    identityParam->SetIdentityL( KGroupId );
+
+    CXIMPIdentityImp* identityParamImp =
+             ( CXIMPIdentityImp* ) identityParam->GetInterface(
+                                        CXIMPIdentityImp::KClassId,
+                                        MXIMPBase::EPanicIfUnknown );
+    HBufC8* packedId = TXIMPObjectPacker< CXIMPIdentityImp >::PackL( *identityParamImp );
+    CleanupStack::PopAndDestroy(); // identityParam
+    CleanupStack::PushL( packedId );
+    CXIMPTestFileSrvMsg* srvMsg = CXIMPTestFileSrvMsg::NewL( CXIMPTestFileSrvMsg::ETestSrvMsgReqParamIdentity,
+                                                             *packedId );
+    CleanupStack::PopAndDestroy( packedId );
+    CleanupStack::PushL( srvMsg );
+    wrapper->FileTool().SrvMsgStoreL( srvMsg );
+    CleanupStack::PopAndDestroy( srvMsg );
+
+    // Wait for server to handle srvmsg.
+    User::After( 2 );
+    // now the adaptation should know how to answer
+
+    // do the call
+    reqId = presGroup.SubscribePresentityGroupContentL( *iCurrentGrId );
+
+    // and wait
+    EUNIT_ASSERT_DESC( KErrNone == iListener2->WaitAndAssertL(), "SubscribePresentityGroupContentL failed" );
+
+    // verify that subscribe was called
+    messenger->AssertSubscribePresentityGroupContentCalled( ETrue );
+
+    // ------------------------------------------------------
+
+    // make sure the new listener is not listening for events!
+    iListener2->SetEventSourceL( NULL );
+
+    wrapper->UnbindL();
+
+    TeardownTestSupport();
+    }
+
+
+// Add members
+void T_PresenceGroupMemberManagement::T_AddGroupMembers_Single_L()
+    {
+    EUNIT_PRINT( _L("Single add members to group") );
+
+    TXIMPCallBack callback = &T_PresenceGroupMemberManagement::T_TestAddMembersL;
+    T_GenericSubAndUnsubL( callback );
+    }
+
+// Remove members
+void T_PresenceGroupMemberManagement::T_RemoveGroupMembers_Single_L()
+    {
+    EUNIT_PRINT( _L("Single remove member of group") );
+
+    TXIMPCallBack callback = &T_PresenceGroupMemberManagement::T_TestRemoveMembersL;
+    T_GenericSubAndUnsubL( callback );
+    }
+
+// Update members
+void T_PresenceGroupMemberManagement::T_UpdateGroupMembers_Single_L()
+    {
+    EUNIT_PRINT( _L("Single update member of group") );
+
+    TXIMPCallBack callback = &T_PresenceGroupMemberManagement::T_TestUpdateMembers_L;
+    T_GenericSubAndUnsubL( callback );
+    }
+
+// Update members without subscription
+void T_PresenceGroupMemberManagement::T_UpdateGroupMembers_NonSub_Single_L()
+    {
+    EUNIT_PRINT( _L("Single update member of group, unsubscribed") );
+
+    TXIMPCallBack callback = &T_PresenceGroupMemberManagement::T_TestUpdateMembers_NonSub_L;
+    iSkipSubscribe = ETrue;
+    iSkipUnsubscribe = ETrue;
+    T_GenericSubAndUnsubL( callback );
+    }
+
+// Update members with non-existing member
+void T_PresenceGroupMemberManagement::T_UpdateGroupMembers_NonExist_Single_L()
+    {
+    EUNIT_PRINT( _L("Single update nonexisting member of group") );
+
+    TXIMPCallBack callback = &T_PresenceGroupMemberManagement::T_TestUpdateMembers_NonExisting_L;
+    T_GenericSubAndUnsubL( callback );
+    }
+
+// Remove members without subscription
+void T_PresenceGroupMemberManagement::T_RemoveGroupMembers_NonSub_Single_L()
+    {
+    EUNIT_PRINT( _L("Single remove member of group, unsubscribed") );
+
+    TXIMPCallBack callback = &T_PresenceGroupMemberManagement::T_TestRemoveMembers_NonSub_L;
+    iSkipSubscribe = ETrue;
+    iSkipUnsubscribe = ETrue;
+    T_GenericSubAndUnsubL( callback );
+    }
+
+// Remove members with non-existing member
+void T_PresenceGroupMemberManagement::T_RemoveGroupMembers_NonExist_Single_L()
+    {
+    EUNIT_PRINT( _L("Single remove nonexisting member of group") );
+
+    TXIMPCallBack callback = &T_PresenceGroupMemberManagement::T_TestRemoveMembers_NonExisting_L;
+    T_GenericSubAndUnsubL( callback );
+    }
+
+// ------------------------------------------------------
+// expire non-subscribed data
+// ------------------------------------------------------
+//
+void T_PresenceGroupMemberManagement::T_ExpireNonSubscribedData_L()
+    {
+    EUNIT_PRINT( _L("Expire non subscribed data") );
+
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    wrapper->BindL( 0 );
+
+    MXIMPContext* context = wrapper->GetContext();
+    CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+    // Get the interfaces
+    MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+    MPresentityGroups& presGroup = presFeat->PresentityGroups();
+
+    iCurrentGrId = context->ObjectFactory().NewIdentityLC();
+    CleanupStack::Pop(); // iCurrentGrId
+    iCurrentGrId->SetIdentityL( KGroupId );
+
+    // Tell the protocol it should act normally
+    messenger->SetNoError();
+
+    // 1. Create notification
+    RXIMPObjOwningPtrArray<CPresentityGroupMemberInfoImp> groupMemberList;
+    CXIMPIdentityImp* identityImp =
+             ( CXIMPIdentityImp* ) iCurrentGrId->GetInterface(
+                                        CXIMPIdentityImp::KClassId,
+                                        MXIMPBase::EPanicIfUnknown );
+    HBufC8* packedId = TXIMPObjectPacker< CXIMPIdentityImp >::PackL( *identityImp );
+    CleanupStack::PushL( packedId );
+    HBufC8* packedArray = TXIMPObjectPacker<CPresentityGroupMemberInfoImp>::PackArrayL( groupMemberList );
+    CleanupStack::PushL( packedArray );
+    RPointerArray< HBufC8 > bufferArray;
+    CleanupClosePushL( bufferArray );
+    bufferArray.AppendL( packedId );
+    bufferArray.AppendL( packedArray );
+    HBufC8* packedBufferArray = TXIMPHBuf8Packer::PackArrayL( bufferArray );
+    CleanupStack::PopAndDestroy( 2, packedArray ); // bufferArray, packedArray
+    CleanupStack::PushL( packedBufferArray );
+
+    // 2. Use filetool to send it for plugin.
+    CXIMPTestFileSrvMsg* srvMsg = CXIMPTestFileSrvMsg::NewL( CXIMPTestFileSrvMsg::ETestSrvMsgPresentityGroupMemberList,
+                                                             *packedBufferArray );
+    CleanupStack::PopAndDestroy( packedBufferArray );
+    CleanupStack::PushL( srvMsg );
+    wrapper->FileTool().CleanAllL();
+    wrapper->FileTool().SrvMsgStoreL( srvMsg );
+    CleanupStack::PopAndDestroy( srvMsg );
+
+    // Wait for server to handle srvmsg.
+    CXIMPTestWaitHelper* wait = CXIMPTestWaitHelper::NewL();
+    CleanupStack::PushL( wait );
+    wait->WaitForL( 2 );
+
+    // 3. Create and send check notification to server
+    srvMsg = CXIMPTestFileSrvMsg::NewL( CXIMPTestFileSrvMsg::ETestCheckIfGroupMemberExists,
+                                                             *packedId );
+    CleanupStack::PushL( srvMsg );
+    wrapper->FileTool().SrvMsgStoreL( srvMsg );
+
+    // Wait for server to handle srvmsg.
+    wait->WaitForL( 2 );
+
+    TInt value = messenger->GetValueFor( EXIMPPlgTestExistsGroupContentInCache );
+    EUNIT_ASSERT_DESC( value == 1, "Data not cached temporarly" );
+
+   // 4. Wait for cache to clear.
+    wait->WaitForL( 15 );
+
+    // 5. Send check notification to server
+    wrapper->FileTool().SrvMsgStoreL( srvMsg );
+    CleanupStack::PopAndDestroy( srvMsg );
+
+    // Wait for server to handle srvmsg.
+    wait->WaitForL( 2 );
+    CleanupStack::PopAndDestroy( wait );
+    CleanupStack::PopAndDestroy( packedId );
+    value = messenger->GetValueFor( EXIMPPlgTestExistsGroupContentInCache );
+    EUNIT_ASSERT_DESC( value == KErrNotFound, "Data not cleared like it should" );
+    wrapper->UnbindL();
+    }
+
+// ------------------------------------------------------
+// expire non-subscribed data, update multiple
+// ------------------------------------------------------
+//
+void T_PresenceGroupMemberManagement::T_ExpireNonSubscribedDataUpdateMultiple_L()
+    {
+    EUNIT_PRINT( _L("Expire non subscribed data, update multiple") );
+
+    // Wait for server to handle srvmsg.
+    CXIMPTestWaitHelper* wait = CXIMPTestWaitHelper::NewL();
+    CleanupStack::PushL( wait );
+
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    wrapper->BindL( 0 );
+
+    MXIMPContext* context = wrapper->GetContext();
+    CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+    // Get the interfaces
+    MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+    MPresentityGroups& presGroup = presFeat->PresentityGroups();
+
+    iCurrentGrId = context->ObjectFactory().NewIdentityLC();
+    CleanupStack::Pop(); // iCurrentGrId
+    iCurrentGrId->SetIdentityL( KGroupId );
+
+    // Tell the protocol it should act normally
+    messenger->SetNoError();
+
+    // 1. Create notification
+    RXIMPObjOwningPtrArray<CPresentityGroupMemberInfoImp> groupMemberList;
+    CXIMPIdentityImp* identityImp =
+             ( CXIMPIdentityImp* ) iCurrentGrId->GetInterface(
+                                        CXIMPIdentityImp::KClassId,
+                                        MXIMPBase::EPanicIfUnknown );
+    HBufC8* packedId = TXIMPObjectPacker< CXIMPIdentityImp >::PackL( *identityImp );
+    CleanupStack::PushL( packedId );
+    HBufC8* packedArray = TXIMPObjectPacker<CPresentityGroupMemberInfoImp>::PackArrayL( groupMemberList );
+    CleanupStack::PushL( packedArray );
+    RPointerArray< HBufC8 > bufferArray;
+    CleanupClosePushL( bufferArray );
+    bufferArray.AppendL( packedId );
+    bufferArray.AppendL( packedArray );
+    HBufC8* packedBufferArray = TXIMPHBuf8Packer::PackArrayL( bufferArray );
+    CleanupStack::PopAndDestroy( 2, packedArray ); // bufferArray, packedArray
+    CleanupStack::PushL( packedBufferArray );
+
+    // 2. Use filetool to send it for plugin.
+    CXIMPTestFileSrvMsg* srvMsg = CXIMPTestFileSrvMsg::NewL( CXIMPTestFileSrvMsg::ETestSrvMsgPresentityGroupMemberList,
+                                                             *packedBufferArray );
+    CleanupStack::PopAndDestroy( packedBufferArray );
+    CleanupStack::PushL( srvMsg );
+    wrapper->FileTool().CleanAllL();
+    wrapper->FileTool().SrvMsgStoreL( srvMsg );
+
+    wait->WaitForL( 2 );
+
+    // 3. Create and send check notification to server
+    CXIMPTestFileSrvMsg* srvMsg2 = CXIMPTestFileSrvMsg::NewL( CXIMPTestFileSrvMsg::ETestCheckIfGroupMemberExists,
+                                                             *packedId );
+    CleanupStack::PushL( srvMsg2 );
+    wrapper->FileTool().SrvMsgStoreL( srvMsg2 );
+
+    // Wait for server to handle srvmsg.
+    wait->WaitForL( 2 );
+
+    TInt value = messenger->GetValueFor( EXIMPPlgTestExistsGroupContentInCache );
+    EUNIT_ASSERT_DESC( value == 1, "Data not cached temporarly" );
+
+   // 4. Wait for cache to clear.
+    wait->WaitForL( 5 );
+
+    // Refresh temporar cache.
+    wrapper->FileTool().SrvMsgStoreL( srvMsg );
+
+   // 4. Wait for cache to clear.
+    wait->WaitForL( 10 );
+
+    // 5. Send check notification to server
+    wrapper->FileTool().SrvMsgStoreL( srvMsg2 );
+    CleanupStack::PopAndDestroy( 3, packedId ); //packedId, srvMsg, srvMsg2
+
+    // Wait for server to handle srvmsg.
+    wait->WaitForL( 2 );
+    value = messenger->GetValueFor( EXIMPPlgTestExistsGroupContentInCache );
+    EUNIT_ASSERT_DESC( value == 1, "Data not cached temporarly, but it should be" );
+
+    wrapper->UnbindL();
+
+    CleanupStack::PopAndDestroy( wait );
+    }
+
+// ------------------------------------------------------
+// General subscribe and unsubscribe for multiple
+// ------------------------------------------------------
+//
+void T_PresenceGroupMemberManagement::T_SubUnsubGroupContent_Multi_L()
+    {
+    BindAllL();
+
+    TInt countOfWrappers = iWrapperMgr->WrapperCount();
+
+    CXIMPObjectFactoryImp* factory = CXIMPObjectFactoryImp::NewL();
+    CleanupStack::PushL( factory );
+
+    MXIMPIdentity* currentGrId = factory->NewIdentityLC();
+    currentGrId->SetIdentityL( KGroupId );
+
+    // create group to all connections
+    for ( TInt i = 0; i < countOfWrappers; i++ )
+        {
+        CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( i );
+
+        // ------------------------------------------------------
+        // some startup stuff
+        MXIMPContext* context = wrapper->GetContext();
+        CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+        // Get the interfaces
+        MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+        MPresentityGroups& presGroup = presFeat->PresentityGroups();
+
+        CXIMPTestListener* listener = CXIMPTestListener::NewL( context );
+        CleanupStack::PushL( listener );
+        // ------------------------------------------------------
+
+        // Tell the protocol it should act normally
+        wrapper->GetMessenger()->SetNoError();
+
+        // ------------------------------------------------------
+        // create presentity group
+        //
+        // expect events:
+        // - request complete.
+        // NOTE: no presentitygrouplistevent as we've not subscribed the group lists
+
+        // normal request complete
+        TXIMPRequestId reqIdDummy;  // not checked
+        CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+
+        // identity + displayname
+        CPresentityGroupInfoImp* infoImp = CPresentityGroupInfoImp::NewLC( *currentGrId, KGroupDisplayName );
+        evReqComplete->AppendParamL( infoImp );
+        CleanupStack::Pop( infoImp );
+
+        listener->ExpectL( evReqComplete );
+        CleanupStack::Pop( evReqComplete );
+
+        TXIMPRequestId reqId = presGroup.CreatePresentityGroupL( *currentGrId, KGroupDisplayName );
+
+        // and wait
+        EUNIT_ASSERT_DESC( KErrNone == listener->WaitAndAssertL(), "CreatePresentityGroupL failed" );
+
+        // verify that create was called
+        messenger->AssertCreatePresentityGroupCalled( ETrue );
+
+        CleanupStack::PopAndDestroy( listener );
+        }
+
+    // subscribe presentity group content in all connections
+    for ( TInt i = 0; i < countOfWrappers; i++ )
+        {
+        CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( i );
+
+        // ------------------------------------------------------
+        // some startup stuff
+        MXIMPContext* context = wrapper->GetContext();
+        CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+        // Get the interfaces
+        MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+        MPresentityGroups& presGroup = presFeat->PresentityGroups();
+
+        CXIMPTestListener* listener = CXIMPTestListener::NewL( context );
+        CleanupStack::PushL( listener );
+        // ------------------------------------------------------
+
+        // ------------------------------------------------------
+        // subscribe presentity group CONTENT
+        //
+        // expect events:
+        // - request complete
+        TXIMPRequestId reqIdDummy;  // not checked
+        CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+        listener->ExpectL( evReqComplete );
+        CleanupStack::Pop( evReqComplete );
+
+        // do the call
+        TXIMPRequestId reqId = presGroup.SubscribePresentityGroupContentL( *currentGrId );
+
+        // and wait
+        EUNIT_ASSERT_DESC( KErrNone == listener->WaitAndAssertL(), "SubscribePresentityGroupContentL failed" );
+
+        // verify that subscribe was called
+        messenger->AssertSubscribePresentityGroupContentCalled( ETrue );
+
+        CleanupStack::PopAndDestroy( listener );
+        }
+
+    // unsubscribe presentity group content in all connections
+    for ( TInt i = 0; i < countOfWrappers; i++ )
+        {
+        CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( i );
+
+        // ------------------------------------------------------
+        // some startup stuff
+        MXIMPContext* context = wrapper->GetContext();
+        CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+        // Get the interfaces
+        MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+        MPresentityGroups& presGroup = presFeat->PresentityGroups();
+
+        CXIMPTestListener* listener = CXIMPTestListener::NewL( context );
+        CleanupStack::PushL( listener );
+        // ------------------------------------------------------
+
+        // ------------------------------------------------------
+        // unsubscribe presentity group content
+        //
+        // expect events:
+        // - request complete
+        // - presentity group content event
+
+        TXIMPRequestId reqIdDummy;  // not checked
+        CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+        listener->ExpectL( evReqComplete );
+        CleanupStack::Pop( evReqComplete );
+
+        CPresentityGroupContentEventImp* groupCntEvent =
+            XIMPTestEventFactory::CreateGroupContentEventLCX(
+                    KGroupId,
+                    KNullDesC,
+                    KNullDesC,
+                    XIMPTestEventFactory::ETestPGLCntRemoved,
+                    KNullDesC,
+                    KNullDesC,
+                    MXIMPDataSubscriptionState::ESubscriptionInactive,
+                    MXIMPDataSubscriptionState::EDataUnavailable
+                    );
+
+        listener->ExpectL( groupCntEvent );
+        CleanupStack::Pop( groupCntEvent ); // 5 more items in cleanupstack
+
+        // do the call
+        TXIMPRequestId reqId = presGroup.UnsubscribePresentityGroupContentL( *currentGrId );
+
+        // and wait
+        EUNIT_ASSERT_DESC( KErrNone == listener->WaitAndAssertL(), "UnsubscribePresentityGroupContentL failed" );
+        CleanupStack::PopAndDestroy( 5 ); // lists
+
+        // verify that unsubscribe was called
+        // unsubscribe really called only on the last one
+        messenger->AssertUnsubscribePresentityGroupContentCalled( i == countOfWrappers-1 ? ETrue : EFalse );
+
+        CleanupStack::PopAndDestroy( listener );
+        }
+
+    // delete presentity group in all connections
+    for ( TInt i = 0; i < countOfWrappers; i++ )
+        {
+        CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( i );
+
+        // ------------------------------------------------------
+        // some startup stuff
+        MXIMPContext* context = wrapper->GetContext();
+        CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+        // Get the interfaces
+        MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+        MPresentityGroups& presGroup = presFeat->PresentityGroups();
+
+        CXIMPTestListener* listener = CXIMPTestListener::NewL( context );
+        CleanupStack::PushL( listener );
+        // ------------------------------------------------------
+
+        // ------------------------------------------------------
+        // delete presentity group
+        //
+        // expect events:
+        // - request complete
+        // NO presentity group content event as we've just unsubscribed it.
+
+        TXIMPRequestId reqIdDummy;  // not checked
+        CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+        listener->ExpectL( evReqComplete );
+        CleanupStack::Pop( evReqComplete );
+
+        // do the call
+        TXIMPRequestId reqId = presGroup.DeletePresentityGroupL( *currentGrId );
+
+        // and wait
+        EUNIT_ASSERT_DESC( KErrNone == listener->WaitAndAssertL(), "DeletePresentityGroupL failed" );
+
+        CleanupStack::PopAndDestroy( listener );
+        }
+
+    // ------------------------------------------------------
+
+    CleanupStack::PopAndDestroy( 2 ); // currentGrId, factory
+
+
+    UnbindAllL();
+
+    TeardownTestSupport();
+    }
+
+// ------------------------------------------------------
+// General subscribe and unsubscribe for multiple
+// Subscribed for all contexts, force refresh
+// ------------------------------------------------------
+//
+void T_PresenceGroupMemberManagement::T_SubUnsubGroupContent_All_Multi_L()
+    {
+    BindAllL();
+
+    TInt countOfWrappers = iWrapperMgr->WrapperCount();
+
+    CXIMPObjectFactoryImp* factory = CXIMPObjectFactoryImp::NewL();
+    CleanupStack::PushL( factory );
+
+    MXIMPIdentity* currentGrId = factory->NewIdentityLC();
+    currentGrId->SetIdentityL( KGroupId );
+
+    // create group to all connections
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+
+    // ------------------------------------------------------
+    // some startup stuff
+    MXIMPContext* context = wrapper->GetContext();
+    CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+    // Get the interfaces
+    MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+    MPresentityGroups& presGroup = presFeat->PresentityGroups();
+
+    CXIMPTestListener* listener = CXIMPTestListener::NewL( context );
+    CleanupStack::PushL( listener );
+    // ------------------------------------------------------
+
+    // Tell the protocol it should act normally
+    wrapper->GetMessenger()->SetNoError();
+
+    // ------------------------------------------------------
+    // create presentity group
+    //
+    // expect events:
+    // - request complete.
+    // NOTE: no presentitygrouplistevent as we've not subscribed the group lists
+
+    // normal request complete
+    TXIMPRequestId reqIdDummy;  // not checked
+    CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+
+    // identity + displayname
+    CPresentityGroupInfoImp* infoImp = CPresentityGroupInfoImp::NewLC( *currentGrId, KGroupDisplayName );
+    evReqComplete->AppendParamL( infoImp );
+    CleanupStack::Pop( infoImp );
+
+    listener->ExpectL( evReqComplete );
+    CleanupStack::Pop( evReqComplete );
+
+    TXIMPRequestId reqId = presGroup.CreatePresentityGroupL( *currentGrId, KGroupDisplayName );
+
+    // and wait
+    EUNIT_ASSERT_DESC( KErrNone == listener->WaitAndAssertL(), "CreatePresentityGroupL failed" );
+
+    // verify that create was called
+    messenger->AssertCreatePresentityGroupCalled( ETrue );
+
+    // we'll make a new listener below, disable temporarily
+    listener->SetEventSourceL( NULL );
+
+    // subscribe presentity group content in all connections
+    for ( TInt i = 0; i < countOfWrappers; i++ )
+        {
+        CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( i );
+
+        // ------------------------------------------------------
+        // some startup stuff
+        MXIMPContext* context = wrapper->GetContext();
+        CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+        // Get the interfaces
+        MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+        MPresentityGroups& presGroup = presFeat->PresentityGroups();
+
+        CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context );
+        CleanupStack::PushL( listener2 );
+        // ------------------------------------------------------
+
+        // ------------------------------------------------------
+        // subscribe presentity group content for ALL contexts
+        //
+        // expect events:
+        // - request complete
+        evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+        listener2->ExpectL( evReqComplete );
+        CleanupStack::Pop( evReqComplete );
+
+        // do the call
+        reqId = presGroup.SubscribePresentityGroupContentL( *currentGrId );
+
+        // and wait
+        EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "SubscribePresentityGroupContentL failed" );
+
+        // verify that subscribe was called for first only
+        if ( i == 0 )
+            {
+            messenger->AssertSubscribePresentityGroupContentCalled( ETrue );
+            // reset flag
+            messenger->SetValueFor(
+                    EXIMPPlgTestSubscribePresentityGroupContentCalled,
+                    EFalse );
+            }
+        else
+            {
+            messenger->AssertSubscribePresentityGroupContentCalled( EFalse );
+            }
+
+        CleanupStack::PopAndDestroy( listener2 );
+        }
+
+    for ( TInt i = 0; i < countOfWrappers; i++ )
+        {
+        CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( i );
+
+        // ------------------------------------------------------
+        // some startup stuff
+        MXIMPContext* context = wrapper->GetContext();
+        CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+        // Get the interfaces
+        MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+        MPresentityGroups& presGroup = presFeat->PresentityGroups();
+
+        CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context );
+        CleanupStack::PushL( listener2 );
+        // ------------------------------------------------------
+
+        // ------------------------------------------------------
+        // subscribe presentity group content, making a REFRESH case
+        // with multiple contexts
+        //
+        // expect events:
+        // - request complete
+        // - group content event
+
+        evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+        listener2->ExpectL( evReqComplete );
+        CleanupStack::Pop( evReqComplete );
+
+        CPresentityGroupContentEventImp* groupCntEvent =
+            XIMPTestEventFactory::CreateGroupContentEventLCX(
+                    KGroupId,
+                    KNullDesC,
+                    KNullDesC,
+                    XIMPTestEventFactory::ETestPGLCntUpdated,
+                    KNullDesC,
+                    KNullDesC,
+                    MXIMPDataSubscriptionState::ESubscriptionActive,
+                    MXIMPDataSubscriptionState::EDataUnavailable
+                    );
+
+        listener2->ExpectL( groupCntEvent );
+        CleanupStack::Pop( groupCntEvent ); // 5 more items in cleanupstack
+
+        // do the call
+        reqId = presGroup.SubscribePresentityGroupContentL( *currentGrId );
+
+        // and wait
+        EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "SubscribePresentityGroupContentL failed" );
+
+        CleanupStack::PopAndDestroy( 5 ); // rest of group the content event
+
+        // subscribe is not called in the adaptation, this is a refresh case
+        messenger->AssertSubscribePresentityGroupContentCalled( EFalse );
+
+        CleanupStack::PopAndDestroy( listener2 );
+        }
+
+    // continue listening
+    listener->SetEventSourceL( context );
+
+    // ------------------------------------------------------
+    // unsubscribe presentity group content
+    //
+    // expect events:
+    // - request complete
+    // - presentity group content event
+
+    evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+    listener->ExpectL( evReqComplete );
+    CleanupStack::Pop( evReqComplete );
+
+    CPresentityGroupContentEventImp* groupCntEvent =
+        XIMPTestEventFactory::CreateGroupContentEventLCX(
+                KGroupId,
+                KNullDesC,
+                KNullDesC,
+                XIMPTestEventFactory::ETestPGLCntRemoved,
+                KNullDesC,
+                KNullDesC,
+                MXIMPDataSubscriptionState::ESubscriptionInactive,
+                MXIMPDataSubscriptionState::EDataUnavailable
+                );
+
+    listener->ExpectL( groupCntEvent );
+    CleanupStack::Pop( groupCntEvent ); // 5 more items in cleanupstack
+
+    // do the call
+    reqId = presGroup.UnsubscribePresentityGroupContentL( *currentGrId );
+
+    // and wait
+    EUNIT_ASSERT_DESC( KErrNone == listener->WaitAndAssertL(), "UnsubscribePresentityGroupContentL failed" );
+    CleanupStack::PopAndDestroy( 5 ); // lists
+
+    // verify that unsubscribe was NOT called (other contexts are listening too),
+    // and it will be unscubscribed on the last call
+    messenger->AssertUnsubscribePresentityGroupContentCalled( EFalse );
+
+    // ------------------------------------------------------
+    // delete presentity group
+    //
+    // expect events:
+    // - request complete
+    // NO presentity group content event as we've just unsubscribed it.
+
+    evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+    listener->ExpectL( evReqComplete );
+    CleanupStack::Pop( evReqComplete );
+
+    // do the call
+    reqId = presGroup.DeletePresentityGroupL( *currentGrId );
+
+    // and wait
+    EUNIT_ASSERT_DESC( KErrNone == listener->WaitAndAssertL(), "DeletePresentityGroupL failed" );
+
+    // ------------------------------------------------------
+
+    CleanupStack::PopAndDestroy( 3 ); // listener, currentGrId, factory
+
+    UnbindAllL();
+
+    TeardownTestSupport();
+    }
+
+// ------------------------------------------------------
+// General subscribe and unsubscribe for multiple
+// Subscribed for one context only
+// ------------------------------------------------------
+//
+void T_PresenceGroupMemberManagement::T_SubUnsubGroupContent_One_Multi_L()
+    {
+    BindAllL();
+
+    CXIMPObjectFactoryImp* factory = CXIMPObjectFactoryImp::NewL();
+    CleanupStack::PushL( factory );
+
+    MXIMPIdentity* currentGrId = factory->NewIdentityLC();
+    currentGrId->SetIdentityL( KGroupId );
+
+    // create group to all connections
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+
+    // ------------------------------------------------------
+    // some startup stuff
+    MXIMPContext* context = wrapper->GetContext();
+    CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+    // Get the interfaces
+    MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+    MPresentityGroups& presGroup = presFeat->PresentityGroups();
+
+    CXIMPTestListener* listener = CXIMPTestListener::NewL( context );
+    CleanupStack::PushL( listener );
+    // ------------------------------------------------------
+
+    // Tell the protocol it should act normally
+    wrapper->GetMessenger()->SetNoError();
+
+    // ------------------------------------------------------
+    // create presentity group
+    //
+    // expect events:
+    // - request complete.
+    // NOTE: no presentitygrouplistevent as we've not subscribed the group lists
+
+    // normal request complete
+    TXIMPRequestId reqIdDummy;  // not checked
+    CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+
+    // identity + displayname
+    CPresentityGroupInfoImp* infoImp = CPresentityGroupInfoImp::NewLC( *currentGrId, KGroupDisplayName );
+    evReqComplete->AppendParamL( infoImp );
+    CleanupStack::Pop( infoImp );
+
+    listener->ExpectL( evReqComplete );
+    CleanupStack::Pop( evReqComplete );
+
+    TXIMPRequestId reqId = presGroup.CreatePresentityGroupL( *currentGrId, KGroupDisplayName );
+
+    // and wait
+    EUNIT_ASSERT_DESC( KErrNone == listener->WaitAndAssertL(), "CreatePresentityGroupL failed" );
+
+    // verify that create was called
+    messenger->AssertCreatePresentityGroupCalled( ETrue );
+
+    // ------------------------------------------------------
+    // subscribe presentity group CONTENT
+    //
+    // expect events:
+    // - request complete
+    evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+    listener->ExpectL( evReqComplete );
+    CleanupStack::Pop( evReqComplete );
+
+    // do the call
+    reqId = presGroup.SubscribePresentityGroupContentL( *currentGrId );
+
+    // and wait
+    EUNIT_ASSERT_DESC( KErrNone == listener->WaitAndAssertL(), "SubscribePresentityGroupContentL failed" );
+
+    // verify that subscribe was called
+    messenger->AssertSubscribePresentityGroupContentCalled( ETrue );
+
+    // ------------------------------------------------------
+    // subscribe presentity group content, making a REFRESH case
+    // with multiple contexts
+    //
+    // expect events:
+    // - request complete
+    // - group content event
+
+    evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+    listener->ExpectL( evReqComplete );
+    CleanupStack::Pop( evReqComplete );
+
+    CPresentityGroupContentEventImp* groupCntEvent =
+        XIMPTestEventFactory::CreateGroupContentEventLCX(
+                KGroupId,
+                KNullDesC,
+                KNullDesC,
+                XIMPTestEventFactory::ETestPGLCntUpdated,
+                KNullDesC,
+                KNullDesC,
+                MXIMPDataSubscriptionState::ESubscriptionActive,
+                MXIMPDataSubscriptionState::EDataUnavailable
+                );
+
+    listener->ExpectL( groupCntEvent );
+    CleanupStack::Pop( groupCntEvent ); // 5 more items in cleanupstack
+
+    // do the call
+    reqId = presGroup.SubscribePresentityGroupContentL( *currentGrId );
+
+    // and wait
+    EUNIT_ASSERT_DESC( KErrNone == listener->WaitAndAssertL(), "SubscribePresentityGroupContentL failed" );
+
+    CleanupStack::PopAndDestroy( 5 ); // rest of group the content event
+
+    // verify that subscribe was called
+    messenger->AssertSubscribePresentityGroupContentCalled( ETrue );
+
+    // ------------------------------------------------------
+    // unsubscribe presentity group content
+    //
+    // expect events:
+    // - request complete
+    // - presentity group content event
+
+    evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+    listener->ExpectL( evReqComplete );
+    CleanupStack::Pop( evReqComplete );
+
+    groupCntEvent =
+        XIMPTestEventFactory::CreateGroupContentEventLCX(
+                KGroupId,
+                KNullDesC,
+                KNullDesC,
+                XIMPTestEventFactory::ETestPGLCntRemoved,
+                KNullDesC,
+                KNullDesC,
+                MXIMPDataSubscriptionState::ESubscriptionInactive,
+                MXIMPDataSubscriptionState::EDataUnavailable
+                );
+
+    listener->ExpectL( groupCntEvent );
+    CleanupStack::Pop( groupCntEvent ); // 5 more items in cleanupstack
+
+    // do the call
+    reqId = presGroup.UnsubscribePresentityGroupContentL( *currentGrId );
+
+    // and wait
+    EUNIT_ASSERT_DESC( KErrNone == listener->WaitAndAssertL(), "UnsubscribePresentityGroupContentL failed" );
+    CleanupStack::PopAndDestroy( 5 ); // lists
+
+    // verify that unsubscribe was called
+    // unsubscribe really called only on the last one
+    messenger->AssertUnsubscribePresentityGroupContentCalled( ETrue );
+
+    // ------------------------------------------------------
+    // delete presentity group
+    //
+    // expect events:
+    // - request complete
+    // NO presentity group content event as we've just unsubscribed it.
+
+    evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+    listener->ExpectL( evReqComplete );
+    CleanupStack::Pop( evReqComplete );
+
+    // do the call
+    reqId = presGroup.DeletePresentityGroupL( *currentGrId );
+
+    // and wait
+    EUNIT_ASSERT_DESC( KErrNone == listener->WaitAndAssertL(), "DeletePresentityGroupL failed" );
+
+    // ------------------------------------------------------
+
+    CleanupStack::PopAndDestroy( 3 ); // listener, currentGrId, factory
+
+    UnbindAllL();
+
+    TeardownTestSupport();
+    }
+
+// Unsubscribe non-subscribed
+void T_PresenceGroupMemberManagement::T_UnsubscribeNonSubscribed_L()
+    {
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    wrapper->BindL( 0 );
+
+    // ------------------------------------------------------
+    // some startup stuff
+    MXIMPContext* context = wrapper->GetContext();
+    CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+    // Get the interfaces
+    MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+    MPresentityGroups& presGroup = presFeat->PresentityGroups();
+
+    iListener2 = CXIMPTestListener::NewL( context );
+    // ------------------------------------------------------
+
+    // Tell the protocol it should act normally
+    wrapper->GetMessenger()->SetNoError();
+
+    iCurrentGrId = context->ObjectFactory().NewIdentityLC();
+    CleanupStack::Pop(); // iCurrentGrId
+    iCurrentGrId->SetIdentityL( KGroupId );
+
+    // ------------------------------------------------------
+    // create presentity group
+    //
+    // expect events:
+    // - request complete.
+    // NOTE: no presentitygrouplistevent as we've not subscribed the group lists
+
+    // normal request complete
+    TXIMPRequestId reqIdDummy;  // not checked
+    CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+
+    // identity + displayname
+    CPresentityGroupInfoImp* infoImp = CPresentityGroupInfoImp::NewLC( *iCurrentGrId, KGroupDisplayName );
+    evReqComplete->AppendParamL( infoImp );
+    CleanupStack::Pop( infoImp );
+
+    iListener2->ExpectL( evReqComplete );
+    CleanupStack::Pop( evReqComplete );
+
+    TXIMPRequestId reqId = presGroup.CreatePresentityGroupL( *iCurrentGrId, KGroupDisplayName );
+
+    // and wait
+    EUNIT_ASSERT_DESC( KErrNone == iListener2->WaitAndAssertL(), "CreatePresentityGroupL failed" );
+    messenger->AssertCreatePresentityGroupCalled( ETrue );
+
+    // ------------------------------------------------------
+    // unsubscribe presentity group content
+    //
+    // expect events:
+    // - request complete
+    // - presentity group content event
+
+    evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+    iListener2->ExpectL( evReqComplete );
+    CleanupStack::Pop( evReqComplete );
+
+    CPresentityGroupContentEventImp* groupCntEvent =
+        XIMPTestEventFactory::CreateGroupContentEventLCX(
+                KGroupId,
+                KNullDesC,
+                KNullDesC,
+                XIMPTestEventFactory::ETestPGLCntRemoved,
+                KNullDesC,
+                KNullDesC,
+                MXIMPDataSubscriptionState::ESubscriptionInactive,
+                MXIMPDataSubscriptionState::EDataUnavailable
+                );
+
+    iListener2->ExpectL( groupCntEvent );
+    CleanupStack::Pop( groupCntEvent ); // 5 more items in cleanupstack
+
+    // do the call
+    reqId = presGroup.UnsubscribePresentityGroupContentL( *iCurrentGrId );
+
+    // and wait
+    EUNIT_ASSERT_DESC( KErrNone == iListener2->WaitAndAssertL(), "UnsubscribePresentityGroupContentL failed" );
+
+    CleanupStack::PopAndDestroy( 5 ); // lists
+
+    // verify that unsubscribe was not called, not subscribed, so won't
+    // unsubscribe
+    messenger->AssertUnsubscribePresentityGroupContentCalled( EFalse );
+
+    // make sure the new listener is not listening for events!
+    iListener2->SetEventSourceL( NULL );
+
+    wrapper->UnbindL();
+
+    TeardownTestSupport();
+    }
+
+// ===========================================================================
+// SETUP HELPERS FOR THE LISTENER
+// ===========================================================================
+//
+void T_PresenceGroupMemberManagement::SetupListenerReqCompleteL( CXIMPTestContextWrapper* aWrapper, TXIMPTestStatusEventTemplate aEventType )
+    {
+    RArray< TInt32 > array;
+    CleanupClosePushL( array );
+    array.Append( MXIMPContextStateEvent::KInterfaceId );
+    array.Append( MPresentityGroupListEvent::KInterfaceId );
+    aWrapper->SetupListenerReqCompleteL( aEventType, &array );
+    CleanupStack::PopAndDestroy(); // array
+    }
+
+void T_PresenceGroupMemberManagement::SetupListenerReqCompleteAllowEventsL(  CXIMPTestContextWrapper* aWrapper, TXIMPTestStatusEventTemplate aEventType )
+    {
+    RArray< TInt32 > array;
+    CleanupClosePushL( array );
+    array.AppendL( MXIMPRequestCompleteEvent::KInterfaceId );
+    array.AppendL( MXIMPContextStateEvent::KInterfaceId );
+    array.Append( MPresentityGroupListEvent::KInterfaceId );
+    array.Append( MXIMPContextStateEvent::KInterfaceId );
+    array.Append( MPresentityGroupListEvent::KInterfaceId );
+    array.Append( MPresentityGroupContentEvent::KInterfaceId );
+    aWrapper->SetupListenerReqCompleteL( aEventType, &array );
+    CleanupStack::PopAndDestroy(); // array
+    }
+
+// ===========================================================================
+// TEST CASE TABLE
+// ===========================================================================
+//
+EUNIT_BEGIN_TEST_TABLE(
+        T_PresenceGroupMemberManagement,
+        "XIMP presence group member management tests",
+        "MODULE" )
+
+PRFW_DECORATED_TEST(
+        "Subscribe and unsubscribe presentity group content",
+        "",
+        "",
+        "FUNCTIONALITY",
+        Setup_L,
+        T_SubUnsubGroupContent_Single_L,
+        Teardown )
+
+PRFW_DECORATED_TEST(
+        "Subscribe and unsubscribe multiple",
+        "",
+        "",
+        "FUNCTIONALITY",
+        SetupMultiple_L,
+        T_SubUnsubGroupContent_Multi_L,
+        Teardown )
+
+PRFW_DECORATED_TEST(
+        "Refresh subscription for one, multiple",
+        "",
+        "",
+        "FUNCTIONALITY",
+        SetupMultiple_L,
+        T_SubUnsubGroupContent_One_Multi_L,
+        Teardown )
+
+PRFW_DECORATED_TEST(
+        "Refresh subscription for all, multiple",
+        "",
+        "",
+        "FUNCTIONALITY",
+        SetupMultiple_L,
+        T_SubUnsubGroupContent_All_Multi_L,
+        Teardown )
+
+PRFW_DECORATED_TEST(
+        "Subscribe content and receive altered id",
+        "",
+        "",
+        "FUNCTIONALITY",
+        Setup_L,
+        T_SubUnsubGroupContent_Altered_Single_L,
+        Teardown )
+
+PRFW_DECORATED_TEST(
+        "Subscribe content and receive altered but same id",
+        "",
+        "",
+        "FUNCTIONALITY",
+        Setup_L,
+        T_SubUnsubGroupContent_AlteredSame_Single_L,
+        Teardown )
+
+PRFW_DECORATED_TEST(
+        "Unsubscribe non-subscribed",
+        "",
+        "",
+        "FUNCTIONALITY",
+        Setup_L,
+        T_UnsubscribeNonSubscribed_L,
+        Teardown )
+
+PRFW_DECORATED_TEST(
+        "Add members to group",
+        "",
+        "",
+        "FUNCTIONALITY",
+        Setup_L,
+        T_AddGroupMembers_Single_L,
+        Teardown )
+
+PRFW_DECORATED_TEST(
+        "Remove members from group",
+        "",
+        "",
+        "FUNCTIONALITY",
+        Setup_L,
+        T_RemoveGroupMembers_Single_L,
+        Teardown )
+
+PRFW_DECORATED_TEST(
+        "Remove members from unsubscribed group",
+        "",
+        "",
+        "FUNCTIONALITY",
+        Setup_L,
+        T_RemoveGroupMembers_NonSub_Single_L,
+        Teardown )
+
+PRFW_DECORATED_TEST(
+        "Remove nonexisting member from group",
+        "",
+        "",
+        "FUNCTIONALITY",
+        Setup_L,
+        T_RemoveGroupMembers_NonExist_Single_L,
+        Teardown )
+
+PRFW_DECORATED_TEST(
+        "Updated members from group",
+        "",
+        "",
+        "FUNCTIONALITY",
+        Setup_L,
+        T_UpdateGroupMembers_Single_L,
+        Teardown )
+
+PRFW_DECORATED_TEST(
+        "Updated members from nonsubscribed group",
+        "",
+        "",
+        "FUNCTIONALITY",
+        Setup_L,
+        T_UpdateGroupMembers_NonSub_Single_L,
+        Teardown )
+
+PRFW_DECORATED_TEST(
+        "Updated nonexisting member of group",
+        "",
+        "",
+        "FUNCTIONALITY",
+        Setup_L,
+        T_UpdateGroupMembers_NonExist_Single_L,
+        Teardown )
+
+PRFW_DECORATED_TEST(
+        "Expire non-subscribed data",
+        "",
+        "",
+        "FUNCTIONALITY",
+        Setup_L,
+        T_ExpireNonSubscribedData_L,
+        Teardown )
+
+PRFW_DECORATED_TEST(
+        "Expire non-subscribed data. Update multiple times",
+        "",
+        "",
+        "FUNCTIONALITY",
+        Setup_L,
+        T_ExpireNonSubscribedDataUpdateMultiple_L,
+        Teardown )
+
+
+EUNIT_END_TEST_TABLE
+
+
+// ===========================================================================
+// TEST SUITE CONSTRUCTION
+// ===========================================================================
+//
+EXPORT_C MEUnitTest* CreateTestSuiteL()
+    {
+    return T_PresenceGroupMemberManagement::NewL();
+    }
+
+// TODO implement this (split this file to multiple parts):
+/*
+// ===========================================================================
+// TEST SUITE CONSTRUCTION
+// ===========================================================================
+//
+EXPORT_C MEUnitTest* CreateTestSuiteL()
+    {
+    CEUnitTestSuite* suiteCollection = CEUnitTestSuite::NewLC( _L("XIMP group list management tests") );
+
+    CEUnitTestSuite* suite = T_PresenceGroupListManagement::NewL();
+    CleanupStack::PushL( suite );
+    suiteCollection->AddL( suite );
+    CleanupStack::Pop( suite );
+
+    suite = T_xxx::NewL();
+    CleanupStack::PushL( suite );
+    suiteCollection->AddL( suite );
+    CleanupStack::Pop( suite );
+
+    CleanupStack::Pop( suiteCollection );
+    return suiteCollection;
+    }
+
+*/
+
+
+
+// ===========================================================================
+// MISC
+// ===========================================================================
+//
+//Exception handler function
+void MyExceptionHandler( TExcType /*aType*/ )
+    {
+    __BREAKPOINT();
+    }
+
+void T_PresenceGroupMemberManagement::UseMyOwnExceptionHandler()
+    {
+    //Register exeption handler
+    TInt r = User::SetExceptionHandler( MyExceptionHandler, 0xFFFFFFFF );
+    if (r != KErrNone)
+        {
+        User::Panic( _L("MyExHandler"), 1 );
+        }
+    }
+
+
+// end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_presencegroupmembermngt/t_presencegroupmembermngt.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,158 @@
+/*
+* 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:
+*
+*/
+
+#ifndef T_PRESENCEGROUPMEMBERMANAGEMENT_H
+#define T_PRESENCEGROUPMEMBERMANAGEMENT_H
+
+
+
+//  EXTERNAL INCLUDES
+#include <platform/digia/eunit/ceunittestsuiteclass.h>
+#include <platform/digia/eunit/EUnitDecorators.h>
+
+#include <ximpbase.h>
+#include <presenceinfo.h>
+#include "prfwteststatuseventlistener.h"
+#include "prfwtestmessaging.h"
+
+class CXIMPTestContextWrapper;
+class CXIMPTestContextWrapperMgr;
+class CXIMPTestMessenger;
+class CPresentityGroupListEventImp;
+class CPresentityGroupContentEventImp;
+
+class T_PresenceGroupMemberManagement;
+
+class CXIMPTestListener;
+
+// function pointer to a method
+typedef void (T_PresenceGroupMemberManagement::* TXIMPCallBack )();
+
+/**
+ * XIMP Framework Eunit tests.
+ *
+ * Tests for XIMP group member management services.
+ *
+ * @since S60 v4.0
+ */
+class T_PresenceGroupMemberManagement : public CEUnitTestSuiteClass
+    {
+
+public:
+    static T_PresenceGroupMemberManagement* NewL();
+    virtual ~T_PresenceGroupMemberManagement();
+
+
+private:
+    T_PresenceGroupMemberManagement();
+    void ConstructL();
+
+private:    // Test case functions
+
+    void Setup_L();
+    void SetupMultiple_L();
+    void BindAllL();
+    void Teardown();
+    
+    // destroy test case support things, which cannot
+    // be known in Setup method.
+    void TeardownTestSupport();
+    
+    void UnbindAllL();
+
+    void T_SubUnsubGroupContent_Single_L();
+    void T_SubUnsubGroupContent_Multi_L();
+    void T_SubUnsubGroupContent_One_Multi_L();
+    void T_SubUnsubGroupContent_All_Multi_L();
+    void T_SubUnsubGroupContent_Altered_Single_L();
+    void T_SubUnsubGroupContent_AlteredSame_Single_L();
+    void T_UnsubscribeNonSubscribed_L();
+    void T_AddGroupMembers_Single_L();
+    void T_RemoveGroupMembers_Single_L();
+    void T_RemoveGroupMembers_NonSub_Single_L();
+    void T_RemoveGroupMembers_NonExist_Single_L();
+    void T_UpdateGroupMembers_Single_L();
+    void T_UpdateGroupMembers_NonSub_Single_L();
+    void T_UpdateGroupMembers_NonExist_Single_L();
+    void T_ExpireNonSubscribedData_L();
+    void T_ExpireNonSubscribedDataUpdateMultiple_L();
+
+    // variable test method support
+    void T_GenericSubAndUnsubL( TXIMPCallBack& aCbFuncL );
+
+    void T_EmptyFunc();
+    void T_TestAddMembersL();
+    void T_TestAddMembers_NonSub_L();
+    void T_TestRemoveMembersL();
+    void T_TestRemoveMembers_NonSub_L();
+    void T_TestRemoveMembers_NonExisting_L();
+    void T_TestUpdateMembers_L();
+    void T_TestUpdateMembers_NonSub_L();
+    void T_TestUpdateMembers_NonExisting_L();
+
+private:    // Test helpers
+
+    void SetupListenerReqCompleteL( CXIMPTestContextWrapper* aWrapper, TXIMPTestStatusEventTemplate aEventType );
+    void SetupListenerReqCompleteAllowEventsL( CXIMPTestContextWrapper* aWrapper, TXIMPTestStatusEventTemplate aEventTypes );
+
+    // sometimes EUnit might eat e.g. an Access violation.
+    // Call this method in the test case to break when it happens,
+    // hopefully you will find the cause.
+    void UseMyOwnExceptionHandler();
+
+private: // Test data
+
+    /**
+     * Eunit test case table declaration.
+     */
+    EUNIT_DECLARE_TEST_TABLE;
+
+    // owned
+    CXIMPTestContextWrapperMgr* iWrapperMgr;
+
+    CActiveSchedulerWait* iASWait;
+
+    // current group id
+    // owned.
+    MXIMPIdentity* iCurrentGrId;
+
+    /**
+     * Last received group content event.
+     * Owned.
+     */
+    CPresentityGroupContentEventImp* iLastEvent;
+
+    CXIMPTestListener* iListener2;
+
+    // ETrue, if you want to skip group content subscription in generic
+    // sub and unsub
+    TBool iSkipSubscribe;
+
+    // EFalse, if you want to skip group content unsubscription
+    TBool iSkipUnsubscribe;
+    };
+
+
+#endif      //  T_PRESENCEGROUPMEMBERMANAGEMENT_H
+
+
+
+// end of file
+
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_presencegroupmembermngt/t_presencegroupmembermngt.mmp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,75 @@
+/*
+* 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:
+*
+*/
+
+#include            "../../tsrcutils/eunitcommon/eunittstdllbase.hrh"
+#include            "../../tsrcutils/processmaster/pm.h"
+
+#include<platform_paths.hrh>
+#include<eunitcaps.h>
+
+TARGET              t_presencegroupmembermngt.dll
+//CAPABILITY              ALL - TCB - DRM
+CAPABILITY      EUNIT_CAPS
+
+SOURCEPATH          .
+SOURCE              t_presencegroupmembermngt.cpp
+
+
+USERINCLUDE             ../../../../../ximpfw/core/srcdatamodel
+USERINCLUDE             ../../../../../ximpfw/presence/srcpresencedatamodel
+USERINCLUDE             ../../../../../ximpfw/presence/srcpresencedatamodel/presentitygroups
+USERINCLUDE             ../../../../../ximpfw/presence/srcpresencedatamodel/presencewatching
+USERINCLUDE             ../../../../../ximpfw/presence/srcpresencedatamodel/presenceauthorization
+USERINCLUDE             ../../../../../ximpfw/presence/srcpresencedatamodel/presencepublishing
+USERINCLUDE             ../../../../../ximpfw/presence/srcpresencedatamodel/presenceinfo
+USERINCLUDE             ../../../../../ximpfw/core/srcutils
+
+// TODO remove unnecessary
+#if defined ( OS_LAYER_SYSTEMINCLUDE )
+OS_LAYER_SYSTEMINCLUDE
+#else
+SYSTEMINCLUDE     /epoc32/include
+#endif
+
+ #if defined ( APP_LAYER_SYSTEMINCLUDE )
+ APP_LAYER_SYSTEMINCLUDE
+ #else
+ SYSTEMINCLUDE     \epoc32\include
+ #endif
+ 
+SYSTEMINCLUDE           ../../../../../ximpfw/inc/core/base
+SYSTEMINCLUDE           ../../../../../ximpfw/inc/core/datamodel
+SYSTEMINCLUDE           ../../../../../ximpfw/inc/core/protocolplugin
+SYSTEMINCLUDE           ../../../../../ximpfw/inc/core/protocolpluginhost
+SYSTEMINCLUDE           ../../../../../ximpfw/inc/presence/presencedatamodel
+SYSTEMINCLUDE           ../../../../../ximpfw/inc/presence/presencemanagement
+SYSTEMINCLUDE           ../../../../../ximpfw/inc/presence/presenceprotocolplugin
+SYSTEMINCLUDE           ../../../../../ximpfw/inc/presence/presenceprotocolpluginhost
+
+LIBRARY             ecom.lib
+LIBRARY             bafl.lib
+LIBRARY             ximpdatamodel.lib
+LIBRARY             presencedatamodel.lib
+LIBRARY             ximputils.lib
+LIBRARY             estor.lib
+LIBRARY                 EUnit.lib
+LIBRARY             eunitutil.lib
+LIBRARY             euser.lib
+
+// end of file
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_presencepublishing/bld.inf	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,26 @@
+/*
+* 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 t_presencemng.dll
+*
+*/
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_TESTMMPFILES
+t_presencepublishing.mmp
+
+PRJ_TESTMMPFILES
+///epoc32/release/winscw/udeb/t_presencepublishing.dll	/epoc32/release/winscw/udeb/z/sys/bin/t_presencepublishing.dll
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_presencepublishing/t_presencepublishing.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,1213 @@
+/*
+* 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:
+*
+*/
+
+
+#include "eunittools.h"
+
+#include <platform/digia/eunit/eunitmacros.h>
+#include <platform/digia/eunit/teunitassertioninfo.h>
+
+#include <ecom/ecom.h>
+#include <badesca.h>
+
+#include <ximpbase.h>
+#include <ximpclient.h>
+#include <ximpcontext.h>
+#include <ximpcontextstateevent.h>
+#include <ximpcontextstate.h>
+#include <ximpobjectfactory.h>
+#include <presencepublishing.h>
+#include <presentitypresenceevent.h>
+#include <presenceobjectfactory.h>
+#include <presencefeatures.h>
+#include <presenceinfofield.h>
+#include <presenceinfofieldcollection.h>
+#include <servicepresenceinfo.h>
+#include <devicepresenceinfo.h>
+#include <personpresenceinfo.h>
+#include <presenceinfofieldvalueenum.h>
+#include <presenceinfofieldvaluetext.h>
+#include <presenceinfo.h>
+
+#include "t_presencepublishing.h"
+
+#include "prfwtestmessaging.h"
+#include "prfwtestmessenger.h"
+#include "prfwtestcontextwrappermgr.h"
+#include "prfwtestcontextwrapper.h"
+
+#include "prfwtestpresencedatautils.h"
+
+#include "ximprequestcompleteeventimp.h"
+#include "ximpcontextstateeventimp.h"
+#include "ximpcontextstateimp.h"
+#include "ximpstatusimp.h"
+#include "ownpresenceeventimp.h"
+
+// new test stuff
+#include "prfwtestlistener.h"
+#include "prfwtestfilesrvmsg.h"
+#include "prfwtestfiletool.h"
+
+
+#include "prfwtestrobustnesstools.h"
+
+_LIT8( KPrefix1, "PreA_" );
+_LIT8( KPrefix2, "PreB_" );
+_LIT8( KPrefix3, "PreC_" );
+_LIT8( KPrefix4, "PreD_" );
+
+_LIT8( KServiceType, "test_service" );
+_LIT(  KStatusMsg, "This is my status." );
+
+const TInt KTestAvailability = 1;
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// CONSTRUCTION
+T_PresencePublishing* T_PresencePublishing::NewL()
+    {
+    T_PresencePublishing* self = new( ELeave ) T_PresencePublishing;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+
+    return self;
+    }
+
+
+T_PresencePublishing::~T_PresencePublishing()
+    {
+    }
+
+
+void T_PresencePublishing::ConstructL()
+    {
+    CEUnitTestSuiteClass::ConstructL();
+    }
+
+
+T_PresencePublishing::T_PresencePublishing()
+    {
+    }
+
+
+
+// ===========================================================================
+// TEST CASE SETUP & TEARDOWN METHODS
+// ===========================================================================
+//
+
+void T_PresencePublishing::Setup_L()
+    {
+    PrfwTestRobustness::DoPreCleaning();
+  
+    iWrapperMgr = CXIMPTestContextWrapperMgr::NewL();
+    iWrapperMgr->CreateWrapperL();
+    }
+
+void T_PresencePublishing::SetupMultiple_L()
+    {
+    PrfwTestRobustness::DoPreCleaning();
+
+    iWrapperMgr = CXIMPTestContextWrapperMgr::NewL();
+    iWrapperMgr->CreateWrapperL();
+    iWrapperMgr->CreateWrapperL();
+    iWrapperMgr->CreateWrapperL();
+    }
+
+
+void T_PresencePublishing::BindL()
+    {
+    CXIMPTestContextWrapper* wrapper0 = iWrapperMgr->GetWrapperL( 0 );
+
+    wrapper0->BindL( 0 );
+    }
+
+void T_PresencePublishing::Bind2L()
+    {
+    CXIMPTestContextWrapper* wrapper0 = iWrapperMgr->GetWrapperL( 0 );
+    wrapper0->BindWithSettingsL( 0 );
+    }
+    
+void T_PresencePublishing::BindAllL()
+    {
+    for( TInt a = 0; a < iWrapperMgr->WrapperCount(); ++a )
+        {
+        CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a );
+        wrapper->BindL( 0 );
+        }
+    }
+
+
+void T_PresencePublishing::Teardown()
+    {
+    delete iWrapperMgr;
+    iWrapperMgr = NULL;
+
+    REComSession::FinalClose();
+
+    PrfwTestRobustness::DoPreCleaning();
+    }
+
+void T_PresencePublishing::UnbindL()
+    {
+    // Do unbind
+    CXIMPTestContextWrapper* wrapper0 = iWrapperMgr->GetWrapperL( 0 );
+    wrapper0->UnbindL();
+    }
+
+void T_PresencePublishing::UnbindAllL()
+    {
+    for( TInt a = 0; a < iWrapperMgr->WrapperCount(); ++a )
+        {
+        CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a );
+        wrapper->UnbindL();
+        }
+    }
+
+
+// ===========================================================================
+// TEST CASES for presence publish
+// ===========================================================================
+void T_PresencePublishing::T_Publish_Single_L()
+    {
+    EUNIT_PRINT( _L("Single Presence Publish test") );
+
+    BindL();
+
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    MXIMPContext* context = wrapper->GetContext();
+    CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+    CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context );
+    CleanupStack::PushL( listener2 );
+
+    // Get the interfaces
+    MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+    MPresencePublishing& presPub = presFeat->PresencePublishing();
+
+    // Generate a doc
+    CPresenceInfoImp* presInfo =
+            XIMPTestPresenceDataUtils::GenerateInfoLC( &KPrefix1 );
+
+    // Tell the protocol it should act normally
+    messenger->SetNoError();
+
+    // Publish the presence
+    TXIMPRequestId reqId = presPub.PublishOwnPresenceL( *presInfo );
+
+    // Setup status event listener
+    CXIMPRequestCompleteEventImp* evReqComplete =
+                            CXIMPRequestCompleteEventImp::NewLC( reqId );
+    listener2->ExpectL( evReqComplete );
+    CleanupStack::Pop( evReqComplete );
+
+    // Wait for events on the request
+    EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Publishing presence failed" );
+    
+
+    COMMONASSERT( messenger, EXIMPPlgTestPublishPresenceCalled, "PublishPresenceL was not called", ETrue, NULL );
+
+    CleanupStack::PopAndDestroy( presInfo );
+    CleanupStack::PopAndDestroy( listener2 );
+    UnbindL();
+    }
+
+void T_PresencePublishing::T_NetworkUnplugError_L()
+	{
+    EUNIT_PRINT( _L("Error from plug-in in publish own presence") );
+    
+    // Creating the error which comes from KErrTimedOut and protocol sends Connection terminated.
+
+// BIND AND SETUP
+
+    Bind2L();
+
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    MXIMPContext* context = wrapper->GetContext();
+    CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+
+    CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context );
+    CleanupStack::PushL( listener2 );
+
+    // Get the interfaces
+    MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+    MPresencePublishing& presPub = presFeat->PresencePublishing();
+
+
+// PUBLISH OWN
+
+    //messenger->SetLeave( KErrAbort );
+	messenger->SetError(KErrTimedOut);
+	
+    // publish own presence in here
+    MPresenceInfo* info = CreateInfoLC();
+
+    TXIMPRequestId reqId = presPub.PublishOwnPresenceL( *info );
+    
+   
+    // Setup status event listener for RequestComplete
+    listener2->Reset();
+    // request complete with KErrAbort
+    CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqId );
+    evReqComplete->CompletionResultImp().SetResultCode( KErrTimedOut );
+    listener2->ExpectL( evReqComplete );
+    CleanupStack::Pop( evReqComplete );
+    
+    CXIMPContextStateEventImp* evContextEvent = CXIMPContextStateEventImp::NewLC();
+    evContextEvent->ContextStateImp().SetStateValue( MXIMPContextState::EUnbinding);
+    listener2->ExpectL( evContextEvent );
+    CleanupStack::Pop( evContextEvent );
+    
+    CXIMPContextStateEventImp* evContextEvent2 = CXIMPContextStateEventImp::NewLC();
+    evContextEvent2->ContextStateImp().SetStateValue( MXIMPContextState::EInactive);
+    listener2->ExpectL( evContextEvent2 );
+    CleanupStack::Pop( evContextEvent2 );
+    
+    listener2->WaitAndAssertL();
+
+// UNBIND
+
+    CleanupStack::PopAndDestroy(1);//info
+    CleanupStack::PopAndDestroy( listener2 );
+
+    messenger->SetError( KErrNone );
+
+    UnbindL();
+	}    
+
+
+void T_PresencePublishing::T_NetworkUnplugErrorMultiple_L()
+	{
+    EUNIT_PRINT( _L("Network disconnect from plug-in in publish own presence, multiple contexts") );
+
+	// Bind 2 contexts
+	BindAllL();
+
+	/* 
+	 * Make the 1st client publish someting and then the disconnect would happen 
+	 */
+	CXIMPTestContextWrapper* wrapper0 = iWrapperMgr->GetWrapperL( 0 );
+    MXIMPContext* context0 = wrapper0->GetContext();
+    CXIMPTestMessenger* messenger0 = wrapper0->GetMessenger();
+
+
+    CXIMPTestListener* listener0 = CXIMPTestListener::NewL( context0);
+    CleanupStack::PushL( listener0);
+
+    MPresenceFeatures* presFeat0 = wrapper0->GetPresenceFeatures();
+    MPresencePublishing& presPub0 = presFeat0->PresencePublishing();
+
+    //messenger->SetLeave( KErrAbort );
+	messenger0->SetError(KErrTimedOut);
+	
+
+    // publish own presence in here
+    MPresenceInfo* info = CreateInfoLC();
+    TXIMPRequestId reqId = presPub0.PublishOwnPresenceL( *info );
+
+    /* Setup status event listener for RequestComplete for client 1 */
+    listener0->Reset();
+    // request complete with KErrTimedOut
+    CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqId );
+    evReqComplete->CompletionResultImp().SetResultCode( KErrTimedOut );
+    listener0->ExpectL( evReqComplete );
+    CleanupStack::Pop( evReqComplete );
+    
+    // Create the context state events for unbinding
+    CXIMPContextStateEventImp* evContextEvent = CXIMPContextStateEventImp::NewLC();
+    evContextEvent->ContextStateImp().SetStateValue( MXIMPContextState::EUnbinding);
+    listener0->ExpectL( evContextEvent );
+    CleanupStack::Pop( evContextEvent );
+    
+    CXIMPContextStateEventImp* evContextEvent2 = CXIMPContextStateEventImp::NewLC();
+    evContextEvent2->ContextStateImp().SetStateValue( MXIMPContextState::EInactive);
+    listener0->ExpectL( evContextEvent2 );
+    CleanupStack::Pop( evContextEvent2 );
+
+  
+   
+   	/* 
+   	 * Create a request for client 2, this will not be processed by the protocol plug-in 
+   	 */
+	CXIMPTestContextWrapper* wrapper1 = iWrapperMgr->GetWrapperL( 1 );
+    MXIMPContext* context1 = wrapper1->GetContext();
+
+    MPresenceFeatures* presFeat1 = wrapper1->GetPresenceFeatures();
+    MPresencePublishing& presPub1 = presFeat1->PresencePublishing();
+
+
+    // Create the empty presence info filter
+    CPresenceInfoFilterImp* pif = CPresenceInfoFilterImp::NewLC();
+    TXIMPRequestId reqId1 = presPub1.SubscribeOwnPresenceL( *pif );
+	CleanupStack::PopAndDestroy(pif);
+
+    // Setup status event listener for RequestComplete
+    CXIMPTestListener* listener1 = CXIMPTestListener::NewL( context1);
+    CleanupStack::PushL( listener1);
+    listener1->Reset();
+    // normal request complete
+    CXIMPRequestCompleteEventImp* evReqComplete1 = CXIMPRequestCompleteEventImp::NewLC( reqId1 );
+    evReqComplete1->CompletionResultImp().SetResultCode( KErrTimedOut );
+    listener1->ExpectL( evReqComplete1 );
+    CleanupStack::Pop( evReqComplete1 );
+
+    // Create the context state events for unbinding
+    evContextEvent = CXIMPContextStateEventImp::NewLC();
+    evContextEvent->ContextStateImp().SetStateValue( MXIMPContextState::EUnbinding);
+    listener1->ExpectL( evContextEvent );
+    CleanupStack::Pop( evContextEvent );
+    
+    evContextEvent2 = CXIMPContextStateEventImp::NewLC();
+    evContextEvent2->ContextStateImp().SetStateValue( MXIMPContextState::EInactive);
+    listener1->ExpectL( evContextEvent2 );
+    CleanupStack::Pop( evContextEvent2 );
+
+
+    // Wait for events on the request
+    
+    EUNIT_ASSERT_DESC( KErrNone == listener0->WaitAndAssertL(), "Publish own presence failed in client 1");
+
+    EUNIT_ASSERT_DESC( KErrNone == listener1->WaitAndAssertL(), "SubscribeOwnPresence failed in client 2" );
+
+    CleanupStack::PopAndDestroy( listener1 );
+    CleanupStack::PopAndDestroy(1);//info
+    CleanupStack::PopAndDestroy( listener0 );
+		
+	// Finish the test case	
+	UnbindAllL();	
+	}
+
+void T_PresencePublishing::T_Publish_ErrFromPlg_Leave_L()
+    {
+    EUNIT_PRINT( _L("Single Presence Publish test") );
+    EUNIT_PRINT( _L("Plugin leaves from PublishOwnPresenceL") );
+
+    BindL();
+
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    MXIMPContext* context = wrapper->GetContext();
+    CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+    CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context );
+    CleanupStack::PushL( listener2 );
+
+    // Get the interfaces
+    MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+    MPresencePublishing& presPub = presFeat->PresencePublishing();
+
+    // Generate a doc
+    CPresenceInfoImp* presDoc =
+                XIMPTestPresenceDataUtils::GenerateInfoLC( &KPrefix1 );
+
+    // Setup status event listener
+    SetupListenerReqCompleteL( wrapper, EXIMPTestStatusEvents_RequestOk );
+
+    // Tell the test protocol to leave on next operation
+    messenger->SetLeave( KErrAbort );
+
+    // Publish the presence
+    TXIMPRequestId reqId = presPub.PublishOwnPresenceL( *presDoc );
+    // Wait for events on the request
+    wrapper->WaitRequestAndStackEvents( reqId );
+    wrapper->VerifyEventStackL( _L8("Publishing single presence, leave with error: ") );
+
+    // Verify that plugin left and didn't go through the PublishOwnPresenceL.
+    COMMONASSERT( messenger, EXIMPPlgTestPublishPresenceCalled, "PublishPresenceL was not called",
+                                                EFalse, "PublishPresenceL was called." );
+
+
+    // TODO wait and verify the events
+    EUNIT_FAIL_TEST( "Under construction." );
+
+    CleanupStack::PopAndDestroy( presDoc );
+    CleanupStack::PopAndDestroy( listener2 );
+    UnbindL();
+    }
+
+void T_PresencePublishing::T_Publish_ErrFromPlg_CompleteWithError_L()
+    {
+    EUNIT_PRINT( _L("Single Presence Publish test") );
+    EUNIT_PRINT( _L("Plugin completes PublishOwnPresenceL with error") );
+
+    BindL();
+
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    MXIMPContext* context = wrapper->GetContext();
+    CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+    CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context );
+    CleanupStack::PushL( listener2 );
+
+    // Get the interfaces
+    MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+    MPresencePublishing& presPub = presFeat->PresencePublishing();
+
+    // Generate a doc
+    CPresenceInfoImp* presDoc =
+                XIMPTestPresenceDataUtils::GenerateInfoLC( &KPrefix1 );
+
+    // Setup status event listener:
+    //TODO  Setup presence event listener
+    SetupListenerReqCompleteL( wrapper, EXIMPTestStatusEvents_RequestOk );
+
+    // Tell the test protocol to return with error on next operation
+    messenger->SetError( KErrAbort );
+
+    // Publish the presence
+    TXIMPRequestId reqId = presPub.PublishOwnPresenceL( *presDoc );
+    // Wait for events on the request
+    wrapper->WaitRequestAndStackEvents( reqId );
+    wrapper->VerifyEventStackL( _L8("Publishing single presence, complete with error: ") );
+
+    // Verify that we did go through PublishOwnPresenceL.
+    COMMONASSERT( messenger, EXIMPPlgTestPublishPresenceCalled, "PublishPresenceL was not called", ETrue, NULL );
+
+    // TODO wait and verify presence events
+    EUNIT_FAIL_TEST( "Under construction." );
+
+    CleanupStack::PopAndDestroy( presDoc );
+    CleanupStack::PopAndDestroy( listener2 );
+
+    UnbindL();
+    }
+
+
+// ===========================================================================
+// TEST CASES for presence interest registration
+// ===========================================================================
+
+// Single client, empty filter
+void T_PresencePublishing::T_SubscribeOwnPresence_Single_Empty_L()
+    {
+    EUNIT_PRINT( _L("Single interest registration") );
+
+    BindL();
+
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    MXIMPContext* context = wrapper->GetContext();
+    CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+
+    CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context );
+    CleanupStack::PushL( listener2 );
+
+    // Tell the protocol it should act normally
+    messenger->SetNoError();
+
+    // Get the interfaces
+    MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+    MPresencePublishing& presPub = presFeat->PresencePublishing();
+
+    // Create the empty presence info filter
+    CPresenceInfoFilterImp* pif = CPresenceInfoFilterImp::NewLC();
+
+    // Setup status event listener for RequestComplete
+    listener2->Reset();
+    // normal request complete
+    TXIMPRequestId reqIdDummy;  // not checked
+    CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+    listener2->ExpectL( evReqComplete );
+    CleanupStack::Pop( evReqComplete );
+
+    // subscribe own presence
+    TXIMPRequestId reqId = presPub.SubscribeOwnPresenceL( *pif );
+
+    // Wait for events on the request
+    EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "SubscribeOwnPresence failed" );
+
+    // verify that SubscribeOwnPresenceL was called
+    COMMONASSERT( messenger, EXIMPPlgTestSubscribeOwnPresenceCalled, "SubscribeOwnPresenceL was not called", ETrue, NULL );
+
+    // Setup status event listener for RequestComplete
+    listener2->Reset();
+    evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+    listener2->ExpectL( evReqComplete );
+    CleanupStack::Pop( evReqComplete );
+  
+    // unsubscribe own presence
+    reqId = presPub.UnsubscribeOwnPresenceL();
+
+    // Wait for events on the request
+    EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "UnsubscribeOwnPresence failed" );
+    
+    // verify that UnsubscribeOwnPresenceL was called
+    COMMONASSERT( messenger, EXIMPPlgTestUnsubscribeOwnPresenceCalled, "UnsubscribeOwnPresenceL was not called", ETrue, NULL );
+
+    CleanupStack::PopAndDestroy( pif );
+    CleanupStack::PopAndDestroy( listener2 );
+    UnbindL();
+    }
+
+// Single client, empty filter
+void T_PresencePublishing::T_SubscribeOwnPresence_Multiple_Empty_L()
+    {
+    EUNIT_PRINT( _L("Multiple client filter registration") );
+
+    BindAllL();
+
+    // Create the empty presence info filter
+    CPresenceInfoFilterImp* pif = CPresenceInfoFilterImp::NewLC();
+
+    TInt countOfWrappers = iWrapperMgr->WrapperCount();
+
+    CXIMPTestListener* listeners[ 50 ];
+    TXIMPRequestId reqIdDummy;  // not checked
+
+
+
+// Setup listeners
+    for( TInt a = 0; a < countOfWrappers; a++ )
+        {
+        CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a );
+        MXIMPContext* context = wrapper->GetContext();
+        listeners[ a ] = CXIMPTestListener::NewL( context );
+        CleanupStack::PushL( listeners[ a ] );
+        }
+
+
+// SUBSCRIBE
+    for( TInt a = countOfWrappers - 1; a > 0 ; --a )
+        {
+        CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a );
+        MXIMPContext* context = wrapper->GetContext();
+        CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+        // Tell the protocol it should act normally
+        messenger->SetNoError();
+
+        // Get the interfaces
+        MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+        MPresencePublishing& presPub = presFeat->PresencePublishing();
+
+        // Setup status event listener for RequestComplete
+        listeners[ a ]->Reset();
+        CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+        listeners[ a ]->ExpectL( evReqComplete );
+        CleanupStack::Pop( evReqComplete );
+
+        messenger->SetValueFor( EXIMPPlgTestSubscribeOwnPresenceCalled, 0 );
+        // subscribe own presence
+        TXIMPRequestId reqId = presPub.SubscribeOwnPresenceL( *pif );
+
+        // Wait for events on the request
+        EUNIT_ASSERT_DESC( KErrNone == listeners[ a ]->WaitAndAssertL(), "SubscribeOwnPresence failed" );
+
+        // verify that SubscribeOwnPresenceL was called
+        COMMONASSERT( messenger, EXIMPPlgTestSubscribeOwnPresenceCalled, "SubscribeOwnPresenceL was not called", 
+        ( a > 1 ) ? ETrue : EFalse , "SubscribeOwnPresenceL was called." );
+        }
+        
+// REFRESH
+
+    for( TInt a = countOfWrappers - 1; a > 0 ; --a )
+        {
+        CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a );
+        MXIMPContext* context = wrapper->GetContext();
+        CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+        // Tell the protocol it should act normally
+        messenger->SetNoError();
+
+        // Get the interfaces
+        MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+        MPresencePublishing& presPub = presFeat->PresencePublishing();
+
+        // Setup status event listener for RequestComplete
+        listeners[ a ]->Reset();
+        CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+        listeners[ a ]->ExpectL( evReqComplete );
+        CleanupStack::Pop( evReqComplete );
+        
+        CXIMPDataSubscriptionStateImp* stateImp = CXIMPDataSubscriptionStateImp::NewLC();
+        stateImp->SetDataStateL( MXIMPDataSubscriptionState::EDataUnavailable );
+        stateImp->SetSubscriptionStateL( MXIMPDataSubscriptionState::ESubscriptionActive );
+        COwnPresenceEventImp* evOwnPresence = COwnPresenceEventImp::NewLC( stateImp );
+        CleanupStack::Pop( 2, stateImp );
+        CleanupStack::PushL( evOwnPresence );
+        listeners[ a ]->ExpectL( evOwnPresence );
+        CleanupStack::Pop( evOwnPresence );
+        
+        // TODO check if this call is still needed
+        messenger->SetValueFor( EXIMPPlgTestSubscribeOwnPresenceCalled, 0 );
+
+        // subscribe own presence
+        TXIMPRequestId reqId = presPub.SubscribeOwnPresenceL( *pif );
+
+        // Wait for events on the request
+        EUNIT_ASSERT_DESC( KErrNone == listeners[ a ]->WaitAndAssertL(), "SubscribeOwnPresence failed" );
+        
+        // verify that SubscribeOwnPresenceL was called
+        COMMONASSERT( messenger, EXIMPPlgTestSubscribeOwnPresenceCalled,
+                        "SubscribeOwnPresenceL was not called", 
+                        EFalse , "SubscribeOwnPresenceL was called." );
+        }
+
+        
+// UNSUBSCRIBE
+        
+    for( TInt a = 0; a < countOfWrappers; ++a )
+        {
+        CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a );
+        MXIMPContext* context = wrapper->GetContext();
+        CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+        // Get the interfaces
+        MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+        MPresencePublishing& presPub = presFeat->PresencePublishing();
+
+        // Setup status event listener for RequestComplete
+        listeners[ a ]->Reset();
+        CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+        listeners[ a ]->ExpectL( evReqComplete );
+        CleanupStack::Pop( evReqComplete );
+        
+
+        // register interest
+        TXIMPRequestId reqId = presPub.UnsubscribeOwnPresenceL();
+
+        // Wait for events on the request
+        EUNIT_ASSERT_DESC( KErrNone == listeners[ a ]->WaitAndAssertL(), "UnsubscribeOwnPresence failed" );
+
+ 
+        // verify that UpdateInterest was called
+        COMMONASSERT( messenger, EXIMPPlgTestUnsubscribeOwnPresenceCalled, 
+            "UnsubscribeOwnPresenceL was not called",
+            ( a < 2 ) ? EFalse : ETrue,
+            "UnsubscribeOwnPresenceL was called" );
+        }
+
+
+    // delete the listeners
+    CleanupStack::PopAndDestroy( countOfWrappers ); // the contents of listeners[]
+
+    CleanupStack::PopAndDestroy( pif );
+    
+    UnbindAllL();
+    }
+
+
+// Single client, filled filter
+void T_PresencePublishing::T_SubscribeOwnPresence_Single_L()
+    {
+    EUNIT_PRINT( _L("Single interest registration") );
+
+    BindL();
+
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    MXIMPContext* context = wrapper->GetContext();
+    CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+    CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context );
+    CleanupStack::PushL( listener2 );
+
+    // Get the interfaces
+    MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+    MPresencePublishing& presPub = presFeat->PresencePublishing();
+
+    // Create the filled interest document
+    CPresenceInfoFilterImp* pif =
+                XIMPTestPresenceDataUtils::GenerateInfoFilterLC( &KPrefix1 );
+
+    // Tell the protocol it should act normally
+    messenger->SetNoError();
+
+
+// SUBSCRIBE
+
+    // subscribe own presence
+    TXIMPRequestId reqId = presPub.SubscribeOwnPresenceL( *pif );
+
+    // Setup status event listener for RequestComplete
+    listener2->Reset();
+    SetupListenerReqCompleteL( wrapper, EXIMPTestStatusEvents_RequestOk );
+    CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqId );
+    listener2->ExpectL( evReqComplete );
+    CleanupStack::Pop( evReqComplete );
+
+    // Wait for events on the request
+    EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "SubscribeOwnPresence failed" );
+
+    // verify that SubscribeOwnPresenceL was called
+    COMMONASSERT( messenger, EXIMPPlgTestSubscribeOwnPresenceCalled, "SubscribeOwnPresenceL was not called", ETrue, NULL );    
+
+// REFRESH
+
+    // subscribe own presence (refresh)
+    reqId = presPub.SubscribeOwnPresenceL( *pif );
+
+    // Setup status event listener for RequestComplete
+    SetupListenerReqCompleteL( wrapper, EXIMPTestStatusEvents_RequestOk );
+    messenger->SetValueFor( EXIMPPlgTestSubscribeOwnPresenceCalled, 0 );
+    listener2->Reset();
+    evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqId );
+    listener2->ExpectL( evReqComplete );
+    CleanupStack::Pop( evReqComplete );
+    // also the event
+    
+    CXIMPDataSubscriptionStateImp* stateImp = CXIMPDataSubscriptionStateImp::NewLC();
+    stateImp->SetDataStateL( MXIMPDataSubscriptionState::EDataUnavailable );
+    stateImp->SetSubscriptionStateL( MXIMPDataSubscriptionState::ESubscriptionActive );    
+    COwnPresenceEventImp* event = COwnPresenceEventImp::NewLC( stateImp );
+    CleanupStack::Pop( 2, stateImp );
+    CleanupStack::PushL( event );    
+    listener2->ExpectL( event );
+    CleanupStack::Pop( event );
+
+    // Wait for events on the request
+    EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Refreshing own presence subscription failed" );
+
+    // verify that SubscribeOwnPresenceL was called
+    COMMONASSERT( messenger, EXIMPPlgTestSubscribeOwnPresenceCalled, "SubscribeOwnPresenceL was not called", EFalse, "SubscribeOwnPresenceL was called" );
+
+    CleanupStack::PopAndDestroy( pif );
+    CleanupStack::PopAndDestroy( listener2 );
+    UnbindL();
+    }
+
+void T_PresencePublishing::T_ErrFromPlg_LeaveOnSubscribeOwnPresence_L()
+    {
+    EUNIT_PRINT( _L("Error from plug-in in presentity presence subscribe") );
+    EUNIT_PRINT( _L("Plug-in leaves from SubscribePresence().") );
+
+// BIND AND SETUP
+
+    BindL();
+
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    MXIMPContext* context = wrapper->GetContext();
+    CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+
+    CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context );
+    CleanupStack::PushL( listener2 );
+
+    // Get the interfaces
+    MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+    MPresencePublishing& presPub = presFeat->PresencePublishing();
+
+    // Create the filled interest document
+    CPresenceInfoFilterImp* pif =
+                XIMPTestPresenceDataUtils::GenerateInfoFilterLC( &KPrefix1 );
+
+// SUBSCRIBE
+
+    messenger->SetLeave( KErrAbort );
+
+    // subscribe own presence
+    TXIMPRequestId reqId = presPub.SubscribeOwnPresenceL( *pif );
+
+    // Setup status event listener for RequestComplete
+    listener2->Reset();
+    // request complete with KErrAbort
+    CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqId );
+    evReqComplete->CompletionResultImp().SetResultCode( KErrAbort );
+    listener2->ExpectL( evReqComplete );
+    CleanupStack::Pop( evReqComplete );
+
+    // Wait for events on the request
+    EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Subscribing presentity presence, didn't complete with error" );
+    
+    // verify that SubscribeOwnPresenceL was called
+    COMMONASSERT( messenger, EXIMPPlgTestSubscribeOwnPresenceCalled, "SubscribeOwnPresenceL was not called", EFalse, "SubscribeOwnPresenceL was called" );
+    
+        
+// SUBSCRIBE
+
+    messenger->SetLeave( KErrNone );
+
+    // subscribe own presence
+    reqId = presPub.SubscribeOwnPresenceL( *pif );
+
+    // Setup status event listener for RequestComplete
+    listener2->Reset();
+    evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqId );
+    listener2->ExpectL( evReqComplete );
+    CleanupStack::Pop( evReqComplete );
+
+    // Wait for events on the request
+    EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Subscribing presentity presence failed" );
+
+    // verify that SubscribeOwnPresenceL was called
+    COMMONASSERT( messenger, EXIMPPlgTestSubscribeOwnPresenceCalled, "SubscribeOwnPresenceL was not called", ETrue, "SubscribeOwnPresenceL was called" );
+    
+
+// UNSUBSCRIBE
+
+    messenger->SetLeave( KErrAbort );
+
+    // register interest
+    reqId = presPub.UnsubscribeOwnPresenceL();
+
+    // Setup status event listener for RequestComplete
+    listener2->Reset();
+    evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqId );
+    evReqComplete->CompletionResultImp().SetResultCode( KErrAbort );
+    listener2->ExpectL( evReqComplete );
+    CleanupStack::Pop( evReqComplete );
+
+    // Wait for events on the request
+    EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Unsubscribing presentity presence with error failed" );
+
+    // verify that UnsubscribeOwnPresenceL was called
+    COMMONASSERT( messenger, EXIMPPlgTestUnsubscribeOwnPresenceCalled, "UnsubscribeOwnPresenceL was not called", EFalse, 
+                                                                       "UnsubscribeOwnPresenceL was called." );
+    
+// UNBIND
+
+    CleanupStack::PopAndDestroy( pif );
+    CleanupStack::PopAndDestroy( listener2 );
+
+    messenger->SetLeave( KErrNone );
+
+    UnbindL();
+    }
+
+// ===========================================================================
+// Single client, filled filter, publish.
+// ===========================================================================
+//
+
+void T_PresencePublishing::T_SubscribeOwnPresence_Publish_Single_L()
+    {
+    EUNIT_PRINT( _L("Single interest registration with publish") );
+
+    /*
+     * TODO: 
+     *
+     * case 1
+     *
+     * - subscribetä oma presence
+     * - luo filtteri
+     * - luo info
+     * - publishaa oma presence + info
+     * - tsekkaa että alakerta on saanut infon
+     * - subscribetä uudelleen (=refresh case)
+     * - tsekkaa että kaikki ok
+     *
+     * case 2
+     *
+     * - sama filtteri kuin edellä
+     * - feikkaa verkkoserveriltä tuleva viesti, jossa sama info kuin edellä
+     * - tsekkaa, että frameworkin läpi tuleva info sisältää vain ne kamat
+     *   jotka on sallittu ja että muut on blokattu. ts. "test_service":n
+     *   "availability" pitäisi tulla läpi. person-presenceen tungettu kama jää
+     *   pois
+     *
+     */
+
+    BindL();
+
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    MXIMPContext* context = wrapper->GetContext();
+    CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+    CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context );
+    CleanupStack::PushL( listener2 );
+
+    // Get the interfaces
+    MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+    MPresencePublishing& presPub = presFeat->PresencePublishing();
+
+    // Create the filter 
+    MPresenceInfoFilter* pif = presFeat->PresenceObjectFactory().NewPresenceInfoFilterLC();
+    pif->AcceptServiceFilterL( KServiceType, NPresenceInfo::NFieldType::KAvailability ); // "test_service", "availability"
+    // note, the person info will be filtered out now since we don't accept it.
+
+    // Tell the protocol it should act normally
+    messenger->SetNoError();
+
+    // SUBSCRIBE
+
+    // subscribe own presence
+    TXIMPRequestId reqId = presPub.SubscribeOwnPresenceL( *pif );
+
+    // Setup status event listener for RequestComplete
+    CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqId );
+    listener2->ExpectL( evReqComplete );
+    CleanupStack::Pop( evReqComplete );
+
+    // Wait for events on the request
+    EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "SubscribeOwnPresence failed" );
+
+    // verify that SubscribeOwnPresenceL was called
+    COMMONASSERT( messenger, EXIMPPlgTestSubscribeOwnPresenceCalled, "SubscribeOwnPresenceL was not called", ETrue, NULL );    
+    
+    // publish own presence in here
+    MPresenceInfo* info = CreateInfoLC();
+
+    reqId = presPub.PublishOwnPresenceL( *info );
+
+    // Setup status event listener
+    evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqId );
+    listener2->ExpectL( evReqComplete );
+    CleanupStack::Pop( evReqComplete );
+    
+    CXIMPDataSubscriptionStateImp* stateImp = CXIMPDataSubscriptionStateImp::NewLC();
+    stateImp->SetDataStateL( MXIMPDataSubscriptionState::EDataAvailable );
+    stateImp->SetSubscriptionStateL( MXIMPDataSubscriptionState::ESubscriptionActive );    
+    COwnPresenceEventImp* event = COwnPresenceEventImp::NewLC( stateImp );
+    CleanupStack::Pop( 2, stateImp );
+    CleanupStack::PushL( event );    
+    listener2->ExpectL( event );
+    CleanupStack::Pop( event );
+
+    // Wait for events on the request
+    EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Publishing presence failed" );
+    COMMONASSERT( messenger, EXIMPPlgTestPublishPresenceCalled, "PublishPresenceL was not called", ETrue, NULL );
+
+    // REFRESH
+
+    // subscribe own presence (refresh)
+    reqId = presPub.SubscribeOwnPresenceL( *pif );
+
+    // Setup status event listener for RequestComplete
+    messenger->SetValueFor( EXIMPPlgTestSubscribeOwnPresenceCalled, 0 );
+    evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqId );
+    listener2->ExpectL( evReqComplete );
+    CleanupStack::Pop( evReqComplete );
+    // also the event
+    
+    stateImp = CXIMPDataSubscriptionStateImp::NewLC();
+    stateImp->SetDataStateL( MXIMPDataSubscriptionState::EDataAvailable );
+    stateImp->SetSubscriptionStateL( MXIMPDataSubscriptionState::ESubscriptionActive );    
+    event = COwnPresenceEventImp::NewLC( stateImp );
+    CleanupStack::Pop( 2, stateImp );
+    CleanupStack::PushL( event );    
+    listener2->ExpectL( event );
+    CleanupStack::Pop( event );
+
+    // Wait for events on the request
+    EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Refreshing own presence subscription failed" );
+
+    // verify that SubscribeOwnPresenceL was called
+    COMMONASSERT( messenger, EXIMPPlgTestSubscribeOwnPresenceCalled, "SubscribeOwnPresenceL was not called", EFalse, "SubscribeOwnPresenceL was called" );
+
+    CleanupStack::PopAndDestroy( 3, listener2 ); // info, pif, listener2
+    UnbindL();
+    }
+
+
+// ===========================================================================
+// SETUP HELPERS FOR THE LISTENER
+// ===========================================================================
+//
+void T_PresencePublishing::SetupListenerReqCompleteL( CXIMPTestContextWrapper* aWrapper, TXIMPTestStatusEventTemplate aEventType )
+    {
+    RArray< TInt32 > array;
+    CleanupClosePushL( array );
+    array.Append( MXIMPContextStateEvent::KInterfaceId );
+    array.Append( MOwnPresenceEvent::KInterfaceId );
+    aWrapper->SetupListenerReqCompleteL( aEventType, &array );
+    CleanupStack::PopAndDestroy(); // array
+    }
+
+void T_PresencePublishing::SetupListenerReqCompleteAllowEventsL(  CXIMPTestContextWrapper* aWrapper, TXIMPTestStatusEventTemplate aEventType )
+    {
+    RArray< TInt32 > array;
+    CleanupClosePushL( array );
+    array.AppendL( MXIMPRequestCompleteEvent::KInterfaceId );
+    array.AppendL( MXIMPContextStateEvent::KInterfaceId );
+    array.AppendL( MOwnPresenceEvent::KInterfaceId );
+    aWrapper->SetupListenerReqCompleteL( aEventType, &array );
+    CleanupStack::PopAndDestroy(); // array
+    }
+
+MPresenceInfo* T_PresencePublishing::CreateInfoLC()
+    {
+    // fill up the info structure with:
+    // service info imp: 
+    //   - info name:    "test_service"
+    //   - field name:   availability
+    //   - field value:  enum type, value 1
+    // person info imp:
+    //   - field name:   "status-message"
+    //   - field value:  "This is my status message."
+    //
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    MXIMPContext* context = wrapper->GetContext();
+
+    // Get the interface
+    MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+    MPresenceInfo* info = presFeat->PresenceObjectFactory().NewPresenceInfoLC();
+
+    // fill service info
+    MServicePresenceInfo* srvInfo = presFeat->PresenceObjectFactory().NewServicePresenceInfoLC();
+    srvInfo->SetServiceTypeL( KServiceType );  // test
+
+    MPresenceInfoField* infoField = presFeat->PresenceObjectFactory().NewInfoFieldLC();
+    
+    MPresenceInfoFieldValueEnum* enumField = presFeat->PresenceObjectFactory().NewEnumInfoFieldLC();
+    enumField->SetValueL( KTestAvailability ); // 1
+    infoField->SetFieldTypeL( NPresenceInfo::NFieldType::KAvailability ); // "availability"
+    infoField->SetFieldValue( enumField );
+    CleanupStack::Pop(); // enumField
+
+    srvInfo->Fields().AddOrReplaceFieldL( infoField );
+    CleanupStack::Pop(); // infoField 
+
+    info->AddServicePresenceL( srvInfo );
+    CleanupStack::Pop(); // srvInfo 
+
+    // fill person info
+    MPersonPresenceInfo* persInfo = presFeat->PresenceObjectFactory().NewPersonPresenceInfoLC();
+    MPresenceInfoField* infoField2 = presFeat->PresenceObjectFactory().NewInfoFieldLC();
+    
+    MPresenceInfoFieldValueText* textField = presFeat->PresenceObjectFactory().NewTextInfoFieldLC();
+    textField->SetTextValueL( KStatusMsg );
+
+    infoField2->SetFieldTypeL( NPresenceInfo::NFieldType::KStatusMessage );
+    infoField2->SetFieldValue( textField );
+    CleanupStack::Pop(); // textField
+
+    persInfo->Fields().AddOrReplaceFieldL( infoField2 );
+    CleanupStack::Pop(); // infoField2
+
+    info->SetPersonPresenceL( persInfo );
+    CleanupStack::Pop(); // persInfo
+    // that's it
+
+    return info;
+    }
+
+// ===========================================================================
+// TEST CASE TABLE
+// ===========================================================================
+//
+EUNIT_BEGIN_TEST_TABLE(
+        T_PresencePublishing,
+        "XIMP presence management tests",
+        "MODULE" )
+
+
+PRFW_DECORATED_TEST(
+        "Publish single presence",
+        "",
+        "",
+        "FUNCTIONALITY",
+        Setup_L,
+        T_Publish_Single_L,
+        Teardown )
+
+/*
+PRFW_NOT_DECORATED_TEST(
+        "Publish, error leave",
+        "",
+        "",
+        "ERRORHANDLING",
+        Setup_Bind_L,
+        T_Publish_ErrFromPlg_Leave_L,
+        Teardown_Unbind )
+
+PRFW_NOT_DECORATED_TEST(
+        "Publish, error complete",
+        "",
+        "",
+        "ERRORHANDLING",
+        Setup_Bind_L,
+        T_Publish_ErrFromPlg_CompleteWithError_L,
+        Teardown_Unbind )
+*/
+
+PRFW_DECORATED_TEST(
+        "Empty own presence subscribtion",
+        "",
+        "",
+        "FUNCTIONALITY",
+        Setup_L,
+        T_SubscribeOwnPresence_Single_Empty_L,
+        Teardown )
+
+PRFW_DECORATED_TEST(
+        "Empty own presence subscribtion for multiple clients",
+        "",
+        "",
+        "FUNCTIONALITY",
+        SetupMultiple_L,
+        T_SubscribeOwnPresence_Multiple_Empty_L,
+        Teardown )
+
+
+PRFW_DECORATED_TEST(
+        "Single own presence subscribtion",
+        "",
+        "",
+        "FUNCTIONALITY",
+        Setup_L,
+        T_SubscribeOwnPresence_Single_L,
+        Teardown )
+
+PRFW_DECORATED_TEST(
+        "Single own presence subscribtion with publish",
+        "",
+        "",
+        "FUNCTIONALITY",
+        Setup_L,
+        T_SubscribeOwnPresence_Publish_Single_L,
+        Teardown )
+
+PRFW_DECORATED_TEST(
+        "Error - Fail subscription",
+        "",
+        "",
+        "FUNCTIONALITY",
+        Setup_L,
+        T_ErrFromPlg_LeaveOnSubscribeOwnPresence_L,
+        Teardown )
+
+PRFW_DECORATED_TEST(
+        "Error - Network UnplugError",
+        "",
+        "",
+        "FUNCTIONALITY",
+        Setup_L,
+        T_NetworkUnplugError_L,
+        Teardown )
+
+/*
+PRFW_DECORATED_TEST(
+        "Error - Network UnplugError",
+        "",
+        "",
+        "FUNCTIONALITY",
+        SetupMultiple_L,
+        T_NetworkUnplugErrorMultiple_L,
+        Teardown )
+*/
+
+EUNIT_END_TEST_TABLE
+
+
+// ===========================================================================
+// TEST SUITE CONSTRUCTION
+// ===========================================================================
+//
+EXPORT_C MEUnitTest* CreateTestSuiteL()
+    {
+    return T_PresencePublishing::NewL();
+    }
+
+
+// end of file
+
+
+
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_presencepublishing/t_presencepublishing.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,135 @@
+/*
+* 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:
+*
+*/
+
+#ifndef T_PRESENCEPUBLISHING_H
+#define T_PRESENCEPUBLISHING_H
+
+
+//  EXTERNAL INCLUDES
+#include <platform/digia/eunit/ceunittestsuiteclass.h>
+#include <platform/digia/eunit/EUnitDecorators.h>
+
+#include <ximpbase.h>
+#include "prfwteststatuseventlistener.h"
+#include "prfwtestmessaging.h"
+
+class CXIMPTestContextWrapper;
+class CXIMPTestContextWrapperMgr;
+class CXIMPTestMessenger;
+
+/**
+ * XIMP Framework Eunit tests.
+ *
+ * Tests for XIMP session management services.
+ *
+ * @since S60 v4.0
+ */
+class T_PresencePublishing : public CEUnitTestSuiteClass
+    {
+
+public:
+    static T_PresencePublishing* NewL();
+    virtual ~T_PresencePublishing();
+
+
+private:
+    T_PresencePublishing();
+    void ConstructL();
+
+
+
+private:    // Test case functions
+
+    void Setup_L();
+    void SetupMultiple_L();
+    void BindL();
+    void Bind2L();
+    void BindAllL();
+    void Teardown();
+    void UnbindL();
+    void UnbindAllL();
+
+
+    //------------------------------------------
+    //Presence Publish
+    //
+    void T_Publish_Single_L();
+
+    // Maybe unneeded cases. All events should act likewise and these
+    // kind of situations are tested in t_sessionmng already.
+    void T_Publish_ErrFromPlg_Leave_L();
+    void T_Publish_ErrFromPlg_CompleteWithError_L();
+
+
+    //------------------------------------------
+    //Presence interest registration
+    //
+    void T_SubscribeOwnPresence_Single_Empty_L();
+    void T_SubscribeOwnPresence_Multiple_Empty_L();
+    void T_SubscribeOwnPresence_Single_L();
+    void T_SubscribeOwnPresence_Publish_Single_L();
+    void T_SubscribeOwnPresence_Two_Clients_L();
+    void T_ErrFromPlg_LeaveOnSubscribeOwnPresence_L();
+    void T_NetworkUnplugError_L();
+    void T_NetworkUnplugErrorMultiple_L();
+
+    // Plugin leaves with error, returns error. Same as above.
+    //void T_InterestRegistration_ErrorFromPlg_Leave_L();
+    //void T_InterestRegistration_ErrorFromPlg_Error_L();
+
+    //------------------------------------------
+    // Input data verification tests
+    // TODO when the mechanism for
+    //
+    //   Verify that plugin receives correct input data
+    //     - single publish
+    //     - single registration
+    //     - aggregated registrations
+    //   Verify that the test case received correct data (verify plugin output data)
+    //     - own presence event
+    //     - UpdatePresenceL / presentity event
+    //     - filter registration verifications on presentity events
+
+private:    // Test helpers
+
+    void SetupListenerReqCompleteL( CXIMPTestContextWrapper* aWrapper, TXIMPTestStatusEventTemplate aEventType );
+    void SetupListenerReqCompleteAllowEventsL( CXIMPTestContextWrapper* aWrapper, TXIMPTestStatusEventTemplate aEventTypes );
+    // TODO move these to some TOOL part - could be common
+    // among all components
+
+    MPresenceInfo* CreateInfoLC();
+
+private: // Test data
+
+    /**
+     * Eunit test case table declaration.
+     */
+    EUNIT_DECLARE_TEST_TABLE;
+
+    // owned
+    CXIMPTestContextWrapperMgr* iWrapperMgr;
+    };
+
+#endif      //  T_PRESENCEPUBLISHING_H
+
+
+
+// end of file
+
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_presencepublishing/t_presencepublishing.mmp	Wed Nov 03 09:32:20 2010 +0530
@@ -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:
+*
+*/
+
+#include            "../../tsrcutils/eunitcommon/eunittstdllbase.hrh"
+#include            "../../tsrcutils/processmaster/pm.h"
+
+#include<platform_paths.hrh>
+#include<eunitcaps.h>
+
+TARGET              t_presencepublishing.dll
+//CAPABILITY              ALL - TCB - DRM
+CAPABILITY      EUNIT_CAPS
+
+SOURCEPATH          .
+SOURCE              t_presencepublishing.cpp
+
+
+USERINCLUDE             ../../../../../ximpfw/core/srcdatamodel
+USERINCLUDE             ../../../../../ximpfw/presence/srcpresencedatamodel
+USERINCLUDE             ../../../../../ximpfw/presence/srcpresencedatamodel/presentitygroups
+USERINCLUDE             ../../../../../ximpfw/presence/srcpresencedatamodel/presencewatching
+USERINCLUDE             ../../../../../ximpfw/presence/srcpresencedatamodel/presenceauthorization
+USERINCLUDE             ../../../../../ximpfw/presence/srcpresencedatamodel/presencepublishing
+USERINCLUDE             ../../../../../ximpfw/presence/srcpresencedatamodel/presenceinfo
+USERINCLUDE             ../../../../../ximpfw/core/srcutils
+
+// TODO remove unnecessary
+#if defined ( OS_LAYER_SYSTEMINCLUDE )
+OS_LAYER_SYSTEMINCLUDE
+#else
+SYSTEMINCLUDE     /epoc32/include
+#endif
+
+ #if defined ( APP_LAYER_SYSTEMINCLUDE )
+ APP_LAYER_SYSTEMINCLUDE
+ #else
+ SYSTEMINCLUDE     \epoc32\include
+ #endif
+SYSTEMINCLUDE           ../../../../../ximpfw/inc/core/base
+SYSTEMINCLUDE           ../../../../../ximpfw/inc/core/datamodel
+SYSTEMINCLUDE           ../../../../../ximpfw/inc/core/protocolplugin
+SYSTEMINCLUDE           ../../../../../ximpfw/inc/core/protocolpluginhost
+SYSTEMINCLUDE           ../../../../../ximpfw/inc/presence/presencedatamodel
+SYSTEMINCLUDE           ../../../../../ximpfw/inc/presence/presencemanagement
+SYSTEMINCLUDE           ../../../../../ximpfw/inc/presence/presenceprotocolplugin
+SYSTEMINCLUDE           ../../../../../ximpfw/inc/presence/presenceprotocolpluginhost
+
+LIBRARY             ecom.lib
+LIBRARY             bafl.lib
+LIBRARY             ximpdatamodel.lib
+LIBRARY             presencedatamodel.lib
+LIBRARY             estor.lib
+LIBRARY             ximputils.lib
+LIBRARY                 EUnit.lib
+LIBRARY             eunitutil.lib
+LIBRARY             euser.lib
+// end of file
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_presencewatcherlistmngt/bld.inf	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,23 @@
+/*
+* 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 t_presencewatcherlistmngt.dll
+*
+*/
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_TESTMMPFILES
+t_presencewatcherlistmngt.mmp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_presencewatcherlistmngt/t_presencewatcherlistmngt.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,1356 @@
+/*
+* 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:
+*
+*/
+
+
+#include "eunittools.h"
+
+#include <platform/digia/eunit/eunitmacros.h>
+#include <platform/digia/eunit/teunitassertioninfo.h>
+
+
+#include <ecom/ecom.h>
+#include <badesca.h>
+
+#include <ximpbase.h>
+#include <ximpclient.h>
+#include <presencefeatures.h>
+#include <presencepublishing.h>
+#include <ximpdatasubscriptionstate.h>
+#include <presentitygroups.h>
+#include <ximpobjectfactory.h>
+#include <presencewatching.h>
+#include <presenceobjectfactory.h>
+#include <ximpcontext.h>
+#include <ximpcontextstateevent.h>
+#include <ximprequestcompleteevent.h>
+#include <ximpstatus.h>
+#include <presentitypresenceevent.h>
+#include "prfwtestpresencedatautils.h"
+
+
+
+#include "t_presencewatcherlistmngt.h"
+
+// watcher list related includes
+#include "presencewatcherinfoimp.h"
+#include "presencewatcherlisteventimp.h"
+
+// other data model includes
+#include "ximpidentityimp.h"
+#include "ximpdatasubscriptionstateimp.h"
+#include "presentitygroupmemberinfoimp.h"
+#include "presenceinfofilterimp.h"
+
+// utils includes
+#include "ximpobjecthelpers.h"
+
+#include "ximprequestcompleteeventimp.h"
+
+// testing tool includes
+#include "prfwtestmessaging.h"
+#include "prfwtestmessenger.h"
+#include "prfwtestcontextwrappermgr.h"
+#include "prfwtestcontextwrapper.h"
+#include "prfwtestwaithelper.h"
+
+#include "prfwtestfilesrvmsg.h"
+#include "prfwtestfiletool.h"
+#include "prfwtestlistener.h"
+
+#include "prfwtestrobustnesstools.h"
+
+
+
+
+
+/*#include "presenceinfoimp.h"
+#include "presenceinfofilterimp.h"
+#include "prfwtestpresencedatautils.h"
+#include "ximpidentityimp.h"
+#include "presentitygroupmemberinfoimp.h"
+#include "ximpobjecthelpers.h"
+#include "prfwtestfilesrvmsg.h"
+#include "prfwtestwaithelper.h"*/
+
+_LIT8( KPrefix1, "PreA_" );
+_LIT8( KPrefix2, "PreB_" );
+_LIT8( KPrefix3, "PreC_" );
+_LIT8( KPrefix4, "PreD_" );
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// CONSTRUCTION
+T_PresenceWatcherListManagement* T_PresenceWatcherListManagement::NewL()
+    {
+    T_PresenceWatcherListManagement* self = new( ELeave ) T_PresenceWatcherListManagement;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+
+    return self;
+    }
+
+
+T_PresenceWatcherListManagement::~T_PresenceWatcherListManagement()
+    {
+    }
+
+
+void T_PresenceWatcherListManagement::ConstructL()
+    {
+    CEUnitTestSuiteClass::ConstructL();
+    }
+
+
+T_PresenceWatcherListManagement::T_PresenceWatcherListManagement()
+    {
+    }
+
+
+
+// ===========================================================================
+// TEST CASE SETUP & TEARDOWN METHODS
+// ===========================================================================
+//
+
+void T_PresenceWatcherListManagement::Setup_L()
+    {
+        
+    __UHEAP_MARK;
+    PrfwTestRobustness::DoPreCleaning();
+
+    iWrapperMgr = CXIMPTestContextWrapperMgr::NewL();
+    iWrapperMgr->CreateWrapperL();
+    }
+
+void T_PresenceWatcherListManagement::SetupMultiple_L()
+    {
+    __UHEAP_MARK;
+    PrfwTestRobustness::DoPreCleaning();
+
+    iWrapperMgr = CXIMPTestContextWrapperMgr::NewL();
+    iWrapperMgr->CreateWrapperL();
+    iWrapperMgr->CreateWrapperL();
+    iWrapperMgr->CreateWrapperL();
+    }
+
+
+void T_PresenceWatcherListManagement::BindL()
+    {
+    CXIMPTestContextWrapper* wrapper0 = iWrapperMgr->GetWrapperL( 0 );
+
+    wrapper0->BindL( 0 );
+    }
+
+void T_PresenceWatcherListManagement::BindAllL()
+    {
+    for( TInt a = 0; a < iWrapperMgr->WrapperCount(); ++a )
+        {
+        CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a );
+        wrapper->BindL( 0 );
+        }
+    }
+
+
+void T_PresenceWatcherListManagement::Teardown()
+    {
+    delete iWrapperMgr;
+    iWrapperMgr = NULL;
+
+    REComSession::FinalClose();
+
+    PrfwTestRobustness::DoPreCleaning();
+        
+    __UHEAP_MARKEND;
+    }
+
+void T_PresenceWatcherListManagement::UnbindL()
+    {
+    // Do unbind
+    CXIMPTestContextWrapper* wrapper0 = iWrapperMgr->GetWrapperL( 0 );
+    wrapper0->UnbindL();
+    }
+
+void T_PresenceWatcherListManagement::UnbindAllL()
+    {
+    for( TInt a = 0; a < iWrapperMgr->WrapperCount(); ++a )
+        {
+        CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a );
+        wrapper->UnbindL();
+        }
+    }
+
+
+// ===========================================================================
+// TEST CASES for presentity presence subscription
+// ===========================================================================
+// Check that this don't leak memory
+void T_PresenceWatcherListManagement::T_BindUnbind_L()
+    {
+    BindL();
+    UnbindL();
+    }
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+// Subscribe, unsubscribe - Single client
+void T_PresenceWatcherListManagement::T_SubscribePresenceWatcherList_Single_L()
+    {
+
+    EUNIT_PRINT( _L("Single client presence watcher list subscription") );
+
+    BindL();
+
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    MXIMPContext* context = wrapper->GetContext();
+    CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+    CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context );
+    CleanupStack::PushL( listener2 );
+
+    // Tell the protocol it should act normally
+    messenger->SetNoError();
+
+    // Get the interfaces
+    MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+    MPresencePublishing& presPub = presFeat->PresencePublishing();
+
+    //-------------------------------------------------
+    // subscribe
+
+    // Setup status event listener for RequestComplete
+    // ---------------------------------------------
+    listener2->Reset();
+
+    // normal request complete
+    TXIMPRequestId reqIdDummy;  // not checked
+    CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+    listener2->ExpectL( evReqComplete );
+    CleanupStack::Pop( evReqComplete );
+
+
+    // Subscribe
+    TXIMPRequestId reqId = presPub.SubscribePresenceWatcherListL();
+
+    EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Subscribe failed" );
+
+    // verify that SubscribePresenceWatcherListL was called
+    COMMONASSERT( messenger, EXIMPPlgTestSubscribePresenceWatcherListCalled, "SubscribePresenceWatcherListL was not called", ETrue, NULL );
+
+    //-------------------------------------------------
+    // refresh subscribe
+
+    // Setup status event listener for RequestComplete
+    listener2->Reset();
+
+    evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+    listener2->ExpectL( evReqComplete );
+    CleanupStack::Pop( evReqComplete );
+
+    RPrWatLstInfoImpArray* currentList(NULL);
+    CPresenceWatcherListEventImp* event = CreateWatcherListEventLCX(
+        KNullDesC, KNullDesC,
+        MXIMPDataSubscriptionState::ESubscriptionActive,
+        MXIMPDataSubscriptionState::EDataUnavailable,
+        ETestPWlCurrent, currentList);
+    listener2->ExpectL( event );
+    CleanupStack::Pop(); //event 3 to go.
+    // ---------------------------------------------
+
+    // Subscribe second time
+    reqId = presPub.SubscribePresenceWatcherListL();
+
+    EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Refresh failed" );
+    CleanupStack::PopAndDestroy( 3 ); // rest of the items.
+
+    // verify that SubscribePresenceWatcherListL was called
+    COMMONASSERT( messenger, EXIMPPlgTestSubscribePresenceWatcherListCalled, "SubscribePresenceWatcherListL was not called", ETrue, NULL );
+
+
+    //-------------------------------------------------
+    // unsubscribe
+
+    // Setup status event listener for RequestComplete
+    listener2->Reset();
+
+    evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+    listener2->ExpectL( evReqComplete );
+    CleanupStack::Pop( evReqComplete );
+
+    // register interest
+    reqId = presPub.UnsubscribePresenceWatcherListL();
+
+    EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Unsubscribe failed" );
+
+    // verify that UnsubscribePresenceWatcherListL was called
+    COMMONASSERT( messenger, EXIMPPlgTestUnsubscribePresenceWatcherListCalled, "UnsubscribePresenceWatcherListL was not called", ETrue, NULL );
+
+    //-------------------------------------------------
+    // unsubscribe nonsubscribed
+
+    // Setup status event listener for RequestComplete
+    listener2->Reset();
+
+    evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+    listener2->ExpectL( evReqComplete );
+    CleanupStack::Pop( evReqComplete );
+
+    // register interest
+    reqId = presPub.UnsubscribePresenceWatcherListL();
+
+    // Wait for events on the request
+    EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Unsubscribe failed" );
+
+    // verify that UpdateInterest was called
+    COMMONASSERT( messenger, EXIMPPlgTestUnsubscribePresenceWatcherListCalled, "UnsubscribePresenceWatcherListL was not called", ETrue, NULL );
+
+
+
+    listener2->SetEventSourceL( NULL );
+
+    UnbindL();
+
+    CleanupStack::PopAndDestroy( listener2 );
+    }
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+// Subscribe, Unsubscribe - Multiple clients
+void T_PresenceWatcherListManagement::T_SubscribePresenceWatcherList_Multiple_L()
+    {
+    EUNIT_PRINT( _L("Multiple client presence watcher list subscription") );
+
+    BindAllL();
+
+    TInt countOfWrappers = iWrapperMgr->WrapperCount();
+    for( TInt a = 0; a < countOfWrappers; ++a )
+        {
+        CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a );
+        MXIMPContext* context = wrapper->GetContext();
+        CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+        // Tell the protocol it should act normally
+        messenger->SetNoError();
+
+        CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context );
+        CleanupStack::PushL( listener2 );
+
+        // Get the interfaces
+        MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+        MPresencePublishing& presPub = presFeat->PresencePublishing();
+
+        // Setup status event listener for RequestComplete
+        listener2->Reset();
+
+        TXIMPRequestId reqIdDummy;  // not checked
+        CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+        listener2->ExpectL( evReqComplete );
+        CleanupStack::Pop( evReqComplete );
+
+        // Subscribe
+        TXIMPRequestId reqId = presPub.SubscribePresenceWatcherListL();
+
+        // Wait for events on the request
+        EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Subscribe failed" );
+
+        // verify that SubscribePresenceWatcherListL was called
+        COMMONASSERT( messenger, EXIMPPlgTestSubscribePresenceWatcherListCalled, "SubscribePresenceWatcherListL was not called", ETrue, NULL );
+
+        CleanupStack::PopAndDestroy( listener2 );
+        }
+    for( TInt a = 0; a < countOfWrappers; ++a )
+        {
+        CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a );
+        MXIMPContext* context = wrapper->GetContext();
+        CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+        CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context );
+        CleanupStack::PushL( listener2 );
+
+        // Get the interfaces
+        MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+        MPresencePublishing& presPub = presFeat->PresencePublishing();
+
+        // Setup status event listener for RequestComplete
+        listener2->Reset();
+
+        TXIMPRequestId reqIdDummy;  // not checked
+        CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+        listener2->ExpectL( evReqComplete );
+        CleanupStack::Pop( evReqComplete );
+
+        // Unsubscribe
+        TXIMPRequestId reqId = presPub.UnsubscribePresenceWatcherListL();
+
+        // Wait for events on the request
+        EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Unsubscribe failed" );
+
+        // verify that unsubscribe was called
+        COMMONASSERT( messenger, EXIMPPlgTestUnsubscribePresenceWatcherListCalled,
+            "UnsubscribePresenceWatcherListL was not called",
+            ( a < 2 ) ? EFalse : ETrue,
+            "UnsubscribePresenceWatcherListL was called" );
+
+        CleanupStack::PopAndDestroy( listener2 );
+        }
+
+    UnbindAllL();
+    }
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+void T_PresenceWatcherListManagement::SubscribeL()
+    {
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    MXIMPContext* context = wrapper->GetContext();
+    CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+    // Get the interfaces
+    MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+    MPresencePublishing& presPub = presFeat->PresencePublishing();
+
+    CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context );
+    CleanupStack::PushL( listener2 );
+
+    // Setup status event listener for RequestComplete
+    listener2->Reset();
+
+    TXIMPRequestId reqIdDummy;  // not checked
+    CXIMPRequestCompleteEventImp* evReqComplete =
+                    CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+    listener2->ExpectL( evReqComplete );
+    CleanupStack::Pop( evReqComplete );
+
+    // subscribe
+    TXIMPRequestId reqId = presPub.SubscribePresenceWatcherListL();
+
+    // Wait for events on the request
+    EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Subscribe failed" );
+
+    COMMONASSERT( messenger, EXIMPPlgTestSubscribePresenceWatcherListCalled, "SubscribeWatcherListL was not called", ETrue, NULL );
+
+    CleanupStack::PopAndDestroy( listener2 );
+    }
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+void T_PresenceWatcherListManagement::UnsubscribeL()
+    {
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    MXIMPContext* context = wrapper->GetContext();
+    CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+    // Get the interfaces
+    MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+    MPresencePublishing& presPub = presFeat->PresencePublishing();
+
+    // Setup status event listener for RequestComplete
+    CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context );
+    CleanupStack::PushL( listener2 );
+
+    // Setup status event listener for RequestComplete
+    listener2->Reset();
+
+    TXIMPRequestId reqIdDummy;  // not checked
+    CXIMPRequestCompleteEventImp* evReqComplete =
+                    CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+    listener2->ExpectL( evReqComplete );
+    CleanupStack::Pop( evReqComplete );
+
+    // unsubscribe
+    TXIMPRequestId reqId = presPub.UnsubscribePresenceWatcherListL();
+
+    EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Unsbscribe failed" );
+
+    // verify that UnsubscribeWatcherListL was called
+    COMMONASSERT( messenger, EXIMPPlgTestUnsubscribePresenceWatcherListCalled, "UnsubscribeWatcherListL was not called", ETrue, NULL );
+
+    CleanupStack::PopAndDestroy( listener2 );
+
+    }
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+void T_PresenceWatcherListManagement::T_HandlePresenceWatcherList_L()
+    {
+    EUNIT_PRINT( _L("Handle presence watcher list.") );
+
+    BindL();
+    SubscribeL();
+
+    // ------------------------------------------------------
+    // some startup stuff
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    MXIMPContext* context = wrapper->GetContext();
+
+    CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context );
+    CleanupStack::PushL( listener2 );
+    // ------------------------------------------------------
+
+    // Tell the protocol it should act normally
+    wrapper->GetMessenger()->SetNoError();
+
+    // ------------------------------------------------------
+    // 1. Create faked server message about watcher list (empty)
+    SendSrvMsgL( CXIMPTestFileSrvMsg::ETestSrvMsgPresenceWatcherList );
+
+    // ------------------------------------------------------
+    // expect empty MPresencewatcherList event.
+
+    RPrWatLstInfoImpArray* currentList(NULL);
+    CPresenceWatcherListEventImp* event = CreateWatcherListEventLCX(
+            KNullDesC, KNullDesC,
+        MXIMPDataSubscriptionState::ESubscriptionActive,
+        MXIMPDataSubscriptionState::EDataAvailable,
+        ETestPWlCurrent, currentList);
+
+    listener2->ExpectL( event );
+    CleanupStack::Pop( event ); // 3 more items in cleanupstack
+
+    //Waqas: Fixed task Ticket#22
+    EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "HandlePresenceWatcherListL failed" );
+    CleanupStack::PopAndDestroy( 3 ); // lists
+    // ------------------------------------------------------
+
+
+    // ------------------------------------------------------
+    // 2. Create faked server message about watcher list (new)
+    listener2->Reset();
+
+    _LIT16( KWatcherUri1,      "http://carpe.diem.com" );
+    _LIT16( KWatcherDispName1, "DispnameA, LoremI" );
+
+    SendSrvMsgL( KWatcherUri1,
+                 KWatcherDispName1,
+                 CXIMPTestFileSrvMsg::ETestSrvMsgPresenceWatcherList );
+
+    // ------------------------------------------------------
+    // MPresencewatcherList event.
+
+    currentList = NULL; // previous one was destroyed
+    //Now create the actual event
+    event = CreateWatcherListEventLCX(  // previous event was destroyed
+            KWatcherUri1, KWatcherDispName1,
+        MXIMPDataSubscriptionState::ESubscriptionActive,
+        MXIMPDataSubscriptionState::EDataAvailable,
+        ETestPWlNew, currentList);
+    
+
+    listener2->ExpectL( event );
+    CleanupStack::Pop( event ); // 3 more items in cleanupstack
+
+    EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "HandlePresenceWatcherListL failed" );
+    CleanupStack::PopAndDestroy( 3 ); // lists
+
+
+    // ------------------------------------------------------
+    // 3. Create faked server message about watcher list (disappeared)
+    listener2->Reset();
+
+    SendSrvMsgL( CXIMPTestFileSrvMsg::ETestSrvMsgPresenceWatcherList );
+    // ------------------------------------------------------
+    // MPresencewatcherList event.
+
+    CXIMPIdentityImp* idForEvent = CXIMPIdentityImp::NewLC( KWatcherUri1 );
+    // we need to create current list to give to the event
+    currentList = new ( ELeave ) RPrWatLstInfoImpArray; // previous is destroyed
+    CleanupDeletePushL( currentList );
+            // create the group info
+    CPresenceWatcherInfoImp* watcherInfoForEvent = 
+                            CPresenceWatcherInfoImp::NewLC( (MPresenceWatcherInfo::TWatcherType)0, *idForEvent, KWatcherDispName1);
+    currentList->AppendL( watcherInfoForEvent );
+    CleanupStack::Pop( watcherInfoForEvent );
+    CleanupStack::Pop( currentList );
+    CleanupStack::PopAndDestroy( idForEvent );    
+
+
+    //Now create the actual event
+    event = CreateWatcherListEventLCX(
+            KWatcherUri1, KWatcherDispName1,
+        MXIMPDataSubscriptionState::ESubscriptionActive,
+        MXIMPDataSubscriptionState::EDataAvailable,
+        ETestPWlDisappeared, currentList);
+
+    listener2->ExpectL( event );
+    CleanupStack::Pop( event ); // 3 more items in cleanupstack
+
+    //Waqas: Fixed task Ticket#22
+    EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "HandlePresenceWatcherListL failed" );
+
+    CleanupStack::PopAndDestroy( 3 ); // lists
+
+
+    // clean it up
+    UnsubscribeL();
+    
+    /* TODO later on better time.
+    // ------------------------------------------------------
+    // 4. Create faked server message about watcher list (no subscribers to list)
+    //    Make sure no event is 
+    listener2->Reset();
+    
+    event = CreateWatcherListEventLCX(
+            KNullDesC, KNullDesC,
+            ETestPWlEmpty );
+
+    //EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "HandlePresenceWatcherListL failed" );
+
+    */
+    CleanupStack::PopAndDestroy( listener2 );
+    
+    UnbindL();
+    }
+
+////////////////////////////////////////////////////
+//// INTIA CASE 
+////////////////////////////////////////////////////
+void T_PresenceWatcherListManagement::T_IndiaCase_L()
+    {
+
+    EUNIT_PRINT( _L("Presence notification subscribed list, Intia") );
+   
+
+    BindL();
+
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    MXIMPContext* presenceCtx = wrapper->GetContext();
+    CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+    CXIMPTestListener* ctxObserver = CXIMPTestListener::NewL( presenceCtx );
+    CleanupStack::PushL( ctxObserver );  // << ctxObserver
+  
+
+    // Tell the protocol it should act normally
+    messenger->SetNoError();
+
+       // Get the interfaces
+    MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+    MPresencePublishing& presPub = presFeat->PresencePublishing();
+    MPresentityGroups& presGroups = presFeat->PresentityGroups();    
+    MPresenceWatching& presWatch = presFeat->PresenceWatching();
+    
+    MXIMPObjectFactory& objFactory = presenceCtx->ObjectFactory();
+    
+    _LIT( KGroupId, "rakesh.harsh/Friends" );
+    _LIT( KGroupDisplayName, "my_friend" );
+    _LIT( KMemberId1, "user1" );
+    _LIT( KMember1DisplayName, "user1DisplayName" );
+    _LIT( KMemberId2, "user2" );
+    _LIT( KMember2DisplayName, "user2DisplayName" );
+    
+    
+    // Create test variables
+    MXIMPIdentity* testGroupId = objFactory.NewIdentityLC();   // << testGroupId
+    testGroupId->SetIdentityL( KGroupId ); 
+        
+    MXIMPIdentity* member1 = objFactory.NewIdentityLC(); // << member1
+    member1->SetIdentityL( KMemberId1 );
+    
+    MXIMPIdentity* member2 = objFactory.NewIdentityLC(); // << member2
+    member2->SetIdentityL( KMemberId2 );
+    
+    //////////////////////////////////////////////////////////////////////////
+    // SUBSCRIBE PRESENTITY GROUP LIST
+    //////////////////////////////////////////////////////////////////////////
+    
+    // Setup status event listener for RequestComplete
+    TXIMPRequestId reqId;  
+    ctxObserver->Reset();
+    CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqId );// << evReqComplete
+    ctxObserver->ExpectL( evReqComplete );
+    CleanupStack::Pop( evReqComplete ); // >> evReqComplete 
+    
+    SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk );
+    
+    // subscribe PresentityGroupList
+    reqId = presGroups.SubscribePresentityGroupListL();
+    
+    // Wait for events on the request
+    wrapper->WaitRequestAndStackEvents( reqId );
+    wrapper->VerifyEventStackL( _L8("Subscribing presentity group list, complete with error: ") );
+    
+    // verify that SubscribePresentityGroupListL was called
+    messenger->AssertSubscribePresentityGroupListCalled( ETrue );
+    
+    
+    // get list request
+/*    TXIMPRequestId req = presGroups.SubscribePresentityGroupListL(); 
+    ctxObserver->WaitOpToCompleteL( req );
+
+    CUserAfter::AfterL( 1000000 );
+*/
+    
+    //////////////////////////////////////////////////////////////////////////
+    // SUBSCRIBE PRESENTITY GROUP CONTENT
+    //////////////////////////////////////////////////////////////////////////    
+
+    // Setup status event listener for RequestComplete
+    ctxObserver->Reset();
+    evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqId );
+    ctxObserver->ExpectL( evReqComplete );
+    CleanupStack::Pop( evReqComplete );
+    SetupListenerReqCompleteL( wrapper, EXIMPTestStatusEvents_RequestOk );
+            
+    // subscribe group content
+    reqId = presGroups.SubscribePresentityGroupContentL( *testGroupId );
+    
+    // Wait for events on the request
+    wrapper->WaitRequestAndStackEvents( reqId );
+    wrapper->VerifyEventStackL( _L8("Subscribe presentity group content, complete with error: ") );
+
+    COMMONASSERT( messenger, EXIMPPlgTestSubscribePresentityGroupContentCalled, "SubscribeGroupContentL was not called", ETrue, NULL );
+    
+/*    TInt count = ctxObserver->gidcount;
+    // List manage request
+     for(TInt i = 0; i<count;i++)
+     { 
+      //get the content of the lists
+       MXIMPIdentity*   tgid = objFactory.NewIdentityLC();
+     tgid->SetIdentityL( ctxObserver->gid[i] ); 
+    // tgid->SetIdentityL( _L("rakesh.harsh/basu2@nokia.com") );
+      
+      TXIMPRequestId  req = presGroups.SubscribePresentityGroupContentL( *tgid );
+    
+      ctxObserver->WaitOpToCompleteL( req );
+    
+      CleanupStack::PopAndDestroy( 1 ); //  tgid
+     }  */
+     
+    //////////////////////////////////////////////////////////////////////////
+    // CREATE PRESENTITY GROUP
+    /////////////////////////////////////////////////////////////////////////
+    
+    // Setup status event listener for RequestComplete
+    // This will also produce HandlePresentityGroupListEvent, since the
+    // the group is subscribed 
+    ctxObserver->Reset();
+    evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqId );
+    ctxObserver->ExpectL( evReqComplete );
+    CleanupStack::Pop( evReqComplete );//TODO???
+
+    SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk );
+
+    // Create group
+    reqId = presGroups.CreatePresentityGroupL( *testGroupId, KGroupDisplayName );
+    
+    // Wait for events on the request
+    wrapper->WaitRequestAndStackEvents( reqId );
+    wrapper->VerifyEventStackL( _L8("CreatePresentityGroupL failed, complete with error: ") );
+    
+    // verify that SubscribePresentityGroupListL was called
+    messenger->AssertCreatePresentityGroupCalled( ETrue );
+
+    
+                   
+    // first make a test group in our roster
+ /*   MXIMPIdentity* newGroupId = objFactory.NewIdentityLC();//1
+    newGroupId->SetIdentityL( _L("rakesh.harsh/Friends") );
+
+    req = presGroups.CreatePresentityGroupL( *newGroupId,_L("my_friend") );
+    // wait completion
+    ctxObserver->WaitOpToCompleteL( req );
+      
+    CUserAfter::AfterL( 1000000 );*/
+    
+    //////////////////////////////////////////////////////////////////////////
+    // ADD PRESENTITY GROUP MEMBER
+    ////////////////////////////////////////////////////////////////////////// 
+    
+    // Setup event listener for RequestComplete
+    ctxObserver->Reset();
+    evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqId ); // << evReqComplete
+
+    // group id
+    CXIMPIdentityImp* grid = CXIMPIdentityImp::NewLC( testGroupId->Identity() ); // << grid
+    evReqComplete->AppendParamL( grid );
+    CleanupStack::Pop(); // >> grid
+
+    // id for member info
+    CXIMPIdentityImp* miId = CXIMPIdentityImp::NewLC( KMemberId1 ); // << miId
+    // member info
+    CPresentityGroupMemberInfoImp* memInfoImp =
+        CPresentityGroupMemberInfoImp::NewLC( *miId, KMember1DisplayName ); // << memInfoImp
+    evReqComplete->AppendParamL( memInfoImp );
+    CleanupStack::Pop(); // memInfoImp owned by AppendParamL    // >> memInfoImp
+    CleanupStack::PopAndDestroy( miId ); // copy was made   // >>> miId
+
+    ctxObserver->ExpectL( evReqComplete );
+    CleanupStack::Pop( evReqComplete ); // >> evReqComplete
+
+    // do the call
+    reqId = presGroups.AddPresentityGroupMemberL(
+            *testGroupId, *member1, KMember1DisplayName );
+
+    // Wait for events on the request
+    wrapper->WaitRequestAndStackEvents( reqId );
+    messenger->AssertAddPresentityGroupMemberCalled( ETrue );
+
+ 
+    //add a member
+/*    MXIMPIdentity* testContactId = objFactory.NewIdentityLC();
+    testContactId->SetIdentityL( _L("mukesh") );
+    req = presGroups.AddPresentityGroupMemberL( *newGroupId,
+                                                *testContactId,
+                                                _L("h2") );
+    // wait completion
+    ctxObserver->WaitOpToCompleteL( req );
+    
+    
+    CUserAfter::AfterL( 1000000 );*/
+    
+    
+    //////////////////////////////////////////////////////////////////////////
+    // ADD PRESENTITY GROUP MEMBER
+    ////////////////////////////////////////////////////////////////////////// 
+
+    // Setup event listener for RequestComplete
+    ctxObserver->Reset();
+    evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqId ); // << evReqComplete
+
+    // group id
+    CXIMPIdentityImp* grid2 = CXIMPIdentityImp::NewLC( testGroupId->Identity() );
+    evReqComplete->AppendParamL( grid2 );
+    CleanupStack::Pop(); // grid2
+
+    // id for member info
+    CXIMPIdentityImp* miId2 = CXIMPIdentityImp::NewLC( KMemberId2 );
+    // member info
+    CPresentityGroupMemberInfoImp* memInfoImp2 =
+        CPresentityGroupMemberInfoImp::NewLC( *miId2, KMember2DisplayName );
+    evReqComplete->AppendParamL( memInfoImp2 );
+    CleanupStack::Pop(); // memInfoImp owned by AppendParamL
+    CleanupStack::PopAndDestroy( miId2 ); // copy was made
+
+    ctxObserver->ExpectL( evReqComplete );
+    CleanupStack::Pop( evReqComplete );
+    // reset the variable
+    messenger->SetValueFor( EXIMPPlgTestAddPresentityGroupMemberCalled, 0 );
+    // do the call
+    reqId = presGroups.AddPresentityGroupMemberL(
+            *testGroupId, *member2, KMember2DisplayName );
+
+    // Wait for events on the request
+    wrapper->WaitRequestAndStackEvents( reqId );
+    messenger->AssertAddPresentityGroupMemberCalled( ETrue );
+
+    
+/*    testContactId->SetIdentityL( _L("bb0") );
+    req = presGroups.AddPresentityGroupMemberL( *newGroupId,
+                                                *testContactId,
+                                                _L("b1") );
+    // wait completion
+    ctxObserver->WaitOpToCompleteL( req );
+    
+*/    
+    //////////////////////////////////////////////////////////////////////////
+    // SUBSCRIBE PRESENTITY GROUP MEMBERS PRESENCE
+    ////////////////////////////////////////////////////////////////////////// 
+        
+    // Setup status event listener for RequestComplete
+    ctxObserver->Reset();
+    evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqId );
+    ctxObserver->ExpectL( evReqComplete );
+    CleanupStack::Pop( evReqComplete );
+    SetupListenerReqCompleteL( wrapper, EXIMPTestStatusEvents_RequestOk );
+
+    
+    // Set filter for the group
+    MPresenceInfoFilter* gpif = presFeat->PresenceObjectFactory().NewPresenceInfoFilterLC();
+    gpif->AcceptPersonFilterL( NPresenceInfo::NFieldType::KStatusMessage  );
+    gpif->AcceptPersonFilterL( NPresenceInfo::NFieldType::KAvatar );
+
+    // register interest
+    reqId = presWatch.SubscribePresentityGroupMembersPresenceL( *testGroupId, *gpif );
+    
+    CleanupStack::PopAndDestroy(); // >>> gpif
+
+    // Wait for events on the request
+    wrapper->WaitRequestAndStackEvents( reqId );
+    wrapper->VerifyEventStackL( _L8("Subscribe presentity group members, complete with error: ") );
+        
+    // verify that UpdateInterest was called
+    COMMONASSERT( messenger, EXIMPPlgTestSubscribePresentityGroupMembersPresesenceCalled, "SubscribePresentityGroupMembersPresenceL was not called", ETrue, NULL );
+
+     
+
+/*    CUserAfter::AfterL( 1000000 );
+    MPresenceWatching& presWatch = presenceCtx->PresenceWatching();
+    MPresenceInfoFilter* infoFilt = objFactory.NewPresenceInfoFilterLC();
+    req = presWatch.SubscribePresentityGroupMembersPresenceL( *newGroupId, *infoFilt );
+    // wait completion
+    ctxObserver->WaitOpToCompleteL( req );
+    
+   // req = presWatch.SubscribePresentityPresenceL( *testContactId, *infoFilt );
+    // wait completion
+   // ctxObserver->WaitOpToCompleteL( req );
+    //MXIMPClient* presClient1 = NULL;
+   // MXIMPContext* presenceCtx1 = NULL;
+    //CUSContextObserver* ctxObserver1  = NULL;
+    
+    /*TInt pushCount1 = DoSetupDefaultContext1LC( presClient1,
+                                              presenceCtx1,
+                                              ctxObserver1 );
+    
+    ctxObserver->WaitOpToCompleteL( req );*/
+ //   CUserAfter::AfterL( 60000000 ); //60 seconds
+    
+    /*if ( !iWait.IsStarted() )
+			{    
+			iWait.Start();  // CSI: 10 # iWait is not an active object
+			}
+     */
+    //code is for login with diff id 
+     //Initialize XIMP client
+ /*  #if 0
+    MXIMPClient* presClient1 = MXIMPClient::NewClientL();
+    CleanupDeletePushL( presClient );
+      
+    //Create new sink to receive presence context events
+    CUSContextObserver* eventObserver1 = CUSContextObserver::NewLC();
+
+    //Create new presence context
+    MXIMPContext* presecenCtx1 = presClient->NewPresenceContextLC();
+    presecenCtx1->RegisterObserverL( *eventObserver1 );
+
+    //Bind context to desired presence service
+    TUid protocolUid = TUid::Uid( KProtocolUid );
+
+
+    //Bind context to desired presence service
+     req = presecenCtx1->BindToL( protocolUid,
+                                               KServerAddress,
+                                               KUserName2,
+                                               KPassword2,
+                                               KIAP );
+ 
+    //Wait with CActiveSchedulerWait the binding to complete
+    //If binding fails, it is handled with leave
+    eventObserver1->WaitOpToCompleteL( req );
+    MXIMPIdentity* newGroupId1 = objFactory.NewIdentityLC();//1
+    newGroupId1->SetIdentityL( _L("bb0/jaya") );
+
+     req = presGroups.CreatePresentityGroupL( *newGroupId1,_L("my_sweety") );
+    // wait completion
+    ctxObserver->WaitOpToCompleteL( req );
+      
+    CUserAfter::AfterL( 1000000 );
+    presecenCtx1->UnbindL();
+    eventObserver1->WaitOpToCompleteL( req );
+    CleanupStack::PopAndDestroy( 4 ); //newGroupId1,presecenCtx1,eventObserver1,presClient1
+    
+    #endif*/
+    //code is for login with diff id end
+    
+    //add this user to bb0's contact list.i should  recieve notification
+    
+    //   delete group friend which is created above statement 
+    //req = presGroups.DeletePresentityGroupL( *newGroupId );
+    // wait completion
+   // ctxObserver->WaitOpToCompleteL( req );
+ //   CUserAfter::AfterL( 60000000 );
+    //Unbind the context and wait completion
+  //  req = presenceCtx->UnbindL();
+  //  ctxObserver->WaitOpToCompleteL( req );
+
+    //Destroy the context (it is automaticly unbind)
+ //   CleanupStack::PopAndDestroy( 3 ); //  infoFilt,testContactId,newGroupId
+ //   CleanupStack::PopAndDestroy( pushCount );	
+ 
+ 
+    //////////////////////////////////////////////////////////////////////////
+    // SEND DATA FOR GROUP MEMBER -> HANDLE PRESENTITY PRESENCE
+    ////////////////////////////////////////////////////////////////////////// 
+
+     
+     // create test message
+    CPresenceInfoImp* presenceInfo = CPresenceInfoImp::NewLC(); // << presenceInfo
+    HBufC8* packedInfo = TXIMPObjectPacker< CPresenceInfoImp >::PackL( *presenceInfo );
+    CleanupStack::PopAndDestroy( presenceInfo );// >>> presenceInfo
+    CleanupStack::PushL( packedInfo );  // << packedInfo
+    
+    CXIMPIdentityImp* changed = CXIMPIdentityImp::NewLC( ); // << changed
+    changed->SetIdentityL( KMemberId1 );
+    HBufC8* packedId = TXIMPObjectPacker< CXIMPIdentityImp >::PackL( *changed );
+    CleanupStack::PopAndDestroy(); // >>> changed
+    CleanupStack::PushL( packedId );// << packedId
+    
+    RPointerArray< HBufC8 > bufferArray;
+    CleanupClosePushL( bufferArray );   // << bufferArray
+    bufferArray.AppendL( packedId );
+    bufferArray.AppendL( packedInfo );
+    
+    HBufC8* packedBufferArray = TXIMPHBuf8Packer::PackArrayL( bufferArray );
+    CleanupStack::PopAndDestroy( 2 ); // >>> packedId, packedInfo
+    CleanupStack::PopAndDestroy(); // >>> bufferArray
+    CleanupStack::PushL( packedBufferArray );   // << packedBufferArray
+    
+    // Send it to plugin 
+    CXIMPTestFileSrvMsg* srvMsg = CXIMPTestFileSrvMsg::NewL( CXIMPTestFileSrvMsg::ETestSrvMsgPresentityPresence, 
+                                                             *packedBufferArray );
+    CleanupStack::PopAndDestroy( packedBufferArray );   // >>> packedBufferArray
+    
+    CleanupStack::PushL( srvMsg );  // << srvMsg
+    wrapper->FileTool().SrvMsgStoreL( srvMsg );
+    CleanupStack::PopAndDestroy( srvMsg );  // >>> srvMsg
+    wrapper->FileTool().CleanAllL();
+
+    // Wait for server to handle srvmsg.
+    User::After( 4 * 1000000 );       
+
+    COMMONASSERT( messenger, EXIMPPlgTestHandlePresentityPresenceCalled, "HandlePresentityPresenceL was not called", ETrue, NULL );
+
+    CleanupStack::PopAndDestroy( 3 ); // >>> testGroupId, member1, member2
+    CleanupStack::PopAndDestroy( ctxObserver ); // >>> ctxObserver
+    
+    UnbindL(); 
+
+}
+// ===========================================================================
+// SETUP HELPERS FOR THE LISTENER
+// ===========================================================================
+//
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+// send a faked server-originated message with watcher info made
+// from the given uri and displayname
+//
+void T_PresenceWatcherListManagement::SendSrvMsgL(
+        const TDesC& aUri, const TDesC& aDispName,
+        TInt aMsgType )
+    {
+    // we'll use hard-coded wrapper 0 instance for now.
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+
+    // create a grant req info contained within the server-originated
+    // faked message
+    RXIMPObjOwningPtrArray<CPresenceWatcherInfoImp> watcherList;
+    CleanupClosePushL( watcherList );
+
+    CXIMPIdentityImp* watcherId = CXIMPIdentityImp::NewLC( aUri );
+    CPresenceWatcherInfoImp* watcherItem =
+                CPresenceWatcherInfoImp::NewLC(
+                            (MPresenceWatcherInfo::TWatcherType)0,
+                            *watcherId,
+                            aDispName );
+    watcherList.AppendL( watcherItem );
+    CleanupStack::Pop( watcherItem );
+    CleanupStack::PopAndDestroy( watcherId );
+
+    HBufC8* packedArray =
+        TXIMPObjectPacker<CPresenceWatcherInfoImp>::PackArrayL( watcherList );
+    CleanupStack::PushL( packedArray );
+
+    // use filetool to send it for plugin.
+    CXIMPTestFileSrvMsg* srvMsg = CXIMPTestFileSrvMsg::NewL( aMsgType,
+            *packedArray );
+    CleanupStack::PushL( srvMsg );
+    wrapper->FileTool().CleanAllL();
+    wrapper->FileTool().SrvMsgStoreL( srvMsg );
+    CleanupStack::PopAndDestroy( 3 ); // srvMsg, packedArray, watcherList
+    }
+
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+// send a faked server-originated message with empty contents
+//
+void T_PresenceWatcherListManagement::SendSrvMsgL( TInt aMsgType )
+    {
+    // we'll use hard-coded wrapper 0 instance for now.
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+
+    // create a server-originated faked message with empty contents
+    RXIMPObjOwningPtrArray<CPresenceWatcherInfoImp> watcherList;
+
+    HBufC8* packedArray = TXIMPObjectPacker<CPresenceWatcherInfoImp>::PackArrayL( watcherList );
+    CleanupStack::PushL( packedArray );
+
+    // use filetool to send it for plugin.
+    CXIMPTestFileSrvMsg* srvMsg = CXIMPTestFileSrvMsg::NewL( aMsgType,
+            *packedArray );
+    CleanupStack::PushL( srvMsg );
+    wrapper->FileTool().CleanAllL();
+    wrapper->FileTool().SrvMsgStoreL( srvMsg );
+    CleanupStack::PopAndDestroy( 2 ); // srvMsg, packedArray
+    }
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+// create a watcher list event with given arrays
+//
+CPresenceWatcherListEventImp* T_PresenceWatcherListManagement::CreateWatcherListEventLCX(
+        const TDesC& aUri,
+        const TDesC& aDispName,
+            MXIMPDataSubscriptionState::TSubscriptionState aSubscriptionState,
+            MXIMPDataSubscriptionState::TDataState aDataState,
+            TTestPWlOperation aOperation,
+            RPrWatLstInfoImpArray* aCurrentList)
+    {
+    // create the arrays
+
+
+    // new list
+    RPrWatLstInfoImpArray* newList = new ( ELeave ) RPrWatLstInfoImpArray;
+    CleanupDeletePushL( newList );
+
+    // current list, created by caller
+    if(!aCurrentList) // if client didnt created the list
+        aCurrentList = new ( ELeave ) RPrWatLstInfoImpArray;
+    CleanupDeletePushL( aCurrentList );
+
+    // disappeared list
+    RPrWatLstInfoImpArray* disappearedList = new ( ELeave ) RPrWatLstInfoImpArray;
+    CleanupDeletePushL( disappearedList );
+
+    // create the watcher info
+    CPresenceWatcherInfoImp* watcherInfoForEvent1 = NULL; 
+            {
+            CXIMPIdentityImp* idForEvent = CXIMPIdentityImp::NewLC( aUri );
+            watcherInfoForEvent1 = CPresenceWatcherInfoImp::NewLC( (MPresenceWatcherInfo::TWatcherType)0, *idForEvent, aDispName );
+            CleanupStack::Pop( watcherInfoForEvent1 );        
+            CleanupStack::PopAndDestroy( idForEvent ); 
+            CleanupStack::PushL( watcherInfoForEvent1 );        
+            }
+    
+    CPresenceWatcherInfoImp* watcherInfoForEvent2 = 
+            TXIMPObjectCloner< CPresenceWatcherInfoImp >::CloneLC( *watcherInfoForEvent1 );
+    
+    TInt count(0);
+    TBool found(EFalse);
+    TInt i(0);
+    
+    // put the given watcher info into the specified array
+    switch ( aOperation )
+        {
+        case ETestPWlNew:
+            {
+            newList->AppendL( watcherInfoForEvent2 );
+            CleanupStack::Pop( watcherInfoForEvent2 );
+            
+            aCurrentList->AppendL( watcherInfoForEvent1 );
+            CleanupStack::Pop( watcherInfoForEvent1 );
+            }
+            break;
+        case ETestPWlCurrent:
+            {
+            // don't add, thus return what user has given
+            CleanupStack::PopAndDestroy( watcherInfoForEvent2 ); // watcherInfoForEvent2
+            CleanupStack::PopAndDestroy( watcherInfoForEvent1 ); // watcherInfoForEvent1
+            }
+            break;
+        case ETestPWlDisappeared:
+            {
+            // search the given id in current list
+            count = aCurrentList->Count();
+            for(i=0;i<count;i++)
+                {
+                // if dispname and id are same
+                if (( ((((*aCurrentList)[i])->WatcherId()).Identity()) == aUri )
+                    && ( (((*aCurrentList)[i])->WatcherDisplayName()) == aDispName ))
+                    {
+                    found = ETrue;
+            break;            
+                    }
+                }
+            if(found) // do we need to leave if error? Waqas
+            {
+                delete (*aCurrentList)[i];
+                aCurrentList->Remove(i);
+                disappearedList->AppendL( watcherInfoForEvent2 );
+                CleanupStack::Pop( watcherInfoForEvent2 );
+                }
+            else
+                CleanupStack::PopAndDestroy( watcherInfoForEvent2 );
+            
+            CleanupStack::PopAndDestroy( watcherInfoForEvent1 );
+            }
+            break;
+        default:
+            {
+            User::Leave( KErrArgument );
+            }
+            break;            
+        };
+
+    CXIMPDataSubscriptionStateImp* stateImp = CXIMPDataSubscriptionStateImp::NewLC();
+    stateImp->SetDataStateL( aDataState );
+    stateImp->SetSubscriptionStateL( aSubscriptionState );
+    CleanupStack::Pop( stateImp );
+
+    // create the actual event
+    CPresenceWatcherListEventImp* tmp =
+        CPresenceWatcherListEventImp::NewLC(
+                newList,
+                aCurrentList,
+                disappearedList,
+                stateImp );
+     
+
+    /*
+     * In cleanupstack there are 4 items, FIFO
+     *   - new list
+     *   - current list
+     *   - disappeared list
+     *   - event imp
+     */
+
+    return tmp;
+    }
+
+void T_PresenceWatcherListManagement::SetupListenerReqCompleteL( CXIMPTestContextWrapper* aWrapper, TXIMPTestStatusEventTemplate aEventType )
+    {
+    RArray< TInt32 > array;
+    CleanupClosePushL( array );
+    array.AppendL( MXIMPRequestCompleteEvent::KInterfaceId );
+    array.Append( MXIMPContextStateEvent::KInterfaceId );
+    array.Append( MPresentityPresenceEvent::KInterfaceId );
+    aWrapper->SetupListenerReqCompleteL( aEventType, &array );
+    CleanupStack::PopAndDestroy(); // array
+    }
+
+void T_PresenceWatcherListManagement::SetupListenerReqCompleteAllowEventsL(  CXIMPTestContextWrapper* aWrapper, TXIMPTestStatusEventTemplate aEventType )
+    {
+    RArray< TInt32 > array;
+    CleanupClosePushL( array );
+    array.AppendL( MXIMPRequestCompleteEvent::KInterfaceId );
+    array.AppendL( MXIMPContextStateEvent::KInterfaceId );
+    array.AppendL( MPresentityPresenceEvent::KInterfaceId );
+    aWrapper->SetupListenerReqCompleteL( aEventType, &array );
+    CleanupStack::PopAndDestroy(); // array
+    }
+
+// ===========================================================================
+// EVENT OBSERVER METHODS
+// ===========================================================================
+//
+void T_PresenceWatcherListManagement::HandlePresenceContextEvent(
+    const MXIMPContext& aContext,
+    const MXIMPBase& aEvent )
+    {
+    iLastError = KErrNone;
+    TInt ifId = aEvent.GetInterfaceId();
+    TInt gg = MPresentityPresenceEvent::KInterfaceId;
+    if( ifId == MPresenceWatcherListEvent::KInterfaceId )
+        {
+        const MPresenceWatcherListEvent* watcherListEvent = 
+        TXIMPGetInterface< const MPresenceWatcherListEvent >::From( aEvent, MXIMPBase::EPanicIfUnknown );
+        
+        if( watcherListEvent->NewWatchersCount() )
+            {
+            iLastEvent = EWatcherList;
+            TInt count = watcherListEvent->NewWatchersCount();
+            for( TInt a = 0; a < count; ++a )
+                {
+                TRAPD( error,
+                    CPresenceWatcherInfoImp* watcherInfo = CPresenceWatcherInfoImp::NewLC(
+                        watcherListEvent->NewWatcher( a ).WatcherType(),
+                        watcherListEvent->NewWatcher( a ).WatcherId(),
+                        watcherListEvent->NewWatcher( a ).WatcherDisplayName() );
+                    iValidateArray.AppendL( watcherInfo );
+                    CleanupStack::Pop( watcherInfo );
+                    );
+                if( error != KErrNone )
+                    {
+                    iLastError = error;
+                    return;
+                    }
+                }
+            }
+            }
+    else if( ifId == MPresentityPresenceEvent::KInterfaceId )
+        {
+        const MPresentityPresenceEvent* presentityPresenceEvent = 
+        TXIMPGetInterface< const MPresentityPresenceEvent >::From( aEvent, MXIMPBase::EPanicIfUnknown );
+        const MXIMPIdentity& prId = presentityPresenceEvent->PresentityId();
+        const MPresenceInfo& prPif = presentityPresenceEvent->SubscribedPresence(); 
+        const MXIMPDataSubscriptionState& prDataStae =  presentityPresenceEvent->DataSubscriptionState();
+        }
+    else
+        {
+        iLastEvent = EInvalid;
+        }
+    }
+
+// ===========================================================================
+// TEST CASE TABLE
+// ===========================================================================
+//
+EUNIT_BEGIN_TEST_TABLE(
+        T_PresenceWatcherListManagement,
+        "XIMP presence watching tests",
+        "MODULE" )
+
+PRFW_DECORATED_TEST(
+        "Bind Unbind",
+        "",
+        "",
+        "FUNCTIONALITY",
+        Setup_L,
+        T_BindUnbind_L,
+        Teardown )
+
+PRFW_DECORATED_TEST(
+        "Single client watcher list subscription",
+        "",
+        "",
+        "FUNCTIONALITY",
+        Setup_L,
+        T_SubscribePresenceWatcherList_Single_L,
+        Teardown )
+
+PRFW_DECORATED_TEST(
+        "Multiple client watcher list subscription",
+        "",
+        "",
+        "FUNCTIONALITY",
+        SetupMultiple_L,
+        T_SubscribePresenceWatcherList_Multiple_L,
+        Teardown )
+
+PRFW_DECORATED_TEST(
+        "Handle Presence Watcher List",
+        "",
+        "",
+        "FUNCTIONALITY",
+        Setup_L,
+        T_HandlePresenceWatcherList_L,
+        Teardown )
+        
+ PRFW_DECORATED_TEST(
+        "Test India Case",
+        "",
+        "",
+        "FUNCTIONALITY",
+        Setup_L,
+        T_IndiaCase_L,
+        Teardown )
+
+
+EUNIT_END_TEST_TABLE
+
+
+// ===========================================================================
+// TEST SUITE CONSTRUCTION
+// ===========================================================================
+//
+EXPORT_C MEUnitTest* CreateTestSuiteL()
+    {
+    return T_PresenceWatcherListManagement::NewL();
+    }
+
+
+// end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_presencewatcherlistmngt/t_presencewatcherlistmngt.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,183 @@
+/*
+* 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:
+*
+*/
+
+#ifndef T_PRESENCEWATCHERLISTMANAGEMENT_H
+#define T_PRESENCEWATCHERLISTMANAGEMENT_H
+
+
+//  EXTERNAL INCLUDES
+#include <platform/digia/eunit/ceunittestsuiteclass.h>
+#include <platform/digia/eunit/EUnitDecorators.h>
+
+#include <ximpbase.h>
+#include <ximpcontextobserver.h>
+#include "presencetypehelpers.h"
+#include "prfwteststatuseventlistener.h"
+#include "prfwtestmessaging.h"
+
+class CXIMPTestContextWrapper;
+class CXIMPTestContextWrapperMgr;
+class CXIMPTestMessenger;
+class CPresenceWatcherInfoImp;
+class CPresenceWatcherListEventImp;
+
+/**
+ * XIMP Framework Eunit tests.
+ *
+ * Tests for XIMP presence watcher list.
+ *
+ * @since S60 v4.0
+ */
+class T_PresenceWatcherListManagement : public CEUnitTestSuiteClass, 
+    public MXIMPContextObserver
+    {
+
+public:
+    static T_PresenceWatcherListManagement* NewL();
+    virtual ~T_PresenceWatcherListManagement();
+
+
+private:
+    T_PresenceWatcherListManagement();
+    void ConstructL();
+
+    enum TValidateType
+        {
+        EWatcherList,
+        EInvalid = 1000
+        };
+
+private:    // Test case functions
+
+    void Setup_L();
+    void SetupMultiple_L();
+    void BindL();
+    void BindAllL();
+    void Teardown();
+    void UnbindL();
+    void UnbindAllL();
+    void SubscribeL();
+    void UnsubscribeL();
+
+    void T_BindUnbind_L();
+    void T_SubscribePresenceWatcherList_Single_L();
+    void T_SubscribePresenceWatcherList_Multiple_L();
+    void T_HandlePresenceWatcherList_L();
+    void T_IndiaCase_L();
+    void SetupListenerReqCompleteL( CXIMPTestContextWrapper* aWrapper, 
+    TXIMPTestStatusEventTemplate aEventType );
+
+    void SetupListenerReqCompleteAllowEventsL(  CXIMPTestContextWrapper* aWrapper, 
+            TXIMPTestStatusEventTemplate aEventType );
+
+    //TBool ValidateWatcherListEvent( RXIMPObjOwningPtrArray<CPresenceWatcherInfoImp>& aExpectedArray, TValidateType aType );
+
+
+private: // From MXIMPContextObserver
+
+    void HandlePresenceContextEvent(
+                const MXIMPContext& aContext,
+                const MXIMPBase& aEvent );
+
+
+private:    // Test helpers
+
+    /**
+     * Fake a server-originated (=mobile terminated) message.
+     * The message appears to adaptation and framework as if
+     * it came from the network. Uses only one group.
+     * @param aUri The URI of group
+     * @param aDispName The display name for the group
+     * @param aMsgType The message type for CXIMPTestFileSrvMsg
+     */
+    void SendSrvMsgL(
+            const TDesC& aUri, const TDesC& aDispName,
+            TInt aMsgType );
+
+    /**
+     * Fake a server-originated message with empty content.
+     * Whether to use this depends on the event you expect.
+     * @see SendSrvMsgL
+     */
+    void SendSrvMsgL( TInt aMsgType );
+
+    // @see below
+    enum TTestPWlOperation
+        {
+        ETestPWlNew = 0,       // new watchers
+        ETestPWlCurrent,        // current watchers
+        ETestPWlDisappeared    // disappeared watchers
+        };
+
+
+    /**
+     * Creates an event for new watcher, current, or disappred presence watcher
+     * list. The caller provides an identity and current presence watcher list.
+     * Depending on the provided operation an event is created. 
+     *
+     * In cleanupstack there are 4 items, FIFO:
+     *   - new list
+     *   - current list
+     *   - disappeared list
+     *   - event imp
+     *
+     * This is because this event won't take ownership to the arrays
+     * when created this way.
+     *
+     * @param aUri Uri
+     * @param aDispName Displayname
+     * @param aOperation operation for which caller wants to generates event
+     * @param aCurrentList Current watcher list provided by caller, method takes
+     *         ownership of the current list, and it is included in above 3 lists.
+     *         a NULL pointer with operation ETestPWlCurrent causes empty event.
+     * @return The suitably filled event.
+     */
+    CPresenceWatcherListEventImp* CreateWatcherListEventLCX(
+            const TDesC& aUri,
+            const TDesC& aDispName,
+            MXIMPDataSubscriptionState::TSubscriptionState aSubscriptionState,
+            MXIMPDataSubscriptionState::TDataState aDataState,
+            TTestPWlOperation aOperation,
+            RPrWatLstInfoImpArray* aCurrentList = NULL
+            );
+
+
+private: // Test data
+
+    /**
+     * Eunit test case table declaration.
+     */
+    EUNIT_DECLARE_TEST_TABLE;
+
+    // owned
+    CXIMPTestContextWrapperMgr* iWrapperMgr;
+
+    //
+    TValidateType iLastEvent;
+    TInt iLastError;
+    RXIMPObjOwningPtrArray< CPresenceWatcherInfoImp > iValidateArray;
+    };
+
+
+#endif      //  T_PRESENCEWATCHERLISTMANAGEMENT_H
+
+
+
+// end of file
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_presencewatcherlistmngt/t_presencewatcherlistmngt.mmp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,72 @@
+/*
+* 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:
+*
+*/
+
+#include            "../../tsrcutils/eunitcommon/eunittstdllbase.hrh"
+#include            "../../tsrcutils/processmaster/pm.h"
+
+#include<platform_paths.hrh>
+#include<eunitcaps.h>
+TARGET              t_presencewatcherlistmngt.dll
+//CAPABILITY              ALL - TCB - DRM
+CAPABILITY      EUNIT_CAPS
+
+SOURCEPATH          .
+SOURCE              t_presencewatcherlistmngt.cpp
+
+USERINCLUDE             ../../../../../ximpfw/core/srcdatamodel
+USERINCLUDE             ../../../../../ximpfw/presence/srcpresencedatamodel
+USERINCLUDE             ../../../../../ximpfw/presence/srcpresencedatamodel/presentitygroups
+USERINCLUDE             ../../../../../ximpfw/presence/srcpresencedatamodel/presencewatching
+USERINCLUDE             ../../../../../ximpfw/presence/srcpresencedatamodel/presenceauthorization
+USERINCLUDE             ../../../../../ximpfw/presence/srcpresencedatamodel/presencepublishing
+USERINCLUDE             ../../../../../ximpfw/presence/srcpresencedatamodel/presenceinfo
+USERINCLUDE             ../../../../../ximpfw/core/srcutils
+
+// TODO remove unnecessary
+#if defined ( OS_LAYER_SYSTEMINCLUDE )
+OS_LAYER_SYSTEMINCLUDE
+#else
+SYSTEMINCLUDE     /epoc32/include
+#endif
+
+ #if defined ( APP_LAYER_SYSTEMINCLUDE )
+ APP_LAYER_SYSTEMINCLUDE
+ #else
+ SYSTEMINCLUDE     \epoc32\include
+ #endif
+SYSTEMINCLUDE           ../../../../../ximpfw/inc/core/base
+SYSTEMINCLUDE           ../../../../../ximpfw/inc/core/datamodel
+SYSTEMINCLUDE           ../../../../../ximpfw/inc/core/protocolplugin
+SYSTEMINCLUDE           ../../../../../ximpfw/inc/core/protocolpluginhost
+SYSTEMINCLUDE           ../../../../../ximpfw/inc/presence/presencedatamodel
+SYSTEMINCLUDE           ../../../../../ximpfw/inc/presence/presencemanagement
+SYSTEMINCLUDE           ../../../../../ximpfw/inc/presence/presenceprotocolplugin
+SYSTEMINCLUDE           ../../../../../ximpfw/inc/presence/presenceprotocolpluginhost
+
+LIBRARY             ecom.lib
+LIBRARY             bafl.lib
+LIBRARY             ximpdatamodel.lib
+LIBRARY             presencedatamodel.lib
+LIBRARY             euser.lib
+LIBRARY             ximputils.lib
+LIBRARY             eunit.lib
+LIBRARY             eunitutil.lib
+LIBRARY             estor.lib
+
+// end of file
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_presencewatching/bld.inf	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,23 @@
+/*
+* 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 t_presencewatching.dll
+*
+*/
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_TESTMMPFILES
+t_presencewatching.mmp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_presencewatching/t_presencewatching.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,1522 @@
+/*
+* 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:
+*
+*/
+
+
+#include "eunittools.h"
+
+
+#include <platform/digia/eunit/eunitmacros.h>
+#include <platform/digia/eunit/teunitassertioninfo.h>
+#include <ecom/ecom.h>
+#include <badesca.h>
+
+#include <ximpbase.h>
+#include <ximpclient.h>
+#include <ximpcontext.h>
+#include <ximpcontextstateevent.h>
+#include <ximprequestcompleteevent.h>
+#include <ximpstatus.h>
+#include <presencefeatures.h>
+#include <presencewatching.h>
+#include <presencepublishing.h>
+#include <presentitypresenceevent.h>
+#include <ximpobjectfactory.h>
+
+#include "t_presencewatching.h"
+#include "prfwteststatuseventlistener.h"
+#include "prfwtestmessaging.h"
+#include "prfwtestmessenger.h"
+#include "prfwtestcontextwrappermgr.h"
+#include "prfwtestcontextwrapper.h"
+
+#include "presenceinfoimp.h"
+#include "presenceinfofilterimp.h"
+#include "prfwtestpresencedatautils.h"
+#include "ximpidentityimp.h"
+#include "presentitygroupmemberinfoimp.h"
+#include "ximpobjecthelpers.h"
+#include "prfwtestfilesrvmsg.h"
+#include "prfwtestwaithelper.h"
+
+#include "prfwtestrobustnesstools.h"
+#include "presenceinfofieldimp.h"
+#include "presenceinfofieldcollectionimp.h"
+#include "presenceinfofieldvaluetextimp.h"
+#include "personpresenceinfoimp.h"
+
+#include <presencecachereader.h>
+
+// For the protocol UID
+#include "prfwtestprotocols.h"
+
+
+_LIT8( KPrefix1, "PreA_" );
+_LIT8( KPrefix2, "PreB_" );
+_LIT8( KPrefix3, "PreC_" );
+_LIT8( KPrefix4, "PreD_" );
+
+_LIT( KIdentity, "TestId@hello.world" );
+_LIT8( KIdentity8, "TestId@hello.world" );
+
+_LIT( KText, "Hello World" );
+
+
+const TUid KTestProtocolUid = { K_PRFW_TST_PROTOCOL_1_IMPLEMENTATION_UID };  // hardcoded...
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// CONSTRUCTION
+T_PresenceWatching* T_PresenceWatching::NewL()
+    {
+    T_PresenceWatching* self = new( ELeave ) T_PresenceWatching;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+
+    return self;
+    }
+
+
+T_PresenceWatching::~T_PresenceWatching()
+    {
+    }
+
+
+void T_PresenceWatching::ConstructL()
+    {
+    CEUnitTestSuiteClass::ConstructL();
+    }
+
+
+T_PresenceWatching::T_PresenceWatching()
+    {
+    }
+
+
+
+// ===========================================================================
+// TEST CASE SETUP & TEARDOWN METHODS
+// ===========================================================================
+//
+
+void T_PresenceWatching::Setup_L()
+    {
+    __UHEAP_MARK;
+    PrfwTestRobustness::DoPreCleaning();
+
+    iWrapperMgr = CXIMPTestContextWrapperMgr::NewL();
+    iWrapperMgr->CreateWrapperL();
+    
+    iMPresenceCacheReader = MPresenceCacheReader::NewL();
+    }
+
+void T_PresenceWatching::SetupMultiple_L()
+    {
+    PrfwTestRobustness::DoPreCleaning();
+
+    iWrapperMgr = CXIMPTestContextWrapperMgr::NewL();
+    iWrapperMgr->CreateWrapperL();
+    iWrapperMgr->CreateWrapperL();
+    iWrapperMgr->CreateWrapperL();
+    }
+
+
+void T_PresenceWatching::BindL()
+    {
+    CXIMPTestContextWrapper* wrapper0 = iWrapperMgr->GetWrapperL( 0 );
+
+    wrapper0->BindL( 0 );
+    }
+
+void T_PresenceWatching::BindAllL()
+    {
+    for( TInt a = 0; a < iWrapperMgr->WrapperCount(); ++a )
+        {
+        CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a );
+        wrapper->BindL( 0 );
+        }
+    }
+
+
+void T_PresenceWatching::Teardown()
+    {
+    delete iWrapperMgr;
+    iWrapperMgr = NULL;
+    
+    delete iMPresenceCacheReader;
+
+    REComSession::FinalClose();
+
+    PrfwTestRobustness::DoPreCleaning();
+    __UHEAP_MARKEND;
+    }
+
+void T_PresenceWatching::UnbindL()
+    {
+    // Do unbind
+    CXIMPTestContextWrapper* wrapper0 = iWrapperMgr->GetWrapperL( 0 );
+    wrapper0->UnbindL();
+    }
+
+void T_PresenceWatching::UnbindAllL()
+    {
+    for( TInt a = 0; a < iWrapperMgr->WrapperCount(); ++a )
+        {
+        CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a );
+        wrapper->UnbindL();
+        }
+    }
+
+
+// ===========================================================================
+// TEST CASES for presentity presence subscription
+// ===========================================================================
+
+// Single client, empty filter
+void T_PresenceWatching::T_SubscribePresentityPresence_Single_L()
+    {
+    EUNIT_PRINT( _L("Single presentity subscription") );
+
+// BIND AND SETUP
+
+    BindL();
+
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    MXIMPContext* context = wrapper->GetContext();
+    CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+    // Tell the protocol it should act normally
+    messenger->SetNoError();
+
+    // Get the interfaces
+    MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+    MPresenceWatching& presWatch = presFeat->PresenceWatching();
+
+// SUBSCRIBE
+    // Setup status event listener for RequestComplete
+    SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk );
+
+    CXIMPIdentityImp* identity = XIMPTestPresenceDataUtils::GenerateIdentityLC( &KNullDesC8 );
+    CPresenceInfoFilterImp* pif = XIMPTestPresenceDataUtils::GenerateInfoFilterLC( &KPrefix1 );
+    
+    // register interest
+    TXIMPRequestId reqId = presWatch.SubscribePresentityPresenceL( *identity, *pif );
+
+    // Wait for events on the request
+    wrapper->WaitRequestAndStackEvents( reqId );
+    wrapper->VerifyEventStackL( _L8("Subscribing presentity presence, complete with error: ") );
+    // verify that UpdateInterest was called
+    COMMONASSERT( messenger, EXIMPPlgTestSubscribePresentityPresesenceCalled, "SubscribePresentityPresenceL was not called", ETrue, NULL );
+
+
+// REFRESH
+    // Setup status event listener for RequestComplete
+    SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk );
+    messenger->SetValueFor( EXIMPPlgTestSubscribePresentityPresesenceCalled, 0 );
+
+    // register interest
+    reqId = presWatch.SubscribePresentityPresenceL( *identity, *pif );
+
+    // Wait for events on the request
+    wrapper->WaitRequestAndStackEvents( reqId );
+    wrapper->VerifyEventStackL( _L8("Subscribing presentity presence, complete with error: ") );
+    
+    // Wait for event because refresh happened
+    SetupListenerReqCompleteL( wrapper, EXIMPTestStatusEvents_HandlePresentityPresencePending );
+    // Wait for events
+    wrapper->WaitAnyEvent();
+    wrapper->VerifyEventStackL( _L8("Handle presence watcher list. Wrong event occurred.") );
+    
+    // verify that UpdateInterest was called
+    COMMONASSERT( messenger, EXIMPPlgTestSubscribePresentityPresesenceCalled, 
+                 "SubscribePresentityPresenceL was not called", EFalse,
+                 "SubscribePresentityPresenceL was called" );
+
+// UNSUBSCRIBE
+
+    // Setup status event listener for RequestComplete
+    SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); // allow events after reqcomplete
+
+    // register interest
+    reqId = presWatch.UnsubscribePresentityPresenceL( *identity );
+
+    // Wait for events on the request
+    wrapper->WaitRequestAndStackEvents( reqId );
+    wrapper->VerifyEventStackL( _L8("UnSubscribing presentity presence, complete with error: ") );
+    // verify that UpdateInterest was called
+    COMMONASSERT( messenger, EXIMPPlgTestUnsubscribePresentityPresesenceCalled, "UnsubscribePresentityPresenceL was not called", ETrue, NULL );
+
+// UNBIND    
+
+    CleanupStack::PopAndDestroy( pif );
+    CleanupStack::PopAndDestroy( identity );
+    
+    UnbindL();
+    }
+
+// Single client, empty filter, presence cache checking
+void T_PresenceWatching::T_SubscribeHandlePresentityPresence_Single_L()
+    {
+    EUNIT_PRINT( _L("Single presentity subscription") );
+
+// BIND AND SETUP
+
+    BindL();
+
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    MXIMPContext* context = wrapper->GetContext();
+    CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+    // Tell the protocol it should act normally
+    messenger->SetNoError();
+
+    // Get the interfaces
+    MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+    MPresenceWatching& presWatch = presFeat->PresenceWatching();
+
+// SUBSCRIBE
+    // Setup status event listener for RequestComplete
+    SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk );
+
+    CXIMPIdentityImp* identity = XIMPTestPresenceDataUtils::GenerateIdentityLC( &KIdentity8 );
+    CPresenceInfoFilterImp* pif = XIMPTestPresenceDataUtils::GenerateInfoFilterLC( &KPrefix1 );
+    
+    // register interest
+    TXIMPRequestId reqId = presWatch.SubscribePresentityPresenceL( *identity, *pif );
+
+    // Wait for events on the request
+    wrapper->WaitRequestAndStackEvents( reqId );
+    wrapper->VerifyEventStackL( _L8("Subscribing presentity presence, complete with error: ") );
+    // verify that UpdateInterest was called
+    COMMONASSERT( messenger, EXIMPPlgTestSubscribePresentityPresesenceCalled, "SubscribePresentityPresenceL was not called", ETrue, NULL );
+
+// SEND DATA
+    
+    // Create some meaningful data
+    CPresenceInfoImp* presenceInfo = CPresenceInfoImp::NewLC();
+
+    MPresenceInfoFieldValueText* value = CPresenceInfoFieldValueTextImp::NewLC();
+    value->SetTextValueL(KText);
+    
+    MPresenceInfoField* infoField = CPresenceInfoFieldImp::NewLC();
+    infoField->SetFieldTypeL(NPresenceInfo::NFieldType::KStatusMessage);
+    infoField->SetFieldValue(value);    
+    
+    MPersonPresenceInfo* personPres = CPersonPresenceInfoImp::NewLC();
+    MPresenceInfoFieldCollection& fieldCol = personPres->Fields();
+    fieldCol.AddOrReplaceFieldL(infoField);
+    TInt fieldCount= fieldCol.FieldCount();
+        
+    presenceInfo->SetPersonPresenceL(personPres);
+    CleanupStack::Pop(3); // value, infoField, personPres
+    
+    // Pack the data for FileTool
+    HBufC8* packedInfo = TXIMPObjectPacker< CPresenceInfoImp >::PackL( *presenceInfo );
+    CleanupStack::PushL( packedInfo );
+    HBufC8* packedId = TXIMPObjectPacker< CXIMPIdentityImp >::PackL( *identity );
+    CleanupStack::PushL( packedId );
+    RPointerArray< HBufC8 > bufferArray;
+    CleanupClosePushL( bufferArray );
+    bufferArray.AppendL( packedId );
+    bufferArray.AppendL( packedInfo );
+    HBufC8* packedBufferArray = TXIMPHBuf8Packer::PackArrayL( bufferArray );
+    CleanupStack::PopAndDestroy( 3, packedInfo ); // packedId, packedInfo, bufferArray
+    CleanupStack::PushL( packedBufferArray );
+    
+    // Use filetool to send it for plugin.
+    CXIMPTestFileSrvMsg* srvMsg = CXIMPTestFileSrvMsg::NewL( CXIMPTestFileSrvMsg::ETestSrvMsgPresentityPresence, 
+                                                             *packedBufferArray );
+    CleanupStack::PopAndDestroy( packedBufferArray );
+    CleanupStack::PushL( srvMsg );
+    wrapper->FileTool().SrvMsgStoreL( srvMsg );
+    CleanupStack::PopAndDestroy( srvMsg );
+    
+    // Wait for event
+    SetupListenerReqCompleteL( wrapper, EXIMPTestStatusEvents_HandlePresentityPresence );
+
+    // Wait for events
+    wrapper->WaitAnyEvent();
+    wrapper->VerifyEventStackL( _L8("Handle presentity presence. Wrong event occurred.") );
+    
+    // Verify the cache
+    MPresenceInfo* presInfoRead = iMPresenceCacheReader->PresenceInfoLC(*identity);
+
+    CPresenceInfoImp* readInfo = 
+        TXIMPGetImpClassOrPanic<CPresenceInfoImp>::From(*presInfoRead);    
+
+
+    EUNIT_ASSERT( presenceInfo->EqualsContent(*readInfo) );
+    
+    CleanupStack::PopAndDestroy( 2 ); // readInfo, presenceInfo
+            
+        
+// UNSUBSCRIBE
+
+    // Setup status event listener for RequestComplete
+    SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); // allow events after reqcomplete
+
+    // unsubscribe
+    reqId = presWatch.UnsubscribePresentityPresenceL( *identity );
+
+    // Wait for events on the request
+    wrapper->WaitRequestAndStackEvents( reqId );
+    wrapper->VerifyEventStackL( _L8("UnSubscribing presentity presence, complete with error: ") );
+    // verify that UpdateInterest was called
+    COMMONASSERT( messenger, EXIMPPlgTestUnsubscribePresentityPresesenceCalled, "UnsubscribePresentityPresenceL was not called", ETrue, NULL );
+
+// UNBIND    
+
+    CleanupStack::PopAndDestroy( pif );
+    CleanupStack::PopAndDestroy( identity );
+    
+    UnbindL();
+    }
+
+
+// Single client, empty filter
+void T_PresenceWatching::T_SubscribePresentityPresenceChangeId_Single_L()
+    {
+    EUNIT_PRINT( _L("Single presentity subscription") );
+
+// BIND AND SETUP
+
+    BindL();
+
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    MXIMPContext* context = wrapper->GetContext();
+    CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+    // Tell the protocol it should act normally
+    messenger->SetNoError();
+
+    // Get the interfaces
+    MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+    MPresenceWatching& presWatch = presFeat->PresenceWatching();
+
+// ID CHANGE REQUEST TO ADAPTATION
+
+    MXIMPIdentity* identityParam = context->ObjectFactory().NewIdentityLC();
+    identityParam->SetIdentityL( KIdentity );
+    
+    CXIMPIdentityImp* identityParamImp =
+             ( CXIMPIdentityImp* ) identityParam->GetInterface(
+                                        CXIMPIdentityImp::KClassId,
+                                        MXIMPBase::EPanicIfUnknown );
+    HBufC8* packedId = TXIMPObjectPacker< CXIMPIdentityImp >::PackL( *identityParamImp );
+    CleanupStack::PopAndDestroy(); // identityParam
+    CleanupStack::PushL( packedId );
+    CXIMPTestFileSrvMsg* srvMsg = CXIMPTestFileSrvMsg::NewL( CXIMPTestFileSrvMsg::ETestSrvMsgReqParamIdentity, 
+                                                             *packedId );
+    CleanupStack::PopAndDestroy( packedId );
+    CleanupStack::PushL( srvMsg );
+    wrapper->FileTool().SrvMsgStoreL( srvMsg );
+    CleanupStack::PopAndDestroy( srvMsg );
+
+    // Wait for server to handle srvmsg.
+    CXIMPTestWaitHelper* wait = CXIMPTestWaitHelper::NewL();
+    CleanupStack::PushL( wait );
+    wait->WaitForL( 2 );
+    CleanupStack::PopAndDestroy( wait );
+
+// SUBSCRIBE
+    // Setup status event listener for RequestComplete
+    SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk );
+
+    CXIMPIdentityImp* identity = XIMPTestPresenceDataUtils::GenerateIdentityLC( &KNullDesC8 );
+    CPresenceInfoFilterImp* pif = XIMPTestPresenceDataUtils::GenerateInfoFilterLC( &KPrefix1 );
+    
+    // register interest
+    TXIMPRequestId reqId = presWatch.SubscribePresentityPresenceL( *identity, *pif );
+
+    // Wait for events on the request
+    wrapper->WaitRequestAndStackEvents( reqId );
+    wrapper->VerifyEventStackL( _L8("Subscribing presentity presence, complete with error: ") );
+    // verify that UpdateInterest was called
+    COMMONASSERT( messenger, EXIMPPlgTestSubscribePresentityPresesenceCalled, "SubscribePresentityPresenceL was not called", ETrue, NULL );
+
+// UNBIND    
+
+    CleanupStack::PopAndDestroy( pif );
+    CleanupStack::PopAndDestroy( identity );
+    
+    UnbindL();
+    }
+
+
+void T_PresenceWatching::T_UnsubscribeNotSubscribedPresentityPresence_Single_L()
+    {
+    EUNIT_PRINT( _L("Unsubscribe not subscribed presentity presence") );
+
+// BIND AND SETUP
+
+    BindL();
+
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    MXIMPContext* context = wrapper->GetContext();
+    CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+    // Tell the protocol it should act normally
+    messenger->SetNoError();
+
+    // Get the interfaces
+    MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+    MPresenceWatching& presWatch = presFeat->PresenceWatching();
+    
+    CXIMPIdentityImp* identity = XIMPTestPresenceDataUtils::GenerateIdentityLC( &KNullDesC8 );
+    CPresenceInfoFilterImp* pif = XIMPTestPresenceDataUtils::GenerateInfoFilterLC( &KPrefix1 );
+    
+// UNSUBSCRIBE
+
+    // Setup status event listener for RequestComplete
+    SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); // allow events after reqcomplete
+
+    // register interest
+    TXIMPRequestId reqId = presWatch.UnsubscribePresentityPresenceL( *identity );
+
+    // Wait for events on the request
+    wrapper->WaitRequestAndStackEvents( reqId );
+    wrapper->VerifyEventStackL( _L8("UnSubscribing presentity presence, complete with error: ") );
+
+    // verify that UpdateInterest was called
+    COMMONASSERT( messenger, EXIMPPlgTestUnsubscribePresentityPresesenceCalled, "UnsubscribePresentityPresenceL was not called", EFalse, 
+                                                                                "UnsbuscribePresentityPresenceL was called." );
+
+// UNBIND    
+
+    CleanupStack::PopAndDestroy( pif );
+    CleanupStack::PopAndDestroy( identity );
+    
+    UnbindL();
+    }
+
+void T_PresenceWatching::T_UnsubscribeNotSubscribedPresentityPresence_Multiple_L()
+    {
+    EUNIT_PRINT( _L("Multiple client filter registration") );
+
+    BindAllL();
+
+    CXIMPIdentityImp* identity = XIMPTestPresenceDataUtils::GenerateIdentityLC( &KNullDesC8 );
+    CPresenceInfoFilterImp* pif = XIMPTestPresenceDataUtils::GenerateInfoFilterLC( &KPrefix1 );
+
+    TInt countOfWrappers = iWrapperMgr->WrapperCount();
+    for( TInt a = countOfWrappers - 1; a >= 1 ; --a ) // Don't subscribe the first one.
+        {
+        CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a );
+        MXIMPContext* context = wrapper->GetContext();
+        CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+        // Tell the protocol it should act normally
+        messenger->SetNoError();
+
+        // Get the interfaces
+        MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+        MPresenceWatching& presWatch = presFeat->PresenceWatching();
+
+        // Setup status event listener for RequestComplete
+        SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk );
+
+        // register interest
+        TXIMPRequestId reqId = presWatch.SubscribePresentityPresenceL( *identity, *pif );
+
+        // Wait for events on the request
+        wrapper->WaitRequestAndStackEvents( reqId );
+        // verify that UpdateInterest was called
+        COMMONASSERT( messenger, EXIMPPlgTestSubscribePresentityPresesenceCalled, 
+            "SubscribePresentityPresenceL was not called",
+            ( a > 1 ) ? ETrue : EFalse,
+            "SubscribePresentityPresenceL was called" );
+        }
+
+    for( TInt a = 0; a < countOfWrappers; ++a ) // Try to unsubscribe first one first.
+        {
+        CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a );
+        MXIMPContext* context = wrapper->GetContext();
+        CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+        // Get the interfaces
+        MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+        MPresenceWatching& presWatch = presFeat->PresenceWatching();
+        
+        // Setup status event listener for RequestComplete
+        SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); // allow events after reqcomplete
+
+        // register interest
+        TXIMPRequestId reqId = presWatch.UnsubscribePresentityPresenceL( *identity );
+
+        // Wait for events on the request
+        wrapper->WaitRequestAndStackEvents( reqId );
+        wrapper->VerifyEventStackL( _L8("Subscribing presentity presence, complete with error: ") );
+        // verify that UpdateInterest was called
+        COMMONASSERT( messenger, EXIMPPlgTestUnsubscribePresentityPresesenceCalled, 
+            "UnsubscribePresentityPresenceL was not called",
+            ( a < 2 ) ? EFalse : ETrue,
+            "UnsubscribePresentityPresenceL was called" );
+        }
+    
+    CleanupStack::PopAndDestroy( pif );
+    CleanupStack::PopAndDestroy( identity );
+        
+    UnbindAllL();    
+    }
+
+
+void T_PresenceWatching::T_ErrFromPlg_LeaveOnSubscribePresentityPresence_L()
+    {
+    EUNIT_PRINT( _L("Error from plug-in in presentity presence subscribe") );
+    EUNIT_PRINT( _L("Plug-in leaves from SubscribePresence().") );
+
+// BIND AND SETUP
+
+    BindL();
+
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    MXIMPContext* context = wrapper->GetContext();
+    CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+    messenger->SetLeave( KErrAbort );
+
+    // Get the interfaces
+    MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+    MPresenceWatching& presWatch = presFeat->PresenceWatching();
+    
+// SUBSCRIBE
+
+    // Setup status event listener for RequestComplete
+    SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_PresentitySubscribeFailKErrAbort );
+
+    CXIMPIdentityImp* identity = XIMPTestPresenceDataUtils::GenerateIdentityLC( &KNullDesC8 );
+    CPresenceInfoFilterImp* pif = XIMPTestPresenceDataUtils::GenerateInfoFilterLC( &KPrefix1 );
+    
+    // register interest
+    TXIMPRequestId reqId = presWatch.SubscribePresentityPresenceL( *identity, *pif );
+
+    // Wait for events on the request
+    wrapper->WaitRequestAndStackEvents( reqId );
+    wrapper->VerifyEventStackL( _L8("Subscribing presentity presence, complete with error: ") );
+    // verify that UpdateInterest was called
+    COMMONASSERT( messenger, EXIMPPlgTestSubscribePresentityPresesenceCalled, "SubscribePresentityPresenceL was not called", EFalse, "SubscribePresentityPresenceL was called" );
+    
+// UNBIND
+
+    CleanupStack::PopAndDestroy( pif );
+    CleanupStack::PopAndDestroy( identity );
+
+    messenger->SetLeave( KErrNone );
+
+    UnbindL();
+    }
+
+
+void T_PresenceWatching::T_ErrFromPlg_LeaveOnUnsubscribePresentityPresence_L()
+    {
+    EUNIT_PRINT( _L("Error from plug-in in presentity presence subscribe") );
+    EUNIT_PRINT( _L("Plug-in leaves from SubscribePresence().") );
+
+// BIND AND SETUP
+
+    BindL();
+
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    MXIMPContext* context = wrapper->GetContext();
+    CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+    // Get the interfaces
+    MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+    MPresenceWatching& presWatch = presFeat->PresenceWatching();
+
+// SUBSCRIBE
+
+    // Setup status event listener for RequestComplete
+    SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk );
+
+    CXIMPIdentityImp* identity = XIMPTestPresenceDataUtils::GenerateIdentityLC( &KNullDesC8 );
+    CPresenceInfoFilterImp* pif = XIMPTestPresenceDataUtils::GenerateInfoFilterLC( &KPrefix1 );
+    
+    // register interest
+    TXIMPRequestId reqId = presWatch.SubscribePresentityPresenceL( *identity, *pif );
+
+    // Wait for events on the request
+    wrapper->WaitRequestAndStackEvents( reqId );
+    wrapper->VerifyEventStackL( _L8("Subscribing presentity presence, complete with error: ") );
+    // verify that UpdateInterest was called
+    COMMONASSERT( messenger, EXIMPPlgTestSubscribePresentityPresesenceCalled, "SubscribePresentityPresenceL was not called", ETrue, NULL );
+
+// UNSUBSCRIBE
+
+    messenger->SetLeave( KErrAbort );
+
+    // Setup status event listener for RequestComplete
+    SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_PresentitySubscribeFailKErrAbort ); // allow events after reqcomplete
+
+    // register interest
+    reqId = presWatch.UnsubscribePresentityPresenceL( *identity );
+
+    // Wait for events on the request
+    wrapper->WaitRequestAndStackEvents( reqId );
+    wrapper->VerifyEventStackL( _L8("UnSubscribing presentity presence, complete with error: ") );
+
+    // verify that UpdateInterest was called
+    COMMONASSERT( messenger, EXIMPPlgTestUnsubscribePresentityPresesenceCalled, "UnsubscribePresentityPresenceL was not called", EFalse, 
+                                                                                "UnsbuscribePresentityPresenceL was called." );
+    
+// UNBIND
+
+    CleanupStack::PopAndDestroy( pif );
+    CleanupStack::PopAndDestroy( identity );
+
+    messenger->SetLeave( KErrNone );
+
+    UnbindL();
+    }
+
+
+// Multiple client, empty filter
+void T_PresenceWatching::T_SubscribePresentityPresence_Multiple_L()
+    {
+    EUNIT_PRINT( _L("Multiple client filter registration") );
+
+    BindAllL();
+
+    CXIMPIdentityImp* identity = XIMPTestPresenceDataUtils::GenerateIdentityLC( &KNullDesC8 );
+    CPresenceInfoFilterImp* pif = XIMPTestPresenceDataUtils::GenerateInfoFilterLC( &KPrefix1 );
+
+    TInt countOfWrappers = iWrapperMgr->WrapperCount();
+    for( TInt a = 0; a < countOfWrappers; ++a )
+        {
+        CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a );
+        MXIMPContext* context = wrapper->GetContext();
+        CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+        // Tell the protocol it should act normally
+        messenger->SetNoError();
+
+        // Get the interfaces
+        MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+        MPresenceWatching& presWatch = presFeat->PresenceWatching();
+
+        // Setup status event listener for RequestComplete
+        SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk );
+
+        // register interest
+        TXIMPRequestId reqId = presWatch.SubscribePresentityPresenceL( *identity, *pif );
+
+        // Wait for events on the request
+        wrapper->WaitRequestAndStackEvents( reqId );
+        // verify that UpdateInterest was called
+        COMMONASSERT( messenger, EXIMPPlgTestSubscribePresentityPresesenceCalled, 
+            "SubscribePresentityPresenceL was not called",
+            ( a == 0 ) ? ETrue : EFalse,
+            "SubscribePresentityPresenceL was called" );
+        }
+        
+    for( TInt a = 0; a < countOfWrappers; ++a )
+        {
+        CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a );
+        MXIMPContext* context = wrapper->GetContext();
+        CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+        
+        // Get the interfaces
+        MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+        MPresenceWatching& presWatch = presFeat->PresenceWatching();
+                
+        // Setup status event listener for RequestComplete
+        SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk );
+        messenger->SetValueFor( EXIMPPlgTestSubscribePresentityPresesenceCalled, 0 );
+
+        // register interest
+        TXIMPRequestId reqId = presWatch.SubscribePresentityPresenceL( *identity, *pif );
+
+        // Wait for events on the request
+        wrapper->WaitRequestAndStackEvents( reqId );
+        wrapper->VerifyEventStackL( _L8("Subscribing presentity presence, complete with error: ") );
+
+        // Wait for event because refresh happened
+        SetupListenerReqCompleteL( wrapper, EXIMPTestStatusEvents_HandlePresentityPresencePending );
+        // Wait for events
+        wrapper->WaitAnyEvent();
+        wrapper->VerifyEventStackL( _L8("Handle presence watcher list. Wrong event occurred.") );
+
+        // verify that UpdateInterest was called
+        COMMONASSERT( messenger, EXIMPPlgTestSubscribePresentityPresesenceCalled, 
+                     "SubscribePresentityPresenceL was not called", EFalse,
+                     "SubscribePresentityPresenceL was called" );
+        }
+        
+        
+    for( TInt a = 0; a < countOfWrappers; ++a )
+        {
+        CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a );
+        MXIMPContext* context = wrapper->GetContext();
+        CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+        
+        // Get the interfaces
+        MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+        MPresenceWatching& presWatch = presFeat->PresenceWatching();
+
+        // Setup status event listener for RequestComplete
+        SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); // allow events after reqcomplete
+
+        // register interest
+        TXIMPRequestId reqId = presWatch.UnsubscribePresentityPresenceL( *identity );
+
+        // Wait for events on the request
+        wrapper->WaitRequestAndStackEvents( reqId );
+        wrapper->VerifyEventStackL( _L8("Subscribing presentity presence, complete with error: ") );
+        // verify that UpdateInterest was called
+        COMMONASSERT( messenger, EXIMPPlgTestUnsubscribePresentityPresesenceCalled, 
+            "UnsubscribePresentityPresenceL was not called",
+            ( a < 2 ) ? EFalse : ETrue,
+            "UnsubscribePresentityPresenceL was called" );
+        }
+    
+    CleanupStack::PopAndDestroy( pif );
+    CleanupStack::PopAndDestroy( identity );
+    
+    
+    UnbindAllL();
+    }
+
+
+// ===========================================================================
+// TEST CASES for presentity group members presence subscription
+// ===========================================================================
+
+// Single client, empty filter
+void T_PresenceWatching::T_SubscribePresentityGroupMembersPresence_Single_L()
+    {
+    EUNIT_PRINT( _L("Single presentity group members subscription") );
+
+    BindL();
+
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    MXIMPContext* context = wrapper->GetContext();
+    CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+    // Tell the protocol it should act normally
+    messenger->SetNoError();
+
+    // Get the interfaces
+    MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+    MPresenceWatching& presWatch = presFeat->PresenceWatching();
+    // Setup status event listener for RequestComplete
+    SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk );
+
+    CXIMPIdentityImp* identity = XIMPTestPresenceDataUtils::GenerateIdentityLC( &KNullDesC8 );
+    CPresenceInfoFilterImp* pif = XIMPTestPresenceDataUtils::GenerateInfoFilterLC( &KPrefix1 );
+
+// SUBSCRIBE
+
+    // register interest
+    TXIMPRequestId reqId = presWatch.SubscribePresentityGroupMembersPresenceL( *identity, *pif );
+
+    // Wait for events on the request
+    wrapper->WaitRequestAndStackEvents( reqId );
+    // verify that UpdateInterest was called
+    COMMONASSERT( messenger, EXIMPPlgTestSubscribePresentityGroupMembersPresesenceCalled, "SubscribePresentityGroupMembersPresenceL was not called", ETrue, NULL );
+
+// REFRESH
+
+    // Setup status event listener for RequestComplete
+    SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk );
+    messenger->SetValueFor( EXIMPPlgTestSubscribePresentityGroupMembersPresesenceCalled, 0 );
+
+    // register interest
+    reqId = presWatch.SubscribePresentityGroupMembersPresenceL( *identity, *pif );
+
+    // Wait for events on the request
+    wrapper->WaitRequestAndStackEvents( reqId );
+    // verify that UpdateInterest was called
+    COMMONASSERT( messenger, EXIMPPlgTestSubscribePresentityGroupMembersPresesenceCalled, 
+                 "SubscribePresentityPresenceL was not called", EFalse,
+                 "SubscribePresentityPresenceL was called" );
+
+// UNSUBSCRIBE
+
+    // Setup status event listener for RequestComplete
+    SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); // allow events after reqcomplete
+
+
+    // register interest
+    reqId = presWatch.UnsubscribePresentityGroupMembersPresenceL( *identity );
+
+    // Wait for events on the request
+    wrapper->WaitRequestAndStackEvents( reqId );
+    wrapper->VerifyEventStackL( _L8("Subscribing presentity group members presence, complete with error: ") );
+    // verify that UpdateInterest was called
+    COMMONASSERT( messenger, EXIMPPlgTestUnsubscribePresentityGroupMembersPresesenceCalled, "UnsubscribePresentityGroupMembersPresenceL was not called", ETrue, NULL );
+
+    
+    CleanupStack::PopAndDestroy( pif );
+    CleanupStack::PopAndDestroy( identity );
+    
+    UnbindL();
+    }
+
+void T_PresenceWatching::T_UnsubscribeNotSubscribedPresentityGroupMembersPresence_Single_L()
+    {
+    EUNIT_PRINT( _L("Unsubscribe not subscribed presentity group members presence") );
+
+// BIND AND SETUP
+
+    BindL();
+
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    MXIMPContext* context = wrapper->GetContext();
+    CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+    // Tell the protocol it should act normally
+    messenger->SetNoError();
+
+    // Get the interfaces
+    MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+    MPresenceWatching& presWatch = presFeat->PresenceWatching();    
+    CXIMPIdentityImp* identity = XIMPTestPresenceDataUtils::GenerateIdentityLC( &KNullDesC8 );
+    CPresenceInfoFilterImp* pif = XIMPTestPresenceDataUtils::GenerateInfoFilterLC( &KPrefix1 );
+    
+// UNSUBSCRIBE
+
+    // Setup status event listener for RequestComplete
+    SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); // allow events after reqcomplete
+
+    // register interest
+    TXIMPRequestId reqId = presWatch.UnsubscribePresentityGroupMembersPresenceL( *identity );
+
+    // Wait for events on the request
+    wrapper->WaitRequestAndStackEvents( reqId );
+    wrapper->VerifyEventStackL( _L8("UnSubscribing presentity presence, complete with error: ") );
+
+    // verify that UpdateInterest was called
+    COMMONASSERT( messenger, EXIMPPlgTestUnsubscribePresentityGroupMembersPresesenceCalled, "UnsubscribePresentityGroupMembersPresenceL was not called", EFalse, 
+                                                                                            "UnsubscribePresentityGroupMembersPresenceL was called." );
+
+// UNBIND    
+
+    CleanupStack::PopAndDestroy( pif );
+    CleanupStack::PopAndDestroy( identity );
+    
+    UnbindL();
+    }
+
+
+void T_PresenceWatching::T_UnsubscribeNotSubscribedPresentityGroupMembersPresence_Multiple_L()
+    {
+    EUNIT_PRINT( _L("Multiple client filter registration") );
+
+    BindAllL();
+
+    CXIMPIdentityImp* identity = XIMPTestPresenceDataUtils::GenerateIdentityLC( &KNullDesC8 );
+    CPresenceInfoFilterImp* pif = XIMPTestPresenceDataUtils::GenerateInfoFilterLC( &KPrefix1 );
+
+    TInt countOfWrappers = iWrapperMgr->WrapperCount();
+    for( TInt a = countOfWrappers - 1; a >= 1; --a )
+        {
+        CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a );
+        MXIMPContext* context = wrapper->GetContext();
+        CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+        // Tell the protocol it should act normally
+        messenger->SetNoError();
+
+        // Get the interfaces
+        MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+        MPresenceWatching& presWatch = presFeat->PresenceWatching();
+    
+        // Setup status event listener for RequestComplete
+        SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk );
+
+        // register interest
+        TXIMPRequestId reqId = presWatch.SubscribePresentityGroupMembersPresenceL( *identity, *pif );
+
+        // Wait for events on the request
+        wrapper->WaitRequestAndStackEvents( reqId );
+        // verify that UpdateInterest was called
+        COMMONASSERT( messenger, EXIMPPlgTestSubscribePresentityGroupMembersPresesenceCalled,
+            "SubscribePresentityPresenceL was not called",
+            ( a > 1 ) ? ETrue : EFalse,
+            "SubscribePresentityPresenceL was called" );
+        }
+        
+    for( TInt a = 0; a < countOfWrappers; ++a )
+        {
+        CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a );
+        MXIMPContext* context = wrapper->GetContext();
+        CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+        // Get the interfaces
+        MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+        MPresenceWatching& presWatch = presFeat->PresenceWatching();
+    
+        // Setup status event listener for RequestComplete
+        SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); // allow events after reqcomplete
+
+        // register interest
+        TXIMPRequestId reqId = presWatch.UnsubscribePresentityGroupMembersPresenceL( *identity );
+
+        // Wait for events on the request
+        wrapper->WaitRequestAndStackEvents( reqId );
+        wrapper->VerifyEventStackL( _L8("Subscribing presentity presence, complete with error: ") );
+        // verify that UpdateInterest was called
+        COMMONASSERT( messenger, EXIMPPlgTestUnsubscribePresentityGroupMembersPresesenceCalled, 
+            "UnsubscribePresentityPresenceL was not called",
+            ( a < 2 ) ? EFalse : ETrue,
+            "UnsubscribePresentityPresenceL was called" );
+        }
+    
+    CleanupStack::PopAndDestroy( pif );
+    CleanupStack::PopAndDestroy( identity );
+        
+    UnbindAllL();    
+    }
+
+
+
+// Multiple client, empty filter
+void T_PresenceWatching::T_SubscribeGroupMembersPresence_Multiple_L()
+    {
+    EUNIT_PRINT( _L("Multiple client filter registration") );
+
+    BindAllL();
+
+    CXIMPIdentityImp* identity = XIMPTestPresenceDataUtils::GenerateIdentityLC( &KNullDesC8 );
+    CPresenceInfoFilterImp* pif = XIMPTestPresenceDataUtils::GenerateInfoFilterLC( &KPrefix1 );
+
+    TInt countOfWrappers = iWrapperMgr->WrapperCount();
+    for( TInt a = 0; a < countOfWrappers; ++a )
+        {
+        CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a );
+        MXIMPContext* context = wrapper->GetContext();
+        CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+        // Tell the protocol it should act normally
+        messenger->SetNoError();
+
+        // Get the interfaces
+        MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+        MPresenceWatching& presWatch = presFeat->PresenceWatching();
+
+        // Setup status event listener for RequestComplete
+        SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk );
+
+        // register interest
+        TXIMPRequestId reqId = presWatch.SubscribePresentityGroupMembersPresenceL( *identity, *pif );
+
+        // Wait for events on the request
+        wrapper->WaitRequestAndStackEvents( reqId );
+        // verify that UpdateInterest was called
+        COMMONASSERT( messenger, EXIMPPlgTestSubscribePresentityGroupMembersPresesenceCalled, 
+            "SubscribePresentityPresenceL was not called",
+            ( a == 0 ) ? ETrue : EFalse,
+            "SubscribePresentityPresenceL was called" );
+        }
+        
+    for( TInt a = 0; a < countOfWrappers; ++a )
+        {
+        CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a );
+        MXIMPContext* context = wrapper->GetContext();
+        CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+        
+        // Get the interfaces
+        MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+        MPresenceWatching& presWatch = presFeat->PresenceWatching();  
+                      
+        // Setup status event listener for RequestComplete
+        SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk );
+        messenger->SetValueFor( EXIMPPlgTestSubscribePresentityGroupMembersPresesenceCalled, 0 );
+
+        // register interest
+        TXIMPRequestId reqId = presWatch.SubscribePresentityGroupMembersPresenceL( *identity, *pif );
+
+        // Wait for events on the request
+        wrapper->WaitRequestAndStackEvents( reqId );
+        wrapper->VerifyEventStackL( _L8("Subscribing presentity presence, complete with error: ") );
+
+        // verify that UpdateInterest was called
+        COMMONASSERT( messenger, EXIMPPlgTestSubscribePresentityGroupMembersPresesenceCalled, 
+                     "SubscribePresentityPresenceL was not called", EFalse,
+                     "SubscribePresentityPresenceL was called" );
+        }
+        
+        
+    for( TInt a = 0; a < countOfWrappers; ++a )
+        {
+        CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a );
+        MXIMPContext* context = wrapper->GetContext();
+        CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+    
+        // Get the interfaces
+        MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+        MPresenceWatching& presWatch = presFeat->PresenceWatching();
+    
+        // Setup status event listener for RequestComplete
+        SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); // allow events after reqcomplete
+
+        // register interest
+        TXIMPRequestId reqId = presWatch.UnsubscribePresentityGroupMembersPresenceL( *identity );
+
+        // Wait for events on the request
+        wrapper->WaitRequestAndStackEvents( reqId );
+        wrapper->VerifyEventStackL( _L8("Subscribing presentity presence, complete with error: ") );
+        // verify that UpdateInterest was called
+        COMMONASSERT( messenger, EXIMPPlgTestUnsubscribePresentityGroupMembersPresesenceCalled, 
+            "UnsubscribePresentityPresenceL was not called",
+            ( a < 2 ) ? EFalse : ETrue,
+            "UnsubscribePresentityPresenceL was called" );
+        }
+    
+    CleanupStack::PopAndDestroy( pif );
+    CleanupStack::PopAndDestroy( identity );
+    
+    
+    UnbindAllL();
+    }
+
+
+void T_PresenceWatching::T_ErrFromPlg_LeaveOnSubscribePresentityGroupMembersPresence_L()
+    {
+    EUNIT_PRINT( _L("Error from plug-in in presentity group members presence subscribe") );
+    EUNIT_PRINT( _L("Plug-in leaves from SubscribeGroupMembersPresence().") );
+
+// BIND AND SETUP
+
+    BindL();
+
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    MXIMPContext* context = wrapper->GetContext();
+    CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+    messenger->SetLeave( KErrAbort );
+
+    // Get the interfaces
+    MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+    MPresenceWatching& presWatch = presFeat->PresenceWatching();
+
+// SUBSCRIBE
+
+    // Setup status event listener for RequestComplete
+    SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_PresentitySubscribeFailKErrAbort );
+
+    CXIMPIdentityImp* identity = XIMPTestPresenceDataUtils::GenerateIdentityLC( &KNullDesC8 );
+    CPresenceInfoFilterImp* pif = XIMPTestPresenceDataUtils::GenerateInfoFilterLC( &KPrefix1 );
+    
+    // register interest
+    TXIMPRequestId reqId = presWatch.SubscribePresentityGroupMembersPresenceL( *identity, *pif );
+
+    // Wait for events on the request
+    wrapper->WaitRequestAndStackEvents( reqId );
+    wrapper->VerifyEventStackL( _L8("Subscribing presentity presence, complete with error: ") );
+    // verify that UpdateInterest was called
+    COMMONASSERT( messenger, EXIMPPlgTestSubscribePresentityGroupMembersPresesenceCalled, "SubscribePresentityPresenceL was not called", EFalse, "SubscribePresentityPresenceL was called" );
+    
+// UNBIND
+
+    CleanupStack::PopAndDestroy( pif );
+    CleanupStack::PopAndDestroy( identity );
+
+    messenger->SetLeave( KErrNone );
+
+    UnbindL();
+    }
+
+
+void T_PresenceWatching::T_ErrFromPlg_LeaveOnUnsubscribePresentityGroupMembersPresence_L()
+    {
+    EUNIT_PRINT( _L("Error from plug-in in presentity group members presence unsubscribe") );
+    EUNIT_PRINT( _L("Plug-in leaves from UnsubscribeGroupMembersPresence().") );
+
+// BIND AND SETUP
+
+    BindL();
+
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    MXIMPContext* context = wrapper->GetContext();
+    CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+     // Get the interfaces
+    MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+    MPresenceWatching& presWatch = presFeat->PresenceWatching();
+
+// SUBSCRIBE
+
+    // Setup status event listener for RequestComplete
+    SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk );
+
+    CXIMPIdentityImp* identity = XIMPTestPresenceDataUtils::GenerateIdentityLC( &KNullDesC8 );
+    CPresenceInfoFilterImp* pif = XIMPTestPresenceDataUtils::GenerateInfoFilterLC( &KPrefix1 );
+    
+    // register interest
+    TXIMPRequestId reqId = presWatch.SubscribePresentityGroupMembersPresenceL( *identity, *pif );
+
+    // Wait for events on the request
+    wrapper->WaitRequestAndStackEvents( reqId );
+    wrapper->VerifyEventStackL( _L8("Subscribing presentity presence, complete with error: ") );
+    // verify that UpdateInterest was called
+    COMMONASSERT( messenger, EXIMPPlgTestSubscribePresentityGroupMembersPresesenceCalled, "SubscribePresentityPresenceL was not called", ETrue, "SubscribePresentityPresenceL was called" );
+
+// UNSUBSCRIBE
+
+    messenger->SetLeave( KErrAbort );
+
+    // Setup status event listener for RequestComplete
+    SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_PresentitySubscribeFailKErrAbort ); // allow events after reqcomplete
+
+    // register interest
+    reqId = presWatch.UnsubscribePresentityGroupMembersPresenceL( *identity );
+
+    // Wait for events on the request
+    wrapper->WaitRequestAndStackEvents( reqId );
+    wrapper->VerifyEventStackL( _L8("UnSubscribing presentity presence, complete with error: ") );
+
+    // verify that UpdateInterest was called
+    COMMONASSERT( messenger, EXIMPPlgTestUnsubscribePresentityGroupMembersPresesenceCalled, "UnsubscribePresentityGroupMembersPresenceL was not called", EFalse, 
+                                                                                            "UnsubscribePresentityGroupMembersPresenceL was called." );
+
+// UNBIND
+
+    CleanupStack::PopAndDestroy( pif );
+    CleanupStack::PopAndDestroy( identity );
+
+    messenger->SetLeave( KErrNone );
+
+    UnbindL();
+    }
+
+
+void T_PresenceWatching::T_ContentChangePresentityGroupMembersPresence_Single_L()
+    {
+    EUNIT_PRINT( _L("Presentity group members content change") );
+
+    BindL();
+
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    MXIMPContext* context = wrapper->GetContext();
+    CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+    // Tell the protocol it should act normally
+    messenger->SetNoError();
+
+    // Get the interfaces
+    MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+    MPresenceWatching& presWatch = presFeat->PresenceWatching();
+    // Setup status event listener for RequestComplete
+    SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk );
+
+    CXIMPIdentityImp* identity = XIMPTestPresenceDataUtils::GenerateIdentityLC( &KNullDesC8 );
+    CPresenceInfoFilterImp* pif = CPresenceInfoFilterImp::NewLC();
+
+
+    // register interest
+    TXIMPRequestId reqId = presWatch.SubscribePresentityGroupMembersPresenceL( *identity, *pif );
+
+    // Wait for events on the request
+    wrapper->WaitRequestAndStackEvents( reqId );
+    // verify that UpdateInterest was called
+    COMMONASSERT( messenger, EXIMPPlgTestSubscribePresentityGroupMembersPresesenceCalled, "SubscribePresentityGroupMembersPresenceL was not called", ETrue, NULL );
+
+
+// TODO THINGSIES
+    // Get the interface
+    MPresencePublishing& presPub = presFeat->PresencePublishing();
+
+    // Setup status event listener for RequestComplete
+    SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk );
+
+    // register interest
+    reqId = presPub.SubscribeOwnPresenceL( *pif );
+
+    // Wait for events on the request
+    wrapper->WaitRequestAndStackEvents( reqId );
+
+
+
+    // Create member to grouplist we are interested in.
+    // 1. Create notification    
+    RXIMPObjOwningPtrArray<CPresentityGroupMemberInfoImp> groupMemberList;
+    CleanupClosePushL( groupMemberList );
+    CPresentityGroupMemberInfoImp* info = CPresentityGroupMemberInfoImp::NewLC( *identity, KNullDesC );
+    User::LeaveIfError( groupMemberList.Append( info ) );
+    CleanupStack::Pop(); //info
+    HBufC8* packedId = TXIMPObjectPacker< CXIMPIdentityImp >::PackL( *identity );
+    CleanupStack::PushL( packedId );
+    HBufC8* packedArray = TXIMPObjectPacker<CPresentityGroupMemberInfoImp>::PackArrayL( groupMemberList );
+    CleanupStack::PushL( packedArray );    
+    RPointerArray< HBufC8 > bufferArray;
+    CleanupClosePushL( bufferArray );
+    bufferArray.AppendL( packedId );
+    bufferArray.AppendL( packedArray );
+    HBufC8* packedBufferArray = TXIMPHBuf8Packer::PackArrayL( bufferArray );
+    CleanupStack::PopAndDestroy( 4 ); // packedId, bufferArray, packedArray, groupMemberList
+    CleanupStack::PushL( packedBufferArray );
+    
+    // 2. Use filetool to send it for plugin.
+    CXIMPTestFileSrvMsg* srvMsg = CXIMPTestFileSrvMsg::NewL( CXIMPTestFileSrvMsg::ETestSrvMsgPresentityGroupMemberList, 
+                                                             *packedBufferArray );
+    CleanupStack::PopAndDestroy( packedBufferArray );
+    CleanupStack::PushL( srvMsg );
+    wrapper->FileTool().CleanAllL();
+    wrapper->FileTool().SrvMsgStoreL( srvMsg );
+    CleanupStack::PopAndDestroy( srvMsg );
+
+    // 3. Send data to member
+    CPresenceInfoImp* presenceInfo = CPresenceInfoImp::NewLC();
+    HBufC8* packedInfo = TXIMPObjectPacker< CPresenceInfoImp >::PackL( *presenceInfo );
+    CleanupStack::PopAndDestroy( presenceInfo );
+    CleanupStack::PushL( packedInfo );
+    packedId = TXIMPObjectPacker< CXIMPIdentityImp >::PackL( *identity );
+    CleanupStack::PushL( packedId );
+    CleanupClosePushL( bufferArray );
+    bufferArray.AppendL( packedId );
+    bufferArray.AppendL( packedInfo );
+    packedBufferArray = TXIMPHBuf8Packer::PackArrayL( bufferArray );
+    CleanupStack::PopAndDestroy( 3, packedInfo ); // packedId, packedInfo
+    CleanupStack::PushL( packedBufferArray );
+    
+    // 4. Use filetool to send it for plugin.
+    srvMsg = CXIMPTestFileSrvMsg::NewL( CXIMPTestFileSrvMsg::ETestSrvMsgPresentityPresence, 
+                                                             *packedBufferArray );
+    CleanupStack::PopAndDestroy( packedBufferArray );
+    CleanupStack::PushL( srvMsg );
+    wrapper->FileTool().SrvMsgStoreL( srvMsg );
+    CleanupStack::PopAndDestroy( srvMsg );
+    
+    // Wait for event
+    // 5. Wait for event.
+    SetupListenerReqCompleteL( wrapper, EXIMPTestStatusEvents_HandlePresentityPresence );
+    // Wait for events
+    wrapper->WaitAnyEvent();
+    wrapper->VerifyEventStackL( _L8("Handle presence watcher list. Wrong event occurred.") );
+        
+        
+    // Setup status event listener for RequestComplete
+    SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); // allow events after reqcomplete
+
+    // register interest
+    reqId = presPub.UnsubscribeOwnPresenceL();
+
+    // Wait for events on the request
+    wrapper->WaitRequestAndStackEvents( reqId );
+    wrapper->VerifyEventStackL( _L8("Subscribing own presence, complete with error: ") );
+        
+// TODO THINGSIES
+
+    // Setup status event listener for RequestComplete
+    SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); // allow events after reqcomplete
+
+    // register interest
+    reqId = presWatch.UnsubscribePresentityGroupMembersPresenceL( *identity );
+
+    // Wait for events on the request
+    wrapper->WaitRequestAndStackEvents( reqId );
+    wrapper->VerifyEventStackL( _L8("Subscribing presentity group members presence, complete with error: ") );
+    // verify that UpdateInterest was called
+    COMMONASSERT( messenger, EXIMPPlgTestUnsubscribePresentityGroupMembersPresesenceCalled, "UnsubscribePresentityGroupMembersPresenceL was not called", ETrue, NULL );
+
+    CleanupStack::PopAndDestroy( 2, identity ); //pif, identity
+    
+    UnbindL();
+    }
+
+
+// ===========================================================================
+// SETUP HELPERS FOR THE LISTENER
+// ===========================================================================
+//
+void T_PresenceWatching::SetupListenerReqCompleteL( CXIMPTestContextWrapper* aWrapper, TXIMPTestStatusEventTemplate aEventType )
+    {
+    RArray< TInt32 > array;
+    CleanupClosePushL( array );
+    array.Append( MXIMPContextStateEvent::KInterfaceId );
+    array.Append( MPresentityPresenceEvent::KInterfaceId );
+    aWrapper->SetupListenerReqCompleteL( aEventType, &array );
+    CleanupStack::PopAndDestroy(); // array
+    }
+
+void T_PresenceWatching::SetupListenerReqCompleteAllowEventsL(  CXIMPTestContextWrapper* aWrapper, TXIMPTestStatusEventTemplate aEventType )
+    {
+    RArray< TInt32 > array;
+    CleanupClosePushL( array );
+    array.AppendL( MXIMPRequestCompleteEvent::KInterfaceId );
+    array.AppendL( MXIMPContextStateEvent::KInterfaceId );
+    array.AppendL( MPresentityPresenceEvent::KInterfaceId );
+    aWrapper->SetupListenerReqCompleteL( aEventType, &array );
+    CleanupStack::PopAndDestroy(); // array
+    }
+
+// ===========================================================================
+// TEST CASE TABLE
+// ===========================================================================
+//
+EUNIT_BEGIN_TEST_TABLE(
+        T_PresenceWatching,
+        "XIMP presence watching tests",
+        "MODULE" )
+
+PRFW_DECORATED_TEST(
+        "Subscribe single presence",
+        "",
+        "",
+        "FUNCTIONALITY",
+        Setup_L,
+        T_SubscribePresentityPresence_Single_L,
+        Teardown )
+
+PRFW_DECORATED_TEST(
+        "Subscribe single presence and handle the presence data with cache checking",
+        "",
+        "",
+        "FUNCTIONALITY",
+        Setup_L,
+        T_SubscribeHandlePresentityPresence_Single_L,
+        Teardown )
+
+PRFW_DECORATED_TEST(
+        "Subscribe single presence change id",
+        "",
+        "",
+        "FUNCTIONALITY",
+        Setup_L,
+        T_SubscribePresentityPresenceChangeId_Single_L,
+        Teardown )
+
+
+PRFW_DECORATED_TEST(
+        "Unsubscribe single presence",
+        "",
+        "",
+        "FUNCTIONALITY",
+        Setup_L,
+        T_UnsubscribeNotSubscribedPresentityPresence_Single_L,
+        Teardown )
+
+PRFW_DECORATED_TEST(
+        "Unsubscribe multiple presence",
+        "",
+        "",
+        "FUNCTIONALITY",
+        SetupMultiple_L,
+        T_UnsubscribeNotSubscribedPresentityPresence_Multiple_L,
+        Teardown )
+
+
+PRFW_DECORATED_TEST(
+        "Error From Plugin -> Leave when presentity subscribe is called",
+        "",
+        "",
+        "ERROHANDLING",
+        Setup_L,
+        T_ErrFromPlg_LeaveOnSubscribePresentityPresence_L,
+        Teardown )
+
+PRFW_DECORATED_TEST(
+        "Error From Plugin -> Leave when presentity unsubscribe is called",
+        "",
+        "",
+        "ERROHANDLING",
+        Setup_L,
+        T_ErrFromPlg_LeaveOnUnsubscribePresentityPresence_L,
+        Teardown )
+
+
+PRFW_DECORATED_TEST(
+        "Subscribe multiple presence",
+        "",
+        "",
+        "FUNCTIONALITY",
+        SetupMultiple_L,
+        T_SubscribePresentityPresence_Multiple_L,
+        Teardown )
+
+PRFW_DECORATED_TEST(
+        "Subscribe group members single presence",
+        "",
+        "",
+        "FUNCTIONALITY",
+        Setup_L,
+        T_SubscribePresentityGroupMembersPresence_Single_L,
+        Teardown )
+
+PRFW_DECORATED_TEST(
+        "Unsubscribe single group members presence",
+        "",
+        "",
+        "FUNCTIONALITY",
+        Setup_L,
+        T_UnsubscribeNotSubscribedPresentityGroupMembersPresence_Single_L,
+        Teardown )
+
+PRFW_DECORATED_TEST(
+        "Unsubscribe multiple group members presence",
+        "",
+        "",
+        "FUNCTIONALITY",
+        SetupMultiple_L,
+        T_UnsubscribeNotSubscribedPresentityGroupMembersPresence_Multiple_L,
+        Teardown )
+
+
+PRFW_DECORATED_TEST(
+        "Subscribe multiple presence for group members",
+        "",
+        "",
+        "FUNCTIONALITY",
+        SetupMultiple_L,
+        T_SubscribeGroupMembersPresence_Multiple_L,
+        Teardown )
+
+        
+PRFW_DECORATED_TEST(
+        "Error From Plugin -> Leave when presentity group members subscribe is called",
+        "",
+        "",
+        "ERROHANDLING",
+        Setup_L,
+        T_ErrFromPlg_LeaveOnSubscribePresentityGroupMembersPresence_L,
+        Teardown )
+
+PRFW_DECORATED_TEST(
+        "Error From Plugin -> Leave when presentity group members unsubscribe is called",
+        "",
+        "",
+        "ERROHANDLING",
+        Setup_L,
+        T_ErrFromPlg_LeaveOnUnsubscribePresentityGroupMembersPresence_L,
+        Teardown )
+        
+
+PRFW_DECORATED_TEST(
+        "Handle group members single presence",
+        "",
+        "",
+        "FUNCTIONALITY",
+        Setup_L,
+        T_ContentChangePresentityGroupMembersPresence_Single_L,
+        Teardown )
+
+
+EUNIT_END_TEST_TABLE
+
+
+// ===========================================================================
+// TEST SUITE CONSTRUCTION
+// ===========================================================================
+//
+EXPORT_C MEUnitTest* CreateTestSuiteL()
+    {
+    return T_PresenceWatching::NewL();
+    }
+
+
+// end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_presencewatching/t_presencewatching.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,111 @@
+/*
+* 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:
+*
+*/
+
+#ifndef T_PRESENCEWATCHING_H
+#define T_PRESENCEWATCHING_H
+
+
+//  EXTERNAL INCLUDES
+#include <platform/digia/eunit/ceunittestsuiteclass.h>
+#include <platform/digia/eunit/EUnitDecorators.h>
+#include <ximpbase.h>
+#include "prfwteststatuseventlistener.h"
+#include "prfwtestmessaging.h"
+
+class CXIMPTestContextWrapper;
+class CXIMPTestContextWrapperMgr;
+class CXIMPTestMessenger;
+class MPresenceCacheReader;
+
+/**
+ * XIMP Framework Eunit tests.
+ *
+ * Tests for XIMP session management services.
+ *
+ * @since S60 v4.0
+ */
+class T_PresenceWatching : public CEUnitTestSuiteClass
+    {
+
+public:
+    static T_PresenceWatching* NewL();
+    virtual ~T_PresenceWatching();
+
+
+private:
+    T_PresenceWatching();
+    void ConstructL();
+
+
+
+private:    // Test case functions
+
+    void Setup_L();
+    void SetupMultiple_L();
+    void BindL();
+    void BindAllL();
+    void Teardown();
+    void UnbindL();
+    void UnbindAllL();
+
+    void T_SubscribePresentityPresence_Single_L();
+    void T_SubscribeHandlePresentityPresence_Single_L();
+    void T_SubscribePresentityPresenceChangeId_Single_L();
+    void T_UnsubscribeNotSubscribedPresentityPresence_Single_L();
+    void T_UnsubscribeNotSubscribedPresentityPresence_Multiple_L();
+
+    void T_SubscribePresentityPresence_Multiple_L();
+    void T_SubscribePresentityGroupMembersPresence_Single_L();
+    void T_UnsubscribeNotSubscribedPresentityGroupMembersPresence_Single_L();
+    void T_UnsubscribeNotSubscribedPresentityGroupMembersPresence_Multiple_L();
+    void T_ContentChangePresentityGroupMembersPresence_Single_L();
+    
+    void T_ErrFromPlg_LeaveOnSubscribePresentityPresence_L();
+    void T_ErrFromPlg_LeaveOnSubscribePresentityGroupMembersPresence_L();
+    void T_ErrFromPlg_LeaveOnUnsubscribePresentityPresence_L();
+    void T_ErrFromPlg_LeaveOnUnsubscribePresentityGroupMembersPresence_L();
+    
+    void T_SubscribeGroupMembersPresence_Multiple_L();
+
+private:    // Test helpers
+
+    void SetupListenerReqCompleteL( CXIMPTestContextWrapper* aWrapper, TXIMPTestStatusEventTemplate aEventType );
+    void SetupListenerReqCompleteAllowEventsL( CXIMPTestContextWrapper* aWrapper, TXIMPTestStatusEventTemplate aEventTypes );
+
+private: // Test data
+
+    /**
+     * Eunit test case table declaration.
+     */
+    EUNIT_DECLARE_TEST_TABLE;
+
+    // owned
+    CXIMPTestContextWrapperMgr* iWrapperMgr;
+    
+    MPresenceCacheReader* iMPresenceCacheReader;
+    };
+
+
+#endif      //  T_PRESENCEWATCHING_H
+
+
+
+// end of file
+
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_presencewatching/t_presencewatching.mmp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,75 @@
+/*
+* 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:
+*
+*/
+
+#include            "../../tsrcutils/eunitcommon/eunittstdllbase.hrh"
+#include            "../../tsrcutils/processmaster/pm.h"
+
+#include<platform_paths.hrh>
+#include<eunitcaps.h>
+TARGET              t_presencewatching.dll
+//CAPABILITY              ALL - TCB - DRM
+CAPABILITY      EUNIT_CAPS
+SOURCEPATH          .
+SOURCE              t_presencewatching.cpp
+
+
+USERINCLUDE             ../../../../../ximpfw/core/srcdatamodel
+USERINCLUDE             ../../../../../ximpfw/presence/srcpresencedatamodel
+USERINCLUDE             ../../../../../ximpfw/presence/srcpresencedatamodel/presentitygroups
+USERINCLUDE             ../../../../../ximpfw/presence/srcpresencedatamodel/presencewatching
+USERINCLUDE             ../../../../../ximpfw/presence/srcpresencedatamodel/presenceauthorization
+USERINCLUDE             ../../../../../ximpfw/presence/srcpresencedatamodel/presencepublishing
+USERINCLUDE             ../../../../../ximpfw/presence/srcpresencedatamodel/presenceinfo
+USERINCLUDE             ../../../../../ximpfw/core/srcutils
+
+USERINCLUDE             ../../tsrcprotocols
+
+// TODO remove unnecessary
+#if defined ( OS_LAYER_SYSTEMINCLUDE )
+OS_LAYER_SYSTEMINCLUDE
+#else
+SYSTEMINCLUDE     /epoc32/include
+#endif
+
+ #if defined ( APP_LAYER_SYSTEMINCLUDE )
+ APP_LAYER_SYSTEMINCLUDE
+ #else
+ SYSTEMINCLUDE     \epoc32\include
+ #endif
+SYSTEMINCLUDE           ../../../../../ximpfw/inc/core/base
+SYSTEMINCLUDE           ../../../../../ximpfw/inc/core/datamodel
+SYSTEMINCLUDE           ../../../../../ximpfw/inc/core/protocolplugin
+SYSTEMINCLUDE           ../../../../../ximpfw/inc/core/protocolpluginhost
+SYSTEMINCLUDE           ../../../../../ximpfw/inc/presence/presencedatamodel
+SYSTEMINCLUDE           ../../../../../ximpfw/inc/presence/presencemanagement
+SYSTEMINCLUDE           ../../../../../ximpfw/inc/presence/presenceprotocolplugin
+SYSTEMINCLUDE           ../../../../../ximpfw/inc/presence/presenceprotocolpluginhost
+
+
+LIBRARY             ecom.lib
+LIBRARY             bafl.lib
+LIBRARY             ximpdatamodel.lib
+LIBRARY             estor.lib
+LIBRARY             presencedatamodel.lib
+LIBRARY             ximputils.lib
+LIBRARY                 EUnit.lib
+LIBRARY             eunitutil.lib
+LIBRARY             euser.lib
+
+// end of file
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_rootservices/bld.inf	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,23 @@
+/*
+* 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 t_rootservices.dll
+*
+*/
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_TESTMMPFILES
+t_rootservices.mmp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_rootservices/t_rootservices.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -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:
+*
+*/
+
+#include "t_rootservices.h"
+
+#include "eunittools.h"
+
+#include <ecom/ecom.h>
+#include <badesca.h>
+
+
+#include <platform/digia/eunit/eunitmacros.h>
+#include <platform/digia/eunit/teunitassertioninfo.h>
+
+//XIMP headers
+#include <ximpbase.h>
+#include <ximpclient.h>
+#include <ximpprotocolinfo.h>
+#include <ximpfeatureinfo.h>
+
+#include "prfwtestrobustnesstools.h"
+#include "prfwtestprotocols.h"
+
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// CONSTRUCTION
+T_RootServices* T_RootServices::NewL()
+    {
+    T_RootServices* self = new( ELeave ) T_RootServices;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+
+    return self;
+    }
+
+
+T_RootServices::~T_RootServices()
+    {
+    }
+
+
+void T_RootServices::ConstructL()
+    {
+    CEUnitTestSuiteClass::ConstructL();
+    }
+
+
+T_RootServices::T_RootServices()
+    {
+    }
+
+
+
+// ===========================================================================
+// TEST CASE SETUP & TEARDOWN METHODS
+// ===========================================================================
+//
+void T_RootServices::Setup_L()
+    {
+    PrfwTestRobustness::DoPreCleaning();
+    }
+
+
+
+void T_RootServices::Teardown()
+    {
+    REComSession::FinalClose();
+    PrfwTestRobustness::DoPreCleaning();
+    }
+
+
+
+// ===========================================================================
+// USAGE SCENARIO:
+//
+// ===========================================================================
+//
+void T_RootServices::Test_ListProtocolsAndTheirCapabilities_L()
+    {
+    //Initialize XIMP client
+    MXIMPClient* presClient = MXIMPClient::NewClientL();
+    CleanupDeletePushL( presClient );
+
+    RXIMPObjOwningPtrArray< MXIMPProtocolInfo > protocolList;
+    CleanupClosePushL( protocolList );
+
+    //List & dump all available protocols
+    presClient->GetProtocolsL( protocolList );
+    __DumpProtocolListL( protocolList );
+
+    //Verify that atleast main test protocol exist in list
+    //And for it is reported corect properties
+    TBool mainTestProtocolFound( EFalse );
+    for ( TInt index( 0 ); index < protocolList.Count(); index++ )
+        {
+        MXIMPProtocolInfo& protocol = *protocolList[ index ];
+        if (protocol.DisplayName() == K_PRFW_TST_PROTOCOL_1_DISPLAY_NAME )
+            {
+            if ( protocol.ImplementationUid() == TUid::Uid( K_PRFW_TST_PROTOCOL_1_IMPLEMENTATION_UID ) ) 
+                {
+                mainTestProtocolFound = ETrue;
+                break;
+                }
+            }
+        }
+
+    EUNIT_ASSERT_DESC( mainTestProtocolFound, "Primary test protocol not found." );
+
+    CleanupStack::PopAndDestroy(); //protocolList
+    CleanupStack::PopAndDestroy(); //presClient
+    }
+
+
+
+
+// ===========================================================================
+// HELPERS
+// ===========================================================================
+//
+void T_RootServices::__DumpProtocolListL(
+    RXIMPObjOwningPtrArray< MXIMPProtocolInfo >& aProtocolList )
+    {
+    const TInt count = aProtocolList.Count();
+    EUNIT_PRINT( _L( "Dumping %d protocols:"), count );
+
+    //Iterate through the list of protocols and dump details
+    for( TInt ix = 0; ix < count; ix++ )
+        {
+        MXIMPProtocolInfo& protocol = *aProtocolList[ ix ];
+        MXIMPFeatureInfo* feats = protocol.GetProtocolFeaturesLC();
+
+            {
+            TBuf< 1000 > buffer;
+
+            //Print protocol details
+            buffer.AppendFormat( _L("  Protocol %d: [%08x] [%S]"),
+                                 ix,
+                                 protocol.ImplementationUid(),
+                                 &protocol.DisplayName() );
+            EUNIT_PRINT( buffer );
+
+
+            //Print feature details
+            const MDesC8Array& featureIds = feats->FeatureIds();
+
+            const TInt featCount = featureIds.MdcaCount();
+            buffer.Zero();
+            buffer.AppendFormat( _L("  Supported features %d: "), featCount );
+
+            for( TInt ix = 0; ix < featCount; ix++ )
+                {
+                TBuf< 50 > tmpBuf;
+                tmpBuf.Copy( featureIds.MdcaPoint( ix ) );
+                buffer.AppendFormat( _L("%S "), &tmpBuf );
+                }
+
+            EUNIT_PRINT( buffer );
+            }
+
+        CleanupStack::PopAndDestroy(); //feats
+        }
+    }
+
+
+
+
+// ===========================================================================
+// TEST CASE TABLE
+// ===========================================================================
+//
+EUNIT_BEGIN_TEST_TABLE(
+    T_RootServices,
+    "XIMP root services",
+    "MODULE" )
+
+    PRFW_NOT_DECORATED_TEST(
+        "List available protocols and their capabilities",
+        "",
+        "",
+        "FUNCTIONALITY",
+        Setup_L,
+        Test_ListProtocolsAndTheirCapabilities_L,
+        Teardown )
+
+
+EUNIT_END_TEST_TABLE
+
+
+
+
+
+// ===========================================================================
+// TEST SUITE CONSTRUCTION
+// ===========================================================================
+//
+EXPORT_C MEUnitTest* CreateTestSuiteL()
+    {
+    return T_RootServices::NewL();
+    }
+
+
+// end of file
+
+
+
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_rootservices/t_rootservices.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,88 @@
+/*
+* 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:
+*
+*/
+
+#ifndef T_ROOTSERVICES_H__
+#define T_ROOTSERVICES_H__
+
+
+//  EXTERNAL INCLUDES
+#include <platform/digia/eunit/ceunittestsuiteclass.h>
+#include <platform/digia/eunit/EUnitDecorators.h>
+#include <ximpbase.h>
+
+class MXIMPProtocolInfo;
+class MXIMPClient;
+class MXIMPContext;
+class CUSContextObserver;
+
+
+/**
+ * XIMP Framework Eunit tests.
+ *
+ * Tests for XIMP root services.
+ *
+ * @since S60 v3.2
+ */
+class T_RootServices : public CEUnitTestSuiteClass
+    {
+public:
+    static T_RootServices* NewL();
+    virtual ~T_RootServices();
+
+
+private:
+    T_RootServices();
+    void ConstructL();
+
+
+
+private:    // Test case functions
+
+    void Setup_L();
+    void Teardown();
+
+    void Test_ListProtocolsAndTheirCapabilities_L();
+
+
+private:    // Test helpers
+
+    void __DumpProtocolListL(
+        RXIMPObjOwningPtrArray< MXIMPProtocolInfo >& aProtocolList );
+
+
+
+private: // Test data
+
+
+    /**
+     * Eunit test case table declaration.
+     */
+    EUNIT_DECLARE_TEST_TABLE;
+
+
+    };
+
+
+#endif      //  T_ROOTSERVICES_H__
+
+
+
+// end of file
+
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_rootservices/t_rootservices.mmp	Wed Nov 03 09:32:20 2010 +0530
@@ -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:
+*
+*/
+
+#include            "../../tsrcutils/eunitcommon/eunittstdllbase.hrh"
+#include            "../../tsrcutils/processmaster/pm.h"
+
+#include<platform_paths.hrh>
+#include<eunitcaps.h>
+TARGET              t_rootservices.dll
+CAPABILITY      EUNIT_CAPS
+
+SOURCEPATH          .
+SOURCE              t_rootservices.cpp
+
+USERINCLUDE             ../../../../../ximpfw/core/srcdatamodel
+USERINCLUDE             ../../../../../ximpfw/presence/srcpresencedatamodel
+USERINCLUDE             ../../../../../ximpfw/presence/srcpresencedatamodel/presentitygroups
+USERINCLUDE             ../../../../../ximpfw/presence/srcpresencedatamodel/presencewatching
+USERINCLUDE             ../../../../../ximpfw/presence/srcpresencedatamodel/presenceauthorization
+USERINCLUDE             ../../../../../ximpfw/presence/srcpresencedatamodel/presencepublishing
+USERINCLUDE             ../../../../../ximpfw/presence/srcpresencedatamodel/presenceinfo
+USERINCLUDE             ../../../../../ximpfw/core/srcutils
+
+
+USERINCLUDE         ../../tsrcprotocols
+#if defined ( OS_LAYER_SYSTEMINCLUDE )
+OS_LAYER_SYSTEMINCLUDE
+#else
+SYSTEMINCLUDE     /epoc32/include
+#endif
+
+ #if defined ( APP_LAYER_SYSTEMINCLUDE )
+ APP_LAYER_SYSTEMINCLUDE
+ #else
+ SYSTEMINCLUDE     \epoc32\include
+ #endif
+LIBRARY             ecom.lib
+LIBRARY             bafl.lib
+LIBRARY             ximpdatamodel.lib
+LIBRARY             presencedatamodel.lib
+LIBRARY             estor.lib
+LIBRARY             ximputils.lib
+LIBRARY                 EUnit.lib
+LIBRARY             eunitutil.lib
+LIBRARY             euser.lib
+// end of file
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_sessionmng/bld.inf	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,23 @@
+/*
+* 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 t_sessionmng.dll
+*
+*/
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_TESTMMPFILES
+t_sessionmng.mmp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_sessionmng/t_sessionmng.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,874 @@
+/*
+* 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:
+*
+*/
+
+
+#include <ecom/ecom.h>
+#include <badesca.h>
+#include <e32base.h>
+
+#include "t_sessionmng.h"
+#include "prfwteststatuseventlistener.h"
+#include "prfwtestmessaging.h"
+#include "prfwtestmessenger.h"
+#include "prfwtestcontextwrappermgr.h"
+#include "prfwtestcontextwrapper.h"
+#include "prfwtestfiletool.h"
+#include "userafter.h"
+
+#include "eunittools.h"
+#include "prfwtestrobustnesstools.h"
+#include "prfwtestprotocols.h"
+
+#include <ximpclient.h>
+#include <ximpcontext.h>
+#include <ximpcontextstateevent.h>
+#include <ximprequestcompleteevent.h>
+#include <ximpstatus.h>
+#include <ximpfeatureinfo.h>
+#include <ximpserviceinfo.h>
+
+
+
+#include <platform/digia/eunit/eunitmacros.h>
+#include <platform/digia/eunit/teunitassertioninfo.h>
+
+
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// CONSTRUCTION
+T_SessionMng* T_SessionMng::NewL()
+    {
+    T_SessionMng* self = new( ELeave ) T_SessionMng;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+
+    return self;
+    }
+
+
+T_SessionMng::~T_SessionMng()
+    {
+    delete iWrapperMgr;
+    
+    CXIMPTestFileTool::CleanAllL();
+    }
+
+
+void T_SessionMng::ConstructL()
+    {
+    CEUnitTestSuiteClass::ConstructL();
+    CXIMPTestFileTool::CleanAllL();
+    }
+
+
+T_SessionMng::T_SessionMng()
+    {
+    }
+
+
+
+// ===========================================================================
+// TEST CASE SETUP & TEARDOWN METHODS
+// ===========================================================================
+//
+
+void T_SessionMng::Setup_L()
+    {
+    PrfwTestRobustness::DoPreCleaning();
+
+    // now we're using only one connection
+    iWrapperMgr = CXIMPTestContextWrapperMgr::NewL();
+    iWrapperMgr->CreateWrapperL();
+    }
+
+
+void T_SessionMng::Setup_2_L()
+    {
+    iWrapperMgr = CXIMPTestContextWrapperMgr::NewL();
+
+    // two wrappers
+    iWrapperMgr->CreateWrapperL();
+    iWrapperMgr->CreateWrapperL();
+    }
+
+
+void T_SessionMng::Setup_3_L()
+    {
+    iWrapperMgr = CXIMPTestContextWrapperMgr::NewL();
+
+    // three wrappers for unbalanced bind/share unbind/unshare test
+    iWrapperMgr->CreateWrapperL();
+    iWrapperMgr->CreateWrapperL();
+    iWrapperMgr->CreateWrapperL();
+    }
+
+
+void T_SessionMng::Teardown()
+    {
+    delete iWrapperMgr;
+    iWrapperMgr = NULL;
+
+    REComSession::FinalClose();
+
+    PrfwTestRobustness::DoPreCleaning();
+    }
+
+
+
+// ===========================================================================
+// TEST CASE
+// ===========================================================================
+void T_SessionMng::T_Simple_Bind_Wait_Unbind_L()
+    {
+    EUNIT_PRINT( _L("Simple context Bind/Unbind test.") );
+    EUNIT_PRINT( _L("Client side waits bind completion before issuing unbind.") );
+
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    MXIMPContext* context = wrapper->GetContext();
+    CXIMPTestStatusEventListener* eventListener = wrapper->GetEventListener();
+    CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+    //Do bind, wait and verify events
+    wrapper->SetupListenerL( EXIMPTestStatusEvents_BindingOk );
+    
+    messenger->SetPluginIndex( 0 );
+    messenger->SetNoError();
+
+    TXIMPRequestId reqId;
+    reqId = BindContextToDefaultL( context );
+    EUNIT_ASSERT( reqId != TXIMPRequestId::Null() );
+
+    wrapper->WaitRequestAndStackEvents( reqId );
+    wrapper->VerifyEventStackL( _L8("Binding single context: ") );
+
+    messenger->AssertOpenSessionCalled( ETrue );
+
+    //Verify features availability
+    MXIMPFeatureInfo* ctxFeats = context->GetContextFeaturesLC();
+    EUNIT_ASSERT_DESC( ctxFeats->FeatureIds().MdcaCount() > 0, "No features from context" );
+    CleanupStack::PopAndDestroy(); //ctxFeats
+
+    //Do unbind, wait and verify events
+    wrapper->SetupListenerL( EXIMPTestStatusEvents_UnbindingOk );
+    messenger->SetNoError();
+    reqId = context->UnbindL();
+    EUNIT_ASSERT( reqId != TXIMPRequestId::Null() );
+
+    wrapper->WaitRequestAndStackEvents( reqId );
+    wrapper->VerifyEventStackL( _L8("Unbinding single context: ") );
+
+    messenger->AssertCloseSessionCalled( ETrue );
+    messenger->AssertPluginDied( ETrue );
+    }
+
+// ===========================================================================
+// TEST CASE
+// ===========================================================================
+void T_SessionMng::T_Settings_Bind_Wait_Unbind_L()
+    {
+    EUNIT_PRINT( _L("Context Bind with Settings id/Unbind test.") );
+    EUNIT_PRINT( _L("Client side waits bind completion before issuing unbind.") );
+
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    MXIMPContext* context = wrapper->GetContext();
+    CXIMPTestStatusEventListener* eventListener = wrapper->GetEventListener();
+    CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+    //Do bind, wait and verify events
+    wrapper->SetupListenerL( EXIMPTestStatusEvents_BindingOk );
+    
+    messenger->SetPluginIndex( 0 );
+    messenger->SetNoError();
+
+    TXIMPRequestId reqId;
+    TUid protocol = { K_PRFW_TST_PROTOCOL_1_IMPLEMENTATION_UID };
+    reqId = context->BindToL( protocol, 0 );
+    
+    EUNIT_ASSERT( reqId != TXIMPRequestId::Null() );
+
+    wrapper->WaitRequestAndStackEvents( reqId );
+    wrapper->VerifyEventStackL( _L8("Binding single context: ") );
+
+    messenger->AssertOpenSessionCalled( ETrue );
+
+    //Verify features availability
+    MXIMPFeatureInfo* ctxFeats = context->GetContextFeaturesLC();
+    EUNIT_ASSERT_DESC( ctxFeats->FeatureIds().MdcaCount() > 0, "No features from context" );
+    CleanupStack::PopAndDestroy(); //ctxFeats
+
+    //Do unbind, wait and verify events
+    wrapper->SetupListenerL( EXIMPTestStatusEvents_UnbindingOk );
+    messenger->SetNoError();
+    reqId = context->UnbindL();
+    EUNIT_ASSERT( reqId != TXIMPRequestId::Null() );
+
+    wrapper->WaitRequestAndStackEvents( reqId );
+    wrapper->VerifyEventStackL( _L8("Unbinding single context: ") );
+
+    messenger->AssertCloseSessionCalled( ETrue );
+    messenger->AssertPluginDied( ETrue );
+    }
+
+
+// ===========================================================================
+// TEST CASE
+// ===========================================================================
+void T_SessionMng::T_Simple_Bind_Wait_OOM_L()
+    {
+    EUNIT_PRINT( _L("Simple context Bind OOM test.") );
+    EUNIT_PRINT( _L("Client side waits bind completion in alloc heaven.") );
+
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    MXIMPContext* context = wrapper->GetContext();
+    CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+    //Do bind, wait and verify events
+    wrapper->SetupListenerReqCompleteL( EXIMPTestStatusEvents_RequestOk );
+
+    messenger->SetPluginIndex( 0 );
+    messenger->SetNoError();
+
+    TXIMPRequestId reqId;
+    reqId = BindContextToDefaultL( context );
+    EUNIT_ASSERT( reqId != TXIMPRequestId::Null() );
+
+    wrapper->WaitRequestAndStackEvents( reqId );
+    
+    CXIMPTestStatusEventListener* eventListener = wrapper->GetEventListener();    
+    TInt reqCompleteErr = eventListener->GetReqCompletionErrL( reqId );
+    User::LeaveIfError( reqCompleteErr );
+    
+    wrapper->VerifyEventStackL( _L8("Binding single context in OOM: ") );
+    }
+
+
+// ===========================================================================
+// TEST CASE
+// ===========================================================================
+void T_SessionMng::T_Simple_Bind_Wait_Unbind_WithReqCompleteEventFilter_L()
+    {
+    EUNIT_PRINT( _L("Simple context Bind/Unbind test.") );
+    EUNIT_PRINT( _L("Client side waits bind completion before issuing unbind.") );
+    EUNIT_PRINT( _L("Client event filter accepts only request completion events") );
+
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    MXIMPContext* context = wrapper->GetContext();
+    CXIMPTestStatusEventListener* eventListener = wrapper->GetEventListener();
+    CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+    //Accept only ReqComplete events
+    wrapper->SetupListenerReqCompleteL( EXIMPTestStatusEvents_RequestOk );
+    
+    messenger->SetPluginIndex( 0 );
+    messenger->SetNoError();
+    
+    
+    //Do bind, wait and verify events    
+    TXIMPRequestId reqId = BindContextToDefaultL( context );
+
+    wrapper->WaitRequestAndStackEvents( reqId );
+    wrapper->VerifyEventStackL( _L8("Binding single context, accepting only reqComplete events: ") );
+    messenger->AssertOpenSessionCalled( ETrue );
+    
+
+    //Accept only ReqComplete events
+    wrapper->SetupListenerReqCompleteL( EXIMPTestStatusEvents_RequestOk );
+    messenger->SetNoError();
+
+    //Do unbind, wait and verify events
+    reqId = context->UnbindL();
+
+    wrapper->WaitRequestAndStackEvents( reqId );
+    wrapper->VerifyEventStackL( _L8("Unbinding single context, accepting only reqComplete events: ") );
+
+    messenger->AssertCloseSessionCalled( ETrue );
+    }
+
+
+
+// ===========================================================================
+// TEST CASE
+// ===========================================================================
+//
+void T_SessionMng::T_Simple_Bind_Wait_CloseHandle_L()
+    {
+    EUNIT_PRINT( _L("Simple context Bind/CloseHandle test.") );
+    EUNIT_PRINT( _L("Client side waits bind completion before closing the handle.") );
+
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    MXIMPContext* context = wrapper->GetContext();
+    CXIMPTestStatusEventListener* eventListener = wrapper->GetEventListener();
+    CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+    //Do bind, wait and verify events
+    wrapper->SetupListenerL( EXIMPTestStatusEvents_BindingOk );
+
+    messenger->SetPluginIndex( 0 );
+    messenger->SetNoError();
+
+    TXIMPRequestId reqId = BindContextToDefaultL( context );
+
+    wrapper->WaitRequestAndStackEvents( reqId );
+    wrapper->VerifyEventStackL( _L8("Binding single context: ") );
+
+    messenger->AssertOpenSessionCalled( ETrue );
+
+
+    //Close handle and verify events
+    wrapper->ClearListener();    
+    messenger->SetNoError();
+    wrapper->DeletePresenceContext();
+    
+    
+    // we give 10 sec to plugin to die
+    CUserAfter::AfterSecondsL( 10 );
+
+
+    messenger->AssertCloseSessionCalled( ETrue );
+    messenger->AssertPluginDied( ETrue );
+
+    wrapper->VerifyEventStackL( _L8("Closing single context handle: ") );
+    }
+
+
+
+// ===========================================================================
+// TEST CASE
+// ===========================================================================
+//
+void T_SessionMng::T_Simple_Bind_Direct_Unbind_L()
+    {
+    EUNIT_PRINT( _L("Simple context Bind/Unbind test.") );
+    EUNIT_PRINT( _L("Client side deletes context while the binding is still active.") );
+
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    MXIMPContext* context = wrapper->GetContext();
+    CXIMPTestStatusEventListener* eventListener = wrapper->GetEventListener();
+    CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+    wrapper->SetupListenerL( EXIMPTestStatusEvents_BindingOk );
+    wrapper->AppendToTraitsL( EXIMPTestStatusEvents_UnbindingOk );
+
+    
+    messenger->SetPluginIndex( 0 );
+    messenger->SetNoError(); //For binding
+
+    
+    TXIMPRequestId bindReqId = BindContextToDefaultL( context );
+
+
+    messenger->AssertOpenSessionCalled( ETrue );
+
+    messenger->SetNoError(); // for unbinding
+    TXIMPRequestId unbindReqId = context->UnbindL();
+
+    wrapper->WaitRequestAndStackEvents( bindReqId );
+    wrapper->WaitRequestAndStackEvents( unbindReqId );
+
+    wrapper->VerifyEventStackL( _L8("Direct Bind/Unbind single context: ") );
+
+    messenger->AssertCloseSessionCalled( ETrue );
+    messenger->AssertPluginDied( ETrue );
+    }
+
+
+
+
+// ===========================================================================
+// TEST CASE
+// ===========================================================================
+//
+void T_SessionMng::T_Simple_Bind_Direct_CloseHandle_L()
+    {
+    EUNIT_PRINT( _L("Simple context Bind/Unbind test.") );
+    EUNIT_PRINT( _L("Client side closes context handle while the binding is still active.") );
+
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    MXIMPContext* context = wrapper->GetContext();
+    CXIMPTestStatusEventListener* eventListener = wrapper->GetEventListener();
+    CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+   
+    messenger->SetPluginIndex( 0 );
+    messenger->SetNoError();   
+
+
+    TXIMPRequestId reqId = BindContextToDefaultL( context );
+
+    messenger->AssertOpenSessionCalled( ETrue );
+    wrapper->DeletePresenceContext();
+
+    // wait for plugin to die properly here
+    CUserAfter::AfterSecondsL( 10 );
+
+    messenger->AssertCloseSessionCalled( ETrue );
+    messenger->AssertPluginDied( ETrue );
+    }
+
+
+
+
+// ===========================================================================
+// TEST CASE
+// ===========================================================================
+//
+void T_SessionMng::T_ErrFromPlg_LeaveOnOpenSession_L()
+    {
+    EUNIT_PRINT( _L("Error from plug-in in bind/unbind." ) );
+    EUNIT_PRINT( _L("Plug-in leaves from OpenSessionL()." ) );
+
+
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    MXIMPContext* context = wrapper->GetContext();
+    CXIMPTestStatusEventListener* eventListener = wrapper->GetEventListener();
+    CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+        {
+        wrapper->SetupListenerL( EXIMPTestStatusEvents_BindingFailKErrAbort );
+        messenger->SetLeave( KErrAbort );
+        messenger->SetPluginIndex( 0 );
+        
+        TXIMPRequestId reqId = BindContextToDefaultL( context );
+
+        wrapper->WaitRequestAndStackEvents( reqId );
+        wrapper->VerifyEventStackL( _L8("Binding single context: ") );
+
+        //Verify that features are not available
+        TRAPD( featLoadErr,
+                MXIMPFeatureInfo* ctxFeats = context->GetContextFeaturesLC();
+                CleanupStack::PopAndDestroy(); //ctxFeats
+             );
+        EUNIT_ASSERT_NOT_EQUALS( featLoadErr, KErrNone );
+
+        // plugin should've been unloaded without calling CloseSession
+        EUNIT_ASSERT_DESC( ! messenger->GetBoolean( EXIMPPlgTestCloseSessionCalled ), "CloseSession was called" );
+
+        messenger->AssertPluginDied( ETrue );
+        }
+    }
+
+
+// ===========================================================================
+// TEST CASE:
+// ===========================================================================
+//
+void T_SessionMng::T_ErrFromPlg_ErrorResultOnOpenSession_L()
+    {
+    EUNIT_PRINT( _L("Error from plug-in in bind/unbind") );
+    EUNIT_PRINT( _L("Plug-in completes OpenSessionL() with error") );
+    EUNIT_PRINT( _L("Clint ctx can be reused for second bind.") );
+
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    MXIMPContext* context = wrapper->GetContext();
+    CXIMPTestStatusEventListener* eventListener = wrapper->GetEventListener();
+    CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+        {
+        wrapper->SetupListenerL( EXIMPTestStatusEvents_BindingFailKErrAbort );
+
+        messenger->SetError( KErrAbort );
+
+        messenger->SetPluginIndex( 0 );
+
+        TXIMPRequestId reqId = BindContextToDefaultL( context );
+
+        wrapper->WaitRequestAndStackEvents( reqId );
+        wrapper->VerifyEventStackL( _L8("Binding single context: ") );
+
+
+        // plugin should've been unloaded without calling CloseSession
+        EUNIT_ASSERT_DESC( ! messenger->GetBoolean( EXIMPPlgTestCloseSessionCalled ), "CloseSession was called" );
+        messenger->AssertPluginDied( ETrue );
+        }
+
+    
+    //It should be possible to reuse client ctx for second bind
+        {
+        //Do bind, wait and verify events
+        wrapper->SetupListenerL( EXIMPTestStatusEvents_BindingOk );
+        
+        messenger->SetPluginIndex( 0 );
+        messenger->SetNoError();
+
+        TXIMPRequestId reqId;
+        reqId = BindContextToDefaultL( context );
+        EUNIT_ASSERT( reqId != TXIMPRequestId::Null() );
+
+        wrapper->WaitRequestAndStackEvents( reqId );
+        wrapper->VerifyEventStackL( _L8("Binding single context: ") );
+
+        messenger->AssertOpenSessionCalled( ETrue );
+
+        //Verify features availability
+        MXIMPFeatureInfo* ctxFeats = context->GetContextFeaturesLC();
+        EUNIT_ASSERT_DESC( ctxFeats->FeatureIds().MdcaCount() > 0, "No features from context" );
+        CleanupStack::PopAndDestroy(); //ctxFeats
+
+        //Do unbind, wait and verify events
+        wrapper->SetupListenerL( EXIMPTestStatusEvents_UnbindingOk );
+        messenger->SetNoError();
+        reqId = context->UnbindL();
+        EUNIT_ASSERT( reqId != TXIMPRequestId::Null() );
+
+        wrapper->WaitRequestAndStackEvents( reqId );
+        wrapper->VerifyEventStackL( _L8("Unbinding single context: ") );
+
+        messenger->AssertCloseSessionCalled( ETrue );
+        messenger->AssertPluginDied( ETrue );
+        }    
+    }
+
+
+// ===========================================================================
+// TEST CASE:
+// Simple bind, bind error
+// ===========================================================================
+//
+void T_SessionMng::T_ErrFromPlg_InvalidReqIdOnOpenSession_L()
+    {
+    EUNIT_PRINT( _L("Error from plug-in in bind/unbind") );
+    EUNIT_PRINT( _L("Plug-in completes OpenSessionL() with faulty ReqId") );
+
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    MXIMPContext* context = wrapper->GetContext();
+    CXIMPTestStatusEventListener* eventListener = wrapper->GetEventListener();
+    CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+        {
+        wrapper->SetupListenerL( EXIMPTestStatusEvents_BindingFailInvalidReqId );
+        messenger->SetBoolean( EXIMPTestPlgBehaveInvalidReqId );
+        messenger->SetPluginIndex( 0 );
+        
+        TXIMPRequestId reqId = BindContextToDefaultL( context );
+
+        wrapper->WaitRequestAndStackEvents( reqId );
+        wrapper->VerifyEventStackL( _L8("Binding single context: ") );
+        }
+
+    }
+
+
+
+// ===========================================================================
+// TEST CASE:
+// ===========================================================================
+//
+void T_SessionMng::T_ErrFromPlg_ErrorResultOnCloseSession_L()
+    {
+    EUNIT_PRINT( _L("Error from plug-in in bind/unbind") );
+    EUNIT_PRINT( _L("Plug-in completes CloseSession() with error") );
+
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    MXIMPContext* context = wrapper->GetContext();
+    CXIMPTestStatusEventListener* eventListener = wrapper->GetEventListener();
+    CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+    //Do bind, wait and verify events
+    wrapper->SetupListenerL( EXIMPTestStatusEvents_BindingOk );
+
+    messenger->SetNoError();
+
+    messenger->SetPluginIndex( 0 );
+    
+    TXIMPRequestId reqId = BindContextToDefaultL( context );    
+
+
+    wrapper->WaitRequestAndStackEvents( reqId );
+    wrapper->VerifyEventStackL( _L8("Binding single context: ") );
+
+    messenger->AssertOpenSessionCalled( ETrue );
+
+    //Do unbind, wait and verify events
+    wrapper->SetupListenerL( EXIMPTestStatusEvents_UnbindingOk );
+
+    messenger->SetError( KErrCouldNotDisconnect );
+    reqId = context->UnbindL();
+
+    wrapper->WaitRequestAndStackEvents( reqId );
+    wrapper->VerifyEventStackL( _L8("Unbinding single context: ") );
+
+    messenger->AssertPluginDied( ETrue );
+    }
+
+  
+
+
+
+// ===========================================================================
+// TEST CASE
+// ===========================================================================
+//
+void T_SessionMng::T_Multi_Bind_Unbind_WithWaits_L()
+    {
+    EUNIT_PRINT( _L("Multiple context Bind/Unbind test.") );
+    EUNIT_PRINT( _L("Client performs multiple bind & unbinds for a separated context sharing a connection.") );
+
+    TInt ix;
+
+    // bind contexts
+    for ( ix = 0; ix < 3; ix++ )
+        {
+        CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( ix );
+        MXIMPContext* context = wrapper->GetContext();
+        CXIMPTestStatusEventListener* eventListener = wrapper->GetEventListener();
+        CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+        if ( ix == 1 )
+            {
+            // fail the middle one
+            wrapper->SetupListenerL( EXIMPTestStatusEvents_BindingFailKErrAbort );
+            messenger->SetError( KErrAbort );   // for binding
+            }
+        else
+            {
+            wrapper->SetupListenerL( EXIMPTestStatusEvents_BindingOk );
+            messenger->SetNoError();   // for binding
+            }
+
+        messenger->SetPluginIndex( ix );
+
+        TUid protocol = { K_PRFW_TST_PROTOCOL_1_IMPLEMENTATION_UID };
+        const TDesC16& instanceId = wrapper->InstanceId();
+        TXIMPRequestId reqId = context->BindToL( protocol,
+                                                _L("www.imps.no/wv"),
+                                                _L("user"),
+                                                _L("password"),
+                                                instanceId,
+                                                ix );
+
+        wrapper->WaitRequestAndStackEvents( reqId );
+
+        TBuf8<100> title;
+        title.AppendFormat( _L8("Bind [%d]: "), ix );
+        wrapper->VerifyEventStackL( title );
+
+        switch ( ix )
+            {
+            case 0 :
+            case 1 :
+            case 2 :
+                {
+                messenger->AssertOpenSessionCalled( ETrue );
+                break;
+                }
+            default :
+                {
+                break;
+                }
+            }
+    }
+
+
+    // now context has been bound.
+    // one has failed, but two are okay. do 3 unbinds.
+    for( ix = 0; ix < 3; ix++ )
+        {
+        CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( ix );
+        MXIMPContext* context = wrapper->GetContext();
+        CXIMPTestStatusEventListener* eventListener = wrapper->GetEventListener();
+        CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+        if ( ix == 1 )
+            {
+            // the middle one has failed
+            TRAPD( err, context->UnbindL() );
+            EUNIT_ASSERT_EQUALS( err, KErrNotReady );
+            }
+
+        else
+            {
+            // we expect all unbinds to be okay from client point of view
+            wrapper->SetupListenerL( EXIMPTestStatusEvents_UnbindingOk );
+            messenger->SetNoError();   // For unbinding
+
+            TXIMPRequestId reqId = context->UnbindL();
+            wrapper->WaitRequestAndStackEvents( reqId );
+
+            TBuf8<100> title;
+            title.AppendFormat( _L8("Unbind [%d]: "), ix );
+            wrapper->VerifyEventStackL( title );
+            messenger->AssertCloseSessionCalled( ETrue );
+            }
+        }
+    }
+    
+    
+TXIMPRequestId T_SessionMng::BindContextToDefaultL( MXIMPContext* aContext )
+    {
+    TUid protocol = { K_PRFW_TST_PROTOCOL_1_IMPLEMENTATION_UID };
+    return aContext->BindToL( protocol,
+                             _L("www.imps.no/wv"),
+                             _L("user"),
+                             _L("password"),
+                             0 ); 
+    }
+
+
+
+// ===========================================================================
+// TEST CASE TABLE
+// ===========================================================================
+//
+EUNIT_BEGIN_TEST_TABLE(
+        T_SessionMng,
+        "XIMP session management tests",
+        "MODULE" )
+
+
+PRFW_NOT_DECORATED_TEST(
+        "Simple bind wait unbind",
+        "",
+        "",
+        "FUNCTIONALITY",
+        Setup_L,
+        T_Simple_Bind_Wait_Unbind_L,
+        Teardown )
+
+ PRFW_NOT_DECORATED_TEST(
+        "Settings bind wait unbind",
+        "",
+        "",
+        "FUNCTIONALITY",
+        Setup_L,
+        T_Settings_Bind_Wait_Unbind_L,
+        Teardown )
+
+EUNIT_ALLOC_TEST(
+        "Simple bind in OOM",
+        "",
+        "",
+        "FUNCTIONALITY",
+        Setup_L,
+        T_Simple_Bind_Wait_OOM_L,
+        Teardown )
+
+
+PRFW_NOT_DECORATED_TEST(
+        "Simple bind wait unbind with reqComplete event filter",
+        "",
+        "",
+        "FUNCTIONALITY",
+        Setup_L,
+        T_Simple_Bind_Wait_Unbind_WithReqCompleteEventFilter_L,
+        Teardown )
+
+PRFW_NOT_DECORATED_TEST(
+        "Simple bind wait close handle",
+        "",
+        "",
+        "FUNCTIONALITY",
+        Setup_L,
+        T_Simple_Bind_Wait_CloseHandle_L,
+        Teardown )
+
+
+PRFW_NOT_DECORATED_TEST(
+        "Simple bind direct unbind",
+        "",
+        "",
+        "FUNCTIONALITY",
+        Setup_L,
+        T_Simple_Bind_Direct_Unbind_L,
+        Teardown )
+
+
+PRFW_NOT_DECORATED_TEST(
+        "Simple bind direct close handle",
+        "",
+        "",
+        "FUNCTIONALITY",
+        Setup_L,
+        T_Simple_Bind_Direct_CloseHandle_L,
+        Teardown )
+
+
+// opensession errors
+PRFW_NOT_DECORATED_TEST(
+        "ErrFromPlg leave OpenSession",
+        "",
+        "",
+        "ERROHANDLING",
+        Setup_L,
+        T_ErrFromPlg_LeaveOnOpenSession_L,
+        Teardown )
+
+PRFW_NOT_DECORATED_TEST(
+        "ErrFromPlg OpenSession",
+        "",
+        "",
+        "ERROHANDLING",
+        Setup_L,
+        T_ErrFromPlg_ErrorResultOnOpenSession_L,
+        Teardown )
+
+
+
+PRFW_NOT_DECORATED_TEST(
+        "ErrFromPlg Invalid ReqId",
+        "",
+        "",
+        "ERROHANDLING",
+        Setup_L,
+        T_ErrFromPlg_InvalidReqIdOnOpenSession_L,
+        Teardown )
+
+
+// closesession errors
+PRFW_NOT_DECORATED_TEST(
+        "ErrFromPlg CloseSession",
+        "",
+        "",
+        "ERROHANDLING",
+        Setup_L,
+        T_ErrFromPlg_ErrorResultOnCloseSession_L,
+        Teardown )
+
+
+// multiple bind + unbind tests
+PRFW_NOT_DECORATED_TEST(
+        "Multiple context Bind/Unbind test.",
+        "",
+        "",
+        "ERROHANDLING",
+        Setup_3_L,
+        T_Multi_Bind_Unbind_WithWaits_L,
+        Teardown )
+
+
+EUNIT_END_TEST_TABLE
+
+
+// ===========================================================================
+// TEST SUITE CONSTRUCTION
+// ===========================================================================
+//
+EXPORT_C MEUnitTest* CreateTestSuiteL()
+    {
+    return T_SessionMng::NewL();
+    }
+
+
+// end of file
+
+
+
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_sessionmng/t_sessionmng.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,113 @@
+/*
+* 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:
+*
+*/
+
+#ifndef T_SESSIONMNG_H__
+#define T_SESSIONMNG_H__
+
+
+//  EXTERNAL INCLUDES
+#include <platform/digia/eunit/ceunittestsuiteclass.h>
+#include <platform/digia/eunit/EUnitDecorators.h>
+#include <ximpbase.h>
+
+#include "prfwteststatuseventlistener.h"
+
+
+class CXIMPTestContextWrapperMgr;
+class MXIMPContext;
+
+/**
+ * XIMP Framework Eunit tests.
+ *
+ * Tests for XIMP session management services.
+ *
+ * @since S60 v4.0
+ */
+class T_SessionMng : public CEUnitTestSuiteClass
+    {
+
+public:
+    static T_SessionMng* NewL();
+    virtual ~T_SessionMng();
+
+
+private:
+    T_SessionMng();
+    void ConstructL();
+
+
+
+private:    // Test case functions
+
+    void Teardown();
+    
+    void Setup_L();
+    void Setup_2_L();
+    void Setup_3_L();
+
+   
+    void T_Simple_Bind_Wait_Unbind_L();
+    void T_Settings_Bind_Wait_Unbind_L();
+    void T_Simple_Bind_Wait_OOM_L();
+
+    void T_Simple_Bind_Wait_Unbind_WithReqCompleteEventFilter_L();
+    void T_Simple_Bind_Wait_CloseHandle_L();
+    void T_Simple_Bind_Direct_Unbind_L();
+    void T_Simple_Bind_Direct_CloseHandle_L();
+
+
+
+    void T_ErrFromPlg_LeaveOnOpenSession_L();
+    void T_ErrFromPlg_ErrorResultOnOpenSession_L();
+    void T_ErrFromPlg_ErrorResultOnCloseSession_L();
+    
+    void T_ErrFromPlg_InvalidReqIdOnOpenSession_L();
+    void T_Multi_Bind_Unbind_WithWaits_L();    
+    
+
+
+private:    // Test helpers
+
+    TXIMPRequestId BindContextToDefaultL( MXIMPContext* aContext );
+
+
+
+
+
+private: // Test data
+
+    /**
+     * Eunit test case table declaration.
+     */
+    EUNIT_DECLARE_TEST_TABLE;
+
+    /**
+     * Context Wrapper Manager
+     */
+    CXIMPTestContextWrapperMgr* iWrapperMgr;
+
+    };
+
+#endif      //  T_SESSIONMNG_H__
+
+
+
+// end of file
+
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_sessionmng/t_sessionmng.mmp	Wed Nov 03 09:32:20 2010 +0530
@@ -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:
+*
+*/
+
+#include            "../../tsrcutils/eunitcommon/eunittstdllbase.hrh"
+#include            "../../tsrcutils/processmaster/pm.h"
+
+#include<platform_paths.hrh>
+#include<eunitcaps.h>
+TARGET              t_sessionmng.dll
+CAPABILITY      EUNIT_CAPS
+
+SOURCEPATH          .
+SOURCE              t_sessionmng.cpp
+
+USERINCLUDE             ../../../../../ximpfw/core/srcdatamodel
+USERINCLUDE             ../../../../../ximpfw/presence/srcpresencedatamodel
+USERINCLUDE             ../../../../../ximpfw/presence/srcpresencedatamodel/presentitygroups
+USERINCLUDE             ../../../../../ximpfw/presence/srcpresencedatamodel/presencewatching
+USERINCLUDE             ../../../../../ximpfw/presence/srcpresencedatamodel/presenceauthorization
+USERINCLUDE             ../../../../../ximpfw/presence/srcpresencedatamodel/presencepublishing
+USERINCLUDE             ../../../../../ximpfw/presence/srcpresencedatamodel/presenceinfo
+USERINCLUDE             ../../../../../ximpfw/core/srcutils
+USERINCLUDE         ../../tsrcprotocols
+
+#if defined ( OS_LAYER_SYSTEMINCLUDE )
+OS_LAYER_SYSTEMINCLUDE
+#else
+SYSTEMINCLUDE     /epoc32/include
+#endif
+
+ #if defined ( APP_LAYER_SYSTEMINCLUDE )
+ APP_LAYER_SYSTEMINCLUDE
+ #else
+ SYSTEMINCLUDE     \epoc32\include
+ #endif
+LIBRARY             ecom.lib
+LIBRARY             bafl.lib
+LIBRARY             ximpdatamodel.lib
+LIBRARY             presencedatamodel.lib
+LIBRARY             estor.lib
+LIBRARY             ximputils.lib
+LIBRARY                 EUnit.lib
+LIBRARY             eunitutil.lib
+LIBRARY             euser.lib
+// end of file
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_utils/bld.inf	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,23 @@
+/*
+* 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 t_utils.dll
+ *
+*/
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_TESTMMPFILES
+t_utils.mmp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_utils/t_utils.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,646 @@
+/*
+* 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:
+*
+*/
+
+
+
+#include <ecom/ecom.h>
+#include <badesca.h>
+#include <e32property.h>
+#include <e32base.h>
+#include <e32std.h>
+
+#include "eunittools.h"
+
+
+#include <platform/digia/eunit/eunitmacros.h>
+#include <platform/digia/eunit/teunitassertioninfo.h>
+#include "t_utils.h"
+
+
+
+#include <ximpbase.h>
+#include <presenceinfo.h>
+
+#include "ximpeventcodec.h"
+#include "ownpresenceeventimp.h"
+#include "prfwtestfiletool.h"
+#include "ximppanics.h"
+
+#include "prfwtestrobustnesstools.h"
+
+#include "ximpobjectfactoryimp.h"
+#include "ximpobjectcollection.h"
+#include "ximprestrictedobjectcollection.h"
+#include "ximpidentityimp.h"
+#include "ximpstatusimp.h"
+#include "ximprequestidbuilder.h"
+
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// CONSTRUCTION
+T_Utils* T_Utils::NewL()
+    {
+    T_Utils* self = new( ELeave ) T_Utils;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+
+    return self;
+    }
+
+
+T_Utils::~T_Utils()
+    {
+    }
+
+
+void T_Utils::ConstructL()
+    {
+    CEUnitTestSuiteClass::ConstructL();
+    }
+
+
+T_Utils::T_Utils()
+    {
+    }
+
+// ===========================================================================
+// TEST CASE SETUP & TEARDOWN METHODS
+// ===========================================================================
+//
+
+void T_Utils::Setup_L()
+    {
+    }
+
+void T_Utils::Teardown()
+    {
+    }
+
+// ===========================================================================
+// TEST CASE
+// ===========================================================================
+void T_Utils::T_FileToolTest_L()
+    {
+    // TODO add more brains to the test
+    EUNIT_PRINT( _L("FileTool test.") );
+
+    /*
+    CXIMPTestFileTool* tool = CXIMPTestFileTool::NewL();
+    CleanupStack::PushL( tool );
+    tool->CleanL( 0 );
+    tool->PrepareL( 0 );
+    TInt files = tool->NumObjectsL( 0 );
+
+    EUNIT_ASSERT_DESC( files == 0, "Non-zero count of files, Clean or Prepare did not work" );
+
+    // make a proper object and store it.
+    MPresenceInfo::TPresenceInfoStatus status;
+    status = MPresenceInfo::EDataSubscriptionPending;
+    COwnPresenceEventImp* event = COwnPresenceEventImp::NewLC( status );
+
+    CBufFlat* buf = CBufFlat::NewL( 50 );
+    CleanupStack::PushL( buf );
+    TInt32 eventType = 0;
+    XIMPEventCodec::PackL( *event, eventType, buf );
+    HBufC8* extObj = buf->Ptr( 0 ).AllocLC();
+
+    // create more objects
+    tool->StoreL( 0, *extObj );
+    tool->StoreL( 0, *extObj );
+    tool->StoreL( 0, *extObj );
+    tool->StoreL( 0, *extObj );
+    tool->StoreL( 0, *extObj );
+
+    files = tool->NumObjectsL( 0 );
+    EUNIT_ASSERT_DESC( files == 5, "Bad count of files" );
+
+    COwnPresenceEventImp* object = static_cast<COwnPresenceEventImp*>( tool->RestoreLC( 0, 2 ) );
+    EUNIT_ASSERT_DESC( status == object->Status(), "Wrong status from restored object." );
+
+    CleanupStack::PopAndDestroy( 4, event ); // object, extObj, buf, event
+
+    CleanupStack::PopAndDestroy( tool );
+    */
+    }
+
+// ===========================================================================
+// TEST CASE
+// ===========================================================================
+void T_Utils::T_KillServers_L()
+    {
+    EUNIT_PRINT( _L("Utility to kill the servers. Always succeeds.") );
+
+    PrfwTestRobustness::DoPreCleaning();
+    }
+
+_LIT8( KTestObjectName,    "John Doe" );     // regular
+_LIT8( KTestObjectName2,   "Jane Doe" );     // regular
+_LIT8( KTestObjectNameWC,  "Jo* Doe" );      // wildcards
+_LIT8( KTestObjectNameWC2, "Ja* Doe" );      // wildcards
+
+_LIT( KIdentity1, "Identity 1" );
+_LIT( KIdentity2, "Identity 2" );
+
+// ===========================================================================
+// TEST CASE
+// ===========================================================================
+void T_Utils::T_ObjectCollection_Unnamed_L()
+    {
+    EUNIT_PRINT( _L("Object collection unnamed tests.") );
+
+    CXIMPObjectFactoryImp* factory = CXIMPObjectFactoryImp::NewL();
+    CleanupStack::PushL( factory );
+
+    MXIMPObjectCollection* collection = factory->NewObjectCollectionLC();
+
+    // LookupByType should not find anything
+    const MXIMPBase* obj = NULL;
+    collection->LookupByType( obj, MXIMPIdentity::KInterfaceId );
+    EUNIT_ASSERT_DESC( obj == NULL, "LookupByType found an object" );
+
+    // LookupByTypeAndName should not find anything
+    collection->LookupByTypeAndName( obj, MXIMPIdentity::KInterfaceId, KTestObjectName );
+    EUNIT_ASSERT_DESC( obj == NULL, "LookupByTypeAndName found an object" );
+
+    collection->LookupByTypeAndName( obj, MXIMPIdentity::KInterfaceId, KTestObjectNameWC );
+    EUNIT_ASSERT_DESC( obj == NULL, "LookupByTypeAndName with wildcard found an object" );
+
+    // add some
+    MXIMPIdentity* identity2 = factory->NewIdentityLC();
+    identity2->SetIdentityL( KIdentity2 );
+
+    MXIMPStatus* status = factory->NewStatusLC();
+    status->SetResultCode( KErrArgument );
+
+    MXIMPIdentity* identity1 = factory->NewIdentityLC();
+    identity1->SetIdentityL( KIdentity1 );
+
+    collection->AddObjectL( identity1 );
+    CleanupStack::Pop(); // identity1
+
+    collection->AddObjectL( status );
+    CleanupStack::Pop(); // status
+
+    collection->AddObjectL( identity2 );
+    CleanupStack::Pop(); // identity2
+
+    // get and verify the status
+    MXIMPBase* getObj = NULL;
+    collection->GetByType( getObj, MXIMPStatus::KInterfaceId );
+    EUNIT_ASSERT_DESC( getObj != NULL, "LookupByType did not find an object" );
+
+    MXIMPStatus* gotStatus = ( MXIMPStatus* ) getObj->GetInterface( MXIMPStatus::KInterfaceId, MXIMPBase::EPanicIfUnknown );
+    CleanupDeletePushL( gotStatus );
+    EUNIT_ASSERT_DESC( gotStatus->ResultCode() == KErrArgument, "Status got corrupted" );
+    CleanupStack::PopAndDestroy(); // gotStatus
+
+    // check that status can't be found anymore
+    obj = NULL;
+    collection->LookupByType( obj, MXIMPStatus::KInterfaceId );
+    EUNIT_ASSERT_DESC( obj == NULL, "LookupByType found an object" );
+
+    collection->LookupByTypeAndName( obj, MXIMPStatus::KInterfaceId, KTestObjectName );
+    EUNIT_ASSERT_DESC( obj == NULL, "LookupByTypeAndName found an object" );
+
+    collection->LookupByTypeAndName( obj, MXIMPStatus::KInterfaceId, KTestObjectNameWC );
+    EUNIT_ASSERT_DESC( obj == NULL, "LookupByTypeAndName with wildcard found an object" );
+
+    // get and verify the two identities
+    // first identity
+    getObj = NULL;
+    collection->GetByType( getObj, MXIMPIdentity::KInterfaceId );
+    EUNIT_ASSERT_DESC( getObj != NULL, "LookupByType did not find an object" );
+
+    MXIMPIdentity* gotIdentity = ( MXIMPIdentity* ) getObj->GetInterface( MXIMPIdentity::KInterfaceId, MXIMPBase::EPanicIfUnknown );
+    CleanupDeletePushL( gotIdentity );
+    EUNIT_ASSERT_DESC( 0 == gotIdentity->Identity().Compare( KIdentity1 ), "Wrong identity object found" );
+    CleanupStack::PopAndDestroy(); // gotIdentity
+
+    // second identity
+    getObj = NULL;
+    collection->GetByType( getObj, MXIMPIdentity::KInterfaceId );
+    EUNIT_ASSERT_DESC( getObj != NULL, "LookupByType did not find an object" );
+
+    gotIdentity = ( MXIMPIdentity* ) getObj->GetInterface( MXIMPIdentity::KInterfaceId, MXIMPBase::EPanicIfUnknown );
+    CleanupDeletePushL( gotIdentity );
+    EUNIT_ASSERT_DESC( 0 == gotIdentity->Identity().Compare( KIdentity2 ), "Wrong identity object found" );
+    CleanupStack::PopAndDestroy(); // gotIdentity
+
+    // now there should not be anything anymore
+    obj = NULL;
+    collection->LookupByType( obj, MXIMPIdentity::KInterfaceId );
+    EUNIT_ASSERT_DESC( obj == NULL, "LookupByType found an object" );
+
+    CleanupStack::PopAndDestroy(); // collection
+    CleanupStack::PopAndDestroy( factory );
+    }
+
+// ===========================================================================
+// TEST CASE
+// ===========================================================================
+void T_Utils::T_ObjectCollection_Named_L()
+    {
+    EUNIT_PRINT( _L("Object collection named tests.") );
+
+    CXIMPObjectFactoryImp* factory = CXIMPObjectFactoryImp::NewL();
+    CleanupStack::PushL( factory );
+
+    MXIMPObjectCollection* collection = factory->NewObjectCollectionLC();
+
+    // LookupByType should not find anything
+    const MXIMPBase* obj = NULL;
+    collection->LookupByType( obj, MXIMPIdentity::KInterfaceId );
+    EUNIT_ASSERT_DESC( obj == NULL, "LookupByType found an object" );
+
+    // LookupByTypeAndName should not find anything
+    collection->LookupByTypeAndName( obj, MXIMPIdentity::KInterfaceId, KTestObjectName );
+    EUNIT_ASSERT_DESC( obj == NULL, "LookupByTypeAndName found an object" );
+
+    collection->LookupByTypeAndName( obj, MXIMPIdentity::KInterfaceId, KTestObjectNameWC );
+    EUNIT_ASSERT_DESC( obj == NULL, "LookupByTypeAndName with wildcard found an object" );
+
+    // add some
+    MXIMPIdentity* identity2 = factory->NewIdentityLC();
+    identity2->SetIdentityL( KIdentity2 );
+    
+    MXIMPStatus* status = factory->NewStatusLC();
+    status->SetResultCode( KErrArgument );
+
+    MXIMPIdentity* identity1 = factory->NewIdentityLC();
+    identity1->SetIdentityL( KIdentity1 );
+    
+    collection->AddObjectWithNameL( identity1, KTestObjectName );
+    CleanupStack::Pop(); // identity1
+
+    TRAPD( err, collection->AddObjectWithNameL( status, KTestObjectNameWC ) );
+    EUNIT_ASSERT_DESC( err == KErrBadName, "Did not leave when given wildcards" );
+    CleanupStack::PopAndDestroy(); // status
+
+    collection->AddObjectWithNameL( identity2, KTestObjectName2 );
+    CleanupStack::Pop(); // identity2
+
+    // should not find the status object
+    MXIMPBase* getObj = NULL;
+    collection->GetByType( getObj, MXIMPStatus::KInterfaceId );
+    EUNIT_ASSERT_DESC( getObj == NULL, "LookupByType found wrong object" );
+
+    // get and verify the two identities
+    // first identity
+    getObj = NULL;
+    collection->GetByTypeAndName( getObj, MXIMPIdentity::KInterfaceId, KTestObjectName );
+    EUNIT_ASSERT_DESC( getObj != NULL, "LookupByType did not find an object" );
+
+    MXIMPIdentity* gotIdentity = ( MXIMPIdentity* ) getObj->GetInterface( MXIMPIdentity::KInterfaceId, MXIMPBase::EPanicIfUnknown );
+    CleanupDeletePushL( gotIdentity );
+    EUNIT_ASSERT_DESC( 0 == gotIdentity->Identity().Compare( KIdentity1 ), "Wrong identity object found" );
+    CleanupStack::PopAndDestroy(); // gotIdentity
+
+    // second identity
+    getObj = NULL;
+    collection->GetByTypeAndName( getObj, MXIMPIdentity::KInterfaceId, KTestObjectNameWC2 );
+    EUNIT_ASSERT_DESC( getObj != NULL, "LookupByType did not find an object" );
+
+    gotIdentity = ( MXIMPIdentity* ) getObj->GetInterface( MXIMPIdentity::KInterfaceId, MXIMPBase::EPanicIfUnknown );
+    CleanupDeletePushL( gotIdentity );
+    EUNIT_ASSERT_DESC( 0 == gotIdentity->Identity().Compare( KIdentity2 ), "Wrong identity object found" );
+    CleanupStack::PopAndDestroy(); // gotIdentity
+
+    // now there should not be anything anymore
+    obj = NULL;
+    collection->LookupByType( obj, MXIMPIdentity::KInterfaceId );
+    EUNIT_ASSERT_DESC( obj == NULL, "LookupByType found an object" );
+
+    CleanupStack::PopAndDestroy(); // collection
+    CleanupStack::PopAndDestroy( factory );
+    }
+
+// ===========================================================================
+// TEST CASE
+// ===========================================================================
+void T_Utils::T_RestrictedObjectCollection_L()
+    {
+    EUNIT_PRINT( _L("Restricted object collection tests.") );
+
+    CXIMPObjectFactoryImp* factory = CXIMPObjectFactoryImp::NewL();
+    CleanupStack::PushL( factory );
+
+    MXIMPRestrictedObjectCollection* resColl = factory->NewRestrictedObjectCollectionLC();
+
+    // LookupByType should not find anything, empty collection
+    const MXIMPBase* obj = NULL;
+    resColl->LookupByType( obj, MXIMPIdentity::KInterfaceId );
+    EUNIT_ASSERT_DESC( obj == NULL, "LookupByType found an object" );
+
+    // add some
+    MXIMPIdentity* identity2 = factory->NewIdentityLC();
+    identity2->SetIdentityL( KIdentity2 );
+    
+    MXIMPStatus* status = factory->NewStatusLC();
+    status->SetResultCode( KErrArgument );
+
+    MXIMPIdentity* identity1 = factory->NewIdentityLC();
+    identity1->SetIdentityL( KIdentity1 );
+    
+    resColl->AddOrReplaceTypeL( identity1 );
+    CleanupStack::Pop(); // identity1
+
+    resColl->AddOrReplaceTypeL( status );
+    CleanupStack::Pop(); // identity1
+
+    resColl->AddOrReplaceTypeL( identity2 );
+    CleanupStack::Pop(); // identity2
+
+    // there should only be {identity2, status} in the collection
+    obj = NULL;
+    resColl->LookupByType( obj, MXIMPIdentity::KInterfaceId );
+    EUNIT_ASSERT_DESC( obj != NULL, "LookupByType did not find an object" );
+
+    obj = NULL;
+    resColl->LookupByType( obj, MXIMPStatus::KInterfaceId );
+    EUNIT_ASSERT_DESC( obj != NULL, "LookupByType did not find an object" );
+
+    // get the objects and verify their contents
+    
+    // 1. identity
+    MXIMPBase* getObj = NULL;
+    resColl->GetByType( getObj, MXIMPIdentity::KInterfaceId );
+    EUNIT_ASSERT_DESC( getObj != NULL, "LookupByType did not find an object" );
+
+    MXIMPIdentity* gotIdentity = ( MXIMPIdentity* ) getObj->GetInterface( MXIMPIdentity::KInterfaceId, MXIMPBase::EPanicIfUnknown );
+    CleanupDeletePushL( gotIdentity );
+    EUNIT_ASSERT_DESC( 0 == gotIdentity->Identity().Compare( KIdentity2 ), "Second identity object did not replace the first one" );
+    CleanupStack::PopAndDestroy(); // gotIdentity
+
+    // 2. status
+    getObj = NULL;
+    resColl->GetByType( getObj, MXIMPStatus::KInterfaceId );
+    EUNIT_ASSERT_DESC( getObj != NULL, "LookupByType did not find an object" );
+
+    MXIMPStatus* gotStatus = ( MXIMPStatus* ) getObj->GetInterface( MXIMPStatus::KInterfaceId, MXIMPBase::EPanicIfUnknown );
+    CleanupDeletePushL( gotStatus );
+    EUNIT_ASSERT_DESC( KErrArgument == gotStatus->ResultCode(), "Status object was corrupted" );
+    CleanupStack::PopAndDestroy(); // gotStatus
+
+    // now there should not be anything anymore
+    obj = NULL;
+    resColl->LookupByType( obj, MXIMPIdentity::KInterfaceId );
+    EUNIT_ASSERT_DESC( obj == NULL, "LookupByType found an identity object although it was removed" );
+    
+    obj = NULL;
+    resColl->LookupByType( obj, MXIMPStatus::KInterfaceId );
+    EUNIT_ASSERT_DESC( obj == NULL, "LookupByType found a status object although it was removed" );
+
+    CleanupStack::PopAndDestroy(); // collection
+    CleanupStack::PopAndDestroy( factory );
+    }
+
+void T_Utils::T_DataSubscriptionState_L()
+    {
+    EUNIT_PRINT( _L("Data subscription state tests.") );
+
+    CXIMPObjectFactoryImp* factory = CXIMPObjectFactoryImp::NewL();
+    CleanupStack::PushL( factory );
+
+    MXIMPDataSubscriptionState* dataState = factory->NewDataSubscriptionStateLC();
+
+    EUNIT_ASSERT_DESC( dataState->DataState() == MXIMPDataSubscriptionState::EDataUnavailable, 
+                      "Data was available." );
+    EUNIT_ASSERT_DESC( dataState->SubscriptionState() == MXIMPDataSubscriptionState::ESubscriptionInactive, 
+                      "Subscription was active." );
+    
+    dataState->SetDataStateL( MXIMPDataSubscriptionState::EDataAvailable );
+    dataState->SetSubscriptionStateL( MXIMPDataSubscriptionState::ESubscriptionActive );
+
+    EUNIT_ASSERT_DESC( dataState->DataState() == MXIMPDataSubscriptionState::EDataAvailable, 
+                      "Data was unavailable." );
+    EUNIT_ASSERT_DESC( dataState->SubscriptionState() == MXIMPDataSubscriptionState::ESubscriptionActive, 
+                      "Subscription was inactive." );
+
+    CleanupStack::PopAndDestroy(); // collection
+    CleanupStack::PopAndDestroy( factory );
+    }
+
+
+
+void T_Utils::T_TXIMPRequestIdBuilder_Test_L()
+    {
+    EUNIT_PRINT( _L("TXIMPRequestIdbuilder test.") );
+    
+    TXIMPRequestIdBuilder builder;
+    builder.SetProtocolId( 1 );
+    builder.SetSessionId( 1 );
+    builder.SetRequestId( 1 );    
+
+    TXIMPRequestId id1 = builder.BuildRequestId();
+    EUNIT_ASSERT( id1 == id1 );
+    EUNIT_ASSERT( id1 != TXIMPRequestId::Null() );
+
+
+        {
+        builder.SetProtocolId( 2 );   
+        TXIMPRequestId id2 = builder.BuildRequestId();
+        EUNIT_ASSERT( id2 == id2 );
+        EUNIT_ASSERT( id1 != id2 );
+        EUNIT_ASSERT( id2 != id1 );
+        EUNIT_ASSERT( id2 != TXIMPRequestId::Null() );        
+        }
+
+        {
+        builder.SetSessionId( 2 );   
+        TXIMPRequestId id3 = builder.BuildRequestId();
+        EUNIT_ASSERT( id3 == id3 );
+        EUNIT_ASSERT( id1 != id3 );
+        EUNIT_ASSERT( id3 != id1 );
+        EUNIT_ASSERT( id3 != TXIMPRequestId::Null() );        
+        }
+
+
+        {
+        builder.SetRequestId( 2 );   
+        TXIMPRequestId id4 = builder.BuildRequestId();
+        EUNIT_ASSERT( id4 == id4 );
+        EUNIT_ASSERT( id1 != id4 );
+        EUNIT_ASSERT( id4 != id1 );
+        EUNIT_ASSERT( id4 != TXIMPRequestId::Null() );                
+        }
+        
+        
+        {
+        builder.SetProtocolId( 33333333 );
+        builder.SetSessionId( 44444444 );
+        builder.SetRequestId( 55555555 );    
+
+        TXIMPRequestId id5 = builder.BuildRequestId();
+        EUNIT_ASSERT( id5 == id5 );
+        EUNIT_ASSERT( id1 != id5 );
+        EUNIT_ASSERT( id5 != id1 );
+        EUNIT_ASSERT( id5 != TXIMPRequestId::Null() );                
+        }
+    }
+
+
+void T_Utils::T_TXIMPRequestId_Test_L()
+    {
+    EUNIT_PRINT( _L("TXIMPRequestIdbuilder test.") );
+    
+    TXIMPRequestId id0 = TXIMPRequestId::Null();
+    EUNIT_ASSERT( id0 == TXIMPRequestId::Null() );  
+    
+        {
+        TXIMPRequestId id1 = TXIMPRequestId::Init( 1 ); 
+        EUNIT_ASSERT( id1 != TXIMPRequestId::Null() ); 
+        }
+
+
+        {
+        TXIMPRequestId id2 = TXIMPRequestId::Init( 2);     
+        EUNIT_ASSERT( id0 != id2 );             
+        }
+
+    
+        {
+        TXIMPRequestId id3 = TXIMPRequestId::Init( KMaxTInt );     
+        EUNIT_ASSERT( id0 != id3 );             
+        }
+
+
+        {
+        TXIMPRequestId id4 = TXIMPRequestId::Init( 33333333 );     
+        EUNIT_ASSERT( id0 != id4 );             
+        }
+        
+        {
+        TXIMPRequestId id5 = TXIMPRequestId::Init( KMaxTInt );     
+        TXIMPRequestId id6 = TXIMPRequestId::Init( KMinTInt );     
+        EUNIT_ASSERT( id0 != id5 );             
+        EUNIT_ASSERT( id0 != id6 );             
+        EUNIT_ASSERT( id5 != id6 );             
+        }
+        
+    }
+
+
+
+
+// ===========================================================================
+// TEST CASE TABLE
+// ===========================================================================
+//
+EUNIT_BEGIN_TEST_TABLE(
+        T_Utils,
+        "XIMP test utils tests",
+        "MODULE" )
+
+ PRFW_NOT_DECORATED_TEST(
+        "Kill servers",
+        "",
+        "",
+        "FUNCTIONALITY",
+        Setup_L,
+        T_KillServers_L,
+        Teardown )
+
+PRFW_NOT_DECORATED_TEST(
+        "Object collection without names",
+        "",
+        "",
+        "FUNCTIONALITY",
+        Setup_L,
+        T_ObjectCollection_Unnamed_L,
+        Teardown )
+
+PRFW_NOT_DECORATED_TEST(
+        "Object collection using names",
+        "",
+        "",
+        "FUNCTIONALITY",
+        Setup_L,
+        T_ObjectCollection_Named_L,
+        Teardown )
+
+PRFW_NOT_DECORATED_TEST(
+        "Restricted object collection",
+        "",
+        "",
+        "FUNCTIONALITY",
+        Setup_L,
+        T_RestrictedObjectCollection_L,
+        Teardown )
+
+PRFW_NOT_DECORATED_TEST(
+        "Data subscription state",
+        "",
+        "",
+        "FUNCTIONALITY",
+        Setup_L,
+        T_DataSubscriptionState_L,
+        Teardown )
+
+
+PRFW_NOT_DECORATED_TEST(
+        "TXIMPRequestIdBuilder test",
+        "",
+        "",
+        "FUNCTIONALITY",
+        Setup_L,
+        T_TXIMPRequestIdBuilder_Test_L,
+        Teardown )
+
+
+PRFW_NOT_DECORATED_TEST(
+        "TXIMPRequestId test",
+        "",
+        "",
+        "FUNCTIONALITY",
+        Setup_L,
+        T_TXIMPRequestId_Test_L,
+        Teardown )
+
+
+/* PRFW_NOT_DECORATED_TEST(
+        "FileTool test",
+        "",
+        "",
+        "FUNCTIONALITY",
+        Setup_L,
+        T_FileToolTest_L,
+        Teardown ) */
+
+
+EUNIT_END_TEST_TABLE
+
+
+// ===========================================================================
+// TEST SUITE CONSTRUCTION
+// ===========================================================================
+//
+EXPORT_C MEUnitTest* CreateTestSuiteL()
+    {
+    return T_Utils::NewL();
+    }
+
+
+// end of file
+
+
+
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_utils/t_utils.h	Wed Nov 03 09:32:20 2010 +0530
@@ -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:
+*
+*/
+
+#ifndef T_UTILS_H__
+#define T_UTILS_H__
+
+
+//  EXTERNAL INCLUDES
+#include <platform/digia/eunit/ceunittestsuiteclass.h>
+#include <platform/digia/eunit/EUnitDecorators.h>
+#include <ximpbase.h>
+
+#include "prfwteststatuseventlistener.h"
+#include "prfwwaitobserver.h"
+
+class CXIMPTestContextWrapperMgr;
+
+/**
+ * XIMP Framework Eunit tests.
+ *
+ * Tests for XIMP session management services.
+ *
+ * @since S60 v4.0
+ */
+class T_Utils : public CEUnitTestSuiteClass
+    {
+
+public:
+    static T_Utils* NewL();
+    virtual ~T_Utils();
+
+private:
+    T_Utils();
+    void ConstructL();
+
+private:    // Test case functions
+
+    void Setup_L();
+    void Teardown();
+
+    void T_FileToolTest_L();
+
+    void T_KillServers_L();
+    
+    void T_ObjectCollection_Unnamed_L();
+    void T_ObjectCollection_Named_L();
+    void T_RestrictedObjectCollection_L();
+    void T_DataSubscriptionState_L();
+    
+    void T_TXIMPRequestIdBuilder_Test_L();
+    void T_TXIMPRequestId_Test_L();
+
+private:    // Test helpers
+
+private: // Test data
+
+    /**
+     * Eunit test case table declaration.
+     */
+    EUNIT_DECLARE_TEST_TABLE;
+    };
+
+#endif      //  T_UTILS_H__
+
+// end of file
+
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_utils/t_utils.mmp	Wed Nov 03 09:32:20 2010 +0530
@@ -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:
+*
+*/
+
+#include            "../../tsrcutils/eunitcommon/eunittstdllbase.hrh"
+#include            "../../tsrcutils/processmaster/pm.h"
+
+#include<platform_paths.hrh>
+#include<eunitcaps.h>
+TARGET              t_utils.dll
+CAPABILITY      EUNIT_CAPS
+
+SOURCEPATH          .
+SOURCE              t_utils.cpp
+
+
+
+USERINCLUDE             ../../../../../ximpfw/core/srcdatamodel
+USERINCLUDE             ../../../../../ximpfw/presence/srcpresencedatamodel
+USERINCLUDE             ../../../../../ximpfw/presence/srcpresencedatamodel/presentitygroups
+USERINCLUDE             ../../../../../ximpfw/presence/srcpresencedatamodel/presencewatching
+USERINCLUDE             ../../../../../ximpfw/presence/srcpresencedatamodel/presenceauthorization
+USERINCLUDE             ../../../../../ximpfw/presence/srcpresencedatamodel/presencepublishing
+USERINCLUDE             ../../../../../ximpfw/presence/srcpresencedatamodel/presenceinfo
+USERINCLUDE             ../../../../../ximpfw/core/srcutils
+
+// TODO remove unnecessary
+#if defined ( OS_LAYER_SYSTEMINCLUDE )
+OS_LAYER_SYSTEMINCLUDE
+#else
+SYSTEMINCLUDE     /epoc32/include
+#endif
+
+ #if defined ( APP_LAYER_SYSTEMINCLUDE )
+ APP_LAYER_SYSTEMINCLUDE
+ #else
+ SYSTEMINCLUDE     \epoc32\include
+ #endif
+SYSTEMINCLUDE           ../../../../../ximpfw/inc/core/base
+SYSTEMINCLUDE           ../../../../../ximpfw/inc/core/datamodel
+SYSTEMINCLUDE           ../../../../../ximpfw/inc/core/protocolplugin
+SYSTEMINCLUDE           ../../../../../ximpfw/inc/core/protocolpluginhost
+SYSTEMINCLUDE           ../../../../../ximpfw/inc/presence/presencedatamodel
+SYSTEMINCLUDE           ../../../../../ximpfw/inc/presence/presencemanagement
+SYSTEMINCLUDE           ../../../../../ximpfw/inc/presence/presenceprotocolplugin
+SYSTEMINCLUDE           ../../../../../ximpfw/inc/presence/presenceprotocolpluginhost
+
+
+LIBRARY             ecom.lib
+LIBRARY             bafl.lib
+LIBRARY             ximpdatamodel.lib
+LIBRARY             presencedatamodel.lib
+LIBRARY             estor.lib
+LIBRARY             ximputils.lib
+LIBRARY                 EUnit.lib
+LIBRARY             eunitutil.lib
+LIBRARY             euser.lib
+// end of file
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcprotocols/bld.inf	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,26 @@
+/*
+* 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 PrFw test protocols
+ *
+*/
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_TESTMMPFILES
+
+pr_prfwtestprotocol/pr_prfwtestprotocol.mmp
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcprotocols/pr_prfwtestprotocol/bld.inf	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,29 @@
+/*
+* 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 Presence Framework
+*
+*/
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+PRJ_TESTMMPFILES
+pr_prfwtestprotocol.mmp
+
+
+
+PRJ_TESTEXPORTS
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcprotocols/pr_prfwtestprotocol/pr_prfwtestprotocol.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,1519 @@
+/*
+* 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:  Test Protocol implementation for XIMP Framework
+ *
+*/
+
+
+#include <badesca.h>
+#include <ecom/implementationproxy.h>
+
+#include <ximpstatus.h>
+#include <ximpserviceinfo.h>
+#include <ximpcontextclientinfo.h>
+
+#include <ximpprotocolconnectionhost.h>
+#include <protocolpresencepublishingdatahost.h>
+#include <protocolpresencefeatures.h>
+#include <ximprestrictedobjectcollection.h>
+#include <ximpidentity.h>
+#include <presentitygroupinfo.h>
+#include <presentitygroupmemberinfo.h>
+#include <ximpobjectfactory.h>
+#include <ximpprotocolrequestcompleteevent.h>
+#include <presencefeatures.h>
+#include <presenceobjectfactory.h>
+#include <protocolpresencedatahost.h>
+
+
+#include "pr_prfwtestprotocol.h"
+#include "prfwgeneralwaiter.h"
+#include "prfwtestmessaging.h"
+#include "prfwtestmessenger.h"
+#include "prfwtestfilelogichelper.h"
+#include "prfwtestfiletool.h"
+#include "ximprequestidbuilder.h"
+#include "prfwtestprotocols.h"
+
+
+
+const TInt KWaitTime = 1;
+
+T_XIMPTestConnection::ClientWrapper* T_XIMPTestConnection::ClientWrapper::NewLC( const TDesC& aClientId )
+    {
+    ClientWrapper* self = new ( ELeave ) ClientWrapper;
+    CleanupStack::PushL( self );
+    self->ConstructL( aClientId );
+    return self;
+    }
+
+void T_XIMPTestConnection::ClientWrapper::ConstructL( const TDesC& aClientId )
+    {
+    iId.CreateL( aClientId );
+    }
+
+void T_XIMPTestConnection::ClientWrapper::InitializeL( MXIMPProtocolConnectionHost& aConnectionHost )
+    {
+    if( !iMessenger )
+        {
+        TLex lex( iId );
+        TInt index = 0;
+        User::LeaveIfError( lex.Val( index ) );
+        // TEST CODE
+        __ASSERT_ALWAYS( index != -1, User::Panic(_L("Protocol"), 666));
+        iMessenger = CXIMPTestMessenger::NewForAdaptationSideL( index );
+        iPluginIndex = index;
+        }
+
+    if( !iFileLogicHelper )
+        {
+        iFileLogicHelper = CXIMPTestFileLogicHelper::NewL( aConnectionHost, *iMessenger );
+        }
+
+    if( !iFileTool )
+        {
+        // TODO FIX FILETOOL CREATION
+        iFileTool = CXIMPTestFileTool::NewL( K_PRFW_TST_PROTOCOL_1_IMPLEMENTATION_UID, iId );
+        iFileTool->RegisterObserverL( iFileLogicHelper );
+        }
+    }
+
+T_XIMPTestConnection::ClientWrapper::~ClientWrapper()
+    {
+    if( iFileTool && iFileLogicHelper )
+        {
+        iFileTool->UnregisterObserver( iFileLogicHelper );
+        }
+    delete iFileTool;
+    delete iFileLogicHelper;
+    delete iMessenger;
+
+    iId.Close();
+    }
+
+// ---------------------------------------------------------------------------
+// OrderOfClients()
+// ---------------------------------------------------------------------------
+//
+TInt T_XIMPTestConnection::OrderOfClients( const T_XIMPTestConnection::ClientWrapper& aFirst,
+                                           const T_XIMPTestConnection::ClientWrapper& aSecond )
+    {
+    return aFirst.iId.Compare( aSecond.iId );
+    }
+
+// ======== MEMBER FUNCTIONS ========
+
+
+// ---------------------------------------------------------------------------
+// OrderOfConnections()
+// ---------------------------------------------------------------------------
+//
+TInt T_XIMPTestConnection::OrderOfConnections( const T_XIMPTestConnection& aFirst,
+                                               const T_XIMPTestConnection& aSecond )
+    {
+    TInt retVal = aFirst.iServerAddress->Compare( *aSecond.iServerAddress );
+    if( retVal != 0 )
+        {
+        return retVal;
+        }
+    retVal = aFirst.iUserName->Compare( *aSecond.iUserName );
+    if( retVal != 0 )
+        {
+        return retVal;
+        }
+
+    return aFirst.iPassword->Compare( *aSecond.iPassword );
+    }
+
+
+// ---------------------------------------------------------------------------
+// T_XIMPTestConnection::T_XIMPTestConnection()
+// ---------------------------------------------------------------------------
+//
+T_XIMPTestConnection::T_XIMPTestConnection()
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// T_XIMPTestConnection::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void T_XIMPTestConnection::ConstructL( const MXIMPServiceInfo& aServiceInfo,
+                                       const MXIMPContextClientInfo& aClientCtxInfo )
+    {
+    iWaitter = CXIMPTestGeneralWaiter::NewL( this );
+
+    iAuxTimer = CPeriodic::NewL( CActive::EPriorityIdle );
+
+    iServerAddress = aServiceInfo.ServiceAddress().AllocL();
+    iUserName = aServiceInfo.UserId().AllocL();
+    iPassword = aServiceInfo.Password().AllocL();
+    iClientId = aClientCtxInfo.ClientId().Identity().AllocL();
+    }
+
+
+// ---------------------------------------------------------------------------
+// T_XIMPTestConnection::NewLC()
+// ---------------------------------------------------------------------------
+//
+T_XIMPTestConnection* T_XIMPTestConnection::NewLC( const MXIMPServiceInfo& aServiceInfo,
+                                                   const MXIMPContextClientInfo& aClientCtxInfo )
+    {
+    T_XIMPTestConnection* self = new( ELeave ) T_XIMPTestConnection(  );
+    CleanupStack::PushL( self );
+    self->ConstructL( aServiceInfo, aClientCtxInfo );
+    return self;
+    }
+
+
+// ---------------------------------------------------------------------------
+// T_XIMPTestConnection::NewL()
+// ---------------------------------------------------------------------------
+//
+T_XIMPTestConnection* T_XIMPTestConnection::NewL( const MXIMPServiceInfo& aServiceInfo,
+                                                  const MXIMPContextClientInfo& aClientCtxInfo )
+    {
+    T_XIMPTestConnection* self = T_XIMPTestConnection::NewLC( aServiceInfo, aClientCtxInfo );
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// T_XIMPTestConnection::~T_XIMPTestConnection()
+// ---------------------------------------------------------------------------
+//
+T_XIMPTestConnection::~T_XIMPTestConnection()
+    {
+    SetBoolean( EXIMPPlgTestDeath );
+
+    if ( iAuxTimer )
+        {
+        iAuxTimer->Deque();
+        }
+    delete iAuxTimer;
+
+    delete iWaitter;
+
+    iClients.ResetAndDestroy();
+
+    delete iServerAddress;
+    delete iUserName;
+    delete iPassword;
+    delete iClientId;
+
+    delete iClientToBeDeleted;
+    }
+
+
+// ---------------------------------------------------------------------------
+// T_XIMPTestConnection::PrimeHost()
+// ---------------------------------------------------------------------------
+//
+void T_XIMPTestConnection::PrimeHost( MXIMPProtocolConnectionHost& aHost )
+    {
+    iConnectionHost = &aHost;
+    }
+
+// ---------------------------------------------------------------------------
+// T_XIMPTestConnection::PresenceFeatures()
+// ---------------------------------------------------------------------------
+//
+MProtocolPresenceFeatures& T_XIMPTestConnection::ProtocolPresenceFeatures()
+    {
+    return *this;
+    }
+
+
+// ---------------------------------------------------------------------------
+// T_XIMPTestConnection::PresenceFeatures()
+// ---------------------------------------------------------------------------
+//	MProtocolImFeatures* ProtocolImFeatures();
+//MProtocolImFeatures* T_XIMPTestConnection::ProtocolImFeatures()
+//    {
+//    return NULL;
+//    }
+// ---------------------------------------------------------------------------
+// T_XIMPTestConnection::GetProtocolInterface()
+// ---------------------------------------------------------------------------
+TAny* T_XIMPTestConnection::GetProtocolInterface(TInt aInterfaceId)
+	{
+	return NULL ;
+	}
+    
+    
+    
+// ---------------------------------------------------------------------------
+// T_XIMPTestConnection::PresenceWatching()
+// ---------------------------------------------------------------------------
+//
+MProtocolPresenceWatching& T_XIMPTestConnection::PresenceWatching()
+    {
+    return *this;
+    }
+// ---------------------------------------------------------------------------
+// T_XIMPTestConnection::PresencePublishing()
+// ---------------------------------------------------------------------------
+//
+MProtocolPresencePublishing& T_XIMPTestConnection::PresencePublishing()
+    {
+    return *this;
+    }
+// ---------------------------------------------------------------------------
+// T_XIMPTestConnection::PresentityGroups()
+// ---------------------------------------------------------------------------
+//
+MProtocolPresentityGroups& T_XIMPTestConnection::PresentityGroups()
+    {
+    return *this;
+    }
+// ---------------------------------------------------------------------------
+// T_XIMPTestConnection::PresenceAuthorization()
+// ---------------------------------------------------------------------------
+//
+MProtocolPresenceAuthorization& T_XIMPTestConnection::PresenceAuthorization()
+    {
+    return *this;
+    }
+
+// ---------------------------------------------------------------------------
+// T_XIMPTestConnection::HandleProtocolConnectionHostEvent()
+// ---------------------------------------------------------------------------
+//
+void T_XIMPTestConnection::HandleProtocolConnectionHostEvent(
+    const MXIMPProtocolConnectionHost& aHost,
+    const MXIMPBase& aEvent )
+    {
+    if( &aHost != iConnectionHost )
+        {
+        User::Panic(_L("Protocol"), -42 );
+        }
+    
+    
+    if( aEvent.GetInterfaceId() == MXIMPProtocolRequestCompleteEvent::KInterfaceId )
+        {
+        const MXIMPProtocolRequestCompleteEvent* eventIf =
+        TXIMPGetInterface< const MXIMPProtocolRequestCompleteEvent >::From( aEvent,
+                                                                            MXIMPBase::EPanicIfUnknown );
+        RDebug::Print( _L("   T_XIMPTestConnection: received ProtocolRequestCompleteEvent with result [%d]"), 
+                       eventIf->ResultCode() );
+        }
+    }
+    
+    
+
+// ---------------------------------------------------------------------------
+// T_XIMPTestConnection::OpenSessionL()
+// ---------------------------------------------------------------------------
+//
+void T_XIMPTestConnection::OpenSessionL( const MXIMPContextClientInfo& aClientCtxInfo,
+                                       TXIMPRequestId aReqId )
+    {
+    iConnectionHost->RegisterObserverL( *this );
+
+    ClientWrapper* client = ClientWrapper::NewLC( aClientCtxInfo.ClientId().Identity() );
+
+    TLinearOrder< T_XIMPTestConnection::ClientWrapper > order( T_XIMPTestConnection::OrderOfClients );
+    TInt indexOfClient = iClients.FindInOrder( client, order );
+
+    if( indexOfClient != KErrNotFound )
+        {
+        User::LeaveIfError( indexOfClient );
+        CleanupStack::PopAndDestroy(); //id
+        client = iClients[ indexOfClient ];
+        }
+    else
+        {
+        client->InitializeL( *iConnectionHost );
+        iCurrentMessenger = client->iMessenger;
+        }
+
+    PluginAPIMethodCommonL( aReqId );
+
+    if( indexOfClient == KErrNotFound )
+        {
+        iClients.InsertInOrderL( client, order );
+        CleanupStack::Pop(); //id
+        }
+
+
+    SetBooleanToCurrent( EXIMPPlgTestOpenSessionCalled );
+    iWaitter->WaitForL( KWaitTime );
+    }
+
+// ---------------------------------------------------------------------------
+// T_XIMPTestConnection::OpenSessionL()
+// ---------------------------------------------------------------------------
+//
+void T_XIMPTestConnection::OpenSessionL(
+                const TInt& aSettingsId,
+                TXIMPRequestId aReqId )
+
+    {
+    iConnectionHost->RegisterObserverL( *this );
+
+    ClientWrapper* client = ClientWrapper::NewLC( _L("0") );
+
+    TLinearOrder< T_XIMPTestConnection::ClientWrapper > order( T_XIMPTestConnection::OrderOfClients );
+    TInt indexOfClient = iClients.FindInOrder( client, order );
+
+    if( indexOfClient != KErrNotFound )
+        {
+        User::LeaveIfError( indexOfClient );
+        CleanupStack::PopAndDestroy(); //id
+        client = iClients[ indexOfClient ];
+        }
+    else
+        {
+        client->InitializeL( *iConnectionHost );
+        iCurrentMessenger = client->iMessenger;
+        }
+
+    PluginAPIMethodCommonL( aReqId );
+
+    if( indexOfClient == KErrNotFound )
+        {
+        iClients.InsertInOrderL( client, order );
+        CleanupStack::Pop(); //id
+        }
+
+
+    SetBooleanToCurrent( EXIMPPlgTestOpenSessionCalled );
+    iWaitter->WaitForL( KWaitTime );
+    }
+        
+        
+
+// ---------------------------------------------------------------------------
+// T_XIMPTestConnection::CloseSession()
+// ---------------------------------------------------------------------------
+//
+void T_XIMPTestConnection::CloseSession( const MXIMPContextClientInfo& aClientCtxInfo,
+                                         TXIMPRequestId aReqId )
+    {
+    PluginAPIMethodCommonL( aReqId );
+
+    iClientToBeDeleted = NULL;
+    TInt count = iClients.Count();
+    TBool found(EFalse);
+    for( TInt a = 0; a < count && !iClientToBeDeleted; ++a )
+        {
+        if( aClientCtxInfo.ClientId().Identity().Compare( iClients[ a ]->iId ) == 0 )
+            {
+            iClientToBeDeleted = iClients[ a ];
+            iClients.Remove( a );
+            found = ETrue;
+            }
+        }
+
+    SetBooleanToCurrent( EXIMPPlgTestCloseSessionCalled );
+
+    if(found)
+    iWaitter->WaitForL( KWaitTime );
+    else
+    	{
+	    MXIMPStatus* status = iConnectionHost->ObjectFactory().NewStatusLC();
+	    CleanupStack::Pop(); // status.
+	    status->SetResultCode(KErrNone);
+    	iConnectionHost->HandleRequestCompleted( aReqId, status);    		
+    	}
+    	
+    
+    	
+    }
+
+
+// ---------------------------------------------------------------------------
+// T_XIMPTestConnection::GetSupportedFeaturesL()
+// ---------------------------------------------------------------------------
+//
+void T_XIMPTestConnection::GetSupportedFeaturesL( CDesC8Array& aFeatures ) const
+    {
+    if ( ! iClients.Count() )
+        {
+        User::LeaveIfError( KErrNotReady );
+        }
+
+    // first empty the whole array
+    aFeatures.Reset();
+
+    // then add two features there: 1 supported by XIMP, 1 not
+    aFeatures.AppendL( _L8("feat/pres/pub") );
+    aFeatures.AppendL( _L8("feat/worlddomination") );
+    }
+
+// ---------------------------------------------------------------------------
+// T_XIMPTestConnection::DoSubscribeOwnPresenceL
+// ---------------------------------------------------------------------------
+//
+void T_XIMPTestConnection::DoSubscribeOwnPresenceL( const MPresenceInfoFilter& aPif,
+        TXIMPRequestId aReqId )
+    {
+    PluginAPIMethodCommonL( aReqId );
+
+    SetBooleanToCurrent( EXIMPPlgTestSubscribeOwnPresenceCalled );
+
+    // TODO do something, like in PublishPresence
+
+    iWaitter->WaitForL( KWaitTime );
+    }
+
+// ---------------------------------------------------------------------------
+// T_XIMPTestConnection::DoUpdateOwnPresenceSubscriptionL
+// ---------------------------------------------------------------------------
+//
+void T_XIMPTestConnection::DoUpdateOwnPresenceSubscriptionPifL( const MPresenceInfoFilter& aPif,
+        TXIMPRequestId aReqId )
+    {
+    PluginAPIMethodCommonL( aReqId );
+
+    SetBooleanToCurrent( EXIMPPlgTestUpdateOwnSubscriptionCalled );
+
+    // TODO do something, like in PublishPresence
+
+    iWaitter->WaitForL( KWaitTime );
+    }
+
+
+// ---------------------------------------------------------------------------
+// From MPscPlugin class.
+// T_XIMPTestConnection::DoSubscribePresenceWatcherListL()
+// ---------------------------------------------------------------------------
+//
+void T_XIMPTestConnection::DoSubscribePresenceWatcherListL( TXIMPRequestId aReqId )
+    {
+    PluginAPIMethodCommonL( aReqId );
+
+    SetBooleanToCurrent( EXIMPPlgTestSubscribePresenceWatcherListCalled );
+
+    // TODO do something, like in PublishPresence
+
+    iWaitter->WaitForL( KWaitTime );
+    }
+
+// ---------------------------------------------------------------------------
+// From MPscPlugin class.
+// T_XIMPTestConnection::DoUnsubscribePresenceWatcherListL()
+// ---------------------------------------------------------------------------
+//
+void T_XIMPTestConnection::DoUnsubscribePresenceWatcherListL( TXIMPRequestId aReqId )
+    {
+    PluginAPIMethodCommonL( aReqId );
+
+    SetBooleanToCurrent( EXIMPPlgTestUnsubscribePresenceWatcherListCalled );
+
+    // TODO do something, like in PublishPresence
+
+    iWaitter->WaitForL( KWaitTime );
+    }
+
+// ---------------------------------------------------------------------------
+// T_XIMPTestConnection::DoSubscribePresentityGroupListL
+// ---------------------------------------------------------------------------
+//
+void T_XIMPTestConnection::DoSubscribePresentityGroupListL( TXIMPRequestId aReqId )
+    {
+    PluginAPIMethodCommonL( aReqId );
+
+    SetBooleanToCurrent( EXIMPPlgTestSubscribeGroupListCalled );
+
+    // TODO do something, like in PublishPresence
+
+    iWaitter->WaitForL( KWaitTime );
+    }
+
+// ---------------------------------------------------------------------------
+// T_XIMPTestConnection::DoUnsubscribePresentityGroupListL
+// ---------------------------------------------------------------------------
+//
+void T_XIMPTestConnection::DoUnsubscribePresentityGroupListL( TXIMPRequestId aReqId )
+    {
+    PluginAPIMethodCommonL( aReqId );
+
+    SetBooleanToCurrent( EXIMPPlgTestUnsubscribeGroupListCalled );
+
+    // TODO do something, like in PublishPresence
+
+    iWaitter->WaitForL( KWaitTime );
+    }
+
+
+// ---------------------------------------------------------------------------
+// T_XIMPTestConnection::PublishPresenceL()
+// ---------------------------------------------------------------------------
+//
+void T_XIMPTestConnection::DoPublishOwnPresenceL(
+        const MPresenceInfo& aPresence,
+        TXIMPRequestId aReqId )
+    {
+    // With SetupLeave we leave here
+    PluginAPIMethodCommonL( aReqId );
+
+    SetBooleanToCurrent( EXIMPPlgTestPublishPresenceCalled );
+
+    MProtocolPresenceDataHost& presHost = iConnectionHost->ProtocolPresenceDataHost();
+    // Set own presence data in data cache
+    MPresenceInfo* presence = presHost.PresenceObjectFactory().NewPresenceInfoLC();
+    TXIMPRequestId reqid = presHost.PublishingDataHost().HandleSubscribedOwnPresenceL( presence );
+    CleanupStack::Pop(); //presence
+
+    
+    if(iCurrentMessenger->GetError()==KErrTimedOut)
+    	{
+	    MXIMPStatus* status1 = iConnectionHost->ObjectFactory().NewStatusLC();
+	    iConnectionHost->HandleConnectionTerminated(status1);
+
+		CleanupStack::PopAndDestroy(1);
+    	}
+
+    iWaitter->WaitForL( KWaitTime );
+
+    // TODO when implemented, write the data received for test case verification
+    }
+
+// ---------------------------------------------------------------------------
+// T_XIMPTestConnection::DoUnsubscribeOwnPresenceL()
+// ---------------------------------------------------------------------------
+//
+void T_XIMPTestConnection::DoUnsubscribeOwnPresenceL( TXIMPRequestId aReqId )
+    {
+    PluginAPIMethodCommonL( aReqId );
+
+    // prepare the message for test code
+    SetBooleanToCurrent( EXIMPPlgTestUnsubscribeOwnPresenceCalled );
+    // TODO when implemented, read the data given by test case and
+    //      generate the required events
+    iWaitter->WaitForL( KWaitTime );
+    }
+
+// ---------------------------------------------------------------------------
+// T_XIMPTestConnection::DoCreatePresentityGroupL
+// ---------------------------------------------------------------------------
+//
+void T_XIMPTestConnection::DoCreatePresentityGroupL( const MXIMPIdentity& aIdentity,
+                                           const TDesC16& aDisplayName,
+                                           TXIMPRequestId aReqId )
+    {
+    PluginAPIMethodCommonL( aReqId );
+
+    // prepare the message for test code
+    SetBooleanToCurrent( EXIMPPlgTestCreatePresentityGroupCalled );
+    // TODO when implemented, read the data given by test case and
+    //      generate the required events
+    iWaitter->WaitForL( KWaitTime );
+    }
+
+// ---------------------------------------------------------------------------
+// T_XIMPTestConnection::DoCreatePresentityGroupL
+// ---------------------------------------------------------------------------
+//
+void T_XIMPTestConnection::DoDeletePresentityGroupL( const MXIMPIdentity& aIdentity,
+                                           TXIMPRequestId aReqId )
+    {
+    PluginAPIMethodCommonL( aReqId );
+
+    // prepare the message for test code
+    SetBooleanToCurrent( EXIMPPlgTestDeletePresentityGroupCalled );
+    // TODO when implemented, read the data given by test case and
+    //      generate the required events
+    iWaitter->WaitForL( KWaitTime );
+    }
+
+// ---------------------------------------------------------------------------
+// T_XIMPTestConnection::DoCreatePresentityGroupL
+// ---------------------------------------------------------------------------
+//
+void T_XIMPTestConnection::DoUpdatePresentityGroupDisplayNameL( const MXIMPIdentity& aIdentity,
+                                           const TDesC16& aDisplayName,
+                                           TXIMPRequestId aReqId )
+    {
+    PluginAPIMethodCommonL( aReqId );
+
+    // prepare the message for test code
+    SetBooleanToCurrent( EXIMPPlgTestUpdatePresentityGroupDisplayNameCalled );
+    // TODO when implemented, read the data given by test case and
+    //      generate the required events
+    iWaitter->WaitForL( KWaitTime );
+    }
+
+// ---------------------------------------------------------------------------
+// T_XIMPTestConnection::DoSubscribePresentityPresenceL
+// ---------------------------------------------------------------------------
+//
+void T_XIMPTestConnection::DoSubscribePresentityPresenceL(
+                                    const MXIMPIdentity& aIdentity,
+                                    const MPresenceInfoFilter& aPif,
+                                    TXIMPRequestId aReqId )
+    {
+    PluginAPIMethodCommonL( aReqId );
+
+    // prepare the message for test code
+    SetBooleanToCurrent( EXIMPPlgTestSubscribePresentityPresesenceCalled );
+    // TODO when implemented, read the data given by test case and
+    //      generate the required events
+    iWaitter->WaitForL( KWaitTime );
+    }
+
+// ---------------------------------------------------------------------------
+// T_XIMPTestConnection::DoUpdatePresentityPresenceSubscriptionL
+// ---------------------------------------------------------------------------
+//
+void T_XIMPTestConnection::DoUpdatePresentityPresenceSubscriptionPifL(
+                                    const MXIMPIdentity& aIdentity,
+                                    const MPresenceInfoFilter& aPif,
+                                    TXIMPRequestId aReqId )
+    {
+    PluginAPIMethodCommonL( aReqId );
+
+    // prepare the message for test code
+    SetBooleanToCurrent( EXIMPPlgTestUpdatePresentityPresesenceCalled );
+    // TODO when implemented, read the data given by test case and
+    //      generate the required events
+    iWaitter->WaitForL( KWaitTime );
+    }
+
+// ---------------------------------------------------------------------------
+// T_XIMPTestConnection::DoUnsubscribePresentityPresenceL
+// ---------------------------------------------------------------------------
+//
+void T_XIMPTestConnection::DoUnsubscribePresentityPresenceL(
+                                        const MXIMPIdentity& aIdentity,
+                                        TXIMPRequestId aReqId )
+    {
+    PluginAPIMethodCommonL( aReqId );
+
+    // prepare the message for test code
+    SetBooleanToCurrent( EXIMPPlgTestUnsubscribePresentityPresesenceCalled );
+    // TODO when implemented, read the data given by test case and
+    //      generate the required events
+    iWaitter->WaitForL( KWaitTime );
+    }
+
+
+// ---------------------------------------------------------------------------
+// T_XIMPTestConnection::DoSubscribePresentityGroupMembersPresenceL
+// ---------------------------------------------------------------------------
+//
+void T_XIMPTestConnection::DoSubscribePresentityGroupMembersPresenceL(
+                                    const MXIMPIdentity& aIdentity,
+                                    const MPresenceInfoFilter& aPif,
+                                    TXIMPRequestId aReqId )
+    {
+    PluginAPIMethodCommonL( aReqId );
+
+    // prepare the message for test code
+    SetBooleanToCurrent( EXIMPPlgTestSubscribePresentityGroupMembersPresesenceCalled );
+    // TODO when implemented, read the data given by test case and
+    //      generate the required events
+    iWaitter->WaitForL( KWaitTime );
+    }
+
+// ---------------------------------------------------------------------------
+// T_XIMPTestConnection::DoUpdatePresentityPresenceSubscriptionL
+// ---------------------------------------------------------------------------
+//
+void T_XIMPTestConnection::DoUpdatePresentityGroupMembersPresenceSubscriptionPifL(
+                                    const MXIMPIdentity& aIdentity,
+                                    const MPresenceInfoFilter& aPif,
+                                    TXIMPRequestId aReqId )
+    {
+    PluginAPIMethodCommonL( aReqId );
+
+    // prepare the message for test code
+    SetBooleanToCurrent( EXIMPPlgTestUpdatePresentityGroupMembersPresesenceCalled );
+    // TODO when implemented, read the data given by test case and
+    //      generate the required events
+    iWaitter->WaitForL( KWaitTime );
+    }
+
+// ---------------------------------------------------------------------------
+// T_XIMPTestConnection::DoUnsubscribePresentityPresenceL
+// ---------------------------------------------------------------------------
+//
+void T_XIMPTestConnection::DoUnsubscribePresentityGroupMembersPresenceL(
+                                        const MXIMPIdentity& aIdentity,
+                                        TXIMPRequestId aReqId )
+    {
+    PluginAPIMethodCommonL( aReqId );
+
+    // prepare the message for test code
+    SetBooleanToCurrent( EXIMPPlgTestUnsubscribePresentityGroupMembersPresesenceCalled );
+    // TODO when implemented, read the data given by test case and
+    //      generate the required events
+    iWaitter->WaitForL( KWaitTime );
+    }
+
+
+
+// ---------------------------------------------------------------------------
+// From MPscPlugin class.
+// T_XIMPTestConnection::DoSubscribePresentityGroupContentL
+// ---------------------------------------------------------------------------
+//
+void T_XIMPTestConnection::DoSubscribePresentityGroupContentL(
+                                            const MXIMPIdentity& aGroupId,
+                                            TXIMPRequestId aReqId )
+    {
+    PluginAPIMethodCommonL( aReqId );
+
+    // prepare the message for test code
+    SetBooleanToCurrent( EXIMPPlgTestSubscribePresentityGroupContentCalled );
+    // TODO when implemented, read the data given by test case and
+    //      generate the required events
+    iWaitter->WaitForL( KWaitTime );
+    }
+
+// ---------------------------------------------------------------------------
+// From MPscPlugin class.
+// T_XIMPTestConnection::DoUnsubscribePresentityGroupContentL
+// ---------------------------------------------------------------------------
+//
+void T_XIMPTestConnection::DoUnsubscribePresentityGroupContentL(
+                                            const MXIMPIdentity& aGroupId,
+                                            TXIMPRequestId aReqId )
+    {
+    PluginAPIMethodCommonL( aReqId );
+    // prepare the message for test code
+    SetBooleanToCurrent( EXIMPPlgTestUnsubscribePresentityGroupContentCalled );
+    // TODO when implemented, read the data given by test case and
+    //      generate the required events
+    iWaitter->WaitForL( KWaitTime );
+
+    }
+
+// ---------------------------------------------------------------------------
+// From MPscPlugin class.
+// T_XIMPTestConnection::DoAddPresentityGroupMemberL
+// ---------------------------------------------------------------------------
+//
+void T_XIMPTestConnection::DoAddPresentityGroupMemberL(
+                                            const MXIMPIdentity& aGroupId,
+                                            const MXIMPIdentity& aMemberId,
+                                            const TDesC16& aMemberDisplayName,
+                                            TXIMPRequestId aReqId )
+    {
+        /*
+        //Req complete parameter template
+        {
+        MXIMPRestrictedObjectCollection* collection =
+            iConnectionHost->ObjectFactory().NewRestrictedObjectCollectionLC();
+
+        MXIMPIdentity* identityClone = iConnectionHost->ObjectFactory().NewIdentityLC();
+        identityClone->SetIdentityL( aMemberId.Identity() );
+
+        MPresentityGroupMemberInfo* grpMember =
+        iConnectionHost->ObjectFactory().NewPresentityGroupMemberInfoLC( *identityClone,
+                                                                         _L("AlteredDisplayname") );
+        CleanupStack::Pop(); //grpMember
+        CleanupStack::PopAndDestroy(); //identityClone
+
+        CleanupDeletePushL( grpMember );
+        collection->AddOrReplaceTypeL( grpMember );
+        CleanupStack::Pop(); //grpMember
+
+        delete iReqCompleteParams;
+        iReqCompleteParams = NULL;
+        iReqCompleteParams = collection;
+
+        CleanupStack::Pop(); //collection
+        }
+        */
+
+    PluginAPIMethodCommonL( aReqId );
+
+    // prepare the message for test code
+    SetBooleanToCurrent( EXIMPPlgTestAddPresentityGroupMemberCalled );
+    // TODO when implemented, read the data given by test case and
+    //      generate the required events
+    iWaitter->WaitForL( KWaitTime );
+    }
+
+// ---------------------------------------------------------------------------
+// From MPscPlugin class.
+// T_XIMPTestConnection::DoRemovePresentityGroupMemberL
+// ---------------------------------------------------------------------------
+//
+void T_XIMPTestConnection::DoRemovePresentityGroupMemberL(
+                                            const MXIMPIdentity& aGroupId,
+                                            const MXIMPIdentity& aMemberId,
+                                            TXIMPRequestId aReqId )
+    {
+    PluginAPIMethodCommonL( aReqId );
+
+    // prepare the message for test code
+    SetBooleanToCurrent( EXIMPPlgTestRemovePresentityGroupMemberCalled );
+    // TODO when implemented, read the data given by test case and
+    //      generate the required events
+    iWaitter->WaitForL( KWaitTime );
+    }
+
+// ---------------------------------------------------------------------------
+// From MPscPlugin class.
+// T_XIMPTestConnection::DoUpdatePresentityGroupMemberDisplayNameL
+// ---------------------------------------------------------------------------
+//
+void T_XIMPTestConnection::DoUpdatePresentityGroupMemberDisplayNameL(
+                                            const MXIMPIdentity& aGroupId,
+                                            const MXIMPIdentity& aMemberId,
+                                            const TDesC16& aMemberDisplayName,
+                                            TXIMPRequestId aReqId )
+    {
+    PluginAPIMethodCommonL( aReqId );
+
+    // prepare the message for test code
+    SetBooleanToCurrent( EXIMPPlgTestUpdatePresentityGroupMemberDisplayNameCalled );
+    // TODO when implemented, read the data given by test case and
+    //      generate the required events
+    iWaitter->WaitForL( KWaitTime );
+    }
+
+
+// ---------------------------------------------------------------------------
+// From MPscPlugin class.
+// T_XIMPTestConnection::DoSubscribePresenceGrantRequestListL
+// ---------------------------------------------------------------------------
+//
+void T_XIMPTestConnection::DoSubscribePresenceGrantRequestListL( TXIMPRequestId aReqId )
+    {
+    PluginAPIMethodCommonL( aReqId );
+
+    SetBooleanToCurrent( EXIMPPlgTestSubscribePresenceGrantRequestListCalled );
+
+    // TODO do something, like in PublishPresence
+
+    iWaitter->WaitForL( KWaitTime );
+    }
+
+// ---------------------------------------------------------------------------
+// From MPscPlugin class.
+// T_XIMPTestConnection::DoUnsubscribePresenceGrantRequestListL
+// ---------------------------------------------------------------------------
+//
+void T_XIMPTestConnection::DoUnsubscribePresenceGrantRequestListL( TXIMPRequestId aReqId )
+    {
+    PluginAPIMethodCommonL( aReqId );
+
+    SetBooleanToCurrent( EXIMPPlgTestUnsubscribePresenceGrantRequestListCalled );
+
+    // TODO do something, like in PublishPresence
+
+    iWaitter->WaitForL( KWaitTime );
+    }
+
+
+void T_XIMPTestConnection::DoGrantPresenceForPresentityL( const MXIMPIdentity& aIdentity,
+                                           const MPresenceInfoFilter& aPif,
+                                           TXIMPRequestId aReqId )
+    {
+    PluginAPIMethodCommonL( aReqId );
+
+    SetBooleanToCurrent( EXIMPPlgTestGrantPresenceForPresentityCalled );
+
+    // TODO do something, like in PublishPresence
+
+    iWaitter->WaitForL( KWaitTime );
+
+    }
+void T_XIMPTestConnection::DoGrantPresenceForPresentityGroupMembersL( const MXIMPIdentity& aGroupId,
+                                                        const MPresenceInfoFilter& aPif,
+                                                        TXIMPRequestId aReqId )
+    {
+    PluginAPIMethodCommonL( aReqId );
+
+    SetBooleanToCurrent( EXIMPPlgTestGrantPresenceForPresentityGroupMembersCalled );
+
+    // TODO do something, like in PublishPresence
+
+    iWaitter->WaitForL( KWaitTime );
+
+    }
+
+void T_XIMPTestConnection::DoGrantPresenceForEveryoneL( const MPresenceInfoFilter& aPif,
+                                                        TXIMPRequestId aReqId )
+    {
+    PluginAPIMethodCommonL( aReqId );
+
+    SetBooleanToCurrent( EXIMPPlgTestGrantPresenceForEveryoneCalled );
+
+    // TODO do something, like in PublishPresence
+
+    iWaitter->WaitForL( KWaitTime );
+
+    }
+
+
+void T_XIMPTestConnection::DoUpdatePresenceGrantPifForPresentityL( const MXIMPIdentity& aIdentity,
+                                           const MPresenceInfoFilter& aPif,
+                                           TXIMPRequestId aReqId )
+    {
+    PluginAPIMethodCommonL( aReqId );
+
+    SetBooleanToCurrent( EXIMPPlgTestUpdateGrantPresenceForPresentityCalled );
+
+    // TODO do something, like in PublishPresence
+
+    iWaitter->WaitForL( KWaitTime );
+
+    }
+
+void T_XIMPTestConnection::DoUpdatePresenceGrantPifForPresentityGroupMembersL( const MXIMPIdentity& aGroupId,
+                                                        const MPresenceInfoFilter& aPif,
+                                                        TXIMPRequestId aReqId )
+    {
+    PluginAPIMethodCommonL( aReqId );
+
+    SetBooleanToCurrent( EXIMPPlgTestUpdateGrantPresenceForPresentityGroupMembersCalled );
+
+    // TODO do something, like in PublishPresence
+
+    iWaitter->WaitForL( KWaitTime );
+
+    }
+
+void T_XIMPTestConnection::DoUpdatePresenceGrantPifForEveryoneL( const MPresenceInfoFilter& aPif,
+                                                                 TXIMPRequestId aReqId )
+    {
+    PluginAPIMethodCommonL( aReqId );
+
+    SetBooleanToCurrent( EXIMPPlgTestUpdateGrantPresenceForEveryoneCalled );
+
+    // TODO do something, like in PublishPresence
+
+    iWaitter->WaitForL( KWaitTime );
+
+    }
+
+
+void T_XIMPTestConnection::DoWithdrawPresenceGrantFromPresentityL( const MXIMPIdentity& aIdentity, TXIMPRequestId aReqId )
+    {
+    PluginAPIMethodCommonL( aReqId );
+
+    SetBooleanToCurrent( EXIMPPlgTestWithdrawPresenceFromPresentityCalled );
+
+    // TODO do something, like in PublishPresence
+
+    iWaitter->WaitForL( KWaitTime );
+
+    }
+
+void T_XIMPTestConnection::DoWithdrawPresenceGrantFromEveryoneL( TXIMPRequestId aReqId )
+    {
+    PluginAPIMethodCommonL( aReqId );
+
+    SetBooleanToCurrent( EXIMPPlgTestWithdrawPresenceFromEveryoneCalled );
+
+    // TODO do something, like in PublishPresence
+
+    iWaitter->WaitForL( KWaitTime );
+
+    }
+
+void T_XIMPTestConnection::DoWithdrawPresenceGrantFromPresentityGroupMembersL( const MXIMPIdentity& aGroupId,
+                                                            TXIMPRequestId aReqId )
+    {
+    PluginAPIMethodCommonL( aReqId );
+
+    SetBooleanToCurrent( EXIMPPlgTestWithdrawPresenceFromPresentityGroupMembersCalled );
+
+    // TODO do something, like in PublishPresence
+
+    iWaitter->WaitForL( KWaitTime );
+
+    }
+
+void T_XIMPTestConnection::DoSubscribePresenceBlockListL( TXIMPRequestId aReqId )
+    {
+    PluginAPIMethodCommonL( aReqId );
+
+    SetBooleanToCurrent( EXIMPPlgTestSubscribePresenceBlockListCalled );
+
+    // TODO do something, like in PublishPresence
+
+    iWaitter->WaitForL( KWaitTime );
+
+    }
+
+void T_XIMPTestConnection::DoUnsubscribePresenceBlockListL( TXIMPRequestId aReqId )
+    {
+    PluginAPIMethodCommonL( aReqId );
+
+    SetBooleanToCurrent( EXIMPPlgTestUnsubscribePresenceBlockListCalled );
+
+    // TODO do something, like in PublishPresence
+
+    iWaitter->WaitForL( KWaitTime );
+
+    }
+void T_XIMPTestConnection::DoBlockPresenceForPresentityL( const MXIMPIdentity& aPresentityId,
+                                    TXIMPRequestId aReqId )
+    {
+    PluginAPIMethodCommonL( aReqId );
+
+    SetBooleanToCurrent( EXIMPPlgTestBlockPresenceForPresentityCalled );
+
+    // TODO do something, like in PublishPresence
+
+    iWaitter->WaitForL( KWaitTime );
+
+    }
+void T_XIMPTestConnection::DoCancelPresenceBlockFromPresentityL( const MXIMPIdentity& aPresentityId,
+                                           TXIMPRequestId aReqId )
+    {
+    PluginAPIMethodCommonL( aReqId );
+
+    SetBooleanToCurrent( EXIMPPlgTestCancelPresenceBlockFromPresentityCalled );
+
+    // TODO do something, like in PublishPresence
+
+    iWaitter->WaitForL( KWaitTime );
+
+    }
+
+
+
+// ---------------------------------------------------------------------------
+// T_XIMPTestConnection::PluginAPIMethodCommonL
+// ---------------------------------------------------------------------------
+//
+void T_XIMPTestConnection::PluginAPIMethodCommonL( TXIMPRequestId& aOpId )
+    {
+    iReqId = aOpId;
+
+    TInt index = CXIMPTestMessenger::GetPluginIndex();
+    TInt count = iClients.Count();
+    for( TInt a = 0; a < count; ++a )
+        {
+        if( iClients[ a ]->iPluginIndex == index )
+            {
+            iCurrentMessenger = iClients[ a ]->iMessenger;
+            }
+        }
+    iCurrentMessenger->HandleLeaveL();
+    // handle other errors here
+    if ( iCurrentMessenger->GetBoolean( EXIMPTestPlgBehaveInvalidReqId ) )
+        {
+        // arbitrarily mangle the given request id
+        TXIMPRequestIdBuilder idBuilder;
+        idBuilder.SetProtocolId( 123 );
+        idBuilder.SetSessionId( 456 );
+        idBuilder.SetRequestId( 789 );
+        //iReqId = TXIMPRequestId( 123, 456, 789 );
+        iReqId = idBuilder.BuildRequestId();
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// T_XIMPTestConnection::WaitCompleted()
+// ---------------------------------------------------------------------------
+//
+void T_XIMPTestConnection::WaitCompleted( TInt /* aRetVal */ )
+    {
+    TInt errorCode = iCurrentMessenger->GetError();
+
+/*
+    if ( iSessionLostFailReconnects )
+        {
+        // fail all reconnects
+        errorCode = KErrTimedOut;
+        iConnectedClients = 0;
+        }
+*/
+    MXIMPStatus* status = iConnectionHost->ObjectFactory().NewStatusLC();
+    CleanupStack::Pop(); // status.
+    status->SetResultCode( errorCode );
+
+    MXIMPRestrictedObjectCollection* reqCompleteParams = iCurrentMessenger->GetReqCompleteParams();
+
+    if( reqCompleteParams )
+        {
+        iConnectionHost->HandleRequestCompleted( iReqId, status, reqCompleteParams );
+        reqCompleteParams = NULL;
+        }
+    else
+        {
+        iConnectionHost->HandleRequestCompleted( iReqId, status );
+        }
+
+    if ( iSessionLostFailReconnects )
+        {
+        // doing a sequence of failing reconnects
+        return;
+        }
+
+    // check if test code wants us to fake session lost
+    TInt val = iCurrentMessenger->GetValueFor( EXIMPTestPlgSessionLostStrategy );
+
+    if ( val != EXIMPPrtValSessionLostEmpty )
+        {
+        // yep, fake session lost
+
+        // reset the old value! otherwise timer will restart upon next operation.
+        iCurrentMessenger->SetValueFor( EXIMPTestPlgSessionLostStrategy, EXIMPPrtValSessionLostEmpty );
+
+        iSessionLostReconnect = val == EXIMPPrtValSessionLostReconnect;
+        iSessionLostFailReconnects = val == EXIMPPrtValSessionLostReconnectExhaustAttempts;
+
+        // start another wait (5 sec) with callback.
+        TInt time = 1000000 * 5;
+        TCallBack callback( ReconnectSimulator, this );
+        iAuxTimer->Start( time, time, callback );
+        }
+
+    delete iClientToBeDeleted;
+    iClientToBeDeleted = NULL;
+    
+    }
+
+// ---------------------------------------------------------------------------
+// RECONNECTION SIMULATOR ROUTINES
+// ---------------------------------------------------------------------------
+//
+TInt T_XIMPTestConnection::ReconnectSimulator( TAny* aMyself )
+    {
+//    (static_cast<T_XIMPTestConnection*>(aMyself))->DoReconnectSimulator();
+    return 0; // ignored by CPeriodic
+    }
+
+void T_XIMPTestConnection::DoReconnectSimulator()
+    {
+/*    TRAPD( err, DoReconnectSimulatorL() );
+    if ( err != KErrNone )
+        {
+        // TODO what to do? is this enough to fail testcode
+        User::Panic( _L("XIMPTestPrt"), 424242 );
+        }
+        */
+    }
+
+void T_XIMPTestConnection::DoReconnectSimulatorL()
+    {
+    iAuxTimer->Cancel();    // must stop it from running again
+/*
+    // connection dies.
+    iConnectedClients = 0;
+
+    if ( iSessionLostReconnect || iSessionLostFailReconnects )
+        {
+        // tell host to try to reconnect
+        iConnectionHost->HandleConnectionLost( iStatus );
+        }
+    else
+        {
+        // tell host to kill connection
+        iConnectionHost->HandleConnectionTerminated( iStatus );
+        }
+*/
+    }
+
+void T_XIMPTestConnection::SetBooleanToCurrent( TXIMPTestPropertyKeys aKey )
+    {
+    if( iCurrentMessenger )
+        {
+        iCurrentMessenger->SetBoolean( aKey );
+        }
+    }
+
+void T_XIMPTestConnection::SetBoolean( TXIMPTestPropertyKeys aKey )
+    {
+    TInt count = iClients.Count();
+    for( TInt a = 0; a < count ; ++a )
+        {
+        iClients[ a ]->iMessenger->SetBoolean( aKey );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// T_XIMPTestConnection::GetInterface()
+// ---------------------------------------------------------------------------
+//
+TAny* T_XIMPTestConnection::GetInterface(
+        TInt32 aInterfaceId,
+        TIfGetOps /* aOptions */ )
+    {
+    if ( aInterfaceId == MXIMPProtocolConnection::KInterfaceId )
+        {
+        // caller wants this interface
+        MXIMPProtocolConnection* myIf = this;
+        return myIf;
+        }
+    else if( aInterfaceId == MProtocolPresencePublishing::KInterfaceId )
+        {
+        // caller wants this interface
+        MProtocolPresencePublishing* myIf = this;
+        return myIf;
+        }
+    else if( aInterfaceId == MProtocolPresenceWatching::KInterfaceId )
+        {
+        // caller wants this interface
+        MProtocolPresenceWatching* myIf = this;
+        return myIf;
+        }
+    else if( aInterfaceId == MProtocolPresenceAuthorization::KInterfaceId )
+        {
+        // caller wants this interface
+        MProtocolPresenceAuthorization* myIf = this;
+        return myIf;
+        }
+    else if( aInterfaceId == MProtocolPresentityGroups::KInterfaceId )
+        {
+        // caller wants this interface
+        MProtocolPresentityGroups* myIf = this;
+        return myIf;
+        }
+    else if( aInterfaceId == T_XIMPTestConnection::KClassId )
+        {
+        return this;
+        }
+    else
+        {
+        return NULL;
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// T_XIMPTestConnection::GetInterface()
+// ---------------------------------------------------------------------------
+//
+const TAny* T_XIMPTestConnection::GetInterface(
+        TInt32 aInterfaceId,
+        TIfGetOps /* aOptions */ ) const
+    {
+    if ( aInterfaceId == MXIMPProtocolConnection::KInterfaceId )
+        {
+        // caller wants this interface
+        const MXIMPProtocolConnection* myIf = this;
+        return myIf;
+        }
+    else if( aInterfaceId == MProtocolPresencePublishing::KInterfaceId )
+        {
+        // caller wants this interface
+        const MProtocolPresencePublishing* myIf = this;
+        return myIf;
+        }
+    else if( aInterfaceId == MProtocolPresenceWatching::KInterfaceId )
+        {
+        // caller wants this interface
+        const MProtocolPresenceWatching* myIf = this;
+        return myIf;
+        }
+    else if( aInterfaceId == MProtocolPresenceAuthorization::KInterfaceId )
+        {
+        // caller wants this interface
+        const MProtocolPresenceAuthorization* myIf = this;
+        return myIf;
+        }
+    else if( aInterfaceId == MProtocolPresentityGroups::KInterfaceId )
+        {
+        // caller wants this interface
+        const MProtocolPresentityGroups* myIf = this;
+        return myIf;
+        }
+    else if( aInterfaceId == T_XIMPTestConnection::KClassId )
+        {
+        return this;
+        }
+    else
+        {
+        return NULL;
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// T_XIMPTestConnection::GetInterfaceId()
+// ---------------------------------------------------------------------------
+//
+TInt32 T_XIMPTestConnection::GetInterfaceId() const
+    {
+    return MXIMPProtocolConnection::KInterfaceId;
+    }
+
+
+// ---------------------------------------------------------------------------
+// Key value pair table to identify correct constructor
+// function for the requested interface.
+// ---------------------------------------------------------------------------
+//
+const TImplementationProxy ImplementationTable[] =
+    {
+    IMPLEMENTATION_PROXY_ENTRY( K_PRFW_TST_PROTOCOL_1_IMPLEMENTATION_UID,
+                                T_XIMPTestProtocol::NewL )
+    };
+
+
+// ---------------------------------------------------------------------------
+// Exported function to return the implementation proxy table
+// ---------------------------------------------------------------------------
+//
+EXPORT_C const TImplementationProxy* ImplementationGroupProxy( TInt& aTableCount )
+    {
+    aTableCount = sizeof( ImplementationTable ) / sizeof( TImplementationProxy );
+    return ImplementationTable;
+    }
+
+// ---------------------------------------------------------------------------
+// T_XIMPTestProtocol::T_XIMPTestProtocol()
+// ---------------------------------------------------------------------------
+//
+T_XIMPTestProtocol::T_XIMPTestProtocol()
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// T_XIMPTestProtocol::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void T_XIMPTestProtocol::ConstructL()
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// T_XIMPTestProtocol::NewLC()
+// ---------------------------------------------------------------------------
+//
+T_XIMPTestProtocol* T_XIMPTestProtocol::NewLC()
+    {
+    T_XIMPTestProtocol* self = new( ELeave ) T_XIMPTestProtocol();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+
+// ---------------------------------------------------------------------------
+// T_XIMPTestProtocol::NewL()
+// ---------------------------------------------------------------------------
+//
+T_XIMPTestProtocol* T_XIMPTestProtocol::NewL()
+    {
+    T_XIMPTestProtocol* self = T_XIMPTestProtocol::NewLC();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// T_XIMPTestProtocol::~T_XIMPTestProtocol()
+// ---------------------------------------------------------------------------
+//
+T_XIMPTestProtocol::~T_XIMPTestProtocol()
+    {
+    iConnections.Close();
+    }
+
+// ---------------------------------------------------------------------------
+// T_XIMPTestProtocol::PrimeHost()
+// ---------------------------------------------------------------------------
+//
+void T_XIMPTestProtocol::PrimeHost( MXIMPProtocolPluginHost& aHost )
+    {
+    iHost = &aHost;
+    }
+
+// ---------------------------------------------------------------------------
+// T_XIMPTestProtocol::AcquireConnectionL()
+// ---------------------------------------------------------------------------
+//
+MXIMPProtocolConnection& T_XIMPTestProtocol::AcquireConnectionL(
+                                    const MXIMPServiceInfo& aServiceInfo,
+                                    const MXIMPContextClientInfo& aClientCtxInfo )
+    {
+    T_XIMPTestConnection* newConnection = T_XIMPTestConnection::NewLC( aServiceInfo, aClientCtxInfo );
+    TLinearOrder< T_XIMPTestConnection > order( T_XIMPTestConnection::OrderOfConnections );
+    TInt index = iConnections.FindInOrder( newConnection, order );
+    if( index != KErrNotFound )
+        {
+        User::LeaveIfError( index );
+        CleanupStack::PopAndDestroy(); // newConnection
+        newConnection = iConnections[ index ];
+        }
+    else
+        {
+        iConnections.InsertInOrderL( newConnection, order );
+        CleanupStack::Pop(); //newConnection
+        }
+    return *newConnection;
+    }
+
+// ---------------------------------------------------------------------------
+// T_XIMPTestProtocol::ReleaseConnection()
+// ---------------------------------------------------------------------------
+//
+void T_XIMPTestProtocol::ReleaseConnection( MXIMPProtocolConnection& aConnection )
+    {
+    TLinearOrder< T_XIMPTestConnection > order( T_XIMPTestConnection::OrderOfConnections );
+    T_XIMPTestConnection* connection = ( T_XIMPTestConnection* )( aConnection.GetInterface(
+                    T_XIMPTestConnection::KClassId,
+                    MXIMPBase::EPanicIfUnknown ) );
+    TInt index = iConnections.FindInOrder( connection, order );
+    if( index >= 0 )
+        {
+        iConnections.Remove( index );
+        }
+    delete connection;
+    }
+
+// ---------------------------------------------------------------------------
+// T_XIMPTestProtocol::GetInterface()
+// ---------------------------------------------------------------------------
+//
+TAny* T_XIMPTestProtocol::GetInterface(
+        TInt32 aInterfaceId,
+        TIfGetOps /* aOptions */ )
+    {
+    if ( aInterfaceId == MXIMPProtocolPlugin::KInterfaceId )
+        {
+        // caller wants this interface
+        MXIMPProtocolPlugin* myIf = this;
+        return myIf;
+        }
+    else
+        {
+        return NULL;
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// T_XIMPTestProtocol::GetInterface()
+// ---------------------------------------------------------------------------
+//
+const TAny* T_XIMPTestProtocol::GetInterface(
+        TInt32 aInterfaceId,
+        TIfGetOps /* aOptions */ ) const
+    {
+    if ( aInterfaceId == MXIMPProtocolPlugin::KInterfaceId )
+        {
+        // caller wants this interface
+        const MXIMPProtocolPlugin* myIf = this;
+        return myIf;
+        }
+    else
+        {
+        return NULL;
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// T_XIMPTestProtocol::GetInterfaceId()
+// ---------------------------------------------------------------------------
+//
+TInt32 T_XIMPTestProtocol::GetInterfaceId() const
+    {
+    return MXIMPProtocolPlugin::KInterfaceId;
+    }
+
+
+
+// End of file
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcprotocols/pr_prfwtestprotocol/pr_prfwtestprotocol.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,403 @@
+/*
+* 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:  Test Protocol implementation for XIMP Framework
+ *
+*/
+
+
+#ifndef T_PRFWTESTPROTOCOL_H
+#define T_PRFWTESTPROTOCOL_H
+
+
+#include <e32base.h>
+
+#include <ximpprotocolpluginbase.h>
+#include <protocolpresencepublishing.h>
+#include <protocolpresencewatching.h>
+#include <protocolpresenceauthorization.h>
+#include <protocolpresentitygroups.h>
+#include <protocolpresencefeatures.h>
+#include <ximpprotocolconnection.h>
+#include <ximpprotocolconnectionhostobserver.h>
+#include <ximpbase.h>
+
+#include "prfwwaitobserver.h"
+
+#include "prfwtestmessaging.h"
+
+class CXIMPTestGeneralWaiter;
+class CXIMPTestMessenger;
+class CPeriodic;
+class CXIMPTestFileLogicHelper;
+class CXIMPTestFileTool;
+class MXIMPRestrictedObjectCollection;
+class MProtocolImFeatures;
+#define PRIMP_CLSID_CPRESENTITYGROUPINFOIMP 15000
+
+class T_XIMPTestConnection :public CBase,
+                            public MXIMPProtocolConnection,
+                            public MProtocolPresenceFeatures,
+                            public MProtocolPresencePublishing,
+                            public MProtocolPresenceWatching,
+                            public MProtocolPresenceAuthorization,
+                            public MProtocolPresentityGroups,
+                            public MXIMPProtocolConnectionHostObserver,
+                            public T_MWaitObserver
+                            
+    {
+    public:
+    /** The class ID. */
+    enum { KClassId = PRIMP_CLSID_CPRESENTITYGROUPINFOIMP };
+
+
+        class ClientWrapper : public CBase
+            {
+            private:
+
+                void ConstructL( const TDesC& aClientId );
+
+            public:
+
+                static ClientWrapper* NewLC( const TDesC& aClientId );
+                void InitializeL( MXIMPProtocolConnectionHost& aConnectionHost );
+                ~ClientWrapper();
+
+            public:
+
+                RBuf iId;
+                CXIMPTestFileTool* iFileTool;
+                CXIMPTestMessenger* iMessenger;
+                CXIMPTestFileLogicHelper* iFileLogicHelper;
+                TInt iPluginIndex;
+            };
+
+    public:
+
+        static T_XIMPTestConnection* NewL( const MXIMPServiceInfo& aServiceInfo,
+                                           const MXIMPContextClientInfo& aClientCtxInfo );
+        static T_XIMPTestConnection* NewLC( const MXIMPServiceInfo& aServiceInfo,
+                                            const MXIMPContextClientInfo& aClientCtxInfo );
+
+        ~T_XIMPTestConnection();
+
+
+    private:
+
+        T_XIMPTestConnection();
+        void ConstructL( const MXIMPServiceInfo& aServiceInfo,
+                         const MXIMPContextClientInfo& aClientCtxInfo );
+
+    public: // From MXIMPProtocolConnection
+
+        /**
+         * host for connection
+         */
+        void PrimeHost( MXIMPProtocolConnectionHost& aHost );
+
+        void OpenSessionL( const MXIMPContextClientInfo& aClientCtxInfo,
+                               TXIMPRequestId aReqId  );
+
+        
+        void OpenSessionL(
+                const TInt& aSettingsId,
+                TXIMPRequestId aReqId );
+
+        void CloseSession( const MXIMPContextClientInfo& aClientCtxInfo,
+                               TXIMPRequestId aReqId );
+                               
+        MProtocolPresenceFeatures& ProtocolPresenceFeatures();
+		
+		//MProtocolImFeatures* ProtocolImFeatures();
+		
+		TAny* GetProtocolInterface(TInt aInterfaceId);
+		
+    public: // MProtocolPresenceFeatures
+        MProtocolPresenceWatching& PresenceWatching();
+        MProtocolPresencePublishing& PresencePublishing();
+        MProtocolPresentityGroups& PresentityGroups();
+        MProtocolPresenceAuthorization& PresenceAuthorization();
+        
+        
+    public: // From MXIMPProtocolConnectionHostObserver        
+    
+        void HandleProtocolConnectionHostEvent(
+                const MXIMPProtocolConnectionHost& aHost,
+                const MXIMPBase& aEvent );
+
+
+    public: // from MPscPlugin
+
+
+        void GetSupportedFeaturesL(
+                CDesC8Array& aFeatures ) const;
+
+        void DoPublishOwnPresenceL(
+                const MPresenceInfo& aPresence,
+                TXIMPRequestId aReqId );
+
+        void DoSubscribeOwnPresenceL( const MPresenceInfoFilter& aPif,
+                                          TXIMPRequestId aReqId );
+
+        void DoUnsubscribeOwnPresenceL( TXIMPRequestId aReqId );
+
+        void DoUpdateOwnPresenceSubscriptionPifL( const MPresenceInfoFilter& aPif,
+                                          TXIMPRequestId aReqId );
+
+
+        void DoSubscribePresenceWatcherListL( TXIMPRequestId aReqId );
+        void DoUnsubscribePresenceWatcherListL( TXIMPRequestId aReqId );
+
+        void DoSubscribePresentityGroupListL( TXIMPRequestId aReqId );
+        void DoUnsubscribePresentityGroupListL( TXIMPRequestId aReqId );
+
+        void DoCreatePresentityGroupL( const MXIMPIdentity& aIdentity,
+                                           const TDesC16& aDisplayName,
+                                           TXIMPRequestId aReqId );
+        void DoDeletePresentityGroupL( const MXIMPIdentity& aIdentity,
+                                               TXIMPRequestId aReqId );
+        void DoUpdatePresentityGroupDisplayNameL( const MXIMPIdentity& aIdentity,
+                                               const TDesC16& aDisplayName,
+                                               TXIMPRequestId aReqId );
+        void DoSubscribePresentityPresenceL(
+                                    const MXIMPIdentity& aIdentity,
+                                    const MPresenceInfoFilter& aPif,
+                                    TXIMPRequestId aReqId );
+        void DoUpdatePresentityPresenceSubscriptionPifL(
+                                    const MXIMPIdentity& aIdentity,
+                                    const MPresenceInfoFilter& aPif,
+                                    TXIMPRequestId aReqId );
+        void DoUnsubscribePresentityPresenceL( const MXIMPIdentity& aIdentity,
+                                    TXIMPRequestId aReqId );
+
+        void DoSubscribePresentityGroupContentL( const MXIMPIdentity& aGroupId,
+                                                     TXIMPRequestId aReqId );
+
+        void DoUnsubscribePresentityGroupContentL( const MXIMPIdentity& aGroupId,
+                                                       TXIMPRequestId aReqId );
+
+        void DoAddPresentityGroupMemberL( const MXIMPIdentity& aGroupId,
+                                              const MXIMPIdentity& aMemberId,
+                                              const TDesC16& aMemberDisplayName,
+                                              TXIMPRequestId aReqId );
+
+        void DoRemovePresentityGroupMemberL( const MXIMPIdentity& aGroupId,
+                                                 const MXIMPIdentity& aMemberId,
+                                                 TXIMPRequestId aReqId );
+
+        void DoUpdatePresentityGroupMemberDisplayNameL( const MXIMPIdentity& aGroupId,
+                                                            const MXIMPIdentity& aMemberId,
+                                                            const TDesC16& aMemberDisplayName,
+                                                            TXIMPRequestId aReqId );
+        void DoSubscribePresentityGroupMembersPresenceL(
+                                        const MXIMPIdentity& aIdentity,
+                                        const MPresenceInfoFilter& aPif,
+                                        TXIMPRequestId aReqId );
+
+        void DoUpdatePresentityGroupMembersPresenceSubscriptionPifL(
+                                        const MXIMPIdentity& aIdentity,
+                                        const MPresenceInfoFilter& aPif,
+                                        TXIMPRequestId aReqId );
+
+        void DoUnsubscribePresentityGroupMembersPresenceL( const MXIMPIdentity& aIdentity,
+                                        TXIMPRequestId aReqId );
+
+        void DoSubscribePresenceGrantRequestListL( TXIMPRequestId aReqId );
+
+        void DoUnsubscribePresenceGrantRequestListL( TXIMPRequestId aReqId );
+
+        void DoGrantPresenceForPresentityL( const MXIMPIdentity& aIdentity,
+                                                   const MPresenceInfoFilter& aPif,
+                                                   TXIMPRequestId aReqId );
+        void DoGrantPresenceForPresentityGroupMembersL( const MXIMPIdentity& aGroupId,
+                                                                const MPresenceInfoFilter& aPif,
+                                                                TXIMPRequestId aReqId );
+
+        void DoGrantPresenceForEveryoneL( const MPresenceInfoFilter& aPif,
+                                            TXIMPRequestId aReqId );
+
+        void DoUpdatePresenceGrantPifForPresentityL( const MXIMPIdentity& aIdentity,
+                                                   const MPresenceInfoFilter& aPif,
+                                                   TXIMPRequestId aReqId );
+
+        void DoUpdatePresenceGrantPifForPresentityGroupMembersL( const MXIMPIdentity& aGroupId,
+                                                                const MPresenceInfoFilter& aPif,
+                                                                TXIMPRequestId aReqId );
+
+        void DoUpdatePresenceGrantPifForEveryoneL( const MPresenceInfoFilter& aPif,
+                                                   TXIMPRequestId aReqId );
+
+        void DoWithdrawPresenceGrantFromPresentityL( const MXIMPIdentity& aIdentity, TXIMPRequestId aReqId );
+
+        void DoWithdrawPresenceGrantFromPresentityGroupMembersL( const MXIMPIdentity& aGroupId,
+                                                                    TXIMPRequestId aReqId );
+
+        void DoWithdrawPresenceGrantFromEveryoneL( TXIMPRequestId aReqId );
+
+        void DoSubscribePresenceBlockListL( TXIMPRequestId aReqId );
+        void DoUnsubscribePresenceBlockListL( TXIMPRequestId aReqId );
+        void DoBlockPresenceForPresentityL( const MXIMPIdentity& aPresentityId,
+                                            TXIMPRequestId aReqId );
+        void DoCancelPresenceBlockFromPresentityL( const MXIMPIdentity& aPresentityId,
+                                                   TXIMPRequestId aReqId );
+
+    public: // from T_MWaitObserver
+
+        void WaitCompleted( TInt aRetVal );
+
+
+    public: // from MXIMPBase
+
+        TAny* GetInterface(
+                TInt32 aInterfaceId,
+                TIfGetOps aOptions );
+
+        const TAny* GetInterface(
+                TInt32 aInterfaceId,
+                TIfGetOps aOptions ) const;
+
+        TInt32 GetInterfaceId() const;
+
+    private:
+        /**
+         * All plugin API methods should call this method
+         * to handle test code to plugin communication
+         * properly.
+         * Add more common stuff here (such as new special messages
+         * which behave in a common way to all plugin API calls, etc.)
+         * @param aOpId The request id
+         */
+        void PluginAPIMethodCommonL( TXIMPRequestId& aOpId );
+
+        /**
+         * Callback for aux timer
+         * @see TCallBack
+         */
+        static TInt ReconnectSimulator( TAny* aMyself );
+
+        /**
+         * Actual callback called from ReconnectSimulator
+         */
+        void DoReconnectSimulator();
+
+        /**
+         * Leaving version of aux timer callback.
+         */
+        void DoReconnectSimulatorL();
+
+        void SetBooleanToCurrent( TXIMPTestPropertyKeys aKey );
+        void SetBoolean( TXIMPTestPropertyKeys aKey );
+
+    public:
+        static TInt OrderOfConnections( const T_XIMPTestConnection& aFirst,
+                                        const T_XIMPTestConnection& aSecond );
+
+    private:
+
+        static TInt OrderOfClients( const ClientWrapper& aFirst,
+                                    const ClientWrapper& aSecond );
+    private:
+
+        HBufC* iServerAddress;
+        HBufC* iUserName;
+        HBufC* iPassword;
+        HBufC* iClientId;
+
+        //TInt iConnectedClients;
+
+        RPointerArray< ClientWrapper > iClients;
+        ClientWrapper* iClientToBeDeleted;
+
+        TXIMPRequestId iReqId;
+        CXIMPTestGeneralWaiter* iWaitter;
+
+        MXIMPStatus* iStatus;
+
+        // last received message
+        TXIMPTestMsg iLastMsg;
+
+        // ETrue if reconnect is to be faked for session lost.
+        TBool iSessionLostReconnect;
+
+        // ETrue if all reconnects are to be failed.
+        TBool iSessionLostFailReconnects;
+
+        // auxiliary timer (session lost simulation)
+        CPeriodic* iAuxTimer;
+
+
+        /**
+         * File tool for monitoring events.
+         */
+        //CXIMPTestFileTool* iFileTool;
+
+        /**
+         * Host for connection
+         */
+        MXIMPProtocolConnectionHost* iConnectionHost;
+
+        CXIMPTestMessenger* iCurrentMessenger;
+    };
+
+/**
+ * Example protocol plugin
+ *
+ *
+ * @lib ?library
+ * @since S60 v4.0
+ */
+class T_XIMPTestProtocol : public CXIMPProtocolPluginBase
+    {
+    public:
+
+        static T_XIMPTestProtocol* NewL();
+        static T_XIMPTestProtocol* NewLC();
+
+        ~T_XIMPTestProtocol();
+
+    private:
+
+        T_XIMPTestProtocol();
+        void ConstructL();
+
+    public: // From MXIMPProtocolPlugin
+
+        void PrimeHost( MXIMPProtocolPluginHost& aHost );
+
+        MXIMPProtocolConnection& AcquireConnectionL(
+                    const MXIMPServiceInfo& aServiceInfo,
+                    const MXIMPContextClientInfo& aClientCtxInfo );
+        void ReleaseConnection(
+                        MXIMPProtocolConnection& aConnection );
+
+    public: // from MXIMPBase
+
+        TAny* GetInterface(
+                TInt32 aInterfaceId,
+                TIfGetOps aOptions );
+
+        const TAny* GetInterface(
+                TInt32 aInterfaceId,
+                TIfGetOps aOptions ) const;
+
+        TInt32 GetInterfaceId() const;
+
+
+    private: // Data
+
+        // Prime host
+        MXIMPProtocolPluginHost* iHost;
+        RXIMPObjOwningPtrArray< T_XIMPTestConnection > iConnections;
+    };
+
+#endif // T_PRFWTESTPROTOCOL_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcprotocols/pr_prfwtestprotocol/pr_prfwtestprotocol.mmp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,92 @@
+/*
+* 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 Presence Framework Test Protocol
+*
+*/
+
+#include <platform_paths.hrh>
+#include "../prfwtestprotocols_resource.hrh"
+#include<eunitcaps.h>
+
+TARGET              pr_prfwtestprotocol.dll
+TARGETTYPE          PLUGIN
+UID                 XIMP_DLL_UID_ECOM_PLUGIN  PRFW_DLL_UID_PR_PRFWTESTPROTOCOL
+VENDORID            VID_DEFAULT
+//CAPABILITY          ALL -TCB
+CAPABILITY      EUNIT_CAPS
+
+
+//ECOM RESOURCE
+START RESOURCE      pr_prfwtestprotocol.rss
+TARGET              pr_prfwtestprotocol.rsc
+END                 // RESOURCE
+
+SOURCEPATH          .
+SOURCE              pr_prfwtestprotocol.cpp
+
+SOURCEPATH          ../../tsrcutils/testcaseutils
+SOURCE              prfwtestfilelogichelper.cpp
+SOURCE              prfwtestfiletool.cpp
+
+USERINCLUDE             ../../../../../ximpfw/core/srcdatamodel
+USERINCLUDE             ../../../../../ximpfw/presence/srcpresencedatamodel
+USERINCLUDE             ../../../../../ximpfw/presence/srcpresencedatamodel/presentitygroups
+USERINCLUDE             ../../../../../ximpfw/presence/srcpresencedatamodel/presencewatching
+USERINCLUDE             ../../../../../ximpfw/presence/srcpresencedatamodel/presenceauthorization
+USERINCLUDE             ../../../../../ximpfw/presence/srcpresencedatamodel/presencepublishing
+USERINCLUDE             ../../../../../ximpfw/presence/srcpresencedatamodel/presenceinfo
+USERINCLUDE             ../../../../../ximpfw/core/srcutils
+USERINCLUDE             ../../tsrcprotocols
+USERINCLUDE             ../../tsrcutils/testcaseutils
+
+// TODO remove unnecessary
+SYSTEMINCLUDE           ../../../../../ximpfw/inc/core/base
+SYSTEMINCLUDE           ../../../../../ximpfw/inc/core/datamodel
+SYSTEMINCLUDE           ../../../../../ximpfw/inc/core/protocolplugin
+SYSTEMINCLUDE           ../../../../../ximpfw/inc/core/protocolpluginhost
+SYSTEMINCLUDE           ../../../../../ximpfw/inc/presence/presencedatamodel
+SYSTEMINCLUDE           ../../../../../ximpfw/inc/presence/presencemanagement
+SYSTEMINCLUDE           ../../../../../ximpfw/inc/presence/presenceprotocolplugin
+SYSTEMINCLUDE           ../../../../../ximpfw/inc/presence/presenceprotocolpluginhost
+
+#if defined ( OS_LAYER_SYSTEMINCLUDE )
+OS_LAYER_SYSTEMINCLUDE
+#else
+SYSTEMINCLUDE     /epoc32/include
+#endif
+
+ #if defined ( APP_LAYER_SYSTEMINCLUDE )
+ APP_LAYER_SYSTEMINCLUDE
+ #else
+ SYSTEMINCLUDE     \epoc32\include
+ #endif
+
+MW_LAYER_SYSTEMINCLUDE
+SYSTEMINCLUDE   /epoc32/include/ecom
+
+
+LIBRARY             euser.lib
+LIBRARY             ecom.lib
+LIBRARY             bafl.lib
+LIBRARY             estor.lib
+LIBRARY             efsrv.lib
+LIBRARY             flogger.lib
+
+LIBRARY             ximpdatamodel.lib
+LIBRARY             presencedatamodel.lib
+LIBRARY             ximputils.lib
+LIBRARY             prfwtestcaseutils.lib
+
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcprotocols/pr_prfwtestprotocol/pr_prfwtestprotocol.rss	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  ECOM registery info for Presence Framework Test Protocol
+*
+*/
+
+#include <ecom/registryinfov2.rh>
+#include <ximpprotocolpluginifids.hrh>
+
+#include "prfwtestprotocols_resource.hrh"
+
+
+
+// ---------------------------------------------------------------------------
+// ECOM registery info for Presence Framework ECOM hook
+// ---------------------------------------------------------------------------
+//
+RESOURCE REGISTRY_INFO theInfo
+    {
+    resource_format_version = RESOURCE_FORMAT_VERSION_2;
+    dll_uid = PRFW_DLL_UID_PR_PRFWTESTPROTOCOL;
+
+    interfaces =
+        {
+        INTERFACE_INFO
+            {
+            interface_uid = XIMP_ECOM_IF_UID_PROTOCOL_PLUGIN_BASE_INTERFACE;
+
+            implementations =
+                {
+                IMPLEMENTATION_INFO
+                    {
+                    implementation_uid = PRFW_TST_PROTOCOL_1_IMPLEMENTATION_UID;
+                    version_no         = PRFW_TST_PROTOCOL_1_VERSION_NO;
+                    display_name       = PRFW_TST_PROTOCOL_1_DISPLAY_NAME;
+                    default_data       = PRFW_TST_PROTOCOL_1_DEFAULT_DATA;
+                    opaque_data        = PRFW_TST_PROTOCOL_1_OPAQUE_DATA;
+                    }
+                };
+            }
+        };
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcprotocols/prfwtestprotocols.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,49 @@
+/*
+* 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: 
+*
+*/
+
+#ifndef PRFWTESTPROTOCOLS_H
+#define PRFWTESTPROTOCOLS_H
+
+#include <e32std.h>
+
+
+/**
+ * C++ compatible definitions for XIMP test protocols.
+ *
+ * This must be kept in-sync with definitions in
+ * "prfwtestprotocols_resource.hrh"
+ */
+
+//XIMP primary test protocol
+const TInt K_PRFW_TST_PROTOCOL_1_IMPLEMENTATION_UID  = 0x10282DDF;
+const TInt K_PRFW_TST_PROTOCOL_1_VERSION_NO          = 1;
+_LIT( K_PRFW_TST_PROTOCOL_1_DISPLAY_NAME,            "XIMP primary test protocol" );
+_LIT( K_PRFW_TST_PROTOCOL_1_DEFAULT_DATA,            "" );
+_LIT( K_PRFW_TST_PROTOCOL_1_OPAQUE_DATA,             "<p>Nokia<f>feat/pres/pub<f>feat/pres/fetch<f>feat/pres/subs<s>sip" );
+
+
+
+//XIMP secondary test protocols
+const TInt K_PRFW_TST_PROTOCOL_2_IMPLEMENTATION_UID  = 0x10282DE0;
+const TInt K_PRFW_TST_PROTOCOL_3_IMPLEMENTATION_UID  = 0x10282DE1;
+const TInt K_PRFW_TST_PROTOCOL_4_IMPLEMENTATION_UID  = 0x10282DE2;
+const TInt K_PRFW_TST_PROTOCOL_5_IMPLEMENTATION_UID  = 0x10282DE3;
+
+
+
+#endif // PRFWTESTPROTOCOLS_H
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcprotocols/prfwtestprotocols_resource.hrh	Wed Nov 03 09:32:20 2010 +0530
@@ -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: 
+*
+*/
+
+#ifndef PRFWTESTPROTOCOLS_RESOURCE_HRH
+#define PRFWTESTPROTOCOLS_RESOURCE_HRH
+
+
+
+/**
+ * System wide UID 2:s for ECom plugin dlls.
+ */
+#define XIMP_DLL_UID_ECOM_PLUGIN                    0x10009D8D
+
+
+/**
+ * Officially reserved UID 3 for the Presence Framework
+ * test protocol dll.
+ */
+#define PRFW_DLL_UID_PR_PRFWTESTPROTOCOL            0x10282DDD
+
+
+
+/**
+ * Resource file compatible defintions for PrFw test protocols.
+ *
+ * This must be kept in-sync with definitions in
+ * "prfwtestprotocols.h"
+ */
+
+//PrFw primary test protocol
+#define PRFW_TST_PROTOCOL_1_IMPLEMENTATION_UID      0x10282DDF
+#define PRFW_TST_PROTOCOL_1_VERSION_NO              1
+#define PRFW_TST_PROTOCOL_1_DISPLAY_NAME            "PrFw primary test protocol"
+#define PRFW_TST_PROTOCOL_1_DEFAULT_DATA            ""
+#define PRFW_TST_PROTOCOL_1_OPAQUE_DATA             "<p>Nokia<f>feat/pres/pub<f>feat/pres/fetch<f>feat/pres/subs<s>sip"
+
+
+
+//PrFw secondary test protocols
+#define PRFW_TST_PROTOCOL_2_IMPLEMENTATION_UID      0x10282DE0
+#define PRFW_TST_PROTOCOL_3_IMPLEMENTATION_UID      0x10282DE1
+#define PRFW_TST_PROTOCOL_4_IMPLEMENTATION_UID      0x10282DE2
+#define PRFW_TST_PROTOCOL_5_IMPLEMENTATION_UID      0x10282DE3
+
+
+
+#endif // PRFWTESTPROTOCOLS_RESOURCE_HRH
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/bld.inf	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,22 @@
+/*
+* 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 prfwtestcaseutils.dll
+*
+*/
+
+
+#include "testcaseutils/bld.inf"
+#include "processmaster/bld.inf"
+
+//#include "eunitcommon/move_tests_to_eunit.inf"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/bwins/prfwtestcaseutilsu.def	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,113 @@
+EXPORTS
+	??0TXIMPTestStatusEventSnapshot@@QAE@HHH@Z @ 1 NONAME ; TXIMPTestStatusEventSnapshot::TXIMPTestStatusEventSnapshot(int, int, int)
+	??0TXIMPTestStatusEventSnapshot@@QAE@XZ @ 2 NONAME ; TXIMPTestStatusEventSnapshot::TXIMPTestStatusEventSnapshot(void)
+	?AcceptedEventTypes@CXIMPTestStatusEventListener@@QAEAAV?$RArray@J@@XZ @ 3 NONAME ; class RArray<long> & CXIMPTestStatusEventListener::AcceptedEventTypes(void)
+	?AppendToTraitsL@CXIMPTestContextWrapper@@QAEXW4TXIMPTestStatusEventTemplate@@@Z @ 4 NONAME ; void CXIMPTestContextWrapper::AppendToTraitsL(enum TXIMPTestStatusEventTemplate)
+	?AssertAddPresentityGroupMemberCalled@CXIMPTestMessenger@@QAEXH@Z @ 5 NONAME ; void CXIMPTestMessenger::AssertAddPresentityGroupMemberCalled(int)
+	?AssertCloseSessionCalled@CXIMPTestMessenger@@QAEXH@Z @ 6 NONAME ; void CXIMPTestMessenger::AssertCloseSessionCalled(int)
+	?AssertCreatePresentityGroupCalled@CXIMPTestMessenger@@QAEXH@Z @ 7 NONAME ; void CXIMPTestMessenger::AssertCreatePresentityGroupCalled(int)
+	?AssertEquality@XIMPTestPresenceDataUtils@@SAXAAVMPresenceInfo@@0@Z @ 8 NONAME ; void XIMPTestPresenceDataUtils::AssertEquality(class MPresenceInfo &, class MPresenceInfo &)
+	?AssertOpenSessionCalled@CXIMPTestMessenger@@QAEXH@Z @ 9 NONAME ; void CXIMPTestMessenger::AssertOpenSessionCalled(int)
+	?AssertPluginDied@CXIMPTestMessenger@@QAEXH@Z @ 10 NONAME ; void CXIMPTestMessenger::AssertPluginDied(int)
+	?AssertRemovePresentityGroupMemberCalled@CXIMPTestMessenger@@QAEXH@Z @ 11 NONAME ; void CXIMPTestMessenger::AssertRemovePresentityGroupMemberCalled(int)
+	?AssertShareSessionCalled@CXIMPTestMessenger@@QAEXH@Z @ 12 NONAME ; void CXIMPTestMessenger::AssertShareSessionCalled(int)
+	?AssertSubscribePresentityGroupContentCalled@CXIMPTestMessenger@@QAEXH@Z @ 13 NONAME ; void CXIMPTestMessenger::AssertSubscribePresentityGroupContentCalled(int)
+	?AssertSubscribePresentityGroupListCalled@CXIMPTestMessenger@@QAEXH@Z @ 14 NONAME ; void CXIMPTestMessenger::AssertSubscribePresentityGroupListCalled(int)
+	?AssertUnshareSessionCalled@CXIMPTestMessenger@@QAEXH@Z @ 15 NONAME ; void CXIMPTestMessenger::AssertUnshareSessionCalled(int)
+	?AssertUnsubscribePresentityGroupContentCalled@CXIMPTestMessenger@@QAEXH@Z @ 16 NONAME ; void CXIMPTestMessenger::AssertUnsubscribePresentityGroupContentCalled(int)
+	?AssertUnsubscribePresentityGroupListCalled@CXIMPTestMessenger@@QAEXH@Z @ 17 NONAME ; void CXIMPTestMessenger::AssertUnsubscribePresentityGroupListCalled(int)
+	?AssertUpdatePresentityGroupDisplayNameCalled@CXIMPTestMessenger@@QAEXH@Z @ 18 NONAME ; void CXIMPTestMessenger::AssertUpdatePresentityGroupDisplayNameCalled(int)
+	?AssertUpdatePresentityGroupMemberDisplayNameCalled@CXIMPTestMessenger@@QAEXH@Z @ 19 NONAME ; void CXIMPTestMessenger::AssertUpdatePresentityGroupMemberDisplayNameCalled(int)
+	?BindL@CXIMPTestContextWrapper@@QAEXH@Z @ 20 NONAME ; void CXIMPTestContextWrapper::BindL(int)
+	?BindL@CXIMPTestContextWrapper@@QAEXVTUid@@ABVTDesC16@@11@Z @ 21 NONAME ; void CXIMPTestContextWrapper::BindL(class TUid, class TDesC16 const &, class TDesC16 const &, class TDesC16 const &)
+	?BindWithSettingsL@CXIMPTestContextWrapper@@QAEXH@Z @ 22 NONAME ; void CXIMPTestContextWrapper::BindWithSettingsL(int)
+	?CleanAllL@CXIMPTestFileTool@@SAXXZ @ 23 NONAME ; void CXIMPTestFileTool::CleanAllL(void)
+	?ClearListener@CXIMPTestContextWrapper@@QAEXXZ @ 24 NONAME ; void CXIMPTestContextWrapper::ClearListener(void)
+	?CommonAssert@CXIMPTestMessenger@@ABEXW4TXIMPTestPropertyKeys@@HABVTDesC8@@1@Z @ 25 NONAME ; void CXIMPTestMessenger::CommonAssert(enum TXIMPTestPropertyKeys, int, class TDesC8 const &, class TDesC8 const &) const
+	?Contains@XIMPTestPresenceDataUtils@@QBEHAAVMPresenceInfo@@0@Z @ 26 NONAME ; int XIMPTestPresenceDataUtils::Contains(class MPresenceInfo &, class MPresenceInfo &) const
+	?CreateGroupContentEventLCX@XIMPTestEventFactory@@SAPAVCPresentityGroupContentEventImp@@ABVTDesC16@@00W4TTestPGLContentArraySpecifier@1@00W4TSubscriptionState@MXIMPDataSubscriptionState@@W4TDataState@6@@Z @ 27 NONAME ; class CPresentityGroupContentEventImp * XIMPTestEventFactory::CreateGroupContentEventLCX(class TDesC16 const &, class TDesC16 const &, class TDesC16 const &, enum XIMPTestEventFactory::TTestPGLContentArraySpecifier, class TDesC16 const &, class TDesC16 const &, enum MXIMPDataSubscriptionState::TSubscriptionState, enum MXIMPDataSubscriptionState::TDataState)
+	?CreateGroupListEventLCX@XIMPTestEventFactory@@SAPAVCPresentityGroupListEventImp@@ABVTDesC16@@0W4TTestPGLArraySpecifier@1@00W4TSubscriptionState@MXIMPDataSubscriptionState@@W4TDataState@6@@Z @ 28 NONAME ; class CPresentityGroupListEventImp * XIMPTestEventFactory::CreateGroupListEventLCX(class TDesC16 const &, class TDesC16 const &, enum XIMPTestEventFactory::TTestPGLArraySpecifier, class TDesC16 const &, class TDesC16 const &, enum MXIMPDataSubscriptionState::TSubscriptionState, enum MXIMPDataSubscriptionState::TDataState)
+	?CreateWrapperL@CXIMPTestContextWrapperMgr@@QAEXH@Z @ 29 NONAME ; void CXIMPTestContextWrapperMgr::CreateWrapperL(int)
+	?DeletePresenceContext@CXIMPTestContextWrapper@@QAEXXZ @ 30 NONAME ; void CXIMPTestContextWrapper::DeletePresenceContext(void)
+	?DeletePubSubKeys@CXIMPTestMessenger@@QAEXXZ @ 31 NONAME ; void CXIMPTestMessenger::DeletePubSubKeys(void)
+	?Equals@TXIMPTestStatusEventSnapshot@@QBEHABV1@@Z @ 32 NONAME ; int TXIMPTestStatusEventSnapshot::Equals(class TXIMPTestStatusEventSnapshot const &) const
+	?Equals@XIMPTestPresenceDataUtils@@QBEHAAVCPresenceInfoImp@@0@Z @ 33 NONAME ; int XIMPTestPresenceDataUtils::Equals(class CPresenceInfoImp &, class CPresenceInfoImp &) const
+	?ExpectL@CXIMPTestListener@@QAEXPAVCXIMPApiObjBase@@@Z @ 34 NONAME ; void CXIMPTestListener::ExpectL(class CXIMPApiObjBase *)
+	?ExternalizeL@CXIMPTestFileSrvMsg@@QBEXAAVRWriteStream@@@Z @ 35 NONAME ; void CXIMPTestFileSrvMsg::ExternalizeL(class RWriteStream &) const
+	?FileTool@CXIMPTestContextWrapper@@QBEAAVCXIMPTestFileTool@@XZ @ 36 NONAME ; class CXIMPTestFileTool & CXIMPTestContextWrapper::FileTool(void) const
+	?GenerateIdentityLC@XIMPTestPresenceDataUtils@@SAPAVCXIMPIdentityImp@@PBVTDesC8@@W4TPresenceDataGroup@1@@Z @ 37 NONAME ; class CXIMPIdentityImp * XIMPTestPresenceDataUtils::GenerateIdentityLC(class TDesC8 const *, enum XIMPTestPresenceDataUtils::TPresenceDataGroup)
+	?GenerateInfoFilterLC@XIMPTestPresenceDataUtils@@SAPAVCPresenceInfoFilterImp@@PBVTDesC8@@W4TPresenceDataGroup@1@@Z @ 38 NONAME ; class CPresenceInfoFilterImp * XIMPTestPresenceDataUtils::GenerateInfoFilterLC(class TDesC8 const *, enum XIMPTestPresenceDataUtils::TPresenceDataGroup)
+	?GenerateInfoLC@XIMPTestPresenceDataUtils@@SAPAVCPresenceInfoImp@@PBVTDesC8@@W4TPresenceDataGroup@1@@Z @ 39 NONAME ; class CPresenceInfoImp * XIMPTestPresenceDataUtils::GenerateInfoLC(class TDesC8 const *, enum XIMPTestPresenceDataUtils::TPresenceDataGroup)
+	?GetBoolean@CXIMPTestMessenger@@QBEHW4TXIMPTestPropertyKeys@@@Z @ 40 NONAME ; int CXIMPTestMessenger::GetBoolean(enum TXIMPTestPropertyKeys) const
+	?GetClient@CXIMPTestContextWrapper@@QAEPAVMXIMPClient@@XZ @ 41 NONAME ; class MXIMPClient * CXIMPTestContextWrapper::GetClient(void)
+	?GetContext@CXIMPTestContextWrapper@@QAEPAVMXIMPContext@@XZ @ 42 NONAME ; class MXIMPContext * CXIMPTestContextWrapper::GetContext(void)
+	?GetError@CXIMPTestMessenger@@QAEHXZ @ 43 NONAME ; int CXIMPTestMessenger::GetError(void)
+	?GetEventListener@CXIMPTestContextWrapper@@QAEPAVCXIMPTestStatusEventListener@@XZ @ 44 NONAME ; class CXIMPTestStatusEventListener * CXIMPTestContextWrapper::GetEventListener(void)
+	?GetEventTemplateL@CXIMPTestStatusEventListener@@QAEXAAV?$RArray@VTXIMPTestStatusEventSnapshot@@@@W4TXIMPTestStatusEventTemplate@@@Z @ 45 NONAME ; void CXIMPTestStatusEventListener::GetEventTemplateL(class RArray<class TXIMPTestStatusEventSnapshot> &, enum TXIMPTestStatusEventTemplate)
+	?GetLeave@CXIMPTestMessenger@@QAEHXZ @ 46 NONAME ; int CXIMPTestMessenger::GetLeave(void)
+	?GetMessenger@CXIMPTestContextWrapper@@QAEPAVCXIMPTestMessenger@@XZ @ 47 NONAME ; class CXIMPTestMessenger * CXIMPTestContextWrapper::GetMessenger(void)
+	?GetPluginIndex@CXIMPTestMessenger@@SAHXZ @ 48 NONAME ; int CXIMPTestMessenger::GetPluginIndex(void)
+	?GetPresenceFeatures@CXIMPTestContextWrapper@@QAEPAVMPresenceFeatures@@XZ @ 49 NONAME ; class MPresenceFeatures * CXIMPTestContextWrapper::GetPresenceFeatures(void)
+	?GetReqCompleteParams@CXIMPTestMessenger@@QAEPAVMXIMPRestrictedObjectCollection@@XZ @ 50 NONAME ; class MXIMPRestrictedObjectCollection * CXIMPTestMessenger::GetReqCompleteParams(void)
+	?GetReqCompletionErrL@CXIMPTestStatusEventListener@@QBEHABVTXIMPRequestId@@@Z @ 51 NONAME ; int CXIMPTestStatusEventListener::GetReqCompletionErrL(class TXIMPRequestId const &) const
+	?GetStatusTraits@CXIMPTestContextWrapper@@QAEPAV?$RArray@VTXIMPTestStatusEventSnapshot@@@@XZ @ 52 NONAME ; class RArray<class TXIMPTestStatusEventSnapshot> * CXIMPTestContextWrapper::GetStatusTraits(void)
+	?GetValueFor@CXIMPTestMessenger@@QBEHW4TXIMPTestPropertyKeys@@@Z @ 53 NONAME ; int CXIMPTestMessenger::GetValueFor(enum TXIMPTestPropertyKeys) const
+	?GetWrapperL@CXIMPTestContextWrapperMgr@@QAEPAVCXIMPTestContextWrapper@@H@Z @ 54 NONAME ; class CXIMPTestContextWrapper * CXIMPTestContextWrapperMgr::GetWrapperL(int)
+	?HandleLeaveL@CXIMPTestMessenger@@QAEXXZ @ 55 NONAME ; void CXIMPTestMessenger::HandleLeaveL(void)
+	?InsertPrefixL@XIMPTestPresenceDataUtils@@SAXPBVTDesC8@@AAVRBuf8@@@Z @ 56 NONAME ; void XIMPTestPresenceDataUtils::InsertPrefixL(class TDesC8 const *, class RBuf8 &)
+	?InstanceId@CXIMPTestContextWrapper@@QBEABVTDesC16@@XZ @ 57 NONAME ; class TDesC16 const & CXIMPTestContextWrapper::InstanceId(void) const
+	?InstanceId@CXIMPTestFileTool@@QBEABVTDesC16@@XZ @ 58 NONAME ; class TDesC16 const & CXIMPTestFileTool::InstanceId(void) const
+	?InternalizeL@CXIMPTestFileSrvMsg@@QAEXAAVRReadStream@@@Z @ 59 NONAME ; void CXIMPTestFileSrvMsg::InternalizeL(class RReadStream &)
+	?NewForAdaptationSideL@CXIMPTestMessenger@@SAPAV1@H@Z @ 60 NONAME ; class CXIMPTestMessenger * CXIMPTestMessenger::NewForAdaptationSideL(int)
+	?NewForClientSideL@CXIMPTestMessenger@@SAPAV1@H@Z @ 61 NONAME ; class CXIMPTestMessenger * CXIMPTestMessenger::NewForClientSideL(int)
+	?NewL@CXIMPTestContextWrapper@@SAPAV1@HPAVMXIMPClient@@@Z @ 62 NONAME ; class CXIMPTestContextWrapper * CXIMPTestContextWrapper::NewL(int, class MXIMPClient *)
+	?NewL@CXIMPTestContextWrapperMgr@@SAPAV1@XZ @ 63 NONAME ; class CXIMPTestContextWrapperMgr * CXIMPTestContextWrapperMgr::NewL(void)
+	?NewL@CXIMPTestFileSrvMsg@@SAPAV1@HABVTDesC8@@@Z @ 64 NONAME ; class CXIMPTestFileSrvMsg * CXIMPTestFileSrvMsg::NewL(int, class TDesC8 const &)
+	?NewL@CXIMPTestFileTool@@SAPAV1@KABVTDesC16@@@Z @ 65 NONAME ; class CXIMPTestFileTool * CXIMPTestFileTool::NewL(unsigned long, class TDesC16 const &)
+	?NewL@CXIMPTestFileTool@@SAPAV1@KH@Z @ 66 NONAME ; class CXIMPTestFileTool * CXIMPTestFileTool::NewL(unsigned long, int)
+	?NewL@CXIMPTestGeneralWaiter@@SAPAV1@PAVT_MWaitObserver@@@Z @ 67 NONAME ; class CXIMPTestGeneralWaiter * CXIMPTestGeneralWaiter::NewL(class T_MWaitObserver *)
+	?NewL@CXIMPTestListener@@SAPAV1@PAVMXIMPContext@@@Z @ 68 NONAME ; class CXIMPTestListener * CXIMPTestListener::NewL(class MXIMPContext *)
+	?NewL@CXIMPTestStatusEventListener@@SAPAV1@HPAVMXIMPContext@@@Z @ 69 NONAME ; class CXIMPTestStatusEventListener * CXIMPTestStatusEventListener::NewL(int, class MXIMPContext *)
+	?NewL@CXIMPTestWaitHelper@@SAPAV1@XZ @ 70 NONAME ; class CXIMPTestWaitHelper * CXIMPTestWaitHelper::NewL(void)
+	?NewLC@CXIMPTestFileSrvMsg@@SAPAV1@XZ @ 71 NONAME ; class CXIMPTestFileSrvMsg * CXIMPTestFileSrvMsg::NewLC(void)
+	?NumObjectsL@CXIMPTestFileTool@@QAEHXZ @ 72 NONAME ; int CXIMPTestFileTool::NumObjectsL(void)
+	?NumSrvMsgL@CXIMPTestFileTool@@QAEHXZ @ 73 NONAME ; int CXIMPTestFileTool::NumSrvMsgL(void)
+	?PayloadL@CXIMPTestFileSrvMsg@@QAEAAVTDesC8@@XZ @ 74 NONAME ; class TDesC8 & CXIMPTestFileSrvMsg::PayloadL(void)
+	?PluginRestoreLC@CXIMPTestFileTool@@QAEPAVCXIMPApiEventBase@@H@Z @ 75 NONAME ; class CXIMPApiEventBase * CXIMPTestFileTool::PluginRestoreLC(int)
+	?PluginStoreL@CXIMPTestFileTool@@QAEXABVTDesC8@@@Z @ 76 NONAME ; void CXIMPTestFileTool::PluginStoreL(class TDesC8 const &)
+	?PrepareL@CXIMPTestFileTool@@QAEXXZ @ 77 NONAME ; void CXIMPTestFileTool::PrepareL(void)
+	?ReRegisterEventFilterL@CXIMPTestStatusEventListener@@QAEXXZ @ 78 NONAME ; void CXIMPTestStatusEventListener::ReRegisterEventFilterL(void)
+	?Reset@CXIMPTestListener@@QAEXXZ @ 79 NONAME ; void CXIMPTestListener::Reset(void)
+	?ResetEventStack@CXIMPTestStatusEventListener@@QAEXXZ @ 80 NONAME ; void CXIMPTestStatusEventListener::ResetEventStack(void)
+	?ResetEventTypeStack@CXIMPTestStatusEventListener@@QAEXXZ @ 81 NONAME ; void CXIMPTestStatusEventListener::ResetEventTypeStack(void)
+	?ResetListener@CXIMPTestContextWrapper@@QAEXXZ @ 82 NONAME ; void CXIMPTestContextWrapper::ResetListener(void)
+	?ResetPubSub@CXIMPTestMessenger@@QAEXXZ @ 83 NONAME ; void CXIMPTestMessenger::ResetPubSub(void)
+	?SetBoolean@CXIMPTestMessenger@@QAEXW4TXIMPTestPropertyKeys@@@Z @ 84 NONAME ; void CXIMPTestMessenger::SetBoolean(enum TXIMPTestPropertyKeys)
+	?SetError@CXIMPTestMessenger@@QAEXH@Z @ 85 NONAME ; void CXIMPTestMessenger::SetError(int)
+	?SetEventObserver@CXIMPTestListener@@QAEXPAVMXIMPContextObserver@@@Z @ 86 NONAME ; void CXIMPTestListener::SetEventObserver(class MXIMPContextObserver *)
+	?SetEventObserver@CXIMPTestStatusEventListener@@QAEXPAVMXIMPContextObserver@@@Z @ 87 NONAME ; void CXIMPTestStatusEventListener::SetEventObserver(class MXIMPContextObserver *)
+	?SetEventSourceL@CXIMPTestListener@@QAEXPAVMXIMPContext@@@Z @ 88 NONAME ; void CXIMPTestListener::SetEventSourceL(class MXIMPContext *)
+	?SetEventSourceL@CXIMPTestStatusEventListener@@QAEXPAVMXIMPContext@@@Z @ 89 NONAME ; void CXIMPTestStatusEventListener::SetEventSourceL(class MXIMPContext *)
+	?SetLeave@CXIMPTestMessenger@@QAEXH@Z @ 90 NONAME ; void CXIMPTestMessenger::SetLeave(int)
+	?SetNoError@CXIMPTestMessenger@@QAEXXZ @ 91 NONAME ; void CXIMPTestMessenger::SetNoError(void)
+	?SetPluginIndex@CXIMPTestMessenger@@QAEXH@Z @ 92 NONAME ; void CXIMPTestMessenger::SetPluginIndex(int)
+	?SetReqCompleteParams@CXIMPTestMessenger@@QAEXPAVMXIMPRestrictedObjectCollection@@@Z @ 93 NONAME ; void CXIMPTestMessenger::SetReqCompleteParams(class MXIMPRestrictedObjectCollection *)
+	?SetValueFor@CXIMPTestMessenger@@QAEXW4TXIMPTestPropertyKeys@@H@Z @ 94 NONAME ; void CXIMPTestMessenger::SetValueFor(enum TXIMPTestPropertyKeys, int)
+	?SetupEmptyListener@CXIMPTestContextWrapper@@QAEXXZ @ 95 NONAME ; void CXIMPTestContextWrapper::SetupEmptyListener(void)
+	?SetupListenerL@CXIMPTestContextWrapper@@QAEXW4TXIMPTestStatusEventTemplate@@@Z @ 96 NONAME ; void CXIMPTestContextWrapper::SetupListenerL(enum TXIMPTestStatusEventTemplate)
+	?SetupListenerReqCompleteL@CXIMPTestContextWrapper@@QAEXW4TXIMPTestStatusEventTemplate@@PAV?$RArray@J@@@Z @ 97 NONAME ; void CXIMPTestContextWrapper::SetupListenerReqCompleteL(enum TXIMPTestStatusEventTemplate, class RArray<long> *)
+	?SrvMsgId@CXIMPTestFileSrvMsg@@QAEHXZ @ 98 NONAME ; int CXIMPTestFileSrvMsg::SrvMsgId(void)
+	?SrvMsgRestoreLC@CXIMPTestFileTool@@QAEPAVCXIMPTestFileSrvMsg@@H@Z @ 99 NONAME ; class CXIMPTestFileSrvMsg * CXIMPTestFileTool::SrvMsgRestoreLC(int)
+	?SrvMsgStoreL@CXIMPTestFileTool@@QAEXPAVCXIMPTestFileSrvMsg@@@Z @ 100 NONAME ; void CXIMPTestFileTool::SrvMsgStoreL(class CXIMPTestFileSrvMsg *)
+	?UnbindL@CXIMPTestContextWrapper@@QAEXXZ @ 101 NONAME ; void CXIMPTestContextWrapper::UnbindL(void)
+	?VerifyEventStackL@CXIMPTestContextWrapper@@QAEXABVTPtrC8@@@Z @ 102 NONAME ; void CXIMPTestContextWrapper::VerifyEventStackL(class TPtrC8 const &)
+	?VerifyEventStackL@CXIMPTestStatusEventListener@@QBEXABV?$TArray@VTXIMPTestStatusEventSnapshot@@@@ABVTDesC8@@@Z @ 103 NONAME ; void CXIMPTestStatusEventListener::VerifyEventStackL(class TArray<class TXIMPTestStatusEventSnapshot> const &, class TDesC8 const &) const
+	?WaitAndAssertL@CXIMPTestListener@@QAEHXZ @ 104 NONAME ; int CXIMPTestListener::WaitAndAssertL(void)
+	?WaitAnyEvent@CXIMPTestContextWrapper@@QAEXXZ @ 105 NONAME ; void CXIMPTestContextWrapper::WaitAnyEvent(void)
+	?WaitAnyEvent@CXIMPTestStatusEventListener@@QAEXXZ @ 106 NONAME ; void CXIMPTestStatusEventListener::WaitAnyEvent(void)
+	?WaitForL@CXIMPTestGeneralWaiter@@QAEXH@Z @ 107 NONAME ; void CXIMPTestGeneralWaiter::WaitForL(int)
+	?WaitForL@CXIMPTestWaitHelper@@QAEXH@Z @ 108 NONAME ; void CXIMPTestWaitHelper::WaitForL(int)
+	?WaitRequestAndStackEvents@CXIMPTestContextWrapper@@QAEXVTXIMPRequestId@@@Z @ 109 NONAME ; void CXIMPTestContextWrapper::WaitRequestAndStackEvents(class TXIMPRequestId)
+	?WaitRequestAndStackEvents@CXIMPTestStatusEventListener@@QAEXABVTXIMPRequestId@@H@Z @ 110 NONAME ; void CXIMPTestStatusEventListener::WaitRequestAndStackEvents(class TXIMPRequestId const &, int)
+	?WrapperCount@CXIMPTestContextWrapperMgr@@QBEHXZ @ 111 NONAME ; int CXIMPTestContextWrapperMgr::WrapperCount(void) const
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/eabi/prfwtestcaseutilsu.def	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,132 @@
+EXPORTS
+	_ZN17CXIMPTestFileTool10NumSrvMsgLEv @ 1 NONAME
+	_ZN17CXIMPTestFileTool11NumObjectsLEv @ 2 NONAME
+	_ZN17CXIMPTestFileTool12PluginStoreLERK6TDesC8 @ 3 NONAME
+	_ZN17CXIMPTestFileTool12SrvMsgStoreLEP19CXIMPTestFileSrvMsg @ 4 NONAME
+	_ZN17CXIMPTestFileTool15PluginRestoreLCEi @ 5 NONAME
+	_ZN17CXIMPTestFileTool15SrvMsgRestoreLCEi @ 6 NONAME
+	_ZN17CXIMPTestFileTool4NewLEmRK7TDesC16 @ 7 NONAME
+	_ZN17CXIMPTestFileTool4NewLEmi @ 8 NONAME
+	_ZN17CXIMPTestFileTool8PrepareLEv @ 9 NONAME
+	_ZN17CXIMPTestFileTool9CleanAllLEv @ 10 NONAME
+	_ZN17CXIMPTestListener14WaitAndAssertLEv @ 11 NONAME
+	_ZN17CXIMPTestListener15SetEventSourceLEP12MXIMPContext @ 12 NONAME
+	_ZN17CXIMPTestListener16SetEventObserverEP20MXIMPContextObserver @ 13 NONAME
+	_ZN17CXIMPTestListener4NewLEP12MXIMPContext @ 14 NONAME
+	_ZN17CXIMPTestListener5ResetEv @ 15 NONAME
+	_ZN17CXIMPTestListener7ExpectLEP15CXIMPApiObjBase @ 16 NONAME
+	_ZN18CXIMPTestMessenger10SetBooleanE21TXIMPTestPropertyKeys @ 17 NONAME
+	_ZN18CXIMPTestMessenger10SetNoErrorEv @ 18 NONAME
+	_ZN18CXIMPTestMessenger11ResetPubSubEv @ 19 NONAME
+	_ZN18CXIMPTestMessenger11SetValueForE21TXIMPTestPropertyKeysi @ 20 NONAME
+	_ZN18CXIMPTestMessenger12HandleLeaveLEv @ 21 NONAME
+	_ZN18CXIMPTestMessenger14GetPluginIndexEv @ 22 NONAME
+	_ZN18CXIMPTestMessenger14SetPluginIndexEi @ 23 NONAME
+	_ZN18CXIMPTestMessenger16AssertPluginDiedEi @ 24 NONAME
+	_ZN18CXIMPTestMessenger16DeletePubSubKeysEv @ 25 NONAME
+	_ZN18CXIMPTestMessenger17NewForClientSideLEi @ 26 NONAME
+	_ZN18CXIMPTestMessenger20GetReqCompleteParamsEv @ 27 NONAME
+	_ZN18CXIMPTestMessenger20SetReqCompleteParamsEP31MXIMPRestrictedObjectCollection @ 28 NONAME
+	_ZN18CXIMPTestMessenger21NewForAdaptationSideLEi @ 29 NONAME
+	_ZN18CXIMPTestMessenger23AssertOpenSessionCalledEi @ 30 NONAME
+	_ZN18CXIMPTestMessenger24AssertCloseSessionCalledEi @ 31 NONAME
+	_ZN18CXIMPTestMessenger24AssertShareSessionCalledEi @ 32 NONAME
+	_ZN18CXIMPTestMessenger26AssertUnshareSessionCalledEi @ 33 NONAME
+	_ZN18CXIMPTestMessenger33AssertCreatePresentityGroupCalledEi @ 34 NONAME
+	_ZN18CXIMPTestMessenger36AssertAddPresentityGroupMemberCalledEi @ 35 NONAME
+	_ZN18CXIMPTestMessenger39AssertRemovePresentityGroupMemberCalledEi @ 36 NONAME
+	_ZN18CXIMPTestMessenger40AssertSubscribePresentityGroupListCalledEi @ 37 NONAME
+	_ZN18CXIMPTestMessenger42AssertUnsubscribePresentityGroupListCalledEi @ 38 NONAME
+	_ZN18CXIMPTestMessenger43AssertSubscribePresentityGroupContentCalledEi @ 39 NONAME
+	_ZN18CXIMPTestMessenger44AssertUpdatePresentityGroupDisplayNameCalledEi @ 40 NONAME
+	_ZN18CXIMPTestMessenger45AssertUnsubscribePresentityGroupContentCalledEi @ 41 NONAME
+	_ZN18CXIMPTestMessenger50AssertUpdatePresentityGroupMemberDisplayNameCalledEi @ 42 NONAME
+	_ZN18CXIMPTestMessenger8GetErrorEv @ 43 NONAME
+	_ZN18CXIMPTestMessenger8GetLeaveEv @ 44 NONAME
+	_ZN18CXIMPTestMessenger8SetErrorEi @ 45 NONAME
+	_ZN18CXIMPTestMessenger8SetLeaveEi @ 46 NONAME
+	_ZN19CXIMPTestFileSrvMsg12InternalizeLER11RReadStream @ 47 NONAME
+	_ZN19CXIMPTestFileSrvMsg4NewLEiRK6TDesC8 @ 48 NONAME
+	_ZN19CXIMPTestFileSrvMsg5NewLCEv @ 49 NONAME
+	_ZN19CXIMPTestFileSrvMsg8PayloadLEv @ 50 NONAME
+	_ZN19CXIMPTestFileSrvMsg8SrvMsgIdEv @ 51 NONAME
+	_ZN19CXIMPTestWaitHelper4NewLEv @ 52 NONAME
+	_ZN19CXIMPTestWaitHelper8WaitForLEi @ 53 NONAME
+	_ZN20XIMPTestEventFactory23CreateGroupListEventLCXERK7TDesC16S2_NS_22TTestPGLArraySpecifierES2_S2_N26MXIMPDataSubscriptionState18TSubscriptionStateENS4_10TDataStateE @ 54 NONAME
+	_ZN20XIMPTestEventFactory26CreateGroupContentEventLCXERK7TDesC16S2_S2_NS_29TTestPGLContentArraySpecifierES2_S2_N26MXIMPDataSubscriptionState18TSubscriptionStateENS4_10TDataStateE @ 55 NONAME
+	_ZN22CXIMPTestGeneralWaiter4NewLEP15T_MWaitObserver @ 56 NONAME
+	_ZN22CXIMPTestGeneralWaiter8WaitForLEi @ 57 NONAME
+	_ZN23CXIMPTestContextWrapper10GetContextEv @ 58 NONAME
+	_ZN23CXIMPTestContextWrapper12GetMessengerEv @ 59 NONAME
+	_ZN23CXIMPTestContextWrapper12WaitAnyEventEv @ 60 NONAME
+	_ZN23CXIMPTestContextWrapper13ClearListenerEv @ 61 NONAME
+	_ZN23CXIMPTestContextWrapper13ResetListenerEv @ 62 NONAME
+	_ZN23CXIMPTestContextWrapper14SetupListenerLE28TXIMPTestStatusEventTemplate @ 63 NONAME
+	_ZN23CXIMPTestContextWrapper15AppendToTraitsLE28TXIMPTestStatusEventTemplate @ 64 NONAME
+	_ZN23CXIMPTestContextWrapper15GetStatusTraitsEv @ 65 NONAME
+	_ZN23CXIMPTestContextWrapper16GetEventListenerEv @ 66 NONAME
+	_ZN23CXIMPTestContextWrapper17BindWithSettingsLEi @ 67 NONAME
+	_ZN23CXIMPTestContextWrapper17VerifyEventStackLERK6TPtrC8 @ 68 NONAME
+	_ZN23CXIMPTestContextWrapper18SetupEmptyListenerEv @ 69 NONAME
+	_ZN23CXIMPTestContextWrapper19GetPresenceFeaturesEv @ 70 NONAME
+	_ZN23CXIMPTestContextWrapper21DeletePresenceContextEv @ 71 NONAME
+	_ZN23CXIMPTestContextWrapper25SetupListenerReqCompleteLE28TXIMPTestStatusEventTemplateP6RArrayIlE @ 72 NONAME
+	_ZN23CXIMPTestContextWrapper25WaitRequestAndStackEventsE14TXIMPRequestId @ 73 NONAME
+	_ZN23CXIMPTestContextWrapper4NewLEiP11MXIMPClient @ 74 NONAME
+	_ZN23CXIMPTestContextWrapper5BindLE4TUidRK7TDesC16S3_S3_ @ 75 NONAME
+	_ZN23CXIMPTestContextWrapper5BindLEi @ 76 NONAME
+	_ZN23CXIMPTestContextWrapper7UnbindLEv @ 77 NONAME
+	_ZN23CXIMPTestContextWrapper9GetClientEv @ 78 NONAME
+	_ZN25XIMPTestPresenceDataUtils13InsertPrefixLEPK6TDesC8R5RBuf8 @ 79 NONAME
+	_ZN25XIMPTestPresenceDataUtils14AssertEqualityER13MPresenceInfoS1_ @ 80 NONAME
+	_ZN25XIMPTestPresenceDataUtils14GenerateInfoLCEPK6TDesC8NS_18TPresenceDataGroupE @ 81 NONAME
+	_ZN25XIMPTestPresenceDataUtils18GenerateIdentityLCEPK6TDesC8NS_18TPresenceDataGroupE @ 82 NONAME
+	_ZN25XIMPTestPresenceDataUtils20GenerateInfoFilterLCEPK6TDesC8NS_18TPresenceDataGroupE @ 83 NONAME
+	_ZN26CXIMPTestContextWrapperMgr11GetWrapperLEi @ 84 NONAME
+	_ZN26CXIMPTestContextWrapperMgr14CreateWrapperLEi @ 85 NONAME
+	_ZN26CXIMPTestContextWrapperMgr4NewLEv @ 86 NONAME
+	_ZN28CXIMPTestStatusEventListener12WaitAnyEventEv @ 87 NONAME
+	_ZN28CXIMPTestStatusEventListener15ResetEventStackEv @ 88 NONAME
+	_ZN28CXIMPTestStatusEventListener15SetEventSourceLEP12MXIMPContext @ 89 NONAME
+	_ZN28CXIMPTestStatusEventListener16SetEventObserverEP20MXIMPContextObserver @ 90 NONAME
+	_ZN28CXIMPTestStatusEventListener17GetEventTemplateLER6RArrayI28TXIMPTestStatusEventSnapshotE28TXIMPTestStatusEventTemplate @ 91 NONAME
+	_ZN28CXIMPTestStatusEventListener18AcceptedEventTypesEv @ 92 NONAME
+	_ZN28CXIMPTestStatusEventListener19ResetEventTypeStackEv @ 93 NONAME
+	_ZN28CXIMPTestStatusEventListener22ReRegisterEventFilterLEv @ 94 NONAME
+	_ZN28CXIMPTestStatusEventListener25WaitRequestAndStackEventsERK14TXIMPRequestIdi @ 95 NONAME
+	_ZN28CXIMPTestStatusEventListener4NewLEiP12MXIMPContext @ 96 NONAME
+	_ZN28TXIMPTestStatusEventSnapshotC1Eiii @ 97 NONAME
+	_ZN28TXIMPTestStatusEventSnapshotC1Ev @ 98 NONAME
+	_ZN28TXIMPTestStatusEventSnapshotC2Eiii @ 99 NONAME
+	_ZN28TXIMPTestStatusEventSnapshotC2Ev @ 100 NONAME
+	_ZNK17CXIMPTestFileTool10InstanceIdEv @ 101 NONAME
+	_ZNK18CXIMPTestMessenger10GetBooleanE21TXIMPTestPropertyKeys @ 102 NONAME
+	_ZNK18CXIMPTestMessenger11GetValueForE21TXIMPTestPropertyKeys @ 103 NONAME
+	_ZNK19CXIMPTestFileSrvMsg12ExternalizeLER12RWriteStream @ 104 NONAME
+	_ZNK23CXIMPTestContextWrapper10InstanceIdEv @ 105 NONAME
+	_ZNK23CXIMPTestContextWrapper8FileToolEv @ 106 NONAME
+	_ZNK25XIMPTestPresenceDataUtils6EqualsER16CPresenceInfoImpS1_ @ 107 NONAME
+	_ZNK25XIMPTestPresenceDataUtils8ContainsER13MPresenceInfoS1_ @ 108 NONAME
+	_ZNK26CXIMPTestContextWrapperMgr12WrapperCountEv @ 109 NONAME
+	_ZNK28CXIMPTestStatusEventListener17VerifyEventStackLERK6TArrayI28TXIMPTestStatusEventSnapshotERK6TDesC8 @ 110 NONAME
+	_ZNK28CXIMPTestStatusEventListener20GetReqCompletionErrLERK14TXIMPRequestId @ 111 NONAME
+	_ZNK28TXIMPTestStatusEventSnapshot6EqualsERKS_ @ 112 NONAME
+	_ZTI17CXIMPTestFileTool @ 113 NONAME ; #<TI>#
+	_ZTI17CXIMPTestListener @ 114 NONAME ; #<TI>#
+	_ZTI18CXIMPTestMessenger @ 115 NONAME ; #<TI>#
+	_ZTI19CXIMPTestFileSrvMsg @ 116 NONAME ; #<TI>#
+	_ZTI19CXIMPTestWaitHelper @ 117 NONAME ; #<TI>#
+	_ZTI22CXIMPTestGeneralWaiter @ 118 NONAME ; #<TI>#
+	_ZTI23CXIMPTestContextWrapper @ 119 NONAME ; #<TI>#
+	_ZTI26CXIMPTestContextWrapperMgr @ 120 NONAME ; #<TI>#
+	_ZTI28CXIMPTestStatusEventListener @ 121 NONAME ; #<TI>#
+	_ZTV17CXIMPTestFileTool @ 122 NONAME ; #<VT>#
+	_ZTV17CXIMPTestListener @ 123 NONAME ; #<VT>#
+	_ZTV18CXIMPTestMessenger @ 124 NONAME ; #<VT>#
+	_ZTV19CXIMPTestFileSrvMsg @ 125 NONAME ; #<VT>#
+	_ZTV19CXIMPTestWaitHelper @ 126 NONAME ; #<VT>#
+	_ZTV22CXIMPTestGeneralWaiter @ 127 NONAME ; #<VT>#
+	_ZTV23CXIMPTestContextWrapper @ 128 NONAME ; #<VT>#
+	_ZTV26CXIMPTestContextWrapperMgr @ 129 NONAME ; #<VT>#
+	_ZTV28CXIMPTestStatusEventListener @ 130 NONAME ; #<VT>#
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/eunitcommon/cglobalwaitingnote.h	Wed Nov 03 09:32:20 2010 +0530
@@ -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:
+*
+*/
+
+#ifndef CGLOBALWAITINGNOTE_H
+#define CGLOBALWAITINGNOTE_H
+
+// INCLUDES
+#include <e32base.h>
+#include <aknglobalprogressdialog.h>
+#include <avkon.rsg>
+
+
+
+/**
+ * Global waiting message for XIMP Framework Eunit tests.
+ */
+class CGlobalWaitingNote : public CActive
+    {
+    public:
+
+        /**
+         * Shows the waiting message with progress bar.
+         *
+         * @param aMessage The message text to show.
+         * @param aTotalShowTime The show time in milliseconds.
+         * @param aProgressSteps How many progress steps the progress bar should have.
+         */
+        inline static void ShowMsgL( const TDesC& aMessage,
+                                     TInt aTotalShowTime,
+                                     TInt aProgressSteps );
+
+
+    private:
+
+        inline CGlobalWaitingNote();
+        inline ~CGlobalWaitingNote();
+        inline void ConstructL();
+
+        inline void DoShowMsgL( const TDesC& aMessage,
+                                TInt aTotalShowTime,
+                                TInt aProgressSteps );
+
+        inline static TInt ProgressTickCb( TAny* aSelf );
+        inline TInt HandleProgressTick();
+
+        inline void RunL();
+        inline TInt RunError( TInt aError );
+        inline void DoCancel();
+
+
+
+    private: //data
+
+        //OWN: Active Scheduler wait
+        CActiveSchedulerWait    iWait;
+
+        //OWN: Progress ticker
+        CPeriodic*  iProgressTicker;
+
+        //OWN: The global note.
+        CAknGlobalProgressDialog*   iGlobalNote;
+
+        //OWN: Total show time
+        TInt iTotalShowTime;
+
+        //OWN: Progress interval
+        TInt iProgressInterval;
+
+        //OWN: Current progress value
+        TInt iCurrentProgress;
+    };
+
+
+
+
+
+// -----------------------------------------------------------------------------
+// CGlobalWaitingNote public functions
+// -----------------------------------------------------------------------------
+//
+void CGlobalWaitingNote::ShowMsgL( const TDesC& aMessage,
+                                   TInt aTotalShowTime,
+                                   TInt aProgressSteps )
+    {
+    CGlobalWaitingNote* self = new (ELeave) CGlobalWaitingNote;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    self->DoShowMsgL( aMessage,
+                      aTotalShowTime,
+                      aProgressSteps );
+
+    CleanupStack::PopAndDestroy();
+    }
+
+
+
+// -----------------------------------------------------------------------------
+// CGlobalWaitingNote private functions
+// -----------------------------------------------------------------------------
+//
+CGlobalWaitingNote::CGlobalWaitingNote()
+    : CActive( CActive::EPriorityStandard )
+    {
+    }
+
+
+CGlobalWaitingNote::~CGlobalWaitingNote()
+    {
+    delete iProgressTicker;
+    delete iGlobalNote;
+    }
+
+
+void CGlobalWaitingNote::ConstructL()
+    {
+    CActiveScheduler::Add( this );
+    iGlobalNote = CAknGlobalProgressDialog::NewL();
+
+    iProgressTicker = CPeriodic::NewL( CActive::EPriorityStandard );
+    }
+
+
+
+void CGlobalWaitingNote::DoShowMsgL( const TDesC& aMessage,
+                                     TInt aTotalShowTime,
+                                     TInt aProgressSteps )
+    {
+    iGlobalNote->ShowProgressDialogL( iStatus,
+                                      aMessage,
+                                      R_AVKON_SOFTKEYS_OK_EMPTY,
+                                      aTotalShowTime );
+    SetActive();
+
+    iProgressInterval =  aTotalShowTime / aProgressSteps;
+    iTotalShowTime = aTotalShowTime;
+    iCurrentProgress = 0;
+
+    TCallBack progressCb( CGlobalWaitingNote::ProgressTickCb, this );
+    iProgressTicker->Start( iProgressInterval, iProgressInterval, progressCb );
+
+    iWait.Start();
+    }
+
+
+TInt CGlobalWaitingNote::ProgressTickCb( TAny* aSelf )
+    {
+    return ( (CGlobalWaitingNote*) aSelf )->HandleProgressTick();
+    }
+
+
+TInt CGlobalWaitingNote::HandleProgressTick()
+    {
+    if( iCurrentProgress < iTotalShowTime )
+        {
+        iCurrentProgress += iProgressInterval;
+        iGlobalNote->UpdateProgressDialog( iCurrentProgress, iTotalShowTime );
+        }
+
+    else
+        {
+        iGlobalNote->ProcessFinished();
+        }
+
+    return KErrNone;
+    }
+
+
+
+void CGlobalWaitingNote::RunL()
+    {
+    iWait.AsyncStop();
+    }
+
+
+TInt CGlobalWaitingNote::RunError( TInt /*aError*/ )
+    {
+    return KErrNone;
+    }
+
+
+void CGlobalWaitingNote::DoCancel()
+    {
+    iGlobalNote->ProcessFinished();
+    }
+
+#endif // CGLOBALWAITINGNOTE_H
+
+// end of file
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/eunitcommon/eunit_test_mover.pl	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,80 @@
+#
+# 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:
+#
+#!perl
+#
+use strict;
+use File::Path;
+
+$|=1; # ensures that any progress information sent to the screen is displayed immediately and not buffered
+
+# When this script is used with build tools, move is done only for WINSCW platform 
+if ( exists($ENV{'PLATFORM'})  && 
+     ($ENV{'PLATFORM'} ne 'WINSCW' ) )
+	{
+	print "\nEUnit Test DLL Mover: nothing to do for platform.\n";
+	exit 0;
+	}
+
+
+# destination folder where EUnit test dlls are placed
+my $destFolder = "\\epoc32\\release\\winscw\\udeb\\z\\sys\\bin";
+
+# ABLD command 
+# If this script is used with build chain, then "TO_BLDINF" env. variable points to the ABLD folder 
+# else use ABLD from current folder
+my $abldCommand = ""; 
+if (exists($ENV{'TO_BLDINF'}))
+	{
+	$abldCommand = $ENV{'TO_BLDINF'} . "\\abld build winscw udeb -what";	
+	}
+else
+	{
+	$abldCommand = "abld build winscw udeb -what";
+	}
+
+# get option
+my $option = $ARGV[0];
+
+# get all the files produced by the ABLD
+my @allProducedFiles = `$abldCommand`;
+
+# we're interested only from dlls
+my @dllList = grep{ $_=~m#^.+\.dll$#i }@allProducedFiles;
+
+print "\n";
+foreach my $dll (@dllList)
+	{
+	chomp($dll);
+
+    # skip those which are not mt_, ut_, t_, dec_
+    my @paths = split(/\\/, $dll);
+    next unless (grep { $paths[-1] =~ m#^$_.+$#i; } (qw(mt_ ut_ t_ dec_)));
+
+	if( $option eq "-wipe" )
+		{
+		my($dllPath, $dllName) = $dll =~ m/(.*\\)(.*)$/;
+		$dll = $destFolder . "\\" . $dllName;
+		print "EUnit Test DLL Mover: CLEANING $dll\n";
+		rmtree $dll;
+		}
+	else
+		{
+		print "EUnit Test DLL Mover: COPYING $dll to $destFolder\n";
+		system "copy $dll ${destFolder}";
+		}
+	}
+	
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/eunitcommon/eunittools.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,169 @@
+/*
+* 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:
+*
+*/
+
+#ifndef EUNITTOOLS_H
+#define EUNITTOOLS_H
+
+#include <e32std.h>
+
+#include <platform/digia/eunit/eunitmacros.h>
+#include <platform/digia/eunit/teunitassertioninfo.h>
+
+
+#include <platform/digia/eunit/ceunittestsuiteclass.h>
+#include <platform/digia/eunit/EUnitDecorators.h>
+
+
+#include "cglobalwaitingnote.h"
+
+
+
+// -----------------------------------------------------------------------------
+// ASSERTION HELPER
+// Leaves if the provided error code is decorator error.
+// -----------------------------------------------------------------------------
+//
+#define LEAVE_IF_DECORATOR_ERROR( aErr ) \
+    { \
+    if( aErr == KErrNoMemory ) \
+        { \
+        User::Leave( KErrNoMemory ); \
+        } \
+    }
+
+
+
+// -----------------------------------------------------------------------------
+// ASSERTION HELPER
+// Returns from current function if the provided error code is decorator error.
+// -----------------------------------------------------------------------------
+//
+#define RETURN_IF_DECORATOR_ERROR( aErr ) \
+    { \
+    if( aErr == KErrNoMemory ) \
+        { \
+        return KErrNoMemory; \
+        } \
+    }
+
+
+
+// -----------------------------------------------------------------------------
+// MEMORY LEAK TRACKING HELPER
+// Performs __UHEAP_MARK and shows visual notify.
+// (Visual notify gives time to reset HookLogger heap checks.)
+// -----------------------------------------------------------------------------
+//
+#define __UHEAP_MARK_WITH_VISUAL_NOTIFY \
+    { \
+    __UHEAP_MARK; \
+    EUnitTools::NotifyFromTestEnterL(); \
+    }
+
+
+// -----------------------------------------------------------------------------
+// MEMORY LEAK TRACKING HELPER
+// Performs __UHEAP_MARKEND with JIT debugger on.
+// -----------------------------------------------------------------------------
+//
+#define __UHEAP_MARKEND_WITH_DEBUGGER \
+    { \
+    TBool __justInTime = User::JustInTime(); \
+    User::SetJustInTime( ETrue ); \
+    __UHEAP_MARKEND; \
+    User::SetJustInTime( __justInTime ); \
+    }
+
+
+
+
+
+// -----------------------------------------------------------------------------
+// TEST CASE DECLARATION
+// Defines not decorated test case.
+// -----------------------------------------------------------------------------
+//
+#define PRFW_NOT_DECORATED_TEST( aDescription, aClass, aMethods, aCategory, aSetupMethod, aTestMethod, aTeardownMethod )\
+EUNIT_NOT_DECORATED_TEST( aDescription, aClass, aMethods, aCategory, aSetupMethod, aTestMethod, aTeardownMethod )
+
+// -----------------------------------------------------------------------------
+// TEST CASE DECLARATION
+// Defines decorated test case.
+// -----------------------------------------------------------------------------
+//
+#define PRFW_DECORATED_TEST( aDescription, aClass, aMethods, aCategory, aSetupMethod, aTestMethod, aTeardownMethod )\
+EUNIT_TEST( aDescription, aClass, aMethods, aCategory, aSetupMethod, aTestMethod, aTeardownMethod )
+
+#define PRFW_ASSERT_DESC( aCondition, aDescription ) \
+    if ( aCondition ) { } else { \
+        TEUnitAssertionInfo __eunit_assert_info = { \
+			__EUNIT_INTERNAL_ASSERT_BASE( aCondition, aDescription ), \
+        	NULL }; \
+        EUnit::AssertionFailedL( __eunit_assert_info ); }
+
+
+/**
+ * Collection of EUnit Tools
+ */
+class EUnitTools
+    {
+    public:
+        static inline void NotifyFromTestEnterL();
+
+    };
+
+
+
+inline void EUnitTools::NotifyFromTestEnterL()
+    {
+    __UHEAP_MARK;
+
+    TInt decoratorfailCount = -1;
+    CEUnitTestCaseDecorator* decorator = CEUnitTestCaseDecorator::ActiveTestCaseDecorator( KNullDesC ); //Any decorator
+    if( decorator )
+        {
+        decorator->GetParameter( _L("ErrorCount"), //Run loop counter value
+                                 decoratorfailCount );
+        }
+
+    if( !decorator ||
+        ( decoratorfailCount == 1 ) )
+        {
+        EUNIT_DISABLE_ANY_DECORATOR;
+
+        TFileName processImage = RProcess().FileName();
+        TBuf<350> msg;
+        msg.Append( _L("Entering to test case. Test process:") );
+        msg.Append( processImage );
+
+        CGlobalWaitingNote::ShowMsgL( msg, 15000000, 15 );  //15 seconds, 1 second steps
+
+        EUNIT_ENABLE_ANY_DECORATOR;
+        }
+    }
+
+
+
+#endif // EUNITTOOLS_H
+
+
+
+//  end of file
+
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/eunitcommon/eunittstdll_armv5u.def	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,3 @@
+EXPORTS
+	_Z16CreateTestSuiteLv @ 1 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/eunitcommon/eunittstdll_winsu.def	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,3 @@
+EXPORTS
+	?CreateTestSuiteL@@YAPAVMEUnitTest@@XZ @ 1 NONAME ; class MEUnitTest * CreateTestSuiteL(void)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/eunitcommon/eunittstdllbase.hrh	Wed Nov 03 09:32:20 2010 +0530
@@ -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:
+*
+*/
+
+// To get the MW_LAYER_SYSTEMINCLUDE-definition
+#include <platform_paths.hrh>
+
+// DEFINES
+#define KEUnitUid3 0x1000af59
+#define KEUnitTestDllUid2 0x1000af5a
+
+
+// COMMON TEST DLL TARGET DEFINITIONS
+#if defined(ARMCC)
+deffile             ./eunittstdll_armv5.def
+#elif defined(MARM)
+deffile             ./eunittstdll_marm.def
+#elif defined(WINS)
+deffile             ./eunittstdll_wins.def
+#endif
+
+UID                 KEUnitTestDllUid2 KEUnitUid3
+TARGETTYPE          dll
+CAPABILITY          ALL -TCB
+VENDORID            VID_DEFAULT
+NOEXPORTLIBRARY
+
+
+// COMMON TEST DLL INCLUDE PATHS
+// Default system include paths for middleware layer modules.
+MW_LAYER_SYSTEMINCLUDE
+SYSTEMINCLUDE       /epoc32/include/digia/eunit
+USERINCLUDE         .
+
+
+// COMMON TEST DLL DEPENDENCIES TO SYSTEM COMPONENTS
+LIBRARY             euser.lib
+LIBRARY             eunit.lib
+LIBRARY             eunitutil.lib
+LIBRARY             aknnotify.lib
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/eunitcommon/move_tests_to_eunit.inf	Wed Nov 03 09:32:20 2010 +0530
@@ -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:
+*
+*/
+////////////////////////////////////////////////////////////
+// bld.inf extension
+// Part of Presence Engine EUnit tests
+
+PRJ_EXPORTS
+eunit_test_mover.pl /epoc32/tools/eunit_test_mover.pl
+
+
+PRJ_TESTMMPFILES
+gnumakefile move_tests_to_eunit.mk
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/eunitcommon/move_tests_to_eunit.mk	Wed Nov 03 09:32:20 2010 +0530
@@ -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:
+#
+
+do_nothing :
+	@rem do_nothing
+
+MAKMAKE : do_nothing
+
+BLD :	do_nothing
+
+CLEAN : 
+	@\epoc32\tools\eunit_test_mover.pl -wipe
+
+LIB : do_nothing
+
+CLEANLIB : do_nothing
+
+RESOURCE : do_nothing
+
+FREEZE : do_nothing
+
+SAVESPACE : do_nothing
+
+RELEASABLES : do_nothing
+
+FINAL : 
+	@\epoc32\tools\eunit_test_mover.pl
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/processmaster/bld.inf	Wed Nov 03 09:32:20 2010 +0530
@@ -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:
+*
+*/
+// Platforms
+PRJ_PLATFORMS
+DEFAULT
+
+// Server components
+PRJ_TESTMMPFILES
+prfwtestprocessmaster.mmp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/processmaster/pm.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,27 @@
+/*
+* 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:
+*
+*/
+
+
+// assume tests in /internal/tsrc/t_blah
+
+USERINCLUDE         ../../tsrcutils/processmaster
+USERINCLUDE         ../../tsrcutils/testcaseutils
+USERINCLUDE         ../../../../../ximpfw/core/srcpscserver
+USERINCLUDE         ../../../../../ximpfw/core/srcrootserver
+
+LIBRARY             efsrv.lib
+LIBRARY             prfwtestcaseutils.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/processmaster/prfwtestprocessmaster.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,99 @@
+/*
+* 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: 
+ *
+*/
+
+#include <e32base.h>
+#include "prfwtestprocessmaster.h"
+
+
+// ==============================================================
+// ============ DoKillProcessL()                    =============
+// ==============================================================
+void DoKillProcessL( const TDesC& aProcessName )
+    {
+    TFullName psName;
+    psName.Append( _L("*") );
+    psName.Append( aProcessName );
+    psName.Append( _L("*") );
+
+    TFindProcess psFinder;
+    psFinder.Find( psName );
+
+    TInt killCount( 0 );
+    while( psFinder.Next( psName ) != KErrNotFound )
+        {
+        RProcess ps;
+        User::LeaveIfError( ps.Open( psFinder ) );
+        ps.Kill( -666 );
+        ps.Close();
+        killCount++;
+        }
+
+    User::Leave( killCount );
+    }
+
+
+// ==============================================================
+// ============ E32MainL()                          =============
+// ==============================================================
+void E32MainL()
+    {
+    TInt theCommand;
+    User::LeaveIfError( User::GetTIntParameter( PrfwTestProcessMaster::EMsgSlot_Command, theCommand ) );
+
+    TBuf< PrfwTestProcessMaster::EMaxMsgDataLength > theDesC16;
+    User::LeaveIfError( User::GetDesParameter( PrfwTestProcessMaster::EMsgSlot_Desc16Data, theDesC16 ) );
+
+    switch( theCommand )
+        {
+        case PrfwTestProcessMaster::EKillProcess:
+            {
+            DoKillProcessL( theDesC16 );
+            break;
+            }
+
+        default:
+            {
+            User::Leave( KErrNotSupported );
+            break;
+            }
+        }
+    }
+
+
+// ==============================================================
+// ============ E32Main()                           =============
+// ==============================================================
+GLDEF_C TInt E32Main()
+    {
+    CTrapCleanup* tc = CTrapCleanup::New();
+    if( !tc )
+        {
+        return KErrNoMemory;
+        }
+
+    __UHEAP_MARK;
+    TRAPD( err, E32MainL() );
+    __UHEAP_MARKEND;
+
+    delete tc;
+
+    RProcess::Rendezvous( err );
+    return err;
+    }
+
+
+//End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/processmaster/prfwtestprocessmaster.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,148 @@
+/*
+* 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: 
+ *
+*/
+
+#ifndef PRFWTESTPROCESSMASTER_H__
+#define PRFWTESTPROCESSMASTER_H__
+
+
+// INCLUDES
+#include <e32std.h>
+#include <data_caging_path_literals.hrh>
+#include <f32file.h>
+#include <e32base.h>
+
+#include "ximpserverdefs.h"
+#include "ximprootserverdefs.h"
+
+// CLASS DESCRIPTION
+
+/**
+ * Test utility for managing Presence Engine processies
+ */
+class PrfwTestProcessMaster
+    {
+    public: //enumerations
+        enum TPEngProcessMasterEnums
+            {
+            EMsgSlot_Command = 1,
+            EMsgSlot_Desc16Data = 2,
+
+            EKillProcess = 100,
+            EMaxMsgDataLength = 256
+            };
+
+    public: //Public functions
+
+        /**
+         *
+         *
+         *
+         *
+         *
+         */
+        static inline TInt KillPscServers();
+        static inline TInt KillRootServer();
+
+    private: //Helper functions
+        static inline TInt DoKillServer( const TDesC& aServer );
+
+    };
+
+
+
+
+// -----------------------------------------------------------------------------
+// PrfwTestProcessMaster public functions
+// -----------------------------------------------------------------------------
+//
+inline TInt PrfwTestProcessMaster::KillPscServers()
+    {
+    return PrfwTestProcessMaster::DoKillServer( NXIMPSrv::NName::KServerPattern );
+    }
+
+inline TInt PrfwTestProcessMaster::KillRootServer()
+    {
+    return PrfwTestProcessMaster::DoKillServer( NRootSrv::NName::KServerPattern );
+    }
+
+// -----------------------------------------------------------------------------
+// PrfwTestProcessMaster private functions
+// -----------------------------------------------------------------------------
+//
+inline TInt PrfwTestProcessMaster::DoKillServer( const TDesC& aServer )
+    {
+    //Compose full executable name
+    TFileName processMasterExe;
+
+    // TODO this code shouldn't leave? does it? it was TRAP+L elsewhere.
+    TFileName dllPath;
+    Dll::FileName( dllPath );
+    TParsePtrC dllPathParser( dllPath );
+    processMasterExe.Insert( 0, dllPathParser.Drive() );
+
+    processMasterExe.Append( KDC_PROGRAMS_DIR );
+    processMasterExe.Append( _L("prfwtestprocessmaster.exe") );
+
+    //Initialize ProcessMaster process
+    RProcess processMaster;
+    TInt err = processMaster.Create( processMasterExe, KNullDesC );
+    if( err != KErrNone )
+        {
+        processMaster.Close();
+        return err;
+        }
+
+    err = processMaster.SetParameter( PrfwTestProcessMaster::EMsgSlot_Command,
+            PrfwTestProcessMaster::EKillProcess );
+    if( err != KErrNone )
+        {
+        processMaster.Close();
+        return err;
+        }
+
+
+    err = processMaster.SetParameter( PrfwTestProcessMaster::EMsgSlot_Desc16Data,
+            aServer );
+    if( err != KErrNone )
+        {
+        processMaster.Close();
+        return err;
+        }
+
+    //Execute ProcessMaster
+    TRequestStatus rendezvousStatus;
+    processMaster.Rendezvous( rendezvousStatus );
+    processMaster.Resume();
+    User::WaitForRequest( rendezvousStatus );
+    err = rendezvousStatus.Int();
+
+
+    //Get exit statuses for debuging purposes
+    TExitType exitType = processMaster.ExitType();
+    TExitCategoryName exitCategory = processMaster.ExitCategory();
+    TInt exitReason = processMaster.ExitReason();
+
+    processMaster.Close();
+
+    return err;
+    }
+
+
+#endif // PRFWTESTPROCESSMASTER_H__
+
+//  End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/processmaster/prfwtestprocessmaster.mmp	Wed Nov 03 09:32:20 2010 +0530
@@ -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: 
+*
+*/
+
+// To get the MW_LAYER_SYSTEMINCLUDE-definition
+#include <platform_paths.hrh>
+#include<eunitcaps.h>
+TARGET          prfwtestprocessmaster.exe
+TARGETTYPE      exe
+UID             0x0     0x10282DDE
+VENDORID        VID_DEFAULT
+CAPABILITY      CAP_SERVER ProtServ PowerMgmt AllFiles ReadDeviceData  EUNIT_CAPS
+
+TARGETPATH      /system/libs
+SOURCEPATH      .
+SOURCE          prfwtestprocessmaster.cpp
+
+#if defined ( OS_LAYER_SYSTEMINCLUDE )
+OS_LAYER_SYSTEMINCLUDE
+#else
+SYSTEMINCLUDE     /epoc32/include
+#endif
+
+ #if defined ( APP_LAYER_SYSTEMINCLUDE )
+ APP_LAYER_SYSTEMINCLUDE
+ #else
+ SYSTEMINCLUDE     \epoc32\include
+ #endif
+
+MW_LAYER_SYSTEMINCLUDE
+USERINCLUDE     ../testcaseutils
+USERINCLUDE     ../../../../../ximpfw/core/srcrootserver
+USERINCLUDE     ../../../../../ximpfw/core/srcpscserver
+
+
+LIBRARY         euser.lib
+
+//  End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/testcaseutils/bld.inf	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,23 @@
+/*
+* 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 prfwtestcaseutils.dll
+*
+*/
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_TESTMMPFILES
+prfwtestcaseutils.mmp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/testcaseutils/prfwgeneralwaiter.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,110 @@
+/*
+* 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:  ?Description
+*
+*/
+
+
+
+#include <e32std.h>
+
+#include "prfwgeneralwaiter.h"
+#include "prfwwaitobserver.h"
+
+
+
+// ======== LOCAL FUNCTIONS ========
+
+
+// ======== MEMBER FUNCTIONS ========
+
+
+// ---------------------------------------------------------------------------
+// ?description_if_needed
+// ---------------------------------------------------------------------------
+//
+CXIMPTestGeneralWaiter::CXIMPTestGeneralWaiter( T_MWaitObserver* aObserver ) :
+    CActive( EPriorityNormal ),
+    iObserver( aObserver )
+    {
+    CActiveScheduler::Add( this );
+    }
+
+
+// ---------------------------------------------------------------------------
+// ?description_if_needed
+// ---------------------------------------------------------------------------
+//
+void CXIMPTestGeneralWaiter::ConstructL()
+    {
+    iTimer.CreateLocal();
+    }
+
+
+// ---------------------------------------------------------------------------
+// ?description_if_needed
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CXIMPTestGeneralWaiter* CXIMPTestGeneralWaiter::NewL( T_MWaitObserver* aObserver )
+    {
+    CXIMPTestGeneralWaiter* self = new( ELeave ) CXIMPTestGeneralWaiter( aObserver );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+
+// ---------------------------------------------------------------------------
+// ?description_if_needed
+// ---------------------------------------------------------------------------
+//
+CXIMPTestGeneralWaiter::~CXIMPTestGeneralWaiter()
+    {
+    iTimer.Close();
+    }
+
+
+// ---------------------------------------------------------------------------
+// ?implementation_description
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CXIMPTestGeneralWaiter::WaitForL( TInt aSeconds )
+    {
+    TTimeIntervalMicroSeconds32 timeToWait( aSeconds * 1000000 );
+    iTimer.After( iStatus, timeToWait );
+    SetActive();
+    }
+
+
+void CXIMPTestGeneralWaiter::RunL()
+    {
+    iObserver->WaitCompleted( KErrNone );
+    }
+
+
+void CXIMPTestGeneralWaiter::DoCancel()
+    {
+    
+    }
+
+
+TInt CXIMPTestGeneralWaiter::RunErrorL( TInt /* aError */ )
+    {
+    iObserver->WaitCompleted( KErrGeneral );
+    return 0;
+    }
+
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/testcaseutils/prfwgeneralwaiter.h	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  ?Description
+*
+*/
+
+
+
+#ifndef CPRFWTESTGENERALWAITER_H
+#define CPRFWTESTGENERALWAITER_H 
+
+
+#include <e32base.h>
+
+
+class T_MWaitObserver;
+
+
+/**
+ * ?one_line_short_description
+ *
+ * ?more_complete_description
+ *
+ * @lib ?library
+ * @since S60 v4.0
+ */
+class CXIMPTestGeneralWaiter : public CActive
+    {
+public:
+
+    IMPORT_C static CXIMPTestGeneralWaiter* NewL( T_MWaitObserver* aObserver );
+
+
+    virtual ~CXIMPTestGeneralWaiter();
+
+
+private:
+
+    CXIMPTestGeneralWaiter( T_MWaitObserver* aObserver );
+    void ConstructL();
+
+
+public:
+
+    /**
+     * ?description
+     *
+     * @since S60 ?S60_version
+     * @param ?arg1 ?description
+     * @param ?arg2 ?description
+     * @return ?description
+     */
+    IMPORT_C void WaitForL( TInt aSeconds );
+
+
+private:
+
+    void RunL();
+
+
+    void DoCancel();
+
+
+    TInt RunErrorL( TInt aError );
+
+
+private: // data
+
+
+    T_MWaitObserver* iObserver;
+
+    RTimer iTimer;
+
+    };
+
+#endif // CPRFWTESTGENERALWAITER_H 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/testcaseutils/prfwsrvtestclient.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,184 @@
+/*
+* 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:  XIMP Framework server test client implementation
+*
+*/
+
+
+//  INCLUDE FILES
+#include "ximpbase.h"
+#include "ximpsrvtestclient.h"
+#include "ximpprocessstarter.h"
+#include "ximprootserverdefs.h"
+#include "ximpserverdefs.h"
+#include "prfwtestserverdefs.h"
+
+#include <e32base.h>
+#include <s32mem.h>
+
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// RXIMPSrvRootClient::RXIMPSrvRootClient()
+// ---------------------------------------------------------------------------
+//
+RXIMPSrvTestClient::RXIMPSrvTestClient()
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// RXIMPSrvRootClient::Connect()
+// ---------------------------------------------------------------------------
+//
+TInt RXIMPSrvTestClient::Connect()
+    {
+    TFileName fullExePath;
+    XIMPProcessStarter::FullExePathForClienLocation( NRootSrv::NName::KExecutable,
+                                                     fullExePath );
+
+    TInt ret = XIMPProcessStarter::ConnectToServer( fullExePath,
+                                            KNullDesC,
+                                            NULL,
+                                            *this,
+                                            NRootSrv::NName::KSymbianServer,
+                                            TVersion( NRootSrv::NVersion::KMajor,
+                                                      NRootSrv::NVersion::KMinor,
+                                                      NRootSrv::NVersion::KBuild ),
+                                                      NRootSrv::NRequest::KMsgSlotCount );
+
+    if ( ret == KErrNone )
+        {
+        TIpcArgs msgArgs;
+        ret = SendReceive( NTestSrv::NRequest::EInstantiateTestSession, msgArgs );
+        }
+
+    return ret;
+    }
+
+// ---------------------------------------------------------------------------
+// RXIMPSrvContextClient::Connect()
+// ---------------------------------------------------------------------------
+//
+void RXIMPSrvTestClient::ConnectL( TUid aProtocolImpUid )
+    {
+    // create the server name: "!XIMPCtxSrv9bde667a" 
+    HBufC* serverName = HBufC::NewLC( NXIMPSrv::NName::KSymbianServer().Length() + 
+                                      NXIMPSrv::NStartupParam::KProtocolUidMaxLen + 
+                                      1 );
+
+    serverName->Des().Copy( NXIMPSrv::NName::KSymbianServer );
+    serverName->Des().AppendNumFixedWidth( aProtocolImpUid.iUid, 
+                                           EHex, 
+                                           NXIMPSrv::NStartupParam::KProtocolUidMaxLen );
+
+    // Pass the UID to server side.
+    // For security reasons it was not allowed to pass the complete 
+    // server name descriptor but just the UID part
+    RArray< TXIMPProcessStartupParam > params;
+    CleanupClosePushL( params );
+
+    TXIMPProcessStartupParam paramUid;
+    paramUid.Set( NXIMPSrv::NStartupParam::KProtocolUidIndex, 
+                  aProtocolImpUid.iUid );
+
+    User::LeaveIfError( params.Append( paramUid ) );
+    TArray< TXIMPProcessStartupParam > array = params.Array();
+
+
+    //Get path to correct exe to launch
+    TFileName fullExePath;
+    XIMPProcessStarter::FullExePathForClienLocation( NXIMPSrv::NName::KExecutable,
+                                                     fullExePath );
+
+    //Create a connection
+    TInt ret = XIMPProcessStarter::ConnectToServer( fullExePath,
+                                                    KNullDesC,
+                                                    &array,
+                                                    *this,
+                                                    *serverName,
+                                                    TVersion( NXIMPSrv::NVersion::KMajor,
+                                                              NXIMPSrv::NVersion::KMinor,
+                                                              NXIMPSrv::NVersion::KBuild ),
+                                                    NXIMPSrv::NRequest::KMsgSlotCount );
+    User::LeaveIfError( ret );
+    CleanupStack::PopAndDestroy( 2, serverName ); // params, serverName
+
+    //Mutate the server side session to correct type
+    ret = SendReceive( NTestSrv::NRequest::EInstantiateTestSession );
+    User::LeaveIfError( ret );
+    }
+
+// ---------------------------------------------------------------------------
+// RXIMPSrvRootClient::Close()
+// ---------------------------------------------------------------------------
+//
+void RXIMPSrvTestClient::Close()
+    {
+    RSessionBase::Close();
+    }
+
+
+// ---------------------------------------------------------------------------
+// RXIMPSrvTestClient::SetAllocFailureL()
+// ---------------------------------------------------------------------------
+//
+void RXIMPSrvTestClient::SetAllocFailure( TInt aRate )
+    {
+    TPckgBuf< TInt > rateBuf( aRate );
+    TIpcArgs msgArgs;
+    msgArgs.Set( 0, &rateBuf );
+    
+    SendReceive( NTestSrv::NRequest::ESetAllocFail, msgArgs );
+    }
+    
+// ---------------------------------------------------------------------------
+// RXIMPSrvRootClient::GetLastError()
+// ---------------------------------------------------------------------------
+//
+NTestSrv::SErrorData RXIMPSrvTestClient::FetchErrorData()
+    {
+    NTestSrv::SErrorData errorData;
+    TPckgBuf< NTestSrv::SErrorData > errorBuf( errorData );
+    TIpcArgs msgArgs;
+    msgArgs.Set( 0, &errorBuf );
+    TInt retVal = SendReceive( NTestSrv::NRequest::EPrepareErrorData, msgArgs );
+    __ASSERT_ALWAYS( retVal >= 0, User::Panic( _L( "SendReceive failed" ), retVal ) );
+    errorData = errorBuf();
+    return errorData;
+//    return GetData( NTestSrv::NRequest::EPrepareErrorData );
+    }    
+
+// ---------------------------------------------------------------------------
+// RXIMPSrvRootClient::GetDataL()
+// ---------------------------------------------------------------------------
+//
+NTestSrv::SErrorData RXIMPSrvTestClient::GetData( TInt aMsg )
+    {
+/*    TInt bufSize = SendReceive( aMsg );
+    __ASSERT_ALWAYS( bufSize == NTestSrv::KErrorDataSize, User::Panic( _L( "Wrong bufsize" ), KErrArgument ) );
+
+    NTestSrv::SErrorData errorData;
+    TPckgBuf< NTestSrv::SErrorData > errorBuf( errorData );
+    TIpcArgs msgArgs;
+    msgArgs.Set( 0, &errorBuf );
+    __ASSERT_ALWAYS( SendReceive( NTestSrv::NRequest::EFetchData, msgArgs ) >= 0, 
+                    User::Panic( _L( "SendReceive failed" ) ) );
+    return errorData;*/
+    }
+
+
+// End of file
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/testcaseutils/prfwsrvtestclient.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,72 @@
+/*
+* 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:  XIMP Framework server test session.
+*
+*/
+
+#ifndef PRFWSRVTESTCLIENT_H__
+#define PRFWSRVTESTCLIENT_H__
+
+#include <ximpbase.h>
+#include <e32std.h>
+#include "prfwtestserverdefs.h"
+
+
+/**
+ * XIMP Framework server test session.
+ *
+ * @lib ximpsrvclient.dll
+ * @since S60 v3.2
+ */
+class RXIMPSrvTestClient : public RSessionBase
+    {
+public:
+
+    /**
+     * Default constructor.
+     */
+    RXIMPSrvTestClient();
+
+    /**
+     * Session connection method.
+     *
+     * @return Error code from creating server connection.
+     */
+    TInt Connect();
+    void ConnectL( TUid aProtocolImpUid );
+
+    /**
+     * Closes server connection.
+     */
+    void Close();
+    
+    /**
+     * Set alloc failure
+     */
+    void SetAllocFailure( TInt aRate );
+    NTestSrv::SErrorData RXIMPSrvTestClient::FetchErrorData();
+
+private:
+
+    /**
+     * Helper to get data from server side.
+     * @return Externalized object to be passed onward
+     */
+    NTestSrv::SErrorData GetData( TInt aMsg );
+    };
+
+
+#endif      //  PRFWSRVTESTCLIENT_H__
+
+// END OF FILE
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/testcaseutils/prfwtestcaseutils.mmp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,109 @@
+/*
+* 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:
+*
+*/
+
+#include<platform_paths.hrh>
+#include<eunitcaps.h>
+
+#include "prfwtestdlluids.hrh"
+
+TARGET                  prfwtestcaseutils.dll
+TARGETTYPE              dll
+UID                     PRFWTEST_DLL_UID_STATIC_INTERFACE PRFWTEST_DLL_UID_COMMON
+
+//CAPABILITY              ALL -TCB -DRM 
+CAPABILITY 			     EUNIT_CAPS
+
+VENDORID                VID_DEFAULT
+
+
+SOURCEPATH              .
+SOURCE                  prfwteststatuseventlistener.cpp
+SOURCE                  prfwtestmessenger.cpp
+SOURCE                  prfwtestfilesrvmsg.cpp
+SOURCE                  prfwtestfiletool.cpp
+SOURCE                  prfwtestcontextwrapper.cpp
+SOURCE                  prfwtestcontextwrappermgr.cpp
+SOURCE                  prfwgeneralwaiter.cpp
+SOURCE                  prfwtestpresencedatautils.cpp
+SOURCE                  prfwtestlistener.cpp
+SOURCE                  prfwtestwaithelper.cpp
+SOURCE                  prfwtesteventfactory.cpp
+
+USERINCLUDE             ../../../../../ximpfw/core/srcdatamodel
+USERINCLUDE             ../../../../../ximpfw/presence/srcpresencedatamodel
+USERINCLUDE             ../../../../../ximpfw/presence/srcpresencedatamodel/presentitygroups
+USERINCLUDE             ../../../../../ximpfw/presence/srcpresencedatamodel/presencewatching
+USERINCLUDE             ../../../../../ximpfw/presence/srcpresencedatamodel/presenceauthorization
+USERINCLUDE             ../../../../../ximpfw/presence/srcpresencedatamodel/presencepublishing
+USERINCLUDE             ../../../../../ximpfw/presence/srcpresencedatamodel/presenceinfo
+USERINCLUDE             ../../../../../ximpfw/core/srcutils
+
+
+USERINCLUDE             ../../../../../ximpfw/core/srcclient
+USERINCLUDE             ../../../../../ximpfw/core/srcpscserver
+USERINCLUDE             ../../../../../ximpfw/core/srcrootserver
+
+USERINCLUDE             .
+USERINCLUDE             ../../tsrcutils/eunitcommon
+USERINCLUDE             ../../tsrcutils/processmaster
+USERINCLUDE             ../../tsrcprotocols
+
+
+// TODO remove unnecessary
+#if defined ( OS_LAYER_SYSTEMINCLUDE )
+OS_LAYER_SYSTEMINCLUDE
+#else
+SYSTEMINCLUDE     /epoc32/include
+#endif
+
+ #if defined ( APP_LAYER_SYSTEMINCLUDE )
+ APP_LAYER_SYSTEMINCLUDE
+ #else
+ SYSTEMINCLUDE     \epoc32\include
+ #endif
+SYSTEMINCLUDE           ../../../../../ximpfw/inc/core/base
+SYSTEMINCLUDE           ../../../../../ximpfw/inc/core/datamodel
+SYSTEMINCLUDE           ../../../../../ximpfw/inc/core/protocolplugin
+SYSTEMINCLUDE           ../../../../../ximpfw/inc/core/protocolpluginhost
+SYSTEMINCLUDE           ../../../../../ximpfw/inc/presence/presencedatamodel
+SYSTEMINCLUDE           ../../../../../ximpfw/inc/presence/presencemanagement
+SYSTEMINCLUDE           ../../../../../ximpfw/inc/presence/presenceprotocolplugin
+SYSTEMINCLUDE           ../../../../../ximpfw/inc/presence/presenceprotocolpluginhost
+
+SYSTEMINCLUDE           /epoc32/include/platform/digia/eunit
+MW_LAYER_SYSTEMINCLUDE
+
+
+LIBRARY                 ecom.lib
+LIBRARY                 bafl.lib
+LIBRARY                 euser.lib
+LIBRARY                 estor.lib
+LIBRARY                 efsrv.lib
+LIBRARY                 eunit.lib
+LIBRARY                 eunitutil.lib
+LIBRARY                 ximpsrvclient.lib
+LIBRARY                 ximpdatamodel.lib
+LIBRARY             presencedatamodel.lib
+LIBRARY                 ximputils.lib
+LIBRARY 								aknnotify.lib 
+LIBRARY									eiksrv.lib 
+
+EXPORTUNFROZEN
+
+// end of file
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/testcaseutils/prfwtestcaseutilspanics.h	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  XIMP Framework panic defines.
+ *
+*/
+
+#ifndef PRFWTESTCASEUTILSPANICS_H
+#define PRFWTESTCASEUTILSPANICS_H
+
+#include <e32std.h>
+
+/**
+ * Panic category and reason codes for XIMP Framework
+ * test case utils failures.
+ */
+namespace NXIMPTestCaseUtilsPanic
+    {
+    _LIT( KCategory, "XIMPTestUtils" );
+
+    enum TReason
+        {
+        EStatusEventListenerBadMaxCount,
+        EStatusEventListenerAlreadyWaiting,
+        EStatusEventListenerUnknownEventTemplate,
+        EAddSnapshotOverflow,
+        ESnapshotIndexOutOfBounds,
+        EReceivingEventFromWrongContext,
+        EReceivedNotAcceptedEventType,
+        EUnsupportedEventTypeInVerification
+        };
+
+
+    inline void Panic( NXIMPTestCaseUtilsPanic::TReason aReason )
+        {
+        User::Panic( KCategory, aReason );
+
+        }
+    }
+
+
+#endif  //PRFWTESTCASEUTILSPANICS_H
+
+
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/testcaseutils/prfwtestcontextwrapper.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,453 @@
+/*
+* 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:  Testing context wrapper
+ *
+*/
+
+
+
+#include <e32std.h>
+
+#include <eunitmacros.h>
+
+#include "prfwtestcontextwrapper.h"
+#include <ximpclient.h>
+#include <ximpcontext.h>
+#include <ximpcontextstateevent.h>
+#include <ximprequestcompleteevent.h>
+#include <ximpstatus.h>
+#include <presencefeatures.h>
+
+
+#include "prfwteststatuseventlistener.h"
+#include "prfwtestmessenger.h"
+#include "prfwtestmessaging.h"
+#include "prfwtestfiletool.h"
+#include "prfwtestprotocols.h"
+
+_LIT( KInstanceAsNumber, "%d" );
+// ======== LOCAL FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// Length of number in characters (e.g. 501 --> 3)
+// ---------------------------------------------------------------------------
+//
+TInt NumLenInChars( TInt aNum )
+    {
+    TInt len = 0;
+    TInt tmp = aNum;
+    do
+        {
+        tmp /= 10;  // number is base-10
+        len++;
+        }
+    while ( tmp > 0 );
+    return len;
+    }
+
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// Instance id
+// ---------------------------------------------------------------------------
+//
+EXPORT_C const TDesC16& CXIMPTestContextWrapper::InstanceId() const
+    {
+    return *iInstance;
+    }
+
+
+// ---------------------------------------------------------------------------
+// ?description_if_needed
+// ---------------------------------------------------------------------------
+//
+CXIMPTestContextWrapper::CXIMPTestContextWrapper( TInt aIndex,
+        MXIMPClient* aClient ) :
+    iIndex( aIndex ),
+    iClient( aClient )
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// ?description_if_needed
+// ---------------------------------------------------------------------------
+//
+void CXIMPTestContextWrapper::ConstructL()
+    {
+    iContext = iClient->NewPresenceContextLC();
+    CleanupStack::Pop(); // iContext
+    iListener = CXIMPTestStatusEventListener::NewL( 20, iContext );
+    iMessenger = CXIMPTestMessenger::NewForClientSideL( iIndex );
+    iPresFeatures = MPresenceFeatures::NewL(iContext); 
+    TInt instanceLength = NumLenInChars( iIndex );
+    iInstance = HBufC::NewL( instanceLength );
+    iInstance->Des().AppendFormat( KInstanceAsNumber, iIndex );
+    }
+
+// ---------------------------------------------------------------------------
+// ?description_if_needed
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CXIMPTestContextWrapper* CXIMPTestContextWrapper::NewL(
+        TInt aIndex, MXIMPClient* aClient )
+    {
+    CXIMPTestContextWrapper* self = new( ELeave ) CXIMPTestContextWrapper( aIndex, aClient );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// ?description_if_needed
+// ---------------------------------------------------------------------------
+//
+CXIMPTestContextWrapper::~CXIMPTestContextWrapper()
+    {
+    iStatusEventTraits.Close();
+
+    delete iMessenger;
+    delete iListener;
+    delete iContext;
+    delete iFileTool;
+    delete iInstance;
+    delete iPresFeatures;
+    }
+
+// ---------------------------------------------------------------------------
+// ?description_if_needed
+// ---------------------------------------------------------------------------
+//
+EXPORT_C MXIMPContext* CXIMPTestContextWrapper::GetContext()
+    {
+    return iContext;
+    }
+
+// ---------------------------------------------------------------------------
+// ?description_if_needed
+// ---------------------------------------------------------------------------
+//
+EXPORT_C MPresenceFeatures* CXIMPTestContextWrapper::GetPresenceFeatures()
+    {
+    return iPresFeatures;
+    }
+// ---------------------------------------------------------------------------
+// ?description_if_needed
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CXIMPTestStatusEventListener* CXIMPTestContextWrapper::GetEventListener()
+    {
+    return iListener;
+    }
+
+// ---------------------------------------------------------------------------
+// ?description_if_needed
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CXIMPTestMessenger* CXIMPTestContextWrapper::GetMessenger()
+    {
+    return iMessenger;
+    }
+
+// ---------------------------------------------------------------------------
+// ?description_if_needed
+// ---------------------------------------------------------------------------
+//
+EXPORT_C MXIMPClient* CXIMPTestContextWrapper::GetClient()
+    {
+    return iClient;
+    }
+
+// ---------------------------------------------------------------------------
+// ?description_if_needed
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CXIMPTestContextWrapper::DeletePresenceContext()
+    {
+    // used to test abrupt handle closings
+    iListener->SetEventSourceL( NULL );
+    delete iContext;
+    iContext = NULL;
+    }
+
+// ---------------------------------------------------------------------------
+// ?description_if_needed
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CXIMPTestContextWrapper::SetupEmptyListener()
+    {
+    iListener->ResetEventStack();
+    iStatusEventTraits.Reset();
+    }
+
+// ---------------------------------------------------------------------------
+// ?description_if_needed
+// ---------------------------------------------------------------------------
+//
+EXPORT_C RArray<TXIMPTestStatusEventSnapshot>* CXIMPTestContextWrapper::GetStatusTraits()
+    {
+    return &iStatusEventTraits;
+    }
+
+// ---------------------------------------------------------------------------
+// ?description_if_needed
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CXIMPTestContextWrapper::SetupListenerL( TXIMPTestStatusEventTemplate aEventType )
+    {
+    ResetListener();
+    iListener->GetEventTemplateL( iStatusEventTraits, aEventType );
+    iMessenger->SetPluginIndex( iIndex );
+    }
+
+// ---------------------------------------------------------------------------
+// ?description_if_needed
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CXIMPTestContextWrapper::AppendToTraitsL( TXIMPTestStatusEventTemplate aEventType )
+    {
+    iListener->GetEventTemplateL( iStatusEventTraits, aEventType );
+    }
+
+// ---------------------------------------------------------------------------
+// ?description_if_needed
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CXIMPTestContextWrapper::SetupListenerReqCompleteL(
+        TXIMPTestStatusEventTemplate aEventType,
+        RArray< TInt32 >* aAdditionalEvents )
+    {
+    iListener->ResetEventStack();
+    iListener->AcceptedEventTypes().Reset();
+    iListener->AcceptedEventTypes().AppendL( MXIMPRequestCompleteEvent::KInterfaceId );
+
+    if ( aAdditionalEvents )
+        {
+        for ( TInt i = 0; i < aAdditionalEvents->Count(); i++ )
+            {
+            iListener->AcceptedEventTypes().AppendL( (*aAdditionalEvents)[ i ] );
+            }
+        }
+
+    iListener->ReRegisterEventFilterL();
+    iStatusEventTraits.Reset();
+    iListener->GetEventTemplateL( iStatusEventTraits, aEventType );
+
+    iMessenger->SetPluginIndex( iIndex );
+    }
+
+// ---------------------------------------------------------------------------
+// ?description_if_needed
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CXIMPTestContextWrapper::ClearListener()
+    {
+    iListener->ResetEventStack();
+    iListener->SetEventSourceL( NULL );
+
+    iStatusEventTraits.Reset();
+    }
+
+
+// ---------------------------------------------------------------------------
+// ?description_if_needed
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CXIMPTestContextWrapper::ResetListener()
+    {
+    iListener->ResetEventStack();
+    iListener->ResetEventTypeStack();
+    iStatusEventTraits.Reset();
+    iListener->ReRegisterEventFilterL();
+    }
+
+// ---------------------------------------------------------------------------
+// ?description_if_needed
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CXIMPTestContextWrapper::WaitRequestAndStackEvents( TXIMPRequestId aReqId )
+    {
+    iListener->WaitRequestAndStackEvents( aReqId );
+    }
+
+// ---------------------------------------------------------------------------
+// ?description_if_needed
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CXIMPTestContextWrapper::VerifyEventStackL( const TPtrC8& aDesc )
+    {
+    iListener->VerifyEventStackL( iStatusEventTraits.Array(), aDesc );
+    }
+
+// ---------------------------------------------------------------------------
+// CXIMPTestContextWrapper::WaitAnyEvent
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CXIMPTestContextWrapper::WaitAnyEvent()
+    {
+    iListener->WaitAnyEvent();
+    }
+
+// ---------------------------------------------------------------------------
+// ?description_if_needed
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CXIMPTestContextWrapper::BindL(
+        TUid aUid,
+        const TDesC& aServer,
+        const TDesC& aUser,
+        const TDesC& aPassword )
+    {
+    SetupListenerL( EXIMPTestStatusEvents_BindingOk );
+    iMessenger->SetNoError();
+    iMessenger->SetPluginIndex( iIndex );
+
+    delete iFileTool;
+    iFileTool = NULL;
+    iFileTool = CXIMPTestFileTool::NewL( aUid.iUid, iIndex );
+
+    TXIMPRequestId reqId = iContext->BindToL(
+            aUid,
+            aServer,
+            aUser,
+            aPassword,
+            *iInstance,
+            iIndex );
+
+    WaitRequestAndStackEvents( reqId );
+    VerifyEventStackL( _L8("Binding (wrapper BindL): ") );
+
+    EUNIT_ASSERT_DESC( iMessenger->GetBoolean( EXIMPPlgTestOpenSessionCalled ) ||
+                       iMessenger->GetBoolean( EXIMPPlgTestShareSessionCalled ), "OpenSessionL was not called" );
+    }
+
+// ---------------------------------------------------------------------------
+// Bind alternative
+// ---------------------------------------------------------------------------
+//
+const TUid KTestProtocolUid = { K_PRFW_TST_PROTOCOL_1_IMPLEMENTATION_UID };  // hardcoded...
+
+_LIT( KTestFakeServer,      "www.imps%d.no/wv" );
+_LIT( KTestFakeUser,        "user%d" );
+_LIT( KTestFakePassword,    "password%d" );
+
+EXPORT_C void CXIMPTestContextWrapper::BindL( TInt aId )
+    {
+    SetupListenerL( EXIMPTestStatusEvents_BindingOk );
+    iMessenger->SetNoError();
+    iMessenger->SetPluginIndex( aId );
+
+    // create fake info
+    TInt extraLength = 8; // bad style... but length is enough
+
+    HBufC* fakeSrv = HBufC::NewLC( KTestFakeServer().Length() + extraLength );
+    fakeSrv->Des().AppendFormat( KTestFakeServer, aId );
+
+    HBufC* fakeUser = HBufC::NewLC( KTestFakeUser().Length() + extraLength );
+    fakeUser->Des().AppendFormat( KTestFakeUser, aId );
+
+    HBufC* fakePass = HBufC::NewLC( KTestFakePassword().Length() + extraLength );
+    fakePass->Des().AppendFormat( KTestFakePassword, aId );
+
+    delete iFileTool;
+    iFileTool = NULL;
+    iFileTool = CXIMPTestFileTool::NewL( KTestProtocolUid.iUid, iIndex );
+
+    TXIMPRequestId reqId = iContext->BindToL(
+            KTestProtocolUid,
+            *fakeSrv,
+            *fakeUser,
+            *fakePass,
+            *iInstance,
+            aId );
+
+    CleanupStack::PopAndDestroy( 3, fakeSrv );
+
+    WaitRequestAndStackEvents( reqId );
+    VerifyEventStackL( _L8("Binding (wrapper BindL): ") );
+
+    EUNIT_ASSERT_DESC( iMessenger->GetBoolean( EXIMPPlgTestOpenSessionCalled ) ||
+                       iMessenger->GetBoolean( EXIMPPlgTestShareSessionCalled ), "OpenSessionL was not called" );
+    }
+
+  
+    
+ ///NEW BIND   
+ EXPORT_C void CXIMPTestContextWrapper::BindWithSettingsL( TInt aId )
+    {
+    SetupListenerL( EXIMPTestStatusEvents_BindingOk );
+    iMessenger->SetNoError();
+    iMessenger->SetPluginIndex( 0/*aId*/ );
+
+    // create fake info
+    TInt extraLength = 8; // bad style... but length is enough
+
+    HBufC* fakeSrv = HBufC::NewLC( KTestFakeServer().Length() + extraLength );
+    fakeSrv->Des().AppendFormat( KTestFakeServer, aId );
+
+    HBufC* fakeUser = HBufC::NewLC( KTestFakeUser().Length() + extraLength );
+    fakeUser->Des().AppendFormat( KTestFakeUser, aId );
+
+    HBufC* fakePass = HBufC::NewLC( KTestFakePassword().Length() + extraLength );
+    fakePass->Des().AppendFormat( KTestFakePassword, aId );
+
+    delete iFileTool;
+    iFileTool = NULL;
+    iFileTool = CXIMPTestFileTool::NewL( KTestProtocolUid.iUid, iIndex );
+
+    TXIMPRequestId reqId = iContext->BindToL(
+            KTestProtocolUid, aId );
+
+    CleanupStack::PopAndDestroy( 3, fakeSrv );
+
+    WaitRequestAndStackEvents( reqId );
+    VerifyEventStackL( _L8("Binding (wrapper BindWithSettingsL): ") );
+
+    EUNIT_ASSERT_DESC( iMessenger->GetBoolean( EXIMPPlgTestOpenSessionCalled ) ||
+                       iMessenger->GetBoolean( EXIMPPlgTestShareSessionCalled ), "OpenSessionL was not called" );
+    }
+
+// ---------------------------------------------------------------------------
+// ?description_if_needed
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CXIMPTestContextWrapper::UnbindL()
+    {
+    SetupListenerL( EXIMPTestStatusEvents_UnbindingOk );
+    iMessenger->SetNoError();
+    TXIMPRequestId reqId = iContext->UnbindL();
+
+    WaitRequestAndStackEvents( reqId );
+    VerifyEventStackL( _L8("Unbinding (wrapper UnbindL): ") );
+
+    EUNIT_ASSERT_DESC( iMessenger->GetBoolean( EXIMPPlgTestCloseSessionCalled ) ||
+                       iMessenger->GetBoolean( EXIMPPlgTestUnshareSessionCalled ) , "CloseSession was not called" );
+    if( iMessenger->GetBoolean( EXIMPPlgTestCloseSessionCalled ) )
+        {
+        DeletePresenceContext();
+        //EUNIT_ASSERT_DESC( iMessenger->GetBoolean( EXIMPPlgTestDeath ), "Plugin did not die, destructor not called.");
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// ?description_if_needed
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CXIMPTestFileTool& CXIMPTestContextWrapper::FileTool() const
+    {
+    return *iFileTool;
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/testcaseutils/prfwtestcontextwrapper.h	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  Testing context wrapper
+ *
+*/
+
+
+#ifndef CPRFWTESTCONTEXTWRAPPER_H
+#define CPRFWTESTCONTEXTWRAPPER_H 
+
+#include <e32base.h>
+
+#include "prfwteststatuseventlistener.h"
+
+class MXIMPClient;
+class MXIMPContext;
+class CXIMPTestStatusEventListener;
+class CXIMPTestMessenger;
+class CXIMPTestFileTool;
+class MPresenceFeatures;
+
+/**
+ * Wrapper for testing.
+ * Owns the things needed to test one host-plugin connection.
+ *
+ * @since S60 v4.0
+ */
+class CXIMPTestContextWrapper : public CBase
+    {
+    public:
+
+        /**
+         * @param aIndex Index of wrapper (used for pubsub-messaging
+         * between test plugin and test code).
+         */
+        IMPORT_C static CXIMPTestContextWrapper* NewL( TInt aIndex, MXIMPClient* aClient );
+        virtual ~CXIMPTestContextWrapper();
+
+    private:
+
+        CXIMPTestContextWrapper( TInt aIndex, MXIMPClient* aClient );
+        void ConstructL();
+
+    public:
+
+        // accessors
+        IMPORT_C MXIMPContext* GetContext();
+        IMPORT_C CXIMPTestStatusEventListener* GetEventListener();
+        IMPORT_C CXIMPTestMessenger* GetMessenger();
+        IMPORT_C MXIMPClient* GetClient();
+        IMPORT_C RArray<TXIMPTestStatusEventSnapshot>* GetStatusTraits();
+        IMPORT_C MPresenceFeatures* GetPresenceFeatures();
+
+        // low-level test support - see e.g. t_sessionmng test for usage
+        //
+        /**
+         * Delete the presence context and set it to NULL.
+         */
+        IMPORT_C void DeletePresenceContext();
+
+        /**
+         * Like SetupListenerL but sets no event template. Use AppendToTraitsL to set
+         * the desired templates. Useful for certain test cases.
+         */
+        IMPORT_C void SetupEmptyListener();
+
+        /**
+         * Setup a listener using the given event template for the traits.
+         * @param aEventType The event template to listen to.
+         */
+        IMPORT_C void SetupListenerL( TXIMPTestStatusEventTemplate aEventType );
+
+        /**
+         * Append the given template to the internal traits.
+         * @param aEventType The event template to add.
+         */
+        IMPORT_C void AppendToTraitsL( TXIMPTestStatusEventTemplate aEventType );
+
+        /**
+         * Setup a listener for a request complete event. All other events from the
+         * given template are ignored (except those given by aAdditionalEvents).
+         * @param aEventType The event template.
+         * @param aAdditionalEvents Additional events to listen to.
+         */
+        IMPORT_C void SetupListenerReqCompleteL( 
+                TXIMPTestStatusEventTemplate aEventType,
+                RArray< TInt32 >* aAdditionalEvents = NULL );
+
+        /**
+         * Clear the listener.
+         */
+        IMPORT_C void ClearListener();
+        
+        /**
+         * Back to begin state of listener.
+         */
+        IMPORT_C void ResetListener(); 
+
+        /**
+         * Wait for the events and a request complete event for the given request id.
+         * @param aReqId The request id for which a req. complete ends the wait
+         */
+        IMPORT_C void WaitRequestAndStackEvents( TXIMPRequestId aReqId );
+
+        /**
+         * Wait for any event to occur. Event ends the wait.
+         */
+        IMPORT_C void WaitAnyEvent();
+
+        /**
+         * Verify the event stack against the previously set template(s).
+         * The description is printed to the EUnit log.
+         * @param aDesc The description
+         */
+        IMPORT_C void VerifyEventStackL( const TPtrC8& aDesc );
+
+        // high-level test support
+        /**
+         * Happy-path binding.
+         */
+        IMPORT_C void BindL( 
+                TUid aUid, 
+                const TDesC& aServer,
+                const TDesC& aUser,
+                const TDesC& aPassword );
+        
+        /**
+         * Happy-path binding alternative method.
+         * The server, userid and password are automatically modified
+         * based on the given id:
+         * Server: www.imps%d.no/wv
+         * User:   user%d
+         * Password: password%d.
+         * @param aId An id used to modify server login data.
+         */
+        IMPORT_C void BindL( TInt aId );
+        
+        IMPORT_C void BindWithSettingsL( TInt aId );
+        /**
+         * Happy-path unbinding
+         */
+        IMPORT_C void UnbindL();
+        
+        /**
+         * Access to filetool of wrapper.
+         */
+        IMPORT_C CXIMPTestFileTool& FileTool() const;
+        
+        /**
+         * @return Instance id
+         */
+        IMPORT_C const TDesC16& InstanceId() const;        
+
+    private: // data
+
+        // not owned
+        MXIMPClient* iClient;
+
+        // owned
+        MXIMPContext* iContext;
+
+        // owned
+        MPresenceFeatures* iPresFeatures;
+
+
+        // owned
+        CXIMPTestStatusEventListener* iListener;
+
+        // owned
+        CXIMPTestMessenger* iMessenger;
+
+        // owned
+        RArray< TXIMPTestStatusEventSnapshot > iStatusEventTraits;
+
+        TInt iIndex;
+        
+        /**
+         * Filetool 
+         */
+        CXIMPTestFileTool* iFileTool;
+        
+        HBufC16* iInstance;     // the global instance id        
+
+    };
+
+#endif // CPRFWTESTCONTEXTWRAPPER_H 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/testcaseutils/prfwtestcontextwrappermgr.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  Testing context wrapper
+ *
+*/
+
+
+
+#include <e32std.h>
+
+#include <ximpclient.h>
+#include <ximpbase.h>
+#include "prfwtestcontextwrappermgr.h"
+#include "prfwtestcontextwrapper.h"
+#include <ximpcontext.h>
+#include "prfwteststatuseventlistener.h"
+#include "prfwtestmessenger.h"
+#include "prfwtestmessaging.h"
+
+// ======== LOCAL FUNCTIONS ========
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// ?description_if_needed
+// ---------------------------------------------------------------------------
+//
+CXIMPTestContextWrapperMgr::CXIMPTestContextWrapperMgr() 
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// ?description_if_needed
+// ---------------------------------------------------------------------------
+//
+void CXIMPTestContextWrapperMgr::ConstructL()
+    {
+    // TODO
+    }
+
+// ---------------------------------------------------------------------------
+// ?description_if_needed
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CXIMPTestContextWrapperMgr* CXIMPTestContextWrapperMgr::NewL()
+    {
+    CXIMPTestContextWrapperMgr* self = new( ELeave ) CXIMPTestContextWrapperMgr();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// ?description_if_needed
+// ---------------------------------------------------------------------------
+//
+CXIMPTestContextWrapperMgr::~CXIMPTestContextWrapperMgr()
+    {
+    iWrappers.Close();
+    iPrClients.Close();
+    }
+
+// ---------------------------------------------------------------------------
+// ?description_if_needed
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CXIMPTestContextWrapperMgr::CreateWrapperL( TInt aClientIndex /* = KErrNotFound */ )
+    {
+    // make sure we've the client
+    MXIMPClient* client = NULL;
+
+    if ( aClientIndex == KErrNotFound )
+        {
+        if( iPrClients.Count() == 0 )
+            {
+            // make a new one
+            client = MXIMPClient::NewClientL();
+            iPrClients.AppendL( client );
+            }
+        else
+            {
+            client = iPrClients[ 0 ];
+            }
+        }
+    else
+        {
+        // if the index was bad, everything will blow. it's up to the client to instruct
+        // us correctly
+        client = iWrappers[ aClientIndex ]->GetClient();
+        }
+
+    CXIMPTestContextWrapper* tmp = CXIMPTestContextWrapper::NewL( iIndex, client );
+    iWrappers.AppendL( tmp );
+
+    iIndex++;
+    }
+
+// ---------------------------------------------------------------------------
+// ?description_if_needed
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CXIMPTestContextWrapper* CXIMPTestContextWrapperMgr::GetWrapperL( TInt aIndex )
+    {
+    return iWrappers[ aIndex ];
+    }
+
+EXPORT_C TInt CXIMPTestContextWrapperMgr::WrapperCount() const
+    {
+    return iWrappers.Count();
+    } 
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/testcaseutils/prfwtestcontextwrappermgr.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,81 @@
+/*
+* 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:  Testing context wrapper
+ *
+*/
+
+
+#ifndef CPRFWTESTCONTEXTWRAPPERMGR_H
+#define CPRFWTESTCONTEXTWRAPPERMGR_H 
+
+#include <e32base.h>
+#include <ximpbase.h>
+
+#include "prfwteststatuseventlistener.h"
+
+class MXIMPClient;
+class CXIMPTestContextWrapper;
+class MXIMPContext;
+class CXIMPTestStatusEventListener;
+class CXIMPTestMessenger;
+
+/**
+ * Manager for wrappers.
+ * Owns the wrappers and provides convenience methods for
+ * test code.
+ *
+ * @since S60 v4.0
+ */
+class CXIMPTestContextWrapperMgr : public CBase
+    {
+    public:
+
+        IMPORT_C static CXIMPTestContextWrapperMgr* NewL();
+        virtual ~CXIMPTestContextWrapperMgr();
+
+    private:
+
+        CXIMPTestContextWrapperMgr();
+        void ConstructL();
+
+    public:
+
+        /**
+         * Creates a wrapper. The presence client can be given for wrappers
+         * which share a presence client.
+         * @param aClientIndex Use the client from this wrapper
+         * If aClientIndex is KErrNotFound, creates a new client.
+         */
+        IMPORT_C void CreateWrapperL( TInt aClientIndex = KErrNotFound );
+
+        /**
+         * Direct access to a wrapper. Ownership NOT transferred.
+         * @param aIndex The index of desired wrapper
+         */
+        IMPORT_C CXIMPTestContextWrapper* GetWrapperL( TInt aIndex );
+
+        /**
+         * Count of wrappers
+         */         
+        IMPORT_C TInt WrapperCount() const;
+
+    private: // data
+
+        RXIMPObjOwningPtrArray<CXIMPTestContextWrapper> iWrappers;
+        RXIMPObjOwningPtrArray<MXIMPClient> iPrClients;
+
+        TInt iIndex;
+    };
+
+#endif // CPRFWTESTCONTEXTWRAPPERMGR_H 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/testcaseutils/prfwtestdlluids.hrh	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  Presence Framework Eunit tests.
+*
+*/
+
+#ifndef PRFWTESTDLLUIDS_HRH
+#define PRFWTESTDLLUIDS_HRH
+
+
+// -----------------------------------------------------------------------------
+// These are system wide UID 2:s for the various dll types.
+//
+// -----------------------------------------------------------------------------
+//
+#define PRFWTEST_DLL_UID_STATIC_INTERFACE           0x1000008d
+#define PRFWTEST_DLL_UID_ECOM_PLUGIN                0x10009D8D
+
+// -----------------------------------------------------------------------------
+// These are the UID 3:s for the Presence Framework test dlls.
+//
+// -----------------------------------------------------------------------------
+//
+#define PRFWTEST_DLL_UID_COMMON                     0x1110ff50 // TODO
+
+
+#endif // PRFWDLLUIDS_HRH
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/testcaseutils/prfwtesteventfactory.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,426 @@
+/*
+* 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:
+*
+*/
+
+
+#include "prfwtestcaseutilspanics.h"
+#include "prfwtesteventfactory.h"
+
+#include <eunitmacros.h>
+#include <ximpcontextstateevent.h>
+#include <ximprequestcompleteevent.h>
+#include <ximpstatus.h>
+#include <presentitypresenceevent.h>
+#include <presentitygrouplistevent.h>
+#include <presentitygroupcontentevent.h>
+#include <presenceinfo.h>
+
+#include "ximpidentityimp.h"
+#include "presencetypehelpers.h"
+#include "presentitygroupinfoimp.h"
+#include "presentitygroupmemberinfoimp.h"
+#include "presentitygroupcontenteventimp.h"
+#include "presentitygrouplisteventimp.h"
+
+
+
+using namespace NXIMPTestCaseUtilsPanic;
+
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// ---------------------------------------------------------------------------
+// create a group content event with given arrays
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CPresentityGroupContentEventImp*
+XIMPTestEventFactory::CreateGroupContentEventLCX(
+        const TDesC& aGroupId,
+        const TDesC& aIdentityForDelta,
+        const TDesC& aDispNameForDelta,
+        TTestPGLContentArraySpecifier aArraySpec,
+        const TDesC& aIdentityCurrent,
+        const TDesC& aDispNameCurrent,
+        MXIMPDataSubscriptionState::TSubscriptionState aSubscriptionState,
+        MXIMPDataSubscriptionState::TDataState aDataState
+        )
+    {
+    // id for group
+    CXIMPIdentityImp* idForGroup = CXIMPIdentityImp::NewLC( aGroupId );
+
+    // create the arrays
+    RPrGrpMemInfoImpArray* addedList = new ( ELeave ) RPrGrpMemInfoImpArray;
+    CleanupDeletePushL( addedList );
+
+    RPrGrpMemInfoImpArray* updatedList = new ( ELeave ) RPrGrpMemInfoImpArray;
+    CleanupDeletePushL( updatedList );
+
+    RPrGrpMemInfoImpArray* removedList = new ( ELeave ) RPrGrpMemInfoImpArray;
+    CleanupDeletePushL( removedList );
+
+    RPrGrpMemInfoImpArray* currentList = new ( ELeave ) RPrGrpMemInfoImpArray;
+    CleanupDeletePushL( currentList );
+
+    // populate the current list
+    if ( aIdentityCurrent.Length() > 0 )
+        {
+        // but don't put "KNullDesC" there if it's really empty
+        CXIMPIdentityImp* idForCurrent = CXIMPIdentityImp::NewLC( aIdentityCurrent );
+        CPresentityGroupMemberInfoImp* grpInfoForCurrent =
+            CPresentityGroupMemberInfoImp::NewLC( *idForCurrent, aDispNameCurrent );
+        currentList->AppendL( grpInfoForCurrent );
+        CleanupStack::Pop( grpInfoForCurrent );
+        CleanupStack::PopAndDestroy( idForCurrent );
+        }
+
+    // create the delta list
+    CXIMPIdentityImp* idForEvent = CXIMPIdentityImp::NewLC( aIdentityForDelta );
+    CPresentityGroupMemberInfoImp* grpInfoForEvent =
+        CPresentityGroupMemberInfoImp::NewLC( *idForEvent, aDispNameForDelta );
+
+    // notice the cleanup stack usage. AppendL takes ownership, but
+    // it might not be done always.
+    TBool didAppend = EFalse;
+
+    // put the given group info into the specified array.
+    switch ( aArraySpec )
+        {
+        case ETestPGLCntAdded :
+            {
+            if ( aIdentityForDelta.Length() > 0 )
+                {
+                addedList->AppendL( grpInfoForEvent );
+                didAppend = ETrue;
+                }
+            break;
+            }
+
+        case ETestPGLCntUpdated :
+            {
+            if ( aIdentityForDelta.Length() > 0 )
+                {
+                updatedList->AppendL( grpInfoForEvent );
+                didAppend = ETrue;
+                }
+            break;
+            }
+
+        case ETestPGLCntRemoved :
+            {
+            if ( aIdentityForDelta.Length() > 0 )
+                {
+                removedList->AppendL( grpInfoForEvent );
+                didAppend = ETrue;
+                }
+            break;
+            }
+
+        case ETestPGLCntEmpty :
+            {
+            // don't add, thus creating an empty array.
+            break;
+            }
+
+        default:
+            {
+            User::Leave( KErrArgument );
+            break;
+            }
+        };
+
+    // remove the event and id from cleanupstack. removal
+    // method depends on whether we did append or not
+    if ( didAppend )
+        {
+        CleanupStack::Pop( grpInfoForEvent );
+        CleanupStack::PopAndDestroy( idForEvent );
+        }
+    else
+        {
+        CleanupStack::PopAndDestroy( 2, idForEvent );
+        }
+
+    CXIMPDataSubscriptionStateImp* stateImp = CXIMPDataSubscriptionStateImp::NewLC();
+    stateImp->SetSubscriptionStateL( aSubscriptionState );
+    stateImp->SetDataStateL( aDataState );
+        
+    // create the actual event
+    CPresentityGroupContentEventImp* tmp =
+        CPresentityGroupContentEventImp::NewLC(
+                *idForGroup,
+                addedList,
+                updatedList,
+                removedList,
+                currentList,
+                stateImp
+                );
+    CleanupStack::Pop( 2, stateImp );
+    CleanupStack::PushL( tmp );
+
+    // test the accessors
+    if ( aIdentityForDelta.Length() > 0 )
+        {
+        switch ( aArraySpec )
+            {
+            case ETestPGLCntAdded :
+                {
+                EUNIT_ASSERT_DESC( tmp->NewMembersCount() == 1, "Added group member count mismatch" );
+                TBool same = 0 == tmp->NewMember( 0 ).GroupMemberId().Identity().Compare( aIdentityForDelta );
+                EUNIT_ASSERT_DESC( same, "Added group member id mismatch" );
+                break;
+                }
+
+            case ETestPGLCntUpdated :
+                {
+                EUNIT_ASSERT_DESC( tmp->UpdatedMembersCount() == 1, "Updated group member count mismatch" );
+                TBool same = 0 == tmp->UpdatedMember( 0 ).GroupMemberId().Identity().Compare( aIdentityForDelta );
+                EUNIT_ASSERT_DESC( same, "Updated group member id mismatch" );
+                break;
+                }
+
+            case ETestPGLCntRemoved :
+                {
+                EUNIT_ASSERT_DESC( tmp->DisappearedMembersCount() == 1, "Removed group member count mismatch" );
+                TBool same = 0 == tmp->DisappearedMember( 0 ).GroupMemberId().Identity().Compare( aIdentityForDelta );
+                EUNIT_ASSERT_DESC( same, "Removed group member id mismatch" );
+                break;
+                }
+
+            case ETestPGLCntEmpty :
+                {
+                // don't add, thus creating an empty array.
+                break;
+                }
+
+            default :
+                {
+                break;
+                }
+            }
+        }
+
+    if ( aIdentityCurrent.Length() > 0 )
+        {
+        EUNIT_ASSERT_DESC( tmp->CurrentMembersCount() == 1, "Current group member count mismatch" );
+        
+        TBool same = 0 == tmp->CurrentMember( 0 ).GroupMemberId().Identity().Compare( aIdentityCurrent );
+        EUNIT_ASSERT_DESC( same, "Current group member id mismatch" );
+        
+        same = 0 == tmp->CurrentMember( 0 ).GroupMemberDisplayName().Compare( aDispNameCurrent );
+        EUNIT_ASSERT_DESC( same, "Current group member display name mismatch" );
+        }
+    else
+        {
+        EUNIT_ASSERT_DESC( tmp->CurrentMembersCount() == 0, "Current group member count mismatch" );
+        }
+
+    /*
+     * In cleanupstack there are 6 items, FIFO:
+     *   - identity object
+     *   - added list
+     *   - updated list
+     *   - removed list
+     *   - current member list
+     *   - event imp
+     */
+
+    return tmp;
+    }
+
+
+// ---------------------------------------------------------------------------
+// create a group list event with given arrays
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CPresentityGroupListEventImp* XIMPTestEventFactory::CreateGroupListEventLCX(
+        const TDesC& aUri,
+        const TDesC& aDispName,
+        TTestPGLArraySpecifier aArraySpec,
+        const TDesC& aUriCurrent,
+        const TDesC& aDispNameCurrent,
+        MXIMPDataSubscriptionState::TSubscriptionState aSubscriptionState,
+        MXIMPDataSubscriptionState::TDataState aDataState
+        )
+    {
+    // create the arrays
+    RPrGrpInfoImpArray* createdList = new ( ELeave ) RPrGrpInfoImpArray;
+    CleanupDeletePushL( createdList );
+
+    RPrGrpInfoImpArray* updatedList = new ( ELeave ) RPrGrpInfoImpArray;
+    CleanupDeletePushL( updatedList );
+
+    RPrGrpInfoImpArray* deletedList = new ( ELeave ) RPrGrpInfoImpArray;
+    CleanupDeletePushL( deletedList );
+    
+    RPrGrpInfoImpArray* currentList = new ( ELeave ) RPrGrpInfoImpArray;
+    CleanupDeletePushL( currentList );
+
+    // create the group info
+    CXIMPIdentityImp* idForEvent = CXIMPIdentityImp::NewLC( aUri );
+    CPresentityGroupInfoImp* grpInfoForEvent =
+        CPresentityGroupInfoImp::NewLC( *idForEvent, aDispName );
+
+    // populate the current list
+    if ( aUriCurrent.Length() > 0 )
+        {
+        // but don't put "KNullDesC" there if it's really empty
+        CXIMPIdentityImp* idForCurrent = CXIMPIdentityImp::NewLC( aUriCurrent );
+        CPresentityGroupInfoImp* grpInfoForCurrent =
+            CPresentityGroupInfoImp::NewLC( *idForCurrent, aDispNameCurrent );
+        currentList->AppendL( grpInfoForCurrent );
+        CleanupStack::Pop( grpInfoForCurrent );
+        CleanupStack::PopAndDestroy( idForCurrent );
+        }
+    
+    // notice the cleanup stack usage. AppendL takes ownership, but
+    // it might not be done always.
+    TBool didAppend = EFalse;
+
+    // put the given group info into the specified array
+    switch ( aArraySpec )
+        {
+        case ETestPGLCreated :
+            {
+            if ( aUri.Length() > 0 )
+                {
+                createdList->AppendL( grpInfoForEvent );
+                didAppend = ETrue;
+                }
+            break;
+            }
+
+        case ETestPGLUpdated :
+            {
+            if ( aUri.Length() > 0 )
+                {
+                updatedList->AppendL( grpInfoForEvent );
+                didAppend = ETrue;
+                }
+            break;
+            }
+
+        case ETestPGLDeleted :
+            {
+            if ( aUri.Length() > 0 )
+                {
+                deletedList->AppendL( grpInfoForEvent );
+                didAppend = ETrue;
+                }
+            break;
+            }
+
+        case ETestPGLEmpty :
+            {
+            // don't add, thus creating an empty array
+            break;
+            }
+
+        default:
+            {
+            User::Leave( KErrArgument );
+            break;
+            }
+        };
+
+    // remove the event and id from cleanupstack. removal
+    // method depends on whether we did append or not
+    if ( didAppend )
+        {
+        CleanupStack::Pop( grpInfoForEvent );
+        CleanupStack::PopAndDestroy( idForEvent );
+        }
+    else
+        {
+        CleanupStack::PopAndDestroy( 2, idForEvent );
+        }
+
+    CXIMPDataSubscriptionStateImp* stateImp = CXIMPDataSubscriptionStateImp::NewLC();
+    stateImp->SetSubscriptionStateL( aSubscriptionState );
+    stateImp->SetDataStateL( aDataState );
+        
+    // create the actual event
+    CPresentityGroupListEventImp* tmp =
+        CPresentityGroupListEventImp::NewLC(
+                createdList,
+                updatedList,
+                deletedList,
+                currentList,
+                stateImp
+                );                
+    CleanupStack::Pop( 2, stateImp );
+    CleanupStack::PushL( tmp );
+
+    // verify that the event contains correct information
+    if ( aUri.Length() > 0 )
+        {
+        switch ( aArraySpec )
+            {
+            case ETestPGLCreated :
+                {
+                EUNIT_ASSERT_DESC( tmp->NewGroupsCount() == 1, "Created group count mismatch" );
+                TBool same = 0 == tmp->NewGroup( 0 ).GroupId().Identity().Compare( aUri );
+                EUNIT_ASSERT_DESC( same, "Created group id mismatch" );
+                break;
+                }
+
+            case ETestPGLUpdated :
+                {
+                EUNIT_ASSERT_DESC( tmp->UpdatedGroupsCount() == 1, "Updated group count mismatch" );
+                TBool same = 0 == tmp->UpdatedGroup( 0 ).GroupId().Identity().Compare( aUri );
+                EUNIT_ASSERT_DESC( same, "Updated group id mismatch" );
+                break;
+                }
+
+            case ETestPGLDeleted :
+                {
+                EUNIT_ASSERT_DESC( tmp->DisappearedGroupsCount() == 1, "Deleted group count mismatch" );
+                TBool same = 0 == tmp->DisappearedGroup( 0 ).GroupId().Identity().Compare( aUri );
+                EUNIT_ASSERT_DESC( same, "Deleted group id mismatch" );
+                break;
+                }
+            }
+        }
+    
+    if ( aUriCurrent.Length() > 0 )
+        {
+        EUNIT_ASSERT_DESC( tmp->CurrentGroupsCount() == 1, "Current group count mismatch" );
+   
+        TBool same = 0 == tmp->CurrentGroup( 0 ).GroupId().Identity().Compare( aUriCurrent );
+        EUNIT_ASSERT_DESC( same, "Current group id mismatch" );
+        
+        same = 0 == tmp->CurrentGroup( 0 ).GroupDisplayName().Compare( aDispNameCurrent );
+        EUNIT_ASSERT_DESC( same, "Current group display name mismatch" );
+        }
+    else
+        {
+        EUNIT_ASSERT_DESC( tmp->CurrentGroupsCount() == 0, "Current group count mismatch, expected 0" );
+        }
+
+    /*
+     * In cleanupstack there are 5 items, FIFO:
+     *   - created list
+     *   - updated list
+     *   - deleted list
+     *   - current list
+     *   - event imp
+     */
+
+    return tmp;
+    }
+
+// end of file
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/testcaseutils/prfwtesteventfactory.h	Wed Nov 03 09:32:20 2010 +0530
@@ -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:
+*
+*/
+
+
+#ifndef PRFWTESTEVENTFACTORY_H__
+#define PRFWTESTEVENTFACTORY_H__
+
+#include <e32base.h>
+#include <ximpdatasubscriptionstate.h>
+
+// CLASS DESCRIPTION
+
+class CPresentityGroupListEventImp;
+class CPresentityGroupContentEventImp;
+class CXIMPDataSubscriptionStateImp;
+
+/**
+ * Presence event factory for use in tests.
+ */
+class XIMPTestEventFactory
+    {
+    public:
+
+        // @see below  
+        enum TTestPGLArraySpecifier 
+            { 
+            ETestPGLCreated = 0,    // group info is created
+            ETestPGLUpdated,        // group info is updated
+            ETestPGLDeleted,        // group info is deleted
+            ETestPGLEmpty,          // make an empty array for empty event
+            };
+
+        /**
+         * Places an identity (uri-displayname pair) inside a group info into the
+         * array defined by aArraySpec, and returns the created event.
+         *
+         * In cleanupstack there are 5 items, FIFO:
+         *   - created list
+         *   - updated list
+         *   - deleted list
+         *   - current list
+         *   - event imp
+         *
+         * This is because this event won't take ownership to the arrays
+         * when created this way.
+         *
+         * @param aUri URI of group
+         * @param aDispName Displayname
+         * @param aArraySpec Defines into which array to put the group info
+         * @param aUriCurrent The URI of group in "current"-list
+         * @param aDispNameCurrent The display name of the group in
+         * "current"-list
+         * @param aStatus The subscription status 
+         * @return The suitably filled event.
+         */
+        IMPORT_C static CPresentityGroupListEventImp* CreateGroupListEventLCX( 
+                const TDesC& aUri,
+                const TDesC& aDispName,
+
+                TTestPGLArraySpecifier aArraySpec,
+
+                const TDesC& aUriCurrent,
+                const TDesC& aDispNameCurrent,
+                
+                MXIMPDataSubscriptionState::TSubscriptionState aSubscriptionState,
+                MXIMPDataSubscriptionState::TDataState aDataState
+                );
+
+        // @see below  
+        enum TTestPGLContentArraySpecifier 
+            { 
+            ETestPGLCntAdded = 0,    // group content is added
+            ETestPGLCntUpdated,      // group content is updated
+            ETestPGLCntRemoved,      // group content is deleted
+            ETestPGLCntEmpty,        // make an empty array for empty event
+            };
+
+        /**
+         * Places an group member (identity-displayname pair) inside 
+         * a group content info into the delta array defined by aArraySpec, 
+         * and returns the created event.
+         *
+         * The current member list will contain only the group member
+         * specified by parameters aIdentityCurrent and aDispNameCurrent.
+         * To support more members than 1 this method needs to be changed,
+         * but for now, it suffices for our testing.
+         *
+         * In cleanupstack there are 5 items, FIFO:
+         *   - added list
+         *   - updated list
+         *   - removed list
+         *   - current member list
+         *   - event imp
+         *
+         * This is because this event won't take ownership to the arrays
+         * when created this way.
+         *
+         * @param aGroupId The group id
+         * @param aUri Uri
+         * @param aDispName Displayname
+         * @param aArraySpec Defines into which delta array to put the member
+         * @param aIdentityCurrent Identity part of current member
+         * @param aDispNameCurrent Display name part of current member
+         * @param aStatus The subscription status
+         * @return The suitably filled event.
+         */
+        IMPORT_C static CPresentityGroupContentEventImp* 
+            CreateGroupContentEventLCX( 
+                    const TDesC& aGroupId,
+                    
+                    const TDesC& aIdentityForDelta,
+                    const TDesC& aDispNameForDelta,
+                    
+                    TTestPGLContentArraySpecifier aArraySpec,
+         
+                    const TDesC& aIdentityCurrent,
+                    const TDesC& aDispNameCurrent,
+                    
+                    MXIMPDataSubscriptionState::TSubscriptionState aSubscriptionState,
+                    MXIMPDataSubscriptionState::TDataState aDataState
+                    );
+    };
+
+#endif //PRFWTESTEVENTFACTORY_H__
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/testcaseutils/prfwtestfilelogichelper.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,317 @@
+/*
+* 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:  Test support file tool
+ *
+*/
+
+
+#include <ximpprotocolconnectionhost.h>
+#include <protocolpresenceauthorizationdatahost.h>
+#include <protocolpresentitygroupsdatahost.h>
+#include <protocolpresencepublishingdatahost.h>
+#include <protocolpresencewatchingdatahost.h>
+#include <ximpdatasubscriptionstate.h>
+#include <protocolpresencedatahost.h>
+#include "prfwtestfilelogichelper.h"
+#include "prfwtestfilesrvmsg.h"
+#include "presentitygroupinfoimp.h"
+#include "presentitygroupmemberinfoimp.h"
+#include "presencewatcherinfoimp.h"
+#include "presencegrantrequestinfoimp.h"
+#include "presenceblockinfoimp.h"
+#include "ximpidentityimp.h"
+#include "ximpobjecthelpers.h"
+#include "prfwtestmessenger.h"
+#include "ximprestrictedobjectcollectionimp.h"
+#include "ximpobjectcollectionimp.h"
+#include "presenceinfoimp.h"
+
+// ======== LOCAL FUNCTIONS ========
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// ?description_if_needed
+// ---------------------------------------------------------------------------
+//
+CXIMPTestFileLogicHelper::CXIMPTestFileLogicHelper( MXIMPProtocolConnectionHost& aHost, CXIMPTestMessenger& aMessenger )
+: iHost( aHost ), iMessenger( aMessenger )
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// ?description_if_needed
+// ---------------------------------------------------------------------------
+//
+void CXIMPTestFileLogicHelper::ConstructL()
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// ?description_if_needed
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CXIMPTestFileLogicHelper* CXIMPTestFileLogicHelper::NewL( MXIMPProtocolConnectionHost& aHost, CXIMPTestMessenger& aMessenger  )
+    {
+    CXIMPTestFileLogicHelper* self = new( ELeave ) CXIMPTestFileLogicHelper( aHost, aMessenger );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// ?description_if_needed
+// ---------------------------------------------------------------------------
+//
+CXIMPTestFileLogicHelper::~CXIMPTestFileLogicHelper()
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// ?description_if_needed
+// ---------------------------------------------------------------------------
+//
+void CXIMPTestFileLogicHelper::HandleL( TInt aCommandType, TDesC8& aCommand )
+    {
+    switch( aCommandType )
+        {
+        case CXIMPTestFileSrvMsg::ETestSrvMsgPresenceGrantRequestList:
+            {
+            RXIMPObjOwningPtrArray< CPresenceGrantRequestInfoImp > array;
+            CleanupClosePushL( array );
+            TXIMPObjectPacker<CPresenceGrantRequestInfoImp>::UnPackArrayL( array, aCommand );
+            CXIMPObjectCollectionImp* objCollection = CXIMPObjectCollectionImp::NewLC();
+            for( TInt a = 0; a < array.Count(); ++a )
+                {
+                objCollection->AddObjectL( array[ a ] );
+                array[ a ] = NULL;
+                }
+
+            iHost.ProtocolPresenceDataHost().AuthorizationDataHost().HandlePresenceGrantRequestListL( objCollection );
+            CleanupStack::Pop( objCollection );
+            CleanupStack::PopAndDestroy(); //array
+            break;
+            }
+        case CXIMPTestFileSrvMsg::ETestSrvMsgPresenceGrantRequestReceived:
+            {
+            CPresenceGrantRequestInfoImp* infoFromServer =
+                                CPresenceGrantRequestInfoImp::NewLC();
+            TXIMPObjectPacker<CPresenceGrantRequestInfoImp>::UnPackL(
+                                    *infoFromServer, aCommand );
+
+            iHost.ProtocolPresenceDataHost().AuthorizationDataHost().HandlePresenceGrantRequestReceivedL( infoFromServer );
+            CleanupStack::Pop( infoFromServer );
+            break;
+            }
+        case CXIMPTestFileSrvMsg::ETestSrvMsgPresenceGrantRequestObsoleted:
+            {
+            CXIMPIdentityImp* idFromServer = CXIMPIdentityImp::NewLC();
+            TXIMPObjectPacker<CXIMPIdentityImp>::UnPackL( *idFromServer,
+                                                            aCommand );
+
+            iHost.ProtocolPresenceDataHost().AuthorizationDataHost().HandlePresenceGrantRequestObsoletedL( idFromServer );
+            CleanupStack::Pop( idFromServer );
+            break;
+            }
+        case CXIMPTestFileSrvMsg::ETestSrvMsgPresentityGroupList:
+            {
+            RXIMPObjOwningPtrArray< CPresentityGroupInfoImp > array;
+            CleanupClosePushL( array );
+            TXIMPObjectPacker<CPresentityGroupInfoImp>::UnPackArrayL( array, aCommand );
+            CXIMPObjectCollectionImp* objCollection = CXIMPObjectCollectionImp::NewLC();
+            for( TInt a = 0; a < array.Count(); ++a )
+                {
+                objCollection->AddObjectL( array[ a ] );
+                array[ a ] = NULL;
+                }
+            iHost.ProtocolPresenceDataHost().GroupsDataHost().HandlePresentityGroupListL( objCollection );
+            CleanupStack::Pop( objCollection );
+            CleanupStack::PopAndDestroy(); //array
+            break;            
+            }
+        case CXIMPTestFileSrvMsg::ETestSrvMsgPresentityGroupCreate:
+        case CXIMPTestFileSrvMsg::ETestSrvMsgPresentityGroupUpdate:
+            {
+            CPresentityGroupInfoImp* infoFromServer =
+                                CPresentityGroupInfoImp::NewLC();
+            TXIMPObjectPacker<CPresentityGroupInfoImp>::UnPackL(
+                                    *infoFromServer, aCommand );
+
+            if( aCommandType == CXIMPTestFileSrvMsg::ETestSrvMsgPresentityGroupCreate )
+                {
+                iHost.ProtocolPresenceDataHost().GroupsDataHost().HandlePresentityGroupCreatedL( infoFromServer );
+                }
+            else
+                {
+                iHost.ProtocolPresenceDataHost().GroupsDataHost().HandlePresentityGroupDisplayNameUpdatedL( infoFromServer );
+                }
+            CleanupStack::Pop( infoFromServer );
+            break;
+            }
+        case CXIMPTestFileSrvMsg::ETestSrvMsgPresentityGroupDelete:
+            {
+            CXIMPIdentityImp* idFromServer = CXIMPIdentityImp::NewLC();
+            TXIMPObjectPacker<CXIMPIdentityImp>::UnPackL( *idFromServer,
+                                                            aCommand );
+            iHost.ProtocolPresenceDataHost().GroupsDataHost().HandlePresentityGroupDeletedL( idFromServer );
+            CleanupStack::Pop( idFromServer );
+            break;
+            }
+        case CXIMPTestFileSrvMsg::ETestSrvMsgPresentityGroupMemberList:
+            {
+            RPointerArray< HBufC8 > bufferArray;
+            CleanupClosePushL( bufferArray );
+            TXIMPHBuf8Packer::UnPackArrayL( bufferArray, aCommand );
+            HBufC8* groupIdBuf = bufferArray[ 0 ];
+            HBufC8* array = bufferArray[ 1 ];
+            CleanupStack::PopAndDestroy(); //  BufferArray
+            CleanupStack::PushL( groupIdBuf );
+            CleanupStack::PushL( array );
+
+            CXIMPIdentityImp* groupId = CXIMPIdentityImp::NewLC();
+            TXIMPObjectPacker< CXIMPIdentityImp >::UnPackL( *groupId, *groupIdBuf );
+
+            RXIMPObjOwningPtrArray< CPresentityGroupMemberInfoImp > memberArray;
+            CleanupClosePushL( memberArray );
+            TXIMPObjectPacker<CPresentityGroupMemberInfoImp>::UnPackArrayL( memberArray, *array );
+            CXIMPObjectCollectionImp* objCollection = CXIMPObjectCollectionImp::NewLC();
+            for( TInt a = 0; a < memberArray.Count(); ++a )
+                {
+                objCollection->AddObjectL( memberArray[ a ] );
+                memberArray[ a ] = NULL;
+                }
+            iHost.ProtocolPresenceDataHost().GroupsDataHost().HandlePresentityGroupContentL( groupId, objCollection );
+            CleanupStack::Pop( objCollection );
+            CleanupStack::PopAndDestroy(); //memberArray
+            CleanupStack::Pop( groupId );
+            CleanupStack::PopAndDestroy( 2, groupIdBuf );
+            break;
+            }
+        case CXIMPTestFileSrvMsg::ETestCheckIfGroupMemberExists:
+            {
+            CXIMPIdentityImp* groupId = CXIMPIdentityImp::NewLC();
+            TXIMPObjectPacker< CXIMPIdentityImp >::UnPackL( *groupId, aCommand );
+            // Write to pubsub
+            const MXIMPDataSubscriptionState& state = 
+                iHost.ProtocolPresenceDataHost().GroupsDataHost().PresentityGroupContentDataSubscriptionState( *groupId );
+            if( state.DataState() == MXIMPDataSubscriptionState::EDataAvailable )
+                {
+                iMessenger.SetValueFor( EXIMPPlgTestExistsGroupContentInCache, 1 );
+                }
+            else
+                {
+                iMessenger.SetValueFor( EXIMPPlgTestExistsGroupContentInCache, KErrNotFound );
+                }
+            CleanupStack::PopAndDestroy( groupId );
+            break;
+            }
+        case CXIMPTestFileSrvMsg::ETestSrvMsgPresenceWatcherList:
+            {
+            RXIMPObjOwningPtrArray< CPresenceWatcherInfoImp > array;
+            CleanupClosePushL( array );
+            TXIMPObjectPacker< CPresenceWatcherInfoImp >::UnPackArrayL( array, aCommand );
+            CXIMPObjectCollectionImp* objCollection = CXIMPObjectCollectionImp::NewLC();
+            for( TInt a = 0; a < array.Count(); ++a )
+                {
+                objCollection->AddObjectL( array[ a ] );
+                array[ a ] = NULL;
+                }
+
+            iHost.ProtocolPresenceDataHost().PublishingDataHost().HandlePresenceWatcherListL( objCollection );
+            CleanupStack::Pop( objCollection );
+            CleanupStack::PopAndDestroy(); //, array
+            break;
+            }
+        case CXIMPTestFileSrvMsg::ETestSrvMsgPresentityPresence:
+            {
+            RPointerArray< HBufC8 > bufferArray;
+            CleanupClosePushL( bufferArray );
+            TXIMPHBuf8Packer::UnPackArrayL( bufferArray, aCommand );
+            HBufC8* presenceIdBuf = bufferArray[ 0 ];
+            HBufC8* presenceInfoBuf = bufferArray[ 1 ];
+            CleanupStack::PopAndDestroy(); //  BufferArray
+            CleanupStack::PushL( presenceIdBuf );
+            CleanupStack::PushL( presenceInfoBuf );
+
+            CXIMPIdentityImp* presenceId = CXIMPIdentityImp::NewLC();
+            TXIMPObjectPacker< CXIMPIdentityImp >::UnPackL( *presenceId, *presenceIdBuf );
+
+            CPresenceInfoImp* presenceInfo = CPresenceInfoImp::NewLC();
+            TXIMPObjectPacker< CPresenceInfoImp >::UnPackL( *presenceInfo, *presenceInfoBuf );
+
+            iHost.ProtocolPresenceDataHost().WatchingDataHost().HandleSubscribedPresentityPresenceL( presenceId, presenceInfo );
+            
+            CleanupStack::Pop( 2, presenceId );
+            CleanupStack::PopAndDestroy( 2, presenceIdBuf );
+            break;
+            }
+        case CXIMPTestFileSrvMsg::ETestSrvMsgPresenceBlockList:
+            {
+            RXIMPObjOwningPtrArray< CPresenceBlockInfoImp > array;
+            CleanupClosePushL( array );
+            TXIMPObjectPacker< CPresenceBlockInfoImp >::UnPackArrayL( array, aCommand );
+            CXIMPObjectCollectionImp* objCollection = CXIMPObjectCollectionImp::NewLC();
+            for( TInt a = 0; a < array.Count(); ++a )
+                {
+                objCollection->AddObjectL( array[ a ] );
+                array[ a ] = NULL;
+                }
+
+            iHost.ProtocolPresenceDataHost().AuthorizationDataHost().HandlePresenceBlockListL( objCollection );
+            CleanupStack::Pop( objCollection );
+            CleanupStack::PopAndDestroy(); // array
+            break;
+            }
+        case CXIMPTestFileSrvMsg::ETestSrvMsgPresenceBlocked:
+            {
+            CPresenceBlockInfoImp* infoFromServer =
+                                CPresenceBlockInfoImp::NewLC();
+            TXIMPObjectPacker<CPresenceBlockInfoImp>::UnPackL(
+                                    *infoFromServer, aCommand );
+            iHost.ProtocolPresenceDataHost().AuthorizationDataHost().HandlePresenceBlockedL( infoFromServer );
+            CleanupStack::Pop( infoFromServer );
+            break;
+            }
+        case CXIMPTestFileSrvMsg::ETestSrvMsgPresenceBlockCanceled:
+            {
+            CXIMPIdentityImp* idFromServer = CXIMPIdentityImp::NewLC();
+            TXIMPObjectPacker<CXIMPIdentityImp>::UnPackL( *idFromServer,
+                                                            aCommand );
+
+            iHost.ProtocolPresenceDataHost().AuthorizationDataHost().HandlePresenceBlockCanceledL( idFromServer );
+
+            CleanupStack::Pop( idFromServer );
+            break;
+            }
+
+        case CXIMPTestFileSrvMsg::ETestSrvMsgReqParamIdentity:
+            {
+            CXIMPIdentityImp* groupId = CXIMPIdentityImp::NewLC();
+            TXIMPObjectPacker< CXIMPIdentityImp >::UnPackL( *groupId, aCommand );
+            CXIMPRestrictedObjectCollectionImp* paramCollection = CXIMPRestrictedObjectCollectionImp::NewLC();
+            paramCollection->AddOrReplaceTypeL( groupId );
+            iMessenger.SetReqCompleteParams( paramCollection );
+            CleanupStack::Pop( 2, groupId );
+            break;
+            }
+        default:
+            {
+            User::Panic( _L( "Not valid commandtype" ), 59 );
+            break;
+            }
+        }
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/testcaseutils/prfwtestfilelogichelper.h	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  Test support file tool
+ *
+*/
+
+
+#ifndef CPRFWTESTFILELOGICHELPER_H
+#define CPRFWTESTFILELOGICHELPER_H
+
+#include <e32base.h>
+#include "prfwtestfileobserver.h"
+
+class MXIMPProtocolConnectionHost;
+class CXIMPTestMessenger;
+
+/**
+ * @since S60 v4.0
+ */
+class CXIMPTestFileLogicHelper : public CBase, public MXIMPTestFileObserver
+    {
+    public:
+
+        IMPORT_C static CXIMPTestFileLogicHelper* NewL( MXIMPProtocolConnectionHost& aHost, CXIMPTestMessenger& aMessenger  );
+        virtual ~CXIMPTestFileLogicHelper();
+
+    private:
+
+        CXIMPTestFileLogicHelper( MXIMPProtocolConnectionHost& aHost, CXIMPTestMessenger& aMessenger );
+        void ConstructL();
+
+    public:
+
+
+    private: // From MXIMPTestFileObserver
+
+        /**
+         * @see MXIMPTestFileObserver
+         */
+        virtual void HandleL( TInt aCommandType, TDesC8& aCommand );
+
+    private: // data
+
+        /**
+         * Access to host for server messages.
+         */
+        MXIMPProtocolConnectionHost& iHost;
+        
+        /**
+         * Does not own. Messenger for signaling.
+         */
+        CXIMPTestMessenger& iMessenger;
+    };
+
+#endif // CPRFWTESTFILELOGICHELPER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/testcaseutils/prfwtestfileobserver.h	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  Test support file tool
+ *
+*/
+
+
+#ifndef MPRFWTESTFILEOBSERVER_H
+#define MPRFWTESTFILEOBSERVER_H
+
+/**
+ * @since S60 v4.0
+ */
+class MXIMPTestFileObserver
+    {
+    protected:
+
+        /**
+         * Cannot be deleted through this interface
+         */
+        virtual ~MXIMPTestFileObserver(){}
+
+    public: // Interface
+
+        virtual void HandleL( TInt aCommandType, TDesC8& aCommand ) = 0;
+
+    };
+
+#endif // CPRFWTESTFILELOGICHELPER_H
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/testcaseutils/prfwtestfilesrvmsg.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,149 @@
+/*
+* 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:  Test support file tool server message
+ *
+*/
+
+
+
+#include <e32std.h>
+#include <f32file.h>
+#include <s32file.h>
+
+#include "prfwtestfilesrvmsg.h"
+
+// ======== LOCAL FUNCTIONS ========
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// ?description_if_needed
+// ---------------------------------------------------------------------------
+//
+CXIMPTestFileSrvMsg::CXIMPTestFileSrvMsg()
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// ?description_if_needed
+// ---------------------------------------------------------------------------
+//
+void CXIMPTestFileSrvMsg::ConstructL()
+    {
+    iPayload = HBufC8::NewL(0);
+    }
+
+
+// ---------------------------------------------------------------------------
+// ?description_if_needed
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CXIMPTestFileSrvMsg* CXIMPTestFileSrvMsg::NewLC()
+    {
+    CXIMPTestFileSrvMsg* self = new( ELeave ) CXIMPTestFileSrvMsg();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// ?description_if_needed
+// ---------------------------------------------------------------------------
+//
+void CXIMPTestFileSrvMsg::ConstructL( const TDesC8& aPayload )
+    {
+    iPayload = aPayload.AllocL();
+    }
+
+// ---------------------------------------------------------------------------
+// ?description_if_needed
+// ---------------------------------------------------------------------------
+//
+CXIMPTestFileSrvMsg::CXIMPTestFileSrvMsg( TInt aSrvMsgId ) :
+    iSrvMsgId( aSrvMsgId )
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// ?description_if_needed
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CXIMPTestFileSrvMsg* CXIMPTestFileSrvMsg::NewL(
+        TInt aSrvMsgId,
+        const TDesC8& aPayload )
+    {
+    CXIMPTestFileSrvMsg* self = new( ELeave ) CXIMPTestFileSrvMsg( aSrvMsgId );
+    CleanupStack::PushL( self );
+    self->ConstructL( aPayload );
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// ?description_if_needed
+// ---------------------------------------------------------------------------
+//
+CXIMPTestFileSrvMsg::~CXIMPTestFileSrvMsg()
+    {
+    delete iPayload;
+    }
+
+// ---------------------------------------------------------------------------
+// ?description_if_needed
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CXIMPTestFileSrvMsg::ExternalizeL( RWriteStream& aStream ) const
+    {
+    aStream.WriteUint32L( iSrvMsgId );
+    aStream.WriteUint32L( iPayload->Length() );
+    aStream.WriteL( *iPayload );
+    }
+        
+// ---------------------------------------------------------------------------
+// ?description_if_needed
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CXIMPTestFileSrvMsg::InternalizeL( RReadStream& aStream )
+    {
+    iSrvMsgId = aStream.ReadUint32L();
+    TInt len = aStream.ReadUint32L();
+
+    HBufC8* buffer = HBufC8::NewLC( len );
+    TPtr8 ptr = buffer->Des();
+    aStream.ReadL( ptr, len );
+
+    delete iPayload;
+    CleanupStack::Pop( buffer );
+    iPayload = buffer;   
+    }
+        
+// ---------------------------------------------------------------------------
+// ?description_if_needed
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TDesC8& CXIMPTestFileSrvMsg::PayloadL()
+    {
+    return *iPayload;
+    }
+        
+// ---------------------------------------------------------------------------
+// ?description_if_needed
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CXIMPTestFileSrvMsg::SrvMsgId()
+    {
+    return iSrvMsgId;
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/testcaseutils/prfwtestfilesrvmsg.h	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  Test support file tool server message
+ *
+*/
+
+
+#ifndef CPRFWTESTFILESRVMSG_H
+#define CPRFWTESTFILESRVMSG_H 
+
+#include <e32base.h>
+#include <s32strm.h>
+
+/**
+ * Support for servermessage files.
+ *
+ * @since S60 v4.0
+ */
+class CXIMPTestFileSrvMsg : public CBase
+    {
+    public:
+    
+        enum TTestSrvMsgType
+            {
+            ETestSrvMsgPresenceBlockList,
+            ETestSrvMsgPresenceBlocked,
+            ETestSrvMsgPresenceBlockCanceled,
+            ETestSrvMsgPresenceGrantRequestList,
+            ETestSrvMsgPresenceGrantRequestReceived,
+            ETestSrvMsgPresenceGrantRequestObsoleted,
+            ETestSrvMsgPresentityGroupList,
+            ETestSrvMsgPresentityGroupCreate,
+            ETestSrvMsgPresentityGroupDelete,
+            ETestSrvMsgPresentityGroupUpdate,
+            ETestSrvMsgPresentityGroupMemberList,
+            ETestCheckIfGroupMemberExists,
+            ETestSrvMsgPresenceWatcherList,
+            ETestSrvMsgPresentityPresence,
+            ETestSrvMsgReqParamIdentity,
+            };
+    
+    public:
+
+        IMPORT_C static CXIMPTestFileSrvMsg* NewLC();
+        
+        IMPORT_C static CXIMPTestFileSrvMsg* NewL( 
+                TInt aSrvMsgId,
+                const TDesC8& aPayload );
+        
+        virtual ~CXIMPTestFileSrvMsg();
+
+    private:
+
+        CXIMPTestFileSrvMsg();
+
+        void ConstructL();
+        
+        CXIMPTestFileSrvMsg( TInt aSrvMsgId );
+        
+        void ConstructL( const TDesC8& aPayload );
+
+    public:
+
+        /**
+         * Extenalizes object data to given stream.
+         * @param aStream Stream to write.
+         */
+        IMPORT_C void ExternalizeL( RWriteStream& aStream ) const;
+
+        /**
+         * Internalizes object data from given stream.
+         * @param aStream Stream to read.
+         */
+        IMPORT_C void InternalizeL( RReadStream& aStream );
+
+        /**
+         * Getter for the data stored inside this class.
+         * @return Reference to the data
+         */
+        IMPORT_C TDesC8& PayloadL();
+
+        /**
+         * Server message identifier specifies what kind of
+         * server-originated message this is.
+         * @return Server message identifier
+         */
+        IMPORT_C TInt SrvMsgId();
+
+    private: // data
+
+        TInt iSrvMsgId;
+        HBufC8* iPayload;
+    };
+
+#endif // CPRFWTESTFILESRVMSG_H 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/testcaseutils/prfwtestfiletool.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,502 @@
+/*
+* 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:  Test support file tool
+ *
+*/
+
+
+
+#include <e32std.h>
+#include <f32file.h>
+#include <s32file.h>
+
+#include "prfwtestfiletool.h"
+#include "prfwtestfilesrvmsg.h"
+#include "ximpeventcodec.h"
+#include "prfwtestfileobserver.h"
+
+/* Hierarchy under C:/temp/prfw/:
+ * /protocoluid/instancenumber/Plugin\
+ * /protocoluid/instancenumber/SrvMsg\
+ */
+
+_LIT( KFileToolMainDirFull, "c:\\temp\\prfw" );
+
+_LIT( KFileToolBackslash, "\\" );
+_LIT( KFileToolDirUid, "%d" );
+_LIT( KInstanceAsNumber, "%d" );
+
+_LIT( KFileToolPluginDirBase, "Plugin" );
+_LIT( KFileToolSrvDirBase, "SrvMsg" );
+
+_LIT( KFileToolWildcard, "file*.prfw" );
+_LIT( KFileToolFileBase, "file%d.prfw" );
+
+// ======== LOCAL FUNCTIONS ========
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// ?description_if_needed
+// ---------------------------------------------------------------------------
+//
+CXIMPTestFileTool::CXIMPTestFileTool( TUint32 aUid ) :
+    iUid( aUid )
+    {
+    iFs.Connect();
+    }
+
+// ---------------------------------------------------------------------------
+// ?description_if_needed
+// ---------------------------------------------------------------------------
+//
+void CXIMPTestFileTool::ConstructL( const TDesC16& aInstanceId )
+    {
+    iTimer = CPeriodic::NewL( CActive::EPriorityStandard );
+    iInstance = aInstanceId.AllocL();
+    }
+
+// ---------------------------------------------------------------------------
+// ?description_if_needed
+// ---------------------------------------------------------------------------
+//
+void CXIMPTestFileTool::ConstructL( TInt aInstanceIdAsNum )
+    {
+    TInt instanceLength = NumLenInChars( aInstanceIdAsNum );
+    HBufC* instance = HBufC::NewLC( instanceLength );
+    instance->Des().AppendFormat( KInstanceAsNumber, aInstanceIdAsNum );
+    ConstructL( *instance );
+    CleanupStack::PopAndDestroy( instance );
+    }
+
+// ---------------------------------------------------------------------------
+// ?description_if_needed
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CXIMPTestFileTool* CXIMPTestFileTool::NewL( TUint32 aUid, const TDesC16& aInstanceId )
+    {
+    CXIMPTestFileTool* self = new( ELeave ) CXIMPTestFileTool( aUid );
+    CleanupStack::PushL( self );
+    self->ConstructL( aInstanceId );
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// ?description_if_needed
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CXIMPTestFileTool* CXIMPTestFileTool::NewL( TUint32 aUid, TInt aInstanceIdAsNum )
+    {
+    CXIMPTestFileTool* self = new( ELeave ) CXIMPTestFileTool( aUid );
+    CleanupStack::PushL( self );
+    self->ConstructL( aInstanceIdAsNum );
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+
+// ---------------------------------------------------------------------------
+// ?description_if_needed
+// ---------------------------------------------------------------------------
+//
+CXIMPTestFileTool::~CXIMPTestFileTool()
+    {
+    iFs.Close();
+    if ( iTimer )
+        {
+        iTimer->Deque();
+        }
+    delete iTimer;
+    iObservers.Close();
+    delete iInstance;
+    }
+
+// ---------------------------------------------------------------------------
+// Remove the entire prfw directory 
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CXIMPTestFileTool::CleanAllL()
+    {
+    RFs fs;
+    fs.Connect();
+    CleanupClosePushL( fs );
+
+    CFileMan* fileMan = CFileMan::NewL( fs );
+    CleanupStack::PushL( fileMan );
+
+    // remove the files and the directory
+    fileMan->RmDir( KFileToolMainDirFull );
+
+    CleanupStack::PopAndDestroy( 2 );  // fileman, fs
+    }
+
+// ---------------------------------------------------------------------------
+// Prepare everything, after this objects can be externalized and
+// internalized
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CXIMPTestFileTool::PrepareL()
+    {
+    // create the directory structure
+    HBufC* dirName = GetDirNameAndBackslashLC( KFileToolPluginDirBase );
+    iFs.MkDirAll( *dirName );
+    CleanupStack::PopAndDestroy( dirName );
+    
+    dirName = GetDirNameAndBackslashLC( KFileToolSrvDirBase );
+    iFs.MkDirAll( *dirName );
+    CleanupStack::PopAndDestroy( dirName );
+    }
+
+// ---------------------------------------------------------------------------
+// Write the file to correct directory.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CXIMPTestFileTool::PluginStoreL( const TDesC8& aExternalizedObject )
+    {
+    HBufC* fileName = GetFileNameLC( 
+            KFileToolPluginDirBase,
+            iObjIndex );
+
+    RFileWriteStream out;
+    CleanupClosePushL( out );
+    out.Create( iFs, *fileName, EFileWrite|EFileStream|EFileShareAny );
+
+    // write the file
+    TUint32 len = aExternalizedObject.Length();
+    out.WriteUint32L( len );
+    out.WriteL( aExternalizedObject );
+    CleanupStack::PopAndDestroy(); // out
+
+    CleanupStack::PopAndDestroy( fileName ); // fileName
+
+    // next file will have a new index
+    iObjIndex++;
+    }
+
+// ---------------------------------------------------------------------------
+// Restore the file from given directory and given index
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CXIMPApiEventBase* CXIMPTestFileTool::PluginRestoreLC(
+        TInt aObjIndex )
+    {
+    HBufC* fileName = GetFileNameLC( 
+            KFileToolPluginDirBase, 
+            aObjIndex );
+
+    // try to instantiate it
+    RFileReadStream in;
+    CleanupClosePushL( in );
+
+    in.Open( iFs, *fileName, EFileStream );
+    TInt len = in.ReadUint32L();
+    HBufC8* buffer = HBufC8::NewLC( len );
+    TPtr8 ptr = buffer->Des();
+    in.ReadL( ptr );
+
+    // instantiate the object
+    TInt32 dummy = 0;
+    CXIMPApiEventBase* object = XIMPEventCodec::UnPackL( *buffer, dummy );
+
+    CleanupStack::PopAndDestroy( 2 ); // buffer, in
+
+    // delete the just read object
+    iFs.Delete( *fileName );
+
+    CleanupStack::PopAndDestroy( fileName );
+
+    CleanupStack::PushL( object );
+    return object;
+    }
+
+// ---------------------------------------------------------------------------
+// Write the server message object to correct directory.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CXIMPTestFileTool::SrvMsgStoreL( 
+        CXIMPTestFileSrvMsg* aSrvMsg )
+    {
+    TInt nextObjIndex = NumSrvMsgL();
+    HBufC* fileName = GetFileNameLC( 
+            KFileToolSrvDirBase,
+            nextObjIndex);
+
+    RFileWriteStream out;
+    CleanupClosePushL( out );
+    TInt retVal = out.Create( iFs, *fileName, EFileWrite|EFileStream|EFileShareAny );
+    User::LeaveIfError( retVal );
+
+    aSrvMsg->ExternalizeL( out );
+    
+    CleanupStack::PopAndDestroy( 2, fileName ); // out, fileName
+
+    // next file will have a new index
+    //iSrvObjIndex++;
+    }
+
+// ---------------------------------------------------------------------------
+// Restore the file from given directory and given index
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CXIMPTestFileSrvMsg* CXIMPTestFileTool::SrvMsgRestoreLC(
+        TInt aObjIndex )
+    {
+    CXIMPTestFileSrvMsg* msg = CXIMPTestFileSrvMsg::NewLC();
+
+    HBufC* fileName = GetFileNameLC( 
+            KFileToolSrvDirBase, 
+            aObjIndex );
+
+    // try to instantiate it
+    RFileReadStream in;
+    CleanupClosePushL( in );
+
+    in.Open( iFs, *fileName, EFileStream );
+
+    msg->InternalizeL( in ); 
+
+    CleanupStack::PopAndDestroy(); // in
+
+    // delete the just read object
+    iFs.Delete( *fileName );
+
+    CleanupStack::PopAndDestroy( fileName ); // fileName
+    return msg;
+    }
+
+// ---------------------------------------------------------------------------
+// Common file counting helper
+// ---------------------------------------------------------------------------
+//
+TInt CXIMPTestFileTool::DoNumObjectsL( const TDesC& aTemplate )
+    {
+    CDir* dir = GetDirListL( aTemplate );
+    TInt count = dir->Count();
+    delete dir;
+    return count;
+    }
+
+// ---------------------------------------------------------------------------
+// Number of objects (files) in a given directory
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CXIMPTestFileTool::NumObjectsL()
+    {
+    return DoNumObjectsL( KFileToolPluginDirBase );
+    }
+
+// ---------------------------------------------------------------------------
+// Number of server-originated objects (files) in a given directory
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CXIMPTestFileTool::NumSrvMsgL()
+    {
+    // returns the number of objects in the directory
+    // get file listing and derive the count from that
+    return DoNumObjectsL( KFileToolSrvDirBase );
+    }
+
+// ---------------------------------------------------------------------------
+// Instace id
+// ---------------------------------------------------------------------------
+//
+EXPORT_C const TDesC16& CXIMPTestFileTool::InstanceId() const
+    {
+    return *iInstance;
+    }
+    
+// ---------------------------------------------------------------------------
+// Length of number in characters (e.g. 501 --> 3)
+// ---------------------------------------------------------------------------
+//
+TInt CXIMPTestFileTool::NumLenInChars( TInt aNum )
+    {
+    TInt len = 0;
+    TInt tmp = aNum;
+    do
+        {
+        tmp /= 10;  // number is base-10
+        len++;
+        }
+    while ( tmp > 0 );
+    return len;
+    }
+
+// ---------------------------------------------------------------------------
+// Gets properly expanded directory name with backslash appended
+// ---------------------------------------------------------------------------
+//
+HBufC* CXIMPTestFileTool::GetDirNameAndBackslashLC( 
+        const TDesC& aTemplate )
+    {
+    TInt uidLength = NumLenInChars( iUid );
+    TInt instanceLength = iInstance->Length();
+
+    HBufC* dirName = HBufC::NewLC( 
+            KFileToolMainDirFull().Length()
+            + KFileToolBackslash().Length()
+            + KFileToolDirUid().Length()
+            -2  // "%d" gets modified to be the number
+            + KFileToolBackslash().Length()
+            + uidLength + instanceLength
+            + KFileToolBackslash().Length()
+            + aTemplate.Length()
+            + KFileToolBackslash().Length() // added for later use by GetDirNameAndBackslashLC.
+            );
+
+    dirName->Des().Append( KFileToolMainDirFull );
+    dirName->Des().Append( KFileToolBackslash );
+    dirName->Des().AppendFormat( KFileToolDirUid, iUid );
+    dirName->Des().Append( KFileToolBackslash );
+    dirName->Des().Append( *iInstance );
+    dirName->Des().Append( KFileToolBackslash );
+    dirName->Des().Append( aTemplate );
+    
+    dirName->Des().Append( KFileToolBackslash );
+    iFs.MkDirAll( *dirName );
+    return dirName;
+    }
+
+// ---------------------------------------------------------------------------
+// Get full path wildcard for files residing in a directory
+// with given index
+// ---------------------------------------------------------------------------
+//
+HBufC* CXIMPTestFileTool::GetWildcardLC( 
+        const TDesC& aDirTemplate )
+    {
+    HBufC* dirName = GetDirNameAndBackslashLC( aDirTemplate );
+    HBufC* wildcard = HBufC::NewLC(
+            dirName->Length() + KFileToolWildcard().Length() );
+    wildcard->Des().Append( *dirName );
+    wildcard->Des().Append( KFileToolWildcard );
+
+    CleanupStack::Pop( 2 ); // wildcard, dirName
+    delete dirName;
+
+    CleanupStack::PushL( wildcard );
+    return wildcard;
+    }
+
+// ---------------------------------------------------------------------------
+// Get a list of files in a given directory
+// ---------------------------------------------------------------------------
+//
+CDir* CXIMPTestFileTool::GetDirListL( const TDesC& aTemplate )
+    {
+    HBufC* wildcard = GetWildcardLC( aTemplate );
+
+    CDir* dirList = NULL;
+    iFs.GetDir( *wildcard, KEntryAttNormal, ESortByName, dirList );
+    CleanupStack::PopAndDestroy( wildcard );
+
+    return dirList;
+    }
+
+// ---------------------------------------------------------------------------
+// Get fully qualified file name
+// ---------------------------------------------------------------------------
+//
+HBufC* CXIMPTestFileTool::GetFileNameLC( 
+        const TDesC& aDirTemplate,
+        TInt aObjIndex )
+    {
+    // create file name
+    HBufC* dirName = GetDirNameAndBackslashLC( aDirTemplate );
+
+    TInt numLen = NumLenInChars( aObjIndex );
+    HBufC* fileName = HBufC::NewLC(
+            dirName->Length()
+            + KFileToolFileBase().Length()
+            + numLen
+            - 2  // "%d" gets modified to be the number
+            );
+    fileName->Des().Append( *dirName );
+    fileName->Des().AppendFormat( KFileToolFileBase, aObjIndex );
+
+    CleanupStack::Pop( fileName );
+    CleanupStack::PopAndDestroy( dirName );
+    CleanupStack::PushL( fileName );
+
+    // now we have the filename
+    return fileName;
+    }
+
+const TInt KSecond = 1000000;
+
+// ---------------------------------------------------------------------------
+// CXIMPTestFileTool::RegisterObserverL
+// ---------------------------------------------------------------------------
+//
+void CXIMPTestFileTool::RegisterObserverL( MXIMPTestFileObserver* aObserver )
+    {    
+    iObservers.AppendL( aObserver );
+    if( !iTimer->IsActive() )
+        {
+        TCallBack callback( Process, this );
+        iTimer->Start( KSecond, KSecond, callback );
+        }        
+    }
+    
+// ---------------------------------------------------------------------------
+// CXIMPTestFileTool::UnregisterObserver
+// ---------------------------------------------------------------------------
+//
+void CXIMPTestFileTool::UnregisterObserver( MXIMPTestFileObserver* aObserver )
+    {    
+    TInt index = iObservers.Find( aObserver );
+    if( index != KErrNotFound )
+        {
+        iObservers.Remove( index );
+        }
+    if( iObservers.Count() == 0 )
+        {
+        iTimer->Cancel();
+        }
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPTestFileTool::RunL
+// ---------------------------------------------------------------------------
+//
+TInt CXIMPTestFileTool::Process( TAny* aMyself )
+    {
+    TRAPD( ignore, ( static_cast< CXIMPTestFileTool* >( aMyself ) )->DoProcessL() );
+    return 0; // ignored by CPeriodic
+    }
+
+// ---------------------------------------------------------------------------
+// CXIMPTestFileTool::RunL
+// ---------------------------------------------------------------------------
+//
+void CXIMPTestFileTool::DoProcessL()
+    {
+    TInt countOfSrvMsg = NumSrvMsgL();
+    TInt countOfObservers = iObservers.Count();
+    
+    for( TInt a = 0; a < countOfSrvMsg; ++a )
+        {
+        CXIMPTestFileSrvMsg* newMsg = SrvMsgRestoreLC( a );
+        for( TInt b = 0;b < countOfObservers; ++b )
+            {
+            iObservers[ b ]->HandleL( newMsg->SrvMsgId(), newMsg->PayloadL() );
+            }
+        CleanupStack::PopAndDestroy( newMsg );
+        }
+    }
+
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/testcaseutils/prfwtestfiletool.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,199 @@
+/*
+* 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:  Test support file tool
+ *
+*/
+
+
+#ifndef CPRFWTESTFILETOOL_H
+#define CPRFWTESTFILETOOL_H 
+
+#include <e32base.h>
+#include <ximpbase.h>
+
+class CXIMPApiEventBase;
+class CXIMPTestFileSrvMsg;
+class MXIMPTestFileObserver;
+
+/**
+ * File support for tests.
+ * Support functions for externalizing a class to a known directory and
+ * retrieving the classes.
+ *
+ * This is a sort of "pseudo-IPC" from the test protocol (ecom plugin)
+ * to EUnit test code. A server could also be used, but this is faster
+ * to do and simpler.
+ *
+ * @since S60 v4.0
+ */
+class CXIMPTestFileTool : public CBase
+    {
+    public:
+
+        IMPORT_C static CXIMPTestFileTool* NewL( TUint32 aUid, const TDesC16& aInstanceId );
+        IMPORT_C static CXIMPTestFileTool* NewL( TUint32 aUid, TInt aInstanceIdAsNum );
+        virtual ~CXIMPTestFileTool();
+
+    private:
+
+        CXIMPTestFileTool( TUint32 aUid );
+        void ConstructL( const TDesC16& aInstanceId );
+        void ConstructL( TInt aInstanceIdAsNum );
+
+    public:
+
+        /**
+         * Clean all files from the filetool directory.
+         * Remove also the directory itself.
+         * Removes EVERYTHING from ALL DIRECTORIES used
+         * by filetool!!! So don't call it everytime, only once
+         * upon test case startup.
+         */
+        IMPORT_C static void CleanAllL();
+
+        /**
+         * Prepares for writing only the directory used by this
+         * filetool instance
+         */
+        IMPORT_C void PrepareL();
+
+        /**
+         * Store the object to file.
+         * The given descriptor is externalized as given,
+         * with the length of the descriptor written first,
+         * as a 32-bit TUint:
+         * <length of descriptor 32-bit><descriptor data>
+         * @param aExternalizedObject The externalized object
+         */
+        IMPORT_C void PluginStoreL( const TDesC8& aExternalizedObject );
+        
+        /**
+         * Restore a stored object from file.
+         * Ownership is transferred!
+         * @param aObjIndex The index for the object
+         */
+        IMPORT_C CXIMPApiEventBase* PluginRestoreLC( TInt aObjIndex );
+        
+        /**
+         * Store the object to file. (SERVER MESSAGE)
+         * The given descriptor is externalized as given,
+         * with the length of the descriptor written first,
+         * as a 32-bit TUint:
+         * <length of descriptor 32-bit><descriptor data>
+         * @param aExternalizedObject The externalized object
+         */
+        IMPORT_C void SrvMsgStoreL( CXIMPTestFileSrvMsg* aSrvMsg );
+        
+        /**
+         * Restore a stored object from file. (SERVER MESSAGE)
+         * Ownership is transferred!
+         * @param aIndex The index for the object
+         */
+        IMPORT_C CXIMPTestFileSrvMsg* SrvMsgRestoreLC( TInt aIndex );
+
+        /**
+         * Return the number of objects currently stored in the directory.
+         */
+        IMPORT_C TInt NumObjectsL();
+        
+        /**
+         * Return the number of objects depicting server-originated
+         * message currently stored in the directory.
+         */
+        IMPORT_C TInt NumSrvMsgL();
+        
+        /**
+         * @return Instance id
+         */
+        IMPORT_C const TDesC16& InstanceId() const;
+
+    private:
+
+        /**
+         * @return The directory name (with backslash)
+         * (E.g. "C:/temp/prfw/1234/0/SrvMsg/")
+         */
+        HBufC* GetDirNameAndBackslashLC( 
+                const TDesC& aTemplate );
+
+        /**
+         * @return Wildcard for file deletion 
+         * (E.g. "C:/temp/prfw/1234/0/SrvMsg/file*.prfw")
+         * @param aDirTemplate The directory template for the wildcard
+         */
+        HBufC* GetWildcardLC( 
+                const TDesC& aDirTemplate );
+
+        /**
+         * Get the full file name, properly expanded.
+         * @param aDirTemplate The template for the dirs
+         * @param aObjIndex The object index
+         */
+        HBufC* GetFileNameLC( 
+                const TDesC& aDirTemplate,
+                TInt aObjIndex );
+
+        /**
+         * @return Length of the given number as if it were a string.
+         * @param aNum The number
+         */
+        TInt NumLenInChars( TInt aNum );
+
+        /**
+         * @return Listing of the directory
+         * @param aTemplate The wildcard template for the files
+         */
+        CDir* GetDirListL( const TDesC& aTemplate );
+        
+        /**
+         * Common helper for NumObjects methods.
+         */
+        TInt DoNumObjectsL( const TDesC& aTemplate );
+        
+        /**
+         *
+         */
+        static TInt Process( TAny* aMyself );
+        void DoProcessL();
+        
+    public:
+      
+        /**
+         * Observer registration
+         */
+        void RegisterObserverL( MXIMPTestFileObserver* aObserver );        
+        void UnregisterObserver( MXIMPTestFileObserver* aObserver );
+        
+        
+    private: // data
+
+        TUint32 iUid;       // protocoluid
+        HBufC16* iInstance;     // the global instance id
+
+        TInt iObjIndex;     // object index for created objects
+        TInt iSrvObjIndex;  // object index for created srvmsg objects
+        RFs iFs;
+        
+        
+        /**
+         * Monitor on when there is observers. 
+         * Call HandleL for observers for every new file.         
+         */
+        RPointerArray< MXIMPTestFileObserver > iObservers;
+        
+        // timer
+        CPeriodic* iTimer;        
+    };
+
+#endif // CPRFWTESTFILETOOL_H 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/testcaseutils/prfwtestlistener.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,280 @@
+/*
+* 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:
+*
+*/
+
+#include "prfwtestlistener.h"
+#include "prfwtestcaseutilspanics.h"
+#include "prfwgeneralwaiter.h"
+
+#include <eunitmacros.h>
+#include <ximpcontextstateevent.h>
+#include <ximprequestcompleteevent.h>
+#include <ximpstatus.h>
+#include <presentitypresenceevent.h>
+#include <presentitygrouplistevent.h>
+#include <presentitygroupcontentevent.h>
+#include <presenceinfo.h>
+
+#include <ximpbase.h>
+#include "ximpapiobjbase.h"
+#include "ximpapieventbase.h"
+
+
+using namespace NXIMPTestCaseUtilsPanic;
+
+const TInt KWaitAfterEvents = 2;
+
+// ============================ MEMBER FUNCTIONS ===============================
+EXPORT_C CXIMPTestListener* CXIMPTestListener::NewL(
+        MXIMPContext* aEventSource )
+    {
+    CXIMPTestListener* self = new (ELeave) CXIMPTestListener( aEventSource );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+
+CXIMPTestListener::~CXIMPTestListener()
+    {
+    if( iEventSource )
+        {
+        iEventSource->UnregisterObserver( *this );
+        }
+
+    iDescription.Close();
+
+    if ( iWait.IsStarted() )
+        {
+        iWait.AsyncStop();
+        }
+    }
+
+
+CXIMPTestListener::CXIMPTestListener( MXIMPContext* aEventSource ) :
+    iEventSource( aEventSource )
+    {
+    }
+
+
+void CXIMPTestListener::ConstructL()
+    {
+    if( iEventSource )
+        {
+        iEventSource->RegisterObserverL( *this, NULL );
+        }
+
+    iDescription.CreateL( 512 );
+    }
+
+
+// ===========================================================================
+// PUBLIC FUNCTIONS
+// ===========================================================================
+//
+EXPORT_C void CXIMPTestListener::SetEventSourceL(
+        MXIMPContext* aEventSource )
+    {
+    if( iEventSource )
+        {
+        iEventSource->UnregisterObserver( *this );
+        }
+
+    if( aEventSource )
+        {
+        aEventSource->RegisterObserverL( *this, NULL );
+        }
+
+    iEventSource = aEventSource;
+    }
+
+// clear the stack
+EXPORT_C void CXIMPTestListener::Reset()
+    {
+    iEventStack.ResetAndDestroy();
+    }
+
+// expect the given event
+EXPORT_C void CXIMPTestListener::ExpectL( CXIMPApiObjBase* aEvent )
+    {
+    iEventStack.AppendL( aEvent );
+
+    iDescription.Zero();
+    iDescription.AppendFormat( _L8("Eventstack has [%d] items."), iEventStack.Count() );
+    EUNIT_PRINT( iDescription );
+    }
+
+// wait for req complete and events (must come in the given order!)
+EXPORT_C TInt CXIMPTestListener::WaitAndAssertL()
+    {
+    __ASSERT_ALWAYS( !iWait.IsStarted(),
+            Panic( EStatusEventListenerAlreadyWaiting ) );
+
+    iCoolDownActive = EFalse;
+    iError = KErrNone;
+    iReceivedEventCount = 0;
+    iWait.Start();
+
+    // start a timer to catch excess events, 2 seconds should
+    // be enough. such events are caught by DoHandleEventL and printed.
+    // if any events arrived, iError will be set.
+
+    iCoolDownActive = ETrue;
+    CXIMPTestGeneralWaiter* waiter = CXIMPTestGeneralWaiter::NewL( this );
+    CleanupStack::PushL( waiter );
+    waiter->WaitForL( KWaitAfterEvents );
+    iWait.Start();
+
+    // waiter callback will have ended the wait
+    CleanupStack::PopAndDestroy( waiter );
+
+    return iError;
+    }
+
+// the event observer where to pass the events
+EXPORT_C void CXIMPTestListener::SetEventObserver( MXIMPContextObserver* aObserver )
+    {
+    iObserver = aObserver;
+    }
+
+// ===========================================================================
+// FROM MPRFWPRESENCECONTEXTOBSERVER
+// ===========================================================================
+//
+void CXIMPTestListener::DoHandlePresenceContextEventL(
+    const MXIMPContext& aContext,
+    const MXIMPBase& aEvent )
+    {
+    const TInt32 eventType = aEvent.GetInterfaceId();
+
+    __ASSERT_ALWAYS( iEventSource == &aContext,
+            Panic( EReceivingEventFromWrongContext ) );
+
+    if( iObserver )
+        {
+        // give the event to the observer, if any, at the earliest possible
+        // phase
+        iObserver->HandlePresenceContextEvent( aContext, aEvent );
+
+        // XXX should this be done when cool-down is active?
+        }
+
+    if ( iCoolDownActive )
+    {
+        iDescription.Zero();
+        iDescription.AppendFormat( _L8("Excess event with interface id [%d]"), aEvent.GetInterfaceId() );
+        EUNIT_PRINT( iDescription );
+
+        iError = KErrGeneral;
+
+        // just ignore it
+        return;
+    }
+
+    iDescription.Zero();
+    iDescription.AppendFormat( _L8("Expecting event to stack pos [%d]"), iReceivedEventCount );
+    EUNIT_PRINT( iDescription );
+
+    // try to find the received event from the stack - the given stack must
+    // be in order
+    TBool found = EFalse;
+    TInt stackId = iEventStack[ 0 ]->Base().GetInterfaceId();
+    found = stackId == aEvent.GetInterfaceId();
+
+    if ( ! found )
+        {
+        // unexpected event
+        iDescription.Zero();
+        iDescription.AppendFormat( _L8("Expected interface id [%d], got [%d]"), stackId, aEvent.GetInterfaceId() );
+        EUNIT_PRINT( iDescription );
+
+        iDescription.Zero();
+        iDescription.AppendFormat( _L8("Received unexpected event at pos [%d]"), iReceivedEventCount );
+        EUNIT_PRINT( iDescription );
+
+        // get out
+        User::Leave( KErrGeneral );
+        }
+
+    // found the received event from the stack of expected events.
+    // remove the event from the stack of expected events, then handle it.
+    CXIMPApiEventBase* expected = ( CXIMPApiEventBase* ) iEventStack[ 0 ];
+    CleanupStack::PushL( expected );
+    iEventStack.Remove( 0 );
+
+    CXIMPApiEventBase* received = ( CXIMPApiEventBase* ) ( aEvent.GetInterface( XIMPIMP_CLSID_CXIMPAPIEVENTBASE, MXIMPBase::EPanicIfUnknown ) );
+
+    if ( ! expected->EqualsContent( *received ) )
+        {
+        // expected event mismatches with the received event
+        iDescription.Zero();
+        iDescription.AppendFormat( _L8("Received event with mismatching content at pos [%d]"), iReceivedEventCount );
+        EUNIT_PRINT( iDescription );
+
+        // get out
+        User::Leave( KErrGeneral );
+        }
+
+    CleanupStack::PopAndDestroy( expected );
+
+    iDescription.Zero();
+    iDescription.AppendFormat( _L8("Got correct event to stack pos [%d]"), iReceivedEventCount );
+    EUNIT_PRINT( iDescription );
+
+    // we've processed a received event successfully
+    iReceivedEventCount++;
+
+    if ( iEventStack.Count() <= 0 )
+        {
+        // no more events to expect
+        if( iWait.IsStarted() )
+            {
+            iWait.AsyncStop();
+            }
+        }
+    }
+    
+
+void CXIMPTestListener::HandlePresenceContextEvent( 
+    const MXIMPContext& aContext,
+    const MXIMPBase& aEvent )
+    {
+    TRAPD( err, DoHandlePresenceContextEventL( aContext, aEvent ) );
+
+    if ( err != KErrNone )
+        {
+        // something evil happened, stop async wait
+
+        iError = err;
+
+        if( iWait.IsStarted() )
+            {
+            iWait.AsyncStop();
+            }
+        }
+    }
+
+void CXIMPTestListener::WaitCompleted( TInt aRetVal )
+    {
+    if( iWait.IsStarted() )
+        {
+        iWait.AsyncStop();
+        }
+    }
+
+// end of file
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/testcaseutils/prfwtestlistener.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,152 @@
+/*
+* 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:
+*
+*/
+
+
+#ifndef CPRFWTESTLISTENER_H__
+#define CPRFWTESTLISTENER_H__
+
+
+#include <e32base.h>
+#include <ximpcontextobserver.h>
+#include <ximpcontext.h>
+
+#include "prfwwaitobserver.h"
+
+// CLASS DESCRIPTION
+class CXIMPApiObjBase;
+
+/**
+ * Presence test listener to record events
+ * and to wait request completion.
+ */
+class CXIMPTestListener : public CBase,
+    public MXIMPContextObserver,
+    public T_MWaitObserver
+    {
+    public:
+
+        /**
+         * Instantiates new listener object.
+         *
+         * If valid event source is given, reqisters this object as
+         * event observer to it.
+         */
+        IMPORT_C static CXIMPTestListener* CXIMPTestListener::NewL(
+                MXIMPContext* aEventSource );
+
+        ~CXIMPTestListener();
+
+    private:
+
+        CXIMPTestListener( MXIMPContext* aEventSource );
+
+        void ConstructL();
+
+    public:
+
+        /**
+         * Sets new event source from where to listen events.
+         * Unregisters from previous one.
+         * Can be NULL, in which case just performs the
+         * unregistration.
+         */
+        IMPORT_C void SetEventSourceL( MXIMPContext* aEventSource );
+
+        /**
+         * Clears the event trait template. After this call,
+         * you must call ExpectL to tell listener what events to expect.
+         */
+        IMPORT_C void Reset();
+
+        /**
+         * Add the given event to the list of expected events.
+         * The order of ExpectL calls is significant.
+         * Ownership of given event is transferred to this class.
+         * @param aEvent The event to expect
+         */
+        IMPORT_C void ExpectL( CXIMPApiObjBase* aEvent );
+
+        /**
+         * Method to wait with CActiveSchedulerWait
+         * a request complete, then any events which are expected.
+         * When all events are received, the method returns. If not all events
+         * come, the test case will timeout. If a wrong event or event with wrong
+         * data is received, the method will barf in EUNIT_ASSERT.
+         * 
+         * @return Error code, if any
+         */
+        IMPORT_C TInt WaitAndAssertL();
+
+        /**
+         * Forward the received events to the given event observer, if set.
+         * Set to NULL to disable forwarding.
+         * @param aObserver The observer 
+         */
+        IMPORT_C void SetEventObserver( MXIMPContextObserver* aObserver );
+
+    public:  // from T_MWaitObserver
+
+        void WaitCompleted( TInt aRetVal );
+
+    private:  //From MXIMPContextObserver
+
+        void HandlePresenceContextEvent(
+                const MXIMPContext& aContext,
+                const MXIMPBase& aEvent );
+
+        void DoHandlePresenceContextEventL(
+                const MXIMPContext& aContext,
+                const MXIMPBase& aEvent );
+
+
+    private: //Helpers
+
+    private:  //Data
+
+        //OWN: Active scheduler wait for waiting the completion
+        CActiveSchedulerWait    iWait;
+
+        //REF: Context from where receiving events
+        MXIMPContext* iEventSource;
+
+        //OWN: Description buffer to hold the failure description
+        mutable RBuf8 iDescription;
+
+        // To handle event by observer.
+        MXIMPContextObserver* iObserver;
+
+        // OWN: the event stack (and the objects)
+        RXIMPObjOwningPtrArray< CXIMPApiObjBase > iEventStack;
+
+        // current error state. WaitAndAssertL
+        // always clears the error
+        TInt iError;
+
+        // number of received events
+        TInt iReceivedEventCount;
+
+        // ETrue if we're doing a "cool-down" period, that is,
+        // we are waiting for any events which might come after
+        // we've successfully exhausted our stack of expected events.
+        // This is so that we can spot any excess events
+        // during testing.
+        TBool iCoolDownActive;
+    };
+
+#endif //CPRFWTESTLISTENER_H__
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/testcaseutils/prfwtestmessaging.h	Wed Nov 03 09:32:20 2010 +0530
@@ -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:
+*
+*/
+
+
+#ifndef T_PRFWTESTMESSAGING_H_
+#define T_PRFWTESTMESSAGING_H_
+
+#include <e32base.h>
+#include <e32property.h>
+
+// FIXME change this?
+// base UID for pubsub keys
+const TUid KXIMPTestPropertyCatBase = { 0x10012345 };
+
+enum TXIMPTestPropertyValues
+    {
+    // values for EXIMPPlgTestDeath
+    EXIMPPrtValPluginDeathEmpty = 0,
+    EXIMPPrtValPluginDeathDied = 1,
+
+    // values for EXIMPTestPlgSessionLostStrategy
+    EXIMPPrtValSessionLostEmpty = 0,
+    EXIMPPrtValSessionLostReconnect,
+    EXIMPPrtValSessionLostTeardown,
+    EXIMPPrtValSessionLostReconnectExhaustAttempts,
+
+    // values for EXIMPTestPlgBehaveGeneric
+    EXIMPPrtValBehaveNothing = 0,           // do nothing
+    };
+
+// pubsub keys
+enum TXIMPTestPropertyKeys
+    {
+    // meta things (message queue internal)
+    EXIMPTestMetaPubSubDefined,             // pubsub stuff has been defined (1)
+    EXIMPTestMetaPluginIndex,               // protocol plugin reads its index from this (-1=undefined)
+
+    // p = plugin, h = host, t = test code.
+    // direction also encoded into the property name
+
+    // Instructions for plugin behaviour (t->p).
+    // next call to plugin API method will cause the requested behavior (e.g. leave)
+    EXIMPTestPlgBehaveLeave,            // leave with given code
+    EXIMPTestPlgBehaveError,            // cause error with given code
+
+    // boolean valued
+    EXIMPTestPlgBehaveCloseHandle,      // abrupt close handle (1)
+    EXIMPTestPlgBehaveInvalidReqId,     // complete next call with invalid req. id (1)
+
+    // API method called -messages (p->t)
+    // value is boolean (set or unset, 1 or 0)
+    EXIMPPlgTestOpenSessionCalled,           // OpenSessionL
+    EXIMPPlgTestShareSessionCalled,          // ShareSessionL
+    EXIMPPlgTestUnshareSessionCalled,        // ShareSessionL
+    EXIMPPlgTestCloseSessionCalled,          // CloseSessionL
+    EXIMPPlgTestPublishPresenceCalled,       // PublishPresenceL
+    EXIMPPlgTestUpdateInterestCalled,        // UpdatePresenceInterestL
+    EXIMPPlgTestSubscribeOwnPresenceCalled,  // DoSubscribeOwnPresenceL
+    EXIMPPlgTestUnsubscribeOwnPresenceCalled, // DoUnsubscribeOwnPresenceL
+    EXIMPPlgTestUpdateOwnSubscriptionCalled, // DoUpdateOwnPresenceSubscriptionL
+    EXIMPPlgTestSubscribeGroupListCalled,    // DoSubscribePresentityGroupListL
+    EXIMPPlgTestUnsubscribeGroupListCalled,    // DoUnsubscribePresentityGroupListL
+    EXIMPPlgTestCreatePresentityGroupCalled, // DoCreatePresentityGroupL
+    EXIMPPlgTestDeletePresentityGroupCalled, // DoDeletePresentityGroupL
+    EXIMPPlgTestUpdatePresentityGroupDisplayNameCalled, // DoUpdatePresentityGroupDisplayNameL
+    EXIMPPlgTestSubscribePresentityPresesenceCalled,    // DoSubscribePresentityPresenceL
+    EXIMPPlgTestUpdatePresentityPresesenceCalled,       // DoUpdatePresentityPresenceSubscriptionL
+    EXIMPPlgTestUnsubscribePresentityPresesenceCalled,  // DoUnsubscribePresentityPresenceL
+    EXIMPPlgTestSubscribePresentityGroupMembersPresesenceCalled,    // DoSubscribePresentityGroupMembersPresenceL
+    EXIMPPlgTestUpdatePresentityGroupMembersPresesenceCalled,       // DoUpdatePresentityGroupMembersPresenceSubscriptionL
+    EXIMPPlgTestUnsubscribePresentityGroupMembersPresesenceCalled,  // DoUnsubscribePresentityGroupMembersPresenceL
+
+    EXIMPPlgTestSubscribePresentityGroupContentCalled,  // DoSubscribePresentityGroupContentL
+    EXIMPPlgTestUnsubscribePresentityGroupContentCalled,  // DoUnsubscribePresentityGroupContentL
+    EXIMPPlgTestAddPresentityGroupMemberCalled,  // DoAddPresentityGroupMemberL
+    EXIMPPlgTestRemovePresentityGroupMemberCalled,  // DoRemovePresentityGroupMemberL
+    EXIMPPlgTestUpdatePresentityGroupMemberDisplayNameCalled,  // DoUpdatePresentityGroupMemberDisplayNameL
+    EXIMPPlgTestSubscribePresenceWatcherListCalled,     // DoSubscribePresenceWatcherListL
+    EXIMPPlgTestUnsubscribePresenceWatcherListCalled,   // DoUnsubscribePresenceWatcherListL
+
+    EXIMPPlgTestSubscribePresenceGrantRequestListCalled,    // DoSubscribePresenceGrantRequestListL
+    EXIMPPlgTestUnsubscribePresenceGrantRequestListCalled,    // DoUnsubscribePresenceGrantRequestListL
+
+    EXIMPPlgTestGrantPresenceForPresentityCalled,                   // EXIMPPlgTestGrantPresenceForPresentityCalled
+    EXIMPPlgTestGrantPresenceForPresentityGroupMembersCalled,       // EXIMPPlgTestGrantPresenceForPresentityGroupMembersCalled
+    EXIMPPlgTestGrantPresenceForEveryoneCalled,                   // EXIMPPlgTestGrantPresenceForEveryoneCalled
+    EXIMPPlgTestUpdateGrantPresenceForPresentityCalled,             // EXIMPPlgTestUpdateGrantPresenceForPresentityCalled
+    EXIMPPlgTestUpdateGrantPresenceForEveryoneCalled,             // EXIMPPlgTestUpdateGrantPresenceForEveryoneCalled
+    EXIMPPlgTestUpdateGrantPresenceForPresentityGroupMembersCalled, // EXIMPPlgTestUpdateGrantPresenceForPresentityGroupMembersCalled
+    EXIMPPlgTestWithdrawPresenceFromPresentityCalled,               // EXIMPPlgTestWithdrawPresenceFromPresentityCalled
+    EXIMPPlgTestWithdrawPresenceFromPresentityGroupMembersCalled,   // EXIMPPlgTestWithdrawPresenceFromPresentityGroupMembersCalled
+    EXIMPPlgTestWithdrawPresenceFromEveryoneCalled,               // EXIMPPlgTestWithdrawPresenceFromEveryoneCalled
+    EXIMPPlgTestSubscribePresenceBlockListCalled,                   // EXIMPPlgTestSubscribePresenceBlockListCalled
+    EXIMPPlgTestUnsubscribePresenceBlockListCalled,                  // EXIMPPlgTestUnubscribePresenceBlockListCalled
+    EXIMPPlgTestBlockPresenceForPresentityCalled,                   // EXIMPPlgTestBlockPresenceForPresentityCalled
+    EXIMPPlgTestCancelPresenceBlockFromPresentityCalled,            // EXIMPPlgTestCancelPresenceBlockFromPresentityCalled
+    
+    EXIMPPlgTestSubscribePresentityGroupListCalled,  // DoSubscribePresentityGroupListL
+    EXIMPPlgTestUnsubscribePresentityGroupListCalled,  // DoUnsubscribePresentityGroupListL
+    EXIMPPlgTestHandlePresentityGroupListCalled, //EXIMPPlgTestHandlePresentityGroupListCalled
+    EXIMPPlgTestHandlePresentityPresenceCalled,   
+    
+
+
+    // For signaling some situations checked by adaptation
+    EXIMPPlgTestExistsGroupContentInCache,              // Check if group content exists in cache.
+
+    // signal Plg destruction (p->t)
+    EXIMPPlgTestDeath,
+
+    // simulate session lost with given strategy (t->p)
+    EXIMPTestPlgSessionLostStrategy,
+    };
+
+// T-class for internal use
+class TXIMPTestMsg
+    {
+public:
+    TXIMPTestPropertyKeys iKey;     // pubsub key
+    TInt iVal;                      // pubsub value
+    };
+
+    /**
+     * @param aIndex The index for the testing context
+     * @param aDescription Description for failed test.
+     * @param aModifier If EFalse, negate the test, thus checking for
+     * publish presence NOT being called.
+     * @param aDescription2 Description for negate failed test.
+     */
+#define COMMONASSERT( aMsg, aKey, aDescription, aModifier, aDescription2 ) \
+        { \
+        TBool value = aMsg->GetBoolean( aKey ); \
+        if( aModifier ) \
+            { \
+            EUNIT_ASSERT_DESC( value, aDescription ); \
+            } \
+        else if( !aDescription2 ) \
+            { \
+            EUNIT_ASSERT_DESC( value, "Description 2 not set." ); \
+            } \
+        else \
+            { \
+            EUNIT_ASSERT_DESC( !value, aDescription2 ); \
+            } \
+        }
+
+#endif // T_PRFWTESTMESSAGING_H_
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/testcaseutils/prfwtestmessenger.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,584 @@
+/*
+* 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:
+*
+*/
+
+
+#include "eunittools.h"
+#include <e32def.h>
+#include <eunitmacros.h>
+#include <ximprestrictedobjectcollection.h>
+
+#include "prfwtestmessaging.h"
+#include "prfwtestmessenger.h"
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// CONSTRUCTION
+EXPORT_C CXIMPTestMessenger* CXIMPTestMessenger::NewForClientSideL( TInt aId )
+    {
+    CXIMPTestMessenger* self = new (ELeave) CXIMPTestMessenger( aId );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+    self->DeletePubSubKeys();
+    self->ResetPubSub();
+    return self;
+    }
+
+
+EXPORT_C CXIMPTestMessenger* CXIMPTestMessenger::NewForAdaptationSideL( TInt aId )
+    {
+    CXIMPTestMessenger* self = new (ELeave) CXIMPTestMessenger( aId );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+    return self;
+    }
+
+
+
+void CXIMPTestMessenger::ConstructL()
+    {
+    iDescription.CreateL( 512 );
+    }
+
+// reset the given pubsub keys
+// and any helper variables
+
+_LIT_SECURITY_POLICY_PASS( KAllowReadToAll );
+_LIT_SECURITY_POLICY_PASS( KAllowWriteToAll );
+
+EXPORT_C void CXIMPTestMessenger::ResetPubSub()
+    {
+    // check if we've already defined the keys. if we redefine and set
+    // defaults, the test logic breaks.
+    /*TInt pubSubDefined = GetValueFor( EXIMPTestMetaPubSubDefined );
+    if ( pubSubDefined )
+        {
+        // all done
+        return;
+        }
+*/
+    TInt r = 0;
+
+    // special behavioral keys
+    r = RProperty::Define( iMyUid, EXIMPTestMetaPubSubDefined, RProperty::EInt, KAllowReadToAll, KAllowWriteToAll );
+
+    r = RProperty::Define( iMyUid, EXIMPPlgTestDeath,                RProperty::EInt, KAllowReadToAll, KAllowWriteToAll );
+    r = RProperty::Define( iMyUid, EXIMPTestPlgSessionLostStrategy,  RProperty::EInt, KAllowReadToAll, KAllowWriteToAll );
+
+    // behavioral keys
+    r = RProperty::Define( iMyUid, EXIMPTestPlgBehaveLeave,    RProperty::EInt, KAllowReadToAll, KAllowWriteToAll );
+    r = RProperty::Define( iMyUid, EXIMPTestPlgBehaveError,    RProperty::EInt, KAllowReadToAll, KAllowWriteToAll );
+    r = RProperty::Define( iMyUid, EXIMPTestPlgBehaveCloseHandle, RProperty::EInt, KAllowReadToAll, KAllowWriteToAll );
+    r = RProperty::Define( iMyUid, EXIMPTestPlgBehaveInvalidReqId, RProperty::EInt, KAllowReadToAll, KAllowWriteToAll );
+    // TODO add more here
+
+    // "method called" keys
+    r = RProperty::Define( iMyUid, EXIMPPlgTestOpenSessionCalled,       RProperty::EInt, KAllowReadToAll, KAllowWriteToAll );
+    r = RProperty::Define( iMyUid, EXIMPPlgTestShareSessionCalled,      RProperty::EInt, KAllowReadToAll, KAllowWriteToAll );
+    r = RProperty::Define( iMyUid, EXIMPPlgTestUnshareSessionCalled,    RProperty::EInt, KAllowReadToAll, KAllowWriteToAll );
+    r = RProperty::Define( iMyUid, EXIMPPlgTestCloseSessionCalled,      RProperty::EInt, KAllowReadToAll, KAllowWriteToAll );
+    r = RProperty::Define( iMyUid, EXIMPPlgTestPublishPresenceCalled,   RProperty::EInt, KAllowReadToAll, KAllowWriteToAll );
+    r = RProperty::Define( iMyUid, EXIMPPlgTestUpdateInterestCalled,    RProperty::EInt, KAllowReadToAll, KAllowWriteToAll );
+    r = RProperty::Define( iMyUid, EXIMPPlgTestSubscribeOwnPresenceCalled,  RProperty::EInt, KAllowReadToAll, KAllowWriteToAll );
+    r = RProperty::Define( iMyUid, EXIMPPlgTestUnsubscribeOwnPresenceCalled,  RProperty::EInt, KAllowReadToAll, KAllowWriteToAll );
+    r = RProperty::Define( iMyUid, EXIMPPlgTestUpdateOwnSubscriptionCalled, RProperty::EInt, KAllowReadToAll, KAllowWriteToAll );
+    r = RProperty::Define( iMyUid, EXIMPPlgTestSubscribeGroupListCalled,  RProperty::EInt, KAllowReadToAll, KAllowWriteToAll );
+    r = RProperty::Define( iMyUid, EXIMPPlgTestUnsubscribeGroupListCalled,  RProperty::EInt, KAllowReadToAll, KAllowWriteToAll );
+    r = RProperty::Define( iMyUid, EXIMPPlgTestCreatePresentityGroupCalled,  RProperty::EInt, KAllowReadToAll, KAllowWriteToAll );
+    r = RProperty::Define( iMyUid, EXIMPPlgTestDeletePresentityGroupCalled,  RProperty::EInt, KAllowReadToAll, KAllowWriteToAll );
+    r = RProperty::Define( iMyUid, EXIMPPlgTestUpdatePresentityGroupDisplayNameCalled,  RProperty::EInt, KAllowReadToAll, KAllowWriteToAll );
+    r = RProperty::Define( iMyUid, EXIMPPlgTestSubscribePresentityPresesenceCalled,  RProperty::EInt, KAllowReadToAll, KAllowWriteToAll );
+    r = RProperty::Define( iMyUid, EXIMPPlgTestUnsubscribePresentityPresesenceCalled,  RProperty::EInt, KAllowReadToAll, KAllowWriteToAll );
+    r = RProperty::Define( iMyUid, EXIMPPlgTestUpdatePresentityPresesenceCalled,  RProperty::EInt, KAllowReadToAll, KAllowWriteToAll );
+    r = RProperty::Define( iMyUid, EXIMPPlgTestSubscribePresentityGroupContentCalled,  RProperty::EInt, KAllowReadToAll, KAllowWriteToAll );
+    r = RProperty::Define( iMyUid, EXIMPPlgTestUnsubscribePresentityGroupContentCalled,  RProperty::EInt, KAllowReadToAll, KAllowWriteToAll );
+    r = RProperty::Define( iMyUid, EXIMPPlgTestAddPresentityGroupMemberCalled,  RProperty::EInt, KAllowReadToAll, KAllowWriteToAll );
+    r = RProperty::Define( iMyUid, EXIMPPlgTestRemovePresentityGroupMemberCalled,  RProperty::EInt, KAllowReadToAll, KAllowWriteToAll );
+    r = RProperty::Define( iMyUid, EXIMPPlgTestUpdatePresentityGroupMemberDisplayNameCalled,  RProperty::EInt, KAllowReadToAll, KAllowWriteToAll );
+    r = RProperty::Define( iMyUid, EXIMPPlgTestSubscribePresenceWatcherListCalled,  RProperty::EInt, KAllowReadToAll, KAllowWriteToAll );
+    r = RProperty::Define( iMyUid, EXIMPPlgTestUnsubscribePresenceWatcherListCalled,  RProperty::EInt, KAllowReadToAll, KAllowWriteToAll );
+    r = RProperty::Define( iMyUid, EXIMPPlgTestSubscribePresentityGroupMembersPresesenceCalled,  RProperty::EInt, KAllowReadToAll, KAllowWriteToAll );
+    r = RProperty::Define( iMyUid, EXIMPPlgTestUnsubscribePresentityGroupMembersPresesenceCalled,  RProperty::EInt, KAllowReadToAll, KAllowWriteToAll );
+    r = RProperty::Define( iMyUid, EXIMPPlgTestUpdatePresentityGroupMembersPresesenceCalled,  RProperty::EInt, KAllowReadToAll, KAllowWriteToAll );
+    r = RProperty::Define( iMyUid, EXIMPPlgTestSubscribePresenceGrantRequestListCalled,  RProperty::EInt, KAllowReadToAll, KAllowWriteToAll );
+    r = RProperty::Define( iMyUid, EXIMPPlgTestUnsubscribePresenceGrantRequestListCalled,  RProperty::EInt, KAllowReadToAll, KAllowWriteToAll );
+
+    r = RProperty::Define( iMyUid, EXIMPPlgTestGrantPresenceForPresentityCalled,  RProperty::EInt, KAllowReadToAll, KAllowWriteToAll );
+    r = RProperty::Define( iMyUid, EXIMPPlgTestGrantPresenceForPresentityGroupMembersCalled,  RProperty::EInt, KAllowReadToAll, KAllowWriteToAll );
+    r = RProperty::Define( iMyUid, EXIMPPlgTestGrantPresenceForEveryoneCalled,  RProperty::EInt, KAllowReadToAll, KAllowWriteToAll );
+    r = RProperty::Define( iMyUid, EXIMPPlgTestUpdateGrantPresenceForPresentityCalled,  RProperty::EInt, KAllowReadToAll, KAllowWriteToAll );
+    r = RProperty::Define( iMyUid, EXIMPPlgTestUpdateGrantPresenceForPresentityGroupMembersCalled,  RProperty::EInt, KAllowReadToAll, KAllowWriteToAll );
+    r = RProperty::Define( iMyUid, EXIMPPlgTestUpdateGrantPresenceForEveryoneCalled,  RProperty::EInt, KAllowReadToAll, KAllowWriteToAll );
+    r = RProperty::Define( iMyUid, EXIMPPlgTestWithdrawPresenceFromPresentityCalled,  RProperty::EInt, KAllowReadToAll, KAllowWriteToAll );
+    r = RProperty::Define( iMyUid, EXIMPPlgTestWithdrawPresenceFromPresentityGroupMembersCalled,  RProperty::EInt, KAllowReadToAll, KAllowWriteToAll );
+    r = RProperty::Define( iMyUid, EXIMPPlgTestWithdrawPresenceFromEveryoneCalled,  RProperty::EInt, KAllowReadToAll, KAllowWriteToAll );
+    
+    r = RProperty::Define( iMyUid, EXIMPPlgTestSubscribePresenceBlockListCalled,  RProperty::EInt, KAllowReadToAll, KAllowWriteToAll );
+    r = RProperty::Define( iMyUid, EXIMPPlgTestUnsubscribePresenceBlockListCalled,  RProperty::EInt, KAllowReadToAll, KAllowWriteToAll );
+    r = RProperty::Define( iMyUid, EXIMPPlgTestBlockPresenceForPresentityCalled,  RProperty::EInt, KAllowReadToAll, KAllowWriteToAll );
+    r = RProperty::Define( iMyUid, EXIMPPlgTestCancelPresenceBlockFromPresentityCalled,  RProperty::EInt, KAllowReadToAll, KAllowWriteToAll );
+
+//Pia
+    r = RProperty::Define( iMyUid, EXIMPPlgTestSubscribePresentityGroupListCalled, RProperty::EInt, KAllowReadToAll, KAllowWriteToAll );
+    r = RProperty::Define( iMyUid, EXIMPPlgTestUnsubscribePresentityGroupListCalled, RProperty::EInt, KAllowReadToAll, KAllowWriteToAll );
+    r = RProperty::Define( iMyUid, EXIMPPlgTestHandlePresentityGroupListCalled, RProperty::EInt, KAllowReadToAll, KAllowWriteToAll );
+    r = RProperty::Define( iMyUid, EXIMPPlgTestHandlePresentityPresenceCalled, RProperty::EInt, KAllowReadToAll, KAllowWriteToAll );
+
+    r = RProperty::Define( iMyUid, EXIMPPlgTestExistsGroupContentInCache,  RProperty::EInt, KAllowReadToAll, KAllowWriteToAll );
+
+    // TODO add more here
+
+    // reset keys which have special meaning to defaults which will cause
+    // no actions - a happy path scenario
+    SetValueFor( EXIMPPlgTestDeath, EXIMPPrtValPluginDeathEmpty );
+    SetValueFor( EXIMPTestPlgSessionLostStrategy, EXIMPPrtValSessionLostEmpty );
+
+    // set other behavioral things to "happy path" by default
+    SetValueFor( EXIMPTestPlgBehaveLeave, KErrNone );
+    SetValueFor( EXIMPTestPlgBehaveError, KErrNone );
+    SetValueFor( EXIMPTestPlgBehaveCloseHandle, 0 );
+    SetValueFor( EXIMPTestPlgBehaveInvalidReqId, 0 );
+
+    // reset method called messages
+    SetValueFor( EXIMPPlgTestOpenSessionCalled, 0 );
+    SetValueFor( EXIMPPlgTestShareSessionCalled, 0 );
+    SetValueFor( EXIMPPlgTestUnshareSessionCalled, 0 );
+    SetValueFor( EXIMPPlgTestCloseSessionCalled, 0 );
+    SetValueFor( EXIMPPlgTestPublishPresenceCalled, 0 );
+    SetValueFor( EXIMPPlgTestUpdateInterestCalled, 0 );
+    SetValueFor( EXIMPPlgTestSubscribeOwnPresenceCalled, 0 );
+    SetValueFor( EXIMPPlgTestUnsubscribeOwnPresenceCalled, 0 );
+    SetValueFor( EXIMPPlgTestUpdateOwnSubscriptionCalled, 0 );
+    SetValueFor( EXIMPPlgTestSubscribeGroupListCalled, 0 );
+    SetValueFor( EXIMPPlgTestUnsubscribeGroupListCalled, 0 );
+    SetValueFor( EXIMPPlgTestCreatePresentityGroupCalled, 0 );
+    SetValueFor( EXIMPPlgTestDeletePresentityGroupCalled, 0 );
+    SetValueFor( EXIMPPlgTestUpdatePresentityGroupDisplayNameCalled, 0 );
+    SetValueFor( EXIMPPlgTestSubscribePresentityPresesenceCalled, 0 );
+    SetValueFor( EXIMPPlgTestUnsubscribePresentityPresesenceCalled, 0 );
+    SetValueFor( EXIMPPlgTestUpdatePresentityPresesenceCalled, 0 );
+    SetValueFor( EXIMPPlgTestSubscribePresentityGroupContentCalled, 0 );
+    SetValueFor( EXIMPPlgTestUnsubscribePresentityGroupContentCalled, 0 );
+    SetValueFor( EXIMPPlgTestAddPresentityGroupMemberCalled, 0 );
+    SetValueFor( EXIMPPlgTestRemovePresentityGroupMemberCalled, 0 );
+    SetValueFor( EXIMPPlgTestUpdatePresentityGroupMemberDisplayNameCalled, 0 );
+    SetValueFor( EXIMPPlgTestSubscribePresenceWatcherListCalled, 0 );
+    SetValueFor( EXIMPPlgTestUnsubscribePresenceWatcherListCalled, 0 );
+    SetValueFor( EXIMPPlgTestSubscribePresentityGroupMembersPresesenceCalled, 0 );
+    SetValueFor( EXIMPPlgTestUnsubscribePresentityGroupMembersPresesenceCalled, 0 );
+    SetValueFor( EXIMPPlgTestUpdatePresentityGroupMembersPresesenceCalled, 0 );
+    SetValueFor( EXIMPPlgTestSubscribePresenceGrantRequestListCalled, 0 );
+    SetValueFor( EXIMPPlgTestUnsubscribePresenceGrantRequestListCalled, 0 );
+
+    SetValueFor( EXIMPPlgTestGrantPresenceForPresentityCalled, 0 );
+    SetValueFor( EXIMPPlgTestGrantPresenceForPresentityGroupMembersCalled, 0 );
+    SetValueFor( EXIMPPlgTestGrantPresenceForEveryoneCalled, 0 );
+    SetValueFor( EXIMPPlgTestUpdateGrantPresenceForPresentityCalled, 0 );
+    SetValueFor( EXIMPPlgTestUpdateGrantPresenceForPresentityGroupMembersCalled, 0 );
+    SetValueFor( EXIMPPlgTestUpdateGrantPresenceForEveryoneCalled, 0 );
+    SetValueFor( EXIMPPlgTestWithdrawPresenceFromPresentityCalled, 0 );
+    SetValueFor( EXIMPPlgTestWithdrawPresenceFromPresentityGroupMembersCalled, 0 );
+    SetValueFor( EXIMPPlgTestWithdrawPresenceFromEveryoneCalled, 0 );
+
+    SetValueFor( EXIMPPlgTestSubscribePresenceBlockListCalled, 0 );
+    SetValueFor( EXIMPPlgTestUnsubscribePresenceBlockListCalled, 0 );
+    SetValueFor( EXIMPPlgTestBlockPresenceForPresentityCalled, 0 );
+    SetValueFor( EXIMPPlgTestCancelPresenceBlockFromPresentityCalled, 0 );
+    //Pia
+    SetValueFor( EXIMPPlgTestSubscribePresentityGroupListCalled, 0 );  // DoSubscribePresentityGroupListL
+    SetValueFor( EXIMPPlgTestUnsubscribePresentityGroupListCalled, 0 );  // DoUnsubscribePresentityGroupListL
+    SetValueFor( EXIMPPlgTestHandlePresentityGroupListCalled, 0 ); //EXIMPPlgTestHandlePresentityGroupListCalled
+    SetValueFor( EXIMPPlgTestHandlePresentityPresenceCalled, 0 );
+
+    SetValueFor( EXIMPPlgTestExistsGroupContentInCache, 0 );
+
+    // TODO add any new keys also to DeletePubSubKeys!!!
+
+
+   // TODO add more here
+
+    // TODO make the integer-valued keys and values into an array with
+    // default values, then loop over the array
+
+    // pubsub things have been defined. keep this as last line!
+    SetValueFor( EXIMPTestMetaPubSubDefined, 1 );
+    }
+
+
+EXPORT_C void CXIMPTestMessenger::SetPluginIndex( TInt aIndex /* = KErrNotFound */ )
+    {
+    // NOTE! Plugin index is ALWAYS set to base UID!
+    TInt val = 0;
+    TInt r = RProperty::Get( KXIMPTestPropertyCatBase,EXIMPTestMetaPluginIndex, val );
+    if ( r == KErrNotFound )
+        {
+        // value was not defined
+        TInt r = RProperty::Define( KXIMPTestPropertyCatBase, EXIMPTestMetaPluginIndex, RProperty::EInt );
+        }
+
+    r = RProperty::Set( KXIMPTestPropertyCatBase, EXIMPTestMetaPluginIndex, aIndex );
+
+    iMyUid = TUid::Uid( KXIMPTestPropertyCatBase.iUid + aIndex );
+    }
+
+
+EXPORT_C TInt CXIMPTestMessenger::GetPluginIndex()
+    {
+    TInt val = 0;
+    TInt r = RProperty::Get( KXIMPTestPropertyCatBase,EXIMPTestMetaPluginIndex, val );
+    if ( r == KErrNotFound )
+        {
+        val = KErrNotFound;
+        }
+
+    return val;
+    }
+
+
+CXIMPTestMessenger::~CXIMPTestMessenger()
+    {
+    DeletePubSubKeys();
+    iDescription.Close();
+    delete iReqCompleteParams;
+    }
+
+
+CXIMPTestMessenger::CXIMPTestMessenger( TInt aId )
+    {
+    iId = aId;
+    iMyUid = TUid::Uid( KXIMPTestPropertyCatBase.iUid + iId );
+    }
+
+
+// ===========================================================================
+// PUBLIC FUNCTIONS
+// ===========================================================================
+//
+
+//
+// Setters and getters for error code
+//
+EXPORT_C void CXIMPTestMessenger::SetNoError()
+    {
+    SetValueFor( EXIMPTestPlgBehaveError, KErrNone );
+    }
+
+EXPORT_C void CXIMPTestMessenger::SetError( TInt aErrorCode )
+    {
+    SetValueFor( EXIMPTestPlgBehaveError, aErrorCode );
+    }
+
+EXPORT_C TInt CXIMPTestMessenger::GetError()
+    {
+    return GetValueFor( EXIMPTestPlgBehaveError );
+    }
+
+//
+// Setters and getters for boolean flags
+//
+EXPORT_C void CXIMPTestMessenger::SetBoolean( TXIMPTestPropertyKeys aKey )
+    {
+    // aKey takes boolean value, e.g. "*BehaveInvalidReqId"
+    SetValueFor( aKey, 1 );
+    }
+
+EXPORT_C TBool CXIMPTestMessenger::GetBoolean( TXIMPTestPropertyKeys aKey ) const
+    {
+    // aKey takes boolean value, e.g. "*BehaveInvalidReqId"
+    return GetValueFor( aKey ) == 1;
+    }
+
+//
+// Setters, getters and utility methods for leave codes
+//
+EXPORT_C void CXIMPTestMessenger::SetLeave( TInt aLeaveCode )
+    {
+    SetValueFor( EXIMPTestPlgBehaveLeave, aLeaveCode );
+    }
+
+EXPORT_C TInt CXIMPTestMessenger::GetLeave()
+    {
+    return GetValueFor( EXIMPTestPlgBehaveLeave );
+    }
+
+// call this method to automatically handle leaves
+EXPORT_C void CXIMPTestMessenger::HandleLeaveL()
+    {
+    User::LeaveIfError( GetLeave() );
+    }
+
+
+//
+//
+// General messaging support for direct access,
+// also used internally as setters and getters.
+//
+EXPORT_C void CXIMPTestMessenger::SetValueFor( TXIMPTestPropertyKeys aKey, TInt aValue )
+    {
+    TXIMPTestMsg testMsg;
+    testMsg.iKey = aKey;
+    testMsg.iVal = aValue;
+    Send( testMsg );
+    }
+
+EXPORT_C TInt CXIMPTestMessenger::GetValueFor( TXIMPTestPropertyKeys aKey ) const
+    {
+    TXIMPTestMsg testMsg;
+    testMsg.iKey = aKey;
+    Receive( testMsg );
+    return testMsg.iVal;
+    }
+
+//
+// Actual pubsub setters and getters
+//
+void CXIMPTestMessenger::Send( TXIMPTestMsg& aMsg )
+    {
+    TInt r = RProperty::Set( iMyUid, aMsg.iKey, aMsg.iVal );
+    // TODO handle error in r
+    }
+
+void CXIMPTestMessenger::Receive( TXIMPTestMsg& aMsg ) const
+    {
+    TInt val = 0;
+    TInt r = RProperty::Get( iMyUid,
+            aMsg.iKey, val );
+    aMsg.iVal = val;
+    // TODO handle error in r, set val appropriately (0)?
+    }
+
+// ----------------------------------------------------------------
+//
+// assert helpers
+//
+void CXIMPTestMessenger::CommonAssert( TXIMPTestPropertyKeys aKey,
+        TBool aCompareState,
+        const TDesC8& aTrueDesc,
+        const TDesC8& aFalseDesc ) const
+    {
+    iDescription.Zero();
+    TBool value = GetBoolean( aKey );
+
+    if ( aCompareState )
+        {
+        // the true case means success here
+        iDescription = aFalseDesc;
+        PRFW_ASSERT_DESC( value, iDescription.PtrZ() );
+        }
+    else
+        {
+        // the false case means success here
+        iDescription = aTrueDesc;
+        PRFW_ASSERT_DESC( ! value, iDescription.PtrZ() );
+        }
+    }
+
+//
+// One Assert-method for each boolean-value (see prfwtestmessaging.h)
+//
+EXPORT_C void CXIMPTestMessenger::AssertPluginDied( TBool aState )
+    {
+    // ETrue == Yes, plugin died.
+/*    CommonAssert( EXIMPPlgTestDeath, aState,
+                 _L8( "Plugin was destroyed" ),
+                 _L8( "Plugin was not destroyed" ) );*/
+    }
+
+EXPORT_C void CXIMPTestMessenger::AssertOpenSessionCalled( TBool aState )
+    {
+    CommonAssert( EXIMPPlgTestOpenSessionCalled, aState,
+                 _L8( "OpenSession called" ),
+                 _L8( "OpenSession not called" ) );
+    }
+
+EXPORT_C void CXIMPTestMessenger::AssertShareSessionCalled( TBool aState )
+    {
+    CommonAssert( EXIMPPlgTestShareSessionCalled, aState,
+                 _L8( "ShareSession called" ),
+                 _L8( "ShareSession not called" ) );
+    }
+
+EXPORT_C void CXIMPTestMessenger::AssertCloseSessionCalled( TBool aState )
+    {
+    CommonAssert( EXIMPPlgTestCloseSessionCalled, aState,
+                 _L8( "CloseSession called" ),
+                 _L8( "CloseSession not called" ) );
+    }
+
+EXPORT_C void CXIMPTestMessenger::AssertUnshareSessionCalled( TBool aState )
+    {
+    CommonAssert( EXIMPPlgTestUnshareSessionCalled, aState,
+                 _L8( "UnshareSession called" ),
+                 _L8( "UnshareSession not called" ) );
+    }
+
+EXPORT_C void CXIMPTestMessenger::AssertSubscribePresentityGroupContentCalled( TBool aState )
+    {
+    CommonAssert( EXIMPPlgTestSubscribePresentityGroupContentCalled, aState,
+            _L8( "DoSubscribePresentityGroupContentL called" ),
+            _L8( "DoSubscribePresentityGroupContentL not called" ) );
+    }
+
+EXPORT_C void CXIMPTestMessenger::AssertSubscribePresentityGroupListCalled( TBool aState )
+    {
+    CommonAssert( EXIMPPlgTestSubscribeGroupListCalled, aState,
+            _L8( "DoSubscribePresentityGroupListL called" ),
+            _L8( "DoSubscribePresentityGroupListL not called" ) );
+    }
+
+EXPORT_C void CXIMPTestMessenger::AssertUnsubscribePresentityGroupContentCalled( TBool aState )
+    {
+    CommonAssert( EXIMPPlgTestUnsubscribePresentityGroupContentCalled, aState,
+                 _L8( "DoUnsubscribePresentityGroupContentL called" ),
+                 _L8( "DoUnsubscribePresentityGroupContentL not called" ) );
+    }
+
+EXPORT_C void CXIMPTestMessenger::AssertUnsubscribePresentityGroupListCalled( TBool aState )
+    {
+    CommonAssert( EXIMPPlgTestUnsubscribeGroupListCalled, aState,
+                 _L8( "DoUnsubscribePresentityGroupListL called" ),
+                 _L8( "DoUnsubscribePresentityGroupListL not called" ) );
+    }
+
+EXPORT_C void CXIMPTestMessenger::AssertAddPresentityGroupMemberCalled( TBool aState )
+    {
+    CommonAssert( EXIMPPlgTestAddPresentityGroupMemberCalled, aState,
+            _L8( "DoAddPresentityGroupMemberL called" ),
+            _L8( "DoAddPresentityGroupMemberL not called" ) );
+    }
+
+EXPORT_C void CXIMPTestMessenger::AssertRemovePresentityGroupMemberCalled( TBool aState )
+    {
+    CommonAssert( EXIMPPlgTestRemovePresentityGroupMemberCalled, aState,
+                 _L8( "DoRemovePresentityGroupMemberL called" ),
+                 _L8( "DoRemovePresentityGroupMemberL not called" ) );
+    }
+
+EXPORT_C void CXIMPTestMessenger::AssertUpdatePresentityGroupMemberDisplayNameCalled( TBool aState )
+    {
+    CommonAssert( EXIMPPlgTestUpdatePresentityGroupMemberDisplayNameCalled, aState,
+                 _L8( "DoUpdatePresentityGroupMemberDisplayNameL called" ),
+                 _L8( "DoUpdatePresentityGroupMemberDisplayNameL not called" ) );
+    }
+
+EXPORT_C void CXIMPTestMessenger::AssertUpdatePresentityGroupDisplayNameCalled( TBool aState )
+    {
+    CommonAssert( EXIMPPlgTestUpdatePresentityGroupDisplayNameCalled, aState,
+                 _L8( "DoUpdatePresentityGroupDisplayNameL called" ),
+                 _L8( "DoUpdatePresentityGroupDisplayNameL not called" ) );
+    }
+
+EXPORT_C void CXIMPTestMessenger::AssertCreatePresentityGroupCalled( TBool aState )
+    {
+    CommonAssert( EXIMPPlgTestCreatePresentityGroupCalled, aState,
+                 _L8( "DoCreatePresentityGroupL called" ),
+                 _L8( "DoCreatePresentityGroupL not called" ) );
+    }
+
+EXPORT_C void CXIMPTestMessenger::SetReqCompleteParams( MXIMPRestrictedObjectCollection* aParams )
+    {
+    delete iReqCompleteParams;
+    iReqCompleteParams = aParams;
+    }
+EXPORT_C MXIMPRestrictedObjectCollection* CXIMPTestMessenger::GetReqCompleteParams()
+    {
+    MXIMPRestrictedObjectCollection* retParam = iReqCompleteParams;
+    iReqCompleteParams = NULL;
+    return retParam;
+    }
+
+// TODO add more
+
+EXPORT_C void CXIMPTestMessenger::DeletePubSubKeys()
+    {
+    TInt r = RProperty::Delete( iMyUid, EXIMPPlgTestDeath );
+    r = RProperty::Delete( iMyUid, EXIMPTestPlgSessionLostStrategy );
+
+    // behavioral keys
+    r = RProperty::Delete( iMyUid, EXIMPTestPlgBehaveLeave );
+    r = RProperty::Delete( iMyUid, EXIMPTestPlgBehaveError );
+    r = RProperty::Delete( iMyUid, EXIMPTestPlgBehaveCloseHandle );
+    r = RProperty::Delete( iMyUid, EXIMPTestPlgBehaveInvalidReqId );
+    // TODO add more here
+
+    // "method called" keys
+    r = RProperty::Delete( iMyUid, EXIMPPlgTestOpenSessionCalled );
+    r = RProperty::Delete( iMyUid, EXIMPPlgTestShareSessionCalled );
+    r = RProperty::Delete( iMyUid, EXIMPPlgTestUnshareSessionCalled );
+    r = RProperty::Delete( iMyUid, EXIMPPlgTestCloseSessionCalled );
+    r = RProperty::Delete( iMyUid, EXIMPPlgTestPublishPresenceCalled );
+    r = RProperty::Delete( iMyUid, EXIMPPlgTestUpdateInterestCalled );
+    r = RProperty::Delete( iMyUid, EXIMPPlgTestSubscribeOwnPresenceCalled );
+    r = RProperty::Delete( iMyUid, EXIMPPlgTestUnsubscribeOwnPresenceCalled );
+    r = RProperty::Delete( iMyUid, EXIMPPlgTestUpdateOwnSubscriptionCalled );
+    r = RProperty::Delete( iMyUid, EXIMPPlgTestSubscribeGroupListCalled );
+    r = RProperty::Delete( iMyUid, EXIMPPlgTestUnsubscribeGroupListCalled );
+    r = RProperty::Delete( iMyUid, EXIMPPlgTestCreatePresentityGroupCalled );
+    r = RProperty::Delete( iMyUid, EXIMPPlgTestDeletePresentityGroupCalled );
+    r = RProperty::Delete( iMyUid, EXIMPPlgTestUpdatePresentityGroupDisplayNameCalled );
+    r = RProperty::Delete( iMyUid, EXIMPPlgTestSubscribePresentityPresesenceCalled );
+    r = RProperty::Delete( iMyUid, EXIMPPlgTestUnsubscribePresentityPresesenceCalled );
+    r = RProperty::Delete( iMyUid, EXIMPPlgTestUpdatePresentityPresesenceCalled );
+    r = RProperty::Delete( iMyUid, EXIMPPlgTestSubscribePresentityGroupMembersPresesenceCalled );
+    r = RProperty::Delete( iMyUid, EXIMPPlgTestUnsubscribePresentityGroupMembersPresesenceCalled );
+    r = RProperty::Delete( iMyUid, EXIMPPlgTestUpdatePresentityGroupMembersPresesenceCalled );
+
+    r = RProperty::Delete( iMyUid, EXIMPPlgTestSubscribePresentityGroupContentCalled );
+    r = RProperty::Delete( iMyUid, EXIMPPlgTestUnsubscribePresentityGroupContentCalled );
+    r = RProperty::Delete( iMyUid, EXIMPPlgTestAddPresentityGroupMemberCalled );
+    r = RProperty::Delete( iMyUid, EXIMPPlgTestRemovePresentityGroupMemberCalled );
+    r = RProperty::Delete( iMyUid, EXIMPPlgTestUpdatePresentityGroupMemberDisplayNameCalled );
+
+    r = RProperty::Delete( iMyUid, EXIMPPlgTestSubscribePresenceWatcherListCalled );
+    r = RProperty::Delete( iMyUid, EXIMPPlgTestUnsubscribePresenceWatcherListCalled );
+
+    r = RProperty::Delete( iMyUid, EXIMPPlgTestSubscribePresenceGrantRequestListCalled );
+    r = RProperty::Delete( iMyUid, EXIMPPlgTestUnsubscribePresenceGrantRequestListCalled );
+
+    r = RProperty::Delete( iMyUid, EXIMPPlgTestGrantPresenceForPresentityCalled );
+    r = RProperty::Delete( iMyUid, EXIMPPlgTestGrantPresenceForPresentityGroupMembersCalled );
+    r = RProperty::Delete( iMyUid, EXIMPPlgTestGrantPresenceForEveryoneCalled );
+    r = RProperty::Delete( iMyUid, EXIMPPlgTestUpdateGrantPresenceForPresentityCalled );
+    r = RProperty::Delete( iMyUid, EXIMPPlgTestUpdateGrantPresenceForPresentityGroupMembersCalled );
+    r = RProperty::Delete( iMyUid, EXIMPPlgTestUpdateGrantPresenceForEveryoneCalled );
+    r = RProperty::Delete( iMyUid, EXIMPPlgTestWithdrawPresenceFromPresentityCalled );
+    r = RProperty::Delete( iMyUid, EXIMPPlgTestWithdrawPresenceFromPresentityGroupMembersCalled );
+    r = RProperty::Delete( iMyUid, EXIMPPlgTestWithdrawPresenceFromEveryoneCalled );
+
+    r = RProperty::Delete( iMyUid, EXIMPPlgTestSubscribePresenceBlockListCalled );
+    r = RProperty::Delete( iMyUid, EXIMPPlgTestUnsubscribePresenceBlockListCalled );
+    r = RProperty::Delete( iMyUid, EXIMPPlgTestBlockPresenceForPresentityCalled );
+    r = RProperty::Delete( iMyUid, EXIMPPlgTestCancelPresenceBlockFromPresentityCalled );
+
+    
+       //Pia
+    r = RProperty::Delete( iMyUid, EXIMPPlgTestSubscribePresentityGroupListCalled );  // DoSubscribePresentityGroupListL
+    r = RProperty::Delete( iMyUid, EXIMPPlgTestUnsubscribePresentityGroupListCalled );  // DoUnsubscribePresentityGroupListL
+    r = RProperty::Delete( iMyUid, EXIMPPlgTestHandlePresentityGroupListCalled); //EXIMPPlgTestHandle
+    r = RProperty::Delete( iMyUid, EXIMPPlgTestHandlePresentityPresenceCalled); //
+
+
+    r = RProperty::Delete( iMyUid, EXIMPTestMetaPubSubDefined );
+
+    r = RProperty::Delete( iMyUid, EXIMPPlgTestExistsGroupContentInCache );    
+    }
+
+
+// end of file
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/testcaseutils/prfwtestmessenger.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,221 @@
+/*
+* 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:
+*
+*/
+
+
+#ifndef CPRFWTESTMESSENGER_H 
+#define CPRFWTESTMESSENGER_H
+
+// INCLUDES
+#include <e32def.h>
+#include <e32base.h>
+#include <e32property.h>
+#include "prfwtestmessaging.h"
+
+// CLASS DESCRIPTION
+
+class TXIMPTestMsg;
+class MXIMPRestrictedObjectCollection;
+
+/**
+ * Asynchronous protocol for PRFW testing.
+ * Implementation class and helper routines.
+ * Done using Publish and Subscribe, although it's used as a collection of
+ * "flags".
+ *
+ * RMsgQueue is not good, because we do not know the length of the array in
+ * advance: there is often 1 in the array, but there could be 2 or 3 or more.
+ * Each time someone writes, the array should be read. This becomes a bit
+ * problematic, an easier and more robust way is to use pubsub.
+ *
+ * The descriptions of API methods rely on the protocol implementation, thus
+ * the descriptions are meant to document what kind of effects the clients and
+ * users of this class expect this class to cause.
+ */
+class CXIMPTestMessenger : public CBase
+    {
+    public:
+
+        /**
+         * @param aMsgQName The name for the queue
+         */
+        IMPORT_C static CXIMPTestMessenger* NewForClientSideL( TInt aId );
+        IMPORT_C static CXIMPTestMessenger* NewForAdaptationSideL( TInt aId );
+        ~CXIMPTestMessenger();
+
+    private:
+
+        CXIMPTestMessenger( TInt aId );
+        
+        void ConstructL();
+
+    public:
+
+        /**
+         * Define and reset pubsub keys.
+         */
+        IMPORT_C void ResetPubSub();
+
+        /**
+         * Delete all pubsub keys.
+         */
+        IMPORT_C void DeletePubSubKeys();
+
+        /**
+         * Set index for plugin. Call before Bind-operation.
+         * Default of KErrNotFound (-1) will set the key to
+         * unused.
+         */
+        IMPORT_C void SetPluginIndex( TInt aIndex = KErrNotFound );
+        
+        /**
+         * Get index for plugin.
+         * @return Plugin index, or KErrNotFound if not found.
+         */
+        IMPORT_C static TInt GetPluginIndex();
+
+        /**
+         * Clears the error behavior.
+         */
+        IMPORT_C void SetNoError();
+
+        /**
+         * Setup for general error. Next operation will fail with this error
+         * code.
+         * @param aErrorCode The error code e.g. KErrNotFound
+         */
+        IMPORT_C void SetError( TInt aErrorCode );
+        
+        /**
+         * @return The currently set error code.
+         */
+        IMPORT_C TInt GetError();
+
+        /**
+         * Setup a specialized error which has a boolean value.
+         * Next operation will do the given specialized error, e.g. complete request
+         * with invalid request id (EXIMPTestPlgBehaveInvalidReqId)
+         * @param aKey The type defining the error, e.g. EXIMPTestPlgBehaveInvalidReqId
+         */
+        IMPORT_C void SetBoolean( TXIMPTestPropertyKeys aKey );
+        
+        /**
+         * @param aKey The type defining the error, e.g. EXIMPTestPlgBehaveInvalidReqId
+         * @return The value of the boolean-valued specialized error
+         */
+        IMPORT_C TBool GetBoolean( TXIMPTestPropertyKeys aKey ) const;
+
+        /**
+         * Setup for leave. Next operation will leave with given leave code.
+         * @param aLeaveCode Code with which to leave
+         */
+        IMPORT_C void SetLeave( TInt aLeaveCode );
+        
+        /**
+         * @return The currently set leave code
+         */
+        IMPORT_C TInt GetLeave();
+
+        /**
+         * Leaves if leave has been requested. Uses value obtained from pubsub.
+         */
+        IMPORT_C void HandleLeaveL();
+
+        /**
+         * General messaging support for direct access.
+         * @param aKey The key to set
+         * @param aValue The value to set to given key
+         */
+        IMPORT_C void SetValueFor( TXIMPTestPropertyKeys aKey, TInt aValue );
+
+        /**
+         * General messaging support for direct access.
+         * @param aKey The key to set
+         * @return The value in the given key
+         */
+        IMPORT_C TInt GetValueFor( TXIMPTestPropertyKeys aKey ) const;
+
+        /**
+         * Assert-methods.
+         * @param aState ETrue, if successful case is expected.
+         * 
+         * E.g. in the case of AssertPluginDied, 
+         * ETrue means:
+         *    "I expect the plugin to have died, check that it did" 
+         * and EFalse means:
+         *    "I expect the plugin to NOT have died, check that it didn't".
+         */
+        IMPORT_C void AssertPluginDied( TBool aState );
+        IMPORT_C void AssertOpenSessionCalled( TBool aState );
+        IMPORT_C void AssertCloseSessionCalled( TBool aState );
+        IMPORT_C void AssertShareSessionCalled( TBool aState );
+        IMPORT_C void AssertUnshareSessionCalled( TBool aState );
+        IMPORT_C void AssertSubscribePresentityGroupContentCalled( TBool aState );
+        IMPORT_C void AssertSubscribePresentityGroupListCalled( TBool aState );
+        IMPORT_C void AssertUnsubscribePresentityGroupContentCalled( TBool aState );
+        IMPORT_C void AssertUnsubscribePresentityGroupListCalled( TBool aState );
+        IMPORT_C void AssertAddPresentityGroupMemberCalled( TBool aState );
+        IMPORT_C void AssertCreatePresentityGroupCalled( TBool aState );
+        IMPORT_C void AssertRemovePresentityGroupMemberCalled( TBool aState );
+        IMPORT_C void AssertUpdatePresentityGroupMemberDisplayNameCalled( TBool aState );
+        IMPORT_C void AssertUpdatePresentityGroupDisplayNameCalled( TBool aState );
+        
+        IMPORT_C void SetReqCompleteParams( MXIMPRestrictedObjectCollection* aParams );
+        IMPORT_C MXIMPRestrictedObjectCollection* GetReqCompleteParams();
+
+    private:
+
+        /**
+         * Send the given message.
+         * @param aMessage The message to send with the key and value fields set
+         */
+        void Send( TXIMPTestMsg& aMsg );
+
+        /**
+         * Receive message.
+         * Returns the message with the value field set, using the same
+         * message parameter which was given as input.
+         * @param aMsg [inout] The message with the key field set
+         */
+        void Receive( TXIMPTestMsg& aMsg ) const;
+
+        /**
+         * Common internal assert method for all Assert* methods.
+         * @param aKey The key to assert
+         * @param aCompareState The expected state (ETrue for success)
+         * @param aTrueDesc Description for success case failing
+         * @param aFalseDesc Description for failure case failing
+         */
+        IMPORT_C void CommonAssert( TXIMPTestPropertyKeys aKey, 
+                TBool aCompareState, 
+                const TDesC8& aTrueDesc, 
+                const TDesC8& aFalseDesc ) const;
+    private:  
+
+        // id number for this message queue
+        TInt iId;
+        TUid iMyUid;
+
+        //OWN: Description buffer to hold the failure description
+        mutable RBuf8 iDescription;
+        
+        // Params for next reqcomplete
+        MXIMPRestrictedObjectCollection* iReqCompleteParams;
+    };
+
+#endif // CPRFWTESTMESSENGER_H
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/testcaseutils/prfwtestpresencedatautils.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -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:
+*
+*/
+
+#include "prfwtestpresencedatautils.h"
+#include "prfwtestcaseutilspanics.h"
+#include <eunitmacros.h>
+
+#include "ximprbufhelpers.h"
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+
+// Generation
+// -----------------------------------------------------------------------------
+// XIMPTestPresenceDataUtils::GenerateIdentityLC()
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CXIMPIdentityImp*
+    XIMPTestPresenceDataUtils::GenerateIdentityLC(
+                            const TDesC8* aPrefix,
+                            TPresenceDataGroup aGroup )
+    {
+    // According to Group:
+    //   Generate uri
+    _LIT16( KUri, "http://google.com" );
+
+    //   Generate protocolAddr
+    _LIT16( KProtocolAddress, "protocollll" );
+    
+    CXIMPIdentityImp* pres = CXIMPIdentityImp::NewLC( KUri );
+    return pres;    
+    }
+
+
+
+// -----------------------------------------------------------------------------
+// XIMPTestPresenceDataUtils::GenerateInfoLC()
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CPresenceInfoImp*
+    XIMPTestPresenceDataUtils::GenerateInfoLC(
+                            const TDesC8* aPrefix,
+                            TPresenceDataGroup aGroup )
+    {
+    CPresenceInfoImp* doc = CPresenceInfoImp::NewLC();
+    return doc;
+    }
+    
+// -----------------------------------------------------------------------------
+// XIMPTestPresenceDataUtils::GenerateInfoFilterLC()
+// -----------------------------------------------------------------------------
+//        
+EXPORT_C CPresenceInfoFilterImp* 
+    XIMPTestPresenceDataUtils::GenerateInfoFilterLC( const TDesC8* aPrefix, 
+                                                     TPresenceDataGroup aGroup )
+    {
+    CPresenceInfoFilterImp* pif = CPresenceInfoFilterImp::NewLC();
+    return pif;
+    }
+    
+
+
+
+// -----------------------------------------------------------------------------
+// XIMPTestPresenceDataUtils::InsertPrefixL
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void XIMPTestPresenceDataUtils::InsertPrefixL( const TDesC8* aPrefix, RBuf8& buf )
+    {
+    if ( aPrefix )
+        {
+        XIMPRBuf8Helper::GrowIfNeededL( buf, aPrefix->Length() + buf.Length() );
+        buf.Insert( 0, *aPrefix );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// XIMPTestPresenceDataUtils::Contains()
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TBool XIMPTestPresenceDataUtils::Contains( MPresenceInfo& a1,
+                                                    MPresenceInfo& a2 ) const
+    {
+    return ETrue;
+    }
+
+
+
+// -----------------------------------------------------------------------------
+// XIMPTestPresenceDataUtils::Equals()
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TBool XIMPTestPresenceDataUtils::Equals( CPresenceInfoImp& a1,
+                                                  CPresenceInfoImp& a2 ) const
+    {
+    return ETrue;
+    }
+
+
+
+// -----------------------------------------------------------------------------
+// XIMPTestPresenceDataUtils::AssertEquality()
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void XIMPTestPresenceDataUtils::AssertEquality(
+    MPresenceInfo& a1,
+    MPresenceInfo& a2 )
+    {
+    }
+
+
+
+
+// end of file
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/testcaseutils/prfwtestpresencedatautils.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,81 @@
+/*
+* 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:
+*
+*/
+
+#ifndef PRFWTESTPRESENCEDATAUTILS_H
+#define PRFWTESTPRESENCEDATAUTILS_H
+
+
+#include <e32base.h>
+#include "presenceinfoimp.h"
+#include "presenceinfofilterimp.h"
+#include "ximpidentityimp.h"
+
+
+// CLASS DESCRIPTION
+/**
+ * Helper class presence data comparison and generation.
+ */
+class XIMPTestPresenceDataUtils
+    {
+
+public:
+/**
+ * Enumeration defining the supported
+ * test data groups.
+ * A, B and C have unique values.
+ * The combinations are unions of those.
+ */
+enum TPresenceDataGroup
+    {
+    Group_None,
+    Group_A,
+    Group_B,
+    Group_C,
+    Group_AB,
+    Group_AC,
+    Group_BC,
+    Group_ABC,
+    };
+
+// TODO Add the defined names here (if needed for verification).
+
+public: //Generator functions
+    IMPORT_C static CXIMPIdentityImp* GenerateIdentityLC( const TDesC8* aPrefix, TPresenceDataGroup aGroup = Group_None );
+    IMPORT_C static CPresenceInfoImp* GenerateInfoLC( const TDesC8* aPrefix, TPresenceDataGroup aGroup = Group_None );
+    IMPORT_C static CPresenceInfoFilterImp* GenerateInfoFilterLC( const TDesC8* aPrefix, TPresenceDataGroup aGroup = Group_None );
+    
+public: //Comparator functions
+
+    // Contains. All a1 info are in a2
+    IMPORT_C TBool Contains( MPresenceInfo& a1, MPresenceInfo& a2 ) const;
+
+    
+    // Equality comparison
+    IMPORT_C TBool Equals( CPresenceInfoImp& a1, CPresenceInfoImp& a2 ) const;
+
+    // Equality assertion
+    // TODO these are containment currently. Used by t_dmattrobjs. Modify...
+    IMPORT_C static void AssertEquality( MPresenceInfo& a1,
+                                   MPresenceInfo& a2 );
+
+//private: // Helpers
+    IMPORT_C static void InsertPrefixL( const TDesC8* aPrefix, RBuf8& buf );
+    };
+
+#endif //PRFWTESTPRESENCEDATAUTILS_H
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/testcaseutils/prfwtestrobustnesstools.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,95 @@
+/*
+* 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:  Tools to increase Presence Engine tests robustness.
+ *
+*/
+
+#ifndef PENGTSTROBUSTNESSTOOLS_H__
+#define PENGTSTROBUSTNESSTOOLS_H__
+
+
+// INCLUDES
+#include <e32std.h>
+//#include <eunitmacros.h>
+#include <platform/digia/eunit/eunitmacros.h>
+#include <platform/digia/eunit/teunitassertioninfo.h>
+#include "prfwtestprocessmaster.h"
+#include "userafter.h"
+#include "prfwtestfiletool.h"
+
+//MACROS
+
+
+// CLASS DESCRIPTION
+
+/**
+ * PE test robustness handler.
+ */
+class PrfwTestRobustness
+    {
+    public: //Robustness handling
+        static inline void DoPreCleaning();
+
+    private: //Helpers
+        static inline void HandleKill( TInt aErr,
+                TInt aWaitTime,
+                const TDesC& aDescription );
+
+    private: //Prohibited constructor / destructor
+        PrfwTestRobustness() {}
+        ~PrfwTestRobustness() {}
+    };
+
+
+
+// -----------------------------------------------------------------------------
+// PrfwTestRobustness public functions
+// -----------------------------------------------------------------------------
+//
+inline void PrfwTestRobustness::DoPreCleaning()
+    {
+    TInt err = PrfwTestProcessMaster::KillPscServers();
+    HandleKill( err, 0, _L("PSC srv processes - Pre") );
+
+    err = PrfwTestProcessMaster::KillRootServer();
+    HandleKill( err, 0, _L("ROOT srv processes - pre") );
+
+    TRAPD( ignore, CXIMPTestFileTool::CleanAllL() );
+    }
+
+
+// -----------------------------------------------------------------------------
+// PrfwTestRobustness functions
+// -----------------------------------------------------------------------------
+//
+inline void PrfwTestRobustness::HandleKill( TInt aErr,
+        TInt aWaitTime,
+        const TDesC& aDescription )
+    {
+    if( aErr > 0 )
+        {
+        if( aWaitTime > 0 )
+            {
+            TRAPD( ignore, CUserAfter::AfterL( aWaitTime ) );    
+            }
+
+        EUNIT_PRINT( _L("ProcessKill: %S, %d instance(s)"), &aDescription, aErr );
+        }
+    }
+
+
+#endif // PRWFWTESTROBUSTNESSTOOLS_H__
+
+//  End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/testcaseutils/prfwteststatuseventlistener.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,1051 @@
+/*
+* 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:
+*
+*/
+
+#include "prfwteststatuseventlistener.h"
+#include "prfwtestcaseutilspanics.h"
+#include <eunitmacros.h>
+
+#include <ximpcontext.h>
+#include <ximpcontextstateevent.h>
+#include <ximprequestcompleteevent.h>
+#include <ximpstatus.h>
+#include <ownpresenceevent.h>
+#include <presentitypresenceevent.h>
+#include <presentitygrouplistevent.h>
+#include <presentitygroupcontentevent.h>
+#include <presencewatcherlistevent.h>
+#include <presencewatcherinfo.h>
+#include <ximpdatasubscriptionstate.h>
+
+
+using namespace NXIMPTestCaseUtilsPanic;
+EUNIT_DECLARE_PRINTABLE_AS_TINT( MXIMPContextState::TState )
+
+
+    // ============================ MEMBER FUNCTIONS ===============================
+EXPORT_C TXIMPTestStatusEventSnapshot::TXIMPTestStatusEventSnapshot()
+    {
+    iEventType = TXIMPTestStatusEventSnapshot::EStateValueNotPresent;
+    iCtxState = (MXIMPContextState::TState) TXIMPTestStatusEventSnapshot::EStateValueNotPresent;
+    iReqId = TXIMPRequestId();
+    iResultCode = TXIMPTestStatusEventSnapshot::EStateValueNotPresent;
+    }
+
+
+EXPORT_C TXIMPTestStatusEventSnapshot::TXIMPTestStatusEventSnapshot(
+        TInt aEventType,
+        TInt aCtxState,
+        TInt aResultCode )
+    {
+    iEventType = aEventType;
+    iCtxState = (MXIMPContextState::TState) aCtxState;
+    iResultCode = aResultCode;
+    }
+
+EXPORT_C TBool TXIMPTestStatusEventSnapshot::Equals(
+        const TXIMPTestStatusEventSnapshot& aOther ) const
+    {
+    TBool equals = ETrue;
+
+    if( iEventType != aOther.iEventType )
+        {
+        equals = EFalse;
+        }
+
+    if( iCtxState != aOther.iCtxState )
+        {
+        equals = EFalse;
+        }
+
+    if( iResultCode != aOther.iResultCode )
+        {
+        equals = EFalse;
+        }
+
+    return equals;
+    }
+
+
+
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+EXPORT_C CXIMPTestStatusEventListener* CXIMPTestStatusEventListener::NewL(
+        TInt aStackSize,
+        MXIMPContext* aEventSource )
+    {
+    CXIMPTestStatusEventListener* self =
+        new (ELeave) CXIMPTestStatusEventListener( aStackSize, aEventSource );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+
+CXIMPTestStatusEventListener::~CXIMPTestStatusEventListener()
+    {
+    User::Free( iSnapshots );
+    if( iEventSource )
+        {
+        iEventSource->UnregisterObserver( *this );
+        }
+
+    iAcceptedEventTypes.Reset();
+    iDescription.Close();
+    }
+
+
+CXIMPTestStatusEventListener::CXIMPTestStatusEventListener(
+        TInt aStackSize,
+        MXIMPContext* aEventSource )
+: iSnapshotMaxCount( aStackSize ),
+    iEventSource( aEventSource )
+    {
+    }
+
+
+void CXIMPTestStatusEventListener::ConstructL()
+    {
+    __ASSERT_ALWAYS( iSnapshotMaxCount > 0,
+            Panic( EStatusEventListenerBadMaxCount ) );
+
+    TInt allocSize = iSnapshotMaxCount * sizeof( TXIMPTestStatusEventSnapshot );
+    iSnapshots = (TXIMPTestStatusEventSnapshot*) User::AllocL( allocSize );
+    ResetEventStack();
+    ResetEventTypeStack();
+
+    if( iEventSource )
+        {
+        TArray< TInt32 > eventFilterArray = iAcceptedEventTypes.Array();
+        iEventSource->RegisterObserverL( *this, &eventFilterArray );
+        }
+
+    iDescription.CreateL( 512 );
+    }
+
+
+
+
+// ===========================================================================
+// PUBLIC FUNCTIONS
+// ===========================================================================
+//
+EXPORT_C void CXIMPTestStatusEventListener::SetEventSourceL(
+        MXIMPContext* aEventSource )
+    {
+    if( iEventSource )
+        {
+        iEventSource->UnregisterObserver( *this );
+        }
+
+    if( aEventSource )
+        {
+        TArray< TInt32 > eventFilterArray = iAcceptedEventTypes.Array();
+        aEventSource->RegisterObserverL( *this, &eventFilterArray );
+        }
+
+    iEventSource = aEventSource;
+    }
+
+
+
+EXPORT_C void CXIMPTestStatusEventListener::ReRegisterEventFilterL()
+    {
+    if( iEventSource )
+        {
+        TArray< TInt32 > eventFilterArray = iAcceptedEventTypes.Array();
+        iEventSource->RegisterObserverL( *this, &eventFilterArray );
+        }
+    }
+
+
+
+EXPORT_C RArray< TInt32 >& CXIMPTestStatusEventListener::AcceptedEventTypes()
+    {
+    return iAcceptedEventTypes;
+    }
+
+
+
+EXPORT_C void CXIMPTestStatusEventListener::GetEventTemplateL(
+        RArray< TXIMPTestStatusEventSnapshot >& aArray,
+        TXIMPTestStatusEventTemplate aTemplate )
+    {
+	CleanupClosePushL(aArray);
+    switch( aTemplate )
+        {
+        // session handling
+        case EXIMPTestStatusEvents_BindingOk:
+            {
+            TXIMPTestStatusEventSnapshot event;
+            event.iEventType = MXIMPContextStateEvent::KInterfaceId;
+            event.iCtxState = MXIMPContextState::EBinding;
+            event.iResultCode = TXIMPTestStatusEventSnapshot::EStatusObjNotPresent;
+            aArray.AppendL( event );
+
+            event.iEventType = MXIMPContextStateEvent::KInterfaceId;
+            event.iCtxState = MXIMPContextState::EActive;
+            event.iResultCode = TXIMPTestStatusEventSnapshot::EStatusObjNotPresent;
+            aArray.AppendL( event );
+
+            event.iEventType = MXIMPRequestCompleteEvent::KInterfaceId;
+            event.iCtxState = (MXIMPContextState::TState) TXIMPTestStatusEventSnapshot::EStateValueNotPresent;
+            event.iResultCode = KErrNone;
+            aArray.AppendL( event );
+
+            break;
+            }
+
+        case EXIMPTestStatusEvents_BindingFailKErrAbort:
+            {
+            TXIMPTestStatusEventSnapshot event;
+            event.iEventType = MXIMPContextStateEvent::KInterfaceId;
+            event.iCtxState = MXIMPContextState::EBinding;
+            event.iResultCode = TXIMPTestStatusEventSnapshot::EStatusObjNotPresent;
+            aArray.AppendL( event );
+
+            event.iEventType = MXIMPContextStateEvent::KInterfaceId;
+            event.iCtxState = MXIMPContextState::EInactive;
+            event.iResultCode = TXIMPTestStatusEventSnapshot::EStatusObjNotPresent;
+            aArray.AppendL( event );
+
+            event.iEventType = MXIMPRequestCompleteEvent::KInterfaceId;
+            event.iCtxState = (MXIMPContextState::TState) TXIMPTestStatusEventSnapshot::EStateValueNotPresent;
+            event.iResultCode = KErrAbort;
+            aArray.AppendL( event );
+            break;
+            }
+
+        case EXIMPTestStatusEvents_BindingFailInvalidReqId:
+            {
+            TXIMPTestStatusEventSnapshot event;
+            event.iEventType = MXIMPContextStateEvent::KInterfaceId;
+            event.iCtxState = MXIMPContextState::EBinding;
+            event.iResultCode = TXIMPTestStatusEventSnapshot::EStatusObjNotPresent;
+            aArray.AppendL( event );
+
+            event.iEventType = MXIMPRequestCompleteEvent::KInterfaceId;
+            event.iCtxState = (MXIMPContextState::TState) TXIMPTestStatusEventSnapshot::EStateValueNotPresent,
+            event.iResultCode = KErrServerTerminated;
+            aArray.AppendL( event );            
+            
+            event.iEventType = MXIMPContextStateEvent::KInterfaceId;
+            event.iCtxState = MXIMPContextState::EInactive;
+            event.iResultCode = KErrServerTerminated;
+            
+            aArray.AppendL( event );
+            break;
+            }
+
+
+        case EXIMPTestStatusEvents_BindingFailServerTermination:
+            {
+            TXIMPTestStatusEventSnapshot event;
+            event.iEventType = MXIMPContextStateEvent::KInterfaceId;
+            event.iCtxState = MXIMPContextState::EUnbinding;
+            event.iResultCode = KErrServerTerminated;
+            aArray.AppendL( event );
+
+            event.iEventType = MXIMPContextStateEvent::KInterfaceId;
+            event.iCtxState = MXIMPContextState::EInactive;
+            event.iResultCode = KErrServerTerminated;
+            aArray.AppendL( event );
+
+            event.iEventType = MXIMPRequestCompleteEvent::KInterfaceId;
+            event.iCtxState = (MXIMPContextState::TState) TXIMPTestStatusEventSnapshot::EStateValueNotPresent;
+            event.iResultCode = KErrServerTerminated;
+            aArray.AppendL( event );
+
+            break;
+            }
+
+        case EXIMPTestStatusEvents_UnbindingOk:
+            {
+            TXIMPTestStatusEventSnapshot event;
+            event.iEventType = MXIMPContextStateEvent::KInterfaceId;
+            event.iCtxState = MXIMPContextState::EUnbinding;
+            event.iResultCode = TXIMPTestStatusEventSnapshot::EStatusObjNotPresent;
+            aArray.AppendL( event );
+
+            event.iEventType = MXIMPContextStateEvent::KInterfaceId;
+            event.iCtxState = MXIMPContextState::EInactive;
+            event.iResultCode = TXIMPTestStatusEventSnapshot::EStatusObjNotPresent;
+            aArray.AppendL( event );
+
+            event.iEventType = MXIMPRequestCompleteEvent::KInterfaceId;
+            event.iCtxState = (MXIMPContextState::TState) TXIMPTestStatusEventSnapshot::EStateValueNotPresent;
+            event.iResultCode = KErrNone;
+            aArray.AppendL( event );
+            break;
+            }
+
+
+        case EXIMPTestStatusEvents_RequestOk:
+            {
+            TXIMPTestStatusEventSnapshot event;
+            event.iEventType = MXIMPRequestCompleteEvent::KInterfaceId;
+            event.iCtxState = (MXIMPContextState::TState) TXIMPTestStatusEventSnapshot::EStateValueNotPresent;
+            event.iResultCode = KErrNone;
+            aArray.AppendL( event );
+            break;
+            }
+
+
+        case EXIMPTestStatusEvents_RequestOOM:
+            {
+            TXIMPTestStatusEventSnapshot event;
+            event.iEventType = MXIMPRequestCompleteEvent::KInterfaceId;
+            event.iCtxState = (MXIMPContextState::TState) TXIMPTestStatusEventSnapshot::EStateValueNotPresent;
+            event.iResultCode = KErrNoMemory;
+            aArray.AppendL( event );
+            break;
+            }
+
+
+
+        // own presence
+        case EXIMPTestStatusEvents_SubscribeOwnPresenceSingleCtx:
+            {
+            TXIMPTestStatusEventSnapshot event;
+            event.iEventType = MOwnPresenceEvent::KInterfaceId;
+            event.iCtxState = (MXIMPContextState::TState) ( MXIMPDataSubscriptionState::EDataUnavailable + MXIMPDataSubscriptionState::ESubscriptionActive );
+            event.iResultCode = TXIMPTestStatusEventSnapshot::EStateValueNotPresent;
+            aArray.AppendL( event );
+            break;
+            }
+
+        case EXIMPTestStatusEvents_UnsubscribeOwnPresenceSingleCtx:
+            {
+            TXIMPTestStatusEventSnapshot event;
+            event.iEventType = MOwnPresenceEvent::KInterfaceId;
+            event.iCtxState = (MXIMPContextState::TState) ( MXIMPDataSubscriptionState::EDataUnavailable + MXIMPDataSubscriptionState::ESubscriptionInactive );
+            event.iResultCode = TXIMPTestStatusEventSnapshot::EStateValueNotPresent;
+            aArray.AppendL( event );
+            break;
+            }
+
+        // presentity presence
+        case EXIMPTestStatusEvents_SubscribePresentityPresenceSingleCtx:
+            {
+            TXIMPTestStatusEventSnapshot event;
+            event.iEventType = MPresentityPresenceEvent::KInterfaceId;
+            event.iCtxState = (MXIMPContextState::TState) ( MXIMPDataSubscriptionState::EDataUnavailable + MXIMPDataSubscriptionState::ESubscriptionActive );
+            event.iResultCode = TXIMPTestStatusEventSnapshot::EStateValueNotPresent;
+            aArray.AppendL( event );
+            break;
+            }
+
+        case EXIMPTestStatusEvents_UnsubscribePresentityPresenceSingleCtx:
+            {
+            TXIMPTestStatusEventSnapshot event;
+            event.iEventType = MPresentityPresenceEvent::KInterfaceId;
+            event.iCtxState = (MXIMPContextState::TState) ( MXIMPDataSubscriptionState::EDataUnavailable + MXIMPDataSubscriptionState::ESubscriptionInactive );
+            event.iResultCode = TXIMPTestStatusEventSnapshot::EStateValueNotPresent;
+            aArray.AppendL( event );
+            break;
+            }
+
+        // group lists
+        case EXIMPTestStatusEvents_SubscribePresentityGroupListCtx:
+            {
+            // TODO check this
+            TXIMPTestStatusEventSnapshot event;
+            event.iEventType = MPresentityGroupListEvent::KInterfaceId;
+            event.iCtxState = (MXIMPContextState::TState) TXIMPTestStatusEventSnapshot::EStateValueNotPresent;
+            event.iResultCode = KErrNone;
+            aArray.AppendL( event );
+
+            event.iEventType = MXIMPRequestCompleteEvent::KInterfaceId;
+            event.iCtxState = (MXIMPContextState::TState) TXIMPTestStatusEventSnapshot::EStateValueNotPresent;
+            event.iResultCode = KErrNone;
+            aArray.AppendL( event );
+            break;
+            }
+
+        case EXIMPTestStatusEvents_UnsubscribePresentityGroupListCtx:
+            {
+            TXIMPTestStatusEventSnapshot event;
+            event.iEventType = MPresentityGroupListEvent::KInterfaceId;
+            // TODO check this
+            event.iCtxState = (MXIMPContextState::TState) TXIMPTestStatusEventSnapshot::EStateValueNotPresent;
+            event.iResultCode = TXIMPTestStatusEventSnapshot::EStateValueNotPresent;
+            aArray.AppendL( event );
+            break;
+            }
+
+        case EXIMPTestStatusEvents_CreatePresentityGroup:
+            {
+            TXIMPTestStatusEventSnapshot event;
+            event.iEventType = MPresentityGroupListEvent::KInterfaceId;
+            // TODO check this
+            event.iCtxState = (MXIMPContextState::TState) TXIMPTestStatusEventSnapshot::EStateValueNotPresent;
+            event.iResultCode = TXIMPTestStatusEventSnapshot::EStateValueNotPresent;
+            aArray.AppendL( event );
+
+            event.iEventType = MXIMPRequestCompleteEvent::KInterfaceId;
+            event.iCtxState = (MXIMPContextState::TState) TXIMPTestStatusEventSnapshot::EStateValueNotPresent;
+            event.iResultCode = KErrNone;
+            aArray.AppendL( event );
+
+            break;
+            }
+
+        case EXIMPTestStatusEvents_HandlePresentityGroupList:
+            {
+            TXIMPTestStatusEventSnapshot event;
+            event.iEventType = MPresentityGroupListEvent::KInterfaceId;
+            // TODO check this
+            event.iCtxState = (MXIMPContextState::TState) TXIMPTestStatusEventSnapshot::EStateValueNotPresent;
+            event.iResultCode = TXIMPTestStatusEventSnapshot::EStateValueNotPresent;
+            aArray.AppendL( event );
+            break;
+            }
+
+        // group content
+        case EXIMPTestStatusEvents_SubscribePresentityGroupContentSingleCtx:
+            {
+            // TODO check this
+            TXIMPTestStatusEventSnapshot event;
+            event.iEventType = MPresentityGroupContentEvent::KInterfaceId;
+            event.iCtxState = (MXIMPContextState::TState) TXIMPTestStatusEventSnapshot::EStateValueNotPresent;
+            event.iResultCode = KErrNone;
+            aArray.AppendL( event );
+
+            event.iEventType = MXIMPRequestCompleteEvent::KInterfaceId;
+            event.iCtxState = (MXIMPContextState::TState) TXIMPTestStatusEventSnapshot::EStateValueNotPresent;
+            event.iResultCode = KErrNone;
+            aArray.AppendL( event );
+            break;
+            }
+
+        case EXIMPTestStatusEvents_UnsubscribePresentityGroupContentSingleCtx:
+            {
+            TXIMPTestStatusEventSnapshot event;
+            event.iEventType = MPresentityGroupContentEvent::KInterfaceId;
+            event.iCtxState = (MXIMPContextState::TState) TXIMPTestStatusEventSnapshot::EStateValueNotPresent;
+            event.iResultCode = TXIMPTestStatusEventSnapshot::EStateValueNotPresent;
+            aArray.AppendL( event );
+
+            event.iEventType = MXIMPRequestCompleteEvent::KInterfaceId;
+            event.iCtxState = (MXIMPContextState::TState) TXIMPTestStatusEventSnapshot::EStateValueNotPresent;
+            event.iResultCode = KErrNone;
+            aArray.AppendL( event );
+            break;
+            }
+
+        // watcher list
+        case EXIMPTestStatusEvents_SubscribePresenceWatcherListCtx:
+            {
+            TXIMPTestStatusEventSnapshot event;
+            event.iEventType = MPresenceWatcherListEvent::KInterfaceId;
+            event.iCtxState = (MXIMPContextState::TState) TXIMPTestStatusEventSnapshot::EStateValueNotPresent;
+            event.iResultCode = KErrNone;
+            aArray.AppendL( event );
+
+            event.iEventType = MXIMPRequestCompleteEvent::KInterfaceId;
+            event.iCtxState = (MXIMPContextState::TState) TXIMPTestStatusEventSnapshot::EStateValueNotPresent;
+            event.iResultCode = KErrNone;
+            aArray.AppendL( event );
+            break;
+            }
+
+        case EXIMPTestStatusEvents_UnsubscribePresenceWatcherListCtx:
+            {
+            TXIMPTestStatusEventSnapshot event;
+            event.iEventType = MPresenceWatcherListEvent::KInterfaceId;
+            event.iCtxState = (MXIMPContextState::TState) TXIMPTestStatusEventSnapshot::EStateValueNotPresent;
+            event.iResultCode = TXIMPTestStatusEventSnapshot::EStateValueNotPresent;
+            aArray.AppendL( event );
+            break;
+            }
+
+        case EXIMPTestStatusEvents_HandlePresenceWatcherList:
+            {
+            TXIMPTestStatusEventSnapshot event;
+            event.iEventType = MPresenceWatcherListEvent::KInterfaceId;
+            event.iCtxState = (MXIMPContextState::TState) TXIMPTestStatusEventSnapshot::EStateValueNotPresent;
+            event.iResultCode = TXIMPTestStatusEventSnapshot::EStateValueNotPresent;
+            aArray.AppendL( event );
+            break;
+            }
+
+        case EXIMPTestStatusEvents_HandlePresentityPresence:
+            {
+            TXIMPTestStatusEventSnapshot event;
+            event.iEventType = MPresentityPresenceEvent::KInterfaceId;
+            event.iCtxState = (MXIMPContextState::TState) ( MXIMPDataSubscriptionState::EDataAvailable + MXIMPDataSubscriptionState::ESubscriptionActive );
+            event.iResultCode = TXIMPTestStatusEventSnapshot::EStateValueNotPresent;
+            aArray.AppendL( event );
+            break;
+            }
+
+
+        case EXIMPTestStatusEvents_HandlePresentityPresencePending:
+            {
+            TXIMPTestStatusEventSnapshot event;
+            event.iEventType = MPresentityPresenceEvent::KInterfaceId;
+            event.iCtxState = (MXIMPContextState::TState) ( MXIMPDataSubscriptionState::EDataUnavailable + MXIMPDataSubscriptionState::ESubscriptionActive );
+            event.iResultCode = TXIMPTestStatusEventSnapshot::EStateValueNotPresent;
+            aArray.AppendL( event );
+            break;
+            }
+
+        case EXIMPTestStatusEvents_PresentitySubscribeFailKErrAbort:
+            {
+            TXIMPTestStatusEventSnapshot event;
+            event.iEventType = MXIMPRequestCompleteEvent::KInterfaceId;
+            event.iCtxState = (MXIMPContextState::TState) TXIMPTestStatusEventSnapshot::EStateValueNotPresent;
+            event.iResultCode = KErrAbort;
+            aArray.AppendL( event );
+            break;
+            }
+
+        // misc
+        case EXIMPTestStatusEvents_PublishOk:
+            {
+            TXIMPTestStatusEventSnapshot event;
+
+            // request complete with KErrNone
+            event.iEventType = MXIMPRequestCompleteEvent::KInterfaceId;
+            event.iCtxState = (MXIMPContextState::TState) TXIMPTestStatusEventSnapshot::EStateValueNotPresent;
+            event.iResultCode = KErrNone;
+            aArray.AppendL( event );
+
+            // OwnPresenceEvent
+            event.iEventType = MOwnPresenceEvent::KInterfaceId;
+            event.iCtxState = (MXIMPContextState::TState) TXIMPTestStatusEventSnapshot::EStateValueNotPresent;
+            event.iResultCode = TXIMPTestStatusEventSnapshot::EStatusObjNotPresent;
+            aArray.AppendL( event );
+
+            break;
+            }
+
+        case EXIMPTestStatusEvents_PublishFailKErrAbort:
+            {
+            TXIMPTestStatusEventSnapshot event;
+
+            // Request completed with KErrAbort
+            event.iEventType = MXIMPRequestCompleteEvent::KInterfaceId;
+            event.iCtxState = (MXIMPContextState::TState) TXIMPTestStatusEventSnapshot::EStateValueNotPresent;
+            event.iResultCode = KErrAbort;
+            aArray.AppendL( event );
+
+            break;
+            }
+
+        default:
+            {
+            Panic( EStatusEventListenerUnknownEventTemplate );
+            }
+        }
+		CleanupStack::Pop(&aArray);
+    }
+
+
+
+EXPORT_C void CXIMPTestStatusEventListener::WaitRequestAndStackEvents(
+        const TXIMPRequestId& aReqToWait, TBool aAnyReq /* = EFalse */ )
+    {
+    __ASSERT_ALWAYS( !iWait.IsStarted(),
+            Panic( EStatusEventListenerAlreadyWaiting ) );
+
+    iWaitForAnyReq = aAnyReq;
+    iReqToWait = aReqToWait;
+    iWaitForAnyEvent = EFalse;
+
+    iWait.Start();
+    }
+
+EXPORT_C void CXIMPTestStatusEventListener::WaitAnyEvent()
+    {
+    iWaitForAnyEvent = ETrue;
+    iWait.Start();
+    }
+
+
+EXPORT_C void CXIMPTestStatusEventListener::VerifyEventStackL(
+        const TArray< TXIMPTestStatusEventSnapshot >& aEventTraits,
+        const TDesC8& aErrorTitle ) const
+    {
+    iDescription.Zero();
+    TInt ix = 0;
+
+    //Dumb event lists if there is some mismatches
+    if( !HasSameEvents( aEventTraits ) )
+        {
+        iDescription = aErrorTitle;
+        iDescription += _L8("Mismatches in event stack");
+        EUNIT_PRINT( iDescription );
+
+        iDescription = _L8("Received: ");
+        for( ix = 0; ix < iSnapshotCount; ix++ )
+            {
+            GetNameForEvent( iDescription, SnapshotFromStack( ix ).iEventType );
+            }
+        EUNIT_PRINT( iDescription );
+
+
+        iDescription = _L8("Expected: ");
+        const TInt traitCount = aEventTraits.Count();
+        for( ix = 0; ix < traitCount; ix++ )
+            {
+            GetNameForEvent( iDescription, aEventTraits[ ix ].iEventType );
+            }
+        EUNIT_PRINT( iDescription );
+        }
+
+
+    //Now do the actual verification
+    iDescription = aErrorTitle;
+    iDescription += _L8("Event count mismatch");
+    EUNIT_ASSERT_EQUALS_DESC( iSnapshotCount, aEventTraits.Count(), iDescription.PtrZ() );
+
+
+    for( TInt ix = 0; ix < iSnapshotCount; ix++ )
+        {
+        const TXIMPTestStatusEventSnapshot& expected = aEventTraits[ ix ];
+        const TXIMPTestStatusEventSnapshot& received = SnapshotFromStack( ix );
+
+            {
+            iDescription = aErrorTitle;
+            iDescription.AppendFormat( _L8("Event type mismatch on event [%d]"), ix );
+            EUNIT_ASSERT_EQUALS_DESC( expected.iEventType, expected.iEventType, iDescription.PtrZ() );
+            }
+
+            {
+            const TInt type = received.iEventType;
+
+            iDescription = aErrorTitle;
+            iDescription += _L8("Content mismatch on ");
+            GetNameForEvent( iDescription, type );
+            iDescription.AppendFormat( _L8("event on position [%d]"), ix );
+            switch( type )
+                {
+                case MXIMPRequestCompleteEvent::KInterfaceId:
+                    {
+                    EUNIT_ASSERT_EQUALS_DESC( expected.iResultCode, received.iResultCode, iDescription.PtrZ() );
+                    break;
+                    }
+
+
+                case MXIMPContextStateEvent::KInterfaceId:
+                    {
+                    EUNIT_ASSERT_EQUALS_DESC( expected.iCtxState, received.iCtxState, iDescription.PtrZ() );
+                    EUNIT_ASSERT_EQUALS_DESC( expected.iResultCode, received.iResultCode, iDescription.PtrZ() );
+                    break;
+                    }
+
+                case MOwnPresenceEvent::KInterfaceId:
+                case MPresentityPresenceEvent::KInterfaceId:
+                    {
+                    EUNIT_ASSERT_EQUALS_DESC( expected.iCtxState, received.iCtxState, iDescription.PtrZ() );
+                    break;
+                    }
+
+                case MPresentityGroupListEvent::KInterfaceId:
+                    {
+                    EUNIT_ASSERT_EQUALS_DESC( expected.iCtxState, received.iCtxState, iDescription.PtrZ() );
+                    EUNIT_ASSERT_EQUALS_DESC( expected.iResultCode, received.iResultCode, iDescription.PtrZ() );
+                    break;
+                    }
+
+                case MPresentityGroupContentEvent::KInterfaceId:
+                    {
+                    EUNIT_ASSERT_EQUALS_DESC( expected.iCtxState, received.iCtxState, iDescription.PtrZ() );
+                    EUNIT_ASSERT_EQUALS_DESC( expected.iResultCode, received.iResultCode, iDescription.PtrZ() );
+                    break;
+                    }
+
+                case MPresenceWatcherListEvent::KInterfaceId:
+                    {
+                    EUNIT_ASSERT_EQUALS_DESC( expected.iCtxState, received.iCtxState, iDescription.PtrZ() );
+                    EUNIT_ASSERT_EQUALS_DESC( expected.iResultCode, received.iResultCode, iDescription.PtrZ() );
+                    break;
+                    }
+
+
+                default:
+                    {
+                    Panic( EUnsupportedEventTypeInVerification );
+                    break;
+                    }
+                }
+            }
+        }
+    }
+
+
+
+
+EXPORT_C TInt CXIMPTestStatusEventListener::GetReqCompletionErrL( 
+    const TXIMPRequestId& aReqId ) const
+    {
+    for( TInt ix = 0; ix < iSnapshotCount; ix++ )
+        {
+        const TXIMPTestStatusEventSnapshot& received = SnapshotFromStack( ix );
+        const TInt type = received.iEventType;
+
+        if( type == MXIMPRequestCompleteEvent::KInterfaceId )
+            {
+            if( received.iReqId == aReqId )
+                {
+                return received.iResultCode;
+                }
+            }
+        }
+    
+    User::Leave( KErrNotFound );
+    return KErrNotFound;
+    }
+
+
+EXPORT_C void CXIMPTestStatusEventListener::ResetEventStack()
+    {
+    for( TInt ix = 0; ix < iSnapshotMaxCount; ix++ )
+        {
+        new( &iSnapshots[ ix ] ) TXIMPTestStatusEventSnapshot();
+        }
+
+    iSnapshotCount = 0;
+    }
+
+EXPORT_C void CXIMPTestStatusEventListener::ResetEventTypeStack()
+    {
+    iAcceptedEventTypes.Reset();
+    iAcceptedEventTypes.AppendL( MXIMPRequestCompleteEvent::KInterfaceId );
+    iAcceptedEventTypes.AppendL( MXIMPContextStateEvent::KInterfaceId );
+    iAcceptedEventTypes.AppendL( MOwnPresenceEvent::KInterfaceId );
+    iAcceptedEventTypes.AppendL( MPresentityPresenceEvent::KInterfaceId );
+    }
+
+EXPORT_C void CXIMPTestStatusEventListener::SetEventObserver( MXIMPContextObserver* aObserver )
+    {
+    iObserver = aObserver;
+    }
+
+
+
+
+
+
+
+
+// ===========================================================================
+// FROM MPRFWPRESENCECONTEXTOBSERVER
+// ===========================================================================
+//
+void CXIMPTestStatusEventListener::HandlePresenceContextEvent(
+    const MXIMPContext& aContext,
+    const MXIMPBase& aEvent )
+    {
+    const TInt32 eventType = aEvent.GetInterfaceId();
+
+    __ASSERT_ALWAYS( iEventSource == &aContext,
+            Panic( EReceivingEventFromWrongContext ) );
+
+    __ASSERT_ALWAYS( IsAcceptedEventType( eventType ),
+            Panic( EReceivedNotAcceptedEventType ) );
+
+    TXIMPTestStatusEventSnapshot snapShot;
+    switch( eventType )
+        {
+        case MXIMPRequestCompleteEvent::KInterfaceId:
+            {
+            const MXIMPRequestCompleteEvent* event =
+                TXIMPGetInterface< const MXIMPRequestCompleteEvent >::From( aEvent, MXIMPBase::EPanicIfUnknown );
+                {
+                snapShot.iEventType = event->GetInterfaceId();
+                snapShot.iCtxState = (MXIMPContextState::TState) TXIMPTestStatusEventSnapshot::EStateValueNotPresent;
+                snapShot.iReqId = event->RequestId();
+                snapShot.iResultCode = event->CompletionResult().ResultCode();
+
+                AddSnapshotToStack( snapShot );
+                }
+
+            if( iWaitForAnyReq || event->RequestId() == iReqToWait )
+                {
+                HandleRequestCompleteReceived();
+                }
+
+            break;
+            }
+
+        case MXIMPContextStateEvent::KInterfaceId:
+            {
+            const MXIMPContextStateEvent& event =
+                *TXIMPGetInterface< const MXIMPContextStateEvent >::From( aEvent,
+                                                                                  MXIMPBase::EPanicIfUnknown );
+                {
+                TXIMPTestStatusEventSnapshot snapShot;
+                snapShot.iEventType = event.GetInterfaceId();
+                snapShot.iCtxState = event.ContextState().ContextState();
+                if( event.StateChangeReason() )
+                    {
+                    snapShot.iResultCode = event.StateChangeReason()->ResultCode();
+                    }
+                else
+                    {
+                    snapShot.iResultCode = TXIMPTestStatusEventSnapshot::EStatusObjNotPresent;
+                    }
+
+                AddSnapshotToStack( snapShot );
+                }
+            break;
+            }
+
+        case MOwnPresenceEvent::KInterfaceId:
+            {
+            const MOwnPresenceEvent& event =
+                *TXIMPGetInterface< const MOwnPresenceEvent >::From( aEvent,
+                                                                         MXIMPBase::EPanicIfUnknown );
+                {
+                TXIMPTestStatusEventSnapshot snapShot;
+                snapShot.iEventType = event.GetInterfaceId();
+                snapShot.iCtxState = ( MXIMPContextState::TState ) ( event.DataSubscriptionState().DataState() + event.DataSubscriptionState().SubscriptionState() );
+                AddSnapshotToStack( snapShot );
+                }
+            break;
+            }
+
+        case MPresentityPresenceEvent::KInterfaceId:
+            {
+            const MPresentityPresenceEvent& event =
+                *TXIMPGetInterface< const MPresentityPresenceEvent >::From( aEvent,
+                                                                                MXIMPBase::EPanicIfUnknown );
+                {
+                TXIMPTestStatusEventSnapshot snapShot;
+                snapShot.iEventType = event.GetInterfaceId();
+                snapShot.iCtxState = ( MXIMPContextState::TState ) ( event.DataSubscriptionState().DataState() + event.DataSubscriptionState().SubscriptionState() );
+                AddSnapshotToStack( snapShot );
+                }
+            break;
+            }
+
+        case MPresentityGroupListEvent::KInterfaceId:
+            {
+            const MPresentityGroupListEvent& event =
+                *TXIMPGetInterface< const MPresentityGroupListEvent >::From( aEvent,
+                                                                                 MXIMPBase::EPanicIfUnknown );
+                {
+                TXIMPTestStatusEventSnapshot snapShot;
+                snapShot.iEventType = event.GetInterfaceId();
+                AddSnapshotToStack( snapShot );
+                }
+            break;
+            }
+
+        case MPresentityGroupContentEvent::KInterfaceId:
+            {
+            const MPresentityGroupContentEvent& event =
+            *TXIMPGetInterface< const MPresentityGroupContentEvent >::From( aEvent,
+                                                                                MXIMPBase::EPanicIfUnknown );
+                {
+                TXIMPTestStatusEventSnapshot snapShot;
+                snapShot.iEventType = event.GetInterfaceId();
+                AddSnapshotToStack( snapShot );
+                }
+            break;
+            }
+
+
+        case MPresenceWatcherListEvent::KInterfaceId:
+            {
+            const MPresenceWatcherListEvent& event =
+                *TXIMPGetInterface< const MPresenceWatcherListEvent >::From( aEvent,
+                                                                                 MXIMPBase::EPanicIfUnknown );
+                {
+                TXIMPTestStatusEventSnapshot snapShot;
+                snapShot.iEventType = event.GetInterfaceId();
+                AddSnapshotToStack( snapShot );
+                }
+            break;
+            }
+
+
+        default:
+            {
+            break;
+            }
+        }
+
+    if( iObserver )
+        {
+        iObserver->HandlePresenceContextEvent( aContext, aEvent );
+        }
+
+    if( iWaitForAnyEvent )
+        {
+        HandleRequestCompleteReceived();
+        }
+    }
+
+
+
+// ===========================================================================
+// HELPERS
+// ===========================================================================
+//
+void CXIMPTestStatusEventListener::HandleRequestCompleteReceived()
+    {
+    if( iWait.IsStarted() )
+        {
+        iWait.AsyncStop();
+        }
+    }
+
+
+
+TBool CXIMPTestStatusEventListener::IsAcceptedEventType( TInt32 aEventType ) const
+    {
+    TInt index = iAcceptedEventTypes.Find( aEventType );
+    if( index == KErrNotFound )
+        {
+        return EFalse;
+        }
+    return ETrue;
+    }
+
+
+
+void CXIMPTestStatusEventListener::AddSnapshotToStack(
+        TXIMPTestStatusEventSnapshot aSnapshot )
+    {
+    __ASSERT_ALWAYS( iSnapshotCount < iSnapshotMaxCount,
+            Panic( EAddSnapshotOverflow ) );
+
+    iSnapshots[ iSnapshotCount ] = aSnapshot;
+    iSnapshotCount++;
+    }
+
+
+
+const TXIMPTestStatusEventSnapshot& CXIMPTestStatusEventListener::SnapshotFromStack( TInt aIndex ) const
+    {
+    __ASSERT_ALWAYS( aIndex < iSnapshotCount,
+            Panic( ESnapshotIndexOutOfBounds ) );
+
+    return iSnapshots[ aIndex ];
+    }
+
+
+
+TBool CXIMPTestStatusEventListener::HasSameEvents(
+        const TArray< TXIMPTestStatusEventSnapshot >& aEventTraits ) const
+    {
+    TBool hasSameEvents = ETrue;
+
+    if( iSnapshotCount != aEventTraits.Count() )
+        {
+        hasSameEvents = EFalse;
+        }
+    else
+        {
+        for( TInt ix = 0; ix < iSnapshotCount; ix++ )
+            {
+            const TXIMPTestStatusEventSnapshot& eventTrait = aEventTraits[ ix ];
+            const TXIMPTestStatusEventSnapshot& receivedEvent = SnapshotFromStack( ix );
+
+            if( !receivedEvent.Equals( eventTrait ) )
+                {
+                hasSameEvents = EFalse;
+                }
+            }
+        }
+
+    return hasSameEvents;
+    }
+
+
+
+void CXIMPTestStatusEventListener::GetNameForEvent(
+        TDes8& aTarget,
+        TInt aEventType ) const
+    {
+    switch( aEventType )
+        {
+        case MXIMPRequestCompleteEvent::KInterfaceId:
+            {
+            SafeAppendEventName( aTarget, _L8("[ReqComplete] ") );
+            break;
+            }
+
+        case MXIMPContextStateEvent::KInterfaceId:
+            {
+            SafeAppendEventName( aTarget, _L8("[PresCtx] ") );
+            break;
+            }
+
+        case MOwnPresenceEvent::KInterfaceId:
+            {
+            SafeAppendEventName( aTarget, _L8("[OwnPres] ") );
+            break;
+            }
+
+        case MPresentityGroupListEvent::KInterfaceId:
+            {
+            SafeAppendEventName( aTarget, _L8("[GroupList] ") );
+            break;
+            }
+
+        case MPresentityGroupContentEvent::KInterfaceId:
+            {
+            SafeAppendEventName( aTarget, _L8("[GroupContent] ") );
+            break;
+            }
+
+        case MPresentityPresenceEvent::KInterfaceId:
+            {
+            SafeAppendEventName( aTarget, _L8("[Presentity] ") );
+            break;
+            }
+
+        default:
+            {
+            SafeAppendEventName( aTarget, _L8("[Unknown] ") );
+            break;
+            }
+        }
+    }
+
+
+
+void CXIMPTestStatusEventListener::SafeAppendEventName(
+        TDes8& aTarget,
+        const TDesC8& aName ) const
+    {
+    const TInt sizeAvailable = aTarget.MaxLength() - aTarget.Length();
+
+    if( sizeAvailable > aName.Size() )
+        {
+        aTarget += aName;
+        }
+    else
+        {
+        _LIT8( KEllipsis, "..." );
+        if( sizeAvailable > KEllipsis().Size() )
+            {
+            aTarget += KEllipsis;
+            }
+        }
+    }
+
+
+
+
+// end of file
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/testcaseutils/prfwteststatuseventlistener.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,284 @@
+/*
+* 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:
+*
+*/
+
+#ifndef CPRFWTESTSTATUSEVENTLISTENER_H__
+#define CPRFWTESTSTATUSEVENTLISTENER_H__
+
+
+#include <e32base.h>
+#include <ximpcontextobserver.h>
+#include <ximpcontextstate.h>
+
+
+
+// CLASS DESCRIPTION
+/**
+ * Helper class to store snapshot from
+ * received status events:
+ * - MXIMPRequestCompleteEvent
+ * - MXIMPContextStateEvent
+ */
+class TXIMPTestStatusEventSnapshot
+    {
+public: //Value enums
+    enum
+        {
+        EStatusObjNotPresent = 100,
+        EStateValueNotPresent = 101
+        };
+
+public: //Constructors
+
+    //Default c++ constructor
+    IMPORT_C TXIMPTestStatusEventSnapshot();
+
+    //Constructor accepting integer fields
+    IMPORT_C TXIMPTestStatusEventSnapshot( TInt aEventType,
+                                           TInt aCtxState,
+                                           TInt aResultCode );
+
+public: //Comparator functions
+
+    IMPORT_C TBool Equals( const TXIMPTestStatusEventSnapshot& aOther ) const;
+
+
+public: //Data
+    TInt iEventType;
+    MXIMPContextState::TState iCtxState;
+    TXIMPRequestId iReqId;
+    TInt iResultCode;
+    TBuf< 24 > iPrtResultDescription;
+    };
+
+
+/**
+ * Enumeration defining supported
+ * status event templates.
+ */
+enum TXIMPTestStatusEventTemplate
+    {
+    EXIMPTestStatusEvents_BindingOk,
+    EXIMPTestStatusEvents_BindingFailKErrAbort,
+    EXIMPTestStatusEvents_BindingFailInvalidReqId,
+    EXIMPTestStatusEvents_BindingFailServerTermination,
+
+    EXIMPTestStatusEvents_UnbindingOk,
+
+    EXIMPTestStatusEvents_RequestOk,
+    EXIMPTestStatusEvents_RequestOOM,
+
+    EXIMPTestStatusEvents_PublishOk,
+    EXIMPTestStatusEvents_PublishFailKErrAbort,
+
+    EXIMPTestStatusEvents_SubscribeOwnPresenceSingleCtx,
+    EXIMPTestStatusEvents_UnsubscribeOwnPresenceSingleCtx,
+
+    EXIMPTestStatusEvents_SubscribePresentityPresenceSingleCtx,
+    EXIMPTestStatusEvents_UnsubscribePresentityPresenceSingleCtx,
+
+    EXIMPTestStatusEvents_SubscribePresentityGroupListCtx,
+    EXIMPTestStatusEvents_UnsubscribePresentityGroupListCtx,
+
+    EXIMPTestStatusEvents_SubscribePresentityGroupContentSingleCtx,
+    EXIMPTestStatusEvents_UnsubscribePresentityGroupContentSingleCtx,
+
+    EXIMPTestStatusEvents_HandlePresentityGroupList,
+
+    EXIMPTestStatusEvents_CreatePresentityGroup,
+
+    EXIMPTestStatusEvents_SubscribePresenceWatcherListCtx,
+    EXIMPTestStatusEvents_UnsubscribePresenceWatcherListCtx,
+    EXIMPTestStatusEvents_HandlePresenceWatcherList,
+
+    EXIMPTestStatusEvents_HandlePresentityPresence,
+    EXIMPTestStatusEvents_HandlePresentityPresencePending,
+    EXIMPTestStatusEvents_PresentitySubscribeFailKErrAbort,
+    };
+
+
+/**
+ * Presence context listener to record status events
+ * and to wait request completion
+ * Handles following event types:
+ * - MXIMPRequestCompleteEvent
+ * - MXIMPContextStateEvent
+ *
+ * For other XIMP event types, see other
+ * test listeners.
+ */
+class CXIMPTestStatusEventListener : public CBase,
+                                     public MXIMPContextObserver
+    {
+public:
+
+    /**
+     * Instantiates new listener object.
+     *
+     * If valid event source is given, reqisters this object as
+     * event observer to it.
+     */
+    IMPORT_C static CXIMPTestStatusEventListener* CXIMPTestStatusEventListener::NewL(
+                    TInt aStackSize,
+                    MXIMPContext* aEventSource );
+
+    ~CXIMPTestStatusEventListener();
+
+private:
+    CXIMPTestStatusEventListener( TInt aStackSize,
+                                  MXIMPContext* aEventSource );
+    void ConstructL();
+
+
+public:
+
+    /**
+     * Sets new event source from where to listen events.
+     * Unregisters from previous one.
+     * Can be NULL, in wich case just performs the
+     * unregistration.
+     */
+    IMPORT_C void SetEventSourceL( MXIMPContext* aEventSource );
+
+    /**
+     * Access to accepted event types list.
+     * Client can alter the list.
+     *
+     * By default list has:
+     * - MXIMPRequestCompleteEvent
+     * - MXIMPContextStateEvent
+     *
+     * NOTE: remember to push edited list to event source with
+     *       ReRegisterEventFilterL()
+     */
+    IMPORT_C RArray< TInt32 >& AcceptedEventTypes();
+
+
+    /**
+     * ReRegisters this listener to event source.
+     * In practice, takes new event filter in use.
+     */
+    IMPORT_C void ReRegisterEventFilterL();
+
+
+    /**
+     * Fills the given array with event templates.
+     *
+     * Given enumeration defines which template to retrieve.
+     */
+    IMPORT_C void GetEventTemplateL( RArray< TXIMPTestStatusEventSnapshot >& aArray,
+                                     TXIMPTestStatusEventTemplate aTemplate );
+
+    /**
+     * Method to wait with CActiveSchedulerWait
+     * the given request completion.
+     * NOTE: Only one request can be waited at time.
+     * Stacks received MXIMPRequestCompleteEvent and
+     * MXIMPContextStateEvent details to
+     * event stack.
+     *
+     * @param aReqToWait The request to wait.
+     */
+    IMPORT_C void WaitRequestAndStackEvents( const TXIMPRequestId& aReqToWait, TBool aAnyReq = EFalse );
+    IMPORT_C void WaitAnyEvent();
+
+
+    /**
+     * Verifies event stack contents against the given traits.
+     *
+     * NOTE: You can use GetEventTemplateL() to retrieve a
+     * common event traits.
+     *
+     * Error title is printed in the error assertion description.
+     */
+    IMPORT_C void VerifyEventStackL( const TArray< TXIMPTestStatusEventSnapshot >& aEventTraits,
+                                     const TDesC8& aErrorTitle ) const;
+
+    
+    
+    IMPORT_C TInt GetReqCompletionErrL( const TXIMPRequestId& aReqId ) const;
+
+
+
+    /**
+     * Resets the event stack contents.
+     */
+    IMPORT_C void ResetEventStack();
+    IMPORT_C void ResetEventTypeStack();
+
+    /**
+     * Set event observer when needed.
+     */
+    IMPORT_C void SetEventObserver( MXIMPContextObserver* aObserver );
+
+
+private:  //From MXIMPContextObserver
+
+    void HandlePresenceContextEvent(
+            const MXIMPContext& aContext,
+            const MXIMPBase& aEvent );
+
+
+private: //Helpers
+    void HandleRequestCompleteReceived();
+    TBool IsAcceptedEventType( TInt32 aEventType ) const;
+    void AddSnapshotToStack( TXIMPTestStatusEventSnapshot aSnapshot );
+    const TXIMPTestStatusEventSnapshot& SnapshotFromStack( TInt aIndex ) const;
+
+    TBool HasSameEvents( const TArray< TXIMPTestStatusEventSnapshot >& aEventTraits ) const;
+    void GetNameForEvent( TDes8& aTarget, TInt aEventType ) const;
+    void SafeAppendEventName( TDes8& aTarget, const TDesC8& aName ) const;
+
+
+
+
+private:  //Data
+
+    //OWN: Active scheduler wait for waiting the completion
+    CActiveSchedulerWait    iWait;
+
+
+    //OWN: Request ID identifying request which completion event to wait
+    TXIMPRequestId    iReqToWait;
+
+
+    //REF: Context from where receiving events
+    MXIMPContext* iEventSource;
+
+
+    //OWN: Accepted event types
+    RArray< TInt32 > iAcceptedEventTypes;
+
+
+    //OWN: Variables to maintain event snapshot stack
+    const TInt iSnapshotMaxCount;
+    TInt iSnapshotCount;
+    TXIMPTestStatusEventSnapshot* iSnapshots;
+
+    //OWN: Description buffer to hold the failure description
+    mutable RBuf8 iDescription;
+
+    TBool iWaitForAnyReq;
+
+    TBool iWaitForAnyEvent;
+
+    // To handle event by observer.
+    MXIMPContextObserver* iObserver;
+    };
+
+#endif //CPRFWTESTSTATUSEVENTLISTENER_H__
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/testcaseutils/prfwtestwaithelper.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  ?Description
+*
+*/
+
+
+
+#include <e32std.h>
+
+#include "prfwtestwaithelper.h"
+
+// ======== LOCAL FUNCTIONS ========
+
+
+// ======== MEMBER FUNCTIONS ========
+
+
+// ---------------------------------------------------------------------------
+// ?description_if_needed
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CXIMPTestWaitHelper* CXIMPTestWaitHelper::NewL()
+    {
+    CXIMPTestWaitHelper* self = new ( ELeave ) CXIMPTestWaitHelper;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+void CXIMPTestWaitHelper::ConstructL()
+    {
+    }
+    
+CXIMPTestWaitHelper::~CXIMPTestWaitHelper()
+    {
+    }
+        
+EXPORT_C void CXIMPTestWaitHelper::WaitForL( TInt aSeconds )
+    {
+    User::After( aSeconds * 1000000 );
+    }
+    
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/testcaseutils/prfwtestwaithelper.h	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  ?Description
+*
+*/
+
+
+
+#ifndef CPRFWTESTWAITHELPER_H
+#define CPRFWTESTWAITHELPER_H
+
+
+#include <e32base.h>
+
+class CXIMPTestGeneralWaiter;
+
+class CXIMPTestWaitHelper : public CBase
+    {
+    public:
+
+        IMPORT_C static CXIMPTestWaitHelper* NewL();
+        
+        IMPORT_C void WaitForL( TInt aSeconds );
+        
+        ~CXIMPTestWaitHelper();
+
+    private:
+    
+        /**
+         *
+         */
+        void ConstructL();
+
+    private: // data
+    };
+
+#endif // CPRFWTESTWAITHELPER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/testcaseutils/prfwwaitobserver.h	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  ?Description
+*
+*/
+
+
+
+#ifndef T_PRFWWAITOBSERVER
+#define T_PRFWWAITOBSERVER
+
+
+/**
+ * ?one_line_short_description
+ *
+ * ?more_complete_description
+ *
+ * @lib ?library
+ * @since S60 v4.0
+ */
+class T_MWaitObserver
+    {
+
+public:
+
+    /**
+     * ?description
+     *
+     * @since S60 ?S60_version
+     * @param ?arg1 ?description
+     * @param ?arg2 ?description
+     * @return ?description
+     */
+    virtual void WaitCompleted( TInt aRetVal ) = 0;
+
+
+protected:
+
+    /**
+     * Protected destructor.
+     * Instancies can't be destroyed via this interface.
+     */
+    virtual ~T_MWaitObserver() {};
+
+    };
+
+
+
+#endif // T_PRFWWAITOBSERVER
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/testcaseutils/userafter.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,151 @@
+/*
+* 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:  Active object based wait.
+*
+*/
+
+#ifndef CUSERAFTER_H__
+#define CUSERAFTER_H__
+
+// INCLUDES
+#include <e32base.h>
+
+
+// CLASS DESCRIPTION
+
+/**
+ * Active object based wait.
+ *
+ * Similar like User::After() but doesn't block
+ * whole thread, but current RunL() with
+ * CActiveSchedulerWait.
+ */
+class CUserAfter : public CTimer
+    {
+    public: //Construction
+        static inline CUserAfter* NewL();
+        static inline CUserAfter* NewLC();
+       ~CUserAfter();
+
+
+    public: //Wait support
+
+        /**
+         * Static "one shot" wait method.
+         */
+        static inline void AfterL( TInt aWaitTimeMicroSeconds );
+        static inline void AfterSecondsL( TInt aWaitTimeSeconds );
+
+        /**
+         * Member wait method.
+         */
+        inline void After( TInt aWaitTimeMicroSeconds );
+
+
+    private:
+        CUserAfter();
+
+        void RunL();
+        void RunError();
+        void DoCancel();
+
+
+    private:    //data
+        CActiveSchedulerWait iWait;
+
+    };
+
+
+
+
+// -----------------------------------------------------------------------------
+// CUserAfter public functions
+// -----------------------------------------------------------------------------
+//
+inline CUserAfter* CUserAfter::NewL()
+    {
+    CUserAfter* self = CUserAfter::NewLC();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+inline CUserAfter* CUserAfter::NewLC()
+    {
+    CUserAfter* self = new (ELeave) CUserAfter();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+
+inline CUserAfter::~CUserAfter()
+    {
+    CTimer::Cancel();
+    }
+
+inline void CUserAfter::After( TInt aWaitTimeMicroSeconds )
+    {
+    CTimer::After( aWaitTimeMicroSeconds );
+    iWait.Start();
+    }
+
+
+inline void CUserAfter::AfterL( TInt aWaitTimeMicroSeconds )
+    {
+    CUserAfter* after = CUserAfter::NewL();
+    after->After( aWaitTimeMicroSeconds );
+    delete after;
+    }
+
+
+inline void CUserAfter::AfterSecondsL( TInt aWaitTimeSeconds )
+    {
+    CUserAfter* after = CUserAfter::NewL();
+    after->After( aWaitTimeSeconds * 1000000 );
+    delete after;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CUserAfter private functions
+// -----------------------------------------------------------------------------
+//
+inline CUserAfter::CUserAfter()
+    : CTimer( CActive::EPriorityStandard )
+    {
+    CActiveScheduler::Add( this );
+    }
+
+
+inline void CUserAfter::RunL()
+    {
+    iWait.AsyncStop();
+    Cancel();
+    }
+
+inline void CUserAfter::RunError()
+    {
+    }
+
+inline void CUserAfter::DoCancel()
+    {
+    iWait.AsyncStop();
+    CTimer::DoCancel();
+    }
+
+
+#endif // CUSERAFTER_H__
+
+// End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_feature_plugin_api/ximp_core_feature_plugin_api.metaxml	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,21 @@
+<?xml version="1.0" ?>
+<api id="4f52c616453696d89dd07f3274833eae" dataversion="1.0">
+<name>ximp_core_feature_plugin_api</name>
+<description>Contains interfaces for managing and accessing the XIMP Feature Plugins .
+</description>
+<type>c++</type>
+<subsystem>ximpfw</subsystem>
+<libs><lib name="ximpdatamodel.lib"/>
+<lib name="ximpoperations.lib"/>
+<lib name="ximpecomhook.lib"/>
+<lib name="ximpmanager.lib"/>
+<lib name="ximpsrvclient.lib"/>
+<lib name="ximpprocessor.lib"/>
+<lib name="ximputils.lib"/>
+</libs>
+<release category="domain" sinceversion=""/>
+<attributes>
+<htmldocprovided>yes</htmldocprovided>
+<adaptation>no</adaptation>
+</attributes>
+</api>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_management_api/group/bld.inf	Wed Nov 03 09:32:20 2010 +0530
@@ -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 
+:                XIMP Core Management API
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+../inc/ximpcontextstateevent.h     MW_LAYER_PLATFORM_EXPORT_PATH(ximpcontextstateevent.h)
+../inc/ximpclient.inl     MW_LAYER_PLATFORM_EXPORT_PATH(ximpclient.inl)
+../inc/ximpclient.h     MW_LAYER_PLATFORM_EXPORT_PATH(ximpclient.h)
+../inc/ximpcontextobserver.h     MW_LAYER_PLATFORM_EXPORT_PATH(ximpcontextobserver.h)
+../inc/ximpcontext.h     MW_LAYER_PLATFORM_EXPORT_PATH(ximpcontext.h)
+../inc/ximprequestcompleteevent.h     MW_LAYER_PLATFORM_EXPORT_PATH(ximprequestcompleteevent.h)
+../inc/ximpmanagementifids.hrh     MW_LAYER_PLATFORM_EXPORT_PATH(ximpmanagementifids.hrh)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_management_api/inc/ximpclient.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,151 @@
+/*
+* 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:  Root interface for clients for XIMP Framework usage.
+*
+*/
+
+#ifndef MXIMPFWCLIENT_H
+#define MXIMPFWCLIENT_H
+
+#include <e32std.h>
+#include <ximpbase.h>
+#include <ximpmanagementifids.hrh>
+
+
+class MXIMPProtocolInfo;
+class MXIMPFeatureInfo;
+class MXIMPContext;
+
+
+/**
+ * Root interface for clients for XIMP Framework usage.
+ *
+ * MXIMPClient is main interface for XIMP Framework
+ * clients, to access XIMP Framework services.
+ * Interface is implemented by the XIMP Framework.
+ * MXIMPClient instance is created with the
+ * MXIMPClient::NewClientL() method.
+ *
+ * MXIMPClient provides methods to query available
+ * presence protocols and their capabilities.
+ *
+ * MXIMPClient is also factory for instantiating
+ * presence context objects.
+ *
+ * @ingroup ximpfwmanagementapi
+ * @since S60 v3.2
+ */
+class MXIMPClient : public MXIMPBase
+    {
+public:
+
+    /**
+     * ECom interface UID for the MXIMPClient.
+     *
+     * This interface ID is used:
+     * 1) In XIMPFw ECom registration file, to declare
+     *    implemented interface. It is used also by
+     *    the MXIMPClient::NewClientL() instantiation
+     *    method, when creating MXIMPClient instance
+     *    through the ECom.
+     *
+     * 2) By clients when resolving MXIMPClient interface
+     *    through MXIMPBase::GetInterface().
+     */
+    enum { KInterfaceId = XIMP_ECOM_IF_UID_CLIENT_INTERFACE };
+
+
+public:
+
+    /**
+     * Factory method to instantiate MXIMPClient.
+     *
+     * Factory method to instantiate platform default
+     * MXIMPClient implementation through the ECom.
+     * If the default presence framework isn't supported
+     * in the platform, leaves with errorcode signalled
+     * from ECom.
+     *
+     * @return The new presence client object. Object
+     *         ownership is returned to caller.
+     */
+    static inline MXIMPClient* NewClientL();
+
+
+    /**
+     * Public destructor.
+     * Object can be deleted through this interface.
+     */
+    virtual inline ~MXIMPClient();
+
+
+
+protected:
+
+    /**
+     * Default constructor to zero initialize
+     * the iEcomDtorID member.
+     */
+    inline MXIMPClient();
+
+
+public:
+
+    /**
+     * Retrieves a list of presence protocols.
+     *
+     * @param [in, out] aProtocols
+     *        The list of presence protocols, each protocol is
+     *        presented with MXimpFwPresenceProtocolInfo object.
+     *        Existing protocol info items are deleted from array
+     *        before adding new entries. Ownership of created objects
+     *        is returned to caller.
+     */
+    virtual void GetProtocolsL(
+                RXIMPObjOwningPtrArray< MXIMPProtocolInfo >& aProtocols ) = 0;
+
+    /**
+     * Retrieves features supported by current
+     * XIMP Framework implementation.
+     *
+     * @return Features supported by the XIMP Framework.
+     *         Exact feature IDs are defined in NXIMPFeature
+     *         namespace. Object ownership is returned to
+     *         caller.
+     */
+    virtual MXIMPFeatureInfo* GetFrameworkFeaturesLC() = 0;
+
+
+    /**
+     * Instantiates new presence context object.
+     *
+     * @return New presence context instance.
+     *         Object ownership is returned to caller.
+     */
+    virtual MXIMPContext* NewPresenceContextLC() = 0;
+
+
+
+private: // Data
+
+    //OWN: ECom destructor ID
+    TUid iEcomDtorID;
+    };
+
+#include <ximpclient.inl>
+
+#endif // MXIMPFWCLIENT_H
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_management_api/inc/ximpclient.inl	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,64 @@
+/*
+* 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:  Root interface used by Presence Framework clients.
+*
+*/
+
+#include <ecom/ecom.h>
+
+
+// -----------------------------------------------------------------------------
+// MXIMPClient::NewClientL() implementation
+// Factory method to instantiate the platform default
+// MXIMPClient implementation through the ECom framework.
+// -----------------------------------------------------------------------------
+//
+inline MXIMPClient* MXIMPClient::NewClientL()
+    {
+    _LIT8( KXimpFwDefaultData, XIMP_ECOM_DEFAULT_DATA_CLIENT_INTERFACE );
+
+    TEComResolverParams resolvingParams;
+    resolvingParams.SetDataType( KXimpFwDefaultData );
+    resolvingParams.SetWildcardMatch( ETrue );
+
+    TAny* imp = REComSession::CreateImplementationL( TUid::Uid( MXIMPClient::KInterfaceId ),
+                                                     _FOFF( MXIMPClient, iEcomDtorID ),
+                                                     resolvingParams );
+
+    return reinterpret_cast< MXIMPClient* >( imp );
+    }
+
+
+// -----------------------------------------------------------------------------
+// MXIMPClient::MXIMPClient() implementation
+// Zero initializes the iEcomDtorID member.
+// -----------------------------------------------------------------------------
+//
+inline MXIMPClient::MXIMPClient()
+    {
+    iEcomDtorID = TUid::Null();
+    }
+
+
+// -----------------------------------------------------------------------------
+// MXIMPClient::~MXIMPClient()
+// Destructor notifies the ECom from implementation destruction.
+// -----------------------------------------------------------------------------
+//
+inline MXIMPClient::~MXIMPClient()
+    {
+    REComSession::DestroyedImplementation( iEcomDtorID );
+    }
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_management_api/inc/ximpcontext.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,271 @@
+/*
+* 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:  Interface for XIMP context.
+*
+*/
+
+#ifndef MXIMPFWPRESENCECONTEXT_H
+#define MXIMPFWPRESENCECONTEXT_H
+
+#include <e32std.h>
+#include <ximpbase.h>
+#include <ximpmanagementifids.hrh>
+
+
+class MXIMPClient;
+class MXIMPContextObserver;
+class MXIMPFeatureInfo;
+class MXIMPObjectFactory;
+
+
+
+/**
+ * Interface for XIMP context.
+ * This interface is implemented by the XIMP Framework.
+ *
+ * MXIMPContext is root interface for accessing
+ * and updating XIMP data to remote XIMP service.
+ * MXIMPContext client binds MXIMPContext
+ * interface to desired remote XIMP service and uses
+ * other MXIMPContext sub interfaces to publish
+ * and access XIMP data.
+ *
+ * Following sub interfaces can be accessed from
+ * from MXIMPContext:
+ *   - MXIMPObjectFactory
+ *
+ * All Presence events (context state, XIMP data,
+ * request completion etc. ones) are delivered through
+ * MXIMPContextObserver interface.
+ *
+ * @ingroup ximpfwmanagementapi
+ * @since S60 v3.2
+ */
+class MXIMPContext : public MXIMPBase
+    {
+public:
+
+    /** Interface ID for the MXIMPContext. */
+    enum { KInterfaceId = XIMP_IF_ID_CONTEXT };
+
+
+public:
+
+    /**
+     * Public destructor.
+     * Objects can be deleted through this interface.
+     */
+    virtual ~MXIMPContext() {}
+
+
+
+public:
+
+    /**
+     * Reqisters XIMP context event observer.
+     *
+     * Reqisters observer is notified from XIMP context events.
+     * XIMP Framework client side events are listed in
+     * MXIMPContextObserver header.
+     *
+     * Event delivery uses client side active object to callback
+     * the reqistered observer. If client thread is blocked with
+     * User::WaitFor...() or other high priority active objects,
+     * event notification is delayed until XIMP Framework
+     * client side active objects get their execution turn.
+     * When client is blocked, XIMP Framework queues events,
+     * and delivers those later in FIFO order to observer. However,
+     * the XIMP Framework limits the que size and thus
+     * events might get dropped if the the client is blocked
+     * too long.
+     *
+     * Even though client shouldn't perform any heavy
+     * processing in the event callback, XIMP Framework
+     * allows the client client to issue following kind of
+     * requests to XIMP Framework, from event callback:
+     * - Data management relatred asynchronous & synchronous requests
+     * - Observer registeration and unregisteration
+     * - Presence context undbind
+     * - Presence contex destroy
+     *
+     * @param [in] aObserver
+     *        The observer to be notified from context events.
+     *        If the observer is already registered, event filter
+     *        associated to it is updated.
+     *
+     * @param [in] aEventFilter
+     *        List of event types that the observer accepts.
+     *        Event types are identified with their event interface IDs.
+     *        If NULL, all event types are delivered to observer.
+     */
+    virtual void RegisterObserverL(
+            MXIMPContextObserver& aObserver,
+            const TArray<TInt32>* aEventFilter = NULL ) = 0;
+
+
+    /**
+     * Unregisters context event observer.
+     *
+     * @param [in] aObserver
+     *        The observer to unregister.
+     */
+    virtual void UnregisterObserver(
+            MXIMPContextObserver& aObserver ) = 0;
+
+
+
+    /**
+     * Binds the XIMP context to remote XIMP service.
+     *
+     * Binds the XIMP context to given XIMP service,
+     * with given credentials and by using defined protocol plug-in.
+     * Binding is asynchronous operation and evolves network interaction.
+     * Used protocol plug-in is identified explicitly with its
+     * implementation UID.
+     *
+     * @param [in] aProtocolImpUid
+     *        Protocol implementation UID identifying which
+     *        PSC protocol implementation to use.
+     *
+     * @param [in] aServiceAddress
+     *        Service address string identifying the remote
+     *        XIMP service.
+     *
+     * @param [in] aIapId
+     *        Internet Accesspoint for accessing the remote
+     *        XIMP service connection.
+     *
+     * @param [in] aUsername
+     *        Username (credential) for accessing the remote
+     *        XIMP service.
+     *
+     * @param [in] aPassword
+     *        Password (credential) for accessing the remote
+     *        XIMP service.
+     *
+     * @return The request ID identifying the started binding request.
+     *         Client can use request ID to find out correct
+     *         completion event from the MXIMPContextObserver
+     *         event stream.
+     */
+    virtual TXIMPRequestId BindToL(
+                TUid aProtocolImpUid,
+                const TDesC16& aServiceAddress,
+                const TDesC16& aUsername,
+                const TDesC16& aPassword,
+                TInt32 aIapId ) = 0;
+
+
+    virtual TXIMPRequestId BindToL(
+                TUid aProtocolImpUid,
+                const TDesC16& aServiceAddress,
+                const TDesC16& aUsername,
+                const TDesC16& aPassword,
+                const TDesC16& aClientId,
+                TInt32 aIapId ) = 0;
+
+    /**
+         * Binds the XIMP context to remote XIMP service.
+         *
+         * Binds the XIMP context to given XIMP service,
+         * with given credentials and by using defined protocol plug-in.
+         * Binding is asynchronous operation and evolves network interaction.
+         * Used protocol plug-in is identified explicitly with its
+         * implementation UID.
+         *
+         * @param [in] aProtocolImpUid
+         *        Protocol implementation UID identifying which
+         *        PSC protocol implementation to use.
+         *
+         * @param [in] aServiceAddress
+         *        Service address string identifying the remote
+         *        XIMP service.
+         *
+         * @param [in] aUsername
+         *        Username (credential) for accessing the remote
+         *        XIMP service.
+         *
+         * @param [in] aPassword
+         *        Password (credential) for accessing the remote
+         *        XIMP service.
+         * @param [in] aServiceId  - Service Id
+         * 
+         * @return The request ID identifying the started binding request.
+         *         Client can use request ID to find out correct
+         *         completion event from the MXIMPContextObserver
+         *         event stream.
+         */
+    virtual TXIMPRequestId BindToL( TUid aProtocolImpUid,
+                            TInt aServiceId ) = 0;
+
+    virtual TXIMPRequestId BindToL(
+                TUid aProtocolImpUid,
+                const TDesC16& aUsername,
+                const TDesC16& aPassword,
+                TInt aServiceId ) = 0;
+    /**
+     * Unbinds the XIMP context from the to currently binded
+     * XIMP service. Unbinding is asynchronous operation and
+     * might evolve network operations. Unbinding or waiting
+     * unbinding completion isn't mandatory for the client.
+     * XIMPFw performs unbinding implicitly when the bound
+     * MXIMPContext object is destroyed.
+     *
+     * @return The request ID identifying the started unbinding
+     *         request. Client can use request ID to find out correct
+     *         completion event from the MXIMPContextObserver
+     *         event stream.
+     */
+    virtual TXIMPRequestId UnbindL() = 0;
+
+
+
+    /**
+     * Retrieves Presence Contex features.
+     *
+     * Retrieves features supported by the Presence Contex.
+     * Features returned here may be "less" than what the
+     * protocol indicated, since connected remote service
+     * may limit available features.
+     *
+     * @return Features supported in Presence Contex.
+     *         Exact feature IDs are defined in NXIMPFeature
+     *         namespace. Object ownership is returned
+     *         to caller.
+     */
+    virtual MXIMPFeatureInfo* GetContextFeaturesLC() const = 0;
+
+
+
+public: //Sub interfaces for XIMP context
+
+
+    /**
+     * Gets reference to object factory interface.
+     *
+     * Returned object factory interface is used
+     * to instantiate XIMP objects.
+     *
+     * @return Object factory interface.
+     *         No ownership is returned caller.
+     */
+    virtual MXIMPObjectFactory& ObjectFactory() const = 0;
+
+    };
+
+
+#endif // MXIMPFWPRESENCECONTEXT_H
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_management_api/inc/ximpcontextobserver.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,160 @@
+/*
+* 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:  Interface for XIMP context event observer.
+*
+*/
+
+#ifndef XIMPFWPRESENCECONTEXTOBSERVER_H
+#define XIMPFWPRESENCECONTEXTOBSERVER_H
+
+#include <e32std.h>
+#include <ximpbase.h>
+
+
+class MXIMPContext;
+class MXimpFwEventBase;
+
+
+
+/**
+ * Interface for XIMP context event observer.
+ * This interface must be implemented by the client which
+ * is using the XIMP Framework services, to receive status
+ * and data notification callbacks from XIMP Framework.
+ *
+ * All callbacks from XIMP Framework XIMP context
+ * to client direction happen through this interface
+ * HandlePresenceContextEvent() method. Data content in callbacks
+ * is presented to client with following event specific
+ * interfaces:
+ *  - MXIMPRequestCompleteEvent
+ *  - MXIMPContextStateEvent
+ *  - MOwnPresenceEvent
+ *  - MPresentityPresenceEvent
+ *  - MPresentityGroupListEvent
+ *  - MPresentityGroupContentEvent
+ *  - MPresenceWatcherListEvent
+ *  - MPresenceGrantRequestListEvent
+ *  - MPresenceBlockListEvent
+ *
+ * See event interface type specific documentation
+ * for further information about different event types.
+ *
+ * Client can dispatch and cast event types on its own
+ * event callback implementation in following way:
+ * @code
+ * void CMyObserverClass::HandlePresenceContextEvent(
+ *      const MXIMPContext& aContext,
+ *      const MXIMPBase& aEvent )
+ *      {
+ *      switch( aEvent.GetInterfaceId() )
+ *          {
+ *          case MXIMPRequestCompleteEvent::KInterfaceId:
+ *              {
+ *              const MXIMPRequestCompleteEvent* complEvent =
+ *                  TXIMPGetInterface< const MXIMPRequestCompleteEvent >::From( aEvent,
+ *                                                                              MXIMPBase::EPanicIfUnknown );
+ *
+ *              // Do here request complete event specific handling
+ *              complEvent->RequestId();
+ *
+ *              break;
+ *              }
+ *
+ *
+ *          case MXIMPContextStateEvent::KInterfaceId:
+ *              {
+ *              const MXIMPContextStateEvent* ctxtStateEvent =
+ *                  TXIMPGetInterface< const MXIMPContextStateEvent >::From( aEvent,
+ *                                                                                   MXIMPBase::EPanicIfUnknown );
+ *              // Do here context state event specific handling
+ *              ctxtStateEvent->ContextState();
+ *
+ *              break;
+ *              }
+ *
+ *
+ *          default:
+ *              {
+ *              // New event types may be introduced in newer XIMP Framework
+ *              // versions, so handle unknown event types gracefully.
+ *              break;
+ *              }
+ *          }
+ *      }
+ *
+ * @endcode
+ *
+ *
+ * @ingroup ximpfwmanagementapi
+ * @since S60 v3.2
+ */
+class MXIMPContextObserver
+    {
+protected:
+
+    /**
+     * Protected destructor. Observer instancies
+     * can't be destroyed via this interface.
+     */
+    virtual ~MXIMPContextObserver() {}
+
+
+public:
+
+    /**
+     * Event callback.
+     *
+     * Events are delivered as MXIMPBase typed objects to client.
+     * Client can use MXIMPBase::GetInterfaceId() to determine
+     * the real event interface type.
+     *
+     * @param [in] aContext
+     *        Presence context object from where this event is coming.
+     *        Provided as reference for client, so client can
+     *        distinguish events from different contexts.
+     *
+     * @param [in] aEvent
+     *        The event object. Client can use MXIMPBase::GetInterfaceId()
+     *        to determine real event type and TXIMPGetInterface helper
+     *        to cast base typed object to real event interface.
+     *        Object ownership isn't transfered to client.
+     */
+    virtual void HandlePresenceContextEvent(
+                const MXIMPContext& aContext,
+                const MXIMPBase& aEvent ) = 0;
+
+
+    /**
+     * Extension point for this observer interface.
+     *
+     * Returns an pointer to MXIMPContextObserver
+     * extension interface or NULL if the concrete observer
+     * implementation doesn't support requested extension.
+     *
+     * @param [in] aInterfaceId
+     *        Interface ID identifying the requested extension
+     *        interface.
+     *
+     * @return Pointer to requested extension interface or NULL.
+     */
+    virtual TAny* PresenceContextObserverExtensionOrNull(
+                TInt32 aInterfaceId ) { ( void ) aInterfaceId; return NULL; }
+
+    };
+
+#endif // XIMPFWPRESENCECONTEXTOBSERVER_H
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_management_api/inc/ximpcontextstateevent.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,104 @@
+/*
+* 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:  Event interface for XIMP context state notification.
+*
+*/
+
+#ifndef MXIMPFWPRESENCECONTEXTSTATEEVENT_H
+#define MXIMPFWPRESENCECONTEXTSTATEEVENT_H
+
+
+#include <e32std.h>
+#include <ximpbase.h>
+#include <ximpmanagementifids.hrh>
+
+
+class MXIMPStatus;
+class MXIMPContextState;
+
+
+
+/**
+ * Event interface for XIMP context state notification.
+ *
+ * This interface is implemented by the XIMP Framework,
+ * and it is used to notify clients about XIMP context
+ * state changes.
+ *
+ * XIMP Framework signalls this event it to registered
+ * client observers through MXIMPContextObserver
+ * observer interface. Clients do need to perform any specific
+ * subscribe request for this event type, just register a valid
+ * observer with MXIMPPscContext::RegisterObserverL(),
+ * with such event type filter, that this
+ * MXIMPContextStateEvent interface is accepted.
+ *
+ * @ingroup ximpfwmanagementapievents
+ * @since S60 v3.2
+ */
+class MXIMPContextStateEvent : public MXIMPBase
+    {
+public:
+
+    /** Interface ID for the MXIMPContextStateEvent. */
+    enum { KInterfaceId = XIMP_IF_ID_CONTEXT_STATE_EVENT };
+
+
+
+protected:
+
+    /**
+     * Protected destructor.
+     * Event objects can't be deleted via this interface.
+     */
+    virtual ~MXIMPContextStateEvent() {}
+
+
+
+public:
+
+
+    /**
+     * Gets the XIMP context current state.
+     *
+     * @return The XIMP context current state.
+     */
+    virtual const MXIMPContextState& ContextState() const = 0;
+
+
+
+    /**
+     * Gets status object describing the XIMP contexts
+     * state change reason.
+     *
+     * Status object is optional and it is present only in
+     * those state change events which are originated from
+     * underlying protocol. Protocol can fill in into status
+     * object the details about the state reason.
+     *
+     * @return The MXIMPStatus object describing
+     *         the XIMP context state change reason.
+     *         NULL if no status object is present.
+     *         Object ownersip is not returned.
+     */
+    virtual const MXIMPStatus* StateChangeReason() const = 0;
+
+    };
+
+
+
+#endif // MXIMPFWPRESENCECONTEXTSTATEEVENT_H
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_management_api/inc/ximpmanagementifids.hrh	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,73 @@
+/*
+* 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:  XIMP Framework Presence Management API interface IDs.
+*
+*/
+
+#ifndef XIMPPRESENCEMANAGEMENTIFUIDS_HRH
+#define XIMPPRESENCEMANAGEMENTIFUIDS_HRH
+
+
+
+/**
+ * @defgroup ximpfwmanagementapi XIMP Core Management API
+ * @ingroup ximpcoreapi
+ *
+ * XIMP Core Management API contains
+ * abstract core management interfaces, which are implemented by
+ * XIMP Framework. XIMP Framework clients call these
+ * interfaces to request XIMP Framework execute
+ * certain XIMP services.
+ * @since S60 v3.2
+ */
+
+
+/**
+ * @defgroup ximpfwmanagementapievents XIMP Core Management API events
+ *
+ * XIMP Core Management API contains also
+ * abstract event interfaces, which are used to deliver data
+ * and state information to XIMP Framework clients through
+ * MXIMPContextObserver::HandlePresenceContextEvent()
+ * event callback.
+ *
+ * @ingroup ximpfwmanagementapi
+ * @since S60 v3.2
+ */
+
+
+// Management IF id's
+// 20xx - ximp related
+// 21xx - presence related
+// 22xx - instant messaging related
+
+// Interface UID for XIMP Protocol Plugin Base ECom interface
+#define XIMP_ECOM_IF_UID_CLIENT_INTERFACE              0x10282DD6
+
+
+// Default implementation resulution data
+// for XIMPFw Protocol Plugin Base ECom interface
+#define XIMP_ECOM_DEFAULT_DATA_CLIENT_INTERFACE         "default"
+
+
+// Interface IDs for XIMP Management API interfaces
+#define XIMP_IF_ID_CONTEXT                    2001
+#define XIMP_IF_ID_REQUEST_COMPLETE_EVENT     2002
+#define XIMP_IF_ID_CONTEXT_STATE_EVENT        2203
+#define XIMP_IF_ID_CONTEXT_INTERNAL           2204 
+
+
+
+#endif // XIMPPRESENCEMANAGEMENTIFUIDS_HRH
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_management_api/inc/ximprequestcompleteevent.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,114 @@
+/*
+* 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:  Event interface for request completion notification.
+*
+*/
+
+#ifndef MXIMPFWREQUESTCOMPLETEEVENT_H
+#define MXIMPFWREQUESTCOMPLETEEVENT_H
+
+#include <e32std.h>
+#include <ximpbase.h>
+#include <ximpmanagementifids.hrh>
+
+
+class MXIMPStatus;
+
+
+/**
+ * Event interface for request completion notification.
+ *
+ * This interface is implemented by the XIMP Framework,
+ * and it is used to notify clients that XIMP Framework
+ * has completed processing of certain client request.
+ *
+ * XIMP Framework signalls this event it to registered
+ * client observers through MXIMPContextObserver
+ * observer interface. Clients do need to perform any specific
+ * subscribe request for this event type, just register a valid
+ * observer with MXIMPPscContext::RegisterObserverL(),
+ * with such event type filter, that this MXIMPRequestCompleteEvent
+ * interface is accepted.
+ *
+ * @ingroup ximpfwmanagementapievents
+ * @since S60 v3.2
+ */
+class MXIMPRequestCompleteEvent : public MXIMPBase
+    {
+public:
+
+    /** Interface ID for the MXIMPRequestCompleteEvent. */
+    enum { KInterfaceId = XIMP_IF_ID_REQUEST_COMPLETE_EVENT };
+
+
+protected:
+
+    /**
+     * Protected destructor.
+     * Event objects can't be deleted via this interface.
+     */
+    virtual ~MXIMPRequestCompleteEvent() {}
+
+
+public:
+
+
+    /**
+     * Returns request id of the completed request.
+     *
+     * @return The request id.
+     */
+    virtual const TXIMPRequestId& RequestId() const = 0;
+
+
+    /**
+     * Returns request completion result.
+     *
+     * @return The request completion result object.
+     *         Object ownership is not returned to caller.
+     */
+    virtual const MXIMPStatus& CompletionResult() const = 0;
+
+
+    /**
+     * Looks up the extension data object having given
+     * interface type.
+     *
+     * Protocol adaptation or XIMP Framework itself
+     * may signal request specific extra data to client
+     * through request complete event. Client can use
+     * this method to retrieve a pointer to extra data
+     * object and later cast returned base object
+     * to real object interface type with TXIMPGetInterface.
+     *
+     * @param [in] aInterfaceId
+     *        The interface type of the extra data object
+     *        to be looked up.
+     *
+     * @return Pointer to object of given interface type
+     *         or NULL if no object having given interface
+     *         was found from this request complete events
+     *         extra data collection. Object ownership
+     *         is not returned to caller.
+     */
+    virtual const MXIMPBase* LookupCompletionDataByType(
+                TInt32 aInterfaceId ) const = 0;
+
+    };
+
+
+#endif // MXIMPFWREQUESTCOMPLETEEVENT_H
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_management_api/ximp_core_management_api.metaxml	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,26 @@
+<?xml version="1.0" ?>
+<api id="b3dbecebacc420336d0e033991439a6a" dataversion="1.0">
+  <name>XIMP Core Management API</name>
+  <description>Contains interfaces for managing and accessing the XIMP core features. API provides interfaces for:
+- creating ne instances of the framework
+- requesting the framework features
+- creating new contexts</description>
+  <type>c++</type>
+  <subsystem>ximpfw</subsystem>
+  <libs><lib name="ximpdatamodel.lib"/>
+<lib name="ximpoperations.lib"/>
+<lib name="ximpecomhook.lib"/>
+<lib name="ximpmanager.lib"/>
+<lib name="ximpsrvclient.lib"/>
+<lib name="ximpprocessor.lib"/>
+<lib name="ximputils.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/imsrv_plat/ximp_core_protocol_plugin_api/group/bld.inf	Wed Nov 03 09:32:20 2010 +0530
@@ -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 
+:                XIMP Core Protocol Plug-in API
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+../inc/ximpprotocolpluginifids.hrh     MW_LAYER_PLATFORM_EXPORT_PATH(ximpprotocolpluginifids.hrh)
+../inc/ximpprotocolplugin.h     MW_LAYER_PLATFORM_EXPORT_PATH(ximpprotocolplugin.h)
+../inc/ximpprotocolconnection.h     MW_LAYER_PLATFORM_EXPORT_PATH(ximpprotocolconnection.h)
+../inc/ximpprotocolpluginbase.h     MW_LAYER_PLATFORM_EXPORT_PATH(ximpprotocolpluginbase.h)
+../inc/ximpprotocolpluginbase.inl     MW_LAYER_PLATFORM_EXPORT_PATH(ximpprotocolpluginbase.inl)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_protocol_plugin_api/inc/ximpprotocolconnection.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,299 @@
+/*
+* 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:  Interface for presence protocol connection object.
+*
+*/
+
+#ifndef MXIMPFWPROTOCOLCONNECTION_H
+#define MXIMPFWPROTOCOLCONNECTION_H
+
+
+#include <e32std.h>
+#include <badesca.h>
+#include <ximpprotocolpluginifids.hrh>
+#include <ximpbase.h>
+
+
+class MXIMPContextClientInfo;
+class MXIMPProtocolConnectionHost;
+class MProtocolPresenceFeatures;
+class MProtocolImFeatures;
+
+
+
+/**
+ * Interface for presence protocol connection object.
+ * Interface must be implemented by a XIMP Framework protocol
+ * plug-ins.
+ *
+ * This interface models a connection from XIMP Framework to
+ * single remote presence service, over certain presence protocol
+ * implementation. XIMP Framework calls methods on this interface
+ * based on XIMP Framework client requests.
+ *
+ * XIMP Framework retrieves MXIMPProtocolConnection
+ * instances through MXIMPProtocolPlugin::AcquireConnectionL().
+ * Same MXIMPProtocolConnection instance may be returned by multiple
+ * MXIMPProtocolPlugin::AcquireConnectionL() calls. In this case
+ * XIMP Framework shares MXIMPProtocolConnection instance
+ * by multiple clients, and MXIMPProtocolConnection lifetime is
+ * extended over utilizing client sessions. When last utilizing
+ * client session is succesfully closed with
+ * MXIMPProtocolConnection::CloseSession(), XIMP Framework
+ * disposes the MXIMPProtocolConnection instance with
+ * MXIMPProtocolPlugin::ReleaseConnection().
+ *
+ *
+ * MXIMPProtocolConnection implementation must provide
+ * access following feature specific sub-interfaces:
+ * - MProtocolPresenceWatching
+ * - MProtocolPresencePublishing
+ * - MProtocolPresentityGroups
+ * - MProtocolPresenceAuthorization
+ *
+ * Each provided sub-interface defines a set of its own
+ * presence managements requests, relating to presence watching
+ * and subscribing, presence publication, presentity groups and
+ * presentity group member management and to presence authorizations.
+ * XIMP Framework calls these sub-interfaces to request on
+ * spesific presence requests from protocol connection.
+ *
+ * @see MXIMPProtocolConnectionHost
+ * @ingroup ximpprotocolpluginapi
+ * @since S60 v3.2
+ */
+class MXIMPProtocolConnection : public MXIMPBase
+    {
+public:
+
+    /** Interface ID for the MXIMPProtocolConnection. */
+    enum { KInterfaceId = XIMP_IF_ID_PROTOCOL_CONNECTION };
+
+
+protected:
+
+    /**
+     * Protected destructor. MXIMPProtocolConnection
+     * objects can't be deleted through this interface.
+     *
+     * XIMP Framework disposes MXIMPProtocolConnection
+     * instances through MXIMPProtocolPlugin::ReleaseConnection().
+     */
+    virtual inline ~MXIMPProtocolConnection() {};
+
+
+
+public: // Common
+
+
+    /**
+     * Primes protocol connection with its callback interface.
+     *
+     * Primes the presence protocol connection instance with
+     * its XIMP Framework side callback interface.
+     * Here given MXIMPProtocolConnectionHost interface is
+     * implemented and owned by the XIMP Framework, and
+     * presence protocol connection must use it to communicate back to
+     * XIMP Framework direction.
+     *
+     * Call and interface lifetime convention:
+     * - This method is called by XIMP Framework before
+     *   requesting any other requests from protocol connection
+     *   instance.
+     *
+     * - This method is called just once for each MXIMPProtocolConnection,
+     *   even the same MXIMPProtocolConnection instance is returned
+     *   multiple times from MXIMPProtocolPlugin::AcquireConnectionL().
+     *
+     * - Each presence protocol connection instance must use here
+     *   given specific host interface instance to communicate back
+     *   to XIMP Framework direction
+     *
+     * - The presence protocol connection implementation must
+     *   store the here given host reference internally, so
+     *   protocol connection implementation can access the host
+     *   when needed.
+     *
+     * - Here given MXIMPProtocolConnectionHost instance, is guaranteed
+     *   to remain valid (usable), untill the presence protocol connection
+     *   has completed the last MXIMPProtocolConnection::CloseSession()
+     *   request.
+     *
+     *
+     * @param [in] aHost
+     *        Reference to host interface, what this MXIMPProtocolConnection
+     *        instance must use to communicate back to XIMP Framework
+     *        direction. Object ownership is not trasfered.
+     */
+    virtual void PrimeHost(
+                    MXIMPProtocolConnectionHost& aHost ) = 0;
+
+
+
+public: // Connection handling
+
+
+    /**
+     * Opens a session for the identified client through
+     * the presence protocol connection.
+     *
+     * XIMP Framework calls this method to open a session to
+     * remote presence service, for here specified client.
+     * Remote presence service was identified when the
+     * MXIMPProtocolConnection instance was retrieved through
+     * MXIMPProtocolPlugin::AcquireConnectionL().
+     *
+     * @param [in] aContextClient
+     *        Object describing the presence connection client.
+     *
+     * @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().
+     */
+    virtual void OpenSessionL(
+                const MXIMPContextClientInfo& aContextClient,
+                TXIMPRequestId aReqId ) = 0;
+
+
+    /**
+     * Opens a session for the identified client through
+     * the presence protocol connection.
+     *
+     * XIMP Framework calls this method to open a session to
+     * remote presence service, for here specified client.
+     * Remote presence service was identified when the
+     * MXIMPProtocolConnection instance was retrieved through
+     * MXIMPProtocolPlugin::AcquireConnectionL().
+     *
+     * @param [in] aSettingsId
+     *        SettingsId for the presence connection client.
+     *
+     * @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().
+     */
+    virtual void OpenSessionL(
+                const TInt& aSettingsId,
+                TXIMPRequestId aReqId ) = 0;
+     
+    
+    /**
+     * Closes the identified client session from the
+     * presence connection.
+     *
+     * XIMP Framework calls this method to close
+     * the remote presence service session, for here specified
+     * client. When last using client session is closed,
+     * XIMP Framework consideres the remote presence connection
+     * as disconnect, and disposes MXIMPProtocolConnection instance
+     * with MXIMPProtocolPlugin::ReleaseConnection().
+     *
+     * @param [in] aContextClient
+     *        Client which session to close.
+     *
+     * @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().
+     */
+    virtual void CloseSession(
+                const MXIMPContextClientInfo& aContextClient,
+                TXIMPRequestId aReqId ) = 0;
+
+
+    /**
+     * Gets features that presence protocol connection supports.
+     *
+     * Presence protocol connection should negotiate
+     * available features during the connection establish
+     * and this method should return the supported features
+     * from presence protocol connection internal cache.
+     *
+     * @param [out] aFeatures
+     *        Return parameter where to append supported
+     *        presence protocol connection features.
+     *        Feature IDs are defined in NXIMPFeature namespace.
+     */
+    virtual void GetSupportedFeaturesL(
+                CDesC8Array& aFeatures ) const = 0;
+
+
+
+public: // Access to sub-interfaces
+
+
+    /**
+     * Gets reference to presence watching interface.
+     *
+     * XIMP Framework calls this method to retrieve a reference
+     * to protocols MProtocolPresenceWatching interface
+     * implementation.
+     *
+     * Call and interface lifetime convention:
+     * - This method isn't called before protocol has signalled
+     *   MXIMPProtocolConnection::OpenSessionL() succesfully completed.
+     *
+     * - XIMP Framework may call this method multiple times for
+     *   for one MXIMPProtocolConnection instance.
+     *
+     * - Each call per one MXIMPProtocolConnection instance,
+     *   must return reference to same interface instance.
+     *
+     * - Returned interface instance must remain valid (usable)
+     *   untill last client session, using originating presence protocol
+     *   connection is successfully closed with
+     *   MXIMPProtocolConnection::CloseSession().
+     *
+     * @return Requested interface.
+     *         interface ownership is not returned caller.
+     */
+    virtual MProtocolPresenceFeatures& ProtocolPresenceFeatures() = 0;
+    
+
+    /**
+     * Gets reference to protocol specific interface.
+     *
+     * XIMP Framework calls this method to retrieve a reference
+     * to protocol interface implementation.
+     *
+     * Call and interface lifetime convention:
+     * - This method isn't called before protocol has signalled
+     *   MXIMPProtocolConnection::OpenSessionL() succesfully completed.
+     *
+     * - XIMP Framework may call this method multiple times for
+     *   for one MXIMPProtocolConnection instance.
+     *
+     * - Each call per one MXIMPProtocolConnection instance,
+     *   must return reference to same interface instance.
+     *
+     * - Returned interface instance must remain valid (usable)
+     *   untill last client session, using originating presence protocol
+     *   connection is successfully closed with
+     *   MXIMPProtocolConnection::CloseSession().
+     *
+     * @return Requested interface.
+     *         interface ownership is not returned caller.
+     */
+    virtual TAny* GetProtocolInterface(TInt aInterfaceId) = 0;
+
+    };
+
+
+
+#endif // MXIMPFWPROTOCOLCONNECTION_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_protocol_plugin_api/inc/ximpprotocolplugin.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,192 @@
+/*
+* 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:  Interface for presence protocol plug-in object.
+*
+*/
+
+#ifndef MXIMPFWPROTOCOLPLUGIN_H
+#define MXIMPFWPROTOCOLPLUGIN_H
+
+
+#include <e32std.h>
+#include <badesca.h>
+#include <ximpprotocolpluginifids.hrh>
+#include <ximpbase.h>
+
+class MXIMPServiceInfo;
+class MXIMPProtocolPluginHost;
+class MXIMPProtocolConnection;
+class MXIMPContextClientInfo;
+
+
+
+/**
+ * Interface for presence protocol plug-in object.
+ * Interface must be implemented by a concrete
+ * XIMP Framework protocol plug-ins.
+ *
+ * This interface models presence protocol plug-in.
+ * XIMP Framework loads a MXIMPProtocolPlugin
+ * instance for needed protocol, by instantiating
+ * protocol specific CXimpFwProtocolPluginBase
+ * object through ECom architecture.
+ *
+ * XIMP Framework calls methods defined in this
+ * interface to manage protocol connections based
+ * on clients requests.
+ *
+ * @ingroup ximpprotocolpluginapi
+ * @since S60 v3.2
+ */
+class MXIMPProtocolPlugin : public MXIMPBase
+    {
+public:
+
+    /** Interface ID for the MXIMPProtocolPlugin. */
+    enum { KInterfaceId = XIMP_IF_ID_PROTOCOL_PLUGIN };
+
+
+protected:
+
+    /**
+     * Protected destructor. MXIMPProtocolPlugin
+     * objects can't be deleted through this interface.
+     */
+     virtual inline ~MXIMPProtocolPlugin() {};
+
+
+
+public: // Common
+
+
+    /**
+     * Primes presence protocol plug-in with its callback interface.
+     *
+     * Primes the presence protocol plug-in instance with
+     * its XIMP Framework side callback interface.
+     * Here given MXIMPProtocolPluginHost interface is
+     * implemented and owned by the XIMP Framework, and
+     * presence protocol plug-in must use it to communicate back to
+     * XIMP Framework direction.
+     *
+     * Call and interface lifetime convention:
+     * - This method is called by XIMP Framework before requesting
+     *   any other requests from presence protocol plug-in instance.
+     *
+     * - This method is called just once for one MXIMPProtocolPlugin,
+     *   just after loading MXIMPProtocolPlugin instance through ECom
+     *   architecture.
+     *
+     * - Presence protocol plug-in instance must use here
+     *   given specific host interface instance to communicate
+     *   back to XIMP Framework direction from asynchronous
+     *   requests.
+     *
+     * - The presence protocol plug-in implementation must
+     *   store the here given host reference internally, so
+     *   protocol plug-in implementation can access the host
+     *   when needed.
+     *
+     * - Here given MXIMPProtocolPluginHost instance, is guaranteed
+     *   to remain valid (usable), untill the protocol plug-in
+     *   destroyed by deleting. However, protocol plug-in isn't
+     *   allowed to call MXIMPProtocolPluginHost from its
+     *   MXIMPProtocolPlugin::~MXIMPProtocolPlugin() destructor.
+     *
+     *
+     * @param [in] aHost
+     *        Reference to host interface, what this MXIMPProtocolPlugin
+     *        instance must use when communicating back to XIMP Framework
+     *        direction. Object ownership is not trasfered.
+     */
+    virtual void PrimeHost(
+                    MXIMPProtocolPluginHost& aHost ) = 0;
+
+
+
+public: // Managing of protocol connections
+
+
+    /**
+     * Acquires a presence protocol connection.
+     *
+     * XIMP Framework calls this to acquire a presence protocol
+     * connection object for identified remote service and client.
+     * Protocol plug-in implementation can either:
+     * -# Always instantiate a new MXIMPProtocolConnection
+     *    object to manage each client session as separated
+     *    entity.
+     *
+     * -# Try to locate suitable existing connection from
+     *    list of currently existing remote connections,
+     *    and thus allow two or more client applications to share
+     *    the remote presence connection. Protocol plug-in
+     *    implementation can itself select in which circumstance
+     *    to share the connection. Usually  sharing should happen,
+     *    when two remote connections are targeted to same remote
+     *    service and to same user account.
+     *
+     * Presence Protocol plug-in must maintain internally list
+     * of existing presence service connection objects.
+     * Direct ownership of acquired presence service connection
+     * objects remain in the presence protocol plug-in. When
+     * XIMP Framework doesn't anymore need the certain
+     * acquired presence service connection, XIMP Framework
+     * disposes MXIMPProtocolConnection instance with
+     * MXIMPProtocolPlugin::ReleaseConnection(). If the same
+     * MXIMPProtocolConnection instance was returned multiple
+     * times from MXIMPProtocolPlugin::AcquireConnectionL(),
+     * it is still disposed only once with ReleaseConnection(),
+     * after closing the last utilizing client session.
+     *
+     * @param [in] aService
+     *        Target address, credentials etc.
+     *        info for remote presence connection.
+     *
+     * @param [in] aContextClient
+     *        Object describing the client requesting the
+     *        remote presence connection.
+     *
+     * @return New or existing presence protocol connection.
+     *         Object ownership not transfered. However,
+     *         returned object must remain valid (usable)
+     *         untill XIMP Framework calls
+     *         MXIMPProtocolPlugin::ReleaseConnection() to dispose
+     *         the MXIMPProtocolConnection.
+     */
+    virtual MXIMPProtocolConnection& AcquireConnectionL(
+                const MXIMPServiceInfo& aService,
+                const MXIMPContextClientInfo& aContextClient ) = 0;
+
+
+    /**
+     * Releases presence service connection.
+     *
+     * XIMP Framework calls this to releases previously acquired
+     * MXIMPProtocolConnection instance. XIMP Framework calls this
+     * method just once for each MXIMPProtocolConnection instance, event
+     * same MXIMPProtocolConnection instance were returned in several
+     * AcquireConnectionL() calls.
+     *
+     * @param [in] aConnection
+     *        Connection object to release.
+     */
+    virtual void ReleaseConnection(
+                    MXIMPProtocolConnection& aConnection ) = 0;
+
+    };
+
+
+
+#endif // MXIMPFWPROTOCOLPLUGIN_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_protocol_plugin_api/inc/ximpprotocolpluginbase.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,132 @@
+/*
+* 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:  Base class for XIMP Framework protocol plug-ins.
+*
+*/
+
+#ifndef CXIMPFWPROTOCOLPLUGINBASE_H
+#define CXIMPFWPROTOCOLPLUGINBASE_H
+
+#include <e32base.h>
+#include <ecom/ecom.h>
+#include <ximpprotocolplugin.h>
+#include <ximpprotocolpluginhost.h>
+#include <ximpprotocolpluginifids.hrh>
+
+
+
+/**
+ * Base class for XIMP Framework protocol plug-ins.
+ *
+ * Base class for XIMP Framework protocol plug-ins.
+ * This class must be implemented by a XIMP Framework
+ * protocol plug-ins so that XIMP Framework is able to
+ * load a instance of it through ECom architecture and
+ * can call into it. XIMP Framework manages loaded
+ * CXIMPProtocolPluginBase object as thread singleton.
+ *
+ * Protocol plug-in must also implement MXIMPProtocolPlugin
+ * interface, so XIMP Framework can call and issue
+ * protocol and connection management requests to protocol
+ * plug-in.
+ *
+ * @see MXIMPProtocolPlugin
+ * @see MXIMPProtocolPluginHost
+ * @ingroup ximpprotocolpluginapi
+ * @since S60 v3.2
+ */
+class CXIMPProtocolPluginBase : public CBase,
+                                public MXIMPProtocolPlugin
+    {
+public:
+
+    /**
+     * ECom interface UID for the CXIMPProtocolPluginBase.
+     *
+     * This ECom interface UID is used:
+     * -# In protocol adaptation ECom registration resource file,
+     *    to identify the implemented interface. Interface UID symbol
+     *    @c XIMP_ECOM_IF_UID_PROTOCOL_PLUGIN_BASE_INTERFACE from
+     *    ximpprotocolpluginifids.hrh can be directly included
+     *    to protocol plug-in ECom registration resource file.
+     *
+     * -# Interface UID is used internally in XIMP Framework when
+     *    resolving and instantiating available protocol implementations.
+     */
+    enum { KInterfaceId = XIMP_ECOM_IF_UID_PROTOCOL_PLUGIN_BASE_INTERFACE };
+
+
+public:
+
+
+    /**
+     * Public destructor.
+     * Plugin can be deleted through this interface.
+     */
+    inline ~CXIMPProtocolPluginBase();
+
+
+
+public:
+
+    /**
+     * Sets the plug-in destructor id.
+     *
+     * @param [in] aId
+     *        Destructor id for the plug-in instance.
+     */
+    inline void SetDestructorId( TUid aId );
+
+
+
+protected:
+
+    /**
+     * C++ default constructor.
+     */
+    inline CXIMPProtocolPluginBase();
+
+
+
+private: //Data
+
+    /**
+     * OWN: ECom destructor ID for Presence Protocol plug-in.
+     * XIMPFw assignes the destructor ID during plug-in
+     * object construction.
+     */
+    TUid iEcomDtorID;
+
+
+    /**
+     * OWN: Reserved member for future extension.
+     */
+    TAny* iReserved1;
+
+
+    /**
+     * OWN: Reserved member for future extension.
+     */
+    TAny* iReserved2;
+
+
+    /**
+     * OWN: Reserved member for future extension.
+     */
+    TAny* iReserved3;
+    };
+
+#include "ximpprotocolpluginbase.inl"
+
+#endif // CXIMPFWPROTOCOLPLUGINBASE_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_protocol_plugin_api/inc/ximpprotocolpluginbase.inl	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,48 @@
+/*
+* 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:  Base class for Presence Framework protocol plug-ins.
+*
+*/
+
+#include <ecom/ecom.h>
+
+// -----------------------------------------------------------------------------
+// CXIMPProtocolPluginBase::CXIMPProtocolPluginBase()
+// C++ default constructor.
+// -----------------------------------------------------------------------------
+//
+inline CXIMPProtocolPluginBase::CXIMPProtocolPluginBase()
+    {
+    }
+
+
+// -----------------------------------------------------------------------------
+// CXIMPProtocolPluginBase::~CXIMPProtocolPluginBase()
+// Destructor notifies the ECom from plug-in implementation destruction.
+// -----------------------------------------------------------------------------
+//
+inline CXIMPProtocolPluginBase::~CXIMPProtocolPluginBase()
+    {
+    REComSession::DestroyedImplementation( iEcomDtorID );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CXIMPProtocolPluginBase::SetDestructorId()
+// -----------------------------------------------------------------------------
+//
+inline void CXIMPProtocolPluginBase::SetDestructorId( TUid aId )
+    {
+    iEcomDtorID = aId;
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_protocol_plugin_api/inc/ximpprotocolpluginifids.hrh	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,58 @@
+/*
+* 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:  XIMP Framework Protocol Plugin API interface IDs.
+*
+*/
+
+#ifndef XIMPPROTOCOLPLUGINIFIDS_HRH
+#define XIMPPROTOCOLPLUGINIFIDS_HRH
+
+
+/**
+ * @defgroup ximpprotocolpluginapi XIMP Protocol Plugin API
+ * @ingroup ximpcoreapi
+ *
+ * XIMP Framework Protocol Plugin API contains abstract
+ * interfaces what protocol adaptation plug-ins must implement.
+ * XIMP Framework will instantiate protocol plug-ins through
+ * ECom framework and call methods declared in these interfces.
+ *
+ * XIMP Framework will instantiate and execute protocol
+ * implementations on dedicated Symbian OS server process.
+ * Protocol implementations are loaded on need basis, based
+ * on XIMP Framework clients requests. Protocol adaptation
+ * must derive from CXIMPProtocolPluginBase and make  
+ * concrete protocol implementation available through ECom
+ * framework.
+ *
+ * @since S60 v3.2
+ */
+
+// ECom interface UID for XIMPFw Protocol Plugin Base
+#define XIMP_ECOM_IF_UID_PROTOCOL_PLUGIN_BASE_INTERFACE     0x10282DD7
+
+
+// Protocol plugin IF id's
+// 30xx - ximp related
+// 31xx - presence related
+// 32xx - instant messaging related
+
+// Interface IDs for XIMPFw Protocol Plugin API interfaces
+#define XIMP_IF_ID_PROTOCOL_PLUGIN                          3001
+#define XIMP_IF_ID_PROTOCOL_CONNECTION                      3002
+
+
+#endif // XIMPPROTOCOLPLUGINIFIDS_HRH
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_protocol_plugin_api/ximp_core_protocol_plugin_api.metaxml	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,25 @@
+<?xml version="1.0" ?>
+<api id="c5abe1a8714f500e6889205330ded96f" dataversion="1.0">
+  <name>XIMP Core Protocol Plug-in API</name>
+  <description>XIMP Framework Protocol Plugin API contains abstract interfaces what protocol adaptation plug-ins must implement. XIMP Framework will instantiate protocol plug-ins through ECom framework and call methods declared in these interfces. This interface includes methods to:
+- get the features of the protocol plug-in
+- manage the service connections</description>
+  <type>c++</type>
+  <subsystem>ximpfw</subsystem>
+  <libs><lib name="ximpdatamodel.lib"/>
+<lib name="ximpoperations.lib"/>
+<lib name="ximpecomhook.lib"/>
+<lib name="ximpmanager.lib"/>
+<lib name="ximpsrvclient.lib"/>
+<lib name="ximpprocessor.lib"/>
+<lib name="ximputils.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/imsrv_plat/ximp_core_protocol_plugin_host_api/group/bld.inf	Wed Nov 03 09:32:20 2010 +0530
@@ -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 
+:                XIMP Core Protocol Plug-in Host API
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+../inc/ximpprotocolrequestcompleteevent.h     MW_LAYER_PLATFORM_EXPORT_PATH(ximpprotocolrequestcompleteevent.h)
+../inc/ximpprotocolpluginhost.h     MW_LAYER_PLATFORM_EXPORT_PATH(ximpprotocolpluginhost.h)
+../inc/ximpprotocolpluginhostifids.hrh     MW_LAYER_PLATFORM_EXPORT_PATH(ximpprotocolpluginhostifids.hrh)
+../inc/ximpprotocolconnectionhostobserver.h     MW_LAYER_PLATFORM_EXPORT_PATH(ximpprotocolconnectionhostobserver.h)
+../inc/ximpprotocolconnectionhost.h     MW_LAYER_PLATFORM_EXPORT_PATH(ximpprotocolconnectionhost.h)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_protocol_plugin_host_api/inc/ximpprotocolconnectionhost.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,242 @@
+/*
+* 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:  Interface for XIMP protocol connection host.
+*
+*/
+
+#ifndef MXIMPFWPROTOCOLCONNECTIONHOST_H
+#define MXIMPFWPROTOCOLCONNECTIONHOST_H
+
+
+#include <ximpbase.h>
+#include <ximpprotocolpluginhostifids.hrh>
+#include <e32std.h>
+
+
+class MXIMPStatus;
+class MXIMPObjectFactory;
+class MXIMPProtocolConnectionHostObserver;
+class MProtocolPresenceDataHost;
+class MProtocolImDataHost;
+
+
+// CLASS DECLARATION
+
+/**
+ * Interface for XIMP protocol connection host.
+ * This interface is implemented by XIMP Framework.
+ *
+ * XIMP protocol connection host interface defines
+ * requests that a XIMP protocol implementation
+ * can request (callback) from XIMP Framework.
+ *
+ * @see MXIMPProtocolConnection
+ * @ingroup ximpprotocolpluginhostapi
+ * @since S60 v3.2
+ */
+class MXIMPProtocolConnectionHost : public MXIMPBase
+    {
+public:
+
+    /** Interface ID for the MXIMPProtocolConnectionHost. */
+    enum { KInterfaceId = XIMP_IF_ID_PROTOCOL_CONNECTION_HOST };
+
+
+protected:
+
+    /**
+     * Protected destructor. MXIMPProtocolConnectionHost instancies
+     * can't be destroyed via this interface.
+     */
+    virtual inline ~MXIMPProtocolConnectionHost() {};
+
+
+
+public: // Request completion handling
+
+
+    /**
+     * Notifies XIMP Framework that protocol connection has
+     * completed (successfully or otherwise) the request handling.
+     *
+     * @param [in] aReqId
+     *        Request ID identifying the request which handling
+     *        is completed. This must equal to value given in
+     *        the processing initiation. If no pending XIMP
+     *        protocol connection request is found with this
+     *        request ID, protocol connection is paniced.
+     *
+     * @param [in] aResultCode
+     *        Result code from request handling.
+     */
+    virtual void HandleRequestCompleted(
+                TXIMPRequestId aReqId,
+                TInt aResultCode ) = 0;
+
+
+
+    /**
+     * Notifies XIMP Framework that protocol connection has
+     * completed (successfully or otherwise) the request handling.
+     *
+     * @param [in] aReqId
+     *        Request ID identifying the request which handling
+     *        is completed. This must equal to value given in
+     *        the processing initiation. If no pending XIMP
+     *        protocol connection request is found with this
+     *        request ID, protocol connection is paniced.
+     *
+     * @param [in] aResult
+     *        Status object describing result from request handling.
+     *        Object ownership is transfered always to XIMPFw.
+     *        NULL value not allowed.
+     */
+    virtual void HandleRequestCompleted(
+                TXIMPRequestId aReqId,
+                MXIMPStatus* aResult ) = 0;
+
+
+
+    /**
+     * Notifies XIMP Framework that protocol connection has
+     * completed (successfully or otherwise) the request handling.
+     *
+     * @param [in] aReqId
+     *        Request ID identifying the request which handling
+     *        is completed. This must equal to value given in
+     *        the processing initiation. If no pending XIMP
+     *        protocol connection request is found with this
+     *        request ID, protocol connection is paniced.
+     *
+     * @param [in] aResult
+     *        Status object describing result from request handling.
+     *        Object ownership is transfered always to XIMPFw.
+     *        NULL value not allowed.
+     *
+     * @param [in] aParameter
+     *        Additional request complete parameters.
+     *        NULL if no additional parameters to transfer XIMPFw.
+     *        Parameter may be single MXIMPBase derived
+     *        object or MXIMPRestrictedObjectCollection object
+     *        containing multiple objects. Ownership of given
+     *        parameter (also the container and contained objects)
+     *        is transfered always to XIMPFw.
+     */
+    virtual void HandleRequestCompleted(
+                TXIMPRequestId aReqId,
+                MXIMPStatus* aResult,
+                MXIMPBase* aParameter ) = 0;
+
+
+
+public: // Connection status handling
+
+
+    /**
+     * Notifies XIMP Framework that protocol connection to
+     * remote XIMP service is terminated due certain reason.
+     *
+     * In this case, XIMP Framework doesn't try to re-open
+     * the client sessions.
+     *
+     * @param [in] aReason
+     *        Status object describing more closely
+     *        the protocol connection termination reason.
+     *        Object ownership is transfered always to
+     *        XIMP Framework. NULL value is allowed.
+     *
+     * @return The request id for the handle operation.
+     */
+    virtual TXIMPRequestId HandleConnectionTerminated(
+                MXIMPStatus* aReason ) = 0;
+
+
+
+public: // Access to sub-interfaces
+
+
+    /**
+     * Gets reference to object factory interface.
+     *
+     * XIMP protocol connection implementation
+     * uses factory interface to instantiate XIMP
+     * objects.
+     *
+     * @return Object factory interface.
+     *         No ownership is returned caller.
+     */
+    virtual MXIMPObjectFactory& ObjectFactory() = 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& ProtocolPresenceDataHost() = 0;
+    
+
+public: // Observer registration
+
+
+    /**
+     * Reqisters XIMP connection host event observer.
+     *
+     * Reqisters observer to be notified from XIMP connection
+     * host events.
+     *
+     * @param [in] aObserver
+     *        The observer to be notified from XIMP
+     *        connection host events. If the observer is already
+     *        registered, event filter associated to observer
+     *        is updated.
+     *
+     * @param [in] aEventFilter
+     *        List of event types that the observer accepts.
+     *        Event types are identified with their interface IDs.
+     *        If NULL, all event types are delivered to observer.
+     *        In this case, observer must be prepared to handle
+     *        gracefully unknown event types, which are added
+     *        in future when extending XIMP Framework
+     *        functionality.
+     */
+    virtual void RegisterObserverL(
+                MXIMPProtocolConnectionHostObserver& aObserver,
+                const TArray<TInt32>* aEventFilter = NULL ) = 0;
+
+
+    /**
+     * Unregisters XIMP connection host observer.
+     *
+     * @param [in] aObserver
+     *        The observer to unregister.
+     */
+    virtual void UnregisterConnectionHostObserver(
+                MXIMPProtocolConnectionHostObserver& aObserver ) = 0;
+
+
+    };
+
+
+
+#endif // MXIMPFWPROTOCOLCONNECTIONHOST_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_protocol_plugin_host_api/inc/ximpprotocolconnectionhostobserver.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,100 @@
+/*
+* 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:  XIMP Protocol Connection Host interface.
+*
+*/
+
+#ifndef MXIMPFWPROTOCOLCONNECTIONHOSTOBSERVER_H
+#define MXIMPFWPROTOCOLCONNECTIONHOSTOBSERVER_H
+
+#include <e32std.h>
+
+
+class MXIMPBase;
+class MXIMPProtocolConnectionHost;
+
+
+// CLASS DECLARATION
+
+/**
+ * XIMP connection host observer interface.
+ * All XIMP connection host events are delivered
+ * through this interface back to protocol adaptation
+ * implementation.
+ *
+ * @ingroup ximpprotocolpluginhostapi
+ * @since S60 v3.2
+ */
+class MXIMPProtocolConnectionHostObserver
+    {
+protected:
+
+    /**
+     * Protected destructor. Observer instancies
+     * can't be destroyed via this interface.
+     */
+    virtual ~MXIMPProtocolConnectionHostObserver() {}
+
+
+public:
+
+
+    /**
+     * Event callback.
+     *
+     * Events are delivered as MXIMPBase typed objects.
+     * Protocol adaptation can use MXIMPBase::InterfaceId()
+     * to identify the real event interface type. Observer
+     * can use cast methods provided in MXimpFw...Event
+     * interfaces to cast to real event interface.
+     *
+     * @param [in] aHost
+     *        XIMP host object from where this event is coming.
+     *        Provided as reference for protocol adaptation, so
+     *        observer can distinguish events coming from different
+     *        hosts if listened in single observer.
+     *
+     * @param [in] aEvent
+     *        The event object. Client can use MXIMPBase::InterfaceId()
+     *        to determine correct event type and interface cast
+     *        methods from MXimpFw...Event interfaces to cast object
+     *        to real event interface.
+     */
+    virtual void HandleProtocolConnectionHostEvent(
+                const MXIMPProtocolConnectionHost& aHost,
+                const MXIMPBase& aEvent ) = 0;
+
+
+
+    /**
+     * Extension point for this observer interface.
+     *
+     * Returns an pointer to MXIMPProtocolConnectionHostObserver
+     * extension interface or NULL if the concrete observer
+     * implementation doesn't support requested extension.
+     *
+     * @param [in] aInterfaceId
+     *        Interface ID identifying the requested extension
+     *        interface.
+     *
+     * @return Pointer to requested extension interface or NULL.
+     */
+    virtual TAny* ProtocolConnectionHostObserverExtensionOrNull(
+                TInt32 aInterfaceId  ) { ( void ) aInterfaceId; return NULL; }
+
+    };
+
+
+
+#endif // MXIMPFWPROTOCOLCONNECTIONHOSTOBSERVER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_protocol_plugin_host_api/inc/ximpprotocolpluginhost.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,165 @@
+/*
+* 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:  XIMP Protocol Plugin host interface.
+*
+*/
+
+#ifndef MXIMPFWPROTOCOLPLUGINHOST_H
+#define MXIMPFWPROTOCOLPLUGINHOST_H
+
+#include <ximpbase.h>
+#include <ximpprotocolpluginhostifids.hrh>
+#include <e32std.h>
+
+
+class MXIMPObjectFactory;
+class MXIMPStatus;
+
+
+
+// CLASS DECLARATION
+
+/**
+ * Interface for XIMP Protocol Plugin host.
+ * This interface is implemented by XIMP Framework.
+ *
+ * XIMP Protocol Plugin host interface defines
+ * actions that a XIMP protocol plug-in can
+ * request (callback) from XIMP Framework.
+ *
+ * @see MXIMPProtocolPlugin
+ * @see CXIMPProtocolPluginBase
+ * @ingroup ximpprotocolpluginhostapi
+ * @since S60 v3.2
+ */
+class MXIMPProtocolPluginHost : public MXIMPBase
+    {
+public:
+
+    /** Interface ID for the MXIMPProtocolPluginHost. */
+    enum { KInterfaceId = XIMP_IF_ID_PROTOCOL_PLUGIN_HOST };
+
+
+protected:
+
+    /**
+     * Protected destructor. XIMP Protocol Plugin host
+     * instancies can't be destroyed via this interface.
+     */
+    virtual inline ~MXIMPProtocolPluginHost() {};
+
+
+public:
+
+
+    /**
+     * Gets reference to object factory interface.
+     *
+     * Returned object factory interface is used
+     * to instantiate XIMP data objects.
+     *
+     * @return Object factory interface.
+     *         No ownership is returned caller.
+     */
+    virtual MXIMPObjectFactory& ObjectFactory() = 0;
+
+
+
+    /**
+     * Notifies XIMP Framework that XIMP protocol
+     * plug-in has completed (successfully or otherwise)
+     * the request handling.
+     *
+     * NOTE: This method isn't yet supported by XIMP Framework,
+     *       since all MXIMPProtocolPlugin methods are currently
+     *       synchronous.
+     *
+     *
+     * @param [in] aReqId
+     *        Request ID identifying the request which handling
+     *        is completed. This must equal to value given in
+     *        the processing initiation. If no pending XIMP
+     *        protocol plug-in request is found with this ID,
+     *        plug-in is paniced.
+     *
+     * @param [in] aResultCode
+     *        Result code from request handling.
+     */
+    virtual void HandleRequestCompleted( TXIMPRequestId aReqId,
+                                         TInt aResultCode ) = 0;
+
+
+    /**
+     * Notifies XIMP Framework that XIMP protocol
+     * plug-in has completed (successfully or otherwise)
+     * the request handling.
+     *
+     * NOTE: This method isn't yet supported by XIMP Framework,
+     *       since all MXIMPProtocolPlugin methods are currently
+     *       synchronous.
+     *
+     * @param [in] aReqId
+     *        Request ID identifying the request which handling
+     *        is completed. This must equal to value given in
+     *        the processing initiation. If no pending XIMP
+     *        protocol plug-in request is found with this ID,
+     *        plug-in is paniced.
+     *
+     * @param [in] aResult
+     *        Status object describing result from request handling.
+     *        Object ownership is transfered always to XIMPFw.
+     *        NULL value not allowed.
+     */
+    virtual void HandleRequestCompleted( TXIMPRequestId aReqId,
+                                         MXIMPStatus* aResult ) = 0;
+
+
+    /**
+     * Notifies XIMP Framework that XIMP protocol
+     * plug-in has completed (successfully or otherwise)
+     * the request handling.
+     *
+     * NOTE: This method isn't yet supported by XIMP Framework,
+     *       since all MXIMPProtocolPlugin methods are currently
+     *       synchronous.
+     *
+     * @param [in] aReqId
+     *        Request ID identifying the request which handling
+     *        is completed. This must equal to value given in
+     *        the processing initiation. If no pending XIMP
+     *        protocol plug-in request is found with this ID,
+     *        plug-in is paniced.
+     *
+     * @param [in] aResult
+     *        Status object describing result from request handling.
+     *        Object ownership is transfered always to XIMPFw.
+     *        NULL value not allowed.
+     *
+     * @param [in] aParameter
+     *        Additional request complete parameters.
+     *        NULL if no additional parameters to transfer XIMPFw.
+     *        Parameter may be single MXIMPBase derived
+     *        object or MXIMPRestrictedObjectCollection object
+     *        containing multiple objects. Ownership of given
+     *        parameter (also the container and contained objects)
+     *        is transfered always to XIMPFw.
+     */
+    virtual void HandleRequestCompleted( TXIMPRequestId aReqId,
+                                         MXIMPStatus* aResult,
+                                         MXIMPBase* aParameter ) = 0;
+
+    };
+
+
+#endif // MXIMPFWPROTOCOLPLUGINHOST_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_protocol_plugin_host_api/inc/ximpprotocolpluginhostifids.hrh	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,55 @@
+/*
+* 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:  Protocol Plugin Host API interface IDs.
+*
+*/
+
+#ifndef XIMPPROTOCOLPLUGINHOSTIFIDS_HRH
+#define XIMPPROTOCOLPLUGINHOSTIFIDS_HRH
+
+
+/**
+ * @defgroup ximpprotocolpluginhostapi XIMP Protocol Plugin Host API
+ * @ingroup ximpcoreapi
+ *
+ * Protocol Plugin Host API contains abstract interfaces what
+ * XIMP Framework implements, and what protocol adaptation
+ * plug-ins must use to communicate back to XIMP Framework
+ * direction. XIMP Framework registeres these callback interfaces
+ * to protocol adaptation plug-ins, after instantiating plug-in
+ * objects, but before using them any other way.
+ *
+ * MXIMPProtocolPluginHost interface is the callback interface for
+ * the MXIMPProtocolPlugin.
+ *
+ * MXIMPProtocolConnectionHost interface is the callback interface for
+ * the MXIMPProtocolConnection.
+ *
+ * @since S60 v3.2
+ */
+
+// Protocol plugin host IF id's
+// 40xx - ximp related
+// 41xx - presence related
+// 42xx - instant messaging related
+
+// Interface IDs for XIMPFw Protocol Plugin Host interfaces
+#define XIMP_IF_ID_PROTOCOL_PLUGIN_HOST                        4001
+#define XIMP_IF_ID_PROTOCOL_CONNECTION_HOST                    4002
+#define XIMP_IF_ID_PROTOCOL_REQUEST_COMPLETE_EVENT             4003
+
+
+#endif // XIMPPROTOCOLPLUGINHOSTIFIDS_HRH
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_protocol_plugin_host_api/inc/ximpprotocolrequestcompleteevent.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,85 @@
+/*
+* 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:  Interface for protocol request completion event.
+*
+*/
+
+#ifndef MXIMPFWPROTOCOLREQUESTCOMPLETEEVENT_H
+#define MXIMPFWPROTOCOLREQUESTCOMPLETEEVENT_H
+
+#include <e32std.h>
+#include <ximpbase.h>
+#include <ximpprotocolpluginhostifids.hrh>
+
+
+
+/**
+ * Interface for protocol request completion event.
+ * This interface is implemented by XIMP Framework.
+ *
+ * This event is signalled from XIMP Framework to
+ * protocol adaptation to inform protocol implementation
+ * about its request completion (succesfully or otherwise).
+ *
+ * @ingroup ximpprotocolpluginhostapi
+ * @since S60 v3.2
+ */
+class MXIMPProtocolRequestCompleteEvent : public MXIMPBase
+    {
+public:
+
+    /** Interface ID for the MXIMPProtocolRequestCompleteEvent. */
+    enum { KInterfaceId = XIMP_IF_ID_PROTOCOL_REQUEST_COMPLETE_EVENT };
+
+
+protected:
+
+    /**
+     * Protected destructor.
+     * Event objects can't be deleted via this interface.
+     */
+    virtual ~MXIMPProtocolRequestCompleteEvent() {}
+
+
+public:
+
+
+    /**
+     * Gets request id of the completed request.
+     *
+     * @return The request id.
+     */
+    virtual const TXIMPRequestId& RequestId() const = 0;
+
+
+    /**
+     * Gets request completion code.
+     *
+     * Result code can be:
+     *  - one of the system wide errors
+     *  - one of the XIMP specific errors defined in ximperrors.hrh and 
+     *    in presenceerrors.hrh
+     *
+     * @return The result code.
+     */
+    virtual TInt ResultCode() const = 0;
+
+
+    };
+
+
+#endif // MXIMPFWPROTOCOLREQUESTCOMPLETEEVENT_H
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_core_protocol_plugin_host_api/ximp_core_protocol_plugin_host_api.metaxml	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,23 @@
+<?xml version="1.0" ?>
+<api id="2c6e2ca7eee789711ce8b855fa930a1b" dataversion="1.0">
+  <name>XIMP Core Protocol Plug-in Host API</name>
+  <description>API contains interfaces which protocol plug-ins use for communicating back to XIMP Framework direction. This API contains methods to indicate the connection status and the basic request complete methods.</description>
+  <type>c++</type>
+  <subsystem>ximpfw</subsystem>
+  <libs><lib name="ximpdatamodel.lib"/>
+<lib name="ximpoperations.lib"/>
+<lib name="ximpecomhook.lib"/>
+<lib name="ximpmanager.lib"/>
+<lib name="ximpsrvclient.lib"/>
+<lib name="ximpprocessor.lib"/>
+<lib name="ximputils.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/imsrv_plat/ximp_im_base_api/group/bld.inf	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  File that exports the files belonging to 
+:                XIMP IM Base API
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+../inc/imerrors.hrh     	MW_LAYER_PLATFORM_EXPORT_PATH(imerrors.hrh)
+../inc/imoperationdefs.h	MW_LAYER_PLATFORM_EXPORT_PATH(imoperationdefs.h)
+../inc/imdlluids.hrh		MW_LAYER_PLATFORM_EXPORT_PATH(imdlluids.hrh)
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_im_base_api/inc/imdlluids.hrh	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,73 @@
+/*
+* 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:  XIMP Framework IM DLL uids
+*
+*/
+
+#ifndef IMDLLUIDS_HRH
+#define IMDLLUIDS_HRH
+
+
+// -----------------------------------------------------------------------------
+// Common dll uids
+// -----------------------------------------------------------------------------
+//
+#define XIMP_IM_DLL_UID_STATIC_INTERFACE                   0x1000008d
+#define XIMP_IM_DLL_UID_ECOM_PLUGIN                        0x10009D8D
+
+// -----------------------------------------------------------------------------
+// Common UID 3 for the XIMP Framework dlls.
+// -----------------------------------------------------------------------------
+//
+#define XIMP_IM_DLL_UID_COMMON                             0x10282DD8
+// -----------------------------------------------------------------------------
+// ECOM implementation UID
+// -----------------------------------------------------------------------------
+//
+#define XIMP_ECOM_IMPLEMENTATION_UID_IM_INTERFACE   				0x2000B5ED
+
+//#define XIMP_ECOM_IMPL_UID_IM_CACHE_INTERFACE       				0x2000B5EE
+
+// Factory interface for internal data structures
+#define XIMP_ECOM_IMPL_UID_IM_DATAMODEL_INTERFACE   				0x2000B5EF
+
+#define XIMP_ECOM_IMPL_UID_IM_PROCESSOR_INTERFACE   				0x20015A10
+#define XIMP_ECOM_IMPL_UID_IM_OPERATION_INTERFACE   				0x20015A0F
+
+// -----------------------------------------------------------------------------
+// Other dll uids
+// -----------------------------------------------------------------------------
+//
+#define XIMP_DLL_UID_IM_HOOK                      					0x2000B5F0
+#define XIMP_DLL_UID_IM_MANAGER                   					0x2000B5F1
+#define XIMP_DLL_UID_IM_DATAMODEL_HOOK            					0x2000B5F2
+//#define XIMP_DLL_UID_IM_CACHE_HOOK                					0x2000B5F3
+#define XIMP_DLL_UID_IM_PROCESSOR	            					0x2000B5F4
+#define XIMP_DLL_UID_IM_PROCESSOR_HOOK            					0x20015A12
+#define XIMP_DLL_UID_IM_OPERATIONS_HOOK            					0x20015A13
+
+
+#define XIMP_DLL_UID_IM_OPERATION           						0x20015A11
+
+
+//#define XIMP_ECOM_IMPLEMENTATION_UID_IM_INTERFACE 		0x2000B5EA
+//#define XIMP_DLL_UID_IM_HOOK                      			0x2000B5EB
+//#define XIMP_DLL_UID_IM_MANAGER                   			0x2000B5EC
+
+
+
+
+#endif // IMDLLUIDS_HRH
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_im_base_api/inc/imerrors.hrh	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,237 @@
+/*
+* 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:  Protocol agnostic error codes for IM Feature Plugin.
+*
+*/
+
+#ifndef IMERRORS_H
+#define IMERRORS_H
+
+
+
+/**
+ * IM Feature Plugin error codes.
+ *
+ * Error codes returned from IM are either:
+ * -# System wide Symbian OS error codes (KErrNone, KErrNoMemory, etc.)
+ * -# Protocol agnostic IM Feature related error codes defined here.
+ *    These error codes have range: KImErrBase ... KImErrLow.
+ *
+ * @ingroup Imbaseapi
+ * @since S60 
+ */
+enum 
+    {
+    KImErrBase = -30131,
+
+    /**
+     * Generic error code to indicate that request processing
+     * has failed on IM protocol level to some error,
+     * which isn't mapped to any other more detailed
+     * error code.
+     */
+    KImErrServiceGeneralError = KImErrBase,
+
+    /**
+    * Error not registered
+    */
+    KImApiErrNotRegistered = KImErrBase - 2,
+    
+    /**
+    * Error already registered
+    */
+    KImApiErrAlreadyRegistered = KImErrBase - 3,
+    
+    /**
+    * Error not logged
+    */
+    KImApiErrNotLogged = KImErrBase - 4,
+    
+    /**
+    * The contact ID provided in send message API is invalid
+    */
+    KImApiErrInvalidContactId = KImErrBase - 6,
+
+    /**
+    * The user ID provided in send message API is invalid
+    */
+    KImApiErrInvalidUserId = KImErrBase - 7,
+
+    /**
+    * Not all the users have a valid User ID when sending message
+    */
+    KImApiErrPartialSuccess = KImErrBase - 8,
+
+    /**
+    * Missing mandatory elements
+    */
+    KImApiErrMissingMandatoryElement = KImErrBase - 9,
+    
+    /**
+    * Special IM error code: the sender is blocked by the recipient 
+    */
+    KImApiErrSenderBlocked = KImErrBase - 10,
+
+    /** 
+    * Special IM error code: the recipient is not logged in 
+    */
+    KImApiErrRecipientNotLogged = KImErrBase - 11,
+
+    /**
+     * Error code to indicate that IM service
+     * doesn't support the request issued by the client.
+     */
+    KImErrServiceRequestTypeNotSupported = KImErrBase - 12,
+
+    /**
+     * Error code to indicate that request handling has
+     * failed because the IM service is
+     * shutting down.
+     */
+    KImErrServiceShutdown = KImErrBase - 13,
+
+    /**
+     * Error code to indicate that IM service
+     * has terminated the IM session.
+     */
+    KImErrServiceForceClosedSession = KImErrBase - 14,
+
+    /**
+     * Error code to indicate that request handling has
+     * failed on IM protocol level to insufficient
+     * user authentication.
+     */
+    KImErrServiceAuthenticationFailed = KImErrBase - 15,
+
+    /**
+     * Error code to indicate that request handling has
+     * timeouted on IM protocol level.
+     */
+    KImErrServicRequestTimeouted = KImErrBase - 16,
+
+    /**
+     * Error code to indicate that IM protocol or
+     * protocol adaptation does not support given IM
+     * information field type.
+     */
+    KImErrFieldTypeNotSupported = KImErrBase - 17,
+
+    /**
+     * Error code to indicate that IM protocol or
+     * protocol adaptation does not support given IM
+     * information field value.
+     */
+    KImErrFieldValueNotSupported = KImErrBase - 18,
+
+    /**
+     * Error code to indicate that IM protocol or
+     * protocol adaptation does not support given 
+     * IM group property.
+     */
+    KImErrGroupPropertyNotSupported = KImErrBase - 19,
+
+    /**
+     * Error code to indicate that request processing has failed
+     * on IM service, because the IM group amount
+     * exceeds the service specific limit.
+     */
+    KImErrTooManyIMGroups = KImErrBase - 20,
+
+    /**
+     * Error code to indicate that request processing has failed
+     * on IM service, because the IM amount
+     * exceeds the service specific limit.
+     */
+    KImErrTooManyIM = KImErrBase - 21,
+
+    /**
+     * Error code to indicate that IM service doesn't know
+     * the IM group, which was identified in the request.
+     */
+    KImErrUnknownIMGroup = KImErrBase - 22,
+
+    /**
+     * Error code to indicate that the IM service
+     * has refused from request handling, because user
+     * doesn't have enough credits for the operation.
+     */
+    KImErrNotEnoughCredits = KImErrBase - 23,
+    
+    /**
+     * Out of range value
+     */
+    KImErrOutOfRangeValue = KImErrBase - 24,
+
+    /**
+     * Unsupported Context
+     */
+    KImErrUnsupportedContext = KImErrBase - 25,
+    
+     /**
+     * Error code to indicate that request processing has failed
+     * on IM service, because the number of users
+     * exceeds the service specific limit.
+     */
+    KImErrTooManyUsers = KImErrBase - 26,
+    
+    
+    /**
+     * Error code to indicate that specified
+     * group does't not exits
+     * 
+     */
+    KImErrGroupDoesNotExists = KImErrBase - 27,
+    
+    /**
+     * Error code to indicate that group 
+     * already exists
+     * 
+     */
+    KImErrGroupAlreadyExists = KImErrBase - 28,
+
+	/**
+     * Error code to indicate that group 
+     * already joined
+     * 
+     */
+    KImErrGroupAlreadyJoined = KImErrBase - 29,
+    
+   /**
+     * Error code to indicate that  
+     * no joined in the specified group.
+     * 
+     */
+    KImErrGroupNotJoined = KImErrBase - 30,
+     /**
+     * Error code to indicate that not having 
+     * permission/access rights.
+     * 
+     */
+    KImErrNotHavingPermission = KImErrBase - 31,
+
+	/**
+     * Error code to indicate that not having 
+     * permission/access rights.
+     * 
+     */
+    KImErrJoiningNotAllowed = KImErrBase - 32,
+	
+
+    KImErrLow = -30150
+    };
+
+
+#endif // IMERRORS_H
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_im_base_api/inc/imoperationdefs.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,50 @@
+/*
+* 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:  XIMP framework im operation definitions.
+ *
+*/
+
+#ifndef IMOPERATIONDEFS_H
+#define IMOPERATIONDEFS_H
+
+#include <e32std.h>
+
+// TODO: use ranges for operations types, that will make sure that
+// the core, Presence and IM operations won't overlap
+
+/**
+ * PSC operations.
+ */
+namespace NImOps
+    {
+    enum TImOpTypes
+        {
+        // -----------------------------------------------
+        // From client
+        //
+        ESendImMessage = 200,                          // 200
+        ESendImMessageToGroup,                         // 201
+        EHandleSentMessage,       
+        EHandleReceiveMessage,      
+        ESynthesiseImSubscription = 280,
+        EIMCleaner = 290            
+        };
+    }
+
+#endif  //IMOPERATIONDEFS_H
+
+
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_im_base_api/ximp_im_base_api.metaxml	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,13 @@
+<?xml version="1.0" ?>
+<api id="24a1055beb673b74dae8b860b8df4ee4" dataversion="1.0">
+<name>ximp_im_base_api</name>
+<description>This is a API that provides the common error codes, plugin UIDs and operation types of instant messaging base.</description>
+<type>c++</type>
+<subsystem>ximp_im_base_api</subsystem>
+<libs></libs>
+<release category="domain" sinceversion=""/>
+<attributes>
+<htmldocprovided>yes</htmldocprovided>
+<adaptation>no</adaptation>
+</attributes>
+</api>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_im_data_model_api/group/bld.inf	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,33 @@
+/*
+* 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:  File that exports the files belonging to 
+:                XIMP IM Data Model API
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+../inc/imdatamodelifids.hrh     MW_LAYER_PLATFORM_EXPORT_PATH(imdatamodelifids.hrh)
+../inc/imconversationinfo.h     MW_LAYER_PLATFORM_EXPORT_PATH(imconversationinfo.h)
+../inc/imgroupinfo.h     				MW_LAYER_PLATFORM_EXPORT_PATH(imgroupinfo.h)
+../inc/imobjectfactory.h     		MW_LAYER_PLATFORM_EXPORT_PATH(imobjectfactory.h)
+../inc/imsearchinfo.h     			MW_LAYER_PLATFORM_EXPORT_PATH(imsearchinfo.h)
+../inc/iminvitationinfo.h     	MW_LAYER_PLATFORM_EXPORT_PATH(iminvitationinfo.h)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_im_data_model_api/inc/imconversationinfo.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,113 @@
+/*
+* 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:  Interface for IM info object.
+*
+*/
+
+#ifndef MIMCONVERSATIONINFO_H
+#define MIMCONVERSATIONINFO_H
+
+#include <e32std.h>
+#include <bamdesca.h>
+#include <ximpbase.h>
+#include <imdatamodelifids.hrh>
+
+
+class MXIMPIdentity;
+
+ /**
+     * Common enumerated message type values for "messages"
+     * message type field.
+     *
+     * @ingroup imdatamodelapi
+     *
+     */
+    enum TMessageTypes
+        {
+
+        /**
+         * Message type is private.
+         */
+        EPrivateMessage = 0,
+
+        };
+
+/**
+ * Interface for IM info object.
+ *
+ * IM info object presents single IM conversation
+ * IM info object holds the identity, message content, delivery result, conversation ID
+ * block entity display name
+ *
+ *
+ * @ingroup Imdatamodelapi
+ * 
+ */
+class MImConversationInfo : public MXIMPBase
+    {
+public:
+
+    /** Interface ID for the MImConversationInfo. */
+    enum { KInterfaceId = IM_IF_ID_CONVERSATION_INFO };
+
+
+public:
+
+    /**
+     * Public destructor.
+     * Objects can be deleted through this interface.
+     */
+    virtual ~MImConversationInfo() {}
+
+
+public:
+
+    /**
+     * Returns identity of the message.
+     *
+     * @return The identity of the message.
+     */
+	virtual const MXIMPIdentity& MessageId() const = 0;
+
+	virtual const TDesC16& TextMessage() const = 0;
+	
+	virtual const MDesCArray&  RecipientL() const = 0;
+    /**
+     * Sets identity of the message.
+     *
+     * @param [in] aIdentity
+     *        Identity of the message.
+     *        Ownership of the argument is transfered to
+     *        callee, if method succeeds without a leave.
+     *
+     * @leave KErrNoMemory if failed to allocate memory.
+     * @leave KErrArgument if NULL argument were provided.
+     */
+	virtual void SetMessageIdL(
+                MXIMPIdentity* aIdentity ) = 0;
+
+
+    virtual void SetTextMessageL(
+                const TDesC16& aMessage ) = 0;   
+                 
+    virtual void SetRecipientL(const MDesCArray* aRecipients) = 0;
+
+	
+    };
+
+
+#endif // MIMCONVERSATIONINFO_H
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_im_data_model_api/inc/imdatamodelifids.hrh	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,35 @@
+/*
+* 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:  IM Feature Plugin Data Model API interface IDs.
+*
+*/
+
+#ifndef IMDATAMODELIFIDS_HRH
+#define IMDATAMODELIFIDS_HRH
+
+// Data model IF id's
+// 20xx - ximp related
+// 21xx - presence related
+// 22xx - instant messaging related
+
+#define IM_IF_ID_IDENTITY                   2201
+#define IM_IF_ID_IM_OBJECT_FACTORY          2204
+#define IM_IF_ID_CONVERSATION_INFO          2202
+
+
+
+#endif // IMDATAMODELIFIDS_HRH
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_im_data_model_api/inc/imgroupinfo.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,156 @@
+/*
+* 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:  Interface for group info object.
+*
+*/
+
+#ifndef MIMGROUPINFO_H
+#define MIMGROUPINFO_H
+
+#include <e32std.h>
+#include <ximpbase.h>
+#include <imdatamodelifids.hrh>
+
+
+class MXIMPIdentity;
+
+
+/**
+ * Interface for group info object.
+ *
+ * Group info object presents single group and the group members
+ * in the group list.
+ * Group info object holds the identity,
+ * display name and members for the group.
+ *
+ * @ingroup Imdatamodelapi
+ * 
+ */
+class MImGroupInfo : public MXIMPBase
+    {
+public:
+
+    /** Interface ID for the MImGroupInfo. */
+    enum { KInterfaceId = IM_IF_ID_GROUP_INFO };
+
+
+public:
+
+
+    /**
+     * Public destructor.
+     * Objects can be deleted through this interface.
+     */
+    virtual ~MImGroupInfo() {}
+
+
+
+public:
+
+    /**
+     * Returns group identity value.
+     *
+     * @return The group identity value.
+     */
+    virtual const MXIMPIdentity& GroupId() const = 0;
+
+
+
+    /**
+     * Returns group display name value.
+     *
+     * @return The group display name value.
+     */
+    virtual const TDesC16& GroupDisplayName() const = 0;
+
+
+    /**
+     * Returns group member identity value.
+     *
+     * @return The group member identity value.
+     */
+    virtual const MXIMPIdentity& GroupMemberId() const = 0;
+
+
+    /**
+     * Returns group member display name value.
+     *
+     * @return The group member display name value.
+     */
+    virtual const TDesC16& GroupMemberDisplayName() const = 0;
+
+
+    /**
+     * Sets group identity value.
+     *
+     * @param [in] aIdentity
+     *        New group identity value.
+     *        Ownership of the argument is transfered to
+     *        callee, if method succeeds without a leave.
+     *
+     * @leave KErrNoMemory if failed to allocate memory.
+     * @leave KErrArgument if NULL argument were provided.
+     */
+    virtual void SetGroupIdL(
+                MXIMPIdentity* aIdentity ) = 0;
+
+
+
+    /**
+     * Sets group display name value.
+     *
+     * @param [in] aDisplayName
+     *        New display name value.
+     *
+     * @leave KErrNoMemory if failed to allocate memory.
+     */
+    virtual void SetGroupDisplayNameL(
+                const TDesC16& aDisplayName ) = 0;
+
+
+    /**
+     * Sets group member identity value.
+     *
+     * @param [in] aIdentity
+     *        New group member identity value.
+     *        Ownership of the argument is transfered to
+     *        callee, if method succeeds without a leave.
+     *
+     * @leave KErrNoMemory if failed to allocate memory.
+     * @leave KErrArgument if NULL argument were provided.
+     */
+    virtual void SetGroupMemberIdL(
+                MXIMPIdentity* aIdentity ) = 0;
+
+
+    /**
+     * Sets group member display name value.
+     *
+     * @param [in] aDisplayName
+     *        New display name value.
+     *
+     * @leave KErrNoMemory if failed to allocate memory.
+     */
+    virtual void SetGroupMemberDisplayNameL(
+                const TDesC16& aDisplayName ) = 0;
+
+
+
+    };
+
+
+#endif // MIMGROUPINFO_H
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_im_data_model_api/inc/iminvitationinfo.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,194 @@
+/*
+* 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:  Interface for invitation info object.
+*
+*/
+
+#ifndef MIMINVITATIONINFO_H
+#define MIMINVITATIONINFO_H
+
+#include <e32std.h>
+#include <ximpbase.h>
+#include <imdatamodelifids.hrh>
+
+
+class MXIMPIdentity;
+
+
+/**
+ * Interface for invitation info object.
+ *
+ * Invitation info object presents single invitation and the member
+ * in the invitation list. Invitation info object holds the identity,
+ * display name, response and the member.
+ *
+ * @ingroup Imdatamodelapi
+ * 
+ */
+class MImInvitationInfo : public MXIMPBase
+    {
+public:
+
+    /** Interface ID for the MImInvitationInfo. */
+    enum { KInterfaceId = IM_IF_ID_INVITATION_INFO };
+
+
+public:
+
+
+    /**
+     * Public destructor.
+     * Objects can be deleted through this interface.
+     */
+    virtual ~MImInvitationInfo() {}
+
+
+
+public:
+
+    /**
+     * Returns invitation identity value.
+     *
+     * @return The invitation identity value.
+     */
+    virtual const MXIMPIdentity& InvitationID() const = 0;
+
+
+    /**
+     * Returns inviting user ID value.
+     *
+     * @return The inviting user ID value.
+     */
+    virtual const TDesC16& UserID() const = 0;
+
+
+    /**
+     * Returns group name value.
+     *
+     * @return The group name value.
+     */
+    virtual const TDesC16& GroupName() const = 0;
+
+
+    /**
+     * Returns screen name value.
+     *
+     * @return The screen name value.
+     */
+    virtual const TDesC16& ScreenName() const = 0;
+ 
+
+   /**
+     * Returns acceptance of the invitation.
+     *
+     * @return The acceptance of the invitation.
+     */
+    virtual const TBool Accept() const = 0;
+
+
+   /**
+     * Returns response/description of acceptance.
+     *
+     * @return The response/description of acceptance.
+     */
+    virtual const TDesC16& Response() const = 0;
+        
+    
+
+    /**
+     * Sets invitation identity value.
+     *
+     * @param [in] aIdentity
+     *        New invitation identity value.
+     *        Ownership of the argument is transfered to
+     *        callee, if method succeeds without a leave.
+     *
+     * @leave KErrNoMemory if failed to allocate memory.
+     * @leave KErrArgument if NULL argument were provided.
+     */
+    virtual void SetInvitationIdL(
+                MXIMPIdentity* aIdentity ) = 0;
+
+
+
+    /**
+     * Sets inviting user ID value.
+     *
+     * @param [in] aUser
+     *        New User ID value.
+     *
+     * @leave KErrNoMemory if failed to allocate memory.
+     */
+    virtual void SetUserIDL(
+                const TDesC16& aUser ) = 0;
+
+
+    /**
+     * Sets Group name value.
+     *
+     * @param [in] aGroup
+     *        Group name value.
+     *        Ownership of the argument is transfered to
+     *        callee, if method succeeds without a leave.
+     *
+     * @leave KErrNoMemory if failed to allocate memory.
+     * @leave KErrArgument if NULL argument were provided.
+     */
+    virtual void SetGroupNameL(
+                const TDesC16& aGroup ) = 0;
+
+
+    /**
+     * Sets screen name value.
+     *
+     * @param [in] aScreen
+     *        screen name value.
+     *
+     * @leave KErrNoMemory if failed to allocate memory.
+     */
+    virtual void SetScreenNameL(
+                const TDesC16& aScreen ) = 0;
+
+
+    /**
+     * Sets acceptance value.
+     *
+     * @param [in] aAccept
+     *        Acceptance value.
+     *
+     * @leave KErrNoMemory if failed to allocate memory.
+     */
+	virtual void SetAcceptL(
+				const TBool aAccept ) = 0;
+	
+	
+    /**
+     * Sets response value.
+     *
+     * @param [in] aResponse
+     *        response value.
+     *
+     * @leave KErrNoMemory if failed to allocate memory.
+     */
+	virtual void SetResponseL(
+				const TDesC16& aResponse ) = 0;
+
+
+    };
+
+
+#endif // MImINVITATIONINFO_H
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_im_data_model_api/inc/imobjectfactory.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,116 @@
+/*
+* 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:  Interface for IM Feature Plugin object factory.
+*
+*/
+
+#ifndef MIMOBJECTFACTORY_H
+#define MIMOBJECTFACTORY_H
+
+#include <ximpbase.h>
+#include <ximpidentity.h>
+#include <bamdesca.h>
+#include <imdatamodelifids.hrh>
+
+class MImGroupInfo;
+class MImConversationInfo;
+class MImInvitationInfo;
+class MImSearchInfo;
+
+/**
+ * Interface for IM Feature Plugin IM object factory.
+ *
+ * IM object factory is used to instantiate
+ * data objects declared in data model API.
+ *
+ * MImObjectFactory interface can be obtained from
+ * MXIMPContext or MXIMPProtocolConnectionHost
+ * interfaces.
+ *
+ * @ingroup imdatamodelapi
+ * @since S60 
+ */
+class MImObjectFactory : public MXIMPBase
+    {
+public:
+
+    /** Interface ID for the MImObjectFactory. */
+    enum { KInterfaceId = IM_IF_ID_IM_OBJECT_FACTORY };
+
+
+protected:
+
+    /**
+     * Protected destructor.
+     * Object instancies can't be deleted via this interface.
+     */
+    virtual ~MImObjectFactory() {}
+
+
+
+
+public: // Group and similar info object types
+
+
+    /**
+     * Instantiates new IM group info object.
+     *
+     * @return New IM group info object instance.
+     *         Object ownership is returned to caller.
+     *
+     * @leave KErrNoMemory if failed to allocate memory.
+     */
+    //virtual MImGroupInfo* NewImGroupInfoLC() = 0;
+
+
+    /**
+     * Instantiates new im conversation info object.
+     *
+     * @return new im conversation info object instance.
+     *         Object ownership is returned to caller.
+     *
+     * @leave KErrNoMemory if failed to allocate memory.
+     */
+    virtual MImConversationInfo* NewImConversationInfoLC() = 0;
+
+
+    /**
+     * Instantiates new im invitation info object.
+     *
+     * @return new im invitation info object instance.
+     *         Object ownership is returned to caller.
+     *
+     * @leave KErrNoMemory if failed to allocate memory.
+     */
+    //virtual MImInvitationInfo* NewImInvitationInfoLC() = 0;
+
+
+    /**
+     * Instantiates new im search info object.
+     *
+     * @return im search info info object instance.
+     *         Object ownership is returned to caller.
+     *
+     * @leave KErrNoMemory if failed to allocate memory.
+     */
+    //virtual MImSearchInfo* NewImSearchInfoLC() = 0;
+
+    };
+
+
+
+#endif // MIMOBJECTFACTORY_H
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_im_data_model_api/inc/imsearchinfo.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,148 @@
+/*
+* 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:  Interface for Search info object.
+*
+*/
+
+#ifndef MIMSEARCHINFO_H
+#define MIMSEARCHINFO_H
+
+#include <e32std.h>
+#include <ximpbase.h>
+#include <imdatamodelifids.hrh>
+#include <badesca.h> 
+
+
+
+class MXIMPIdentity;
+
+
+/**
+ * Interface for Search info object.
+ *
+ * Search info object presents single search. 
+ * Search info object holds the identity,search limit and search results.
+ *
+ *
+ * @ingroup Imdatamodelapi
+ *
+ */
+class MImSearchInfo : public MXIMPBase
+    {
+public:
+
+    /** Interface ID for the MImSearchInfo. */
+    enum { KInterfaceId = IM_IF_ID_SEARCH_INFO };
+
+
+public:
+
+    /**
+     * Public destructor.
+     * Objects can be deleted through this interface.
+     */
+    virtual ~MImSearchInfo() {}
+
+
+public:
+
+    /**
+     * Returns identity of the Search.
+     *
+     * @return The identity of the Search.
+     */
+	virtual const MXIMPIdentity& SearchId() const = 0;
+
+	
+    /**
+     * Returns the search index.
+     *
+     * @return The search index.
+     */
+	virtual const TInt Index() const = 0;
+	
+
+    /**
+     * Returns the number of search results.
+     *
+     * @return The number of search results.
+     */
+	virtual const TInt Results() const = 0;
+	
+
+    /**
+     * Returns the search result.
+     *
+     * @return The search result.
+     */
+	virtual const CPtrC16Array& ResultArray() const = 0;
+
+
+    /**
+     * Sets identity of the search.
+     *
+     * @param [in] aIdentity
+     *        Identity of the search.
+     *        Ownership of the argument is transfered to
+     *        callee, if method succeeds without a leave.
+     *
+     * @leave KErrNoMemory if failed to allocate memory.
+     * @leave KErrArgument if NULL argument were provided.
+     */
+	virtual void SetSearchIdL(
+                MXIMPIdentity* aIdentity ) = 0;
+
+
+    /**
+     * Sets index of the search.
+     *
+     * @param [in] aIndex
+     *        New search index value.
+     *
+     * @leave KErrNoMemory if failed to allocate memory.
+     */
+    virtual void SetIndex(
+                const TInt aIndex ) = 0;                
+
+
+    /**
+     * Sets number of results.
+     *
+     * @param [in] aResult
+     *        New search result value.
+     *
+     * @leave KErrNoMemory if failed to allocate memory.
+     */
+	virtual void SetResults(
+				const TInt aResult ) = 0;
+	
+
+    /**
+     * Sets the searched result.
+     *
+     * @param [in] aResultArray
+     *        New searched result value.
+     *
+     * @leave KErrNoMemory if failed to allocate memory.
+     */
+	virtual void SetResultArray(
+				CPtrC16Array& aResultArray ) = 0;
+	
+    };
+
+
+#endif // MIMSEARCHINFO_H
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_im_data_model_api/ximp_im_data_model_api.metaxml	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,15 @@
+<?xml version="1.0" ?>
+<api id="1f865404a640a4d9df89327079684420" dataversion="1.0">
+<name>ximp_im_data_model_api</name>
+<description>This is a API that provides data model for instant messaging related operations like conversations.</description>
+<type>c++</type>
+<subsystem>imdatamodel</subsystem>
+<libs><lib name="imdatamodel.lib"/>
+<lib name="ximputils.lib"/>
+</libs>
+<release category="domain" sinceversion=""/>
+<attributes>
+<htmldocprovided>yes</htmldocprovided>
+<adaptation>no</adaptation>
+</attributes>
+</api>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_im_management_api/group/bld.inf	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  File that exports the files belonging to 
+:                XIMP IM Management API
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+../inc/immanagementifids.hrh     MW_LAYER_PLATFORM_EXPORT_PATH(immanagementifids.hrh)
+../inc/imfeatures.inl     MW_LAYER_PLATFORM_EXPORT_PATH(imfeatures.inl)
+../inc/imconversation.h     MW_LAYER_PLATFORM_EXPORT_PATH(imconversation.h)
+../inc/imconversationevent.h     MW_LAYER_PLATFORM_EXPORT_PATH(imconversationevent.h)
+../inc/imfeatures.h     MW_LAYER_PLATFORM_EXPORT_PATH(imfeatures.h)
+../inc/imgroup.h     MW_LAYER_PLATFORM_EXPORT_PATH(imgroup.h)
+../inc/imgroupevent.h     MW_LAYER_PLATFORM_EXPORT_PATH(imgroupevent.h)
+../inc/iminvitation.h     MW_LAYER_PLATFORM_EXPORT_PATH(iminvitation.h)
+../inc/iminvitationevent.h     MW_LAYER_PLATFORM_EXPORT_PATH(iminvitationevent.h)
+../inc/imsearch.h     MW_LAYER_PLATFORM_EXPORT_PATH(imsearch.h)
+../inc/imsearchelement.h     MW_LAYER_PLATFORM_EXPORT_PATH(imsearchelement.h)
+../inc/imsearchevent.h     MW_LAYER_PLATFORM_EXPORT_PATH(imsearchevent.h)
+../inc/imaccesscontrollist.h     MW_LAYER_PLATFORM_EXPORT_PATH(imaccesscontrollist.h)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_im_management_api/inc/imaccesscontrollist.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,86 @@
+/*
+* 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:  Interface for IM context.
+*
+*/
+
+#ifndef MIMACCESSCONTROLLIST_H
+#define MIMACCESSCONTROLLIST_H
+
+#include <e32std.h>
+#include <ximpbase.h>
+#include <immanagementifids.hrh>
+//#include <ximpcontext.h>
+
+
+class MImObjectFactory;
+class MImGroups;
+class MImConversation;
+class MImInvitation;
+class MImSearch;
+
+/**
+ * Access control list interface for clients use.
+ * Defines the access rules to a resource as an access control list (ACL). 
+ * The resource itself is identified at the time the ACL is assigned to the resource.
+ * Access control is support for the following resource types: IMGroup..... 
+
+
+ * 
+ * @ingroup immanagementapi
+ */
+class MImAccessControlList : public MXIMPBase
+    {
+public:
+
+    /** Interface ID for the MImAccessControlList. */
+    enum { KInterfaceId = IM_IF_ID_ACCESSCONTROL_LIST };
+
+
+public: 
+      
+	/**
+	* Stores moderators of the IM group
+	* @return The Array of moderators of the Im group
+	*/
+   virtual RPointerArray<HBufC> ImGroupModerateList() = 0;
+   /**
+	* Stores admins of the IM group
+	* @return The Array of admins of the Im group
+	*/
+   virtual RPointerArray<HBufC> ImGroupAdminList() = 0;
+    /**
+	* Stores ordinaries of the IM group
+	* @return The Array of ordinaries of the Im group
+	*/
+   virtual RPointerArray<HBufC> ImGroupOrdinaryList() = 0;
+   
+    
+protected:
+
+    /**
+     * Protected destructor.
+     * Instancies can't be destroyed via this interface.
+     */
+    virtual ~MImAccessControlList() {}
+
+    };
+
+
+
+
+#endif // MIMACCESSCONTROLLIST_H
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_im_management_api/inc/imconversation.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,168 @@
+/*
+* 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:  IM interface for clients use.
+*
+*/
+
+#ifndef MIMCONVERSATIONIMP_H
+#define MIMCONVERSATIONIMP_H
+
+#include <e32std.h>
+#include <badesca.h>
+#include <bamdesca.h>
+#include <ximpbase.h>
+#include "immanagementifids.hrh"
+
+class MImConversationInfo;
+class MXIMPIdentity;
+/**
+ * Conversation interface for clients use.
+ * Interface is implemented by the IM.
+ *
+ * @ingroup Immanagementapi
+ * 
+ */
+class MImConversation : public MXIMPBase
+    {
+public:
+
+    /** Interface ID for the MImConversation. */
+    enum { KInterfaceId = IM_IF_ID_CONVERSATION };
+
+protected:
+
+    /**
+     * Protected destructor.
+     * Object instancies can't be deleted via this interface.
+     */
+    virtual ~MImConversation() {}
+
+public: 
+    /**
+     * Send message to user(s)
+     *
+	 * @param [in] aImMessage 	- Identification and content of the message.
+     *		MImConversationInfo contains messageid, contenttype - text/content, content,.......  
+     * @param [in] aRecipients 	- Recipients userid.
+	 *
+	 *  /b Note: Possible error conditions
+     * /n	 1. Invalid userid/recipient, user does not exist [KImApiErrInvalidUserId].
+     * /n	 2. Recipient user blocked the sender [KImApiErrSenderBlocked].
+     * /n	 3. Unsupported message context [KImErrUnsupportedContext].
+     * /n	 4. Message queue full [KImErrTooManyIM].
+     */
+   virtual TXIMPRequestId SendMessageL( const MImConversationInfo& aImMessage) = 0;
+     /**
+     * Forward message to user(s)
+     *
+	 * @param [in] aImMessage 	- Identification and content of the message.
+     *		MImConversationInfo contains messageid, contenttype - text/content, content,.......  
+     * @param [in] aRecipients 	- Recipients userid.
+	 *
+	 * /b Note: Possible error conditions
+     * /n	     1. Invalid userid/recipient, user does not exist [KImApiErrInvalidUserId].
+     * /n		 2. Recipient user blocked the sender [KImApiErrSenderBlocked].
+     * /n		 3. Unsupported message context [KImErrUnsupportedContext].
+     * /n		 4. Message queue full [KImErrTooManyIM].
+     */
+    //virtual TXIMPRequestId ForwardMessageL( const MImConversationInfo& aImMessage) = 0;
+	/**
+     * Send message to group.
+     *
+	 * @param [in] aImMessage 	- Identification and content of the message.
+     *		MImConversationInfo contains messageid, contenttype - text/content, content,.......  
+     * @param [in] aUserIds 	- Recipients userid.
+	 *
+	 * /b Note: Possible error conditions
+     * /n	     1. Invalid userid/recipient, user does not exist [KImApiErrInvalidUserId].
+     * /n		 2. Recipient user blocked the sender [KImApiErrSenderBlocked].
+     * /n		 3. Unsupported message context [KImErrUnsupportedContext].
+     * /n		 4. Message queue full [KImErrTooManyIM].
+     */
+
+
+    //virtual TXIMPRequestId SendMessageToGroupL( const MImConversationInfo& aImMessage,
+	//		                                        const TDesC* aGroupId ) = 0;
+
+    /**
+     * Block user(s).
+	 *
+     * @param [in] aUserIds - User id's need to be blocked
+     *
+     * /b Note: Possible error conditions
+     * /n		 1. Userid doesn't exist [KImErrServiceGeneralError].
+     * /n		 2. The maximum number of users reached for the user in the list [KImErrTooManyUsers].
+     */
+	//virtual TXIMPRequestId BlockUsersL(const MDesCArray* aUserIds ) = 0;
+
+	/**
+     * UnBlock User(s).
+	 *
+     * @param [in] aUserIds - User Id's need to be unblocked
+     *
+     * /b Note: Possible error conditions
+     *	/n	 1. Userid doesn't exist [KImErrServiceGeneralError].
+     *	/n	 2. The maximum number of users reached for the user in the list [KImErrTooManyUsers].
+     */
+	//virtual TXIMPRequestId UnBlockUsersL(const MDesCArray* aUserIds ) = 0;
+
+    /**
+     * Get Blocked usersid's list 
+     *
+     * /b Note: Possible error conditions
+     *	/n	 1. No block list in use [KImErrServiceGeneralError].
+     */
+	//virtual TXIMPRequestId GetBlockedUsersListL(void ) = 0;
+
+    /**
+     * Retrieve the Message-Info structures of the undelivered instant messages. 
+     * May use the retrieved message-info structures to inform the user about the new messages, or it may
+	 * retrieve/reject/forward the instant messages automatically.
+	 * 
+     * @param [in] aImMessageId Identification for IM.
+     * @param [in] aGroupId Identifies the group to retrieve history.
+     * @param [in] aMessageCount The maximum number of message-info structures to be returned.
+     * @param [in] aDeliveryReportWanted If the user wants to order delivery report.
+	 *
+     * /b Note: Possible error conditions.
+     *	/n	 1. Invalid group id [KImErrUnknownIMGroup].
+     */
+	//virtual TXIMPRequestId GetMessageListL( const MXIMPIdentity& aImMessageId,
+	//		    								   	   const TDesC* aGroupId,
+	//		    								   	   const TInt aMessageCount,
+	//		                                           TBool aDeliveryReportWanted) = 0;
+	
+    /**
+     * Reject the accumulated messages in the server.
+     *
+     * @param [in] aImMessageId Identifies the messages to be removed
+	 *
+     * /b Note: Possible error conditions
+     *	/n	 1. Invalid message-id [KImErrFieldValueNotSupported].
+     */
+	//virtual TXIMPRequestId RejectMessageL( const MXIMPIdentity& aImMessageId)= 0;
+	
+	
+	private:
+		// Message Info:
+		// Identity  Messageid;
+		// Message content text
+		// Screenname
+		// Deliver Report required
+    };
+
+
+#endif // MIMCONVERSATIONIMP_H
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_im_management_api/inc/imconversationevent.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,199 @@
+/*
+* 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:  Event interface for IM.
+*
+*/
+
+#ifndef MIMCONVERSATIONEVENT_H
+#define MIMCONVERSATIONEVENT_H
+
+#include <e32std.h>
+#include <ximpbase.h>
+#include <immanagementifids.hrh>
+
+class MImConversationInfo;
+/**
+ * Event interface for message content.
+ *
+ * This interface is implemented by the IM and
+ * event object is signalled to registered client observers
+ * through MPrFwIMContextObserver observer interface.
+ * This event notifies clients about changes in
+ * message content.
+ * 
+ * IM signals this event when:
+ * - New message is received from protocol.
+ * - Delivery report is received from the protocol
+ *
+ * @ingroup Immanagementapievents
+ * 
+ */
+class MImConversationEvent : public MXIMPBase
+    {
+public:
+    /** Interface ID for the MImConversationEvent. */
+    enum { KInterfaceId = IM_IF_ID_CONVERSATION_EVENT };
+
+
+protected:
+
+    /**
+     * Protected destructor.
+     * Object instancies can't be deleted via this interface.
+     */
+    virtual ~MImConversationEvent() {}
+
+
+public: // Access to "delta information"
+
+
+    /**
+     * Gets the count of newly received text messages.
+     *
+     * @return The count of newly received text messages.
+     */
+    virtual TInt NewTextMessageCount() const = 0;
+    
+
+    /**
+     * Gets received text message by index.
+     *
+     * @param [in] aIndex
+     *        The index of the text message to get.
+     *
+     * @return The received text message entry from given index.
+     */
+	virtual const MImConversationInfo& NewTextMessage( TInt aIndex ) const = 0;
+
+
+    /**
+     * Gets the count of newly received binary messages.
+     *
+     * @return The count of newly received binary messages.
+     */
+	//virtual TInt NewContentMessageCount() const = 0;
+		
+
+    /**
+     * Gets received binary message by index.
+     *
+     * @param [in] aIndex
+     *        The index of the binary message to get.
+     *
+     * @return The received binary message entry from given index.
+     */
+	//virtual const MImConversationInfo& NewContentMessage( TInt aIndex ) const = 0;
+
+
+    /**
+     * Gets the count of message delivery report.
+     *
+     * @return The count of message delivery report.
+     */
+	//virtual TInt DeliveryReportCount() const = 0;
+	
+
+    /**
+     * Gets message delivery report by index.
+     *
+     * @param [in] aIndex
+     *        The index of the message delivery report to get.
+     *
+     * @return The message delivery report entry from given index.
+     */
+	//virtual const MImConversationInfo& DeliveryReport( TInt aIndex ) const = 0;
+	
+ 
+    /**
+     * Gets the count of blocked entity.
+     *
+     * @return The count of blocked entity.
+     */
+	//virtual TInt BlockedEntityCount( TInt aIndex ) const = 0;
+	
+
+    /**
+     * Gets blocked entity by index.
+     *
+     * @param [in] aIndex
+     *        The index of the blocked entity to get.
+     *
+     * @return The blocked entity entry from given index.
+     */
+	//virtual const MImConversationInfo& BlockedEntity( TInt aIndex ) const = 0;
+	
+
+    /**
+     * Gets the count of undelivered messages.
+     *
+     * @return The count of undelivered messages.
+     */
+	//virtual TInt UndeliveredMessageCount() const = 0;
+	
+
+    /**
+     * Gets undelivered message by index.
+     *
+     * @param [in] aIndex
+     *        The index of the undelivered message to get.
+     *
+     * @return The undelivered message entry from given index.
+     */
+	//virtual const MImConversationInfo& UndeliveredMessage( TInt aIndex ) const = 0;
+	
+
+   /**
+     * Gets the count of rejected messages.
+     *
+     * @return The count of rejected messages.
+     */
+	//virtual TInt RejectedMessageCount() const = 0;
+	
+
+    /**
+     * Gets rejected message by index.
+     *
+     * @param [in] aIndex
+     *        The index of the rejected message to get.
+     *
+     * @return The rejected message entry from given index.
+     */
+	//virtual const MImConversationInfo& RejectedMessage( TInt aIndex ) const = 0;
+	
+ 
+    /**
+     * Gets the count of on going conversations.
+     *
+     * @return The count of on going conversations.
+     */
+	//virtual TInt ConversationCount() const = 0;
+	
+
+    /**
+     * Gets on going conversation by index.
+     *
+     * @param [in] aIndex
+     *        The index of the on going conversation to get.
+     *
+     * @return The on going conversation entry from given index.
+     */
+	//virtual const MImConversationInfo& Conversation( TInt aIndex ) const = 0;
+	
+
+    };
+
+
+#endif // MIMCONVERSATIONEVENT_H
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_im_management_api/inc/imfeatures.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,174 @@
+/*
+* 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:  Interface for IM context.
+*
+*/
+
+#ifndef MIMFEATURES_H
+#define MIMFEATURES_H
+
+#include <e32std.h>
+#include <ximpbase.h>
+#include <immanagementifids.hrh>
+#include <ximpcontext.h>
+
+
+class MImObjectFactory;
+class MImGroups;
+class MImConversation;
+class MImInvitation;
+class MImSearch;
+
+/**
+ * Interface for IM features.
+ * This interface is implemented by the IM.
+ *
+ * MImFeatures is root interface for accessing
+ * and updating im data to remote im service.
+ * IM client binds MXIMPContext interface
+ * to desired remote im service and creates
+ * MImFeatures interface to access the Im feature plugin related 
+ * methods to publish and access IM data.
+ *
+ * Following sub interfaces can be accessed from
+ * from MImFeatures:
+ *   - MImObjectFactory
+ *   - MImGroupInfo
+ *   - MImConversation
+ *   - MImInvitation
+ *   - MImSearch
+ *
+ * All IM events (context state, im data,
+ * request completion etc. ones) are delivered through
+ * MImContextObserver interface.
+ *
+ * @ingroup immanagementapi
+ * @since S60 
+ */
+class MImFeatures : public MXIMPBase
+    {
+public:
+
+    /** Interface ID for the MImFeatures. */
+   enum { KInterfaceId = XIMP_ECOM_IF_UID_IM_INTERFACE };
+
+
+public:
+
+    /**
+     * Factory method to instantiate MImFeatures.
+     *
+     * Factory method to instantiate platform default
+     * MXIMPClient implementation through the ECom.
+     * If the default IM Feature isn't supported
+     * in the platform, leaves with errorcode signalled
+     * from ECom.
+     *
+     * @return The new Im client object. Object
+     *         ownership is returned to caller.
+     */
+    static inline MImFeatures* NewL( MXIMPContext* aContext );
+
+    /**
+     * Public destructor.
+     * Objects can be deleted through this interface.
+     */
+    virtual inline ~MImFeatures();
+    
+protected:
+
+    /**
+     * Default constructor to zero initialize
+     * the iEcomDtorID member.
+     */
+    inline MImFeatures();
+
+
+public: //Sub interfaces for im context
+
+
+    /**
+     * Gets reference to im object factory interface.
+     *
+     * Returned object factory interface is used
+     * to instantiate im objects.
+     *
+     * @return Object factory interface.
+     *         No ownership is returned caller.
+     */
+    virtual MImObjectFactory& ImObjectFactory() const = 0;
+
+
+    /**
+     * Gets reference to im object factory interface.
+     *
+     * Returned object factory interface is used
+     * to instantiate im objects.
+     *
+     * @return Object factory interface.
+     *         No ownership is returned caller.
+     */
+    //virtual MImDataCache& ImDataAccess() const = 0;
+    
+
+    /**
+     * Gets reference to im groups interface.
+     *
+     * @return Requested interface.
+     *         No ownership is returned caller.
+     */
+    //virtual MImGroups& ImGroups() const = 0;
+
+
+
+    /**
+     * Gets reference to im conversation interface.
+     *
+     * @return Requested interface.
+     *         No ownership is returned caller.
+     */
+    virtual MImConversation& ImConversation() const = 0;
+
+
+
+    /**
+     * Gets reference to Im invitation interface.
+     *
+     * @return Requested interface.
+     *         No ownership is returned caller.
+     */
+    //virtual MImInvitation& ImInvtation() const = 0;
+
+
+    /**
+     * Gets reference to im search interface.
+     *
+     * @return Requested interface.
+     *         No ownership is returned caller.
+     */
+    //virtual MImSearch& ImSearch() const = 0;
+
+private: // Data
+
+    //OWN: ECom destructor ID
+    TUid iEcomDtorID;
+    };
+
+#include <imfeatures.inl>
+
+
+#endif // MIMFEATURES_H
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_im_management_api/inc/imfeatures.inl	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,64 @@
+/*
+* 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:  IM Features interface used by XIMP IM clients.
+*
+*/
+
+#include <ecom/ecom.h>
+
+
+// -----------------------------------------------------------------------------
+// MImFeatures::NewL( MXIMPContext* aContext) implementation
+// Factory method to instantiate the platform default
+// MImFeatures implementation through the ECom framework.
+// -----------------------------------------------------------------------------
+//
+inline MImFeatures* MImFeatures::NewL(MXIMPContext* aContext )
+    {
+    _LIT8( KXIMPIMDefaultData, XIMP_ECOM_DEFAULT_DATA_IM_INTERFACE );
+
+    TEComResolverParams resolvingParams;
+    resolvingParams.SetDataType( KXIMPIMDefaultData );
+    resolvingParams.SetWildcardMatch( ETrue );
+		//TInt auid = 0x2000B5F4; ///MImFeatures::KInterfaceId
+    TAny* imp = REComSession::CreateImplementationL( TUid::Uid( MImFeatures::KInterfaceId),
+                                                     _FOFF( MImFeatures, iEcomDtorID ),
+                                                     aContext, resolvingParams );
+
+    return reinterpret_cast< MImFeatures* >( imp );
+    }
+
+
+// -----------------------------------------------------------------------------
+// MImFeatures::MImFeatures() implementation
+// Zero initializes the iEcomDtorID member.
+// -----------------------------------------------------------------------------
+//
+inline MImFeatures::MImFeatures()
+    {
+    iEcomDtorID = TUid::Null();
+    }
+
+
+// -----------------------------------------------------------------------------
+// MImFeatures::~MImFeatures()
+// Destructor notifies the ECom from implementation destruction.
+// -----------------------------------------------------------------------------
+//
+inline MImFeatures::~MImFeatures()
+    {
+    REComSession::DestroyedImplementation( iEcomDtorID );
+    }
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_im_management_api/inc/imgroup.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,347 @@
+/*
+* 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:  IM group handling interface for clients use.
+*
+*/
+
+#ifndef MIMGROUPS_H
+#define MIMGROUPS_H
+
+
+#include <ximpbase.h>
+#include <ximpidentity.h>
+#include  "imaccesscontrollist.h"
+#include  "imaccesscontrollistimp.h"
+#include  <bamdesca.h>
+
+class MImGroupInfo;
+class MImAccessControlList;
+/**
+ * IM group handling interface for clients use.
+ * Interface is implemented by the IM.
+ *
+ * MImGroups provides services for
+ * Im clients to manage groups
+ * and group members. It provides also services to 
+ * subscribe notifications from IM group list changes
+ * and from individual IM group changes.
+ *
+ * Client can retrieve MImGroups interface from
+ * MImContext interface.
+ *
+ * @ingroup Immanagementapi
+ * 
+ */
+class MImGroups : public MXIMPBase
+    {
+public:
+
+    /** Interface ID for the MImGroups. */
+    enum { KInterfaceId = IM_IF_ID_GROUPS };
+
+
+protected:
+
+    /**
+     * Protected destructor.
+     * Object instancies can't be deleted via this interface.
+     */
+    virtual ~MImGroups() {}
+
+
+public: //IM Group management requests
+   
+   	/**
+     * Subscribe to the specified group change notification
+     * 
+     * @return The request ID identifying the issued request.
+     *
+     * /b Note: Possible error conditions
+     *	/n		1. Group does't exists  - KImErrGroupDoesNotExists
+     *	/n		2. Not joined in this group  - KImErrGroupNotJoined
+     *
+     * If the request is success whenever there is a change in the group
+     * user will be notified.
+     *
+     */
+     virtual TXIMPRequestId SubscribeImGroupChangeL(const MXIMPIdentity& aGroupId)= 0;
+     
+     /**
+     * UnSubscribe to the specified group change notification
+     * 
+     * @param [in] aGroupId
+     *		Identification for IM group.
+	 *
+     * @return The request ID identifying the issued request.
+     *
+     * /b Note: Possible error conditions
+     *	/n		1. Group does't exists - KImErrGroupDoesNotExists
+     *	/n		2. Not joined in this group  - KImErrGroupNotJoined
+     *
+     * If the request is success whenever there is a change in the group
+     * user will not be notified.
+     *
+     */
+     virtual TXIMPRequestId UnsubscribeImGroupChangeL(const MXIMPIdentity& aGroupId)= 0;
+        /** 
+     * Creates IM group
+     * 				(By default private group)
+     * @param [in] aProperties
+     *      To be created IM group Properties.
+     *
+     * @return The request ID identifying the issued request.
+     *
+     * /b Note: Possible error conditions
+     *	/n		1. Group already exists -  KImErrGroupAlreadyExists
+     *	/n		2. Incorrect group properties is not  - KImErrGroupPropertyNotSupported
+     *	/n		3. Not allowed to create a group - KImErrNotHavingPermission
+     *
+     * If the request is success it will create a group
+     *
+     */
+    virtual TXIMPRequestId CreateImGroupL(const MImGroupInfo& aProperties) = 0;
+	/**
+     * Join IM group
+     *
+	 * @param [in] aGroupId	
+     *		Identification for IM group.
+     *
+	 * @return The request ID identifying the issued request.
+     *
+     * /b Note: Possible error conditions
+     *	/n		1. Group does't exists - KImErrGroupDoesNotExists 
+     *	/n		2. Group already joined - KImErrGroupAlreadyJoined
+     *	/n		3. Joining this group is rejected - KImErrJoiningNotAllowed
+     *	/n		4. Reached the maximum limit to users can be joined - KImErrTooManyIMGroups
+	 * If the request is success user will be joined in the 
+	 * specified group with the mentioned screenname
+     */
+    virtual TXIMPRequestId JoinImGroupL(const MXIMPIdentity& aGroupId) = 0;
+   /**
+     * Delete IM group
+     *
+	 * @param [in] aGroupId
+     *		Identification for IM group.
+     *
+	 * @return The request ID identifying the issued request.
+     *
+     * /b Note: Possible error conditions
+     *	/n		1. Group does't exists - KImErrGroupDoesNotExists 
+     *	/n		2. Not having access rigts to delete the group -KImErrNotHavingPermission
+     * If the request is success specified group will be deleted
+     */
+    virtual TXIMPRequestId DeleteImGroupL(const MXIMPIdentity& aGroupId) = 0;
+    
+    
+    /**
+     * Leave IM group
+     *
+	 * @param [in] aGroupId
+     *		Identification for IM group.
+     *
+	 * @return The request ID identifying the issued request.
+     *
+     * /b Note: Possible error conditions
+     *	/n		1. Group does't exists - KImErrGroupDoesNotExists 
+     *	/n		2. Not joined in this group - KImErrGroupNotJoined
+     * If the request is success user will leave the group.
+     */
+    virtual TXIMPRequestId LeaveImGroupL(const MXIMPIdentity& aGroupId) = 0;
+   
+    /**
+     * Get the specified group properties
+     *
+	 * @param [in] aGroupId
+     *		Identification for IM group.
+     *
+	 * @return The request ID identifying the issued request.
+     *
+     * /b Note: Possible error conditions
+     *	/n		1. Group does't exists - KImErrGroupDoesNotExists
+     *	/n		2. Not joined in this group - KImErrGroupNotJoined
+     *
+     * If the request is success response will have the specified group properties
+     *
+     */
+     virtual TXIMPRequestId GetImGroupPropertiesL( MXIMPIdentity* aGroupId )= 0;
+
+
+	/**
+     * Set/Modify the specified group properties
+     *
+	 * @param [in] aGroupId
+     *		Identification for IM group.
+     * @param [in] aGroupProps
+     *		Group properties need to be set for the specified group
+     *
+	 * @return The request ID identifying the issued request.
+     *
+     * /b Note: Possible error conditions
+     *	/n		1. Group does't exists - KImErrGroupDoesNotExists
+     *	/n		2. Incorrect group properties - KImErrGroupPropertyNotSupported
+     *	/n		3. Not allowed(having permission) to change the group properties - KImErrNotHavingPermission
+     *
+     * If the request is success specified group properties will be updated
+     *
+     */
+     virtual TXIMPRequestId SetImGroupPropertiesL( MXIMPIdentity* aGroupId,
+                                            MImGroupInfo* aGroupProps)= 0;
+
+	 /**
+     * Get access control list of users of the specified group
+     *
+	 * @param [in] aGroupId
+     *		Identification for IM group.
+     *
+	 * @return The request ID identifying the issued request.
+	 *
+     * /b Note: Possible error conditions
+     *	/n		1. Group does't exists
+     *	/n		2. User does't exists
+     * If the request is success responce will have access control list for the specified group
+     *
+     */
+   virtual TXIMPRequestId GetImGroupAccessControlListL( const MXIMPIdentity& aGroupId )=0;
+    /**
+     * Set access control list of users for the specified group
+     *
+	 * @param [in] aGroupId
+     *		Identification for IM group.
+	 * @param [in] acl
+     *		access control list.
+
+     * @return The request ID identifying the issued request.
+     * 
+	 *  /b Note: Possible error conditions
+     *	/n		1. Group does't exists
+     *	/n		2. User does't exists
+	 *  /n      3. User don't have access control   
+     * If the request is success responce will have access control for the specified group
+     *
+     */
+   
+   virtual TXIMPRequestId SetImGroupAccessControLlistL( const MXIMPIdentity& aGroupId,
+                                           MImAccessControlList* aCl ) = 0;
+
+  	/**
+     * Set rejected list of users of the specified group
+     *
+	 * @param [in] aGroupId
+     *		Identification for IM group.
+     * @param [in] aRejectedList
+     *      List of users need to be rejected from the group  
+     * @param [in] aEnabledList
+     *      List of users need to be added to the group      
+     *
+	 * @return The request ID identifying the issued request.
+     *
+     * /b Note: Possible error conditions
+     *	/n		1. Group does't exists
+     *	/n		2. User does't exists
+     *  /n		3. Not allowed(having permission) to chage/update users list of the group
+     * If the request is success user permissions will be  
+     * granted as per the request in the specified group
+     *
+     */
+   virtual TXIMPRequestId SetImGroupRejectListL( const TDesC& aGroupId,
+                                      const MDesCArray* aRejectedList,
+                                      const MDesCArray* aEnabledList )= 0;
+
+    
+
+ public: //Prototypes for IM group member management requests
+ 
+   /**
+     * Get list of members of the indicated group
+	 * 
+     * @param [in] aGroupId
+     *		Identification for IM group.
+     *
+	 * @return The request ID identifying the issued request.
+     *
+     * /b Note: Possible error conditions
+     *	/n		1. Group does't exists  - KImErrGroupDoesNotExists
+     *	/n		2. Not Joined in this group  - KImErrGroupNotJoined
+     *
+     * If the request is success,response will have list of members of the specified group
+     *
+     */
+     virtual TXIMPRequestId GetImGroupMembersL( MXIMPIdentity* aGroupId )= 0;
+      /**
+     * Get lest of joined users for the specified group
+     *
+	 * @param [in] aGroupId
+     *		Identification for IM group.
+     *
+	 * @return The request ID identifying the issued request.
+     *
+	 * /b Note: Possible error conditions
+     *	/n		1. Group does't exists
+     *	/n		2. User does't exists
+     * If the Request is success client will get list of joined users for the specified group
+     *
+     */
+   virtual TXIMPRequestId GetImGroupJoinedUsersListL( const MXIMPIdentity& aGroupId )=0;
+       
+	 /**
+     * Add members to IM group
+     *
+	 * @param [in] aGroupId
+     *		Identification for IM group.
+     * @param [in] aUserList
+     *      List of users need to be added to the group     
+     *
+	 * @return The request ID identifying the issued request.
+     *
+     * /b Note: Possible error conditions
+     *	/n		1. Group does't exists
+     *	/n		2. Not allowed(having permission) to change the group properties
+     *
+     * If the request is success user list will be added to the Group
+     *
+     */
+   
+	virtual TXIMPRequestId AddImGroupMembersL( const MXIMPIdentity& aGroupId,const MDesCArray& aUserList )= 0;
+										
+
+  /**
+     * Remove members from IM group
+     *
+	 * @param [in] aGroupId
+     *		Identification for IM group.
+     * @param [in] aUserList
+     *      List of users need to be removed from the group     
+     *
+	 * @return The request ID identifying the issued request.
+     *
+     * /b Note: Possible error conditions
+     *	/n		1. Group does't exists
+     *	/n		2. Not allowed(having permission) to change the group properties
+     *
+     * If the request is success user list will be removed to the Group
+     *
+     */
+    virtual TXIMPRequestId RemoveImGroupMembersL( const MXIMPIdentity& aGroupId,
+   											  const MDesCArray& aUserList )= 0;
+
+    
+    
+    
+    
+    
+    };
+
+
+
+#endif // MIMGROUPS_H
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_im_management_api/inc/imgroupevent.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,186 @@
+/*
+* 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:  Event interface for group content.
+*
+*/
+
+#ifndef MIMGROUPEVENT_H
+#define MIMGROUPEVENT_H
+
+#include <e32std.h>
+#include <ximpbase.h>
+#include <immanagementifids.hrh>
+
+
+class MXIMPIdentity;
+class MImGroupInfo;
+class MImDataSubscriptionState;
+
+
+/**
+ * Event interface for group content.
+ *
+ * This interface is implemented by the Im and
+ * event object is signalled to registered client observers
+ * through MImContextObserver observer interface.
+ * This event notifies clients about changes in
+ * group content.
+ *
+ * Clients subscribe for this event with
+ * MImGroups::SubscribeImGroupChangeL().
+ *
+ * Im signals this event when:
+ * - New subscribed data is received from protocol.
+ * - Data item data subscription status is updated by
+ *   protocol adaptation.
+ * - When client unsubscribes the data item.
+ * - Im generates initial data notification
+ *   to client automatically after clients subscription,
+ *   when the initial data comes available from protocol.
+ *
+ * @ingroup imftmanagementapievents
+ * 
+ */
+class MImGroupEvent : public MXIMPBase
+    {
+public:
+    /** Interface ID for the MImGroupEvent. */
+    enum { KInterfaceId = IM_IF_ID_GROUP_EVENT };
+
+
+
+protected:
+
+    /**
+     * Protected destructor.
+     * Object instancies can't be deleted via this interface.
+     */
+    virtual ~MImGroupEvent() {}
+
+
+public: // Access to "delta information"
+
+
+    /**
+     * Gets count of new groups.
+     *
+     * @return The count of new groups.
+     */
+    virtual TInt NewGroupsCount() const = 0;
+
+
+    /**
+     * Gets group entry by index.
+     *
+     * @param [in] aIndex
+     *        The index of the group entry to get.
+     *
+     * @return The group entry from given index.
+     */
+    virtual const MImGroupInfo& NewGroup(
+                TInt aIndex ) const = 0;
+
+
+    /**
+     * Gets count of updated groups.
+     *
+     * @return The count of updated groups.
+     */
+    virtual TInt UpdatedGroupsCount() const = 0;
+
+
+    /**
+     * Gets group entry by index.
+     *
+     * @param [in] aIndex
+     *        The index of the group entry to get.
+     *
+     * @return The group entry from given index.
+     */
+    virtual const MImGroupInfo& UpdatedGroup(
+                TInt aIndex ) const = 0;
+
+
+    /**
+     * Gets count of disappeared groups.
+     *
+     * @return The count of disappeared groups.
+     */
+    virtual TInt DisappearedGroupsCount() const = 0;
+
+
+    /**
+     * Gets group entry by index.
+     *
+     * @param [in] aIndex
+     *        The index of the group entry to get.
+     *
+     * @return The group entry from given index.
+     */
+    virtual const MImGroupInfo& DisappearedGroup(
+                TInt aIndex ) const = 0;
+
+
+
+public: // Access to "current information"
+
+    /**
+     * Gets count of current groups.
+     *
+     * Note that, current information is signalled only when
+     * the client refreshes the event data from Im cache,
+     * by re-issuing the data subscription.
+     *
+     * @return The count of current groups.
+     */
+    virtual TInt CurrentGroupsCount() const = 0;
+
+
+    /**
+     * Gets group entry by index.
+     *
+     * Note that, current information is signalled only when
+     * the client refreshes the event data from Im cache,
+     * by re-issuing the data subscription.
+     *
+     * @param [in] aIndex
+     *        The index of the group entry to get.
+     *
+     * @return The group entry from given index.
+     */
+    virtual const MImGroupInfo& CurrentGroup(
+                TInt aIndex ) const = 0;
+
+
+
+public: // Access to subscription state
+
+
+    /**
+     * Returns subscription state object holding
+     * information about data items data subscription state.
+     *
+     * @return The data items data subscription state.
+     *         Object ownership is not returned.
+     */
+    virtual const MImDataSubscriptionState& DataSubscriptionState() const = 0;
+
+
+    };
+
+
+#endif // MIMGROUPEVENT_H
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_im_management_api/inc/iminvitation.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,156 @@
+/*
+* 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:  IM Invitation handling interface for clients use.
+*
+*/
+
+#ifndef MIMININVITATION_H
+#define MIMININVITATION_H
+
+
+#include <ximpbase.h>
+#include <ximpidentity.h>
+#include <bamdesca.h>
+#include "immanagementifids.hrh"
+
+class MImInvitationInfo;
+class MXIMPIdentity;
+
+/**
+ * IM Invitation handling interface for clients use.
+ * Interface is implemented by the IM.
+ *
+ * MImInvitation provides services for
+ * IM clients to manage Invitationitaion
+ * It provides also services to ???
+ *
+ * Client can retrieve MImInvitation interface from
+ * MImContext interface.
+ *
+ * @ingroup Immanagementapi
+ * 
+ */
+class MImInvitation : public MXIMPBase
+    {
+public:
+
+    /** Interface ID for the MImInvitation. */
+    enum { KInterfaceId = IM_IF_ID_INVITATION};
+
+
+protected:
+
+    /**
+     * Protected destructor.
+     * Object instancies can't be deleted via this interface.
+     */
+    virtual ~MImInvitation() {}
+
+
+public: //Invitation Requests
+
+     /** Inviting group of users to join in the mentioned group
+     *
+	 *  @param [in] aUserID           = IDs of the users to invite
+     *  @param [in] InviteGroup      = ID of the group to which the users
+     *                             			are invited to join
+	 * @param [in] aInviteInfo        = Identification and content of the invitation.
+     *		MImInvitationInfo contains InviteId, contenttype - text/content, invitereason,validityperiod....... 
+     *
+	 * @return The request id identifying the issued request.
+     *
+	 * /b Note: Possible error conditions
+     *	/n		1. Invalid invite ID
+     *	/n		2. Invalid userId/screenname
+     *	/n		3. Group does't exists
+     *  If the request is success it will send a group invitation to the mentioned users
+	 *
+     */
+    virtual TXIMPRequestId ImGroupInviteL( const MDesCArray* aUserID,
+                                    const MXIMPIdentity& InviteGroup,
+                                   const MImInvitationInfo& aInviteInfo )= 0;
+                                   
+    /**  Invite user to IM conversation
+     *
+	 *  @param [in] aUserID           = ID of the user to invite
+     *  @param [in] aInviteInfo       = Identification and content of the invitation.
+     *		MImInvitationInfo contains InviteId, contenttype - text/content, invitereason,validityperiod....... 
+	 *
+	 *  @return The request ID identifying the issued request.
+     *  
+	 * /b Note: Possible error conditions
+     *	/n		1. Invalid Invite ID
+     *	/n		2. Invalid userId
+     *  If the request is success it will send a group invitation to the mentioned users
+     *
+	 */
+    virtual TXIMPRequestId ImInviteL( const TDesC& aUserID,                              
+                                 const MImInvitationInfo& aInviteInfo ) = 0;
+                                 
+     /** Cancel an im group invite 
+     *
+	 *  @param [in] aUserID           = IDs of the users to cancel invititation
+     *  @param [in] InviteGroup      = ID of the group to which the users
+     *                             			are invited to join
+	 * @param [in] aInviteInfo        = Identification and content of the invitation.
+     *		MImInvitationInfo contains InviteId, contenttype - text/content, invitereason,validityperiod....... 
+     * @return The request ID identifying the issued request.
+     *
+	 * /b Note: Possible error conditions
+     *	/n		1. Invalid Invite ID
+     *	/n		2. Invalid userId/Screenname
+     *	/n		3. Group does't exists
+     *  If the request is success it will send a group invitation to the mentioned users
+     *
+	 */
+  virtual TXIMPRequestId CancelImgroupInviteL( const MDesCArray* aUserID,
+                                    const MXIMPIdentity& InviteGroup,
+                                   const MImInvitationInfo& aInviteInfo )= 0;
+                                
+     /**  Cancel an IM conversation Invite
+     *
+	 *  @param [in] aUserID           = ID of the user to cancel invitataion
+     *  @param [in] aInviteInfo       = Identification and content of the invitation.
+     *		MImInvitationInfo contains InviteId, contenttype - text/content, invitereason,validityperiod....... 
+     *  @return The request ID identifying the issued request.
+     *
+	 * /b Note: Possible error conditions
+     *	/n		1. Invalid Invite ID
+     *	/n		2. Invalid userId
+     *  If the request is success it will send a group invitation to the mentioned users
+     *
+	 */
+    virtual TXIMPRequestId CancelImInviteL( const TDesC& aUserID,                              
+                                 const MImInvitationInfo& aInviteInfo ) = 0;
+                                 
+     /** Send response to invite
+	 *
+     *  @param [in] aRecipientUserId  = UserID of the invitee
+     *  @param [in] aInviteInfo       = Identification and content of the invitation.
+     *		MImInvitationInfo contains InviteId, contenttype - text/content, inviteresponse,acceptance....... 
+	 *  @return The request ID identifying the issued request.
+     * 
+	 * /b Note: Possible error conditions
+     *	/n		1. Invalid invite id
+     *	/n		2. Invalid userId/screenname/groupName
+     *  If the request is success it will send a group invitation to the mentioned users
+     *
+	 */
+		virtual TXIMPRequestId InviteResponseL( const TDesC& aRecipientUserId,
+										   const MImInvitationInfo& aInviteInfo ) = 0;
+    };
+#endif // MIMININVITATION_H
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_im_management_api/inc/iminvitationevent.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,110 @@
+/*
+* 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:  Event interface for invitation content.
+*
+*/
+
+#ifndef MIMINVITATIONEVENT_H
+#define MIMINVITATIONEVENT_H
+
+#include <e32std.h>
+#include <ximpbase.h>
+#include <immanagementifids.hrh>
+
+
+class MXIMPIdentity;
+class MImInvitationInfo;
+class MImDataSubscriptionState;
+
+
+/**
+ * Event interface for invitation content.
+ *
+ * This interface is implemented by the IM and
+ * event object is signalled to registered client observers
+ * through MImContextObserver observer interface.
+ * This event notifies clients about changes in
+ * invitation content.
+ *
+ * IM signals this event when:
+ * - New invitation for group is received from protocol.
+ * - New invitation for conversation is received from protocol.
+ * - Invitation response for group is received
+ * - Invitation response for conversation is received
+ * @ininvitation immanagementapievents
+ * 
+ */
+class MImInvitationEvent : public MXIMPBase
+    {
+public:
+    /** Interface ID for the MImInvitationEvent. */
+    enum { KInterfaceId = IM_IF_ID_INVITATION_EVENT };
+
+
+
+protected:
+
+    /**
+     * Protected destructor.
+     * Object instancies can't be deleted via this interface.
+     */
+    virtual ~MImInvitationEvent() {}
+
+
+public: // Access to "current information"
+
+
+    /**
+     * Gets count of invitations.
+     *
+     * @return The count of invitations.
+     */
+    virtual TInt InvitationCount() const = 0;
+
+
+    /**
+     * Gets invitation response by index.
+     *
+     * @param [in] aIndex
+     *        The index of the invitation entry to get.
+     *
+     * @return The invitation response from given index.
+     */
+    virtual const MImInvitationInfo& InvitationResponse(
+                TInt aIndex ) const = 0;
+
+
+
+
+
+public: // Access to subscription state
+
+
+    /**
+     * Returns subscription state object holding
+     * information about data items data subscription state.
+     *
+     * @return The data items data subscription state.
+     *         Object ownership is not returned.
+     */
+    virtual const MImDataSubscriptionState& DataSubscriptionState() const = 0;
+
+
+    };
+
+
+#endif // MIMINVITATIONEVENT_H
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_im_management_api/inc/immanagementifids.hrh	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,57 @@
+/*
+* 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:  Im Feature Plugin Management API interface IDs.
+*
+*/
+
+#ifndef IMMANAGEMENTIFUIDS_HRH
+#define IMMANAGEMENTIFUIDS_HRH
+
+
+
+
+
+// Management IF id's
+// 20xx - ximp related
+// 21xx - presence related
+// 22xx - instant messaging related
+
+
+
+// Interface IDs for Im Feature Plugin Management API interfaces
+#define IM_IF_ID_SEARCH                        2211
+#define IM_IF_ID_GROUPS                        2212
+#define IM_IF_ID_CONVERSATION                  2213
+#define IM_IF_ID_INVITATION                    2214
+#define IM_IF_ID_GROUP_EVENT                   2215
+#define IM_IF_ID_CONVERSATION_EVENT            2216
+#define IM_IF_ID_INVITATION_EVENT              2217
+#define IM_IF_ID_SEARCH_EVENT                  2218
+#define IM_IF_ID_PROTOCOL_IM_FEATURES          2219
+#define IM_IF_ID_ACCESSCONTROL_LIST            2220
+#define IM_CLSID_CIMFEATURESIMP                2221
+#define IM_IF_ID_SEARCHREQUEST								2222
+
+
+// Interface UID for IMfeatures interface
+#define XIMP_ECOM_IF_UID_IM_INTERFACE             0x2000B5F4
+
+// Default implementation resulution data
+// for XIMP imfeature interterface Base ECom interface
+#define XIMP_ECOM_DEFAULT_DATA_IM_INTERFACE         "default"
+
+
+
+#endif // IMMANAGEMENTIFUIDS_HRH
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_im_management_api/inc/imsearch.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,113 @@
+/*
+* 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:  Search interface for clients use.
+*
+*/
+
+#ifndef CIMSEARCH_H
+#define CIMSEARCH_H
+
+#include <e32std.h>
+#include <ximpbase.h>
+#include "imsearchelementimp.h"
+#include "immanagementifids.hrh"
+
+/**
+ * Search interface for clients use.
+ * Interface is implemented by the IM.
+ *
+ * @ingroup immanagementapi
+ *
+ */
+class MImSearch : public MXIMPBase
+    {
+public:
+
+    /** Interface ID for the MImSearch. */
+    enum { KInterfaceId = IM_IF_ID_SEARCH };
+
+
+protected:
+
+    /**
+     * Protected destructor.
+     * Object instancies can't be deleted via this interface.
+     */
+    virtual ~MImSearch() {}
+
+
+
+public: 
+
+    /**
+     * Start search.
+     *
+     * @param [in] aImSearchId
+     *		Identification for IM search.
+     * @param [in] aPairs 
+     *        Defines what is to be searched.
+     * @param [in] aSearchLimit 
+     *        How many results you want.
+     *
+	 * @return The request ID identifying the issued request.
+	 * 
+	 * /b Note: Possible error conditions
+     *	/n	 1. Invalid/Unsupported search-element [KImErrFieldTypeNotSupported].
+     */
+    virtual TXIMPRequestId ImSearchL( const MXIMPIdentity& aImSearchId,
+    										   const CSearchRequest& aPairs,
+                                    		   TInt aSearchLimit ) = 0;
+
+    /**
+     * Continue search.
+     *
+     * @param [in] aImSearchId
+     *		  Identification for IM search.
+     * @param [in] aSearchID 
+     *		  Which search is to be continued.
+     * @param [in] aIndex 
+     *		  From which index the search is continued.
+	 *
+     * @return The request ID identifying the issued request.
+     *
+     * /b Note: Possible error conditions
+     *	/n	 1. Initial search request was not sent / Invalid searchid [KImErrFieldValueNotSupported].
+     *	/n	 2. Invalid Search-index / out of range [KImErrOutOfRangeValue].
+     *	/n	 3. Search timeout (in case of continued search the subsequent request primitive is late) [KImErrServicRequestTimeouted].
+     */
+    virtual TXIMPRequestId ContinueImSearchL( const MXIMPIdentity& aImSearchId,
+    										  TInt aSearchID ) = 0;
+
+    /**
+     * Stop search.
+     *
+	 * @param [in] aImSearchId
+     *		Identification for IM search.
+     * @param [in] aSearchID 
+     *		  Which search is to be stopped.
+     *
+	 * @return The request ID identifying the issued request.
+	 *
+     * /b Note: Possible error conditions
+     *	/n	 1. Initial search request was not sent (invalid searchid) [KImErrFieldValueNotSupported].
+     */
+	virtual TXIMPRequestId StopImSearchL( const MXIMPIdentity& aImSearchId,
+											  TInt aSearchID ) = 0;
+	
+    };
+
+
+#endif // CIMSEARCH_H
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_im_management_api/inc/imsearchelement.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,122 @@
+/*
+* 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:  Implementation of MImSearchRequest
+*
+*/
+
+
+#ifndef MIMSEARCHELEMENT_H
+#define MIMSEARCHELEMENT_H
+#include <e32std.h>
+#include <ximpbase.h>
+#include "imsearchelementimp.h"
+#include "imapiobjbase.h"
+#include "ximpidentity.h"
+#include <immanagementifids.hrh>
+
+/*
+* Supported search elements 
+*/
+enum TSearchElement
+    {
+    EUserAlias,
+    EUserOnlineStatus,
+    EUserEmailAddress,
+    EUserFirstName,
+    EUserID,
+    EUserLastName,
+    EUserMobileNumber,
+    EUserAgeMin,
+    EUserAgeMax,
+    EUserCountry,
+    EUserFriendlyName,
+    EUserCity,
+    EUserGender,
+    EUserIntention,
+    EUserInterestHobbies,
+    EUserMaritialStatus,
+    EGroupID,
+    EGroupName,
+    EGroupTopic,
+    EGroupUserIDJoined,
+    EGroupUserIDOwner
+    };
+
+/*
+* Search result element
+*/
+enum TSearchResultType
+    {
+    EUserResult,
+    EGroupResult
+    };
+    
+/**
+ * Interface for IM search request object.
+ *
+ * 
+ *
+ * @ingroup Imdatamodelapi
+ * 
+ */
+class MImSearchRequest : public MXIMPBase
+{
+    public:
+
+        /** Interface ID for the MImSearchRequest. */
+    	enum { KInterfaceId = IM_IF_ID_SEARCHREQUEST };
+
+    public:
+    
+    	/**
+     	* Public destructor.
+     	* Objects instancies can be deleted through this interface.
+     	*/
+    	virtual ~MImSearchRequest() {}
+    	
+    public: 	
+        /**
+        * Set search values. 
+        * @param [in] aSearchId
+	    *		Identification for IM search.
+        * @param [in] aElement 
+        *			  search key
+        * @param [in] aValue 
+        *			  search value
+        * @return The request ID identifying the issued request.
+        *
+        * Note: Possible error conditions
+	    *		 1. Invalid/Unsupported Search-Element [KImErrFieldTypeNotSupported].
+	    *		 2. Invalid/Unsupported Search-Value [KImErrFieldValueNotSupported].
+	    */
+        virtual TXIMPRequestId SetRequestL( MXIMPIdentity* aSearchId,
+        										  TSearchElement aElement, 
+                                   				  const TDesC& aValue ) = 0;
+        
+        /**
+        * Reset the object 
+        * @param [in] aSearchId
+	    *		Identification for IM search.
+        * @return The request ID identifying the issued request.
+	    */
+        virtual TXIMPRequestId ResetL( MXIMPIdentity* aSearchId ) = 0;
+        
+        
+
+};
+
+
+#endif //MIMSEARCHELEMENT_H
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_im_management_api/inc/imsearchevent.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,86 @@
+/*
+* 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:  Event interface for ImSearch.
+*
+*/
+
+#ifndef MIMSEARCHEVENT_H
+#define MIMSEARCHEVENT_H
+
+#include <e32std.h>
+#include <ximpbase.h>
+#include "immanagementifids.hrh"
+class MImSearchInfo;
+
+
+/**
+ * Event interface for message content.
+ *
+ * This interface is implemented by the IM Feature Plugin and
+ * event object is signalled to registered client observers
+ * through MImSearchContextObserver observer interface.
+ * This event notifies clients about changes in
+ * search result.
+ *
+ * IM signals this event when:
+ * - Search result is received from protocol.
+ * @ingroup Immanagementapievents
+ * 
+ */
+class MImSearchEvent : public MXIMPBase
+    {
+public:
+    /** Interface ID for the MImSearchEvent. */
+    enum { KInterfaceId = IM_IF_ID_SEARCH_EVENT };
+
+
+protected:
+
+    /**
+     * Protected destructor.
+     * Object instancies can't be deleted via this interface.
+     */
+    virtual ~MImSearchEvent() {}
+
+
+public: 
+
+	
+    /**
+     * Gets the count of the searched results.
+     *
+     * @return The count of count of the searched results.
+     */
+    virtual TInt SearchResultCount() const = 0;
+    
+    
+    /**
+     * Gets the searched result by index.
+     *
+     * @param [in] aIndex
+     *        The index of the search.
+     *
+     * @return The searched result from given index.
+     */
+    virtual const MImSearchInfo& SearchResult( TInt aIndex ) const = 0;
+    
+    
+	
+
+    };
+
+
+#endif // MIMSEARCHEVENT_H
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_im_management_api/ximp_im_management_api.metaxml	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,14 @@
+<?xml version="1.0" ?>
+<api id="ec9b710291eb2dfbbd2ad55b2226f895" dataversion="1.0">
+<name>ximp_im_management_api</name>
+<description>This is a API that provides instant messaging related APIs like sending and receiving messages to the client.</description>
+<type>c++</type>
+<subsystem>immanager</subsystem>
+<libs><lib name="immanager.lib"/>
+</libs>
+<release category="domain" sinceversion=""/>
+<attributes>
+<htmldocprovided>yes</htmldocprovided>
+<adaptation>no</adaptation>
+</attributes>
+</api>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_im_protocol_plugin_api/group/bld.inf	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,37 @@
+/*
+* 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:  File that exports the files belonging to 
+:                XIMP Im Protocol Plug-in API
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+../inc/protocolimconversation.h     MW_LAYER_PLATFORM_EXPORT_PATH(protocolimconversation.h)
+../inc/protocolimgroup.h     MW_LAYER_PLATFORM_EXPORT_PATH(protocolimgroup.h)
+../inc/protocoliminvitation.h     MW_LAYER_PLATFORM_EXPORT_PATH(protocoliminvitation.h)
+../inc/protocolimfeatures.h     MW_LAYER_PLATFORM_EXPORT_PATH(protocolimfeatures.h)
+../inc/protocolimfeatures.inl     MW_LAYER_PLATFORM_EXPORT_PATH(protocolimfeatures.inl)
+../inc/improtocolpluginifids.hrh     MW_LAYER_PLATFORM_EXPORT_PATH(improtocolpluginifids.hrh)
+../inc/protocolimsearch.h     MW_LAYER_PLATFORM_EXPORT_PATH(protocolimsearch.h)
+../inc/cprotocolimfeatures.h     MW_LAYER_PLATFORM_EXPORT_PATH(cprotocolimfeatures.h)
+../inc/cprotocolimfeatures.inl     MW_LAYER_PLATFORM_EXPORT_PATH(cprotocolimfeatures.inl)
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_im_protocol_plugin_api/inc/cprotocolimfeatures.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,288 @@
+/*
+* 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:  Interface for IM Protocol connection object.
+*
+*/
+
+#ifndef CPROTOCOLIMFEATURES_H
+#define CPROTOCOLIMFEATURES_H
+
+
+#include <e32std.h>
+#include <ximpbase.h>
+#include <immanagementifids.hrh>
+#include <ximpcontext.h>
+
+class MProtocolImGroup;
+class MProtocolImConversation;
+class MProtocolImInvitation;
+class MProtocolImSearch;
+class MProtocolImDataHost;
+
+
+
+/**
+ * Interface for IM protocol connection object.
+ * Interface must be implemented by a XIMP Framework
+ * plug-ins.
+ *
+ * This interface models a connection from XIMP Framework to
+ * single remote IM service, over certain IM protocol
+ * implementation. XIMP Framework calls methods on this interface
+ * based on XIMP Framework client requests.
+ *
+ * XIMP Framework retrieves MXIMPProtocolConnection
+ * instances through MXIMPProtocolPlugin::AcquireConnectionL().
+ * Same MXIMPProtocolConnection instance may be returned by multiple
+ * MXIMPProtocolPlugin::AcquireConnectionL() calls. In this case
+ * XIMP Framework shares MXIMPProtocolConnection instance
+ * by multiple clients, and MXIMPProtocolConnection lifetime is
+ * extended over utilizing client sessions. When last utilizing
+ * client session is succesfully closed with
+ * MXIMPProtocolConnection::CloseSession(), XIMP Framework
+ * disposes the MXIMPProtocolConnection instance with
+ * MXIMPProtocolPlugin::ReleaseConnection().
+ *
+ *
+ * CProtocolImFeatures implementation must provide
+ * access following feature specific sub-interfaces:
+ * - MProtocolImGroup
+ * - MProtocolImConversation
+ * - MProtocolImInvitation
+ * - MProtocolImSearch
+ *
+ * Each provided sub-interface defines a set of its own
+ * im managements requests, relating to im groups,search,im and
+ * im invitation.
+ * IM calls these sub-interfaces to request on
+ * spesific im requests from protocol connection.
+ *
+ * @see MXIMPProtocolConnectionHost
+ * @ingroup protocolimpluginapi
+ * @since S60 
+ */
+class CProtocolImFeatures : public CBase, public MXIMPBase
+    {
+    
+public:
+
+    /** Interface ID for the CProtocolImFeatures. */
+    enum { KInterfaceId = IM_IF_ID_PROTOCOL_IM_FEATURES };
+    
+    /** All possible subinterfaces plugin may support. */
+    enum KImFeatureSubInterfaces 
+        {
+        EProtocolImGroup            = 1,
+        EProtocolImConversation     = 2,
+        EProtocolImInvitation       = 4,
+        EProtocolImSearch           = 8
+        };
+    
+	/**
+     * Factory method to instantiate CProtocolImFeatures.
+     *
+     * Factory method to instantiate platform default
+     * MXIMPClient implementation through the ECom.
+     * If the default IM Feature isn't supported
+     * in the platform, leaves with errorcode signalled
+     * from ECom.
+     *
+     * @return The new Im client object. Object
+     *         ownership is returned to caller.
+     */
+    static inline CProtocolImFeatures* NewL();
+    
+    /**
+     * Factory method to instantiate CProtocolImFeatures with
+     * initial parameters and specified implementation UID.
+     *
+     * If the specified IM Feature isn't supported
+     * in the platform, leaves with errorcode signalled
+     * from ECom.
+     * 
+     * @since S60 v5.0
+     * @param aImplementationUid    Implementation UID of the plugin to be loaded
+     * @param aInitParams           Initialization parameters
+     * @return The new Im client object.
+     */
+    static inline CProtocolImFeatures* NewL( TUid aImplementationUid,
+        TAny* aInitParams );
+
+    /**
+     * Protected destructor. MXIMPProtocolConnection
+     * objects can't be deleted through this interface.
+     *
+     * XIMP Framework disposes MXIMPProtocolConnection
+     * instances through MXIMPProtocolPlugin::ReleaseConnection().
+     */
+    virtual inline ~CProtocolImFeatures();
+    
+    /**
+     * Returns bitfield representing supported sub-interfaces. Sub-interfaces
+     * are defined with KImFeatureSubInterfaces. If client tries to access
+     * non-supported sub-interface, panic will occur.
+     *
+     * @return  Supported sub-interfaces as a bitwield.
+     */
+    virtual TInt SupportedSubInterfaces() const = 0;
+
+protected:
+
+    /**
+     * Default constructor to zero initialize
+     * the iEcomDtorID member.
+     */
+    inline CProtocolImFeatures();
+
+
+public: // Access to sub-interfaces
+
+
+    /**
+     * Gets reference to im group interface.
+     *
+     * IM calls this method to retrieve a reference
+     * to protocols MProtocolImGroup interface
+     * implementation.
+     *
+     * Call and interface lifetime convention:
+     * - This method isn't called before protocol has signalled
+     *   MXIMPProtocolConnection::OpenSessionL() succesfully completed.
+     *
+     * - XIMP Framework may call this method multiple times for
+     *   for one MXIMPProtocolConnection instance.
+     *
+     * - Each call per one MXIMPProtocolConnection instance,
+     *   must return reference to same interface instance.
+     *
+     * - Returned interface instance must remain valid (usable)
+     *   untill last client session, using originating im protocol
+     *   connection is successfully closed with
+     *   MXIMPProtocolConnection::CloseSession().
+     *
+     * @return Requested interface.
+     *         interface ownership is not returned caller.
+     */
+   virtual MProtocolImGroup& ImGroup() = 0;
+
+
+
+    /**
+     * Gets reference to Im Conversation interface.
+     *
+     * IM calls this method to retrieve a reference
+     * to protocols MProtocolImConversation interface
+     * implementation.
+     *
+     * Call and interface lifetime convention:
+     * - This method isn't called before protocol has signalled
+     *   MXIMPProtocolConnection::OpenSessionL() succesfully completed.
+     *
+     * - XIMP Framework may call this method multiple times for
+     *   for one MXIMPProtocolConnection instance.
+     *
+     * - Each call per one MXIMPProtocolConnection instance,
+     *   must return reference to same interface instance.
+     *
+     * - Returned interface instance must remain valid (usable)
+     *   untill last client session, using originating im protocol
+     *   connection is successfully closed with
+     *   MXIMPProtocolConnection::CloseSession().
+     *
+     * @return Requested interface.
+     *         interface ownership is not returned caller.
+     */
+    virtual MProtocolImConversation& ImConversation() = 0;
+
+
+
+    /**
+     * Gets reference to im groups interface.
+     *
+     * IM calls this method to retrieve a reference
+     * to protocols MProtocolImInvitation interface
+     * implementation.
+     *
+     * Call and interface lifetime convention:
+     * - This method isn't called before protocol has signalled
+     *   MXIMPProtocolConnection::OpenSessionL() succesfully completed.
+     *
+     * - XIMP Framework may call this method multiple times for
+     *   for one MXIMPProtocolConnection instance.
+     *
+     * - Each call per one MXIMPProtocolConnection instance,
+     *   must return reference to same interface instance.
+     *
+     * - Returned interface instance must remain valid (usable)
+     *   untill last client session, using originating im protocol
+     *   connection is successfully closed with
+     *   MXIMPProtocolConnection::CloseSession().
+     *
+     * @return Requested interface.
+     *         interface ownership is not returned caller.
+     */
+    virtual MProtocolImInvitation& ImInvitation() = 0;
+
+
+
+    /**
+     * Gets reference to im search interface.
+     *
+     * IM calls this method to retrieve a reference
+     * to protocols MProtocolImSearch interface
+     * implementation.
+     *
+     * Call and interface lifetime convention:
+     * - This method isn't called before protocol has signalled
+     *   MXIMPProtocolConnection::OpenSessionL() succesfully completed.
+     *
+     * - XIMP Framework may call this method multiple times for
+     *   for one MXIMPProtocolConnection instance.
+     *
+     * - Each call per one MXIMPProtocolConnection instance,
+     *   must return reference to same interface instance.
+     *
+     * - Returned interface instance must remain valid (usable)
+     *   untill last client session, using originating im protocol
+     *   connection is successfully closed with
+     *   MXIMPProtocolConnection::CloseSession().
+     *
+     * @return Requested interface.
+     *         interface ownership is not returned caller.
+     */
+    virtual MProtocolImSearch& ImSearch() = 0;
+
+    
+    /**
+     * Sets data host.
+     * 
+     * IM calls this method to specify datahost.
+     * 
+     * @since   S60 v5.0
+     * @param   aHost   data host
+     * @return  void
+     */    
+    virtual void SetHost(MProtocolImDataHost& aHost) = 0;
+  
+private: // Data
+
+    /**
+     * Unique instance identifier key
+     */
+    TUid iEcomDtorID;
+    };
+
+#include <cprotocolimfeatures.inl>
+
+#endif // CPROTOCOLIMFEATURES_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_im_protocol_plugin_api/inc/cprotocolimfeatures.inl	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,80 @@
+/*
+* 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:  IM Features interface used by XIMP IM clients.
+*
+*/
+
+#include <ecom/ecom.h>
+
+
+// -----------------------------------------------------------------------------
+// CProtocolImFeatures::NewL() implementation
+// Factory method to instantiate the platform default
+// CProtocolImFeatures implementation through the ECom framework.
+// -----------------------------------------------------------------------------
+//
+inline CProtocolImFeatures* CProtocolImFeatures::NewL()
+    {
+    _LIT8( KXIMPIMDefaultData, "2219" );
+
+    TEComResolverParams resolvingParams;
+    resolvingParams.SetDataType( KXIMPIMDefaultData );
+    resolvingParams.SetWildcardMatch( ETrue );
+    TAny* imp = REComSession::CreateImplementationL( 
+        TUid::Uid( CProtocolImFeatures::KInterfaceId), 
+        _FOFF( CProtocolImFeatures, iEcomDtorID ), resolvingParams );
+
+    return reinterpret_cast< CProtocolImFeatures* >( imp );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CProtocolImFeatures::NewL() implementation
+// Factory method to instantiate the user specific implementation for 
+// CProtocolImFeatures API through the ECom framework.
+// -----------------------------------------------------------------------------
+//
+inline CProtocolImFeatures* CProtocolImFeatures::NewL( TUid aImplementationUid,
+    TAny* aInitParams )
+    {
+    CProtocolImFeatures* ptr = reinterpret_cast<CProtocolImFeatures*>(
+        REComSession::CreateImplementationL( 
+        aImplementationUid, 
+        _FOFF( CProtocolImFeatures, iEcomDtorID ), 
+        aInitParams ) );
+
+    return ptr;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CProtocolImFeatures::CProtocolImFeatures() implementation
+// Zero initializes the iEcomDtorID member.
+// -----------------------------------------------------------------------------
+//
+inline CProtocolImFeatures::CProtocolImFeatures()
+    {
+    iEcomDtorID = TUid::Null();
+    }
+
+
+// -----------------------------------------------------------------------------
+// CProtocolImFeatures::~CProtocolImFeatures()
+// Destructor notifies the ECom from implementation destruction.
+// -----------------------------------------------------------------------------
+//
+inline CProtocolImFeatures::~CProtocolImFeatures()
+    {
+    REComSession::DestroyedImplementation( iEcomDtorID );
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_im_protocol_plugin_api/inc/improtocolpluginifids.hrh	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,37 @@
+/*
+* 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:  Protocol Plugin API interface IDs.
+*
+*/
+
+#ifndef IMPROTOCOLPLUGINIFIDS_HRH
+#define IMPROTOCOLPLUGINIFIDS_HRH
+
+
+
+// Protocol plugin IF id's
+// 30xx - ximp related
+// 31xx - presence related
+// 32xx - instant messaging related
+
+// Interface IDs for XIMPFw Protocol Plugin API interfaces
+#define IM_IF_ID_PROTOCOL_GROUPS                    3201
+#define IM_IF_ID_PROTOCOL_CONVERSATION               3202
+#define IM_IF_ID_PROTOCOL_INVITATION                3203
+#define IM_IF_ID_PROTOCOL_SEARCH                    3204
+//#define IM_IF_ID_PROTOCOL_IM_FEATURES               3205
+
+#endif // IMPROTOCOLPLUGINIFIDS_HRH
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_im_protocol_plugin_api/inc/protocolimconversation.h	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  Interface for IM protocol messaging object.
+*
+*/
+
+#ifndef MPROTOCOLIMCONVERSATION_H
+#define MPROTOCOLIMCONVERSATION_H
+
+
+#include <e32std.h>
+#include <badesca.h>
+#include <ximpbase.h>
+#include <improtocolpluginifids.hrh>
+
+
+class MXIMPIdentity;
+class MImConversationInfo;
+/**
+ * Interface for IM protocol message handling object.
+ * Interface must be implemented by a IM protocol
+ * plug-ins.
+ *
+ * This interface defines actions that IM 
+ * requests from a IM protocol connection to
+ * execute conversation related tasks.
+ *
+ * Protocol implementation must route requests received through
+ * this interface, to same remote IM service destination,
+ * as where the parent MXIMPProtocolConnection is connected.
+ * (Here the parent MXIMPProtocolConnection means the protocol
+ * connection instance from where this interface instance
+ * was retrieved.)
+ *
+ * @see MXIMPProtocolConnection
+ * @ingroup Improtocolpluginapi
+ *
+ */
+class MProtocolImConversation : public MXIMPBase
+    {
+public:
+
+    /** Interface ID for the MProtocolImConversation. */
+    enum { KInterfaceId = IM_IF_ID_PROTOCOL_CONVERSATION };
+
+
+protected:
+
+    /**
+     * Protected destructor. MProtocolImConversation
+     * instancies can't be destroyed via this interface.
+     */
+    virtual inline ~MProtocolImConversation() {};
+
+public: 
+    /**
+     * Request the protocol to send a  message.
+     *
+	 * @param [in] aImMessage 	- Identification and content of the message.
+     *		MImConversationInfo contains messageid, contenttype - text/content, content,.......  
+     * @param [in] aRecipients 	- Recipients userid.
+     * @param [in] aReqId
+     *        Request id identifying the issued request.
+	 *
+	 * /b Note: Possible error conditions
+     *	/n	 1. Invalid User-ID/Recipient user does not exist [KImApiErrInvalidUserId].
+     *	/n	 2. Recipient user blocked the sender [KImApiErrSenderBlocked].
+     *	/n	 3. Unsupported message context [KImErrUnsupportedContext].
+     *	/n	 4. Message queue full [KImErrTooManyIM].
+     */
+    virtual void DoSendMessageL( const MImConversationInfo& aImMessage,TXIMPRequestId aReqId )= 0;
+
+    /**
+     * Request the protocol to forward a message with binary content.
+     * Forward message to user(s)
+     *
+	 * @param [in] aImMessage 	- Identification and content of the message.
+     *		MImConversationInfo contains messageid, contenttype - text/content, content,.......  
+     * @param [in] aRecipients 	- Recipients userid.
+	 * @param [in] aReqId
+     *        Request id identifying the issued request.
+	 *
+	 * /b Note: Possible error conditions
+     *	/n	 1. Invalid user-id/recipient user does not exist [KImApiErrInvalidUserId].
+     *	/n	 2. Recipient user blocked the sender [KImApiErrSenderBlocked].
+     *	/n	 3. Unsupported message context [KImErrUnsupportedContext].
+     *	/n	 4. Message queue full [KImErrTooManyIM].
+     */
+   virtual void DoForwardMessageL( const MImConversationInfo& aImMessage,TXIMPRequestId aReqId) = 0;
+
+
+    /**
+     * Request the protocol to send message to group.
+     *
+	 * @param [in] aImMessage 	- Identification and content of the message.
+     *		MImConversationInfo contains messageid, contenttype - text/content, content,.......  
+     * @param [in] aUserIds 	- Recipients userid.
+	 * @param [in] aReqId
+     *        Request id identifying the issued request.
+	 *
+	 * /b Note: Possible error conditions
+     *	/n	 1. Invalid user-id/recipient user does not exist [KImApiErrInvalidUserId].
+     *	/n	 2. Recipient user blocked the sender [KImApiErrSenderBlocked].
+     *	/n	 3. Unsupported message context [KImErrUnsupportedContext].
+     *	/n	 4. Message queue full [KImErrTooManyIM].
+     */
+	virtual void DoSendMessageToGroupL( const MImConversationInfo& aImMessage,
+			                                        const TDesC* aGroupId,TXIMPRequestId aReqId ) = 0;
+
+/**
+     * Request the protocol to block user(s).
+     *
+     * @param [in] aUserIds - User id's need to be blocked
+     * @param [in] aReqId
+     *        Request ID identifying the issued request.
+     *    
+	 * /b Note: Possible error conditions
+     *	/n	 1. UserId doesn't exist [KImErrServiceGeneralError].
+     *	/n	 2. The maximum number of users reached for the user in the list [KImErrTooManyUsers].
+     */
+	virtual TXIMPRequestId DoBlockUsersL(const MDesCArray* aUserIds ,TXIMPRequestId aReqId) = 0;
+/**
+     * Request the protocol to UnBlock User(s).
+     *
+     * @param [in] aUserIds - User id's need to be unblocked
+     * @param [in] aReqId
+     *        Request id identifying the issued request.
+     *
+	 * /b Note: Possible error conditions
+     *	/n	 1. UserId doesn't exist [KImErrServiceGeneralError].
+     *	/n	 2. The maximum number of users reached for the user in the list [KImErrTooManyUsers].
+     */
+	virtual TXIMPRequestId DoUnBlockUsersL(const MDesCArray* aUserIds,TXIMPRequestId aReqId ) = 0;
+
+    /**
+     * Request the protocol to get blocked users list from server
+     *
+     * @param [in] aImMessageId Identification for IM.
+	   * @param [in] aReqId
+     *        Request id identifying the issued request.
+     *
+	 * /b Note: Possible error conditions
+     *	/n	 1. No block list in use [KImErrServiceGeneralError].
+     */
+	virtual void DoGetBlockedListRequestL( const MXIMPIdentity& aImMessageId,
+											TXIMPRequestId aReqId ) = 0;
+
+   
+    /**
+     * Request the protocol to retrieve the message-info structures of the undelivered instant messages. 
+     * May use the retrieved Message-Info structures to inform the user about the new messages, or it May
+	 * retrieve/reject/forward the instant messages automatically.
+	 * 
+     * @param [in] aImMessageId Identification for IM.
+     * @param [in] aGroupId Identifies the group to retrieve history.
+     * @param [in] aMessageCount The maximum number of message-info structures to be returned.
+     * @param [in] aDeliveryReportWanted If the user wats to order delivery report.
+	 * @param [in] aReqId
+     *        Request id identifying the issued request.
+    
+	* /b Note: Possible error conditions
+     *	/n	 1. Invalid group id [KImErrUnknownIMGroup].
+     */
+	virtual void DoGetMessageListL( const MXIMPIdentity& aImMessageId,
+			    								   	   const TDesC* aGroupId,
+			    								   	   const TInt aMessageCount,
+			                                           TBool aDeliveryReportWanted,
+			                                           TXIMPRequestId aReqId) = 0;
+	
+    /**
+     * Request the protocol to reject the accumulated messages in the server.
+     *
+     * @param [in] aImMessageId Identification for IM.
+     * @param [in] aMessageID Identifies the messages to be removed
+	   * @param [in] aReqId
+     *        Request id identifying the issued request.
+     *
+	 * /b Note: Possible error conditions
+     *	/n	 1. Invalid message-id [KImErrFieldValueNotSupported].
+     */
+	virtual void DoRejectMessageL( const MXIMPIdentity& aImMessageId,
+													const TDesC& aMessageID,
+													TXIMPRequestId aReqId ) = 0;
+	
+    
+    };
+
+
+
+#endif // MPROTOCOLIMCONVERSATION_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_im_protocol_plugin_api/inc/protocolimfeatures.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,274 @@
+/*
+* 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:  Interface for IM Protocol connection object.
+*
+*/
+
+#ifndef MPROTOCOLIMFEATURES_H
+#define MPROTOCOLIMFEATURES_H
+
+
+#include <e32std.h>
+#include <ximpbase.h>
+#include <immanagementifids.hrh>
+#include <ximpcontext.h>
+
+class MProtocolImGroup;
+class MProtocolImConversation;
+class MProtocolImInvitation;
+class MProtocolImSearch;
+class MProtocolImDataHost;
+
+
+
+/**
+ * Interface for IM protocol connection object.
+ * Interface must be implemented by a XIMP Framework
+ * plug-ins.
+ *
+ * This interface models a connection from XIMP Framework to
+ * single remote IM service, over certain IM protocol
+ * implementation. XIMP Framework calls methods on this interface
+ * based on XIMP Framework client requests.
+ *
+ * XIMP Framework retrieves MXIMPProtocolConnection
+ * instances through MXIMPProtocolPlugin::AcquireConnectionL().
+ * Same MXIMPProtocolConnection instance may be returned by multiple
+ * MXIMPProtocolPlugin::AcquireConnectionL() calls. In this case
+ * XIMP Framework shares MXIMPProtocolConnection instance
+ * by multiple clients, and MXIMPProtocolConnection lifetime is
+ * extended over utilizing client sessions. When last utilizing
+ * client session is succesfully closed with
+ * MXIMPProtocolConnection::CloseSession(), XIMP Framework
+ * disposes the MXIMPProtocolConnection instance with
+ * MXIMPProtocolPlugin::ReleaseConnection().
+ *
+ *
+ * MProtocolImFeatures implementation must provide
+ * access following feature specific sub-interfaces:
+ * - MProtocolImGroup
+ * - MProtocolImConversation
+ * - MProtocolImInvitation
+ * - MProtocolImSearch
+ *
+ * Each provided sub-interface defines a set of its own
+ * im managements requests, relating to im groups,search,im and
+ * im invitation.
+ * IM calls these sub-interfaces to request on
+ * spesific im requests from protocol connection.
+ *
+ * @see MXIMPProtocolConnectionHost
+ * @ingroup protocolimpluginapi
+ * @since S60 
+ */
+class MProtocolImFeatures : public MXIMPBase
+    {
+    
+public:
+
+    /** Interface ID for the MProtocolImFeatures. */
+    enum { KInterfaceId = IM_IF_ID_PROTOCOL_IM_FEATURES };
+
+	/**
+     * Factory method to instantiate MProtocolImFeatures.
+     *
+     * Factory method to instantiate platform default
+     * MXIMPClient implementation through the ECom.
+     * If the default IM Feature isn't supported
+     * in the platform, leaves with errorcode signalled
+     * from ECom.
+     *
+     * @return The new Im client object. Object
+     *         ownership is returned to caller.
+     */
+    static inline MProtocolImFeatures* NewL();
+    
+    /**
+     * Factory method to instantiate MProtocolImFeatures with
+     * initial parameters and specified implementation UID.
+     *
+     * If the specified IM Feature isn't supported
+     * in the platform, leaves with errorcode signalled
+     * from ECom.
+     * 
+     * @since S60 v5.0
+     * @param aImplementationUid    Implementation UID of the plugin to be loaded
+     * @param aInitParams           Initialization parameters
+     * @return The new Im client object.
+     */
+    static inline MProtocolImFeatures* NewL( TUid aImplementationUid,
+        TAny* aInitParams );
+
+    /**
+     * Protected destructor. MXIMPProtocolConnection
+     * objects can't be deleted through this interface.
+     *
+     * XIMP Framework disposes MXIMPProtocolConnection
+     * instances through MXIMPProtocolPlugin::ReleaseConnection().
+     */
+    virtual inline ~MProtocolImFeatures();
+ 
+    
+protected:
+
+    /**
+     * Default constructor to zero initialize
+     * the iEcomDtorID member.
+     */
+    inline MProtocolImFeatures();
+
+
+public: // Access to sub-interfaces
+
+
+    /**
+     * Gets reference to im group interface.
+     *
+     * IM calls this method to retrieve a reference
+     * to protocols MProtocolImGroup interface
+     * implementation.
+     *
+     * Call and interface lifetime convention:
+     * - This method isn't called before protocol has signalled
+     *   MXIMPProtocolConnection::OpenSessionL() succesfully completed.
+     *
+     * - XIMP Framework may call this method multiple times for
+     *   for one MXIMPProtocolConnection instance.
+     *
+     * - Each call per one MXIMPProtocolConnection instance,
+     *   must return reference to same interface instance.
+     *
+     * - Returned interface instance must remain valid (usable)
+     *   untill last client session, using originating im protocol
+     *   connection is successfully closed with
+     *   MXIMPProtocolConnection::CloseSession().
+     *
+     * @return Requested interface.
+     *         interface ownership is not returned caller.
+     */
+   virtual MProtocolImGroup& ImGroup();
+
+
+
+    /**
+     * Gets reference to Im Conversation interface.
+     *
+     * IM calls this method to retrieve a reference
+     * to protocols MProtocolImConversation interface
+     * implementation.
+     *
+     * Call and interface lifetime convention:
+     * - This method isn't called before protocol has signalled
+     *   MXIMPProtocolConnection::OpenSessionL() succesfully completed.
+     *
+     * - XIMP Framework may call this method multiple times for
+     *   for one MXIMPProtocolConnection instance.
+     *
+     * - Each call per one MXIMPProtocolConnection instance,
+     *   must return reference to same interface instance.
+     *
+     * - Returned interface instance must remain valid (usable)
+     *   untill last client session, using originating im protocol
+     *   connection is successfully closed with
+     *   MXIMPProtocolConnection::CloseSession().
+     *
+     * @return Requested interface.
+     *         interface ownership is not returned caller.
+     */
+    virtual MProtocolImConversation& ImConversation() = 0;
+
+
+
+    /**
+     * Gets reference to im groups interface.
+     *
+     * IM calls this method to retrieve a reference
+     * to protocols MProtocolImInvitation interface
+     * implementation.
+     *
+     * Call and interface lifetime convention:
+     * - This method isn't called before protocol has signalled
+     *   MXIMPProtocolConnection::OpenSessionL() succesfully completed.
+     *
+     * - XIMP Framework may call this method multiple times for
+     *   for one MXIMPProtocolConnection instance.
+     *
+     * - Each call per one MXIMPProtocolConnection instance,
+     *   must return reference to same interface instance.
+     *
+     * - Returned interface instance must remain valid (usable)
+     *   untill last client session, using originating im protocol
+     *   connection is successfully closed with
+     *   MXIMPProtocolConnection::CloseSession().
+     *
+     * @return Requested interface.
+     *         interface ownership is not returned caller.
+     */
+    virtual MProtocolImInvitation& ImInvitation();
+
+
+
+    /**
+     * Gets reference to im search interface.
+     *
+     * IM calls this method to retrieve a reference
+     * to protocols MProtocolImSearch interface
+     * implementation.
+     *
+     * Call and interface lifetime convention:
+     * - This method isn't called before protocol has signalled
+     *   MXIMPProtocolConnection::OpenSessionL() succesfully completed.
+     *
+     * - XIMP Framework may call this method multiple times for
+     *   for one MXIMPProtocolConnection instance.
+     *
+     * - Each call per one MXIMPProtocolConnection instance,
+     *   must return reference to same interface instance.
+     *
+     * - Returned interface instance must remain valid (usable)
+     *   untill last client session, using originating im protocol
+     *   connection is successfully closed with
+     *   MXIMPProtocolConnection::CloseSession().
+     *
+     * @return Requested interface.
+     *         interface ownership is not returned caller.
+     */
+    virtual MProtocolImSearch& ImSearch();
+
+    
+    /**
+     * Sets data host.
+     * 
+     * IM calls this method to specify datahost.
+     * 
+     * @since   S60 v5.0
+     * @param   aHost   data host
+     * @return  void
+     */    
+      virtual void SetHost(MProtocolImDataHost& aHost) = 0;
+  
+private: // Data
+
+    /**
+     * Unique instance identifier key
+     */
+    TUid iEcomDtorID;
+    };
+
+#include <protocolimfeatures.inl>
+
+
+
+
+#endif // MPROTOCOLIMFEATURES_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_im_protocol_plugin_api/inc/protocolimfeatures.inl	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,115 @@
+/*
+* 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:  IM Features interface used by XIMP IM clients.
+*
+*/
+
+#include <ecom/ecom.h>
+
+
+// -----------------------------------------------------------------------------
+// MProtocolImFeatures::NewL() implementation
+// Factory method to instantiate the platform default
+// MProtocolImFeatures implementation through the ECom framework.
+// -----------------------------------------------------------------------------
+//
+inline MProtocolImFeatures* MProtocolImFeatures::NewL()
+    {
+    _LIT8( KXIMPIMDefaultData, "2219" );
+
+    TEComResolverParams resolvingParams;
+    resolvingParams.SetDataType( KXIMPIMDefaultData );
+    resolvingParams.SetWildcardMatch( ETrue );
+    TAny* imp = REComSession::CreateImplementationL( 
+        TUid::Uid( MProtocolImFeatures::KInterfaceId), 
+        _FOFF( MProtocolImFeatures, iEcomDtorID ), resolvingParams );
+
+    return reinterpret_cast< MProtocolImFeatures* >( imp );
+    }
+
+
+// -----------------------------------------------------------------------------
+// MProtocolImFeatures::NewL() implementation
+// Factory method to instantiate the user specific implementation for 
+// MProtocolImFeatures API through the ECom framework.
+// -----------------------------------------------------------------------------
+//
+inline MProtocolImFeatures* MProtocolImFeatures::NewL( TUid aImplementationUid,
+    TAny* aInitParams )
+    {
+    MProtocolImFeatures* ptr = reinterpret_cast<MProtocolImFeatures*>(
+        REComSession::CreateImplementationL( 
+        aImplementationUid, 
+        _FOFF( MProtocolImFeatures, iEcomDtorID ), 
+        aInitParams ) );
+
+    return ptr;
+    }
+
+
+// -----------------------------------------------------------------------------
+// MProtocolImFeatures::MProtocolImFeatures() implementation
+// Zero initializes the iEcomDtorID member.
+// -----------------------------------------------------------------------------
+//
+inline MProtocolImFeatures::MProtocolImFeatures()
+    {
+    iEcomDtorID = TUid::Null();
+    }
+
+
+// -----------------------------------------------------------------------------
+// MProtocolImFeatures::~MProtocolImFeatures()
+// Destructor notifies the ECom from implementation destruction.
+// -----------------------------------------------------------------------------
+//
+inline MProtocolImFeatures::~MProtocolImFeatures()
+    {
+    REComSession::DestroyedImplementation( iEcomDtorID );
+    }
+
+
+// -----------------------------------------------------------------------------
+// MProtocolImGroup& MProtocolImFeatures::ImGroup()
+// Dummy Implementation
+// -----------------------------------------------------------------------------
+//
+inline MProtocolImGroup& MProtocolImFeatures::ImGroup()
+    {
+    MProtocolImGroup* dummyGroup = NULL;
+    return *dummyGroup;
+    }
+
+// -----------------------------------------------------------------------------
+// MProtocolImInvitation& MProtocolImFeatures::ImInvitation()
+// Dummy Implementation
+// -----------------------------------------------------------------------------
+//
+inline MProtocolImInvitation& MProtocolImFeatures::ImInvitation()
+    {
+    MProtocolImInvitation* dummyInvitation = NULL;
+    return *dummyInvitation;
+    }
+
+// -----------------------------------------------------------------------------
+// MProtocolImSearch& MProtocolImFeatures::ImSearch()
+// Dummy Implementation
+// -----------------------------------------------------------------------------
+//
+inline MProtocolImSearch& MProtocolImFeatures::ImSearch()
+    {
+    MProtocolImSearch* dummySearch = NULL;
+    return *dummySearch;
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_im_protocol_plugin_api/inc/protocolimgroup.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,300 @@
+/*
+* 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:  Interface for  protocol IM groups object.
+*
+*/
+
+
+
+#ifndef MPROTOCOLIMGROUP_H
+#define MPROTOCOLIMGROUP_H
+#include <e32std.h>
+#include <badesca.h>
+#include <ximpbase.h>
+#include "improtocolifids.hrh"
+class MXIMPIdentity;
+/**
+ * Interface for IM protocol groups object.
+ * Interface must be implemented by a XIMP Framework protocol
+ * plug-ins.
+ *
+ * This interface defines actions that XIMP Framework
+ * requests from a IM protocol connection to
+ * execute groups related tasks.
+ *
+ * Protocol implementation must route requests received through
+ * this interface, to same remote IM service destination,
+ * as where the parent MXIMPProtocolConnection is connected.
+ * (Here the parent MXIMPProtocolConnection means the protocol
+ * connection instance from where this interface instance
+ * was retrieved.)
+ *
+ * @see MXIMPProtocolConnection
+ * @ingroup protocolimpluginapi
+ *
+ */
+class MProtocolImGroup : public MXIMPBase
+    {
+public:
+
+    /** Interface ID for the MProtocolImGroups. */
+    enum { KInterfaceId = IM_IF_ID_PROTOCOL_GROUPS };
+
+
+protected:
+
+    /**
+     * Protected destructor. MProtocolImuginroups
+     * instancies can't be destroyed via this interface.
+     */
+    virtual inline ~MProtocolImGroup() {};
+
+public: // 
+    /**
+     * Subscribe to the specified group change notification
+     * 
+     * @param [in] aGroupId
+     *		Identification for IM group.
+     * @param [in] aReqId 
+     *		Request id identifying the issued request.
+     */
+     virtual void DoSubscribeImGroupChangeL( MXIMPIdentity* aGroupId,
+     								  TXIMPRequestId aReqId )= 0;
+
+
+	/**
+     * Unsubscribe to the specified group change notification
+     * 
+     * @param [in] aGroupId
+     *		Identification for IM group.
+     * @param [in] aReqId 
+     *		Request id identifying the issued request.
+     */
+     virtual void DoUnsubscribeImGroupChangeL( MXIMPIdentity* aGroupId,
+     									TXIMPRequestId aReqId )= 0;
+
+    /**
+     * Requests the protocol to create group
+     *
+	 * @param [in] aGroupId
+     *		Identification for IM group.
+     * @param [in] aProperties
+     *      To be created IM group properties.
+     * @param [in] aScreenName
+     *		Screen Name for the group
+     * @param [in] aJoinGroup
+     *		Whether joining this group is allowed
+     * @param [in] aSubscribeNotification
+     *		When the group is changed whether the notification is required
+     * @param [in] aReqId 
+     *		Request id identifying the issued request.
+     */
+    virtual void DoCreateGroupL(const MXIMPIdentity& aGroupId,
+    					const MImGroupInfo& aProperties,
+    					const TDesC& aScreenName,
+                        TBool aJoinGroup,
+                        TBool aSubscribeNotification,
+                        TXIMPRequestId aReqId) = 0;
+     /**
+     * Requests the protocol to join IM Group
+     *
+	 * @param [in] aGroupId
+     *		Identification for IM group.
+     * @param [in] aScreenName
+     *		Screen Name for the group
+     * @param [in] aUsers
+     *		Boolean value - mentioning whether the already 
+     *		joined users list is required as a response to this request
+     * @param [in] aSubscribeNotification
+     *		When the group is changed whether the notification is required
+     * @param [in] aReqId 
+     *		Request id identifying the issued request.
+     */
+    virtual void DoJoinGroupL(const MXIMPIdentity& aGroupId,
+                                  const TDesC& aScreenName,
+                                  TBool aUsers,
+                                  TBool aSubscribeNotification,
+                                  TXIMPRequestId aReqId) = 0;
+   /**
+     * Requests the protocol to delete IM group
+     *
+	 * @param [in] aGroupId
+     *		Identification for IM group.
+     * @param [in] aReqId 
+     *		Request ID identifying the issued request.
+     */
+    virtual void DoDeleteGroupL(const MXIMPIdentity& aGroupId,
+    							 TXIMPRequestId aReqId ) = 0;
+    
+    
+    /**
+     * Requests the protocol to leave IM group
+     *
+	 * @param [in] aGroupId
+     *		Identification for IM group.
+	 * @param [in] aReqId 
+     *		Request ID identifying the issued request.
+     */
+    virtual void DoLeaveGroupL(const MXIMPIdentity& aGroupId,
+    							TXIMPRequestId aReqId ) = 0;                               
+
+	/**
+     * Requests the protocol to get the specified group properties
+     *
+	 * @param [in] aGroupId
+     *		Identification for IM group.
+     * @param [in] aReqId 
+     *		Request id identifying the issued request.
+     */
+     virtual void DoGetGroupPropertiesL( MXIMPIdentity* aGroupId,
+     									  TXIMPRequestId aReqId )= 0;
+
+
+	/**
+     * Requests the protocol to set/modify the specified group properties
+     *
+	 * @param [in] aGroupId
+     *		Identification for IM group.
+     * @param [in] aGroupProps
+     *		Group properties need to be set for the specified group
+     * @param [in] aReqId 
+     *		Request id identifying the issued request.
+     */
+     virtual void DoSetGroupPropertiesL( MXIMPIdentity* aGroupId,
+                                           const MImGroupInfo* aGroupProps,
+                                           TXIMPRequestId aReqId )= 0;
+     /**
+     * Requests the protocol to Get access control list of users of the specified group
+     *
+	 * @param [in] aGroupId
+     *		Identification for IM group.
+     * @param [in] aReqId 
+     *		Request ID identifying the issued request.
+     * @return The request ID identifying the issued request.
+     *
+	 * /b Note: Possible error conditions
+     *	/n		1. Group does't exists
+     *	/n		2. User does't exists
+     * If the request is success responce will have access control list for the specified group
+     *
+     */
+	virtual TXIMPRequestId DoGetImGroupAccessControlListL( const MXIMPIdentity& aGroupId,
+	                                                                           TXIMPRequestId aReqId )=0;
+     /**
+     * Requests the protocol to Set access control list of users for the specified group
+     
+	 * @param [in] aGroupId
+     *		Identification for IM group.
+	 * @param [in] acl
+     *		access control list.
+     * @param [in] aReqId 
+     *		Request id identifying the issued request.
+     * @return The request id identifying the issued request.
+     *
+	 * /b Note: Possible error conditions
+     *	/n		1. Group does't exists
+     *	/n		2. User does't exists
+	 *  /n      3. User don't have access control   
+     * If the request is success responce will have access control for the specified group
+     *
+     */
+   
+   virtual TXIMPRequestId DoSetImGroupAccessControLlistL( const MXIMPIdentity& aGroupId,
+                                           MImAccessControlList* aCl,TXIMPRequestId aReqId ) = 0;
+        
+	  /**
+     * Requests the protocol to set rejected list of users of the specified group
+     *
+	 * @param [in] aGroupId
+     *		Identification for IM group.
+     * @param [in] aRejectedList
+     *      List of users need to be rejected from the group  
+     * @param [in] aEnabledList
+     *      List of users need to be added to the group      
+     * @param [in] aReqId 
+     *		Request id identifying the issued request.
+     */
+   virtual void DoSetImGroupRejectListL( const TDesC& aGroupId,
+                                      const MDesCArray* aRejectedList,
+                                      const MDesCArray* aEnabledList,
+                                      TXIMPRequestId aReqId )=0;		
+     /**
+     * Requests the protocol to get list of members of the indicated group
+	 * 
+     * @param [in] aGroupId
+     *		Identification for IM group.
+     * @param [in] aReqId 
+     *		Request ID identifying the issued request.
+     *
+	 * @return The request id identifying the issued request.
+     *
+     * /b Note: Possible error conditions
+     *	/n		1. Group does't exists  - KImErrGroupDoesNotExists
+     *	/n		2. Not joined in this group  - KImErrGroupNotJoined
+     *
+     * If the request is success,response will have list of members of the specified group
+     *
+     */
+     virtual TXIMPRequestId DoGetImGroupMembersL( MXIMPIdentity* aGroupId,TXIMPRequestId aReqId )= 0;
+      /**
+     * Requests the protocol to Get lest of joined users for the specified group
+     *
+	 * @param [in] aGroupId
+     *		Identification for IM group.
+     * @param [in] aReqId 
+     *		Request ID identifying the issued request.
+     * @return The request ID identifying the issued request.
+     * 
+	 * /b Note: Possible error conditions
+     *	/n		1. Group does't exists
+     *	/n		2. User does't exists
+     * If the Request is success client will get list of joined users for the specified group
+     *
+     */
+   virtual TXIMPRequestId DoGetImGroupJoinedUsersListL( const MXIMPIdentity& aGroupId,TXIMPRequestId aReqId )=0;
+    
+    /**
+     * Add members to IM Group
+     *    
+	 * @param [in] aGroupId
+     *		Identification for IM group.
+     * @param [in] aUserList
+     *      List of users need to be added to the group     
+     * @param [in] aReqId 
+     *		Request id identifying the issued request.
+     */
+     
+	virtual void DoAddImGroupMembersL( const MXIMPIdentity& aGroupId,
+								 const MDesCArray& aUserList,
+								 TXIMPRequestId aReqId )= 0;
+
+   /**
+     * Remove members from IM group
+     *
+	 * @param [in] aGroupId
+     *		Identification for IM group.
+     * @param [in] aUserList
+     *      List of users need to be removed from the group     
+     * @param [in] aReqId 
+     *		Request id identifying the issued request.
+     */
+   virtual void DoRemoveImGroupMembersL( const MXIMPIdentity& aGroupId,
+   									const MDesCArray& aUserList,
+   									TXIMPRequestId aReqId  )= 0;
+ 
+    };
+
+
+
+#endif // MPROTOCOLIMGROUP_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_im_protocol_plugin_api/inc/protocoliminvitation.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,131 @@
+/*
+* 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:  Interface for IM protocol Invitation object.
+*
+*/
+
+#ifndef MPROTOCOLIMINVITATION_H
+#define MPROTOCOLIMINVITATION_H
+
+#include <e32std.h>
+#include <badesca.h>
+#include <ximpbase.h>
+#include "improtocolifids.hrh"
+
+
+class MXIMPIdentity;
+class MImInvitationInfo;
+/**
+ * Interface for IM protocol invitation object.
+ * Interface must be implemented by a XIMP Framework protocol
+ * plug-ins.
+ *
+ * This interface defines actions that XIMP Framework
+ * requests from a IM protocol connection to
+ * execute invitation related tasks.
+ *
+ * Protocol implementation must route requests received through
+ * this interface, to same remote IM service destination,
+ * as where the parent MXIMPProtocolConnection is connected.
+ * (Here the parent MXIMPProtocolConnection means the protocol
+ * connection instance from where this interface instance
+ * was retrieved.)
+ *
+ * @see MProtocolImConnection
+ * @ingroup ProtocolImpluginapi
+ * 
+ */
+class MProtocolImInvitation : public MXIMPBase
+    {
+public:
+
+    /** Interface ID for the MProtocolImInvitation. */
+    enum { KInterfaceId = IM_IF_ID_PROTOCOL_INVITATION };
+
+
+protected:
+
+    /**
+     * Protected destructor. MProtocolImInvitation
+     * instancies can't be destroyed via this interface.
+     */
+    virtual inline ~MProtocolImInvitation() {}
+
+public: 
+
+     /** Requests the protocol to invite group of users to join in the mentioned group
+     *
+	 *  @param [in] aUserID           = IDs of the users to invite
+     *  @param [in] InviteGroup      = ID of the group to which the users
+     *                             			are invited to join
+	 *  @param [in] aInviteInfo        = Identification and content of the invitation.
+     *		MImInvitationInfo contains inviteId, contenttype - text/content, invitereason,validityperiod....... 
+     *
+	 */
+                        
+    virtual void DoImGroupInviteL( const MDesCArray* aUserID,
+                                    const MXIMPIdentity& InviteGroup,
+                                   const MImInvitationInfo& aInviteInfo ) = 0;
+    /**  Request the protocol to invite user to IM conversation
+     *
+	 *  @param [in] aUserID           = IDs of the users to invite
+     *  @param [in] aInviteInfo       = Identification and content of the invitation.
+     *		MImInvitationInfo contains inviteid, contenttype - text/content, invitereason,validityperiod....... 
+	 *
+	 */
+    virtual void DoImInviteL( const TDesC& aUserID,                              
+                                 const MImInvitationInfo& aInviteInfo ) = 0;
+
+     /** Request the protocol to Cancel an im group invite 
+     *
+	 *  @param [in] aUserID           = IDs of the users to invite
+     *  @param [in] InviteGroup      = ID of the group to which the users
+     *                             			are invited to join
+	 *  @param [in] aInviteInfo        = Identification and content of the invitation.
+     *		MImInvitationInfo contains inviteid, contenttype - text/content, invitereason,validityperiod....... 
+     *
+	 */
+
+    virtual void DoCancelImgroupInviteL( const MDesCArray* aUserID,
+                                    const MXIMPIdentity& InviteGroup,
+                                   const MImInvitationInfo& aInviteInfo )= 0;
+	/**  Request the protocol to cancel invitation for user to IM conversation
+     
+	 *   @param [in] aUserID           = IDs of the users to invite
+     *   @param [in] aInviteInfo       = Identification and content of the invitation.
+     *		MImInvitationInfo contains inviteid, contenttype - text/content, invitereason,validityperiod....... 
+	 
+	 *   @return The request id identifying the issued request.
+     *
+	 * /b Note: Possible error conditions
+     *	/n		1. Invalid invite id
+     *	/n		2. Invalid userid
+     *  If the request is success it will send a group invitation to the mentioned users
+     *
+	 */
+    virtual TXIMPRequestId DoCancelImInviteL( const TDesC& aUserID,                              
+                                 const MImInvitationInfo& aInviteInfo ) = 0;
+     /** Request the protocol to Send response to invite
+     *  @param [in] aRecipientUserId  = Userid of the invitee
+     *  @param [in] aInviteInfo       = Identification and content of the invitation.
+     *		MImInvitationInfo contains inviteId, contenttype - text/content, inviteresponse,acceptance....... 
+	 *
+	 */
+    virtual void DoInviteResponseL( const TDesC& aRecipientUserId,
+										   const MImInvitationInfo& aInviteInfo ) = 0;
+    };
+
+
+
+#endif // MPROTOCOLIMINVITATION_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_im_protocol_plugin_api/inc/protocolimsearch.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,140 @@
+/*
+* 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:  Interface for IM Feature Plugin protocol IM object.
+*
+*/
+
+
+
+#ifndef MPROTOCOLIMSEARCH_H
+#define MPROTOCOLIMSEARCH_H
+#include <e32std.h>
+#include <badesca.h>
+#include <ximpbase.h>
+#include "improtocolifids.hrh"
+
+#include "imsearchelementimp.h"
+
+
+class MXIMPIdentity;
+//class CSearchRequest;
+/**
+ * Interface for Search object.
+ * Interface must be implemented by a XIMP Framework protocol
+ * plug-ins.
+ *
+ * This interface defines actions that XIMP Framework
+ * requests from a IM protocol connection to
+ * execute search related tasks.
+ *
+ * Protocol implementation must route requests received through
+ * this interface, to same remote IM service destination,
+ * as where the parent MXIMPProtocolConnection is connected.
+ * (Here the parent MXIMPProtocolConnection means the protocol
+ * connection instance from where this interface instance
+ * was retrieved.)
+ *
+ * @see MXIMPProtocolConnection
+ * @ingroup ProtocolImpluginapi
+ * 
+ */
+class MProtocolImSearch : public MXIMPBase
+    {
+public:
+
+    /** Interface ID for the MProtocolImSearch */
+    enum { KInterfaceId = IM_IF_ID_PROTOCOL_SEARCH };
+
+
+protected:
+
+    /**
+     * Protected destructor. MProtocolImSearch
+     * instancies can't be destroyed via this interface.
+     */
+    virtual inline ~MProtocolImSearch() {};
+
+
+public: 
+
+    /**
+     * Requests the protocol to start search.
+     *
+     * @param [in] aImSearchId
+     *		Identification for IM search.
+     * @param [in] aPairs 
+     *        Defines what is to be searched.
+     * @param [in] aSearchLimit 
+     *        How many results you want.
+     * @param [in] aReqId 
+     *		Request id identifying the issued request.
+ 	 * @return The request id identifying the issued request.
+	 *
+     * /b Note: Possible error conditions
+     *	/n	 1. Invalid/unsupported search-element [KImErrFieldTypeNotSupported].
+     */
+    virtual void DoImSearchL( const MXIMPIdentity& aImSearchId,
+    										   const CSearchRequest& aPairs,
+                                    		   TInt aSearchLimit,
+                                    		   TXIMPRequestId aReqId ) = 0;
+
+    /**
+     * Continue search.
+     *
+     * @param [in] aImSearchId
+     *		  Identification for IM search.
+     * @param [in] aSearchID 
+     *		  Which search is to be continued.
+     * @param [in] aIndex 
+     *		  From which index the search is continued.
+	 * @param [in] aReqId 
+     *		Request id identifying the issued request.
+     *
+	 * @return The request id identifying the issued request.
+     *
+     * /b Note: Possible error conditions
+     *	/n	 1. Initial search request was not sent / invalid searchid [KImErrFieldValueNotSupported].
+     *	/n	 2. Invalid Search-Index / out of range [KImErrOutOfRangeValue].
+     *	/n	 3. Search timeout (in case of continued search the subsequent request primitive is late) [KImErrServicRequestTimeouted].
+     */
+    virtual void DoContinueImSearchL( const MXIMPIdentity& aImSearchId,
+    										  TInt aSearchID,
+                                    		   TXIMPRequestId aReqId ) = 0;
+
+    /**
+     * Stop search.
+     *
+     * @param [in] aImSearchId
+     *		Identification for IM search.
+     * @param [in] aSearchID 
+     *		  Which search is to be stopped.
+     * @param [in] aReqId 
+     *		Request id identifying the issued request.
+	 *
+	 * @return The request id identifying the issued request.
+	 *
+     * /b Note: Possible error conditions
+     *	/n	 1. Initial search request was not sent (invalid searchid) [KImErrFieldValueNotSupported].
+     */
+	virtual void DoStopImSearchL( const MXIMPIdentity& aImSearchId,
+											                     TInt aSearchID,
+                                    		   TXIMPRequestId aReqId ) = 0;
+	
+
+
+    };
+
+
+
+#endif // MPROTOCOLIMSEARCH_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_im_protocol_plugin_api/ximp_im_protocol_plugin_api.metaxml	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,13 @@
+<?xml version="1.0" ?>
+<api id="d09900a8d963ac479922b3164c34054f" dataversion="1.0">
+<name>ximp_im_protocol_plugin_api</name>
+<description>This is a API that provides instant messaging interfaces to the adaptation plugin which needs to be implemented by the adaptation.</description>
+<type>c++</type>
+<subsystem>ximp_im_protocol_plugin_api</subsystem>
+<libs></libs>
+<release category="domain" sinceversion=""/>
+<attributes>
+<htmldocprovided>yes</htmldocprovided>
+<adaptation>no</adaptation>
+</attributes>
+</api>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_im_protocol_plugin_host_api/group/bld.inf	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,35 @@
+/*
+* 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:  File that exports the files belonging to 
+:                XIMP IM Protocol Plug-in Host API
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+../inc/protocolimconversationdatahost.h     MW_LAYER_PLATFORM_EXPORT_PATH(protocolimconversationdatahost.h)
+../inc/protocolimgroupdatahost.h     MW_LAYER_PLATFORM_EXPORT_PATH(protocolimgroupdatahost.h)
+../inc/protocoliminvitationdatahost.h     MW_LAYER_PLATFORM_EXPORT_PATH(protocoliminvitationdatahost.h)
+../inc/protocolimdatahost.h     MW_LAYER_PLATFORM_EXPORT_PATH(protocolimdatahost.h)
+../inc/improtocolpluginhostifids.hrh     MW_LAYER_PLATFORM_EXPORT_PATH(improtocolpluginhostifids.hrh)
+../inc/protocolimdatahost.inl     MW_LAYER_PLATFORM_EXPORT_PATH(protocolimdatahost.inl)
+../inc/protocolimsearchdatahost.h     MW_LAYER_PLATFORM_EXPORT_PATH(protocolimsearchdatahost.h)
+../inc/protocolimpluginhost.h     MW_LAYER_PLATFORM_EXPORT_PATH(protocolimpluginhost.h)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_im_protocol_plugin_host_api/inc/improtocolpluginhostifids.hrh	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,41 @@
+/*
+* 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:  Protocol Plugin Host API interface IDs.
+*
+*/
+
+#ifndef PROTOCOLIMPLUGINHOSTIFIDS_HRH
+#define PROTOCOLIMPLUGINHOSTIFIDS_HRH
+
+
+// Protocol plugin host IF id's
+// 40xx - ximp related
+// 41xx - presence related
+// 42xx - instant messaging related
+
+// Interface IDs for XIMPFw Protocol Plugin Host interfaces
+#define IM_IF_ID_PROTOCOL_GROUP_DATAHOST             4201
+#define IM_IF_ID_PROTOCOL_CONVERSATION_DATAHOST      4202
+#define IM_IF_ID_PROTOCOL_INVITATION_DATAHOST        4203
+#define IM_IF_ID_PROTOCOL_PLUGIN_HOST    						 4204
+#define IM_IF_ID_PROTOCOL_SEARCH_DATAHOST            4205
+#define IM_IF_ID_PROTOCOL_DATA_HOST                  4206
+
+// Interface UID for IMfeatures interface
+#define XIMP_ECOM_IF_UID_IM_PROCESSOR_INTERFACE             0xE0000003
+
+
+#endif // PROTOCOLIMPLUGINHOSTIFIDS_HRH
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_im_protocol_plugin_host_api/inc/protocolimconversationdatahost.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,308 @@
+/*
+* 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:  Interface for managing cached IM(Instant Message's) information.
+*
+*/
+
+#ifndef MPROTOCOLCONVERSATIONDATAHOST_H
+#define MPROTOCOLCONVERSATIONDATAHOST_H
+
+#include <e32std.h>
+#include <bamdesca.h>
+#include <improtocolpluginhostifids.hrh>
+#include <ximpbase.h>
+
+
+class MXIMPIdentity;
+class MXIMPObjectCollection;
+class MXIMPDataSubscriptionState;
+class MXIMPStatus;
+class MImConversationInfo;
+
+
+/**
+ * Interface for managing cached conversation information.
+ *
+ * Interface is used by protocol adaptations to manage
+ * conversation information stored
+ * in IM internal data cache.
+ *
+ * This interface is implemented by IM.
+ * Protocol adaptation can obtain reference to this
+ * interface from MXIMPProtocolConnectionHost interface.
+ *
+ * For each separated protocol connection, protocol
+ * adaptation must use the specific
+ * MImProtocolConversationDataHost instance,
+ * what is received from the connection specific
+ * MXIMPProtocolConnectionHost instance.
+ *
+ * @ingroup Improtocolpluginhostapi
+ * @since S60 
+ */
+class MProtocolImConversationDataHost : public MXIMPBase
+    {
+public:
+
+    /** Interface ID for the MImProtocolConversationDataHost. */
+    enum { KInterfaceId = IM_IF_ID_PROTOCOL_CONVERSATION_DATAHOST };
+
+protected:
+
+    /**
+     * Protected destructor. Object instancies
+     * can't be deleted via this interface.
+     */
+    virtual ~MProtocolImConversationDataHost() {}
+    
+public: // Handling IM information
+	
+	/**
+     * Notifies IM from 
+     * message sent completion information.
+     *
+     * Protocol adaptation implementation can call this
+     * method to notify IM from message 
+     * sent completion information. IM
+     * updates its cached information and
+     * notifies the subscribing clients from data changes.
+     *
+     * IM takes ownership of the argument(s),
+     * if method succeeds without a leave.
+     *
+     * @param [in] aMessageId
+     *        MXIMPIdentity object identifying the 
+     *        Message sent information
+     *
+	 * @return The request id identifying the issued request.
+     *         Data cache request is processed asynchronously and
+     *         its completion is signalled to adaptation direction
+     *         through MXIMPProtocolConnectionHostObserver interface,
+     *         with MXIMPProtocolRequestCompleteEvent event.
+     *
+     * @leave KErrNoMemory if failed to allocate memory.
+     * @leave KErrArgument if NULL argument(s) were provided.
+     */
+    //virtual TXIMPRequestId HandleSentMessageL(MXIMPIdentity* aMessageId) = 0;
+	/**
+     * Notifies IM from 
+     * new text message received information.
+     *
+     * Protocol adaptation implementation can call this
+     * method to notify IM from new
+     * text message received information. IM
+     * updates its cached new text message and
+     * notifies the subscribing clients from data changes.
+     *
+     * IM takes ownership of the argument(s),
+     * if method succeeds without a leave.
+     *
+     * @param [in] aMessageId
+     *        MXIMPIdentity object identifying the new
+     *        message information
+     * @param [in] aSender
+     *        message sender userid/groupId if the sender is group
+     * @param [in] aScreenName
+     *        ScreenName if the sender is groupid/NullDesc if the sender is userid
+     * @param [in] aRecipients
+     *        List of userid's / list of groupId's if receipients are groups.
+     * @param [in] aScreenNames
+     *        List of screennames if receipients are groups.
+     * @param [in] aText
+     *        Message text.
+     *
+	 * @return The request id identifying the issued request.
+     *         Data cache request is processed asynchronously and
+     *         its completion is signalled to adaptation direction
+     *         through MXIMPProtocolConnectionHostObserver interface,
+     *         with MXIMPProtocolRequestCompleteEvent event.
+     *
+     * @leave KErrNoMemory if failed to allocate memory.
+     * @leave KErrArgument if NULL argument(s) were provided.
+     */
+    virtual TXIMPRequestId HandleNewTextMessageL( MImConversationInfo* aImMessage)  = 0;
+	/**
+     * Notifies IM from 
+     * new content message received information.
+     *
+     * Protocol adaptation implementation can call this
+     * method to notify IM from new
+     * text message received information. IM
+     * updates its cached new content message and
+     * notifies the subscribing clients from data changes.
+     *
+     * IM takes ownership of the argument(s),
+     * if method succeeds without a leave.
+     *
+     * @param [in] aMessageId
+     *        MXIMPIdentity object identifying the new
+     *        message information
+     * @param [in] aSender
+     *        message sender userid/groupid if the sender is group
+     * @param [in] aScreenName
+     *        ScreenName if the sender is groupid/NullDesc if the sender is userid
+     * @param [in] aRecipients
+     *        List of userid's / List of groupid's if receipients are groups.
+     * @param [in] aScreenNames
+     *        List of screennames if receipients are groups.
+     * @param [in] aContentType
+     *        Type of the message content.
+     * @param [in] aContent
+     *        Message content.
+     *
+	 * @return The request id identifying the issued request.
+     *         Data cache request is processed asynchronously and
+     *         its completion is signalled to adaptation direction
+     *         through MXIMPProtocolConnectionHostObserver interface,
+     *         with MXIMPProtocolRequestCompleteEvent event.
+     *
+     * @leave KErrNoMemory if failed to allocate memory.
+     * @leave KErrArgument if NULL argument(s) were provided.
+     */
+    //virtual TXIMPRequestId HandleNewContentMessageL(  MXIMPIdentity* aMessageId,
+    //                                       const TDesC& aSender,   
+    //                                       const TDesC& aScreenName, 
+    //                                       const MDesCArray& aRecipients,
+    //                                       const MDesCArray& aScreenNames,                  
+    //                                       const TDesC& aContentType, 
+    //                                       const TDesC8& aContent)  = 0;
+	/**
+     * Notifies IM from 
+     * blocked/granted List information.
+     *
+     * Protocol adaptation implementation can call this
+     * method to notify IM from blocked/granted
+     * list of information. IM
+     * updates its cached blocked / granted list and
+     * notifies the subscribing clients from data changes.
+     *
+     * IM takes ownership of the argument(s),
+     * if method succeeds without a leave.
+     *
+     * @param [in] aBlockedList
+     *        list of blocked users identified by userid
+     * @param [in] aBlockedListInUse
+     *        whether the blocked list is in use 
+     * @param [in] aGrantedList
+     *        list of granted users identified by userid
+     * @param [in] aGrantedListInUse
+     *        whether the granted list is in use
+     *
+	 * @return The request id identifying the issued request.
+     *         Data cache request is processed asynchronously and
+     *         its completion is signalled to adaptation direction
+     *         through MXIMPProtocolConnectionHostObserver interface,
+     *         with MXIMPProtocolRequestCompleteEvent event.
+     *
+     * @leave KErrNoMemory if failed to allocate memory.
+     * @leave KErrArgument if NULL argument(s) were provided.
+     */
+     //virtual TXIMPRequestId HandleBlockedListResponseL( const MDesCArray* aBlockedList,
+     //                                         TBool aBlockedListInUse,
+     //                                         const MDesCArray* aGrantedList,
+     //                                         TBool aGrantedListInUse)  = 0;
+	/**
+     * Notifies IM from 
+     * message forward completion information.
+     *
+     * Protocol adaptation implementation can call this
+     * method to notify IM from Message 
+     * forward completion information. IM
+     * updates its cached information and
+     * notifies the subscribing clients from data changes.
+     *
+     * IM takes ownership of the argument(s),
+     * if method succeeds without a leave.
+     *
+     * @param [in] aMessageId
+     *        MXIMPIdentity object identifying the 
+     *        message forward information
+     *
+	 * @return The request ID identifying the issued request.
+     *         Data cache request is processed asynchronously and
+     *         its completion is signalled to adaptation direction
+     *         through MXIMPProtocolConnectionHostObserver interface,
+     *         with MXIMPProtocolRequestCompleteEvent event.
+     *
+     * @leave KErrNoMemory if failed to allocate memory.
+     * @leave KErrArgument if NULL argument(s) were provided.
+     */
+    //virtual TXIMPRequestId HandleForwardMessageCompletionL(MXIMPIdentity* aMessageId) = 0;
+
+
+
+	/**
+     * Notifies IM from 
+     * received message list information.
+     *
+     * Protocol adaptation implementation can call this
+     * method to notify IM from message 
+     * forward completion information. IM
+     * updates its cached information and
+     * notifies the subscribing clients from data changes.
+     *
+     * IM takes ownership of the argument(s),
+     * if method succeeds without a leave.
+     *
+     * @param [in] aMessageList
+     *			MImFtpPluginObjectCollection object containing zero or
+     *        	more /Message info class/ objects. Each
+     *        	contained information about the message.
+     *
+	 * @return The request ID identifying the issued request.
+     *         Data cache request is processed asynchronously and
+     *         its completion is signalled to adaptation direction
+     *         through MXIMPProtocolConnectionHostObserver interface,
+     *         with MXIMPProtocolRequestCompleteEvent event.
+     *
+     * @leave KErrNoMemory if failed to allocate memory.
+     * @leave KErrArgument if NULL argument(s) were provided.
+     */
+	//virtual TXIMPRequestId HandleGetMessageListL( /*MImFtpPluginObjectCollection* aMessageList */) = 0;
+	/**
+     * Notifies IM from 
+     * reject message information.
+     *
+     * Protocol adaptation implementation can call this
+     * reject message information.
+     * method to notify IM from 
+     * reject message  information. 
+	 * IM updates its cached new text message and
+     * notifies the subscribing clients from data changes.
+     *
+     * IM takes ownership of the argument(s),
+     * if method succeeds without a leave.
+     *
+     * @param [in] aMessageId
+     *        MXIMPIdentity object identifying the reject
+     *        message information
+     *
+	 * @return The request id identifying the issued request.
+     *         data cache request is processed asynchronously and
+     *         its completion is signalled to adaptation direction
+     *         through MXIMPProtocolConnectionHostObserver interface,
+     *         with MXIMPProtocolRequestCompleteEvent event.
+     *
+     * @leave KErrNoMemory if failed to allocate memory.
+     * @leave KErrArgument if NULL argument(s) were provided.
+     */
+    //virtual TXIMPRequestId HandleRejectMessageL( MXIMPIdentity* aMessageId) = 0;
+                                        
+   
+
+
+    };
+
+
+#endif // MPROTOCOLCONVERSATIONDATAHOST_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_im_protocol_plugin_host_api/inc/protocolimdatahost.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,166 @@
+/*
+* 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:  Interface for Im protocol connection host
+ *
+*/
+
+#ifndef MPROTOCOLIMDATAHOST_H
+#define MPROTOCOLIMDATAHOST_H
+
+#include <ximpbase.h>
+#include <improtocolpluginhostifids.hrh>
+#include <e32std.h>
+
+class MXIMPStatus;
+class MImObjectFactory;
+class MXIMPProtocolConnectionHostObserver;
+class MProtocolImConversationDataHost;
+class MProtocolImGroupDataHost;
+class MProtocolImInvitationDataHost;
+class MProtocolImSearchDataHost;
+class MXIMPHost;
+class CImDataCache ;
+
+/**
+ * Im connection host.
+ *
+ * @lib ximpprocessor.lib
+ * @since S60 v3.2
+ */
+class MProtocolImDataHost //: public MXIMPBase
+
+    {
+public:
+
+    
+    /** Interface ID for the MProtocolImDataHost. */
+    enum { KInterfaceId = XIMP_ECOM_IF_UID_IM_PROCESSOR_INTERFACE };
+
+    
+public:
+
+    /**
+     * Factory method to instantiate MImFeatures.
+     *
+     * Factory method to instantiate platform default
+     * MXIMPClient implementation through the ECom.
+     * If the default IM Feature isn't supported
+     * in the platform, leaves with errorcode signalled
+     * from ECom.
+     *
+     * @return The new Im client object. Object
+     *         ownership is returned to caller.
+     */
+    //static MProtocolImDataHost* NewL( MXIMPHost& aHost );
+
+    /**
+     * Public destructor.
+     * Objects can be deleted through this interface.
+     */
+    //virtual ~MProtocolImDataHost();
+    
+//protected:
+
+//    MProtocolImDataHost();
+
+public: // Access to sub-interfaces
+
+
+    /**
+     * Gets reference to object factory interface.
+     *
+     * Im protocol connection implementation
+     * uses factory interface to instantiate Im
+     * objects.
+     *
+     * @return Object factory interface.
+     *         No ownership is returned caller.
+     */
+    virtual MImObjectFactory& ImObjectFactory() = 0;
+
+
+
+    /**
+     * Gets reference to
+     * MProtocolImConversationDataHost interface.
+     *
+     * Im protocol connection implementation uses returned
+     * data host interface to manage the Im connections
+     * Im conversation data.
+     *
+     * @return MProtocolImConversationDataHost interface.
+     *         Interface ownership is not returned caller.
+     *         Returned interface is guaranteed to remain valid (usable)
+     *         as long as this source interface.
+     */
+    virtual MProtocolImConversationDataHost& ConversationDataHost() = 0;
+
+
+
+    /**
+     * Gets reference to
+     * MProtocolImGroupDataHost interface.
+     *
+     * Im protocol connection implementation uses returned
+     * data host interface to manage the Im connections
+     * Im group data.
+     *
+     * @return MProtocolImGroupDataHost interface.
+     *         Interface ownership is not returned caller.
+     *         Returned interface is guaranteed to remain valid (usable)
+     *         as long as this source interface.
+     */
+    //virtual MProtocolImGroupDataHost& GroupDataHost() = 0;
+
+
+
+    /**
+     * Gets reference to
+     * MImProtocolInvitationDataHost interface.
+     *
+     * Im protocol connection implementation uses returned
+     * data host interface to manage the im connections
+     * im invitation data.
+     *
+     * @return MImProtocolInvitationDataHost interface.
+     *         Interface ownership is not returned caller.
+     *         Returned interface is guaranteed to remain valid (usable)
+     *         as long as this source interface.
+     */
+    //virtual MProtocolImInvitationDataHost& InvitationDataHost() = 0;
+
+
+
+    /**
+     * Gets reference to
+     * MProtocolImSearchDataHost interface.
+     *
+     * Im protocol connection implementation uses returned
+     * data host interface to manage the Im connections
+     * search data.
+     *
+     * @return MProtocolImSearchDataHost interface.
+     *         Interface ownership is not returned caller.
+     *         Returned interface is guaranteed to remain valid (usable)
+     *         as long as this source interface.
+     */
+    //virtual MProtocolImSearchDataHost& SearchDataHost() = 0;
+    
+    virtual CImDataCache& ImDataCache() = 0;
+
+    };
+
+
+#endif // MPROTOCOLIMDATAHOST_H
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_im_protocol_plugin_host_api/inc/protocolimdatahost.inl	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,62 @@
+/*
+* 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:  IM Features interface used by XIMP IM clients.
+*
+*/
+
+#include <ecom/ecom.h>
+
+
+// -----------------------------------------------------------------------------
+// MProtocolImDataHost::NewL( MXIMPHost& aHost) implementation
+// Factory method to instantiate the platform default
+// MProtocolImDataHost implementation through the ECom framework.
+// -----------------------------------------------------------------------------
+//
+inline MProtocolImDataHost* MProtocolImDataHost::NewL(MXIMPHost& aHost )
+    {
+    _LIT8( KIMDefaultData, "" );
+
+    TEComResolverParams resolvingParams;
+    resolvingParams.SetDataType( KIMDefaultData );
+    resolvingParams.SetWildcardMatch( ETrue );
+    TAny* imp = REComSession::CreateImplementationL( TUid::Uid( MProtocolImDataHost::KInterfaceId),
+                                                     _FOFF( MProtocolImDataHost, iEcomDtorID ),
+                                                     &aHost, resolvingParams );
+    return reinterpret_cast< MProtocolImDataHost* >( imp );
+    }
+
+
+// -----------------------------------------------------------------------------
+// MProtocolImDataHost::MProtocolImDataHost() implementation
+// Zero initializes the iEcomDtorID member.
+// -----------------------------------------------------------------------------
+//
+inline MProtocolImDataHost::MProtocolImDataHost()
+    {
+    iEcomDtorID = TUid::Null();
+    }
+
+
+// -----------------------------------------------------------------------------
+// MProtocolImDataHost::~MProtocolImDataHost()
+// Destructor notifies the ECom from implementation destruction.
+// -----------------------------------------------------------------------------
+//
+inline MProtocolImDataHost::~MProtocolImDataHost()
+    {
+    REComSession::DestroyedImplementation( iEcomDtorID );
+    }
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_im_protocol_plugin_host_api/inc/protocolimdatahostimp.h	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  Im connection host
+ *
+*/
+
+#ifndef CPROTOCOLIMDATAHOSTIMP_H
+#define CPROTOCOLIMDATAHOSTIMP_H
+
+#include <e32base.h>
+#include <ximpprotocolconnectionhost.h>
+#include <ximpcontext.h>
+#include <ximpbase.h>
+#include <protocolimdatahost.h>
+#include "imapiobjbase.h"
+#include "ximpapiobjbase.h"
+//#include "ximpitemparent.h"
+#include "ximphost.h"
+//#include "ximpoperationdefs.h"
+//#include "ximprequestidbuilder.h"
+
+
+class MXIMPHost;
+class MImObjectFactory;
+class CImObjectFactoryImp;
+
+class CXIMPPscContext;
+class MImDataCache;
+class CImDataCache;
+class CXIMPContextStateEventImp;
+class CPeriodic;
+class MXIMPProtocolConnection;
+class CProtocolImConversationDataHostImp;
+class MProtocolImConversationDataHost;
+class CProtocolImGroupDataHostImp;
+class CProtocolImInvitationDataHostImp;
+class CProtocolImSearchDataHostImp;
+
+
+/**
+ * Im connection host.
+ *
+ * @lib ximpprocessor.lib
+ * @since S60 v3.2
+ */
+class CProtocolImDataHostImp : public CXIMPApiObjBase,
+                                     public MProtocolImDataHost
+
+    {
+public:
+    /** The class ID. */
+    enum { KClassId = IMIMP_CLSID_CPROTOCOLIMDATAHOSTIMP };
+
+public:
+
+    IMPORT_C static CProtocolImDataHostImp* NewL( MXIMPHost& aHost );
+
+    IMPORT_C static CProtocolImDataHostImp* NewLC( MXIMPHost& aHost );
+
+    virtual ~CProtocolImDataHostImp();
+
+private:
+
+    CProtocolImDataHostImp( MXIMPHost& aHost );
+    void ConstructL();
+
+public: // From MXIMPBase
+
+    /**
+     * Implementation of MXIMPBase interface methods
+     * @see MXIMPBase
+     */
+    XIMPIMP_DECLARE_IF_BASE_METHODS
+
+
+public: // MProtocolImDataHost
+   
+    MImObjectFactory& ImObjectFactory();
+
+    MProtocolImConversationDataHost& ConversationDataHost();
+
+    MProtocolImGroupDataHost& GroupDataHost();
+
+    MProtocolImInvitationDataHost& InvitationDataHost();
+
+    MProtocolImSearchDataHost& SearchDataHost();
+
+public: 
+    
+    IMPORT_C CImDataCache& ImDataCache();
+    IMPORT_C CProtocolImConversationDataHostImp& ConversationDataAccess();
+
+private: // data
+
+    MXIMPHost& iHost;
+    /**
+     * Data cache
+     */
+ 	CImDataCache* iImDataCache;
+    
+    CImObjectFactoryImp* iImObjFactory;
+
+    /**
+     * Data hosts
+     */
+    CProtocolImConversationDataHostImp* iConvDataHost;
+    CProtocolImGroupDataHostImp* iGroupDataHost;
+    CProtocolImInvitationDataHostImp* iInvitationDataHost;
+    CProtocolImSearchDataHostImp* iSearchDataHost;
+
+
+    };
+
+
+#endif // CPROTOCOLIMDATAHOSTIMP_H
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_im_protocol_plugin_host_api/inc/protocolimgroupdatahost.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,462 @@
+/*
+* 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:  Interface for managing cached group information.
+*
+*/
+
+#ifndef MPROTOCOLIMGROUPDATAHOST_H
+#define MPROTOCOLIMGROUPDATAHOST_H
+
+#include <e32base.h>
+#include <protocolimimpluginhostifids.hrh>
+#include <ximpbase.h>
+
+class MXIMPIdentity;
+class MImGroupInfo;
+class MImGroupMemberInfo;
+
+/**
+ * Interface for managing cached group information.
+ *
+ * Interface used by protocol adaptations to manage
+ * group information and group member information 
+ * in IM internal data cache.
+ *
+ * This interface is implemented by IM.
+ * Protocol adaptation can obtain reference to this
+ * interface from MXIMPProtocolConnectionHost interface.
+ *
+ * For each separated protocol connection, protocol
+ * adaptation must use the specific
+ * MProtocolImuginroupDataHost instance,
+ * what is received from the connection specific
+ * MXIMPProtocolConnectionHost instance.
+ *
+ * @ingroup ProtocolImpluginhostapi
+ * @since S60 
+ */
+class MProtocolImGroupDataHost : public MXIMPBase
+    {
+public:
+
+    /** Interface ID for the MProtocolImuginroupDataHost. */
+    enum { KInterfaceId = IM_IF_ID_PROTOCOL_GROUP_DATAHOST };
+
+protected:
+
+    /**
+     * Protected destructor. Object instancies
+     * can't be deleted via this interface.
+     */
+    virtual ~MProtocolImGroupDataHost() {}
+
+
+
+public: // Handling group information
+ /**
+     * Notifies IM from
+     * IM group list contents.
+     *
+     * Protocol adaptation implementation can call this
+     * method to notify IM from
+     * complete Im group list content.
+     * IM calculates the changes
+     * (new and removed Im groups) compared to previous
+     * IM group list content, and notifies
+     * the subscribing clients from data changes.
+     *
+     * IM takes ownership of the object
+     * collection and all objects contained within, if
+     * the method succeeds without a leave.
+     *
+     *
+     * @param [in] aGroupList
+     *        MImObjectCollection object containing zero or
+     *        more MImGroupInfo objects. Each
+     *        contained MImGroupInfo shall im
+     *        single im group within the im
+     *        group list.
+     *
+     * @return The request id identifying the issued request.
+     *         Data cache request is processed asynchronously and
+     *         its completion is signalled to adaptation direction
+     *         through MXIMPProtocolConnectionHostObserver interface,
+     *         with MXIMPProtocolRequestCompleteEvent event.
+     *
+     * @leave KErrNoMemory if failed to allocate memory.
+     * @leave KErrArgument if NULL argument(s) were provided.
+     */
+    virtual TXIMPRequestId HandleImGroupListL(
+                MImObjectCollection* aGroupList ) = 0;
+    /**
+     * Notifies IM from new
+     * group created.
+     *
+     * Protocol adaptation implementation can call this
+     * method to notify IM from
+     * new group created. IM
+     * calculates notifies the subscribing
+     * clients from data changes.
+     *
+     * IM takes ownership of the argument(s),
+     * if method succeeds without a leave.
+     *
+     * @param [in] aGroupInfo
+     *        MImGroupInfo object holding
+     *        information about new group entry.
+     *
+     * @return The request id identifying the issued request.
+     *         Data cache request is processed asynchronously and
+     *         its completion is signalled to adaptation direction
+     *         through MXIMPProtocolConnectionHostObserver interface,
+     *         with MXIMPProtocolRequestCompleteEvent event.
+     *
+     * @leave KErrNoMemory if failed to allocate memory.
+     * @leave KErrArgument if NULL argument(s) were provided.
+     */
+    virtual TXIMPRequestId HandleGroupCreatedL(
+                MImGroupInfo* aGroupInfo ) = 0;
+
+
+	/**
+     * Notifies IM from joined
+     * group members.
+     *
+     * Protocol adaptation implementation can call this
+     * method to notify IM from
+     * Joined group members. IM
+     * calculates notifies the subscribing
+     * clients from data changes.
+     *
+     * IM takes ownership of the argument(s),
+     * if method succeeds without a leave.
+     *
+     * @param [in] aGroupInfo
+     *        MImGroupInfo object holding
+     *        information about group members.
+     *
+     * @return The request id identifying the issued request.
+     *         data cache request is processed asynchronously and
+     *         its completion is signalled to adaptation direction
+     *         through MXIMPProtocolConnectionHostObserver interface,
+     *         with MXIMPProtocolRequestCompleteEvent event.
+     *
+     * @leave KErrNoMemory if failed to allocate memory.
+     * @leave KErrArgument if NULL argument(s) were provided.
+     */
+    virtual TXIMPRequestId HandleJoinedGroupL(
+                MImGroupInfo* aGroupInfo ) = 0;
+
+    /**
+     * Notifies IM from Left
+     * group members.
+     *
+     * Protocol adaptation implementation can call this
+     * method to notify IM from
+     * left group. IM
+     * calculates notifies the subscribing
+     * clients from data changes.
+     *
+     * IM takes ownership of the argument(s),
+     * if method succeeds without a leave.
+     *
+     * @param [in] aGroupId
+     *        MXIMPIdentity object holding group id
+     *
+     * @return The request id identifying the issued request.
+     *         data cache request is processed asynchronously and
+     *         its completion is signalled to adaptation direction
+     *         through MXIMPProtocolConnectionHostObserver interface,
+     *         with MXIMPProtocolRequestCompleteEvent event.
+     *
+     * @leave KErrNoMemory if failed to allocate memory.
+     * @leave KErrArgument if NULL argument(s) were provided.
+     */
+    virtual TXIMPRequestId HandleLeaveGroupL(MXIMPIdentity* aGroupId) = 0;
+
+	/**
+     * Notifies IM from 
+     * deleted Group .
+     *
+     * Protocol adaptation implementation can call this
+     * method to notify IM from
+     * deleted group. IM
+     * calculates notifies the subscribing
+     * clients from data changes.
+     *
+     * IM takes ownership of the argument(s),
+     * if method succeeds without a leave.
+     *
+     * @param [in] aGroupId
+     *        MXIMPIdentity object holding group id
+     *
+     * @return The request id identifying the issued request.
+     *         Data cache request is processed asynchronously and
+     *         its completion is signalled to adaptation direction
+     *         through MXIMPProtocolConnectionHostObserver interface,
+     *         with MXIMPProtocolRequestCompleteEvent event.
+     *
+     * @leave KErrNoMemory if failed to allocate memory.
+     * @leave KErrArgument if NULL argument(s) were provided.
+     */
+    virtual TXIMPRequestId HandleDeleteGroupL(MXIMPIdentity* aGroupId) = 0;
+
+	/**
+     * Notifies IM from 
+     * group properties.
+     *
+     * Protocol adaptation implementation can call this
+     * method to notify IM from
+     * group properties. IM
+     * calculates notifies the subscribing
+     * clients from data changes.
+     *
+     * IM takes ownership of the argument(s),
+     * if method succeeds without a leave.
+     *
+     * @param [in] aGroupInfo
+     *        MImGroupInfo object holding
+     *        information about group properties.
+     *
+     * @return The request id identifying the issued request.
+     *         Data cache request is processed asynchronously and
+     *         its completion is signalled to adaptation direction
+     *         through MXIMPProtocolConnectionHostObserver interface,
+     *         with MXIMPProtocolRequestCompleteEvent event.
+     *
+     * @leave KErrNoMemory if failed to allocate memory.
+     * @leave KErrArgument if NULL argument(s) were provided.
+     */
+    virtual TXIMPRequestId HandleGroupPropertiesL(
+                MImGroupInfo* aGroupInfo ) = 0;
+                
+                
+     /**
+     * Notifies IM from 
+     * group subscription information.
+     *
+     * Protocol adaptation implementation can call this
+     * method to notify IM from
+     * group subscription information. IM
+     * calculates notifies the subscribing
+     * clients from data changes.
+     *
+     * IM takes ownership of the argument(s),
+     * if method succeeds without a leave.
+     *
+     * @param [in] aSubscription
+     *        Whether subscribed to group
+     *
+     * @return The request id identifying the issued request.
+     *         Data cache request is processed asynchronously and
+     *         its completion is signalled to adaptation direction
+     *         through MXIMPProtocolConnectionHostObserver interface,
+     *         with MXIMPProtocolRequestCompleteEvent event.
+     *
+     * @leave KErrNoMemory if failed to allocate memory.
+     * @leave KErrArgument if NULL argument(s) were provided.
+     */
+    virtual TXIMPRequestId HandleGroupPropertiesL(
+                TBool aSubscription ) = 0;
+     /**
+     * Notifies IM from
+     * IM group access control list contents.
+     *
+     * Protocol adaptation implementation can call this
+     * method to notify IM from
+     * complete Im group access control list content.
+     * IM calculates the changes
+     * (new and removed Im groups) compared to previous
+     * Im group list content, and notifies
+     * the subscribing clients from data changes.
+     *
+     * IM takes ownership of the object
+     * collection and all objects contained within, if
+     * the method succeeds without a leave.
+     *
+     *
+     * @param [in] accesscontrollist
+     *        MImObjectCollection object containing zero or
+     *        more MImAccessControlList objects. Each
+     *        contained MImAccessControlList shall present
+     *        single access control list for a  group within the im
+     *        group list.
+     *
+     * @return The request id identifying the issued request.
+     *         Data cache request is processed asynchronously and
+     *         its completion is signalled to adaptation direction
+     *         through MXIMPProtocolConnectionHostObserver interface,
+     *         with MXIMPProtocolRequestCompleteEvent event.
+     *
+     * @leave KErrNoMemory if failed to allocate memory.
+     * @leave KErrArgument if NULL argument(s) were provided.
+     */
+    virtual TXIMPRequestId HandleImAccessControlListL(
+                MImObjectCollection* accesscontrollist ) = 0;
+     /**
+     * Notifies IM from
+     * IM group members.
+     *
+     * Protocol adaptation implementation can call this
+     * method to notify IM from IM group
+     * members. IM calculates the changes
+     * (added and removed group members) compared to previous
+     * IM group content, and notifies the subscribing
+     * clients from data changes.
+     *
+     * IM takes ownership of the object
+     * collection and all objects contained within, if
+     * the method succeeds without a leave.
+     *
+     * @param [in] aGroupId
+     *        MXIMPIdentity object identifying the im group
+     *        of which content is notified here.
+     *
+     * @param [in] aGroupMembers
+     *        MImObjectCollection object containing zero or
+     *        more MImGroupInfo objects. Each
+     *        contained MImGroupInfo shall
+     *        present single im group member, within
+     *        the im group.
+     *
+     * @return The request id identifying the issued request.
+     *         Data cache request is processed asynchronously and
+     *         its completion is signalled to adaptation direction
+     *         through MXIMPProtocolConnectionHostObserver interface,
+     *         with MXIMPProtocolRequestCompleteEvent event.
+     *
+     * @leave KErrNoMemory if failed to allocate memory.
+     * @leave KErrArgument if NULL argument(s) were provided.
+     */
+    virtual TPrFwRequestId HandleImGroupMembersL(
+                MXIMPIdentity* aGroupId,
+                MImObjectCollection* aGroupMembers ) = 0;
+/**
+     * Notifies IM from
+     * im group joined users.
+     *
+     * Protocol adaptation implementation can call this
+     * method to notify IM from im group
+     * joined users. IM calculates the changes
+     * (added and removed group members) compared to previous
+     * Im group content, and notifies the subscribing
+     * clients from data changes.
+     *
+     * IM takes ownership of the object
+     * collection and all objects contained within, if
+     * the method succeeds without a leave.
+     *
+     * @param [in] aGroupId
+     *        MXIMPIdentity object identifying the im group
+     *        of which content is notified here.
+     * @param [in] aGroupJoinedUsers
+     *        MImObjectCollection object containing zero or
+     *        more MImGroupInfo objects. Each
+     *        contained MImGroupInfo shall
+     *        present single im group joined user, within
+     *        the im group.
+     *
+     * @return The request id identifying the issued request.
+     *         Data cache request is processed asynchronously and
+     *         its completion is signalled to adaptation direction
+     *         through MXIMPProtocolConnectionHostObserver interface,
+     *         with MXIMPProtocolRequestCompleteEvent event.
+     *
+     * @leave KErrNoMemory if failed to allocate memory.
+     * @leave KErrArgument if NULL argument(s) were provided.
+     */
+    virtual TPrFwRequestId HandleImGroupJoinedUsersListL(
+                MXIMPIdentity* aGroupId,
+                MImObjectCollection* aGroupJoinedUsers ) = 0;
+
+
+
+    /**
+     * Notifies IM from new
+     * im group member entry.
+     *
+     * Protocol adaptation implementation can call this
+     * method to notify IM from
+     * new im group member entry. IM
+     * calculates the change, from previous im
+     * group content, and notifies the subscribing
+     * clients from data changes.
+     *
+     * IM takes ownership of the argument(s),
+     * if method succeeds without a leave.
+     *
+     * @param [in] aGroupId
+     *        MPrFwIdentity object identifying the im
+     *        group to where the group member is added.
+     * @param [in] aGroupMember
+     *        MImGroupInfo object holding
+     *        information about new im group member
+     *        entry. New im group member is added
+     *        to the im group content.
+     *
+      * @return The request id identifying the issued request.
+     *         Data cache request is processed asynchronously and
+     *         its completion is signalled to adaptation direction
+     *         through MXIMPProtocolConnectionHostObserver interface,
+     *         with MXIMPProtocolRequestCompleteEvent event.
+     *
+     * @leave KErrNoMemory if failed to allocate memory.
+     * @leave KErrArgument if NULL argument(s) were provided.
+     */
+    virtual TPrFwRequestId HandleImGroupMemberAddedL(
+                MPrFwIdentity* aGroupId,
+                MImGroupInfo* aGroupMember ) = 0;
+
+     /**
+     * Notifies IM from new
+     * im group member entry.
+     *
+     * Protocol adaptation implementation can call this
+     * method to notify IM from
+     * remove of existing group member entry. IM
+     * calculates the change, from previous im
+     * group content, and notifies the subscribing
+     * clients from data changes.
+     *
+     * IM takes ownership of the argument(s),
+     * if method succeeds without a leave.
+     *
+     * @param [in] aGroupId
+     *        MPrFwIdentity object identifying the im
+     *        group to where the group member is added.
+     *
+     * @param [in] aGroupMember
+     *        MPrFwIdentity object identifying the im
+     *        group member which to remove from the im
+     *        group.
+     *
+      * @return The request id identifying the issued request.
+     *         Data cache request is processed asynchronously and
+     *         its completion is signalled to adaptation direction
+     *         through MXIMPProtocolConnectionHostObserver interface,
+     *         with MXIMPProtocolRequestCompleteEvent event.
+     *
+     * @leave KErrNoMemory if failed to allocate memory.
+     * @leave KErrArgument if NULL argument(s) were provided.
+     */
+    virtual TPrFwRequestId HandleImGroupMemberRemovedL(
+                MPrFwIdentity* aGroupId,
+                MImGroupInfo* aGroupMember ) = 0;
+
+      
+
+    };
+
+
+#endif // MPROTOCOLIMGROUPDATAHOST_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_im_protocol_plugin_host_api/inc/protocoliminvitationdatahost.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,236 @@
+/*
+* 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:  Interface for managing cached Invite information.
+*
+*/
+
+#ifndef MPROTOCOLIMINVITATIONDATAHOST_H
+#define MPROTOCOLIMINVITATIONDATAHOST_H
+
+#include <e32std.h>
+#include <improtocolpluginhostifids.hrh>
+#include <ximpbase.h>
+
+class MXIMPIdentity;
+/**
+ * Interface for managing cached Invitation information.
+ *
+ * Interface is used by protocol adaptations to manage
+ * invitation related information in
+ * IM internal data cache.
+ *
+ * This interface is implemented by IM.
+ * Protocol adaptation can obtain reference to this
+ * interface from MXIMPProtocolConnectionHost interface.
+ *
+ * For each separated protocol connection, protocol
+ * adaptation must use the specific
+ * MImProtocolInvitationDataHost instance,
+ * what is received from the connection specific
+ * MXIMPProtocolConnectionHost instance.
+ *
+ * @ingroup Improtocolpluginhostapi
+ * @since S60
+ */
+class MImProtocolInvitationDataHost : public MXIMPBase
+    {
+public:
+
+    /** Interface ID for the MImProtocolInvitationDataHost. */
+    enum { KInterfaceId = IM_IF_ID_PROTOCOL_INVITATION_DATAHOST };
+
+
+protected:
+
+
+    /**
+     * Protected destructor. Object instancies
+     * can't be deleted via this interface.
+     */
+    virtual ~MImProtocolInvitationDataHost() {}
+
+
+
+public: // Handling invitation requests
+
+     
+    /**
+     * Notifies IM from
+     * im group invitation .
+     *
+     * Protocol adaptation implementation can call this
+     * method to notify IM from
+     * im group invitation .
+     * IM calculates the changes
+     * notifies the subscribing clients from data changes.
+     *
+     * IM takes ownership of the argument(s),
+     * if method succeeds without a leave.
+     *
+     *  @param [in] aUserID           = IDs of the users to invite
+     *  @param [in] InviteGroup      = ID of the group to which the users
+     *                             			are invited to join
+	 * @param [in] aInviteInfo        = Identification and content of the invitation.
+     *		MImInvitationInfo contains InviteId, contenttype - text/content, invitereason,validityperiod....... 
+     *
+	 * @return The request ID identifying the issued request.
+     *         Data cache update request is processed
+     *         asynchronously and operation completion result is
+     *         signalled to adaptation direction through
+     *         MXIMPProtocolConnectionHostObserver interface,
+	 *         with MXIMPProtocolRequestCompleteEvent event.
+     *
+     * @leave KErrNoMemory if failed to allocate memory.
+     * @leave KErrArgument if NULL argument(s) were provided.
+     */
+	virtual TXIMPRequestId HandleImGroupInviteL(
+                 const MDesCArray* aUserID,
+                                    const MXIMPIdentity& InviteGroup,
+                                   const MImInvitationInfo& aInviteInfo ) = 0;
+	 /**
+     * Notifies IM from
+     * im Invitation .
+     *
+     * Protocol adaptation implementation can call this
+     * method to notify IM from
+     * IM  invitation .
+     * IM calculates the changes
+     * notifies the subscribing clients from data changes.
+     *
+     * IM takes ownership of the argument(s),
+     * if method succeeds without a leave.
+     *
+	 *  @param [in] aUserID           = ID of the user to invite
+     *  @param [in] aInviteInfo       = Identification and content of the invitation.
+     *		MImInvitationInfo contains InviteId, contenttype - text/content, invitereason,validityperiod....... 
+	 *
+	 * @return The request id identifying the issued request.
+     *         Data cache update request is processed
+     *         asynchronously and operation completion result is
+     *         signalled to adaptation direction through
+     *         MXIMPProtocolConnectionHostObserver interface,
+	 *         with MXIMPProtocolRequestCompleteEvent event.
+     *
+     * @leave KErrNoMemory if failed to allocate memory.
+     * @leave KErrArgument if NULL argument(s) were provided.
+     */
+	virtual TXIMPRequestId HandleImInviteL(
+                 const TDesC& aUserID,                              
+                                 const MImInvitationInfo& aInviteInfo ) = 0;
+	
+
+
+    /**
+     * Notifies IM from
+     * invitation response.
+     *
+     * Protocol adaptation implementation can call this
+     * method to notify IM from
+     * invitation response.
+     * IM calculates the changes
+     * notifies the subscribing clients from data changes.
+     *
+     * IM takes ownership of the argument(s),
+     * if method succeeds without a leave.
+     *
+     *  @param [in] aRecipientUserId  = UserID of the invitee
+     *  @param [in] aInviteInfo       = Identification and content of the invitation.
+     *		MImInvitationInfo contains InviteId, contenttype - text/content, inviteresponse,acceptance....... 
+	 *
+	 * @return The request id identifying the issued request.
+     *         Data cache update request is processed
+     *         asynchronously and operation completion result is
+     *         signalled to adaptation direction through
+     *         MXIMPProtocolConnectionHostObserver interface,
+	 *         with MXIMPProtocolRequestCompleteEvent event.
+     *
+     * @leave KErrNoMemory if failed to allocate memory.
+     * @leave KErrArgument if NULL argument(s) were provided.
+     */
+	virtual TXIMPRequestId HandleInviteResponseL(
+                const TDesC& aRecipientUserId,
+										   const MImInvitationInfo& aInviteInfo ) = 0;
+	
+	
+	/**
+     * Notifies IM from
+     * Cancelled im group Invitation.
+     *
+     * Protocol adaptation implementation can call this
+     * method to notify IM from
+     * cancelled im group invitation request.
+     * IM calculates the changes
+     * notifies the subscribing clients from data changes.
+     *
+     * IM takes ownership of the argument(s),
+     * if method succeeds without a leave.
+     *
+	 *  @param [in] aUserID           = IDs of the users to cancel invititation
+     *  @param [in] InviteGroup      = ID of the group to which the users
+     *                             			are invited to join
+	 * @param [in] aInviteInfo        = Identification and content of the invitation.
+     *		MImInvitationInfo contains InviteId, contenttype - text/content, invitereason,validityperiod....... 
+     * 
+	 * @return The request id identifying the issued request.
+     *         Data cache update request is processed
+     *         asynchronously and operation completion result is
+     *         signalled to adaptation direction through
+     *         MXIMPProtocolConnectionHostObserver interface,
+	 *         with MXIMPProtocolRequestCompleteEvent event.
+     *
+     * @leave KErrNoMemory if failed to allocate memory.
+     * @leave KErrArgument if NULL argument(s) were provided.
+     */
+  
+     virtual TXIMPRequestId HandleCancelImgroupInviteL( const MDesCArray* aUserID,
+                                    const MXIMPIdentity& InviteGroup,
+                                   const MImInvitationInfo& aInviteInfo )= 0;
+
+/**
+     * Notifies IM from
+     * Cancelled Invitation.
+     *
+     * Protocol adaptation implementation can call this
+     * method to notify IM from
+     * cancelled invitation request.
+     * IM calculates the changes
+     * notifies the subscribing clients from data changes.
+     *
+     * IM takes ownership of the argument(s),
+     * if method succeeds without a leave.
+     *
+	 *  @param [in] aUserID           = ID of the user to cancel invitataion
+     *  @param [in] aInviteInfo       = Identification and content of the invitation.
+     *		MImInvitationInfo contains InviteId, contenttype - text/content, invitereason,validityperiod....... 
+     *
+	 * @return The request ID identifying the issued request.
+     *         Data cache update request is processed
+     *         asynchronously and operation completion result is
+     *         signalled to adaptation direction through
+     *         MXIMPProtocolConnectionHostObserver interface,
+	 *         with MXIMPProtocolRequestCompleteEvent event.
+     *
+     * @leave KErrNoMemory if failed to allocate memory.
+     * @leave KErrArgument if NULL argument(s) were provided.
+     */
+  
+     virtual TXIMPRequestId HandleCancelImInviteL( const TDesC& aUserID,                              
+                                 const MImInvitationInfo& aInviteInfo ) = 0;
+                                         
+
+
+    };
+
+
+#endif // MPROTOCOLIMINVITATIONDATAHOST_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_im_protocol_plugin_host_api/inc/protocolimpluginhost.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,161 @@
+/*
+* 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:   Protocol IM Plugin host interface.
+*
+*/
+
+#ifndef MPROTOCOLIMPLUGINHOST_H
+#define MPROTOCOLIMPLUGINHOST_H
+
+#include <ximpbase.h>
+#include <protocolimpluginhostifids.hrh>
+#include <e32std.h>
+
+
+//class MImObjectFactory;
+//class MImStatus;
+
+
+
+// CLASS DECLARATION
+
+/**
+ * Interface for IM Protocol Plugin host.
+ * This interface is implemented by IM.
+ *
+ * IM Protocol Plugin host interface defines
+ * actions that a IM protocol plug-in can
+ * request (callback) from IM.
+ *
+ * @see MProtocolImPlugin
+ * @see CProtocolImPluginBase
+ * @ingroup ProtocolImpluginhostapi
+ * @since S60 
+ */
+class MProtocolImPluginHost : public MXIMPBase
+    {
+public:
+
+    /** Interface ID for the MProtocolImPluginHost. */
+    enum { KInterfaceId = IM_IF_ID_PROTOCOL_PLUGIN_HOST };
+
+
+protected:
+
+    /**
+     * Protected destructor. IM Protocol Plugin host
+     * instancies can't be destroyed via this interface.
+     */
+    virtual inline ~MProtocolImPluginHost() {};
+
+
+public:
+
+
+    /**
+     * Gets reference to object factory interface.
+     *
+     * Returned object factory interface is used
+     * to instantiate IM data objects.
+     *
+     * @return Object factory interface.
+     *         No ownership is returned caller.
+     */
+    virtual MImObjectFactory& ObjectFactory() = 0;
+
+
+
+    /**
+     * Notifies IM that IM protocol
+     * plug-in has completed (successfully or otherwise)
+     * the request handling.
+     *
+     * /b NOTE: This method isn't yet supported by IM,
+     *       since all MProtocolImPlugin methods are currently
+     *       synchronous.
+     *
+     * @param [in] aReqId
+     *        Request ID identifying the request which handling
+     *        is completed. This must equal to value given in
+     *        the processing initiation. If no pending IM
+     *        protocol plug-in request is found with this id,
+     *        plug-in is paniced.
+     *
+     * @param [in] aResultCode
+     *        Result code from request handling.
+     */
+    virtual void HandleRequestCompleted( TXIMPRequestId aReqId,
+                                         TInt aResultCode ) = 0;
+
+
+    /**
+     * Notifies IM that IM protocol
+     * plug-in has completed (successfully or otherwise)
+     * the request handling.
+     *
+     * /b NOTE: This method isn't yet supported by IM,
+     *       since all MProtocolImPlugin methods are currently
+     *       synchronous.
+     *
+     * @param [in] aReqId
+     *        Request ID identifying the request which handling
+     *        is completed. This must equal to value given in
+     *        the processing initiation. If no pending IM
+     *        protocol plug-in request is found with this id,
+     *        plug-in is paniced.
+     * @param [in] aResult
+     *        Status object describing result from request handling.
+     *        Object ownership is transfered always to IM.
+     *        NULL value not allowed.
+     */
+    virtual void HandleRequestCompleted( TXIMPRequestId aReqId,
+                                         MImStatus* aResult ) = 0;
+
+
+    /**
+     * Notifies IM that IM protocol
+     * plug-in has completed (successfully or otherwise)
+     * the request handling.
+     *
+     * /b NOTE: This method isn't yet supported by IM,
+     *       since all MProtocolImPlugin methods are currently
+     *       synchronous.
+     *
+	 * @param [in] aReqId
+     *        Request ID identifying the request which handling
+     *        is completed. This must equal to value given in
+     *        the processing initiation. If no pending IM
+     *        protocol plug-in request is found with this id,
+     *        plug-in is paniced.
+     * @param [in] aResult
+     *        Status object describing result from request handling.
+     *        Object ownership is transfered always to Im.
+     *        NULL value not allowed.
+     * @param [in] aParameter
+     *        Additional request complete parameters.
+     *        NULL if no additional parameters to transfer Im.
+     *        Parameter may be single MXIMPBase derived
+     *        object or MImRestrictedObjectCollection object
+     *        containing multiple objects. Ownership of given
+     *        parameter (also the container and contained objects)
+     *        is transfered always to Im.
+     */
+    virtual void HandleRequestCompleted( TXIMPRequestId aReqId,
+                                         MImStatus* aResult,
+                                         MXIMPBase* aParameter ) = 0;
+
+    };
+
+
+#endif // MPROTOCOLIMPLUGINHOST_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_im_protocol_plugin_host_api/inc/protocolimsearchdatahost.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,138 @@
+/*
+* 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:  Interface for managing cached Search information.
+*
+*/
+
+#ifndef MPROTOCOLIMSEARCHDATAHOST_H
+#define MPROTOCOLIMSEARCHDATAHOST_H
+
+
+#include <e32std.h>
+#include <protocolimpluginhostifids.hrh>
+#include <ximpbase.h>
+
+
+/**
+ * Interface for managing cached search information.
+ *
+ * Interface is used by protocol adaptations to manage
+ * search related information in
+ * IM internal data cache
+ *
+ * This interface is implemented by IM.
+ * Protocol adaptation can obtain reference to this
+ * interface from MXIMPProtocolConnectionHost interface.
+ *
+ * For each separated protocol connection, protocol
+ * adaptation must use the specific
+ * MProtocolImSearchDataHost instance,
+ * what is received from the connection specific
+ * MXIMPProtocolConnectionHost instance.
+ *
+ * @ingroup protocolimpluginhostapi
+ * @since S60 
+ */
+class MProtocolImSearchDataHost : public MXIMPBase
+    {
+public:
+
+    /** Interface ID for the MProtocolImSearchDataHost. */
+    enum { KInterfaceId = IM_IF_ID_PROTOCOL_SEARCH_DATAHOST };
+
+
+protected:
+
+
+    /**
+     * Protected destructor. Object instancies
+     * can't be deleted via this interface.
+     */
+    virtual ~MProtocolImSearchDataHost() {}
+
+
+
+public: // Handling search information
+
+
+    /**
+     * Notifies IM from 
+     * search result information.
+     *
+     * Protocol adaptation implementation can call this
+     * method to notify IM from search
+     * result information. IM
+     * updates its cached status, and
+     * notifies the subscribing clients from data changes.
+     *
+     * IM takes ownership of the argument(s),
+     * if method succeeds without a leave.
+     *
+     * @param [in] aSearchId
+	 * 			search operation id, used when search is continued or stopped
+	 * @param [in]  aResultsFound - Indicates the number of the current findings. 
+     * @param [in]  aIndex    -  Indicates the particular index from which the 
+     *        next search can start. It is 0 in error case.
+     * @param [in]  aCompleted - TRUE if server has completed the search, 
+     *        FALSE if there are more results available.
+     * @param [in]  aUsrIdResults -List of results( UserId's), 
+     *        NULL if none.    
+     *
+     * @return The request id identifying the issued request.
+     *         Data cache request is processed asynchronously and
+     *         its completion is signalled to adaptation direction
+     *         through MXIMPProtocolConnectionHostObserver interface,
+     *         with MXIMPProtocolRequestCompleteEvent event.
+     *
+     * @leave KErrNoMemory if failed to allocate memory.
+     * @leave KErrArgument if NULL argument(s) were provided.
+     */
+
+    virtual TXIMPRequestId HandleSearchL(MXIMPIdentity* aSearchId,
+    							TInt aResultsFound,  
+                                TBool aCompleted, 
+                                TInt aIndex,                                 
+                                MDesCArray* aUsrIdResults)  = 0;
+
+	/**
+     * Notifies IM from 
+     * search result information.
+     *
+     * Protocol adaptation implementation can call this
+     * method to notify IM from search
+     * result information. IM
+     * updates its cached status, and
+     * notifies the subscribing clients from data changes.
+     *
+     * IM takes ownership of the argument(s),
+     * if method succeeds without a leave.
+     *
+     * @param [in] aSearchId
+	 * 			search operation id, used when search was stopped
+     *
+     * @return The request id identifying the issued request.
+     *         Data cache request is processed asynchronously and
+     *         its completion is signalled to adaptation direction
+     *         through MXIMPProtocolConnectionHostObserver interface,
+     *         with MXIMPProtocolRequestCompleteEvent event.
+     *
+     * @leave KErrNoMemory if failed to allocate memory.
+     * @leave KErrArgument if NULL argument(s) were provided.
+     */
+
+    virtual TXIMPRequestId HandleSearchStoppedL(MXIMPIdentity* aSearchId)  = 0;
+    };
+
+
+#endif // MProtocolImSEARCHDATAHOST_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_im_protocol_plugin_host_api/ximp_im_protocol_plugin_host_api.metaxml	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,14 @@
+<?xml version="1.0" ?>
+<api id="999d4b5f3fab2086ed66a1f6c685305e" dataversion="1.0">
+<name>ximp_im_protocol_plugin_host_api</name>
+<description>Protocol adaptation implementation can call this method to notify IM from message forward completion information. IM updates its cached information and notifies the subscribing clients from data changes.</description>
+<type>c++</type>
+<subsystem>improcessor</subsystem>
+<libs><lib name="improcessor.lib"/>
+</libs>
+<release category="domain" sinceversion=""/>
+<attributes>
+<htmldocprovided>yes</htmldocprovided>
+<adaptation>no</adaptation>
+</attributes>
+</api>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_presence_base_api/group/bld.inf	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,27 @@
+/*
+* 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 
+:                XIMP Presence Base API
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+../inc/presenceerrors.hrh     MW_LAYER_PLATFORM_EXPORT_PATH(presenceerrors.hrh)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_presence_base_api/inc/presenceerrors.hrh	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,104 @@
+/*
+* 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:  Protocol agnostic error codes for XIMP Framework Presence.
+*
+*/
+
+#ifndef PRESENCEERRORS_HRH
+#define PRESENCEERRORS_HRH
+
+
+/**
+ * XIMP Framework Presence error codes.
+ *
+ * Error codes returned from XIMP Framework are either:
+ * -# System wide Symbian OS error codes (KErrNone, KErrNoMemory, etc.)
+ * -# Protocol agnostic presence related error codes defined here.
+ *    These error codes have range: KXIMPErrBase ... KXIMPErrLow. (-30150 )
+ *
+ * @ingroup ximppresenceapi
+ * @since S60 v3.2
+ */
+enum
+    {
+    KPresenceErrBase = -30138,
+
+    /**
+     * Error code to indicate that presence protocol or
+     * protocol adaptation does not support given presence
+     * information field type.
+     */
+    KPresenceErrPresenceInfoFieldTypeNotSupported = KPresenceErrBase - 1,
+
+
+    /**
+     * Error code to indicate that presence protocol or
+     * protocol adaptation does not support given presence
+     * information field value.
+     */
+    KPresenceErrPresenceInfoFieldValueNotSupported = KPresenceErrBase - 2,
+
+
+    /**
+     * Error code to indicate that presence protocol or
+     * protocol adaptation does not support given presentity
+     * group property (for example display name property).
+     */
+    KPresenceErrPresentityGroupPropertyNotSupported = KPresenceErrBase - 3,
+
+
+    /**
+     * Error code to indicate that request processing has failed
+     * on presence service, because the presentity group amount
+     * exeeds the service specific limit.
+     */
+    KPresenceErrTooManyPresentityGroups = KPresenceErrBase - 4,
+
+
+    /**
+     * Error code to indicate that request processing has failed
+     * on presence service, because the presentity amount
+     * exeeds the service specific limit.
+     */
+    KPresenceErrTooManyPresentities = KPresenceErrBase - 5,
+
+
+    /**
+     * Error code to indicate that presence service doesn't know
+     * the presentity group, which was identified in the request.
+     */
+    KPresenceErrUnknownPresentityGroup = KPresenceErrBase - 6,
+
+
+    /**
+     * Error code to indicate that presence service doesn't know
+     * the presentity, which was identified in the request.
+     */
+    KPresenceErrUnknownPresentity = KPresenceErrBase - 7,
+
+
+    /**
+     * Error code to indicate that the presence service
+     * has refused from request handling, because user
+     * doesn't have enough credits for the operation.
+     */
+    KPresenceErrNotEnoughCredits = KPresenceErrBase - 47
+
+
+    };
+
+
+#endif // PRESENCEERRORS_HRH
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_presence_base_api/ximp_presence_base_api.metaxml	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,20 @@
+<?xml version="1.0" ?>
+<api id="e64d5c92535182d1f85426f8750dbc62" dataversion="1.0">
+<name>XIMP Presence Base API</name>
+<description>Contains common base interface and definitions shared between all other XIMP Presence Feture Plug-in APIs.</description>
+<type>c++</type>
+<subsystem>ximpfw</subsystem>
+<libs><lib name="presencecacheecomhook.lib"/>
+<lib name="presencedatamodel.lib"/>
+<lib name="presencedatamodelhook.lib"/>
+<lib name="presenceecomhook.lib"/>
+<lib name="presencemanager.lib"/>
+<lib name="presenceoperation.lib"/>
+<lib name="presencecacheclient.lib"/>
+</libs>
+<release category="domain" sinceversion=""/>
+<attributes>
+<htmldocprovided>yes</htmldocprovided>
+<adaptation>no</adaptation>
+</attributes>
+</api>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_presence_cache_api/group/bld.inf	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,32 @@
+/*
+* 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:  File that exports the files belonging to 
+:                XIMP Presence Cache API
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+../inc/prescachereadhandler.h     MW_LAYER_PLATFORM_EXPORT_PATH(prescachereadhandler.h)
+../inc/prescachewritehandler.h     MW_LAYER_PLATFORM_EXPORT_PATH(prescachewritehandler.h)
+../inc/presencecachereader.h    MW_LAYER_PLATFORM_EXPORT_PATH(presencecachereader.h)
+../inc/presencecachereader.inl     MW_LAYER_PLATFORM_EXPORT_PATH(presencecachereader.inl)
+../inc/presencecachewriter.h    MW_LAYER_PLATFORM_EXPORT_PATH(presencecachewriter.h)
+../inc/presencecachewriter.inl     MW_LAYER_PLATFORM_EXPORT_PATH(presencecachewriter.inl)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_presence_cache_api/inc/prescachereadhandler.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,59 @@
+/*
+* Copyright (c) 2007, 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:  Interface for presence cache reader handler.
+*
+*/
+
+#ifndef MPRESCACHEREADHANDLER_H
+#define MPRESCACHEREADHANDLER_H
+
+/**
+ * Interface for presence cache reader API handler for asynchronous functions used in API.
+ * This interface is implemented by the clients as per their needs. 
+ *
+ * @ingroup ximpprescacheapi
+ * @since S60 v3.2
+ */
+ 
+class MPresenceBuddyInfoList;
+class MPresenceBuddyInfo;
+
+class MPresCacheReadHandler
+    {
+    public:
+        /**
+         * Handler for AllBuddiesPresenceInService method of MPresenceCacheReader.
+         *
+         * @param aErrorCode 
+         * @param aPresenceBuddyInfoList presence infos for all buddies requested. 
+         *         Ownership to callee. Can be null if not found.
+         */    
+        virtual void HandlePresenceReadL(TInt aErrorCode,
+                            MPresenceBuddyInfoList* aPresenceBuddyInfoList) = 0;
+                            
+        /**
+         * Handler for Buddy presence change notifications.
+         *
+         * @param aErrorCode 
+         * @param aPresenceBuddyInfo presence info for buddy. 
+         *         Ownership to callee. Can be NULL if aErrorCode exist.
+         */    
+        virtual void HandlePresenceNotificationL(TInt aErrorCode,
+                            MPresenceBuddyInfo* aPresenceBuddyInfo) = 0;
+    };
+
+#endif // MPRESCACHEREADHANDLER_H
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_presence_cache_api/inc/prescachewritehandler.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,40 @@
+/*
+* 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:  Interface for presence cache writer handler.
+*
+*/
+
+#ifndef MPRESCACHEWRITEHANDLER_H
+#define MPRESCACHEWRITEHANDLER_H
+
+/**
+ * Interface for presence cache writer API. Handler for asynchronous functions used in API.
+ * This interface is implemented by the clients as per their needs. 
+ *
+ * @ingroup ximpprescacheapi
+ * @since S60 v3.2
+ */
+class MPresCacheWriteHandler
+    {
+    public:
+    
+        /**
+         * Handler for Asynchronous methods of MPresenceCacheWriter.
+         *
+         * @param TInt error code comes here 
+         */    
+        virtual void HandlePresenceWriteL(TInt aErrorCode) = 0;
+    };
+
+#endif // MPRESCACHEWRITEHANDLER_H
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_presence_cache_api/inc/presencecachereader.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,195 @@
+/*
+* Copyright (c) 2007, 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:  Interface for presence cache reader.
+*
+*/
+
+#ifndef MPRESENCECACHEREADER_H
+#define MPRESENCECACHEREADER_H
+
+#include <e32std.h>
+#include <e32base.h>
+#include <presencemanagementifids.hrh>
+
+class MPresenceInfo;
+class MPresenceBuddyInfoList;
+class MPersonPresenceInfo;
+class MPresCacheReadHandler;
+class MXIMPIdentity;
+
+/**
+ * Interface for presence cache reader API. This interface is implemented 
+ * by the XIMP Framework Presence Cache client. Clients must call 
+ * REComSession::FinalClose() from their destructors.  Notice that an xsp id is
+ * in the form ovi:xyz@example.com
+ *
+ * @ingroup ximpprescacheapi
+ * @since S60 v3.2
+ */
+class MPresenceCacheReader
+    {
+public:
+
+    /** Interface ID for the MPresenceCacheReader. */
+    enum { KInterfaceId = XIMP_ECOM_IF_UID_PRESENCE_CACHE_READER };
+
+
+public:
+
+    /**
+     * Factory method to instantiate MPresenceCacheReader through 
+     * the ECom.
+     *
+     * @return The new MPresenceCacheReader object. Object
+     *         ownership is returned to caller.
+     */
+    static inline MPresenceCacheReader* NewL();
+
+    /**
+     * Public destructor.
+     * Objects can be deleted through this interface.
+     */
+    virtual inline ~MPresenceCacheReader();
+    
+protected:
+
+    /**
+     * Default constructor to zero initialize
+     * the iEcomDtorID member.
+     */
+    inline MPresenceCacheReader();
+
+
+public: //Sub interfaces for presence cache reader, Synchonous methods
+
+    /**
+     * Instantiates new identity object.
+     *
+     * @return New Identity instance. Object ownership is returned to caller.
+     * @leave KErrNoMemory if failed to allocate memory.
+     */
+    virtual MXIMPIdentity* NewIdentityLC() = 0;
+    
+    /**
+     * Reads presence info from cache for a given identity, returns immediately.
+     *
+     * @param aIdentity buddy id, identity must be in xsp id format
+     * @return MPresenceInfo for the given buddy. Ownership to caller.
+     *         Null if service or buddy not found, not on Cleanup in that case.    
+     */
+    virtual MPresenceInfo* PresenceInfoLC(const MXIMPIdentity& aIdentity) = 0;
+    
+    /**
+     * Returns total number of buddies stored in presence cache.
+     * It includes all services, probably useful while deciding performance 
+     * overheads or informing to the user.
+     *
+     * @return TInt Total number of presence infos in presence cache.
+     */                           
+    virtual TInt BuddyCountInAllServices() = 0;
+    
+    /**
+     * Returns total number of buddies (presence infos) stored in a specific
+     * service in presence cache. It includes only the given service. 
+     *
+     * @param aServiceName as in device's service table
+     * @return TInt buddy count or error code. e.g. in case of service not
+     *         found return value is KErrNotFound.
+     */                           
+    virtual TInt BuddyCountInService(const TDesC& aServiceName) = 0;
+    
+    /**
+     * Returns total number services in presence cache.
+     *
+     * @return TInt total number of services in presence cache.
+     */                           
+    virtual TInt ServicesCount() = 0;
+    
+    /**
+     * Returns all service names present in presence cache.
+     *
+     * @returned Service names are returned here, ownership to caller.
+     */                           
+    //virtual CDesCArray* ServicesLC() = 0;
+    
+    /**
+     * Cancels any async. read operation going on. After calling this
+     * method no callback will be received from asycn read method.
+     *
+     * @return error code, KErrNone if successfully cancelled.
+     */
+    virtual TInt CancelRead() = 0;
+                                                
+
+public: //Sub interfaces for presence cache reader, Asynchronous methods
+
+    /**
+     * Reads all presence info from cache for a given service. Returns in 
+     * MPresCacheReadHandler's HandlePresenceReadL.
+     *
+     * @param aServiceName Service name to search from
+     * @param aHandler to handle async. callback
+     * @return error code, in case of error callback wont be called.
+     */    
+    virtual TInt AllBuddiesPresenceInService(const TDesC& aServiceName, 
+                                MPresCacheReadHandler* aHandler) = 0;
+
+public: //Sub interfaces for presence cache reader, Asynchronous methods
+    
+    /**
+     * Sets the observer to receive Presence Buddy Change notifications.
+     * Observer must be set before using SubscribePresenceBuddyChangeL.
+     * If client changes the observer using this method, all the notifications
+     * related to existing and new subscriptions will be delivered to 
+     * the new observer.
+     *
+     * @return Error code, if KErrNone observer is successfully set.
+     */
+    virtual TInt SetObserverForSubscribedNotifications(
+                                    MPresCacheReadHandler* aHandler) = 0;
+    
+    /**
+     * Subscribe for given presence buddy's change in presence. An observer
+     * must be set before using this method by SetObserverForSubscribedNotifications.
+     * Notifcations are delivered through MPresCacheReadHandler's HandlePresenceNotificationL
+     *
+     * @param aIdentity buddy id, identity must be in xsp id format
+     * @return KErrNone if successful, KErrArgument if observer not set
+     * @leave Only in system error cases e.g. if failed to allocate memory.
+     */
+    virtual TInt SubscribePresenceBuddyChangeL(const MXIMPIdentity& aIdentity) = 0;
+                                                
+    /**
+     * Unsubscribe for given presence buddy's change in presence. The request
+     * is ignored if invalid.
+     *
+     * @param aIdentity buddy id, identity must be in xsp id format
+     * @leave Only in system error cases e.g. if failed to allocate memory.
+     */
+    virtual void UnSubscribePresenceBuddyChangeL(const MXIMPIdentity& aIdentity) = 0;
+
+            
+private: // Data
+
+    //OWN: ECom destructor ID
+    TUid iEcomDtorID;
+    };
+
+#include <presencecachereader.inl>
+
+
+#endif // MPRESENCECACHEREADER_H
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_presence_cache_api/inc/presencecachereader.inl	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,63 @@
+/*
+* 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 Cache reader interface used by XIMP Presence clients.
+*
+*/
+
+#include <ecom/ecom.h>
+
+// -----------------------------------------------------------------------------
+// MPresenceCacheReader::NewL() implementation
+// Factory method to instantiate the platform default
+// MPresenceCacheReader implementation through the ECom framework.
+// -----------------------------------------------------------------------------
+//
+inline MPresenceCacheReader* MPresenceCacheReader::NewL()
+    {
+    _LIT8( KXIMPPresenceDefaultData, XIMP_ECOM_DEFAULT_DATA_PRESENCE_INTERFACE );
+
+    TEComResolverParams resolvingParams;
+    resolvingParams.SetDataType( KXIMPPresenceDefaultData );
+    resolvingParams.SetWildcardMatch( ETrue );
+
+    TAny* imp = REComSession::CreateImplementationL( TUid::Uid( MPresenceCacheReader::KInterfaceId ),
+                                                     _FOFF( MPresenceCacheReader, iEcomDtorID ), 
+                                                                            resolvingParams );
+
+    return reinterpret_cast< MPresenceCacheReader* >( imp );
+    }
+
+
+// -----------------------------------------------------------------------------
+// MPresenceCacheReader::MPresenceCacheReader() implementation
+// Zero initializes the iEcomDtorID member.
+// -----------------------------------------------------------------------------
+//
+inline MPresenceCacheReader::MPresenceCacheReader()
+    {
+    iEcomDtorID = TUid::Null();
+    }
+
+
+// -----------------------------------------------------------------------------
+// MPresenceCacheReader::~MPresenceCacheReader()
+// Destructor notifies the ECom from implementation destruction.
+// -----------------------------------------------------------------------------
+//
+inline MPresenceCacheReader::~MPresenceCacheReader()
+    {
+    REComSession::DestroyedImplementation( iEcomDtorID );
+    }
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_presence_cache_api/inc/presencecachewriter.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,193 @@
+/*
+* Copyright (c) 2007, 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:  Interface for presence cache writer.
+*
+*/
+
+#ifndef MPRESENCECACHEWRITER_H
+#define MPRESENCECACHEWRITER_H
+
+#include <e32std.h>
+#include <ximpbase.h>
+#include <presencemanagementifids.hrh>
+
+
+class MPresenceInfo;
+class MPersonPresenceInfo;
+class MPresenceInfoField;
+class MPresenceBuddyInfo;
+class MPersonPresenceInfo;
+class MPresCacheWriteHandler;
+class MPresenceBuddyInfoList;
+class MXIMPIdentity;
+class MPresenceObjectFactory;
+
+
+/**
+ * Interface for presence cache writer API. This interface is implemented 
+ * by the XIMP Framework Presence Cache client. Clients must call 
+ * REComSession::FinalClose() from their destructors. Notice that an xsp id is
+ * in the form ovi:xyz@example.com
+ *
+ * @ingroup ximpprescacheapi
+ * @since S60 v3.2
+ */
+class MPresenceCacheWriter //: public MXIMPBase
+    {
+public:
+
+    /** Interface ID for the MPresenceCacheWriter. */
+    enum { KInterfaceId = XIMP_ECOM_IF_UID_PRESENCE_CACHE_WRITER };
+
+
+public:
+
+    /**
+     * Factory method to instantiate MPresenceCacheWriter through 
+     * the ECom.
+     *
+     * @return The new MPresenceCacheWriter object. Object
+     *         ownership is returned to caller.
+     */
+    static inline MPresenceCacheWriter* NewL();
+
+    /**
+     * Public destructor.
+     * Objects can be deleted through this interface.
+     */
+    virtual inline ~MPresenceCacheWriter();
+    
+protected:
+
+    /**
+     * Default constructor to zero initialize
+     * the iEcomDtorID member.
+     */
+    inline MPresenceCacheWriter();
+
+
+public: //Sub interfaces for presence cache writer, Synchonous methods
+
+    /**
+     * Writes presence info to cache for a given buddy. Leaves only in system
+     * errors.
+     *
+     * @param aPresenceBuddyInfo contains xsp identity and presence
+     * @return Error code
+     */
+    virtual TInt WritePresenceL(const MPresenceBuddyInfo* aPresenceBuddyInfo) = 0;
+    
+    
+    /**
+     * Instantiates new Presence object Factory object. With this factory presence
+     * related ximp structures can be created.
+     *
+     * @return reference to MPresenceObjectFactory. No ownership to caller.
+     */
+    virtual MPresenceObjectFactory& PresenceObjectFactory() const = 0;
+    
+    
+    /**
+     * Instantiates new identity object.
+     *
+     * @return New Identity instance. Object ownership is returned to caller.
+     * @leave KErrNoMemory if failed to allocate memory.
+     */
+    virtual MXIMPIdentity* NewIdentityLC() = 0;
+
+
+    /**
+     * Instantiates new presence info object.
+     *
+     * @return New presence info instance. Object ownership
+     *         is returned to caller.
+     * @leave KErrNoMemory if failed to allocate memory.
+     */
+    virtual MPresenceInfo* NewPresenceInfoLC() = 0;
+    
+    
+    /**
+     * Instantiates new buddy presence info object.
+     *
+     * @return New buddy presence info instance. Object ownership
+     *         is returned to caller.
+     * @leave KErrNoMemory if failed to allocate memory.
+     */
+    virtual MPresenceBuddyInfo* NewBuddyPresenceInfoLC() = 0;
+    
+    /**
+     * Instantiates new buddy presence info list object.
+     *
+     * @param aServiceName service name for this list, if set to KNullDesC
+     *        the list can be appended with identities from different services
+     * @return New buddy presence info list instance. Object ownership
+     *         is returned to caller.
+     * @leave KErrNoMemory if failed to allocate memory.
+     */
+    virtual MPresenceBuddyInfoList* NewPresenceBuddyInfoListLC(const TDesC& aServiceName) = 0;
+    
+    
+    /**
+     * Delete all buddies presence associated with given service.
+     *
+     * @param aServiceName service name as in sp table
+     * @return error code
+     */
+    virtual TInt DeleteService(const TDesC& aServiceName) = 0;
+    
+    /**
+     * Deletes all presence related to given xsp identity.
+     * Leaves only in system errors.
+     *
+     * @param MXIMPIdentity identity for buddy to be removed, in xsp format
+     * @return error code
+     */
+    virtual TInt DeletePresenceL(const MXIMPIdentity& aIdentity) = 0;
+    
+    /**
+     * Cancels any async. write operation going on. After calling this
+     * method no callback will be received from asycn write method.
+     *
+     * @return error code, KErrNone if successfully cancelled.
+     */
+    virtual TInt CancelWrite() = 0;
+    
+
+public: //Sub interfaces for presence cache writer, Asynchronous methods
+
+    /**
+     * Writes buddy presence info objects to cache. Returns in 
+     * MPresCacheWriteHandler's HandlePresenceWriteL. Provide a null pointer
+     * to receive no call back. Leaves only in system errors.
+     *
+     * @param aBuddyPresenceInfos presence infos for all buddies. 
+     *         Ownership remains to caller.
+     * @param MPresCacheWriterHandler to handle async calls. A 'NULL' pointer
+     *         can be provided to receive no call back.
+     * @return TInt error code.
+     */    
+    virtual TInt WritePresenceL(const MPresenceBuddyInfoList* aBuddyPresenceInfos,
+                                    MPresCacheWriteHandler* aHandler) = 0;
+
+   
+private: // Data
+
+    //OWN: ECom destructor ID
+    TUid iEcomDtorID;
+    };
+
+#include <presencecachewriter.inl>
+
+
+#endif // MPRESENCECACHEWRITER_H
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_presence_cache_api/inc/presencecachewriter.inl	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,63 @@
+/*
+* 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 Cache writer interface used by XIMP Presence clients.
+*
+*/
+
+#include <ecom/ecom.h>
+
+// -----------------------------------------------------------------------------
+// MPresenceCacheWriter::NewL() implementation
+// Factory method to instantiate the platform default
+// MPresenceCacheWriter implementation through the ECom framework.
+// -----------------------------------------------------------------------------
+//
+inline MPresenceCacheWriter* MPresenceCacheWriter::NewL()
+    {
+    _LIT8( KXIMPPresenceDefaultData, XIMP_ECOM_DEFAULT_DATA_PRESENCE_INTERFACE );
+
+    TEComResolverParams resolvingParams;
+    resolvingParams.SetDataType( KXIMPPresenceDefaultData );
+    resolvingParams.SetWildcardMatch( ETrue );
+
+    TAny* imp = REComSession::CreateImplementationL( TUid::Uid( MPresenceCacheWriter::KInterfaceId ),
+                                                     _FOFF( MPresenceCacheWriter, iEcomDtorID ), 
+                                                                            resolvingParams);
+
+    return reinterpret_cast< MPresenceCacheWriter* >( imp );
+    }
+
+
+// -----------------------------------------------------------------------------
+// MPresenceCacheWriter::MPresenceCacheWriter() implementation
+// Zero initializes the iEcomDtorID member.
+// -----------------------------------------------------------------------------
+//
+inline MPresenceCacheWriter::MPresenceCacheWriter()
+    {
+    iEcomDtorID = TUid::Null();
+    }
+
+
+// -----------------------------------------------------------------------------
+// MPresenceCacheWriter::~MPresenceCacheWriter()
+// Destructor notifies the ECom from implementation destruction.
+// -----------------------------------------------------------------------------
+//
+inline MPresenceCacheWriter::~MPresenceCacheWriter()
+    {
+    REComSession::DestroyedImplementation( iEcomDtorID );
+    }
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_presence_cache_api/ximp_presence_cache_api.metaxml	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,20 @@
+<?xml version="1.0" ?>
+<api id="f67ac04f24a77d0691b6fdbf16123b45" dataversion="1.0">
+<name>ximp_presence_cache_api</name>
+<description>This is a API that provides read and write to the presence cache. </description>
+<type>c++</type>
+<subsystem>ximpfw</subsystem>
+<libs><lib name="presencecacheecomhook.lib"/>
+<lib name="presencedatamodel.lib"/>
+<lib name="presencedatamodelhook.lib"/>
+<lib name="presenceecomhook.lib"/>
+<lib name="presencemanager.lib"/>
+<lib name="presenceoperation.lib"/>
+<lib name="presencecacheclient.lib"/>
+</libs>
+<release category="domain" sinceversion=""/>
+<attributes>
+<htmldocprovided>yes</htmldocprovided>
+<adaptation>no</adaptation>
+</attributes>
+</api>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_presence_data_model_api/group/bld.inf	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  File that exports the files belonging to 
+:                XIMP Presence Data Model API
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+../inc/presencedatamodelifids.hrh     MW_LAYER_PLATFORM_EXPORT_PATH(presencedatamodelifids.hrh)
+../inc/presenceinfofieldcollection.h     MW_LAYER_PLATFORM_EXPORT_PATH(presenceinfofieldcollection.h)
+../inc/presenceinfo.h     MW_LAYER_PLATFORM_EXPORT_PATH(presenceinfo.h)
+../inc/devicepresenceinfo.h     MW_LAYER_PLATFORM_EXPORT_PATH(devicepresenceinfo.h)
+../inc/presenceobjectfactory.h     MW_LAYER_PLATFORM_EXPORT_PATH(presenceobjectfactory.h)
+../inc/presenceinfofieldvaluebinary.h     MW_LAYER_PLATFORM_EXPORT_PATH(presenceinfofieldvaluebinary.h)
+../inc/presenceinfofilter.h     MW_LAYER_PLATFORM_EXPORT_PATH(presenceinfofilter.h)
+../inc/presenceinfofield.h     MW_LAYER_PLATFORM_EXPORT_PATH(presenceinfofield.h)
+../inc/presencegrantrequestinfo.h     MW_LAYER_PLATFORM_EXPORT_PATH(presencegrantrequestinfo.h)
+../inc/presenceblockinfo.h     MW_LAYER_PLATFORM_EXPORT_PATH(presenceblockinfo.h)
+../inc/personpresenceinfo.h     MW_LAYER_PLATFORM_EXPORT_PATH(personpresenceinfo.h)
+../inc/presenceinfofieldvalueenum.h     MW_LAYER_PLATFORM_EXPORT_PATH(presenceinfofieldvalueenum.h)
+../inc/presencewatcherinfo.h     MW_LAYER_PLATFORM_EXPORT_PATH(presencewatcherinfo.h)
+../inc/presentitygroupinfo.h     MW_LAYER_PLATFORM_EXPORT_PATH(presentitygroupinfo.h)
+../inc/presenceinfofieldvaluetext.h     MW_LAYER_PLATFORM_EXPORT_PATH(presenceinfofieldvaluetext.h)
+../inc/servicepresenceinfo.h     MW_LAYER_PLATFORM_EXPORT_PATH(servicepresenceinfo.h)
+../inc/presentitygroupmemberinfo.h     MW_LAYER_PLATFORM_EXPORT_PATH(presentitygroupmemberinfo.h)
+../inc/presencebuddyinfo.h     MW_LAYER_PLATFORM_EXPORT_PATH(presencebuddyinfo.h)
+../inc/presencebuddyinfolist.h     MW_LAYER_PLATFORM_EXPORT_PATH(presencebuddyinfolist.h)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_presence_data_model_api/inc/devicepresenceinfo.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,98 @@
+/*
+* 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:  Interface for device presence info object.
+*
+*/
+
+#ifndef MXIMPFWDEVICEPRESENCEINFO_H
+#define MXIMPFWDEVICEPRESENCEINFO_H
+
+#include <e32std.h>
+#include <ximpbase.h>
+#include <presencedatamodelifids.hrh>
+
+
+class MPresenceInfoFieldCollection;
+
+
+/**
+ * Interface for device presence info object.
+ *
+ *
+ *
+ * @todo Interface might be extended with new methods.
+ *
+ * @ingroup presencedatamodelapi
+ * @since S60 v3.2
+ */
+class MDevicePresenceInfo : public MXIMPBase
+    {
+public:
+
+    /** Interface ID for the MDevicePresenceInfo. */
+    enum { KInterfaceId = PRES_IF_ID_DEVICE_PRESENCE_INFO };
+
+
+public:
+
+    /**
+     * Public destructor. MDevicePresenceInfo object
+     * can be deleted through this interface.
+     */
+    virtual ~MDevicePresenceInfo() {}
+
+
+public:
+
+    /**
+     * Returns device name value.
+     *
+     * Returns string identifying type of device.
+     *
+     * @return Device name.
+     */
+    virtual const TPtrC8 DeviceName() const = 0;
+
+    /**
+     * Set service name.
+     *
+     * @leave KErrNoMemory if failed to allocate memory
+     */
+    virtual void SetDeviceNameL( const TDesC8& aDeviceName ) = 0;
+
+    /**
+     * Returns read-only reference to presence information
+     * field collection.
+     *
+     * @return Presence information field collection.
+     */
+    virtual const MPresenceInfoFieldCollection& Fields() const = 0;
+
+
+    /**
+     * Returns modifiable reference to presence
+     * information field collection.
+     *
+     * @return Presence information field collection.
+     */
+    virtual MPresenceInfoFieldCollection& Fields() = 0;
+
+    };
+
+
+
+#endif //MXIMPFWDEVICEPRESENCEINFO_H
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_presence_data_model_api/inc/personpresenceinfo.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,81 @@
+/*
+* 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:  Interface for person presence info object.
+*
+*/
+
+#ifndef MXIMPFWPERSONPRESENCEINFO_H
+#define MXIMPFWPERSONPRESENCEINFO_H
+
+#include <e32std.h>
+#include <ximpbase.h>
+#include <presencedatamodelifids.hrh>
+
+
+class MPresenceInfoFieldCollection;
+
+
+/**
+ * Interface for person presence info object.
+ *
+ *
+ * @todo Interface might be extended with new methods.
+ *
+ * @ingroup presencedatamodelapi
+ * @since S60 v3.2
+ */
+class MPersonPresenceInfo : public MXIMPBase
+    {
+public:
+
+    /** Interface ID for the MPersonPresenceInfo. */
+    enum { KInterfaceId = PRES_IF_ID_PERSON_PRESENCE_INFO };
+
+
+public:
+
+    /**
+     * Public destructor. MPersonPresenceInfo object
+     * can be deleted through this interface.
+     */
+    virtual ~MPersonPresenceInfo() {}
+
+
+public:
+
+    /**
+     * Returns read-only reference to presence information
+     * field collection.
+     *
+     * @return Presence information field collection.
+     */
+    virtual const MPresenceInfoFieldCollection& Fields() const = 0;
+
+
+    /**
+     * Returns modifiable reference to presence
+     * information field collection.
+     *
+     * @return Presence information field collection.
+     */
+    virtual MPresenceInfoFieldCollection& Fields() = 0;
+
+    };
+
+
+
+#endif //MXIMPFWPERSONPRESENCEINFO_H
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_presence_data_model_api/inc/presenceblockinfo.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,111 @@
+/*
+* 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:  Interface for presence block info object.
+*
+*/
+
+#ifndef MXIMPFWPRESENCEBLOCKINFO_H
+#define MXIMPFWPRESENCEBLOCKINFO_H
+
+#include <e32std.h>
+#include <ximpbase.h>
+#include <presencedatamodelifids.hrh>
+
+
+class MXIMPIdentity;
+
+
+/**
+ * Interface for presence block info object.
+ *
+ * Presence block info object presents single
+ * presence block entry in the presence block list.
+ * Presence block info object holds the identity
+ * and display name information for the presence
+ * block entry.
+ *
+ * @ingroup presencedatamodelapi
+ * @since S60 v3.2
+ */
+class MPresenceBlockInfo : public MXIMPBase
+    {
+public:
+
+    /** Interface ID for the MPresenceBlockInfo. */
+    enum { KInterfaceId = PRES_IF_ID_PRESENCE_BLOCK_INFO };
+
+
+public:
+
+
+    /**
+     * Public destructor.
+     * Objects can be deleted through this interface.
+     */
+    virtual ~MPresenceBlockInfo() {}
+
+
+public:
+
+    /**
+     * Returns identity of the blocked entity.
+     *
+     * @return The identity of the blocked entity.
+     */
+    virtual const MXIMPIdentity& BlockedEntityId() const = 0;
+
+
+
+    /**
+     * Returns displayname of the blocked entity.
+     *
+     * @return The displayname of the blocked entity.
+     */
+    virtual const TDesC16& BlockedEntityDisplayName() const = 0;
+
+
+
+    /**
+     * Sets identity of the blocked entity.
+     *
+     * @param [in] aIdentity
+     *        Identity of the blocked entity.
+     *        Ownership of the argument is transfered to
+     *        callee, if method succeeds without a leave.
+     *
+     * @leave KErrNoMemory if failed to allocate memory.
+     * @leave KErrArgument if NULL argument were provided.
+     */
+    virtual void SetBlockedEntityIdL(
+                MXIMPIdentity* aIdentity ) = 0;
+
+
+    /**
+     * Sets displayname of the blocked entity.
+     *
+     * @param [in] aDisplayName
+     *        New display name value.
+     *
+     * @leave KErrNoMemory if failed to allocate memory.
+     */
+    virtual void SetBlockedEntityDisplayNameL(
+                const TDesC16& aDisplayName ) = 0;
+
+    };
+
+
+#endif // MXIMPFWPRESENCEBLOCKINFO_H
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_presence_data_model_api/inc/presencebuddyinfo.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,121 @@
+/*
+* 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:  Interface for presence buddy presence info.
+*
+*/
+
+#ifndef MPRESENCEBUDDYINFO_H
+#define MPRESENCEBUDDYINFO_H
+
+#include <e32std.h>
+#include <ximpbase.h>
+#include <presencedatamodelifids.hrh>
+
+class MPresenceInfo;
+class MPersonPresenceInfo;
+class MXIMPIdentity;
+
+/**
+ * Interface buddy presence info. This object has MPresenceInfo and MXIMPIdentity
+ * with and service Uid. This interface is implemented by the XIMP Framework 
+ * Presence Data model. 
+ * Users of XIMP can not create this object themselves, instead it's created from 
+ * MPresenceCacheWriter interface.
+ *
+ * @ingroup presencedatamodelapi
+ * @since S60 v3.2
+ */
+class MPresenceBuddyInfo : public MXIMPBase
+    {
+public:
+
+    /** Interface ID for the MPresenceBuddyInfo. */
+    enum { KInterfaceId = PRES_IF_ID_PRESENCE_BUDDY_INFO };
+
+
+public:
+
+    /**
+     * Public destructor.
+     * Objects can be deleted through this interface.
+     */
+    virtual ~MPresenceBuddyInfo() {}
+    
+public:
+
+    /**
+     * Sets the buddy identity, service and presence info. Takes ownerships.
+     *
+     * @param aService Service UID of the buddy
+     * @param aPresenceInfo for the buddy. Takes ownership.  
+     * @return Error code
+     */
+    virtual TInt Set( MXIMPIdentity* aIdentity, 
+                      MPresenceInfo* aPresenceInfo) = 0;
+                                
+    /**
+     * Sets the presence info.
+     *
+     * @param aPresenceInfo for the buddy. Takes ownership.
+     * @return Error code
+     */
+    virtual TInt SetPresenceInfo(MPresenceInfo* aPresenceInfo) = 0;
+    
+    
+    /**
+     * Sets the Buddy Identity.
+     *
+     * @param aIdentity identity of the buddy. Takes ownership.
+     * @return Error code
+     */
+    virtual TInt SetBuddyId(MXIMPIdentity* aIdentity) = 0;
+                                
+    /**
+     * Sets the buddy's person presence info. Leaves in system errors only.
+     *
+     * @param aPersonPresenceInfo for the buddy. Takes ownership.
+     * @return Error code
+     */
+    virtual TInt SetPersonPresenceL(MPersonPresenceInfo* aPersonPresenceInfo) = 0;                                                        
+                                
+    /**
+     * Reads presence info.
+     *
+     * @return MPresenceInfo for the given buddy. Ownership remains to this object.
+     */
+    virtual const MPresenceInfo* PresenceInfo() const = 0;
+    
+    /**
+     * Reads buddy Id.
+     *
+     * @return MXIMPIdentity id.
+     */
+    virtual const MXIMPIdentity* BuddyId() const = 0;
+                                                
+    
+    /**
+     * Return true if identity is same with other instance.
+     *
+     * @param aOtherInstance other instance of this object.
+     * @return ETrue if same.
+     */
+    virtual TBool EqualsIdentity(
+                    const MPresenceBuddyInfo* aOtherInstance ) const = 0;
+    
+    };
+
+#endif // MPRESENCEBUDDYINFO_H
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_presence_data_model_api/inc/presencebuddyinfolist.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,106 @@
+/*
+* Copyright (c) 2007, 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:  Interface for presence buddy info list.
+*
+*/
+
+#ifndef MPRESENCEBUDDYINFOLIST_H
+#define MPRESENCEBUDDYINFOLIST_H
+
+#include <e32std.h>
+#include <ximpbase.h>
+#include <presencedatamodelifids.hrh>
+
+class MPresenceBuddyInfo;
+class MXIMPIdentity;
+
+/**
+ * Interface for buddy presence info list. This object has a pointer array of
+ * MPresenceBuddyInfo(s). 
+ * This interface is implemented by the XIMP Framework Presence Data model. 
+ * Users of XIMP can not create this object themselves, instead it's created from 
+ * MPresenceCacheWriter interface.
+ *
+ * @ingroup presencedatamodelapi
+ * @since S60 v3.2
+ */
+class MPresenceBuddyInfoList : public MXIMPBase
+    {
+public:
+
+    /** Interface ID for the MPresenceBuddyInfoList. */
+    enum { KInterfaceId = PRES_IF_ID_PRESENCE_BUDDY_INFO_LIST };
+
+
+public:
+
+    /**
+     * Public destructor.
+     * Objects can be deleted through this interface.
+     */
+    virtual ~MPresenceBuddyInfoList() {}
+    
+    /**
+     * Gets reference to object collection.
+     *
+     * @return MXIMPObjectCollection. Ownership remains to this object.
+     */
+    virtual RPointerArray<MPresenceBuddyInfo>& GetObjectCollection() = 0;
+    
+
+    /**
+     * Service name accessor.
+     *
+     * @return Service name.
+     */    
+    virtual TPtrC ServiceName() const = 0;
+    
+    /**
+     * Number of MPresenceBuddyInfo.
+     *
+     * @return TInt count.
+     */    
+    virtual TInt Count() const = 0;
+    
+    /**
+     * Add or replace the buddy presence info object in this collection. 
+     * The object will be replaced if found same used id and service. 
+     * Takes Ownership.
+     * @param aBuddyPresenceInfo object to add or replace.
+     * @return error code
+     */
+    virtual TInt AddOrReplace(MPresenceBuddyInfo* aBuddyPresenceInfo) = 0;
+    
+    /**
+     * Find and remove the buddy presence info object matching given identity. 
+     * The first found object will be removed with same identity.
+     * @param aIdentity to be matched for.
+     * @return error code
+     */
+    virtual TInt FindAndRemove(const MXIMPIdentity& aIdentity) = 0;
+    
+    /**
+     * Find and get the first found buddy presence info object matching given identity. 
+     * A Null pointer will be returned if object with same identity not found.
+     * ownership remains to callee.
+     * @param aIdentity to be matched for.
+     */
+    virtual MPresenceBuddyInfo* FindAndGet(const MXIMPIdentity& aIdentity) const = 0;
+    
+    };
+
+#endif // MPRESENCEBUDDYINFOLIST_H
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_presence_data_model_api/inc/presencedatamodelifids.hrh	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,70 @@
+/*
+* 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:  XIMP Framework Presence Data Model API interface IDs.
+*
+*/
+
+#ifndef PRESENCEDATAMODELIFIDS_HRH
+#define PRESENCEDATAMODELIFIDS_HRH
+
+
+/**
+ * @defgroup ximppresenceapi XIMP Framework Presence API
+ * @defgroup presencedatamodelapi XIMP Presence Data Model API
+ * @ingroup ximppresenceapi
+ *
+ * XIMP Framework Presence Data Model API contains
+ * abstract interfaces for presentity groups,
+ * presence authorization and presence information,
+ * related data items. API provides also abstract object
+ * factory interface to instantiate other related objects.
+ *
+ * @TODO Is it ok?: Object types declared in XIMP Framework Data Model API
+ * are used both in XIMP Framework - client communication
+ * and in XIMP Framework - protocol adaptation cummunication.
+ *
+ * @since S60 v3.2
+ */
+
+// Data model IF id's
+// 10xx - ximp related
+// 11xx - presence related
+// 12xx - instant messaging related
+
+// Interface IDs for Presence Data Model API interfaces
+#define PRES_IF_ID_PRESENTITY_GROUP_INFO               1101
+#define PRES_IF_ID_PRESENTITY_GROUP_MEMBER_INFO        1102
+#define PRES_IF_ID_PRESENCE_WATCHER_INFO               1103
+#define PRES_IF_ID_PRESENCE_GRANT_REQUEST_INFO         1104
+#define PRES_IF_ID_PRESENCE_BLOCK_INFO                 1105
+#define PRES_IF_ID_PRESENCE_INFO                       1106
+#define PRES_IF_ID_PRESENCE_INFO_FILTER                1107
+#define PRES_IF_ID_DEVICE_PRESENCE_INFO                1108
+#define PRES_IF_ID_PERSON_PRESENCE_INFO                1109
+#define PRES_IF_ID_SERVICE_PRESENCE_INFO               1110
+#define PRES_IF_ID_PRESENCE_INFO_FIELD_COLLECTION      1111
+#define PRES_IF_ID_PRESENCE_FIELD                      1112
+#define PRES_IF_ID_PRESENCE_INFO_FIELD_VALUE_BINARY    1113
+#define PRES_IF_ID_PRESENCE_INFO_FIELD_VALUE_TEXT      1114
+#define PRES_IF_ID_PRESENCE_INFO_FIELD_VALUE_ENUM      1115
+#define PRES_IF_ID_PRESENCE_BUDDY_INFO                 1116
+#define PRES_IF_ID_PRESENCE_BUDDY_INFO_LIST            1117
+
+#define PRES_IF_ID_PRESENCE_OBJECT_FACTORY     1027
+
+
+#endif // PRESENCEDATAMODELIFIDS_HRH
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_presence_data_model_api/inc/presencegrantrequestinfo.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,114 @@
+/*
+* 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:  Interface for presence grant request info object.
+*
+*/
+
+#ifndef MXIMPFWPRESENCEGRANTREQUESTINFO_H
+#define MXIMPFWPRESENCEGRANTREQUESTINFO_H
+
+#include <e32std.h>
+#include <ximpbase.h>
+#include <presencedatamodelifids.hrh>
+
+
+class MXIMPIdentity;
+
+
+/**
+ * Interface for presence grant request info object.
+ *
+ * Presence grant request info object presents single
+ * presence grant request entry in the presence
+ * grant request list. Presence grant request info
+ * object holds the identity and display name information
+ * for the presence grant request.
+ *
+ * @ingroup presencedatamodelapi
+ * @since S60 v3.2
+ */
+class MPresenceGrantRequestInfo : public MXIMPBase
+    {
+public:
+
+    /** Interface ID for the MPresenceGrantRequestInfo. */
+    enum { KInterfaceId = PRES_IF_ID_PRESENCE_GRANT_REQUEST_INFO };
+
+
+public:
+
+    /**
+     * Public destructor.
+     * Objects can be deleted through this interface.
+     */
+    virtual ~MPresenceGrantRequestInfo() {}
+
+
+
+public:
+
+
+    /**
+     * Returns presence requestor identity value.
+     *
+     * @return The presence requestor identity value.
+     */
+    virtual const MXIMPIdentity& RequestorId() const = 0;
+
+
+
+    /**
+     * Returns presence requestor displayname value.
+     *
+     * @return The presence requestor displayname value.
+     */
+    virtual const TDesC16& RequestorDisplayName() const = 0;
+
+
+
+    /**
+     * Sets presence requestor identity value.
+     *
+     * @param [in] aIdentity
+     *        New presence requestor identity value.
+     *        Ownership of the argument is transfered to
+     *        callee, if method succeeds without a leave.
+     *
+     * @leave KErrNoMemory if failed to allocate memory.
+     * @leave KErrArgument if NULL argument were provided.
+     */
+    virtual void SetRequestorIdL(
+                MXIMPIdentity* aIdentity ) = 0;
+
+
+
+    /**
+     * Sets presence requestor display name value.
+     *
+     * @param [in] aDisplayName
+     *        New display name value.
+     *
+     * @leave KErrNoMemory if failed to allocate memory.
+     */
+    virtual void SetRequestorDisplayNameL(
+                const TDesC16& aDisplayName ) = 0;
+
+
+    };
+
+
+#endif // MXIMPFWPRESENCEGRANTREQUESTINFO_H
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_presence_data_model_api/inc/presenceinfo.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,416 @@
+/*
+* 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:  Interface for presence info object.
+*
+*/
+
+#ifndef MXIMPFWPRESENCEINFO_H
+#define MXIMPFWPRESENCEINFO_H
+
+#include <e32std.h>
+#include <ximpbase.h>
+#include <presencedatamodelifids.hrh>
+
+
+
+/**
+ * Name constants and similar definitions
+ * for presence information components and
+ * presence information fields.
+ *
+ * @ingroup presencedatamodelapi
+ * @since S60 v3.2
+ */
+namespace NPresenceInfo
+    {
+
+    /**
+     * Common type constants for MServicePresenceInfo
+     * objects.
+     *
+     * @ingroup presencedatamodelapi
+     * @since S60 v3.2
+     */
+    namespace NServiceType
+        {
+        _LIT8( KInstantMessaging,   "instant-messaging");
+        _LIT8( KPushToTalk,         "push-to-talk");
+        _LIT8( KVoip,               "voip");
+        _LIT8( KCall,               "call");
+        _LIT8( KSms,                "sms");
+        _LIT8( KMms,                "mms");
+        _LIT8( KEMail,              "e-mail");
+        _LIT8( KGame,               "game");
+        }
+
+
+    /**
+     * Common name constants MPresenceInfoField
+     * objects.
+     *
+     * @ingroup presencedatamodelapi
+     * @since S60 v3.2
+     */
+    namespace NFieldType
+        {
+
+        /**
+         * Field type for "status message" field.
+         *
+         * Status message field contains user written
+         * free text, describing for example his/hers current
+         * presence status. Status message is in unicode format.
+         *
+         * Field storage format: MPresenceInfoFieldValueText
+         */
+        _LIT8( KStatusMessage,      "status-msg");
+
+
+
+        /**
+         * Field type for "avatar" field.
+         *
+         * Avatar field contains user selected image. Image may be
+         * an avatar describing the user or it may be image showing
+         * user current presence status.
+         *
+         * Image is in JPEG or similar format, for what there exists
+         * image codes in the platform. Field contains image binary
+         * content and MIME string describing the content format.
+         *
+         * Field storage format: MPresenceInfoFieldValueBinary
+         */
+        _LIT8( KAvatar,             "avatar");
+
+
+
+        /**
+         * Field type for "availability-text" field.
+         *
+         * Availability text field describes presentity's communication
+         * availability as text. This is useful in case of branded
+         * presence availability, since any text value is possible.
+         *
+         * Field storage format: MPresenceInfoFieldValueText
+         */
+        _LIT8( KAvailability,       "availability");
+        
+
+
+        /**
+         * Field type for "availability" field enumeration value.
+         *
+         * Availability field describes presentitys communication
+         * availability. Possible availability values are
+         * listed in TAvailabilityValues enumeration.
+         *
+         * Field storage format: MPresenceInfoFieldValueEnum
+         */
+        _LIT8( KAvailabilityEnum,       "availability-enum");
+        
+        
+        
+        /**
+         * This means that all field types are accepted.
+         * Field types are status message, avatar and
+         * availability.
+         *
+         */
+        _LIT8( KAcceptAll,      "*");
+        }
+
+
+
+    /**
+     * Common enumerated availability values for "availability"
+     * presence information field.
+     *
+     * @ingroup presencedatamodelapi
+     * @since S60 v3.2
+     */
+    enum TAvailabilityValues
+        {
+
+        /**
+		* Presentity is not available for communication.
+		*/
+        ENotAvailable = 0,
+
+
+        /**
+		* Presentity is currently busy.
+		* Presentity may or may not be available
+		* for for communication.
+		*/
+        EBusy = 1,
+
+
+        /**
+		* Presentity is available for communication.
+		*/
+        EAvailable = 2,
+
+		/**
+		* Presentity appears Offline for communication.
+		*/
+        EHidden = 3,
+
+		/**
+		* Presentity is away.
+		*/
+        EAway = 4,
+
+		/**
+		* Presentity is extended away
+		*/
+        EExtAway = 5,
+        
+        /**
+        * Presentity is on the Phone Call
+        */
+        EOnPhone = 6,
+        
+        /**
+        * Presentity is in Do Not disturb status
+        */
+        EDoNotDisturb = 7,
+                
+        /**
+        * Presentity of received contact request
+        */        
+        EPendingRequest = 8,
+        
+        /**
+        * Presentity of received contact request when offline
+        */
+        EPendingRequestOffline = 9,
+        
+        /**
+        * Presentity is Empty / Not matched
+        */
+        EEmptyStatus = 10,       
+ 
+        /**
+        * Presentity is offline
+        */
+        EOffline = 11,
+   
+        /**
+        * Presentity is Local Pending
+        */
+        ELocalPending = 12,
+        
+        /**
+        * Presentity is offline
+        */
+        ERemotePending = 13
+        
+
+        };
+
+
+    const TInt KValueLengthUnlimited = -1;
+    }
+
+
+
+class MPersonPresenceInfo;
+class MServicePresenceInfo;
+class MDevicePresenceInfo;
+
+
+/**
+ * Interface for presence info object.
+ *
+ *
+ * @todo Interface might be extended with new methods.
+ *
+ * @ingroup presencedatamodelapi
+ * @since S60 v3.2
+ */
+class MPresenceInfo : public MXIMPBase
+    {
+public:
+
+    /** Interface ID for the MPresenceInfo. */
+    enum { KInterfaceId = PRES_IF_ID_PRESENCE_INFO };
+
+
+
+public:
+
+    /**
+     * Public destructor. MPresenceInfo object
+     * can be deleted through this interface.
+     */
+    virtual ~MPresenceInfo() {}
+
+
+public: // Access to person presence
+
+
+    /**
+     * Returns read-only person presence information object.
+     *
+     * Returns the read-only person presence information
+     * object or NULL if person presence information
+     * not available.
+     *
+     * @return Person presence information object or NULL.
+     */
+    virtual const MPersonPresenceInfo* PersonPresence() const = 0;
+    
+    /**
+     * Returns person presence information object.
+     *
+     * Returns the person presence information
+     * object or NULL if person presence information
+     * not available.
+     *
+     * @return Person presence information object or NULL.
+     */
+    virtual MPersonPresenceInfo* PersonPresence() = 0;
+
+
+    /**
+     * Sets person presence information object.
+     *
+     * @param [in] aPersonPresence
+     *        New person presence value.
+     *        Ownership of the argument is transfered to
+     *        callee, if method succeeds without a leave.
+     *
+     * @leave KErrNoMemory if failed to allocate memory.
+     * @leave KErrArgument if NULL argument were provided.
+     */
+    virtual void SetPersonPresenceL(
+                MPersonPresenceInfo* aPersonPresence ) = 0;
+
+
+
+public: // Access to service presence
+
+
+    /**
+     * Returns count of service presence information objects.
+     *
+     * @return Count of service presence information objects.
+     */
+    virtual TInt ServicePresenceCount() const = 0;
+
+
+    /**
+     * Returns a read-only service presence information object.
+     *
+     * @param [in] aIndex
+     *        Zero-based index of the service presence
+     *        information object to return.
+     *
+     * @return Reference to a service presence information
+     *        object at aIndex.
+     */
+    virtual const MServicePresenceInfo& ServicePresenceAt(
+                TInt aIndex ) const = 0;
+
+
+    /**
+     * Looks up a read-only service presence information object,
+     * having matching service type.
+     *
+     * @param [in,out] aServicePresence
+     *        On entry, contains the object from where to start
+     *        the lookup or NULL if lookup should be started from
+     *        the beginning of the set.
+     *        If object given in entry is not found from set,
+     *        lookup is started from the beginning of the set.
+     *        On return, if an matching object is found, this is
+     *        set to point to the found object, else NULL.
+     *        Found object ownership is not returned to caller.
+     *
+     * @param [in] aMatch
+     *        The service type match pattern.
+     *        Match pattern may contain question mark and
+     *        asterisk characters ("?", "*") resepectively to
+     *        match single or multiple characters. Service type
+     *        are handled as folded in pattern matching.
+     */
+    virtual void LookupServicePresenceByServiceType(
+                MServicePresenceInfo*& aServicePresence,
+                const TDesC8& aMatch ) const = 0;
+
+
+    /**
+     * Adds service presence information object.
+     *
+     * @param [in] aServicePresence
+     *        New service presence value.
+     *        Ownership of the argument is transfered to
+     *        callee, if method succeeds without a leave.
+     *
+     * @leave KErrNoMemory if failed to allocate memory.
+     * @leave KErrArgument if NULL argument were provided.
+     */
+    virtual void AddServicePresenceL(
+                MServicePresenceInfo* aServicePresence ) = 0;
+
+
+
+
+public: // Access to device presence
+
+
+    /**
+     * Returns count of device presence information objects.
+     *
+     * @return Count of device presence information objects.
+     */
+    virtual TInt DevicePresenceCount() const = 0;
+
+
+    /**
+     * Returns a read-only device presence information object.
+     *
+     * @param [in] aIndex
+     *        Zero-based index of the device presence
+     *        information object to return.
+     *
+     * @return Reference to a device presence information
+     *         object at aIndex.
+     */
+    virtual const MDevicePresenceInfo& DevicePresenceAt(
+                TInt aIndex ) const = 0;
+
+
+    /**
+     * Adds device presence information object.
+     *
+     * @param [in] aDevicePresence
+     *        New device presence value.
+     *        Ownership of the argument is transfered to
+     *        callee, if method succeeds without a leave.
+     *
+     * @leave KErrNoMemory if failed to allocate memory.
+     * @leave KErrArgument if NULL argument were provided.
+     */
+    virtual void AddDevicePresenceL(
+                MDevicePresenceInfo* aDevicePresence ) = 0;
+
+    };
+
+
+
+#endif //MXIMPFWPRESENCEINFO_H
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_presence_data_model_api/inc/presenceinfofield.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,99 @@
+/*
+* 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:  Interface for presence info field object.
+*
+*/
+
+#ifndef MXIMPFWPRESENCEINFOFIELD_H
+#define MXIMPFWPRESENCEINFOFIELD_H
+
+#include <e32std.h>
+#include <ximpbase.h>
+#include <presencedatamodelifids.hrh>
+
+
+/**
+ * Interface for presence info field object.
+ *
+ *
+ * @todo Interface might be extended with new methods.
+ *
+ * @ingroup presencedatamodelapi
+ * @since S60 v3.2
+ */
+class MPresenceInfoField : public MXIMPBase
+    {
+public:
+
+    /** Interface ID for the MPresenceInfoField. */
+    enum { KInterfaceId = PRES_IF_ID_PRESENCE_FIELD };
+
+
+public:
+
+    /**
+     * Public destructor. MPresenceInfoField object
+     * can be deleted through this interface.
+     */
+    virtual ~MPresenceInfoField() {}
+
+
+public:
+
+
+    /**
+     * Returns this presence information field's name.
+     *
+     * @return Presence information field's name.
+     */
+    virtual const TDesC8& FieldType() const =0;
+    
+    /**
+     * Set this presence information field's name.
+     * @param aFieldType The new field type
+     */
+    virtual void SetFieldTypeL( const TDesC8& aFieldType ) =0;
+
+    /**
+     * Returns read-only reference to this presence
+     * information field's value storage.
+     *
+     * @return Presence information field's value storage.
+     */
+    virtual const MXIMPBase& FieldValue() const =0;
+
+
+    /**
+     * Returns modifiable reference to this presence
+     * information field's value storage.
+     *
+     * @return Presence information field's value storage.
+     */
+    virtual MXIMPBase& FieldValue() =0;
+    
+    /**
+     * Set the field value object for this field's value storage.
+     * Ownership transferred.
+     * @param aFieldValue The field value object
+     */
+    virtual void SetFieldValue( MXIMPBase* aFieldValue ) = 0;
+
+    };
+
+
+
+#endif //MXIMPFWPRESENCEINFOFIELD_H
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_presence_data_model_api/inc/presenceinfofieldcollection.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,144 @@
+/*
+* 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:  Interface for presence field collection object.
+*
+*/
+
+#ifndef MXIMPFWPRESENCEINFOFIELDCOLLECTION_H
+#define MXIMPFWPRESENCEINFOFIELDCOLLECTION_H
+
+#include <e32std.h>
+#include <ximpbase.h>
+#include <presencedatamodelifids.hrh>
+
+
+class MPresenceInfoField;
+
+/**
+ * Interface for presence field collection object.
+ *
+ *
+ * @todo Interface might be extended with new methods.
+ *
+ * @ingroup presencedatamodelapi
+ * @since S60 v3.2
+ */
+class MPresenceInfoFieldCollection : public MXIMPBase
+    {
+public:
+
+    /** Interface ID for the MPresenceInfoFieldCollection. */
+    enum { KInterfaceId = PRES_IF_ID_PRESENCE_INFO_FIELD_COLLECTION };
+
+
+public:
+
+    /**
+     * Public destructor. MPresenceInfoFieldCollection object
+     * can be deleted through this interface.
+     */
+    virtual ~MPresenceInfoFieldCollection() {}
+
+
+public:
+
+
+    /**
+     * Returns the count of presence information
+     * fields in this collection.
+     *
+     * @return Count of presence information fields
+     *         in this collection.
+     */
+    virtual TInt FieldCount() const = 0;
+
+
+    /**
+     * Returns a read-only presence information
+     * field from this collection.
+     *
+     * @param [in] aIndex
+     *        Zero-based index of the field to return.
+     *
+     * @return Reference to a field at aIndex.
+     *         Returned reference is guaranteed to remain valid
+     *         only until next field is retrieved.
+     */
+    virtual const MPresenceInfoField& FieldAt(
+                TInt aIndex ) const = 0;
+
+
+    /**
+     * Looks up the field having given name.
+     *
+     * @param [in,out] aPresenceInfoField
+     *        On entry, contains the field object from where to start
+     *        the lookup or NULL if lookup should be started from
+     *        beginning of the collection. If field object given in
+     *        entry is not a member of collection, lookup is started
+     *        from beginning.
+     *        On return, if an matching field object is found, this is
+     *        set to point to the found field, else NULL.
+     *        Found field object ownership is not returned to caller.
+     *
+     * @param [in] aMatch
+     *        Presence information field type match pattern.
+     *        Match pattern may contain question mark and asterisk
+     *        characters ("?", "*") resepectively to match single
+     *        or multiple characters. Field type values are
+     *        folded in pattern matching.
+     */
+    virtual void LookupFieldByFieldType(
+                MPresenceInfoField*& aPresenceInfoField,
+                const TDesC8& aMatch ) const = 0;
+                
+    
+    /**
+     * Looks up and delete the field having given name.
+     *
+     * @param [in] aMatch
+     *        Presence information field type match pattern.
+     *        Match pattern may contain question mark and asterisk
+     *        characters ("?", "*") resepectively to match single
+     *        or multiple characters. Field type values are
+     *        folded in pattern matching.
+     * @return KErrNone if deletion successful otherwise KErrNotFound
+     */
+    virtual TInt DeleteFieldByFieldType(const TDesC8& aMatch ) = 0;
+
+
+    /**
+     * Adds new presence information field to the set.
+     * If there exists already a presence information field
+     * object in the set with equal field type, existing
+     * object is deleted and replaced with given one.
+     *
+     * @param [in] aPresenceInfoField
+     *        New new presence information field object
+     *        to add to set. Takes object ownership in success.
+     *
+     * @leave KErrNoMemory if failed to allocate memory.
+     * @leave KErrArgument if NULL argument were provided.
+     */
+    virtual void AddOrReplaceFieldL(
+                MPresenceInfoField* aPresenceInfoField ) = 0;
+
+    };
+
+
+
+#endif //MXIMPFWPRESENCEINFOFIELDCOLLECTION_H
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_presence_data_model_api/inc/presenceinfofieldvaluebinary.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,114 @@
+/*
+* 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:  Interface for binary presence info field value object.
+*
+*/
+
+#ifndef MXIMPFWPRESENCEINFOFIELDVALUEBINARY_H
+#define MXIMPFWPRESENCEINFOFIELDVALUEBINARY_H
+
+#include <e32std.h>
+#include <ximpbase.h>
+#include <presencedatamodelifids.hrh>
+
+
+
+/**
+ * Interface for binary presence info field value object.
+ *
+ * Interface for presence information field value having
+ * binary format. Contained binary value might be
+ * image or similar data object.
+ *
+ * @ingroup presencedatamodelapi
+ * @since S60 v3.2
+ */
+class MPresenceInfoFieldValueBinary : public MXIMPBase
+    {
+public:
+
+    /** Interface ID for the MPresenceInfoFieldValueBinary. */
+    enum { KInterfaceId = PRES_IF_ID_PRESENCE_INFO_FIELD_VALUE_BINARY };
+
+
+
+public:
+
+    /**
+     * Public destructor. MPresenceInfoFieldValueBinary object
+     * can be deleted through this interface.
+     */
+    virtual ~MPresenceInfoFieldValueBinary() {}
+
+
+public:
+
+
+    /**
+     * Returns maximum length of the field value.
+     *
+     * @return Maximum length of the field value or
+     *         KXIMPFieldValueLengthUnlimited if the value
+     *         length is limited only by the available resources.
+     */
+    virtual TInt MaxLength() const = 0;
+
+
+    /**
+     * Returns the binary value.
+     *
+     * @return The binary value.
+     */
+    virtual TPtrC8 BinaryValue() const = 0;
+
+
+    /**
+     * Returns the mime type of the contained value.
+     *
+     * @return The mime type.
+     */
+    virtual const TPtrC8 MimeType() const = 0;
+
+
+    /**
+     * Sets the binary value.
+     *
+     * @param [in] aValue
+     *        New binary value to set.
+     *
+     * @leave KErrOverflow if value length exceeds field specific maxlength.
+     * @leave KErrNoMemory if failed to allocate memory.
+     */
+    virtual void SetBinaryValueL(
+                const TDesC8& aValue ) = 0;
+
+
+    /**
+     * Sets the mime type of the contained object.
+     *
+     * @param [in] aMimeType
+     *        New mime type value.
+     *
+     * @leave KErrNoMemory if failed to allocate memory.
+     */
+    virtual void SetMimeTypeL(
+                const TDesC8& aMimeType ) = 0;
+
+
+    };
+
+#endif //MXIMPFWPRESENCEINFOFIELDVALUEBINARY_H
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_presence_data_model_api/inc/presenceinfofieldvalueenum.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,99 @@
+/*
+* 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:  Interface for enum presence info field value object.
+*
+*/
+
+#ifndef MXIMPFWPRESENCEINFOFIELDVALUEENUM_H
+#define MXIMPFWPRESENCEINFOFIELDVALUEENUM_H
+
+#include <e32std.h>
+#include <ximpbase.h>
+#include <presencedatamodelifids.hrh>
+
+
+/**
+ * Interface for presence information field value having
+ * an enumerated integer value.
+ *
+ * @ingroup presencedatamodelapi
+ * @since S60 v3.2
+ */
+class MPresenceInfoFieldValueEnum : public MXIMPBase
+    {
+public:
+
+    /** Interface ID for the MPresenceInfoFieldValueEnum. */
+    enum { KInterfaceId = PRES_IF_ID_PRESENCE_INFO_FIELD_VALUE_ENUM };
+
+public:
+
+    /**
+     * Public destructor. MPresenceInfoFieldValueEnum object
+     * can be deleted through this interface.
+     */
+    virtual ~MPresenceInfoFieldValueEnum() {}
+
+
+public:
+
+    /**
+     * Returns minimum value of enumeration.
+     *
+     * @return Minimum allowed value for enumeration
+     */
+    virtual TInt MinValue() const = 0;
+
+
+    /**
+     * Returns maximum value of enumeration.
+     *
+     * @return Maximum allowed value for enumeration
+     */
+    virtual TInt MaxValue() const = 0;
+
+
+    /**
+     * Returns Value of enumeration.
+     *
+     * @return Value of enumeration
+     */
+    virtual TInt Value() const = 0;
+
+
+    /**
+     * Set the value of the enumeration.
+     *
+     * @param [in] aValue
+     *             New enum value to set
+     *
+     * @leave KErrUnderFlow If the enum value is less than the allowed minimum
+     * @leave KErrOverFlow If the enum value is more than the allowed maximum
+     */
+    virtual void SetValueL( TInt aValue ) = 0;
+
+    /**
+     * Set the minimum and maximum allowed by the enumeration.
+     * The value range set is inclusive, that is [aMin..aMax].
+     * @param aMin The minimum
+     * @param aMax The maximum
+     */
+    virtual void SetLimits( TInt aMin, TInt aMax ) = 0;
+
+    };
+
+#endif //MXIMPFWPRESENCEINFOFIELDVALUEENUM_H
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_presence_data_model_api/inc/presenceinfofieldvaluetext.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,92 @@
+/*
+* 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:  Interface for textual presence info field value object.
+*
+*/
+
+#ifndef MXIMPFWPRESENCEINFOFIELDVALUETEXT_H
+#define MXIMPFWPRESENCEINFOFIELDVALUETEXT_H
+
+#include <e32std.h>
+#include <ximpbase.h>
+#include <presencedatamodelifids.hrh>
+
+
+
+/**
+ * Interface for textual presence info field value object..
+ *
+ * Interface for presence information field value having
+ * textual format. Contained text can be rendered to
+ * end user as is.
+ *
+ * @ingroup presencedatamodelapi
+ * @since S60 v3.2
+ */
+class MPresenceInfoFieldValueText : public MXIMPBase
+    {
+public:
+
+    /** Interface ID for the MPresenceInfoFieldValueText. */
+    enum { KInterfaceId = PRES_IF_ID_PRESENCE_INFO_FIELD_VALUE_TEXT };
+
+
+public:
+
+    /**
+     * Public destructor. MPresenceInfoFieldValueText object
+     * can be deleted through this interface.
+     */
+    virtual ~MPresenceInfoFieldValueText() {}
+
+
+public:
+
+    /**
+     * Returns maximum length of the field value.
+     *
+     * @return Maximum length of the field value or
+     *         KXIMPFieldValueLengthUnlimited if the value
+     *         length is limited only by the available resources.
+     */
+    virtual TInt MaxLength() const = 0;
+
+
+    /**
+     * Returns the textual value.
+     *
+     * @return The textual value.
+     */
+    virtual TPtrC TextValue() const =0;
+
+
+    /**
+     * Sets the textual data.
+     *
+     * @param [in] aValue
+     *        New textual value to set.
+     *
+     * @leave KErrOverflow if value length exceeds field specific maxlength.
+     * @leave KErrNoMemory if failed to allocate memory.
+     */
+    virtual void SetTextValueL(
+                const TDesC& aValue ) =0;
+
+    };
+
+
+#endif //MXIMPFWPRESENCEINFOFIELDVALUETEXT_H
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_presence_data_model_api/inc/presenceinfofilter.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,122 @@
+/*
+* 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:  Interface for presence info filter object.
+*
+*/
+
+#ifndef XIMPFWPRESENCEINFOFILTER_H
+#define XIMPFWPRESENCEINFOFILTER_H
+
+#include <e32std.h>
+#include <ximpbase.h>
+#include <presencedatamodelifids.hrh>
+
+
+/**
+ * Interface for presence info filter object.
+ *
+ * Presence information filter is used to define requested
+ * presence information in presence subscriptions and
+ * granted presence information in presence grants.
+ *
+ * Filtering is "inclusive": data is passed through if it matches the given
+ * filtering criteria. Data with keys not matching to the filtering
+ * criteria will be skipped by the filter.
+ *
+ * The Accept*FilterL methods can be called many times, to accept multiple
+ * distinct fields. Wildcards "*" and "?" are allowed within the strings.
+ *
+ * @todo Interface will be extended.
+ *
+ * @ingroup presencedatamodelapi
+ * @since S60 v3.2
+ */
+class MPresenceInfoFilter : public MXIMPBase
+    {
+public:
+
+    /** Interface ID for the MPresenceInfoFilter. */
+    enum { KInterfaceId = PRES_IF_ID_PRESENCE_INFO_FILTER };
+
+public:
+
+    /**
+     * Public destructor. MPresenceInfoFilter object
+     * can be deleted through this interface.
+     */
+    virtual ~MPresenceInfoFilter() {}
+
+public:
+
+    /**
+     * Set filter for a field in the person presence component.
+     * Wildcards "*" and "?" are allowed.
+     * @param aFieldName The field name within the person info
+     */
+    virtual void AcceptPersonFilterL( const TDesC8& aFieldName ) = 0;
+
+    /**
+     * Set filter for the service presence component. 
+     * Wildcards "*" and "?" are allowed.
+     * @param aServiceName The service type
+     * @param aFieldName The field name within the given service info
+     */
+    virtual void AcceptServiceFilterL( 
+            const TDesC8& aServiceName,
+            const TDesC8& aFieldName ) = 0;
+  
+    /**
+     * Set filter for the device presence component.
+     * Wildcards "*" and "?" are allowed.
+     * @param aDeviceName The device name
+     * @param aFieldName The field name within the given device info
+     */
+    virtual void AcceptDeviceFilterL( 
+            const TDesC8& aDeviceName,
+            const TDesC8& aFieldName ) = 0;
+
+    /**
+     * Try to match given field type against the filters
+     * for the person presence component.
+     * @param aFieldName The field to check
+     * @return ETrue if the given field is accepted
+     */
+    virtual TBool MatchPersonFilter( const TDesC8& aFieldName ) const = 0;
+    
+    /**
+     * Find out if the filter accepts the field in a given service info.
+     * @param aServiceName The name of the service info to check
+     * @param aFieldName The field name to check
+     * @return ETrue if the given field within the named info is accepted
+     */
+    virtual TBool MatchServiceFilterL( 
+            const TDesC8& aServiceName,
+            const TDesC8& aFieldName ) const = 0;
+
+    /**
+     * Find out if the filter accepts the field in a given device info.
+     * @param aDeviceName The name of the device info to check
+     * @param aFieldName The field to check
+     * @return ETrue if the given field within the named info is accepted
+     */
+    virtual TBool MatchDeviceFilterL( 
+            const TDesC8& aDeviceName,
+            const TDesC8& aFieldName ) const = 0;
+    
+    };
+
+#endif //XIMPFWPRESENCEINFOFILTER_H
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_presence_data_model_api/inc/presenceobjectfactory.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,221 @@
+/*
+* 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:  Interface for XIMP Framework object factory.
+*
+*/
+
+#ifndef MPRESENCEOBJECTFACTORY_H
+#define MPRESENCEOBJECTFACTORY_H
+
+#include <e32std.h>
+#include <ximpbase.h>
+#include <presencedatamodelifids.hrh>
+
+class MPresenceInfo;
+class MPresenceInfoFilter;
+class MPresentityGroupInfo;
+class MPresenceWatcherInfo;
+class MPresenceGrantRequestInfo;
+class MPresentityGroupMemberInfo;
+class MServicePresenceInfo;
+class MPersonPresenceInfo;
+class MDevicePresenceInfo;
+class MPresenceInfoField;
+class MPresenceInfoFieldValueEnum;
+class MPresenceInfoFieldValueText;
+class MPresenceInfoFieldValueBinary;
+class MPresenceBlockInfo;
+
+/**
+ * Interface for XIMP Framework presence object factory.
+ *
+ * Presence object factory is used to instantiate
+ * data objects declared in Data Model API.
+ *
+ * MPresenceObjectFactory interface can be obtained from
+ * MPresenceContext or MXIMPProtocolConnectionHost
+ * interfaces.
+ *
+ * @ingroup presencedatamodelapi
+ * @since S60 v3.2
+ */
+class MPresenceObjectFactory : public MXIMPBase
+    {
+public:
+
+    /** Interface ID for the MPresenceObjectFactory. */
+    enum { KInterfaceId = PRES_IF_ID_PRESENCE_OBJECT_FACTORY };
+
+
+protected:
+
+    /**
+     * Protected destructor.
+     * Object instancies can't be deleted via this interface.
+     */
+    virtual ~MPresenceObjectFactory() {}
+
+
+
+
+public: // Group and similar info object types
+
+
+    /**
+     * Instantiates new presentity group info object.
+     *
+     * @return New group info object instance.
+     *         Object ownership is returned to caller.
+     *
+     * @leave KErrNoMemory if failed to allocate memory.
+     */
+    virtual MPresentityGroupInfo* NewPresentityGroupInfoLC() = 0;
+
+
+    /**
+     * Instantiates new presentity group member info object.
+     *
+     * @return New group member info object instance.
+     *         Object ownership is returned to caller.
+     *
+     * @leave KErrNoMemory if failed to allocate memory.
+     */
+    virtual MPresentityGroupMemberInfo* NewPresentityGroupMemberInfoLC() = 0;
+
+
+    /**
+     * Instantiates new presence watcher info object.
+     *
+     * @return New watcher info object instance.
+     *         Object ownership is returned to caller.
+     *
+     * @leave KErrNoMemory if failed to allocate memory.
+     */
+    virtual MPresenceWatcherInfo* NewPresenceWatcherInfoLC() = 0;
+
+
+    /**
+     * Instantiates new presence grant request info object.
+     *
+     * @return New grant request info object instance.
+     *         Object ownership is returned to caller.
+     *
+     * @leave KErrNoMemory if failed to allocate memory.
+     */
+    virtual MPresenceGrantRequestInfo* NewPresenceGrantRequestInfoLC() = 0;
+
+
+
+public: // Presence information object types
+
+
+    /**
+     * Instantiates new presence info object.
+     *
+     * @return New presence info instance. Object ownership
+     *         is returned to caller.
+     *
+     * @leave KErrNoMemory if failed to allocate memory.
+     */
+    virtual MPresenceInfo* NewPresenceInfoLC() = 0;
+
+
+    /**
+     * Instantiates new presence info filter object.
+     *
+     * @return New presence info filter instance. Object ownership
+     *         is returned to caller.
+     *
+     * @leave KErrNoMemory if failed to allocate memory.
+     */
+    virtual MPresenceInfoFilter* NewPresenceInfoFilterLC() = 0;
+
+    /**
+     * Instantiates new presence person info object.
+     *
+     * @return New presence person info instance. Object ownership
+     *         is returned to caller.
+     *
+     * @leave KErrNoMemory if failed to allocate memory.
+     */
+    virtual MPersonPresenceInfo* NewPersonPresenceInfoLC() = 0;
+
+    /**
+     * Instantiates new presence service info object.
+     *
+     * @return New presence service info instance. Object ownership
+     *         is returned to caller.
+     *
+     * @leave KErrNoMemory if failed to allocate memory.
+     */
+    virtual MServicePresenceInfo* NewServicePresenceInfoLC() = 0;
+
+    /**
+     * Instantiates new presence device info object.
+     *
+     * @return New presence device info instance. Object ownership
+     *         is returned to caller.
+     *
+     * @leave KErrNoMemory if failed to allocate memory.
+     */
+    virtual MDevicePresenceInfo* NewDevicePresenceInfoLC() = 0;
+
+    /**
+     * Instantiates new info field object.
+     *
+     * @return New info field instance. Object ownership
+     *         is returned to caller.
+     *
+     * @leave KErrNoMemory if failed to allocate memory.
+     */
+    virtual MPresenceInfoField* NewInfoFieldLC() = 0;
+
+    /**
+     * Instantiates new enumerated info field value object.
+     *
+     * @return New info field value instance. Object ownership
+     *         is returned to caller.
+     *
+     * @leave KErrNoMemory if failed to allocate memory.
+     */
+    virtual MPresenceInfoFieldValueEnum* NewEnumInfoFieldLC() = 0;
+
+    /**
+     * Instantiates new textual info field value object.
+     *
+     * @return New info field value instance. Object ownership
+     *         is returned to caller.
+     *
+     * @leave KErrNoMemory if failed to allocate memory.
+     */
+    virtual MPresenceInfoFieldValueText* NewTextInfoFieldLC() = 0;
+
+    /**
+     * Instantiates new binary info field value object.
+     *
+     * @return New info field value instance. Object ownership
+     *         is returned to caller.
+     *
+     * @leave KErrNoMemory if failed to allocate memory.
+     */
+    virtual MPresenceInfoFieldValueBinary* NewBinaryInfoFieldLC() = 0;
+    virtual MPresenceBlockInfo* NewPresenceBlockInfoLC() = 0;
+    };
+
+
+
+#endif // MPRESENCEOBJECTFACTORY_H
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_presence_data_model_api/inc/presencewatcherinfo.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,143 @@
+/*
+* 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:  Interface for presence watcher info object.
+*
+*/
+
+#ifndef MXIMPFWPRESENCEWATCHERINFO_H
+#define MXIMPFWPRESENCEWATCHERINFO_H
+
+#include <e32std.h>
+#include <ximpbase.h>
+#include <presencedatamodelifids.hrh>
+
+
+class MXIMPIdentity;
+
+
+/**
+ * Interface for presence watcher info object.
+ *
+ * Presence watcher info object presents single presence watcher
+ * entry in the presence watcher list. Presence watcher info
+ * object holds the identity, display name and watcher type
+ * information for the presence watcher.
+ *
+ * @ingroup presencedatamodelapi
+ * @since S60 v3.2
+ */
+class MPresenceWatcherInfo : public MXIMPBase
+    {
+public:
+
+    /** Interface ID for the MPresenceWatcherInfo. */
+    enum { KInterfaceId = PRES_IF_ID_PRESENCE_WATCHER_INFO };
+
+
+    /** Presence watcher types. */
+    enum TWatcherType
+        {
+        /** Presence watcher type unknown. */
+        EUnknown,
+
+        /** Presence watcher is currently subscribing user presence. */
+        EPresenceSubscriber
+        };
+
+
+public:
+
+    /**
+     * Public destructor.
+     * Objects can be deleted through this interface.
+     */
+    virtual ~MPresenceWatcherInfo() {}
+
+
+
+public:
+
+
+    /**
+     * Returns presence watcher identity value.
+     *
+     * @return The presence watcher identity value.
+     */
+    virtual const MXIMPIdentity& WatcherId() const = 0;
+
+
+
+    /**
+     * Returns presence watcher displayname value.
+     *
+     * @return The presence watcher displayname value.
+     */
+    virtual const TDesC16& WatcherDisplayName() const = 0;
+
+
+
+    /**
+     * Returns presence watcher type value.
+     *
+     * @return The presence watcher type value.
+     */
+    virtual TWatcherType WatcherType() const = 0;
+
+
+
+    /**
+     * Sets watcher identity value.
+     *
+     * @param [in] aIdentity
+     *        New watcher identity value.
+     *        Ownership of the argument is transfered to
+     *        callee, if method succeeds without a leave.
+     *
+     * @leave KErrNoMemory if failed to allocate memory.
+     * @leave KErrArgument if NULL argument were provided.
+     */
+    virtual void SetWatcherIdL(
+                MXIMPIdentity* aIdentity ) = 0;
+
+
+    /**
+     * Sets presence watcher displayname value.
+     *
+     * @param [in] aDisplayName
+     *        New display name value.
+     *
+     * @leave KErrNoMemory if failed to allocate memory.
+     */
+    virtual void SetWatcherDisplayNameL(
+                const TDesC16& aDisplayName ) = 0;
+
+
+    /**
+     * Sets presence watcher type value.
+     *
+     * @param [in] aType
+     *        New presence watcher type value.
+     *
+     * @leave KErrNoMemory if failed to allocate memory.
+     */
+    virtual void SetWatcherTypeL(
+                TWatcherType aType ) = 0;
+
+    };
+
+
+#endif // MXIMPFWPRESENCEWATCHERINFO_H
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_presence_data_model_api/inc/presentitygroupinfo.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,111 @@
+/*
+* 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:  Interface for presentity group info object.
+*
+*/
+
+#ifndef MXIMPFWPRESENTITYGROUPINFO_H
+#define MXIMPFWPRESENTITYGROUPINFO_H
+
+#include <e32std.h>
+#include <ximpbase.h>
+#include <presencedatamodelifids.hrh>
+
+
+class MXIMPIdentity;
+
+
+/**
+ * Interface for presentity group info object.
+ *
+ * Presentity group info object presents single presentity group
+ * in the presentity group list. Presentity group info object
+ * holds the identity and display name for the presentity group.
+ *
+ * @ingroup presencedatamodelapi
+ * @since S60 v3.2
+ */
+class MPresentityGroupInfo : public MXIMPBase
+    {
+public:
+
+    /** Interface ID for the MPresentityGroupInfo. */
+    enum { KInterfaceId = PRES_IF_ID_PRESENTITY_GROUP_INFO };
+
+
+public:
+
+
+    /**
+     * Public destructor.
+     * Objects can be deleted through this interface.
+     */
+    virtual ~MPresentityGroupInfo() {}
+
+
+
+public:
+
+    /**
+     * Returns group identity value.
+     *
+     * @return The group identity value.
+     */
+    virtual const MXIMPIdentity& GroupId() const = 0;
+
+
+
+    /**
+     * Returns group display name value.
+     *
+     * @return The group display name value.
+     */
+    virtual const TDesC16& GroupDisplayName() const = 0;
+
+
+
+    /**
+     * Sets group identity value.
+     *
+     * @param [in] aIdentity
+     *        New group identity value.
+     *        Ownership of the argument is transfered to
+     *        callee, if method succeeds without a leave.
+     *
+     * @leave KErrNoMemory if failed to allocate memory.
+     * @leave KErrArgument if NULL argument were provided.
+     */
+    virtual void SetGroupIdL(
+                MXIMPIdentity* aIdentity ) = 0;
+
+
+
+    /**
+     * Sets group display name value.
+     *
+     * @param [in] aDisplayName
+     *        New display name value.
+     *
+     * @leave KErrNoMemory if failed to allocate memory.
+     */
+    virtual void SetGroupDisplayNameL(
+                const TDesC16& aDisplayName ) = 0;
+
+    };
+
+
+#endif // MXIMPFWPRESENTITYGROUPINFO_H
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_presence_data_model_api/inc/presentitygroupmemberinfo.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,111 @@
+/*
+* 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:  Interface for presentity group member info object.
+*
+*/
+
+#ifndef MXIMPFWPRESENTITYGROUPMEMBERINFO_H
+#define MXIMPFWPRESENTITYGROUPMEMBERINFO_H
+
+#include <e32std.h>
+#include <ximpbase.h>
+#include <presencedatamodelifids.hrh>
+
+
+class MXIMPIdentity;
+
+
+/**
+ * Interface for presentity group member info object.
+ *
+ * PresentityGroupMemberInfo presents single
+ * presentity group member. Object holds the identity
+ * and display name for the presentity group member.
+ *
+ * @ingroup presencedatamodelapi
+ * @since S60 v3.2
+ */
+class MPresentityGroupMemberInfo : public MXIMPBase
+    {
+public:
+
+    /** Interface ID for the MPresentityGroupMemberInfo. */
+    enum { KInterfaceId = PRES_IF_ID_PRESENTITY_GROUP_MEMBER_INFO };
+
+
+public:
+
+
+    /**
+     * Public destructor.
+     * Objects can be deleted through this interface.
+     */
+    virtual ~MPresentityGroupMemberInfo() {}
+
+
+
+public:
+
+
+    /**
+     * Returns group member identity value.
+     *
+     * @return The group member identity value.
+     */
+    virtual const MXIMPIdentity& GroupMemberId() const = 0;
+
+
+
+    /**
+     * Returns group member display name value.
+     *
+     * @return The group member display name value.
+     */
+    virtual const TDesC16& GroupMemberDisplayName() const = 0;
+
+
+
+    /**
+     * Sets group member identity value.
+     *
+     * @param [in] aIdentity
+     *        New group member identity value.
+     *        Ownership of the argument is transfered to
+     *        callee, if method succeeds without a leave.
+     *
+     * @leave KErrNoMemory if failed to allocate memory.
+     * @leave KErrArgument if NULL argument were provided.
+     */
+    virtual void SetGroupMemberIdL(
+                MXIMPIdentity* aIdentity ) = 0;
+
+
+    /**
+     * Sets group member display name value.
+     *
+     * @param [in] aDisplayName
+     *        New display name value.
+     *
+     * @leave KErrNoMemory if failed to allocate memory.
+     */
+    virtual void SetGroupMemberDisplayNameL(
+                const TDesC16& aDisplayName ) = 0;
+
+    };
+
+
+#endif // MXIMPFWPRESENTITYGROUPMEMBERINFO_H
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_presence_data_model_api/inc/servicepresenceinfo.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,110 @@
+/*
+* 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:  Interface for service presence info object.
+*
+*/
+
+#ifndef MXIMPFWSERVICEPRESENCEINFO_H
+#define MXIMPFWSERVICEPRESENCEINFO_H
+
+#include <e32std.h>
+#include <ximpbase.h>
+#include <presencedatamodelifids.hrh>
+
+class MXIMPIdentity;
+class MPresenceInfoFieldCollection;
+
+
+/**
+ * Interface for service presence info object.
+ *
+ *
+ * @todo Interface might be extended with new methods.
+ *
+ * @ingroup presencedatamodelapi
+ * @since S60 v3.2
+ */
+class MServicePresenceInfo : public MXIMPBase
+    {
+public:
+
+    /** Interface ID for the MServicePresenceInfo. */
+    enum { KInterfaceId = PRES_IF_ID_SERVICE_PRESENCE_INFO };
+
+
+public:
+
+    /**
+     * Public destructor. MServicePresenceInfo object
+     * can be deleted through this interface.
+     */
+    virtual ~MServicePresenceInfo() {}
+
+
+public:
+
+
+    /**
+     * Returns service type value.
+     *
+     * Returns string identifying type of service
+     * for which this object is containing
+     * presence information.
+     *
+     * Service type is on of the well known strings
+     * listed in NPresenceInfo::NServiceType
+     * namespace.
+     *
+     * @return Service type value.
+     */
+    virtual const TPtrC8 ServiceType() const = 0;
+    
+    /**
+     * Set service type value.
+     *
+     * Service type is on of the well known strings
+     * listed in NPresenceInfo::NServiceType
+     * namespace.
+     *
+     * @return Service type value.
+     * @leave KErrArgument if the given string is not in NPresenceInfo::NServiceType
+     * @leave KErrNoMemory if failed to allocate memory
+     */
+    virtual void SetServiceTypeL( const TDesC8& aServiceType ) = 0;
+
+    /**
+     * Returns read-only reference to presence information
+     * field collection.
+     *
+     * @return Presence information field collection.
+     */
+    virtual const MPresenceInfoFieldCollection& Fields() const = 0;
+
+
+    /**
+     * Returns modifiable reference to presence
+     * information field collection.
+     *
+     * @return Presence information field collection.
+     */
+    virtual MPresenceInfoFieldCollection& Fields() = 0;
+
+
+    };
+
+
+#endif //MXIMPFWSERVICEPRESENCEINFO_H
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_presence_data_model_api/ximp_presence_data_model_api.metaxml	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,23 @@
+<?xml version="1.0" ?>
+<api id="183ce72f8849e807a5b9bc8ce4dbc92f" dataversion="1.0">
+  <name>XIMP Presence Data Model API</name>
+  <description>Contains protocol agnostic interfaces for presence, presence contact groups and presence authorization related data items. API provides also a set of generic presence attributes.</description>
+  <type>c++</type>
+  <subsystem>ximpfw</subsystem>
+  <libs><lib name="presencecacheecomhook.lib"/>
+<lib name="presencedatamodel.lib"/>
+<lib name="presencedatamodelhook.lib"/>
+<lib name="presenceecomhook.lib"/>
+<lib name="presencemanager.lib"/>
+<lib name="presenceoperation.lib"/>
+<lib name="presencecacheclient.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/imsrv_plat/ximp_presence_management_api/group/bld.inf	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  File that exports the files belonging to 
+:                XIMP Presence Management API
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+../inc/presenceblocklistevent.h     MW_LAYER_PLATFORM_EXPORT_PATH(presenceblocklistevent.h)
+../inc/presencemanagementifids.hrh     MW_LAYER_PLATFORM_EXPORT_PATH(presencemanagementifids.hrh)
+../inc/presencefeatures.inl     MW_LAYER_PLATFORM_EXPORT_PATH(presencefeatures.inl)
+../inc/presencewatching.h     MW_LAYER_PLATFORM_EXPORT_PATH(presencewatching.h)
+../inc/presencepublishing.h     MW_LAYER_PLATFORM_EXPORT_PATH(presencepublishing.h)
+../inc/presenceauthorization.h     MW_LAYER_PLATFORM_EXPORT_PATH(presenceauthorization.h)
+../inc/presencewatcherlistevent.h     MW_LAYER_PLATFORM_EXPORT_PATH(presencewatcherlistevent.h)
+../inc/presentitygrouplistevent.h     MW_LAYER_PLATFORM_EXPORT_PATH(presentitygrouplistevent.h)
+../inc/presentitygroups.h     MW_LAYER_PLATFORM_EXPORT_PATH(presentitygroups.h)
+../inc/presencefeatures.h     MW_LAYER_PLATFORM_EXPORT_PATH(presencefeatures.h)
+../inc/presentitypresenceevent.h     MW_LAYER_PLATFORM_EXPORT_PATH(presentitypresenceevent.h)
+../inc/ownpresenceevent.h     MW_LAYER_PLATFORM_EXPORT_PATH(ownpresenceevent.h)
+../inc/presencegrantrequestlistevent.h     MW_LAYER_PLATFORM_EXPORT_PATH(presencegrantrequestlistevent.h)
+../inc/presentitygroupcontentevent.h     MW_LAYER_PLATFORM_EXPORT_PATH(presentitygroupcontentevent.h)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_presence_management_api/inc/ownpresenceevent.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,101 @@
+/*
+* 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:  Event interface for subscribed own presence information.
+*
+*/
+
+#ifndef MXIMPFWOWNPRESENCEEVENT_H
+#define MXIMPFWOWNPRESENCEEVENT_H
+
+#include <e32std.h>
+#include <ximpbase.h>
+#include <presencemanagementifids.hrh>
+
+
+class MXIMPIdentity;
+class MPresenceInfo;
+class MXIMPDataSubscriptionState;
+
+
+
+/**
+ * Event interface for subscribed own presence information.
+ *
+ * This interface is implemented by the XIMP Framework and
+ * event object is signalled to registered client observers
+ * through MXIMPContextObserver observer interface.
+ * This event notifies clients about changes in subscribed
+ * own presence information.
+ *
+ * Clients subscribe for this event with
+ * MPresencePublishing::SubscribeOwnPresenceL().
+ *
+ * XIMP Framework signals this event when:
+ * - New subscribed data is received from protocol.
+ * - Data item data subscription status is updated by
+ *   protocol adaptation.
+ * - When client unsubscribes the data item.
+ * - XIMP Framework generates initial data notification
+ *   to client automatically after clients subscription,
+ *   when the initial data comes available from protocol.
+ *
+ * @ingroup ximppresmanagementapievents
+ * @since S60 v3.2
+ */
+class MOwnPresenceEvent : public MXIMPBase
+    {
+public:
+    /** Interface ID for the MOwnPresenceEvent. */
+    enum { KInterfaceId = PRES_IF_ID_OWN_PRESENCE_EVENT };
+
+
+protected:
+
+    /**
+     * Protected destructor.
+     * Object instancies can't be deleted via this interface.
+     */
+    virtual ~MOwnPresenceEvent() {}
+
+
+public:
+
+
+    /**
+     * Returns presence info object holding
+     * the subscribed user own presence information.
+     *
+     * @return The subscribed user own presence info.
+     *         Object ownership is not returned.
+     */
+    virtual const MPresenceInfo& SubscribedPresence() const = 0;
+
+
+    /**
+     * Returns subscription state object holding
+     * information data items data subscription state.
+     *
+     * @return The data items data subscription state.
+     *         Object ownership is not returned.
+     */
+    virtual const MXIMPDataSubscriptionState& DataSubscriptionState() const = 0;
+
+
+    };
+
+
+#endif // MXIMPFWOWNPRESENCEEVENT_H
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_presence_management_api/inc/presenceauthorization.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,244 @@
+/*
+* 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:  Presence authorization control interface for XIMPFw clients use.
+*
+*/
+
+#ifndef MXIMPFWPRESENCEAUTHORIZATION_H
+#define MXIMPFWPRESENCEAUTHORIZATION_H
+
+#include <e32std.h>
+#include <ximpbase.h>
+#include <presencemanagementifids.hrh>
+
+
+class MPresenceInfoFilter;
+class MXIMPIdentity;
+
+
+
+/**
+ * Presence authorization control interface for XIMPFw clients use.
+ * Interface is implemented by the XIMP Framework.
+ *
+ * This interface defines actions that client can request from
+ * XIMP Framework execute presence authorization related tasks.
+ *
+ * @ingroup ximppresmanagementapi
+ * @since S60 v3.2
+ */
+class MPresenceAuthorization : public MXIMPBase
+    {
+public:
+
+    /** Interface ID for the MPresenceAuthorization. */
+    enum { KInterfaceId = PRES_IF_ID_PRESENCE_AUTHORIZATION };
+
+
+protected:
+
+    /**
+     * Protected destructor.
+     * Object instancies can't be deleted via this interface.
+     */
+    virtual ~MPresenceAuthorization() {}
+
+
+
+
+
+public: // Presence grant request list access
+
+    /**
+     * Requests the XIMPFw to subscribe presence
+     * grant request list from remote service.
+     *
+     * @return The request ID identifying the issued request.
+     */
+    virtual TXIMPRequestId SubscribePresenceGrantRequestListL() = 0;
+
+
+    /**
+     * Requests the XIMPFw to terminate presence
+     * grant request list subscription.
+     *
+     * @return The request ID identifying the issued request.
+     */
+    virtual TXIMPRequestId UnsubscribePresenceGrantRequestListL() = 0;
+
+
+
+
+
+public: // Granting presence information access to single presentities
+
+
+    /**
+     * Requests the XIMPFw to allow the identified presentity
+     * to see specified presence information.
+     *
+     * @param [in] aPresentityId
+     *        Identification of the presentity to which
+     *        to allow presence information access.
+     *
+     * @param [in] aPif
+     *        Presence information filter indicating the
+     *        allowed presence information.
+     *
+     * @return The request ID identifying the issued request.
+     */
+    virtual TXIMPRequestId GrantPresenceForPresentityL(
+                    const MXIMPIdentity& aPresentityId,
+                    const MPresenceInfoFilter& aPif ) = 0;
+
+
+    /**
+     * Requests the XIMPFw to withdraw existing
+     * presence information grant.
+     *
+     * @param [in] aPresentityId
+     *        Identification of the presentity which presence
+     *        grant to withdraw.
+     *
+     * @return The request ID identifying the issued request.
+     */
+    virtual TXIMPRequestId WithdrawPresenceGrantFromPresentityL(
+                    const MXIMPIdentity& aPresentityId ) = 0;
+
+
+
+
+public: // Granting presence information access to presentity group members
+
+
+    /**
+     * Requests the XIMPFw to allow the identified presentity
+     * group members to see specified presence information.
+     *
+     * @param [in] aGroupId
+     *        Identification of the presentity group for which
+     *        members to allow presence information.
+     *
+     * @param [in] aPif
+     *        Presence information filter indicating the
+     *        allowed presence information.
+     *
+     * @return The request ID identifying the issued request.
+     */
+    virtual TXIMPRequestId GrantPresenceForPresentityGroupMembersL(
+                    const MXIMPIdentity& aGroupId,
+                    const MPresenceInfoFilter& aPif ) = 0;
+
+
+    /**
+     * Requests the XIMPFw to withdraw existing
+     * presentity group members presence information grant.
+     *
+     * @param [in] aGroupId
+     *        Identification of the presentity group
+     *        which members presence grant to terminate.
+     *
+     * @return The request ID identifying the issued request.
+     */
+    virtual TXIMPRequestId WithdrawPresenceGrantFromPresentityGroupMembersL(
+                    const MXIMPIdentity& aGroupId ) = 0;
+
+
+
+public: // Granting presence information access to everyone
+
+
+    /**
+     * Requests the XIMPFw to allow everyone
+     * to see specified presence information.
+     *
+     * @param [in] aPif
+     *        Presence information filter indicating the
+     *        allowed presence information.
+     *
+     * @return The request ID identifying the issued request.
+     */
+    virtual TXIMPRequestId GrantPresenceForEveryoneL(
+                    const MPresenceInfoFilter& aPif ) = 0;
+
+
+    /**
+     * Requests the XIMPFw to withdraw existing
+     * information grant for everyone.
+     *
+     * @return The request ID identifying the issued request.
+     */
+    virtual TXIMPRequestId WithdrawPresenceGrantFromEveryoneL() = 0;
+
+
+public: // Presence block list access
+
+    /**
+     * Subscribe presence block information.
+     *
+     * @return The request ID identifying the issued request.
+     */
+    virtual TXIMPRequestId SubscribePresenceBlockListL() = 0;
+
+
+    /**
+     * Unsubscribe presence block information.
+     *
+     * @return The request ID identifying the issued request.
+     */
+    virtual TXIMPRequestId UnsubscribePresenceBlockListL() = 0;
+
+
+
+
+public: // Blocking presence information access from single presentities
+
+
+    /**
+     * Requests the XIMPFw to block the identified presentity
+     * from seeing presence information produced by this
+     * presence context.
+     *
+     * After blocking, identified presentity can't anymore
+     * access the user own presence information.
+     *
+     * @param [in] aPresentityId
+     *        Identification of the presentity for which
+     *        presence information access to block.
+     *
+     * @return The request ID identifying the issued request.
+     */
+    virtual TXIMPRequestId BlockPresenceForPresentityL(
+                    const MXIMPIdentity& aPresentityId ) = 0;
+
+
+    /**
+     * Requests the protocol to cancel existing presence
+     * information block from the identified presentity.
+     *
+     * @param [in] aPresentityId
+     *        Identification of the presentity of which
+     *        presence information block to cancel.
+     *
+     * @return The request ID identifying the issued request.
+     */
+    virtual TXIMPRequestId CancelPresenceBlockFromPresentityL(
+                    const MXIMPIdentity& aPresentityId ) = 0;
+
+
+    };
+
+#endif // MXIMPFWPRESENCEAUTHORIZATION_H
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_presence_management_api/inc/presenceblocklistevent.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,190 @@
+/*
+* 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:  Event interface for presence block list content.
+*
+*/
+
+#ifndef MXIMPFWPRESENCEBLOCKLISTEVENT_H
+#define MXIMPFWPRESENCEBLOCKLISTEVENT_H
+
+#include <e32std.h>
+#include <ximpbase.h>
+#include <presencemanagementifids.hrh>
+
+
+class MXIMPIdentity;
+class MPresenceBlockInfo;
+class MXIMPDataSubscriptionState;
+
+
+
+/**
+ * Event interface for presence block list content.
+ *
+ * This interface is implemented by the XIMP Framework and
+ * event object is signalled to registered client observers
+ * through MXIMPContextObserver observer interface.
+ * This event notifies clients about changes in
+ * presence block list content.
+ *
+ * Clients subscribe for this event with
+ * MPresenceAuthorization::SubscribePresenceBlockListL.
+ *
+ * XIMP Framework signals this event when:
+ * - New subscribed data is received from protocol.
+ * - Data item data subscription status is updated by
+ *   protocol adaptation.
+ * - When client unsubscribes the data item.
+ * - XIMP Framework generates initial data notification
+ *   to client automatically after clients subscription,
+ *   when the initial data comes available from protocol.
+ *
+ * @ingroup ximppresmanagementapievents
+ * @since S60 v3.2
+ */
+class MPresenceBlockListEvent : public MXIMPBase
+    {
+public:
+    /** Interface ID for the MPresenceBlockListEvent. */
+    enum { KInterfaceId = PRES_IF_ID_PRESENCE_BLOCK_LIST_EVENT };
+
+
+protected:
+
+    /**
+     * Protected destructor.
+     * Object instancies can't be deleted via this interface.
+     */
+    virtual ~MPresenceBlockListEvent() {}
+
+
+
+public: // Access to "delta information"
+
+
+    /**
+     * Gets count of new presence block entries.
+     *
+     * @return The count of new presence block entries.
+     */
+    virtual TInt NewBlocksCount() const = 0;
+
+
+    /**
+     * Gets presence block entry by index.
+     *
+     * @param [in] aIndex
+     *        The index of the presence block entry to get.
+     *
+     * @return The presence block entry from given index.
+     */
+    virtual const MPresenceBlockInfo& NewBlock(
+                TInt aIndex ) const = 0;
+
+
+    /**
+     * Gets count of updated presence block entries.
+     *
+     * @return The count of updated presence block entries.
+     */
+    virtual TInt UpdatedBlocksCount() const = 0;
+
+
+    /**
+     * Gets presence block entry by index.
+     *
+     * @param [in] aIndex
+     *        The index of the presence block entry to get.
+     *
+     * @return The presence block entry from given index.
+     */
+    virtual const MPresenceBlockInfo& UpdatedBlock(
+                TInt aIndex ) const = 0;
+
+
+    /**
+     * Gets count of disappeared presence block entries.
+     *
+     * @return The count of disappeared presence block entries.
+     */
+    virtual TInt DisappearedBlocksCount() const = 0;
+
+
+    /**
+     * Gets presence block entry by index.
+     *
+     * @param [in] aIndex
+     *        The index of the presence block entry to get.
+     *
+     * @return The presence block entry from given index.
+     */
+    virtual const MPresenceBlockInfo& DisappearedBlock(
+                TInt aIndex ) const = 0;
+
+
+
+public: // Access to "current information"
+
+
+    /**
+     * Gets count of current presence block entries.
+     *
+     * Note that, valid "current information" is signalled only when
+     * the client refreshes the event data from XIMP Framework cache,
+     * by re-issuing the data subscription. In other cases, just plain
+     * "delta information" is signalled to client.
+     *
+     * @return The count of current presence block entries.
+     */
+    virtual TInt CurrentBlocksCount() const = 0;
+
+
+    /**
+     * Gets presence block entry by index.
+     *
+     * Note that, valid "current information" is signalled only when
+     * the client refreshes the event data from XIMP Framework cache,
+     * by re-issuing the data subscription. In other cases, just plain
+     * "delta information" is signalled to client.
+     *
+     * @param [in] aIndex
+     *        The index of the presence block entry to get.
+     *
+     * @return The presence block entry from given index.
+     */
+    virtual const MPresenceBlockInfo& CurrentBlock(
+                TInt aIndex ) const = 0;
+
+
+
+public: // Access to subscription state
+
+
+    /**
+     * Returns subscription state object holding
+     * information data items data subscription state.
+     *
+     * @return The data items data subscription state.
+     *         Object ownership is not returned.
+     */
+    virtual const MXIMPDataSubscriptionState& DataSubscriptionState() const = 0;
+
+    };
+
+
+
+#endif // MXIMPFWPRESENCEBLOCKLISTEVENT_H
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_presence_management_api/inc/presencefeatures.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,175 @@
+/*
+* 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:  Interface for presence context.
+*
+*/
+
+#ifndef MPRESENCEFEATURES_H
+#define MPRESENCEFEATURES_H
+
+#include <e32std.h>
+#include <ximpbase.h>
+#include <presencemanagementifids.hrh>
+#include <ximpcontext.h>
+
+
+class MPresenceObjectFactory;
+class MPresenceDataCache;
+class MPresenceWatching;
+class MPresencePublishing;
+class MPresentityGroups;
+class MPresenceAuthorization;
+
+/**
+ * Interface for presence features.
+ * This interface is implemented by the XIMP Framework Presence Feature plug-in.
+ *
+ * MPresenceFeatures is root interface for accessing
+ * and updating presence data to remote presence service.
+ * XIMP FW client binds MXIMPContext interface
+ * to desired remote presence service and creates
+ * MPresenceFeatures interface to access the XIMP FW presence related 
+ * methods to publish and access presence data.
+ *
+ * Following sub interfaces can be accessed from
+ * from MPresenceFeatures:
+ *   - MPresenceObjectFactory
+ *   - MPresenceWatching
+ *   - MPresencePublishing
+ *   - MPresentityGroups
+ *   - MPresenceAuthorization
+ *
+ * All Presence events (context state, presence data,
+ * request completion etc. ones) are delivered through
+ * MPresenceContextObserver interface.
+ *
+ * @ingroup ximppresmanagementapi
+ * @since S60 v3.2
+ */
+class MPresenceFeatures : public MXIMPBase
+    {
+public:
+
+    /** Interface ID for the MPresenceContext. */
+    enum { KInterfaceId = XIMP_ECOM_IF_UID_PRESENCE_INTERFACE };
+
+
+public:
+
+    /**
+     * Factory method to instantiate MPresenceFeatures.
+     *
+     * Factory method to instantiate platform default
+     * MXIMPClient implementation through the ECom.
+     * If the default presence framework isn't supported
+     * in the platform, leaves with errorcode signalled
+     * from ECom.
+     *
+     * @return The new presence client object. Object
+     *         ownership is returned to caller.
+     */
+    static inline MPresenceFeatures* NewL( MXIMPContext* aContext );
+
+    /**
+     * Public destructor.
+     * Objects can be deleted through this interface.
+     */
+    virtual inline ~MPresenceFeatures();
+    
+protected:
+
+    /**
+     * Default constructor to zero initialize
+     * the iEcomDtorID member.
+     */
+    inline MPresenceFeatures();
+
+
+public: //Sub interfaces for presence context
+
+
+    /**
+     * Gets reference to object factory interface.
+     *
+     * Returned object factory interface is used
+     * to instantiate presence objects.
+     *
+     * @return Object factory interface.
+     *         No ownership is returned caller.
+     */
+    virtual MPresenceObjectFactory& PresenceObjectFactory() const = 0;
+
+
+    /**
+     * Gets reference to object factory interface.
+     *
+     * Returned object factory interface is used
+     * to instantiate presence objects.
+     *
+     * @return Object factory interface.
+     *         No ownership is returned caller.
+     */
+    //virtual MPresenceDataCache& PresenceDataAccess() const = 0;
+    
+
+    /**
+     * Gets reference to presence watching interface.
+     *
+     * @return Requested interface.
+     *         No ownership is returned caller.
+     */
+    virtual MPresenceWatching& PresenceWatching() const = 0;
+
+
+
+    /**
+     * Gets reference to presence publishing interface.
+     *
+     * @return Requested interface.
+     *         No ownership is returned caller.
+     */
+    virtual MPresencePublishing& PresencePublishing() const = 0;
+
+
+
+    /**
+     * Gets reference to presentity groups interface.
+     *
+     * @return Requested interface.
+     *         No ownership is returned caller.
+     */
+    virtual MPresentityGroups& PresentityGroups() const = 0;
+
+
+    /**
+     * Gets reference to presence authorization interface.
+     *
+     * @return Requested interface.
+     *         No ownership is returned caller.
+     */
+    virtual MPresenceAuthorization& PresenceAuthorization() const = 0;
+
+private: // Data
+
+    //OWN: ECom destructor ID
+    TUid iEcomDtorID;
+    };
+
+#include <presencefeatures.inl>
+
+
+#endif // MPRESENCEFEATURES_H
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_presence_management_api/inc/presencefeatures.inl	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,64 @@
+/*
+* 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 Features interface used by XIMP Presence clients.
+*
+*/
+
+#include <ecom/ecom.h>
+
+
+// -----------------------------------------------------------------------------
+// MPresenceFeatures::NewL( MXIMPContext* aContext) implementation
+// Factory method to instantiate the platform default
+// MPresenceFeatures implementation through the ECom framework.
+// -----------------------------------------------------------------------------
+//
+inline MPresenceFeatures* MPresenceFeatures::NewL(MXIMPContext* aContext )
+    {
+    _LIT8( KXIMPPresenceDefaultData, XIMP_ECOM_DEFAULT_DATA_PRESENCE_INTERFACE );
+
+    TEComResolverParams resolvingParams;
+    resolvingParams.SetDataType( KXIMPPresenceDefaultData );
+    resolvingParams.SetWildcardMatch( ETrue );
+
+    TAny* imp = REComSession::CreateImplementationL( TUid::Uid( MPresenceFeatures::KInterfaceId ),
+                                                     _FOFF( MPresenceFeatures, iEcomDtorID ),
+                                                     aContext, resolvingParams );
+
+    return reinterpret_cast< MPresenceFeatures* >( imp );
+    }
+
+
+// -----------------------------------------------------------------------------
+// MPresenceFeatures::MPresenceFeatures() implementation
+// Zero initializes the iEcomDtorID member.
+// -----------------------------------------------------------------------------
+//
+inline MPresenceFeatures::MPresenceFeatures()
+    {
+    iEcomDtorID = TUid::Null();
+    }
+
+
+// -----------------------------------------------------------------------------
+// MPresenceFeatures::~MPresenceFeatures()
+// Destructor notifies the ECom from implementation destruction.
+// -----------------------------------------------------------------------------
+//
+inline MPresenceFeatures::~MPresenceFeatures()
+    {
+    REComSession::DestroyedImplementation( iEcomDtorID );
+    }
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_presence_management_api/inc/presencegrantrequestlistevent.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,169 @@
+/*
+* 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:  Event interface for presence grant request list content.
+*
+*/
+
+#ifndef MXIMPFWPRESENCEGRANTREQUESTLISTEVENT_H
+#define MXIMPFWPRESENCEGRANTREQUESTLISTEVENT_H
+
+#include <e32std.h>
+#include <ximpbase.h>
+#include <presencemanagementifids.hrh>
+
+
+class MXIMPIdentity;
+class MPresenceGrantRequestInfo;
+class MXIMPDataSubscriptionState;
+
+
+/**
+ * Event interface for presence grant request list content.
+ *
+ * This interface is implemented by the XIMP Framework and
+ * event object is signalled to registered client observers
+ * through MXIMPContextObserver observer interface.
+ * This event notifies clients about changes in
+ * presence grant request list content.
+ *
+ * Clients subscribe for this event with
+ * MPresenceAuthorization::SubscribePresenceGrantRequestListL().
+ *
+ * XIMP Framework signals this event when:
+ * - New subscribed data is received from protocol.
+ * - Data item data subscription status is updated by
+ *   protocol adaptation.
+ * - When client unsubscribes the data item.
+ * - XIMP Framework generates initial data notification
+ *   to client automatically after clients subscription,
+ *   when the initial data comes available from protocol.
+ *
+ * @ingroup ximppresmanagementapievents
+ * @since S60 v3.2
+ */
+class MPresenceGrantRequestListEvent : public MXIMPBase
+    {
+public:
+    /** Interface ID for the MPresenceGrantRequestListEvent. */
+    enum { KInterfaceId = PRES_IF_ID_PRESENCE_GRANT_REQUEST_LIST_EVENT };
+
+
+protected:
+
+    /**
+     * Protected destructor.
+     * Object instancies can't be deleted via this interface.
+     */
+    virtual ~MPresenceGrantRequestListEvent() {}
+
+
+
+public: // Access to "delta information"
+
+
+    /**
+     * Gets count of new presence grant request entries.
+     *
+     * @return The count of new presence grant request entries.
+     */
+    virtual TInt NewRequestsCount() const = 0;
+
+
+    /**
+     * Gets presence grant request entry by index.
+     *
+     * @param [in] aIndex
+     *        The index of the presence grant request entry to get.
+     *
+     * @return The presence grant request entry from given index.
+     */
+    virtual const MPresenceGrantRequestInfo& NewRequest(
+                TInt aIndex ) const = 0;
+
+
+    /**
+     * Gets count of disappeared presence grant request entries.
+     *
+     * @return The count of disappeared presence grant request entries.
+     */
+    virtual TInt DisappearedRequestsCount() const = 0;
+
+
+    /**
+     * Gets presence grant request entry by index.
+     *
+     * @param [in] aIndex
+     *        The index of the presence grant request entry to get.
+     *
+     * @return The presence grant request entry from given index.
+     */
+    virtual const MPresenceGrantRequestInfo& DisappearedRequest(
+                TInt aIndex ) const = 0;
+
+
+
+public: // Access to "current information"
+
+
+    /**
+     * Gets count of current presence grant request entries.
+     *
+     * Note that, valid "current information" is signalled only when
+     * the client refreshes the event data from XIMP Framework cache,
+     * by re-issuing the data subscription. In other cases, just plain
+     * "delta information" is signalled to client.
+     *
+     * @return The count of current presence grant request entries.
+     */
+    virtual TInt CurrentRequestsCount() const = 0;
+
+
+    /**
+     * Gets presence grant request entry by index.
+     *
+     * Note that, valid "current information" is signalled only when
+     * the client refreshes the event data from XIMP Framework cache,
+     * by re-issuing the data subscription. In other cases, just plain
+     * "delta information" is signalled to client.
+     *
+     * @param [in] aIndex
+     *        The index of the presence grant request entry to get.
+     *
+     * @return The presence grant request entry from given index.
+     */
+    virtual const MPresenceGrantRequestInfo& CurrentRequest(
+                TInt aIndex ) const = 0;
+
+
+
+public: // Access to subscription state
+
+
+    /**
+     * Returns subscription state object holding
+     * information about data items data subscription state.
+     *
+     * @return The data items data subscription state.
+     *         Object ownership is not returned.
+     */
+    virtual const MXIMPDataSubscriptionState& DataSubscriptionState() const = 0;
+
+
+    };
+
+
+#endif // MXIMPFWPRESENCEGRANTREQUESTLISTEVENT_H
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_presence_management_api/inc/presencemanagementifids.hrh	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,88 @@
+/*
+* 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:  XIMP Framework Presence Management API interface IDs.
+*
+*/
+
+#ifndef PRESENCEMANAGEMENTIFUIDS_HRH
+#define PRESENCEMANAGEMENTIFUIDS_HRH
+
+
+
+/**
+ * @defgroup ximppresmanagementapi XIMP Presence Management API
+ * @ingroup ximppresenceapi
+ *
+ * XIMP Framework Presence Management API contains
+ * abstract management interfaces, which are implemented by
+ * XIMP Framework. XIMP Framework clients call these
+ * interfaces to request XIMP Framework execute
+ * certain presence services.
+ * @since S60 v3.2
+ */
+
+
+/**
+ * @defgroup ximppresmanagementapievents XIMP Presence Management API events
+ *
+ * XIMP Framework Presence Management API contains also
+ * abstract event interfaces, which are used to deliver data
+ * and state information to XIMP Framework clients through
+ * MXIMPContextObserver::HandlePresenceContextEvent()
+ * event callback.
+ *
+ * @ingroup ximppresmanagementapi
+ * @since S60 v3.2
+ */
+
+
+// Management IF id's
+// 20xx - ximp related
+// 21xx - presence related
+// 22xx - instant messaging related
+
+
+
+// Interface IDs for XIMPFw Presence Management API interfaces
+#define PRES_IF_ID_PRESENCE_PUBLISHING                 2101
+#define PRES_IF_ID_PRESENTITY_GROUPS                   2102
+#define PRES_IF_ID_PRESENCE_WATCHING                   2103
+#define PRES_IF_ID_PRESENCE_AUTHORIZATION              2104
+#define PRES_IF_ID_PRESENTITY_GROUP_LIST_EVENT         2105
+#define PRES_IF_ID_PRESENTITY_GROUP_CONTENT_EVENT      2106
+#define PRES_IF_ID_PRESENCE_BLOCK_LIST_EVENT           2107
+#define PRES_IF_ID_PRESENCE_GRANT_REQUEST_LIST_EVENT   2108
+#define PRES_IF_ID_PRESENCE_WATCHER_LIST_EVENT         2109
+#define PRES_IF_ID_PRESENTITY_PRESENCE_EVENT           2110
+#define PRES_IF_ID_OWN_PRESENCE_EVENT                  2111
+#define PRES_IF_ID_PRESENCE_FEATURES                   2112
+
+
+// Interface UID for Presencefeatures interface
+#define XIMP_ECOM_IF_UID_PRESENCE_INTERFACE             0x2000B185
+
+// Interface UID for PresenceCacheReader interface
+#define XIMP_ECOM_IF_UID_PRESENCE_CACHE_READER         0x2000B4EC
+
+// Interface UID for PresenceCacheWriter interface
+#define XIMP_ECOM_IF_UID_PRESENCE_CACHE_WRITER         0x2000B4ED
+
+// Default implementation resulution data
+// for XIMP presencefeature interterface Base ECom interface
+#define XIMP_ECOM_DEFAULT_DATA_PRESENCE_INTERFACE         "default"
+
+
+
+#endif // PRESENCEMANAGEMENTIFUIDS_HRH
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_presence_management_api/inc/presencepublishing.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,141 @@
+/*
+* 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:  Presence publication control interface for clients use.
+*
+*/
+
+#ifndef MXIMPFWPRESENCEPUBLISHING_H
+#define MXIMPFWPRESENCEPUBLISHING_H
+
+#include <e32std.h>
+#include <ximpbase.h>
+#include <presencemanagementifids.hrh>
+
+
+class MPresenceInfo;
+class MPresenceInfoFilter;
+
+
+/**
+ * Presence publication control interface for clients use.
+ * Interface is implemented by the XIMP Framework.
+ *
+ * MPresencePublishing provides services to publish
+ * own presence infrmation to binded remote presence service.
+ * It also provides way to subscribe notifications from own
+ * presence changes
+ *
+ * MPresencePublishing interface can be obtained from
+ * MXIMPContext interface.
+ *
+ * @ingroup ximppresmanagementapi
+ * @since S60 v3.2
+ */
+class MPresencePublishing : public MXIMPBase
+    {
+public:
+
+    /** Interface ID for the MPresencePublishing. */
+    enum { KInterfaceId = PRES_IF_ID_PRESENCE_PUBLISHING };
+
+
+protected:
+
+    /**
+     * Protected destructor.
+     * Object instancies can't be deleted via this interface.
+     */
+    virtual ~MPresencePublishing() {}
+
+
+public: //Presence publishing requests
+
+
+    /**
+     * Subscribes own presence information.
+     *
+     * Subscribes own presence information from
+     * remote presence service.
+     *
+     * Own presence subscription is asynchronous operation and
+     * it might evolve network operations.
+     *
+     * @param [in] aPif
+     *        Presence info filter defining the presence
+     *        information to subscribe.
+     *
+     * @return The request ID identifying the issued request.
+     */
+    virtual TXIMPRequestId SubscribeOwnPresenceL(
+                const MPresenceInfoFilter& aPif ) = 0;
+
+
+    /**
+     * Unsubscribes own presence information.
+     *
+     * Unsubscribing own presence is asynchronous operation
+     * and it might evolve network operations.
+     *
+     * @return The request ID identifying the issued request.
+     */
+    virtual TXIMPRequestId UnsubscribeOwnPresenceL() = 0;
+
+
+
+    /**
+     * Publishes own presence information.
+     *
+     * Publishes own presence information to remote presence service.
+     *
+     * Presence publication is asynchronous operation and
+     * evolves network operations.
+     *
+     * @param [in] aPresence
+     *        Presence info defining the presence information
+     *        to publish.
+     *
+     * @return The request ID identifying the issued request.
+     */
+    virtual TXIMPRequestId PublishOwnPresenceL(
+                const MPresenceInfo& aPresence ) = 0;
+
+
+
+
+public: //Presence watcher list requests
+
+
+    /**
+     * Subscribes presence watcher list.
+     *
+     * @return The request ID identifying the issued request.
+     */
+    virtual TXIMPRequestId SubscribePresenceWatcherListL() = 0;
+
+
+    /**
+     * Unsubscribes presence watcher list.
+     *
+     * @return The request ID identifying the issued request.
+     */
+    virtual TXIMPRequestId UnsubscribePresenceWatcherListL() = 0;
+
+    };
+
+
+
+#endif // MXIMPFWPRESENCEPUBLISHING_H
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_presence_management_api/inc/presencewatcherlistevent.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,170 @@
+/*
+* 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:  Event interface for presence watcher list content.
+*
+*/
+
+#ifndef MXIMPFWPRESENCEWATCHERLISTEVENT_H
+#define MXIMPFWPRESENCEWATCHERLISTEVENT_H
+
+#include <e32std.h>
+#include <ximpbase.h>
+#include <presencemanagementifids.hrh>
+
+
+class MXIMPIdentity;
+class MPresenceWatcherInfo;
+class MXIMPDataSubscriptionState;
+
+
+/**
+ * Event interface for presence watcher list content.
+ *
+ * This interface is implemented by the XIMP Framework and
+ * event object is signalled to registered client observers
+ * through MXIMPContextObserver observer interface.
+ * This event notifies clients about changes in
+ * presence watcher list content.
+ *
+ * Clients subscribe for this event with
+ * MPresencePublishing::SubscribePresenceWatcherListL().
+ *
+ * XIMP Framework signals this event when:
+ * - New subscribed data is received from protocol.
+ * - Data item data subscription status is updated by
+ *   protocol adaptation.
+ * - When client unsubscribes the data item.
+ * - XIMP Framework generates initial data notification
+ *   to client automatically after clients subscription,
+ *   when the initial data comes available from protocol.
+ *
+ * @ingroup ximppresmanagementapievents
+ * @since S60 v3.2
+ */
+class MPresenceWatcherListEvent : public MXIMPBase
+    {
+public:
+    /** Interface ID for the MPresenceWatcherListEvent. */
+    enum { KInterfaceId = PRES_IF_ID_PRESENCE_WATCHER_LIST_EVENT };
+
+
+protected:
+
+    /**
+     * Protected destructor.
+     * Object instancies can't be deleted via this interface.
+     */
+    virtual ~MPresenceWatcherListEvent() {}
+
+
+public: // Access to "delta information"
+
+
+    /**
+     * Gets count of new presence watcher entries.
+     *
+     * @return The count of new presence watcher entries.
+     */
+    virtual TInt NewWatchersCount() const = 0;
+
+
+
+    /**
+     * Gets presence watcher entry by index.
+     *
+     * @param [in] aIndex
+     *        The index of the presence watcher entry to get.
+     *
+     * @return The presence watcher entry from given index.
+     */
+    virtual const MPresenceWatcherInfo& NewWatcher(
+                TInt aIndex ) const = 0;
+
+
+
+    /**
+     * Gets count of dissappeared presence watcher entries.
+     *
+     * @return The count of dissappeared presence watcher entries.
+     */
+    virtual TInt DisappearedWatchersCount() const = 0;
+
+
+
+    /**
+     * Gets presence watcher entry by index.
+     *
+     * @param [in] aIndex
+     *        The index of the presence watcher entry to get.
+     *
+     * @return The presence watcher entry from given index.
+     */
+    virtual const MPresenceWatcherInfo& DisappearedWatcher(
+                TInt aIndex ) const = 0;
+
+
+
+public: // Access to "current information"
+
+
+    /**
+     * Gets count of current presence watcher entries.
+     *
+     * Note that, valid "current information" is signalled only when
+     * the client refreshes the event data from XIMP Framework cache,
+     * by re-issuing the data subscription. In other cases, just plain
+     * "delta information" is signalled to client.
+     *
+     * @return The count of current presence watcher entries.
+     */
+    virtual TInt CurrentWatchersCount() const = 0;
+
+
+
+    /**
+     * Gets presence watcher entry by index.
+     *
+     * Note that, current information is signalled only when
+     * the client refreshes the event data from XIMP Framework cache,
+     * by re-issuing the data subscription.
+     *
+     * @param [in] aIndex
+     *        The index of the presence watcher entry to get.
+     *
+     * @return The presence watcher entry from given index.
+     */
+    virtual const MPresenceWatcherInfo& CurrentWatcher(
+                TInt aIndex ) const = 0;
+
+
+
+public: // Access to subscription state
+
+
+    /**
+     * Returns subscription state object holding
+     * information about data items data subscription state.
+     *
+     * @return The data items data subscription state.
+     *         Object ownership is not returned.
+     */
+    virtual const MXIMPDataSubscriptionState& DataSubscriptionState() const = 0;
+
+
+    };
+
+
+#endif // MXIMPFWPRESENCEWATCHERLISTEVENT_H
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_presence_management_api/inc/presencewatching.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,143 @@
+/*
+* 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:  Presence subscription control interface for clients use.
+*
+*/
+
+#ifndef MXIMPFWPRESENCEWATCHING_H
+#define MXIMPFWPRESENCEWATCHING_H
+
+#include <e32std.h>
+#include <ximpbase.h>
+#include <presencemanagementifids.hrh>
+
+
+class MPresenceInfoFilter;
+class MXIMPIdentity;
+
+
+
+/**
+ * Presence subscription control interface for clients use.
+ * Interface is implemented by the XIMP Framework.
+ *
+ * @ingroup ximppresmanagementapi
+ * @since S60 v3.2
+ */
+class MPresenceWatching : public MXIMPBase
+    {
+public:
+
+    /** Interface ID for the MPresenceWatching. */
+    enum { KInterfaceId = PRES_IF_ID_PRESENCE_WATCHING };
+
+
+protected:
+
+    /**
+     * Protected destructor.
+     * Object instancies can't be deleted via this interface.
+     */
+    virtual ~MPresenceWatching() {}
+
+
+
+public: //Presentity presence subscription
+
+
+    /**
+     * Subscribe presentity presence.
+     *
+     * Subscribing presence is asynchronous operation and it
+     * might evolve network operations.
+     *
+     * @param [in] aPresentityId
+     *        Identification of the presentity which presence
+     *        information subscribe to.
+     *
+     * @param [in] aPif
+     *        Presence information filter indicating the set
+     *        of presence information to request from the
+     *        presentity.
+     *
+     * @return The request ID identifying the issued request.
+     */
+    virtual TXIMPRequestId SubscribePresentityPresenceL(
+                    const MXIMPIdentity& aPresentityId,
+                    const MPresenceInfoFilter& aPif ) = 0;
+
+
+    /**
+     * Unsubscribe presentity presence.
+     *
+     * Unsubscribing presence is asynchronous operation and it
+     * might evolve network operations.
+     *
+     * @param [in] aPresentityId
+     *        Identification of the presentity which presence
+     *        information subscribtion to end.
+     *
+     * @return The request ID identifying the issued request.
+     */
+    virtual TXIMPRequestId UnsubscribePresentityPresenceL(
+                    const MXIMPIdentity& aPresentityId ) = 0;
+
+
+
+public: //Presentity group members presence subscription
+
+
+    /**
+     * Subscribe presentity group members presence.
+     *
+     * Subscribing presence is asynchronous operation and it
+     * might evolve network operations.
+     *
+     * @param [in] aGroupId
+     *        Identification of the presentity group for which
+     *        members to request presence information.
+     *
+     * @param [in] aPif
+     *        Presence information filter indicating the set
+     *        of presence information to request from the
+     *        presentity group members.
+     *
+     * @return The request ID identifying the issued request.
+     */
+    virtual TXIMPRequestId SubscribePresentityGroupMembersPresenceL(
+                    const MXIMPIdentity& aGroupId,
+                    const MPresenceInfoFilter& aPif ) = 0;
+
+
+    /**
+     * Unsubscribe presentity group members presence.
+     *
+     * Unsubscribing presence is asynchronous operation and it
+     * might evolve network operations.
+     *
+     * @param [in] aGroupId
+     *        Identification of the presentity group
+     *        which members presence subscribtion to terminate.
+     *
+     * @return The request ID identifying the issued request.
+     */
+    virtual TXIMPRequestId UnsubscribePresentityGroupMembersPresenceL(
+                    const MXIMPIdentity& aGroupId ) = 0;
+
+    };
+
+
+#endif // MXIMPFWPRESENCEWATCHING_H
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_presence_management_api/inc/presentitygroupcontentevent.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,189 @@
+/*
+* 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:  Event interface for presentity group content.
+*
+*/
+
+#ifndef MXIMPFWPRESENTITYGROUPCONTENTEVENT_H
+#define MXIMPFWPRESENTITYGROUPCONTENTEVENT_H
+
+#include <e32std.h>
+#include <ximpbase.h>
+#include <presencemanagementifids.hrh>
+
+
+class MXIMPIdentity;
+class MPresentityGroupMemberInfo;
+class MXIMPDataSubscriptionState;
+
+
+
+/**
+ * Event interface for presentity group content event.
+ *
+ * This interface is implemented by the XIMP Framework and
+ * event object is signalled to registered client observers
+ * through MXIMPContextObserver observer interface.
+ * This event notifies clients about changes in
+ * presentity group content.
+ *
+ * Clients subscribe for this event with
+ * MPresentityGroups::SubscribePresentityGroupContentL().
+ *
+ * XIMP Framework signals this event when:
+ * - New subscribed data is received from protocol.
+ * - Data item data subscription status is updated by
+ *   protocol adaptation.
+ * - When client unsubscribes the data item.
+ * - XIMP Framework generates initial data notification
+ *   to client automatically after clients subscription,
+ *   when the initial data comes available from protocol.
+ *
+ * @ingroup ximppresmanagementapievents
+ * @since S60 v3.2
+ */
+class MPresentityGroupContentEvent : public MXIMPBase
+    {
+public:
+    /** Interface ID for the MPresentityGroupContentEvent. */
+    enum { KInterfaceId = PRES_IF_ID_PRESENTITY_GROUP_CONTENT_EVENT };
+
+
+protected:
+
+    /**
+     * Protected destructor.
+     * Object instancies can't be deleted via this interface.
+     */
+    virtual ~MPresentityGroupContentEvent() {};
+
+
+public: // Access to "delta information"
+
+
+    /**
+     * Presentity group identity information.
+     */
+    virtual const MXIMPIdentity& GroupId() const = 0;
+
+
+
+    /**
+     * Gets count of new presentity group members.
+     *
+     * @return The count of new presentity group members.
+     */
+    virtual TInt NewMembersCount() const = 0;
+
+
+    /**
+     * Gets presentity group member by index.
+     *
+     * @param [in] aIndex
+     *        The index of the presentity group member to get.
+     *
+     * @return The presentity group member from given index.
+     */
+    virtual const MPresentityGroupMemberInfo& NewMember(
+                TInt aIndex ) const = 0;
+
+
+    /**
+     * Gets count of updated presentity group members.
+     *
+     * @return The count of updated presentity group members.
+     */
+    virtual TInt UpdatedMembersCount() const = 0;
+
+
+    /**
+     * Gets presentity group member by index.
+     *
+     * @param [in] aIndex
+     *        The index of the presentity group member to get.
+     *
+     * @return The presentity group member from given index.
+     */
+    virtual const MPresentityGroupMemberInfo& UpdatedMember(
+                TInt aIndex ) const = 0;
+
+
+    /**
+     * Gets count of disappeared presentity group members.
+     *
+     * @return The count of disappeared presentity group members.
+     */
+    virtual TInt DisappearedMembersCount() const = 0;
+
+
+    /**
+     * Gets presentity group member by index.
+     *
+     * @param [in] aIndex
+     *        The index of the presentity group member to get.
+     *
+     * @return The presentity group member from given index.
+     */
+    virtual const MPresentityGroupMemberInfo& DisappearedMember(
+                TInt aIndex ) const = 0;
+
+
+
+public: // Access to "current information"
+
+    /**
+     * Gets count of current presentity group members.
+     *
+     * Note that, current information is signalled only when
+     * the client refreshes the event data from XIMP Framework cache,
+     * by re-issuing the data subscription.
+     *
+     * @return The count of current presentity group members.
+     */
+    virtual TInt CurrentMembersCount() const = 0;
+
+
+
+    /**
+     * Gets presentity group member by index.
+     *
+     * @param [in] aIndex
+     *        The index of the presentity group member to get.
+     *
+     * @return The presentity group member from given index.
+     */
+    virtual const MPresentityGroupMemberInfo& CurrentMember(
+                TInt aIndex ) const = 0;
+
+
+
+public: // Access to subscription state
+
+
+    /**
+     * Returns subscription state object holding
+     * information about data items data subscription state.
+     *
+     * @return The data items data subscription state.
+     *         Object ownership is not returned.
+     */
+    virtual const MXIMPDataSubscriptionState& DataSubscriptionState() const = 0;
+
+    };
+
+
+#endif // MXIMPFWPRESENTITYGROUPCONTENTEVENT_H
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_presence_management_api/inc/presentitygrouplistevent.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,186 @@
+/*
+* 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:  Event interface for presentity group list content.
+*
+*/
+
+#ifndef MXIMPFWPRESENTITYGROUPLISTEVENT_H
+#define MXIMPFWPRESENTITYGROUPLISTEVENT_H
+
+#include <e32std.h>
+#include <ximpbase.h>
+#include <presencemanagementifids.hrh>     
+
+
+class MXIMPIdentity;
+class MPresentityGroupInfo;
+class MXIMPDataSubscriptionState;
+
+
+/**
+ * Event interface for presentity group list content.
+ *
+ * This interface is implemented by the XIMP Framework and
+ * event object is signalled to registered client observers
+ * through MXIMPContextObserver observer interface.
+ * This event notifies clients about changes in
+ * presentity group list content.
+ *
+ * Clients subscribe for this event with
+ * MPresentityGroups::SubscribePresentityGroupListL().
+ *
+ * XIMP Framework signals this event when:
+ * - New subscribed data is received from protocol.
+ * - Data item data subscription status is updated by
+ *   protocol adaptation.
+ * - When client unsubscribes the data item.
+ * - XIMP Framework generates initial data notification
+ *   to client automatically after clients subscription,
+ *   when the initial data comes available from protocol.
+ *
+ * @ingroup ximppresmanagementapievents
+ * @since S60 v3.2
+ */
+class MPresentityGroupListEvent : public MXIMPBase
+    {
+public:
+    /** Interface ID for the MPresentityGroupListEvent. */
+    enum { KInterfaceId = PRES_IF_ID_PRESENTITY_GROUP_LIST_EVENT };
+
+
+
+protected:
+
+    /**
+     * Protected destructor.
+     * Object instancies can't be deleted via this interface.
+     */
+    virtual ~MPresentityGroupListEvent() {}
+
+
+public: // Access to "delta information"
+
+
+    /**
+     * Gets count of new presentity groups.
+     *
+     * @return The count of new presentity groups.
+     */
+    virtual TInt NewGroupsCount() const = 0;
+
+
+    /**
+     * Gets presentity group entry by index.
+     *
+     * @param [in] aIndex
+     *        The index of the presentity group entry to get.
+     *
+     * @return The presentity group entry from given index.
+     */
+    virtual const MPresentityGroupInfo& NewGroup(
+                TInt aIndex ) const = 0;
+
+
+    /**
+     * Gets count of updated presentity groups.
+     *
+     * @return The count of updated presentity groups.
+     */
+    virtual TInt UpdatedGroupsCount() const = 0;
+
+
+    /**
+     * Gets presentity group entry by index.
+     *
+     * @param [in] aIndex
+     *        The index of the presentity group entry to get.
+     *
+     * @return The presentity group entry from given index.
+     */
+    virtual const MPresentityGroupInfo& UpdatedGroup(
+                TInt aIndex ) const = 0;
+
+
+    /**
+     * Gets count of disappeared presentity groups.
+     *
+     * @return The count of disappeared presentity groups.
+     */
+    virtual TInt DisappearedGroupsCount() const = 0;
+
+
+    /**
+     * Gets presentity group entry by index.
+     *
+     * @param [in] aIndex
+     *        The index of the presentity group entry to get.
+     *
+     * @return The presentity group entry from given index.
+     */
+    virtual const MPresentityGroupInfo& DisappearedGroup(
+                TInt aIndex ) const = 0;
+
+
+
+public: // Access to "current information"
+
+    /**
+     * Gets count of current presentity groups.
+     *
+     * Note that, current information is signalled only when
+     * the client refreshes the event data from XIMP Framework cache,
+     * by re-issuing the data subscription.
+     *
+     * @return The count of current presentity groups.
+     */
+    virtual TInt CurrentGroupsCount() const = 0;
+
+
+    /**
+     * Gets presentity group entry by index.
+     *
+     * Note that, current information is signalled only when
+     * the client refreshes the event data from XIMP Framework cache,
+     * by re-issuing the data subscription.
+     *
+     * @param [in] aIndex
+     *        The index of the presentity group entry to get.
+     *
+     * @return The presentity group entry from given index.
+     */
+    virtual const MPresentityGroupInfo& CurrentGroup(
+                TInt aIndex ) const = 0;
+
+
+
+public: // Access to subscription state
+
+
+    /**
+     * Returns subscription state object holding
+     * information about data items data subscription state.
+     *
+     * @return The data items data subscription state.
+     *         Object ownership is not returned.
+     */
+    virtual const MXIMPDataSubscriptionState& DataSubscriptionState() const = 0;
+
+
+    };
+
+
+#endif // MXIMPFWPRESENTITYGROUPLISTEVENT_H
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_presence_management_api/inc/presentitygroups.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,244 @@
+/*
+* 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:  Presentity group handling interface for clients use.
+*
+*/
+
+#ifndef MXIMPFWPRESENTITYGROUPS_H
+#define MXIMPFWPRESENTITYGROUPS_H
+
+#include <e32std.h>
+#include <ximpbase.h>
+#include <presencemanagementifids.hrh>
+
+class MXIMPIdentity;
+
+
+/**
+ * Presentity group handling interface for clients use.
+ * Interface is implemented by the XIMP Framework.
+ *
+ * MPresentityGroups provides services for
+ * XIMP Framework clients to manage presentity groups
+ * and presentity group members. It provides also services
+ * to subscribe notifications from presentity group list changes
+ * and from individual presentity group changes.
+ *
+ * Client can retrieve MPresentityGroups interface from
+ * MXIMPContext interface.
+ *
+ * @ingroup ximppresmanagementapi
+ * @since S60 v3.2
+ */
+class MPresentityGroups : public MXIMPBase
+    {
+public:
+
+    /** Interface ID for the MPresentityGroups. */
+    enum { KInterfaceId = PRES_IF_ID_PRESENTITY_GROUPS };
+
+
+protected:
+
+    /**
+     * Protected destructor.
+     * Object instancies can't be deleted via this interface.
+     */
+    virtual ~MPresentityGroups() {}
+
+
+public: //Presentity group management requests
+
+
+    /**
+     * Subscribes presentity group list notifications.
+     *
+     * @return The request ID identifying the issued request.
+     */
+    virtual TXIMPRequestId SubscribePresentityGroupListL() = 0;
+
+
+
+    /**
+     * Unsubscribes presentity group list notifications.
+     *
+     * @return The request ID identifying the issued request.
+     */
+    virtual TXIMPRequestId UnsubscribePresentityGroupListL() = 0;
+
+
+
+    /**
+     * Creates presentity group.
+     *
+     * Note: Remote service may alter given presentity group ID and
+     *       display name. Altered ID and display names are signalled back
+     *       to client through MXIMPRequestCompleteEvent.
+     *
+     * @param [in] aGroupId
+     *        Identification for presentity group.
+     *
+     * @param [in] aDisplayName
+     *        Presentity group display name.
+     *
+     *
+     * @return The request ID identifying the issued request.
+     */
+    virtual TXIMPRequestId CreatePresentityGroupL(
+                    const MXIMPIdentity& aGroupId,
+                    const TDesC16& aDisplayName ) = 0;
+
+
+    /**
+     * Deletes presentity group.
+     *
+     * @param [in] aGroupId
+     *        Identification for presentity group.
+     *
+     * @return The request ID identifying the issued request.
+     */
+    virtual TXIMPRequestId DeletePresentityGroupL(
+                    const MXIMPIdentity& aGroupId ) = 0;
+
+
+
+    /**
+     * Updates presentity group display name.
+     *
+     * Note: Remote service may alter given presentity group display name.
+     *       Altered display name is signalled back to client through
+     *       MXIMPRequestCompleteEvent.
+     *
+     * @param [in] aGroupId
+     *        Identification for presentity group.
+     *
+     * @param [in] aDisplayName
+     *        New display name for the presentity group.
+     *
+     * @return The request ID identifying the issued request.
+     */
+    virtual TXIMPRequestId UpdatePresentityGroupDisplayNameL(
+                    const MXIMPIdentity& aGroupId,
+                    const TDesC16& aDisplayName ) = 0;
+
+
+
+public: //Prototypes for presentity group member management requests
+
+
+    /**
+     * Subscribes presentity group content notifications.
+     *
+     * @param [in] aGroupId
+     *        Identification for presentity group for which
+     *        to subscribe content notifications.
+     *
+     * @return The request ID identifying the issued request.
+     */
+    virtual TXIMPRequestId SubscribePresentityGroupContentL(
+                    const MXIMPIdentity& aGroupId ) = 0;
+
+
+    /**
+     * Unsubscribes presentity group content notifications.
+     *
+     * @param [in] aGroupId
+     *        Identification for presentity group for which
+     *        content notification subscription to terminate.
+     *
+     * @return The request ID identifying the issued request.
+     */
+    virtual TXIMPRequestId UnsubscribePresentityGroupContentL(
+                    const MXIMPIdentity& aGroupId ) = 0;
+
+
+    /**
+     * Requests the protocol to add new member to
+     * identified presentity group.
+     *
+     *
+     * Note: Remote service may alter given member and
+     *       display name. Altered ID and display names
+     *       are signalled back to client through MXIMPRequestCompleteEvent.
+     *
+     * @param [in] aGroupId
+     *        Identification of the presentity group where to
+     *        add new member.
+     *
+     * @param [in] aMemberId
+     *        Identification of the new member.
+     *
+     * @param [in] aMemberDisplayName
+     *        Display name for the added member.
+     *
+     * @return The request ID identifying the issued request.
+     */
+    virtual TXIMPRequestId AddPresentityGroupMemberL(
+                    const MXIMPIdentity& aGroupId,
+                    const MXIMPIdentity& aMemberId,
+                    const TDesC16& aMemberDisplayName ) = 0;
+
+
+    /**
+     * Requests the XIMPFw to remove member from
+     * identified presentity group.
+     *
+     * @param [in] aGroupId
+     *        Identification of the presentity group from
+     *        where to remove member.
+     *
+     * @param [in] aMemberId
+     *        Identification of the member to remove.
+     *
+     * @return The request ID identifying the issued request.
+     */
+    virtual TXIMPRequestId RemovePresentityGroupMemberL(
+                    const MXIMPIdentity& aGroupId,
+                    const MXIMPIdentity& aMemberId ) = 0;
+
+
+
+    /**
+     * Requests the XIMPFw to update presentity group
+     * member display name.
+     *
+     * Note: Remote service may alter given presentity group member
+     *       display name. Altered display name is signalled back
+     *       to client through MXIMPRequestCompleteEvent.
+     *
+     * @param [in] aGroupId
+     *        Identification for presentity group.
+     *
+     * @param [in] aMemberId
+     *        Identification of the member which display
+     *        name to update.
+     *
+     * @param [in] aMemberDisplayName
+     *        New display name for the member.
+     *
+     * @return The request ID identifying the issued request.
+     */
+    virtual TXIMPRequestId UpdatePresentityGroupMemberDisplayNameL(
+                    const MXIMPIdentity& aGroupId,
+                    const MXIMPIdentity& aMemberId,
+                    const TDesC16& aMemberDisplayName ) = 0;
+
+    };
+
+
+
+#endif // MXIMPFWPRESENTITYGROUPS_H
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_presence_management_api/inc/presentitypresenceevent.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,110 @@
+/*
+* 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:  Event interface for subscribed presentity presence information.
+*
+*/
+
+#ifndef MXIMPFWPRESENTITYPRESENCEEVENT_H
+#define MXIMPFWPRESENTITYPRESENCEEVENT_H
+
+#include <e32std.h>
+#include <ximpbase.h>
+#include <presencemanagementifids.hrh>
+
+
+class MXIMPIdentity;
+class MPresenceInfo;
+class MXIMPDataSubscriptionState;
+
+
+/**
+ * Event interface for subscribed presentity presence information.
+ *
+ * This interface is implemented by the XIMP Framework and
+ * event object is signalled to registered client observers
+ * through MXIMPContextObserver observer interface.
+ * This event notifies clients about changes in subscribed
+ * presentitys presence information.
+ *
+ * Clients subscribe for this event with
+ * MPresenceWatching::SubscribePresentityPresenceL().
+ *
+ * XIMP Framework signals this event when:
+ * - New subscribed data is received from protocol.
+ * - Data item data subscription status is updated by
+ *   protocol adaptation.
+ * - When client unsubscribes the data item.
+ * - XIMP Framework generates initial data notification
+ *   to client automatically after clients subscription,
+ *   when the initial data comes available from protocol.
+ *
+ * @ingroup ximppresmanagementapievents
+ * @since S60 v3.2
+ */
+class MPresentityPresenceEvent : public MXIMPBase
+    {
+public:
+    /** Interface ID for the MPresentityPresenceEvent. */
+    enum { KInterfaceId = PRES_IF_ID_PRESENTITY_PRESENCE_EVENT };
+
+
+protected:
+
+    /**
+     * Protected destructor.
+     * Object instancies can't be deleted via this interface.
+     */
+    virtual ~MPresentityPresenceEvent() {}
+
+
+public:
+
+
+    /**
+     * Returns indetity of the presentity which presence is
+     * notified here.
+     *
+     * @return The presentity identification.
+     */
+    virtual const MXIMPIdentity& PresentityId() const = 0;
+
+
+    /**
+     * Returns presence info object holding
+     * the subscribed presentitys presence information.
+     *
+     * @return The subscribed presentitys presence info.
+     *         Object ownership is not returned.
+     */
+    virtual const MPresenceInfo& SubscribedPresence() const = 0;
+
+
+    /**
+     * Returns subscription state object holding
+     * information about presentity presence subscription
+     * current state.
+     *
+     * @return The presentity presence subscription state object.
+     *         Object ownership is not returned.
+     */
+    virtual const MXIMPDataSubscriptionState& DataSubscriptionState() const = 0;
+
+
+    };
+
+
+#endif // MXIMPFWPRESENTITYPRESENCEEVENT_H
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_presence_management_api/ximp_presence_management_api.metaxml	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,27 @@
+<?xml version="1.0" ?>
+<api id="ebff949a6dd0d48b8634a0af6e346450" dataversion="1.0">
+  <name>XIMP Presence Management API</name>
+  <description>Contains interfaces for managing and accessing presence information. API provides interfaces for:
+- managing remote presence service connections
+- publishing and subscribing presence data
+- managing contact groups
+- managing presence authorizations</description>
+  <type>c++</type>
+  <subsystem>ximpfw</subsystem>
+  <libs><lib name="presencecacheecomhook.lib"/>
+<lib name="presencedatamodel.lib"/>
+<lib name="presencedatamodelhook.lib"/>
+<lib name="presenceecomhook.lib"/>
+<lib name="presencemanager.lib"/>
+<lib name="presenceoperation.lib"/>
+<lib name="presencecacheclient.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/imsrv_plat/ximp_presence_protocol_plugin_api/group/bld.inf	Wed Nov 03 09:32:20 2010 +0530
@@ -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 
+:                XIMP Presence Protocol Plug-in API
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+../inc/protocolpresencewatching.h     MW_LAYER_PLATFORM_EXPORT_PATH(protocolpresencewatching.h)
+../inc/protocolpresentitygroups.h     MW_LAYER_PLATFORM_EXPORT_PATH(protocolpresentitygroups.h)
+../inc/protocolpresenceauthorization.h     MW_LAYER_PLATFORM_EXPORT_PATH(protocolpresenceauthorization.h)
+../inc/protocolpresencefeatures.h     MW_LAYER_PLATFORM_EXPORT_PATH(protocolpresencefeatures.h)
+../inc/presenceprotocolpluginifids.hrh     MW_LAYER_PLATFORM_EXPORT_PATH(presenceprotocolpluginifids.hrh)
+../inc/protocolpresencepublishing.h     MW_LAYER_PLATFORM_EXPORT_PATH(protocolpresencepublishing.h)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_presence_protocol_plugin_api/inc/presenceprotocolpluginifids.hrh	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,60 @@
+/*
+* 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:  XIMP Framework Protocol Plugin API interface IDs.
+*
+*/
+
+#ifndef PRESENCEPROTOCOLPLUGINIFIDS_HRH
+#define PRESENCEPROTOCOLPLUGINIFIDS_HRH
+
+
+/**
+ * @defgroup ximppresprotocolpluginapi XIMP Presence Protocol Plugin API
+ * @ingroup ximppresenceapi
+ *
+ * XIMP Framework Presence Protocol Plugin API contains abstract
+ * interfaces what protocol adaptation plug-ins must implement.
+ * XIMP Framework will instantiate protocol plug-ins through
+ * ECom framework and call methods declared in these interfces.
+ *
+ * XIMP Framework will instantiate and execute protocol
+ * implementations on dedicated Symbian OS server process.
+ * Protocol implementations are loaded on need basis, based
+ * on XIMP Framework clients requests. Protocol adaptation
+ * must derive from CXIMPProtocolPluginBase and make
+ * concrete protocol implementation available through ECom
+ * framework.
+ *
+ * @since S60 v3.2
+ */
+
+// ECom interface UID for XIMPFw Protocol Plugin Base
+#define XIMP_ECOM_IF_UID_PROTOCOL_PLUGIN_BASE_INTERFACE     0x10282DD7
+
+
+// Protocol plugin IF id's
+// 30xx - ximp related
+// 31xx - presence related
+// 32xx - instant messaging related
+
+// Interface IDs for XIMPFw Protocol Plugin API interfaces
+#define PRES_IF_ID_PROTOCOL_PRESENCE_AUTHORIZATION          3101
+#define PRES_IF_ID_PROTOCOL_PRESENCE_PUBLISHING             3102
+#define PRES_IF_ID_PROTOCOL_PRESENCE_WATCHING               3103
+#define PRES_IF_ID_PROTOCOL_PRESENTITY_GROUPS               3104
+#define PRES_IF_ID_PROTOCOL_PRESENCE_FEATURES               3105
+
+#endif // PRESENCEPROTOCOLPLUGINIFIDS_HRH
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_presence_protocol_plugin_api/inc/protocolpresenceauthorization.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,344 @@
+/*
+* 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:  Interface for presence protocol authorization object.
+*
+*/
+
+#ifndef MXIMPFWPROTOCOLPRESENCEAUTHORIZATION_H
+#define MXIMPFWPROTOCOLPRESENCEAUTHORIZATION_H
+
+
+#include <e32std.h>
+#include <badesca.h>
+#include <presenceprotocolpluginifids.hrh>
+#include <ximpbase.h>
+
+
+class MXIMPIdentity;
+class MPresenceInfoFilter;
+
+
+/**
+ * Interface for presence protocol authorization object.
+ * Interface must be implemented by a XIMP Framework protocol
+ * plug-ins.
+ *
+ * This interface defines actions that XIMP Framework
+ * requests from a presence protocol connection to
+ * execute presence authorization related tasks.
+ *
+ * Protocol implementation must route requests received through
+ * this interface, to same remote presence service destination,
+ * as where the parent MXIMPProtocolConnection is connected.
+ * (Here the parent MXIMPProtocolConnection means the protocol
+ * connection instance from where this interface instance
+ * was retrieved.)
+ *
+ * @see MXIMPProtocolConnection
+ * @ingroup ximppresprotocolpluginapi
+ * @since S60 v3.2
+ */
+class MProtocolPresenceAuthorization : public MXIMPBase
+    {
+public:
+
+    /** Interface ID for the MProtocolPresenceAuthorization. */
+    enum { KInterfaceId = PRES_IF_ID_PROTOCOL_PRESENCE_AUTHORIZATION };
+
+
+protected:
+
+    /**
+     * Protected destructor. MProtocolPresenceAuthorization
+     * instancies can't be destroyed via this interface.
+     */
+    virtual inline ~MProtocolPresenceAuthorization() {};
+
+
+
+public: // Subscribe presence grant request list
+
+
+    /**
+     * Requests the protocol to subscribe presence
+     * grant request list from remote service.
+     *
+     * @param [in] aReqId
+     *        Request ID identifying the issued request.
+     */
+    virtual void DoSubscribePresenceGrantRequestListL(
+                    TXIMPRequestId aReqId ) = 0;
+
+
+    /**
+     * Requests the protocol to terminate presence
+     * grant request list subscription.
+     *
+     * @param [in] aReqId
+     *        Request ID identifying the issued request.
+     */
+    virtual void DoUnsubscribePresenceGrantRequestListL(
+                    TXIMPRequestId aReqId ) = 0;
+
+
+
+
+public: // Granting presence information access to single presentities
+
+
+    /**
+     * Requests the protocol to allow the identified presentity
+     * to see specified presence information.
+     *
+     * @param [in] aPresentityId
+     *        Identification of the presentity to which
+     *        to allow presence information access.
+     *
+     * @param [in] aPif
+     *        Presence information filter indicating the
+     *        allowed presence information.
+     *
+     * @param [in] aReqId
+     *        Request ID identifying the issued request.
+     */
+    virtual void DoGrantPresenceForPresentityL(
+                    const MXIMPIdentity& aPresentityId,
+                    const MPresenceInfoFilter& aPif,
+                    TXIMPRequestId aReqId ) = 0;
+
+
+    /**
+     * Requests the protocol to update presence information
+     * filter (PIF) for already existing presence grant.
+     *
+     * @param [in] aPresentityId
+     *        Identification of the presentity which presence
+     *        grant PIF to update.
+     *
+     * @param [in] aPif
+     *        Indicates the new set of presence information
+     *        to allow for the presentity. Given set
+     *        may be "wider" or "narrower" than the already
+     *        allowed one.
+     *
+     * @param [in] aReqId
+     *        Request ID identifying the issued request.
+     */
+    virtual void DoUpdatePresenceGrantPifForPresentityL(
+                    const MXIMPIdentity& aPresentityId,
+                    const MPresenceInfoFilter& aPif,
+                    TXIMPRequestId aReqId ) = 0;
+
+
+    /**
+     * Requests the protocol to withdraw existing
+     * presence information grant.
+     *
+     * @param [in] aPresentityId
+     *        Identification of the presentity which presence
+     *        grant to withdraw.
+     *
+     * @param [in] aReqId
+     *        Request ID identifying the issued request.
+     */
+    virtual void DoWithdrawPresenceGrantFromPresentityL(
+                    const MXIMPIdentity& aPresentityId,
+                    TXIMPRequestId aReqId ) = 0;
+
+
+
+
+public: // Granting presence information access to presentity group members
+
+
+    /**
+     * Requests the protocol to allow the identified presentity
+     * group members to see specified presence information.
+     *
+     *
+     * @param [in] aGroupId
+     *        Identification of the presentity group for which
+     *        members to allow presence information.
+     *
+     * @param [in] aPif
+     *        Presence information filter indicating the
+     *        allowed presence information.
+     *
+     * @param [in] aReqId
+     *        Request ID identifying the issued request.
+     */
+    virtual void DoGrantPresenceForPresentityGroupMembersL(
+                    const MXIMPIdentity& aGroupId,
+                    const MPresenceInfoFilter& aPif,
+                    TXIMPRequestId aReqId ) = 0;
+
+
+    /**
+     * Requests the protocol to update presence information
+     * filter (PIF) for already existing presentity group
+     * members presence grant.
+     *
+     * @param [in] aGroupId
+     *        Identification of the presentity group for which
+     *        members presence grant PIF to update.
+     *
+     * @param [in] aPif
+     *        Indicates the new set of presence information
+     *        to allow for the presentities. Given set
+     *        may be "wider" or "narrower" than the already
+     *        allowed one.
+     *
+     * @param [in] aReqId
+     *        Request ID identifying the issued request.
+     */
+    virtual void DoUpdatePresenceGrantPifForPresentityGroupMembersL(
+                    const MXIMPIdentity& aGroupId,
+                    const MPresenceInfoFilter& aPif,
+                    TXIMPRequestId aReqId ) = 0;
+
+
+    /**
+     * Requests the protocol to withdraw existing
+     * presentity group members presence information grant.
+     *
+     * @param [in] aGroupId
+     *        Identification of the presentity group
+     *        which members presence grant to terminate.
+     *
+     * @param [in] aReqId
+     *        Request ID identifying the issued request.
+     */
+    virtual void DoWithdrawPresenceGrantFromPresentityGroupMembersL(
+                    const MXIMPIdentity& aGroupId,
+                    TXIMPRequestId aReqId ) = 0;
+
+
+
+public: // Granting presence information access to everyone
+
+
+    /**
+     * Requests the protocol to allow everyone
+     * to see specified presence information.
+     *
+     * @param [in] aPif
+     *        Presence information filter indicating the
+     *        allowed presence information.
+     *
+     * @param [in] aReqId
+     *        Request ID identifying the issued request.
+     */
+    virtual void DoGrantPresenceForEveryoneL(
+                    const MPresenceInfoFilter& aPif,
+                    TXIMPRequestId aReqId ) = 0;
+
+
+    /**
+     * Requests the protocol to update presence information
+     * filter (PIF) for already existing presence grant.
+     *
+     * @param [in] aPif
+     *        Indicates the new set of presence information
+     *        to allow for the presentity. Given set
+     *        may be "wider" or "narrower" than the already
+     *        allowed one.
+     *
+     * @param [in] aReqId
+     *        Request ID identifying the issued request.
+     */
+    virtual void DoUpdatePresenceGrantPifForEveryoneL(
+                    const MPresenceInfoFilter& aPif,
+                    TXIMPRequestId aReqId ) = 0;
+
+
+    /**
+     * Requests the protocol to withdraw existing
+     * presence information grant.
+     *
+     * @param [in] aReqId
+     *        Request ID identifying the issued request.
+     */
+    virtual void DoWithdrawPresenceGrantFromEveryoneL(
+                    TXIMPRequestId aReqId ) = 0;
+
+
+public: // Subscribe presence block list
+
+
+    /**
+     * Requests the protocol to subscribe presence
+     * block list from remote service.
+     *
+     * @param [in] aReqId
+     *        Request ID identifying the issued request.
+     */
+    virtual void DoSubscribePresenceBlockListL(
+                    TXIMPRequestId aReqId ) = 0;
+
+
+    /**
+     * Requests the protocol to terminate presence
+     * block list subscription.
+     *
+     * @param [in] aReqId
+     *        Request ID identifying the issued request.
+     */
+    virtual void DoUnsubscribePresenceBlockListL(
+                    TXIMPRequestId aReqId ) = 0;
+
+
+
+public: // Blocking presence information access from single presentities
+
+
+    /**
+     * Requests the protocol to block the identified presentity
+     * from seeing presence information produced by this
+     * presence connection.
+     *
+     * After blocking, identified presentity can't anymore
+     * access the user own presence information.
+     *
+     * @param [in] aPresentityId
+     *        Identification of the presentity for which
+     *        presence information access to block.
+     *
+     * @param [in] aReqId
+     *        Request ID identifying the issued request.
+     */
+    virtual void DoBlockPresenceForPresentityL(
+                    const MXIMPIdentity& aPresentityId,
+                    TXIMPRequestId aReqId ) = 0;
+
+
+    /**
+     * Requests the protocol to cancel existing presence
+     * information block from the identified presentity.
+     *
+     * @param [in] aPresentityId
+     *        Identification of the presentity of which
+     *        presence information block to cancel.
+     *
+     * @param [in] aReqId
+     *        Request ID identifying the issued request.
+     */
+    virtual void DoCancelPresenceBlockFromPresentityL(
+                    const MXIMPIdentity& aPresentityId,
+                    TXIMPRequestId aReqId ) = 0;
+
+    };
+
+
+
+#endif // MXIMPFWPROTOCOLPRESENCEAUTHORIZATION_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_presence_protocol_plugin_api/inc/protocolpresencefeatures.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,220 @@
+/*
+* 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:  Interface for presence protocol connection object.
+*
+*/
+
+#ifndef MPRESENCEPROTOCOFEATURES_H
+#define MPRESENCEPROTOCOFEATURES_H
+
+
+#include <e32std.h>
+#include <badesca.h>
+#include <presenceprotocolpluginifids.hrh>
+#include <ximpbase.h>
+
+
+class MXIMPContextClientInfo;
+class MXIMPProtocolConnectionHost;
+class MProtocolPresenceWatching;
+class MProtocolPresencePublishing;
+class MProtocolPresentityGroups;
+class MProtocolPresenceAuthorization;
+
+
+
+/**
+ * Interface for presence protocol connection object.
+ * Interface must be implemented by a XIMP Framework protocol
+ * plug-ins.
+ *
+ * This interface models a connection from XIMP Framework to
+ * single remote presence service, over certain presence protocol
+ * implementation. XIMP Framework calls methods on this interface
+ * based on XIMP Framework client requests.
+ *
+ * XIMP Framework retrieves MXIMPProtocolConnection
+ * instances through MXIMPProtocolPlugin::AcquireConnectionL().
+ * Same MXIMPProtocolConnection instance may be returned by multiple
+ * MXIMPProtocolPlugin::AcquireConnectionL() calls. In this case
+ * XIMP Framework shares MXIMPProtocolConnection instance
+ * by multiple clients, and MXIMPProtocolConnection lifetime is
+ * extended over utilizing client sessions. When last utilizing
+ * client session is succesfully closed with
+ * MXIMPProtocolConnection::CloseSession(), XIMP Framework
+ * disposes the MXIMPProtocolConnection instance with
+ * MXIMPProtocolPlugin::ReleaseConnection().
+ *
+ *
+ * MProtocolPresenceFeatures implementation must provide
+ * access following feature specific sub-interfaces:
+ * - MProtocolPresenceWatching
+ * - MProtocolPresencePublishing
+ * - MProtocolPresentityGroups
+ * - MProtocolPresenceAuthorization
+ *
+ * Each provided sub-interface defines a set of its own
+ * presence managements requests, relating to presence watching
+ * and subscribing, presence publication, presentity groups and
+ * presentity group member management and to presence authorizations.
+ * XIMP Framework calls these sub-interfaces to request on
+ * spesific presence requests from protocol connection.
+ *
+ * @see MXIMPProtocolConnectionHost
+ * @ingroup ximppresprotocolpluginapi
+ * @since S60 v3.2
+ */
+class MProtocolPresenceFeatures : public MXIMPBase
+    {
+public:
+
+    /** Interface ID for the MXIMPProtocolConnection. */
+    enum { KInterfaceId = PRES_IF_ID_PROTOCOL_PRESENCE_FEATURES };
+
+
+protected:
+
+    /**
+     * Protected destructor. MXIMPProtocolConnection
+     * objects can't be deleted through this interface.
+     *
+     * XIMP Framework disposes MXIMPProtocolConnection
+     * instances through MXIMPProtocolPlugin::ReleaseConnection().
+     */
+    virtual inline ~MProtocolPresenceFeatures() {};
+
+
+
+public: // Access to sub-interfaces
+
+
+    /**
+     * Gets reference to presence watching interface.
+     *
+     * XIMP Framework calls this method to retrieve a reference
+     * to protocols MProtocolPresenceWatching interface
+     * implementation.
+     *
+     * Call and interface lifetime convention:
+     * - This method isn't called before protocol has signalled
+     *   MXIMPProtocolConnection::OpenSessionL() succesfully completed.
+     *
+     * - XIMP Framework may call this method multiple times for
+     *   for one MXIMPProtocolConnection instance.
+     *
+     * - Each call per one MXIMPProtocolConnection instance,
+     *   must return reference to same interface instance.
+     *
+     * - Returned interface instance must remain valid (usable)
+     *   untill last client session, using originating presence protocol
+     *   connection is successfully closed with
+     *   MXIMPProtocolConnection::CloseSession().
+     *
+     * @return Requested interface.
+     *         interface ownership is not returned caller.
+     */
+    virtual MProtocolPresenceWatching& PresenceWatching() = 0;
+
+
+
+    /**
+     * Gets reference to presence publishing interface.
+     *
+     * XIMP Framework calls this method to retrieve a reference
+     * to protocols MProtocolPresencePublishing interface
+     * implementation.
+     *
+     * Call and interface lifetime convention:
+     * - This method isn't called before protocol has signalled
+     *   MXIMPProtocolConnection::OpenSessionL() succesfully completed.
+     *
+     * - XIMP Framework may call this method multiple times for
+     *   for one MXIMPProtocolConnection instance.
+     *
+     * - Each call per one MXIMPProtocolConnection instance,
+     *   must return reference to same interface instance.
+     *
+     * - Returned interface instance must remain valid (usable)
+     *   untill last client session, using originating presence protocol
+     *   connection is successfully closed with
+     *   MXIMPProtocolConnection::CloseSession().
+     *
+     * @return Requested interface.
+     *         interface ownership is not returned caller.
+     */
+    virtual MProtocolPresencePublishing& PresencePublishing() = 0;
+
+
+
+    /**
+     * Gets reference to presentity groups interface.
+     *
+     * XIMP Framework calls this method to retrieve a reference
+     * to protocols MProtocolPresentityGroups interface
+     * implementation.
+     *
+     * Call and interface lifetime convention:
+     * - This method isn't called before protocol has signalled
+     *   MXIMPProtocolConnection::OpenSessionL() succesfully completed.
+     *
+     * - XIMP Framework may call this method multiple times for
+     *   for one MXIMPProtocolConnection instance.
+     *
+     * - Each call per one MXIMPProtocolConnection instance,
+     *   must return reference to same interface instance.
+     *
+     * - Returned interface instance must remain valid (usable)
+     *   untill last client session, using originating presence protocol
+     *   connection is successfully closed with
+     *   MXIMPProtocolConnection::CloseSession().
+     *
+     * @return Requested interface.
+     *         interface ownership is not returned caller.
+     */
+    virtual MProtocolPresentityGroups& PresentityGroups() = 0;
+
+
+
+    /**
+     * Gets reference to presence authorization interface.
+     *
+     * XIMP Framework calls this method to retrieve a reference
+     * to protocols MProtocolPresenceAuthorization interface
+     * implementation.
+     *
+     * Call and interface lifetime convention:
+     * - This method isn't called before protocol has signalled
+     *   MXIMPProtocolConnection::OpenSessionL() succesfully completed.
+     *
+     * - XIMP Framework may call this method multiple times for
+     *   for one MXIMPProtocolConnection instance.
+     *
+     * - Each call per one MXIMPProtocolConnection instance,
+     *   must return reference to same interface instance.
+     *
+     * - Returned interface instance must remain valid (usable)
+     *   untill last client session, using originating presence protocol
+     *   connection is successfully closed with
+     *   MXIMPProtocolConnection::CloseSession().
+     *
+     * @return Requested interface.
+     *         interface ownership is not returned caller.
+     */
+    virtual MProtocolPresenceAuthorization& PresenceAuthorization() = 0;
+
+    };
+
+
+
+#endif // MPRESENCEPROTOCOFEATURES_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_presence_protocol_plugin_api/inc/protocolpresencepublishing.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,170 @@
+/*
+* 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:  Interface for presence protocol publishing object.
+*
+*/
+
+#ifndef MXIMPFWPROTOCOLPRESENCEPUBLISHING_H
+#define MXIMPFWPROTOCOLPRESENCEPUBLISHING_H
+
+
+#include <e32std.h>
+#include <badesca.h>
+#include <presenceprotocolpluginifids.hrh>
+#include <ximpbase.h>
+
+
+class MPresenceInfo;
+class MPresenceInfoFilter;
+class MXIMPIdentity;
+
+
+/**
+ * Interface for presence protocol publishing object.
+ * Interface must be implemented by a XIMP Framework protocol
+ * plug-ins.
+ *
+ * This interface defines actions that XIMP Framework
+ * requests from a presence protocol connection to
+ * execute presence publishing related tasks.
+ *
+ * Protocol implementation must route requests received through
+ * this interface, to same remote presence service destination,
+ * as where the parent MXIMPProtocolConnection is connected.
+ * (Here the parent MXIMPProtocolConnection means the protocol
+ * connection instance from where this interface instance
+ * was retrieved.)
+ *
+ * @see MXIMPProtocolConnection
+ * @ingroup ximppresprotocolpluginapi
+ * @since S60 v3.2
+ */
+class MProtocolPresencePublishing : public MXIMPBase
+    {
+public:
+
+    /** Interface ID for the MProtocolPresencePublishing. */
+    enum { KInterfaceId = PRES_IF_ID_PROTOCOL_PRESENCE_PUBLISHING };
+
+
+protected:
+
+    /**
+     * Protected destructor. MProtocolPresencePublishing
+     * instancies can't be destroyed via this interface.
+     */
+    virtual inline ~MProtocolPresencePublishing() {};
+
+
+
+public: // Publish user own presence information
+
+
+    /**
+     * Requests the protocol to publish user own
+     * presence information to remote service.
+     *
+     *
+     * @param [in] aOwnPresence
+     *        Presence info indicating the own presence
+     *        information to publish to remote service.
+     *
+     * @param [in] aReqId
+     *        Request ID identifying the issued request.
+     */
+    virtual void DoPublishOwnPresenceL(
+                    const MPresenceInfo& aOwnPresence,
+                    TXIMPRequestId aReqId ) = 0;
+
+
+
+
+public: // Subscribe user own presence information
+
+
+    /**
+     * Requests the protocol to subscribe user own
+     * presence information from remote service.
+     *
+     * @param [in] aPif
+     *        Presence information filter indicating the set
+     *        of presence information to subscribe.
+     *
+     * @param [in] aReqId
+     *        Request ID identifying the issued request.
+     */
+    virtual void DoSubscribeOwnPresenceL(
+                    const MPresenceInfoFilter& aPif,
+                    TXIMPRequestId aReqId ) = 0;
+
+
+    /**
+     * Requests the protocol to update presence information
+     * filter (PIF) for already existing own presence subscription.
+     *
+     * @param [in] aPif
+     *        Indicates the new set of presence information
+     *        to subscribe. Given set may be "wider" or "narrower"
+     *        than the already subscribed one.
+     *
+     * @param [in] aReqId
+     *        Request ID identifying the issued request.
+     */
+    virtual void DoUpdateOwnPresenceSubscriptionPifL(
+                    const MPresenceInfoFilter& aPif,
+                    TXIMPRequestId aReqId ) = 0;
+
+
+    /**
+     * Requests the protocol to terminate own presence
+     * information subscription.
+     *
+     * @param [in] aReqId
+     *        Request ID identifying the issued request.
+     */
+    virtual void DoUnsubscribeOwnPresenceL(
+                    TXIMPRequestId aReqId ) = 0;
+
+
+
+
+public: // Subscribe presence watcher list content
+
+
+    /**
+     * Requests the protocol to subscribe presence
+     * watcher list content from remote service.
+     *
+     * @param [in] aReqId
+     *        Request ID identifying the issued request.
+     */
+    virtual void DoSubscribePresenceWatcherListL(
+                    TXIMPRequestId aReqId ) = 0;
+
+
+    /**
+     * Requests the protocol to terminate presence
+     * watcher list content subscription.
+     *
+     * @param [in] aReqId
+     *        Request ID identifying the issued request.
+     */
+    virtual void DoUnsubscribePresenceWatcherListL(
+                    TXIMPRequestId aReqId ) = 0;
+
+    };
+
+
+
+#endif // MXIMPFWPROTOCOLPRESENCEPUBLISHING_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_presence_protocol_plugin_api/inc/protocolpresencewatching.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,205 @@
+/*
+* 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:  Interface for presence protocol watching object.
+*
+*/
+
+#ifndef MXIMPFWPROTOCOLPRESENCEWATCHING_H
+#define MXIMPFWPROTOCOLPRESENCEWATCHING_H
+
+#include <e32std.h>
+#include <badesca.h>
+#include <presenceprotocolpluginifids.hrh>
+#include <ximpbase.h>
+
+
+class MPresenceInfo;
+class MPresenceInfoFilter;
+class MXIMPIdentity;
+
+
+/**
+ * Interface for presence protocol watching object.
+ * Interface must be implemented by a XIMP Framework protocol
+ * plug-ins.
+ *
+ * This interface defines actions that XIMP Framework
+ * requests from a presence protocol connection to
+ * execute presence watching related tasks.
+ *
+ * Protocol implementation must route requests received through
+ * this interface, to same remote presence service destination,
+ * as where the parent MXIMPProtocolConnection is connected.
+ * (Here the parent MXIMPProtocolConnection means the protocol
+ * connection instance from where this interface instance
+ * was retrieved.)
+ *
+ * @see MXIMPProtocolConnection
+ * @ingroup ximppresprotocolpluginapi
+ * @since S60 v3.2
+ */
+class MProtocolPresenceWatching : public MXIMPBase
+    {
+public:
+
+    /** Interface ID for the MProtocolPresenceWatching. */
+    enum { KInterfaceId = PRES_IF_ID_PROTOCOL_PRESENCE_WATCHING };
+
+
+protected:
+
+    /**
+     * Protected destructor. MProtocolPresenceWatching
+     * instancies can't be destroyed via this interface.
+     */
+    virtual inline ~MProtocolPresenceWatching() {};
+
+
+
+public: // Subscribe presence information from single presentities
+
+
+    /**
+     * Requests the protocol to subscribe presence information
+     * for identified presentity.
+     *
+     * @param [in] aPresentityId
+     *        Identification of the presentity which presence
+     *        information subscribe to.
+     *
+     * @param [in] aPif
+     *        Presence information filter indicating the set
+     *        of presence information to request from the
+     *        presentity.
+     *
+     * @param [in] aReqId
+     *        Request ID identifying the issued request.
+     */
+    virtual void DoSubscribePresentityPresenceL(
+                    const MXIMPIdentity& aPresentityId,
+                    const MPresenceInfoFilter& aPif,
+                    TXIMPRequestId aReqId ) = 0;
+
+
+    /**
+     * Requests the protocol to update presence information
+     * filter (PIF) for already existing presence subscription.
+     *
+     * @param [in] aPresentityId
+     *        Identification of the presentity which presence
+     *        subscribtion PIF to update.
+     *
+     * @param [in] aPif
+     *        Indicates the new set of presence information
+     *        to request from the presentity. Given set
+     *        may be "wider" or "narrower" than the already
+     *        subscribed one.
+     *
+     * @param [in] aReqId
+     *        Request ID identifying the issued request.
+     */
+    virtual void DoUpdatePresentityPresenceSubscriptionPifL(
+                    const MXIMPIdentity& aPresentityId,
+                    const MPresenceInfoFilter& aPif,
+                    TXIMPRequestId aReqId ) = 0;
+
+
+    /**
+     * Requests the protocol to terminate presentity
+     * presence information subscription.
+     *
+     * @param [in] aPresentityId
+     *        Identification of the presentity which presence
+     *        subscribtion to terminate.
+     *
+     * @param [in] aReqId
+     *        Request ID identifying the issued request.
+     */
+    virtual void DoUnsubscribePresentityPresenceL(
+                    const MXIMPIdentity& aPresentityId,
+                    TXIMPRequestId aReqId ) = 0;
+
+
+
+
+public: // Subscribe presence information from presentity group members
+
+
+    /**
+     * Requests the protocol to subscribe presence information
+     * for all the presentities existing in the identified
+     * presentity group.
+     *
+     * @param [in] aGroupId
+     *        Identification of the presentity group for which
+     *        members to request presence information.
+     *
+     * @param [in] aPif
+     *        Presence information filter indicating the set
+     *        of presence information to request from the
+     *        presentity group members.
+     *
+     * @param [in] aReqId
+     *        Request ID identifying the issued request.
+     */
+    virtual void DoSubscribePresentityGroupMembersPresenceL(
+                    const MXIMPIdentity& aGroupId,
+                    const MPresenceInfoFilter& aPif,
+                    TXIMPRequestId aReqId ) = 0;
+
+
+    /**
+     * Requests the protocol to update presence information
+     * filter (PIF) for already existing presentity group
+     * members presence subscription.
+     *
+     * @param [in] aGroupId
+     *        Identification of the presentity group for which
+     *        members presence subscribtion PIF to update.
+     *
+     * @param [in] aPif
+     *        Indicates the new set of presence information
+     *        to request from the presentities. Given set
+     *        may be "wider" or "narrower" than the already
+     *        subscribed one.
+     *
+     * @param [in] aReqId
+     *        Request ID identifying the issued request.
+     */
+    virtual void DoUpdatePresentityGroupMembersPresenceSubscriptionPifL(
+                    const MXIMPIdentity& aGroupId,
+                    const MPresenceInfoFilter& aPif,
+                    TXIMPRequestId aReqId ) = 0;
+
+
+    /**
+     * Requests the protocol to terminate presentity group
+     * members presence information subscription.
+     *
+     * @param [in] aGroupId
+     *        Identification of the presentity group
+     *        which members presence subscribtion to terminate.
+     *
+     * @param [in] aReqId
+     *        Request ID identifying the issued request.
+     */
+    virtual void DoUnsubscribePresentityGroupMembersPresenceL(
+                    const MXIMPIdentity& aGroupId,
+                    TXIMPRequestId aReqId ) = 0;
+
+    };
+
+
+
+#endif // MXIMPFWPROTOCOLPRESENCEWATCHING_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_presence_protocol_plugin_api/inc/protocolpresentitygroups.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,265 @@
+/*
+* 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:  Interface for presence protocol presentity groups object.
+*
+*/
+
+#ifndef MXIMPFWPROTOCOLPRESENTITYGROUPS_H
+#define MXIMPFWPROTOCOLPRESENTITYGROUPS_H
+
+
+#include <e32std.h>
+#include <badesca.h>
+#include <presenceprotocolpluginifids.hrh>
+#include <ximpbase.h>
+
+
+class MXIMPIdentity;
+
+
+
+/**
+ * Interface for presence protocol presentity groups object.
+ * Interface must be implemented by a XIMP Framework protocol
+ * plug-ins.
+ *
+ * This interface defines actions that XIMP Framework
+ * requests from a presence protocol connection to
+ * execute presentity groups related tasks.
+ *
+ * Protocol implementation must route requests received through
+ * this interface, to same remote presence service destination,
+ * as where the parent MXIMPProtocolConnection is connected.
+ * (Here the parent MXIMPProtocolConnection means the protocol
+ * connection instance from where this interface instance
+ * was retrieved.)
+ *
+ * @see MXIMPProtocolConnection
+ * @ingroup ximppresprotocolpluginapi
+ * @since S60 v3.2
+ */
+class MProtocolPresentityGroups : public MXIMPBase
+    {
+public:
+
+    /** Interface ID for the MProtocolPresentityGroups. */
+    enum { KInterfaceId = PRES_IF_ID_PROTOCOL_PRESENTITY_GROUPS };
+
+
+protected:
+
+    /**
+     * Protected destructor. MProtocolPresentityGroups
+     * instancies can't be destroyed via this interface.
+     */
+    virtual inline ~MProtocolPresentityGroups() {};
+
+
+
+public: // Subscribe presentity group list content
+
+
+    /**
+     * Requests the protocol to subscribe presentity
+     * group list content from remote service.
+     *
+     * @param [in] aReqId
+     *        Request ID identifying the issued request.
+     */
+    virtual void DoSubscribePresentityGroupListL(
+                    TXIMPRequestId aReqId ) = 0;
+
+
+    /**
+     * Requests the protocol to terminate presentity
+     * group list content subscription.
+     *
+     * @param [in] aReqId
+     *        Request ID identifying the issued request.
+     */
+    virtual void DoUnsubscribePresentityGroupListL(
+                    TXIMPRequestId aReqId ) = 0;
+
+
+
+public: // Manage presentity groups
+
+
+    /**
+     * Requests the protocol to create new presentity
+     * group to remote service.
+     *
+     * @param [in] aGroupId
+     *        Identification of the presentity group to create.
+     *
+     * @param [in] aDisplayName
+     *        Display name for the created presentity group.
+     *
+     * @param [in] aReqId
+     *        Request ID identifying the issued request.
+     */
+    virtual void DoCreatePresentityGroupL(
+                    const MXIMPIdentity& aGroupId,
+                    const TDesC16& aDisplayName,
+                    TXIMPRequestId aReqId ) = 0;
+
+
+    /**
+     * Requests the protocol to delete existing presentity
+     * group from remote service.
+     *
+     * @param [in] aGroupId
+     *        Identification of the presentity group to delete.
+     *
+     * @param [in] aReqId
+     *        Request ID identifying the issued request.
+     */
+    virtual void DoDeletePresentityGroupL(
+                    const MXIMPIdentity& aGroupId,
+                    TXIMPRequestId aReqId ) = 0;
+
+
+    /**
+     * Requests the protocol to update existing presentity
+     * group display name on remote service.
+     *
+     * @param [in] aGroupId
+     *        Identification of the presentity group which
+     *        display name to update.
+     *
+     * @param [in] aDisplayName
+     *        New display name for the presentity group.
+
+     * @param [in] aReqId
+     *        Request ID identifying the issued request.
+     */
+    virtual void DoUpdatePresentityGroupDisplayNameL(
+                    const MXIMPIdentity& aGroupId,
+                    const TDesC16& aDisplayName,
+                    TXIMPRequestId aReqId ) = 0;
+
+
+
+public: // Subscribe presentity group content
+
+    /**
+     * Requests the protocol to subscribe presentity
+     * group content from remote service.
+     *
+     * @param [in] aGroupId
+     *        Identification of the presentity group of which
+     *        content to subscribe.
+     *
+     * @param [in] aReqId
+     *        Request ID identifying the issued request.
+     */
+    virtual void DoSubscribePresentityGroupContentL(
+                    const MXIMPIdentity& aGroupId,
+                    TXIMPRequestId aReqId ) = 0;
+
+
+    /**
+     * Requests the protocol to terminate presentity
+     * group content subscription.
+     *
+     * @param [in] aGroupId
+     *        Identification of the presentity group of which
+     *        content subscribtion to terminate.
+     *
+     * @param [in] aReqId
+     *        Request ID identifying the issued request.
+     */
+    virtual void DoUnsubscribePresentityGroupContentL(
+                    const MXIMPIdentity& aGroupId,
+                    TXIMPRequestId aReqId ) = 0;
+
+
+
+
+public: // Manage presentity group members
+
+
+    /**
+     * Requests the protocol to add new member to
+     * identified presentity group.
+     *
+     * @param [in] aGroupId
+     *        Identification of the presentity group where to
+     *        add new member.
+     *
+     * @param [in] aMemberId
+     *        Identification of the new member.
+     *
+     * @param [in] aMemberDisplayName
+     *        Display name for the added member.
+     *
+     * @param [in] aReqId
+     *        Request ID identifying the issued request.
+     */
+    virtual void DoAddPresentityGroupMemberL(
+                    const MXIMPIdentity& aGroupId,
+                    const MXIMPIdentity& aMemberId,
+                    const TDesC16& aMemberDisplayName,
+                    TXIMPRequestId aReqId ) = 0;
+
+
+    /**
+     * Requests the protocol to remove member from
+     * identified presentity group.
+     *
+     * @param [in] aGroupId
+     *        Identification of the presentity group from
+     *        where to remove member.
+     *
+     * @param [in] aMemberId
+     *        Identification of the member to remove.
+     *
+     * @param [in] aReqId
+     *        Request ID identifying the issued request.
+     */
+    virtual void DoRemovePresentityGroupMemberL(
+                    const MXIMPIdentity& aGroupId,
+                    const MXIMPIdentity& aMemberId,
+                    TXIMPRequestId aReqId ) = 0;
+
+
+    /**
+     * Requests the protocol to update presentity group
+     * member display name.
+     *
+     * @param [in] aGroupId
+     *        Identification of the presentity group of which
+     *        member display name to update.
+     *
+     * @param [in] aMemberId
+     *        Identification of the member which display
+     *        name to update.
+     *
+     * @param [in] aMemberDisplayName
+     *        New display name for the member.
+     *
+     * @param [in] aReqId
+     *        Request ID identifying the issued request.
+     */
+    virtual void DoUpdatePresentityGroupMemberDisplayNameL(
+                    const MXIMPIdentity& aGroupId,
+                    const MXIMPIdentity& aMemberId,
+                    const TDesC16& aMemberDisplayName,
+                    TXIMPRequestId aReqId ) = 0;
+
+    };
+
+
+
+#endif // MXIMPFWPROTOCOLPRESENTITYGROUPS_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_presence_protocol_plugin_api/ximp_presence_protocol_plugin_api.metaxml	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,23 @@
+<?xml version="1.0" ?>
+<api id="10eedded1e474d07f3e75f751efc0a18" dataversion="1.0">
+  <name>XIMP Presence Protocol Plug-in API</name>
+  <description>API contains ECom plug-in interface that must be implemented by the presence protocol plug-ins. The plug-in interface aggregates functionality to send and request presence data from remote presence service.</description>
+  <type>c++</type>
+  <subsystem>ximpfw</subsystem>
+  <libs><lib name="presencecacheecomhook.lib"/>
+<lib name="presencedatamodel.lib"/>
+<lib name="presencedatamodelhook.lib"/>
+<lib name="presenceecomhook.lib"/>
+<lib name="presencemanager.lib"/>
+<lib name="presenceoperation.lib"/>
+<lib name="presencecacheclient.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/imsrv_plat/ximp_presence_protocol_plugin_host_api/group/bld.inf	Wed Nov 03 09:32:20 2010 +0530
@@ -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 
+:                XIMP Presence Protocol Plug-in Host API
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+../inc/protocolpresencewatchingdatahost.h     MW_LAYER_PLATFORM_EXPORT_PATH(protocolpresencewatchingdatahost.h)
+../inc/protocolpresenceauthorizationdatahost.h     MW_LAYER_PLATFORM_EXPORT_PATH(protocolpresenceauthorizationdatahost.h)
+../inc/protocolpresentitygroupsdatahost.h     MW_LAYER_PLATFORM_EXPORT_PATH(protocolpresentitygroupsdatahost.h)
+../inc/protocolpresencedatahost.h     MW_LAYER_PLATFORM_EXPORT_PATH(protocolpresencedatahost.h)
+../inc/presenceprotocolpluginhostifids.hrh     MW_LAYER_PLATFORM_EXPORT_PATH(presenceprotocolpluginhostifids.hrh)
+../inc/protocolpresencepublishingdatahost.h     MW_LAYER_PLATFORM_EXPORT_PATH(protocolpresencepublishingdatahost.h)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_presence_protocol_plugin_host_api/inc/presenceprotocolpluginhostifids.hrh	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,56 @@
+/*
+* 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:  Protocol Plugin Host API interface IDs.
+*
+*/
+
+#ifndef PRESENCEPROTOCOLPLUGINHOSTIFIDS_HRH
+#define PRESENCEPROTOCOLPLUGINHOSTIFIDS_HRH
+
+
+/**
+ * @defgroup ximppresprotocolpluginhostapi XIMP Presence Protocol Plugin Host API
+ * @ingroup ximppresenceapi
+ *
+ * Protocol Plugin Host API contains abstract interfaces what
+ * XIMP Framework implements, and what protocol adaptation
+ * plug-ins must use to communicate back to XIMP Framework
+ * direction. XIMP Framework registeres these callback interfaces
+ * to protocol adaptation plug-ins, after instantiating plug-in
+ * objects, but before using them any other way.
+ *
+ * MXIMPProtocolPluginHost interface is the callback interface for
+ * the MXIMPProtocolPlugin.
+ *
+ * MXIMPProtocolConnectionHost interface is the callback interface for
+ * the MXIMPProtocolConnection.
+ *
+ * @since S60 v3.2
+ */
+
+// Protocol plugin host IF id's
+// 40xx - ximp related
+// 41xx - presence related
+// 42xx - instant messaging related
+
+// Interface IDs for XIMPFw Protocol Plugin Host interfaces
+#define PRES_IF_ID_PROTOCOL_PRESENTITY_GROUPS_DATAHOST         4101
+#define PRES_IF_ID_PROTOCOL_PRESENCE_PUBLISHING_DATAHOST       4102
+#define PRES_IF_ID_PROTOCOL_PRESENCE_WATCHING_DATAHOST         4103
+#define PRES_IF_ID_PROTOCOL_PRESENCE_AUTHORIZATION_DATAHOST    4104
+#define PRES_IF_ID_PROTOCOL_PRESENCE_DATAHOST                  4105
+
+#endif // PRESENCEPROTOCOLPLUGINHOSTIFIDS_HRH
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_presence_protocol_plugin_host_api/inc/protocolpresenceauthorizationdatahost.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,395 @@
+/*
+* 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:  Interface for managing cached presence authorization information.
+*
+*/
+
+#ifndef MXIMPFWPROTOCOLPRESENCEAUTHORIZATIONDATAHOST_H
+#define MXIMPFWPROTOCOLPRESENCEAUTHORIZATIONDATAHOST_H
+
+#include <e32std.h>
+#include <presenceprotocolpluginhostifids.hrh>
+#include <ximpbase.h>
+
+
+class MXIMPIdentity;
+class MXIMPObjectCollection;
+class MPresenceBlockInfo;
+class MPresenceGrantRequestInfo;
+class MXIMPDataSubscriptionState;
+class MXIMPStatus;
+
+
+
+/**
+ * Interface for managing cached presence authorization information.
+ *
+ * Interface is used by protocol adaptations to manage
+ * presence authorization related information in
+ * XIMP Framework internal data cache.
+ *
+ * This interface is implemented by XIMP Framework.
+ * Protocol adaptation can obtain reference to this
+ * interface from MXIMPProtocolConnectionHost interface.
+ *
+ * For each separated protocol connection, protocol
+ * adaptation must use the specific
+ * MProtocolPresentityGroupsDataHost instance,
+ * what is received from the connection specific
+ * MXIMPProtocolConnectionHost instance.
+ *
+ * @ingroup ximppresprotocolpluginhostapi
+ * @since S60 v3.2
+ */
+class MProtocolPresenceAuthorizationDataHost : public MXIMPBase
+    {
+public:
+
+    /** Interface ID for the MProtocolPresenceAuthorizationDataHost. */
+    enum { KInterfaceId = PRES_IF_ID_PROTOCOL_PRESENCE_AUTHORIZATION_DATAHOST };
+
+
+protected:
+
+
+    /**
+     * Protected destructor. Object instancies
+     * can't be deleted via this interface.
+     */
+    virtual ~MProtocolPresenceAuthorizationDataHost() {}
+
+
+
+public: // Handling presence grant requests
+
+
+    /**
+     * Notifies XIMP Framework from
+     * presence grant request list contents.
+     *
+     * Protocol adaptation implementation can call this
+     * method to notify XIMP Framework from
+     * complete presence grant request list content.
+     * XIMP Framework calculates the changes
+     * (new and obsoleted requests) from previous
+     * presence grant request list content, and notifies
+     * the subscribing clients from data changes.
+     *
+     * XIMP Framework takes ownership of the object
+     * collection and all objects contained within, if
+     * the method succeeds without a leave.
+     *
+     * @param [in] aGrantRequestList
+     *        MXIMPObjectCollection object containing zero or
+     *        more MPresenceGrantRequestInfo objects. Each
+     *        contained MPresenceGrantRequestInfo shall present
+     *        single presence grant request entry in the list of
+     *        presence grant requests.
+     *
+     * @return The request ID identifying the issued request.
+     *         Data cache update request is processed
+     *         asynchronously and operation completion result is
+     *         signalled to adaptation direction through
+     *         MXIMPProtocolConnectionHostObserver interface.
+     *
+     * @leave KErrNoMemory if failed to allocate memory.
+     * @leave KErrArgument if NULL argument(s) were provided.
+     */
+    virtual TXIMPRequestId HandlePresenceGrantRequestListL(
+                MXIMPObjectCollection* aGrantRequestList ) = 0;
+
+
+
+    /**
+     * Notifies XIMP Framework from new presence grant request.
+     *
+     * Protocol adaptation implementation can call this
+     * method to notify XIMP Framework from
+     * new presence grant request. XIMP Framework calculates
+     * the change, from previous presence grant request list content,
+     * and notifies the subscribing clients from data changes.
+     *
+     * XIMP Framework takes ownership of the argument(s),
+     * if method succeeds without a leave.
+     *
+     * @param [in] aGrantRequest
+     *        MPresenceGrantRequestInfo object holding
+     *        information about new presence grant request
+     *        entry.
+     *
+     * @return The request ID identifying the issued request.
+     *         Data cache update request is processed
+     *         asynchronously and operation completion result is
+     *         signalled to adaptation direction through
+     *         MXIMPProtocolConnectionHostObserver interface.
+     *
+     * @leave KErrNoMemory if failed to allocate memory.
+     * @leave KErrArgument if NULL argument(s) were provided.
+     */
+    virtual TXIMPRequestId HandlePresenceGrantRequestReceivedL(
+                MPresenceGrantRequestInfo* aGrantRequest ) = 0;
+
+
+
+    /**
+     * Notifies XIMP Framework that existing presence
+     * grant request is obsoleted.
+     *
+     * Notifies XIMP Framework that existing presence
+     * grant request is obsoleted and thus it needs be removed
+     * from presence grant request list. XIMP Framework
+     * calculates the change, from previous presence grant request
+     * list content, and notifies the subscribing clients from
+     * data changes.
+     *
+     * XIMP Framework takes ownership of the argument(s),
+     * if method succeeds without a leave.
+     *
+     * @param [in] aGrantRequestor
+     *        Identity of the presence grant requestor, which
+     *        presence grant request needs to be removed
+     *        from presence grant request list.
+     *
+     * @return The request ID identifying the issued request.
+     *         Data cache update request is processed
+     *         asynchronously and operation completion result is
+     *         signalled to adaptation direction through
+     *         MXIMPProtocolConnectionHostObserver interface.
+     *
+     * @leave KErrNoMemory if failed to allocate memory.
+     * @leave KErrArgument if NULL argument(s) were provided.
+     */
+    virtual TXIMPRequestId HandlePresenceGrantRequestObsoletedL(
+                MXIMPIdentity* aGrantRequestor ) = 0;
+
+
+
+    /**
+     * Gets data subscription state for presence grant request list.
+     *
+     * Protocol adaptation can call this method to retrieve
+     * presence grant request list current data subscription state.
+     * Protocol adaptation can use data subscription state
+     * information, to optimize its own processing and
+     * network trafic amount.
+     *
+     * @return Presence grant request list data subscription state.
+     *         Interface ownership is not returned to caller.
+     *         Caller shouldn't cache the returned reference
+     *         for later use.
+     */
+    virtual const MXIMPDataSubscriptionState&
+                PresenceGrantRequestDataSubscriptionState() const = 0;
+
+
+
+    /**
+     * Updates data subscription state for presence grant
+     * request list.
+     *
+     * Updates data subscription state for presence grant
+     * request list. XIMP Framework calculates the
+     * subscription state change, from previous
+     * presence grant request list content, and notifies the
+     * subscribing clients from data changes.
+     *
+     * XIMP Framework takes ownership of the argument(s),
+     * if method succeeds without a leave.
+     *
+     * @param [in] aSubscriptionState
+     *        New data subscription state for presence grant
+     *        request list.
+     *
+     * @param [in] aStatus
+     *        Optional status object describing the
+     *        the reason, why protocol adaptation updated
+     *        data item subscription state. Given status object
+     *        is passed to clients through data item specific
+     *        data change event. NULL value is accepted.
+     *
+     * @return The request ID identifying the issued request.
+     *         Data cache update request is processed
+     *         asynchronously and operation completion result is
+     *         signalled to adaptation direction through
+     *         MXIMPProtocolConnectionHostObserver interface.
+     *
+     * @leave KErrNoMemory if failed to allocate memory.
+     * @leave KErrArgument if NULL subscription state argument was provided.
+     */
+    virtual TXIMPRequestId SetPresenceGrantRequestDataSubscriptionStateL(
+                MXIMPDataSubscriptionState* aSubscriptionState,
+                MXIMPStatus* aStatus ) = 0;
+
+
+
+public: // Handling presence blocking
+
+
+
+    /**
+     * Notifies XIMP Framework from presence block list
+     * contents.
+     *
+     * Protocol adaptation implementation can call this
+     * method to notify XIMP Framework from complete
+     * presence block list content. XIMP Framework
+     * calculates the changes (new and removed block entries)
+     * from previous presence block list content, and notifies
+     * the subscribing clients from data changes.
+     *
+     * XIMP Framework takes ownership of the object
+     * collection and all objects contained within, if
+     * the method succeeds without a leave.
+     *
+     * @param [in] aBlockList
+     *        MXIMPObjectCollection object containing zero or
+     *        more MPresenceBlockInfo objects. Each
+     *        contained MPresenceBlockInfo shall present
+     *        single presence block entry in the presence block list.
+     *
+     * @return The request ID identifying the issued request.
+     *         Data cache request is processed asynchronously and
+     *         its completion is signalled to adaptation direction
+     *         through MXIMPProtocolConnectionHostObserver interface,
+     *         with MXIMPProtocolRequestCompleteEvent event.
+     *
+     * @leave KErrNoMemory if failed to allocate memory.
+     * @leave KErrArgument if NULL argument(s) were provided.
+     */
+    virtual TXIMPRequestId HandlePresenceBlockListL(
+                MXIMPObjectCollection* aBlockList ) = 0;
+
+
+
+    /**
+     * Notifies XIMP Framework from new
+     * presence block entry.
+     *
+     * Protocol adaptation implementation can call this
+     * method to notify XIMP Framework from
+     * new presence block entry. XIMP Framework
+     * calculates the change, from previous presence block
+     * list content, and notifies the subscribing clients
+     * from data changes.
+     *
+     * XIMP Framework takes ownership of the argument(s),
+     * if method succeeds without a leave.
+     *
+     * @param [in] aBlockInfo
+     *        MPresenceBlockInfo object containing
+     *        presence block entrys information.
+     *
+     * @return The request ID identifying the issued request.
+     *         Data cache request is processed asynchronously and
+     *         its completion is signalled to adaptation direction
+     *         through MXIMPProtocolConnectionHostObserver interface,
+     *         with MXIMPProtocolRequestCompleteEvent event.
+     *
+     * @leave KErrNoMemory if failed to allocate memory.
+     * @leave KErrArgument if NULL argument(s) were provided.
+     */
+    virtual TXIMPRequestId HandlePresenceBlockedL(
+                MPresenceBlockInfo* aBlockInfo ) = 0;
+
+
+
+    /**
+     * Notifies XIMP Framework from cancellation of
+     * existing presence block entry.
+     *
+     * Protocol adaptation can call this method to notify
+     * XIMP Framework from cancellation of existing
+     * presence block entry. XIMP Framework calculates
+     * the change, from previous presence block list content,
+     * and notifies the subscribing clients from data changes.
+     *
+     * XIMP Framework takes ownership of the argument(s),
+     * if method succeeds without a leave.
+     *
+     * @param [in] aBlockedEntityId
+     *        Identity of the presence block entry which to
+     *        remove from presence block list.
+     *
+     * @return The request ID identifying the issued request.
+     *         Data cache request is processed asynchronously and
+     *         its completion is signalled to adaptation direction
+     *         through MXIMPProtocolConnectionHostObserver interface,
+     *         with MXIMPProtocolRequestCompleteEvent event.
+     *
+     * @leave KErrNoMemory if failed to allocate memory.
+     * @leave KErrArgument if NULL argument(s) were provided.
+     */
+    virtual TXIMPRequestId HandlePresenceBlockCanceledL(
+                MXIMPIdentity* aBlockedEntityId ) = 0;
+
+
+
+    /**
+     * Gets data subscription state for presence block list.
+     *
+     * Protocol adaptation can call this method to retrieve
+     * presence block list current data subscription state.
+     * Protocol adaptation can use data subscription state
+     * information, to optimize its own processing and
+     * network trafic amount.
+     *
+     * @return Presence block list data subscription state.
+     *         Interface ownership is not returned to caller.
+     *         Caller shouldn't cache the returned reference
+     *         for later use.
+     */
+    virtual const MXIMPDataSubscriptionState&
+                PresenceBlockDataSubscriptionState() const = 0;
+
+
+
+    /**
+     * Updates data subscription state for presence block list.
+     *
+     * Updates data subscription state for presence block list.
+     * XIMP Framework calculates the subscription state change,
+     * from previous presence block list content, and notifies the
+     * subscribing clients from data changes.
+     *
+     * XIMP Framework takes ownership of the argument(s),
+     * if method succeeds without a leave.
+     *
+     * @param [in] aSubscriptionState
+     *        New data subscription state for presence block list.
+     *
+     * @param [in] aStatus
+     *        Optional status object describing the
+     *        the reason, why protocol adaptation updated
+     *        data item subscription state. Given status object
+     *        is passed to clients through data item specific
+     *        data change event. NULL value is accepted.
+     *
+     * @return The request ID identifying the issued request.
+     *         Data cache request is processed asynchronously and
+     *         its completion is signalled to adaptation direction
+     *         through MXIMPProtocolConnectionHostObserver interface,
+     *         with MXIMPProtocolRequestCompleteEvent event.
+     *
+     * @leave KErrNoMemory if failed to allocate memory.
+     * @leave KErrArgument if NULL subscription state argument was provided.
+     */
+    virtual TXIMPRequestId SetPresenceBlockDataSubscriptionStateL(
+                MXIMPDataSubscriptionState* aSubscriptionState,
+                MXIMPStatus* aStatus ) = 0;
+
+
+    };
+
+
+#endif // MXIMPFWPROTOCOLPRESENCEAUTHORIZATIONDATAHOST_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_presence_protocol_plugin_host_api/inc/protocolpresencedatahost.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,157 @@
+/*
+* 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:  Interface for presence protocol connection host.
+*
+*/
+
+#ifndef MPROTOCOLPRESENCEDATAHOST_H
+#define MPROTOCOLPRESENCEDATAHOST_H
+
+
+#include <ximpbase.h>
+#include <presenceprotocolpluginhostifids.hrh>
+#include <e32std.h>
+
+
+class MXIMPStatus;
+class MPresenceObjectFactory;
+class MXIMPProtocolConnectionHostObserver;
+class MProtocolPresenceWatchingDataHost;
+class MProtocolPresentityGroupsDataHost;
+class MProtocolPresencePublishingDataHost;
+class MProtocolPresenceAuthorizationDataHost;
+
+
+
+// CLASS DECLARATION
+
+/**
+ * Interface for presence protocol connection host.
+ * This interface is implemented by XIMP Framework.
+ *
+ * Presence protocol connection host interface defines
+ * requests that a presence protocol implementation
+ * can request (callback) from XIMP Framework.
+ *
+ * @see MXIMPProtocolConnection
+ * @ingroup ximppresprotocolpluginhostapi
+ * @since S60 v3.2
+ */
+class MProtocolPresenceDataHost : public MXIMPBase
+    {
+public:
+
+    /** Interface ID for the MXIMPProtocolConnectionHost. */
+    enum { KInterfaceId = PRES_IF_ID_PROTOCOL_PRESENCE_DATAHOST };
+
+
+protected:
+
+    /**
+     * Protected destructor. MXIMPProtocolConnectionHost instancies
+     * can't be destroyed via this interface.
+     */
+    virtual inline ~MProtocolPresenceDataHost() {};
+
+
+
+public: // Access to sub-interfaces
+
+
+    /**
+     * Gets reference to object factory interface.
+     *
+     * Presence protocol connection implementation
+     * uses factory interface to instantiate presence
+     * objects.
+     *
+     * @return Object factory interface.
+     *         No ownership is returned caller.
+     */
+    virtual MPresenceObjectFactory& PresenceObjectFactory() = 0;
+
+
+
+    /**
+     * Gets reference to
+     * MProtocolPresenceAuthorizationDataHost interface.
+     *
+     * Presence protocol connection implementation uses returned
+     * data host interface to manage the presence connections
+     * 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 MProtocolPresenceAuthorizationDataHost& AuthorizationDataHost() = 0;
+
+
+
+    /**
+     * Gets reference to
+     * MProtocolPresencePublishingDataHost interface.
+     *
+     * Presence protocol connection implementation uses returned
+     * data host interface to manage the presence connections
+     * presence publication data.
+     *
+     * @return MProtocolPresencePublishingDataHost interface.
+     *         Interface ownership is not returned caller.
+     *         Returned interface is guaranteed to remain valid (usable)
+     *         as long as this source interface.
+     */
+    virtual MProtocolPresencePublishingDataHost& PublishingDataHost() = 0;
+
+
+
+    /**
+     * Gets reference to
+     * MProtocolPresenceWatchingDataHost interface.
+     *
+     * Presence protocol connection implementation uses returned
+     * data host interface to manage the presence connections
+     * presentity presence data.
+     *
+     * @return MProtocolPresenceWatchingDataHost interface.
+     *         Interface ownership is not returned caller.
+     *         Returned interface is guaranteed to remain valid (usable)
+     *         as long as this source interface.
+     */
+    virtual MProtocolPresenceWatchingDataHost& WatchingDataHost() = 0;
+
+
+
+    /**
+     * Gets reference to
+     * MProtocolPresentityGroupsDataHost interface.
+     *
+     * Presence protocol connection implementation uses returned
+     * data host interface to manage the presence connections
+     * presentity groups data.
+     *
+     * @return MProtocolPresentityGroupsDataHost interface.
+     *         Interface ownership is not returned caller.
+     *         Returned interface is guaranteed to remain valid (usable)
+     *         as long as this source interface.
+     */
+    virtual MProtocolPresentityGroupsDataHost& GroupsDataHost() = 0;
+
+
+    };
+
+
+
+#endif // MPROTOCOLPRESENCEDATAHOST_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_presence_protocol_plugin_host_api/inc/protocolpresencepublishingdatahost.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,261 @@
+/*
+* 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:  Interface for managing cached presence publication information.
+*
+*/
+
+#ifndef MXIMPFWPROTOCOLPRESENCEPUBLISHINGDATAHOST_H
+#define MXIMPFWPROTOCOLPRESENCEPUBLISHINGDATAHOST_H
+
+
+#include <e32std.h>
+#include <presenceprotocolpluginhostifids.hrh>
+#include <ximpbase.h>
+
+
+class MXIMPIdentity;
+class MPresenceInfo;
+class MXIMPObjectCollection;
+class MPresenceWatcherInfo;
+class MXIMPDataSubscriptionState;
+class MXIMPStatus;
+
+
+/**
+ * Interface for managing cached presence publication information.
+ *
+ * Interface is used by protocol adaptations to manage
+ * presence publication related information in
+ * XIMP Framework internal data cache
+ *
+ * This interface is implemented by XIMP Framework.
+ * Protocol adaptation can obtain reference to this
+ * interface from MXIMPProtocolConnectionHost interface.
+ *
+ * For each separated protocol connection, protocol
+ * adaptation must use the specific
+ * MProtocolPresentityGroupsDataHost instance,
+ * what is received from the connection specific
+ * MXIMPProtocolConnectionHost instance.
+ *
+ * @ingroup ximppresprotocolpluginhostapi
+ * @since S60 v3.2
+ */
+class MProtocolPresencePublishingDataHost : public MXIMPBase
+    {
+public:
+
+    /** Interface ID for the MProtocolPresencePublishingDataHost. */
+    enum { KInterfaceId = PRES_IF_ID_PROTOCOL_PRESENCE_PUBLISHING_DATAHOST };
+
+
+protected:
+
+
+    /**
+     * Protected destructor. Object instancies
+     * can't be deleted via this interface.
+     */
+    virtual ~MProtocolPresencePublishingDataHost() {}
+
+
+
+public: // Handling user own presence information
+
+
+    /**
+     * Notifies XIMP Framework from subscribed
+     * user own presence information.
+     *
+     * Protocol adaptation implementation can call this
+     * method to notify XIMP Framework from user own
+     * subscribed presence information. XIMP Framework
+     * updates its cached user own presence status, and
+     * notifies the subscribing clients from data changes.
+     *
+     * XIMP Framework takes ownership of the argument(s),
+     * if method succeeds without a leave.
+     *
+     * @param [in] aPresenceInfo
+     *        MPresenceInfo object containing new
+     *        subscribed own presence information .
+     *
+     * @return The request ID identifying the issued request.
+     *         Data cache request is processed asynchronously and
+     *         its completion is signalled to adaptation direction
+     *         through MXIMPProtocolConnectionHostObserver interface,
+     *         with MXIMPProtocolRequestCompleteEvent event.
+     *
+     * @leave KErrNoMemory if failed to allocate memory.
+     * @leave KErrArgument if NULL argument(s) were provided.
+     */
+    virtual TXIMPRequestId HandleSubscribedOwnPresenceL(
+                MPresenceInfo* aPresenceInfo ) = 0;
+
+
+
+    /**
+     * Gets data subscription state for own presence information.
+     *
+     * Protocol adaptation can call this method to retrieve
+     * own presence information current data subscription state.
+     * Protocol adaptation can use data subscription state
+     * information, to optimize its own processing and
+     * network trafic amount.
+     *
+     * @return Own presence information data subscription state.
+     *         Interface ownership is not returned to caller.
+     *         Caller shouldn't cache the returned reference
+     *         for later use.
+     */
+    virtual const MXIMPDataSubscriptionState&
+                OwnPresenceDataSubscriptionState() const = 0;
+
+
+
+    /**
+     * Updates data subscription state for presence block list.
+     *
+     * Updates data subscription state for own presence information.
+     * XIMP Framework calculates the subscription state change,
+     * from previous own presence information content, and notifies the
+     * subscribing clients from data changes.
+     *
+     * XIMP Framework takes ownership of the argument(s),
+     * if method succeeds without a leave.
+     *
+     * @param [in] aSubscriptionState
+     *        New data subscription state for own presence information.
+     *
+     * @param [in] aStatus
+     *        Optional status object describing the
+     *        the reason, why protocol adaptation updated
+     *        data item subscription state. Given status object
+     *        is passed to clients through data item specific
+     *        data change event. NULL value is accepted.
+     *
+     * @return The request ID identifying the issued request.
+     *         Data cache request is processed asynchronously and
+     *         its completion is signalled to adaptation direction
+     *         through MXIMPProtocolConnectionHostObserver interface,
+     *         with MXIMPProtocolRequestCompleteEvent event.
+     *
+     * @leave KErrNoMemory if failed to allocate memory.
+     * @leave KErrArgument if NULL subscription state argument was provided.
+     */
+    virtual TXIMPRequestId SetOwnPresenceDataSubscriptionStateL(
+                MXIMPDataSubscriptionState* aSubscriptionState,
+                MXIMPStatus* aStatus ) = 0;
+
+
+
+public: // Handling presence watcher list content
+
+
+
+    /**
+     * Notifies XIMP Framework from
+     * presence watcher list contents.
+     *
+     * Protocol adaptation implementation can call this
+     * method to notify XIMP Framework from
+     * complete presence watcher list content.
+     * XIMP Framework calculates the changes
+     * (new and disappeared watcher entries) from previous
+     * presence block list content, and notifies
+     * the subscribing clients from data changes.
+     *
+     * XIMP Framework takes ownership of the object
+     * collection and all objects contained within, if
+     * the method succeeds without a leave.
+     *
+     * @param [in] aWatcherList
+     *        MXIMPObjectCollection object containing zero or
+     *        more MPresenceWatcherInfo objects. Each
+     *        contained MPresenceWatcherInfo shall present
+     *        single presence watcher entry in the list of
+     *        presence watchers.
+     *
+     * @return The request ID identifying the issued request.
+     *         Data cache request is processed asynchronously and
+     *         its completion is signalled to adaptation direction
+     *         through MXIMPProtocolConnectionHostObserver interface,
+     *         with MXIMPProtocolRequestCompleteEvent event.
+     *
+     * @leave KErrNoMemory if failed to allocate memory.
+     * @leave KErrArgument if NULL argument(s) were provided.
+     */
+    virtual TXIMPRequestId HandlePresenceWatcherListL(
+                MXIMPObjectCollection* aWatcherList ) = 0;
+
+
+
+    /**
+     * Gets data subscription state for presence watcher list.
+     *
+     * Protocol adaptation can call this method to retrieve
+     * presence watcher list current data subscription state.
+     * Protocol adaptation can use data subscription state
+     * information, to optimize its own processing and
+     * network trafic amount.
+     *
+     * @return Presence watcher list data subscription state.
+     *         Interface ownership is not returned to caller.
+     *         Caller shouldn't cache the returned reference
+     *         for later use.
+     */
+    virtual const MXIMPDataSubscriptionState&
+                PresenceWatcherListDataSubscriptionState() const = 0;
+
+
+
+    /**
+     * Updates data subscription state for presence watcher list.
+     *
+     * Updates data subscription state for presence watcher list.
+     * XIMP Framework calculates the subscription state change,
+     * from previous presence watcher list content, and notifies the
+     * subscribing clients from data changes.
+     *
+     * XIMP Framework takes ownership of the argument(s),
+     * if method succeeds without a leave.
+     *
+     * @param [in] aSubscriptionState
+     *        New data subscription state for presence watcher list.
+     *
+     * @param [in] aStatus
+     *        Optional status object describing the
+     *        the reason, why protocol adaptation updated
+     *        data item subscription state. Given status object
+     *        is passed to clients through data item specific
+     *        data change event. NULL value is accepted.
+     *
+     * @return The request ID identifying the issued request.
+     *         Data cache request is processed asynchronously and
+     *         its completion is signalled to adaptation direction
+     *         through MXIMPProtocolConnectionHostObserver interface,
+     *         with MXIMPProtocolRequestCompleteEvent event.
+     *
+     * @leave KErrNoMemory if failed to allocate memory.
+     * @leave KErrArgument if NULL subscription state argument was provided.
+     */
+    virtual TXIMPRequestId SetPresenceWatcherListDataSubscriptionStateL(
+                MXIMPDataSubscriptionState* aSubscriptionState,
+                MXIMPStatus* aStatus ) = 0;
+
+
+    };
+
+
+#endif // MXIMPFWPROTOCOLPRESENCEPUBLISHINGDATAHOST_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_presence_protocol_plugin_host_api/inc/protocolpresencewatchingdatahost.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,178 @@
+/*
+* 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:  Interface for managing cached subscribed presence information.
+*
+*/
+
+#ifndef MXIMPFWPROTOCOLPRESENCEWATCHINGDATAHOST_H
+#define MXIMPFWPROTOCOLPRESENCEWATCHINGDATAHOST_H
+
+#include <e32std.h>
+#include <presenceprotocolpluginhostifids.hrh>
+#include <ximpbase.h>
+
+class MPresenceInfo;
+class MXIMPIdentity;
+class MXIMPDataSubscriptionState;
+class MXIMPStatus;
+
+
+
+/**
+ * Interface for managing cached subscribed presence information.
+ *
+ * Interface is used by protocol adaptations to manage
+ * manage presentities presence information stored
+ * in XIMP Framework internal data cache.
+ *
+ * This interface is implemented by XIMP Framework.
+ * Protocol adaptation can obtain reference to this
+ * interface from MXIMPProtocolConnectionHost interface.
+ *
+ * For each separated protocol connection, protocol
+ * adaptation must use the specific
+ * MProtocolPresentityGroupsDataHost instance,
+ * what is received from the connection specific
+ * MXIMPProtocolConnectionHost instance.
+ *
+ * @ingroup ximppresprotocolpluginhostapi
+ * @since S60 v3.2
+ */
+class MProtocolPresenceWatchingDataHost : public MXIMPBase
+    {
+public:
+
+    /** Interface ID for the MProtocolPresenceWatchingDataHost. */
+    enum { KInterfaceId = PRES_IF_ID_PROTOCOL_PRESENCE_WATCHING_DATAHOST };
+
+protected:
+
+    /**
+     * Protected destructor. Object instancies
+     * can't be deleted via this interface.
+     */
+    virtual ~MProtocolPresenceWatchingDataHost() {}
+
+
+
+
+public: // Handling subscribed presence information
+
+
+    /**
+     * Notifies XIMP Framework from subscribed
+     * presentitys presence information.
+     *
+     * Protocol adaptation implementation can call this
+     * method to notify XIMP Framework from subscribed
+     * presentitys presence information. XIMP Framework
+     * updates its cached presentitys presence status, and
+     * notifies the subscribing clients from data changes.
+     *
+     * XIMP Framework takes ownership of the argument(s),
+     * if method succeeds without a leave.
+     *
+     * @param [in] aPresentityId
+     *        MXIMPIdentity object identifying the presentity
+     *        of which subscribed presence information
+     *        is delivered here.
+     *
+     * @param [in] aPresenceInfo
+     *        MPresenceInfo object containing new presence
+     *        information for the identified presentity.
+     *
+     * @return The request ID identifying the issued request.
+     *         Data cache request is processed asynchronously and
+     *         its completion is signalled to adaptation direction
+     *         through MXIMPProtocolConnectionHostObserver interface,
+     *         with MXIMPProtocolRequestCompleteEvent event.
+     *
+     * @leave KErrNoMemory if failed to allocate memory.
+     * @leave KErrArgument if NULL argument(s) were provided.
+     */
+    virtual TXIMPRequestId HandleSubscribedPresentityPresenceL(
+                MXIMPIdentity* aPresentityId,
+                MPresenceInfo* aPresenceInfo ) = 0;
+
+
+
+    /**
+     * Gets data subscription state for presentitys presence
+     * information.
+     *
+     * Protocol adaptation can call this method to retrieve
+     * presentitys presence information data subscription state.
+     * Protocol adaptation can use data subscription state
+     * information, to optimize its own processing and
+     * network trafic amount.
+     *
+     * @return Presentitys presence information data subscription state.
+     *         Interface ownership is not returned to caller.
+     *         Caller shouldn't cache the returned reference
+     *         for later use.
+     */
+    virtual const MXIMPDataSubscriptionState&
+                PresentityPresenceDataSubscriptionState(
+                const MXIMPIdentity& aPresentityId ) const = 0;
+
+
+
+    /**
+     * Updates data subscription state for
+     * presentitys presence information.
+     *
+     * Updates data subscription state for presentitys presence
+     * subscription. XIMP Framework calculates the subscription
+     * state change, from previous presentitys presence information
+     * content, and notifies the subscribing clients from data
+     * changes.
+     *
+     * XIMP Framework takes ownership of the argument(s),
+     * if method succeeds without a leave.
+     *
+     * @param [in] aPresentityId
+     *        MXIMPIdentity object identifying the presentity
+     *        of which presence data subscription state is
+     *        updated here.
+     *
+     * @param [in] aSubscriptionState
+     *        New data subscription state for presentitys
+     *        presence information.
+     *
+     * @param [in] aStatus
+     *        Optional status object describing the
+     *        the reason, why protocol adaptation updated
+     *        data item subscription state. Given status object
+     *        is passed to clients through data item specific
+     *        data change event. NULL value is accepted.
+     *
+     * @return The request ID identifying the issued request.
+     *         Data cache request is processed asynchronously and
+     *         its completion is signalled to adaptation direction
+     *         through MXIMPProtocolConnectionHostObserver interface,
+     *         with MXIMPProtocolRequestCompleteEvent event.
+     *
+     * @leave KErrNoMemory if failed to allocate memory.
+     * @leave KErrArgument if NULL subscription state argument was provided.
+     */
+    virtual TXIMPRequestId SetPresentityPresenceDataSubscriptionStateL(
+                MXIMPIdentity* aPresentityId,
+                MXIMPDataSubscriptionState* aSubscriptionState,
+                MXIMPStatus* aStatus ) = 0;
+
+
+    };
+
+
+#endif // MXIMPFWPROTOCOLPRESENCEWATCHINGDATAHOST_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_presence_protocol_plugin_host_api/inc/protocolpresentitygroupsdatahost.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,492 @@
+/*
+* 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:  Interface for managing cached presentity group information.
+*
+*/
+
+#ifndef MPROTOCOLPRESENTITYGROUPSDATAHOST_H
+#define MPROTOCOLPRESENTITYGROUPSDATAHOST_H
+
+
+#include <e32base.h>
+#include <presenceprotocolpluginhostifids.hrh>
+#include <ximpbase.h>
+
+
+class MXIMPIdentity;
+class MXIMPObjectCollection;
+class MPresentityGroupInfo;
+class MPresentityGroupMemberInfo;
+class MXIMPDataSubscriptionState;
+class MXIMPStatus;
+
+
+
+/**
+ * Interface for managing cached presentity group information.
+ *
+ * Interface used by protocol adaptations to manage
+ * manage presentity group information and presentity
+ * group member information in XIMP Framework
+ * internal data cache.
+ *
+ * This interface is implemented by XIMP Framework.
+ * Protocol adaptation can obtain reference to this
+ * interface from MXIMPProtocolConnectionHost interface.
+ *
+ * For each separated protocol connection, protocol
+ * adaptation must use the specific
+ * MProtocolPresentityGroupsDataHost instance,
+ * what is received from the connection specific
+ * MXIMPProtocolConnectionHost instance.
+ *
+ * @ingroup ximppresprotocolpluginhostapi
+ * @since S60 v3.2
+ */
+class MProtocolPresentityGroupsDataHost : public MXIMPBase
+    {
+public:
+
+    /** Interface ID for the MProtocolPresentityGroupsDataHost. */
+    enum { KInterfaceId = PRES_IF_ID_PROTOCOL_PRESENTITY_GROUPS_DATAHOST };
+
+protected:
+
+    /**
+     * Protected destructor. Object instancies
+     * can't be deleted via this interface.
+     */
+    virtual ~MProtocolPresentityGroupsDataHost() {}
+
+
+
+public: // Handling presentity group information
+
+
+    /**
+     * Notifies XIMP Framework from
+     * presentity group list contents.
+     *
+     * Protocol adaptation implementation can call this
+     * method to notify XIMP Framework from
+     * complete presentity group list content.
+     * XIMP Framework calculates the changes
+     * (new and removed presentity groups) compared to previous
+     * presence presentity group list content, and notifies
+     * the subscribing clients from data changes.
+     *
+     * XIMP Framework takes ownership of the object
+     * collection and all objects contained within, if
+     * the method succeeds without a leave.
+     *
+     *
+     * @param [in] aGroupList
+     *        MXIMPObjectCollection object containing zero or
+     *        more MPresentityGroupInfo objects. Each
+     *        contained MPresentityGroupInfo shall present
+     *        single presentity group within the presentity
+     *        group list.
+     *
+     * @return The request ID identifying the issued request.
+     *         Data cache request is processed asynchronously and
+     *         its completion is signalled to adaptation direction
+     *         through MXIMPProtocolConnectionHostObserver interface,
+     *         with MXIMPProtocolRequestCompleteEvent event.
+     *
+     * @leave KErrNoMemory if failed to allocate memory.
+     * @leave KErrArgument if NULL argument(s) were provided.
+     */
+    virtual TXIMPRequestId HandlePresentityGroupListL(
+                MXIMPObjectCollection* aGroupList ) = 0;
+
+
+
+    /**
+     * Notifies XIMP Framework from new
+     * presentity group list entry.
+     *
+     * Protocol adaptation implementation can call this
+     * method to notify XIMP Framework from
+     * new presentity group list entry. XIMP Framework
+     * calculates the change, from previous presentity
+     * group list content, and notifies the subscribing
+     * clients from data changes.
+     *
+     * XIMP Framework takes ownership of the argument(s),
+     * if method succeeds without a leave.
+     *
+     * @param [in] aGroupInfo
+     *        MPresentityGroupInfo object holding
+     *        information about new presentity group entry.
+     *        New presentity group is added to the presentity
+     *        group list.
+     *
+     * @return The request ID identifying the issued request.
+     *         Data cache request is processed asynchronously and
+     *         its completion is signalled to adaptation direction
+     *         through MXIMPProtocolConnectionHostObserver interface,
+     *         with MXIMPProtocolRequestCompleteEvent event.
+     *
+     * @leave KErrNoMemory if failed to allocate memory.
+     * @leave KErrArgument if NULL argument(s) were provided.
+     */
+    virtual TXIMPRequestId HandlePresentityGroupCreatedL(
+                MPresentityGroupInfo* aGroupInfo ) = 0;
+
+
+
+    /**
+     * Notifies XIMP Framework from deletion of
+     * existing presentity group.
+     *
+     * Protocol adaptation implementation can call this
+     * method to notify XIMP Framework from deletion
+     * of existing presentity group. XIMP Framework
+     * calculates the change, from previous presentity group
+     * list content, and notifies the subscribing clients
+     * from data changes.
+     *
+     * XIMP Framework takes ownership of the argument(s),
+     * if method succeeds without a leave.
+     *
+     * @param [in] aGroupId
+     *        MXIMPIdentity object identifying the
+     *        presentity group which were deleted and thus
+     *        needs to be removed from presentity group list.
+     *
+     * @return The request ID identifying the issued request.
+     *         Data cache request is processed asynchronously and
+     *         its completion is signalled to adaptation direction
+     *         through MXIMPProtocolConnectionHostObserver interface,
+     *         with MXIMPProtocolRequestCompleteEvent event.
+     *
+     * @leave KErrNoMemory if failed to allocate memory.
+     * @leave KErrArgument if NULL argument(s) were provided.
+     */
+    virtual TXIMPRequestId HandlePresentityGroupDeletedL(
+                MXIMPIdentity* aGroupId ) = 0;
+
+
+
+    /**
+     * Notifies XIMP Framework from update of
+     * existing presentity group displayname.
+     *
+     * Protocol adaptation implementation can call this
+     * method to notify XIMP Framework from update
+     * of existing presentity group displayname. XIMP Framework
+     * calculates the change, from previous presentity group
+     * list content, and notifies the subscribing clients
+     * from data changes.
+     *
+     * XIMP Framework takes ownership of the argument(s),
+     * if method succeeds without a leave.
+     *
+     * @param [in] aGroupInfo
+     *        MPresentityGroupInfo object identifying the
+     *        presentity group and new displayname for the group.
+     *
+     * @return The request ID identifying the issued request.
+     *         Data cache request is processed asynchronously and
+     *         its completion is signalled to adaptation direction
+     *         through MXIMPProtocolConnectionHostObserver interface,
+     *         with MXIMPProtocolRequestCompleteEvent event.
+     *
+     * @leave KErrNoMemory if failed to allocate memory.
+     * @leave KErrArgument if NULL argument(s) were provided.
+     */
+    virtual TXIMPRequestId HandlePresentityGroupDisplayNameUpdatedL(
+                MPresentityGroupInfo* aGroupInfo ) = 0;
+
+
+
+    /**
+     * Gets data subscription state for presentity group list.
+     *
+     * Protocol adaptation can call this method to retrieve
+     * presentity group lists data subscription state.
+     * Protocol adaptation can use data subscription state
+     * information, to optimize its own processing and
+     * network trafic amount.
+     *
+     * @return Presentity group list data subscription state.
+     *         Interface ownership is not returned to caller.
+     *         Caller shouldn't cache the returned reference
+     *         for later use.
+     */
+    virtual const MXIMPDataSubscriptionState&
+                PresentityGroupListDataSubscriptionState() const = 0;
+
+
+
+    /**
+     * Updates data subscription state for presentity group list.
+     *
+     * Updates data subscription state for presentity group list.
+     * XIMP Framework calculates the subscription state change,
+     * from previous presentity group list, and
+     * notifies the subscribing clients from data changes.
+     *
+     * XIMP Framework takes ownership of the argument(s),
+     * if method succeeds without a leave.
+     *
+     * @param [in] aSubscriptionState
+     *        New data subscription state for presentity group list.
+     *
+     * @param [in] aStatus
+     *        Optional status object describing the
+     *        the reason, why protocol adaptation updated
+     *        data item subscription state. Given status object
+     *        is passed to clients through data item specific
+     *        data change event. NULL value is accepted.
+     *
+     * @return The request ID identifying the issued request.
+     *         Data cache request is processed asynchronously and
+     *         its completion is signalled to adaptation direction
+     *         through MXIMPProtocolConnectionHostObserver interface,
+     *         with MXIMPProtocolRequestCompleteEvent event.
+     *
+     * @leave KErrNoMemory if failed to allocate memory.
+     * @leave KErrArgument if NULL subscription state argument was provided.
+     */
+    virtual TXIMPRequestId SetPresentityGroupListDataSubscriptionStateL(
+                MXIMPDataSubscriptionState* aSubscriptionState,
+                MXIMPStatus* aStatus ) = 0;
+
+
+
+public: // Handling presentity group content
+
+
+    /**
+     * Notifies XIMP Framework from
+     * presentity group contents.
+     *
+     * Protocol adaptation implementation can call this
+     * method to notify XIMP Framework from presentity group
+     * content. XIMP Framework calculates the changes
+     * (added and removed group members) compared to previous
+     * presentity group content, and notifies the subscribing
+     * clients from data changes.
+     *
+     * XIMP Framework takes ownership of the object
+     * collection and all objects contained within, if
+     * the method succeeds without a leave.
+     *
+     * @param [in] aGroupId
+     *        MXIMPIdentity object identifying the presentity group
+     *        of which content is notified here.
+     *
+     * @param [in] aGroupMembers
+     *        MXIMPObjectCollection object containing zero or
+     *        more MPresentityGroupMemberInfo objects. Each
+     *        contained MPresentityGroupMemberInfo shall
+     *        present single presentity group member, within
+     *        the presentity group.
+     *
+     * @return The request ID identifying the issued request.
+     *         Data cache request is processed asynchronously and
+     *         its completion is signalled to adaptation direction
+     *         through MXIMPProtocolConnectionHostObserver interface,
+     *         with MXIMPProtocolRequestCompleteEvent event.
+     *
+     * @leave KErrNoMemory if failed to allocate memory.
+     * @leave KErrArgument if NULL argument(s) were provided.
+     */
+    virtual TXIMPRequestId HandlePresentityGroupContentL(
+                MXIMPIdentity* aGroupId,
+                MXIMPObjectCollection* aGroupMembers ) = 0;
+
+
+
+    /**
+     * Notifies XIMP Framework from new
+     * presentity group member entry.
+     *
+     * Protocol adaptation implementation can call this
+     * method to notify XIMP Framework from
+     * new presentity group member entry. XIMP Framework
+     * calculates the change, from previous presentity
+     * group content, and notifies the subscribing
+     * clients from data changes.
+     *
+     * XIMP Framework takes ownership of the argument(s),
+     * if method succeeds without a leave.
+     *
+     * @param [in] aGroupId
+     *        MXIMPIdentity object identifying the presentity
+     *        group to where the group member is added.
+     *
+     * @param [in] aGroupMember
+     *        MPresentityGroupMemberInfo object holding
+     *        information about new presentity group member
+     *        entry. New presentity group member is added
+     *        to the presentity group content.
+     *
+     * @return The request ID identifying the issued request.
+     *         Data cache request is processed asynchronously and
+     *         its completion is signalled to adaptation direction
+     *         through MXIMPProtocolConnectionHostObserver interface,
+     *         with MXIMPProtocolRequestCompleteEvent event.
+     *
+     * @leave KErrNoMemory if failed to allocate memory.
+     * @leave KErrArgument if NULL argument(s) were provided.
+     */
+    virtual TXIMPRequestId HandlePresentityGroupMemberAddedL(
+                MXIMPIdentity* aGroupId,
+                MPresentityGroupMemberInfo* aGroupMember ) = 0;
+
+
+
+    /**
+     * Notifies XIMP Framework from remove of
+     * existing presentity group member.
+     *
+     * Protocol adaptation implementation can call this
+     * method to notify XIMP Framework from remove
+     * of existing presentity group member. XIMP Framework
+     * calculates the change, from previous presentity group
+     * content, and notifies the subscribing clients
+     * from data changes.
+     *
+     * XIMP Framework takes ownership of the argument(s),
+     * if method succeeds without a leave.
+     *
+     * @param [in] aGroupId
+     *        MXIMPIdentity object identifying the presentity
+     *        group from where to remove the group member.
+     *
+     * @param [in] aGroupMemberId
+     *        MXIMPIdentity object identifying the presentity
+     *        group member which to remove from the presentity
+     *        group.
+     *
+     * @return The request ID identifying the issued request.
+     *         Data cache request is processed asynchronously and
+     *         its completion is signalled to adaptation direction
+     *         through MXIMPProtocolConnectionHostObserver interface,
+     *         with MXIMPProtocolRequestCompleteEvent event.
+     *
+     * @leave KErrNoMemory if failed to allocate memory.
+     * @leave KErrArgument if NULL argument(s) were provided.
+     */
+    virtual TXIMPRequestId HandlePresentityGroupMemberRemovedL(
+                MXIMPIdentity* aGroupId,
+                MXIMPIdentity* aGroupMemberId ) = 0;
+
+
+
+    /**
+     * Notifies XIMP Framework from displayname update of
+     * existing presentity group member.
+     *
+     * Protocol adaptation implementation can call this
+     * method to notify XIMP Framework from displayname
+     * update of existing presentity group member.
+     * XIMP Framework calculates the change, from previous
+     * presentity group content, and notifies the subscribing
+     * clients from data changes.
+     *
+     * XIMP Framework takes ownership of the argument(s),
+     * if method succeeds without a leave.
+     *
+     * @param [in] aGroupId
+     *        MXIMPIdentity object identifying the presentity
+     *        group which member displayname to update.
+     *
+     * @param [in] aGroupMember
+     *        MPresentityGroupMemberInfo object identifying
+     *        the presentity group member and its new displayname.
+     *
+     * @return The request ID identifying the issued request.
+     *         Data cache request is processed asynchronously and
+     *         its completion is signalled to adaptation direction
+     *         through MXIMPProtocolConnectionHostObserver interface,
+     *         with MXIMPProtocolRequestCompleteEvent event.
+     *
+     * @leave KErrNoMemory if failed to allocate memory.
+     * @leave KErrArgument if NULL argument(s) were provided.
+     */
+    virtual TXIMPRequestId HandlePresentityGroupMemberDisplayNameUpdatedL(
+                MXIMPIdentity* aGroupId,
+                MPresentityGroupMemberInfo* aGroupMember ) = 0;
+
+
+
+    /**
+     * Gets data subscription state for presentity group.
+     *
+     * Protocol adaptation can call this method to retrieve
+     * given presentity groups content subscription state.
+     * Protocol adaptation can use data subscription state
+     * information, to optimize its own processing and
+     * network trafic amount.
+     *
+     * @return Presentity groups content subscription state.
+     *         Interface ownership is not returned to caller.
+     *         Caller shouldn't cache the returned reference
+     *         for later use.
+     */
+    virtual const MXIMPDataSubscriptionState&
+                PresentityGroupContentDataSubscriptionState(
+                const MXIMPIdentity& aGroupId ) const = 0;
+
+
+
+    /**
+     * Updates data subscription state for
+     * presentity group content.
+     *
+     * Updates data subscription state for presentity group content.
+     * XIMP Framework calculates the subscription state change,
+     * from previous presentity group content, and
+     * notifies the subscribing clients from data changes.
+     *
+     * XIMP Framework takes ownership of the argument(s),
+     * if method succeeds without a leave.
+     *
+     * @param [in] aGroupId
+     *        MXIMPIdentity object identifying the presentity
+     *        group of which data subscription state is
+     *        updated here.
+     *
+     * @param [in] aSubscriptionState
+     *        New data subscription state for presentity group .
+     *
+     * @param [in] aStatus
+     *        Optional status object describing the
+     *        the reason, why protocol adaptation updated
+     *        data item subscription state. Given status object
+     *        is passed to clients through data item specific
+     *        data change event. NULL value is accepted.
+     *
+     * @return The request ID identifying the issued request.
+     *         Data cache request is processed asynchronously and
+     *         its completion is signalled to adaptation direction
+     *         through MXIMPProtocolConnectionHostObserver interface,
+     *         with MXIMPProtocolRequestCompleteEvent event.
+     *
+     * @leave KErrNoMemory if failed to allocate memory.
+     * @leave KErrArgument if NULL subscription state argument was provided.
+     */
+    virtual TXIMPRequestId SetPresentityGroupContentDataSubscriptionStateL(
+                MXIMPIdentity* aGroupId,
+                MXIMPDataSubscriptionState* aSubscriptionState,
+                MXIMPStatus* aStatus ) = 0;
+
+
+    };
+
+
+#endif // MPROTOCOLPRESENTITYGROUPSDATAHOST_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_presence_protocol_plugin_host_api/ximp_presence_protocol_plugin_host_api.metaxml	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,23 @@
+<?xml version="1.0" ?>
+<api id="04d9a4e48a04b46863200fd13b89264e" dataversion="1.0">
+  <name>XIMP Presence Protocol Plug-in Host API</name>
+  <description>API contains interfaces which presence protocol plug-ins use for communicating back to XIMP Framework direction.</description>
+  <type>c++</type>
+  <subsystem>ximpfw</subsystem>
+  <libs><lib name="presencecacheecomhook.lib"/>
+<lib name="presencedatamodel.lib"/>
+<lib name="presencedatamodelhook.lib"/>
+<lib name="presenceecomhook.lib"/>
+<lib name="presencemanager.lib"/>
+<lib name="presenceoperation.lib"/>
+<lib name="presencecacheclient.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/imsrv_plat/ximp_search_base_api/group/bld.inf	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  File that exports the files belonging to 
+*                Search Feature Plugin  Base API
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+../inc/searcherrors.hrh     	MW_LAYER_PLATFORM_EXPORT_PATH(searcherrors.hrh)
+../inc/searchdlluids.hrh		  MW_LAYER_PLATFORM_EXPORT_PATH(searchdlluids.hrh)
+../inc/searchoperationdefs.h		  MW_LAYER_PLATFORM_EXPORT_PATH(searchoperationdefs.h)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_search_base_api/inc/searchdlluids.hrh	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,62 @@
+/*
+* 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:  XIMP Framework SEARCH Feature plugin DLL uids
+*
+*/
+
+
+#ifndef SEARCHDLLUIDS_HRH
+#define SEARCHDLLUIDS_HRH
+
+
+// -----------------------------------------------------------------------------
+// Common dll uids
+// -----------------------------------------------------------------------------
+//
+#define XIMP_SEARCH_DLL_UID_STATIC_INTERFACE                   			0x1000008d
+#define XIMP_SEARCH_DLL_UID_ECOM_PLUGIN                        			0x10009D8D
+
+
+// -----------------------------------------------------------------------------
+// ECOM implementation UID
+// -----------------------------------------------------------------------------
+//
+#define XIMP_ECOM_IMPLEMENTATION_UID_SEARCH_INTERFACE   				0x2001846F
+#define XIMP_ECOM_IMPL_UID_SEARCH_DATAMODEL_INTERFACE   				0x20018470
+#define XIMP_ECOM_IMPL_UID_SEARCH_PROCESSOR_INTERFACE   				0x20018471
+#define XIMP_ECOM_IMPL_UID_SEARCH_OPERATION_INTERFACE   				0x20018472
+
+//-------------------------------------------------------------------------------------
+// HOOK uids 
+//------------------------------------------------------------------------------------
+
+#define XIMP_DLL_UID_SEARCH_HOOK                      					0x20018473
+#define XIMP_DLL_UID_SEARCH_DATAMODEL_HOOK            					0x20018474
+#define XIMP_DLL_UID_SEARCH_PROCESSOR_HOOK            					0x20018475
+#define XIMP_DLL_UID_SEARCH_OPERATIONS_HOOK            					0x20018476
+
+//-------------------------------------------------------------------------------------
+// Dll  uids 
+//------------------------------------------------------------------------------------
+
+#define XIMP_DLL_UID_SEARCH_MANAGER                   					0x20018477
+#define XIMP_DLL_UID_SEARCH_PROCESSOR	            					0x20018478
+#define XIMP_DLL_UID_SEARCH_OPERATION                   				0x20018479
+#define XIMP_DLL_UID_SEARCH_DATAMODEL                             		0x2001847A
+
+
+
+#endif // SEARCHDLLUIDS_HRH
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_search_base_api/inc/searcherrors.hrh	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,54 @@
+/*
+* 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:  Protocol agnostic error codes for Search Feature Plugin.
+*
+*/
+
+#ifndef SEARCHERRORS_H
+#define SEARCHERRORS_H
+
+
+
+/**
+ * Search Feature Plugin error codes.
+ *
+ * Error codes returned from Search are either:
+ * -# System wide Symbian OS error codes (KErrNone, KErrNoMemory, etc.)
+ * -# Protocol agnostic  Search Feature related error codes defined here.
+ *    These error codes have range: KSearchErrBase ... 
+ *
+ * @ingroup searchbaseapi
+ * 
+ */
+enum 
+    {
+    KSearchErrBase = -40131,
+
+    /**
+     * Generic error code to indicate that request processing
+     * has failed on Search protocol level to some error,
+     * which isn't mapped to any other more detailed
+     * error code.
+     */
+    KErrServiceGeneralError = KSearchErrBase ,
+
+    
+ 
+ 
+    };
+
+
+#endif // SEARCHERRORS_H
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_search_base_api/inc/searchoperationdefs.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,43 @@
+/*
+* 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:  Search Feature Plugin operation definitions.
+ *
+*/
+
+#ifndef SEARCHOPERATIONDEFS_H
+#define SEARCHOPERATIONDEFS_H
+
+#include <e32std.h>
+
+
+
+namespace NSearchOps
+    {
+    enum TSearchOpTypes
+        {
+        
+        ESearch = 300,                          
+        EHandleSearchResults,
+        ESearchCleaner,
+        EGetSearchKeys, 
+        EHandleSearchKeys
+        };
+    }
+
+#endif  //SEARCHOPERATIONDEFS_H
+
+
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_search_base_api/ximp_search_base_api.metaxml	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,13 @@
+<?xml version="1.0" ?>
+<api id="4ca09f5a7dd7d067447c8114a14f1816" dataversion="1.0">
+<name>ximp_search_base_api</name>
+<description>This is a API that provides the common error codes, plugin UIDs and operation types of search base.</description>
+<type>c++</type>
+<subsystem>ximp_search_base_api</subsystem>
+<libs></libs>
+<release category="domain" sinceversion=""/>
+<attributes>
+<htmldocprovided>yes</htmldocprovided>
+<adaptation>no</adaptation>
+</attributes>
+</api>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_search_data_model_api/group/bld.inf	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,30 @@
+/*
+* 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:  File that exports the files belonging to 
+:               Search Feature Plugin Data Model API
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+../inc/searchdatamodelifids.hrh     MW_LAYER_PLATFORM_EXPORT_PATH(searchdatamodelifids.hrh)
+../inc/searchobjectfactory.h     	MW_LAYER_PLATFORM_EXPORT_PATH(searchobjectfactory.h)
+../inc/searchinfo.h     			MW_LAYER_PLATFORM_EXPORT_PATH(searchinfo.h)
+../inc/searchkeyinfo.h       		MW_LAYER_PLATFORM_EXPORT_PATH(searchkeyinfo.h)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_search_data_model_api/inc/searchdatamodelifids.hrh	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,36 @@
+/*
+* 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:  Search Feature Plugin Data Model API interface IDs.
+*
+*/
+
+#ifndef SEARCHDATAMODELIFIDS_HRH
+#define SEARCHDATAMODELIFIDS_HRH
+
+// Data model IF id's
+// 20xx - ximp related
+// 21xx - presence related
+// 22xx - instant messaging related
+// 24xx - Search related
+
+
+#define SEARCH_IF_ID_SEARCH_OBJECT_FACTORY      2404
+#define SEARCH_IF_ID_SEARCH_INFO                2402
+#define SEARCH_IF_ID_SEARCH_KEY_INFO            2403
+
+
+#endif // SEARCHDATAMODELIFIDS_HRH
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_search_data_model_api/inc/searchinfo.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,104 @@
+/*
+* 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:  Interface for Search info object.
+*
+*/
+
+#ifndef MSEARCHINFO_H
+#define MSEARCHINFO_H
+
+#include <e32std.h>
+#include <ximpbase.h>
+#include <searchdatamodelifids.hrh>
+#include <badesca.h> 
+
+class MXIMPIdentity;
+
+/**
+ * Defines Enums for information type.
+ *
+ * Information of following type  can be
+ * stored and retrieve. 
+ * 
+ *
+ */
+
+enum TInfoType
+	    {
+	    
+	    EEmailAddress,
+	    EFirstName,
+	    ELastName
+	    
+	    };	
+	
+
+/**
+ * Interface for Search info object.
+ *
+ * Search info holds details of a single  search result.
+ * Search results contains collection of searchinfo.
+ *
+ * @ingroup Searchdatamodelapi
+ *
+ */
+class MSearchInfo : public MXIMPBase
+    {
+    
+	    
+	public:
+
+	    /** Interface ID for the MImSearchInfo. */
+	    enum { KInterfaceId = SEARCH_IF_ID_SEARCH_INFO };
+
+
+	public:
+
+	    /**
+	     * Public destructor.
+	     * Objects can be deleted through this interface.
+	     */
+	    virtual ~MSearchInfo() {}
+
+
+	public:
+	 	/**
+	     * Returns the  information of particular information type.
+	     *
+	     * @param aType
+	     *        TInfoType which information type (e.g. EFirstname, Elastname etc)
+	     * 
+	     * @return TDesc16&  information of the type  passed. 
+	     */
+	    virtual const TDesC16& GetFieldInfo(TInfoType aType ) const =0 ;
+	    
+	    
+      	/**
+	     * Sets the information of a particular type.
+	     *
+	     * @param aFieldInfo
+	     *        information to be set.
+	     *
+	     * @param aType
+	     *        type of the information.(e.g. EFirstname, Elastname etc)
+	     *
+	     */
+	    virtual void SetFieldInfoL(const TDesC16& aFieldInfo, TInfoType aType)  = 0 ;
+    };
+
+
+#endif // MSEARCHINFO_H
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_search_data_model_api/inc/searchkeyinfo.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,118 @@
+/*
+* 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:  Interface for Search key  info object.
+*
+*/
+
+#ifndef MSEARCHKEYINFO_H
+#define MSEARCHKEYINFO_H
+
+#include <e32std.h>
+#include <ximpbase.h>
+#include <searchdatamodelifids.hrh>
+#include <badesca.h> 
+#include <searchelement.h>
+
+ enum TKeyType
+     {
+     EKey, 
+     ELabel
+     };
+
+/**  file supportedsearchkey.h
+ *  Interface class for  seach key  info 
+ *
+ */
+class MSearchKeyInfo : public MXIMPBase
+    {
+    
+	    
+	public:
+
+	    /** Interface ID for the MSearchKeyInfo. */
+	    enum { KInterfaceId = SEARCH_IF_ID_SEARCH_KEY_INFO };
+
+
+	public:
+
+	    /**
+	     * Public destructor.
+	     * Objects can be deleted through this interface.
+	     */
+	    virtual ~MSearchKeyInfo() {}
+
+
+	public:
+	    /**
+         *  returns key type 
+         *  cleint has to access Key() and Label() methods based on this return value.
+         *  if return value if Ekey , then  Key()
+         *  else f return value if ELabel ,then Label()
+         * 
+         *  @return the TKeyType , which is the key type.
+         *  any one value in the range of TKeyType enums 
+         * 
+         */
+         virtual  TKeyType  Type()const =0 ;
+         
+        /**
+         *   Sets the key type, whether label or key 
+         *
+         *   @param aType :  
+         *        aType to be set any value from the set of TKeyType enums
+         *
+         */
+        virtual void SetType( TKeyType aType)  = 0 ;
+	    
+	 	/**
+	     *  returns key value 
+	     * 
+	     *  @return the TSearchKey value , which is the key.
+	     *  this value is '0' if not set properly. ( If label 
+	     *  else any one value in the range of TSearchKey enums 
+	     *  also see searchelement.h for TSearchKey enums value. 
+	     */
+	    virtual  TSearchKey Key()const =0 ;
+	    
+	    
+      	/**
+	     *   Sets the key value
+	     *
+	     *   @param aKey :  
+	     *        akey to be set any value from the set of TSearchKey enums
+	     *
+	     */
+	    virtual void SetKey( TSearchKey aKey)  = 0 ;
+	    
+	    /**
+         *   returns the search label.
+         * 
+         *  @return TDesc16& value of the  label. 
+         */
+        virtual const TDesC16&  Label() const =0 ;
+        
+        
+        /**
+         *   Sets the label
+         *
+         *  @param aLabel   label to be set
+         */
+        virtual void  SetLabelL(const TDesC16& aLabel)  = 0 ;  
+    };
+
+
+#endif // MSEARCHKEYINFO_H
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_search_data_model_api/inc/searchobjectfactory.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,99 @@
+/*
+* 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:  Interface for Search Feature Plugin object factory.
+*
+*/
+
+#ifndef MSEARCHOBJECTFACTORY_H
+#define MSEARCHOBJECTFACTORY_H
+
+#include <ximpbase.h>
+#include <ximpidentity.h>
+#include <bamdesca.h>
+#include <searchdatamodelifids.hrh>
+
+
+class MSearchElement;
+class MSearchInfo;
+class MSearchKeyInfo;
+/**
+ * Interface for Search Feature Plugin search object factory.
+ *
+ * Search  object factory is used to instantiate
+ * data objects declared in data model API.
+ *
+ * @ingroup Searchdatamodelapi
+ *  
+ */
+class MSearchObjectFactory : public MXIMPBase
+    {
+	public:
+
+	    /** Interface ID for the MSearchObjectFactory. */
+	    enum { KInterfaceId = SEARCH_IF_ID_SEARCH_OBJECT_FACTORY };
+
+
+	protected:
+
+	    /**
+	     * Protected destructor.
+	     * Object instancies can't be deleted via this interface.
+	     */
+	    virtual ~MSearchObjectFactory() {}
+
+
+
+
+	public: 
+
+	 	/**
+	     * Instantiates new search element object.
+	     *
+	     * @return Newsearch element object instance.
+	     *         Object ownership is returned to caller.
+	     *
+	     * @leave KErrNoMemory if failed to allocate memory.
+	     */
+	   
+	    virtual MSearchElement* NewSearchElementLC() = 0;
+	    
+	    
+	    /**
+	     * Instantiates new search info object.
+	     *
+	     * @return New search info object instance.
+	     *         Object ownership is returned to caller.
+	     *
+	     * @leave KErrNoMemory if failed to allocate memory.
+	     */
+	    virtual MSearchInfo* NewSearchInfoLC() = 0;
+
+	    /**
+          * Instantiates new SearchKey info  object.
+          *
+          * @return new SearchKey   object instance.
+          *         Object ownership is returned to caller.
+          *
+          * @leave KErrNoMemory if failed to allocate memory.
+          */
+       virtual MSearchKeyInfo* NewSearchKeyInfoLC() = 0;
+
+    };
+
+
+
+#endif // MSEARCHOBJECTFACTORY_H
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_search_data_model_api/ximp_search_data_model_api.metaxml	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,14 @@
+<?xml version="1.0" ?>
+<api id="67998fbda77e658d4ae8862590cab3d7" dataversion="1.0">
+<name>ximp_search_data_model_api</name>
+<description>This is a API that provides data model for search related operations.</description>
+<type>c++</type>
+<subsystem>searchdatamodel</subsystem>
+<libs><lib name="searchdatamodel.lib"/>
+</libs>
+<release category="domain" sinceversion=""/>
+<attributes>
+<htmldocprovided>yes</htmldocprovided>
+<adaptation>no</adaptation>
+</attributes>
+</api>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_search_management_api/group/bld.inf	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,33 @@
+/*
+* 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:  File that exports the files belonging to 
+:                Search Feature Plugin Management API
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+../inc/searchmanagementifids.hrh     	MW_LAYER_PLATFORM_EXPORT_PATH(searchmanagementifids.hrh)
+../inc/searchfeature.inl     			MW_LAYER_PLATFORM_EXPORT_PATH(searchfeature.inl)
+../inc/searchfeature.h     				MW_LAYER_PLATFORM_EXPORT_PATH(searchfeature.h)
+../inc/search.h  						MW_LAYER_PLATFORM_EXPORT_PATH(search.h)
+../inc/searchevent.h  					MW_LAYER_PLATFORM_EXPORT_PATH(searchevent.h )
+../inc/searchelement.h					MW_LAYER_PLATFORM_EXPORT_PATH(searchelement.h)
+../inc/searchkeysevent.h 				MW_LAYER_PLATFORM_EXPORT_PATH(searchkeysevent.h)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_search_management_api/inc/search.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,101 @@
+/*
+* 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:  Search interface for clients use.
+*
+*/
+
+#ifndef MSEARCH_H
+#define MSEARCH_H
+
+#include <ximpbase.h>
+#include <searchmanagementifids.hrh>
+
+class  MXIMPIdentity;
+class  MSearchElement ;
+class  MXIMPObjectCollection;
+/**
+ * Search interface for clients use.
+ * Interface is implemented by the IM.
+ *
+ * @ingroup Searchmanagementapi
+ *
+ */
+class MSearch : public MXIMPBase
+    {
+public:
+
+    /** Interface ID for the MSearch. */
+    enum { KInterfaceId = SEARCH_IF_ID_SEARCH };
+
+
+protected:
+
+    /**
+     * Protected destructor.
+     * Object instancies can't be deleted via this interface.
+     */
+    virtual ~MSearch() {}
+
+
+
+public: 
+
+    /**
+     * start the search, issues the serach request to server 
+     *
+     * @param [in] aSearchId
+     *		Identification for a search.
+     *
+     * @param [in] aObjs
+     *        Its array of search elements.Elements contain what is to be serached. 
+     *
+     * @param [in] aSearchLimit 
+     *        How many results client wants at a time.
+     *
+	 * @return The request ID identifying the issued request.
+	 * 
+	 * 
+     */
+    virtual TXIMPRequestId SearchL( const MXIMPIdentity& aSearchId, 
+    								const RPointerArray< MSearchElement >& aObjs,
+                                    TInt aSearchLimit ) = 0;
+
+     
+
+    /**
+     * Cancels  the  search request which was issued.
+     *
+	 * @param [in] aImSearchId
+     *		Identification for the search to be stopped.
+     * 
+     *
+	 * @return The request ID identifying the issued request.
+	 *
+     * 
+     */
+	//virtual TXIMPRequestId CancelSearchL( const MXIMPIdentity& aSearchId ) = 0;
+											 
+    /**
+     *  Requests the protocol plugin for search keys supported.
+     *  Search key basically says client that server supports serach on this
+     *  particular key. Key may be e.g. EUserFirstname 
+     * 
+     */
+	virtual TXIMPRequestId GetSearchKeysL() = 0;
+    };
+
+
+#endif // MSEARCH_H
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_search_management_api/inc/searchelement.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,140 @@
+/*
+* 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:  Interface for search element
+*
+*/
+
+
+#ifndef MSEARCHELEMENT_H
+#define MSEARCHELEMENT_H
+
+#include <ximpbase.h>
+#include <searchmanagementifids.hrh>
+
+class MXIMPIdentity;
+/**
+ *  Enums 
+ *  Supported search keys  
+ *  Searver may not support all of these : 
+ *  Client can query server which are all supported 
+ */
+enum TSearchKey 
+    {
+    EUserFirstName = 600,
+    EUserMiddleName,
+    EUserLastName,
+    EUserFullName,
+    EUserCountry,
+    EUserCity,
+    EBirthday,
+    EState,
+    EUserEmailAddress,
+    EUser,
+    EUserNickName, 
+    EOrganisation,
+    EOrganisationUnit,
+    EReadLabel  // Not for client to set/use 
+                // if client trys to set this ,  SetrequestL leaves with KErrArgument
+                // In this case protocol plugin  has to read the LABEL
+    };
+
+/**
+ * Interface for search element object.
+ *
+ * 
+ *
+ * @ingroup searchmanagementapi
+ * 
+ */
+class MSearchElement: public MXIMPBase
+	{
+    public:
+
+        /** Interface ID for the MImSearchRequest. */
+    	enum { KInterfaceId = SEARCH_IF_ID_SEARCHELEMENT };
+
+    public:
+    
+       /**
+     	* Public destructor.
+     	* Objects instancies can be deleted through this interface.
+     	*/
+    	virtual ~MSearchElement() {}
+    	
+    public: 	
+       /**
+        * Set search values. 
+        * @param [in] aSearchStringId
+	    *		Identification for  search word.
+	    *
+	    *
+        * @param [in]  aKey
+        *			  search key value.
+        *
+        * e.g. to serach for "james" as a first name
+        *      aSearchStringId  has to be set with  "james"
+        *      aKey is EUserFirstName
+        * 
+        *  @leave KErrArgument if  client trys to set 'EReadLabel' as key.
+        *  if  aKey = EReadLabel then  leaves with  KErrArgument
+	    */
+        virtual void  SetRequestL( MXIMPIdentity&  aSearchStringId, TSearchKey aKey ) = 0;
+        							
+        /**
+          * Set search values. 
+          * @param [in] aSearchStringId
+          *       Identification for  search word.
+          *
+          *
+          * @param [in] aLabelId 
+          *             Identification for  label.
+          *
+          * e.g. to serach for "james" as a first name
+          *      aSearchStringId  has to be set with  "james"
+          *      aLabelId is  "firstname"  : this changes from server to server
+          *  client has to query these labels from server and use
+          */   
+        virtual void  SetRequestL( MXIMPIdentity& aSearchStringId, MXIMPIdentity& aLabelId  ) = 0;
+       
+        
+        /**
+        * returns  search identity 
+        *
+        *
+        * @return identity of the search : adaptation has to get the text from the Id
+	    */
+        virtual MXIMPIdentity& GetSearchId() const =0 ;
+        
+       /**
+        * returns  key  value of the search 
+        *
+        *
+        * @return any enum value of TSearchKey
+	    */
+        virtual TSearchKey GetSearchKey()const =0 ;
+
+        /**
+         * returns   label identity 
+         *
+         *
+         * @return identity of the label : adaptation has to get the text from the Id
+         */  
+        virtual MXIMPIdentity& GetSearchLabel() const =0 ;
+        
+		};
+
+
+#endif //MSEARCHELEMENT_H
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_search_management_api/inc/searchevent.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,87 @@
+/*
+* 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:  Event interface for Search results.
+*
+*/
+
+#ifndef MSEARCHEVENT_H
+#define MSEARCHEVENT_H
+
+#include <ximpbase.h>
+#include <searchmanagementifids.hrh>
+
+class MSearchInfo;
+class MXIMPIdentity;
+
+/**
+ * Event interface for search content.
+ *
+ * This interface is implemented by the Search Feature Plugin 
+ * This event notifies clients 
+ * when Search result is received from protocol.
+ * 
+ * @ingroup searchmanagementapi
+ */
+class MSearchEvent : public MXIMPBase
+    {
+public:
+    /** Interface ID for the MSearchEvent. */
+    enum { KInterfaceId = SEARCH_IF_ID_SEARCH_EVENT };
+
+
+protected:
+
+    /**
+     * Protected destructor.
+     * Object instancies can't be deleted via this interface.
+     */
+    virtual inline ~MSearchEvent() {};
+
+
+public: 
+
+	
+    /**
+     * returns the count of the searched results.
+     *
+     * @return The count of count of the searched results.
+     */
+    virtual TInt SearchResultCount() const = 0;
+    
+    
+    /**
+     * Gets the searched result by index.
+     *
+     * @param [in] aIndex
+     *        The index of the search.
+     *
+     * @return The searched result from given index.
+     */
+    virtual const MSearchInfo& SearchResult( TInt aIndex ) const = 0;
+    
+    
+    /**
+     * returns the serachid
+     *
+     * @return The serach id fro which result has come.
+     */
+    virtual const MXIMPIdentity& SearchId() const = 0;
+	
+
+    };
+
+
+#endif // MSEARCHEVENT_H
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_search_management_api/inc/searchfeature.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,111 @@
+/*
+* 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:  Interface for XIMP Framework /Search Feature 
+*
+*/
+
+#ifndef MSEARCHFEATURE_H
+#define MSEARCHFEATURE_H
+
+#include <ximpbase.h>
+#include <searchmanagementifids.hrh>
+#include <ximpcontext.h>
+
+
+class MSearch;
+class MSearchObjectFactory;
+
+
+/**
+ * Interface for Search Feature
+ *
+ * @ingroup searchmanagementapi
+ *
+ */
+class MSearchFeature : public MXIMPBase
+{
+	
+ 
+public:
+
+    /** Interface ID for the MSearchFeature. */
+   enum { KInterfaceId = XIMP_ECOM_IF_UID_SEARCH_INTERFACE };
+
+
+public:
+
+    /**
+     * Factory method to instantiate MSearchFeature.
+     *
+     * Factory method to instantiate platform default
+     * MXIMPClient implementation through the ECom.
+     * If the default search Feature isn't supported
+     * in the platform, leaves with errorcode signalled
+     * from ECom.
+     *
+     * @return The new serach client object. Object
+     *         ownership is returned to caller.
+     */
+    static inline MSearchFeature* NewL( MXIMPContext* aContext );
+
+    /**
+     * Public destructor.
+     * Objects can be deleted through this interface.
+     */
+    virtual inline ~MSearchFeature();
+    
+protected:
+
+    /**
+     * Default constructor to zero initialize
+     * the iEcomDtorID member.
+     */
+    inline MSearchFeature();
+
+
+public: //Sub interfaces for im context
+
+
+    /**
+     * Gets reference to search object factory interface.
+     *
+     * Returned object factory interface is used
+     * to instantiate search objects.
+     *
+     * @return Object factory interface.
+     *         No ownership is returned caller.
+     */
+    virtual MSearchObjectFactory& SearchObjectFactory() const = 0;
+
+    /**
+     * Gets reference to  search interface.
+     *
+     * @return Requested interface.
+     *         No ownership is returned caller.
+     */
+    virtual MSearch& Search() const = 0;
+
+private: // Data
+
+    //OWN: ECom destructor ID
+    TUid iEcomDtorID;
+    };
+
+#include <searchfeature.inl>
+
+
+#endif // MSearchFeature_H
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_search_management_api/inc/searchfeature.inl	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,64 @@
+/*
+* 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:  Search Feature interface used by XIMP  clients.
+*
+*/
+
+#include <ecom/ecom.h>
+
+
+// -----------------------------------------------------------------------------
+// MSearchFeature::NewL( MXIMPContext* aContext) implementation
+// Factory method to instantiate the platform default
+// MSearchFeature implementation through the ECom framework.
+// -----------------------------------------------------------------------------
+//
+inline MSearchFeature* MSearchFeature::NewL(MXIMPContext* aContext )
+    {
+    _LIT8( KXIMPSearchDefaultData, XIMP_ECOM_DEFAULT_DATA_SEARCH_INTERFACE );
+
+    TEComResolverParams resolvingParams;
+    resolvingParams.SetDataType( KXIMPSearchDefaultData );
+    resolvingParams.SetWildcardMatch( ETrue );
+	
+    TAny* imp = REComSession::CreateImplementationL( TUid::Uid( MSearchFeature::KInterfaceId),
+                                                     _FOFF( MSearchFeature, iEcomDtorID ),
+                                                     aContext, resolvingParams );
+
+    return reinterpret_cast< MSearchFeature* >( imp );
+    }
+
+
+// -----------------------------------------------------------------------------
+// MSearchFeature::MSearchFeature() implementation
+// Zero initializes the iEcomDtorID member.
+// -----------------------------------------------------------------------------
+//
+inline MSearchFeature::MSearchFeature()
+    {
+    iEcomDtorID = TUid::Null();
+    }
+
+
+// -----------------------------------------------------------------------------
+// MSearchFeature::~MSearchFeature()
+// Destructor notifies the ECom from implementation destruction.
+// -----------------------------------------------------------------------------
+//
+inline MSearchFeature::~MSearchFeature()
+    {
+    REComSession::DestroyedImplementation( iEcomDtorID );
+    }
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_search_management_api/inc/searchkeysevent.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,74 @@
+/*
+* 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:  Event interface for Search keys event.
+*
+*/
+
+#ifndef MSEARCHKEYSEVENT_H
+#define MSEARCHKEYSEVENT_H
+
+#include <ximpbase.h>
+#include <searchmanagementifids.hrh>
+
+class MSearchKeyInfo;
+
+/**
+ * Event interface for search content.
+ *
+ * This interface is implemented by the Search Feature Plugin 
+ * This event notifies clients 
+ * when Search Keys are received from protocol.
+ * 
+ * @ingroup searchmanagementapi
+ */
+class MSearchKeysEvent : public MXIMPBase
+    {
+public:
+    /** Interface ID for the MSearchKeysEvent. */
+    enum { KInterfaceId = SEARCH_IF_ID_SEARCH_KEYS_EVENT };
+
+
+protected:
+
+    /**
+     * Protected destructor.
+     * Object instancies can't be deleted via this interface.
+     */
+    virtual inline ~MSearchKeysEvent() {};
+    
+public :
+    /**
+     * returns the count of the  search key info count.
+     *
+     * @return The count of he supported search keys.
+     */
+    virtual TInt InfoCount() const =0;
+    
+    /**
+     * Gets the search key info object by index.
+     *
+     * @param [in] aIndex
+     *        The index of the array.
+     *
+     * @return The search key info object from given index.
+     */    
+    virtual const MSearchKeyInfo& SearchKeyInfo( TInt aIndex ) const = 0;
+    
+    
+    };
+
+
+#endif // MSEARCHKEYSEVENT_H
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_search_management_api/inc/searchmanagementifids.hrh	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,49 @@
+/*
+* 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:  Search Feature Plugin  Management API interface IDs.
+*
+*/
+
+#ifndef SEARCHMANAGEMENTIFUIDS_HRH
+#define SEARCHMANAGEMENTIFUIDS_HRH
+
+
+
+
+
+// Management IF id's
+// 20xx - ximp related
+// 21xx - presence related
+// 22xx - instant messaging related
+// 23xx - search related
+
+
+// Interface IDs for search Feature Plugin Management API interfaces
+#define SEARCH_IF_ID_SEARCH                        2301
+#define SEARCH_IF_ID_SEARCHELEMENT			   	   2302
+#define SEARCH_IF_ID_SEARCH_EVENT                  2304
+#define SEARCH_IF_ID_PROTOCOL_SEARCH_FEATURE       2305
+#define SEARCH_IF_ID_SEARCH_KEYS_EVENT             2306
+
+// Interface UID for searchfeatures interface
+#define XIMP_ECOM_IF_UID_SEARCH_INTERFACE             0x2001847B
+
+// Default implementation resulution data
+// for XIMP searchfeature interterface Base ECom interface
+#define XIMP_ECOM_DEFAULT_DATA_SEARCH_INTERFACE         "search"
+
+
+
+#endif // SEARCHMANAGEMENTIFUIDS_HRH
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_search_management_api/ximp_search_management_api.metaxml	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,14 @@
+<?xml version="1.0" ?>
+<api id="75c160758bc95162585777014237d64c" dataversion="1.0">
+<name>ximp_search_management_api</name>
+<description>This is an API that provides getting the search keys, search interfaces to the client.</description>
+<type>c++</type>
+<subsystem>searchmanager</subsystem>
+<libs><lib name="searchmanager.lib"/>
+</libs>
+<release category="domain" sinceversion=""/>
+<attributes>
+<htmldocprovided>yes</htmldocprovided>
+<adaptation>no</adaptation>
+</attributes>
+</api>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_search_protocol_plugin_api/group/bld.inf	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,31 @@
+/*
+* 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:  File that exports the files belonging to 
+:                Search Feature Protocol Plug-in API
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+
+../inc/protocolsearchfeature.h     			MW_LAYER_PLATFORM_EXPORT_PATH(protocolsearchfeature.h)
+../inc/searchprotocolpluginifids.hrh     	MW_LAYER_PLATFORM_EXPORT_PATH(searchprotocolpluginifids.hrh)
+../inc/protocolsearch.h     				MW_LAYER_PLATFORM_EXPORT_PATH(protocolsearch.h)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_search_protocol_plugin_api/inc/protocolsearch.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,110 @@
+/*
+* 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:  Interface for Search Feature Protocol
+*
+*/
+
+
+
+#ifndef MPROTOCOLSEARCH_H
+#define MPROTOCOLSEARCH_H
+
+#include <badesca.h>
+#include <ximpbase.h>
+#include <searchprotocolpluginifids.hrh>
+
+class MXIMPIdentity;
+class MSearchElement;
+/**
+ * Interface for Search object.
+ * Interface must be implemented by a XIMP Framework protocol
+ * plug-ins.
+ *
+ * This interface defines actions that XIMP Framework
+ * requests from a Search protocol connection to
+ * execute search related tasks.
+ *
+ *
+ * @ingroup ProtocolSearchpluginapi
+ * 
+ */
+class MProtocolSearch : public MXIMPBase
+    {
+public:
+
+    /** Interface ID for the MProtocolSearch */
+    enum { KInterfaceId = SEARCH_IF_ID_PROTOCOL_SEARCH };
+
+
+protected:
+
+    /**
+     * Protected destructor. MProtocolSearch
+     * instancies can't be destroyed via this interface.
+     */
+    virtual inline ~MProtocolSearch() {};
+
+
+public: 
+
+    /**
+     * Requests the protocol to start search.
+     *
+     *
+     * @param [in] aSearchId
+     *		Identification for a search.
+     *
+     * @param [in] aObjs
+     *        Defines what is to be searched. 
+     *
+     * @param [in] aSearchLimit
+     *        How many results client wants at a time. 
+     *
+     * @param [in] aReqId
+     * 		  request ID identifying the issued request.
+     */
+    virtual void DoSearchL( const  MXIMPIdentity& aSearchId,
+							const  RPointerArray< MSearchElement >& aObjs,
+							TInt   aSearchLimit,
+	                		TXIMPRequestId aReqId ) = 0;
+
+    
+
+    /**
+     * Requests the protocol to  Stop search.
+     *
+     * @param [in] aSearchId
+     *		Identification for a search.
+     *
+     *
+     * @param [in] aReqId
+     * 		  request ID identifying the issued request
+     */
+/*	virtual void DoCancelSearchL( const MXIMPIdentity& aSearchId,
+                                        TXIMPRequestId aReqId ) = 0;*/
+	
+    /**
+     * Requests the protocol to get the serach keys
+     *
+     *
+     * @param [in] aReqId
+     *        request ID identifying the issued request
+     */
+    virtual void DoGetSearchKeysL( TXIMPRequestId aReqId ) = 0;
+
+    };
+
+
+
+#endif // MPROTOCOLIMSEARCH_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_search_protocol_plugin_api/inc/protocolsearchfeature.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,104 @@
+/*
+* 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:  Interface for search feature Protocol  object.
+*
+*/
+
+#ifndef MPROTOCOLSEARCHFEATURE_H
+#define MPROTOCOLSEARCHFEATURE_H
+
+#include <ximpbase.h>
+#include <searchmanagementifids.hrh>
+#include <ximpcontext.h>
+
+
+
+class MProtocolSearch;
+class MProtocolSearchDataHost;
+
+
+
+/**
+ * .
+ * Interface must be implemented by a XIMP Framework
+ * protocol plug-ins.
+ *
+ * @ingroup protocolsearchpluginapi
+ *  
+ */
+class MProtocolSearchFeature : public MXIMPBase
+    {
+    
+public:
+
+    /** Interface ID for the MProtocolSearchFeature. */
+    enum { KInterfaceId = SEARCH_IF_ID_PROTOCOL_SEARCH_FEATURE };
+
+
+
+    /**
+     * Protected destructor. MXIMPProtocolConnection
+     * objects can't be deleted through this interface.
+     *
+     * XIMP Framework disposes MXIMPProtocolConnection
+     * instances through MXIMPProtocolPlugin::ReleaseConnection().
+     */
+    virtual inline ~MProtocolSearchFeature()  {};
+ 
+    
+
+
+public: // Access to sub-interfaces
+
+    /**
+     * Gets reference to  search interface.
+     *
+     * search calls this method to retrieve a reference
+     * to protocols MProtocolSearch interface
+     * implementation.
+     *
+     * Call and interface lifetime convention:
+     * - This method isn't called before protocol has signalled
+     *   MXIMPProtocolConnection::OpenSessionL() succesfully completed.
+     *
+     * - XIMP Framework may call this method multiple times for
+     *   for one MXIMPProtocolConnection instance.
+     *
+     * - Each call per one MXIMPProtocolConnection instance,
+     *   must return reference to same interface instance.
+     *
+     * - Returned interface instance must remain valid (usable)
+     *   untill last client session, using originating im protocol
+     *   connection is successfully closed with
+     *   MXIMPProtocolConnection::CloseSession().
+     *
+     * @return Requested interface.
+     *         interface ownership is not returned caller.
+     */
+    virtual MProtocolSearch& Search() = 0;
+    
+    
+   /**
+     * Sets reference of serach datahost.
+     *
+     * @param aSearchHost 
+     *			MProtocolSearchDataHost object reference.
+     *			ownership is not transfered.
+     */
+    virtual void SetHost(MProtocolSearchDataHost& aSearchHost) = 0;
+
+    };
+
+
+#endif // MPROTOCOLSEARCHFEATURES_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_search_protocol_plugin_api/inc/searchprotocolpluginifids.hrh	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,36 @@
+/*
+* 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:  Protocol Plugin API interface IDs.
+*
+*/
+
+#ifndef SEARCHPROTOCOLPLUGINIFIDS_HRH
+#define SEARCHPROTOCOLPLUGINIFIDS_HRH
+
+
+
+// Protocol plugin IF id's
+// 30xx - ximp related
+// 31xx - presence related
+// 32xx - instant messaging related
+// 34xx - search related
+
+// Interface IDs for XIMPFw Protocol Plugin API interfaces
+
+#define SEARCH_IF_ID_PROTOCOL_SEARCH                    3400
+#define SEARCH_IF_ID_PROTOCOL_SEARCH_FEATURES           3401
+
+#endif // SEARCHPROTOCOLPLUGINIFIDS_HRH
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_search_protocol_plugin_api/ximp_search_protocol_plugin_api.metaxml	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,13 @@
+<?xml version="1.0" ?>
+<api id="22bcb6bea40a8e683c1963e396fcc070" dataversion="1.0">
+<name>ximp_search_protocol_plugin_api</name>
+<description>This is an API that provides search interfaces to the adaptation plugin which needs to be implemented by the adaptation.</description>
+<type>c++</type>
+<subsystem>ximp_search_protocol_plugin_api</subsystem>
+<libs></libs>
+<release category="domain" sinceversion=""/>
+<attributes>
+<htmldocprovided>yes</htmldocprovided>
+<adaptation>no</adaptation>
+</attributes>
+</api>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_search_protocol_plugin_host_api/group/bld.inf	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,31 @@
+/*
+* 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:  File that exports the files belonging to 
+:                XIMP Search Feature Plugin  Host API
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+
+../inc/searchprotocolpluginhostifids.hrh    MW_LAYER_PLATFORM_EXPORT_PATH(searchprotocolpluginhostifids.hrh)
+../inc/protocolsearchdatahost.h     		MW_LAYER_PLATFORM_EXPORT_PATH(protocolsearchdatahost.h)
+../inc/protocolsearchfeaturedatahost.h	    MW_LAYER_PLATFORM_EXPORT_PATH(protocolsearchfeaturedatahost.h)
+../inc/protocolsearchpluginhost.h	    MW_LAYER_PLATFORM_EXPORT_PATH(protocolsearchpluginhost.h)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_search_protocol_plugin_host_api/inc/protocolsearchdatahost.h	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  Interface for Search Feature Plugin  host
+ *
+*/
+
+#ifndef MPROTOCOLSEARCHDATAHOST_H
+#define MPROTOCOLSEARCHDATAHOST_H
+
+#include <ximpbase.h>
+#include <searchprotocolpluginhostifids.hrh>
+#include <e32std.h>
+
+class MXIMPStatus;
+class MSearchObjectFactory;
+class MXIMPProtocolConnectionHostObserver;
+class MProtocolImConversationDataHost;
+class MProtocolImGroupDataHost;
+class MProtocolImInvitationDataHost;
+class MProtocolImSearchDataHost;
+class MXIMPHost;
+
+class MProtocolSearchFeatureDataHost;
+/**
+ * search connection host. 
+ * Main interface class for protocol plugin.
+ * protocol plugin can get sub interfaces to features from this.
+ * 
+ * @ingroup ProtocolSearchpluginhostapi
+ */
+ 
+ 
+class MProtocolSearchDataHost
+
+    {
+public:
+
+    
+    /** Interface ID for the MProtocolSearchDataHost. */
+    enum { KInterfaceId = XIMP_ECOM_IF_UID_SEARCH_PROCESSOR_INTERFACE };
+
+    
+protected:
+
+    /**
+     * Protected destructor. MProtocolSearchDataHost instancies
+     * can't be destroyed via this interface.
+     */
+    virtual inline ~MProtocolSearchDataHost() {};
+
+
+    
+
+public: // Access to sub-interfaces
+
+
+    /**
+     * Gets reference to object factory interface.
+     *
+     * search protocol connection implementation
+     * uses factory interface to instantiate Im
+     * objects.
+     *
+     * @return Object factory interface.
+     *         No ownership is returned caller.
+     */
+   
+	virtual MSearchObjectFactory& SearchObjectFactory() = 0;
+	
+	
+	/**
+     * Gets reference to
+     * MProtocolSearchFeatureDataHost interface.
+     *
+     * Search protocol connection implementation uses returned
+     * data host interface to manage the 
+     * search data.
+     *
+     * @return MProtocolSearchFeatureDataHost interface.
+     *         Interface ownership is not returned caller.
+     *         Returned interface is guaranteed to remain valid (usable)
+     *         as long as this source interface.
+     */
+
+    
+    virtual MProtocolSearchFeatureDataHost& SearchFeatureDataAccess() =0;
+    
+    
+    };
+
+
+#endif // MPROTOCOLIMDATAHOST_H
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_search_protocol_plugin_host_api/inc/protocolsearchfeaturedatahost.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,129 @@
+/*
+* 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:  header for MProtocolSearchFeatureDataHost
+*
+*/
+
+#ifndef MPROTOCOLSEARCHFEATUREDATAHOST_H
+#define MPROTOCOLSEARCHFEATUREDATAHOST_H
+
+
+#include <searchprotocolpluginhostifids.hrh>
+#include <ximpbase.h>
+
+
+class MXIMPIdentity;
+class MXIMPObjectCollection;
+
+/**
+ * Interface for managing cached search information.
+ *
+ * Interface is used by protocol adaptations to manage
+ * search related information 
+ *
+ * This interface is implemented by Search plugin
+ * Protocol adaptation can obtain reference to this
+ * interface from 
+ * 
+ * @ingroup ProtocolSearchpluginhostapi
+ */
+class MProtocolSearchFeatureDataHost : public MXIMPBase
+    {
+public:
+
+    /** Interface ID for the MProtocolSearchFeatureDataHost. */
+    enum { KInterfaceId = SEARCH_IF_ID_PROTOCOL_SEARCH_DATAHOST };
+
+
+protected:
+
+
+    /**
+     * Protected destructor. Object instancies
+     * can't be deleted via this interface.
+     */
+    virtual ~MProtocolSearchFeatureDataHost() {}
+
+
+
+public: // Handling search information
+
+
+    /**
+     * Notifies Search plugin for 
+     * search result information.
+     *
+     *
+     * Search plugin takes ownership of the argument(s),
+     * if method succeeds without a leave.
+     *
+     * @param [in] aSearchId
+	 * 			search  id of the search request
+
+     * @param [in]  aSearchResults -List of results( MsearchInfos), 
+     *        NULL if none.    
+     *
+     * @return The request id identifying the issued request.
+     *         Data cache request is processed asynchronously and
+     *         its completion is signalled to adaptation direction.
+     *
+     * @leave KErrNoMemory if failed to allocate memory.
+     * @leave KErrArgument if NULL argument(s) were provided.
+     */
+
+    virtual TXIMPRequestId HandleSearchResultsL(MXIMPIdentity* aSearchId,
+    										    MXIMPObjectCollection* aSearchResults)  = 0;
+   /**
+    * Notifies Search plugin for 
+    * supported search Keys and serach labels  information.
+    * 
+    *
+    * Search plugin takes ownership of the argument(s),
+    * if method succeeds without a leave.
+    *
+    * @param [in] aSearchKeyInfos - List of search key info objects 
+    *        
+    *
+    * @return The request id identifying the issued request.
+    *         Data cache request is processed asynchronously and
+    *         its completion is signalled to adaptation direction.
+    *
+    * @leave KErrNoMemory if failed to allocate memory.
+    * @leave KErrArgument if NULL argument(s) were provided.
+    */							                               
+    virtual TXIMPRequestId HandleSearchKeysL( MXIMPObjectCollection* aSearchKeyInfos )  = 0;                            
+
+	/**
+     * Notifies  search plugin for 
+     * search stopped.
+     *
+     *
+     *  search plugin takes ownership of the argument(s),
+     * if method succeeds without a leave.
+     *
+     * @param [in] aSearchId
+	 * 			search  id of the search request
+     *
+     * @return The request id identifying the issued request.
+     *         Data cache request is processed asynchronously and
+     *         its completion is signalled to adaptation.
+     * @leave KErrNoMemory if failed to allocate memory.
+     * @leave KErrArgument if NULL argument(s) were provided.
+     */
+
+  //  virtual TXIMPRequestId HandleSearchCancelL(MXIMPIdentity* aSearchId)  = 0;
+    };
+
+
+#endif // MPROTOCOLSEARCHFEATUREDATAHOST_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_search_protocol_plugin_host_api/inc/protocolsearchpluginhost.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,150 @@
+/*
+* 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:  Protocol Search Feature Plugin host interface.
+*
+*/
+
+#ifndef MPROTOCOLSEARCHPLUGINHOST_H
+#define MPROTOCOLSEARCHPLUGINHOST_H
+
+#include <ximpbase.h>
+#include <protocolimpluginhostifids.hrh>
+#include <e32std.h>
+
+
+// CLASS DECLARATION
+
+/**
+ * Interface for Search Protocol Plugin host.
+ * This interface is implemented by search
+ *
+ * @ingroup Protocolserachpluginhostapi
+ * 
+ */
+class MProtocolSearchPluginHost : public MXIMPBase
+    {
+public:
+
+    /** Interface ID for the MProtocolImPluginHost. */
+    enum { KInterfaceId = SEARCH_IF_ID_PROTOCOL_PLUGIN_HOST };
+
+
+protected:
+
+    /**
+     * Protected destructor. IM Protocol Plugin host
+     * instancies can't be destroyed via this interface.
+     */
+    virtual inline ~MProtocolSearchPluginHost() {};
+
+
+public:
+
+
+    /**
+     * Gets reference to object factory interface.
+     *
+     * Returned object factory interface is used
+     * to instantiate IM data objects.
+     *
+     * @return Object factory interface.
+     *         No ownership is returned caller.
+     */
+    virtual MSearchObjectFactory& ObjectFactory() = 0;
+
+
+
+    /**
+     * Notifies IM that IM protocol
+     * plug-in has completed (successfully or otherwise)
+     * the request handling.
+     *
+     * /b NOTE: This method isn't yet supported by IM,
+     *       since all MProtocolImPlugin methods are currently
+     *       synchronous.
+     *
+     * @param [in] aReqId
+     *        Request ID identifying the request which handling
+     *        is completed. This must equal to value given in
+     *        the processing initiation. If no pending IM
+     *        protocol plug-in request is found with this id,
+     *        plug-in is paniced.
+     *
+     * @param [in] aResultCode
+     *        Result code from request handling.
+     */
+    virtual void HandleRequestCompleted( TXIMPRequestId aReqId,
+                                         TInt aResultCode ) = 0;
+
+
+    /**
+     * Notifies IM that IM protocol
+     * plug-in has completed (successfully or otherwise)
+     * the request handling.
+     *
+     * /b NOTE: This method isn't yet supported by IM,
+     *       since all MProtocolImPlugin methods are currently
+     *       synchronous.
+     *
+     * @param [in] aReqId
+     *        Request ID identifying the request which handling
+     *        is completed. This must equal to value given in
+     *        the processing initiation. If no pending IM
+     *        protocol plug-in request is found with this id,
+     *        plug-in is paniced.
+     * @param [in] aResult
+     *        Status object describing result from request handling.
+     *        Object ownership is transfered always to IM.
+     *        NULL value not allowed.
+     */
+    virtual void HandleRequestCompleted( TXIMPRequestId aReqId,
+                                         MImStatus* aResult ) = 0;
+
+
+    /**
+     * Notifies IM that IM protocol
+     * plug-in has completed (successfully or otherwise)
+     * the request handling.
+     *
+     * /b NOTE: This method isn't yet supported by IM,
+     *       since all MProtocolImPlugin methods are currently
+     *       synchronous.
+     *
+	 * @param [in] aReqId
+     *        Request ID identifying the request which handling
+     *        is completed. This must equal to value given in
+     *        the processing initiation. If no pending IM
+     *        protocol plug-in request is found with this id,
+     *        plug-in is paniced.
+     * @param [in] aResult
+     *        Status object describing result from request handling.
+     *        Object ownership is transfered always to Im.
+     *        NULL value not allowed.
+     * @param [in] aParameter
+     *        Additional request complete parameters.
+     *        NULL if no additional parameters to transfer Im.
+     *        Parameter may be single MXIMPBase derived
+     *        object or MImRestrictedObjectCollection object
+     *        containing multiple objects. Ownership of given
+     *        parameter (also the container and contained objects)
+     *        is transfered always to Im.
+     */
+    virtual void HandleRequestCompleted( TXIMPRequestId aReqId,
+                                         MImStatus* aResult,
+                                         MXIMPBase* aParameter ) = 0;
+
+    };
+
+
+#endif // MPROTOCOLSEARCHPLUGINHOST_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_search_protocol_plugin_host_api/inc/searchprotocolpluginhostifids.hrh	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,40 @@
+/*
+* 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:  Protocol Plugin Host API interface IDs.
+*
+*/
+
+#ifndef PROTOCOLSEARCHPLUGINHOSTIFIDS_HRH
+#define PROTOCOLSEARCHPLUGINHOSTIFIDS_HRH
+
+
+// Protocol plugin host IF id's
+// 40xx - ximp related
+// 41xx - presence related
+// 42xx - instant messaging related
+// 43xx - instant messaging related
+
+// Interface IDs for search Plugin Host interfaces
+
+#define SEARCH_IF_ID_PROTOCOL_PLUGIN_HOST    			 4300
+#define SEARCH_IF_ID_PROTOCOL_SEARCH_DATAHOST            4301
+#define SEARCH_IF_ID_PROTOCOL_DATA_HOST                  4302
+
+// Interface UID for Searchfeatures interface
+#define XIMP_ECOM_IF_UID_SEARCH_PROCESSOR_INTERFACE      0x2001847C
+
+
+#endif // PROTOCOLSEARCHPLUGINHOSTIFIDS_HRH
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/ximp_search_protocol_plugin_host_api/ximp_search_protocol_plugin_host_api.metaxml	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,14 @@
+<?xml version="1.0" ?>
+<api id="f6d94742009b5c62b40550fd0fc105e9" dataversion="1.0">
+<name>ximp_search_protocol_plugin_host_api</name>
+<description>Interface for managing cached search information. Interface is used by protocol adaptations to manage search related information, this interface is implemented by Search plugin Protocol adaptation.</description>
+<type>c++</type>
+<subsystem>searchprocessor</subsystem>
+<libs><lib name="searchprocessor.lib"/>
+</libs>
+<release category="domain" sinceversion=""/>
+<attributes>
+<htmldocprovided>yes</htmldocprovided>
+<adaptation>no</adaptation>
+</attributes>
+</api>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/xmpp_settings_api/group/bld.inf	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  File that exports the files belonging to 
+:                XIMP IM Base API
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+../inc/xmppparams.h     	MW_LAYER_PLATFORM_EXPORT_PATH(xmppparams.h)
+../inc/xmppservicesettingsapi.h			MW_LAYER_PLATFORM_EXPORT_PATH(xmppservicesettingsapi.h)
+../inc/xmppsettingsapicommon.h				MW_LAYER_PLATFORM_EXPORT_PATH(xmppsettingsapicommon.h)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/xmpp_settings_api/inc/xmppparams.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,85 @@
+/*
+* Copyright (c) 2007-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 header holds the various xmpp params/fields
+*
+*/
+
+#ifndef __XMPPPARAMS_H
+#define __XMPPPARAMS_H
+
+#include <e32base.h>
+namespace XmppParams
+    {
+      /** Presence status */
+        enum TPresenceStatus
+            {
+            /** Unavailable */
+            EUnavailable,
+            /** Available */
+            EAvailable,
+            /** Chat */
+            EChat,
+            /** Away */
+            EAway,
+            /** Extended away */
+            EXAway,
+            /** Do not disturb */
+            EDoNotDisturb,
+            /** Invisible */
+            EInvisible
+            };
+
+    // TInt
+    _LIT( KXmppParamSnapId,                         "SNAP-ID");
+    _LIT( KXmppParamServerPort,                     "SERVER-ADDRESS_PORT");
+    _LIT( KXmppParamMsgToneVolume,                  "MSG-TONE_VOLUME");
+    _LIT( KXmppParamSipProfileId,                   "VOIP-PROFILE-ID");
+    _LIT( KXmppParamVoipProfileId,                  "SIP-PROFILE-ID");
+    // TBool == TInt
+    _LIT( KXmppParamPublishOnThePhoneState,         "PUBLISH-ON-THE-PHONE-STATUS");
+    _LIT( KXmppParamAutoAcceptBuddyReq,             "ACCEPT-BUDDY-REQ-AUTO-ENABLED");
+    // others == TInt
+    _LIT( KXmppParamPresenceStatus,                 "PRESENCE-STATUS");
+    _LIT( KXmppParamConSecurityOption,              "CONNECTION-SECURITY-OPTION");
+    // TDesC16
+    _LIT( KXmppParamMsgTonePathFile,                "MESSAGE-TONE-PATH-FILE");
+    _LIT( KXmppParamXmppServerAddress,              "XMPP-SERVER-ADDRESS");
+    _LIT( KXmppParamDomain,                         "XMPP-DOMAIN");
+    _LIT( KXmppParamUsername,                       "XMPP-USERNAME");
+    _LIT( KXmppParamPassword,                       "XMPP-PASSWORD");
+    _LIT( KXmppParamPresenceStatusFreeTextOnline,         "PRESENCE-STATUS-FREE-TEXT-ONLINE");
+    _LIT( KXmppParamPresenceStatusFreeTextAway,         "PRESENCE-STATUS-FREE-TEXT-AWAY");
+    _LIT( KXmppParamPresenceStatusFreeTextBusy,         "PRESENCE-STATUS-FREE-TEXT-BUSY");    
+    _LIT( KXmppParamPresenceStatusFreeTextOffline,         "PRESENCE-STATUS-FREE-TEXT-OFFLINE");
+    _LIT( KXmppParamPresenceStatusFreeTextInvisible,    "PRESENCE-STATUS-FREE-TEXT-INVISIBLE"); 
+    _LIT( KXmppParamLastLoggedInUserName,              "XMPP-LAST-LOGGEDIN-USERNAME");
+    // gabble specific things
+
+
+	_LIT( KXmppParamResource,                		"RESOURCE-FILE");
+	_LIT( KXmppParamOldSSLRequired,                 "OLD_SSL_REQUIRED");
+	_LIT( KXmppParamRegisterRequired,               "REGISTER-REQUIRED");
+	_LIT( KXmppParamHttpsProxyServerPort,           "HTTPS-PROXY-SERVER-ADDRESS_PORT");
+	_LIT( KXmppParamHttpsProxyServerAddress,        "HTTPS-PROXY-SERVER-ADDERES");  
+	_LIT( KXmppParamAlais,                   		"ALIAS");
+    _LIT( KXmppParamSnapName,                       "SNAP-NAME");
+    _LIT( KXmppParamSettingsName,                   "SETTINGS-NAME");
+	
+	//Connection manager related    
+    _LIT( KXmppParamConnMgrBus,                   	"CONNMGR_BUS");
+    _LIT( KXmppParamConnMgrPath,                  	"CONNMGR_PATH");
+    _LIT( KXmppParamProtocol,           	      	"PROTOCOL");
+
+    }
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/xmpp_settings_api/inc/xmppservicesettingsapi.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,301 @@
+/*
+* 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:  This class handles dynamic name-value pair storing.
+*
+*/
+
+
+#ifndef C_XMPPSETTINGSAPI_H
+#define C_XMPPSETTINGSAPI_H
+
+
+
+#include <e32base.h>
+
+class CRepository;
+class CXmppSettingsRecord;
+class CXmppSettingsColumn;
+
+
+/**
+ *  This class handles dynamic name-value pair storing.
+ *  Be warned, all actions are final.
+ *
+ *
+ *  This is how this component works:
+ *  It has two tables. First one, the column table, contains only single row.
+ *  This table is actually a header table for the record table. When you set
+ *  an new attribute, we check that does it already exist in column table. If
+ *  it does not, it is added as last entry. After that data of the attribute 
+ *  is set to the record table into same column as it is attribute name is in
+ *  the column table. Row of the settings record is determined by
+ *  given settingsrecordid.
+ *
+ *  The column table can hold 0xFFFE (65534) of different user attributes
+ *  and you can add 0xFF (255) different settingsrecords.
+ *
+ *  Below is an picture of the tables. Only the ID column is mandatory. All 
+ *  other columns are defined by user.
+ *
+ *   ------------------------------------------------------------
+ *   | COLUMNS TABLE                                             |
+ *   |-----------------------------------------------------------
+ *   | 1  |     2       |      3      |    4     |  5... |      |
+ *   ------------------------------------------------------------
+ *   | ID | SERVER-ADDR | SERVER-PORT | USERNAME | etc...|      |
+ *   ------------------------------------------------------------
+ *   
+ *   ------------------------------------------------------------
+ *   | RECORDS TABLE                                            |
+ *   |-----------------------------------------------------------
+ *   |  1 |          2          |  3   |    4    |  5... |      |
+ *   ------------------------------------------------------------
+ *   |  1 |   www.gizmo.com     | 5223 | Myerdin | etc...|      |
+ *   ------------------------------------------------------------
+ *   |  2 |                     | 5222 | Ballmer | etc...|      |
+ *   ------------------------------------------------------------
+ *   |  3 |   login.com         |      | Apple   | etc...|      |
+ *   ------------------------------------------------------------
+ *   |  4 |   aaa.bbb.com       | 1234 | user    | etc...|      |
+ *   ------------------------------------------------------------
+ * 
+ *  Usage examples: 
+ *  @code
+ *  ---- Example 1 ----------------------------------------------
+ *   Usage example:
+ *   First Create settings record:
+ *
+ *   TUint32 settingId(0);
+ *   CXmppSettingsApi* sapi = CXmppSettingsApi::NewLC();
+ *   sapi->CreateSettingsRecordL( settingId );
+ *   CleanupStack::PopAndDestroy( sapi );
+ *
+ *   The settingId contains now new id.
+ *
+ * ---- Example 2 ----------------------------------------------
+ *   You can request default settings record (currently returns the first):
+ *
+ *   TUint32 settingId(0);
+ *   sapi->DefaultSettingsRecordL( settingId );
+ *
+ *   The settingId contains now the id.
+ *
+ *  ---- Example 3 ----------------------------------------------
+ *   When you want to add new parameter to the settings record, do following:
+ *
+ *   _LIT( KOurParam, "USERNAME");
+ *
+ *   sapi->SetParamL( settingId,
+ *                    KOurParam(),
+ *                    aUsername );
+ *
+ *   If this is the first time the parameter is added to the settings record,
+ *   it creates new room for it.
+ *
+ *  ---- Example 4 ----------------------------------------------
+ *   When you want to get parameter from the settings record, do following:
+ *
+ *   _LIT( KOurParam, "USERNAME");
+ *   RBuf value;
+ *   value.CreateL( KMaxParamLength );
+ *
+ *   sapi->SetParamL( settingId,
+ *                    KOurParam(),
+ *                    value );
+ *
+ *   Value now contains the value recordd in the settings record. If no value
+ *   has been set for this settins records column, then it cannot be
+ *   found ->leaves KErrNotFound.
+ *
+ *  @endcode
+ *
+ *  @lib jabbersettings.lib
+ *  @since S60 5.0
+ */
+class CXmppSettingsApi: public CBase
+    {
+
+public:
+		
+		/**
+     * Two-phased constructor.         
+     * @return Instance of this class
+     */
+    IMPORT_C static CXmppSettingsApi* NewL();
+
+    IMPORT_C static CXmppSettingsApi* NewLC();
+		
+		/**
+	   * Destructor
+	   */
+    IMPORT_C virtual ~CXmppSettingsApi();
+
+
+    /**
+     * Creates new settings record.
+     *
+     * @since S60 5.0
+     * @param aSettingsRecordId On return contains the new setting id.
+     */
+    IMPORT_C void CreateSettingsRecordL( TUint32& aSettingsRecordId );
+
+    /**
+     * Removes Settings record using given settings record id.
+     *
+     * @since S60 5.0
+     * @param aSettingsRecordId Setting id to be removed.
+     */
+    IMPORT_C void RemoveSettingsRecordL( TUint32 aSettingsRecordId );
+
+    /**
+     * Returns default settings record id.
+     *
+     * @since S60 5.0
+     * @param aSettingsRecordId On return contains the setting id.
+     */
+    IMPORT_C void DefaultSettingsRecordL( TUint32& aSettingsRecordId );
+
+    /**
+     * Fills the array with settings ids. If there is none, array
+     * is zero length.
+     *
+     * @since S60 5.0
+     * @param aArray Array is filled with setting ids.
+     */
+    IMPORT_C void GetSettingsRecordIdArrayL( RArray<TUint32>& aArray );
+
+    /**
+     * Sets value of the param. If ParamName is not found, it creates new.
+     *
+     * @since S60 5.0
+     * @param aSettingsRecordId Setting id of interest.
+     * @param aAttrName Parameters name.
+     * @param aAttrValue Parameters value.
+     */
+    IMPORT_C void SetParamL( TUint32 aSettingsRecordId,
+                             const TDesC& aAttrName,
+                             const TDesC& aAttrValue );
+
+    /**
+     * Sets value of the param. If ParamName is not found, it creates new.
+     *
+     * @since S60 5.0
+     * @param aSettingsRecordId Setting id of interest.
+     * @param aAttrName Parameters name.
+     * @param aAttrValue Parameters value.
+     */
+    IMPORT_C void SetParamL( TUint32 aSettingsRecordId,
+                             const TDesC& aAttrName,
+                             TInt aAttrValue );
+
+    /**
+     * Gets value of the param.
+     * - KErrNotFound if setting collection or Param is not found.
+     *
+     * @since S60 5.0
+     * @param aSettingsRecordId Setting id of interest.
+     * @param aAttrName Parameters name.
+     * @param aAttrValue On return, contains the param value.
+     */
+    IMPORT_C void GetParamL( TUint32 aSettingsRecordId,
+                             const TDesC& aAttrName,
+                             TDes& aAttrValue );
+
+    /**
+     * Gets value of the param.
+     * - KErrNotFound if setting collection or Param is not found.
+     *
+     * @since S60 5.0
+     * @param aSettingsRecordId Setting id of interest.
+     * @param aAttrName Parameters name.
+     * @param aAttrValue On return, contains the param value.
+     */
+    IMPORT_C void GetParamL( TUint32 aSettingsRecordId,
+                                const TDesC& aAttrName,
+                                TInt& aAttrValue );
+
+    /**
+     * Removes this param from this Settings record.
+     * - KErrNotFound If Settings record or param is not found.
+     *
+     * @since S60 5.0
+     * @param aSettingsRecordId Setting id.
+     * @param aAttrName Parameters name.
+     */
+    IMPORT_C void RemoveParamL( TUint32 aSettingsRecordId,
+                                const TDesC& aAttrName );
+
+	
+	 /**
+     * This method does checks before setting or getting values.
+     *
+     * @since S60 5.0
+     * @param aSettingsRecordId Setting id to be changed.
+     * @param aAttrName Parameters name.
+     * @param aCreateColumnIfNotExist Should new column be created if it is not
+     *                         founded (by aAttrName).
+     * @param aTheKey On return contains key to be created/changed.
+     */
+    IMPORT_C void GetRepositoryKeyL( TUint32 aSettingsRecordId,
+                       const TDesC& aAttrName,
+                       TBool aCreateColumnIfNotExist,
+                       TUint32& aTheKey );
+                       
+private:
+		
+		/**
+		 * Default Contructor
+		 */
+    CXmppSettingsApi();
+
+    void ConstructL();
+
+   	 /**
+     * This method does checks before setting or getting values.
+     *
+     * @since S60 5.0
+     * @param aSettingsRecordId Setting id to be changed.
+     * @param aAttrName Parameters name.
+     * @param aCreateColumnIfNotExist Should new column be created if it is not
+     *                         founded (by aAttrName).
+     * @param aTheKey On return contains key to be created/changed.
+     */
+    void GetColumnKeyL( TUint32 aSettingsRecordId,
+                       const TDesC& aAttrName,
+                       TBool aCreateColumnIfNotExist,
+                       TUint32& aTheKey );
+
+private: // data
+
+    /**
+     * Central Repository.
+     * Own.
+     */
+    CRepository* iRepository;
+
+    /**
+     * Class for settings records handling.
+     * Own.
+     */
+    CXmppSettingsRecord* iRecords;
+
+    /**
+     * Class for column table handling.
+     * Own.
+     */
+    CXmppSettingsColumn* iColumns;
+
+    };
+
+#endif // C_XMPPSETTINGSAPI_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/xmpp_settings_api/inc/xmppsettingsapicommon.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,37 @@
+/*
+* 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:  Common defines for this component.
+*
+*/
+
+
+
+
+#ifndef _XMPPSETTINGSAPICOMMON_H
+#define _XMPPSETTINGSAPICOMMON_H
+
+#include <e32base.h>
+
+_LIT( KColSettingId, "XMPP-SETTING-ID-COL");
+const TUid  KXmppSettingsApiCenRep         ={0x1020E334};
+// keys
+const TUint32 KXmppKeyColumnTable       = 0x00000000;
+const TUint32 KXmppKeyDataTable         = 0x01000000;
+const TUint32 KCurrentSettingIdIndex    = 0xFFFFFFFF;
+
+//masks
+const TUint32 KXmppMaskColumns          = 0xFFFF0000;
+const TUint32 KXmppMaskAllRows          = 0xFF00FFFF;
+
+#endif // _XMPPSETTINGSAPICOMMON_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/xmpp_settings_api/tsrc/bmarm/xmppsettings_apiu.def	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,3 @@
+EXPORTS
+	LibEntryL__FR13CTestModuleIf @ 1 NONAME R3UNUSED ; LibEntryL(CTestModuleIf &)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/xmpp_settings_api/tsrc/bwins/xmppsettings_apiu.def	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,3 @@
+EXPORTS
+	?LibEntryL@@YAPAVCScriptBase@@AAVCTestModuleIf@@@Z @ 1 NONAME ; class CScriptBase * __cdecl LibEntryL(class CTestModuleIf &)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/xmpp_settings_api/tsrc/conf/xmppsettings_api.cfg	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,70 @@
+[Test]
+title Test_CreateSettingsRecordL
+create xmppsettings_api xmppsettings_apiObj
+xmppsettings_apiObj Test_CreateSettingsRecordL 
+delete xmppsettings_apiObj
+[Endtest] 
+
+[Test]
+title Test_DefaultSettingsRecord
+create xmppsettings_api xmppsettings_apiObj
+xmppsettings_apiObj Test_DefaultSettingsRecord 
+delete xmppsettings_apiObj
+[Endtest] 
+
+[Test]
+title Test_GetSettingsRecordIdArray
+create xmppsettings_api xmppsettings_apiObj
+xmppsettings_apiObj Test_GetSettingsRecordIdArray 
+delete xmppsettings_apiObj
+[Endtest]
+
+[Test]
+title Test_SetParamInt
+create xmppsettings_api xmppsettings_apiObj
+xmppsettings_apiObj Test_SetParamInt 
+delete xmppsettings_apiObj
+[Endtest]
+
+[Test]
+title Test_SetParamLDes
+create xmppsettings_api xmppsettings_apiObj
+xmppsettings_apiObj Test_SetParamLDes 
+delete xmppsettings_apiObj
+[Endtest]
+
+[Test]
+title Test_GetParamInt
+create xmppsettings_api xmppsettings_apiObj
+xmppsettings_apiObj Test_GetParamInt 
+delete xmppsettings_apiObj
+[Endtest]
+
+[Test]
+title Test_GetParamLDes
+create xmppsettings_api xmppsettings_apiObj
+xmppsettings_apiObj Test_GetParamLDes 
+delete xmppsettings_apiObj
+[Endtest]
+
+[Test]
+title Test_RemoveSettingsRecord
+create xmppsettings_api xmppsettings_apiObj
+xmppsettings_apiObj Test_RemoveSettingsRecord 
+delete xmppsettings_apiObj
+[Endtest]
+
+[Test]
+title Test_RemoveParam
+create xmppsettings_api xmppsettings_apiObj
+xmppsettings_apiObj Test_RemoveParam 
+delete xmppsettings_apiObj
+[Endtest]
+
+[Test]
+title Test_GetRepositoryKeyL
+create xmppsettings_api xmppsettings_apiObj
+xmppsettings_apiObj Test_GetRepositoryKeyL 
+delete xmppsettings_apiObj
+[Endtest]
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/xmpp_settings_api/tsrc/eabi/xmppsettings_apiU.def	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,3 @@
+EXPORTS
+	_Z9LibEntryLR13CTestModuleIf @ 1 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/xmpp_settings_api/tsrc/group/bld.inf	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,54 @@
+/*
+* 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:
+*
+*/
+
+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_TESTEXPORTS
+// NOTE: If using ARS requirements all export operations should be done under this.
+// 'abld test export'
+
+PRJ_EXPORTS
+// Specify the source file followed by its destination here
+// copy will be used to copy the source file to its destination
+// If there's no destination then the source file will be copied
+// 
+// Example: 
+/*
+
+*/
+../init/TestFramework.ini /epoc32/winscw/c/TestFramework/TestFramework.ini
+../conf/xmppsettings_api.cfg /epoc32/winscw/c/TestFramework/xmppsettings_api.cfg	
+PRJ_TESTMMPFILES
+
+	xmppsettings_api.mmp
+
+
+// Specify the .mmp files required for building the important component
+// releasables.
+//
+// Specify "tidy" if the component you need to build doesn't need to be
+// released. Specify "ignore" if the MMP file exists but should be
+// ignored.
+// Example:
+//
+
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/xmpp_settings_api/tsrc/group/xmppsettings_api.mmp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,77 @@
+/*TYPE TESTCLASS*/
+/*
+* 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: MMP file for STIF Test Framework's TestScripter 
+* testclass test module.
+*
+*/
+
+#include <platform_paths.hrh>
+
+TARGET          xmppsettings_api.dll
+TARGETTYPE      dll
+UID             0x1000008D 0x101FB3E3
+
+CAPABILITY      ALL -TCB
+/* Remove comments and replace 0x00000000 with correct vendor id */
+// VENDORID     0x00000000
+/* Remove comments and replace 0x00000000 with correct secure id */
+// SECUREID     0x00000000
+
+//TARGETPATH      ?target_path
+DEFFILE         xmppsettings_api.DEF
+
+USERINCLUDE     ../inc 
+
+OS_LAYER_SYSTEMINCLUDE
+APP_LAYER_SYSTEMINCLUDE
+MW_LAYER_SYSTEMINCLUDE
+SOURCEPATH      ../src
+
+SOURCE          xmppsettings_api.cpp
+SOURCE          xmppsettings_apiBlocks.cpp
+
+//RESOURCE        resource_file
+//RESOURCE        resource_file2
+
+LIBRARY         euser.lib
+LIBRARY         stiftestinterface.lib
+LIBRARY         stiftestengine.lib
+LIBRARY         jabbersettings.lib
+LIBRARY         centralrepository.lib
+LANG            SC
+
+/*
+START WINS      
+?wins_specific_information
+END
+
+START MARM
+?marm_specific_information
+END
+*/
+// Other possible keywords:
+ 
+// DOCUMENT     ?file, that is not compiled, but added to MSVC project workspace (i.e. release notes)
+/*
+START BITMAP ?target
+TARGETPATH   ?emulated_path_on_target_machine
+HEADER
+SOURCE       ?color_depth ?source_bitmap
+END
+*/
+// DEFFILE ?filename
+// AIF ?filename
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/xmpp_settings_api/tsrc/group/xmppsettings_api.pkg	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,66 @@
+;
+; 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:
+;
+; 	Installation file for STIF
+;
+
+; Languages
+&EN
+
+; Provide value for uid
+#{"STIF"},(0x00000000),1,1,0,TYPE=SA
+
+; Series60 product id for S60 3.0
+[0x101F7961], 0, 0, 0, {"Series60ProductID"}
+
+; Localised Vendor name
+%{"Nokia"}
+
+; Unique Vendor name
+:"Nokia"
+
+; Logo
+; None
+
+; Package signature - Optional
+; None
+
+; Start of Package body
+
+; Condition blocks
+; None
+
+; Options list
+; None
+
+;INI FILE
+"..\init\testframework.ini"        			-"c:\Testframework\ttestframework.ini"
+
+;CFG FILES
+"..\conf\xmppsettings_api.cfg"        			-"c:\Testframework\xmppsettings_api.cfg"
+
+; Install files
+"\epoc32\release\armv5\udeb\xmppsettings_api.dll"   -   "!:\Sys\Bin\xmppsettings_api.dll"
+  
+; Embedded SIS 
+; None
+
+; End of Package body
+
+; PKG dependencies
+; None
+
+; PKG capabilities
+; None
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/xmpp_settings_api/tsrc/group/xmppsettings_api_DoxyFile.txt	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,241 @@
+#/*TYPE TESTCLASS*/
+#/*
+#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: MMP file for STIF Test Framework's TestScripter 
+# testclass test module.
+#
+#*/
+
+# Doxyfile 1.4.1
+
+#---------------------------------------------------------------------------
+# Project related configuration options
+#---------------------------------------------------------------------------
+PROJECT_NAME           = xmppsettings_api
+PROJECT_NUMBER         = 
+OUTPUT_DIRECTORY       = \xmppsettings_api\
+CREATE_SUBDIRS         = NO
+OUTPUT_LANGUAGE        = English
+USE_WINDOWS_ENCODING   = YES
+BRIEF_MEMBER_DESC      = YES
+REPEAT_BRIEF           = YES
+ABBREVIATE_BRIEF       = 
+ALWAYS_DETAILED_SEC    = NO
+INLINE_INHERITED_MEMB  = NO
+FULL_PATH_NAMES        = NO
+STRIP_FROM_PATH        = 
+STRIP_FROM_INC_PATH    = 
+SHORT_NAMES            = NO
+JAVADOC_AUTOBRIEF      = NO
+MULTILINE_CPP_IS_BRIEF = NO
+DETAILS_AT_TOP         = NO
+INHERIT_DOCS           = YES
+DISTRIBUTE_GROUP_DOC   = NO
+TAB_SIZE               = 8
+ALIASES                = 
+OPTIMIZE_OUTPUT_FOR_C  = YES
+OPTIMIZE_OUTPUT_JAVA   = NO
+SUBGROUPING            = YES
+#---------------------------------------------------------------------------
+# Build related configuration options
+#---------------------------------------------------------------------------
+EXTRACT_ALL            = YES
+EXTRACT_PRIVATE        = NO
+EXTRACT_STATIC         = NO
+EXTRACT_LOCAL_CLASSES  = NO
+EXTRACT_LOCAL_METHODS  = NO
+HIDE_UNDOC_MEMBERS     = NO
+HIDE_UNDOC_CLASSES     = NO
+HIDE_FRIEND_COMPOUNDS  = NO
+HIDE_IN_BODY_DOCS      = NO
+INTERNAL_DOCS          = YES
+CASE_SENSE_NAMES       = YES
+HIDE_SCOPE_NAMES       = NO
+SHOW_INCLUDE_FILES     = YES
+INLINE_INFO            = YES
+SORT_MEMBER_DOCS       = YES
+SORT_BRIEF_DOCS        = NO
+SORT_BY_SCOPE_NAME     = NO
+GENERATE_TODOLIST      = NO
+GENERATE_TESTLIST      = NO
+GENERATE_BUGLIST       = NO
+GENERATE_DEPRECATEDLIST= YES
+ENABLED_SECTIONS       = 
+MAX_INITIALIZER_LINES  = 30
+SHOW_USED_FILES        = YES
+SHOW_DIRECTORIES       = YES
+FILE_VERSION_FILTER    = 
+#---------------------------------------------------------------------------
+# configuration options related to warning and progress messages
+#---------------------------------------------------------------------------
+QUIET                  = NO
+WARNINGS               = YES
+WARN_IF_UNDOCUMENTED   = YES
+WARN_IF_DOC_ERROR      = YES
+WARN_NO_PARAMDOC       = NO
+WARN_FORMAT            = "$file:$line: $text"
+WARN_LOGFILE           = 
+#---------------------------------------------------------------------------
+# configuration options related to the input files
+#---------------------------------------------------------------------------
+INPUT                  = \xmppsettings_api\
+FILE_PATTERNS          = *.h \
+                         *.rh \
+                         *.hrh
+RECURSIVE              = YES
+EXCLUDE                = 
+EXCLUDE_SYMLINKS       = NO
+EXCLUDE_PATTERNS       = 
+EXAMPLE_PATH           = 
+EXAMPLE_PATTERNS       = 
+EXAMPLE_RECURSIVE      = NO
+IMAGE_PATH             = 
+INPUT_FILTER           = 
+FILTER_PATTERNS        = 
+FILTER_SOURCE_FILES    = NO
+#---------------------------------------------------------------------------
+# configuration options related to source browsing
+#---------------------------------------------------------------------------
+SOURCE_BROWSER         = NO
+INLINE_SOURCES         = NO
+STRIP_CODE_COMMENTS    = YES
+REFERENCED_BY_RELATION = YES
+REFERENCES_RELATION    = YES
+VERBATIM_HEADERS       = YES
+#---------------------------------------------------------------------------
+# configuration options related to the alphabetical class index
+#---------------------------------------------------------------------------
+ALPHABETICAL_INDEX     = NO
+COLS_IN_ALPHA_INDEX    = 5
+IGNORE_PREFIX          = 
+#---------------------------------------------------------------------------
+# configuration options related to the HTML output
+#---------------------------------------------------------------------------
+GENERATE_HTML          = NO
+HTML_OUTPUT            = html
+HTML_FILE_EXTENSION    = .html
+HTML_HEADER            = 
+HTML_FOOTER            = 
+HTML_STYLESHEET        = 
+HTML_ALIGN_MEMBERS     = YES
+GENERATE_HTMLHELP      = YES
+CHM_FILE               = 
+HHC_LOCATION           = 
+GENERATE_CHI           = NO
+BINARY_TOC             = YES
+TOC_EXPAND             = YES
+DISABLE_INDEX          = YES
+ENUM_VALUES_PER_LINE   = 4
+GENERATE_TREEVIEW      = YES
+TREEVIEW_WIDTH         = 250
+#---------------------------------------------------------------------------
+# configuration options related to the LaTeX output
+#---------------------------------------------------------------------------
+GENERATE_LATEX         = NO
+LATEX_OUTPUT           = latex
+LATEX_CMD_NAME         = latex
+MAKEINDEX_CMD_NAME     = makeindex
+COMPACT_LATEX          = NO
+PAPER_TYPE             = a4wide
+EXTRA_PACKAGES         = 
+LATEX_HEADER           = 
+PDF_HYPERLINKS         = NO
+USE_PDFLATEX           = NO
+LATEX_BATCHMODE        = NO
+LATEX_HIDE_INDICES     = NO
+#---------------------------------------------------------------------------
+# configuration options related to the RTF output
+#---------------------------------------------------------------------------
+GENERATE_RTF           = YES
+RTF_OUTPUT             = Doc
+COMPACT_RTF            = YES
+RTF_HYPERLINKS         = YES
+RTF_STYLESHEET_FILE    = 
+RTF_EXTENSIONS_FILE    = 
+#---------------------------------------------------------------------------
+# configuration options related to the man page output
+#---------------------------------------------------------------------------
+GENERATE_MAN           = NO
+MAN_OUTPUT             = man
+MAN_EXTENSION          = .3
+MAN_LINKS              = NO
+#---------------------------------------------------------------------------
+# configuration options related to the XML output
+#---------------------------------------------------------------------------
+GENERATE_XML           = NO
+XML_OUTPUT             = xml
+XML_SCHEMA             = 
+XML_DTD                = 
+XML_PROGRAMLISTING     = YES
+#---------------------------------------------------------------------------
+# configuration options for the AutoGen Definitions output
+#---------------------------------------------------------------------------
+GENERATE_AUTOGEN_DEF   = NO
+#---------------------------------------------------------------------------
+# configuration options related to the Perl module output
+#---------------------------------------------------------------------------
+GENERATE_PERLMOD       = NO
+PERLMOD_LATEX          = NO
+PERLMOD_PRETTY         = YES
+PERLMOD_MAKEVAR_PREFIX = 
+#---------------------------------------------------------------------------
+# Configuration options related to the preprocessor   
+#---------------------------------------------------------------------------
+ENABLE_PREPROCESSING   = YES
+MACRO_EXPANSION        = YES
+EXPAND_ONLY_PREDEF     = NO
+SEARCH_INCLUDES        = YES
+INCLUDE_PATH           = 
+INCLUDE_FILE_PATTERNS  = 
+PREDEFINED             = NONSHARABLE_CLASS
+EXPAND_AS_DEFINED      = 
+SKIP_FUNCTION_MACROS   = YES
+#---------------------------------------------------------------------------
+# Configuration::additions related to external references   
+#---------------------------------------------------------------------------
+TAGFILES               = 
+GENERATE_TAGFILE       = 
+ALLEXTERNALS           = NO
+EXTERNAL_GROUPS        = YES
+PERL_PATH              = /usr/bin/perl
+#---------------------------------------------------------------------------
+# Configuration options related to the dot tool   
+#---------------------------------------------------------------------------
+CLASS_DIAGRAMS         = YES
+HIDE_UNDOC_RELATIONS   = YES
+HAVE_DOT               = NO
+CLASS_GRAPH            = YES
+COLLABORATION_GRAPH    = YES
+GROUP_GRAPHS           = YES
+UML_LOOK               = NO
+TEMPLATE_RELATIONS     = YES
+INCLUDE_GRAPH          = YES
+INCLUDED_BY_GRAPH      = YES
+CALL_GRAPH             = NO
+GRAPHICAL_HIERARCHY    = YES
+DIRECTORY_GRAPH        = YES
+DOT_IMAGE_FORMAT       = png
+DOT_PATH               = 
+DOTFILE_DIRS           = 
+MAX_DOT_GRAPH_WIDTH    = 1024
+MAX_DOT_GRAPH_HEIGHT   = 1024
+MAX_DOT_GRAPH_DEPTH    = 0
+DOT_TRANSPARENT        = NO
+DOT_MULTI_TARGETS      = NO
+GENERATE_LEGEND        = YES
+DOT_CLEANUP            = YES
+#---------------------------------------------------------------------------
+# Configuration::additions related to the search engine   
+#---------------------------------------------------------------------------
+SEARCHENGINE           = NO
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/xmpp_settings_api/tsrc/group/xmppsettings_api_nrm.mmp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,75 @@
+/*TYPE TESTCLASS*/
+/*
+* 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: MMP file for STIF Test Framework's TestScripter 
+* testclass test module.
+*
+*/
+
+#include <platform_paths.hrh>
+
+TARGET          xmppsettings_api.dll
+TARGETTYPE      dll
+UID             0x1000008D 0x101FB3E3
+
+CAPABILITY      ALL -TCB
+/* Remove comments and replace 0x00000000 with correct vendor id */
+// VENDORID     0x00000000
+/* Remove comments and replace 0x00000000 with correct secure id */
+// SECUREID     0x00000000
+
+//TARGETPATH      ?target_path
+DEFFILE         xmppsettings_api.def
+
+USERINCLUDE     ../inc 
+
+OS_LAYER_SYSTEMINCLUDE
+
+SOURCEPATH      ../src
+
+SOURCE          xmppsettings_api.cpp
+SOURCE          xmppsettings_apiBlocks.cpp
+
+//RESOURCE        resource_file
+//RESOURCE        resource_file2
+
+LIBRARY         euser.lib
+LIBRARY         stiftestinterface.lib
+LIBRARY         stiftestengine.lib
+
+LANG            SC
+
+/*
+START WINS      
+?wins_specific_information
+END
+
+START MARM
+?marm_specific_information
+END
+*/
+// Other possible keywords:
+ 
+// DOCUMENT     ?file, that is not compiled, but added to MSVC project workspace (i.e. release notes)
+/*
+START BITMAP ?target
+TARGETPATH   ?emulated_path_on_target_machine
+HEADER
+SOURCE       ?color_depth ?source_bitmap
+END
+*/
+// DEFFILE ?filename
+// AIF ?filename
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/xmpp_settings_api/tsrc/inc/xmppsettings_api.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,224 @@
+/*
+* 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: STIF testclass declaration
+*
+*/
+
+#ifndef XMPPSETTINGS_API_H
+#define XMPPSETTINGS_API_H
+
+//  INCLUDES
+#include <StifLogger.h>
+#include <TestScripterInternal.h>
+#include <StifTestModule.h>
+#include <TestclassAssert.h>
+
+// CONSTANTS
+//const ?type ?constant_var = ?constant;
+
+// MACROS
+//#define ?macro ?macro_def
+#define TEST_CLASS_VERSION_MAJOR 0
+#define TEST_CLASS_VERSION_MINOR 0
+#define TEST_CLASS_VERSION_BUILD 0
+
+// Logging path
+_LIT( Kxmppsettings_apiLogPath, "\\logs\\testframework\\xmppsettings_api\\" ); 
+// Log file
+_LIT( Kxmppsettings_apiLogFile, "xmppsettings_api.txt" ); 
+_LIT( Kxmppsettings_apiLogFileWithTitle, "xmppsettings_api_[%S].txt" );
+
+// FUNCTION PROTOTYPES
+//?type ?function_name(?arg_list);
+
+// FORWARD DECLARATIONS
+//class ?FORWARD_CLASSNAME;
+class CXmppSettingsApi;
+class Cxmppsettings_api;
+
+// DATA TYPES
+//enum ?declaration
+//typedef ?declaration
+//extern ?data_type;
+
+// CLASS DECLARATION
+
+/**
+*  Cxmppsettings_api test class for STIF Test Framework TestScripter.
+*  ?other_description_lines
+*
+*  @lib ?library
+*  @since ?Series60_version
+*/
+NONSHARABLE_CLASS(Cxmppsettings_api) : public CScriptBase
+    {
+    public:  // Constructors and destructor
+
+        /**
+        * Two-phased constructor.
+        */
+        static Cxmppsettings_api* NewL( CTestModuleIf& aTestModuleIf );
+
+        /**
+        * Destructor.
+        */
+        virtual ~Cxmppsettings_api();
+
+    public: // New functions
+
+        /**
+        * ?member_description.
+        * @since ?Series60_version
+        * @param ?arg1 ?description
+        * @return ?description
+        */
+        //?type ?member_function( ?type ?arg1 );
+
+    public: // Functions from base classes
+
+        /**
+        * From CScriptBase Runs a script line.
+        * @since ?Series60_version
+        * @param aItem Script line containing method name and parameters
+        * @return Symbian OS error code
+        */
+        virtual TInt RunMethodL( CStifItemParser& aItem );
+
+    protected:  // New functions
+
+        /**
+        * ?member_description.
+        * @since ?Series60_version
+        * @param ?arg1 ?description
+        * @return ?description
+        */
+        //?type ?member_function( ?type ?arg1 );
+
+    protected:  // Functions from base classes
+
+        /**
+        * From ?base_class ?member_description
+        */
+        //?type ?member_function();
+
+    private:
+
+        /**
+        * C++ default constructor.
+        */
+        Cxmppsettings_api( CTestModuleIf& aTestModuleIf );
+
+        /**
+        * By default Symbian 2nd phase constructor is private.
+        */
+        void ConstructL();
+
+        // Prohibit copy constructor if not deriving from CBase.
+        // ?classname( const ?classname& );
+        // Prohibit assigment operator if not deriving from CBase.
+        // ?classname& operator=( const ?classname& );
+
+        /**
+        * Frees all resources allocated from test methods.
+        * @since ?Series60_version
+        */
+        void Delete();
+
+        /**
+        * Test methods are listed below. 
+        */
+
+        /**
+        * Example test method.
+        * @since ?Series60_version
+        * @param aItem Script line containing parameters.
+        * @return Symbian OS error code.
+        */
+        
+        void ResetRepository();
+        virtual TInt Test_CreateSettingsRecordL( CStifItemParser& aItem );
+        virtual TInt Test_DefaultSettingsRecord( CStifItemParser& aItem );
+        virtual TInt Test_GetSettingsRecordIdArray(CStifItemParser& aItem );
+        virtual TInt Test_SetParamInt(CStifItemParser& aItem );
+        virtual TInt Test_SetParamLDes(CStifItemParser& aItem );
+        virtual TInt Test_GetParamInt(CStifItemParser& aItem );
+        virtual TInt Test_GetParamLDes(CStifItemParser& aItem );
+        virtual TInt Test_RemoveSettingsRecord(CStifItemParser& aItem );
+        virtual TInt Test_RemoveParam(CStifItemParser& aItem );
+        virtual TInt Test_GetRepositoryKeyL(CStifItemParser& aItem);
+       
+        /**
+         * Method used to log version of test class
+         */
+        void SendTestClassVersion();
+
+        //ADD NEW METHOD DEC HERE
+        //[TestMethods] - Do not remove
+
+    public:     // Data
+        // ?one_line_short_description_of_data
+        //?data_declaration;
+        TInt iXmppSettingId;
+           TInt iXmppSnapId;
+           TInt iXmppServerPort;
+           TInt iMessageToneVolume;
+           TInt iLastRegistrationError;
+
+           TBool iPublishOnThePhoneStatus;
+           TBool iRoamingWarning;
+           TBool iAllowBuddyReq;
+           TBool iAutoLogin;
+           TBool iDefaultProfile;
+
+           HBufC* iMessageTone;
+           HBufC* iSnapName;
+           HBufC* iSettingsName;
+           HBufC* iStackVersion;
+           HBufC* iXmppServerAddress;
+           HBufC* iUsername;
+           HBufC* iPassword;
+           HBufC* iConnectionServer1;
+           HBufC* iConnectionServer2;
+           TUint32 iSettingId;
+           RArray<TUint32> iSettingIdArray;
+           
+           CXmppSettingsApi* iApi;
+
+           
+
+
+    protected:  // Data
+        // ?one_line_short_description_of_data
+        //?data_declaration;
+
+    private:    // Data
+        
+        // ?one_line_short_description_of_data
+        //?data_declaration;
+
+        // Reserved pointer for future extension
+        //TAny* iReserved;
+
+    public:     // Friend classes
+        //?friend_class_declaration;
+    protected:  // Friend classes
+        //?friend_class_declaration;
+    private:    // Friend classes
+        //?friend_class_declaration;
+
+    };
+
+#endif      // XMPPSETTINGS_API_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/xmpp_settings_api/tsrc/init/TestFramework.ini	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,45 @@
+#
+# This is STIFTestFramework initialization file
+# Comment lines start with '#'-character.
+# See STIF TestFramework users guide.doc for instructions
+
+# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+
+[Engine_Defaults]
+
+TestReportMode= FullReport		# Possible values are: 'Empty', 'Summary', 'Environment',
+                                                               'TestCases' or 'FullReport'
+
+CreateTestReport= YES			# Possible values: YES or NO
+
+TestReportFilePath= C:\LOGS\TestFramework\
+TestReportFileName= TestReport
+
+TestReportFormat= TXT			# Possible values: TXT or HTML
+TestReportOutput= FILE			# Possible values: FILE or RDEBUG
+TestReportFileCreationMode= OVERWRITE	# Possible values: OVERWRITE or APPEND
+
+DeviceResetDllName= StifResetForNokia.dll # e.g. 'StifHWResetStub.dll' for user specific reseting
+
+[End_Defaults]
+# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+
+# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+# Module configurations start
+
+[New_Module]
+ModuleName= testscripter
+TestCaseFile= C:\testframework\xmppsettings_api.cfg
+[End_Module]
+
+
+
+
+# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+
+[Logger_Defaults]
+
+[End_Logger_Defaults]
+# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+
+# End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/xmpp_settings_api/tsrc/src/xmppsettings_api.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,254 @@
+/*
+* 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: This file contains testclass implementation.
+*
+*/
+
+// INCLUDE FILES
+#include <StifTestInterface.h>
+#include "xmppsettings_api.h"
+#include <SettingServerClient.h>
+#include<xmppservicesettingsapi.h>
+
+// EXTERNAL DATA STRUCTURES
+//extern  ?external_data;
+
+// EXTERNAL FUNCTION PROTOTYPES  
+//extern ?external_function( ?arg_type,?arg_type );
+
+// CONSTANTS
+//const ?type ?constant_var = ?constant;
+
+// MACROS
+//#define ?macro ?macro_def
+
+// LOCAL CONSTANTS AND MACROS
+//const ?type ?constant_var = ?constant;
+//#define ?macro_name ?macro_def
+
+// MODULE DATA STRUCTURES
+//enum ?declaration
+//typedef ?declaration
+
+// LOCAL FUNCTION PROTOTYPES
+//?type ?function_name( ?arg_type, ?arg_type );
+
+// FORWARD DECLARATIONS
+//class ?FORWARD_CLASSNAME;
+
+// ============================= LOCAL FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// ?function_name ?description.
+// ?description
+// Returns: ?value_1: ?description
+//          ?value_n: ?description_line1
+//                    ?description_line2
+// -----------------------------------------------------------------------------
+//
+/*
+?type ?function_name(
+    ?arg_type arg,  // ?description
+    ?arg_type arg)  // ?description
+    {
+
+    ?code  // ?comment
+
+    // ?comment
+    ?code
+    }
+*/
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// Cxmppsettings_api::Cxmppsettings_api
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+Cxmppsettings_api::Cxmppsettings_api( 
+    CTestModuleIf& aTestModuleIf ):
+        CScriptBase( aTestModuleIf )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// Cxmppsettings_api::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void Cxmppsettings_api::ConstructL()
+    {
+        iXmppSettingId = 0;
+        iXmppSnapId = 15;
+        
+        iXmppServerPort = 5223;
+        iMessageToneVolume = 7;
+        iLastRegistrationError = KErrNone;
+
+        iPublishOnThePhoneStatus = ETrue;
+        iRoamingWarning = ETrue;
+        iAllowBuddyReq = ETrue;
+        iAutoLogin = EFalse;
+        iDefaultProfile = ETrue;
+        
+        iApi = CXmppSettingsApi::NewL();
+         iMessageTone = HBufC::NewL( 50 );
+        iMessageTone->Des().Copy( _L("c:\\system\\tones\\diipadaapa.wav") );
+        
+       // LOGARG16("messagetone path: %S", iMessageTone);
+        
+        iSnapName = HBufC::NewL( 50 );
+        iSnapName->Des().Copy( _L("Internet") );
+        
+        iSettingsName = HBufC::NewL( 50 );
+        iSettingsName->Des().Copy( _L("XMPP-SETTING 1") );
+        
+        iStackVersion = HBufC::NewL( 50 );
+        iStackVersion->Des().Copy( _L("XMPP STACK V1.021 build 127") );
+        
+        iXmppServerAddress = HBufC::NewL( 50 );
+        iXmppServerAddress->Des().Copy( _L("chat.gizmoproject.com") );
+        
+        iUsername = HBufC::NewL( 50 );
+        iUsername->Des().Copy( _L("lassi") );
+        
+        iPassword = HBufC::NewL( 50 );
+        iPassword->Des().Copy( _L("lassi123") );
+        
+        iConnectionServer1 = HBufC::NewL( 50 );
+        iConnectionServer1->Des().Copy( _L("Con.Server.gizmo.com") );
+        
+        iConnectionServer2 = HBufC::NewL( 50 );
+        iConnectionServer2->Des().Copy( _L("Con2.Server.gizmo.com") );
+        
+        
+
+    //Read logger settings to check whether test case name is to be
+    //appended to log file name.
+    RSettingServer settingServer;
+    TInt ret = settingServer.Connect();
+    if(ret != KErrNone)
+        {
+        User::Leave(ret);
+        }
+    // Struct to StifLogger settigs.
+    TLoggerSettings loggerSettings; 
+    // Parse StifLogger defaults from STIF initialization file.
+    ret = settingServer.GetLoggerSettings(loggerSettings);
+    if(ret != KErrNone)
+        {
+        User::Leave(ret);
+        } 
+    // Close Setting server session
+    settingServer.Close();
+
+    TFileName logFileName;
+    
+    if(loggerSettings.iAddTestCaseTitle)
+        {
+        TName title;
+        TestModuleIf().GetTestCaseTitleL(title);
+        logFileName.Format(Kxmppsettings_apiLogFileWithTitle, &title);
+        }
+    else
+        {
+        logFileName.Copy(Kxmppsettings_apiLogFile);
+        }
+
+    iLog = CStifLogger::NewL( Kxmppsettings_apiLogPath, 
+                          logFileName,
+                          CStifLogger::ETxt,
+                          CStifLogger::EFile,
+                          EFalse );
+    
+    SendTestClassVersion();
+    }
+
+// -----------------------------------------------------------------------------
+// Cxmppsettings_api::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+Cxmppsettings_api* Cxmppsettings_api::NewL( 
+    CTestModuleIf& aTestModuleIf )
+    {
+    Cxmppsettings_api* self = new (ELeave) Cxmppsettings_api( aTestModuleIf );
+
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+
+    return self;
+
+    }
+
+// Destructor
+Cxmppsettings_api::~Cxmppsettings_api()
+    { 
+
+    // Delete resources allocated from test methods
+    Delete();
+        delete iMessageTone;
+        delete iSnapName;
+        delete iSettingsName;
+        delete iStackVersion;
+        delete iXmppServerAddress;
+        delete iUsername;
+        delete iPassword;
+        delete iConnectionServer1;
+        delete iConnectionServer2;
+        delete iApi;
+    // Delete logger
+    delete iLog; 
+
+    }
+
+//-----------------------------------------------------------------------------
+// Cxmppsettings_api::SendTestClassVersion
+// Method used to send version of test class
+//-----------------------------------------------------------------------------
+//
+void Cxmppsettings_api::SendTestClassVersion()
+	{
+	TVersion moduleVersion;
+	moduleVersion.iMajor = TEST_CLASS_VERSION_MAJOR;
+	moduleVersion.iMinor = TEST_CLASS_VERSION_MINOR;
+	moduleVersion.iBuild = TEST_CLASS_VERSION_BUILD;
+	
+	TFileName moduleName;
+	moduleName = _L("xmppsettings_api.dll");
+
+	TBool newVersionOfMethod = ETrue;
+	TestModuleIf().SendTestModuleVersion(moduleVersion, moduleName, newVersionOfMethod);
+	}
+
+// ========================== OTHER EXPORTED FUNCTIONS =========================
+
+// -----------------------------------------------------------------------------
+// LibEntryL is a polymorphic Dll entry point.
+// Returns: CScriptBase: New CScriptBase derived object
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CScriptBase* LibEntryL( 
+    CTestModuleIf& aTestModuleIf ) // Backpointer to STIF Test Framework
+    {
+
+    return ( CScriptBase* ) Cxmppsettings_api::NewL( aTestModuleIf );
+
+    }
+
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/xmpp_settings_api/tsrc/src/xmppsettings_apiBlocks.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,605 @@
+/*
+* 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: This file contains testclass implementation.
+*
+*/
+
+// [INCLUDE FILES] - do not remove
+#include <e32svr.h>
+#include <StifParser.h>
+#include <StifTestInterface.h>
+#include "xmppsettings_api.h"
+#include <xmppservicesettingsapi.h>
+#include<centralrepository.h>
+
+// EXTERNAL DATA STRUCTURES
+//extern  ?external_data;
+const TUid  KXmppSettingsApiCenRep         ={0x1020e334};
+_LIT( KParamName, "XMPP-PARAM-NUMBER-0x%08d");
+_LIT( KParamValue16, "param value - 0x%08d");
+// EXTERNAL FUNCTION PROTOTYPES  
+//extern ?external_function( ?arg_type,?arg_type );
+
+// CONSTANTS
+//const ?type ?constant_var = ?constant;
+
+// MACROS
+//#define ?macro ?macro_def
+
+// LOCAL CONSTANTS AND MACROS
+//const ?type ?constant_var = ?constant;
+//#define ?macro_name ?macro_def
+
+// MODULE DATA STRUCTURES
+//enum ?declaration
+//typedef ?declaration
+
+// LOCAL FUNCTION PROTOTYPES
+//?type ?function_name( ?arg_type, ?arg_type );
+
+// FORWARD DECLARATIONS
+//class ?FORWARD_CLASSNAME;
+
+// ============================= LOCAL FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// ?function_name ?description.
+// ?description
+// Returns: ?value_1: ?description
+//          ?value_n: ?description_line1
+//                    ?description_line2
+// -----------------------------------------------------------------------------
+//
+/*
+?type ?function_name(
+    ?arg_type arg,  // ?description
+    ?arg_type arg)  // ?description
+    {
+
+    ?code  // ?comment
+
+    // ?comment
+    ?code
+    }
+*/
+void Cxmppsettings_api::ResetRepository()
+    {
+    CRepository* rep = CRepository::NewL( KXmppSettingsApiCenRep );
+    User::LeaveIfError( rep->Reset() );
+    delete rep;
+    }
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// Cxmppsettings_api::Delete
+// Delete here all resources allocated and opened from test methods. 
+// Called from destructor. 
+// -----------------------------------------------------------------------------
+//
+void Cxmppsettings_api::Delete() 
+    {
+
+    }
+
+// -----------------------------------------------------------------------------
+// Cxmppsettings_api::RunMethodL
+// Run specified method. Contains also table of test mothods and their names.
+// -----------------------------------------------------------------------------
+//
+TInt Cxmppsettings_api::RunMethodL( 
+    CStifItemParser& aItem ) 
+    {
+
+    static TStifFunctionInfo const KFunctions[] =
+        {  
+        // Copy this line for every implemented function.
+        // First string is the function name used in TestScripter script file.
+        // Second is the actual implementation member function. 
+        ENTRY( "Test_CreateSettingsRecordL", Cxmppsettings_api::Test_CreateSettingsRecordL ),
+        ENTRY( "Test_DefaultSettingsRecord", Cxmppsettings_api::Test_DefaultSettingsRecord ),
+        ENTRY( "Test_GetSettingsRecordIdArray", Cxmppsettings_api::Test_GetSettingsRecordIdArray ),
+        ENTRY( "Test_SetParamInt", Cxmppsettings_api::Test_SetParamInt ),
+        ENTRY( "Test_SetParamLDes", Cxmppsettings_api::Test_SetParamLDes ),
+        ENTRY( "Test_GetParamInt", Cxmppsettings_api::Test_GetParamInt ),
+        ENTRY( "Test_GetParamLDes", Cxmppsettings_api::Test_GetParamLDes ),
+        ENTRY( "Test_RemoveSettingsRecord", Cxmppsettings_api::Test_RemoveSettingsRecord ),
+        ENTRY( "Test_RemoveParam", Cxmppsettings_api::Test_RemoveParam ),
+        ENTRY( "Test_GetRepositoryKeyL", Cxmppsettings_api::Test_GetRepositoryKeyL ),
+
+        
+        //ADD NEW ENTRY HERE
+        // [test cases entries] - Do not remove
+
+        };
+
+    const TInt count = sizeof( KFunctions ) / 
+                        sizeof( TStifFunctionInfo );
+
+    return RunInternalL( KFunctions, count, aItem );
+
+    }
+
+// -----------------------------------------------------------------------------
+// Cxmppsettings_api::ExampleL
+// Example test method function.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt Cxmppsettings_api::Test_CreateSettingsRecordL( CStifItemParser& aItem )
+    {
+    
+    ResetRepository();
+     iApi->CreateSettingsRecordL( iSettingId );
+     if(0==iSettingId)
+         {
+         return KErrGeneral;
+         }
+    
+    RArray<TUint32> array;
+
+    iApi->GetSettingsRecordIdArrayL( array );
+    TInt arraycount = array.Count();
+    if(0==arraycount)
+        {
+        return KErrGeneral;
+        }
+    if(iSettingId!=array[0])
+        {
+        return KErrGeneral;
+        }
+    array.Reset();
+    array.Close();
+    ResetRepository();
+    TInt count = 5;
+    for (TInt i=0; i< count; i++ )
+        {
+        iApi->CreateSettingsRecordL( iSettingId ) ;
+        }
+    iApi->GetSettingsRecordIdArrayL( array );
+    arraycount = array.Count();
+    if(count!=arraycount)
+        {
+        return KErrGeneral;
+        }
+    array.Reset();
+    array.Close();
+    ResetRepository();
+    return KErrNone;
+        }
+
+TInt Cxmppsettings_api::Test_DefaultSettingsRecord( CStifItemParser& aItem )
+    {
+    ResetRepository();
+    iApi->CreateSettingsRecordL( iSettingId );
+    TUint32 settingId;
+    iApi->DefaultSettingsRecordL( settingId );
+    if(settingId!=iSettingId)
+        {
+        return KErrGeneral;
+        }
+    ResetRepository();
+    return KErrNone;
+    
+    }
+
+TInt Cxmppsettings_api::Test_GetSettingsRecordIdArray( CStifItemParser& aItem )
+    {
+    
+    ResetRepository();
+     iApi->CreateSettingsRecordL( iSettingId );
+     if(0==iSettingId)
+         {
+         return KErrGeneral;
+         }
+    
+    RArray<TUint32> array;
+
+    iApi->GetSettingsRecordIdArrayL( array );
+    TInt arraycount = array.Count();
+    if(0==arraycount)
+        {
+        return KErrGeneral;
+        }
+    if(iSettingId!=array[0])
+        {
+        return KErrGeneral;
+        }
+    array.Reset();
+    array.Close();
+    ResetRepository();
+    TInt count = 5;
+    for (TInt i=0; i< count; i++ )
+        {
+        iApi->CreateSettingsRecordL( iSettingId ) ;
+        }
+    iApi->GetSettingsRecordIdArrayL( array );
+    arraycount = array.Count();
+    if(count!=arraycount)
+        {
+        return KErrGeneral;
+        }
+    array.Reset();
+    array.Close();
+    ResetRepository();
+    return KErrNone;
+        }
+TInt Cxmppsettings_api::Test_SetParamInt( CStifItemParser& aItem )
+    {
+    ResetRepository();
+    iApi->CreateSettingsRecordL( iSettingId );
+
+    _LIT( KParamName, "XMPP-PARAM-NUMBER-0x%08d");
+
+    TInt count = 128; // 0xFF
+    TInt err;
+   for (TInt i=0; i < count; i++ )
+    {
+    HBufC* paramName = HBufC::NewL( KParamName().Length()+20 );
+    paramName->Des().AppendFormat( KParamName(), i );
+
+    TInt paramValue(i);
+
+    TRAP(err,iApi->SetParamL( iSettingId, *paramName, paramValue));
+    if(err!=KErrNone)
+        {
+        ResetRepository();
+        return KErrGeneral;
+        }
+
+    delete paramName;
+    }
+    ResetRepository();
+    return KErrNone;
+    }
+
+TInt Cxmppsettings_api::Test_SetParamLDes( CStifItemParser& aItem )
+    {
+    TInt err;
+    ResetRepository();
+    iApi->CreateSettingsRecordL( iSettingId );
+
+    TInt count = 128; // 0xFF
+
+    for (TInt i=0; i < count; i++ )
+        {
+        HBufC* paramName = HBufC::NewL( KParamName().Length()+20 );
+        paramName->Des().AppendFormat( KParamName(), i );
+
+        HBufC* paramValue = HBufC::NewL( KParamValue16().Length()+20 );
+        paramValue->Des().AppendFormat( KParamValue16(), i );
+
+        TRAP(err,iApi->SetParamL( iSettingId, *paramName, *paramValue));
+        if(err!=KErrNone)
+           {
+            ResetRepository();
+            delete paramName;
+            delete paramValue;
+            return KErrGeneral;
+                }
+
+        delete paramName;
+        delete paramValue;
+        }
+    ResetRepository();
+    return KErrNone;
+    
+    }
+
+TInt Cxmppsettings_api::Test_GetParamInt( CStifItemParser& aItem )
+    {
+    ResetRepository();
+    iApi->CreateSettingsRecordL( iSettingId );
+
+    _LIT( KParamName, "XMPP-PARAM-NUMBER-0x%08d");
+
+    TInt count = 128; // 0xFF
+    TInt err;
+   for (TInt i=0; i < count; i++ )
+    {
+    HBufC* paramName = HBufC::NewL( KParamName().Length()+20 );
+    paramName->Des().AppendFormat( KParamName(), i );
+
+    TInt paramValue(i);
+
+    TRAP(err,iApi->SetParamL( iSettingId, *paramName, paramValue));
+    if(err!=KErrNone)
+        {
+        ResetRepository();
+        return KErrGeneral;
+        }
+
+    delete paramName;
+    }
+   for ( TInt i=0; i < count; i++ )
+           {
+           HBufC* paramName = HBufC::NewL( KParamName().Length()+20 );
+           paramName->Des().AppendFormat( KParamName(), i );
+
+           TInt paramValue(0);
+
+           iApi->GetParamL( iSettingId,*paramName,paramValue);
+
+           if( i!= paramValue)
+               {
+               return KErrGeneral;
+               }
+
+           delete paramName;
+           }
+    ResetRepository();
+    return KErrNone;
+    }
+    
+TInt Cxmppsettings_api::Test_GetParamLDes( CStifItemParser& aItem )
+    {
+    ResetRepository();
+    iApi->CreateSettingsRecordL( iSettingId );
+
+    _LIT( KParamName, "XMPP-PARAM-NUMBER-0x%08d");
+
+    TInt count = 128; // 0xFF
+    TInt err;
+   for (TInt i=0; i < count; i++ )
+    {
+    HBufC* paramName = HBufC::NewL( KParamName().Length()+20 );
+    paramName->Des().AppendFormat( KParamName(), i );
+
+    HBufC* paramValue = HBufC::NewL( KParamValue16().Length()+20 );
+    paramValue->Des().AppendFormat( KParamValue16(), i );
+
+    TRAP(err,iApi->SetParamL( iSettingId, *paramName, *paramValue));
+    if(err!=KErrNone)
+       {
+        ResetRepository();
+        delete paramName;
+        delete paramValue;
+        return KErrGeneral;
+            }
+
+    delete paramName;
+    delete paramValue;
+    }
+   for ( TInt i=0; i < count; i++ )
+           {
+           HBufC* paramName = HBufC::NewL( KParamName().Length()+20 );
+           paramName->Des().AppendFormat( KParamName(), i );
+
+           HBufC* paramValue = HBufC::NewL( KParamValue16().Length()+20 );
+           paramValue->Des().AppendFormat( KParamValue16(), i );
+
+           RBuf buf;
+           buf.CreateL( 255 );
+
+           TRAP(err,iApi->GetParamL( iSettingId,*paramName, buf) );
+           
+           if(err!=KErrNone)
+               {
+               return KErrGeneral;
+               }
+           //*paramValue, buf, ;
+
+           delete paramName;
+           delete paramValue;
+
+           buf.Close();
+           }
+    ResetRepository();
+    return KErrNone;
+    }
+
+TInt Cxmppsettings_api::Test_RemoveSettingsRecord( CStifItemParser& aItem )
+    {
+    ResetRepository();
+    iApi->CreateSettingsRecordL( iSettingId );
+    iApi->RemoveSettingsRecordL( iSettingId );
+
+    RArray<TUint32> array;
+
+    iApi->GetSettingsRecordIdArrayL( array );
+    TInt arraycount = array.Count();
+    if(1==arraycount)
+        {
+        return KErrGeneral;
+        }
+
+    array.Reset();
+
+    iSettingId = 0;
+
+    ResetRepository();
+
+    TInt count = 128;
+
+    for (TInt i=1; i< count; i++ )
+        {
+        iApi->CreateSettingsRecordL( iSettingId);
+        }
+
+    // because cen rep is reseted after every test, indexes should start
+    // from zero and go up to count. So its safe to assume that these
+    // indexes exist :)
+
+    iApi->RemoveSettingsRecordL( 1 );
+    iApi->RemoveSettingsRecordL( 55 );
+    iApi->RemoveSettingsRecordL( 123 );
+    iApi->RemoveSettingsRecordL( 96 ) ;
+    iApi->RemoveSettingsRecordL( 2 );
+
+    iApi->GetSettingsRecordIdArrayL( array );
+    arraycount = array.Count();
+    if((count-6)!=arraycount)
+        {
+        return KErrGeneral;
+        }
+
+    for( TInt i=0; i < array.Count(); i++ )
+        {
+         iApi->RemoveSettingsRecordL( array[i] );
+        }
+
+    array.Reset();
+    iApi->GetSettingsRecordIdArrayL( array );
+    if( 0!=(array.Count()))
+        {
+        return KErrGeneral;
+        }
+    array.Reset();
+    array.Close();
+    ResetRepository();
+    return KErrNone;
+      
+    }
+TInt Cxmppsettings_api::Test_RemoveParam( CStifItemParser& aItem )
+    {
+
+
+    ResetRepository();
+    iApi->CreateSettingsRecordL( iSettingId );
+
+    _LIT( KParamName, "XMPP-PARAM-NUMBER-0x%08d");
+
+    TInt count = 128; // 0xFF
+    TInt err;
+   for (TInt i=0; i < count; i++ )
+    {
+    HBufC* paramName = HBufC::NewL( KParamName().Length()+20 );
+    paramName->Des().AppendFormat( KParamName(), i );
+
+    TInt paramValue(i);
+
+    TRAP(err,iApi->SetParamL( iSettingId, *paramName, paramValue));
+    if(err!=KErrNone)
+        {
+        ResetRepository();
+        return KErrGeneral;
+        }
+
+    delete paramName;
+    }
+   
+    count = 128; // 0xFF
+
+    TInt param = 56;
+
+        HBufC* paramName = HBufC::NewL( KParamName().Length()+20 );
+        paramName->Des().AppendFormat( KParamName(), param );
+
+        iApi->RemoveParamL( iSettingId,*paramName);
+        TInt paramvalue;
+        
+        TRAP(err,iApi->GetParamL( iSettingId,*paramName,paramvalue));
+        if(err!= -1)
+            {
+            return KErrGeneral;
+            }
+        iApi->SetParamL( iSettingId,*paramName,12345);
+        delete paramName;
+
+    for (TInt i=0; i < count; i++ )
+        {
+        HBufC* paramName = HBufC::NewL( KParamName().Length() + 20 );
+        paramName->Des().AppendFormat( KParamName(), i );
+
+        iApi->RemoveParamL( iSettingId,*paramName);
+
+        delete paramName;
+        }
+
+
+    ResetRepository();
+    return KErrNone;
+    
+    
+    }
+TInt Cxmppsettings_api::Test_GetRepositoryKeyL( CStifItemParser& aItem )
+    {
+    ResetRepository();
+    iApi->CreateSettingsRecordL( iSettingId );
+
+    _LIT( KParamName, "XMPP-PARAM-NUMBER-0x%08d");
+
+    TInt count = 128; // 0xFF
+    TInt err;
+   for (TInt i=0; i < count; i++ )
+    {
+    HBufC* paramName = HBufC::NewL( KParamName().Length()+20 );
+    paramName->Des().AppendFormat( KParamName(), i );
+
+    HBufC* paramValue = HBufC::NewL( KParamValue16().Length()+20 );
+    paramValue->Des().AppendFormat( KParamValue16(), i );
+
+    TRAP(err,iApi->SetParamL( iSettingId, *paramName, *paramValue));
+    if(err!=KErrNone)
+       {
+        ResetRepository();
+        delete paramName;
+        delete paramValue;
+        return KErrGeneral;
+            }
+    TBool CreateColumnIfNotExist = EFalse ;
+    TUint32 TheKey;
+    TRAP(err,iApi->GetRepositoryKeyL( iSettingId,
+                                   *paramName,
+                                   CreateColumnIfNotExist,
+                            TheKey ));
+    delete paramName;
+    delete paramValue;
+    }
+   for ( TInt i=0; i < count; i++ )
+           {
+           HBufC* paramName = HBufC::NewL( KParamName().Length()+20 );
+           paramName->Des().AppendFormat( KParamName(), i );
+
+           HBufC* paramValue = HBufC::NewL( KParamValue16().Length()+20 );
+           paramValue->Des().AppendFormat( KParamValue16(), i );
+
+           RBuf buf;
+           buf.CreateL( 255 );
+
+           TRAP(err,iApi->GetParamL( iSettingId,*paramName, buf) );
+           
+           if(err!=KErrNone)
+               {
+               return KErrGeneral;
+               }
+           //*paramValue, buf, ;
+
+           delete paramName;
+           delete paramValue;
+
+           buf.Close();
+           }
+    ResetRepository();
+    return KErrNone;
+    }
+// -----------------------------------------------------------------------------
+// Cxmppsettings_api::?member_function
+// ?implementation_description
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+/*
+TInt Cxmppsettings_api::?member_function(
+   CItemParser& aItem )
+   {
+
+   ?code
+
+   }
+*/
+
+// ========================== OTHER EXPORTED FUNCTIONS =========================
+// None
+
+//  [End of File] - Do not remove
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imsrv_plat/xmpp_settings_api/xmpp_settings_api.metaxml	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,14 @@
+<?xml version="1.0" ?>
+<api id="30a7ce3294a8454371ee730878f1d3b1" dataversion="1.0">
+<name>xmpp_settings_api</name>
+<description>This is a API that provides read and write facility for protocol specific settings.</description>
+<type>c++</type>
+<subsystem>xmppsettingsapi</subsystem>
+<libs><lib name="xmppsettingsapi.lib"/>
+</libs>
+<release category="domain" sinceversion=""/>
+<attributes>
+<htmldocprovided>yes</htmldocprovided>
+<adaptation>no</adaptation>
+</attributes>
+</api>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/layers.sysdef.xml	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,14 @@
+<?xml version="1.0"?>
+<!DOCTYPE SystemDefinition SYSTEM "sysdef_1_4_0.dtd" [
+  <!ENTITY layer_real_source_path "sf/mw/imsrv" >
+]>
+
+<SystemDefinition name="imsrv" schema="1.4.0">
+  <systemModel>
+    <layer name="mw_layer">
+      <module name="imsrv">
+        <unit unitID="MeCoDo.imsrv" mrp="" bldFile="&layer_real_source_path;/group" name="imsrv" />
+      </module>
+    </layer>
+  </systemModel>
+</SystemDefinition>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sysdef_1_4_0.dtd	Wed Nov 03 09:32:20 2010 +0530
@@ -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/ximpfw/core/bwins/ximpdatamodelu.def	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,116 @@
+EXPORTS
+	??0CXIMPApiDataObjBase@@QAE@XZ @ 1 NONAME ; CXIMPApiDataObjBase::CXIMPApiDataObjBase(void)
+	??0CXIMPApiEventBase@@QAE@XZ @ 2 NONAME ; CXIMPApiEventBase::CXIMPApiEventBase(void)
+	??0CXIMPApiObjBase@@IAE@XZ @ 3 NONAME ; CXIMPApiObjBase::CXIMPApiObjBase(void)
+	??0CXIMPConfigurationItemBase@@QAE@AAVMXIMPItemParentBase@@@Z @ 4 NONAME ; CXIMPConfigurationItemBase::CXIMPConfigurationItemBase(class MXIMPItemParentBase &)
+	??0CXIMPSubscriptionItemBase@@QAE@AAVMXIMPItemParentBase@@@Z @ 5 NONAME ; CXIMPSubscriptionItemBase::CXIMPSubscriptionItemBase(class MXIMPItemParentBase &)
+	??1CXIMPApiDataObjBase@@UAE@XZ @ 6 NONAME ; CXIMPApiDataObjBase::~CXIMPApiDataObjBase(void)
+	??1CXIMPApiEventBase@@UAE@XZ @ 7 NONAME ; CXIMPApiEventBase::~CXIMPApiEventBase(void)
+	??1CXIMPApiObjBase@@UAE@XZ @ 8 NONAME ; CXIMPApiObjBase::~CXIMPApiObjBase(void)
+	??1CXIMPConfigurationItemBase@@UAE@XZ @ 9 NONAME ; CXIMPConfigurationItemBase::~CXIMPConfigurationItemBase(void)
+	??1CXIMPSubscriptionItemBase@@MAE@XZ @ 10 NONAME ; CXIMPSubscriptionItemBase::~CXIMPSubscriptionItemBase(void)
+	??9CXIMPIdentityImp@@QBEHABV0@@Z @ 11 NONAME ; int CXIMPIdentityImp::operator!=(class CXIMPIdentityImp const &) const
+	?Accessor@FeaturePluginHolder@@SAPAVMApiDataObjFactoryAccessor@@H@Z @ 12 NONAME ; class MApiDataObjFactoryAccessor * FeaturePluginHolder::Accessor(int)
+	?AccessorCount@FeaturePluginHolder@@SAHXZ @ 13 NONAME ; int FeaturePluginHolder::AccessorCount(void)
+	?ActivateSubscriberL@CXIMPSubscriptionItemBase@@QAEXPAV1@@Z @ 14 NONAME ; void CXIMPSubscriptionItemBase::ActivateSubscriberL(class CXIMPSubscriptionItemBase *)
+	?ActivateSubscriberL@CXIMPSubscriptionItemBase@@UAEXPAVMXIMPPscContext@@@Z @ 15 NONAME ; void CXIMPSubscriptionItemBase::ActivateSubscriberL(class MXIMPPscContext *)
+	?AddConfiguratorL@CXIMPConfigurationItemBase@@QAEXPAV1@@Z @ 16 NONAME ; void CXIMPConfigurationItemBase::AddConfiguratorL(class CXIMPConfigurationItemBase *)
+	?AddConfiguratorL@CXIMPConfigurationItemBase@@QAEXPAVMXIMPPscContext@@@Z @ 17 NONAME ; void CXIMPConfigurationItemBase::AddConfiguratorL(class MXIMPPscContext *)
+	?AddFeatureL@CXIMPFeatureInfoImp@@QAEHABVTDesC8@@@Z @ 18 NONAME ; int CXIMPFeatureInfoImp::AddFeatureL(class TDesC8 const &)
+	?AddSubscriberL@CXIMPSubscriptionItemBase@@QAEXPAV1@@Z @ 19 NONAME ; void CXIMPSubscriptionItemBase::AddSubscriberL(class CXIMPSubscriptionItemBase *)
+	?AddSubscriberL@CXIMPSubscriptionItemBase@@QAEXPAVMXIMPPscContext@@@Z @ 20 NONAME ; void CXIMPSubscriptionItemBase::AddSubscriberL(class MXIMPPscContext *)
+	?AppendParamL@CXIMPRequestCompleteEventImp@@QAEXPAVCXIMPApiDataObjBase@@@Z @ 21 NONAME ; void CXIMPRequestCompleteEventImp::AppendParamL(class CXIMPApiDataObjBase *)
+	?BaseConstructL@CXIMPConfigurationItemBase@@QAEXXZ @ 22 NONAME ; void CXIMPConfigurationItemBase::BaseConstructL(void)
+	?BaseConstructL@CXIMPSubscriptionItemBase@@QAEXXZ @ 23 NONAME ; void CXIMPSubscriptionItemBase::BaseConstructL(void)
+	?ChangeStatusAfterAdd@CXIMPSubscriptionItemBase@@QAEXXZ @ 24 NONAME ; void CXIMPSubscriptionItemBase::ChangeStatusAfterAdd(void)
+	?ChangeStatusAfterRemove@CXIMPSubscriptionItemBase@@QAEXXZ @ 25 NONAME ; void CXIMPSubscriptionItemBase::ChangeStatusAfterRemove(void)
+	?CleanIfExpired@CXIMPSubscriptionItemBase@@QAEHXZ @ 26 NONAME ; int CXIMPSubscriptionItemBase::CleanIfExpired(void)
+	?Compare@CXIMPIdentityImp@@QBEHABV1@@Z @ 27 NONAME ; int CXIMPIdentityImp::Compare(class CXIMPIdentityImp const &) const
+	?CompletionResultImp@CXIMPRequestCompleteEventImp@@QAEAAVCXIMPStatusImp@@XZ @ 28 NONAME ; class CXIMPStatusImp & CXIMPRequestCompleteEventImp::CompletionResultImp(void)
+	?ConfigurationStatus@CXIMPConfigurationItemBase@@QAE?AW4TConfigurationStatus@1@PAVMXIMPPscContext@@@Z @ 29 NONAME ; enum CXIMPConfigurationItemBase::TConfigurationStatus CXIMPConfigurationItemBase::ConfigurationStatus(class MXIMPPscContext *)
+	?Context@CXIMPSubscriptionItemBase@@QAEAAVMXIMPPscContext@@H@Z @ 30 NONAME ; class MXIMPPscContext & CXIMPSubscriptionItemBase::Context(int)
+	?ContextCount@CXIMPSubscriptionItemBase@@QBEHXZ @ 31 NONAME ; int CXIMPSubscriptionItemBase::ContextCount(void) const
+	?ContextStateImp@CXIMPContextStateEventImp@@QAEAAVCXIMPContextStateImp@@XZ @ 32 NONAME ; class CXIMPContextStateImp & CXIMPContextStateEventImp::ContextStateImp(void)
+	?CountOfSubscribers@CXIMPSubscriptionItemBase@@QAEHXZ @ 33 NONAME ; int CXIMPSubscriptionItemBase::CountOfSubscribers(void)
+	?DataSubscriptionState@CXIMPSubscriptionItemBase@@QAEABVMXIMPDataSubscriptionState@@XZ @ 34 NONAME ; class MXIMPDataSubscriptionState const & CXIMPSubscriptionItemBase::DataSubscriptionState(void)
+	?ExternalizeL@CXIMPContextEventFilter@@QBEXAAVRWriteStream@@@Z @ 35 NONAME ; void CXIMPContextEventFilter::ExternalizeL(class RWriteStream &) const
+	?ExternalizeL@XIMPApiDataObjFactory@@SAXAAVRWriteStream@@ABV?$RArray@USXIMPReqParam@@@@@Z @ 36 NONAME ; void XIMPApiDataObjFactory::ExternalizeL(class RWriteStream &, class RArray<struct SXIMPReqParam> const &)
+	?ExternalizeL@XIMPApiDataObjFactory@@SAXAAVRWriteStream@@ABVCXIMPApiDataObjBase@@@Z @ 37 NONAME ; void XIMPApiDataObjFactory::ExternalizeL(class RWriteStream &, class CXIMPApiDataObjBase const &)
+	?ForceClose@CXIMPConfigurationItemBase@@QAEXXZ @ 38 NONAME ; void CXIMPConfigurationItemBase::ForceClose(void)
+	?ForceClose@CXIMPSubscriptionItemBase@@QAEXXZ @ 39 NONAME ; void CXIMPSubscriptionItemBase::ForceClose(void)
+	?HandleUnknownGetInterface@CXIMPApiObjBase@@IBEPAXJW4TIfGetOps@MXIMPBase@@@Z @ 40 NONAME ; void * CXIMPApiObjBase::HandleUnknownGetInterface(long, enum MXIMPBase::TIfGetOps) const
+	?InitializeL@FeaturePluginHolder@@SAXXZ @ 41 NONAME ; void FeaturePluginHolder::InitializeL(void)
+	?InternalizeL@CXIMPContextClientInfoImp@@QAEXAAVRReadStream@@@Z @ 42 NONAME ; void CXIMPContextClientInfoImp::InternalizeL(class RReadStream &)
+	?InternalizeL@CXIMPContextEventFilter@@QAEXAAVRReadStream@@@Z @ 43 NONAME ; void CXIMPContextEventFilter::InternalizeL(class RReadStream &)
+	?InternalizeL@CXIMPContextStateImp@@QAEXAAVRReadStream@@@Z @ 44 NONAME ; void CXIMPContextStateImp::InternalizeL(class RReadStream &)
+	?InternalizeL@CXIMPDataSubscriptionStateImp@@QAEXAAVRReadStream@@@Z @ 45 NONAME ; void CXIMPDataSubscriptionStateImp::InternalizeL(class RReadStream &)
+	?InternalizeL@CXIMPFeatureInfoImp@@QAEXAAVRReadStream@@@Z @ 46 NONAME ; void CXIMPFeatureInfoImp::InternalizeL(class RReadStream &)
+	?InternalizeL@CXIMPIdentityImp@@QAEXAAVRReadStream@@@Z @ 47 NONAME ; void CXIMPIdentityImp::InternalizeL(class RReadStream &)
+	?InternalizeL@CXIMPProtocolInfoImp@@QAEXAAVRReadStream@@@Z @ 48 NONAME ; void CXIMPProtocolInfoImp::InternalizeL(class RReadStream &)
+	?InternalizeL@CXIMPServiceInfoImp@@QAEXAAVRReadStream@@@Z @ 49 NONAME ; void CXIMPServiceInfoImp::InternalizeL(class RReadStream &)
+	?InternalizeL@CXIMPStatusImp@@QAEXAAVRReadStream@@@Z @ 50 NONAME ; void CXIMPStatusImp::InternalizeL(class RReadStream &)
+	?InternalizeL@XIMPApiDataObjFactory@@SAXAAVRReadStream@@AAV?$RArray@USXIMPReqParam@@@@@Z @ 51 NONAME ; void XIMPApiDataObjFactory::InternalizeL(class RReadStream &, class RArray<struct SXIMPReqParam> &)
+	?InternalizeLC@XIMPApiDataObjFactory@@SAPAVCXIMPApiDataObjBase@@AAVRReadStream@@@Z @ 52 NONAME ; class CXIMPApiDataObjBase * XIMPApiDataObjFactory::InternalizeLC(class RReadStream &)
+	?IsContext@CXIMPConfigurationItemBase@@QBEHPAVMXIMPPscContext@@@Z @ 53 NONAME ; int CXIMPConfigurationItemBase::IsContext(class MXIMPPscContext *) const
+	?IsContext@CXIMPSubscriptionItemBase@@QBEHPAVMXIMPPscContext@@@Z @ 54 NONAME ; int CXIMPSubscriptionItemBase::IsContext(class MXIMPPscContext *) const
+	?IsEventAccepted@CXIMPContextEventFilter@@QBEHJ@Z @ 55 NONAME ; int CXIMPContextEventFilter::IsEventAccepted(long) const
+	?Match@CXIMPContextClientInfoImp@@QBEHPBV1@@Z @ 56 NONAME ; int CXIMPContextClientInfoImp::Match(class CXIMPContextClientInfoImp const *) const
+	?NewCombinedLC@CXIMPContextEventFilter@@SAPAV1@ABV?$TArray@PAVCXIMPContextEventFilter@@@@@Z @ 57 NONAME ; class CXIMPContextEventFilter * CXIMPContextEventFilter::NewCombinedLC(class TArray<class CXIMPContextEventFilter *> const &)
+	?NewFromStreamLC@CXIMPContextClientInfoImp@@SAPAVCXIMPApiDataObjBase@@AAVRReadStream@@@Z @ 58 NONAME ; class CXIMPApiDataObjBase * CXIMPContextClientInfoImp::NewFromStreamLC(class RReadStream &)
+	?NewFromStreamLC@CXIMPContextStateImp@@SAPAVCXIMPApiDataObjBase@@AAVRReadStream@@@Z @ 59 NONAME ; class CXIMPApiDataObjBase * CXIMPContextStateImp::NewFromStreamLC(class RReadStream &)
+	?NewFromStreamLC@CXIMPDataSubscriptionStateImp@@SAPAVCXIMPApiDataObjBase@@AAVRReadStream@@@Z @ 60 NONAME ; class CXIMPApiDataObjBase * CXIMPDataSubscriptionStateImp::NewFromStreamLC(class RReadStream &)
+	?NewFromStreamLC@CXIMPFeatureInfoImp@@SAPAVCXIMPApiDataObjBase@@AAVRReadStream@@@Z @ 61 NONAME ; class CXIMPApiDataObjBase * CXIMPFeatureInfoImp::NewFromStreamLC(class RReadStream &)
+	?NewFromStreamLC@CXIMPIdentityImp@@SAPAVCXIMPApiDataObjBase@@AAVRReadStream@@@Z @ 62 NONAME ; class CXIMPApiDataObjBase * CXIMPIdentityImp::NewFromStreamLC(class RReadStream &)
+	?NewFromStreamLC@CXIMPProtocolInfoImp@@SAPAVCXIMPApiDataObjBase@@AAVRReadStream@@@Z @ 63 NONAME ; class CXIMPApiDataObjBase * CXIMPProtocolInfoImp::NewFromStreamLC(class RReadStream &)
+	?NewFromStreamLC@CXIMPServiceInfoImp@@SAPAVCXIMPApiDataObjBase@@AAVRReadStream@@@Z @ 64 NONAME ; class CXIMPApiDataObjBase * CXIMPServiceInfoImp::NewFromStreamLC(class RReadStream &)
+	?NewFromStreamLC@CXIMPStatusImp@@SAPAVCXIMPApiDataObjBase@@AAVRReadStream@@@Z @ 65 NONAME ; class CXIMPApiDataObjBase * CXIMPStatusImp::NewFromStreamLC(class RReadStream &)
+	?NewL@CXIMPContextClientInfoImp@@SAPAV1@XZ @ 66 NONAME ; class CXIMPContextClientInfoImp * CXIMPContextClientInfoImp::NewL(void)
+	?NewL@CXIMPContextEventFilter@@SAPAV1@PBV?$TArray@J@@@Z @ 67 NONAME ; class CXIMPContextEventFilter * CXIMPContextEventFilter::NewL(class TArray<long> const *)
+	?NewL@CXIMPContextStateEventImp@@SAPAV1@XZ @ 68 NONAME ; class CXIMPContextStateEventImp * CXIMPContextStateEventImp::NewL(void)
+	?NewL@CXIMPContextStateImp@@SAPAV1@XZ @ 69 NONAME ; class CXIMPContextStateImp * CXIMPContextStateImp::NewL(void)
+	?NewL@CXIMPDataSubscriptionStateImp@@SAPAV1@XZ @ 70 NONAME ; class CXIMPDataSubscriptionStateImp * CXIMPDataSubscriptionStateImp::NewL(void)
+	?NewL@CXIMPFeatureInfoImp@@SAPAV1@XZ @ 71 NONAME ; class CXIMPFeatureInfoImp * CXIMPFeatureInfoImp::NewL(void)
+	?NewL@CXIMPIdentityImp@@SAPAV1@XZ @ 72 NONAME ; class CXIMPIdentityImp * CXIMPIdentityImp::NewL(void)
+	?NewL@CXIMPObjectCollectionImp@@SAPAV1@XZ @ 73 NONAME ; class CXIMPObjectCollectionImp * CXIMPObjectCollectionImp::NewL(void)
+	?NewL@CXIMPObjectFactoryImp@@SAPAV1@XZ @ 74 NONAME ; class CXIMPObjectFactoryImp * CXIMPObjectFactoryImp::NewL(void)
+	?NewL@CXIMPRequestCompleteEventImp@@SAPAV1@XZ @ 75 NONAME ; class CXIMPRequestCompleteEventImp * CXIMPRequestCompleteEventImp::NewL(void)
+	?NewL@CXIMPRestrictedObjectCollectionImp@@SAPAV1@H@Z @ 76 NONAME ; class CXIMPRestrictedObjectCollectionImp * CXIMPRestrictedObjectCollectionImp::NewL(int)
+	?NewL@CXIMPServiceInfoImp@@SAPAV1@XZ @ 77 NONAME ; class CXIMPServiceInfoImp * CXIMPServiceInfoImp::NewL(void)
+	?NewL@CXIMPStatusImp@@SAPAV1@XZ @ 78 NONAME ; class CXIMPStatusImp * CXIMPStatusImp::NewL(void)
+	?NewLC@CXIMPContextClientInfoImp@@SAPAV1@XZ @ 79 NONAME ; class CXIMPContextClientInfoImp * CXIMPContextClientInfoImp::NewLC(void)
+	?NewLC@CXIMPContextEventFilter@@SAPAV1@PBV?$TArray@J@@@Z @ 80 NONAME ; class CXIMPContextEventFilter * CXIMPContextEventFilter::NewLC(class TArray<long> const *)
+	?NewLC@CXIMPContextStateEventImp@@SAPAV1@XZ @ 81 NONAME ; class CXIMPContextStateEventImp * CXIMPContextStateEventImp::NewLC(void)
+	?NewLC@CXIMPContextStateImp@@SAPAV1@XZ @ 82 NONAME ; class CXIMPContextStateImp * CXIMPContextStateImp::NewLC(void)
+	?NewLC@CXIMPDataSubscriptionStateImp@@SAPAV1@XZ @ 83 NONAME ; class CXIMPDataSubscriptionStateImp * CXIMPDataSubscriptionStateImp::NewLC(void)
+	?NewLC@CXIMPFeatureInfoImp@@SAPAV1@XZ @ 84 NONAME ; class CXIMPFeatureInfoImp * CXIMPFeatureInfoImp::NewLC(void)
+	?NewLC@CXIMPIdentityImp@@SAPAV1@ABVTDesC16@@@Z @ 85 NONAME ; class CXIMPIdentityImp * CXIMPIdentityImp::NewLC(class TDesC16 const &)
+	?NewLC@CXIMPIdentityImp@@SAPAV1@XZ @ 86 NONAME ; class CXIMPIdentityImp * CXIMPIdentityImp::NewLC(void)
+	?NewLC@CXIMPObjectCollectionImp@@SAPAV1@XZ @ 87 NONAME ; class CXIMPObjectCollectionImp * CXIMPObjectCollectionImp::NewLC(void)
+	?NewLC@CXIMPProtocolInfoImp@@SAPAV1@ABVTDesC16@@VTUid@@ABVCXIMPFeatureInfoImp@@@Z @ 88 NONAME ; class CXIMPProtocolInfoImp * CXIMPProtocolInfoImp::NewLC(class TDesC16 const &, class TUid, class CXIMPFeatureInfoImp const &)
+	?NewLC@CXIMPProtocolInfoImp@@SAPAV1@XZ @ 89 NONAME ; class CXIMPProtocolInfoImp * CXIMPProtocolInfoImp::NewLC(void)
+	?NewLC@CXIMPRequestCompleteEventImp@@SAPAV1@AAVTXIMPRequestId@@H@Z @ 90 NONAME ; class CXIMPRequestCompleteEventImp * CXIMPRequestCompleteEventImp::NewLC(class TXIMPRequestId &, int)
+	?NewLC@CXIMPRestrictedObjectCollectionImp@@SAPAV1@H@Z @ 91 NONAME ; class CXIMPRestrictedObjectCollectionImp * CXIMPRestrictedObjectCollectionImp::NewLC(int)
+	?NewLC@CXIMPServiceInfoImp@@SAPAV1@VTUid@@ABVTDesC16@@11J@Z @ 92 NONAME ; class CXIMPServiceInfoImp * CXIMPServiceInfoImp::NewLC(class TUid, class TDesC16 const &, class TDesC16 const &, class TDesC16 const &, long)
+	?NewLC@CXIMPServiceInfoImp@@SAPAV1@XZ @ 93 NONAME ; class CXIMPServiceInfoImp * CXIMPServiceInfoImp::NewLC(void)
+	?NewLC@CXIMPStatusImp@@SAPAV1@XZ @ 94 NONAME ; class CXIMPStatusImp * CXIMPStatusImp::NewLC(void)
+	?PackL@XIMPEventCodec@@SAPAVHBufC8@@AAVCXIMPApiEventBase@@AAJ@Z @ 95 NONAME ; class HBufC8 * XIMPEventCodec::PackL(class CXIMPApiEventBase &, long &)
+	?PackL@XIMPEventCodec@@SAXAAVCXIMPApiEventBase@@AAJPAVCBufFlat@@@Z @ 96 NONAME ; void XIMPEventCodec::PackL(class CXIMPApiEventBase &, long &, class CBufFlat *)
+	?PresenceObjFactoryAccessor@FeaturePluginHolder@@SAPAVMApiDataObjFactoryAccessor@@XZ @ 97 NONAME ; class MApiDataObjFactoryAccessor * FeaturePluginHolder::PresenceObjFactoryAccessor(void)
+	?Release@FeaturePluginHolder@@SAXXZ @ 98 NONAME ; void FeaturePluginHolder::Release(void)
+	?RemoveConfigurator@CXIMPConfigurationItemBase@@QAEXPAV1@@Z @ 99 NONAME ; void CXIMPConfigurationItemBase::RemoveConfigurator(class CXIMPConfigurationItemBase *)
+	?RemoveConfigurator@CXIMPConfigurationItemBase@@QAEXPAVMXIMPPscContext@@@Z @ 100 NONAME ; void CXIMPConfigurationItemBase::RemoveConfigurator(class MXIMPPscContext *)
+	?RemoveSubscriber@CXIMPSubscriptionItemBase@@QAEXPAV1@@Z @ 101 NONAME ; void CXIMPSubscriptionItemBase::RemoveSubscriber(class CXIMPSubscriptionItemBase *)
+	?RemoveSubscriber@CXIMPSubscriptionItemBase@@QAEXPAVMXIMPPscContext@@@Z @ 102 NONAME ; void CXIMPSubscriptionItemBase::RemoveSubscriber(class MXIMPPscContext *)
+	?SetDataSubscriptionStateL@CXIMPSubscriptionItemBase@@UAEXAAVCXIMPDataSubscriptionStateImp@@@Z @ 103 NONAME ; void CXIMPSubscriptionItemBase::SetDataSubscriptionStateL(class CXIMPDataSubscriptionStateImp &)
+	?SetObjectOwnership@CXIMPRestrictedObjectCollectionImp@@QAEXH@Z @ 104 NONAME ; void CXIMPRestrictedObjectCollectionImp::SetObjectOwnership(int)
+	?SetRequestId@CXIMPRequestCompleteEventImp@@QAEXABVTXIMPRequestId@@@Z @ 105 NONAME ; void CXIMPRequestCompleteEventImp::SetRequestId(class TXIMPRequestId const &)
+	?SetStateChangeReasonImp@CXIMPContextStateEventImp@@QAEXPAVCXIMPStatusImp@@@Z @ 106 NONAME ; void CXIMPContextStateEventImp::SetStateChangeReasonImp(class CXIMPStatusImp *)
+	?SetStateValue@CXIMPContextStateImp@@QAEXW4TState@MXIMPContextState@@@Z @ 107 NONAME ; void CXIMPContextStateImp::SetStateValue(enum MXIMPContextState::TState)
+	?StateChangeReasonImp@CXIMPContextStateEventImp@@QAEPAVCXIMPStatusImp@@XZ @ 108 NONAME ; class CXIMPStatusImp * CXIMPContextStateEventImp::StateChangeReasonImp(void)
+	?StatusLC@CXIMPSubscriptionItemBase@@QBEPAVCXIMPDataSubscriptionStateImp@@PAVMXIMPPscContext@@@Z @ 109 NONAME ; class CXIMPDataSubscriptionStateImp * CXIMPSubscriptionItemBase::StatusLC(class MXIMPPscContext *) const
+	?SubscriptionStatus@CXIMPSubscriptionItemBase@@QAE?AW4TSubscriptionStatus@1@PAVMXIMPPscContext@@@Z @ 110 NONAME ; enum CXIMPSubscriptionItemBase::TSubscriptionStatus CXIMPSubscriptionItemBase::SubscriptionStatus(class MXIMPPscContext *)
+	?SynthesiseSubscriptionEventToAllCtxsL@CXIMPSubscriptionItemBase@@UAEXXZ @ 111 NONAME ; void CXIMPSubscriptionItemBase::SynthesiseSubscriptionEventToAllCtxsL(void)
+	?UnPackL@XIMPEventCodec@@SAPAVCXIMPApiEventBase@@ABVTDesC8@@AAJ@Z @ 112 NONAME ; class CXIMPApiEventBase * XIMPEventCodec::UnPackL(class TDesC8 const &, long &)
+	?UpdateExpirationL@CXIMPSubscriptionItemBase@@QAEXXZ @ 113 NONAME ; void CXIMPSubscriptionItemBase::UpdateExpirationL(void)
+	?UpdateSubscriptionStateL@CXIMPSubscriptionItemBase@@QAEXW4TSubscriptionEvent@1@@Z @ 114 NONAME ; void CXIMPSubscriptionItemBase::UpdateSubscriptionStateL(enum CXIMPSubscriptionItemBase::TSubscriptionEvent)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/core/bwins/ximpmanageru.def	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,3 @@
+EXPORTS
+	?NewMXIMPClientL@CXIMPClientImp@@SAPAVMXIMPClient@@XZ @ 1 NONAME ; class MXIMPClient * CXIMPClientImp::NewMXIMPClientL(void)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/core/bwins/ximpoperationsu.def	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,7 @@
+EXPORTS
+	??0CXIMPOperationBind2@@QAE@XZ @ 1 NONAME ; CXIMPOperationBind2::CXIMPOperationBind2(void)
+	??0CXIMPOperationBind@@QAE@XZ @ 2 NONAME ; CXIMPOperationBind::CXIMPOperationBind(void)
+	??0CXIMPOperationForcedTeardown@@QAE@XZ @ 3 NONAME ; CXIMPOperationForcedTeardown::CXIMPOperationForcedTeardown(void)
+	??0CXIMPOperationUnbind@@QAE@XZ @ 4 NONAME ; CXIMPOperationUnbind::CXIMPOperationUnbind(void)
+	?NewL@CXIMPOperationFactory@@SAPAV1@XZ @ 5 NONAME ; class CXIMPOperationFactory * CXIMPOperationFactory::NewL(void)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/core/bwins/ximpprocessoru.def	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,97 @@
+EXPORTS
+	??0CXIMPOperationBase@@QAE@XZ @ 1 NONAME ; CXIMPOperationBase::CXIMPOperationBase(void)
+	??1CXIMPOperationBase@@UAE@XZ @ 2 NONAME ; CXIMPOperationBase::~CXIMPOperationBase(void)
+	?ActivateEventL@CXIMPEventManager@@QAEXAAVCXIMPApiEventBase@@PAVCXIMPPscContext@@@Z @ 3 NONAME ; void CXIMPEventManager::ActivateEventL(class CXIMPApiEventBase &, class CXIMPPscContext *)
+	?ActivateRequestCompleteEvent@CXIMPEventManager@@QAEXAAVCXIMPRequestCompleteEventImp@@PAVCXIMPPscContext@@@Z @ 4 NONAME ; void CXIMPEventManager::ActivateRequestCompleteEvent(class CXIMPRequestCompleteEventImp &, class CXIMPPscContext *)
+	?AddEventL@CXIMPEventManager@@QAEXAAVCXIMPApiEventBase@@AAV?$RPointerArray@VCXIMPPscContext@@@@@Z @ 5 NONAME ; void CXIMPEventManager::AddEventL(class CXIMPApiEventBase &, class RPointerArray<class CXIMPPscContext> &)
+	?AddEventL@CXIMPEventManager@@QAEXAAVCXIMPApiEventBase@@PAVCXIMPPscContext@@@Z @ 6 NONAME ; void CXIMPEventManager::AddEventL(class CXIMPApiEventBase &, class CXIMPPscContext *)
+	?AddNewOperationL@CXIMPPscContext@@QAE?AVTXIMPRequestId@@HABVTDesC8@@@Z @ 7 NONAME ; class TXIMPRequestId CXIMPPscContext::AddNewOperationL(int, class TDesC8 const &)
+	?AppendToOpQueueL@CXIMPPscContext@@QAEXPAVCXIMPOperationBase@@@Z @ 8 NONAME ; void CXIMPPscContext::AppendToOpQueueL(class CXIMPOperationBase *)
+	?AppendToOpQueueUpdateReqIdL@CXIMPPscContext@@QAE?AVTXIMPRequestId@@PAVCXIMPOperationBase@@@Z @ 9 NONAME ; class TXIMPRequestId CXIMPPscContext::AppendToOpQueueUpdateReqIdL(class CXIMPOperationBase *)
+	?AuthorizationDataAccess@CProtocolPresenceDataHostImp@@QAEAAVCProtocolPresenceAuthorizationDataHostImp@@XZ @ 10 NONAME ; class CProtocolPresenceAuthorizationDataHostImp & CProtocolPresenceDataHostImp::AuthorizationDataAccess(void)
+	?BaseConstructL@CXIMPOperationBase@@QAEXVTXIMPRequestId@@PAVCXIMPPscContext@@@Z @ 11 NONAME ; void CXIMPOperationBase::BaseConstructL(class TXIMPRequestId, class CXIMPPscContext *)
+	?BeginOperation@CXIMPOperationBase@@UAEXXZ @ 12 NONAME ; void CXIMPOperationBase::BeginOperation(void)
+	?ClientInfo@CXIMPPscContext@@QBEPAVCXIMPContextClientInfoImp@@XZ @ 13 NONAME ; class CXIMPContextClientInfoImp * CXIMPPscContext::ClientInfo(void) const
+	?Context@CXIMPOperationBase@@UAEPAVCXIMPPscContext@@XZ @ 14 NONAME ; class CXIMPPscContext * CXIMPOperationBase::Context(void)
+	?CreateRequestCompleteEventL@CXIMPOperationBase@@MAEXXZ @ 15 NONAME ; void CXIMPOperationBase::CreateRequestCompleteEventL(void)
+	?DestroyCachedUnbind@CXIMPPscContext@@QAEXXZ @ 16 NONAME ; void CXIMPPscContext::DestroyCachedUnbind(void)
+	?DisassociateHost@CXIMPHostManager@@QAEXPAVCXIMPHost@@@Z @ 17 NONAME ; void CXIMPHostManager::DisassociateHost(class CXIMPHost *)
+	?DropTopEvent@CXIMPContextEventQueue@@QAEXXZ @ 18 NONAME ; void CXIMPContextEventQueue::DropTopEvent(void)
+	?EndOperation@CXIMPOperationBase@@UAEXXZ @ 19 NONAME ; void CXIMPOperationBase::EndOperation(void)
+	?EventData@CXIMPEventCapsule@@QBEABVTDesC8@@XZ @ 20 NONAME ; class TDesC8 const & CXIMPEventCapsule::EventData(void) const
+	?EventQueue@CXIMPPscContext@@QBEAAVCXIMPContextEventQueue@@XZ @ 21 NONAME ; class CXIMPContextEventQueue & CXIMPPscContext::EventQueue(void) const
+	?EventReqId@CXIMPEventCapsule@@QBE?AVTXIMPRequestId@@XZ @ 22 NONAME ; class TXIMPRequestId CXIMPEventCapsule::EventReqId(void) const
+	?EventType@CXIMPEventCapsule@@QBEJXZ @ 23 NONAME ; long CXIMPEventCapsule::EventType(void) const
+	?ExternalizeL@CXIMPProtocolRequestCompleteEventImp@@QBEXAAVRWriteStream@@@Z @ 24 NONAME ; void CXIMPProtocolRequestCompleteEventImp::ExternalizeL(class RWriteStream &) const
+	?FeatureManager@CXIMPGlobals@@QAEPAVCXIMPFeatureManager@@XZ @ 25 NONAME ; class CXIMPFeatureManager * CXIMPGlobals::FeatureManager(void)
+	?FeaturesForSessionLC@CXIMPPscContext@@QAEPAVCXIMPFeatureInfoImp@@XZ @ 26 NONAME ; class CXIMPFeatureInfoImp * CXIMPPscContext::FeaturesForSessionLC(void)
+	?GetCachedUnbind@CXIMPPscContext@@QAEPAVCXIMPOperationBase@@XZ @ 27 NONAME ; class CXIMPOperationBase * CXIMPPscContext::GetCachedUnbind(void)
+	?GetFrameworkFeaturesL@CXIMPFeatureManager@@QAEPAVHBufC8@@XZ @ 28 NONAME ; class HBufC8 * CXIMPFeatureManager::GetFrameworkFeaturesL(void)
+	?GetProtocolL@CXIMPPluginFactory@@QAEPAVCXIMPProtocolPluginBase@@VTUid@@@Z @ 29 NONAME ; class CXIMPProtocolPluginBase * CXIMPPluginFactory::GetProtocolL(class TUid)
+	?GetProtocolsL@CXIMPPluginFactory@@QAEPAVHBufC8@@XZ @ 30 NONAME ; class HBufC8 * CXIMPPluginFactory::GetProtocolsL(void)
+	?GetReqCompleteEvent@CXIMPOperationBase@@UAEPAVCXIMPRequestCompleteEventImp@@XZ @ 31 NONAME ; class CXIMPRequestCompleteEventImp * CXIMPOperationBase::GetReqCompleteEvent(void)
+	?GroupsDataAccess@CProtocolPresenceDataHostImp@@QAEAAVCProtocolPresentityGroupsDataHostImp@@XZ @ 32 NONAME ; class CProtocolPresentityGroupsDataHostImp & CProtocolPresenceDataHostImp::GroupsDataAccess(void)
+	?HasElements@CXIMPContextEventQueue@@QBEHXZ @ 33 NONAME ; int CXIMPContextEventQueue::HasElements(void) const
+	?HostManager@CXIMPGlobals@@QAEPAVCXIMPHostManager@@XZ @ 34 NONAME ; class CXIMPHostManager * CXIMPGlobals::HostManager(void)
+	?InstallL@CXIMPGlobals@@SAXPAVMXIMPOperationFactory@@PAVMXIMPGlobalsObserver@@@Z @ 35 NONAME ; void CXIMPGlobals::InstallL(class MXIMPOperationFactory *, class MXIMPGlobalsObserver *)
+	?Instance@CXIMPGlobals@@SAPAV1@XZ @ 36 NONAME ; class CXIMPGlobals * CXIMPGlobals::Instance(void)
+	?InternalizeL@CXIMPProtocolRequestCompleteEventImp@@QAEXAAVRReadStream@@@Z @ 37 NONAME ; void CXIMPProtocolRequestCompleteEventImp::InternalizeL(class RReadStream &)
+	?IsHostAssigned@CXIMPPscContext@@QBEHXZ @ 38 NONAME ; int CXIMPPscContext::IsHostAssigned(void) const
+	?IsServerOperation@CXIMPOperationBase@@QBEHXZ @ 39 NONAME ; int CXIMPOperationBase::IsServerOperation(void) const
+	?NewFromStreamLC@CXIMPProtocolRequestCompleteEventImp@@SAPAV1@AAVRReadStream@@@Z @ 40 NONAME ; class CXIMPProtocolRequestCompleteEventImp * CXIMPProtocolRequestCompleteEventImp::NewFromStreamLC(class RReadStream &)
+	?NewL@CProtocolPresenceAuthorizationDataHostImp@@SAPAV1@AAVMXIMPHost@@@Z @ 41 NONAME ; class CProtocolPresenceAuthorizationDataHostImp * CProtocolPresenceAuthorizationDataHostImp::NewL(class MXIMPHost &)
+	?NewL@CProtocolPresenceDataHostImp@@SAPAV1@AAVMXIMPHost@@@Z @ 42 NONAME ; class CProtocolPresenceDataHostImp * CProtocolPresenceDataHostImp::NewL(class MXIMPHost &)
+	?NewL@CProtocolPresencePublishingDataHostImp@@SAPAV1@AAVMXIMPHost@@@Z @ 43 NONAME ; class CProtocolPresencePublishingDataHostImp * CProtocolPresencePublishingDataHostImp::NewL(class MXIMPHost &)
+	?NewL@CProtocolPresenceWatchingDataHostImp@@SAPAV1@AAVMXIMPHost@@@Z @ 44 NONAME ; class CProtocolPresenceWatchingDataHostImp * CProtocolPresenceWatchingDataHostImp::NewL(class MXIMPHost &)
+	?NewL@CProtocolPresentityGroupsDataHostImp@@SAPAV1@AAVMXIMPHost@@@Z @ 45 NONAME ; class CProtocolPresentityGroupsDataHostImp * CProtocolPresentityGroupsDataHostImp::NewL(class MXIMPHost &)
+	?NewL@CXIMPContextEventQueue@@SAPAV1@XZ @ 46 NONAME ; class CXIMPContextEventQueue * CXIMPContextEventQueue::NewL(void)
+	?NewL@CXIMPEventCapsule@@SAPAV1@AAVCXIMPApiEventBase@@H@Z @ 47 NONAME ; class CXIMPEventCapsule * CXIMPEventCapsule::NewL(class CXIMPApiEventBase &, int)
+	?NewL@CXIMPEventManager@@SAPAV1@XZ @ 48 NONAME ; class CXIMPEventManager * CXIMPEventManager::NewL(void)
+	?NewL@CXIMPHostManager@@SAPAV1@XZ @ 49 NONAME ; class CXIMPHostManager * CXIMPHostManager::NewL(void)
+	?NewL@CXIMPProtocolRequestCompleteEventImp@@SAPAV1@XZ @ 50 NONAME ; class CXIMPProtocolRequestCompleteEventImp * CXIMPProtocolRequestCompleteEventImp::NewL(void)
+	?NewL@CXIMPPscContext@@SAPAV1@K@Z @ 51 NONAME ; class CXIMPPscContext * CXIMPPscContext::NewL(unsigned long)
+	?NewLC@CProtocolPresenceDataHostImp@@SAPAV1@AAVMXIMPHost@@@Z @ 52 NONAME ; class CProtocolPresenceDataHostImp * CProtocolPresenceDataHostImp::NewLC(class MXIMPHost &)
+	?NewLC@CXIMPHost@@SAPAV1@AAVMXIMPProtocolConnection@@J@Z @ 53 NONAME ; class CXIMPHost * CXIMPHost::NewLC(class MXIMPProtocolConnection &, long)
+	?NoMoreHosts@CXIMPGlobals@@QAEXXZ @ 54 NONAME ; void CXIMPGlobals::NoMoreHosts(void)
+	?OperationFactory@CXIMPGlobals@@QAEPAVMXIMPOperationFactory@@XZ @ 55 NONAME ; class MXIMPOperationFactory * CXIMPGlobals::OperationFactory(void)
+	?OrderOfContexts@CXIMPPscContext@@SAHABV1@0@Z @ 56 NONAME ; int CXIMPPscContext::OrderOfContexts(class CXIMPPscContext const &, class CXIMPPscContext const &)
+	?PluginFactory@CXIMPGlobals@@QAEPAVCXIMPPluginFactory@@XZ @ 57 NONAME ; class CXIMPPluginFactory * CXIMPGlobals::PluginFactory(void)
+	?PresenceDataCache@CProtocolPresenceDataHostImp@@QAEAAVCPresenceDataCache@@XZ @ 58 NONAME ; class CPresenceDataCache & CProtocolPresenceDataHostImp::PresenceDataCache(void)
+	?PresenceInfoFilter@CXIMPPscContext@@UBEPAVCPresenceInfoFilterImp@@W4TFilterStoreType@MXIMPPscContext@@PBVCXIMPIdentityImp@@@Z @ 59 NONAME ; class CPresenceInfoFilterImp * CXIMPPscContext::PresenceInfoFilter(enum MXIMPPscContext::TFilterStoreType, class CXIMPIdentityImp const *) const
+	?ProcessL@CXIMPOperationBase@@UAEXXZ @ 60 NONAME ; void CXIMPOperationBase::ProcessL(void)
+	?PublishingDataAccess@CProtocolPresenceDataHostImp@@QAEAAVCProtocolPresencePublishingDataHostImp@@XZ @ 61 NONAME ; class CProtocolPresencePublishingDataHostImp & CProtocolPresenceDataHostImp::PublishingDataAccess(void)
+	?Ready@CXIMPEventCapsule@@QBEHXZ @ 62 NONAME ; int CXIMPEventCapsule::Ready(void) const
+	?RegisterSessionQueueL@CXIMPEventManager@@QAEXAAVCXIMPContextEventQueue@@@Z @ 63 NONAME ; void CXIMPEventManager::RegisterSessionQueueL(class CXIMPContextEventQueue &)
+	?RequestCompletedL@CXIMPOperationBase@@UAEXXZ @ 64 NONAME ; void CXIMPOperationBase::RequestCompletedL(void)
+	?RequestId@CXIMPOperationBase@@UBE?AVTXIMPRequestId@@XZ @ 65 NONAME ; class TXIMPRequestId CXIMPOperationBase::RequestId(void) const
+	?SelectTopEventIfNeededL@CXIMPContextEventQueue@@QAEXXZ @ 66 NONAME ; void CXIMPContextEventQueue::SelectTopEventIfNeededL(void)
+	?ServiceInfo@CXIMPPscContext@@QBEPAVCXIMPServiceInfoImp@@XZ @ 67 NONAME ; class CXIMPServiceInfoImp * CXIMPPscContext::ServiceInfo(void) const
+	?SessionId@CXIMPPscContext@@QBEKXZ @ 68 NONAME ; unsigned long CXIMPPscContext::SessionId(void) const
+	?SetClientInfo@CXIMPPscContext@@QAEXPAVCXIMPContextClientInfoImp@@@Z @ 69 NONAME ; void CXIMPPscContext::SetClientInfo(class CXIMPContextClientInfoImp *)
+	?SetEventFilter@CXIMPContextEventQueue@@QAEXAAVCXIMPContextEventFilter@@@Z @ 70 NONAME ; void CXIMPContextEventQueue::SetEventFilter(class CXIMPContextEventFilter &)
+	?SetHost@CXIMPOperationBase@@UAEXAAVMXIMPHost@@@Z @ 71 NONAME ; void CXIMPOperationBase::SetHost(class MXIMPHost &)
+	?SetObjectCollection@CXIMPOperationBase@@UAEXPAVMXIMPBase@@@Z @ 72 NONAME ; void CXIMPOperationBase::SetObjectCollection(class MXIMPBase *)
+	?SetOpL@CXIMPOperationBase@@UAEXPAVCXIMPPscContext@@@Z @ 73 NONAME ; void CXIMPOperationBase::SetOpL(class CXIMPPscContext *)
+	?SetPresenceInfoFilterL@CXIMPPscContext@@QAEXW4TFilterStoreType@MXIMPPscContext@@PAVCPresenceInfoFilterImp@@PBVCXIMPIdentityImp@@@Z @ 74 NONAME ; void CXIMPPscContext::SetPresenceInfoFilterL(enum MXIMPPscContext::TFilterStoreType, class CPresenceInfoFilterImp *, class CXIMPIdentityImp const *)
+	?SetReady@CXIMPEventCapsule@@QAEXH@Z @ 75 NONAME ; void CXIMPEventCapsule::SetReady(int)
+	?SetReqId@CXIMPOperationBase@@UAEXVTXIMPRequestId@@@Z @ 76 NONAME ; void CXIMPOperationBase::SetReqId(class TXIMPRequestId)
+	?SetRequestId@CXIMPProtocolRequestCompleteEventImp@@QAEXABVTXIMPRequestId@@@Z @ 77 NONAME ; void CXIMPProtocolRequestCompleteEventImp::SetRequestId(class TXIMPRequestId const &)
+	?SetResultCode@CXIMPOperationBase@@UAEXH@Z @ 78 NONAME ; void CXIMPOperationBase::SetResultCode(int)
+	?SetResultCode@CXIMPProtocolRequestCompleteEventImp@@QAEXH@Z @ 79 NONAME ; void CXIMPProtocolRequestCompleteEventImp::SetResultCode(int)
+	?SetServerOperation@CXIMPOperationBase@@QAEXXZ @ 80 NONAME ; void CXIMPOperationBase::SetServerOperation(void)
+	?SetServiceInfo@CXIMPPscContext@@QAEXPAVCXIMPServiceInfoImp@@@Z @ 81 NONAME ; void CXIMPPscContext::SetServiceInfo(class CXIMPServiceInfoImp *)
+	?SetStatus@CXIMPOperationBase@@UAEXPAVMXIMPStatus@@@Z @ 82 NONAME ; void CXIMPOperationBase::SetStatus(class MXIMPStatus *)
+	?StartConsuming@CXIMPContextEventQueue@@QAEXAAVMXIMPEventQueueObserver@@@Z @ 83 NONAME ; void CXIMPContextEventQueue::StartConsuming(class MXIMPEventQueueObserver &)
+	?Status@CXIMPOperationBase@@UBEAAVMXIMPStatus@@XZ @ 84 NONAME ; class MXIMPStatus & CXIMPOperationBase::Status(void) const
+	?StopConsuming@CXIMPContextEventQueue@@QAEXXZ @ 85 NONAME ; void CXIMPContextEventQueue::StopConsuming(void)
+	?TopEventDataL@CXIMPContextEventQueue@@QAEABVTDesC8@@XZ @ 86 NONAME ; class TDesC8 const & CXIMPContextEventQueue::TopEventDataL(void)
+	?TopEventReqIdL@CXIMPContextEventQueue@@QAE?AVTXIMPRequestId@@XZ @ 87 NONAME ; class TXIMPRequestId CXIMPContextEventQueue::TopEventReqIdL(void)
+	?Type@CXIMPOperationBase@@UBEHXZ @ 88 NONAME ; int CXIMPOperationBase::Type(void) const
+	?UninstallD@CXIMPGlobals@@SAXXZ @ 89 NONAME ; void CXIMPGlobals::UninstallD(void)
+	?UnregisterSessionQueue@CXIMPEventManager@@QAEXAAVCXIMPContextEventQueue@@@Z @ 90 NONAME ; void CXIMPEventManager::UnregisterSessionQueue(class CXIMPContextEventQueue &)
+	?UpdateEventData@CXIMPEventCapsule@@QAEXAAVCXIMPApiEventBase@@@Z @ 91 NONAME ; void CXIMPEventCapsule::UpdateEventData(class CXIMPApiEventBase &)
+	?UpdateEventDataL@CXIMPEventCapsule@@QAEXAAVCXIMPApiEventBase@@@Z @ 92 NONAME ; void CXIMPEventCapsule::UpdateEventDataL(class CXIMPApiEventBase &)
+	?WatchingDataAccess@CProtocolPresenceDataHostImp@@QAEAAVCProtocolPresenceWatchingDataHostImp@@XZ @ 93 NONAME ; class CProtocolPresenceWatchingDataHostImp & CProtocolPresenceDataHostImp::WatchingDataAccess(void)
+	?GetContext@CXIMPOperationBase@@QAEPAVMXIMPPscContext@@XZ @ 94 NONAME ; class MXIMPPscContext * CXIMPOperationBase::GetContext(void)
+	?GetObjCollection@CXIMPOperationBase@@QAEPAVMXIMPRestrictedObjectCollection@@XZ @ 95 NONAME ; class MXIMPRestrictedObjectCollection * CXIMPOperationBase::GetObjCollection(void)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/core/bwins/ximpsrvclientu.def	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,24 @@
+EXPORTS
+	??0RXIMPSrvContextClient@@QAE@XZ @ 1 NONAME ; RXIMPSrvContextClient::RXIMPSrvContextClient(void)
+	??0RXIMPSrvRootClient@@QAE@XZ @ 2 NONAME ; RXIMPSrvRootClient::RXIMPSrvRootClient(void)
+	??0TXIMPProcessStartupParam@@QAE@XZ @ 3 NONAME ; TXIMPProcessStartupParam::TXIMPProcessStartupParam(void)
+	?CancelListening@RXIMPSrvContextClient@@QAEXXZ @ 4 NONAME ; void RXIMPSrvContextClient::CancelListening(void)
+	?Close@RXIMPSrvContextClient@@QAEXXZ @ 5 NONAME ; void RXIMPSrvContextClient::Close(void)
+	?Close@RXIMPSrvRootClient@@QAEXXZ @ 6 NONAME ; void RXIMPSrvRootClient::Close(void)
+	?Connect@RXIMPSrvRootClient@@QAEHXZ @ 7 NONAME ; int RXIMPSrvRootClient::Connect(void)
+	?ConnectL@RXIMPSrvContextClient@@QAEXVTUid@@@Z @ 8 NONAME ; void RXIMPSrvContextClient::ConnectL(class TUid)
+	?ConnectToServer@XIMPProcessStarter@@SAHABVTDesC16@@0PBV?$TArray@VTXIMPProcessStartupParam@@@@AAVRSessionBase@@0ABVTVersion@@H@Z @ 9 NONAME ; int XIMPProcessStarter::ConnectToServer(class TDesC16 const &, class TDesC16 const &, class TArray<class TXIMPProcessStartupParam> const *, class RSessionBase &, class TDesC16 const &, class TVersion const &, int)
+	?DoQueueOperation@RXIMPSrvContextClient@@QAEHHABVTDesC8@@AAVTXIMPRequestId@@@Z @ 10 NONAME ; int RXIMPSrvContextClient::DoQueueOperation(int, class TDesC8 const &, class TXIMPRequestId &)
+	?DropTopEvent@RXIMPSrvContextClient@@QAEHXZ @ 11 NONAME ; int RXIMPSrvContextClient::DropTopEvent(void)
+	?FetchTopEventDataLC@RXIMPSrvContextClient@@QAEPAVHBufC8@@XZ @ 12 NONAME ; class HBufC8 * RXIMPSrvContextClient::FetchTopEventDataLC(void)
+	?FetchTopEventReqId@RXIMPSrvContextClient@@QAEHAAVTXIMPRequestId@@@Z @ 13 NONAME ; int RXIMPSrvContextClient::FetchTopEventReqId(class TXIMPRequestId &)
+	?FullExePathForClienLocation@XIMPProcessStarter@@SAXABVTDesC16@@AAV?$TBuf@$0BAA@@@@Z @ 14 NONAME ; void XIMPProcessStarter::FullExePathForClienLocation(class TDesC16 const &, class TBuf<256> &)
+	?GetContextFeaturesL@RXIMPSrvContextClient@@QBEPAVHBufC8@@XZ @ 15 NONAME ; class HBufC8 * RXIMPSrvContextClient::GetContextFeaturesL(void) const
+	?GetKnownProtocolsL@RXIMPSrvRootClient@@QAEPAVHBufC8@@XZ @ 16 NONAME ; class HBufC8 * RXIMPSrvRootClient::GetKnownProtocolsL(void)
+	?GetSupportedFrameworkFeaturesL@RXIMPSrvRootClient@@QAEPAVHBufC8@@XZ @ 17 NONAME ; class HBufC8 * RXIMPSrvRootClient::GetSupportedFrameworkFeaturesL(void)
+	?InstallEventFilterL@RXIMPSrvContextClient@@QAEXABVTDesC8@@@Z @ 18 NONAME ; void RXIMPSrvContextClient::InstallEventFilterL(class TDesC8 const &)
+	?ListenEvent@RXIMPSrvContextClient@@QAEXAAVTRequestStatus@@@Z @ 19 NONAME ; void RXIMPSrvContextClient::ListenEvent(class TRequestStatus &)
+	?Set@TXIMPProcessStartupParam@@QAEXHH@Z @ 20 NONAME ; void TXIMPProcessStartupParam::Set(int, int)
+	?StartInstance@XIMPProcessStarter@@SAHABVTDesC16@@0PBV?$TArray@VTXIMPProcessStartupParam@@@@@Z @ 21 NONAME ; int XIMPProcessStarter::StartInstance(class TDesC16 const &, class TDesC16 const &, class TArray<class TXIMPProcessStartupParam> const *)
+	?DoQueueOperation2@RXIMPSrvContextClient@@QAEHHABVTDesC8@@AAVTXIMPRequestId@@@Z @ 22 NONAME ; int RXIMPSrvContextClient::DoQueueOperation2(int, class TDesC8 const &, class TXIMPRequestId &)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/core/bwins/ximputilsu.def	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,27 @@
+EXPORTS
+	??0CXIMPSrvSessionAdapter@@QAE@AAVMXIMPSrv@@@Z @ 1 NONAME ; CXIMPSrvSessionAdapter::CXIMPSrvSessionAdapter(class MXIMPSrv &)
+	??0TXIMPBlockTraceHandler@@QAE@PBG@Z @ 2 NONAME ; TXIMPBlockTraceHandler::TXIMPBlockTraceHandler(unsigned short const *)
+	??0TXIMPRequestIdBuilder@@QAE@XZ @ 3 NONAME ; TXIMPRequestIdBuilder::TXIMPRequestIdBuilder(void)
+	??1CXIMPSrvSessionAdapter@@UAE@XZ @ 4 NONAME ; CXIMPSrvSessionAdapter::~CXIMPSrvSessionAdapter(void)
+	??1TXIMPBlockTraceHandler@@QAE@XZ @ 5 NONAME ; TXIMPBlockTraceHandler::~TXIMPBlockTraceHandler(void)
+	?BuildRequestId@TXIMPRequestIdBuilder@@QBE?AVTXIMPRequestId@@XZ @ 6 NONAME ; class TXIMPRequestId TXIMPRequestIdBuilder::BuildRequestId(void) const
+	?ExternalizeL@XIMPRBuf16Helper@@SAXABVRBuf16@@AAVRWriteStream@@@Z @ 7 NONAME ; void XIMPRBuf16Helper::ExternalizeL(class RBuf16 const &, class RWriteStream &)
+	?ExternalizeL@XIMPRBuf8Helper@@SAXABVRBuf8@@AAVRWriteStream@@@Z @ 8 NONAME ; void XIMPRBuf8Helper::ExternalizeL(class RBuf8 const &, class RWriteStream &)
+	?GrowIfNeededL@XIMPRBuf16Helper@@SAXAAVRBuf16@@H@Z @ 9 NONAME ; void XIMPRBuf16Helper::GrowIfNeededL(class RBuf16 &, int)
+	?GrowIfNeededL@XIMPRBuf8Helper@@SAXAAVRBuf8@@H@Z @ 10 NONAME ; void XIMPRBuf8Helper::GrowIfNeededL(class RBuf8 &, int)
+	?InternalizeL@XIMPRBuf16Helper@@SAXAAVRBuf16@@AAVRReadStream@@@Z @ 11 NONAME ; void XIMPRBuf16Helper::InternalizeL(class RBuf16 &, class RReadStream &)
+	?InternalizeL@XIMPRBuf8Helper@@SAXAAVRBuf8@@AAVRReadStream@@@Z @ 12 NONAME ; void XIMPRBuf8Helper::InternalizeL(class RBuf8 &, class RReadStream &)
+	?NormalExit@TXIMPBlockTraceHandler@@QAEXXZ @ 13 NONAME ; void TXIMPBlockTraceHandler::NormalExit(void)
+	?PackArrayL@TXIMPHBuf8Packer@@SAPAVHBufC8@@ABV?$RPointerArray@VHBufC8@@@@@Z @ 14 NONAME ; class HBufC8 * TXIMPHBuf8Packer::PackArrayL(class RPointerArray<class HBufC8> const &)
+	?Panic@NXIMPPrivPanic@@YAXW4TReason@1@@Z @ 15 NONAME ; void NXIMPPrivPanic::Panic(enum NXIMPPrivPanic::TReason)
+	?Server@CXIMPSrvSessionAdapter@@IAEAAVMXIMPSrv@@XZ @ 16 NONAME ; class MXIMPSrv & CXIMPSrvSessionAdapter::Server(void)
+	?ServiceError@CXIMPSrvSessionAdapter@@UAEXABVRMessage2@@H@Z @ 17 NONAME ; void CXIMPSrvSessionAdapter::ServiceError(class RMessage2 const &, int)
+	?ServiceL@CXIMPSrvSessionAdapter@@UAEXABVRMessage2@@@Z @ 18 NONAME ; void CXIMPSrvSessionAdapter::ServiceL(class RMessage2 const &)
+	?SetNewValueL@XIMPRBuf16Helper@@SAXAAVRBuf16@@ABVTDesC16@@@Z @ 19 NONAME ; void XIMPRBuf16Helper::SetNewValueL(class RBuf16 &, class TDesC16 const &)
+	?SetNewValueL@XIMPRBuf8Helper@@SAXAAVRBuf8@@ABVTDesC8@@@Z @ 20 NONAME ; void XIMPRBuf8Helper::SetNewValueL(class RBuf8 &, class TDesC8 const &)
+	?SetProtocolId@TXIMPRequestIdBuilder@@QAEXK@Z @ 21 NONAME ; void TXIMPRequestIdBuilder::SetProtocolId(unsigned long)
+	?SetRequestId@TXIMPRequestIdBuilder@@QAEXK@Z @ 22 NONAME ; void TXIMPRequestIdBuilder::SetRequestId(unsigned long)
+	?SetSessionId@TXIMPRequestIdBuilder@@QAEXK@Z @ 23 NONAME ; void TXIMPRequestIdBuilder::SetSessionId(unsigned long)
+	?Trace@XIMPTrace@@SAXV?$TRefByValue@$$CBVTDesC16@@@@ZZ @ 24 NONAME ; void XIMPTrace::Trace(class TRefByValue<class TDesC16 const >, ...)
+	?UnPackArrayL@TXIMPHBuf8Packer@@SAXAAV?$RPointerArray@VHBufC8@@@@ABVTDesC8@@@Z @ 25 NONAME ; void TXIMPHBuf8Packer::UnPackArrayL(class RPointerArray<class HBufC8> &, class TDesC8 const &)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/core/eabi/ximpdatamodelu.def	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,153 @@
+EXPORTS
+	_ZN14CXIMPStatusImp12InternalizeLER11RReadStream @ 1 NONAME
+	_ZN14CXIMPStatusImp15NewFromStreamLCER11RReadStream @ 2 NONAME
+	_ZN14CXIMPStatusImp4NewLEv @ 3 NONAME
+	_ZN14CXIMPStatusImp5NewLCEv @ 4 NONAME
+	_ZN14XIMPEventCodec5PackLER17CXIMPApiEventBaseRl @ 5 NONAME
+	_ZN14XIMPEventCodec5PackLER17CXIMPApiEventBaseRlP8CBufFlat @ 6 NONAME
+	_ZN14XIMPEventCodec7UnPackLERK6TDesC8Rl @ 7 NONAME
+	_ZN15CXIMPApiObjBaseC2Ev @ 8 NONAME
+	_ZN15CXIMPApiObjBaseD0Ev @ 9 NONAME
+	_ZN15CXIMPApiObjBaseD1Ev @ 10 NONAME
+	_ZN15CXIMPApiObjBaseD2Ev @ 11 NONAME
+	_ZN16CXIMPIdentityImp12InternalizeLER11RReadStream @ 12 NONAME
+	_ZN16CXIMPIdentityImp15NewFromStreamLCER11RReadStream @ 13 NONAME
+	_ZN16CXIMPIdentityImp4NewLEv @ 14 NONAME
+	_ZN16CXIMPIdentityImp5NewLCERK7TDesC16 @ 15 NONAME
+	_ZN16CXIMPIdentityImp5NewLCEv @ 16 NONAME
+	_ZN17CXIMPApiEventBaseC2Ev @ 17 NONAME
+	_ZN17CXIMPApiEventBaseD0Ev @ 18 NONAME
+	_ZN17CXIMPApiEventBaseD1Ev @ 19 NONAME
+	_ZN17CXIMPApiEventBaseD2Ev @ 20 NONAME
+	_ZN19CXIMPApiDataObjBaseC2Ev @ 21 NONAME
+	_ZN19CXIMPApiDataObjBaseD0Ev @ 22 NONAME
+	_ZN19CXIMPApiDataObjBaseD1Ev @ 23 NONAME
+	_ZN19CXIMPApiDataObjBaseD2Ev @ 24 NONAME
+	_ZN19CXIMPFeatureInfoImp11AddFeatureLERK6TDesC8 @ 25 NONAME
+	_ZN19CXIMPFeatureInfoImp12InternalizeLER11RReadStream @ 26 NONAME
+	_ZN19CXIMPFeatureInfoImp15NewFromStreamLCER11RReadStream @ 27 NONAME
+	_ZN19CXIMPFeatureInfoImp4NewLEv @ 28 NONAME
+	_ZN19CXIMPFeatureInfoImp5NewLCEv @ 29 NONAME
+	_ZN19CXIMPServiceInfoImp12InternalizeLER11RReadStream @ 30 NONAME
+	_ZN19CXIMPServiceInfoImp15NewFromStreamLCER11RReadStream @ 31 NONAME
+	_ZN19CXIMPServiceInfoImp4NewLEv @ 32 NONAME
+	_ZN19CXIMPServiceInfoImp5NewLCE4TUidRK7TDesC16S3_S3_l @ 33 NONAME
+	_ZN19CXIMPServiceInfoImp5NewLCEv @ 34 NONAME
+	_ZN19FeaturePluginHolder11InitializeLEv @ 35 NONAME
+	_ZN19FeaturePluginHolder13AccessorCountEv @ 36 NONAME
+	_ZN19FeaturePluginHolder26PresenceObjFactoryAccessorEv @ 37 NONAME
+	_ZN19FeaturePluginHolder7ReleaseEv @ 38 NONAME
+	_ZN19FeaturePluginHolder8AccessorEi @ 39 NONAME
+	_ZN20CXIMPContextStateImp12InternalizeLER11RReadStream @ 40 NONAME
+	_ZN20CXIMPContextStateImp13SetStateValueEN17MXIMPContextState6TStateE @ 41 NONAME
+	_ZN20CXIMPContextStateImp15NewFromStreamLCER11RReadStream @ 42 NONAME
+	_ZN20CXIMPContextStateImp4NewLEv @ 43 NONAME
+	_ZN20CXIMPContextStateImp5NewLCEv @ 44 NONAME
+	_ZN20CXIMPProtocolInfoImp12InternalizeLER11RReadStream @ 45 NONAME
+	_ZN20CXIMPProtocolInfoImp15NewFromStreamLCER11RReadStream @ 46 NONAME
+	_ZN20CXIMPProtocolInfoImp5NewLCERK7TDesC164TUidRK19CXIMPFeatureInfoImp @ 47 NONAME
+	_ZN20CXIMPProtocolInfoImp5NewLCEv @ 48 NONAME
+	_ZN21CXIMPObjectFactoryImp4NewLEv @ 49 NONAME
+	_ZN21XIMPApiDataObjFactory12ExternalizeLER12RWriteStreamRK19CXIMPApiDataObjBase @ 50 NONAME
+	_ZN21XIMPApiDataObjFactory12ExternalizeLER12RWriteStreamRK6RArrayI13SXIMPReqParamE @ 51 NONAME
+	_ZN21XIMPApiDataObjFactory12InternalizeLER11RReadStreamR6RArrayI13SXIMPReqParamE @ 52 NONAME
+	_ZN21XIMPApiDataObjFactory13InternalizeLCER11RReadStream @ 53 NONAME
+	_ZN23CXIMPContextEventFilter12InternalizeLER11RReadStream @ 54 NONAME
+	_ZN23CXIMPContextEventFilter13NewCombinedLCERK6TArrayIPS_E @ 55 NONAME
+	_ZN23CXIMPContextEventFilter4NewLEPK6TArrayIlE @ 56 NONAME
+	_ZN23CXIMPContextEventFilter5NewLCEPK6TArrayIlE @ 57 NONAME
+	_ZN24CXIMPObjectCollectionImp4NewLEv @ 58 NONAME
+	_ZN24CXIMPObjectCollectionImp5NewLCEv @ 59 NONAME
+	_ZN25CXIMPContextClientInfoImp12InternalizeLER11RReadStream @ 60 NONAME
+	_ZN25CXIMPContextClientInfoImp15NewFromStreamLCER11RReadStream @ 61 NONAME
+	_ZN25CXIMPContextClientInfoImp4NewLEv @ 62 NONAME
+	_ZN25CXIMPContextClientInfoImp5NewLCEv @ 63 NONAME
+	_ZN25CXIMPContextStateEventImp15ContextStateImpEv @ 64 NONAME
+	_ZN25CXIMPContextStateEventImp20StateChangeReasonImpEv @ 65 NONAME
+	_ZN25CXIMPContextStateEventImp23SetStateChangeReasonImpEP14CXIMPStatusImp @ 66 NONAME
+	_ZN25CXIMPContextStateEventImp4NewLEv @ 67 NONAME
+	_ZN25CXIMPContextStateEventImp5NewLCEv @ 68 NONAME
+	_ZN25CXIMPSubscriptionItemBase10ForceCloseEv @ 69 NONAME
+	_ZN25CXIMPSubscriptionItemBase14AddSubscriberLEP15MXIMPPscContext @ 70 NONAME
+	_ZN25CXIMPSubscriptionItemBase14AddSubscriberLEPS_ @ 71 NONAME
+	_ZN25CXIMPSubscriptionItemBase14BaseConstructLEv @ 72 NONAME
+	_ZN25CXIMPSubscriptionItemBase14CleanIfExpiredEv @ 73 NONAME
+	_ZN25CXIMPSubscriptionItemBase16RemoveSubscriberEP15MXIMPPscContext @ 74 NONAME
+	_ZN25CXIMPSubscriptionItemBase16RemoveSubscriberEPS_ @ 75 NONAME
+	_ZN25CXIMPSubscriptionItemBase17UpdateExpirationLEv @ 76 NONAME
+	_ZN25CXIMPSubscriptionItemBase18CountOfSubscribersEv @ 77 NONAME
+	_ZN25CXIMPSubscriptionItemBase18SubscriptionStatusEP15MXIMPPscContext @ 78 NONAME
+	_ZN25CXIMPSubscriptionItemBase19ActivateSubscriberLEP15MXIMPPscContext @ 79 NONAME
+	_ZN25CXIMPSubscriptionItemBase19ActivateSubscriberLEPS_ @ 80 NONAME
+	_ZN25CXIMPSubscriptionItemBase20ChangeStatusAfterAddEv @ 81 NONAME
+	_ZN25CXIMPSubscriptionItemBase21DataSubscriptionStateEv @ 82 NONAME
+	_ZN25CXIMPSubscriptionItemBase23ChangeStatusAfterRemoveEv @ 83 NONAME
+	_ZN25CXIMPSubscriptionItemBase24UpdateSubscriptionStateLENS_18TSubscriptionEventE @ 84 NONAME
+	_ZN25CXIMPSubscriptionItemBase25SetDataSubscriptionStateLER29CXIMPDataSubscriptionStateImp @ 85 NONAME
+	_ZN25CXIMPSubscriptionItemBase37SynthesiseSubscriptionEventToAllCtxsLEv @ 86 NONAME
+	_ZN25CXIMPSubscriptionItemBase7ContextEi @ 87 NONAME
+	_ZN25CXIMPSubscriptionItemBaseC2ER19MXIMPItemParentBase @ 88 NONAME
+	_ZN25CXIMPSubscriptionItemBaseD0Ev @ 89 NONAME
+	_ZN25CXIMPSubscriptionItemBaseD1Ev @ 90 NONAME
+	_ZN25CXIMPSubscriptionItemBaseD2Ev @ 91 NONAME
+	_ZN26CXIMPConfigurationItemBase10ForceCloseEv @ 92 NONAME
+	_ZN26CXIMPConfigurationItemBase14BaseConstructLEv @ 93 NONAME
+	_ZN26CXIMPConfigurationItemBase16AddConfiguratorLEP15MXIMPPscContext @ 94 NONAME
+	_ZN26CXIMPConfigurationItemBase16AddConfiguratorLEPS_ @ 95 NONAME
+	_ZN26CXIMPConfigurationItemBase18RemoveConfiguratorEP15MXIMPPscContext @ 96 NONAME
+	_ZN26CXIMPConfigurationItemBase18RemoveConfiguratorEPS_ @ 97 NONAME
+	_ZN26CXIMPConfigurationItemBase19ConfigurationStatusEP15MXIMPPscContext @ 98 NONAME
+	_ZN26CXIMPConfigurationItemBaseC2ER19MXIMPItemParentBase @ 99 NONAME
+	_ZN26CXIMPConfigurationItemBaseD0Ev @ 100 NONAME
+	_ZN26CXIMPConfigurationItemBaseD1Ev @ 101 NONAME
+	_ZN26CXIMPConfigurationItemBaseD2Ev @ 102 NONAME
+	_ZN28CXIMPRequestCompleteEventImp12AppendParamLEP19CXIMPApiDataObjBase @ 103 NONAME
+	_ZN28CXIMPRequestCompleteEventImp12SetRequestIdERK14TXIMPRequestId @ 104 NONAME
+	_ZN28CXIMPRequestCompleteEventImp19CompletionResultImpEv @ 105 NONAME
+	_ZN28CXIMPRequestCompleteEventImp4NewLEv @ 106 NONAME
+	_ZN28CXIMPRequestCompleteEventImp5NewLCER14TXIMPRequestIdi @ 107 NONAME
+	_ZN29CXIMPDataSubscriptionStateImp12InternalizeLER11RReadStream @ 108 NONAME
+	_ZN29CXIMPDataSubscriptionStateImp15NewFromStreamLCER11RReadStream @ 109 NONAME
+	_ZN29CXIMPDataSubscriptionStateImp4NewLEv @ 110 NONAME
+	_ZN29CXIMPDataSubscriptionStateImp5NewLCEv @ 111 NONAME
+	_ZN34CXIMPRestrictedObjectCollectionImp18SetObjectOwnershipEi @ 112 NONAME
+	_ZN34CXIMPRestrictedObjectCollectionImp4NewLEi @ 113 NONAME
+	_ZN34CXIMPRestrictedObjectCollectionImp5NewLCEi @ 114 NONAME
+	_ZNK15CXIMPApiObjBase25HandleUnknownGetInterfaceElN9MXIMPBase9TIfGetOpsE @ 115 NONAME
+	_ZNK16CXIMPIdentityImp7CompareERKS_ @ 116 NONAME
+	_ZNK16CXIMPIdentityImpneERKS_ @ 117 NONAME
+	_ZNK23CXIMPContextEventFilter12ExternalizeLER12RWriteStream @ 118 NONAME
+	_ZNK23CXIMPContextEventFilter15IsEventAcceptedEl @ 119 NONAME
+	_ZNK25CXIMPContextClientInfoImp5MatchEPKS_ @ 120 NONAME
+	_ZNK25CXIMPSubscriptionItemBase12ContextCountEv @ 121 NONAME
+	_ZNK25CXIMPSubscriptionItemBase8StatusLCEP15MXIMPPscContext @ 122 NONAME
+	_ZNK25CXIMPSubscriptionItemBase9IsContextEP15MXIMPPscContext @ 123 NONAME
+	_ZNK26CXIMPConfigurationItemBase9IsContextEP15MXIMPPscContext @ 124 NONAME
+	_ZTI15CXIMPApiObjBase @ 125 NONAME ; #<TI>#
+	_ZTI17CXIMPApiEventBase @ 126 NONAME ; #<TI>#
+	_ZTI19CXIMPApiDataObjBase @ 127 NONAME ; #<TI>#
+	_ZTI21CXIMPObjectFactoryImp @ 128 NONAME ; #<TI>#
+	_ZTI24CXIMPObjectCollectionImp @ 129 NONAME ; #<TI>#
+	_ZTI25CXIMPSubscriptionItemBase @ 130 NONAME ; #<TI>#
+	_ZTI26CXIMPConfigurationItemBase @ 131 NONAME ; #<TI>#
+	_ZTI34CXIMPRestrictedObjectCollectionImp @ 132 NONAME ; #<TI>#
+	_ZTIN24CXIMPObjectCollectionImp22CXIMPCollectionElementE @ 133 NONAME ; #<TI>#
+	_ZTV15CXIMPApiObjBase @ 134 NONAME ; #<VT>#
+	_ZTV17CXIMPApiEventBase @ 135 NONAME ; #<VT>#
+	_ZTV19CXIMPApiDataObjBase @ 136 NONAME ; #<VT>#
+	_ZTV21CXIMPObjectFactoryImp @ 137 NONAME ; #<VT>#
+	_ZTV24CXIMPObjectCollectionImp @ 138 NONAME ; #<VT>#
+	_ZTV25CXIMPSubscriptionItemBase @ 139 NONAME ; #<VT>#
+	_ZTV26CXIMPConfigurationItemBase @ 140 NONAME ; #<VT>#
+	_ZTV34CXIMPRestrictedObjectCollectionImp @ 141 NONAME ; #<VT>#
+	_ZTVN24CXIMPObjectCollectionImp22CXIMPCollectionElementE @ 142 NONAME ; #<VT>#
+	_ZThn144_N26CXIMPConfigurationItemBaseD0Ev @ 143 NONAME ; #<thunk>#
+	_ZThn144_N26CXIMPConfigurationItemBaseD1Ev @ 144 NONAME ; #<thunk>#
+	_ZThn28_N25CXIMPSubscriptionItemBase19ActivateSubscriberLEP15MXIMPPscContext @ 145 NONAME ; #<thunk>#
+	_ZThn28_N25CXIMPSubscriptionItemBase25SetDataSubscriptionStateLER29CXIMPDataSubscriptionStateImp @ 146 NONAME ; #<thunk>#
+	_ZThn28_N25CXIMPSubscriptionItemBase37SynthesiseSubscriptionEventToAllCtxsLEv @ 147 NONAME ; #<thunk>#
+	_ZThn28_N25CXIMPSubscriptionItemBaseD0Ev @ 148 NONAME ; #<thunk>#
+	_ZThn28_N25CXIMPSubscriptionItemBaseD1Ev @ 149 NONAME ; #<thunk>#
+	_ZThn28_N26CXIMPConfigurationItemBaseD0Ev @ 150 NONAME ; #<thunk>#
+	_ZThn28_N26CXIMPConfigurationItemBaseD1Ev @ 151 NONAME ; #<thunk>#
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/core/eabi/ximpmanageru.def	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,3 @@
+EXPORTS
+	_ZN14CXIMPClientImp15NewMXIMPClientLEv @ 1 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/core/eabi/ximpoperationsu.def	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,21 @@
+EXPORTS
+	_ZN18CXIMPOperationBindC1Ev @ 1 NONAME
+	_ZN18CXIMPOperationBindC2Ev @ 2 NONAME
+	_ZN19CXIMPOperationBind2C1Ev @ 3 NONAME
+	_ZN19CXIMPOperationBind2C2Ev @ 4 NONAME
+	_ZN20CXIMPOperationUnbindC1Ev @ 5 NONAME
+	_ZN20CXIMPOperationUnbindC2Ev @ 6 NONAME
+	_ZN21CXIMPOperationFactory4NewLEv @ 7 NONAME
+	_ZN28CXIMPOperationForcedTeardownC1Ev @ 8 NONAME
+	_ZN28CXIMPOperationForcedTeardownC2Ev @ 9 NONAME
+	_ZTI18CXIMPOperationBind @ 10 NONAME ; #<TI>#
+	_ZTI19CXIMPOperationBind2 @ 11 NONAME ; #<TI>#
+	_ZTI20CXIMPOperationUnbind @ 12 NONAME ; #<TI>#
+	_ZTI21CXIMPOperationFactory @ 13 NONAME ; #<TI>#
+	_ZTI28CXIMPOperationForcedTeardown @ 14 NONAME ; #<TI>#
+	_ZTV18CXIMPOperationBind @ 15 NONAME ; #<VT>#
+	_ZTV19CXIMPOperationBind2 @ 16 NONAME ; #<VT>#
+	_ZTV20CXIMPOperationUnbind @ 17 NONAME ; #<VT>#
+	_ZTV21CXIMPOperationFactory @ 18 NONAME ; #<VT>#
+	_ZTV28CXIMPOperationForcedTeardown @ 19 NONAME ; #<VT>#
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/core/eabi/ximpprocessoru.def	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,128 @@
+EXPORTS
+	_ZN12CXIMPGlobals10UninstallDEv @ 1 NONAME
+	_ZN12CXIMPGlobals11HostManagerEv @ 2 NONAME
+	_ZN12CXIMPGlobals11NoMoreHostsEv @ 3 NONAME
+	_ZN12CXIMPGlobals13PluginFactoryEv @ 4 NONAME
+	_ZN12CXIMPGlobals14FeatureManagerEv @ 5 NONAME
+	_ZN12CXIMPGlobals16OperationFactoryEv @ 6 NONAME
+	_ZN12CXIMPGlobals8InstallLEP21MXIMPOperationFactoryP20MXIMPGlobalsObserver @ 7 NONAME
+	_ZN12CXIMPGlobals8InstanceEv @ 8 NONAME
+	_ZN15CXIMPPscContext13SetClientInfoEP25CXIMPContextClientInfoImp @ 9 NONAME
+	_ZN15CXIMPPscContext14SetServiceInfoEP19CXIMPServiceInfoImp @ 10 NONAME
+	_ZN15CXIMPPscContext15GetCachedUnbindEv @ 11 NONAME
+	_ZN15CXIMPPscContext15OrderOfContextsERKS_S1_ @ 12 NONAME
+	_ZN15CXIMPPscContext16AddNewOperationLEiRK6TDesC8 @ 13 NONAME
+	_ZN15CXIMPPscContext16AppendToOpQueueLEP18CXIMPOperationBase @ 14 NONAME
+	_ZN15CXIMPPscContext19DestroyCachedUnbindEv @ 15 NONAME
+	_ZN15CXIMPPscContext20FeaturesForSessionLCEv @ 16 NONAME
+	_ZN15CXIMPPscContext22SetPresenceInfoFilterLEN15MXIMPPscContext16TFilterStoreTypeEP22CPresenceInfoFilterImpPK16CXIMPIdentityImp @ 17 NONAME
+	_ZN15CXIMPPscContext27AppendToOpQueueUpdateReqIdLEP18CXIMPOperationBase @ 18 NONAME
+	_ZN15CXIMPPscContext4NewLEm @ 19 NONAME
+	_ZN16CXIMPHostManager16DisassociateHostEP9CXIMPHost @ 20 NONAME
+	_ZN17CXIMPEventCapsule15UpdateEventDataER17CXIMPApiEventBase @ 21 NONAME
+	_ZN17CXIMPEventCapsule16UpdateEventDataLER17CXIMPApiEventBase @ 22 NONAME
+	_ZN17CXIMPEventCapsule4NewLER17CXIMPApiEventBasei @ 23 NONAME
+	_ZN17CXIMPEventCapsule8SetReadyEi @ 24 NONAME
+	_ZN17CXIMPEventManager14ActivateEventLER17CXIMPApiEventBaseP15CXIMPPscContext @ 25 NONAME
+	_ZN17CXIMPEventManager21RegisterSessionQueueLER22CXIMPContextEventQueue @ 26 NONAME
+	_ZN17CXIMPEventManager22UnregisterSessionQueueER22CXIMPContextEventQueue @ 27 NONAME
+	_ZN17CXIMPEventManager28ActivateRequestCompleteEventER28CXIMPRequestCompleteEventImpP15CXIMPPscContext @ 28 NONAME
+	_ZN17CXIMPEventManager4NewLEv @ 29 NONAME
+	_ZN17CXIMPEventManager9AddEventLER17CXIMPApiEventBaseP15CXIMPPscContext @ 30 NONAME
+	_ZN17CXIMPEventManager9AddEventLER17CXIMPApiEventBaseR13RPointerArrayI15CXIMPPscContextE @ 31 NONAME
+	_ZN18CXIMPOperationBase10GetContextEv @ 32 NONAME
+	_ZN18CXIMPOperationBase12EndOperationEv @ 33 NONAME
+	_ZN18CXIMPOperationBase13SetResultCodeEi @ 34 NONAME
+	_ZN18CXIMPOperationBase14BaseConstructLE14TXIMPRequestIdP15CXIMPPscContext @ 35 NONAME
+	_ZN18CXIMPOperationBase14BeginOperationEv @ 36 NONAME
+	_ZN18CXIMPOperationBase16GetObjCollectionEv @ 37 NONAME
+	_ZN18CXIMPOperationBase17RequestCompletedLEv @ 38 NONAME
+	_ZN18CXIMPOperationBase18SetServerOperationEv @ 39 NONAME
+	_ZN18CXIMPOperationBase19GetReqCompleteEventEv @ 40 NONAME
+	_ZN18CXIMPOperationBase19SetObjectCollectionEP9MXIMPBase @ 41 NONAME
+	_ZN18CXIMPOperationBase27CreateRequestCompleteEventLEv @ 42 NONAME
+	_ZN18CXIMPOperationBase6SetOpLEP15CXIMPPscContext @ 43 NONAME
+	_ZN18CXIMPOperationBase7ContextEv @ 44 NONAME
+	_ZN18CXIMPOperationBase7SetHostER9MXIMPHost @ 45 NONAME
+	_ZN18CXIMPOperationBase8ProcessLEv @ 46 NONAME
+	_ZN18CXIMPOperationBase8SetReqIdE14TXIMPRequestId @ 47 NONAME
+	_ZN18CXIMPOperationBase9SetStatusEP11MXIMPStatus @ 48 NONAME
+	_ZN18CXIMPOperationBaseC2Ev @ 49 NONAME
+	_ZN18CXIMPOperationBaseD0Ev @ 50 NONAME
+	_ZN18CXIMPOperationBaseD1Ev @ 51 NONAME
+	_ZN18CXIMPOperationBaseD2Ev @ 52 NONAME
+	_ZN18CXIMPPluginFactory12GetProtocolLE4TUid @ 53 NONAME
+	_ZN18CXIMPPluginFactory13GetProtocolsLEv @ 54 NONAME
+	_ZN19CXIMPFeatureManager21GetFrameworkFeaturesLEv @ 55 NONAME
+	_ZN22CXIMPContextEventQueue12DropTopEventEv @ 56 NONAME
+	_ZN22CXIMPContextEventQueue13StopConsumingEv @ 57 NONAME
+	_ZN22CXIMPContextEventQueue13TopEventDataLEv @ 58 NONAME
+	_ZN22CXIMPContextEventQueue14SetEventFilterER23CXIMPContextEventFilter @ 59 NONAME
+	_ZN22CXIMPContextEventQueue14StartConsumingER23MXIMPEventQueueObserver @ 60 NONAME
+	_ZN22CXIMPContextEventQueue14TopEventReqIdLEv @ 61 NONAME
+	_ZN22CXIMPContextEventQueue23SelectTopEventIfNeededLEv @ 62 NONAME
+	_ZN22CXIMPContextEventQueue4NewLEv @ 63 NONAME
+	_ZN28CProtocolPresenceDataHostImp16GroupsDataAccessEv @ 64 NONAME
+	_ZN28CProtocolPresenceDataHostImp17PresenceDataCacheEv @ 65 NONAME
+	_ZN28CProtocolPresenceDataHostImp18WatchingDataAccessEv @ 66 NONAME
+	_ZN28CProtocolPresenceDataHostImp20PublishingDataAccessEv @ 67 NONAME
+	_ZN28CProtocolPresenceDataHostImp23AuthorizationDataAccessEv @ 68 NONAME
+	_ZN28CProtocolPresenceDataHostImp4NewLER9MXIMPHost @ 69 NONAME
+	_ZN28CProtocolPresenceDataHostImp5NewLCER9MXIMPHost @ 70 NONAME
+	_ZN36CProtocolPresenceWatchingDataHostImp4NewLER9MXIMPHost @ 71 NONAME
+	_ZN36CProtocolPresentityGroupsDataHostImp4NewLER9MXIMPHost @ 72 NONAME
+	_ZN36CXIMPProtocolRequestCompleteEventImp12InternalizeLER11RReadStream @ 73 NONAME
+	_ZN36CXIMPProtocolRequestCompleteEventImp12SetRequestIdERK14TXIMPRequestId @ 74 NONAME
+	_ZN36CXIMPProtocolRequestCompleteEventImp13SetResultCodeEi @ 75 NONAME
+	_ZN36CXIMPProtocolRequestCompleteEventImp4NewLEv @ 76 NONAME
+	_ZN38CProtocolPresencePublishingDataHostImp4NewLER9MXIMPHost @ 77 NONAME
+	_ZN41CProtocolPresenceAuthorizationDataHostImp4NewLER9MXIMPHost @ 78 NONAME
+	_ZN9CXIMPHost5NewLCER23MXIMPProtocolConnectionl @ 79 NONAME
+	_ZNK15CXIMPPscContext10ClientInfoEv @ 80 NONAME
+	_ZNK15CXIMPPscContext10EventQueueEv @ 81 NONAME
+	_ZNK15CXIMPPscContext11ServiceInfoEv @ 82 NONAME
+	_ZNK15CXIMPPscContext14IsHostAssignedEv @ 83 NONAME
+	_ZNK15CXIMPPscContext18PresenceInfoFilterEN15MXIMPPscContext16TFilterStoreTypeEPK16CXIMPIdentityImp @ 84 NONAME
+	_ZNK15CXIMPPscContext9SessionIdEv @ 85 NONAME
+	_ZNK17CXIMPEventCapsule10EventReqIdEv @ 86 NONAME
+	_ZNK17CXIMPEventCapsule5ReadyEv @ 87 NONAME
+	_ZNK17CXIMPEventCapsule9EventDataEv @ 88 NONAME
+	_ZNK17CXIMPEventCapsule9EventTypeEv @ 89 NONAME
+	_ZNK18CXIMPOperationBase17IsServerOperationEv @ 90 NONAME
+	_ZNK18CXIMPOperationBase4TypeEv @ 91 NONAME
+	_ZNK18CXIMPOperationBase6StatusEv @ 92 NONAME
+	_ZNK18CXIMPOperationBase9RequestIdEv @ 93 NONAME
+	_ZNK22CXIMPContextEventQueue11HasElementsEv @ 94 NONAME
+	_ZNK36CXIMPProtocolRequestCompleteEventImp12ExternalizeLER12RWriteStream @ 95 NONAME
+	_ZTI12CXIMPGlobals @ 96 NONAME ; #<TI>#
+	_ZTI15CXIMPPscContext @ 97 NONAME ; #<TI>#
+	_ZTI16CXIMPHostManager @ 98 NONAME ; #<TI>#
+	_ZTI17CXIMPEventCapsule @ 99 NONAME ; #<TI>#
+	_ZTI17CXIMPEventManager @ 100 NONAME ; #<TI>#
+	_ZTI18CXIMPOperationBase @ 101 NONAME ; #<TI>#
+	_ZTI18CXIMPPluginFactory @ 102 NONAME ; #<TI>#
+	_ZTI19CXIMPFeatureManager @ 103 NONAME ; #<TI>#
+	_ZTI22CXIMPContextEventQueue @ 104 NONAME ; #<TI>#
+	_ZTI28CProtocolPresenceDataHostImp @ 105 NONAME ; #<TI>#
+	_ZTI36CProtocolPresenceWatchingDataHostImp @ 106 NONAME ; #<TI>#
+	_ZTI36CProtocolPresentityGroupsDataHostImp @ 107 NONAME ; #<TI>#
+	_ZTI38CProtocolPresencePublishingDataHostImp @ 108 NONAME ; #<TI>#
+	_ZTI41CProtocolPresenceAuthorizationDataHostImp @ 109 NONAME ; #<TI>#
+	_ZTI9CXIMPHost @ 110 NONAME ; #<TI>#
+	_ZTV12CXIMPGlobals @ 111 NONAME ; #<VT>#
+	_ZTV15CXIMPPscContext @ 112 NONAME ; #<VT>#
+	_ZTV16CXIMPHostManager @ 113 NONAME ; #<VT>#
+	_ZTV17CXIMPEventCapsule @ 114 NONAME ; #<VT>#
+	_ZTV17CXIMPEventManager @ 115 NONAME ; #<VT>#
+	_ZTV18CXIMPOperationBase @ 116 NONAME ; #<VT>#
+	_ZTV18CXIMPPluginFactory @ 117 NONAME ; #<VT>#
+	_ZTV19CXIMPFeatureManager @ 118 NONAME ; #<VT>#
+	_ZTV22CXIMPContextEventQueue @ 119 NONAME ; #<VT>#
+	_ZTV28CProtocolPresenceDataHostImp @ 120 NONAME ; #<VT>#
+	_ZTV36CProtocolPresenceWatchingDataHostImp @ 121 NONAME ; #<VT>#
+	_ZTV36CProtocolPresentityGroupsDataHostImp @ 122 NONAME ; #<VT>#
+	_ZTV38CProtocolPresencePublishingDataHostImp @ 123 NONAME ; #<VT>#
+	_ZTV41CProtocolPresenceAuthorizationDataHostImp @ 124 NONAME ; #<VT>#
+	_ZTV9CXIMPHost @ 125 NONAME ; #<VT>#
+	_ZThn28_NK15CXIMPPscContext18PresenceInfoFilterEN15MXIMPPscContext16TFilterStoreTypeEPK16CXIMPIdentityImp @ 126 NONAME ; #<thunk>#
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/core/eabi/ximpsrvclientu.def	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,27 @@
+EXPORTS
+	_ZN18RXIMPSrvRootClient18GetKnownProtocolsLEv @ 1 NONAME
+	_ZN18RXIMPSrvRootClient30GetSupportedFrameworkFeaturesLEv @ 2 NONAME
+	_ZN18RXIMPSrvRootClient5CloseEv @ 3 NONAME
+	_ZN18RXIMPSrvRootClient7ConnectEv @ 4 NONAME
+	_ZN18RXIMPSrvRootClientC1Ev @ 5 NONAME
+	_ZN18RXIMPSrvRootClientC2Ev @ 6 NONAME
+	_ZN18XIMPProcessStarter13StartInstanceERK7TDesC16S2_PK6TArrayI24TXIMPProcessStartupParamE @ 7 NONAME
+	_ZN18XIMPProcessStarter15ConnectToServerERK7TDesC16S2_PK6TArrayI24TXIMPProcessStartupParamER12RSessionBaseS2_RK8TVersioni @ 8 NONAME
+	_ZN18XIMPProcessStarter27FullExePathForClienLocationERK7TDesC16R4TBufILi256EE @ 9 NONAME
+	_ZN21RXIMPSrvContextClient11ListenEventER14TRequestStatus @ 10 NONAME
+	_ZN21RXIMPSrvContextClient12DropTopEventEv @ 11 NONAME
+	_ZN21RXIMPSrvContextClient15CancelListeningEv @ 12 NONAME
+	_ZN21RXIMPSrvContextClient16DoQueueOperationEiRK6TDesC8R14TXIMPRequestId @ 13 NONAME
+	_ZN21RXIMPSrvContextClient17DoQueueOperation2EiRK6TDesC8R14TXIMPRequestId @ 14 NONAME
+	_ZN21RXIMPSrvContextClient18FetchTopEventReqIdER14TXIMPRequestId @ 15 NONAME
+	_ZN21RXIMPSrvContextClient19FetchTopEventDataLCEv @ 16 NONAME
+	_ZN21RXIMPSrvContextClient19InstallEventFilterLERK6TDesC8 @ 17 NONAME
+	_ZN21RXIMPSrvContextClient5CloseEv @ 18 NONAME
+	_ZN21RXIMPSrvContextClient8ConnectLE4TUid @ 19 NONAME
+	_ZN21RXIMPSrvContextClientC1Ev @ 20 NONAME
+	_ZN21RXIMPSrvContextClientC2Ev @ 21 NONAME
+	_ZN24TXIMPProcessStartupParam3SetEii @ 22 NONAME
+	_ZN24TXIMPProcessStartupParamC1Ev @ 23 NONAME
+	_ZN24TXIMPProcessStartupParamC2Ev @ 24 NONAME
+	_ZNK21RXIMPSrvContextClient19GetContextFeaturesLEv @ 25 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/core/eabi/ximputilsu.def	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,34 @@
+EXPORTS
+	_ZN14NXIMPPrivPanic5PanicENS_7TReasonE @ 1 NONAME
+	_ZN15XIMPRBuf8Helper12ExternalizeLERK5RBuf8R12RWriteStream @ 2 NONAME
+	_ZN15XIMPRBuf8Helper12InternalizeLER5RBuf8R11RReadStream @ 3 NONAME
+	_ZN15XIMPRBuf8Helper12SetNewValueLER5RBuf8RK6TDesC8 @ 4 NONAME
+	_ZN15XIMPRBuf8Helper13GrowIfNeededLER5RBuf8i @ 5 NONAME
+	_ZN16TXIMPHBuf8Packer10PackArrayLERK13RPointerArrayI6HBufC8E @ 6 NONAME
+	_ZN16TXIMPHBuf8Packer12UnPackArrayLER13RPointerArrayI6HBufC8ERK6TDesC8 @ 7 NONAME
+	_ZN16XIMPRBuf16Helper12ExternalizeLERK6RBuf16R12RWriteStream @ 8 NONAME
+	_ZN16XIMPRBuf16Helper12InternalizeLER6RBuf16R11RReadStream @ 9 NONAME
+	_ZN16XIMPRBuf16Helper12SetNewValueLER6RBuf16RK7TDesC16 @ 10 NONAME
+	_ZN16XIMPRBuf16Helper13GrowIfNeededLER6RBuf16i @ 11 NONAME
+	_ZN21TXIMPRequestIdBuilder12SetRequestIdEm @ 12 NONAME
+	_ZN21TXIMPRequestIdBuilder12SetSessionIdEm @ 13 NONAME
+	_ZN21TXIMPRequestIdBuilder13SetProtocolIdEm @ 14 NONAME
+	_ZN21TXIMPRequestIdBuilderC1Ev @ 15 NONAME
+	_ZN21TXIMPRequestIdBuilderC2Ev @ 16 NONAME
+	_ZN22CXIMPSrvSessionAdapter12ServiceErrorERK9RMessage2i @ 17 NONAME
+	_ZN22CXIMPSrvSessionAdapter6ServerEv @ 18 NONAME
+	_ZN22CXIMPSrvSessionAdapter8ServiceLERK9RMessage2 @ 19 NONAME
+	_ZN22CXIMPSrvSessionAdapterC2ER8MXIMPSrv @ 20 NONAME
+	_ZN22CXIMPSrvSessionAdapterD0Ev @ 21 NONAME
+	_ZN22CXIMPSrvSessionAdapterD1Ev @ 22 NONAME
+	_ZN22CXIMPSrvSessionAdapterD2Ev @ 23 NONAME
+	_ZN22TXIMPBlockTraceHandler10NormalExitEv @ 24 NONAME
+	_ZN22TXIMPBlockTraceHandlerC1EPKt @ 25 NONAME
+	_ZN22TXIMPBlockTraceHandlerC2EPKt @ 26 NONAME
+	_ZN22TXIMPBlockTraceHandlerD1Ev @ 27 NONAME
+	_ZN22TXIMPBlockTraceHandlerD2Ev @ 28 NONAME
+	_ZN9XIMPTrace5TraceE11TRefByValueIK7TDesC16Ez @ 29 NONAME
+	_ZNK21TXIMPRequestIdBuilder14BuildRequestIdEv @ 30 NONAME
+	_ZTI22CXIMPSrvSessionAdapter @ 31 NONAME ; #<TI>#
+	_ZTV22CXIMPSrvSessionAdapter @ 32 NONAME ; #<VT>#
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/core/group/bld.inf	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  Build information file for project Presence Framework
+*
+*/
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+PRJ_MMPFILES
+ximputils.mmp
+ximpdatamodel.mmp
+ximpprocessor.mmp
+ximpoperations.mmp
+ximprootserver.mmp
+ximpserver.mmp
+ximpsrvclient.mmp
+ximpmanager.mmp
+ximpecomhook.mmp
+
+PRJ_TESTMMPFILES
+
+PRJ_TESTEXPORTS
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/core/group/ximpdatamodel.mmp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,103 @@
+/*
+* 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 XIMP Data Model
+*
+*/
+
+#include <platform_paths.hrh>
+#include <data_caging_paths.hrh>
+#include "../../group/ximpdlluids.hrh"
+
+
+
+TARGET                  ximpdatamodel.dll
+TARGETTYPE              dll
+UID                     XIMP_DLL_UID_STATIC_INTERFACE XIMP_DLL_UID_COMMON
+
+CAPABILITY              CAP_GENERAL_DLL
+VENDORID                VID_DEFAULT
+
+
+// ---------------------------------------------------------------------------
+SOURCEPATH              ../srcdatamodel
+// ---------------------------------------------------------------------------
+// API data objects
+SOURCE                  ximpfeatureinfoimp.cpp
+SOURCE                  ximpprotocolinfoimp.cpp
+SOURCE                  ximpserviceinfoimp.cpp
+SOURCE                  ximpcontextclientinfoimp.cpp
+SOURCE                  ximpcontextstateimp.cpp
+SOURCE                  ximpdatasubscriptionstateimp.cpp
+SOURCE                  ximpstatusimp.cpp
+SOURCE                  ximpidentityimp.cpp
+SOURCE                  ximprestrictedobjectcollectionimp.cpp
+SOURCE                  ximpobjectcollectionimp.cpp
+SOURCE                  ximpfeaturepluginholder.cpp
+
+
+// API data events
+SOURCE                  ximprequestcompleteeventimp.cpp
+SOURCE                  ximpcontextstateeventimp.cpp
+
+
+
+
+// ---------------------------------------------------------------------------
+SOURCEPATH              ../srcdatamodel
+// ---------------------------------------------------------------------------
+//Base classes for data types
+SOURCE                  ximpapiobjbase.cpp
+SOURCE                  ximpapieventbase.cpp
+SOURCE                  ximpeventcodec.cpp
+SOURCE                  ximpapidataobjbase.cpp
+SOURCE                  ximpapidataobjfactory.cpp
+SOURCE                  ximpsubscriptionitembase.cpp
+SOURCE                  ximpconfigurationitembase.cpp
+SOURCE                  ximpcontexteventfilter.cpp
+
+//Facade APIs to adaptation
+SOURCE                  ximpobjectfactoryimp.cpp
+
+
+
+
+
+USERINCLUDE             ../srcdatamodel
+USERINCLUDE             ../srcprocessor
+USERINCLUDE             ../srcoperations
+USERINCLUDE             ../../presence/srcpresencedatamodel
+USERINCLUDE             ../srcutils
+
+
+// TODO remove unnecessary
+SYSTEMINCLUDE           ../../inc/core/base
+SYSTEMINCLUDE           ../../inc/core/datamodel
+SYSTEMINCLUDE           ../../inc/core/protocolplugin
+SYSTEMINCLUDE           ../../inc/core/protocolpluginhost
+SYSTEMINCLUDE           ../../inc/presence/presencedatamodel
+SYSTEMINCLUDE           ../../inc/presence/presencemanagement
+SYSTEMINCLUDE           ../../inc/presence/presenceprotocolplugin
+SYSTEMINCLUDE           ../../inc/presence/presenceprotocolpluginhost
+MW_LAYER_SYSTEMINCLUDE
+
+
+LIBRARY                 euser.lib
+LIBRARY                 bafl.lib
+LIBRARY                 estor.lib
+LIBRARY                 ximputils.lib
+LIBRARY                 ecom.lib
+
+
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/core/group/ximpecomhook.mmp	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  Project definition file for ECom Hook
+*
+*/
+
+#include <platform_paths.hrh>
+#include <data_caging_paths.hrh>
+#include "../../group/ximpdlluids.hrh"
+
+
+
+TARGET                  ximpecomhook.dll
+CAPABILITY              CAP_ECOM_PLUGIN
+TARGETTYPE              PLUGIN
+UID                     XIMP_DLL_UID_ECOM_PLUGIN XIMP_DLL_UID_COMMON
+VENDORID                VID_DEFAULT
+
+
+SOURCEPATH              ../srcfrontend/srcecomhook
+START RESOURCE          ximpecomhook.rss
+TARGET                  ximpecomhook.rsc
+END
+
+
+SOURCEPATH              ../srcfrontend/srcecomhook
+SOURCE                  ximpecomhook.cpp
+
+
+USERINCLUDE             ../srcfrontend/srcmanager
+USERINCLUDE             ../../group
+USERINCLUDE             ../../core/srcdatamodel
+
+MW_LAYER_SYSTEMINCLUDE
+
+
+LIBRARY                 euser.lib
+LIBRARY                 ximpmanager.lib
+LIBRARY                 ecom.lib
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/core/group/ximpmanager.mmp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,67 @@
+/*
+* 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:  Project definition file for Presence Manager
+*
+*/
+
+#include <platform_paths.hrh>
+#include <data_caging_paths.hrh>
+#include "../../group/ximpdlluids.hrh"
+
+
+
+TARGET                  ximpmanager.dll
+TARGETTYPE              dll
+UID                     XIMP_DLL_UID_STATIC_INTERFACE XIMP_DLL_UID_COMMON
+
+CAPABILITY              CAP_GENERAL_DLL
+VENDORID                VID_DEFAULT
+
+
+SOURCEPATH              ../srcfrontend/srcmanager
+SOURCE                  ximpclientifsingleton.cpp
+SOURCE                  ximpcontextclientproxy.cpp
+SOURCE                  ximpcontexteventpump.cpp
+SOURCE                  ximpcntxteventobsarray.cpp
+SOURCE                  ximpclientimp.cpp
+SOURCE                  ximpcontextimp.cpp
+
+USERINCLUDE             ../srcfrontend/srcmanager
+USERINCLUDE             ../srcclient
+USERINCLUDE             ../srcutils
+USERINCLUDE             ../srcdatamodel
+USERINCLUDE             ../srcoperations
+USERINCLUDE             ../../presence/srcpresencedatamodel
+USERINCLUDE             ../../presence/srcpresencedatamodel/presencepublishing
+
+// TODO remove unnecessary
+SYSTEMINCLUDE           ../../inc/core/base
+SYSTEMINCLUDE           ../../inc/core/datamodel
+SYSTEMINCLUDE           ../../inc/core/protocolplugin
+SYSTEMINCLUDE           ../../inc/core/protocolpluginhost
+SYSTEMINCLUDE           ../../inc/presence/presencedatamodel
+SYSTEMINCLUDE           ../../inc/presence/presenceprotocolplugin
+SYSTEMINCLUDE           ../../inc/presence/presenceprotocolpluginhost
+MW_LAYER_SYSTEMINCLUDE
+
+
+LIBRARY                 euser.lib
+LIBRARY                 ecom.lib
+LIBRARY                 bafl.lib
+LIBRARY                 estor.lib
+LIBRARY                 ximputils.lib
+LIBRARY                 ximpdatamodel.lib
+LIBRARY                 ximpsrvclient.lib
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/core/group/ximpoperations.mmp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,92 @@
+/*
+* 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 PrFw presence operations
+*
+*/
+
+#include <platform_paths.hrh>
+#include <data_caging_paths.hrh>
+#include "../../group/ximpdlluids.hrh"
+
+
+
+
+TARGET                  ximpoperations.dll
+TARGETTYPE              dll
+UID                     XIMP_DLL_UID_STATIC_INTERFACE XIMP_DLL_UID_COMMON
+
+CAPABILITY              CAP_GENERAL_DLL
+VENDORID                VID_DEFAULT
+
+
+
+// ---------------------------------------------------------------------------
+SOURCEPATH              ../srcoperations
+// ---------------------------------------------------------------------------
+
+// Common infrastucture
+SOURCE                  ximpoperationfactoryimp.cpp
+
+
+
+
+// ---------------------------------------------------------------------------
+SOURCEPATH              ../srcoperations/sessionmng
+// ---------------------------------------------------------------------------
+
+// Client - session management
+SOURCE                  ximpoperationunbind.cpp
+SOURCE                  ximpoperationbind.cpp
+SOURCE                  ximpoperationbind2.cpp
+
+// Adaptation - session state notifications
+SOURCE                  ximpoperationforcedteardown.cpp
+
+// Internal - autonomous session maintenance
+
+
+
+USERINCLUDE             ../srcoperations
+USERINCLUDE             ../srcoperations/sessionmng
+USERINCLUDE             ../../core/srcdatamodel
+
+
+USERINCLUDE             ../srcutils
+USERINCLUDE             ../srcprocessor
+USERINCLUDE             ../../presence/srcpresenceoperations
+
+
+// TODO remove unnecessary
+SYSTEMINCLUDE           ../../inc/core/base
+SYSTEMINCLUDE           ../../inc/core/datamodel
+SYSTEMINCLUDE           ../../inc/core/protocolplugin
+SYSTEMINCLUDE           ../../inc/core/protocolpluginhost
+SYSTEMINCLUDE           ../../inc/presence/presencedatamodel
+SYSTEMINCLUDE           ../../inc/presence/presencemanagement
+SYSTEMINCLUDE           ../../inc/presence/presenceprotocolplugin
+SYSTEMINCLUDE           ../../inc/presence/presenceprotocolpluginhost
+MW_LAYER_SYSTEMINCLUDE
+
+
+
+LIBRARY                 euser.lib
+LIBRARY                 estor.lib
+LIBRARY                 ximputils.lib
+LIBRARY                 ximpdatamodel.lib
+LIBRARY                 ximpprocessor.lib
+LIBRARY                 presenceoperation.lib
+LIBRARY                 ecom.lib
+
+// End of file
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/core/group/ximpprocessor.mmp	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  Project definition file for Presence Framework
+*
+*/
+
+#include <platform_paths.hrh>
+#include <data_caging_paths.hrh>
+#include "../../group/ximpdlluids.hrh"
+
+
+
+TARGET                  ximpprocessor.dll
+TARGETTYPE              dll
+UID                     XIMP_DLL_UID_STATIC_INTERFACE XIMP_DLL_UID_COMMON
+
+
+CAPABILITY              CAP_GENERAL_DLL
+VENDORID                VID_DEFAULT
+
+
+SOURCEPATH              ../srcprocessor
+SOURCE                  ximpglobals.cpp
+SOURCE                  ximppluginfactory.cpp
+SOURCE                  ximpfeaturemanager.cpp
+SOURCE                  ximphostmanager.cpp
+SOURCE                  ximphostimp.cpp
+SOURCE                  ximppsccontextimp.cpp
+SOURCE                  ximpoperationbase.cpp
+SOURCE                  ximpprotocolrequestcompleteeventimp.cpp
+
+//Event system
+SOURCE                  ximpeventmanager.cpp
+SOURCE                  ximpeventcapsule.cpp
+SOURCE                  ximpcontexteventqueue.cpp
+
+SOURCEPATH              ../../presence/srcpresenceprocessor
+//Data host
+SOURCE                  protocolpresencedatahostimp.cpp
+SOURCE                  protocolpresenceauthorizationdatahostimp.cpp
+SOURCE                  protocolpresencepublishingdatahostimp.cpp
+SOURCE                  protocolpresencewatchingdatahostimp.cpp
+SOURCE                  protocolpresentitygroupsdatahostimp.cpp
+
+
+
+
+
+
+
+
+
+
+USERINCLUDE             ../srcprocessor
+USERINCLUDE             ../srcoperations
+USERINCLUDE             ../srcutils
+USERINCLUDE             ../../presence/srcpresenceprocessor
+USERINCLUDE             ../../core/srcdatamodel
+USERINCLUDE             ../../presence/srcpresenceoperations
+USERINCLUDE             ../../presence/srcpresencedatamodel
+USERINCLUDE             ../../presence/srcpresencedatamodel/presentitygroups
+USERINCLUDE             ../../presence/srcpresencedatamodel/presencewatching
+USERINCLUDE             ../../presence/srcpresencedatamodel/presenceauthorization
+USERINCLUDE             ../../presence/srcpresencedatamodel/presencepublishing
+USERINCLUDE             ../../group
+
+
+
+
+
+// TODO remove unnecessary
+SYSTEMINCLUDE           ../../inc/core/base
+SYSTEMINCLUDE           ../../inc/core/datamodel
+SYSTEMINCLUDE           ../../inc/core/protocolplugin
+SYSTEMINCLUDE           ../../inc/core/protocolpluginhost
+SYSTEMINCLUDE           ../../inc/presence/presencedatamodel
+SYSTEMINCLUDE           ../../inc/presence/presencemanagement
+SYSTEMINCLUDE           ../../inc/presence/presenceprotocolplugin
+SYSTEMINCLUDE           ../../inc/presence/presenceprotocolpluginhost
+MW_LAYER_SYSTEMINCLUDE
+
+
+LIBRARY                 euser.lib
+LIBRARY                 ecom.lib
+LIBRARY                 estor.lib
+LIBRARY                 centralrepository.lib
+LIBRARY                 bafl.lib
+LIBRARY                 ximputils.lib
+LIBRARY                 ximpdatamodel.lib
+LIBRARY                 presencedatamodel.lib
+LIBRARY					flogger.lib
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/core/group/ximprootserver.mmp	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  Project definition file for Presence Framework Root Server
+*
+*/
+
+#include <platform_paths.hrh>
+#include <data_caging_paths.hrh>
+#include "../../group/ximpdlluids.hrh"
+
+
+TARGET                  ximprootserver.exe
+TARGETTYPE              exe
+UID                     0x0     XIMP_EXE_UID_ROOT_SERVER
+
+CAPABILITY              CAP_SERVER
+VENDORID                VID_DEFAULT
+
+SOURCEPATH              ../srcrootserver
+SOURCE                  ximprootserver.cpp
+SOURCE                  ximprootserversessionadapter.cpp
+SOURCE                  ximprootsession.cpp
+
+USERINCLUDE             ../srcrootserver
+USERINCLUDE             ../srcprocessor
+USERINCLUDE             ../srcoperations
+USERINCLUDE             ../srcutils
+SYSTEMINCLUDE           ../../inc/core/base
+MW_LAYER_SYSTEMINCLUDE
+
+
+LIBRARY                 euser.lib
+LIBRARY                 ecom.lib
+LIBRARY                 ximputils.lib
+LIBRARY                 ximpprocessor.lib
+LIBRARY                 ximpoperations.lib
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/core/group/ximpserver.mmp	Wed Nov 03 09:32:20 2010 +0530
@@ -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 Presence Framework PSC Server
+*
+*/
+
+#include <platform_paths.hrh>
+#include <data_caging_paths.hrh>
+#include "../../group/ximpdlluids.hrh"
+
+TARGET                  ximpserver.exe
+TARGETTYPE              exe
+UID                     0x0     XIMP_EXE_UID_PROTOCOL_CONNECTION_SERVER
+
+CAPABILITY              CAP_SERVER
+VENDORID                VID_DEFAULT
+EPOCSTACKSIZE           0x5000 // 20KB
+SOURCEPATH              ../srcpscserver
+SOURCE                  ximpserver.cpp
+SOURCE                  ximpserversessionadapter.cpp
+SOURCE                  ximpcontextsession.cpp
+
+
+USERINCLUDE             ../srcpscserver
+USERINCLUDE             ../srcprocessor
+USERINCLUDE             ../srcoperations
+USERINCLUDE             ../../core/srcdatamodel
+USERINCLUDE             ../../presence/srcpresencedatamodel
+USERINCLUDE             ../../presence/srcpresencedatamodel/presentitygroups
+USERINCLUDE             ../../presence/srcpresencedatamodel/presencewatching
+USERINCLUDE             ../../presence/srcpresencedatamodel/presenceauthorization
+USERINCLUDE             ../../presence/srcpresencedatamodel/presencepublishing
+USERINCLUDE             ../srcutils
+SYSTEMINCLUDE           ../../inc/core/base
+SYSTEMINCLUDE           ../../inc/core/datamodel
+SYSTEMINCLUDE           ../../inc/core/protocolplugin
+
+
+MW_LAYER_SYSTEMINCLUDE
+
+
+LIBRARY                 euser.lib
+LIBRARY                 estor.lib
+LIBRARY                 ecom.lib
+LIBRARY                 ximputils.lib
+LIBRARY                 ximpdatamodel.lib
+LIBRARY                 ximpprocessor.lib
+LIBRARY                 ximpoperations.lib
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/core/group/ximpsrvclient.mmp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,49 @@
+/*
+* 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 Presence Framework Server Client
+*
+*/
+
+// To get the MW_LAYER_SYSTEMINCLUDE-definition
+#include <platform_paths.hrh>
+
+#include <data_caging_paths.hrh>
+
+#include "../../group/ximpdlluids.hrh"
+
+
+TARGET                  ximpsrvclient.dll
+TARGETTYPE              dll
+UID                     XIMP_DLL_UID_STATIC_INTERFACE XIMP_DLL_UID_COMMON
+
+CAPABILITY              CAP_GENERAL_DLL
+VENDORID                VID_DEFAULT
+
+SOURCEPATH              ../srcclient
+SOURCE                  ximpprocessstarter.cpp
+SOURCE                  ximpsrvrootclient.cpp
+SOURCE                  ximpsrvcontextclient.cpp
+
+USERINCLUDE             ../srcutils
+USERINCLUDE             ../srcclient
+USERINCLUDE             ../srcpscserver
+USERINCLUDE             ../srcrootserver
+// Default system include paths for middleware layer modules.
+MW_LAYER_SYSTEMINCLUDE
+
+
+LIBRARY                 euser.lib   // base
+LIBRARY                 estor.lib   // streams
+LIBRARY                 efsrv.lib   // file server
+LIBRARY                 ximputils.lib
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/core/group/ximputils.mmp	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  Project definition file for Presence Framework Utils
+*
+*/
+
+#include <platform_paths.hrh>
+#include <data_caging_paths.hrh>
+#include "../../group/ximpdlluids.hrh"
+
+
+
+TARGET                  ximputils.dll
+TARGETTYPE              dll
+UID                     XIMP_DLL_UID_STATIC_INTERFACE XIMP_DLL_UID_COMMON
+
+CAPABILITY              CAP_GENERAL_DLL
+VENDORID                VID_DEFAULT
+
+
+SOURCEPATH              ../srcutils
+SOURCE                  ximpsrvsessionadapter.cpp
+SOURCE                  ximpsrvmessageimp.cpp
+SOURCE                  ximprequestidbuilder.cpp
+
+//Trace services
+SOURCE                  ximptrace.cpp
+
+//Common helpers
+SOURCE                  ximprbufhelpers.cpp
+SOURCE                  ximpobjecthelpers.cpp
+SOURCE                  ximppanics.cpp
+
+// TODO remove unnecessary
+USERINCLUDE             ../srcutils
+USERINCLUDE             ../../core/srcdatamodel
+SYSTEMINCLUDE           ../../inc/presence/presencedatamodel
+SYSTEMINCLUDE           ../../inc/core/datamodel
+MW_LAYER_SYSTEMINCLUDE
+
+
+LIBRARY                 euser.lib   // base
+LIBRARY                 estor.lib   // streams
+LIBRARY                 flogger.lib
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/core/srcclient/ximpprocessstarter.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,396 @@
+/*
+* 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:  XIMP Framework process starter implementation.
+*
+*/
+
+
+//  INCLUDE FILES
+#include "ximpprocessstarter.h"
+#include <e32std.h>
+#include <f32file.h>
+
+
+// CONSTANTS
+_LIT( KEka2ExeDir,"\\sys\\bin\\");
+_LIT( KEka2LaunchMutexExt, "[lMtx]" );
+const TInt KEka2SrvConnTries = 7;               // Try to start 7 times
+                                                // before giving up
+const TInt KEka2SrvConnInitialRetryWait = 500;  // MicroSeconds => 0.0005s
+
+
+
+// ==============================================================
+// ====================== HELPER CLASS ==========================
+// ==============================================================
+
+/**
+ * RSessionBase accessor to give to the XIMPProcessStarter
+ * access to RSessionBase::CreateSession().
+ */
+class REka2SessionBaseAccessor : public RSessionBase
+    {
+    public: // Constructor
+        inline REka2SessionBaseAccessor()
+            {
+            }
+
+    public: // New functions
+
+        /**
+         * Public access to RSessionBase::CreateSession().
+         */
+        inline TInt CreateSession( const TDesC& aServer,
+                                   const TVersion& aVersion,
+                                   TInt aAsyncMessageSlots )
+            {
+            return RSessionBase::CreateSession( aServer,
+                                                aVersion,
+                                                aAsyncMessageSlots );
+            }
+    };
+
+
+// ==============================================================
+// ====================== PROCESSSTARTER ========================
+// ==============================================================
+
+
+// --------------------------------------------------------------
+// XIMPProcessStarter::FullExePathForClienLocation()
+// --------------------------------------------------------------
+//
+EXPORT_C void XIMPProcessStarter::FullExePathForClienLocation(
+    const TDesC& aExeName,
+    TFileName& aFullExePath )
+    {
+    //Get drive (C:) where this client code is installed
+        {
+        TFileName tmp;
+        Dll::FileName( tmp );
+        aFullExePath.Copy( TParsePtrC( tmp ).Drive() );
+        }
+
+    //Build the rest from the exe path
+    aFullExePath.Append( KEka2ExeDir );
+    aFullExePath.Append( aExeName );
+    }
+
+
+// --------------------------------------------------------------
+// XIMPProcessStarter::StartInstance()
+// --------------------------------------------------------------
+//
+EXPORT_C TInt XIMPProcessStarter::StartInstance(
+    const TDesC& aFullExePath,
+    const TDesC& aCommand,
+    const TArray< TXIMPProcessStartupParam >* aParams )
+    {
+    RMutex launchMutex;
+    TInt error = KErrNotFound;
+
+        {
+        // Dynamic mutex name used to allow code share
+        TName launchMutexName( TParsePtrC( aFullExePath ).Name() );
+        launchMutexName.Append( KEka2LaunchMutexExt );
+
+        // Open or Create mutex to serialize to access to server startup code.
+        // (race condition safe way)
+        while( error == KErrNotFound )
+            {
+            error = launchMutex.CreateGlobal( launchMutexName );
+            if( error != KErrAlreadyExists )
+                {
+                break;
+                }
+            error = launchMutex.OpenGlobal( launchMutexName );
+            }
+
+        if( error != KErrNone )
+            {
+            return error;
+            }
+        }
+
+
+    launchMutex.Wait();
+
+    //Serialized access
+    error = XIMPProcessStarter::DoStartInstance( aFullExePath,
+                                             aCommand,
+                                             aParams );
+
+    launchMutex.Signal();
+    launchMutex.Close();
+
+    return error;
+    }
+
+
+// --------------------------------------------------------------
+// XIMPProcessStarter::ConnectToServer()
+// --------------------------------------------------------------
+//
+EXPORT_C TInt XIMPProcessStarter::ConnectToServer(
+    const TDesC& aFullExePath,
+    const TDesC& aCommand,
+    const TArray< TXIMPProcessStartupParam >* aParams,
+    RSessionBase& aSessionToConnect,
+    const TDesC& aServerName,
+    const TVersion& aClientVersion,
+    TInt aAsyncMessageSlots )
+    {
+    if( aSessionToConnect.Handle() != KNullHandle )
+        {
+        return KErrInUse;
+        }
+
+    TInt err = KErrNone;
+    TInt startupWait = KEka2SrvConnInitialRetryWait;
+
+    //Server connect and launch loop
+    for( TInt trie = 0 ; trie < KEka2SrvConnTries ; trie++ )
+        {
+        REka2SessionBaseAccessor acc;
+        err = acc.CreateSession( aServerName,
+                                 aClientVersion,
+                                 aAsyncMessageSlots );
+
+        if( err == KErrNone )
+            {
+            //session ownership is now on client
+            aSessionToConnect = acc;
+            return KErrNone;
+            }
+
+        else if( ( err == KErrNotFound ) ||
+                 ( err == KErrServerTerminated ) )
+            {
+            //Server missing or died when connecting
+            //Start a new server
+            err = XIMPProcessStarter::StartInstance( aFullExePath,
+                                                     aCommand,
+                                                     aParams );
+
+            //If process exist already, then all is fine
+            //(some other process started it between the origical connect and launch trie)
+            if( err == KErrAlreadyExists )
+                {
+                err = KErrNone;
+                }
+
+            //If server process start failed, bail out.
+            if( err != KErrNone )
+                {
+                return err;
+                }
+
+            //If this is 2nd or subsequent try,
+            //give some time for server to startup
+            if( trie > 0 )
+                {
+                User::After( startupWait ); // CSI: 92 #
+                startupWait = 2 * startupWait;
+                }
+            }
+
+        else
+            {
+            //Server process start failed. Bail out.
+            return err;
+            }
+        }
+
+    return err;
+    }
+
+
+// --------------------------------------------------------------
+// XIMPProcessStarter::DoStartServerInstance()
+// --------------------------------------------------------------
+//
+TInt XIMPProcessStarter::DoStartInstance(
+    const TDesC& aFullExePath,
+    const TDesC& aCommand,
+    const TArray< TXIMPProcessStartupParam >* aParams )
+    {
+    TInt error = KErrNone;
+
+    //Create process
+    RProcess process;
+    error = process.Create( aFullExePath, aCommand );
+
+    if( error == KErrNone )
+        {
+        //Set process startup parameters
+        error = ApplyParameters( aParams, process );
+
+        //And execute the process and wait it's startup
+       if( error == KErrNone )
+            {
+            TRequestStatus rendezvousStatus;
+            process.Rendezvous( rendezvousStatus );
+
+            process.Resume();
+            User::WaitForRequest( rendezvousStatus ); // CSI: 94 #
+            error = rendezvousStatus.Int();
+
+            if( process.ExitType() != EExitPending )
+                {
+                //Something failed in server startup
+                //Force the error code to be always something
+                //else than KErrNone
+                if( error == KErrNone )
+                    {
+                    error = KErrServerTerminated;
+                    }
+                }
+            }
+        }
+
+    process.Close();
+
+    return error;
+    }
+
+
+// --------------------------------------------------------------
+// XIMPProcessStarter::ApplyParameters()
+// --------------------------------------------------------------
+//
+TInt XIMPProcessStarter::ApplyParameters(
+    const TArray< TXIMPProcessStartupParam >* aParams,
+    RProcess& aProcess )
+    {
+    TInt error = KErrNone;
+    if( aParams )
+        {
+        const TInt paramCount = aParams->Count();
+        for( TInt ix = 0; ix < paramCount; ix++ )
+            {
+            error = (*aParams)[ ix ].ApplyParam( aProcess );
+            if( error != KErrNone )
+                {
+                break;
+                }
+            }
+        }
+
+    return error;
+    }
+
+
+// ==============================================================
+// ================== TPROCESSSTARTUPPARAM ======================
+// ==============================================================
+
+// --------------------------------------------------------------
+// TXIMPProcessStartupParam::TXIMPProcessStartupParam()
+// --------------------------------------------------------------
+//
+EXPORT_C TXIMPProcessStartupParam::TXIMPProcessStartupParam()
+    : iType( EUnknown ),
+      iSlot( KErrNotFound )
+    {
+    }
+
+
+// --------------------------------------------------------------
+// TXIMPProcessStartupParam::Set()
+// --------------------------------------------------------------
+//
+void TXIMPProcessStartupParam::Set( TInt aSlot,
+                                const RHandleBase& aHandle )
+    {
+    iType = EHandle;
+    iSlot = aSlot;
+    iHandle = &aHandle;
+    }
+
+
+// --------------------------------------------------------------
+// TXIMPProcessStartupParam::Set()
+// --------------------------------------------------------------
+//
+void TXIMPProcessStartupParam::Set( TInt aSlot,
+                                const RSubSessionBase& aSubSession )
+    {
+    iType = ESubSession;
+    iSlot = aSlot;
+    iSubSession = &aSubSession;
+    }
+
+
+// --------------------------------------------------------------
+// TXIMPProcessStartupParam::Set()
+// --------------------------------------------------------------
+//
+void TXIMPProcessStartupParam::Set( TInt aSlot,
+                                const TDesC16& aDes )
+    {
+    iType = EDes16;
+    iSlot = aSlot;
+    iDes16.Set( aDes );
+    }
+
+
+// --------------------------------------------------------------
+// TXIMPProcessStartupParam::Set()
+// --------------------------------------------------------------
+//
+void TXIMPProcessStartupParam::Set( TInt aSlot,
+                                const TDesC8& aDes )
+    {
+    iType = EDes8;
+    iSlot = aSlot;
+    iDes8.Set( aDes );
+    }
+
+
+// --------------------------------------------------------------
+// TXIMPProcessStartupParam::Set()
+// --------------------------------------------------------------
+//
+EXPORT_C void TXIMPProcessStartupParam::Set( TInt aSlot,
+                                TInt aInt )
+    {
+    iType = EInt;
+    iSlot = aSlot;
+    iInt = aInt;
+    }
+
+
+// --------------------------------------------------------------
+// TXIMPProcessStartupParam::ApplyParam()
+// --------------------------------------------------------------
+//
+TInt TXIMPProcessStartupParam::ApplyParam( RProcess& aProcess ) const
+    {
+    switch( iType )
+        {
+        case EHandle: return aProcess.SetParameter( iSlot, *iHandle );
+        case ESubSession: return aProcess.SetParameter( iSlot, *iSubSession );
+        case EDes16: return aProcess.SetParameter( iSlot, iDes16 );
+        case EDes8: return aProcess.SetParameter( iSlot, iDes8 );
+        case EInt: return aProcess.SetParameter( iSlot, iInt );
+        }
+
+    return KErrUnknown;
+    }
+
+
+// END OF FILE
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/core/srcclient/ximpprocessstarter.h	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  XIMP Framework process starter.
+*
+*/
+
+#ifndef XIMPPROCESSSTARTER_H
+#define XIMPPROCESSSTARTER_H
+
+#include <e32std.h>
+class TXIMPProcessStartupParam;
+
+
+
+/**
+ *
+ *
+ *
+ *
+ * @lib ?library
+ * @since S60 v4.0
+ */
+class XIMPProcessStarter
+    {
+public:     // New methods
+    /**
+     *
+     *
+     *
+     *
+     */
+    IMPORT_C static void FullExePathForClienLocation(
+                    const TDesC& aExeName,
+                    TFileName& aFullExePath );
+
+    /**
+     *
+     * Usage example:
+     * TFixedArray< TXIMPProcessStartupParam, 2 > params;
+     * params[ 0 ].Set( 1, 1001 );
+     * params[ 2 ].Set( 2, _L("value") );
+     * TArray< TXIMPProcessStartupParam> paramsArray = params.Array();
+     * TInt err = XIMPProcessStarter::StartInstance( KMySrvServerExe,
+     *                                          _L("command line"),
+     *                                           &paramsArray );
+     */
+    IMPORT_C static TInt StartInstance(
+                    const TDesC& aFullExePath,
+                    const TDesC& aCommand,
+                    const TArray< TXIMPProcessStartupParam >* aParams );
+
+
+    /**
+     *
+     *
+     *
+     *
+     */
+    IMPORT_C static TInt ConnectToServer(
+                    const TDesC& aFullExePath,
+                    const TDesC& aCommand,
+                    const TArray< TXIMPProcessStartupParam >* aParams,
+                    RSessionBase& aSessionToConnect,
+                    const TDesC& aServerName,
+                    const TVersion& aClientVersion,
+                    TInt aAsyncMessageSlots );
+
+
+
+private:    // Helpers
+    static TInt DoStartInstance(
+                    const TDesC& aFullExePath,
+                    const TDesC& aCommand,
+                    const TArray< TXIMPProcessStartupParam >* aParams );
+
+        static TInt ApplyParameters(
+                        const TArray< TXIMPProcessStartupParam >* aParams,
+                        RProcess& aProcess );
+
+    };
+
+
+
+
+/**
+ * Generic process startup parameters.
+ *
+ *
+ *
+ */
+class TXIMPProcessStartupParam
+    {
+public:
+
+    /**
+     * C++ constructor
+     */
+    IMPORT_C TXIMPProcessStartupParam();
+
+    /**
+     *
+     */
+    void Set( TInt aSlot, const RHandleBase& aHandle );
+    void Set( TInt aSlot, const RSubSessionBase& aSubSession );
+    void Set( TInt aSlot, const TDesC16& aDes );
+    void Set( TInt aSlot, const TDesC8& aDes );
+    IMPORT_C void Set( TInt aSlot, TInt aInt );
+
+
+    /**
+     *
+     *
+     * @return
+     */
+    TInt ApplyParam( RProcess& aProcess ) const;
+
+
+
+private: //data
+
+    enum TParamType{ EUnknown, EHandle, ESubSession,
+                     EDes16, EDes8, EInt };
+    //OWN:
+    TParamType iType;
+
+    //OWN:
+    TInt iSlot;
+
+    //OWN:
+    const RHandleBase* iHandle;
+    const RSubSessionBase* iSubSession;
+    TPtrC16 iDes16;
+    TPtrC8 iDes8;
+    TInt iInt;
+    };
+
+
+#endif      //  XIMPPROCESSSTARTER_H
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/core/srcclient/ximpsrvcontextclient.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  XIMP Framework PSC Server context session.
+ *
+*/
+
+#include "ximpsrvcontextclient.h"
+#include "ximpprocessstarter.h"
+#include "ximpserverdefs.h"
+
+#include <e32base.h>
+
+//Import NXIMPSrv
+using namespace NXIMPSrv;
+
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// RXIMPSrvContextClient::RXIMPSrvContextClient()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C RXIMPSrvContextClient::RXIMPSrvContextClient()
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// RXIMPSrvContextClient::Connect()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void RXIMPSrvContextClient::ConnectL( TUid aProtocolImpUid )
+    {
+    iMyUid = aProtocolImpUid;
+
+    // create the server name: "!XIMPCtxSrv9bde667a" 
+    HBufC* serverName = HBufC::NewLC( NName::KSymbianServer().Length() + 
+            NStartupParam::KProtocolUidMaxLen + 
+            1 );
+
+    serverName->Des().Copy( NName::KSymbianServer );
+    serverName->Des().AppendNumFixedWidth( iMyUid.iUid, 
+            EHex, 
+            NStartupParam::KProtocolUidMaxLen );
+
+    // Pass the UID to server side.
+    // For security reasons it was not allowed to pass the complete 
+    // server name descriptor but just the UID part
+    RArray< TXIMPProcessStartupParam > params;
+    CleanupClosePushL( params );
+
+    TXIMPProcessStartupParam paramUid;
+    paramUid.Set( NStartupParam::KProtocolUidIndex, 
+            iMyUid.iUid );
+
+    User::LeaveIfError( params.Append( paramUid ) );
+    TArray< TXIMPProcessStartupParam > array = params.Array();
+
+
+    //Get path to correct exe to launch
+    TFileName fullExePath;
+    XIMPProcessStarter::FullExePathForClienLocation( NName::KExecutable,
+            fullExePath );
+
+    //Create a connection
+    TInt ret = XIMPProcessStarter::ConnectToServer( fullExePath,
+            KNullDesC,
+            &array,
+            *this,
+            *serverName,
+            TVersion( NVersion::KMajor,
+                      NVersion::KMinor,
+                      NVersion::KBuild ),
+                      NRequest::KMsgSlotCount );
+    User::LeaveIfError( ret );
+    CleanupStack::PopAndDestroy( 2, serverName ); // params, serverName
+
+    //Mutate the server side session to correct type
+    User::LeaveIfError( SendReceive( NRequest::EBecomeCtxSession ) );
+    }
+
+
+
+// ---------------------------------------------------------------------------
+// RXIMPSrvContextClient::Close()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void RXIMPSrvContextClient::Close()
+    {
+    RSessionBase::Close();
+    #if _BullseyeCoverage
+    cov_write();
+    #endif
+    }
+
+
+// ---------------------------------------------------------------------------
+// RXIMPSrvContextClient::DoQueueOperation()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt RXIMPSrvContextClient::DoQueueOperation(
+    TInt aOperationType, 
+    const TDesC8& aOperationParams,
+    TXIMPRequestId& aReqId )
+    {
+    TPckgBuf< TXIMPRequestId > reqIdPck;
+
+    TIpcArgs msgArgs;
+    msgArgs.Set( 0, aOperationType );
+    msgArgs.Set( 1, &aOperationParams );
+    msgArgs.Set( 2, &reqIdPck );
+
+    TInt err = SendReceive( NRequest::ECtxSsQueueOperation, msgArgs );
+
+    aReqId = reqIdPck();
+    return err;
+    }
+
+// ---------------------------------------------------------------------------
+// RXIMPSrvContextClient::DoQueueOperation2()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt RXIMPSrvContextClient::DoQueueOperation2(
+    TInt aOperationType, 
+    const TDesC8& aOperationParams,
+    TXIMPRequestId& aReqId )
+    {
+    TPckgBuf< TXIMPRequestId > reqIdPck;
+
+    TIpcArgs msgArgs;
+    msgArgs.Set( 0, aOperationType );
+    msgArgs.Set( 1, &aOperationParams );
+    msgArgs.Set( 2, &reqIdPck );
+
+    TInt err = SendReceive( NRequest::ECtxSsQueueBindOperation, msgArgs );
+    aReqId = reqIdPck();
+    return err;
+    }
+
+// ---------------------------------------------------------------------------
+// RXIMPSrvContextClient::GetContextCapabilitiesL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C HBufC8* RXIMPSrvContextClient::GetContextFeaturesL() const
+    {
+    return PrepareAndGetDataL( NRequest::ECtxSsPrepareContextFeatures );
+    }
+
+
+// ---------------------------------------------------------------------------
+// RXIMPSrvContextClient::ListenEvent()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void RXIMPSrvContextClient::ListenEvent( TRequestStatus& aStatus )
+    {
+    SendReceive( NRequest::ECtxSsSetEventListenScout, aStatus );
+    }
+
+
+// ---------------------------------------------------------------------------
+// RXIMPSrvContextClient::CancelListening()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void RXIMPSrvContextClient::CancelListening()
+    {
+    SendReceive( NRequest::ECtxSsCancelEventListenScout );
+    }
+
+
+// ---------------------------------------------------------------------------
+// RXIMPSrvContextClient::InstallEventFilterL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void RXIMPSrvContextClient::InstallEventFilterL(
+        const TDesC8& aFilterData )
+    {
+    TIpcArgs msgArgs;
+    msgArgs.Set( 0, &aFilterData );
+    User::LeaveIfError( SendReceive( NRequest::ECtxSsInstallEventFilter, 
+                                     msgArgs ) );
+    }
+
+
+// ---------------------------------------------------------------------------
+// RXIMPSrvContextClient::FetchTopEventDataLC()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C HBufC8* RXIMPSrvContextClient::FetchTopEventDataLC()
+    {
+    TInt bufSize = SendReceive( NRequest::ECtxSsFetchTopEventDataSize );
+    User::LeaveIfError( bufSize );
+
+    HBufC8* eventBuf = HBufC8::NewLC( bufSize );
+    TPtr8 ptrBuf( eventBuf->Des() );
+
+    TIpcArgs msgArgs;
+    msgArgs.Set( 0, &ptrBuf );
+
+    User::LeaveIfError( SendReceive( NRequest::ECtxSsFetchTopEventData, 
+                                     msgArgs ) );
+    return eventBuf;
+    }
+
+
+// ---------------------------------------------------------------------------
+// RXIMPSrvContextClient::FetchTopEventReqId()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt RXIMPSrvContextClient::FetchTopEventReqId( 
+    TXIMPRequestId& aReqId )
+    {
+    TPckgBuf< TXIMPRequestId > reqIdPck;
+
+    TIpcArgs msgArgs;
+    msgArgs.Set( 0, &reqIdPck );
+
+    TInt err = SendReceive( NRequest::ECtxSsFetchTopEventReqId, msgArgs );
+
+    aReqId = reqIdPck();
+    return err;
+    }
+
+
+
+// ---------------------------------------------------------------------------
+// RXIMPSrvContextClient::DropTopEvent()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt RXIMPSrvContextClient::DropTopEvent()
+    {
+    TInt err = SendReceive( NRequest::ECtxSsDropTopEvent );
+    return err;
+    }
+
+
+
+// ---------------------------------------------------------------------------
+// RXIMPSrvContextClient::PrepareAndGetDataL()
+// ---------------------------------------------------------------------------
+//
+HBufC8* RXIMPSrvContextClient::PrepareAndGetDataL( TInt aMsg ) const
+    {
+    TInt bufSize = SendReceive( aMsg );
+    User::LeaveIfError( bufSize );
+
+    HBufC8* buf = HBufC8::NewLC( bufSize );
+    TPtr8 ptrBuf( buf->Des() );
+
+    TIpcArgs msgArgs;
+    msgArgs.Set( 0, &ptrBuf );
+
+    User::LeaveIfError( SendReceive( NRequest::ECtxSsGetPreparedData, 
+                                     msgArgs ) );
+
+    CleanupStack::Pop( buf );
+    return buf;
+    }
+
+
+// End of file
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/core/srcclient/ximpsrvcontextclient.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,174 @@
+/*
+* 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:  XIMP Framework PSC Server context session.
+ *
+*/
+
+#ifndef XIMPSRVCONTEXTCLIENT_H__
+#define XIMPSRVCONTEXTCLIENT_H__
+
+#include <e32std.h>
+#include <ximpbase.h>
+
+
+class CXIMPContextEventFilter;
+class CXIMPServiceInfoImp;
+class CXIMPFeatureInfoImp;
+class CBufFlat;
+
+
+/**
+ * XIMP Framework server context session.
+ *
+ * @lib ximpsrvclient.dll
+ * @since S60 v3.2
+ */
+class RXIMPSrvContextClient : public RSessionBase
+    {
+    public:
+
+        /**
+         * Default constructor.
+         */
+        IMPORT_C RXIMPSrvContextClient();
+
+
+        /**
+         * Session connection method.
+         * @param aProtocolImpUid The UID of protocol to associate with 
+         *        this context client.
+         */
+        IMPORT_C void ConnectL( TUid aProtocolImpUid );
+
+
+        /**
+         * Closes server connection.
+         */
+        IMPORT_C void Close();
+
+
+        /**
+         * Issues context operation request to server.
+         *
+         * @param aOperationType In parameter identifying the operation.
+         * @param aOperationParams In parameter package for operation.
+         * @param aReqId Request ID identifying started request.         
+         * @return Error from issuing the request.
+         */
+        IMPORT_C TInt DoQueueOperation(
+                TInt aOperationType, 
+                const TDesC8& aOperationParams, 
+                TXIMPRequestId& aReqId );
+         
+
+        /**
+         * Issues context operation request to server.
+         * To be used when binding with settings id
+         *
+         * @param aOperationType In parameter identifying the operation.
+         * @param aOperationParams In parameter package for operation.
+         * @param aReqId Request ID identifying started request.         
+         * @return Error from issuing the request.
+         */
+        IMPORT_C TInt DoQueueOperation2(
+                TInt aOperationType, 
+                const TDesC8& aOperationParams, 
+                TXIMPRequestId& aReqId );
+
+        /**
+         * Gets presence contexts features.
+         *
+         * @return Presence context features as an externalized
+         * CXIMPFeatureInfoImp. Object ownership is returned to caller.
+         */
+        IMPORT_C HBufC8* GetContextFeaturesL() const;
+
+
+        /**
+         * Issues asynchronous request to listen presence context
+         * events.
+         *
+         * @param aStatus Request status to complete
+         *                when new event object is available.
+         */
+        IMPORT_C void ListenEvent( TRequestStatus& aStatus );
+
+
+        /**
+         * Cancels event listen request.
+         */
+        IMPORT_C void CancelListening();
+        
+        
+        /**
+         * Installs new event filter for presence context event queue.
+         *
+         * @return aFilterData Event filter data to use.
+         */
+        IMPORT_C void InstallEventFilterL( const TDesC8& aFilterData );
+
+
+        /**
+         * Gets event data from event queue.
+         *
+         * @return Event object data from event queue.
+         *         Object ownership is returned to caller.
+         *         Leaves with KErrNotFound if there isn't
+         *         any event available in event queue.
+         */
+        IMPORT_C HBufC8* FetchTopEventDataLC();
+        
+        
+        /**
+         * Fetch top event req id.
+         *
+         * @param aReqId On the return contains, the top event req id. 
+         *
+         * @return Error from req id fetch. 
+         */
+        IMPORT_C TInt FetchTopEventReqId( TXIMPRequestId& aReqId );
+
+        
+        /**
+         * Drops top event from event queue.
+         *
+         * @return Error from drop. 
+         */
+        IMPORT_C TInt DropTopEvent();
+
+
+    private:
+
+        /**
+         * Helper to prepare and get data from server side.
+         *
+         * @return Externalized object to be passed onward
+         */
+        HBufC8* PrepareAndGetDataL( TInt aMsg ) const;
+
+
+    private:
+
+        /**
+         * UID of the used protocol.
+         */
+        TUid iMyUid;
+
+    };
+
+
+#endif      //  XIMPSRVCONTEXTCLIENT_H__
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/core/srcclient/ximpsrvrootclient.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  XIMP Framework server root client implementation
+*
+*/
+
+
+//  INCLUDE FILES
+#include "ximpbase.h"
+#include "ximpsrvrootclient.h"
+#include "ximpprocessstarter.h"
+#include "ximprootserverdefs.h"
+
+#include <e32base.h>
+#include <s32mem.h>
+
+
+//Include Root server namespace
+using namespace NRootSrv;
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// RXIMPSrvRootClient::RXIMPSrvRootClient()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C RXIMPSrvRootClient::RXIMPSrvRootClient()
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// RXIMPSrvRootClient::Connect()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt RXIMPSrvRootClient::Connect()
+    {
+    TFileName fullExePath;
+    XIMPProcessStarter::FullExePathForClienLocation( NName::KExecutable,
+                                                     fullExePath );
+
+    TInt ret = XIMPProcessStarter::ConnectToServer( fullExePath,
+                                            KNullDesC,
+                                            NULL,
+                                            *this,
+                                            NName::KSymbianServer,
+                                            TVersion( NVersion::KMajor,
+                                                      NVersion::KMinor,
+                                                      NVersion::KBuild ),
+                                            NRequest::KMsgSlotCount );
+
+    if ( ret == KErrNone )
+        {
+        TIpcArgs msgArgs;
+        ret = SendReceive( NRequest::EBecomeRootSession, msgArgs );
+        }
+
+    return ret;
+    }
+
+
+// ---------------------------------------------------------------------------
+// RXIMPSrvRootClient::Close()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void RXIMPSrvRootClient::Close()
+    {
+    RSessionBase::Close();
+    #if _BullseyeCoverage
+    cov_write();
+    #endif
+    }
+
+
+// ---------------------------------------------------------------------------
+// RXIMPSrvRootClient::GetProtocolListL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C HBufC8* RXIMPSrvRootClient::GetKnownProtocolsL()
+    {
+    return GetDataL( NRequest::ERootSsPrepareProtocolList );
+    }
+
+
+// ---------------------------------------------------------------------------
+// RXIMPSrvRootClient::GetSupportedFrameworkFeaturesL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C HBufC8* RXIMPSrvRootClient::GetSupportedFrameworkFeaturesL()
+    {
+    return GetDataL( NRequest::ERootSsPrepareSupportedFeatures );
+    }
+
+
+// ---------------------------------------------------------------------------
+// RXIMPSrvRootClient::GetDataL()
+// ---------------------------------------------------------------------------
+//
+HBufC8* RXIMPSrvRootClient::GetDataL( TInt aMsg )
+    {
+    TInt bufSize = SendReceive( aMsg );
+    User::LeaveIfError( bufSize );
+
+    HBufC8* buf = HBufC8::NewLC( bufSize );
+    TPtr8 ptrBuf( buf->Des() );
+
+    TIpcArgs msgArgs;
+    msgArgs.Set( 0, &ptrBuf );
+
+    User::LeaveIfError( SendReceive( NRequest::ERootSsFetchServerSideData, msgArgs ) );
+
+    CleanupStack::Pop( buf );
+    return buf;
+    }
+
+
+// End of file
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/core/srcclient/ximpsrvrootclient.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,88 @@
+/*
+* 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:  XIMP Framework server root session.
+*
+*/
+
+#ifndef XIMPSRVROOTCLIENT_H__
+#define XIMPSRVROOTCLIENT_H__
+
+#include <ximpbase.h>
+#include <e32std.h>
+
+
+/**
+ * XIMP Framework server root session.
+ *
+ * @lib ximpsrvclient.dll
+ * @since S60 v3.2
+ */
+class RXIMPSrvRootClient : public RSessionBase
+    {
+public:
+
+    /**
+     * Default constructor.
+     */
+    IMPORT_C RXIMPSrvRootClient();
+
+
+    /**
+     * Session connection method.
+     *
+     * @return Error code from creating server connection.
+     */
+    IMPORT_C TInt Connect();
+
+
+    /**
+     * Closes server connection.
+     */
+    IMPORT_C void Close();
+
+
+    /**
+     * Retrieves a list of known protocols and their details.
+     *
+     * @return Externalized version of
+     * RXIMPObjOwningPtrArray< CXIMPProtocolInfoImp >, containing the
+     * protocols. Ownership transferred to caller.
+     */
+    IMPORT_C HBufC8* GetKnownProtocolsL();
+
+
+    /**
+     * Gets supported framework features.
+     *
+     * @return Supported framework features, externalized
+     * CXIMPFeatureInfoImp. Ownership transferred to caller.
+     */
+    IMPORT_C HBufC8* GetSupportedFrameworkFeaturesL();
+
+private:
+
+    /**
+     * Helper to get data from server side.
+     * @return Externalized object to be passed onward
+     */
+    HBufC8* GetDataL( TInt aMsg );
+
+
+    };
+
+
+#endif      //  XIMPSRVROOTCLIENT_H__
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/core/srcdatamodel/ximpapidataobjbase.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  API data object base implementation.
+*
+*/
+
+#include "ximpapidataobjbase.h"
+
+
+// ============================ MEMBER FUNCTIONS =============================
+
+// ---------------------------------------------------------------------------
+// CXIMPApiDataObjBase::CXIMPApiDataObjBase()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CXIMPApiDataObjBase::CXIMPApiDataObjBase()
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPApiDataObjBase::~CXIMPApiDataObjBase()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CXIMPApiDataObjBase::~CXIMPApiDataObjBase()
+    {
+    }
+
+
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/core/srcdatamodel/ximpapidataobjfactory.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  Base class for API implementations.
+*
+*/
+
+
+#include <s32strm.h>
+
+#include "ximpapidataobjfactory.h"
+#include "ximpapidataobjbase.h"
+
+// to access the internal factory methods of feature plug-ins
+#include "ximpfeaturepluginholder.h"
+#include "apidataobjfactoryaccessor.h"
+#include "apidataobjfactory.h"
+
+// ============================ MEMBER FUNCTIONS =============================
+
+// ---------------------------------------------------------------------------
+// XIMPApiDataObjFactory::InternalizeL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void XIMPApiDataObjFactory::InternalizeL( 
+        RReadStream& aStream,
+        RPrReqParamArray& aArray )
+    {
+    TInt32 arrLen = aStream.ReadInt32L();
+
+    for ( TInt i = 0; i < arrLen; i++ )
+        {
+        SXIMPReqParam param;
+        param.iParamType = aStream.ReadInt32L();
+        CXIMPApiDataObjBase* dataObject = NewDataObjectFromStreamLC( param.iParamType, aStream );
+
+        // Try to create presence data object
+        MApiDataObjFactoryAccessor* presenceObjFactoryAcc = FeaturePluginHolder::PresenceObjFactoryAccessor();
+        if ( !dataObject && presenceObjFactoryAcc )
+            {
+            dataObject = presenceObjFactoryAcc->ApiDataObjFactory().NewFromStreamLC( param.iParamType, aStream );
+            }
+ 
+        if ( !dataObject )
+	        {
+	        TInt accesorCount = FeaturePluginHolder::AccessorCount() ;
+	        for (TInt i=0; i<accesorCount; i++)
+		        {
+	        	MApiDataObjFactoryAccessor* pFactoryAcc = FeaturePluginHolder::Accessor(i) ;
+	        	dataObject = pFactoryAcc->ApiDataObjFactory().NewFromStreamLC( param.iParamType, aStream );
+	        	if(dataObject)
+	    	    	{
+	        		break ;
+	        		}
+	        	}
+        	}
+        
+        
+        param.iParam = dataObject;
+        aArray.AppendL( param );
+        CleanupStack::Pop( dataObject );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// XIMPApiDataObjFactory::ExternalizeL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void XIMPApiDataObjFactory::ExternalizeL( 
+            RWriteStream& aWs,
+            const RPrReqParamArray& aArray )
+    {
+    // write array length
+    aWs.WriteInt32L( aArray.Count() );
+
+    for ( TInt i = 0; i < aArray.Count(); i++ )
+        {
+        // trust the type within the param struct
+        aWs.WriteInt32L( aArray[ i ].iParamType );
+
+        // write the actual object
+        CXIMPApiDataObjBase* theBase = aArray[ i ].iParam;
+        theBase->ExternalizeL( aWs );
+        }
+
+    aWs.CommitL();
+    }
+
+// ---------------------------------------------------------------------------
+// XIMPApiDataObjFactory::InternalizeLC
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CXIMPApiDataObjBase* XIMPApiDataObjFactory::InternalizeLC(
+        RReadStream& aStream )
+    {
+    TInt32 objType = aStream.ReadInt32L();
+    CXIMPApiDataObjBase* dataObject = NewDataObjectFromStreamLC( objType, aStream );
+    return dataObject;
+    }
+
+// ---------------------------------------------------------------------------
+// XIMPApiDataObjFactory::ExternalizeL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void XIMPApiDataObjFactory::ExternalizeL(
+        RWriteStream& aWs,
+        const CXIMPApiDataObjBase& aDataObj )
+    {
+    aWs.WriteInt32L( aDataObj.Base().GetInterfaceId() );
+    aDataObj.ExternalizeL( aWs );
+    aWs.CommitL();
+    }
+
+// End of file
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/core/srcdatamodel/ximpapidataobjfactory.h	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  Codec to pack and unpack data objects.
+*
+*/
+
+#ifndef XIMPAPIDATAOBJFACTORY_H
+#define XIMPAPIDATAOBJFACTORY_H
+
+#include <e32base.h>
+#include "ximptypehelpers.h"
+
+class CXIMPApiDataObjBase;
+class RReadStream;
+class RWriteStream;
+
+
+/**
+ * Codec to pack and unpack data object arrays.
+ *
+ * @lib ximpdatamodel.dll
+ * @since S60 v3.2
+ */
+NONSHARABLE_CLASS( XIMPApiDataObjFactory )
+    {
+public:
+
+    /**
+     * Unpacks a request parameter array from a 
+     * descriptor back to array format.
+     * @param aDataObjArrayData The packed array
+     * @param aArray The array which to fill
+     */
+    IMPORT_C static void InternalizeL( 
+            RReadStream& aStream,
+            RPrReqParamArray& aArray
+            );
+
+    /**
+     * Packs a given request parameter array into 
+     * a stream.
+     * @param aWs The stream to pack into
+     * @param aArray The array to pack
+     */    
+    IMPORT_C static void ExternalizeL( 
+            RWriteStream& aWs,
+            const RPrReqParamArray& aArray
+            );
+
+    /**
+     * Internalize a CXIMPApiDataObjBase-derived object
+     * from the given stream, ownership is returned to the caller.
+     * @param aStream The stream
+     * @return The object instance
+     */
+    IMPORT_C static CXIMPApiDataObjBase* InternalizeLC(
+            RReadStream& aStream );
+
+    /**
+     * Externalize a CXIMPApiDataObjBase-derived object
+     * to the given stream.
+     * @param aWs The write stream
+     * @param aDataObj The data object
+     */
+    IMPORT_C static void ExternalizeL(
+            RWriteStream& aWs,
+            const CXIMPApiDataObjBase& aDataObj );
+
+    /*
+     * Packs a given array into a stream.
+     * @param aStream The stream
+     * @param aArray The array
+     */
+    template< class INFOIMP>    
+        static inline void InternalizeL( 
+                RReadStream& aStream,
+                RPointerArray<INFOIMP>& aArray
+                );
+
+    /**
+     * Unpacks an array of info fields back to array format.
+     * @param aWs The stream
+     * @param aArray The array which to fill
+     */
+    template< class INFOIMP >
+        static inline void ExternalizeL( 
+                RWriteStream& aWs,
+                const RPointerArray<INFOIMP>& aArray
+                );
+
+private:
+
+    XIMPApiDataObjFactory();
+    ~XIMPApiDataObjFactory();
+    
+    
+
+    };
+
+// template methods need inline implementation
+#include "ximpapidataobjfactory.inl"
+
+#endif // XIMPAPIDATAOBJFACTORY_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/core/srcdatamodel/ximpapidataobjfactory.inl	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  Inline methods for codec to pack and unpack data objects.
+*
+*/
+
+
+//#include <e32base.h>
+#include "ximptypehelpers.h"
+#include "ximpapidataobjfactory.h"
+#include "ximpapidataobjbase.h"
+#include "ximpidentityimp.h"
+//#include "presentitygroupmemberinfoimp.h"
+//#include "presentitygroupinfoimp.h"
+#include "ximpfeatureinfoimp.h"
+#include "ximpcontextclientinfoimp.h"
+//#include "presencegrantrequestinfoimp.h"
+//#include "presencewatcherinfoimp.h"
+#include "ximpprotocolinfoimp.h"
+#include "ximpserviceinfoimp.h"
+#include "ximpstatusimp.h"
+//#include "presenceinfofieldimp.h"
+//#include "presenceinfofieldvaluetextimp.h"
+//#include "presenceinfofieldvaluebinaryimp.h"
+//#include "presenceinfofieldvalueenumimp.h"
+//#include "servicepresenceinfoimp.h"
+//#include "devicepresenceinfoimp.h"
+
+/**
+ * Type definition for exact API data object constructor signature.
+ */
+typedef CXIMPApiDataObjBase* (*TApiDataObjConstructor)( RReadStream& );
+
+
+
+/**
+ * Structure for mapping data object interface IDs to
+ * to corect API data object constructors.
+ */
+struct SApiDataObjConstructorMap
+    {
+    //Interface id
+    TInt32    iInterfaceId;
+
+    //Function pointer to data object interface implementation
+    TApiDataObjConstructor iConstructorPtr;
+    } ;
+
+
+
+/**
+ * Helper macro to initialise KApiDataObjConstructorTable members.
+ *
+ * Macro forces that each data object implementation class to have static
+ * NewFromStreamLC() member function to instantiate the object.
+ *
+ * See TApiDataObjConstructor type definition for exact constructor
+ * signature.
+ */
+#define CONSTRUCTOR_ENTRY( TheImplementedIf, TheClass ) \
+    { TheImplementedIf::KInterfaceId, TheClass::NewFromStreamLC } \
+
+/**
+ * Constructor function mapping for data object interface implementations.
+ *
+ * When new data object types are implemented, add them here.
+ */
+const SApiDataObjConstructorMap KApiDataObjConstructorTable[] =
+    {
+    CONSTRUCTOR_ENTRY( MXIMPIdentity, CXIMPIdentityImp ),
+ //   CONSTRUCTOR_ENTRY( MPresentityGroupMemberInfo, CPresentityGroupMemberInfoImp ),
+ //   CONSTRUCTOR_ENTRY( MPresentityGroupInfo, CPresentityGroupInfoImp ),
+    CONSTRUCTOR_ENTRY( MXIMPFeatureInfo, CXIMPFeatureInfoImp ),
+    CONSTRUCTOR_ENTRY( MXIMPContextClientInfo, CXIMPContextClientInfoImp ),
+ //   CONSTRUCTOR_ENTRY( MPresenceGrantRequestInfo, CPresenceGrantRequestInfoImp ),
+ //   CONSTRUCTOR_ENTRY( MPresenceWatcherInfo, CPresenceWatcherInfoImp ),
+    CONSTRUCTOR_ENTRY( MXIMPProtocolInfo, CXIMPProtocolInfoImp ),
+    CONSTRUCTOR_ENTRY( MXIMPServiceInfo, CXIMPServiceInfoImp ),
+    CONSTRUCTOR_ENTRY( MXIMPStatus, CXIMPStatusImp ),
+ //   CONSTRUCTOR_ENTRY( MPresenceInfoField, CPresenceInfoFieldImp ),
+ //   CONSTRUCTOR_ENTRY( MPresenceInfoFieldValueText, CPresenceInfoFieldValueTextImp ),
+ //   CONSTRUCTOR_ENTRY( MPresenceInfoFieldValueBinary, CPresenceInfoFieldValueBinaryImp ),
+ //   CONSTRUCTOR_ENTRY( MPresenceInfoFieldValueEnum, CPresenceInfoFieldValueEnumImp ),
+ //   CONSTRUCTOR_ENTRY( MDevicePresenceInfo, CDevicePresenceInfoImp ),
+ //   CONSTRUCTOR_ENTRY( MServicePresenceInfo, CServicePresenceInfoImp )
+    };
+
+
+/**
+ * Count of constructor mappings.
+ */
+const TInt KApiDataObjConstructorCount = sizeof( KApiDataObjConstructorTable )
+                                        / sizeof( SApiDataObjConstructorMap );
+
+
+
+// ============================ HELPER FUNCTIONS =============================
+
+
+namespace {
+
+    /**
+     * Helper function to locate constructor function for
+     * data object interface ID.
+     *
+     * @param aDataObjInterfaceId The data object interface ID.
+     * @return Data object constructor function.
+     */
+    TApiDataObjConstructor ConstructorForInterface( TInt32 aDataObjInterfaceId )
+    {
+        //Locate correct constructor
+        for( TInt ix = 0; ix < KApiDataObjConstructorCount; ix++ )
+        {
+            const SApiDataObjConstructorMap map = KApiDataObjConstructorTable[ ix ];
+            if( map.iInterfaceId == aDataObjInterfaceId )
+            {
+                return map.iConstructorPtr;
+            }
+        }
+
+
+        //If assertion below fails, check that data object implementation
+        //class implementing requested data object interface (aDataObjInterfaceId)
+        //is registered to KApiDataObjConstructorTable
+//        __ASSERT_DEBUG( EFalse,
+//                User::Panic( _L("XIMPApiDataObjFactory"), KErrUnknown ) );
+
+        return NULL;
+    }
+
+
+    /**
+     * Helper function to instantiate new data object object
+     * of requested type and construct it from the stream.
+     *
+     * @param aDataObjInterfaceId
+     * @return Data object constructor function.
+     */
+    CXIMPApiDataObjBase* NewDataObjectFromStreamLC( TInt32 aDataObjInterfaceId,
+            RReadStream& aStream )
+    {
+        TApiDataObjConstructor newFromStreamLC = NULL;
+
+        //Locate correct constructor for interface ID
+        newFromStreamLC = ConstructorForInterface( aDataObjInterfaceId );
+
+        //Instantiate the object
+        if ( newFromStreamLC )
+            {
+            CXIMPApiDataObjBase* dataObject = newFromStreamLC( aStream );  
+            return dataObject;      
+            }
+
+        return NULL; 
+    }
+
+} // namespace
+
+// ---------------------------------------------------------------------------
+// XIMPApiDataObjFactory::InternalizeL
+// ---------------------------------------------------------------------------
+//
+template< class INFOIMP >
+inline void XIMPApiDataObjFactory::InternalizeL( 
+        RReadStream& aStream,
+        RPointerArray<INFOIMP>& aArray )
+    {
+    TInt32 arrLen = aStream.ReadInt32L();
+
+    for ( TInt i = 0; i < arrLen; i++ )
+        {
+        TInt paramType = aStream.ReadInt32L();
+        INFOIMP* infoObj = ( INFOIMP* ) NewDataObjectFromStreamLC( paramType, aStream );
+        aArray.AppendL( infoObj );
+        CleanupStack::Pop( infoObj );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// XIMPApiDataObjFactory::ExternalizeL
+// ---------------------------------------------------------------------------
+//
+template <class INFOIMP>
+inline void XIMPApiDataObjFactory::ExternalizeL( 
+        RWriteStream& aWs,
+        const RPointerArray<INFOIMP>& aArray )
+    {
+    aWs.WriteInt32L( aArray.Count() ); // array length
+
+    for ( TInt i = 0; i < aArray.Count(); i++ )
+        {
+        INFOIMP* infoField = aArray[ i ];
+
+        // write the type
+        aWs.WriteInt32L( infoField->Base().GetInterfaceId() );
+
+        // write the actual object
+        infoField->ExternalizeL( aWs );
+        }
+
+    aWs.CommitL();
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/core/srcdatamodel/ximpapieventbase.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  API event object base implementation.
+*
+*/
+
+#include "ximpapieventbase.h"
+
+
+// ============================ MEMBER FUNCTIONS =============================
+
+// ---------------------------------------------------------------------------
+// CXIMPApiEventBase::CXIMPApiEventBase()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CXIMPApiEventBase::CXIMPApiEventBase()
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPApiEventBase::~CXIMPApiEventBase()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CXIMPApiEventBase::~CXIMPApiEventBase()
+    {
+    }
+
+
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/core/srcdatamodel/ximpapiobjbase.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,65 @@
+/*
+* 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:  Base class for XIMP API implementations.
+*
+*/
+
+#include "ximpapiobjbase.h"
+
+
+// ============================ MEMBER FUNCTIONS =============================
+
+// ---------------------------------------------------------------------------
+// CXIMPApiObjBase::CXIMPApiObjBase()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CXIMPApiObjBase::CXIMPApiObjBase()
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPApiObjBase::~CXIMPApiObjBase()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CXIMPApiObjBase::~CXIMPApiObjBase()
+    {
+    HandleUnknownGetInterface(0,MXIMPBase::EReturnNullIfUnknown);
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPApiObjBase::HandleUnknownGetInterface()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TAny* CXIMPApiObjBase::HandleUnknownGetInterface( 
+    TInt32 aInterfaceId, 
+    MXIMPBase::TIfGetOps aOps ) const
+    {
+    XIMP_UNUSED_FORMAL_PARAM( aInterfaceId );
+
+    if( aOps == MXIMPBase::EPanicIfUnknown )
+        {
+        #ifdef __WINS__
+        User::SetJustInTime(ETrue);
+        #endif // __WINS__
+        
+        User::Panic( _L("CXIMPApiObjBase"), KErrExtensionNotSupported );
+        }
+    
+    return NULL;
+    }
+
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/core/srcdatamodel/ximpconfigurationitem.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,44 @@
+/*
+* 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:  Configuration item interface
+*
+*/
+
+#ifndef MXIMPPSCCONFIGURATIONITEM_H
+#define MXIMPPSCCONFIGURATIONITEM_H
+
+//class MXIMPPscContext;
+
+/**
+ * Context interface.
+ *
+ * @since S60 v3.2
+ */
+class MXIMPConfigurationItem
+    {
+    
+public: // Interface
+
+        
+protected: // Destruction
+    
+    /**
+     * Object cannot be deleted through this interface
+     */
+    virtual ~MXIMPConfigurationItem(){}
+    };
+
+/* ======================================================================== */
+
+#endif // MXIMPPSCCONFIGURATIONITEM_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/core/srcdatamodel/ximpconfigurationitembase.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  Configuration item base for configuration items.
+*
+*/
+
+
+#include "ximpconfigurationitembase.h"
+#include "ximpitemparent.h"
+
+// ---------------------------------------------------------------------------
+// CXIMPConfigurationItemBase::OrderOfItems()
+// ---------------------------------------------------------------------------
+//
+TInt CXIMPConfigurationItemBase::OrderOfItems( const CXIMPConfigurationItemBase& aFirst, 
+                                               const CXIMPConfigurationItemBase& aSecond )
+    {
+    if( &aFirst < &aSecond )
+        {
+        return -1;
+        }
+    else if( &aFirst == &aSecond )
+        {
+        return 0;
+        }
+    else
+        {
+        return 1;
+        }
+    }    
+
+
+// ---------------------------------------------------------------------------
+// CXIMPConfigurationItemBase::CXIMPConfigurationItemBase()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CXIMPConfigurationItemBase::CXIMPConfigurationItemBase( MXIMPItemParentBase& aParent )
+: CXIMPSubscriptionItemBase( aParent )
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// CXIMPConfigurationItemBase::BaseConstructL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CXIMPConfigurationItemBase::BaseConstructL()
+    {
+    CXIMPSubscriptionItemBase::BaseConstructL();
+    }
+
+// ---------------------------------------------------------------------------
+// CXIMPConfigurationItemBase::~CXIMPConfigurationItemBase()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CXIMPConfigurationItemBase::~CXIMPConfigurationItemBase()
+    {
+    iConfigContexts.Close();
+    iConfigItems.Close();
+    }
+
+// ---------------------------------------------------------------------------
+// CXIMPConfigurationItemBase::ConfigurationStatus()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CXIMPConfigurationItemBase::TConfigurationStatus 
+           CXIMPConfigurationItemBase::ConfigurationStatus( MXIMPPscContext* aContext )
+    {
+    // Calculate situation
+    TInt count = iConfigContexts.Count() + iConfigItems.Count();
+    TBool contextFound = IsContext( aContext );
+    if( count == 0 )
+        {
+        return ENotConfiguredAtAll;
+        }
+    else if( contextFound )
+        {
+        if( count == 1 )
+            {
+            return EConfiguredForCtxOnly;
+            }
+        return EConfiguredForCtxAndOthers;
+        }
+    return EConfiguredForOtherCtxOnly;
+    }
+    
+// ---------------------------------------------------------------------------
+// CXIMPConfigurationItemBase::AddConfiguratorL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CXIMPConfigurationItemBase::AddConfiguratorL( MXIMPPscContext* aContext )
+    {
+    TLinearOrder< MXIMPPscContext > order( OrderOfContexts );
+    if( IsContext( aContext ) )
+        {
+        User::Leave( KErrAlreadyExists );
+        }    
+    iConfigContexts.InsertInOrderL( aContext, order );
+    User::LeaveIfError( Open() );
+    }
+    
+// ---------------------------------------------------------------------------
+// CXIMPConfigurationItemBase::RemoveConfigurator()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CXIMPConfigurationItemBase::RemoveConfigurator( MXIMPPscContext* aContext )
+    {
+    TLinearOrder< MXIMPPscContext > order( OrderOfContexts );
+    TInt index = iConfigContexts.FindInOrder( aContext, order );
+    if( index >= 0 )
+        {
+        iConfigContexts.Remove( index );
+        Close();
+        }
+    else
+        {
+        iParent.UnregisterExpiringItem( this );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CXIMPConfigurationItemBase::AddConfiguratorL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CXIMPConfigurationItemBase::AddConfiguratorL( CXIMPConfigurationItemBase* aItem )
+    {
+    TLinearOrder< CXIMPConfigurationItemBase > order( OrderOfItems );
+    TInt index = iConfigItems.FindInOrder( aItem, order );    
+    if( index != KErrNotFound )
+        {
+        return;
+        }
+    
+    iConfigItems.InsertInOrderL( aItem, order );
+    User::LeaveIfError( Open() );
+    }
+    
+// ---------------------------------------------------------------------------
+// CXIMPConfigurationItemBase::RemoveConfigurator()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CXIMPConfigurationItemBase::RemoveConfigurator( CXIMPConfigurationItemBase* aItem )
+    {
+    TLinearOrder< CXIMPConfigurationItemBase > order( OrderOfItems );
+    TInt index = iConfigItems.FindInOrder( aItem, order );
+    if( index >= 0 )
+        {
+        iConfigItems.Remove( index );
+        Close();
+        }
+    else
+        {
+        iParent.UnregisterExpiringItem( this );
+        }
+    }    
+    
+// ---------------------------------------------------------------------------
+// CXIMPConfigurationItemBase::IsContext()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TBool CXIMPConfigurationItemBase::IsContext( MXIMPPscContext* aContext ) const
+    {
+    TLinearOrder< MXIMPPscContext > order( OrderOfContexts );    
+    return iConfigContexts.FindInOrder( aContext, order ) != KErrNotFound;
+    }
+    
+// ---------------------------------------------------------------------------
+// CXIMPConfigurationItemBase::ForceClose()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CXIMPConfigurationItemBase::ForceClose()
+    {
+    CXIMPSubscriptionItemBase::ForceClose();
+    TInt count = iConfigContexts.Count();
+    for( TInt a = 0; a < count; ++a )
+        {
+        // RemoveSubscriber removes first one every time.
+        RemoveConfigurator( iConfigContexts[ 0 ] );
+        }
+    count = iConfigItems.Count();
+    for( TInt a = 0; a < count; ++a )
+        {
+        RemoveConfigurator( iConfigItems[ 0 ] );
+        }
+    }    
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/core/srcdatamodel/ximpconfigurationitembase.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,148 @@
+/*
+* 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:  Configuration item base for configuration items.
+*
+*/
+
+#ifndef CXIMPPSCCONFIGURATIONITEMBASE_H
+#define CXIMPPSCCONFIGURATIONITEMBASE_H
+
+#include <e32base.h>
+#include "ximpconfigurationitem.h"
+#include "ximpsubscriptionitembase.h"
+
+/**
+ * Configuration item base
+ *
+ * @since S60 v3.2
+ */
+class CXIMPConfigurationItemBase : public CXIMPSubscriptionItemBase, 
+                                   public MXIMPConfigurationItem
+    {
+public: // Definitions
+        
+    /** 
+     * Authorization status
+     */
+    enum TConfigurationStatus
+        {
+        ENotConfiguredAtAll,
+        EConfiguredForOtherCtxOnly,
+        EConfiguredForCtxOnly,
+        EConfiguredForCtxAndOthers
+        };
+                
+public: // Construction and destruction
+
+    /**
+     * Destruction
+     * - Remember to inform parent about delete.
+     */
+    IMPORT_C virtual ~CXIMPConfigurationItemBase();
+
+    /**
+     * Construction
+     */
+    IMPORT_C CXIMPConfigurationItemBase( MXIMPItemParentBase& aParent );
+        
+    /**
+     * Base construction. Must be called from inherited classes ConstructL
+     */
+    IMPORT_C void BaseConstructL();
+     
+    
+public: // New methods
+    
+    /**
+     * Authorizationstatus for context. 
+     *
+     *   ENotConfiguredAtAll            - Configure not done by any context.
+     *   EConfiguredForOtherCtxOnly     - Configure done by others but not aContext
+     *   EConfiguredForCtxOnly          - Configure done by aContext only.
+     *   EConfiguredForCtxAndOthers     - Configure done by others and aContext.
+     *
+     * @param aContext Check authorization status for aContext.
+     */
+    IMPORT_C TConfigurationStatus ConfigurationStatus( MXIMPPscContext* aContext );
+    
+    /**
+     * Add configurator for item.
+     * @param aContext. Context to be added.
+     */
+    IMPORT_C void AddConfiguratorL( MXIMPPscContext* aContext );
+    
+    /**
+     * Remove configurator from item
+     * @param aContext. Context to be removed.
+     */
+    IMPORT_C void RemoveConfigurator( MXIMPPscContext* aContext );
+    
+    /** 
+     * Add configurator for item.
+     * @param aItem. Item to be added.
+     */
+    IMPORT_C void AddConfiguratorL( CXIMPConfigurationItemBase* aItem );
+
+    /**
+     * Remove configurator from item
+     * @param aContext. Item to be removed.
+     */
+    IMPORT_C void RemoveConfigurator( CXIMPConfigurationItemBase* aItem );
+    
+    
+    
+public: // From CXIMPSubscriptionItemBase
+
+    /**
+     * @see CXIMPSubscriptionItemBase
+     */
+    IMPORT_C TBool IsContext( MXIMPPscContext* aContext ) const;    
+
+    /**
+     * @see CXIMPSubscriptionItemBase
+     */
+    IMPORT_C void ForceClose();
+
+ 
+public: // From MXIMPConfigurationItem
+
+    
+protected: // Helpers
+
+    /**
+     * For linear ordering by pointers
+     */
+    static TInt OrderOfItems( const CXIMPConfigurationItemBase& aFirst, 
+                              const CXIMPConfigurationItemBase& aSecond );
+        
+protected: // New interface methods.
+        
+    
+protected: // Data
+
+    /**
+     * Configured contexts.
+     */
+    RPointerArray< MXIMPPscContext > iConfigContexts;
+    RPointerArray< MXIMPPscContext > iPreConfigContexts;
+    RPointerArray< CXIMPConfigurationItemBase > iConfigItems;
+    RPointerArray< CXIMPConfigurationItemBase > iPreConfigItems;
+    };
+
+
+/* ======================================================================== */
+
+
+
+#endif // CXIMPPSCCONFIGURATIONITEMBASE_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/core/srcdatamodel/ximpcontextclientinfoimp.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  MXIMPContextClientInfo API object implementation.
+*
+*/
+
+#include "ximpcontextclientinfoimp.h"
+#include "ximpidentityimp.h"
+
+// ============================ MEMBER FUNCTIONS =============================
+
+
+// ---------------------------------------------------------------------------
+// CXIMPContextClientInfoImp::NewLC()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CXIMPContextClientInfoImp* CXIMPContextClientInfoImp::NewLC()
+    {
+    CXIMPContextClientInfoImp* self = new( ELeave ) CXIMPContextClientInfoImp;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+    
+
+// ---------------------------------------------------------------------------
+// CXIMPContextClientInfoImp::NewL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CXIMPContextClientInfoImp* CXIMPContextClientInfoImp::NewL()
+    {
+    CXIMPContextClientInfoImp* self = NewLC();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CXIMPContextClientInfoImp::NewFromStreamLC()
+// ---------------------------------------------------------------------------
+//
+XIMPIMP_IMPLEMENT_DATAOBJ_NEWFROMSTREAM( CXIMPContextClientInfoImp )
+
+
+// ---------------------------------------------------------------------------
+// Implement supported interface access.
+// ---------------------------------------------------------------------------
+//
+XIMPIMP_IF_BASE_GET_INTERFACE_BEGIN( CXIMPContextClientInfoImp, 
+                                     MXIMPContextClientInfo )
+XIMPIMP_IF_BASE_GET_INTERFACE_END()
+
+
+XIMPIMP_IF_BASE_GET_CONST_INTERFACE_BEGIN( CXIMPContextClientInfoImp, 
+                                           MXIMPContextClientInfo )
+XIMPIMP_IF_BASE_GET_INTERFACE_END()
+
+// ---------------------------------------------------------------------------
+// CXIMPContextClientInfoImp::~CXIMPContextClientInfoImp()
+// ---------------------------------------------------------------------------
+//
+CXIMPContextClientInfoImp::~CXIMPContextClientInfoImp()
+    {
+    delete iClientId; 
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPContextClientInfoImp::CXIMPContextClientInfoImp()
+// ---------------------------------------------------------------------------
+//
+CXIMPContextClientInfoImp::CXIMPContextClientInfoImp()
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// CXIMPContextClientInfoImp::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void CXIMPContextClientInfoImp::ConstructL()
+    {
+    iClientId = CXIMPIdentityImp::NewL();
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPContextClientInfoImp::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void CXIMPContextClientInfoImp::ConstructL( const TDesC16& aClientId )
+    {
+    iClientId = CXIMPIdentityImp::NewLC( aClientId );
+    CleanupStack::Pop(); //iClientId
+    }
+
+// ---------------------------------------------------------------------------
+// CXIMPContextClientInfoImp::ExternalizeL()
+// ---------------------------------------------------------------------------
+//
+void CXIMPContextClientInfoImp::ExternalizeL( RWriteStream& aStream ) const
+    {
+    iClientId->ExternalizeL( aStream );
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPContextClientInfoImp::InternalizeL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CXIMPContextClientInfoImp::InternalizeL( RReadStream& aStream )
+    {
+    iClientId->InternalizeL( aStream );
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPContextClientInfoImp::Match()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TBool CXIMPContextClientInfoImp::Match( 
+    const CXIMPContextClientInfoImp* aClientInfoImp ) const
+    {
+    return iClientId->Compare( *aClientInfoImp->iClientId ) == 0;
+    }
+
+// ---------------------------------------------------------------------------
+// CXIMPContextClientInfoImp::EqualsContent()
+// ---------------------------------------------------------------------------
+//
+TBool CXIMPContextClientInfoImp::EqualsContent( 
+    const CXIMPApiDataObjBase& aOtherInstance ) const 
+    {
+    const CXIMPContextClientInfoImp* tmp =
+    TXIMPGetImpClassOrPanic< const CXIMPContextClientInfoImp>::From( 
+                                                       aOtherInstance.Base() );
+
+    TBool same = Match( tmp ); 
+    TBool x;
+    x = ETrue; // do some comparison of member variable here
+    same &= x;
+    return same;
+    }
+
+// ---------------------------------------------------------------------------
+// From MXIMPContextClientInfo class.
+// CXIMPContextClientInfoImp::ClientId()
+// ---------------------------------------------------------------------------
+//
+const MXIMPIdentity& CXIMPContextClientInfoImp::ClientId() const
+    {
+    return *iClientId;
+    }
+
+
+// ---------------------------------------------------------------------------
+// From MXIMPContextClientInfo class.
+// CXIMPContextClientInfoImp::SetClientIdL()
+// ---------------------------------------------------------------------------
+//
+void CXIMPContextClientInfoImp::SetClientIdL( 
+    MXIMPIdentity* aIdentity )
+    {   
+    CXIMPIdentityImp* tmp =
+    TXIMPGetImpClassOrPanic< CXIMPIdentityImp>::From( *aIdentity );
+    
+    delete iClientId;
+    iClientId = tmp;
+    }
+
+    
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/core/srcdatamodel/ximpcontextclientinfoimp.h	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  MXIMPContextClientInfo API object implementation.
+*
+*/
+
+#ifndef CXIMPPRESENCECONTEXTCLIENTINFOIMP_H
+#define CXIMPPRESENCECONTEXTCLIENTINFOIMP_H
+
+#include <s32strm.h>
+
+#include "ximpapidataobjbase.h"
+#include <ximpcontextclientinfo.h>
+
+
+class CXIMPIdentityImp;
+
+
+/**
+ * MXIMPContextClientInfo API object implementation.
+ *
+ * @lib ximpdatamodel.dll
+ * @since S60 v3.2
+ */
+NONSHARABLE_CLASS( CXIMPContextClientInfoImp ): public CXIMPApiDataObjBase,
+                                                        public MXIMPContextClientInfo
+    {
+public:
+    /** The class ID. */
+    enum { KClassId = XIMPIMP_CLSID_CXIMPCONTEXTCLIENTINFOIMP };
+
+public:
+
+    IMPORT_C static CXIMPContextClientInfoImp* NewLC();
+    IMPORT_C static CXIMPContextClientInfoImp* NewL();
+
+    virtual ~CXIMPContextClientInfoImp();
+
+private:
+
+    CXIMPContextClientInfoImp();
+    void ConstructL( const TDesC16& aClientId );
+    void ConstructL();
+    
+    /**
+     * @see CXIMPApiDataObjBase
+     */
+    XIMPIMP_DECLARE_DATAOBJ_BASE_PRIV_METHODS
+
+public: // From MXIMPBase
+
+    /**
+     * Implementation of MXIMPBase interface methods
+     * @see MXIMPBase
+     */
+    XIMPIMP_DECLARE_IF_BASE_METHODS
+    
+   /**
+     * @see CXIMPApiDataObjBase
+     */
+    XIMPIMP_DECLARE_DATAOBJ_BASE_METHODS
+
+
+public: // From MXIMPContextClientInfo
+
+    const MXIMPIdentity& ClientId() const;
+    void SetClientIdL( MXIMPIdentity* aIdentity );
+    
+
+public: // New functions
+
+    /**
+     * Internalizes object data from given stream.
+     * @param aStream Stream to read.
+     */
+    IMPORT_C void InternalizeL( RReadStream& aStream );
+
+
+    /**
+     * Tests if the given CXIMPContextClientInfoImp object matches
+     * this one.
+     * @param aServiceInfoImp An Object to match
+     */
+    IMPORT_C TBool Match( const CXIMPContextClientInfoImp* aClientInfoImp ) const;
+
+private: // data
+
+    /**
+     * ClientId
+     */
+    CXIMPIdentityImp* iClientId;
+    };
+
+
+#endif // CXIMPPRESENCECONTEXTCLIENTINFOIMP_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/core/srcdatamodel/ximpcontexteventfilter.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,276 @@
+/*
+* 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 context event filter.
+*
+*/
+
+#include "ximpcontexteventfilter.h"
+
+const TInt KXIMPEventListGranurality = 3;
+
+
+// ============================ MEMBER FUNCTIONS =============================
+
+// ---------------------------------------------------------------------------
+// CXIMPContextEventFilter::NewLC()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CXIMPContextEventFilter* CXIMPContextEventFilter::NewLC( 
+    const TArray< TInt32 >* aAcceptedEvents )
+    {
+    CXIMPContextEventFilter* self = 
+        new( ELeave ) CXIMPContextEventFilter;
+    CleanupStack::PushL( self );
+    self->SetFilterL( aAcceptedEvents );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CXIMPContextEventFilter::NewL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CXIMPContextEventFilter* CXIMPContextEventFilter::NewL( 
+    const TArray< TInt32 >* aAcceptedEvents )
+    {
+    CXIMPContextEventFilter* self = NewLC( aAcceptedEvents );
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPContextEventFilter::NewCombinedLC()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CXIMPContextEventFilter* 
+    CXIMPContextEventFilter::NewCombinedLC( 
+    const TArray< CXIMPContextEventFilter* >& aFilters )
+    {
+    CXIMPContextEventFilter* self = 
+        new( ELeave ) CXIMPContextEventFilter;
+    CleanupStack::PushL( self );
+    self->CombineFilterL( aFilters );
+    return self;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPContextEventFilter::~CXIMPContextEventFilter()
+// ---------------------------------------------------------------------------
+//
+CXIMPContextEventFilter::~CXIMPContextEventFilter()
+    {
+    delete iAcceptedEvents;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPContextEventFilter::CXIMPContextEventFilter()
+// ---------------------------------------------------------------------------
+//
+CXIMPContextEventFilter::CXIMPContextEventFilter()
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPContextEventFilter::IsEventAccepted()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TBool CXIMPContextEventFilter::IsEventAccepted( 
+    TInt32 aEvent ) const
+    {
+    TBool accepted = ETrue;
+
+
+    //If there isn't iAcceptedEvents list limiting accepted event types,
+    //all types are accepted by default
+    if( iAcceptedEvents )
+        {
+        TInt pos;
+        if( !FindEventPosition( aEvent, *iAcceptedEvents, pos ) )
+            {
+            accepted = EFalse; 
+            }
+        }
+
+    return accepted;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPContextEventFilter::ExternalizeL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CXIMPContextEventFilter::ExternalizeL( 
+    RWriteStream& aStream ) const
+    {
+    if( !iAcceptedEvents )
+        {
+        aStream.WriteInt32L( 0 );
+        }
+    else
+        {
+        TInt count = iAcceptedEvents->Count();        
+        aStream.WriteInt32L( count );
+        for( TInt ix = 0; ix < count; ++ix )
+            {
+            aStream.WriteInt32L( ( *iAcceptedEvents )[ ix ] );
+            }
+        }
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPContextEventFilter::InternalizeL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CXIMPContextEventFilter::InternalizeL( 
+    RReadStream& aStream )
+    {
+    TInt count = aStream.ReadInt32L();
+    if( count )
+        {
+        //We are internalizing data which we have previously externalized 
+        // => Internalized array can be directly set as current array
+        
+        CArrayFix< TInt32 >* events = 
+                new (ELeave) CArrayFixFlat< TInt32 >( KXIMPEventListGranurality );
+        CleanupStack::PushL( events );
+
+        for( TInt ix = 0; ix < count; ++ix )
+            {
+            events->AppendL( aStream.ReadInt32L() );
+            }
+        delete iAcceptedEvents;
+        iAcceptedEvents = events;
+
+        CleanupStack::Pop( events );
+        }
+
+    else
+        {
+        delete iAcceptedEvents;
+        iAcceptedEvents = NULL;
+        }        
+    }
+    
+    
+// ---------------------------------------------------------------------------
+// CXIMPContextEventFilter::SetFilterL()
+// ---------------------------------------------------------------------------
+//
+void CXIMPContextEventFilter::SetFilterL(
+    const TArray< TInt32 >* aAcceptedEvents )
+    {
+    if( aAcceptedEvents )
+        {
+        CArrayFix< TInt32 >* events = 
+                new (ELeave) CArrayFixFlat< TInt32 >( KXIMPEventListGranurality );
+        CleanupStack::PushL( events );
+
+        CopyUniqueEventsL( *aAcceptedEvents, *events );
+
+        delete iAcceptedEvents;
+        iAcceptedEvents = events;
+        CleanupStack::Pop( events );
+        }
+
+    else
+        {
+        //Set all accepted
+        delete iAcceptedEvents;
+        iAcceptedEvents = NULL;
+        }
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPContextEventFilter::CombineFilterL()
+// ---------------------------------------------------------------------------
+//
+void CXIMPContextEventFilter::CombineFilterL(
+    const TArray< CXIMPContextEventFilter* >& aFilters )
+    {
+    const TInt filterCount = aFilters.Count();
+
+    CArrayFix< TInt32 >* combinedEvents = new (ELeave) CArrayFixFlat< TInt32 >( KXIMPEventListGranurality );
+    CleanupStack::PushL( combinedEvents );
+
+    for( TInt ix = 0; ix < filterCount; ix++ )
+        {
+        const CXIMPContextEventFilter* sourceFilter = aFilters[ ix ];
+        if( sourceFilter->iAcceptedEvents )
+            {
+            CopyUniqueEventsL( sourceFilter->iAcceptedEvents->Array(),
+                               *combinedEvents );            
+            }
+
+        else
+            {
+            //Set all accepted
+            delete combinedEvents;
+            combinedEvents = NULL;
+            break;
+            }
+        }
+
+
+    delete iAcceptedEvents;
+    iAcceptedEvents = combinedEvents;
+
+    CleanupStack::Pop(); //combinedEvents
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPContextEventFilter::CopyUniqueEventsL()
+// ---------------------------------------------------------------------------
+//
+void CXIMPContextEventFilter::CopyUniqueEventsL(
+    const TArray< TInt32 >& aSource, 
+    CArrayFix< TInt32 >& aTarget )
+    {
+
+    const TInt eventCount = aSource.Count();
+
+    for( TInt ix = 0; ix < eventCount; ix++ )
+        {
+        const TInt32 event = aSource[ ix ];
+        TInt pos;
+        if( !FindEventPosition( event, aTarget, pos ) )
+            {
+            aTarget.InsertL( pos, event );
+            }
+        }
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPContextEventFilter::FindEventPosition()
+// ---------------------------------------------------------------------------
+//
+TBool CXIMPContextEventFilter::FindEventPosition( 
+    const TInt32 aEvent, const CArrayFix< TInt32 >& aEvents, TInt& aPos ) const
+    {
+    TKeyArrayFix key( 0, ECmpTInt32 );
+    if( aEvents.FindIsq( aEvent, key, aPos ) == 0 )
+        {
+        //FindIsq() returns zero, if element is found => this is mapped to ETrue
+        return ETrue;        
+        }
+    
+    return EFalse;
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/core/srcdatamodel/ximpcontexteventfilter.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,128 @@
+/*
+* 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 context event filter.
+*
+*/
+
+#ifndef CXIMPPRESENCECONTEXTEVENTFILTER_H
+#define CXIMPPRESENCECONTEXTEVENTFILTER_H
+
+#include "ximpapiobjbase.h"
+#include <s32strm.h>
+
+/**
+ * Presence Context event filter.
+ *
+ * @lib ximpdatamodel.dll
+ * @since S60 v3.2
+ */
+NONSHARABLE_CLASS( CXIMPContextEventFilter ) : public CBase
+    {
+public:
+
+    /**
+     * Instantiates new event filter object.
+     *
+     * Initializes the list of accepted events 
+     * from given array.
+     * 
+     * @param aAcceptedEvents List of events to accept.
+     *        If NULL, all events are accepted. Default value NULL
+     */
+    IMPORT_C static CXIMPContextEventFilter* NewLC( 
+            const TArray< TInt32 >* aAcceptedEvents = NULL );
+
+    IMPORT_C static CXIMPContextEventFilter* NewL( 
+            const TArray< TInt32 >* aAcceptedEvents = NULL );
+
+
+    /**
+     * Instantiates new event filter object.
+     * 
+     * Collects the accepted events from given event 
+     * filter objects.
+     * 
+     * @param aFilters List of events filters 
+     *        from where to gather accepted events.
+     */
+    IMPORT_C static CXIMPContextEventFilter* NewCombinedLC( 
+            const TArray< CXIMPContextEventFilter* >& aFilters );
+
+
+    /**
+     * Destructor.
+     */
+    virtual ~CXIMPContextEventFilter();
+
+
+private:
+    CXIMPContextEventFilter();
+
+
+
+public:
+
+
+    /**
+     * Checks is the given event accepted or not.
+     * 
+     * @param aEvent The event to check.
+     * @return ETrue if given event type is accepted, 
+     *         else EFalse.
+     */
+    IMPORT_C TBool IsEventAccepted( TInt32 aEvent ) const;
+    
+    
+    /**
+     * Extenalizes object data to given stream.
+     * @param aStream Stream to write.
+     */
+    IMPORT_C void ExternalizeL( RWriteStream& aStream ) const;
+
+
+    /**
+     * Internalizes object data from given stream.
+     * @param aStream Stream to read.
+     */
+    IMPORT_C void InternalizeL( RReadStream& aStream );
+
+
+private:
+    void SetFilterL( const TArray< TInt32 >* aAcceptedEvents );
+
+    void CombineFilterL( 
+         const TArray< CXIMPContextEventFilter* >& aFilters );
+
+    void CopyUniqueEventsL( const TArray< TInt32 >& aSource, 
+                            CArrayFix< TInt32 >& aTarget );
+
+    TBool FindEventPosition( const TInt32 aEvent, 
+                             const CArrayFix< TInt32 >& aEvents, 
+                             TInt& aPos ) const; 
+
+
+
+private: // data
+
+    /**
+     * The list of accepted events.
+     * NULL if all events are accepted.
+     * Own.
+     */
+    CArrayFix< TInt32 >* iAcceptedEvents;
+
+    };
+
+
+#endif // CXIMPPRESENCECONTEXTEVENTFILTER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/core/srcdatamodel/ximpcontextstateeventimp.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,265 @@
+/*
+* 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:  MXIMPContextStateEvent API object implementation.
+ *
+*/
+
+#include <s32strm.h>
+
+#include "ximpcontextstateimp.h"
+#include "ximpstatusimp.h"
+#include "ximpcontextstateeventimp.h"
+
+
+namespace
+    {
+    enum TStatusObjectExistency
+        {
+        ENoStatusObject = 0,
+        EHasStatusObject = 1
+        };
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPContextStateEventImp::NewLC()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CXIMPContextStateEventImp* CXIMPContextStateEventImp::NewLC()
+    {
+    CXIMPContextStateEventImp* self = new( ELeave ) CXIMPContextStateEventImp();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPContextStateEventImp::NewL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CXIMPContextStateEventImp* CXIMPContextStateEventImp::NewL()
+    {
+    CXIMPContextStateEventImp* self = CXIMPContextStateEventImp::NewLC();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPContextStateEventImp::NewFromStreamLC()
+// Instantiation method for event automation.
+// ---------------------------------------------------------------------------
+//
+CXIMPApiEventBase* CXIMPContextStateEventImp::NewFromStreamLC(
+        RReadStream& aStream )
+    {
+    CXIMPContextStateEventImp* self = new( ELeave ) CXIMPContextStateEventImp;
+    CleanupStack::PushL( self );
+    self->ConstructL( aStream );
+    return self;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPContextStateEventImp::~CXIMPContextStateEventImp()
+// ---------------------------------------------------------------------------
+//
+CXIMPContextStateEventImp::~CXIMPContextStateEventImp()
+    {
+    delete iState;
+    delete iStateChangeReason;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPContextStateEventImp::CXIMPContextStateEventImp()
+// ---------------------------------------------------------------------------
+//
+CXIMPContextStateEventImp::CXIMPContextStateEventImp()
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPContextStateEventImp::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void CXIMPContextStateEventImp::ConstructL()
+    {
+    iState = CXIMPContextStateImp::NewL();
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPContextStateEventImp::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void CXIMPContextStateEventImp::ConstructL( RReadStream& aStream )
+    {
+    iState = CXIMPContextStateImp::NewL();
+    iState->InternalizeL( aStream );
+
+
+    TStatusObjectExistency exists =
+             ( TStatusObjectExistency ) aStream.ReadInt8L();
+
+    if( exists  == EHasStatusObject )
+        {
+        iStateChangeReason = CXIMPStatusImp::NewL();
+        iStateChangeReason->InternalizeL( aStream );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Implement supported interface access.
+// ---------------------------------------------------------------------------
+//
+XIMPIMP_IF_BASE_GET_INTERFACE_BEGIN( CXIMPContextStateEventImp,
+                                     MXIMPContextStateEvent )
+    XIMPIMP_IF_BASE_GET_CLASS( CXIMPApiEventBase, this )
+XIMPIMP_IF_BASE_GET_INTERFACE_END()
+
+XIMPIMP_IF_BASE_GET_CONST_INTERFACE_BEGIN( CXIMPContextStateEventImp,
+                                           MXIMPContextStateEvent )
+    XIMPIMP_IF_BASE_GET_CONST_CLASS( CXIMPApiEventBase, this ) 
+XIMPIMP_IF_BASE_GET_INTERFACE_END()
+
+
+
+// ---------------------------------------------------------------------------
+// Implement methods from base event interface and base event class
+// ---------------------------------------------------------------------------
+//
+XIMPIMP_IMPLEMENT_EVENT_BASE_METHODS( CXIMPContextStateEventImp,
+                                      MXIMPContextStateEvent )
+
+// ---------------------------------------------------------------------------
+// CXIMPContextStateEventImp::EqualsContent()
+// ---------------------------------------------------------------------------
+//
+TBool CXIMPContextStateEventImp::EqualsContent( 
+    const CXIMPApiEventBase& aOtherInstance ) const 
+    {
+    const CXIMPContextStateEventImp* tmp =
+    TXIMPGetImpClassOrPanic< const CXIMPContextStateEventImp>::From( 
+                                                       aOtherInstance.Base() );
+    
+    TBool same = ETrue;
+
+    TBool x = iState->EqualsContent(*(tmp->iState));
+    same &= x;
+
+	
+	if( (!iStateChangeReason) && (!tmp->iStateChangeReason) )
+		{
+		//both are NULL
+		same &= ETrue;
+		}
+	else if ((iStateChangeReason) && (tmp->iStateChangeReason))
+		{
+		//both not NULL, contents need to be checked
+    x = iStateChangeReason->ResultCode() == tmp->iStateChangeReason->ResultCode();
+    same &= x;
+
+    x = 0 == iStateChangeReason->ProtocolResultDescription().Compare(
+                tmp->iStateChangeReason->ProtocolResultDescription() );
+    same &= x;
+		}
+	else
+		{
+		// One of them is NULL
+		same &= EFalse;		
+		}
+
+    return same;
+    }
+
+// ---------------------------------------------------------------------------
+// CXIMPContextStateEventImp::ExternalizeL()
+// ---------------------------------------------------------------------------
+//
+void CXIMPContextStateEventImp::ExternalizeL( RWriteStream& aStream ) const
+    {
+    iState->ExternalizeL( aStream );
+
+    if( iStateChangeReason )
+        {
+        aStream.WriteInt8L( EHasStatusObject );
+        iStateChangeReason->ExternalizeL( aStream );
+        }
+    else
+        {
+        aStream.WriteInt8L( ENoStatusObject );
+        }
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPContextStateEventImp::StateChangeReason()
+// ---------------------------------------------------------------------------
+//
+const MXIMPStatus* CXIMPContextStateEventImp::StateChangeReason() const
+    {
+    return iStateChangeReason;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPContextStateEventImp::ContextState()
+// ---------------------------------------------------------------------------
+//
+const MXIMPContextState&
+    CXIMPContextStateEventImp::ContextState() const
+    {
+    return *iState;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPContextStateEventImp::ContextStateImp()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CXIMPContextStateImp&
+    CXIMPContextStateEventImp::ContextStateImp()
+    {
+    return *iState;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPContextStateEventImp::SetStateChangeReasonImp()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CXIMPContextStateEventImp::SetStateChangeReasonImp(
+    CXIMPStatusImp* aStateChangeReason )
+    {
+    delete iStateChangeReason;
+    iStateChangeReason = aStateChangeReason; 
+    }
+    
+
+// ---------------------------------------------------------------------------
+// CXIMPContextStateEventImp::StateChangeReasonImp()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CXIMPStatusImp*
+    CXIMPContextStateEventImp::StateChangeReasonImp()
+    {
+    return iStateChangeReason;
+    }
+
+
+// End of file
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/core/srcdatamodel/ximpcontextstateeventimp.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,126 @@
+/*
+* 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:  MXIMPContextStateEventImp API object implementation.
+ *
+*/
+
+#ifndef CXIMPPRESENCECONTEXTSTATEEVENTIMP_H
+#define CXIMPPRESENCECONTEXTSTATEEVENTIMP_H
+
+#include "ximpapieventbase.h"
+#include <ximpcontextstate.h>
+#include <ximpcontextstateevent.h>
+
+
+class RWriteStream;
+class RReadStream;
+class MXIMPStatus;
+class CXIMPStatusImp;
+class CXIMPContextStateImp;
+
+
+/**
+ * MXIMPContextStateEventImp API object implementation.
+ *
+ * @lib ximpdatamodel.dll
+ * @since S60 v3.2
+ */
+NONSHARABLE_CLASS( CXIMPContextStateEventImp ): public CXIMPApiEventBase,
+    public MXIMPContextStateEvent
+    {
+    public:
+        /** The class ID. */
+        enum { KClassId = XIMPIMP_CLSID_CXIMPCONTEXTSTATEEVENTIMP };
+
+    public:
+
+        /**
+         * Exported instantiation method for initializing
+         * new event object.
+         */
+        IMPORT_C static CXIMPContextStateEventImp* NewLC();
+        IMPORT_C static CXIMPContextStateEventImp* NewL();
+
+
+        /**
+         * Instantiation method for event automation.
+         * Method signature must be exactly this to work
+         * with event delivery automation system.
+         *
+         * Event implementation must be registered to
+         * XIMPEventCodec KXIMPEventConstructorTable.
+         */
+        static CXIMPApiEventBase* NewFromStreamLC( RReadStream& aStream );
+
+        virtual ~CXIMPContextStateEventImp();
+
+        
+    private:
+        CXIMPContextStateEventImp();
+        void ConstructL();
+        void ConstructL( RReadStream& aStream );
+
+
+    public: // From API base interfaces
+
+        /**
+         * Implementation of MXIMPBase interface methods
+         * @see MXIMPBase
+         */
+        XIMPIMP_DECLARE_IF_BASE_METHODS
+
+
+        /**
+         * Implementation of MXIMPEventBase interface and
+         * CXIMPApiEventBase methods
+         *
+         * @see MXIMPEventBase
+         * @see CXIMPApiEventBase
+         */
+        XIMPIMP_DECLARE_EVENT_BASE_METHODS
+
+
+    public: // From MXIMPContextStateEvent
+
+        /**
+         * Implementation of MXIMPContextStateEvent interface methods
+         * @see MXIMPContextStateEventImp
+         */
+        const MXIMPStatus* StateChangeReason() const;
+        const MXIMPContextState& ContextState() const;
+        
+        IMPORT_C CXIMPContextStateImp& ContextStateImp();
+        IMPORT_C void SetStateChangeReasonImp( CXIMPStatusImp* aStateChangeReason );
+        IMPORT_C CXIMPStatusImp* StateChangeReasonImp();
+        
+        
+
+    private: // data
+
+        /**
+         *
+         * Own.
+         */
+        CXIMPContextStateImp* iState;
+
+
+        /**
+         * State change reason.
+         * Own.
+         */
+        CXIMPStatusImp* iStateChangeReason;
+    };
+
+
+#endif // CXIMPPRESENCECONTEXTSTATEEVENTIMP_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/core/srcdatamodel/ximpcontextstateimp.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,160 @@
+/*
+* 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:  MXIMPContextState API object implementation.
+*
+*/
+
+#include "ximpcontextstateimp.h"
+
+
+
+// ============================ MEMBER FUNCTIONS =============================
+
+// ---------------------------------------------------------------------------
+// CXIMPContextStateImp::NewLC()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CXIMPContextStateImp* CXIMPContextStateImp::NewLC()
+    {
+    CXIMPContextStateImp* self = new( ELeave ) CXIMPContextStateImp;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPContextStateImp::NewL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CXIMPContextStateImp* CXIMPContextStateImp::NewL()
+    {
+    CXIMPContextStateImp* self = CXIMPContextStateImp::NewLC();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+
+
+// ---------------------------------------------------------------------------
+// CXIMPContextStateImp::~CXIMPContextStateImp()
+// ---------------------------------------------------------------------------
+//
+CXIMPContextStateImp::~CXIMPContextStateImp()
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPContextStateImp::CXIMPContextStateImp()
+// ---------------------------------------------------------------------------
+//
+CXIMPContextStateImp::CXIMPContextStateImp()
+    {
+    iContextState = MXIMPContextState::EInactive;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPContextStateImp::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void CXIMPContextStateImp::ConstructL()
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPContextStateImp::NewFromStreamLC()
+// ---------------------------------------------------------------------------
+//
+XIMPIMP_IMPLEMENT_DATAOBJ_NEWFROMSTREAM( CXIMPContextStateImp )
+
+
+// ---------------------------------------------------------------------------
+// Implement supported interface access.
+// ---------------------------------------------------------------------------
+//
+XIMPIMP_IF_BASE_GET_INTERFACE_BEGIN( CXIMPContextStateImp,
+                                     MXIMPContextState )
+XIMPIMP_IF_BASE_GET_INTERFACE_END()
+
+
+XIMPIMP_IF_BASE_GET_CONST_INTERFACE_BEGIN( CXIMPContextStateImp,
+                                           MXIMPContextState )
+XIMPIMP_IF_BASE_GET_INTERFACE_END()
+
+
+
+// ---------------------------------------------------------------------------
+// CXIMPContextStateImp::ContextState()
+// ---------------------------------------------------------------------------
+MXIMPContextState::TState CXIMPContextStateImp::ContextState() const
+    {
+    return iContextState;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPContextStateImp::ExternalizeL()
+// ---------------------------------------------------------------------------
+//
+void CXIMPContextStateImp::ExternalizeL( RWriteStream& aStream ) const
+    {
+    aStream.WriteInt32L( iContextState );
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPContextStateImp::InternalizeL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CXIMPContextStateImp::InternalizeL( RReadStream& aStream )
+    {
+    iContextState = (MXIMPContextState::TState) aStream.ReadInt32L();
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPContextStateImp::SetStateValue()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CXIMPContextStateImp::SetStateValue( 
+    MXIMPContextState::TState aState )
+    {
+    iContextState = aState;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPContextStateImp::EqualsContent()
+// ---------------------------------------------------------------------------
+//
+TBool CXIMPContextStateImp::EqualsContent( 
+    const CXIMPApiDataObjBase& aOtherInstance ) const
+    {
+    const CXIMPContextStateImp* tmp =
+    TXIMPGetImpClassOrPanic< const CXIMPContextStateImp >::From( 
+                                                        aOtherInstance.Base() );
+
+    TBool totallySame = ETrue;
+    TBool x;
+    x = iContextState == tmp->iContextState;
+    totallySame &= x;
+
+    return totallySame;
+    }
+
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/core/srcdatamodel/ximpcontextstateimp.h	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  MXIMPContextState API object implementation.
+*
+*/
+
+#ifndef CXIMPPRESENCECONTEXTSTATEIMP_H
+#define CXIMPPRESENCECONTEXTSTATEIMP_H
+
+#include "ximpapidataobjbase.h"
+#include <ximpcontextstate.h>
+#include <s32strm.h>
+
+
+/**
+ * MXIMPContextState API object implementation.
+ *
+ * @lib ximpdatamodel.dll
+ * @since S60 v3.2
+ */
+NONSHARABLE_CLASS( CXIMPContextStateImp ): public CXIMPApiDataObjBase,
+                                                   public MXIMPContextState
+    {
+public:
+    /** The class ID. */
+    enum { KClassId = XIMPIMP_CLSID_CXIMPCONTEXTSTATEIMP };
+
+public:
+
+    IMPORT_C static CXIMPContextStateImp* NewLC();
+    IMPORT_C static CXIMPContextStateImp* NewL();
+    virtual ~CXIMPContextStateImp();
+
+
+private:
+
+    CXIMPContextStateImp();
+    void ConstructL();
+
+    /**
+     * @see CXIMPApiDataObjBase
+     */
+    XIMPIMP_DECLARE_DATAOBJ_BASE_PRIV_METHODS
+
+public: // From MXIMPBase
+
+    /**
+     * Implementation of MXIMPBase interface methods
+     * @see MXIMPBase
+     */
+    XIMPIMP_DECLARE_IF_BASE_METHODS
+
+    /**
+     * @see CXIMPApiDataObjBase
+     */
+    XIMPIMP_DECLARE_DATAOBJ_BASE_METHODS
+
+
+public: // From MXIMPContextState
+
+    /**
+     * Implementation of MXIMPContextState interface methods
+     * @see MXIMPContextState
+     */
+    MXIMPContextState::TState ContextState() const;
+
+
+
+public: // New functions
+
+    /**
+     * Internalizes object data from given stream.
+     * @param aStream Stream to read.
+     */
+    IMPORT_C void InternalizeL( RReadStream& aStream );
+
+
+    /**
+     * 
+     * 
+     */
+    IMPORT_C void SetStateValue( MXIMPContextState::TState aState );
+
+
+private: // data
+
+
+    /**
+     * Result code.
+     * Own.
+     */
+    TState iContextState;
+
+    };
+
+
+#endif // CXIMPPRESENCECONTEXTSTATEIMP_H
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/core/srcdatamodel/ximpdatasubscriptionstateimp.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,232 @@
+/*
+* 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:  MXIMPDataSubscriptionState API object implementation.
+*
+*/
+
+#include "ximpdatasubscriptionstateimp.h"
+#include "ximptrace.h"
+
+// ============================ MEMBER FUNCTIONS =============================
+
+// ---------------------------------------------------------------------------
+// CXIMPDataSubscriptionStateImp::NewLC()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CXIMPDataSubscriptionStateImp* CXIMPDataSubscriptionStateImp::NewLC()
+    {
+    CXIMPDataSubscriptionStateImp* self = new( ELeave ) CXIMPDataSubscriptionStateImp;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPDataSubscriptionStateImp::NewL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CXIMPDataSubscriptionStateImp* CXIMPDataSubscriptionStateImp::NewL()
+    {
+    CXIMPDataSubscriptionStateImp* self = CXIMPDataSubscriptionStateImp::NewLC();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+
+
+// ---------------------------------------------------------------------------
+// CXIMPDataSubscriptionStateImp::~CXIMPDataSubscriptionStateImp()
+// ---------------------------------------------------------------------------
+//
+CXIMPDataSubscriptionStateImp::~CXIMPDataSubscriptionStateImp()
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPDataSubscriptionStateImp::CXIMPDataSubscriptionStateImp()
+// ---------------------------------------------------------------------------
+//
+CXIMPDataSubscriptionStateImp::CXIMPDataSubscriptionStateImp()
+    {
+    iSubscriptionState = MXIMPDataSubscriptionState::ESubscriptionInactive;
+    iDataState = MXIMPDataSubscriptionState::EDataUnavailable;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPDataSubscriptionStateImp::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void CXIMPDataSubscriptionStateImp::ConstructL()
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPDataSubscriptionStateImp::NewFromStreamLC()
+// ---------------------------------------------------------------------------
+//
+XIMPIMP_IMPLEMENT_DATAOBJ_NEWFROMSTREAM( CXIMPDataSubscriptionStateImp )
+
+
+// ---------------------------------------------------------------------------
+// Implement supported interface access.
+// ---------------------------------------------------------------------------
+//
+XIMPIMP_IF_BASE_GET_INTERFACE_BEGIN( CXIMPDataSubscriptionStateImp,
+                                     MXIMPDataSubscriptionState )
+XIMPIMP_IF_BASE_GET_INTERFACE_END()
+
+
+XIMPIMP_IF_BASE_GET_CONST_INTERFACE_BEGIN( CXIMPDataSubscriptionStateImp,
+                                           MXIMPDataSubscriptionState )
+XIMPIMP_IF_BASE_GET_INTERFACE_END()
+
+
+
+// ---------------------------------------------------------------------------
+// From class MXIMPDataSubscriptionState.
+// CXIMPDataSubscriptionStateImp::SubscriptionState()
+// ---------------------------------------------------------------------------
+//
+MXIMPDataSubscriptionState::TSubscriptionState
+    CXIMPDataSubscriptionStateImp::SubscriptionState() const
+    {
+    return iSubscriptionState;
+    }
+
+
+// ---------------------------------------------------------------------------
+// From class MXIMPDataSubscriptionState.
+// CXIMPDataSubscriptionStateImp::DataState()
+// ---------------------------------------------------------------------------
+//
+MXIMPDataSubscriptionState::TDataState
+    CXIMPDataSubscriptionStateImp::DataState() const
+    {
+    return iDataState;
+    }
+
+
+// ---------------------------------------------------------------------------
+// From class MXIMPDataSubscriptionState.
+// CXIMPDataSubscriptionStateImp::SetSubscriptionState()
+// ---------------------------------------------------------------------------
+//
+void CXIMPDataSubscriptionStateImp::SetSubscriptionStateL(
+    MXIMPDataSubscriptionState::TSubscriptionState aSubscriptionState )
+    {
+    SetSubscriptionState( aSubscriptionState );
+    }
+
+
+// ---------------------------------------------------------------------------
+// From class MXIMPDataSubscriptionState.
+// CXIMPDataSubscriptionStateImp::SetDataState()
+// ---------------------------------------------------------------------------
+//
+void CXIMPDataSubscriptionStateImp::SetDataStateL(
+    MXIMPDataSubscriptionState::TDataState aDataState )
+    {
+    SetDataState( aDataState );
+    }
+
+
+// ---------------------------------------------------------------------------
+// From class MXIMPDataSubscriptionState.
+// CXIMPDataSubscriptionStateImp::SetSubscriptionState()
+// ---------------------------------------------------------------------------
+//
+void CXIMPDataSubscriptionStateImp::SetSubscriptionState(
+    MXIMPDataSubscriptionState::TSubscriptionState aSubscriptionState )
+    {
+    if ( MXIMPDataSubscriptionState::ESubscriptionActive == aSubscriptionState )
+        {
+        TRACE( _L("CXIMPDataSubscriptionStateImp::SetSubscriptionState ESubscriptionActive" ) );
+        }
+    else if ( MXIMPDataSubscriptionState::ESubscriptionInactive == aSubscriptionState )
+        {
+        TRACE( _L("CXIMPDataSubscriptionStateImp::SetSubscriptionState ESubscriptionInactive" ) );
+        }
+    else 
+        {
+        TRACE( _L("CXIMPDataSubscriptionStateImp::SetSubscriptionState XXX" ) );
+        }
+    iSubscriptionState = aSubscriptionState;
+    }
+
+
+// ---------------------------------------------------------------------------
+// From class MXIMPDataSubscriptionState.
+// CXIMPDataSubscriptionStateImp::SetDataState()
+// ---------------------------------------------------------------------------
+//
+void CXIMPDataSubscriptionStateImp::SetDataState(
+    MXIMPDataSubscriptionState::TDataState aDataState )
+    {
+    iDataState = aDataState;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPDataSubscriptionStateImp::ExternalizeL()
+// ---------------------------------------------------------------------------
+//
+void CXIMPDataSubscriptionStateImp::ExternalizeL( RWriteStream& aStream ) const
+    {
+    aStream.WriteInt32L( iSubscriptionState );
+    aStream.WriteInt32L( iDataState );
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPDataSubscriptionStateImp::InternalizeL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CXIMPDataSubscriptionStateImp::InternalizeL( RReadStream& aStream )
+    {
+    iSubscriptionState =
+        (MXIMPDataSubscriptionState::TSubscriptionState) aStream.ReadInt32L();
+
+    iDataState =
+        (MXIMPDataSubscriptionState::TDataState) aStream.ReadInt32L();
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPDataSubscriptionStateImp::EqualsContent()
+// ---------------------------------------------------------------------------
+//
+TBool CXIMPDataSubscriptionStateImp::EqualsContent(
+    const CXIMPApiDataObjBase& aOtherInstance ) const
+    {
+    const CXIMPDataSubscriptionStateImp* tmp =
+    TXIMPGetImpClassOrPanic< const CXIMPDataSubscriptionStateImp >::From(
+                                                        aOtherInstance.Base() );
+
+    TBool totallySame = ETrue;
+    TBool x;
+    x = iSubscriptionState == tmp->iSubscriptionState;
+    totallySame &= x;
+
+    x = iDataState == tmp->iDataState;
+    totallySame &= x;
+    
+    return totallySame;
+    }
+
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/core/srcdatamodel/ximpdatasubscriptionstateimp.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,146 @@
+/*
+* 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:  MXIMPDataSubscriptionState API object implementation.
+*
+*/
+
+#ifndef CXIMPDATASUBSCRIPTIONSTATEIMP_H
+#define CXIMPDATASUBSCRIPTIONSTATEIMP_H
+
+#include "ximpapidataobjbase.h"
+#include <ximpdatasubscriptionstate.h>
+#include <s32strm.h>
+
+/**
+ * MXIMPDataSubscriptionState API object implementation.
+ *
+ * @lib ximpdatamodel.dll
+ * @since S60 v3.2
+ */
+NONSHARABLE_CLASS( CXIMPDataSubscriptionStateImp ): public CXIMPApiDataObjBase,
+                                                    public MXIMPDataSubscriptionState
+    {
+public:
+    /** The class ID. */
+    enum { KClassId = XIMPIMP_CLSID_CXIMPDATASUBSCRIPTIONSTATEIMP };
+
+public:
+
+    /**
+     * Construction methods.
+     */
+    IMPORT_C static CXIMPDataSubscriptionStateImp* NewLC();
+    IMPORT_C static CXIMPDataSubscriptionStateImp* NewL();
+    
+    /**
+     * Destruction
+     */
+    virtual ~CXIMPDataSubscriptionStateImp();
+
+private:
+
+    /**
+     * Construction
+     */
+    CXIMPDataSubscriptionStateImp();
+    void ConstructL();
+
+    /**
+     * @see CXIMPApiDataObjBase
+     */
+    XIMPIMP_DECLARE_DATAOBJ_BASE_PRIV_METHODS
+
+public: // From MXIMPBase
+
+    /**
+     * Implementation of MXIMPBase interface methods
+     * @see MXIMPBase
+     */
+    XIMPIMP_DECLARE_IF_BASE_METHODS
+
+    /**
+     * @see CXIMPApiDataObjBase
+     */
+    XIMPIMP_DECLARE_DATAOBJ_BASE_METHODS
+
+
+public: // From MXIMPDataSubscriptionState
+
+    /**
+     * Implementation of MXIMPDataSubscriptionState interface methods
+     * @see MXIMPDataSubscriptionState
+     */
+    MXIMPDataSubscriptionState::TSubscriptionState SubscriptionState() const;
+    
+    /**
+     * Implementation of MXIMPDataSubscriptionState interface methods
+     * @see MXIMPDataSubscriptionState
+     */
+    MXIMPDataSubscriptionState::TDataState DataState() const;
+
+    /**
+     * Implementation of MXIMPDataSubscriptionState interface methods
+     * @see MXIMPDataSubscriptionState
+     */
+    void SetSubscriptionStateL( MXIMPDataSubscriptionState::TSubscriptionState aSubscriptionState );
+
+    /**
+     * Implementation of MXIMPDataSubscriptionState interface methods
+     * @see MXIMPDataSubscriptionState
+     */
+    void SetDataStateL( MXIMPDataSubscriptionState::TDataState aDataState );
+
+public: // New functions
+
+    /**
+     * Internalizes object data from given stream.
+     * @param aStream Stream to read.
+     */
+    IMPORT_C void InternalizeL( RReadStream& aStream );
+
+    /**
+     * Set subscriptionstate for internal usage.
+     * Created as non leaving version of method.
+     * @param aSubscriptionState New subscription state for state object.
+     */
+    void SetSubscriptionState( MXIMPDataSubscriptionState::TSubscriptionState aSubscriptionState );
+    
+    /**
+     * Set data state for internal use.
+     * Created as non leaving version of method.
+     * @param aDataState New data state for state object.
+     */
+    void SetDataState( MXIMPDataSubscriptionState::TDataState aDataState );
+
+private: // data
+
+
+    /**
+     * Subscription state.
+     * Own.
+     */
+    TSubscriptionState iSubscriptionState;
+
+
+    /**
+     * Data state.
+     * Own.
+     */
+    TDataState iDataState;
+    };
+
+
+#endif // CXIMPDATASUBSCRIPTIONSTATEIMP_H
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/core/srcdatamodel/ximpeventcodec.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,233 @@
+/*
+* 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:  Base class for API implementations.
+*
+*/
+
+
+#include <s32strm.h>
+#include <s32mem.h>
+
+#include "ximpeventcodec.h"
+#include "ximprequestcompleteeventimp.h"
+#include "ximpcontextstateeventimp.h"
+
+
+/**
+ * Type definition for exact API event constructor signature.
+ */
+typedef CXIMPApiEventBase* (*TApiEventConstructor)( RReadStream& );
+
+
+
+/**
+ * Structure for mapping event interface IDs to
+ * to corect API event constructors.
+ */
+struct SApiEventConstructorMap
+    {
+    //Interface id
+    TInt32    iInterfaceId;
+
+    //Function pointer to event interface implementation
+    TApiEventConstructor iConstructorPtr;
+    } ;
+
+
+
+/**
+ * Helper macro to initialise KApiEventConstructorTable members.
+ *
+ * Macro forces that each event implementation class to have static
+ * NewFromStreamLC() memeber function to instantiate the object.
+ *
+ * See TApiEventConstructor type definition for exact constructor
+ * signature.
+ */
+#define CONSTRUCTOR_ENTRY( TheImplementedIf, TheClass ) \
+    { TheImplementedIf::KInterfaceId, TheClass::NewFromStreamLC } \
+
+
+
+/**
+ * Constructor function mapping for event interface implementations.
+ *
+ * When new event types are implemented, add them here.
+ */
+const SApiEventConstructorMap KApiEventConstructorTable[] =
+    {
+    CONSTRUCTOR_ENTRY( MXIMPRequestCompleteEvent, CXIMPRequestCompleteEventImp ),
+    CONSTRUCTOR_ENTRY( MXIMPContextStateEvent, CXIMPContextStateEventImp )
+    };
+
+
+/**
+ * Count of constructor mappings.
+ */
+const TInt KApiEventConstructorCount = sizeof( KApiEventConstructorTable )
+                                        / sizeof( SApiEventConstructorMap );
+
+
+
+// ============================ HELPER FUNCTIONS =============================
+
+
+/**
+ * Helper function to locate constructor function for
+ * event interface ID.
+ *
+ * @param aEventInterfaceId The event interface ID.
+ * @return Event object constructor function.
+ */
+TApiEventConstructor ConstructorForInterface( TInt32 aEventInterfaceId )
+    {
+    //Locate correct constructor
+    for( TInt ix = 0; ix < KApiEventConstructorCount; ix++ )
+        {
+        const SApiEventConstructorMap map = KApiEventConstructorTable[ ix ];
+        if( map.iInterfaceId == aEventInterfaceId )
+            {
+            return map.iConstructorPtr;
+            }
+        }
+
+
+    //If assertion below fails, check that event implementation
+    //class implementing requested event interface (aEventInterfaceId)
+    //is registered to KApiEventConstructorTable
+//    __ASSERT_DEBUG( EFalse,
+//                    User::Panic( _L("XIMPEventCodec"), KErrUnknown ) );
+
+    return NULL;
+    }
+
+
+/**
+ * Helper function to instantiate new event object
+ * of requested type and construct it from the stream.
+ *
+ * @param aEventInterfaceId
+ * @return Event object constructor function.
+ */
+CXIMPApiEventBase* NewEventObjectFromStreamLC( TInt32 aEventInterfaceId,
+                                               RReadStream& aStream )
+    {
+    TApiEventConstructor newFromStreamLC = NULL;
+
+    //Locate correct constructor for interface ID
+    newFromStreamLC = ConstructorForInterface( aEventInterfaceId );
+
+    if ( newFromStreamLC )
+        {
+        //Instantiate the object
+        CXIMPApiEventBase* eventObject = newFromStreamLC( aStream );
+        return eventObject;
+        }
+
+
+    // if no constructor
+    return NULL;
+    }
+
+
+
+// ============================ MEMBER FUNCTIONS =============================
+
+// ---------------------------------------------------------------------------
+// XIMPEventCodec::PackL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C HBufC8* XIMPEventCodec::PackL( CXIMPApiEventBase& aEventObj,
+                                        TInt32& aTypeOfEvent )
+    {
+    CBufFlat* buffer = CBufFlat::NewL( 10 ); // initial granularity to 10
+    CleanupStack::PushL( buffer );
+
+    RBufWriteStream ws;
+    CleanupClosePushL( ws );
+    ws.Open( *buffer ); // CSI: 65 #
+
+    //Ask real event type through the event base interface
+    TInt32 eventIfId = aEventObj.Base().GetInterfaceId();
+
+    //And write both event type and data
+    ws.WriteInt32L( eventIfId );
+    aEventObj.ExternalizeL( ws );
+    ws.CommitL();
+    CleanupStack::PopAndDestroy();  //ws
+
+    HBufC8* heapBuf = buffer->Ptr( 0 ).AllocL();
+
+    CleanupStack::PopAndDestroy( buffer );
+
+
+    aTypeOfEvent = eventIfId;
+    return heapBuf;
+    }
+
+
+// ---------------------------------------------------------------------------
+// XIMPEventCodec::PackL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void XIMPEventCodec::PackL( CXIMPApiEventBase& aEventObj,
+                                     TInt32& aTypeOfEvent,
+                                     CBufFlat* aBuffer )
+    {
+    RBufWriteStream ws;
+    CleanupClosePushL( ws );
+    ws.Open( *aBuffer ); // CSI: 65 #
+
+    //Ask real event type through the event base interface
+    TInt32 eventIfId = aEventObj.Base().GetInterfaceId();
+
+    //And write both event type and data
+    ws.WriteInt32L( eventIfId );
+    aEventObj.ExternalizeL( ws );
+    ws.CommitL();
+    CleanupStack::PopAndDestroy();  //ws
+    
+    aTypeOfEvent = eventIfId;
+    }
+
+
+// ---------------------------------------------------------------------------
+// XIMPEventCodec::UnPackL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CXIMPApiEventBase* XIMPEventCodec::UnPackL( const TDesC8& aEventData,
+                                                     TInt32& aTypeOfEvent )
+    {
+    RDesReadStream rs;
+    rs.Open( aEventData ); // CSI: 65 #
+    CleanupClosePushL( rs );
+
+    TInt32 eventIfId = rs.ReadInt32L();
+    CXIMPApiEventBase* eventObject = NewEventObjectFromStreamLC( eventIfId, rs );
+    
+    if ( eventObject )
+        {
+        CleanupStack::Pop(); //eventObject    
+        }
+        
+    CleanupStack::PopAndDestroy(); // rs
+
+
+    aTypeOfEvent = eventIfId;
+    return eventObject;
+    }
+
+
+// End of file
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/core/srcdatamodel/ximpeventcodec.h	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  Codec to pack and unpack event objects.
+*
+*/
+
+#ifndef XIMPEVENTCODEC_H
+#define XIMPEVENTCODEC_H
+
+#include <e32base.h>
+
+class CXIMPApiEventBase;
+class RReadStream;
+
+
+/**
+ * Codec to pack and unpack event objects.
+ *
+ * @lib ximpdatamodel.dll
+ * @since S60 v3.2
+ */
+NONSHARABLE_CLASS( XIMPEventCodec )
+    {
+public:
+
+    /**
+     *
+     *
+     *
+     * @param
+     *
+     * @return
+     *
+     */
+    IMPORT_C static HBufC8* PackL( CXIMPApiEventBase& aEventObj,
+                                   TInt32& aTypeOfEvent );
+    IMPORT_C static void PackL( CXIMPApiEventBase& aEventObj,
+                         TInt32& aTypeOfEvent,
+                         CBufFlat* aBuffer );
+
+    /**
+     *
+     *
+     *
+     * @param
+     *
+     * @return
+     *
+     */
+    IMPORT_C static CXIMPApiEventBase* UnPackL( const TDesC8& aEventData,
+                                                TInt32& aTypeOfEvent );
+
+
+private:
+
+    XIMPEventCodec();
+    ~XIMPEventCodec();
+
+    };
+
+
+#endif // XIMPEVENTCODEC_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/core/srcdatamodel/ximpfeatureinfoimp.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,233 @@
+/*
+* 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:  MXIMPFeatureInfo API object implementation.
+*
+*/
+
+#include "ximpfeatureinfoimp.h"
+#include "ximprbufhelpers.h"
+
+
+const TInt KXIMPFeatureInfoGranularity = 5;
+
+// ============================ MEMBER FUNCTIONS =============================
+
+// ---------------------------------------------------------------------------
+// CXIMPFeatureInfoImp::NewLC()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CXIMPFeatureInfoImp* CXIMPFeatureInfoImp::NewLC()
+    {
+    CXIMPFeatureInfoImp* self = new( ELeave ) CXIMPFeatureInfoImp;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPFeatureInfoImp::NewLC()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CXIMPFeatureInfoImp* CXIMPFeatureInfoImp::NewL()
+    {
+    CXIMPFeatureInfoImp* self = CXIMPFeatureInfoImp::NewLC();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+
+
+// ---------------------------------------------------------------------------
+// CXIMPFeatureInfoImp::~CXIMPFeatureInfoImp()
+// ---------------------------------------------------------------------------
+//
+CXIMPFeatureInfoImp::~CXIMPFeatureInfoImp()
+    {
+    if ( iFeatures )
+        {
+        iFeatures->Reset();
+        }
+    delete iFeatures;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPFeatureInfoImp::CXIMPFeatureInfoImp()
+// ---------------------------------------------------------------------------
+//
+CXIMPFeatureInfoImp::CXIMPFeatureInfoImp()
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPFeatureInfoImp::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void CXIMPFeatureInfoImp::ConstructL()
+    {
+    iFeatures = new ( ELeave ) CDesC8ArraySeg( KXIMPFeatureInfoGranularity );
+    }
+
+// ---------------------------------------------------------------------------
+// CXIMPFeatureInfoImp::NewFromStreamLC()
+// ---------------------------------------------------------------------------
+//
+XIMPIMP_IMPLEMENT_DATAOBJ_NEWFROMSTREAM( CXIMPFeatureInfoImp )
+
+
+// ---------------------------------------------------------------------------
+// Implement supported interface access.
+// ---------------------------------------------------------------------------
+//
+XIMPIMP_IF_BASE_GET_INTERFACE_BEGIN( CXIMPFeatureInfoImp, 
+                                     MXIMPFeatureInfo )
+XIMPIMP_IF_BASE_GET_INTERFACE_END()
+
+XIMPIMP_IF_BASE_GET_CONST_INTERFACE_BEGIN( CXIMPFeatureInfoImp, 
+                                           MXIMPFeatureInfo )
+XIMPIMP_IF_BASE_GET_INTERFACE_END()
+
+
+// ---------------------------------------------------------------------------
+// CXIMPFeatureInfoImp::FeatureIds()
+// ---------------------------------------------------------------------------
+const MDesC8Array& CXIMPFeatureInfoImp::FeatureIds() const
+    {
+    return *iFeatures;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPFeatureInfoImp::HasFeatureId()
+// ---------------------------------------------------------------------------
+TInt CXIMPFeatureInfoImp::HasFeatureId( const TDesC8& aFeatureId )
+    {
+    TInt index(0);
+    return FindFeature( aFeatureId, index );
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPFeatureInfoImp::AddFeatureL()
+// ---------------------------------------------------------------------------
+EXPORT_C TInt CXIMPFeatureInfoImp::AddFeatureL( const TDesC8& aFeature )
+    {
+    // First check if the feature already exists
+    TInt index( 0 );
+    if ( FindFeature( aFeature, index ) == 0 )
+        {
+        return KErrAlreadyExists;
+        }
+
+    // Add to features
+    iFeatures->InsertIsqL( aFeature );
+    return KErrNone;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPFeatureInfoImp::FindFeature()
+// ---------------------------------------------------------------------------
+TInt CXIMPFeatureInfoImp::FindFeature( const TDesC8& aFeature, TInt& aIndex )
+    {
+    if ( iFeatures->FindIsq( aFeature, aIndex ) != 0 )
+        {
+        return KErrNotFound;
+        }
+
+    return KErrNone;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPFeatureInfoImp::ExternalizeL()
+// ---------------------------------------------------------------------------
+//
+void CXIMPFeatureInfoImp::ExternalizeL( RWriteStream& aStream ) const
+    {
+    const TInt featureCount = iFeatures->MdcaCount();
+    aStream.WriteInt32L( featureCount );
+
+    for ( TInt count = 0; count < featureCount; count++ )
+        {
+        TPtrC8 temp (iFeatures->MdcaPoint( count ) );
+        aStream.WriteInt32L( temp.Length() );
+        aStream.WriteL( temp );
+        }
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPFeatureInfoImp::InternalizeL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CXIMPFeatureInfoImp::InternalizeL( RReadStream& aStream )
+    {
+    iFeatures->Reset();
+
+    const TInt featureCount = aStream.ReadInt32L();
+
+    RBuf8 temp;
+    CleanupClosePushL( temp );
+
+    for ( TInt count( 0 ); count < featureCount; count++ )
+        {
+        const TInt length = aStream.ReadInt32L();
+        XIMPRBuf8Helper::GrowIfNeededL( temp, length );
+        aStream.ReadL( temp, length );
+
+        // Fine to simply append new entries, since we are internalizing
+        // data which has been already validated and ordered
+        iFeatures->AppendL( temp );
+        }
+
+    CleanupStack::PopAndDestroy(); // temp
+    }
+
+// ---------------------------------------------------------------------------
+// CXIMPFeatureInfoImp::EqualsContent()
+// ---------------------------------------------------------------------------
+//
+TBool CXIMPFeatureInfoImp::EqualsContent( 
+    const CXIMPApiDataObjBase& aOtherInstance ) const
+    {
+    const CXIMPFeatureInfoImp* tmp =
+        TXIMPGetImpClassOrPanic< const CXIMPFeatureInfoImp >::From( aOtherInstance.Base() );
+
+    TBool same = ETrue;
+    TBool x;
+
+    x = iFeatures->MdcaCount() == tmp->iFeatures->MdcaCount();
+    same &= x;
+
+    if ( ! same )
+        {
+        // early-out if lengths mismatch to avoid costly array
+        // comparison
+        return EFalse;
+        }
+
+    // arrays must be in same order with same content.
+    for ( TInt i = 0; i < iFeatures->Count(); i++ )
+        {
+        x = 0 == iFeatures->MdcaPoint( i ).Compare( tmp->iFeatures->MdcaPoint( i ) );
+        same &= x;
+        }
+
+    return same;
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/core/srcdatamodel/ximpfeatureinfoimp.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,126 @@
+/*
+* 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:  MXIMPFeatureInfo API object implementation.
+*
+*/
+
+#ifndef CXIMPFEATUREINFOIMP_H
+#define CXIMPFEATUREINFOIMP_H
+
+
+#include "ximpapidataobjbase.h"
+#include <ximpfeatureinfo.h>
+#include <s32strm.h> // RWriteStream, RReadStream
+#include <badesca.h> // CDesC8ArraySeg
+
+
+/**
+ * MXIMPFeatureInfo API object implementation.
+ *
+ * @lib ximpdatamodel.dll
+ * @since S60 v3.2
+ */
+NONSHARABLE_CLASS( CXIMPFeatureInfoImp ): public CXIMPApiDataObjBase,
+                                          public MXIMPFeatureInfo
+    {
+public:
+    /** The class ID. */
+    enum { KClassId = XIMPIMP_CLSID_CXIMPFEATUREINFOIMP };
+
+
+public:
+
+    IMPORT_C static CXIMPFeatureInfoImp* NewLC();
+    IMPORT_C static CXIMPFeatureInfoImp* NewL();
+    virtual ~CXIMPFeatureInfoImp();
+
+
+private:
+
+    CXIMPFeatureInfoImp();
+    void ConstructL();
+    
+    /**
+     * @see CXIMPApiDataObjBase
+     */
+    XIMPIMP_DECLARE_DATAOBJ_BASE_PRIV_METHODS
+
+
+public: // From MXIMPBase
+
+    /**
+     * Implementation of MXIMPBase interface methods
+     * @see MXIMPBase
+     */
+    XIMPIMP_DECLARE_IF_BASE_METHODS
+
+    /**
+     * @see CXIMPApiDataObjBase
+     */
+    XIMPIMP_DECLARE_DATAOBJ_BASE_METHODS
+
+public: // From MXIMPFeatureInfo
+
+    /**
+     * Implementation of MXIMPFeatureInfo interface methods
+     * @see MXIMPFeatureInfo
+     */
+    const MDesC8Array& FeatureIds() const;
+    TInt HasFeatureId( const TDesC8& aFeatureId );
+
+
+public: // New methods
+
+    /**
+     * Adds a feature.
+     *
+     * @param aFeature Feature to be added.
+     * @return KErrNone if the feature was added successfully,
+     *         KErrAlreadyExists if the feature already exists,
+     */
+    IMPORT_C TInt AddFeatureL( const TDesC8& aFeature );
+
+    /**
+     * Internalizes object data from given stream.
+     * @param aStream Stream to read.
+     */
+    IMPORT_C void InternalizeL( RReadStream& aStream );
+
+
+private: // helpers
+
+    /**
+     * Find a feature from features.
+     *
+     * @param [in] aFeature That is searched.
+     * @param [out] aIndex If found the index position of the found feature,
+     *                     if not found the place where it should be inserted.
+     * @return KErrNone if the feature exists,
+     *         KErrNotFound if the feature isn't found,
+     */
+    TInt FindFeature( const TDesC8& aFeature, TInt& aIndex );
+
+
+private: // data
+
+    /**
+     * Supported features
+     * Own.
+     */
+    CDesC8ArraySeg* iFeatures;
+
+    };
+
+
+#endif // CXIMPFEATUREINFOIMP_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/core/srcdatamodel/ximpfeaturepluginholder.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,198 @@
+/*
+* 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 Service Connection globals holder
+ *
+*/
+
+
+#include <e32base.h>
+#include "ximpfeaturepluginholder.h"
+#include "apidataobjfactoryaccessor.h"
+
+const TInt KPluginArrayGranularity = 3;
+
+// ============================ HELPER CLASS ===============================
+
+
+/**
+ * Nested structure to hold global accessor objects.
+ */
+
+// FIXME: probably better would be to encapsulate the struct to CBase object
+NONSHARABLE_STRUCT( SAccessorHolder )
+    {
+    /**
+     * Presence obj factory accessor
+     * Owned.
+     */
+    MApiDataObjFactoryAccessor* iPresenceAccessor;
+
+
+    // array of accessor plugins 
+    CArrayFixFlat<MApiDataObjFactoryAccessor*>* iAccessorPlugins;
+    
+    /**
+     * TODO: Add here more accessors
+     */
+     
+    /**
+     * Reference counter
+     */
+    TInt iRefCount;
+    };
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void FeaturePluginHolder::InitializeL( )
+    {
+    SAccessorHolder* singleton = ( SAccessorHolder* ) Dll::Tls();
+
+    if( !singleton )
+        {
+        singleton = new ( ELeave ) SAccessorHolder;
+        Dll::SetTls( singleton );
+        
+        // Initialize the variables
+        singleton->iRefCount = 0;
+        singleton->iPresenceAccessor = NULL;
+
+        TRAP_IGNORE( singleton->iPresenceAccessor = MApiDataObjFactoryAccessor::NewPresenceAccessorL( ) );
+        
+        //added to hold accessor plugins
+        singleton->iAccessorPlugins = new(ELeave)CArrayFixFlat<MApiDataObjFactoryAccessor*>(KPluginArrayGranularity);
+        
+        FeaturePluginHolder::LoadAccessorPluginsL() ;
+        }
+    else
+        {
+        // increase the reference counter
+        singleton->iRefCount++;
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// 
+// -----------------------------------------------------------------------------
+//
+EXPORT_C MApiDataObjFactoryAccessor* FeaturePluginHolder::PresenceObjFactoryAccessor()
+    {
+    SAccessorHolder* singleton = ( SAccessorHolder* ) Dll::Tls();
+    if( !singleton )
+        {
+        User::Panic( _L("cximpglobals"), KErrNotFound );
+        }
+
+    return singleton->iPresenceAccessor;
+    }
+
+
+// -----------------------------------------------------------------------------
+// FeaturePluginHolder::Release()
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void FeaturePluginHolder::Release( )
+    {
+    SAccessorHolder* singleton = ( SAccessorHolder* ) Dll::Tls();
+    if ( !singleton->iRefCount )
+        {
+        // No more users, clean the TLS up
+        delete singleton->iPresenceAccessor;
+        if ( singleton->iAccessorPlugins )
+	    	{
+	    	TInt idx = KErrNotFound;
+	    	while( singleton->iAccessorPlugins->Count() )
+	        	{
+		        idx = singleton->iAccessorPlugins->Count() - 1;
+		        // Delete object
+		        delete singleton->iAccessorPlugins->At( idx );
+		        // Delete element
+		        singleton->iAccessorPlugins->Delete( idx );
+	        	}
+	    	}	
+
+        delete singleton->iAccessorPlugins;
+        REComSession::FinalClose();
+        
+        delete singleton;
+        Dll::SetTls(NULL);
+        }
+    else
+        {
+        singleton->iRefCount--;        
+        }
+    }
+    
+void FeaturePluginHolder::LoadAccessorPluginsL()    
+{
+	SAccessorHolder* singleton = ( SAccessorHolder* ) Dll::Tls();
+	if(!singleton)	
+	{
+		User::Panic( _L("cximpglobals"), KErrNotFound );
+	}
+	else
+	{
+		RImplInfoPtrArray pluginArray;	
+		MApiDataObjFactoryAccessor::ListAllImplementationsL(pluginArray) ;		
+		if ( pluginArray.Count() )
+		{
+			for( TInt i = 0; i < pluginArray.Count(); i++ )
+			{
+				MApiDataObjFactoryAccessor* implementation = NULL ;
+				
+				CImplementationInformation* info = pluginArray[ i ];
+            
+            	TUid id = info->ImplementationUid();
+            	TRAPD(err, implementation = MApiDataObjFactoryAccessor::NewL(id) );
+            	CleanupStack::PushL(implementation);
+            	if(err == KErrNone)
+            	{
+            		singleton->iAccessorPlugins->AppendL( implementation );
+            	}
+            	CleanupStack::Pop(implementation);
+			}
+		}
+		pluginArray.ResetAndDestroy();
+	}
+}
+
+EXPORT_C TInt FeaturePluginHolder::AccessorCount()
+{
+	SAccessorHolder* singleton = ( SAccessorHolder* ) Dll::Tls();
+	if(!singleton)	
+	{
+		User::Panic( _L("cximpglobals"), KErrNotFound );
+	}
+
+	return singleton->iAccessorPlugins->Count() ;	
+	
+}
+
+EXPORT_C MApiDataObjFactoryAccessor* FeaturePluginHolder::Accessor(TInt index) 
+{
+	SAccessorHolder* singleton = ( SAccessorHolder* ) Dll::Tls();
+	if(!singleton)	
+	{
+		User::Panic( _L("cximpglobals"), KErrNotFound );
+	}
+	
+	return singleton->iAccessorPlugins->At(index) ;
+}
+
+// End of file
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/core/srcdatamodel/ximpfeaturepluginholder.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,83 @@
+/*
+* 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 Service Connection globals holder
+ *
+*/
+
+#ifndef FEATUREPLUGINHOLDER_H
+#define FEATUREPLUGINHOLDER_H
+
+class MApiDataObjFactoryAccessor;
+
+/**
+ * Static helper class for accessing the Feature Plug-in datamodel internal interfaces.
+ *
+ * @lib ximpdatamodel.dll
+ * @since S60 v5.0
+ */
+class FeaturePluginHolder 
+    {
+    public: 
+
+        /**
+         * Initializes the TLS where the pointers to the different accessor objects 
+         * from feature plug-ins are stores. The TLS is reference counted.
+         *
+         *
+         */
+        IMPORT_C static void InitializeL();
+
+         /**
+         * Returns the API Data Model Object Factory Accessor from the presence feature plug-in.
+         *
+         *
+         */
+        IMPORT_C static MApiDataObjFactoryAccessor* PresenceObjFactoryAccessor(  );
+
+         /**
+         * Cleans the TLS, reference counted.
+         *
+         *
+         */
+        IMPORT_C static void Release();
+        
+         /**
+         * Returns the API Data Model Object Factory Accessor count
+         *
+         *
+         */
+        IMPORT_C static TInt AccessorCount();
+        
+         /**
+         * Returns the API Data Model Object Factory Accessor from given index
+         *
+         *
+         */
+        IMPORT_C static MApiDataObjFactoryAccessor* Accessor(TInt index) ;
+        
+        
+        
+    private:
+
+         /**
+         * Loads all ecom accessor 
+         *
+         *
+         */
+    	void static LoadAccessorPluginsL() ;    
+    };
+
+#endif      // FEATUREPLUGINHOLDER_H
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/core/srcdatamodel/ximpidentityimp.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  MXIMPIdentity API object implementation.
+*
+*/
+
+
+#include "ximpidentityimp.h"
+#include "ximprbufhelpers.h"
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// CXIMPIdentityImp::NewLC()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CXIMPIdentityImp* CXIMPIdentityImp::NewLC()
+    {
+    CXIMPIdentityImp* self = new( ELeave ) CXIMPIdentityImp;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+
+EXPORT_C CXIMPIdentityImp* CXIMPIdentityImp::NewL()
+    {
+    CXIMPIdentityImp* self = CXIMPIdentityImp::NewLC();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+
+EXPORT_C CXIMPIdentityImp* CXIMPIdentityImp::NewLC( const TDesC16& aIdentity )
+    {
+    CXIMPIdentityImp* self = new( ELeave ) CXIMPIdentityImp;
+    CleanupStack::PushL( self );
+    self->ConstructL( aIdentity );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CXIMPIdentityImp::~CXIMPIdentityImp()
+// ---------------------------------------------------------------------------
+//
+CXIMPIdentityImp::~CXIMPIdentityImp()
+    {
+    iIdentity.Close();
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPIdentityImp::CXIMPIdentityImp()
+// ---------------------------------------------------------------------------
+//
+CXIMPIdentityImp::CXIMPIdentityImp()
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPIdentityImp::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void CXIMPIdentityImp::ConstructL()
+    {
+    iIdentity.CreateL( 0 );
+    }
+
+void CXIMPIdentityImp::ConstructL( const TDesC16& aIdentity )
+    {
+    iIdentity.CreateL( aIdentity );
+    }
+
+// ---------------------------------------------------------------------------
+// CXIMPIdentityImp::NewFromStreamLC()
+// ---------------------------------------------------------------------------
+//
+XIMPIMP_IMPLEMENT_DATAOBJ_NEWFROMSTREAM( CXIMPIdentityImp )
+
+
+// ---------------------------------------------------------------------------
+// Implement supported interface access.
+// ---------------------------------------------------------------------------
+//
+XIMPIMP_IF_BASE_GET_INTERFACE_BEGIN( CXIMPIdentityImp,
+                                     MXIMPIdentity )
+XIMPIMP_IF_BASE_GET_INTERFACE_END()
+
+
+XIMPIMP_IF_BASE_GET_CONST_INTERFACE_BEGIN( CXIMPIdentityImp,
+                                           MXIMPIdentity )
+XIMPIMP_IF_BASE_GET_INTERFACE_END()
+
+
+
+// ---------------------------------------------------------------------------
+// CXIMPIdentityImp::SetIdentityL()
+// ---------------------------------------------------------------------------
+//
+void CXIMPIdentityImp::SetIdentityL( const TDesC16& aIdentity )
+    {
+    iIdentity.Close();
+    iIdentity.CreateL( aIdentity );
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPIdentityImp::Identity()
+// ---------------------------------------------------------------------------
+//
+const TDesC16& CXIMPIdentityImp::Identity() const
+    {
+    return iIdentity;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPIdentityImp::ExternalizeL()
+// ---------------------------------------------------------------------------
+//
+void CXIMPIdentityImp::ExternalizeL( RWriteStream& aStream ) const
+    {
+    XIMPRBuf16Helper::ExternalizeL( iIdentity, aStream );
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPIdentityImp::InternalizeL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CXIMPIdentityImp::InternalizeL( RReadStream& aStream )
+    {
+    XIMPRBuf16Helper::InternalizeL( iIdentity, aStream );
+    }
+
+// ---------------------------------------------------------------------------
+// CXIMPIdentityImp::operator!=()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TBool CXIMPIdentityImp::operator!=( const CXIMPIdentityImp& aOther ) const
+    {
+    if( iIdentity.Compare( aOther.iIdentity ) )
+        {
+        return ETrue;
+        }
+    else
+        {
+        return EFalse;
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CXIMPIdentityImp::EqualsContent()
+// ---------------------------------------------------------------------------
+//
+TBool CXIMPIdentityImp::EqualsContent(
+    const CXIMPApiDataObjBase& aOtherInstance ) const
+    {
+    const CXIMPIdentityImp* tmp =
+        TXIMPGetImpClassOrPanic< const CXIMPIdentityImp >::From( aOtherInstance.Base() );
+
+    TBool same = ETrue;
+
+    TBool x;
+    x = 0 == iIdentity.Compare( tmp->iIdentity );
+    same &= x;
+
+    return same;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPIdentityImp::Compare()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CXIMPIdentityImp::Compare( const CXIMPIdentityImp& aOther ) const
+    {
+    return iIdentity.Compare( aOther.iIdentity );
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/core/srcdatamodel/ximpitemparent.h	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  Item parent interface.
+*
+*/
+
+#ifndef CXIMPITEMPARENT_H
+#define CXIMPITEMPARENT_H
+
+#include <ximpitemparentbase.h>
+
+class COwnPresenceSubscriptionItem;
+class CGroupListSubscriptionItem;
+class CGroupContentSubscriptionItem;
+class CPresentityPresenceSubscriptionItem;
+class CPresentityGroupMembersPresenceSubscriptionItem;
+class CWatcherListSubscriptionItem;
+class CGrantRequestListSubscriptionItem;
+//class CXIMPSubscriptionItemBase;
+class CXIMPApiEventBase;
+class MXIMPPscContext;
+class CXIMPIdentityImp;
+class CPresenceConfigurationItem;
+class CGroupMembersPresenceConfigurationItem;
+class CXIMPConfigurationItemBase;
+class CBlockListSubscriptionItem;
+class CPresenceToEveryoneConfigurationItem;
+class MPresenceCacheWriter;
+
+// FIX ME
+#define PRESENCE_ITEM_PARENT	0xE0000009
+
+/**
+ * Item parent interface.
+ *
+ * @since S60 v3.2
+ */
+class MXIMPItemParent : public MXIMPItemParentBase
+    {
+	public:
+		enum { KInterfaceId = PRESENCE_ITEM_PARENT};
+    
+public: // Definitions
+
+    /**
+     * Remove item
+     * @param aChild Item pointer to remove.
+     */
+    virtual void RemoveMe( COwnPresenceSubscriptionItem* aChild ) = 0;
+    virtual void RemoveMe( CGroupListSubscriptionItem* aChild ) = 0;
+    virtual void RemoveMe( CGroupContentSubscriptionItem* aChild ) = 0;
+    virtual void RemoveMe( CPresentityPresenceSubscriptionItem* aChild ) = 0;
+    virtual void RemoveMe( CWatcherListSubscriptionItem* aChild ) = 0;
+    virtual void RemoveMe( CPresentityGroupMembersPresenceSubscriptionItem* aChild ) = 0;
+    virtual void RemoveMe( CGrantRequestListSubscriptionItem* aChild ) = 0;
+    virtual void RemoveMe( CBlockListSubscriptionItem* aChild ) = 0;
+
+    virtual void RemoveMe( CPresenceConfigurationItem* aChild ) = 0;
+    virtual void RemoveMe( CPresenceToEveryoneConfigurationItem* aChild ) = 0;
+    virtual void RemoveMe( CGroupMembersPresenceConfigurationItem* aChild ) = 0;
+
+    /**
+     * Add event
+     */
+    virtual void AddEventL( CXIMPApiEventBase& aEvent, MXIMPPscContext* aContext ) = 0;
+
+    /**
+     * Register item for expiration purposes.
+     */   
+    //virtual void RegisterExpiringItemL( CXIMPSubscriptionItemBase* aExpireItem ) = 0;
+    
+    /**
+     * Unregister item from expiration purposes.
+     */
+    //virtual void UnregisterExpiringItem( CXIMPSubscriptionItemBase* aExpireItem ) = 0;
+    
+    /**
+     * Add item as subscriber for presentity presence.
+     */
+    virtual void AddPresentityPresenceSubscriberL( const CXIMPIdentityImp& aIdentity, CXIMPSubscriptionItemBase* aItem, CXIMPIdentityImp* aGroup = NULL ) = 0;
+
+    /**
+     * Remove item from subscribing presentity presence.
+     */
+    virtual void RemovePresentityPresenceSubscriber( const CXIMPIdentityImp& aIdentity, CXIMPSubscriptionItemBase* aItem ) = 0;
+    
+    /**
+     * Activate item for subscribing presentity presence
+     */
+    virtual void ActivatePresentityPresenceSubscriberL( const CXIMPIdentityImp& aIdentity, CXIMPSubscriptionItemBase* aItem ) = 0;
+
+    /**
+     * Synthesise presentity presence subscription event
+     */    
+    virtual void SynthesisePresentityPresenceSubscriptionEventToL( const CXIMPIdentityImp& aIdentity, MXIMPPscContext* aContext, TBool aForceEvent ) = 0;
+
+    /**
+     * Add item as configurator for presentity presence.
+     */
+    virtual void AddPresenceConfiguratorL( const CXIMPIdentityImp& aIdentity, CXIMPConfigurationItemBase* aItem ) = 0;
+
+    /**
+     * Remove item from configuring presentity presence.
+     */
+    virtual void RemovePresenceConfigurator( const CXIMPIdentityImp& aIdentity, CXIMPConfigurationItemBase* aItem ) = 0;
+    
+    /**
+     * Return the protocol ID of the host of the parent
+     */
+    virtual TInt32 ProtocolUID( ) = 0;
+
+    /**
+     * Return the global presence cache object
+     */
+    virtual MPresenceCacheWriter* ExternalCache( ) = 0;
+    
+protected: // Destruction
+    
+    /**
+     * Object cannot be delted through this interface
+     */
+    virtual ~MXIMPItemParent(){}
+    };
+
+/* ======================================================================== */
+
+
+
+#endif // CXIMPITEMPARENT_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/core/srcdatamodel/ximpobjectcollectionimp.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,359 @@
+/*
+* 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:  MXIMPObjectCollection implementation
+ *
+*/
+
+#include "ximpobjectcollectionimp.h"
+
+
+// ============================ HELPER CLASS =============================
+
+// ---------------------------------------------------------------------------
+// CXIMPCollectionElement::NewL
+// ---------------------------------------------------------------------------
+//
+CXIMPObjectCollectionImp::CXIMPCollectionElement* 
+CXIMPObjectCollectionImp::CXIMPCollectionElement::NewL(
+        CXIMPApiObjBase* aObject, const TDesC8& aName )
+    {
+    CXIMPCollectionElement* self = new ( ELeave ) CXIMPCollectionElement();
+    CleanupStack::PushL( self );
+    self->ConstructL( aObject, aName );
+    CleanupStack::Pop( self ); 
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CXIMPCollectionElement::ConstructL
+// ---------------------------------------------------------------------------
+//
+void CXIMPObjectCollectionImp::CXIMPCollectionElement::ConstructL(
+        CXIMPApiObjBase* aObject, const TDesC8& aName )
+    {
+    iObject = aObject;
+
+    if ( aName.Length() > 0 )
+        {
+        iName = aName.AllocL();
+        }
+    else
+        {
+        // at least an empty one always exists
+        iName = HBufC8::NewL( 0 );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CXIMPCollectionElement::CXIMPCollectionElement
+// ---------------------------------------------------------------------------
+//
+CXIMPObjectCollectionImp::CXIMPCollectionElement::CXIMPCollectionElement()
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// CXIMPCollectionElement::~CXIMPCollectionElement
+// ---------------------------------------------------------------------------
+//
+CXIMPObjectCollectionImp::CXIMPCollectionElement::~CXIMPCollectionElement()
+    {
+    delete iObject;
+    delete iName;
+    }
+
+// ---------------------------------------------------------------------------
+// CXIMPCollectionElement::GetObject
+// ---------------------------------------------------------------------------
+//
+CXIMPApiObjBase* CXIMPObjectCollectionImp::CXIMPCollectionElement::GetObject()
+    {
+    CXIMPApiObjBase* obj = iObject;
+    iObject = NULL;
+    return obj;
+    }
+
+// ============================ MEMBER FUNCTIONS =============================
+
+// ---------------------------------------------------------------------------
+// CXIMPObjectCollectionImp::NewL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CXIMPObjectCollectionImp* CXIMPObjectCollectionImp::NewL()
+    {
+    CXIMPObjectCollectionImp* self = NewLC();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPObjectCollectionImp::NewLC()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CXIMPObjectCollectionImp* CXIMPObjectCollectionImp::NewLC()
+    {
+    CXIMPObjectCollectionImp* self = new ( ELeave ) CXIMPObjectCollectionImp;
+    CleanupStack::PushL( self );
+    return self;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPObjectCollectionImp::~CXIMPObjectCollectionImp()
+// ---------------------------------------------------------------------------
+//
+CXIMPObjectCollectionImp::~CXIMPObjectCollectionImp()
+    {
+    iCollection.ResetAndDestroy();
+    }
+
+// ---------------------------------------------------------------------------
+// CXIMPObjectCollectionImp::CXIMPObjectCollectionImp()
+// ---------------------------------------------------------------------------
+//
+CXIMPObjectCollectionImp::CXIMPObjectCollectionImp()
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// Implement supported interface access.
+// ---------------------------------------------------------------------------
+//
+XIMPIMP_IF_BASE_GET_INTERFACE_BEGIN( CXIMPObjectCollectionImp,
+                                     MXIMPObjectCollection )
+XIMPIMP_IF_BASE_GET_INTERFACE_END()
+
+
+XIMPIMP_IF_BASE_GET_CONST_INTERFACE_BEGIN( CXIMPObjectCollectionImp,
+                                           MXIMPObjectCollection )
+XIMPIMP_IF_BASE_GET_INTERFACE_END()
+
+
+
+// ---------------------------------------------------------------------------
+// CXIMPObjectCollectionImp::LookupByType()
+// ---------------------------------------------------------------------------
+//
+void CXIMPObjectCollectionImp::LookupByType(
+        const MXIMPBase*& aObject,
+        TInt32 aInterfaceId ) const
+    {
+    TInt start = FindLRUIndex( aObject );
+    
+    aObject = NULL;
+    
+    // now find the object without name
+    for ( TInt i = start; i < iCollection.Count(); i++ )
+        {
+        const CXIMPObjectCollectionImp::CXIMPCollectionElement* element = iCollection[ i ];
+
+        if ( ! element->iName->Length() )
+            {
+            // no name, ok
+            if ( aInterfaceId == element->iObject->Base().GetInterfaceId() )
+                {
+                // got a match!
+                aObject = &(element->iObject->Base());
+                return;
+                }
+            }
+        }
+
+    return;
+    }
+
+// ---------------------------------------------------------------------------
+// CXIMPObjectCollectionImp::LookupByTypeAndName()
+// ---------------------------------------------------------------------------
+//
+void CXIMPObjectCollectionImp::LookupByTypeAndName(
+                const MXIMPBase*& aObject,
+                TInt32 aInterfaceId,
+                const TDesC8& aMatch ) const
+    {
+    TInt start = FindLRUIndex( aObject );
+
+    aObject = NULL;
+
+    // now find the object with name
+    for ( TInt i = start; i < iCollection.Count(); i++ )
+        {
+        const CXIMPObjectCollectionImp::CXIMPCollectionElement* element = iCollection[ i ];
+
+        if ( ( KErrNotFound != element->iName->MatchF( aMatch ) ) 
+                && ( aInterfaceId == element->iObject->Base().GetInterfaceId() ) )
+            {
+            // got a match with correct name and interface id
+            aObject = &(element->iObject->Base());
+            return;
+            }
+        }
+
+    return;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPObjectCollectionImp::AddObjectL
+// ---------------------------------------------------------------------------
+//
+void CXIMPObjectCollectionImp::AddObjectL(
+        MXIMPBase* aObject )
+    {
+    AddObjectWithNameL( aObject, KNullDesC8 );
+    }
+
+// ---------------------------------------------------------------------------
+// CXIMPObjectCollectionImp::AddObjectWithNameL
+// ---------------------------------------------------------------------------
+//
+void CXIMPObjectCollectionImp::AddObjectWithNameL(
+        MXIMPBase* aObject,
+        const TDesC8& aName )
+    {
+    // NULL is not accepted
+    User::LeaveIfError( aObject == NULL ? KErrArgument : KErrNone );
+    
+    // name must not contain wildcards
+    User::LeaveIfError( ValidateName( aName ) );
+
+    CXIMPApiObjBase* base = ( CXIMPApiObjBase* ) 
+        aObject->GetInterface( XIMPIMP_CLSID_CXIMPAPIOBJBASE, EPanicIfUnknown ); 
+    CXIMPObjectCollectionImp::CXIMPCollectionElement* element = 
+        CXIMPObjectCollectionImp::CXIMPCollectionElement::NewL( base, aName );
+    CleanupStack::PushL( element );
+    iCollection.AppendL( element );
+    CleanupStack::Pop( element ); 
+    }
+
+// ---------------------------------------------------------------------------
+// CXIMPObjectCollectionImp::GetByType
+// ---------------------------------------------------------------------------
+//
+TBool CXIMPObjectCollectionImp::GetByType(
+        MXIMPBase*& aObject,
+        TInt32 aInterfaceId )
+    {
+    aObject = NULL;
+
+    // now find the object without name
+    for ( TInt i = 0; i < iCollection.Count(); i++ )
+        {
+        CXIMPObjectCollectionImp::CXIMPCollectionElement* element = iCollection[ i ];
+
+        if ( ! element->iName->Length() )
+            {
+            // no name, ok
+            if ( aInterfaceId == element->iObject->Base().GetInterfaceId() )
+                {
+                // got a match!
+                CXIMPApiObjBase* object = element->GetObject(); 
+                iCollection.Remove( i );
+                delete element;
+                aObject = &(object->Base());
+                return ETrue;
+                }
+            }
+        }
+
+    return EFalse;
+    }
+
+// ---------------------------------------------------------------------------
+// CXIMPObjectCollectionImp::GetByTypeAndName
+// ---------------------------------------------------------------------------
+//
+TBool CXIMPObjectCollectionImp::GetByTypeAndName(
+        MXIMPBase*& aObject,
+        TInt32 aInterfaceId,
+        const TDesC8& aMatch )
+    {
+    aObject = NULL;
+
+    // now find the object with name
+    for ( TInt i = 0; i < iCollection.Count(); i++ )
+        {
+        CXIMPObjectCollectionImp::CXIMPCollectionElement* element = iCollection[ i ];
+
+        if ( ( KErrNotFound != element->iName->MatchF( aMatch ) ) 
+                && ( aInterfaceId == element->iObject->Base().GetInterfaceId() ) )
+            {
+            // got a match with correct name and interface id
+            CXIMPApiObjBase* object = element->GetObject(); 
+            iCollection.Remove( i );
+            delete element;
+            aObject = &(object->Base());
+            return ETrue;
+            }
+        }
+
+    return EFalse;
+    }
+
+// ---------------------------------------------------------------------------
+// CXIMPObjectCollectionImp::FindLRUIndex()
+// ---------------------------------------------------------------------------
+//
+TInt CXIMPObjectCollectionImp::FindLRUIndex( const MXIMPBase*& aObject ) const
+    {
+    TInt start = 0;
+
+    // naive lookup, least recently used (from beginning to the end).
+    // find starting position
+    if ( aObject != NULL )
+        {
+        TBool found = EFalse;
+        for ( TInt i = 0; ( i < iCollection.Count()-1 ) && ( ! found ); i++ )
+            {
+            const CXIMPObjectCollectionImp::CXIMPCollectionElement* element = iCollection[ i ];
+            if ( aObject == &(element->iObject->Base()) )
+                {
+                found = ETrue;
+                start = i;
+                }
+            }
+        }
+
+    return start;
+    }
+
+// ---------------------------------------------------------------------------
+// CXIMPObjectCollectionImp::ValidateName()
+// ---------------------------------------------------------------------------
+//
+TInt CXIMPObjectCollectionImp::ValidateName( const TDesC8& aName ) const
+    {
+    const TUint8* pName = aName.Ptr();
+
+    TInt pNameLen = aName.Length();
+    for( ; pNameLen; pName++, pNameLen-- )
+        {
+        if( *pName > 0x7e || 
+            *pName < 0x20 || 
+            *pName == '*' || 
+            *pName == '?' || 
+            *pName == ':' )
+            {
+            return KErrBadName;                
+            }
+        }
+
+	return KErrNone;
+	}
+
+
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/core/srcdatamodel/ximpobjectcollectionimp.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,176 @@
+/*
+* 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:  Object collection implementation.
+ *
+*/
+
+#ifndef XIMPOBJECTCOLLECTIONIMP_H
+#define XIMPOBJECTCOLLECTIONIMP_H
+
+#include "ximpapiobjbase.h"
+#include <e32std.h>
+#include <ximpobjectcollection.h> 
+
+
+/**
+ * Object collection implementation.
+ *
+ * @see MXIMPObjectCollection
+ * @ingroup ximpdatamodelapi
+ * @since S60 v3.2
+ */
+class CXIMPObjectCollectionImp : public CXIMPApiObjBase,
+    public MXIMPObjectCollection
+    {
+
+private: // helper class
+
+    class CXIMPCollectionElement : public CBase
+        {
+        public:
+
+            static CXIMPCollectionElement* NewL( CXIMPApiObjBase* aObject, const TDesC8& aName );
+            ~CXIMPCollectionElement();
+
+            /**
+             * Get the stored object. Ownership transferred
+             * to the caller.
+             * @param The stored object
+             */
+            CXIMPApiObjBase* GetObject();
+
+        private:
+
+            CXIMPCollectionElement();
+            void ConstructL( CXIMPApiObjBase* aObject, const TDesC8& aName );
+
+        public:
+            // owns: the object
+            CXIMPApiObjBase* iObject;
+
+            // owns: the name (always valid, but can be empty)
+            HBufC8* iName;
+        };
+
+public:
+
+    /** The class ID. */
+    enum { KClassId = XIMPIMP_CLSID_CXIMPOBJECTCOLLECTIONIMP };
+
+public:
+
+    IMPORT_C static CXIMPObjectCollectionImp* NewLC();
+    IMPORT_C static CXIMPObjectCollectionImp* NewL();
+
+public:
+
+    /**
+     * Destruction
+     */
+    ~CXIMPObjectCollectionImp();
+
+
+private:
+
+    CXIMPObjectCollectionImp();
+
+
+public: // From MXIMPBase
+
+    /**
+     * Implementation of MXIMPBase interface methods
+     * @see MXIMPBase
+     */
+    XIMPIMP_DECLARE_IF_BASE_METHODS
+
+public: // from MXIMPObjectCollection
+
+    // object lookup
+
+    /**
+     * @see MXIMPObjectCollection
+     */
+    void LookupByType(
+            const MXIMPBase*& aObject,
+            TInt32 aInterfaceId ) const; 
+
+    /**
+     * @see MXIMPObjectCollection
+     */
+    void LookupByTypeAndName(
+                const MXIMPBase*& aObject,
+                TInt32 aInterfaceId,
+                const TDesC8& aMatch ) const;
+
+    // set management
+
+    /**
+     * @see MXIMPObjectCollection
+     */
+    void AddObjectL(
+                MXIMPBase* aObject );
+
+    /**
+     * @see MXIMPObjectCollection
+     */
+    void AddObjectWithNameL(
+                MXIMPBase* aObject,
+                const TDesC8& aName );
+
+
+    /**
+     * @see MXIMPObjectCollection
+     */
+    TBool GetByType(
+                MXIMPBase*& aObject,
+                TInt32 aInterfaceId );
+
+    /**
+     * @see MXIMPObjectCollection
+     */
+    TBool GetByTypeAndName(
+                MXIMPBase*& aObject,
+                TInt32 aInterfaceId,
+                const TDesC8& aMatch );
+
+private: // helpers
+
+    /**
+     * Find the index of the least recently used
+     * object. Since the internal array is LIFO,
+     * we walk the array forwards to find the index of 
+     * least recently used object.
+     * @param aObject The object from which to start
+     * @return The index
+     */
+    TInt FindLRUIndex( const MXIMPBase*& aObject ) const;
+
+    /**
+     * Validate a given name. Checks that wildcard characters do not exist.
+     * @return KErrNone if the name is OK, KErrBadName otherwise
+     */
+    TInt ValidateName( const TDesC8& aName ) const;
+
+private: // data
+
+    /**
+     * OWN: Objects
+     */
+    RXIMPObjOwningPtrArray< CXIMPCollectionElement > iCollection;
+
+    };
+
+
+#endif // XIMPOBJECTCOLLECTIONIMP_H
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/core/srcdatamodel/ximpobjectfactoryimp.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  Implementation of MPresenceManagement
+ *
+*/
+
+#include "ximpobjectfactoryimp.h"
+#include "ximpstatusimp.h"
+#include "ximprestrictedobjectcollectionimp.h"
+#include "ximpobjectcollectionimp.h"
+#include "ximpidentityimp.h"
+#include "ximpdatasubscriptionstateimp.h"
+
+
+// ============================ MEMBER FUNCTIONS =============================
+
+// ---------------------------------------------------------------------------
+// CXIMPObjectFactoryImp::NewL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CXIMPObjectFactoryImp* CXIMPObjectFactoryImp::NewL()
+    {
+    CXIMPObjectFactoryImp* self = new( ELeave ) CXIMPObjectFactoryImp;
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// Implement supported interface access.
+// ---------------------------------------------------------------------------
+//
+XIMPIMP_IF_BASE_GET_INTERFACE_BEGIN( CXIMPObjectFactoryImp, 
+                                     MXIMPObjectFactory )
+XIMPIMP_IF_BASE_GET_INTERFACE_END()
+
+
+XIMPIMP_IF_BASE_GET_CONST_INTERFACE_BEGIN( CXIMPObjectFactoryImp, 
+                                           MXIMPObjectFactory )
+XIMPIMP_IF_BASE_GET_INTERFACE_END()
+
+// ---------------------------------------------------------------------------
+// CXIMPObjectFactoryImp::~CXIMPObjectFactoryImp()
+// ---------------------------------------------------------------------------
+//
+CXIMPObjectFactoryImp::~CXIMPObjectFactoryImp()
+    {
+    #if _BullseyeCoverage
+    cov_write();
+    #endif
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPObjectFactoryImp::CXIMPObjectFactoryImp()
+// ---------------------------------------------------------------------------
+//
+CXIMPObjectFactoryImp::CXIMPObjectFactoryImp()
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPObjectFactoryImp::NewStatusLC()
+// ---------------------------------------------------------------------------
+//
+MXIMPStatus* CXIMPObjectFactoryImp::NewStatusLC()
+    {
+    return CXIMPStatusImp::NewLC();
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPObjectFactoryImp::NewIdentityLC()
+// ---------------------------------------------------------------------------
+//
+MXIMPIdentity* CXIMPObjectFactoryImp::NewIdentityLC()
+    {
+    return CXIMPIdentityImp::NewLC();
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPObjectFactoryImp::NewRestrictedObjectCollectionLC()
+// ---------------------------------------------------------------------------
+//
+MXIMPRestrictedObjectCollection* CXIMPObjectFactoryImp::NewRestrictedObjectCollectionLC()
+    {
+    return CXIMPRestrictedObjectCollectionImp::NewLC();
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPObjectFactoryImp::NewRestrictedObjectCollectionLC()
+// ---------------------------------------------------------------------------
+//
+MXIMPObjectCollection* CXIMPObjectFactoryImp::NewObjectCollectionLC()
+    {
+    return CXIMPObjectCollectionImp::NewLC();
+    }
+    
+// ---------------------------------------------------------------------------
+// CXIMPObjectFactoryImp::NewRestrictedObjectCollectionLC()
+// ---------------------------------------------------------------------------
+//
+MXIMPDataSubscriptionState* CXIMPObjectFactoryImp::NewDataSubscriptionStateLC()
+    {
+    return CXIMPDataSubscriptionStateImp::NewLC();
+    }
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/core/srcdatamodel/ximpobjectfactoryimp.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,72 @@
+/*
+* 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 of MXIMPObjectFactory
+ *
+*/
+
+#ifndef CXIMPOBJECTFACTORYIMP_H
+#define CXIMPOBJECTFACTORYIMP_H
+
+#include <ximpobjectfactory.h>
+#include "ximpapiobjbase.h"
+
+
+
+
+/**
+ * MXIMPObjectFactory API object implementation.
+ *
+ * @lib ximpmanager.dll
+ * @since S60 v3.2
+ */
+class CXIMPObjectFactoryImp: public CXIMPApiObjBase,
+                             public MXIMPObjectFactory
+    {
+    public:
+    /** The class ID. */
+    enum { KClassId = XIMPIMP_CLSID_CXIMPOBJECTFACTORYIMP };
+
+
+public:
+
+    IMPORT_C static CXIMPObjectFactoryImp* NewL();
+    ~CXIMPObjectFactoryImp();
+
+private:
+    CXIMPObjectFactoryImp();
+
+
+
+public: // From MXIMPBase
+
+    /**
+     * Implementation of MXIMPBase interface methods
+     * @see MXIMPBase
+     */
+    XIMPIMP_DECLARE_IF_BASE_METHODS
+
+
+public: //From MXIMPObjectFactory
+
+
+    MXIMPStatus* NewStatusLC();
+    MXIMPIdentity* NewIdentityLC();
+    MXIMPRestrictedObjectCollection* NewRestrictedObjectCollectionLC();
+    MXIMPObjectCollection* NewObjectCollectionLC();
+    MXIMPDataSubscriptionState* NewDataSubscriptionStateLC();    
+    
+    };
+
+
+#endif // CXIMPOBJECTFACTORYIMP_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/core/srcdatamodel/ximpprotocolinfoimp.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,202 @@
+/*
+* 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:  MXIMPProtocolInfo API object implementation.
+*
+*/
+
+#include "ximpprotocolinfoimp.h"
+#include "ximpobjecthelpers.h"
+#include "ximpfeatureinfoimp.h"
+#include "ximprbufhelpers.h"
+
+
+
+// ============================ MEMBER FUNCTIONS =============================
+
+// ---------------------------------------------------------------------------
+// CXIMPProtocolInfoImp::NewLC()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CXIMPProtocolInfoImp* CXIMPProtocolInfoImp::NewLC()
+    {
+    CXIMPProtocolInfoImp* self = new( ELeave ) CXIMPProtocolInfoImp;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPProtocolInfoImp::NewLC()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CXIMPProtocolInfoImp* CXIMPProtocolInfoImp::NewLC(
+                                        const TDesC16& aDisplayName,
+                                        TUid aImplementationUid,
+                                        const CXIMPFeatureInfoImp& aFeatures )
+    {
+    CXIMPProtocolInfoImp* self = new( ELeave ) CXIMPProtocolInfoImp;
+    CleanupStack::PushL( self );
+    self->ConstructL( aDisplayName, aImplementationUid, aFeatures );
+    return self;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPProtocolInfoImp::~CXIMPProtocolInfoImp()
+// ---------------------------------------------------------------------------
+//
+CXIMPProtocolInfoImp::~CXIMPProtocolInfoImp()
+    {
+    iDisplayName.Close();
+    delete iFeatures;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPProtocolInfoImp::CXIMPProtocolInfoImp()
+// ---------------------------------------------------------------------------
+//
+CXIMPProtocolInfoImp::CXIMPProtocolInfoImp()
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPProtocolInfoImp::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void CXIMPProtocolInfoImp::ConstructL( const TDesC16& aDisplayName,
+                                       TUid aImplementationUid,
+                                       const CXIMPFeatureInfoImp& aFeatures )
+    {
+    iDisplayName.CreateL( aDisplayName );
+    iImplementationUid = aImplementationUid;
+    iFeatures = TXIMPObjectCloner< CXIMPFeatureInfoImp >::CloneL( aFeatures );
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPProtocolInfoImp::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void CXIMPProtocolInfoImp::ConstructL()
+    {
+    // Initialize the RBufs to zero size. Later on realloc as needed.
+    iDisplayName.CreateL( 0 );
+    iFeatures = CXIMPFeatureInfoImp::NewL();
+    }
+
+// ---------------------------------------------------------------------------
+// CXIMPProtocolInfoImp::NewFromStreamLC()
+// ---------------------------------------------------------------------------
+//
+XIMPIMP_IMPLEMENT_DATAOBJ_NEWFROMSTREAM( CXIMPProtocolInfoImp )
+
+
+// ---------------------------------------------------------------------------
+// Implement supported interface access.
+// ---------------------------------------------------------------------------
+//
+XIMPIMP_IF_BASE_GET_INTERFACE_BEGIN( CXIMPProtocolInfoImp, 
+                                     MXIMPProtocolInfo )
+XIMPIMP_IF_BASE_GET_INTERFACE_END()
+
+
+XIMPIMP_IF_BASE_GET_CONST_INTERFACE_BEGIN( CXIMPProtocolInfoImp, 
+                                           MXIMPProtocolInfo )
+XIMPIMP_IF_BASE_GET_INTERFACE_END()
+
+
+
+// ---------------------------------------------------------------------------
+// CXIMPProtocolInfoImp::DisplayName()
+// ---------------------------------------------------------------------------
+const TDesC16& CXIMPProtocolInfoImp::DisplayName() const
+    {
+    return iDisplayName;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPProtocolInfoImp::ImplementationUid()
+// ---------------------------------------------------------------------------
+TUid CXIMPProtocolInfoImp::ImplementationUid() const
+    {
+    return iImplementationUid;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPProtocolInfoImp::GetProtocolFeaturesLC()
+// ---------------------------------------------------------------------------
+MXIMPFeatureInfo* CXIMPProtocolInfoImp::GetProtocolFeaturesLC() const
+    {
+    return TXIMPObjectCloner< CXIMPFeatureInfoImp >::CloneLC( *iFeatures );
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPProtocolInfoImp::ExternalizeL()
+// ---------------------------------------------------------------------------
+//
+void CXIMPProtocolInfoImp::ExternalizeL( RWriteStream& aStream ) const
+    {
+    XIMPRBuf16Helper::ExternalizeL( iDisplayName, aStream );
+    aStream.WriteInt32L( iImplementationUid.iUid );
+
+    iFeatures->ExternalizeL( aStream );
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPProtocolInfoImp::InternalizeL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CXIMPProtocolInfoImp::InternalizeL( RReadStream& aStream )
+    {
+    XIMPRBuf16Helper::InternalizeL( iDisplayName, aStream );
+    iImplementationUid.iUid = aStream.ReadInt32L();
+
+    iFeatures->InternalizeL( aStream );
+    }
+
+// ---------------------------------------------------------------------------
+// CXIMPProtocolInfoImp::EqualsContent
+// ---------------------------------------------------------------------------
+//
+TBool CXIMPProtocolInfoImp::EqualsContent( 
+    const CXIMPApiDataObjBase& aOtherInstance ) const 
+    {
+    const CXIMPProtocolInfoImp* tmp =
+    TXIMPGetImpClassOrPanic< const CXIMPProtocolInfoImp >::From( 
+                                                       aOtherInstance.Base() );
+
+
+    TBool same = ETrue;
+    TBool x;
+    x = 0 == iDisplayName.Compare( tmp->iDisplayName );
+    same &= x;
+
+    x = iImplementationUid == tmp->iImplementationUid;
+    same &= x;
+
+    x = iFeatures->EqualsContent( *( tmp->iFeatures ) );
+    same &= x;
+
+    return same;
+    }
+
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/core/srcdatamodel/ximpprotocolinfoimp.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,128 @@
+/*
+* 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:  MXIMPProtocolInfo API object implementation.
+*
+*/
+
+#ifndef CXIMPPROTOCOLINFOIMP_H
+#define CXIMPPROTOCOLINFOIMP_H
+
+#include "ximpapidataobjbase.h"
+#include <ximpprotocolinfo.h>
+#include <s32strm.h>
+
+
+class MXIMPFeatureInfo;
+class CXIMPFeatureInfoImp;
+
+
+/**
+ * MXIMPProtocolInfo API object implementation.
+ *
+ * @lib ximpdatamodel.dll
+ * @since S60 v3.2
+ */
+NONSHARABLE_CLASS( CXIMPProtocolInfoImp ): public CXIMPApiDataObjBase,
+                                           public MXIMPProtocolInfo
+    {
+public:
+    /** The class ID. */
+    enum { KClassId = XIMPIMP_CLSID_CXIMPPROTOCOLINFOIMP };
+
+public:
+
+    IMPORT_C static CXIMPProtocolInfoImp* NewLC();
+
+    IMPORT_C static CXIMPProtocolInfoImp* NewLC(
+                const TDesC16& aDisplayName,
+                TUid aImplementationUid,
+                const CXIMPFeatureInfoImp& aFeatures );
+
+    virtual ~CXIMPProtocolInfoImp();
+
+private:
+
+    CXIMPProtocolInfoImp();
+    void ConstructL( const TDesC16& aDisplayName,
+                     TUid aImplementationUid,
+                     const CXIMPFeatureInfoImp& aFeatures );
+    void ConstructL();
+
+    /**
+     * @see CXIMPApiDataObjBase
+     */
+    XIMPIMP_DECLARE_DATAOBJ_BASE_PRIV_METHODS
+
+public: // From MXIMPBase
+
+    /**
+     * Implementation of MXIMPBase interface methods
+     * @see MXIMPBase
+     */
+    XIMPIMP_DECLARE_IF_BASE_METHODS
+
+    /**
+     * @see CXIMPApiDataObjBase
+     */
+    XIMPIMP_DECLARE_DATAOBJ_BASE_METHODS
+
+public: // From MXIMPProtocolInfo
+
+    /**
+     * Implementation of MXIMPProtocolInfo interface methods
+     * @see MXIMPProtocolInfo
+     */
+    const TDesC16& DisplayName() const;
+    TUid ImplementationUid() const;
+    MXIMPFeatureInfo* GetProtocolFeaturesLC() const;
+
+
+
+public: // New functions
+
+    /**
+     * Internalizes object data from given stream.
+     * @param aStream Stream to read.
+     */
+    IMPORT_C void InternalizeL( RReadStream& aStream );
+
+
+private: // data
+
+    /**
+     * Protocol plug-in display name.
+     * Own.
+     */
+    RBuf iDisplayName;
+
+
+    /**
+     * Protocol plug-in implementation uid.
+     * Own.
+     */
+    TUid iImplementationUid;
+
+
+    /**
+     * Protocol plug-in feature info.
+     * Own.
+     */
+    CXIMPFeatureInfoImp* iFeatures;
+
+    };
+
+
+#endif // CXIMPPROTOCOLINFOIMP_H
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/core/srcdatamodel/ximprequestcompleteeventimp.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,299 @@
+/*
+* 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:  MXIMPRequestCompleteEvent API object implementation.
+*
+*/
+
+
+#include <s32strm.h>
+
+#include "ximprequestcompleteeventimp.h"
+#include "ximpstatusimp.h"
+#include "ximpapidataobjfactory.h"
+#include "ximpapidataobjbase.h"
+
+
+// ---------------------------------------------------------------------------
+// CXIMPRequestCompleteEventImp::NewL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CXIMPRequestCompleteEventImp* CXIMPRequestCompleteEventImp::NewL()
+    {
+    TXIMPRequestId nullId = TXIMPRequestId::Null();
+    
+    CXIMPRequestCompleteEventImp* self =
+            new( ELeave ) CXIMPRequestCompleteEventImp( nullId );
+    CleanupStack::PushL( self );
+    self->ConstructL( KErrNone );
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+
+
+// ---------------------------------------------------------------------------
+// CXIMPRequestCompleteEventImp::NewLC()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CXIMPRequestCompleteEventImp* CXIMPRequestCompleteEventImp::NewLC(
+       TXIMPRequestId& aRequestId, TInt aDefaultErrorValue )
+    {
+    CXIMPRequestCompleteEventImp* self =
+            new( ELeave ) CXIMPRequestCompleteEventImp( aRequestId );
+    CleanupStack::PushL( self );
+    self->ConstructL( aDefaultErrorValue );
+    return self;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPRequestCompleteEventImp::NewLC()
+// Instantiation method for event automation.
+// ---------------------------------------------------------------------------
+//
+CXIMPApiEventBase*
+    CXIMPRequestCompleteEventImp::NewFromStreamLC( RReadStream& aStream )
+    {
+    CXIMPRequestCompleteEventImp* self = new( ELeave ) CXIMPRequestCompleteEventImp;
+    CleanupStack::PushL( self );
+    self->ConstructL( aStream );
+    return self;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPRequestCompleteEventImp::~CXIMPRequestCompleteEventImp()
+// ---------------------------------------------------------------------------
+//
+CXIMPRequestCompleteEventImp::~CXIMPRequestCompleteEventImp()
+    {
+    delete iResult;
+
+    // remove the owned objects
+    for ( TInt i = 0; i < iParamArray.Count(); i++ )
+        {
+        SXIMPReqParam param = iParamArray[i];
+        delete param.iParam;
+        param.iParam = NULL;
+        }
+    iParamArray.Close();
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPRequestCompleteEventImp::CXIMPRequestCompleteEventImp()
+// ---------------------------------------------------------------------------
+//
+CXIMPRequestCompleteEventImp::CXIMPRequestCompleteEventImp()
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPRequestCompleteEventImp::CXIMPRequestCompleteEventImp()
+// ---------------------------------------------------------------------------
+//
+CXIMPRequestCompleteEventImp::CXIMPRequestCompleteEventImp(
+    TXIMPRequestId& aRequestId ) :
+    iReqId( aRequestId )
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPRequestCompleteEventImp::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void CXIMPRequestCompleteEventImp::ConstructL( TInt aDefaultErrorValue )
+    {
+    iResult = CXIMPStatusImp::NewL();
+    iResult->SetResultCode( aDefaultErrorValue );
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPRequestCompleteEventImp::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void CXIMPRequestCompleteEventImp::ConstructL( RReadStream& aStream )
+    {
+    // normal params
+    TPckgBuf< TXIMPRequestId > bufReqId;
+    aStream.ReadL( bufReqId );
+    iReqId = bufReqId();
+
+    iResult = CXIMPStatusImp::NewL();
+    iResult->InternalizeL( aStream );
+
+    // the array with variable parameters
+    XIMPApiDataObjFactory::InternalizeL( aStream, iParamArray );
+    }
+
+// ---------------------------------------------------------------------------
+// Implement supported interface access.
+// ---------------------------------------------------------------------------
+//
+XIMPIMP_IF_BASE_GET_INTERFACE_BEGIN( CXIMPRequestCompleteEventImp,
+                                     MXIMPRequestCompleteEvent )
+    XIMPIMP_IF_BASE_GET_CLASS( CXIMPApiEventBase, this )
+XIMPIMP_IF_BASE_GET_INTERFACE_END()
+
+XIMPIMP_IF_BASE_GET_CONST_INTERFACE_BEGIN( CXIMPRequestCompleteEventImp,
+                                           MXIMPRequestCompleteEvent )
+    XIMPIMP_IF_BASE_GET_CONST_CLASS( CXIMPApiEventBase, this )
+XIMPIMP_IF_BASE_GET_INTERFACE_END()
+
+
+// ---------------------------------------------------------------------------
+// Implement methods from base event interface and base event class
+// ---------------------------------------------------------------------------
+//
+XIMPIMP_IMPLEMENT_EVENT_BASE_METHODS( CXIMPRequestCompleteEventImp,
+                                      MXIMPRequestCompleteEvent )
+
+// ---------------------------------------------------------------------------
+// CXIMPRequestCompleteEventImp::RequestId()
+// ---------------------------------------------------------------------------
+//
+const TXIMPRequestId& CXIMPRequestCompleteEventImp::RequestId() const
+    {
+    return iReqId;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPRequestCompleteEventImp::CompletionResult()
+// ---------------------------------------------------------------------------
+//
+const MXIMPStatus& CXIMPRequestCompleteEventImp::CompletionResult() const
+    {
+    return *iResult;
+    }
+
+
+
+// ---------------------------------------------------------------------------
+// CXIMPRequestCompleteEventImp::LookupCompletionDataByType()
+// ---------------------------------------------------------------------------
+//
+const MXIMPBase* CXIMPRequestCompleteEventImp::LookupCompletionDataByType(
+    TInt32 aInterfaceId ) const
+    {
+    const TInt count = iParamArray.Count();
+    for( TInt i = 0; i < count; i++ )
+        {
+        if( iParamArray[ i ].iParamType == aInterfaceId )
+            {
+            return &iParamArray[ i ].iParam->Base();
+            }
+        }
+
+    return NULL;
+    }
+
+
+
+
+// ---------------------------------------------------------------------------
+// CXIMPRequestCompleteEventImp::SetRequestId()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CXIMPRequestCompleteEventImp::SetRequestId( const TXIMPRequestId& aRequestId )
+    {
+    iReqId = aRequestId;
+    }
+
+// ---------------------------------------------------------------------------
+// CXIMPRequestCompleteEventImp::EqualsContent
+// ---------------------------------------------------------------------------
+//
+TBool CXIMPRequestCompleteEventImp::EqualsContent(
+    const CXIMPApiEventBase& aOtherInstance ) const
+    {
+    const CXIMPRequestCompleteEventImp* tmp =
+    TXIMPGetImpClassOrPanic< const CXIMPRequestCompleteEventImp >::From(
+                                                        aOtherInstance.Base() );
+
+    TBool same = ETrue;
+
+    TBool x = ( iResult->ResultCode() == tmp->iResult->ResultCode() );
+    same &= x;
+
+    x = ( 0 == iResult->ProtocolResultDescription().Compare(
+                tmp->iResult->ProtocolResultDescription() ) );
+    same &= x;
+
+    // check parameter arrays for equality
+    TInt myCount = iParamArray.Count();
+    TInt otherCount = tmp->iParamArray.Count();
+
+    x = myCount == otherCount;
+    same &= x;
+
+    if ( x )
+        {
+        // don't do potentially expensive operation unless arrays are
+        // have same number of elements
+
+        for ( TInt i = 0; i < myCount; i++ )
+            {
+            // assumes the parameters are IN ORDER
+            x = iParamArray[ i ].iParam->EqualsContent( *( tmp->iParamArray[ i ].iParam ) );
+            same &= x;
+            }
+        }
+
+    return same;
+    }
+
+// ---------------------------------------------------------------------------
+// CXIMPRequestCompleteEventImp::ExternalizeL()
+// ---------------------------------------------------------------------------
+//
+void CXIMPRequestCompleteEventImp::ExternalizeL( RWriteStream& aStream ) const
+    {
+    // normal params
+    TPckgBuf< TXIMPRequestId > bufReqId( iReqId );
+    aStream.WriteL( bufReqId );
+
+    iResult->ExternalizeL( aStream );
+
+    // the array with variable parameters
+    XIMPApiDataObjFactory::ExternalizeL( aStream, iParamArray );
+    }
+
+// ---------------------------------------------------------------------------
+// CXIMPRequestCompleteEventImp::AppendParamL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CXIMPRequestCompleteEventImp::AppendParamL( CXIMPApiDataObjBase* aObj )
+    {
+    SXIMPReqParam param;
+    param.iParamType = aObj->Base().GetInterfaceId();
+    param.iParam = aObj;
+    iParamArray.AppendL( param );
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPRequestCompleteEventImp::CompletionResultImp()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CXIMPStatusImp& CXIMPRequestCompleteEventImp::CompletionResultImp()
+    {
+    return *iResult;
+    }
+
+// End of file
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/core/srcdatamodel/ximprequestcompleteeventimp.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,149 @@
+/*
+* 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:  MXIMPRequestCompleteEvent API object implementation.
+*
+*/
+
+#ifndef CXIMPREQUESTCOMPLETEEVENTIMP_H
+#define CXIMPREQUESTCOMPLETEEVENTIMP_H
+
+#include "ximpapieventbase.h"
+#include "ximptypehelpers.h"
+#include <ximprequestcompleteevent.h>
+
+class RWriteStream;
+class RReadStream;
+class CXIMPStatusImp;
+class MXIMPStatus;
+class CXIMPApiDataObjBase;
+
+
+/**
+ * MXIMPRequestCompleteEvent API object implementation.
+ *
+ * @lib ximpdatamodel.dll
+ * @since S60 v3.2
+ */
+NONSHARABLE_CLASS( CXIMPRequestCompleteEventImp ): 
+    public CXIMPApiEventBase,
+    public MXIMPRequestCompleteEvent
+    {
+    public:
+        /** The class ID. */
+        enum { KClassId = XIMPIMP_CLSID_CXIMPREQUESTCOMPLETEEVENTIMP };
+
+public:
+
+    /**
+     * Exported instantiation method for initializing
+     * new event object.
+     */
+    IMPORT_C static CXIMPRequestCompleteEventImp* NewL();
+    IMPORT_C static CXIMPRequestCompleteEventImp* NewLC(
+            TXIMPRequestId& aRequestId, TInt aDefaultErrorValue = KErrNone );
+
+
+    /**
+     * Instantiation method for event automation.
+     * Method signature must be exactly this to work
+     * with event delivery automation system.
+     *
+     * Event implementation must be registered to
+     * XIMPEventCodec KXIMPEventConstructorTable.
+     */
+    static CXIMPApiEventBase* NewFromStreamLC( RReadStream& aStream );
+
+
+    virtual ~CXIMPRequestCompleteEventImp();
+
+private:
+    CXIMPRequestCompleteEventImp( TXIMPRequestId& aRequestId );
+    CXIMPRequestCompleteEventImp();
+    void ConstructL( TInt aDefaultErrorValue );
+    void ConstructL( RReadStream& aStream );
+    
+public: // From MXIMPRequestCompleteEvent
+
+    /**
+     * Implementation of MXIMPRequestCompleteEvent interface methods
+     * @see MXIMPRequestCompleteEvent
+     */
+    const TXIMPRequestId& RequestId() const;
+    const MXIMPStatus& CompletionResult() const;    
+    const MXIMPBase* LookupCompletionDataByType( TInt32 aInterfaceId ) const;
+
+
+public:
+
+    /** 
+     * Set request id
+     * @param aRequestId New requestId.
+     */
+    IMPORT_C void SetRequestId( const TXIMPRequestId& aRequestId );
+
+    /**
+     * Add data object as a parameter to this event. Ownership
+     * transferred.
+     * @param aObj The fully constructed data object to add
+     */ 
+    IMPORT_C void AppendParamL( CXIMPApiDataObjBase* aObj );
+    
+    
+    IMPORT_C CXIMPStatusImp& CompletionResultImp();    
+
+public: // From API base interfaces
+
+    /**
+     * Implementation of MXIMPBase interface methods
+     * @see MXIMPBase
+     */
+    XIMPIMP_DECLARE_IF_BASE_METHODS
+
+
+    /**
+     * Implementation of MXIMPEventBase interface and
+     * CXIMPApiEventBase methods
+     *
+     * @see MXIMPEventBase
+     * @see CXIMPApiEventBase
+     */
+    XIMPIMP_DECLARE_EVENT_BASE_METHODS
+
+private: // data
+
+    /**
+     * Completed request.
+     * Own.
+     */
+    TXIMPRequestId iReqId;
+
+
+    /**
+     * Request result.
+     * This is set to KErrNoMemory for default value.
+     * Reason for that is error handling in low memory situation
+     * CXIMPEventCapsule will send KErrNoMemory version of event if
+     * event cannot be updated because of low memory.
+     * Own.
+     */
+    CXIMPStatusImp* iResult;
+    
+    /**
+     * Array of params
+     */
+    RPrReqParamArray iParamArray;
+    };
+
+
+#endif // CXIMPREQUESTCOMPLETEEVENTIMP_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/core/srcdatamodel/ximprestrictedobjectcollectionimp.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,201 @@
+/*
+* 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:  MXIMPRestrictedObjectCollection implementation
+*
+*/
+
+#include "ximprestrictedobjectcollectionimp.h"
+
+// ============================ MEMBER FUNCTIONS =============================
+
+
+// ---------------------------------------------------------------------------
+// CXIMPRestrictedObjectCollectionImp::NewL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CXIMPRestrictedObjectCollectionImp*
+    CXIMPRestrictedObjectCollectionImp::NewL( TBool aObjectOwning /*= ETrue*/ )
+    {
+    CXIMPRestrictedObjectCollectionImp* self = NewLC( aObjectOwning );
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPRestrictedObjectCollectionImp::NewLC()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CXIMPRestrictedObjectCollectionImp*
+    CXIMPRestrictedObjectCollectionImp::NewLC( TBool aObjectOwning /*= ETrue*/ )
+    {
+    CXIMPRestrictedObjectCollectionImp* self =
+        new (ELeave) CXIMPRestrictedObjectCollectionImp( aObjectOwning );
+
+    CleanupStack::PushL( self );
+    return self;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPRestrictedObjectCollectionImp::~CXIMPRestrictedObjectCollectionImp()
+// ---------------------------------------------------------------------------
+//
+CXIMPRestrictedObjectCollectionImp::~CXIMPRestrictedObjectCollectionImp()
+    {
+    if( iOwnObjects )
+        {
+        iApiObjects.ResetAndDestroy();
+        }
+    else
+        {
+        iApiObjects.Reset();
+        }    
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPRestrictedObjectCollectionImp::CXIMPRestrictedObjectCollectionImp()
+// ---------------------------------------------------------------------------
+//
+CXIMPRestrictedObjectCollectionImp::CXIMPRestrictedObjectCollectionImp( TBool aObjectOwning )
+: iOwnObjects( aObjectOwning )
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// Implement supported interface access.
+// ---------------------------------------------------------------------------
+//
+XIMPIMP_IF_BASE_GET_INTERFACE_BEGIN( CXIMPRestrictedObjectCollectionImp,
+                                     MXIMPRestrictedObjectCollection )
+XIMPIMP_IF_BASE_GET_INTERFACE_END()
+
+
+XIMPIMP_IF_BASE_GET_CONST_INTERFACE_BEGIN( CXIMPRestrictedObjectCollectionImp,
+                                           MXIMPRestrictedObjectCollection )
+XIMPIMP_IF_BASE_GET_INTERFACE_END()
+
+
+
+// ---------------------------------------------------------------------------
+// CXIMPRestrictedObjectCollectionImp::LookupByType()
+// ---------------------------------------------------------------------------
+//
+void CXIMPRestrictedObjectCollectionImp::LookupByType(
+    const MXIMPBase*& aObject,
+    TInt32 aInterfaceId ) const
+    {
+    aObject = NULL;
+
+    TInt index = iApiObjects.FindInOrder( aInterfaceId,
+                                          OrderIfIdAndApiObject );
+    if( index != KErrNotFound )
+        {
+        const CXIMPApiObjBase* theObject = iApiObjects[ index ];
+        aObject = &theObject->Base();
+        }
+    }
+
+
+
+// ---------------------------------------------------------------------------
+// CXIMPRestrictedObjectCollectionImp::AddOrReplaceTypeL()
+// ---------------------------------------------------------------------------
+//
+void CXIMPRestrictedObjectCollectionImp::AddOrReplaceTypeL(
+    MXIMPBase* aObject )
+    {
+    CXIMPApiObjBase* theObject = TXIMPGetImpClassOrPanic< CXIMPApiObjBase >::From( *aObject );
+                                                         
+
+    TInt index = KErrNotFound;
+    TInt entryExists = iApiObjects.FindInOrder( theObject,
+                                                index,
+                                                OrderApiObjects );
+
+    if( entryExists == KErrNotFound )
+        {
+        iApiObjects.InsertL( theObject, index );
+        }
+    else
+        {
+        CXIMPApiObjBase* oldObject = iApiObjects[ index ];
+        if( iOwnObjects )
+            {
+            delete oldObject;
+            }        
+        iApiObjects[ index ] = theObject;
+        }
+    }
+
+
+
+// ---------------------------------------------------------------------------
+// CXIMPRestrictedObjectCollectionImp::GetByType()
+// ---------------------------------------------------------------------------
+//
+void CXIMPRestrictedObjectCollectionImp::GetByType(
+    MXIMPBase*& aObject,
+    TInt32 aInterfaceId )
+    {
+    aObject = NULL;
+
+    TInt index = iApiObjects.FindInOrder( aInterfaceId,
+                                          OrderIfIdAndApiObject );
+    if( index != KErrNotFound )
+        {
+        CXIMPApiObjBase* theObject = iApiObjects[ index ];
+        aObject = &theObject->Base();
+        iApiObjects.Remove( index );
+        }
+    }
+
+
+
+// ---------------------------------------------------------------------------
+// CXIMPRestrictedObjectCollectionImp::OrderIfIdAndApiObject()
+// ---------------------------------------------------------------------------
+//
+TInt CXIMPRestrictedObjectCollectionImp::OrderIfIdAndApiObject(
+    const TInt32* aIfId,
+    const CXIMPApiObjBase& aRhs )
+    {
+    return (*aIfId) - aRhs.Base().GetInterfaceId();
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPRestrictedObjectCollectionImp::OrderApiObjects()
+// ---------------------------------------------------------------------------
+//
+TInt CXIMPRestrictedObjectCollectionImp::OrderApiObjects(
+    const CXIMPApiObjBase& aLhs,
+    const CXIMPApiObjBase& aRhs )
+    {
+    const TInt32 interfaceId = aLhs.Base().GetInterfaceId();
+    return OrderIfIdAndApiObject( &interfaceId, aRhs );
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPRestrictedObjectCollectionImp::SetObjectOwnership()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CXIMPRestrictedObjectCollectionImp::SetObjectOwnership( TBool aObjectOwning /*= ETrue*/ )
+    {
+    iOwnObjects = aObjectOwning;
+    }
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/core/srcdatamodel/ximprestrictedobjectcollectionimp.h	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  MXIMPRestrictedObjectCollection implementation
+*
+*/
+
+#ifndef CXIMPRESTRICTEDOBJECTCOLLECTIONIMP_H
+#define CXIMPRESTRICTEDOBJECTCOLLECTIONIMP_H
+
+#include <e32std.h>
+#include <ximprestrictedobjectcollection.h>
+#include "ximpapiobjbase.h"
+
+
+/**
+ *
+ * @since S60 v3.2
+ */
+class CXIMPRestrictedObjectCollectionImp : public CXIMPApiObjBase,
+                                           public MXIMPRestrictedObjectCollection
+    {
+public:
+
+    /** The class ID. */
+    enum { KClassId = XIMPIMP_CLSID_CXIMPRESTRICTEDOBJECTCOLLECTIONIMP };
+    
+public:
+    
+    /*
+     * Construction of instance
+     * @param aObjectOwning. ETrue objects are owned by instance.
+     *                       EFalse objects are not owned by instance.
+     *                       Default = ETrue
+     */
+    IMPORT_C static CXIMPRestrictedObjectCollectionImp* NewLC( TBool aObjectOwning = ETrue );
+
+    /*
+     * Construction of instance
+     * @param aObjectOwning. ETrue objects are owned by instance.
+     *                       EFalse objects are not owned by instance.
+     *                       Default = ETrue
+     */
+    IMPORT_C static CXIMPRestrictedObjectCollectionImp* NewL( TBool aObjectOwning = ETrue );
+    
+
+public:
+
+    /**
+     * Destruction
+     */
+    ~CXIMPRestrictedObjectCollectionImp();
+
+
+private:
+
+    /**
+     * Construction
+     * @param aObjectOwning. ETrue objects are owned by instance.
+     *                       EFalse objects are not owned by instance.
+     */
+    CXIMPRestrictedObjectCollectionImp( TBool aObjectOwning );
+
+
+public: // From MXIMPBase
+
+    /**
+     * Implementation of MXIMPBase interface methods
+     * @see MXIMPBase
+     */
+    XIMPIMP_DECLARE_IF_BASE_METHODS
+
+public: // From MXIMPRestrictedObjectCollection
+
+    void LookupByType( const MXIMPBase*& aObject, TInt32 aInterfaceId ) const;
+    void AddOrReplaceTypeL( MXIMPBase* aObject );
+    void GetByType( MXIMPBase*& aObject, TInt32 aInterfaceId );
+
+
+
+public: // New methods
+
+    /**
+     * Set object ownership
+     * @param aObjectOwning. ETrue objects are owned by instance.
+     *                       EFalse objects are not owned by instance.
+     *                       Default = ETrue
+     */
+    IMPORT_C void SetObjectOwnership( TBool aObjectOwning = ETrue );
+
+private: // Helpers
+    static TInt OrderIfIdAndApiObject( const TInt32* aIfId, 
+                                       const CXIMPApiObjBase& aRhs );
+
+    static TInt OrderApiObjects( const CXIMPApiObjBase& aLhs, 
+                                 const CXIMPApiObjBase& aRhs );
+
+
+
+private: // data
+
+    /**
+     * Owning of objects. ETrue, Owns, EFalse does not own.
+     */
+    TBool iOwnObjects;
+
+    /**
+     * OWN: Check iOwnObjects
+     */
+    RXIMPObjOwningPtrArray< CXIMPApiObjBase > iApiObjects;
+    
+    };
+
+
+#endif // CXIMPRESTRICTEDOBJECTCOLLECTIONIMP_H
+
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/core/srcdatamodel/ximpserviceinfoimp.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,253 @@
+/*
+* 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:  MXIMPServiceInfo API object implementation.
+*
+*/
+
+#include "ximpserviceinfoimp.h"
+#include "ximprbufhelpers.h"
+
+
+
+// ============================ MEMBER FUNCTIONS =============================
+
+
+// ---------------------------------------------------------------------------
+// CXIMPServiceInfoImp::NewLC()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CXIMPServiceInfoImp* CXIMPServiceInfoImp::NewLC()
+    {
+    CXIMPServiceInfoImp* self = new( ELeave ) CXIMPServiceInfoImp;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+    
+
+// ---------------------------------------------------------------------------
+// CXIMPServiceInfoImp::NewL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CXIMPServiceInfoImp* CXIMPServiceInfoImp::NewL()
+    {
+    CXIMPServiceInfoImp* self = NewLC();
+    CleanupStack::Pop( self );
+    return self;
+    }
+    
+
+
+// ---------------------------------------------------------------------------
+// CXIMPServiceInfoImp::NewLC()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CXIMPServiceInfoImp* CXIMPServiceInfoImp::NewLC(
+                                             TUid aProtocolImplUid,
+                                             const TDesC16& aServiceAddress,
+                                             const TDesC16& aUsername,
+                                             const TDesC16& aPassword,
+                                             TInt32 aIapId )
+    {
+    CXIMPServiceInfoImp* self = new( ELeave ) CXIMPServiceInfoImp();
+    CleanupStack::PushL( self );
+    self->ConstructL( aProtocolImplUid, aServiceAddress, aUsername, aPassword, aIapId );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CXIMPServiceInfoImp::~CXIMPServiceInfoImp()
+// ---------------------------------------------------------------------------
+//
+CXIMPServiceInfoImp::~CXIMPServiceInfoImp()
+    {
+    iAddress.Close();
+    iUserId.Close();
+    iPassword.Close();
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPServiceInfoImp::CXIMPServiceInfoImp()
+// ---------------------------------------------------------------------------
+//
+CXIMPServiceInfoImp::CXIMPServiceInfoImp()
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPServiceInfoImp::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void CXIMPServiceInfoImp::ConstructL( TUid aProtocolImplUid,
+                                      const TDesC16& aServiceAddress,
+                                      const TDesC16& aUsername,
+                                      const TDesC16& aPassword,
+                                      TInt32 aIapId )
+    {
+    iProtocolUid = aProtocolImplUid;
+    iIapId = aIapId;
+    iAddress.CreateL( aServiceAddress );
+    iUserId.CreateL( aUsername );
+    iPassword.CreateL( aPassword );
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPServiceInfoImp::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void CXIMPServiceInfoImp::ConstructL()
+    {
+    // Initialize RBufs to zero length, realloc later when needed
+    iAddress.CreateL( 0 );
+    iUserId.CreateL( 0 );
+    iPassword.CreateL( 0 );
+    }
+
+// ---------------------------------------------------------------------------
+// CXIMPServiceInfoImp::NewFromStreamLC()
+// ---------------------------------------------------------------------------
+//
+XIMPIMP_IMPLEMENT_DATAOBJ_NEWFROMSTREAM( CXIMPServiceInfoImp )
+
+
+// ---------------------------------------------------------------------------
+// Implement supported interface access.
+// ---------------------------------------------------------------------------
+//
+XIMPIMP_IF_BASE_GET_INTERFACE_BEGIN( CXIMPServiceInfoImp, 
+                                     MXIMPServiceInfo )
+XIMPIMP_IF_BASE_GET_INTERFACE_END()
+
+
+XIMPIMP_IF_BASE_GET_CONST_INTERFACE_BEGIN( CXIMPServiceInfoImp, 
+                                           MXIMPServiceInfo )
+XIMPIMP_IF_BASE_GET_INTERFACE_END()
+
+
+// ---------------------------------------------------------------------------
+// From class MXIMPServiceInfo.
+// CXIMPServiceInfoImp::Address()
+// ---------------------------------------------------------------------------
+//
+const TDesC16& CXIMPServiceInfoImp::ServiceAddress() const
+    {
+    return iAddress;
+    }
+
+
+// ---------------------------------------------------------------------------
+// From class MXIMPServiceInfo.
+// CXIMPServiceInfoImp::UserId()
+// ---------------------------------------------------------------------------
+//
+const TDesC16& CXIMPServiceInfoImp::UserId() const
+    {
+    return iUserId;
+    }
+
+
+// ---------------------------------------------------------------------------
+// From class MXIMPServiceInfo.
+// CXIMPServiceInfoImp::Password()
+// ---------------------------------------------------------------------------
+//
+const TDesC16& CXIMPServiceInfoImp::Password() const
+    {
+    return iPassword;
+    }
+
+
+// ---------------------------------------------------------------------------
+// From class MXIMPServiceInfo.
+// CXIMPServiceInfoImp::IapId()
+// ---------------------------------------------------------------------------
+//
+TInt32 CXIMPServiceInfoImp::IapId() const
+    {
+    return iIapId;
+    }
+
+
+// ---------------------------------------------------------------------------
+// From class MXIMPServiceInfo.
+// CXIMPServiceInfoImp::ProtocolImplUid()
+// ---------------------------------------------------------------------------
+//
+TUid CXIMPServiceInfoImp::ProtocolImplUid() const
+    {
+    return iProtocolUid;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPServiceInfoImp::ExternalizeL()
+// ---------------------------------------------------------------------------
+//
+void CXIMPServiceInfoImp::ExternalizeL( RWriteStream& aStream ) const
+    {
+    XIMPRBuf16Helper::ExternalizeL( iAddress, aStream );
+    XIMPRBuf16Helper::ExternalizeL( iUserId, aStream );
+    XIMPRBuf16Helper::ExternalizeL( iPassword, aStream );
+
+    aStream.WriteInt32L( iProtocolUid.iUid );
+    aStream.WriteInt32L( iIapId );
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPServiceInfoImp::InternalizeL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CXIMPServiceInfoImp::InternalizeL( RReadStream& aStream )
+    {
+    XIMPRBuf16Helper::InternalizeL( iAddress, aStream );
+    XIMPRBuf16Helper::InternalizeL( iUserId, aStream );
+    XIMPRBuf16Helper::InternalizeL( iPassword, aStream );
+
+    iProtocolUid.iUid = aStream.ReadInt32L();
+    iIapId = aStream.ReadInt32L();
+    }
+
+// ---------------------------------------------------------------------------
+// CXIMPServiceInfoImp::EqualsContent()
+// ---------------------------------------------------------------------------
+//
+TBool CXIMPServiceInfoImp::EqualsContent( 
+    const CXIMPApiDataObjBase& aOtherInstance ) const
+    {
+    const CXIMPServiceInfoImp* tmp =
+    TXIMPGetImpClassOrPanic< const CXIMPServiceInfoImp >::From( aOtherInstance.Base() );
+    
+
+    TBool same = ETrue;
+    TBool x = EFalse;
+
+    if( ServiceAddress().Compare( tmp->ServiceAddress() ) == 0 &&
+        UserId().Compare( tmp->UserId() ) == 0 &&
+        Password().Compare( tmp->Password() ) == 0 &&
+        ProtocolImplUid() == tmp->ProtocolImplUid() )
+        {
+        x = ETrue;
+        }
+    
+    same &= x;
+
+    return same;
+    }
+
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/core/srcdatamodel/ximpserviceinfoimp.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,134 @@
+/*
+* 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:  MXIMPServiceInfo API object implementation.
+*
+*/
+
+#ifndef CXIMPSERVICEINFOIMP_H
+#define CXIMPSERVICEINFOIMP_H
+
+
+#include "ximpapidataobjbase.h"
+#include <ximpserviceinfo.h>
+#include <s32strm.h>
+
+/**
+ * MXIMPServiceInfo API object implementation.
+ *
+ * @lib ximpdatamodel.dll
+ * @since S60 v3.2
+ */
+NONSHARABLE_CLASS( CXIMPServiceInfoImp ): public CXIMPApiDataObjBase,
+                                          public MXIMPServiceInfo
+    {
+public:
+    /** The class ID. */
+    enum { KClassId = XIMPIMP_CLSID_CXIMPSERVICEINFOIMP };
+
+
+public:
+
+    IMPORT_C static CXIMPServiceInfoImp* NewLC();
+    IMPORT_C static CXIMPServiceInfoImp* NewL();
+    IMPORT_C static CXIMPServiceInfoImp* NewLC( TUid aProtocolImplUid,
+                                                const TDesC16& aServiceAddress,
+                                                const TDesC16& aUsername,
+                                                const TDesC16& aPassword,
+                                                TInt32 aIapId );
+    virtual ~CXIMPServiceInfoImp();
+
+private:
+
+    CXIMPServiceInfoImp();
+    void ConstructL();
+    void ConstructL( TUid aProtocolImplUid,
+                     const TDesC16& aServiceAddress,
+                     const TDesC16& aUsername,
+                     const TDesC16& aPassword,
+                     TInt32 aIapId );
+    
+    /**
+     * @see CXIMPApiDataObjBase
+     */
+    XIMPIMP_DECLARE_DATAOBJ_BASE_PRIV_METHODS
+
+public: // From MXIMPBase
+
+    /**
+     * Implementation of MXIMPBase interface methods
+     * @see MXIMPBase
+     */
+    XIMPIMP_DECLARE_IF_BASE_METHODS
+
+    /**
+     * @see CXIMPApiDataObjBase
+     */
+    XIMPIMP_DECLARE_DATAOBJ_BASE_METHODS
+
+public: // From MXIMPServiceInfo
+
+    /**
+     * Implementation of MXIMPServiceInfo interface methods
+     * @see MXIMPServiceInfo
+     */
+    const TDesC16& ServiceAddress() const;
+    const TDesC16& UserId() const;
+    const TDesC16& Password() const;
+    TInt32 IapId() const;
+    TUid ProtocolImplUid() const;
+
+
+public: // New functions
+
+
+    /**
+     * Internalizes object data from given stream.
+     * @param aStream Stream to read.
+     */
+    IMPORT_C void InternalizeL( RReadStream& aStream );
+
+private: // data
+
+    /**
+     * Service address
+     * Own.
+     */
+    RBuf   iAddress;
+
+    /**
+     * User ID
+     * Own.
+     */
+    RBuf   iUserId;
+
+    /**
+     * Password
+     * Own.
+     */
+    RBuf   iPassword;
+
+    /**
+     * Protocol Uid
+     */
+    TUid iProtocolUid;
+
+    /**
+     * IAP id
+     */
+    TInt32 iIapId;
+
+    };
+
+
+#endif // CXIMPSERVICEINFOIMP_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/core/srcdatamodel/ximpstatusimp.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,208 @@
+/*
+* 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:  MXIMPStatus API object implementation.
+*
+*/
+
+#include "ximpstatusimp.h"
+#include "ximpobjecthelpers.h"
+#include "ximpfeatureinfoimp.h"
+#include "ximprbufhelpers.h"
+
+
+
+// ============================ MEMBER FUNCTIONS =============================
+
+// ---------------------------------------------------------------------------
+// CXIMPStatusImp::NewLC()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CXIMPStatusImp* CXIMPStatusImp::NewLC()
+    {
+    CXIMPStatusImp* self = new( ELeave ) CXIMPStatusImp;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPStatusImp::NewL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CXIMPStatusImp* CXIMPStatusImp::NewL()
+    {
+    CXIMPStatusImp* self = CXIMPStatusImp::NewLC();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+
+
+// ---------------------------------------------------------------------------
+// CXIMPStatusImp::~CXIMPStatusImp()
+// ---------------------------------------------------------------------------
+//
+CXIMPStatusImp::~CXIMPStatusImp()
+    {
+    iProtocolResultDescription.Close();
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPStatusImp::CXIMPStatusImp()
+// ---------------------------------------------------------------------------
+//
+CXIMPStatusImp::CXIMPStatusImp()
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPStatusImp::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void CXIMPStatusImp::ConstructL()
+    {
+    // Initialize the RBufs to zero size. Later on realloc as needed.
+    iProtocolResultDescription.CreateL( 0 );
+    iResultCode = KErrNone;
+    iProtocolResultCode = KErrNone;
+    }
+
+// ---------------------------------------------------------------------------
+// CXIMPStatusImp::NewFromStreamLC()
+// ---------------------------------------------------------------------------
+//
+XIMPIMP_IMPLEMENT_DATAOBJ_NEWFROMSTREAM( CXIMPStatusImp )
+
+
+// ---------------------------------------------------------------------------
+// Implement supported interface access.
+// ---------------------------------------------------------------------------
+//
+XIMPIMP_IF_BASE_GET_INTERFACE_BEGIN( CXIMPStatusImp, 
+                                     MXIMPStatus )
+XIMPIMP_IF_BASE_GET_INTERFACE_END()
+
+
+XIMPIMP_IF_BASE_GET_CONST_INTERFACE_BEGIN( CXIMPStatusImp, 
+                                           MXIMPStatus )
+XIMPIMP_IF_BASE_GET_INTERFACE_END()
+
+
+
+// ---------------------------------------------------------------------------
+// CXIMPStatusImp::ResultCode()
+// ---------------------------------------------------------------------------
+TInt CXIMPStatusImp::ResultCode() const
+    {
+    return iResultCode;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPStatusImp::ProtocolResultCode()
+// ---------------------------------------------------------------------------
+TInt CXIMPStatusImp::ProtocolResultCode() const
+    {
+    return iProtocolResultCode;
+    }
+
+// ---------------------------------------------------------------------------
+// CXIMPStatusImp::ProtocolResultDescription()
+// ---------------------------------------------------------------------------
+const TDesC16& CXIMPStatusImp::ProtocolResultDescription() const
+    {
+    return iProtocolResultDescription;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPStatusImp::SetResultCode()
+// ---------------------------------------------------------------------------
+void CXIMPStatusImp::SetResultCode( TInt aCode )
+    {
+    iResultCode = aCode;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPStatusImp::SetProtocolResultCode()
+// ---------------------------------------------------------------------------
+void CXIMPStatusImp::SetProtocolResultCode( TInt aCode )
+    {
+    iProtocolResultCode = aCode;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPStatusImp::SetProtocolResultDescriptionL()
+// ---------------------------------------------------------------------------
+void CXIMPStatusImp::SetProtocolResultDescriptionL(
+    const TDesC16& aDescription )
+    {
+    XIMPRBuf16Helper::SetNewValueL( iProtocolResultDescription, aDescription );
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPStatusImp::ExternalizeL()
+// ---------------------------------------------------------------------------
+//
+void CXIMPStatusImp::ExternalizeL( RWriteStream& aStream ) const
+    {
+    aStream.WriteInt32L( iResultCode );
+    aStream.WriteInt32L( iProtocolResultCode );
+    XIMPRBuf16Helper::ExternalizeL( iProtocolResultDescription, aStream );
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPStatusImp::InternalizeL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CXIMPStatusImp::InternalizeL( RReadStream& aStream )
+    {
+    iResultCode = aStream.ReadInt32L();
+    iProtocolResultCode = aStream.ReadInt32L();
+    XIMPRBuf16Helper::InternalizeL( iProtocolResultDescription, aStream );
+    }
+
+// ---------------------------------------------------------------------------
+// CXIMPStatusImp::EqualsContent()
+// ---------------------------------------------------------------------------
+//
+TBool CXIMPStatusImp::EqualsContent( 
+    const CXIMPApiDataObjBase& aOtherInstance ) const
+    {
+    const CXIMPStatusImp* tmp =
+    TXIMPGetImpClassOrPanic< const CXIMPStatusImp >::From( aOtherInstance.Base() );
+
+    TBool same = ETrue;
+    TBool x;
+    x = iResultCode == tmp->iResultCode;
+    same &= x;
+
+    x = iProtocolResultCode == tmp->iProtocolResultCode;
+    same &= x;
+
+    x = 0 == iProtocolResultDescription.Compare( tmp->iProtocolResultDescription );
+    same &= x;
+
+    return same;
+    }
+
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/core/srcdatamodel/ximpstatusimp.h	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  MXIMPStatus API object implementation.
+*
+*/
+
+#ifndef CXIMPSTATUSIMP_H
+#define CXIMPSTATUSIMP_H
+
+#include "ximpapidataobjbase.h"
+#include <ximpstatus.h>
+#include <s32strm.h>
+
+
+/**
+ * MXIMPStatus API object implementation.
+ *
+ * @lib ximpdatamodel.dll
+ * @since S60 v3.2
+ */
+NONSHARABLE_CLASS( CXIMPStatusImp ): public CXIMPApiDataObjBase,
+                                     public MXIMPStatus
+    {
+public:
+    /** The class ID. */
+    enum { KClassId = XIMPIMP_CLSID_CXIMPSTATUSIMP };
+
+public:
+
+    IMPORT_C static CXIMPStatusImp* NewLC();
+    IMPORT_C static CXIMPStatusImp* NewL();
+    virtual ~CXIMPStatusImp();
+
+
+private:
+
+    CXIMPStatusImp();
+    void ConstructL();
+
+    /**
+     * @see CXIMPApiDataObjBase
+     */
+    XIMPIMP_DECLARE_DATAOBJ_BASE_PRIV_METHODS
+
+public: // From MXIMPBase
+
+    /**
+     * Implementation of MXIMPBase interface methods
+     * @see MXIMPBase
+     */
+    XIMPIMP_DECLARE_IF_BASE_METHODS
+
+    /**
+     * @see CXIMPApiDataObjBase
+     */
+    XIMPIMP_DECLARE_DATAOBJ_BASE_METHODS
+
+public: // From MXIMPStatus
+
+    /**
+     * Implementation of MXIMPStatus interface methods
+     * @see MXIMPStatus
+     */
+    TInt ResultCode() const;
+    TInt ProtocolResultCode() const;
+    const TDesC16& ProtocolResultDescription() const;
+
+    void SetResultCode( TInt aCode );
+    void SetProtocolResultCode( TInt aCode );
+    void SetProtocolResultDescriptionL( const TDesC16& aDescription );
+
+
+
+
+public: // New functions
+
+    /**
+     * Internalizes object data from given stream.
+     * @param aStream Stream to read.
+     */
+    IMPORT_C void InternalizeL( RReadStream& aStream );
+
+private: // data
+
+
+    /**
+     * Result code.
+     * Own.
+     */
+    TInt iResultCode;
+
+
+    /**
+     * Protocol result code.
+     * Own.
+     */
+    TInt iProtocolResultCode;
+
+
+    /**
+     * Protocol description.
+     * Own.
+     */
+    RBuf iProtocolResultDescription;
+
+    };
+
+
+#endif // CXIMPSTATUSIMP_H
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/core/srcdatamodel/ximpsubscriptionitembase.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,574 @@
+/*
+* 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 Service Connection subscription item base implementation.
+*
+*/
+
+
+#include "ximpsubscriptionitembase.h"
+#include "ximpitemparent.h"
+#include "ximppanics.h"
+#include "ximppsccontext.h"
+#include "ximpdatasubscriptionstateimp.h"
+#include "ximpobjecthelpers.h"
+
+#include "ximptrace.h"
+
+const TInt KXIMPContentAutoExpiryTime = 15; // Seconds
+
+
+// ---------------------------------------------------------------------------
+// CXIMPSubscriptionItemBase::OrderOfContexts()
+// ---------------------------------------------------------------------------
+//
+TInt CXIMPSubscriptionItemBase::OrderOfContexts( const MXIMPPscContext& aFirst,
+                                                 const MXIMPPscContext& aSecond )
+    {
+    if( &aFirst < &aSecond )
+        {
+        return -1;
+        }
+    else if( &aFirst == &aSecond )
+        {
+        return 0;
+        }
+    else
+        {
+        return 1;
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CXIMPSubscriptionItemBase::OrderOfContexts()
+// ---------------------------------------------------------------------------
+//
+TInt CXIMPSubscriptionItemBase::OrderOfItems( const CXIMPSubscriptionItemBase& aFirst,
+                                              const CXIMPSubscriptionItemBase& aSecond )
+    {
+    if( &aFirst < &aSecond )
+        {
+        return -1;
+        }
+    else if( &aFirst == &aSecond )
+        {
+        return 0;
+        }
+    else
+        {
+        return 1;
+        }
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPSubscriptionItemBase::CXIMPSubscriptionItemBase()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CXIMPSubscriptionItemBase::CXIMPSubscriptionItemBase( MXIMPItemParentBase& aParent )
+: iParent( aParent )
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// CXIMPSubscriptionItemBase::BaseConstructL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CXIMPSubscriptionItemBase::BaseConstructL()
+    {
+    CXIMPDataSubscriptionStateImp* datasubscription = NULL;
+    SetDataSubscriptionStateL(*datasubscription);
+    iSubscriptionState = CXIMPDataSubscriptionStateImp::NewL();
+    }
+
+// ---------------------------------------------------------------------------
+// CXIMPSubscriptionItemBase::~CXIMPSubscriptionItemBase()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CXIMPSubscriptionItemBase::~CXIMPSubscriptionItemBase()
+    {
+    __ASSERT_ALWAYS( !CountOfSubscribers(),
+                     User::Panic( NXIMPPrivPanic::KCategory, NXIMPPrivPanic::EArrayCountNotValid ) );
+    iContexts.Close();
+    iPreContexts.Close();
+    iItems.Close();
+    iPreItems.Close();
+    delete iSubscriptionState;
+    }
+
+// ---------------------------------------------------------------------------
+// CXIMPSubscriptionItemBase::SubscriptionStatus()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CXIMPSubscriptionItemBase::TSubscriptionStatus
+           CXIMPSubscriptionItemBase::SubscriptionStatus( MXIMPPscContext* aContext )
+    {
+    // Calculate situation
+    TInt count = iContexts.Count() + iItems.Count();
+    TBool contextFound = IsContext( aContext );
+    if( count == 0 )
+        {
+        return ENotSubscribedAtAll;
+        }
+    else if( contextFound )
+        {
+        if( count == 1 )
+            {
+            return ESubscribedForCtxOnly;
+            }
+        return ESubscribedForCtxAndOthers;
+        }
+    return ESubscribedForOtherCtxOnly;
+    }
+
+// ---------------------------------------------------------------------------
+// CXIMPSubscriptionItemBase::AddSubscriberL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CXIMPSubscriptionItemBase::AddSubscriberL( MXIMPPscContext* aContext )
+    {
+    TRACE_2( _L("CXIMPSubscriptionItemBase::AddSubscriberL( MXIMPPscContext* aContext ) : this = %d , aContext = %d"), this, aContext );
+
+    TRACE_1( _L("CXIMPSubscriptionItemBase::AddSubscriberL( MXIMPPscContext* aContext ) : iPreContexts.Count 1 = %d"), iPreContexts.Count() );
+    TRACE_1( _L("CXIMPSubscriptionItemBase::AddSubscriberL( MXIMPPscContext* aContext ) : iContexts.Count 1 = %d"), iContexts.Count() );        
+    
+    TLinearOrder< MXIMPPscContext > order( OrderOfContexts );
+    if( IsContext( aContext ) )
+        {
+        User::Leave( KErrAlreadyExists );
+        }
+        
+    TInt index = iPreContexts.FindInOrder( aContext, order );
+    TRACE_1( _L("CXIMPSubscriptionItemBase::AddSubscriberL( MXIMPPscContext* aContext ) : iPreContexts.FindInOrder = %d"), index );
+    
+    if( index != KErrNotFound )
+        {
+        User::Leave( KErrAlreadyExists );
+        }
+
+    iPreContexts.InsertInOrderL( aContext, order );
+    
+    User::LeaveIfError( Open() );
+    
+    TRACE_1( _L("CXIMPSubscriptionItemBase::AddSubscriberL( MXIMPPscContext* aContext ) : iPreContexts.Count 2 = %d"), iPreContexts.Count() );
+    TRACE_1( _L("CXIMPSubscriptionItemBase::AddSubscriberL( MXIMPPscContext* aContext ) : iContexts.Count 2 = %d"), iContexts.Count() );        
+
+    ChangeStatusAfterAdd();
+    }
+
+// ---------------------------------------------------------------------------
+// CXIMPSubscriptionItemBase::RemoveSubscriber()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CXIMPSubscriptionItemBase::RemoveSubscriber( MXIMPPscContext* aContext )
+    {
+    TRACE_1( _L("CXIMPSubscriptionItemBase::RemoveSubscriber( MXIMPPscContext* aContext ) : iPreContexts.Count 1 = %d"), iPreContexts.Count() );
+    TRACE_1( _L("CXIMPSubscriptionItemBase::RemoveSubscriber( MXIMPPscContext* aContext ) : iContexts.Count 1 = %d"), iContexts.Count() );        
+
+    TLinearOrder< MXIMPPscContext > order( OrderOfContexts );
+    TInt index = iContexts.FindInOrder( aContext, order );
+    TInt preIndex = iPreContexts.FindInOrder( aContext, order );
+
+    TRACE_1( _L("CXIMPSubscriptionItemBase::RemoveSubscriber( MXIMPPscContext* aContext ) : iContexts.FindInOrder = %d"), index );
+    TRACE_1( _L("CXIMPSubscriptionItemBase::RemoveSubscriber( MXIMPPscContext* aContext ) : iPreContexts.FindInOrder = %d"), preIndex );        
+
+    if( index >= 0 )
+        {
+        TRACE_1( _L("CXIMPSubscriptionItemBase::RemoveSubscriber( MXIMPPscContext* aContext ) : iContexts.Remove( index ):  aContext = %d"), aContext );        
+        
+        iContexts.Remove( index );
+        ChangeStatusAfterRemove();
+        Close();
+        }
+    else if( preIndex >= 0 )
+        {
+        TRACE_1( _L("CXIMPSubscriptionItemBase::RemoveSubscriber( MXIMPPscContext* aContext ) : iPreContexts.Remove( preIndex ):  aContext = %d"), aContext );        
+        
+        iPreContexts.Remove( preIndex );
+        ChangeStatusAfterRemove();
+        Close();
+        }
+    else
+        {
+        TRACE( _L("CXIMPSubscriptionItemBase::RemoveSubscriber( MXIMPPscContext* aContext ) : iParent.UnregisterExpiringItem") );        
+        
+        iParent.UnregisterExpiringItem( this );
+        }
+
+    TRACE_1( _L("CXIMPSubscriptionItemBase::RemoveSubscriber( MXIMPPscContext* aContext ) : iPreContexts.Count 2 = %d"), iPreContexts.Count() );
+    TRACE_1( _L("CXIMPSubscriptionItemBase::RemoveSubscriber( MXIMPPscContext* aContext ) : iContexts.Count 2 = %d"), iContexts.Count() );        
+
+    }
+
+// ---------------------------------------------------------------------------
+// CXIMPSubscriptionItemBase::AddSubscriberL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CXIMPSubscriptionItemBase::AddSubscriberL( CXIMPSubscriptionItemBase* aItem )
+    {
+    TRACE( _L("CXIMPSubscriptionItemBase::AddSubscriberL( CXIMPSubscriptionItemBase* aItem ) : begin") );        
+    
+    TLinearOrder< CXIMPSubscriptionItemBase > order( OrderOfItems );
+    TInt index = iItems.FindInOrder( aItem, order );
+    if( index != KErrNotFound )
+        {
+        return;
+        }
+    index = iPreItems.FindInOrder( aItem, order );
+    if( index != KErrNotFound )
+        {
+        return;
+        }
+
+    iPreItems.InsertInOrderL( aItem, order );
+    User::LeaveIfError( Open() );
+    ChangeStatusAfterAdd();
+    
+    TRACE( _L("CXIMPSubscriptionItemBase::AddSubscriberL( CXIMPSubscriptionItemBase* aItem ) : end") );        
+    }
+
+// ---------------------------------------------------------------------------
+// CXIMPSubscriptionItemBase::RemoveSubscriber()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CXIMPSubscriptionItemBase::RemoveSubscriber( CXIMPSubscriptionItemBase* aItem )
+    {
+    TRACE( _L("CXIMPSubscriptionItemBase::RemoveSubscriberL( CXIMPSubscriptionItemBase* aItem ) : begin") );        
+    
+    TLinearOrder< CXIMPSubscriptionItemBase > order( OrderOfItems );
+    TInt index = iItems.FindInOrder( aItem, order );
+    TInt preIndex = iPreItems.FindInOrder( aItem, order );
+    if( index >= 0 )
+        {
+        iItems.Remove( index );
+        ChangeStatusAfterRemove();
+        Close();
+        }
+    else if( preIndex >= 0 )
+        {
+        iPreItems.Remove( index );
+        ChangeStatusAfterRemove();
+        Close();
+        }
+    else
+        {
+        iParent.UnregisterExpiringItem( this );
+        }
+    
+    TRACE( _L("CXIMPSubscriptionItemBase::RemoveSubscriberL( CXIMPSubscriptionItemBase* aItem ) : end") );                
+    }
+
+// ---------------------------------------------------------------------------
+// CXIMPSubscriptionItemBase::ForceClose()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CXIMPSubscriptionItemBase::ForceClose()
+    {
+    TInt count = iContexts.Count();
+    for( TInt a = 0; a < count; ++a )
+        {
+        // RemoveSubscriber removes first one every time.
+        RemoveSubscriber( iContexts[ 0 ] );
+        }
+    count = iItems.Count();
+    for( TInt a = 0; a < count; ++a )
+        {
+        RemoveSubscriber( iItems[ 0 ] );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CXIMPSubscriptionItemBase::CleanIfExpired()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TBool CXIMPSubscriptionItemBase::CleanIfExpired()
+    {
+    TTime timeNow;
+    timeNow.UniversalTime();
+    TBool expired =
+        ( iExpireTime + TTimeIntervalSeconds( KXIMPContentAutoExpiryTime ) ) < timeNow;
+    if( expired )
+        {
+        CleanExpired();
+        }
+    return expired;
+    }
+
+// ---------------------------------------------------------------------------
+// CXIMPSubscriptionItemBase::UpdateSubscriptionStateL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CXIMPSubscriptionItemBase::UpdateSubscriptionStateL( TSubscriptionEvent aUpdateState )
+    {
+    switch( aUpdateState )
+        {
+        case ECompleteDataReceived:
+            {
+            if( CountOfSubscribers() == 0 )
+                {
+                UpdateExpirationL();
+                }
+            break;
+            }
+        default:
+            {
+            User::Panic( NXIMPPrivPanic::KCategory, NXIMPPrivPanic::ESubscriptionItemLogicError );
+            break;
+            }
+        }
+    }
+    
+
+// ---------------------------------------------------------------------------
+// CXIMPSubscriptionItemBase::DataSubscriptionState()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C const MXIMPDataSubscriptionState& CXIMPSubscriptionItemBase::DataSubscriptionState()
+    {
+    return *iSubscriptionState;
+    }
+
+// ---------------------------------------------------------------------------
+// CXIMPSubscriptionItemBase::ContextCount()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CXIMPSubscriptionItemBase::ContextCount() const
+    {
+//    return iContexts.Count();
+    TInt count = iContexts.Count();
+    TRACE_1( _L("CXIMPSubscriptionItemBase::ContextCount() : return = %d"), count );
+    return count;
+    }
+
+// ---------------------------------------------------------------------------
+// CXIMPSubscriptionItemBase::Context()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C MXIMPPscContext& CXIMPSubscriptionItemBase::Context( TInt aIndex )
+    {
+    return *iContexts[ aIndex ];
+    }
+
+// ---------------------------------------------------------------------------
+// CXIMPSubscriptionItemBase::Context()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TBool CXIMPSubscriptionItemBase::IsContext( MXIMPPscContext* aContext ) const
+    {
+    TLinearOrder< MXIMPPscContext > order( OrderOfContexts );
+//    return iContexts.FindInOrder( aContext, order ) != KErrNotFound;
+    TBool ret = iContexts.FindInOrder( aContext, order ) != KErrNotFound;
+    TRACE_1( _L("CXIMPSubscriptionItemBase::IsContext( MXIMPPscContext* aContext ) : return = %d"), (TInt)ret );
+    return ret;
+    }
+
+// ---------------------------------------------------------------------------
+// CXIMPSubscriptionItemBase::SynthesiseSubscriptionEventToAllCtxsL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CXIMPSubscriptionItemBase::SynthesiseSubscriptionEventToAllCtxsL()
+    {
+    TRACE_1( _L("CXIMPSubscriptionItemBase::SynthesiseSubscriptionEventToAllCtxsL() : this = %d " ), this );
+    RPointerArray< MXIMPPscContext > contextArray;
+    CleanupClosePushL( contextArray );
+    TLinearOrder< MXIMPPscContext > order( OrderOfContexts );
+
+    TInt contextCount = iContexts.Count();
+    
+    TRACE_1( _L("CXIMPSubscriptionItemBase::SynthesiseSubscriptionEventToAllCtxsL() contextCount = %d"), contextCount );
+    TRACE_1( _L("CXIMPSubscriptionItemBase::SynthesiseSubscriptionEventToAllCtxsL() : iPreContexts.Count = %d"), iPreContexts.Count() );
+    
+    for( TInt a = 0; a < contextCount; ++a )
+        {
+        contextArray.InsertInOrderL( iContexts[ a ], order );
+        }
+
+    TInt itemCount = iItems.Count();
+    TRACE_1( _L("CXIMPSubscriptionItemBase::SynthesiseSubscriptionEventToAllCtxsL() itemCount = %d"), itemCount );
+    
+    for( TInt a = 0; a < itemCount; ++a )
+        {
+        TInt contextCount = iItems[ a ]->ContextCount();
+        for( TInt b = 0; b < contextCount; ++b )
+            {
+            TInt error = contextArray.InsertInOrder( &iItems[ a ]->Context( b ), order );
+            if( error != KErrNotFound )
+                {
+                User::LeaveIfError( error );
+                }
+            }
+        }
+
+    TInt count = contextArray.Count();
+    TRACE_1( _L("CXIMPSubscriptionItemBase::SynthesiseSubscriptionEventToAllCtxsL() contextArray.Count() = %d"), count );
+    
+    for( TInt a = 0; a < count; ++a )
+        {
+        TRACE_1( _L("CXIMPSubscriptionItemBase::SynthesiseSubscriptionEventToAllCtxsL() Sending event to = %d"), a );
+        TInt error ( KErrNone );
+        TRAP( error, SynthesiseSubscriptionEventToL( contextArray[ a ], ETrue ); );
+        TRACE_1( _L("CXIMPSubscriptionItemBase::SynthesiseSubscriptionEventToAllCtxsL() : TRAPD( error, SynthesiseSubscriptionEventToL = %d"), error );
+        }
+    CleanupStack::PopAndDestroy(); // contextArray
+    }
+
+// ---------------------------------------------------------------------------
+// CXIMPSubscriptionItemBase::ActivateSubscriberL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CXIMPSubscriptionItemBase::ActivateSubscriberL( MXIMPPscContext* aContext )
+    {
+    TRACE_1( _L("CXIMPSubscriptionItemBase::ActivateSubscriberL( MXIMPPscContext* aContext ) : this = %d "),this );
+    TLinearOrder< MXIMPPscContext > order( OrderOfContexts );
+    TInt index = iPreContexts.FindInOrder( aContext, order );
+    
+    TRACE_1( _L("CXIMPSubscriptionItemBase::ActivateSubscriberL() : MXIMPPscContext* aContext = %d"), aContext );
+    
+    TRACE_1( _L("CXIMPSubscriptionItemBase::ActivateSubscriberL() : iPreContexts.Count 1 = %d"), iPreContexts.Count() );
+    TRACE_1( _L("CXIMPSubscriptionItemBase::ActivateSubscriberL() : iContexts.Count 1 = %d"), iContexts.Count() );        
+    TRACE_1( _L("CXIMPSubscriptionItemBase::ActivateSubscriberL() : iPreContexts.FindInOrder = %d"), index );
+    if( index != KErrNotFound )
+        {
+        iContexts.InsertInOrderL( iPreContexts[ index ], order );
+        iPreContexts.Remove( index );
+        }
+        
+    TRACE_1( _L("CXIMPSubscriptionItemBase::ActivateSubscriberL() : iPreContexts.Count 2 = %d"), iPreContexts.Count() );
+    TRACE_1( _L("CXIMPSubscriptionItemBase::ActivateSubscriberL() : iContexts.Count 2 = %d"), iContexts.Count() );        
+    }
+
+// ---------------------------------------------------------------------------
+// CXIMPSubscriptionItemBase::ActivateSubscriberL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CXIMPSubscriptionItemBase::ActivateSubscriberL( CXIMPSubscriptionItemBase* aItem )
+    {
+    TRACE( _L("CXIMPSubscriptionItemBase::ActivateSubscriberL( CXIMPSubscriptionItemBase* aItem )" ) );
+    TLinearOrder< CXIMPSubscriptionItemBase > order( OrderOfItems );
+    TInt index = iPreItems.FindInOrder( aItem, order );
+    TRACE_1( _L("CXIMPSubscriptionItemBase::ActivateSubscriberL() : iPreItems.FindInOrder = %d"), index );
+    
+    if( index != KErrNotFound )
+        {
+        iItems.InsertInOrderL( iPreItems[ index ], order );
+        iPreItems.Remove( index );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CXIMPSubscriptionItemBase::Status()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CXIMPSubscriptionItemBase::SetDataSubscriptionStateL( CXIMPDataSubscriptionStateImp& aNewState )
+    {
+    // Some handle logic for terminating subscribers, data expiration etc. missing.
+    delete iSubscriptionState;
+    iSubscriptionState = &aNewState;
+    }
+
+// ---------------------------------------------------------------------------
+// CXIMPSubscriptionItemBase::Status()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CXIMPDataSubscriptionStateImp* CXIMPSubscriptionItemBase::StatusLC( MXIMPPscContext* aContext ) const
+    {
+    MXIMPDataSubscriptionState::TSubscriptionState subscriptionState = iSubscriptionState->SubscriptionState();
+    MXIMPDataSubscriptionState::TDataState dataState = iSubscriptionState->DataState();
+    CXIMPDataSubscriptionStateImp* state = 
+            TXIMPObjectCloner< CXIMPDataSubscriptionStateImp >::CloneL( *iSubscriptionState );
+    CleanupStack::PushL( state );
+    
+    state->SetSubscriptionState( MXIMPDataSubscriptionState::ESubscriptionInactive );
+    state->SetDataState( MXIMPDataSubscriptionState::EDataUnavailable );
+    TInt count = iItems.Count();
+    for( TInt a = 0; a < count; ++a )
+        {
+        if( iItems[ a ]->IsContext( aContext ) )
+            {
+            state->SetSubscriptionState( subscriptionState );
+            state->SetDataState( dataState );
+            return state;
+            }
+        }
+    count = iPreItems.Count();
+    for( TInt a = 0; a < count; ++a )
+        {
+        if( iPreItems[ a ]->IsContext( aContext ) )
+            {
+            state->SetSubscriptionState( MXIMPDataSubscriptionState::ESubscriptionActive );
+            }
+        }
+
+    TLinearOrder< MXIMPPscContext > order( OrderOfContexts );
+    TInt index = iContexts.FindInOrder( aContext, order );
+    if( index == KErrNotFound )
+        {
+        index = iPreContexts.FindInOrder( aContext, order );
+        if( index != KErrNotFound ) // Not yet activated
+            {
+            state->SetSubscriptionState( MXIMPDataSubscriptionState::ESubscriptionActive );
+            }
+        }
+    else
+        {
+        state->SetSubscriptionState( subscriptionState );
+        state->SetDataState( dataState );
+        }
+    return state;
+    }
+
+// ---------------------------------------------------------------------------
+// CXIMPSubscriptionItemBase::UpdateExpirationL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CXIMPSubscriptionItemBase::UpdateExpirationL()
+    {
+    if( CountOfSubscribers() == 0 )
+        {
+        iParent.RegisterExpiringItemL( this );
+        }
+    iExpireTime.UniversalTime();
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPSubscriptionItemBase::ChangeStatusAfterRemove()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CXIMPSubscriptionItemBase::ChangeStatusAfterRemove()
+    {
+    if( CountOfSubscribers() == 0 )
+        {
+        iSubscriptionState->SetSubscriptionState( MXIMPDataSubscriptionState::ESubscriptionInactive );
+        }
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPSubscriptionItemBase::ChangeStatusAfterAdd()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CXIMPSubscriptionItemBase::ChangeStatusAfterAdd()
+    {
+    iSubscriptionState->SetSubscriptionState( MXIMPDataSubscriptionState::ESubscriptionActive );
+    }
+
+// ---------------------------------------------------------------------------
+// CXIMPSubscriptionItemBase::CountOfSubscribers()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CXIMPSubscriptionItemBase::CountOfSubscribers()
+    {
+    return iItems.Count() + iPreItems.Count() + iContexts.Count() + iPreContexts.Count();
+    }
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/core/srcdatamodel/ximptypehelpers.h	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  Typedef helpers for really long typenames.
+ *
+*/
+
+#ifndef XIMPTYPEHELPERS_H
+#define XIMPTYPEHELPERS_H
+
+#include "ximpapiobjbase.h"
+#include <e32base.h>
+
+
+class CXIMPIdentityImp;
+class CXIMPApiDataObjBase;
+
+// Key for opening up the typedefs:
+//
+// R(Xyz)Array = RXIMPObjOwningPtrArray<xyz>
+//
+// When adding new types, follow these conventions.
+//
+
+typedef RXIMPObjOwningPtrArray<CXIMPIdentityImp> RPrIdImpArray;
+
+
+struct SXIMPReqParam
+    {
+    CXIMPApiDataObjBase* iParam;
+    TInt iParamType;
+    };
+
+typedef RArray<SXIMPReqParam> RPrReqParamArray;
+
+#endif // XIMPTYPEHELPERS_H
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/core/srcfrontend/srcecomhook/ximpecomhook.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,46 @@
+/*
+* 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:  XIMP Framework ECom Hook implementation.
+*
+*/
+
+
+#include "ximpdlluids.hrh"
+#include "ximpclientimp.h"
+#include <ecom/implementationproxy.h>
+#include <e32base.h>
+
+
+// ---------------------------------------------------------------------------
+// Key value pair table to identify correct constructor
+// function for the requested interface.
+// ---------------------------------------------------------------------------
+//
+const TImplementationProxy ImplementationTable[] =
+    {
+    IMPLEMENTATION_PROXY_ENTRY( XIMP_ECOM_IMPLEMENTATION_UID_CLIENT_INTERFACE,
+                                CXIMPClientImp::NewMXIMPClientL )
+    };
+
+
+// ---------------------------------------------------------------------------
+// Exported function to return the implementation proxy table
+// ---------------------------------------------------------------------------
+//
+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/ximpfw/core/srcfrontend/srcecomhook/ximpecomhook.rss	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  ECom registery info for ECom hook
+*
+*/
+
+
+#include <ecom/registryinfov2.rh>
+#include "ximpmanagementifids.hrh"
+#include "ximpdlluids.hrh"
+
+
+
+// ---------------------------------------------------------------------------
+// ECom registery info for Presence Framework ECom hook
+// ---------------------------------------------------------------------------
+//
+RESOURCE REGISTRY_INFO theInfo
+    {
+    resource_format_version = RESOURCE_FORMAT_VERSION_2;
+    dll_uid = XIMP_DLL_UID_COMMON;
+
+    interfaces =
+        {
+        INTERFACE_INFO
+            {
+            interface_uid = XIMP_ECOM_IF_UID_CLIENT_INTERFACE;
+            implementations =
+                {
+                IMPLEMENTATION_INFO
+                    {
+                    implementation_uid = XIMP_ECOM_IMPLEMENTATION_UID_CLIENT_INTERFACE;
+                    version_no         = 1;
+                    display_name       = "S60 Default PrFw";
+                    default_data       = XIMP_ECOM_DEFAULT_DATA_CLIENT_INTERFACE;
+                    opaque_data        = "";
+                    }
+                };
+            }
+        };
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/core/srcfrontend/srcmanager/ximpclientifsingleton.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,138 @@
+/*
+* 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:  Reference counted singleton for XIMP client side.
+*
+*/
+
+#include    "ximpclientifsingleton.h"
+#include    "ximpsrvrootclient.h"
+
+
+
+// ============================ HELPER CLASS ===============================
+
+
+/**
+ * CXIMPClientIfSingleton nested structure
+ * to hold global objects.
+ */
+NONSHARABLE_STRUCT( CXIMPClientIfSingleton::SGlobals )
+    {
+    /**
+     * Root connection to XIMP server.
+     * The CXIMPClientIfSingleton manages and ows the connection.
+     */
+    RXIMPSrvRootClient iRootClient;
+    };
+
+
+
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CXIMPClientIfSingleton::InstanceL()
+// Singleton access method.
+// -----------------------------------------------------------------------------
+//
+CXIMPClientIfSingleton* CXIMPClientIfSingleton::InstanceL()
+    {
+    CXIMPClientIfSingleton* singleton;
+
+    singleton = ( CXIMPClientIfSingleton* ) Dll::Tls();
+    if( !singleton )
+        {
+        singleton = CXIMPClientIfSingleton::NewLC();
+        User::LeaveIfError( Dll::SetTls( singleton ) );
+        CleanupStack::Pop();
+        }
+    else
+        {
+        User::LeaveIfError(singleton->Open()); // Open return KErrNone.
+        }
+
+    return singleton;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CXIMPClientIfSingleton::NewLC()
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CXIMPClientIfSingleton* CXIMPClientIfSingleton::NewLC()
+    {
+    CXIMPClientIfSingleton* self = new( ELeave ) CXIMPClientIfSingleton;
+    CleanupClosePushL( *self );
+    self->ConstructL();
+    return self;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CXIMPClientIfSingleton::CXIMPClientIfSingleton()
+// -----------------------------------------------------------------------------
+//
+CXIMPClientIfSingleton::CXIMPClientIfSingleton()
+    {
+    }
+
+
+// Destructor
+CXIMPClientIfSingleton::~CXIMPClientIfSingleton()
+    {
+    //Destroy global objects
+    if( iGlobals )
+        {
+        iGlobals->iRootClient.Close();
+        }
+
+    //And the holder
+    delete iGlobals;
+    Dll::SetTls( NULL );
+    #if _BullseyeCoverage
+    cov_write();
+    #endif    
+    }
+
+
+
+// -----------------------------------------------------------------------------
+// CXIMPClientIfSingleton::ConstructL()
+// -----------------------------------------------------------------------------
+//
+void CXIMPClientIfSingleton::ConstructL()
+    {
+    //Reserve the object holder and zero initialize it
+    iGlobals = new ( ELeave ) SGlobals;
+    Mem::FillZ( iGlobals, sizeof( SGlobals ) );
+
+    //Construct needed global objects
+    User::LeaveIfError( iGlobals->iRootClient.Connect() );
+    }
+
+
+
+// -----------------------------------------------------------------------------
+// CXIMPClientIfSingleton::RootClient()
+// -----------------------------------------------------------------------------
+//
+RXIMPSrvRootClient& CXIMPClientIfSingleton::RootClient()
+    {
+    return iGlobals->iRootClient;
+    }
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/core/srcfrontend/srcmanager/ximpclientifsingleton.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,108 @@
+/*
+* 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:  Reference counted singleton for XIMP client side.
+*
+*/
+
+#ifndef CXIMPCLIENTIFSINGLETON_H
+#define CXIMPCLIENTIFSINGLETON_H
+
+#include <e32base.h>
+
+
+class RXIMPSrvRootClient;
+
+
+
+/**
+ * Reference counted singleton for XIMP Framework
+ * client IF library.
+ *
+ * @lib ximpclientinterface.dll
+ * @since S60 v3.2
+ */
+NONSHARABLE_CLASS( CXIMPClientIfSingleton ) : public CObject
+    {
+    /** Private nested structure to hold global objects */
+    struct SGlobals;
+
+
+public:  // singleton access
+
+    /**
+     * Singleton access method.
+     *
+     * Gets pointer to XIMP Client Interface library singleton.
+     */
+    static CXIMPClientIfSingleton* InstanceL();
+
+
+
+private:
+
+    /**
+     * Two-phased constructor.
+     * Leaves created object on the CleanupStack.
+     */
+    static CXIMPClientIfSingleton* NewLC();
+
+
+    /**
+     * C++ default constructor.
+     */
+    CXIMPClientIfSingleton();
+
+
+    /**
+     * Private destructor.
+     *
+     * Singleton holder is reference counted.
+     * It is automaticly destroyed when last
+     * holded object or reference is destroyed.
+     */
+    ~CXIMPClientIfSingleton();
+
+
+
+    /**
+     * Symbian 2nd phase constructor
+     */
+    void ConstructL();
+
+
+
+public:
+
+
+    /**
+     * Gets reference to XIMP client side Root Server session.
+     *
+     * @return Connected XIMP Root Server session.
+     */
+    RXIMPSrvRootClient& RootClient();
+
+
+private:    // Data
+
+
+    /**
+     * Object holder having pointers to XIMP client side global objects.
+     * Both holder and pointed objects own.
+     */
+    SGlobals* iGlobals;
+    };
+
+#endif      // CXIMPCLIENTIFSINGLETON_H
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/core/srcfrontend/srcmanager/ximpclientimp.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  MXIMPClient API object implementation.
+*
+*/
+
+#include "ximpclientimp.h"
+#include "ximpclientifsingleton.h"
+#include "ximpobjecthelpers.h"
+#include "ximpsrvrootclient.h"
+#include "ximpprotocolinfoimp.h"
+#include "ximpfeatureinfoimp.h"
+#include "ximpcontextimp.h"
+#include "ximpobjecthelpers.h"
+
+
+// ============================ MEMBER FUNCTIONS =============================
+
+
+// ---------------------------------------------------------------------------
+// CXIMPClientImp::NewMXIMPClientL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C MXIMPClient* CXIMPClientImp::NewMXIMPClientL()
+    {
+    CXIMPClientImp* self = new( ELeave ) CXIMPClientImp;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// Implement supported interface access.
+// ---------------------------------------------------------------------------
+//
+XIMPIMP_IF_BASE_GET_INTERFACE_BEGIN( CXIMPClientImp, 
+                                     MXIMPClient )
+XIMPIMP_IF_BASE_GET_INTERFACE_END()
+
+
+XIMPIMP_IF_BASE_GET_CONST_INTERFACE_BEGIN( CXIMPClientImp, 
+                                           MXIMPClient )
+XIMPIMP_IF_BASE_GET_INTERFACE_END()
+
+// ---------------------------------------------------------------------------
+// CXIMPClientImp::~CXIMPClientImp()
+// ---------------------------------------------------------------------------
+//
+CXIMPClientImp::~CXIMPClientImp()
+    {
+    if( iSingleton )
+        {
+        //Singleton is refercen counted
+        //So the Close() is enough to release the reference
+        iSingleton->Close();
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CXIMPClientImp::CXIMPClientImp()
+// ---------------------------------------------------------------------------
+//
+CXIMPClientImp::CXIMPClientImp()
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// void CXIMPClientImp::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void CXIMPClientImp::ConstructL()
+    {
+    iSingleton = CXIMPClientIfSingleton::InstanceL();
+    }
+
+// ---------------------------------------------------------------------------
+// CXIMPClientImp::GetProtocolsL()
+// ---------------------------------------------------------------------------
+//
+void CXIMPClientImp::GetProtocolsL(
+    RXIMPObjOwningPtrArray< MXIMPProtocolInfo >& aProtocols )
+    {
+    aProtocols.ResetAndDestroy();
+
+    RXIMPObjOwningPtrArray< CXIMPProtocolInfoImp > foundProtocols;
+    CleanupClosePushL( foundProtocols ); 
+
+    HBufC8* pack = iSingleton->RootClient().GetKnownProtocolsL(); 
+    CleanupStack::PushL( pack ); 
+    
+    TXIMPObjectPacker< CXIMPProtocolInfoImp >::UnPackArrayL( foundProtocols, 
+                                                             *pack );
+    CleanupStack::PopAndDestroy( pack );
+
+    TXIMPObjectMover< CXIMPProtocolInfoImp, 
+                      MXIMPProtocolInfo >::MoveFromPtrArrayToL( foundProtocols, 
+                                                                aProtocols ); 
+    CleanupStack::PopAndDestroy(); //foundProtocols
+    }
+
+
+
+// ---------------------------------------------------------------------------
+// CXIMPClientImp::GetFrameworkFeaturesLC()
+// ---------------------------------------------------------------------------
+//
+MXIMPFeatureInfo* CXIMPClientImp::GetFrameworkFeaturesLC()
+    {
+    CXIMPFeatureInfoImp* features = CXIMPFeatureInfoImp::NewLC();
+    
+    HBufC8* pack = iSingleton->RootClient().GetSupportedFrameworkFeaturesL();
+    CleanupStack::PushL( pack );
+    TXIMPObjectPacker< CXIMPFeatureInfoImp >::UnPackL( *features, *pack );
+    CleanupStack::PopAndDestroy( pack );
+
+    return features;
+    }
+    
+    
+// ---------------------------------------------------------------------------
+// CXIMPClientImp::NewPresenceContextLC()
+// ---------------------------------------------------------------------------
+//
+MXIMPContext* CXIMPClientImp::NewPresenceContextLC()
+    {
+    return CXIMPContextImp::NewLC();
+    }
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/core/srcfrontend/srcmanager/ximpclientimp.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,88 @@
+/*
+* 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:  MXIMPClient API object implementation.
+*
+*/
+
+#ifndef CXIMPCLIENTIMP_H
+#define CXIMPCLIENTIMP_H
+
+#include <ximpclient.h>
+#include "ximpapiobjbase.h"
+
+
+class CXIMPClientIfSingleton;
+class MXIMPFeatureInfo;
+
+
+/**
+ * MXIMPClient API object implementation.
+ *
+ * @lib ximpmanager.dll
+ * @since S60 v3.2
+ */
+NONSHARABLE_CLASS( CXIMPClientImp ): public CXIMPApiObjBase,
+                                     public MXIMPClient
+    {
+    public:
+    /** The class ID. */
+    enum { KClassId = XIMPIMP_CLSID_CXIMPCLIENTIMP };
+
+
+public:
+
+    IMPORT_C static MXIMPClient* NewMXIMPClientL();
+    virtual ~CXIMPClientImp();
+
+private:
+
+    CXIMPClientImp();
+    void ConstructL();
+
+
+
+public: // From MXIMPBase
+
+    /**
+     * Implementation of MXIMPBase interface methods
+     * @see MXIMPBase
+     */
+    XIMPIMP_DECLARE_IF_BASE_METHODS
+
+
+public: //From MXIMPClient
+
+
+    /**
+     * Implementation of MXIMPClient interface methods
+     * @see MXIMPClient
+     */
+    void GetProtocolsL( RXIMPObjOwningPtrArray< MXIMPProtocolInfo >& aProtocols );
+    MXIMPFeatureInfo* GetFrameworkFeaturesLC();
+    MXIMPContext* NewPresenceContextLC();    
+
+
+
+private: // data
+
+    /**
+     * XIMP client side singleton.
+     * Own.
+     */
+    CXIMPClientIfSingleton* iSingleton;
+
+    };
+
+
+#endif // CXIMPCLIENTIMP_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/core/srcfrontend/srcmanager/ximpcntxteventobsarray.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  Presence context observer array.
+*
+*/
+
+#include "ximpcntxteventobsarray.h"
+#include "ximpcontexteventfilter.h"
+#include "ximpundotask.h"
+#include <ximpcontextobserver.h>
+
+
+
+// ============================ HELPER CLASS =================================
+
+/**
+ * Array entry helper holding pointer to actual observer and event
+ * filter that is used to filter events delivered to the observer.
+ *
+ * @lib ximpmanager.dll
+ * @since S60 v3.2
+ */
+NONSHARABLE_CLASS( CXIMPCntxtEventObsArray::CObsEntry )
+    : public CBase
+    {
+public:
+
+    /**
+     * Two phased constructor.
+     *
+     * @param aObserver The observer.
+     * @param aAcceptedEvents The accepted events. May be NULL.
+     */
+    static CObsEntry* NewLC( MXIMPContextObserver& aObserver, // CSI: 42 #
+                             const TArray< TInt32 >* aAcceptedEvents );
+
+
+    /**
+     * Destructor.
+     */
+    virtual ~CObsEntry();
+
+private:
+
+    CObsEntry( MXIMPContextObserver& aObserver );
+
+public:
+
+    /**
+     * Gets the observer.
+     * @return The observer.
+     */
+    MXIMPContextObserver& Observer();
+
+
+    /**
+     * Gets the event filter that should
+     * be used to filter events delivered to observer.
+     * @return The event filter.
+     */
+    const CXIMPContextEventFilter& EventFilter() const;
+
+
+
+private: // data
+
+    /**
+     * The observer.
+     * Not own.
+     */
+    MXIMPContextObserver& iObserver;
+
+
+    /**
+     * The event filter associated to the observer.
+     * Own.
+     */
+    CXIMPContextEventFilter* iEventFilter;
+    };
+
+
+
+
+
+// ---------------------------------------------------------------------------
+// CXIMPCntxtEventObsArray::CObsEntry::NewLC()
+// ---------------------------------------------------------------------------
+//
+CXIMPCntxtEventObsArray::CObsEntry*
+    CXIMPCntxtEventObsArray::CObsEntry::NewLC(
+    MXIMPContextObserver& aObserver,
+    const TArray< TInt32 >* aAcceptedEvents )
+    {
+    CObsEntry* self = new( ELeave ) CObsEntry( aObserver );
+    CleanupStack::PushL( self );
+
+    self->iEventFilter = CXIMPContextEventFilter::NewLC( aAcceptedEvents );
+    CleanupStack::Pop( self->iEventFilter );
+
+    return self;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPCntxtEventObsArray::CObsEntry::~CObsEntry()
+// ---------------------------------------------------------------------------
+//
+CXIMPCntxtEventObsArray::CObsEntry::~CObsEntry()
+    {
+    delete iEventFilter;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPCntxtEventObsArray::CObsEntry::CObsEntry()
+// ---------------------------------------------------------------------------
+//
+CXIMPCntxtEventObsArray::CObsEntry::CObsEntry(
+    MXIMPContextObserver& aObserver )
+    : iObserver( aObserver )
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPCntxtEventObsArray::CObsEntry::Observer()
+// ---------------------------------------------------------------------------
+//
+MXIMPContextObserver&
+    CXIMPCntxtEventObsArray::CObsEntry::Observer()
+    {
+    return iObserver;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPCntxtEventObsArray::CObsEntry::EventFilter()
+// ---------------------------------------------------------------------------
+//
+const CXIMPContextEventFilter&
+    CXIMPCntxtEventObsArray::CObsEntry::EventFilter() const
+    {
+    return *iEventFilter;
+    }
+
+
+
+// ============================ MEMBER FUNCTIONS =============================
+
+// ---------------------------------------------------------------------------
+// CXIMPCntxtEventObsArray::NewL()
+// ---------------------------------------------------------------------------
+//
+CXIMPCntxtEventObsArray*
+    CXIMPCntxtEventObsArray::NewL()
+    {
+    CXIMPCntxtEventObsArray* self = new( ELeave ) CXIMPCntxtEventObsArray();
+    return self;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPCntxtEventObsArray::CXIMPCntxtEventObsArray()
+// ---------------------------------------------------------------------------
+//
+CXIMPCntxtEventObsArray::~CXIMPCntxtEventObsArray()
+    {
+    iObservers.ResetAndDestroy();
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPCntxtEventObsArray::CXIMPCntxtEventObsArray()
+// ---------------------------------------------------------------------------
+//
+CXIMPCntxtEventObsArray::CXIMPCntxtEventObsArray()
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPCntxtEventObsArray::AddObserverLC()
+// ---------------------------------------------------------------------------
+//
+MXIMPUndoTask* CXIMPCntxtEventObsArray::AddObserverLC(
+    MXIMPContextObserver& aObserver,
+    const TArray< TInt32 >* aEventFilter )
+    {
+    __ASSERT_ALWAYS( !IsReqistered( aObserver ),
+                     User::Leave( KErrAlreadyExists ) );
+
+    //Create undo task
+    CXIMPUndoPtrArrayEntryAdd< CObsEntry >* undoTask =
+    CXIMPUndoPtrArrayEntryAdd< CObsEntry >::NewLC();
+
+    //Create observer entry and add it to observer array
+    CObsEntry* observerEntry = CObsEntry::NewLC( aObserver, aEventFilter );
+    iObservers.AppendL( observerEntry );
+    CleanupStack::Pop( observerEntry );
+
+    //Initialize undo task to remove and destroy just added
+    //observer entry from observer array on undoTask destruction
+    undoTask->InitToRemoveAndDestroyOnUndo( *observerEntry, iObservers );
+    return undoTask;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPCntxtEventObsArray::UpdateObserverLC()
+// ---------------------------------------------------------------------------
+//
+MXIMPUndoTask* CXIMPCntxtEventObsArray::UpdateObserverLC(
+    MXIMPContextObserver& aObserver,
+    const TArray< TInt32 >* aEventFilter )
+    {
+    __ASSERT_ALWAYS( IsReqistered( aObserver ),
+                     User::Leave( KErrAlreadyExists ) );
+
+    //Create undo task
+    CXIMPUndoPtrArrayEntryReplace< CObsEntry >* undoTask =
+    CXIMPUndoPtrArrayEntryReplace< CObsEntry >::NewLC();
+
+    //Create entry & filter for observer
+    CObsEntry* newEntry = CObsEntry::NewLC( aObserver, aEventFilter );
+    CleanupStack::Pop( newEntry );
+
+    //Replace existing entry with new one
+    const TInt index = FindEntryPosition( aObserver );
+    CObsEntry* oldEntry = iObservers[ index ];
+    iObservers[ index ] = newEntry;
+
+    //Initialize undo task to switch back to old entry in case of undo
+    //Undo task takes care of deleting of the entry
+    //which remains out of array
+    undoTask->InitToReplaceOnUndo( *newEntry, iObservers, *oldEntry );
+    return undoTask;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPCntxtEventObsArray::RemoveObserver()
+// ---------------------------------------------------------------------------
+//
+void CXIMPCntxtEventObsArray::RemoveObserver(
+    MXIMPContextObserver& aObserver )
+    {
+    const TInt entryPos = FindEntryPosition( aObserver );
+    if( entryPos != KErrNotFound )
+        {
+        delete iObservers[ entryPos ];
+        iObservers.Remove( entryPos );
+        }
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPCntxtEventObsArray::CollectEventFilterLC()
+// ---------------------------------------------------------------------------
+//
+CXIMPContextEventFilter*
+    CXIMPCntxtEventObsArray::CollectEventFilterLC()
+    {
+    RPointerArray < CXIMPContextEventFilter > tempArray;
+    CleanupClosePushL( tempArray );
+    for (TInt ii( 0 ); ii < iObservers.Count(); ii++ )
+        {
+        const CXIMPContextEventFilter* tempFilter = &(iObservers[ii]->EventFilter());
+        tempArray.AppendL( tempFilter );
+        }
+    TArray <CXIMPContextEventFilter* > daArray = tempArray.Array();
+    CXIMPContextEventFilter* retFilter = CXIMPContextEventFilter::NewCombinedLC( daArray );
+    CleanupStack::Pop(); // retFilter
+    CleanupStack::PopAndDestroy(); // tempArray
+    CleanupStack::PushL( retFilter );
+    return retFilter;
+    }
+
+
+// ---------------------------------------------------------------------------
+// DeliverEventToObserver()
+// ---------------------------------------------------------------------------
+//
+void DeliverEventToObserver( MXIMPContextObserver& aObsrver,
+              const MXIMPContext& aCntxtInterface,
+              const MXIMPBase& aEvent )
+    {
+    aObsrver.HandlePresenceContextEvent( aCntxtInterface, aEvent );
+    }
+
+
+
+// ---------------------------------------------------------------------------
+// CXIMPCntxtEventObsArray::DeliverEvent()
+// ---------------------------------------------------------------------------
+//
+void CXIMPCntxtEventObsArray::DeliverEvent(
+    MXIMPContext& aCntxtInterface,
+    MXIMPBase& aEvent )
+    {
+    TInt32 eventType = aEvent.GetInterfaceId();
+
+    const TInt entryCount = iObservers.Count();
+    for( TInt ix = 0; ix < entryCount; ix++ )
+        {
+        CObsEntry* obsEntry = iObservers[ ix ];
+        if( obsEntry->EventFilter().IsEventAccepted( eventType ) )
+            {
+            MXIMPContextObserver& obs = obsEntry->Observer();
+            __ASSERT_ALWAYS_NO_LEAVE( DeliverEventToObserver( obs,
+                                                              aCntxtInterface,
+                                                              aEvent ) );
+            }
+        }
+    }
+
+
+
+// ---------------------------------------------------------------------------
+// CXIMPCntxtEventObsArray::HasObservers()
+// ---------------------------------------------------------------------------
+//
+TBool CXIMPCntxtEventObsArray::HasObservers() const
+    {
+    return ( iObservers.Count() > 0 );
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPCntxtEventObsArray::IsReqistered()
+// ---------------------------------------------------------------------------
+//
+TBool CXIMPCntxtEventObsArray::IsReqistered(
+    MXIMPContextObserver& aObserver ) const
+    {
+    return ( FindEntryPosition( aObserver ) != KErrNotFound );
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPCntxtEventObsArray::FindEntryPosition()
+// ---------------------------------------------------------------------------
+//
+TInt CXIMPCntxtEventObsArray::FindEntryPosition(
+    MXIMPContextObserver& aObserver ) const
+    {
+    const TInt entryCount = iObservers.Count();
+    for( TInt ix = 0; ix < entryCount; ix++ )
+        {
+        CObsEntry* observerEntry = iObservers[ ix ];
+        if( &observerEntry->Observer() == &aObserver )
+            {
+            return ix;
+            }
+        }
+
+    return KErrNotFound;
+    }
+
+
+
+
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/core/srcfrontend/srcmanager/ximpcntxteventobsarray.h	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  Presence context observer array.
+*
+*/
+
+#ifndef XIMPPRESCNTXTEVENTOBSARRAY_H
+#define XIMPPRESCNTXTEVENTOBSARRAY_H
+
+#include <e32base.h>
+
+class MXIMPContextObserver;
+class MXIMPContext;
+class RXIMPSrvContextClient;
+class CXIMPContextEventFilter;
+class MXIMPUndoTask;
+class MXIMPBase;
+
+
+/**
+ * Presence context observer array.
+ *
+ * @lib ximpmanager.dll
+ * @since S60 v3.2
+ */
+NONSHARABLE_CLASS( CXIMPCntxtEventObsArray )
+    : public CBase
+    {
+    /** Private nested helper classes */
+    class CObsEntry;
+
+
+public:
+
+    static CXIMPCntxtEventObsArray* NewL();
+    virtual ~CXIMPCntxtEventObsArray();
+
+private:
+
+    CXIMPCntxtEventObsArray();
+
+
+public:
+
+    /**
+     * Adds new observer to observer list.
+     *
+     * @param aObserver Client side observer to add.
+     * @param aEventFilter Event filter for observer. Can be NULL.
+     *
+     * @return Undo object. When undo is activated, removes 
+     *         just added observer from observers list. 
+     */
+    MXIMPUndoTask* AddObserverLC( MXIMPContextObserver& aObserver,
+                                  const TArray< TInt32 >* aEventFilter );
+
+
+    /**
+     * Updates observer event filter.
+     *
+     * @param aObserver Client side observer which filter to update. 
+     * @param aEventFilter New event filter for observer. Can be NULL.
+     *
+     * @return Undo object. When undo is activated, takes old 
+     *         event filter in to use for observer. 
+     */
+    MXIMPUndoTask* UpdateObserverLC( MXIMPContextObserver& aObserver,
+                                     const TArray< TInt32 >* aEventFilter );
+
+
+    /**
+     * Removes given observer from observers list.
+     *
+     * @param aObserver Client side observer to remove. 
+     */
+    void RemoveObserver( MXIMPContextObserver& aObserver );
+
+
+    /**
+     * Collects event filter from currently registered 
+     * observers.
+     *
+     * @return Collected event filter instance.
+     */
+    CXIMPContextEventFilter* CollectEventFilterLC();
+
+
+    /**
+     * Delivers given event to registered observers.
+     *
+     * @param aCntxtInterface Source context interface for event.
+     * @param aEvent The event object to deliver.
+     */
+    void DeliverEvent( MXIMPContext& aCntxtInterface,
+                       MXIMPBase& aEvent );
+
+    /**
+     * Checks is there observers registered.
+     * @return ETrue if there is observer registered. Else EFalse. 
+     */
+    TBool HasObservers() const;
+
+
+    /**
+     * Checks is the given observer registered or not.
+     *
+     * @param aObserver Observer to check.
+     * @return ETrue if observer is registered. Else EFalse.
+     */
+    TBool IsReqistered( MXIMPContextObserver& aObserver ) const;
+
+
+
+private:
+
+    TInt FindEntryPosition( MXIMPContextObserver& aObserver ) const;
+
+
+private: // data
+
+    /**
+     * The observers.
+     * Own.
+     */
+    RPointerArray< CObsEntry > iObservers;
+    };
+
+
+
+#endif // XIMPPRESCNTXTEVENTOBSARRAY_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/core/srcfrontend/srcmanager/ximpcontextclientproxy.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,332 @@
+/*
+* 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:  Proxy class to manage context client session.
+ *
+*/
+
+
+#include "ximpcontextclientproxy.h"
+#include "ximppanics.h"
+
+
+const TInt KXIMPWaitListGranurality = 10;
+
+// ============================ MEMBER FUNCTIONS =============================
+
+// ---------------------------------------------------------------------------
+// CXIMPContextClientProxy::CXIMPContextClientProxy()
+// ---------------------------------------------------------------------------
+//
+CXIMPContextClientProxy::CXIMPContextClientProxy()
+    : iCtxConnectionState( ENotConnected ),
+      iReqWaitList( KXIMPWaitListGranurality )
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPContextClientProxy::~CXIMPContextClientProxy()
+// ---------------------------------------------------------------------------
+//
+CXIMPContextClientProxy::~CXIMPContextClientProxy()
+    {
+    iReqWaitList.Reset();
+    Close();
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPContextClientProxy::InitServerSessionLC()
+// ---------------------------------------------------------------------------
+//
+void CXIMPContextClientProxy::InitServerSessionLC( TUid aProtocolUid )
+    {
+    __ASSERT_ALWAYS( iCtxConnectionState == ENotConnected, 
+                     User::Leave( KErrAlreadyExists ) );
+    
+    iCtxConnection.ConnectL( aProtocolUid );
+    iCtxConnectionState = EInTransition;
+    CleanupClosePushL( *this );
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPContextClientProxy::QueueAsyncConnectionOpenL()
+// ---------------------------------------------------------------------------
+//
+TXIMPRequestId CXIMPContextClientProxy::QueueAsyncConnectionOpenL(
+    TInt aOperationType, 
+    const TDesC8& aOperationParams )
+    {
+    //Async open requests are accepted only when client context is 
+    //transition state
+    __ASSERT_ALWAYS( iCtxConnectionState == EInTransition, 
+                     User::Leave( KErrNotReady ) );
+                     
+    return DoQueueAsyncOpL( aOperationType, aOperationParams, EXIMPAsyncOpenReq );
+    }
+
+// ---------------------------------------------------------------------------
+// CXIMPContextClientProxy::QueueAsyncConnectionOpen2L()
+// ---------------------------------------------------------------------------
+//
+TXIMPRequestId CXIMPContextClientProxy::QueueAsyncConnectionOpen2L(
+    TInt aOperationType, 
+    const TDesC8& aOperationParams )
+    {
+    //Async open requests are accepted only when client context is 
+    //transition state
+    __ASSERT_ALWAYS( iCtxConnectionState == EInTransition, 
+                     User::Leave( KErrNotReady ) );
+
+    return DoQueueAsyncOp2L( aOperationType, aOperationParams, EXIMPAsyncOpenReq );
+    }
+
+// ---------------------------------------------------------------------------
+// CXIMPContextClientProxy::QueueAsyncConnectionCloseL()
+// ---------------------------------------------------------------------------
+//
+TXIMPRequestId CXIMPContextClientProxy::QueueAsyncConnectionCloseL(
+    TInt aOperationType, 
+    const TDesC8& aOperationParams )
+    {
+    //Async close requests are accepted when client context is 
+    //fully binded or in transition state
+    __ASSERT_ALWAYS( ( iCtxConnectionState == EConnected ) ||
+                     ( iCtxConnectionState == EInTransition ), 
+                     User::Leave( KErrNotReady ) );
+                     
+    return DoQueueAsyncOpL( aOperationType, aOperationParams, EXIMPAsyncCloseReq );
+    }
+    
+
+
+// ---------------------------------------------------------------------------
+// CXIMPContextClientProxy::QueueOperationL()
+// ---------------------------------------------------------------------------
+//
+TXIMPRequestId CXIMPContextClientProxy::QueueOperationL(
+    TInt aOperationType, 
+    const TDesC8& aOperationParams )
+    {
+    //New operation requests are accepted only when client context is 
+    //fully binded
+    __ASSERT_ALWAYS( iCtxConnectionState == EConnected, 
+                     User::Leave( KErrNotReady ) );
+
+    return DoQueueAsyncOpL( aOperationType, aOperationParams, EXIMPAsyncGeneralReq );
+    }
+
+
+
+// ---------------------------------------------------------------------------
+// CXIMPContextClientProxy::DirectSessionL()
+// ---------------------------------------------------------------------------
+//
+const RXIMPSrvContextClient& CXIMPContextClientProxy::DirectSessionL() const 
+    {
+    //Other direct requests are accepted only when client context is fully binded 
+
+    __ASSERT_ALWAYS( iCtxConnectionState == EConnected, 
+                     User::Leave( KErrNotReady ) );
+    return iCtxConnection;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPContextClientProxy::EventPumpSessionL()
+// ---------------------------------------------------------------------------
+//
+RXIMPSrvContextClient& CXIMPContextClientProxy::EventPumpSessionL()
+    {
+    //Event pump requests are accepted when client context is either fully binded 
+    //or in transition state
+    __ASSERT_ALWAYS( iCtxConnectionState != ENotConnected, 
+                     User::Leave( KErrNotReady ) );
+
+    return iCtxConnection;
+    }
+
+    
+
+// ---------------------------------------------------------------------------
+// CXIMPContextClientProxy::EventPumpSession()
+// ---------------------------------------------------------------------------
+//
+RXIMPSrvContextClient* CXIMPContextClientProxy::EventPumpSession()
+    {
+    //Event pump requests are accepted when client context is either fully binded 
+    //or in transition state
+
+    if( iCtxConnectionState != ENotConnected )
+        {
+        return &iCtxConnection;    
+        }
+    else
+        {
+        return NULL;
+        }        
+    }
+
+    
+    
+// ---------------------------------------------------------------------------
+// CXIMPContextClientProxy::Close()
+// ---------------------------------------------------------------------------
+//
+void CXIMPContextClientProxy::Close()
+    {
+    iCtxConnection.Close();
+    iCtxConnectionState = ENotConnected;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPContextClientProxy::DoQueueAsyncOpL()
+// ---------------------------------------------------------------------------
+//
+TXIMPRequestId CXIMPContextClientProxy::DoQueueAsyncOpL(
+    TInt aOperationType, 
+    const TDesC8& aOperationParams,
+    TXIMPAsyncReqType aReqType )
+    {
+    iReqWaitList.ExtendL();
+    TXIMPRequestId regId;
+
+    TInt err = iCtxConnection.DoQueueOperation( aOperationType, 
+                                                aOperationParams, 
+                                                regId );
+                                            
+    if( err == KErrNone )                                            
+        {
+        TXIMPAsyncReqEntry reqEntry;
+        reqEntry.iReqId = regId;
+        reqEntry.iReqType = aReqType;
+        
+        iReqWaitList[ iReqWaitList.Count() - 1 ] = reqEntry;        
+        }
+    else        
+        {
+        iReqWaitList.Delete( iReqWaitList.Count() - 1 );
+        User::Leave( err );
+        }
+    
+    return regId;
+    }
+
+// ---------------------------------------------------------------------------
+// CXIMPContextClientProxy::DoQueueAsyncOp2L()
+// ---------------------------------------------------------------------------
+//
+TXIMPRequestId CXIMPContextClientProxy::DoQueueAsyncOp2L(
+    TInt aOperationType, 
+    const TDesC8& aOperationParams,
+    TXIMPAsyncReqType aReqType )
+    {
+    iReqWaitList.ExtendL();
+    TXIMPRequestId regId;
+
+    TInt err = iCtxConnection.DoQueueOperation2( aOperationType, 
+                                                aOperationParams, 
+                                                regId );
+                                            
+    if( err == KErrNone )                                            
+        {
+        TXIMPAsyncReqEntry reqEntry;
+        reqEntry.iReqId = regId;
+        reqEntry.iReqType = aReqType;
+        
+        iReqWaitList[ iReqWaitList.Count() - 1 ] = reqEntry;        
+        }
+    else        
+        {
+        iReqWaitList.Delete( iReqWaitList.Count() - 1 );
+        User::Leave( err );
+        }
+    
+    return regId;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPContextClientProxy::HandleReqCompleted()
+// ---------------------------------------------------------------------------
+//
+void CXIMPContextClientProxy::HandleReqCompleted( TXIMPRequestId aReqId,
+                                                  TInt aCompletionCode )
+    {
+    const TInt count = iReqWaitList.Count();                                                                        
+    for( TInt ix = 0; ix < count; ix++ )                                                                
+        {
+        TXIMPAsyncReqEntry entry = iReqWaitList[ ix ];
+        if( entry.iReqId == aReqId )
+            {
+            iReqWaitList.Delete( ix );
+            UpdateCtxConnectionStatus( entry.iReqType, aCompletionCode );
+            return;
+            }
+        }
+        
+    NXIMPPrivPanic::Panic( NXIMPPrivPanic::EMatchingClientSideReqNotFound );
+    }
+    
+    
+// ---------------------------------------------------------------------------
+// CXIMPContextClientProxy::GetTopPendingReq()
+// ---------------------------------------------------------------------------
+//
+TBool CXIMPContextClientProxy::GetTopPendingReq( TXIMPRequestId& aReqId ) const
+    {
+    if( iReqWaitList.Count() > 0 )
+        {
+        aReqId = iReqWaitList[ 0 ].iReqId;
+        return ETrue;
+        }
+
+    aReqId = TXIMPRequestId::Null();
+    return EFalse;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPContextClientProxy::UpdateCtxConnectionStatus()
+// ---------------------------------------------------------------------------
+//
+void CXIMPContextClientProxy::UpdateCtxConnectionStatus( 
+    TXIMPAsyncReqType aReqType, 
+    TInt aCompletionCode )
+    {
+    if( aReqType == EXIMPAsyncOpenReq )  
+        {
+        if( aCompletionCode == KErrNone )
+            {
+            iCtxConnectionState = EConnected;            
+            }
+        else
+            {
+            Close();  
+            }
+        }
+        
+        
+    if( aReqType == EXIMPAsyncCloseReq )
+        {
+        Close();  
+        }
+    }
+
+
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/core/srcfrontend/srcmanager/ximpcontextclientproxy.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,239 @@
+/*
+* 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:  Proxy class to manage context client session.
+*
+*/
+
+#ifndef CXIMPCONTEXTCLIENTPROXY_H
+#define CXIMPCONTEXTCLIENTPROXY_H
+
+
+#include "ximpsrvcontextclient.h"
+#include <e32base.h>
+
+
+
+/**
+ * Type of the request.
+ */
+enum TXIMPAsyncReqType
+    { 
+    EXIMPAsyncOpenReq, 
+    EXIMPAsyncCloseReq, 
+    EXIMPAsyncGeneralReq 
+    };
+
+
+/**
+ * Request entry structure for client side request wait list.
+ */
+NONSHARABLE_CLASS( TXIMPAsyncReqEntry )
+    {
+public:
+    
+    /**
+     * Id of the request.
+     * Own.
+     */
+    TXIMPRequestId  iReqId;
+
+    /**
+     * Type of request.
+     * Own.
+     */
+    TXIMPAsyncReqType  iReqType;
+    };
+
+
+
+/**
+ * Proxy class to manage context client session.
+ *
+ * @lib ximpmanager.dll
+ * @since S60 v3.2
+ */
+NONSHARABLE_CLASS( CXIMPContextClientProxy ): public CBase
+    {
+public:
+    CXIMPContextClientProxy();
+    ~CXIMPContextClientProxy();
+
+
+public: // New methods
+
+    /**
+     * Opens context client session to 
+     * server handling the given protocol.
+     *
+     * Handles errors by leaving. Pushes 
+     * close to cleanupstack to close 
+     * automaticly the session in 
+     * case of leave. 
+     * 
+     * @param aProtocolUid Protocol implementation uid. 
+     */
+    void InitServerSessionLC( TUid aProtocolUid );
+
+
+
+    /**
+     * Issues context connection open request to server.
+     *
+     * @param aOperationType In parameter identifying the operation.
+     * @param aOperationParams In parameter package for operation.
+     * @return Request ID identifying started request.
+     */
+    TXIMPRequestId QueueAsyncConnectionOpenL(
+                TInt aOperationType, 
+                const TDesC8& aOperationParams );
+
+     /**
+     * Issues context connection open request to server.
+     * To be used when binding with settings is
+     *
+     * @param aOperationType In parameter identifying the operation.
+     * @param aOperationParams In parameter package for operation.
+     * @return Request ID identifying started request.
+     */
+    TXIMPRequestId QueueAsyncConnectionOpen2L(
+                TInt aOperationType, 
+                const TDesC8& aOperationParams );
+
+
+    /**
+     * Issues context connection close request to server.
+     *
+     * @param aOperationType In parameter identifying the operation.
+     * @param aOperationParams In parameter package for operation.
+     * @return Request ID identifying started request.
+     */
+    TXIMPRequestId QueueAsyncConnectionCloseL(
+                TInt aOperationType, 
+                const TDesC8& aOperationParams );
+
+
+
+    /**
+     * Issues context operation request to server.
+     *
+     * @param aOperationType In parameter identifying the operation.
+     * @param aOperationParams In parameter package for operation.
+     * @return Request ID identifying started request.
+     */
+    TXIMPRequestId QueueOperationL(
+                TInt aOperationType, 
+                const TDesC8& aOperationParams );
+
+    /**
+     * Gets RXIMPSrvContextClient session. 
+     * If there isn't a valid session, handles 
+     * error by leaving. 
+     * 
+     * @return Valid RXIMPSrvContextClient session.
+     */
+    RXIMPSrvContextClient& EventPumpSessionL();
+
+
+    /**
+     * Gets RXIMPSrvContextClient session. 
+     * If there isn't a valid session, returns NULL. 
+     * 
+     * @return Valid RXIMPSrvContextClient session.
+     */
+    RXIMPSrvContextClient* EventPumpSession();
+
+    
+    
+    /**
+     * Gets RXIMPSrvContextClient session. 
+     * If there isn't a valid session, handles 
+     * error by leaving. 
+     * 
+     * @return Valid RXIMPSrvContextClient session.
+     */
+    const RXIMPSrvContextClient& DirectSessionL() const;
+    
+        
+    
+    /**
+     * Closes RXIMPSrvContextClient session.
+     */
+    void Close();
+
+    
+    /**
+     * Removes identified request from wait list and 
+     * updates properly the proxy server connection 
+     * status based on the given request completion code.
+     *
+     * @param aReqId Request id to drop from wait list.
+     * @param aCompletionCode Completion code indicating 
+     *        how request was completed.
+     */
+    void HandleReqCompleted( TXIMPRequestId aReqId, TInt aCompletionCode );
+
+
+    /**
+     * Gets topmost request ID from wait list. 
+     *
+     * @param aReqId On the return contains topmost req id from wait list.
+     * @return ETrue if the wait list contained elements. 
+     *         EFalse if the wait list was empty. 
+     */
+    TBool GetTopPendingReq( TXIMPRequestId& aReqId ) const;
+    
+
+
+private: // Helpers
+
+    TXIMPRequestId DoQueueAsyncOpL( TInt aOperationType, 
+                                    const TDesC8& aOperationParams,
+                                    TXIMPAsyncReqType aReqType );
+
+                                    
+    TXIMPRequestId DoQueueAsyncOp2L( TInt aOperationType, 
+                                     const TDesC8& aOperationParams,
+                                     TXIMPAsyncReqType aReqType );
+                                    
+
+    void UpdateCtxConnectionStatus( TXIMPAsyncReqType aReqType, 
+                                    TInt aCompletionCode );
+
+
+private: // data
+
+    /**
+     * Managed context session to server.
+     * Own.
+     */
+    RXIMPSrvContextClient iCtxConnection;
+
+
+    /**
+     * Flag to maintain session status.
+     * Own.
+     */
+    enum TCtxConnectionState { ENotConnected, EInTransition, EConnected };     
+    TCtxConnectionState iCtxConnectionState;
+    
+    /**
+     * Array to maintain pending clientside requests.
+     * Own.
+     */
+    CArrayFixSeg< TXIMPAsyncReqEntry > iReqWaitList;
+
+    };
+
+
+#endif // CXIMPCONTEXTCLIENTPROXY_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/core/srcfrontend/srcmanager/ximpcontexteventpump.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,416 @@
+/*
+* 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:  Presence context event pump.
+*
+*/
+
+#include "ximpcontexteventpump.h"
+#include "ximpcntxteventobsarray.h"
+#include "ximpundotask.h"
+
+#include "ximpcontexteventfilter.h"
+#include "ximpsrvcontextclient.h"
+#include "ximpapieventbase.h"
+#include "ximpeventcodec.h"
+#include "ximpcontextclientproxy.h"
+#include "ximpobjecthelpers.h"
+#include "ximppanics.h"
+#include "ximprequestcompleteeventimp.h"
+#include "ximpstatusimp.h"
+#include "ximpcontextstateeventimp.h"
+#include "ximpcontextstateimp.h"
+
+#include "ximpfeaturepluginholder.h"
+#include "apidataobjfactoryaccessor.h"
+#include "eventcodec.h"
+
+
+#include <ximpcontextobserver.h>
+#include <ximprequestcompleteevent.h>
+
+
+// ============================ MEMBER FUNCTIONS =============================
+
+// ---------------------------------------------------------------------------
+// CXIMPContextEventPump::NewL()
+// Instantiate new event pump.
+// ---------------------------------------------------------------------------
+//
+CXIMPContextEventPump* CXIMPContextEventPump::NewL(
+    MXIMPContext& aCntxtInterface,
+    CXIMPContextClientProxy& aContextProxy )
+    {
+    CXIMPContextEventPump* self;
+    self = new( ELeave ) CXIMPContextEventPump( aCntxtInterface,
+                                                aContextProxy );
+
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+
+    return self;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPContextEventPump::~CXIMPContextEventPump()
+// Destroy the event pump.
+// Cancels possibly pending asynhronous requests.
+// ---------------------------------------------------------------------------
+//
+CXIMPContextEventPump::~CXIMPContextEventPump()
+    {
+    Cancel();
+    delete iObservers;
+    delete iSpareReqCompleteEvent;
+    delete iSpareCtxStateEvent;
+    
+    FeaturePluginHolder::Release();
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPContextEventPump::CXIMPContextEventPump()
+// ---------------------------------------------------------------------------
+//
+CXIMPContextEventPump::CXIMPContextEventPump(
+    MXIMPContext& aCntxtInterface,
+    CXIMPContextClientProxy& aContextProxy )
+    : CActive(CActive::EPriorityStandard),
+      iCntxtInterface( aCntxtInterface ),
+      iCtxClientProxy( &aContextProxy )
+    {
+    CActiveScheduler::Add( this );
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPContextEventPump::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void CXIMPContextEventPump::ConstructL()
+    {
+    iObservers = CXIMPCntxtEventObsArray::NewL();
+
+
+    iSpareReqCompleteEvent = CXIMPRequestCompleteEventImp::NewL();
+    iSpareReqCompleteEvent->CompletionResultImp().SetProtocolResultDescriptionL( KNullDesC );
+    iSpareReqCompleteEvent->CompletionResultImp().SetProtocolResultCode( KErrNone );
+
+    
+    iSpareCtxStateEvent = CXIMPContextStateEventImp::NewL();
+    
+    CXIMPStatusImp* status = CXIMPStatusImp::NewLC();
+    status->SetProtocolResultDescriptionL( KNullDesC );
+    status->SetProtocolResultCode( KErrNone );
+    
+    iSpareCtxStateEvent->SetStateChangeReasonImp( status );
+    CleanupStack::Pop( status );
+    
+    // Initialize the datamodel's feature plugin holder.
+    // That stores the different internal IF accessor as global data 
+    FeaturePluginHolder::InitializeL();    
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPContextEventPump::RegisterObserverL()
+// Reqisters new event observer.
+// ---------------------------------------------------------------------------
+//
+void CXIMPContextEventPump::RegisterObserverL(
+    MXIMPContextObserver& aObserver,
+    const TArray< TInt32 >* aEventFilter )
+    {
+    MXIMPUndoTask* undo = NULL;
+
+    if( iObservers->IsReqistered( aObserver ) )
+        {
+        //Update existing observer with new filter. UpdateObserverLC()
+        //returns undoTask object that will undo the observer update
+        //if there happens a leave before undo->CancelUndo() call.
+        undo = iObservers->UpdateObserverLC( aObserver, aEventFilter );
+        }
+    else
+        {
+        //Add new event observer. AddObserverLC() returns undoTask object
+        //that will undo the adding of new entry if there happens a leave before
+        //undo->CancelUndo() call.
+        undo = iObservers->AddObserverLC( aObserver, aEventFilter );
+        }
+
+    //Collect event filter from observers
+    CXIMPContextEventFilter* filter = iObservers->CollectEventFilterLC();
+
+
+    //Update the event filter to the server side.
+    //Update is done everytime when observer is registered
+    //since filter isn't updated when observer is removed
+    TryInstallEventFilterL( *filter );
+
+    //Issue event request to server side
+    TryRefreshEventRequest();
+
+    CleanupStack::PopAndDestroy( filter );
+
+    undo->CancelUndo();
+    CleanupStack::PopAndDestroy(); //undo
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPContextEventPump::UnRegisterObserver()
+// Unreqisters event observer.
+// ---------------------------------------------------------------------------
+//
+void CXIMPContextEventPump::UnRegisterObserver(
+    MXIMPContextObserver& aObserver )
+    {
+    //To simplify logic, event types are not unregistered here
+    //but on the next time when the new observer is registered
+    //and cobined event filer is rebuild
+    iObservers->RemoveObserver( aObserver );
+
+    if( iObservers->HasObservers() )
+        {
+        Cancel();
+        }
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPContextEventPump::StartEventPumpLC()
+// ---------------------------------------------------------------------------
+//
+void CXIMPContextEventPump::StartEventPumpLC()
+    {
+    CleanupClosePushL( *this );
+
+    CXIMPContextEventFilter* filter = iObservers->CollectEventFilterLC();
+    TryInstallEventFilterL( *filter );
+    CleanupStack::PopAndDestroy( filter );
+
+    TryRefreshEventRequest();
+    }
+
+
+
+// ---------------------------------------------------------------------------
+// CXIMPContextEventPump::Close()
+// ---------------------------------------------------------------------------
+//
+void CXIMPContextEventPump::Close()
+    {
+    Cancel();
+    }
+
+
+
+// -----------------------------------------------------------------------------
+// CXIMPContextEventPump::RunL()
+//
+// Handles one and only one event from XIMP server side event queue.
+// (Only one event is handled in one EventPump RunL() round.)
+// Steps:
+// 1. Retrieve event data from server to client side
+// 2. Convert event data to concrete event object
+// 3. Delete the event data from server side 
+// 4. Dispatch event to observers
+// 5. Request new event notification (Request must be issued after event
+//    dispatch, because concrete observer may start nested active scheduler
+//    loop, and it could cause re-entrance to EventPump::RunL())
+// -----------------------------------------------------------------------------
+//
+void CXIMPContextEventPump::RunL()
+    {
+    TInt status ( iStatus.Int() );
+    User::LeaveIfError( status );
+
+
+    HBufC8* eventData = iCtxClientProxy->EventPumpSessionL().FetchTopEventDataLC();
+    TInt32 typeOfEvent;
+    CXIMPApiEventBase* eventObject = XIMPEventCodec::UnPackL( *eventData,
+                                                              typeOfEvent );
+
+    MApiDataObjFactoryAccessor* presenceObjFactoryAcc = FeaturePluginHolder::PresenceObjFactoryAccessor();
+    if ( !eventObject && presenceObjFactoryAcc )
+        {
+        // Try to create presence event
+        eventObject = presenceObjFactoryAcc->EventCodec().UnPackL( *eventData,
+                                                                 typeOfEvent );
+        }
+
+    if ( !eventObject )
+        {
+        TInt accesorCount = FeaturePluginHolder::AccessorCount() ;
+        for (TInt i=0; i<accesorCount; i++)
+	        {
+        	MApiDataObjFactoryAccessor* pFactoryAcc = FeaturePluginHolder::Accessor(i) ;
+        	if(pFactoryAcc)
+	        	{
+	        	eventObject = pFactoryAcc->EventCodec().UnPackL( *eventData, 
+	        														   typeOfEvent );
+	        	if(eventObject)
+	    	    	{
+	        		break ;
+	        		}
+	        	}
+        	}
+        }
+        
+        
+
+    // Check whether have received an unknown event
+    __ASSERT_ALWAYS( eventObject,
+                    User::Panic( _L("XIMPContextEventPump"), KErrUnknown ) );
+                        
+    CleanupStack::PopAndDestroy(); //eventData
+    CleanupStack::PushL( eventObject );
+    
+    User::LeaveIfError( iCtxClientProxy->EventPumpSessionL().DropTopEvent() );
+    if( eventObject->Base().GetInterfaceId() == MXIMPRequestCompleteEvent::KInterfaceId )
+        {
+        const MXIMPRequestCompleteEvent* complEvent =
+            TXIMPGetInterface< const MXIMPRequestCompleteEvent >::From( eventObject->Base(),
+                                                                        MXIMPBase::EPanicIfUnknown );
+        
+        iCtxClientProxy->HandleReqCompleted( complEvent->RequestId(), 
+                                             complEvent->CompletionResult().ResultCode() );
+        }
+
+    iObservers->DeliverEvent( iCntxtInterface, eventObject->Base() );
+    CleanupStack::PopAndDestroy( eventObject );
+
+    TryRefreshEventRequest();
+    }
+
+
+// -----------------------------------------------------------------------------
+// CXIMPContextEventPump::RunError()
+//
+// Handle leave from CXIMPContextEventPump::RunL()
+// by restarting the event request.
+// -----------------------------------------------------------------------------
+//
+TInt CXIMPContextEventPump::RunError( TInt aError )
+    {
+    if( aError == KErrServerTerminated )
+        {
+        //Server has died.
+        //Complete all pending client requests with KErrServerTerminated
+        //and unbind the client context. 
+
+        //Note: This should be perhaps splitted to asynhronous steps 
+        //to follow general paradigm of XIMP observer callbacks. 
+        //Also Ctx state events should be properly indicated to client
+        //(Now they are notified after possible Bind() completion notification)
+        
+        TXIMPRequestId reqId;
+        while( iCtxClientProxy->GetTopPendingReq( reqId ) )
+            {
+            iSpareReqCompleteEvent->SetRequestId( reqId );
+            iSpareReqCompleteEvent->CompletionResultImp().SetResultCode( aError );
+            
+            iObservers->DeliverEvent( iCntxtInterface, *iSpareReqCompleteEvent );
+
+            iCtxClientProxy->HandleReqCompleted( iSpareReqCompleteEvent->RequestId(), 
+                                                 iSpareReqCompleteEvent->CompletionResult().ResultCode() );
+            }
+
+        iSpareCtxStateEvent->StateChangeReasonImp()->SetResultCode( aError );
+        iSpareCtxStateEvent->ContextStateImp().SetStateValue( MXIMPContextState::EInactive );
+        iObservers->DeliverEvent( iCntxtInterface, *iSpareCtxStateEvent );
+        }
+
+    else
+        {
+        //If it was a RequestComplete event, which handling failed here 
+        //on the client side, here is manufactured artificially matching 
+        //completion event to notify failure to client
+
+        __ASSERT_ALWAYS( iCtxClientProxy->EventPumpSession(),
+                         User::Panic( NXIMPPrivPanic::KCategory,
+                                      NXIMPPrivPanic::EFrontEndEventPumpNoServerClient ) );
+
+        
+        TXIMPRequestId reqId = TXIMPRequestId::Null(); 
+
+        iCtxClientProxy->EventPumpSession()->FetchTopEventReqId( reqId );
+        iCtxClientProxy->EventPumpSession()->DropTopEvent();
+        
+        if( reqId != TXIMPRequestId::Null() )
+            {
+            iSpareReqCompleteEvent->SetRequestId( reqId );
+            iSpareReqCompleteEvent->CompletionResultImp().SetResultCode( aError );
+            
+            iObservers->DeliverEvent( iCntxtInterface, *iSpareReqCompleteEvent );
+
+            iCtxClientProxy->HandleReqCompleted( iSpareReqCompleteEvent->RequestId(), 
+                                                 iSpareReqCompleteEvent->CompletionResult().ResultCode() );
+            }
+
+        TryRefreshEventRequest();
+        }
+
+    return KErrNone;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CXIMPContextEventPump::DoCancel()
+// -----------------------------------------------------------------------------
+//
+void CXIMPContextEventPump::DoCancel()
+    {
+    __ASSERT_ALWAYS( iCtxClientProxy->EventPumpSession(),
+                     User::Panic( NXIMPPrivPanic::KCategory,
+                                  NXIMPPrivPanic::EFrontEndEventPumpNoServerClient ) );
+
+    //Eventpump is stopping.
+    //Cancel pending event notification request
+    iCtxClientProxy->EventPumpSession()->CancelListening();
+    }
+
+
+// -----------------------------------------------------------------------------
+// CXIMPContextEventPump::TryRefreshEventRequest()
+// -----------------------------------------------------------------------------
+//
+void CXIMPContextEventPump::TryRefreshEventRequest()
+    {
+    if( !IsActive() && 
+        iObservers->HasObservers() && 
+        iCtxClientProxy->EventPumpSession() )
+        {
+        iCtxClientProxy->EventPumpSession()->ListenEvent( iStatus );
+        SetActive();
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CXIMPContextEventPump::TryInstallEventFilterL()
+// -----------------------------------------------------------------------------
+//
+void CXIMPContextEventPump::TryInstallEventFilterL(
+    const CXIMPContextEventFilter& aFilter )
+    {
+    if( iCtxClientProxy->EventPumpSession() )
+        {
+        HBufC8* pack = TXIMPObjectPacker<CXIMPContextEventFilter>::PackL( aFilter );
+        CleanupStack::PushL( pack );
+        iCtxClientProxy->EventPumpSession()->InstallEventFilterL( *pack );
+        CleanupStack::PopAndDestroy( pack );
+        }
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/core/srcfrontend/srcmanager/ximpcontexteventpump.h	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  Presence context event pump.
+*
+*/
+
+#ifndef CXIMPPRESENCECONTEXTEVENTPUMP_H
+#define CXIMPPRESENCECONTEXTEVENTPUMP_H
+
+#include "ximpcontexteventpump.h"
+#include <e32base.h>
+
+
+class MXIMPContext;
+class MXIMPContextObserver;
+class CXIMPContextClientProxy;
+class CXIMPCntxtEventObsArray;
+class CXIMPContextEventFilter;
+class CXIMPRequestCompleteEventImp;
+class CXIMPContextStateEventImp;
+class MApiDataObjFactoryAccessor;
+
+/**
+ * Presence context event pump.
+ *
+ * @lib ximpmanager.dll
+ * @since S60 v3.2
+ */
+NONSHARABLE_CLASS( CXIMPContextEventPump )
+    : public CActive
+    {
+public:
+
+
+    static CXIMPContextEventPump* NewL( MXIMPContext& aCntxtInterface,
+                                                CXIMPContextClientProxy& aContextProxy );
+    virtual ~CXIMPContextEventPump();
+
+private:
+
+    CXIMPContextEventPump( MXIMPContext& aCntxtInterface,
+                                   CXIMPContextClientProxy& aContextProxy );
+    void ConstructL();
+
+
+
+
+public:
+
+
+    /**
+     * Registers observer with event type filter. 
+     *
+     * Combines event type filter from so far 
+     * registered observers and installs filter 
+     * to server if there exists a valid server connection.  
+     * 
+     * @param aObserver The observer to notify from presence events.
+     * @param aEventFilter Event filter array for limiting accepted events.
+     */
+    void RegisterObserverL( MXIMPContextObserver& aObserver,
+                            const TArray< TInt32 >* aEventFilter );
+
+    /**
+     * Unregisters observer. 
+     * 
+     * @param aObserver The observer to unregister.
+     */
+    void UnRegisterObserver( MXIMPContextObserver& aObserver );
+
+
+    /**
+     * Combines event type filter from so far registered 
+     * observers and installs filter to server. 
+     */
+    void StartEventPumpLC();
+    
+    
+    /**
+     * Stops event pump from pumping events.
+     */
+    void Close();
+
+
+
+public:     // From CActive
+
+    /**
+     * Handles an active object’s request completion event.
+     * Gets event data from server side and notifies observers.
+     */
+    void RunL();
+    
+
+    /**
+     * Handles a leave occurring in the RunL().
+     *
+     * @param aError The leave code from RunL().
+     * @return Always KErrNone.
+     */
+    TInt RunError( TInt aError );
+
+
+    /**
+     * Implements cancellation of an outstanding request.
+     * This function is called as part of the active object’s Cancel().
+     */
+    void DoCancel();
+
+
+private:
+
+    void TryRefreshEventRequest();
+    void TryInstallEventFilterL( const CXIMPContextEventFilter& aFilter );
+
+
+
+private: // data
+
+
+
+    /**
+     * Client interface for event notify.
+     * Not own.
+     */
+    MXIMPContext& iCntxtInterface;
+
+
+    /**
+     * Context client for getting events. 
+     * Not own.
+     */
+    CXIMPContextClientProxy* iCtxClientProxy;
+
+
+    /**
+     * Array of observers.
+     * Own.
+     */
+    CXIMPCntxtEventObsArray* iObservers;
+    
+    
+    /**
+     * Spare req complete event.
+     * Own.
+     */
+    CXIMPRequestCompleteEventImp* iSpareReqCompleteEvent;
+
+
+    /**
+     * Spare ctx state change event.
+     * Own.
+     */
+    CXIMPContextStateEventImp* iSpareCtxStateEvent;
+
+    };
+
+
+#endif // CXIMPPRESENCECONTEXTEVENTPUMP_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/core/srcfrontend/srcmanager/ximpcontextimp.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,418 @@
+/*
+* 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:  Implementation of MXIMPContext
+ *
+*/
+
+#include "ximpcontextimp.h"
+#include "ximpcontexteventpump.h"
+#include "ximpserviceinfoimp.h"
+#include "ximpfeatureinfoimp.h"
+#include "ximpobjecthelpers.h"
+#include "ximpoperationdefs.h"
+
+#include "ximpobjectfactoryimp.h"
+
+#include "ximpcontextclientinfoimp.h"
+#include "ximpidentityimp.h"
+#include "ximpcontextclientproxy.h"
+
+
+_LIT( KZeroId, "0" );
+
+// ============================ MEMBER FUNCTIONS =============================
+
+// ---------------------------------------------------------------------------
+// CXIMPContextImp::NewLC()
+// ---------------------------------------------------------------------------
+//
+CXIMPContextImp* CXIMPContextImp::NewLC()
+    {
+    CXIMPContextImp* self = new( ELeave ) CXIMPContextImp;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// Implement supported interface access.
+// ---------------------------------------------------------------------------
+//
+XIMPIMP_IF_BASE_GET_INTERFACE_BEGIN( CXIMPContextImp, 
+                                     MXIMPContext )
+
+XIMPIMP_IF_BASE_GET_INTERFACE(MXIMPContextInternal, this)
+
+XIMPIMP_IF_BASE_GET_INTERFACE_END()
+
+
+XIMPIMP_IF_BASE_GET_CONST_INTERFACE_BEGIN( CXIMPContextImp, 
+                                           MXIMPContext )
+XIMPIMP_IF_BASE_GET_CONST_INTERFACE(MXIMPContextInternal, this)
+
+XIMPIMP_IF_BASE_GET_INTERFACE_END()
+
+// ---------------------------------------------------------------------------
+// CXIMPContextImp::~CXIMPContextImp()
+// ---------------------------------------------------------------------------
+//
+CXIMPContextImp::~CXIMPContextImp()
+    {
+    delete iObjFactory;
+    delete iEventPump;
+    delete iCtxProxy;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPContextImp::CXIMPContextImp()
+// ---------------------------------------------------------------------------
+//
+CXIMPContextImp::CXIMPContextImp()
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPContextImp::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void CXIMPContextImp::ConstructL()
+    {
+    iCtxProxy = new ( ELeave ) CXIMPContextClientProxy;
+    iEventPump = CXIMPContextEventPump::NewL( *this, *iCtxProxy );
+    iObjFactory = CXIMPObjectFactoryImp::NewL();
+    }
+
+// ---------------------------------------------------------------------------
+// CXIMPContextImp::RegisterObserverL()
+// ---------------------------------------------------------------------------
+//
+void CXIMPContextImp::RegisterObserverL(
+        MXIMPContextObserver& aObserver,
+        const TArray< TInt32 >* aEventFilter )
+    {
+    iEventPump->RegisterObserverL( aObserver, aEventFilter );
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPContextImp::UnregisterObserver()
+// ---------------------------------------------------------------------------
+//
+void CXIMPContextImp::UnregisterObserver(
+        MXIMPContextObserver& aObserver )
+    {
+    iEventPump->UnRegisterObserver( aObserver );
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPContextImp::BindToL()
+// ---------------------------------------------------------------------------
+//
+TXIMPRequestId CXIMPContextImp::BindToL(
+        TUid aProtocolImpUid,
+        const TDesC16& aServiceAddress,
+        const TDesC16& aUsername,
+        const TDesC16& aPassword,
+        TInt32 aIapId )
+
+    {
+    //Setup context connection
+    
+    return BindToL( aProtocolImpUid,
+                    aServiceAddress,
+                    aUsername,
+                    aPassword,
+                    KZeroId,
+                    aIapId );
+
+    }
+
+// ---------------------------------------------------------------------------
+// CXIMPContextImp::BindToL()
+// ---------------------------------------------------------------------------
+//
+TXIMPRequestId CXIMPContextImp::BindToL(
+        TUid aProtocolImpUid,
+        const TDesC16& aServiceAddress,
+        const TDesC16& aUsername,
+        const TDesC16& aPassword,
+        const TDesC16& aClientId,
+        TInt32 aIapId )
+
+    {
+    //Setup context connection
+    iCtxProxy->InitServerSessionLC( aProtocolImpUid ); //Pushes session close
+    iEventPump->StartEventPumpLC(); //Pushes pump close
+
+
+    //Combine bind parameters and issue request
+    CXIMPServiceInfoImp* serviceInfo = CXIMPServiceInfoImp::NewLC( aProtocolImpUid,
+                                                                   aServiceAddress,
+                                                                   aUsername,
+                                                                   aPassword,
+                                                                   aIapId );
+
+
+    CXIMPContextClientInfoImp* clientInfo = CXIMPContextClientInfoImp::NewLC();
+        {
+        CXIMPIdentityImp* identity = CXIMPIdentityImp::NewLC();
+        identity->SetIdentityL( aClientId );
+        clientInfo->SetClientIdL( identity );
+        CleanupStack::Pop( identity );
+        }
+
+
+    HBufC8* packBufDesc = NULL;
+        {
+        CBufFlat* packBuf = CBufFlat::NewL( KObjectBufGranurality );
+        CleanupStack::PushL( packBuf );
+
+        RBufWriteStream ws;
+        ws.Open( *packBuf ); // CSI: 65 #
+        CleanupClosePushL( ws );
+
+        serviceInfo->ExternalizeL( ws );
+        clientInfo->ExternalizeL( ws );
+
+        ws.CommitL();
+        CleanupStack::PopAndDestroy(); //ws
+
+        packBufDesc = packBuf->Ptr(0).AllocL();
+        CleanupStack::PopAndDestroy( packBuf ); 
+        }
+
+    CleanupStack::PushL( packBufDesc );
+
+    TXIMPRequestId reqId = iCtxProxy->QueueAsyncConnectionOpenL( NXIMPOps::EXIMPBindContext,
+                                                                 *packBufDesc );
+
+    CleanupStack::PopAndDestroy( packBufDesc );
+    CleanupStack::PopAndDestroy( clientInfo );
+    CleanupStack::PopAndDestroy( serviceInfo );
+    
+
+    CleanupStack::Pop(); //Pop the pump close
+    CleanupStack::Pop(); //Pop the session close
+
+    return reqId;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPContextImp::BindToL()
+// ---------------------------------------------------------------------------
+//
+TXIMPRequestId CXIMPContextImp::BindToL(
+        TUid aProtocolImpUid,
+        TInt aSettingsId )
+        
+    {
+    //Setup context connection
+    iCtxProxy->InitServerSessionLC( aProtocolImpUid ); //Pushes session close
+    iEventPump->StartEventPumpLC(); //Pushes pump close
+
+
+    //Combine bind parameters and issue request
+    CXIMPServiceInfoImp* serviceInfo = CXIMPServiceInfoImp::NewLC( aProtocolImpUid,
+                                                                   KNullDesC,
+                                                                   KNullDesC,
+                                                                   KNullDesC,
+                                                                   aSettingsId );
+
+     CXIMPContextClientInfoImp* clientInfo = CXIMPContextClientInfoImp::NewLC();
+        {
+        CXIMPIdentityImp* identity = CXIMPIdentityImp::NewLC();
+        identity->SetIdentityL( KZeroId );
+        clientInfo->SetClientIdL( identity );
+        CleanupStack::Pop( identity );
+        }
+
+
+    HBufC8* packBufDesc = NULL;
+        {
+        CBufFlat* packBuf = CBufFlat::NewL( KObjectBufGranurality );
+        CleanupStack::PushL( packBuf );
+
+        RBufWriteStream ws;
+        ws.Open( *packBuf ); // CSI: 65 #
+        CleanupClosePushL( ws );
+
+        serviceInfo->ExternalizeL( ws );
+        clientInfo->ExternalizeL( ws );
+
+        ws.CommitL();
+        CleanupStack::PopAndDestroy(); //ws
+
+        packBufDesc = packBuf->Ptr(0).AllocL();
+        CleanupStack::PopAndDestroy( packBuf ); 
+        }
+
+    CleanupStack::PushL( packBufDesc );
+
+    TXIMPRequestId reqId = iCtxProxy->QueueAsyncConnectionOpen2L( NXIMPOps::EXIMPBindContext2,
+                                                                 *packBufDesc );
+
+    CleanupStack::PopAndDestroy( packBufDesc );
+    CleanupStack::PopAndDestroy( clientInfo );
+    CleanupStack::PopAndDestroy( serviceInfo );
+    
+
+    CleanupStack::Pop(); //Pop the pump close
+    CleanupStack::Pop(); //Pop the session close
+
+    return reqId;
+    }
+
+// ---------------------------------------------------------------------------
+// CXIMPContextImp::BindToL()
+// ---------------------------------------------------------------------------
+//
+ TXIMPRequestId CXIMPContextImp::BindToL( TUid aProtocolImpUid,
+			                const TDesC16& aUsername,
+			                const TDesC16& aPassword,
+			                TInt  aSettingsId )
+	{
+	 //Setup context connection
+    iCtxProxy->InitServerSessionLC( aProtocolImpUid ); //Pushes session close
+    iEventPump->StartEventPumpLC(); //Pushes pump close
+
+
+    //Combine bind parameters and issue request
+    CXIMPServiceInfoImp* serviceInfo = CXIMPServiceInfoImp::NewLC( aProtocolImpUid,
+                                                                   KNullDesC,
+                                                                   aUsername,
+                                                                   aPassword,
+                                                                   aSettingsId );
+
+     CXIMPContextClientInfoImp* clientInfo = CXIMPContextClientInfoImp::NewLC();
+        {
+        CXIMPIdentityImp* identity = CXIMPIdentityImp::NewLC();
+        identity->SetIdentityL( KZeroId );
+        clientInfo->SetClientIdL( identity );
+        CleanupStack::Pop( identity );
+        }
+
+
+    HBufC8* packBufDesc = NULL;
+        {
+        CBufFlat* packBuf = CBufFlat::NewL( KObjectBufGranurality );
+        CleanupStack::PushL( packBuf );
+
+        RBufWriteStream ws;
+        ws.Open( *packBuf ); // CSI: 65 #
+        CleanupClosePushL( ws );
+
+        serviceInfo->ExternalizeL( ws );
+        clientInfo->ExternalizeL( ws );
+
+        ws.CommitL();
+        CleanupStack::PopAndDestroy(); //ws
+
+        packBufDesc = packBuf->Ptr(0).AllocL();
+        CleanupStack::PopAndDestroy( packBuf ); 
+        }
+
+    CleanupStack::PushL( packBufDesc );
+
+    TXIMPRequestId reqId = iCtxProxy->QueueAsyncConnectionOpenL( NXIMPOps::EXIMPBindContext2,
+                                                                 *packBufDesc );
+
+    CleanupStack::PopAndDestroy( packBufDesc );
+    CleanupStack::PopAndDestroy( clientInfo );
+    CleanupStack::PopAndDestroy( serviceInfo );
+    
+
+    CleanupStack::Pop(); //Pop the pump close
+    CleanupStack::Pop(); //Pop the session close
+
+    return reqId;	
+	}
+// ---------------------------------------------------------------------------
+// CXIMPContextImp::UnbindL()
+// ---------------------------------------------------------------------------
+//
+TXIMPRequestId CXIMPContextImp::UnbindL()
+    {
+    return iCtxProxy->QueueAsyncConnectionCloseL( NXIMPOps::EXIMPUnbindContext,
+                                                  KNullDesC8 );
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPContextImp::GetContextFeaturesLC()
+// ---------------------------------------------------------------------------
+//
+MXIMPFeatureInfo* CXIMPContextImp::GetContextFeaturesLC() const
+    {
+    CXIMPFeatureInfoImp* features = CXIMPFeatureInfoImp::NewLC();
+
+    HBufC8* featurePck = iCtxProxy->DirectSessionL().GetContextFeaturesL();
+    CleanupStack::PushL( featurePck );
+    TXIMPObjectPacker<CXIMPFeatureInfoImp>::UnPackL( *features, *featurePck );
+    CleanupStack::PopAndDestroy( featurePck );
+
+    return features;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPContextImp::ObjectFactory()
+// ---------------------------------------------------------------------------
+//
+MXIMPObjectFactory& CXIMPContextImp::ObjectFactory() const
+    {
+    return *iObjFactory;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPContextImp::ObjectFactory()
+// ---------------------------------------------------------------------------
+//
+TXIMPRequestId CXIMPContextImp::QueueOperationL( TInt aOperationType, 
+                                const TDesC8& aOperationParams )
+    {
+    return iCtxProxy->QueueOperationL(aOperationType, aOperationParams );
+    }
+
+// ---------------------------------------------------------------------------
+// CXIMPContextImp::ConvertStringToUidL()
+// ---------------------------------------------------------------------------
+//
+void CXIMPContextImp::ConvertStringToUidL( const TDesC8& aData,
+        TUid& aUid )
+    {
+    // Make sure aData is in the correct format - "0x12345678"
+    _LIT8(K0x, "0x");
+    _LIT8(K0X, "0X");
+
+    if( (aData.Length() == 10) &&
+            ( (aData.FindF( K0x ) == 0) || ( aData.FindF( K0X ) == 0 ) ) )
+        {
+        // only take the right 8 characters (ie discard the "0x")
+        TLex8 lex( aData.Right( 8 ) );
+        TUint32 value = 0;
+        User::LeaveIfError( lex.Val( value, EHex ) );
+        aUid.iUid = value;
+        }
+    else
+        {
+        User::Leave( KErrCorrupt );
+        }
+    }
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/core/srcfrontend/srcmanager/ximpcontextimp.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,140 @@
+/*
+* 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:  Implementation of MXIMPContext
+*
+*/
+
+#ifndef CXIMPPRESENCECONTEXTIMP_H
+#define CXIMPPRESENCECONTEXTIMP_H
+
+#include <ximpcontext.h>
+#include "ximpcontextinternal.h"
+
+#include "ximpapiobjbase.h"
+
+
+class MXIMPContextObserver;
+class CXIMPContextEventPump;
+class MXIMPFeatureInfo;
+class CXIMPObjectFactoryImp;
+class CXIMPContextClientProxy;
+
+
+/**
+ * MXIMPContext API object implementation.
+ *
+ * @lib ximpmanager.dll
+ * @since S60 v3.2
+ */
+NONSHARABLE_CLASS( CXIMPContextImp ): public CXIMPApiObjBase,
+                                      public MXIMPContext,
+                                      public MXIMPContextInternal
+    {
+    public:
+    /** The class ID. */
+    enum { KClassId = XIMPIMP_CLSID_CXIMPCONTEXTIMP };
+
+
+public:
+
+    static CXIMPContextImp* NewLC();
+    virtual ~CXIMPContextImp();
+
+
+private:
+
+    CXIMPContextImp();
+    void ConstructL();
+
+
+public: // From MXIMPBase
+
+    /**
+     * Implementation of MXIMPBase interface methods
+     * @see MXIMPBase
+     */
+    XIMPIMP_DECLARE_IF_BASE_METHODS
+
+
+public: //From MXIMPContext
+
+    /**
+     * Implementation of MXIMPContext interface methods
+     * @see MXIMPContext
+     */
+    void RegisterObserverL( MXIMPContextObserver& aObserver,
+                            const TArray<TInt32>* aEventFilter );
+
+    void UnregisterObserver( MXIMPContextObserver& aObserver );
+
+    TXIMPRequestId BindToL( TUid aProtocolImpUid,
+                            const TDesC16& aServiceAddress,
+                            const TDesC16& aUsername,
+                            const TDesC16& aPassword,
+                            TInt32 aIapId );
+    TXIMPRequestId BindToL( TUid aProtocolImpUid,
+                            const TDesC16& aServiceAddress,
+                            const TDesC16& aUsername,
+                            const TDesC16& aPassword,
+                            const TDesC16& aClientId,
+                            TInt32 aIapId );
+    TXIMPRequestId BindToL( TUid aProtocolImpUid,
+                            TInt aSettingsId );
+    TXIMPRequestId BindToL( TUid aProtocolImpUid,
+			                const TDesC16& aUsername,
+			                const TDesC16& aPassword,
+			                TInt aSettingsId ) ;                        
+
+    TXIMPRequestId UnbindL();
+
+    MXIMPFeatureInfo* GetContextFeaturesLC() const;
+
+    MXIMPObjectFactory& ObjectFactory() const;
+    
+public: // From MXIMPContextInternal
+
+    TXIMPRequestId QueueOperationL( TInt aOperationType, 
+                                const TDesC8& aOperationParams );
+
+
+private: // Helpers
+
+    /**
+     * Converts a string to a uid.
+     * String must be in Hex and begin with "0x".
+     */
+    void ConvertStringToUidL( const TDesC8& aData, TUid& aUid );
+
+
+private: // data
+
+    /**
+     * Context session proxy for having a connection context server.
+     */
+    CXIMPContextClientProxy* iCtxProxy;
+
+    /**
+     * Object factory sub interface.
+     */
+    CXIMPObjectFactoryImp* iObjFactory;
+
+    /**
+     * Event pump.
+     * Own.
+     */
+    CXIMPContextEventPump* iEventPump;
+    };
+
+
+#endif // CXIMPPRESENCECONTEXTIMP_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/core/srcfrontend/srcmanager/ximpundotask.h	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  UndoTask related helpers.
+*
+*/
+
+#ifndef XIMPUNDOTASK_H
+#define XIMPUNDOTASK_H
+
+#include <e32base.h>
+
+
+/**
+ * Abstract UndoTask object interface.
+ * UndoTask object encapsulates data and logic
+ * needed to perform the undo operation.
+ *
+ * Concrete UndoTasks perform the desired undo operation
+ * on its desctructor. So the concrete UndoTask object
+ * can be pushed on the cleanupstack to have the undo
+ * performed automaticly in case of leave.
+ *
+ * If undo operation should not be performed on destruction,
+ * it should be canceled with CancelUndo(). However,
+ * the undo object needs still to be deleted or
+ * PopAndDestroy():ed.
+ *
+ * @since S60 v3.2
+ */
+class MXIMPUndoTask
+    {
+
+public:
+
+    /**
+     * Cancels the undo operation.
+     *
+     * When called, undo isn't performed on
+     * destcruction.
+     */
+    virtual void CancelUndo() = 0;
+
+
+    /**
+     * Public destructor.
+     * Object instancies can be deleted via this interface.
+     *
+     * Destruction performs the desired undo operation,
+     * unless it has been previously canceled.
+     */
+    virtual ~MXIMPUndoTask() {}
+    };
+
+
+
+
+
+/**
+ * Templated UndoTask to perform entry removal from
+ * pointer array.
+ *
+ * @since S60 v3.2
+ */
+template< class T >
+class CXIMPUndoPtrArrayEntryAdd : public CBase,
+                                  public MXIMPUndoTask
+    {
+public:
+
+    /**
+     * Constructor to allocate new undo
+     * task object.
+     */
+    inline static CXIMPUndoPtrArrayEntryAdd* NewLC();
+
+
+    /**
+     * Destructor.
+     *
+     * Destruction performs the undo operation,
+     * unless it has been previously canceled.
+     */
+    inline ~CXIMPUndoPtrArrayEntryAdd();
+
+
+private:
+    inline CXIMPUndoPtrArrayEntryAdd();
+
+
+public:
+
+    /**
+     * Initializes the undo operation to remove and destroy
+     * given object from given object array.
+     *
+     * @param aObj Templated object to remove.
+     * @param aObjArray Templated object array from which
+     *        to remove.
+     */
+    inline void InitToRemoveAndDestroyOnUndo( T& aObj,
+                                              RPointerArray< T >& aObjArray );
+
+    /**
+     * Cancels the initialized undo operation.
+     */
+    inline void CancelUndo();
+
+
+private: // data
+
+    /**
+     * Pointer to RPointerArray from where to remove the entry.
+     * Not own.
+     */
+    RPointerArray< T >* iObjArray;
+
+
+    /**
+     * Pointer to entry which to remove from the array.
+     *
+     * Object is removed from the array and deleted
+     * when this undo object is destroyed.
+     */
+    T*  iObj;
+    };
+
+
+
+
+
+
+/**
+ * Templated UndoTask to perform entry replace on
+ * pointer array.
+ *
+ * @since S60 v4.0
+ */
+template< class T >
+class CXIMPUndoPtrArrayEntryReplace : public CBase,
+                                      public MXIMPUndoTask
+    {
+public:
+
+    /**
+     * Constructor to allocate new undo
+     * task object.
+     */
+    inline static CXIMPUndoPtrArrayEntryReplace* NewLC();
+
+
+    /**
+     * Destructor.
+     *
+     * Destruction performs the undo operation,
+     * unless it has been previously canceled.
+     */
+    inline ~CXIMPUndoPtrArrayEntryReplace();
+
+
+private:
+    inline CXIMPUndoPtrArrayEntryReplace();
+
+
+public:
+
+    /**
+     * Initializes the undo operation to remove and destroy
+     * given object from given object array.
+     *
+     * @param aTarget Templated object which to replace.
+     * @param aObjArray Templated object array on which to replace.
+     * @param aSource Templated object which to insert.
+     */
+    inline void InitToReplaceOnUndo( T& aTarget,
+                                     RPointerArray< T >& aObjArray,
+                                     T& aSource );
+
+    /**
+     * Cancels the initialized undo operation.
+     */
+    inline void CancelUndo();
+
+
+private: // data
+
+    /**
+     * Pointer to RPointerArray from where to replace the entry.
+     * Not own.
+     */
+    RPointerArray< T >* iObjArray;
+
+
+    /**
+     * Pointer to entry which to replace on the the array.
+     * Object is deleted and replaced with source object
+     * when this undo object is destroyed.
+     */
+    T*  iTarget;
+
+
+    /**
+     * Pointer to entry which to insert on the the array.
+     *
+     * Object is deleted when undo is canceled.
+     */
+    T*  iSource;
+
+    };
+
+
+#include "ximpundotask.inl"
+
+#endif // XIMPUNDOTASK_H
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/core/srcfrontend/srcmanager/ximpundotask.inl	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,182 @@
+/*
+* 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:  UndoTask related helpers.
+*
+*/
+
+#include "ximppanics.h"
+
+
+// ============================ MEMBER FUNCTIONS =============================
+
+// ---------------------------------------------------------------------------
+// CXIMPUndoPtrArrayEntryAdd::NewLC()
+// ---------------------------------------------------------------------------
+//
+template< class T >
+CXIMPUndoPtrArrayEntryAdd<T>* CXIMPUndoPtrArrayEntryAdd<T>::NewLC()
+    {
+    CXIMPUndoPtrArrayEntryAdd<T>* self = new (ELeave) CXIMPUndoPtrArrayEntryAdd;
+    CleanupStack::PushL( self );
+    return self;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPUndoPtrArrayEntryAdd::~CXIMPUndoPtrArrayEntryAdd()
+// ---------------------------------------------------------------------------
+//
+template< class T >
+CXIMPUndoPtrArrayEntryAdd<T>::~CXIMPUndoPtrArrayEntryAdd()
+    {
+    if( iObjArray )
+        {
+        TInt index = iObjArray->Find( iObj );
+        if( index != KErrNotFound )
+            {
+            iObjArray->Remove( index );
+            }
+
+        delete iObj;
+        }
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPUndoPtrArrayEntryAdd::CXIMPUndoPtrArrayEntryAdd()
+// ---------------------------------------------------------------------------
+//
+template< class T >
+CXIMPUndoPtrArrayEntryAdd<T>::CXIMPUndoPtrArrayEntryAdd()
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPUndoPtrArrayEntryAdd::InitToRemoveAndDestroyOnUndo()
+// ---------------------------------------------------------------------------
+//
+template< class T >
+void CXIMPUndoPtrArrayEntryAdd<T>::InitToRemoveAndDestroyOnUndo(
+    T& aObj,
+    RPointerArray< T >& aObjArray )
+    {
+    __ASSERT_ALWAYS( !iObjArray,
+                     User::Panic( NXIMPPrivPanic::KCategory,
+                                  NXIMPPrivPanic::EPtrArrayEntryAddUndoInitialized ) );
+
+    iObjArray = &aObjArray;
+    iObj = &aObj;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPUndoPtrArrayEntryAdd::CancelUndo()
+// ---------------------------------------------------------------------------
+//
+template< class T >
+void CXIMPUndoPtrArrayEntryAdd<T>::CancelUndo()
+    {
+    iObjArray = NULL;
+    iObj = NULL;
+    }
+
+
+
+
+// ============================ MEMBER FUNCTIONS =============================
+
+// ---------------------------------------------------------------------------
+// CXIMPUndoPtrArrayEntryReplace::NewLC()
+// ---------------------------------------------------------------------------
+//
+template< class T >
+CXIMPUndoPtrArrayEntryReplace<T>* CXIMPUndoPtrArrayEntryReplace<T>::NewLC()
+    {
+    CXIMPUndoPtrArrayEntryReplace<T>* self =
+            new (ELeave) CXIMPUndoPtrArrayEntryReplace;
+    CleanupStack::PushL( self );
+    return self;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPUndoPtrArrayEntryReplace::~CXIMPUndoPtrArrayEntryReplace()
+// ---------------------------------------------------------------------------
+//
+template< class T >
+CXIMPUndoPtrArrayEntryReplace<T>::~CXIMPUndoPtrArrayEntryReplace()
+    {
+    if( iObjArray )
+        {
+        const TInt index = iObjArray->Find( iTarget );
+        if( index != KErrNotFound )
+            {
+            (*iObjArray)[ index ] = iSource;
+            delete iTarget;
+            }
+        else
+            {
+            delete iSource;
+            }
+        }
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPUndoPtrArrayEntryReplace::CXIMPUndoPtrArrayEntryReplace()
+// ---------------------------------------------------------------------------
+//
+template< class T >
+CXIMPUndoPtrArrayEntryReplace<T>::CXIMPUndoPtrArrayEntryReplace()
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPUndoPtrArrayEntryReplace::InitToReplaceOnUndo()
+// ---------------------------------------------------------------------------
+//
+template< class T >
+void CXIMPUndoPtrArrayEntryReplace<T>::InitToReplaceOnUndo(
+    T& aTarget,
+    RPointerArray< T >& aObjArray,
+    T& aSource )
+    {
+    __ASSERT_ALWAYS( !iObjArray,
+                     User::Panic( NXIMPPrivPanic::KCategory,
+                                  NXIMPPrivPanic::EPtrArrayEntryReplaceUndoInitialized ) );
+
+    iObjArray = &aObjArray;
+    iTarget = &aTarget;
+    iSource = &aSource;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPUndoPtrArrayEntryReplace<T>::CancelUndo()
+// ---------------------------------------------------------------------------
+//
+template< class T >
+void CXIMPUndoPtrArrayEntryReplace<T>::CancelUndo()
+    {
+    iObjArray = NULL;
+    iTarget = NULL;
+
+    delete iSource;
+    iSource = NULL;
+    }
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/core/srcoperations/sessionmng/ximpoperationbind.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,152 @@
+/*
+* 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:  Concrete bind operation
+ *
+*/
+
+#include <ximpprotocolconnection.h>
+
+#include "ximpoperationbind.h"
+#include "ximpserviceinfoimp.h"
+#include "ximpcontextclientinfoimp.h"
+#include "ximpobjecthelpers.h"
+#include "ximpcontextstateeventimp.h"
+#include "ximpcontextstateimp.h"
+#include "ximppsccontextimp.h"
+#include "ximphost.h"
+#include "ximpstatusimp.h"
+
+#include "ximptrace.h"
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// CXIMPOperationBind::CXIMPOperationBind()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CXIMPOperationBind::CXIMPOperationBind()
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPOperationBind::ConstructL
+// ---------------------------------------------------------------------------
+//
+void CXIMPOperationBind::ConstructL( const TDesC8& aParamPck )
+    {
+    if( iContext->IsHostAssigned() )
+        {
+        User::Leave( KErrAlreadyExists );
+        }
+    CXIMPContextClientInfoImp* clientInfo = CXIMPContextClientInfoImp::NewLC();
+    CXIMPServiceInfoImp* serviceInfo = CXIMPServiceInfoImp::NewLC();
+
+        {
+        RDesReadStream rs;
+        CleanupClosePushL( rs );
+        rs.Open( aParamPck ); // CSI: 65 #
+
+	    serviceInfo->InternalizeL( rs );
+	    clientInfo->InternalizeL( rs );
+
+        CleanupStack::PopAndDestroy(); // rs
+        }
+
+
+    CleanupStack::Pop( serviceInfo );
+    iContext->SetServiceInfo( serviceInfo );
+
+    CleanupStack::Pop( clientInfo );
+    iContext->SetClientInfo( clientInfo );
+    
+    iTempEvent = CXIMPContextStateEventImp::NewL();
+    iTempEvent->ContextStateImp().SetStateValue( MXIMPContextState::EInactive );
+    }
+
+// ---------------------------------------------------------------------------
+// CXIMPOperationBind::~CXIMPOperationBind()
+// ---------------------------------------------------------------------------
+//
+CXIMPOperationBind::~CXIMPOperationBind()
+    {
+    delete iTempEvent;
+    }
+
+// ---------------------------------------------------------------------------
+// CXIMPOperationBind::ProcessL()
+// ---------------------------------------------------------------------------
+//
+void CXIMPOperationBind::ProcessL()
+    { 
+    TRACE(_L("CXIMPOperationBind::ProcessL()" ) );   
+    CXIMPOperationBase::ProcessL();
+
+    iTempEvent->ContextStateImp().SetStateValue( MXIMPContextState::EBinding );
+    iMyHost->ActivateEventL( *iTempEvent, iContext );
+
+    MXIMPProtocolConnection& connection = iMyHost->GetConnection();
+    connection.OpenSessionL( *iContext->ClientInfo(), iReqId );
+    }
+
+// ---------------------------------------------------------------------------
+// CXIMPOperationBind::RequestCompleted()
+// ---------------------------------------------------------------------------
+//
+void CXIMPOperationBind::RequestCompletedL()
+    {
+    TRACE(_L("CXIMPOperationBind::RequestCompletedL()" ) );
+    CXIMPOperationBase::RequestCompletedL();
+    
+    if( iStatusObj->ResultCode() != KErrNone )
+        {
+        // Remove unbind, because bind did not succeed. this
+        // can be done only when attempting to connect for the first time
+        iContext->DestroyCachedUnbind();
+        iTempEvent->ContextStateImp().SetStateValue( 
+            MXIMPContextState::EInactive );
+    
+        iMyHost->UnregisterSession( iContext );
+        }
+    else
+        {
+        iTempEvent->ContextStateImp().SetStateValue( MXIMPContextState::EActive );
+        }    
+    iMyHost->ActivateEventL( *iTempEvent, iContext );
+    }
+
+// ---------------------------------------------------------------------------
+// CXIMPOperationBind::Type()
+// ---------------------------------------------------------------------------
+//
+TInt CXIMPOperationBind::Type() const
+    {            
+    return NXIMPOps::EXIMPBindContext;
+    }
+
+// -----------------------------------------------------------------------------
+// CXIMPOperationBind::BeginOperationL
+// -----------------------------------------------------------------------------
+//
+void CXIMPOperationBind::BeginOperation()
+    {
+    }
+    
+// -----------------------------------------------------------------------------
+// CXIMPOperationBind::EndOperationL
+// -----------------------------------------------------------------------------
+//
+void CXIMPOperationBind::EndOperation()
+    {    
+    }
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/core/srcoperations/sessionmng/ximpoperationbind.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,65 @@
+/*
+* 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:  Bind operation
+ *
+*/
+
+#ifndef C_PSCOPERATIONBIND_H
+#define C_PSCOPERATIONBIND_H
+
+
+#include <e32base.h>
+#include <ximpbase.h>
+
+#include "ximpoperationbase.h"
+#include "ximpoperationdefs.h"
+
+class CXIMPContextStateEventImp;
+
+/**
+ * Bind operation
+ *
+ * @lib ximpoperation.lib
+ * @since S60 v4.0
+ */
+class CXIMPOperationBind : public CXIMPOperationBase
+    {
+
+    public:
+        
+        IMPORT_C CXIMPOperationBind();
+
+        void ConstructL( const TDesC8& aParamPck );
+
+        ~CXIMPOperationBind();
+
+    public: // from CXIMPOperationBase
+        
+        void ProcessL();
+
+        void RequestCompletedL();
+        
+        TInt Type() const;
+        
+        void BeginOperation();
+        void EndOperation();
+        
+    private: // data
+    
+        // State event for client
+        CXIMPContextStateEventImp* iTempEvent;
+    };
+
+
+#endif // C_PSCOPERATIONBIND_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/core/srcoperations/sessionmng/ximpoperationbind2.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  Concrete bind operation
+ *
+*/
+
+#include <ximpprotocolconnection.h>
+
+#include "ximpoperationbind2.h"
+#include "ximpserviceinfoimp.h"
+#include "ximpcontextclientinfoimp.h"
+#include "ximpobjecthelpers.h"
+#include "ximpcontextstateeventimp.h"
+#include "ximpcontextstateimp.h"
+#include "ximppsccontextimp.h"
+#include "ximphost.h"
+#include "ximpstatusimp.h"
+
+#include "ximptrace.h"
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// CXIMPOperationBind2::CXIMPOperationBind2()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CXIMPOperationBind2::CXIMPOperationBind2()
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPOperationBind2::ConstructL
+// ---------------------------------------------------------------------------
+//
+void CXIMPOperationBind2::ConstructL( const TDesC8& aParamPck )
+    {
+    if( iContext->IsHostAssigned() )
+        {
+        User::Leave( KErrAlreadyExists );
+        }
+    CXIMPContextClientInfoImp* clientInfo = CXIMPContextClientInfoImp::NewLC();
+    CXIMPServiceInfoImp* serviceInfo = CXIMPServiceInfoImp::NewLC();
+
+        {
+        RDesReadStream rs;
+        CleanupClosePushL( rs );
+        rs.Open( aParamPck ); // CSI: 65 #
+
+	    serviceInfo->InternalizeL( rs );
+	    clientInfo->InternalizeL( rs );
+
+        CleanupStack::PopAndDestroy(); // rs
+        }
+
+
+    CleanupStack::Pop( serviceInfo );
+    iContext->SetServiceInfo( serviceInfo );
+
+    CleanupStack::Pop( clientInfo );
+    iContext->SetClientInfo( clientInfo );
+    
+    iTempEvent = CXIMPContextStateEventImp::NewL();
+    iTempEvent->ContextStateImp().SetStateValue( MXIMPContextState::EInactive );
+    }
+
+// ---------------------------------------------------------------------------
+// CXIMPOperationBind2::~CXIMPOperationBind2()
+// ---------------------------------------------------------------------------
+//
+CXIMPOperationBind2::~CXIMPOperationBind2()
+    {
+    delete iTempEvent;
+    }
+
+// ---------------------------------------------------------------------------
+// CXIMPOperationBind2::ProcessL()
+// ---------------------------------------------------------------------------
+//
+void CXIMPOperationBind2::ProcessL()
+    { 
+    TRACE(_L("CXIMPOperationBind2::ProcessL()" ) );   
+    CXIMPOperationBase::ProcessL();
+
+    iTempEvent->ContextStateImp().SetStateValue( MXIMPContextState::EBinding );
+    iMyHost->ActivateEventL( *iTempEvent, iContext );
+
+    TInt32 settingsId = iContext->ServiceInfo()->IapId();
+    MXIMPProtocolConnection& connection = iMyHost->GetConnection();
+    connection.OpenSessionL( settingsId, iReqId );
+    }
+
+// ---------------------------------------------------------------------------
+// CXIMPOperationBind2::RequestCompleted()
+// ---------------------------------------------------------------------------
+//
+void CXIMPOperationBind2::RequestCompletedL()
+    {
+    TRACE(_L("CXIMPOperationBind2::RequestCompletedL()" ) );
+    CXIMPOperationBase::RequestCompletedL();
+    
+    if( iStatusObj->ResultCode() != KErrNone )
+        {
+        // Remove unbind, because bind did not succeed. this
+        // can be done only when attempting to connect for the first time
+        iContext->DestroyCachedUnbind();
+        iTempEvent->ContextStateImp().SetStateValue( 
+            MXIMPContextState::EInactive );
+    
+        iMyHost->UnregisterSession( iContext );
+        }
+    else
+        {
+        iTempEvent->ContextStateImp().SetStateValue( MXIMPContextState::EActive );
+        }    
+    iMyHost->ActivateEventL( *iTempEvent, iContext );
+    }
+
+// ---------------------------------------------------------------------------
+// CXIMPOperationBind2::Type()
+// ---------------------------------------------------------------------------
+//
+TInt CXIMPOperationBind2::Type() const
+    {            
+    return NXIMPOps::EXIMPBindContext2;
+    }
+
+// -----------------------------------------------------------------------------
+// CXIMPOperationBind2::BeginOperationL
+// -----------------------------------------------------------------------------
+//
+void CXIMPOperationBind2::BeginOperation()
+    {
+    }
+    
+// -----------------------------------------------------------------------------
+// CXIMPOperationBind2::EndOperationL
+// -----------------------------------------------------------------------------
+//
+void CXIMPOperationBind2::EndOperation()
+    {    
+    }
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/core/srcoperations/sessionmng/ximpoperationbind2.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,65 @@
+/*
+* 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:  Bind operation
+ *
+*/
+
+#ifndef C_XIMPOPERATIONBIND2_H
+#define C_XIMPOPERATIONBIND2_H
+
+
+#include <e32base.h>
+#include <ximpbase.h>
+
+#include "ximpoperationbase.h"
+#include "ximpoperationdefs.h"
+
+class CXIMPContextStateEventImp;
+
+/**
+ * Bind operation
+ *
+ * @lib prfwoperation.lib
+ * @since S60 v4.0
+ */
+class CXIMPOperationBind2 : public CXIMPOperationBase
+    {
+
+    public:
+        
+        IMPORT_C CXIMPOperationBind2();
+
+        void ConstructL( const TDesC8& aParamPck );
+
+        ~CXIMPOperationBind2();
+
+    public: // from CXIMPOperationBase
+        
+        void ProcessL();
+
+        void RequestCompletedL();
+        
+        TInt Type() const;
+        
+        void BeginOperation();
+        void EndOperation();
+        
+    private: // data
+    
+        // State event for client
+        CXIMPContextStateEventImp* iTempEvent;
+    };
+
+
+#endif // C_XIMPOPERATIONBIND2_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/core/srcoperations/sessionmng/ximpoperationforcedteardown.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  Forced teardown operation
+ *
+*/
+
+
+#include "ximpoperationforcedteardown.h"
+#include "ximphost.h"
+
+#include "ximptrace.h"
+// ============================ MEMBER FUNCTIONS =============================
+
+// ---------------------------------------------------------------------------
+// CXIMPOperationForcedTeardown::~CXIMPOperationForcedTeardown()
+// ---------------------------------------------------------------------------
+//
+CXIMPOperationForcedTeardown::~CXIMPOperationForcedTeardown()
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// CXIMPOperationForcedTeardown::CXIMPOperationForcedTeardown()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CXIMPOperationForcedTeardown::CXIMPOperationForcedTeardown()
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// CXIMPOperationForcedTeardown::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void CXIMPOperationForcedTeardown::ConstructL( const TDesC8& /* aParamPck */ )
+    {
+    // ignored. can't give parameters to this operation.
+    }
+
+// ---------------------------------------------------------------------------
+// CXIMPOperationForcedTeardown::SetHost
+// ---------------------------------------------------------------------------
+//
+void CXIMPOperationForcedTeardown::SetHost( MXIMPHost& aMyHost )
+    {
+    CXIMPOperationBase::SetHost( aMyHost );
+    }
+
+// ---------------------------------------------------------------------------
+// CXIMPOperationForcedTeardown::ProcessL()
+// ---------------------------------------------------------------------------
+//
+void CXIMPOperationForcedTeardown::ProcessL()
+    {
+    TRACE(_L("CXIMPOperationForcedTeardown::ProcessL()" ) );
+    CXIMPOperationBase::ProcessL();
+
+    iMyHost->ForcedTeardownL();
+    iMyHost->HandleSessionMgmtRequestCompleted( iReqId, KErrNone );
+    }
+
+// ---------------------------------------------------------------------------
+// CXIMPOperationForcedTeardown::RequestCompleted()
+// ---------------------------------------------------------------------------
+//
+void CXIMPOperationForcedTeardown::RequestCompletedL()
+    {
+    TRACE(_L("CXIMPOperationForcedTeardown::RequestCompletedL()" ) );
+    CXIMPOperationBase::RequestCompletedL();
+
+    // no special handling for error situations
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPOperationForcedTeardown::Type()
+// ---------------------------------------------------------------------------
+//
+TInt CXIMPOperationForcedTeardown::Type() const
+    {
+    return NXIMPOps::EXIMPForcedTeardown;
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/core/srcoperations/sessionmng/ximpoperationforcedteardown.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,59 @@
+/*
+* 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:  Forced teardown operation 
+ *
+*/
+
+#ifndef CPSCOPERATIONFORCEDTEARDOWN_H
+#define CPSCOPERATIONFORCEDTEARDOWN_H
+
+
+#include <e32base.h>
+
+#include <ximpbase.h>
+#include "ximpoperationbase.h"
+#include "ximpoperationdefs.h"
+
+class MXIMPHost;
+
+/**
+ * Forced tear down operation.
+ * Activates all cached unbinds.
+ *
+ * @lib ximpoperations.lib
+ * @since S60 v4.0
+ */
+class CXIMPOperationForcedTeardown : public CXIMPOperationBase
+    {
+    public:
+
+        IMPORT_C CXIMPOperationForcedTeardown();
+
+        void ConstructL( const TDesC8& aParamPck );
+
+        ~CXIMPOperationForcedTeardown();
+
+    public: // from CXIMPOperationBase
+
+        void SetHost( MXIMPHost& aMyHost );
+        void ProcessL();
+        void RequestCompletedL();
+        TInt Type() const;
+
+    private: // data
+
+    };
+
+
+#endif // CPSCOPERATIONFORCEDTEARDOWN_H 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/core/srcoperations/sessionmng/ximpoperationunbind.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,138 @@
+/*
+* 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:  Concrete unbind operation
+ *
+*/
+
+
+#include <e32base.h>
+#include <ximpprotocolconnection.h>
+
+#include "ximpoperationunbind.h"
+#include "ximpcontextclientinfoimp.h"
+#include "ximpcontextstateeventimp.h"
+#include "ximpcontextstateimp.h"
+#include "ximphost.h"
+#include "ximppsccontextimp.h"
+
+#include "ximptrace.h"
+
+
+// ======== LOCAL FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// ?description
+// ---------------------------------------------------------------------------
+//
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// CXIMPOperationUnbind::CXIMPOperationUnbind()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CXIMPOperationUnbind::CXIMPOperationUnbind()
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// CXIMPOperationUnbind::ConstructL
+// ---------------------------------------------------------------------------
+//
+void CXIMPOperationUnbind::ConstructL( const TDesC8& /* aParamPck */ )
+    {
+    iTempEvent = CXIMPContextStateEventImp::NewL();
+    iTempEvent->ContextStateImp().SetStateValue( MXIMPContextState::EInactive );
+    }
+
+// ---------------------------------------------------------------------------
+// CXIMPOperationUnbind::~CXIMPOperationUnbind()
+// ---------------------------------------------------------------------------
+//
+CXIMPOperationUnbind::~CXIMPOperationUnbind()
+    {
+    delete iTempEvent;
+    }
+
+// ---------------------------------------------------------------------------
+// CXIMPOperationUnbind::ProcessL()
+// ---------------------------------------------------------------------------
+//
+void CXIMPOperationUnbind::ProcessL()
+    {
+    TRACE(_L("CXIMPOperationUnbind::ProcessL()" ) );
+    CXIMPOperationBase::ProcessL();
+    MXIMPProtocolConnection& connection = iMyHost->GetConnection();
+
+    iTempEvent->ContextStateImp().SetStateValue( MXIMPContextState::EUnbinding );
+    iMyHost->ActivateEventL( *iTempEvent, iContext );
+
+    // normal case, call plugin
+    connection.CloseSession( *iContext->ClientInfo(), iReqId );
+    }
+
+// ---------------------------------------------------------------------------
+// CXIMPOperationUnbind::RequestCompleted()
+// ---------------------------------------------------------------------------
+//
+void CXIMPOperationUnbind::RequestCompletedL()
+    {
+    TRACE(_L("CXIMPOperationUnbind::RequestCompletedL()" ) );
+    CXIMPOperationBase::RequestCompletedL();
+    
+    iTempEvent->ContextStateImp().SetStateValue( MXIMPContextState::EInactive );
+    iMyHost->ActivateEventL( *iTempEvent, iContext );    
+    }
+
+// ---------------------------------------------------------------------------
+// CXIMPOperationUnbind::Type()
+// ---------------------------------------------------------------------------
+//
+TInt CXIMPOperationUnbind::Type() const
+    {
+    return NXIMPOps::EXIMPUnbindContext;
+    }
+
+// -----------------------------------------------------------------------------
+// CXIMPOperationBase::SetResultCode()
+// -----------------------------------------------------------------------------
+//
+void CXIMPOperationUnbind::SetResultCode( TInt /*aResultCode*/ )
+    {
+    // Succeeds always.
+    CXIMPOperationBase::SetResultCode( KErrNone );
+    }
+    
+// -----------------------------------------------------------------------------
+// CXIMPOperationBase::SetResultCode()
+// -----------------------------------------------------------------------------
+//
+void CXIMPOperationUnbind::SetStatus( MXIMPStatus* aStatus )
+    {
+    // Succeeds always.
+    CXIMPOperationBase::SetStatus( aStatus );
+    CXIMPOperationBase::SetResultCode( KErrNone );
+    }
+    
+// -----------------------------------------------------------------------------
+// CXIMPOperationBase::EndOperation()
+// -----------------------------------------------------------------------------
+//
+void CXIMPOperationUnbind::EndOperation()
+    {
+    CXIMPOperationBase::EndOperation();
+    iMyHost->UnregisterSession( iContext );
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/core/srcoperations/sessionmng/ximpoperationunbind.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,69 @@
+/*
+* 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 of CXIMPOperationUnbind
+ *
+*/
+
+#ifndef C_PSCOPERATIONUNBIND_H
+#define C_PSCOPERATIONUNBIND_H
+
+
+#include <e32base.h>
+#include <ximpbase.h>
+
+#include "ximpoperationbase.h"
+#include "ximpoperationdefs.h"
+
+class CXIMPContextStateEventImp;
+
+/**
+ * Unbind operation.
+ *
+ * @lib ximpoperations.lib
+ * @since S60 v4.0
+ */
+class CXIMPOperationUnbind : public CXIMPOperationBase
+    {
+
+    public:
+        
+        IMPORT_C CXIMPOperationUnbind();
+
+        void ConstructL( const TDesC8& aParamPck );
+
+        ~CXIMPOperationUnbind();
+
+    public: // from CXIMPOperationBase
+
+        void ProcessL();
+
+        void RequestCompletedL();
+
+        TInt Type() const; 
+        
+        void SetResultCode( TInt aResultCode );
+        void SetStatus( MXIMPStatus* aStatus );   
+        
+        void EndOperation();             
+
+    private: // data
+    
+        /**
+         *
+         */
+        CXIMPContextStateEventImp* iTempEvent;
+    };
+
+
+#endif // C_PSCOPERATIONUNBIND_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/core/srcoperations/ximpoperationfactory.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,49 @@
+/*
+* 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 Service Connection operation factory
+ *
+*/
+
+
+#ifndef XIMPCPSCOPERATIONFACTORY_H
+#define XIMPCPSCOPERATIONFACTORY_H
+
+#include <e32base.h>
+class CXIMPOperationBase;
+
+/**
+ * Operation factory interface
+ *
+ * @lib ximpoperation.dll
+ * @since S60 v4.0
+ */
+class MXIMPOperationFactory
+    {
+	public: // Allow desctruction through this interface.
+
+		virtual ~MXIMPOperationFactory(){}
+
+    public: // From MXIMPOperationFactory
+
+		/**
+		 * Create operation by operation id.
+		 * @param aOperation. Identifies operation needed to create.
+		 * @return Operation as base object.
+	 	 */
+		virtual CXIMPOperationBase* CreateOperationL( TInt aOperation ) = 0;
+    };
+
+#endif      // XIMPCPSCOPERATIONFACTORY_H
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/core/srcoperations/ximpoperationfactoryimp.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,209 @@
+/*
+* 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 service operation factory
+ *
+*/
+
+
+#include "ximpoperationfactoryimp.h"
+#include "ximpoperationdefs.h"
+#include "ximpoperationbind.h"
+#include "ximpoperationbind2.h"
+#include "ximpoperationunbind.h"
+#include "ximpoperationforcedteardown.h"
+#include "ximppanics.h"
+
+#include "presenceoperationfactoryimp.h"
+#include "ximptrace.h"
+#include "ximpoperationfactory1.h"
+
+using namespace NXIMPOps;
+
+const TInt KPluginArrayGranularity = 3;
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CXIMPOperationFactory::NewL()
+// Singleton access method.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CXIMPOperationFactory* CXIMPOperationFactory::NewL()
+    {
+    CXIMPOperationFactory* self = new ( ELeave ) CXIMPOperationFactory();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CXIMPOperationFactory::CXIMPOperationFactory()
+// -----------------------------------------------------------------------------
+//
+CXIMPOperationFactory::CXIMPOperationFactory()
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CXIMPOperationFactory::~CXIMPOperationFactory()
+// -----------------------------------------------------------------------------
+//
+CXIMPOperationFactory::~CXIMPOperationFactory()
+    {
+    #if _BullseyeCoverage
+    cov_write();
+    #endif
+    delete iPresenceOperation;
+    //delete iImOperation;
+    if ( iOperationPlugins )
+    {
+    	TInt idx = KErrNotFound;
+    	while( iOperationPlugins->Count() )
+        {
+	        idx = iOperationPlugins->Count() - 1;
+	        // Delete object
+	        delete iOperationPlugins->At( idx );
+	        // Delete element
+	        iOperationPlugins->Delete( idx );
+        }
+    }
+
+  	delete iOperationPlugins;
+    REComSession::FinalClose();
+    }
+
+
+// -----------------------------------------------------------------------------
+// CXIMPOperationFactory::ConstructL()
+// -----------------------------------------------------------------------------
+//
+void CXIMPOperationFactory::ConstructL()
+    {
+        iPresenceOperation = CPresenceOperationFactory::NewL();
+        
+        //TRAPD(err, iImOperation = MXIMPOperationFactory1::NewL());
+        
+        iOperationPlugins = new(ELeave)CArrayFixFlat<MXIMPOperationFactory1*>(KPluginArrayGranularity);
+        
+        LoadOperationPluginsL() ;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CXIMPOperationFactory::CreateOperationL()
+// -----------------------------------------------------------------------------
+//
+CXIMPOperationBase* CXIMPOperationFactory::CreateOperationL( TInt aOperation )
+    {
+    CXIMPOperationBase* op = NULL;
+    NXIMPOps::TXIMPOpTypes operation = ( NXIMPOps::TXIMPOpTypes ) aOperation;
+    switch( operation )
+        {
+        case EXIMPBindContext:
+            {
+            op = new ( ELeave ) CXIMPOperationBind();
+            TRACE( _L("Operation Bind created") );
+            break;
+            }
+
+        case EXIMPBindContext2:
+            {
+            op = new ( ELeave ) CXIMPOperationBind2();
+            TRACE( _L("Operation Bind2 created") );
+            break;
+            }
+
+
+        case EXIMPUnbindContext:
+            {
+            op = new ( ELeave ) CXIMPOperationUnbind();
+	        TRACE( _L("Operation Unbind created") );
+            break;
+            }
+
+        case EXIMPForcedTeardown:
+            {
+            op = new ( ELeave ) CXIMPOperationForcedTeardown();
+	        TRACE( _L("Operation ForcedTeardown created") );
+            break;
+            }
+        default:
+        	{
+ 			
+ 			// this for time being, change presence interface
+        	op = iPresenceOperation->CreateOperationL( aOperation );
+        	if(!op)
+        		{
+				TInt count = iOperationPlugins->Count() ;
+	        	
+	        	for(TInt i=0; i<count;i++)
+	        		{
+	        		op = iOperationPlugins->At(i)->CreateOperationL(aOperation) ;
+	        		if(op)
+	        			{
+	        			// got the operation object, no need to pass it to other plugins
+	        			break;
+	        			}
+	        		}
+        		}
+         		break;
+        	}
+        }
+    return op;
+    }
+ 
+void CleanupEComArray(TAny* aArray)
+	{
+	(static_cast<RImplInfoPtrArray*> (aArray))->ResetAndDestroy();
+	(static_cast<RImplInfoPtrArray*> (aArray))->Close();
+	}    
+// -----------------------------------------------------------------------------
+// CXIMPOperationFactory::LoadOperationPluginsL()
+// -----------------------------------------------------------------------------
+//
+void CXIMPOperationFactory::LoadOperationPluginsL() 
+{
+	RImplInfoPtrArray pluginArray;		
+	MXIMPOperationFactory1::ListAllImplementationsL(pluginArray) ;	
+	if ( pluginArray.Count() )
+	{
+		for( TInt i = 0; i < pluginArray.Count(); i++ )
+		{
+			MXIMPOperationFactory1* implementation = NULL ;			
+			CImplementationInformation* info = pluginArray[ i ];        
+        	TUid id = info->ImplementationUid();        	
+        	TRAPD(err, implementation = MXIMPOperationFactory1::NewL(id) );
+        	CleanupStack::PushL(implementation);
+        	if(err == KErrNone)
+        	{
+        		iOperationPlugins->AppendL( implementation );
+        	}
+        	CleanupStack::Pop(implementation);
+		}
+	}
+	pluginArray.ResetAndDestroy();
+}
+
+
+// End of file
+
+
+
+
+
+
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/core/srcoperations/ximpoperationfactoryimp.h	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  Presence Service Connection operation factory
+ *
+*/
+
+
+#ifndef XIMPCPSCOPERATIONFACTORYIMP_H
+#define XIMPCPSCOPERATIONFACTORYIMP_H
+
+
+#include <e32base.h>
+class CXIMPOperationBase;
+class CPresenceOperationFactory;
+class CImOperationFactory;
+
+class MXIMPOperationFactory1 ;
+
+#include "ximpoperationfactory.h"
+#include "ximpoperationfactory1.h"
+
+/**
+ * Operation factory
+ * Class is owned by and handled as singleton by CXIMPGlobals.
+ *
+ * @lib ximpoperation.dll
+ * @since S60 v4.0
+ */
+class CXIMPOperationFactory : public CBase, 
+                                 public MXIMPOperationFactory
+    {
+    public: // Construction and desctruction
+
+        IMPORT_C static CXIMPOperationFactory* NewL();
+
+        virtual ~CXIMPOperationFactory();
+
+    private: // Construction
+
+        /**
+         * C++ default constructor.
+         */
+        CXIMPOperationFactory();
+
+        /**
+         * Symbian 2nd phase constructor
+         */
+        void ConstructL();
+		
+		void LoadOperationPluginsL() ;
+
+    public: // From MXIMPOperationFactory
+
+		/**
+		 * @see MXIMPOperationFactory
+	 	 */
+		CXIMPOperationBase* CreateOperationL( TInt aOperation );
+
+    private:    // Data
+        CPresenceOperationFactory* iPresenceOperation;
+        
+		CArrayFixFlat<MXIMPOperationFactory1*>* iOperationPlugins;
+    };
+
+#endif      // XIMPCPSCOPERATIONFACTORY_H
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/core/srcprocessor/ximpcontexteventqueue.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,429 @@
+/*
+* 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 of context event queue
+ *
+*/
+
+#include "ximpcontexteventqueue.h"
+#include "ximpeventqueueobserver.h"
+
+#include "ximpglobals.h"
+#include "ximpeventmanager.h"
+#include "ximpeventcapsule.h"
+#include "ximpcontexteventfilter.h"
+#include "ximppanics.h"
+#include "ximpcontextstateeventimp.h"
+#include "ximprequestcompleteeventimp.h"
+
+#include <e32base.h>
+
+
+
+// ============================ MEMBER FUNCTIONS =============================
+
+// ---------------------------------------------------------------------------
+// CXIMPContextEventQueue::NewL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CXIMPContextEventQueue* CXIMPContextEventQueue::NewL()
+    {
+    CXIMPContextEventQueue* self =
+        new( ELeave ) CXIMPContextEventQueue( );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPContextEventQueue::~CXIMPContextEventQueue()
+// ---------------------------------------------------------------------------
+//
+CXIMPContextEventQueue::~CXIMPContextEventQueue()
+    {
+    ClearQueuedEvents();
+    delete iEventFilter;
+
+    TInt eventCount =  iPreservedEvents.Count();
+    for( TInt ix = 0; ix < eventCount ; ix++ )
+        {
+        iPreservedEvents[ ix ]->Close();
+        }
+    iPreservedEvents.Reset();
+    eventCount =  iRequestCompleteEvents.Count();
+    for( TInt ix = 0; ix < eventCount ; ix++ )
+        {
+        iRequestCompleteEvents[ ix ]->Close();
+        }
+    iRequestCompleteEvents.Reset();
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPContextEventQueue::CXIMPContextEventQueue()
+// ---------------------------------------------------------------------------
+//
+CXIMPContextEventQueue::CXIMPContextEventQueue()
+    {
+    }
+
+
+// -----------------------------------------------------------------------------
+// CXIMPContextEventQueue::ConstructL()
+// -----------------------------------------------------------------------------
+//
+void CXIMPContextEventQueue::ConstructL()
+    {
+    iEventFilter = CXIMPContextEventFilter::NewL();
+    CXIMPContextStateEventImp* tempEvent =
+            CXIMPContextStateEventImp::NewLC();
+            
+    for( TInt a = 0; a < 6; ++a ) // Count of different states + complete
+        {
+        AddPreservedEventL( *tempEvent );
+        }
+        
+    CleanupStack::PopAndDestroy(); // tempEvent
+    StopConsuming();
+    }
+
+
+// -----------------------------------------------------------------------------
+// CXIMPContextEventQueue::SetEventFilter()
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CXIMPContextEventQueue::SetEventFilter(
+    CXIMPContextEventFilter& aFilter )
+    {
+    delete iEventFilter;
+    iEventFilter = &aFilter;
+
+    //Refilter event queue so we don't deliver such events
+    //that client isn't wanting
+    TInt eventCount =  iPreservedEvents.Count();
+    for( TInt ix = 0; ix < eventCount ; ix++ )
+        {
+        CXIMPEventCapsule* event = iPreservedEvents[ ix ];
+        if( !iEventFilter->IsEventAccepted( event->EventType() ) &&
+            event->Ready() )
+            {
+            event->SetReady( EFalse );
+            }
+        }
+
+    eventCount =  iEvents.Count() - 1;
+    for( TInt ix = eventCount; ix >= 0 ; ix-- )
+        {
+        CXIMPEventCapsule* event = iEvents[ ix ];
+        if( !iEventFilter->IsEventAccepted( event->EventType() ) )
+            {
+            event->Close();
+            iEvents.Remove( ix );
+            }
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CXIMPContextEventQueue::StartConsuming()
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CXIMPContextEventQueue::StartConsuming(
+    MXIMPEventQueueObserver& aQueueObserver )
+    {
+    iObserver = &aQueueObserver;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CXIMPContextEventQueue::StopConsuming()
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CXIMPContextEventQueue::StopConsuming()
+    {
+    iObserver = NULL;
+    ClearQueuedEvents();
+    }
+
+
+// -----------------------------------------------------------------------------
+// CXIMPContextEventQueue::HasElements()
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TBool CXIMPContextEventQueue::HasElements() const
+    {
+    TInt eventCount = iPreservedEvents.Count();
+    TInt count = 0;
+    for( TInt a = 0; a < eventCount; ++a )
+        {
+        if( iPreservedEvents[ a ]->Ready() )
+            {
+            ++count;
+            }
+        }
+
+    eventCount = iRequestCompleteEvents.Count();
+    for( TInt a = 0; a < eventCount; ++a )
+        {
+        if( iRequestCompleteEvents[ a ]->Ready() )
+            {
+            ++count;
+            }
+        }
+
+    return ( iEvents.Count() + count > 0 );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CXIMPContextEventQueue::FindNextEvent()
+// -----------------------------------------------------------------------------
+//
+TBool CXIMPContextEventQueue::FindNextEvent( RPointerArray< CXIMPEventCapsule >& aArray )
+    {
+    TInt eventIndex = KErrNotFound;
+    TInt eventCount = aArray.Count();
+    for( TInt a = 0; a < eventCount; ++a )
+        {
+        if( aArray[ a ]->Ready() )
+            {
+            if( iNextEventToGo )
+                {
+                if( *aArray[ a ] < *iNextEventToGo )
+                    {
+                    eventIndex = a;
+                    iNextEventToGo = aArray[ a ];
+                    }
+                }
+            else
+                {
+                eventIndex = a;
+                iNextEventToGo = aArray[ a ];
+                }            
+            }
+        }
+    return eventIndex;
+    }
+
+// -----------------------------------------------------------------------------
+// CXIMPContextEventQueue::SelectTopEventIfNeededL()
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CXIMPContextEventQueue::SelectTopEventIfNeededL()
+    {
+    if( iNextEventToGo )
+        {
+        return;
+        }
+
+    __ASSERT_ALWAYS( HasElements(), User::Leave( KErrNotFound ) );
+
+    TInt presEvent = FindNextEvent( iPreservedEvents );
+    TInt reqEvent = FindNextEvent( iRequestCompleteEvents );
+    TInt event = FindNextEvent( iEvents );
+
+    if( event != KErrNotFound )
+        {
+        iEvents.Remove( event );
+        }
+    else if( reqEvent != KErrNotFound )
+        {
+        iRequestCompleteEvents.Remove( reqEvent );
+        }
+    else
+        {
+        if(iNextEventToGo)
+         {
+         User::LeaveIfError(iNextEventToGo->Open()); //Open always return KErrNone.      
+         }              
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CXIMPContextEventQueue::TopEventDataL()
+// -----------------------------------------------------------------------------
+//
+EXPORT_C const TDesC8& CXIMPContextEventQueue::TopEventDataL()
+    {
+    __ASSERT_ALWAYS( iNextEventToGo,
+                     User::Leave( KErrNotFound ) );
+                     
+    return iNextEventToGo->EventData();
+    }
+
+
+// -----------------------------------------------------------------------------
+// CXIMPContextEventQueue::TopEventReqIdL()
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TXIMPRequestId CXIMPContextEventQueue::TopEventReqIdL()
+    {
+    __ASSERT_ALWAYS( iNextEventToGo,
+                     User::Leave( KErrNotFound ) );
+                     
+    return iNextEventToGo->EventReqId();
+    }
+    
+
+// -----------------------------------------------------------------------------
+// CXIMPContextEventQueue::DropTopEvent()
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CXIMPContextEventQueue::DropTopEvent()
+    {
+    if( iNextEventToGo )
+        {
+        iNextEventToGo->SetReady( EFalse ); // For preserved events
+        iNextEventToGo->Close();
+        iNextEventToGo = NULL;
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CXIMPContextEventQueue::AddEventL()
+// -----------------------------------------------------------------------------
+//
+void CXIMPContextEventQueue::AddEventL( CXIMPEventCapsule& aEvent )
+    {
+    // Queue accepts the event if:
+    // 1. it has a registered observer
+    // 2. event type is a accepted one
+    TInt32 eventType = aEvent.EventType();
+    if( eventType == MXIMPRequestCompleteEvent::KInterfaceId )
+        {
+        aEvent.SetReady( EFalse );
+        iRequestCompleteEvents.AppendL( &aEvent );
+        User::LeaveIfError(aEvent.Open()); //Open always return KErrNone.  
+        }
+    else if( iObserver &&
+        iEventFilter->IsEventAccepted( eventType ) )
+        {
+        iEvents.AppendL( &aEvent );
+        User::LeaveIfError(aEvent.Open()); //Open always return KErrNone.  
+        aEvent.SetTimeStamp( iTimeStamp++ );
+        iObserver->NewEventAvailable();
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CXIMPContextEventQueue::AddPreservedEventL()
+// -----------------------------------------------------------------------------
+//
+void CXIMPContextEventQueue::AddPreservedEventL( CXIMPApiEventBase& aEvent )
+    {
+    // Queue accepts the event always. Activation uses filter.
+    CXIMPEventCapsule* capsulatedEvent = CXIMPEventCapsule::NewL( aEvent, EFalse );
+    CleanupClosePushL( *capsulatedEvent );
+    iPreservedEvents.AppendL( capsulatedEvent );
+    CleanupStack::Pop( capsulatedEvent );
+    }
+
+// -----------------------------------------------------------------------------
+// CXIMPContextEventQueue::ActivatePreservedEventL()
+// -----------------------------------------------------------------------------
+//
+void CXIMPContextEventQueue::ActivatePreservedEventL( CXIMPApiEventBase& aEvent )
+    {
+    if( iObserver )
+        {
+        TInt eventCount = iPreservedEvents.Count();
+        for( TInt a = 0; a < eventCount; ++a )
+            {
+            if( !iPreservedEvents[ a ]->Ready() )
+                {
+                iPreservedEvents[ a ]->UpdateEventDataL( aEvent );
+                if( iEventFilter->IsEventAccepted( iPreservedEvents[ a ]->EventType() ) )
+                    {
+                    iPreservedEvents[ a ]->SetReady( ETrue );
+                    iPreservedEvents[ a ]->SetTimeStamp( iTimeStamp++ );
+                    iObserver->NewEventAvailable();
+                    }
+                return;
+                }
+            }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CXIMPContextEventQueue::ActivateRequestCompleteEvent()
+// -----------------------------------------------------------------------------
+//
+void CXIMPContextEventQueue::ActivateRequestCompleteEvent( CXIMPRequestCompleteEventImp& aEvent )
+    {
+    TInt eventCount = iRequestCompleteEvents.Count();
+    for( TInt a = 0; a < eventCount; ++a )
+        {
+        if( iRequestCompleteEvents[ a ]->EventReqId() == aEvent.RequestId() )
+            {
+            if( iObserver )
+                {
+                if( iEventFilter->IsEventAccepted( iRequestCompleteEvents[ a ]->EventType() ) )
+                    {
+                    iRequestCompleteEvents[ a ]->UpdateEventData( aEvent );
+                    iRequestCompleteEvents[ a ]->SetReady( ETrue );
+                    iRequestCompleteEvents[ a ]->SetTimeStamp( iTimeStamp++ );
+                    iObserver->NewEventAvailable();
+                    }
+                }
+            else
+                {
+                iRequestCompleteEvents[ a ]->Close();
+                iRequestCompleteEvents.Remove( a );
+                }
+            return;
+            }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CXIMPContextEventQueue::ActivateRequestCompleteEvent()
+// -----------------------------------------------------------------------------
+//
+void CXIMPContextEventQueue::RemoveRequestCompleteEvent( CXIMPRequestCompleteEventImp& aEvent )
+    {
+    TInt eventCount = iRequestCompleteEvents.Count();
+    for( TInt a = 0; a < eventCount; ++a )
+        {
+        if( iRequestCompleteEvents[ a ]->EventReqId() == aEvent.RequestId() )
+            {
+            iRequestCompleteEvents[ a ]->Close();
+            iRequestCompleteEvents.Remove( a );
+            return;
+            }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CXIMPContextEventQueue::ClearQueuedEvents()
+// -----------------------------------------------------------------------------
+//
+void CXIMPContextEventQueue::ClearQueuedEvents()
+    {
+    const TInt eventCount =  iEvents.Count();
+    for( TInt ix = 0; ix < eventCount ; ix++ )
+        {
+        iEvents[ ix ]->Close();
+        }
+
+    iEvents.Reset();
+    if( iNextEventToGo )
+        {
+        iNextEventToGo->Close();
+        iNextEventToGo = NULL;
+        }
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/core/srcprocessor/ximpcontexteventqueue.h	Wed Nov 03 09:32:20 2010 +0530
@@ -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: implementation of CXIMPContextEventQueue
+ *
+*/
+
+#ifndef XIMPCONTEXTEVENTQUEUE_H
+#define XIMPCONTEXTEVENTQUEUE_H
+
+#include <e32base.h>
+#include <ximpbase.h>
+
+class CXIMPEventCapsule;
+class CXIMPContextEventFilter;
+class MXIMPEventQueueObserver;
+class CXIMPApiEventBase;
+class CXIMPRequestCompleteEventImp;
+
+/**
+ * Event queue for client to process.
+ */
+class CXIMPContextEventQueue : public CBase
+    {
+public:     // Constructors and destructors
+
+    /**
+     * Construction
+     */
+    IMPORT_C static CXIMPContextEventQueue* NewL();
+    
+    /**
+     * Destruction
+     */
+    ~CXIMPContextEventQueue();
+
+protected:  // Constructors
+
+    /**
+     * Construction
+     */
+    CXIMPContextEventQueue();
+
+    /**
+     * Construction
+     */
+    void ConstructL();
+
+public: // New functions
+
+    /**
+     * Set event filter for filtering events
+     * @param aFilter New filter.
+     */
+    IMPORT_C void SetEventFilter( CXIMPContextEventFilter& aFilter );
+    
+    /**
+     * Start consuming events.
+     * @param aQueueObserver Observer to notify when event is ready
+     */
+    IMPORT_C void StartConsuming( MXIMPEventQueueObserver& aQueueObserver );
+    
+    /**
+     * Stop event consuming.
+     */
+    IMPORT_C void StopConsuming();
+
+    /**
+     * Check if there is elements.
+     */
+    IMPORT_C TBool HasElements() const;
+    IMPORT_C void SelectTopEventIfNeededL();
+    IMPORT_C const TDesC8& TopEventDataL();
+    IMPORT_C TXIMPRequestId TopEventReqIdL();
+    IMPORT_C void DropTopEvent();
+
+    /** 
+     * Add new event to queue.
+     */
+    void AddEventL( CXIMPEventCapsule& aEvent );
+    
+    /**
+     * Activate new request complete event to queue.
+     * @param aEvent Event to activate.
+     */
+    void ActivateRequestCompleteEvent( CXIMPRequestCompleteEventImp& aEvent );
+    
+    /**
+     * Remove request complete event from queue
+     * @param aEvent Event to remove
+     */
+    void RemoveRequestCompleteEvent( CXIMPRequestCompleteEventImp& aEvent );
+    
+    /**
+     * Activate preserved event for sending.
+     */
+    void ActivatePreservedEventL( CXIMPApiEventBase& aEvent );
+
+    /**
+     * Get id of queue.
+     * @return Id of queue.
+     */
+    inline TUint32 SessionIdOfQueue() const { return iId; }
+    
+    /**
+     * Set id of queue
+     * @param aId Id of queue.
+     */
+    inline void SetSessionIdOfQueue( TUint32 aId ) { iId = aId; }
+
+private:    // Helpers
+
+    /**
+     * Clear queued events.
+     */
+    void ClearQueuedEvents();
+    
+    /**
+     * Add new preserved event to queue.
+     */
+    void AddPreservedEventL( CXIMPApiEventBase& aEvent );
+    
+    /**
+     * Find next ready event from array. Timestamp is used to choose first one.
+     * iNextEventToGo is filled with oldest event. iNextEventToGo can be filled
+     * with reference event before call.
+     * @param aArray. Array of events to choose.
+     * @return Index of found event in array
+     */ 
+    TInt FindNextEvent( RPointerArray< CXIMPEventCapsule >& aArray );
+    
+private:    // Data
+
+    /**
+     * Queue ID.
+     */
+    TUint32 iId;
+
+    /**
+     * Events array. Reference to events own.
+     */
+    RPointerArray< CXIMPEventCapsule > iEvents;
+    
+    /** 
+     * Preserved events array. Reference to events own.
+     */
+    RPointerArray< CXIMPEventCapsule > iPreservedEvents;
+    
+    /**
+     * Request complete events waiting for completion.
+     */
+    RPointerArray< CXIMPEventCapsule > iRequestCompleteEvents;    
+
+    /**
+     * Event filter. Own.
+     */
+    CXIMPContextEventFilter* iEventFilter;
+
+    /**
+     * Queue observer. Ref.
+     */
+    MXIMPEventQueueObserver* iObserver;
+
+    /**
+     * Helper variable to contain next event to go.
+     */
+    CXIMPEventCapsule* iNextEventToGo;
+    
+    /**
+     * Timestamp for events.
+     */
+    TUint32 iTimeStamp;
+
+    };
+
+#endif      //  XIMPCONTEXTEVENTQUEUE_H
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/core/srcprocessor/ximpeventcapsule.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,183 @@
+/*
+* 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:  Event capsulation for shared ownership.
+*
+*/
+
+#include "ximpeventcapsule.h"
+#include "ximpeventcodec.h"
+#include "ximpapieventbase.h"
+#include "ximprbufhelpers.h"
+#include <ximprequestcompleteevent.h>
+
+
+// ---------------------------------------------------------------------------
+// CXIMPEventCapsule::NewL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CXIMPEventCapsule* CXIMPEventCapsule::NewL( CXIMPApiEventBase& aEvent,
+                                                     TBool aEventReady /* = ETrue */ )
+    {
+    CXIMPEventCapsule* self = new( ELeave ) CXIMPEventCapsule( aEventReady );
+    CleanupClosePushL( *self );
+    self->ConstructL( aEvent );
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPEventCapsule::~CXIMPEventCapsule
+// ---------------------------------------------------------------------------
+//
+CXIMPEventCapsule::~CXIMPEventCapsule()
+    {
+    iEventBuf.Close();
+    delete iBuffer;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPEventCapsule::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void CXIMPEventCapsule::ConstructL( CXIMPApiEventBase& aEvent )
+    {
+    iReqId = TXIMPRequestId::Null();
+    
+    iBuffer = CBufFlat::NewL( 10 ); // initial granularity to 10
+    XIMPEventCodec::PackL( aEvent, iEventType, iBuffer );
+    iEventBuf.CreateL( iBuffer->Ptr( 0 ) );
+    
+    InitReqId( aEvent );
+    }
+
+// ---------------------------------------------------------------------------
+// CXIMPEventCapsule::CXIMPEventCapsule()
+// ---------------------------------------------------------------------------
+//
+CXIMPEventCapsule::CXIMPEventCapsule( TBool aEventReady )
+: iEventReady( aEventReady )
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPEventCapsule::EventData()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C const TDesC8& CXIMPEventCapsule::EventData() const
+    {
+    return iEventBuf;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPEventCapsule::EventData()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TXIMPRequestId CXIMPEventCapsule::EventReqId() const
+    {
+    return iReqId;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPEventCapsule::EventType()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt32 CXIMPEventCapsule::EventType() const
+    {
+    return iEventType;
+    }
+
+    
+// ---------------------------------------------------------------------------
+// CXIMPEventCapsule::Ready()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TBool CXIMPEventCapsule::Ready() const
+    {
+    return iEventReady;
+    }
+
+// ---------------------------------------------------------------------------
+// CXIMPEventCapsule::UpdateEventDataL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CXIMPEventCapsule::UpdateEventDataL( CXIMPApiEventBase& aEvent )
+    {
+    XIMPEventCodec::PackL( aEvent, iEventType, iBuffer );
+    XIMPRBuf8Helper::SetNewValueL( iEventBuf, iBuffer->Ptr( 0 ) );
+    
+    InitReqId( aEvent );
+    }
+
+// ---------------------------------------------------------------------------
+// CXIMPEventCapsule::UpdateEventData()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CXIMPEventCapsule::UpdateEventData( CXIMPApiEventBase& aEvent )
+    { 
+    // If update fails old data is used.
+    TRAP_IGNORE(
+        UpdateEventDataL( aEvent );
+        )
+    }
+
+// ---------------------------------------------------------------------------
+// CXIMPEventCapsule::SetReady()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CXIMPEventCapsule::SetReady( TBool aReady )
+    {
+    iEventReady = aReady;
+    }
+
+// ---------------------------------------------------------------------------
+// CXIMPEventCapsule::operator<()
+// ---------------------------------------------------------------------------
+//
+TBool CXIMPEventCapsule::operator<( const CXIMPEventCapsule& aOther ) const
+    {
+    return iTimeStamp < aOther.iTimeStamp;
+    }
+    
+// ---------------------------------------------------------------------------
+// CXIMPEventCapsule::SetTimeStamp()
+// ---------------------------------------------------------------------------
+//
+void CXIMPEventCapsule::SetTimeStamp( TUint32 aTimeStamp )
+    {
+    iTimeStamp = aTimeStamp;
+    }
+    
+    
+// ---------------------------------------------------------------------------
+// CXIMPEventCapsule::InitReqId()
+// ---------------------------------------------------------------------------
+//
+void CXIMPEventCapsule::InitReqId( const CXIMPApiEventBase& aEvent )
+    {
+    if( aEvent.Base().GetInterfaceId() == MXIMPRequestCompleteEvent::KInterfaceId )
+        {
+        const MXIMPRequestCompleteEvent* complEvent =
+            TXIMPGetInterface< const MXIMPRequestCompleteEvent >::From( aEvent.Base(),
+                                                                        MXIMPBase::EPanicIfUnknown );
+        
+        iReqId = complEvent->RequestId();
+        }
+    }
+    
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/core/srcprocessor/ximpeventcapsule.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,146 @@
+/*
+* 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:  Event capsulation for shared ownership.
+*
+*/
+
+#ifndef CXIMPEVENTCAPSULE_H
+#define CXIMPEVENTCAPSULE_H
+
+#include <e32base.h>
+#include <ximpbase.h>
+
+class CXIMPApiEventBase;
+
+/**
+ * Event capsulation for shared ownership.
+ *
+ * @lib ximpprocessor.lib
+ * @since S60 v3.2
+ */
+class CXIMPEventCapsule : public CObject
+    {
+
+public:
+
+    /**
+     * Construction
+     * @aEvent. Event for capsulation. Ownership transferred.
+     */
+    IMPORT_C static CXIMPEventCapsule* NewL( CXIMPApiEventBase& aEvent, 
+                                             TBool aEventReady = ETrue );
+
+private:
+
+    /**
+     * Direct deletion not allowed.
+     * Deletion happens through reference counting.
+     */
+    ~CXIMPEventCapsule();
+    CXIMPEventCapsule( TBool aEventReady );
+    void ConstructL( CXIMPApiEventBase& aEvent );
+
+public: // new methods
+
+    /**
+     * Reference to capsulated event
+     * @return packed event.
+     */
+    IMPORT_C const TDesC8& EventData() const;
+
+
+    /**
+     * Req Id of capsulated event
+     * @return Req Id. If Capsuled event is 
+     *         some other type than RequestComplete event, 
+     *         then req id has TXIMPRequestId::Null() value. 
+     */
+    IMPORT_C TXIMPRequestId EventReqId() const;
+
+    /**
+     * Event type for filtering events.
+     * @return Event interface id.
+     */
+    IMPORT_C TInt32 EventType() const;
+    
+    /**
+     * Event is ready
+     * @return ETrue if event is ready. EFalse if not.
+     */
+    IMPORT_C TBool Ready() const;
+    
+    /**
+     * Update event data.
+     */
+    IMPORT_C void UpdateEventDataL( CXIMPApiEventBase& aEvent );
+    IMPORT_C void UpdateEventData( CXIMPApiEventBase& aEvent );
+    
+    /**
+     * Set event ready for sending.
+     */
+    IMPORT_C void SetReady( TBool aReady );   
+    
+    /**
+     * Check which one should be handled first.
+     */
+    TBool operator<( const CXIMPEventCapsule& aOther ) const;
+      
+    /**
+     * Set timestamp for order check.
+     */
+    void SetTimeStamp( TUint32 aTimeStamp );
+
+
+private: // Helpers
+    
+    /**
+     * Initializes the reg id member if the passed event is 
+     * req complete type.
+     */
+    void InitReqId( const CXIMPApiEventBase& aEvent );
+
+private: // Data
+
+    /**
+     * Capsulated event. Owns.
+     */
+    RBuf8 iEventBuf;
+
+    /**
+     * Event type for filtering
+     */
+    TInt32 iEventType;
+    
+    /**
+     * If event is not ready this is set as ETrue
+     */
+    TBool iEventReady;
+    
+    /**
+     * Used for packing.
+     */
+    CBufFlat* iBuffer;
+    
+    /**
+     * Time stamp for order.
+     */
+    TUint32 iTimeStamp;
+    
+    /**
+     * Request ID.
+     */
+    TXIMPRequestId iReqId;
+    };
+
+#endif //CXIMPEVENTCAPSULE_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/core/srcprocessor/ximpeventmanager.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  XIMP Framework server event manager implementation
+*
+*/
+
+#include "ximpeventmanager.h"
+#include "ximpeventcapsule.h"
+#include "ximpcontexteventqueue.h"
+#include "ximppsccontextimp.h"
+
+
+// ======== LOCAL FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// OrderOfEvents()
+// ---------------------------------------------------------------------------
+//
+TInt OrderOfEvents( const CXIMPContextEventQueue& aFirst, const CXIMPContextEventQueue& aSecond )
+    {
+    TUint32 firstSessionId = aFirst.SessionIdOfQueue();
+    TUint32 secondSessionId = aSecond.SessionIdOfQueue();
+    if( firstSessionId < secondSessionId )
+        {
+        return -1;
+        }
+    else if( firstSessionId == secondSessionId )
+        {
+        return 0;
+        }
+    else
+        {
+        return 1;
+        }
+    }
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// CXIMPEventManager::CXIMPHostManager()
+// ---------------------------------------------------------------------------
+//
+CXIMPEventManager::CXIMPEventManager()
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPEventManager::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void CXIMPEventManager::ConstructL()
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPEventManager::NewL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CXIMPEventManager* CXIMPEventManager::NewL()
+    {
+    CXIMPEventManager* self = new( ELeave ) CXIMPEventManager;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPEventManager::~CXIMPEventManager()
+// ---------------------------------------------------------------------------
+//
+CXIMPEventManager::~CXIMPEventManager()
+    {
+    iEventQueues.Close();
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPEventManager::RegisterSessionQueueL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CXIMPEventManager::RegisterSessionQueueL( CXIMPContextEventQueue& aQueue )
+    {
+    TLinearOrder< CXIMPContextEventQueue > order( *OrderOfEvents );
+    iEventQueues.InsertInOrderL( &aQueue, order );
+    }
+
+// ---------------------------------------------------------------------------
+// CXIMPEventManager::UnregisterSessionQueue()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CXIMPEventManager::UnregisterSessionQueue( CXIMPContextEventQueue& aQueue )
+    {
+    TLinearOrder< CXIMPContextEventQueue > order( *OrderOfEvents );
+    TInt index = iEventQueues.FindInOrder( &aQueue, order );
+    if( index >= 0 )
+        {
+        iEventQueues.Remove( index );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CXIMPEventManager::AddEventL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CXIMPEventManager::AddEventL( CXIMPApiEventBase& aEvent, 
+                                           CXIMPPscContext* aContext  )
+    {
+    if( aContext )
+        {
+        RPointerArray< CXIMPPscContext > array;
+        CleanupClosePushL( array );
+        array.AppendL( aContext );
+        AddEventL( aEvent, array );
+        CleanupStack::PopAndDestroy(); // array
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CXIMPEventManager::ActivateEventL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CXIMPEventManager::ActivateEventL( CXIMPApiEventBase& aEvent, 
+                                                CXIMPPscContext* aContext  )
+    {
+    if( aContext )
+        {
+        aContext->EventQueue().ActivatePreservedEventL( aEvent );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CXIMPEventManager::ActivateRequestCompleteEvent()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CXIMPEventManager::ActivateRequestCompleteEvent( CXIMPRequestCompleteEventImp& aEvent, 
+                                                CXIMPPscContext* aContext  )
+    {
+    if( aContext )
+        {
+        aContext->EventQueue().ActivateRequestCompleteEvent( aEvent );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CXIMPEventManager::AddEventL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CXIMPEventManager::AddEventL( CXIMPApiEventBase& aEvent, 
+                                           RPointerArray< CXIMPPscContext >& aSessions )
+    {
+    CXIMPEventCapsule* capsulatedEvent = CXIMPEventCapsule::NewL( aEvent );
+    CleanupClosePushL( *capsulatedEvent );
+    TInt sessionCount = aSessions.Count();
+    for( TInt a = 0; a < sessionCount; ++a )
+        {
+        aSessions[ a ]->EventQueue().AddEventL( *capsulatedEvent );
+        }
+    CleanupStack::PopAndDestroy( capsulatedEvent );
+    }
+
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/core/srcprocessor/ximpeventmanager.h	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  XIMP Framework server event manager implementation
+*
+*/
+
+#ifndef C_PSCEVENTMANAGER_H
+#define C_PSCEVENTMANAGER_H
+
+
+#include "ximpbase.h"
+#include <e32base.h>
+
+class CXIMPContextEventQueue;
+class CXIMPApiEventBase;
+class CXIMPPscContext;
+class CXIMPRequestCompleteEventImp;
+
+/**
+ * Event handling.
+ *
+ * @since S60 v4.0
+ */
+class CXIMPEventManager : public CBase
+    {
+
+public:
+
+    /**
+     * Construction
+     */
+    IMPORT_C static CXIMPEventManager* NewL();
+
+    /**
+     * Destruction
+     */
+    virtual ~CXIMPEventManager();
+
+private:
+
+    /** 
+     * Construction
+     */
+    CXIMPEventManager();
+    
+    /** 
+     * Construction
+     */
+    void ConstructL();
+
+
+public: // New methods
+
+    /**
+     * Register session queue.
+     * @param aQueue Session queue for registration.
+     */
+    IMPORT_C void RegisterSessionQueueL( CXIMPContextEventQueue& aQueue );
+    
+    /**
+     * Unregister session by id.
+     * @param aSessionId, Session id for unregistration.
+     */
+    IMPORT_C void UnregisterSessionQueue( CXIMPContextEventQueue& aQueue );
+    
+    /**
+     * Add event to session.
+     * @param aEvent Event to add.
+     * @param aSessionId, Session that receives event.
+     */
+    IMPORT_C void AddEventL( CXIMPApiEventBase& aEvent, CXIMPPscContext* aContext  );
+    IMPORT_C void ActivateEventL( CXIMPApiEventBase& aEvent, CXIMPPscContext* aContext  );
+    IMPORT_C void ActivateRequestCompleteEvent( CXIMPRequestCompleteEventImp& aEvent, 
+                                                CXIMPPscContext* aContext );
+
+    /**
+     *  Add event to session.
+     * @param aEvent Event to add.
+     * @param aSessionId, Array of sessions that receives event.
+     */
+    IMPORT_C void AddEventL( CXIMPApiEventBase& aEvent, 
+                             RPointerArray< CXIMPPscContext >& aSessions );
+private: // data
+
+    /**
+     * Array of event queues. 
+     * Does not own items.
+     */
+    RPointerArray< CXIMPContextEventQueue > iEventQueues;
+    };
+
+
+#endif // C_PSCEVENTMANAGER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/core/srcprocessor/ximpeventqueueobserver.h	Wed Nov 03 09:32:20 2010 +0530
@@ -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: Observer for Event queue 
+*
+*/
+
+#ifndef MXIMPEVENTQUEUEOBSERVER_H
+#define MXIMPEVENTQUEUEOBSERVER_H
+
+#include <e32std.h>
+
+/**
+ * Event queue observer.
+ *
+ * @since S60 v3.2
+ */
+class MXIMPEventQueueObserver
+    {
+protected:
+
+    /**
+     * Protected destructor. Observer instancies
+     * can't be destroyed via this interface.
+     */
+    virtual ~MXIMPEventQueueObserver() {}
+
+public:
+
+    /**
+     * Notifies observer that new event was
+     * added to event queue and it is
+     * available for observer consumption.
+     */
+    virtual void NewEventAvailable() = 0;
+
+    };
+
+#endif // MXIMPEVENTQUEUEOBSERVER_H
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/core/srcprocessor/ximpfeaturemanager.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,103 @@
+/*
+* 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:  feature manager of XIMP
+*
+*/
+
+
+#include "ximpfeaturemanager.h"
+#include "ximpfeatureinfoimp.h"
+#include "ximpobjecthelpers.h"
+
+#include <centralrepository.h>
+
+// ======== LOCAL FUNCTIONS ========
+
+
+// ======== MEMBER FUNCTIONS ========
+
+
+// ---------------------------------------------------------------------------
+// ?description_if_needed
+// ---------------------------------------------------------------------------
+//
+CXIMPFeatureManager::CXIMPFeatureManager()
+    {
+
+    }
+
+
+// ---------------------------------------------------------------------------
+// ?description_if_needed
+// ---------------------------------------------------------------------------
+//
+void CXIMPFeatureManager::ConstructL()
+    {
+    //iCenRep = CRepository::NewL();
+    }
+
+
+// ---------------------------------------------------------------------------
+// ?description_if_needed
+// ---------------------------------------------------------------------------
+//
+CXIMPFeatureManager* CXIMPFeatureManager::NewL()
+    {
+    CXIMPFeatureManager* self = new( ELeave ) CXIMPFeatureManager;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+
+// ---------------------------------------------------------------------------
+// ?description_if_needed
+// ---------------------------------------------------------------------------
+//
+CXIMPFeatureManager::~CXIMPFeatureManager()
+    {
+    //delete iCenRep;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CXIMPFeatureManager::GetProtocolsL()
+// -----------------------------------------------------------------------------
+//
+EXPORT_C HBufC8* CXIMPFeatureManager::GetFrameworkFeaturesL()
+    {
+    CXIMPFeatureInfoImp* featInfo = CXIMPFeatureInfoImp::NewLC();
+    
+    /*
+    TInt featuresLength( KErrNotFound );
+    iCenRep->Get( 0x1, featuresLength );
+    
+    HBufC8* tmpBuffer = HBufC8::NewLC( featuresLength );
+	TPtr8 tmpPtr( tmpBuffer->Des() );
+	iCenRep->Get( 0x2, tmpPtr );
+
+    featInfo->AddFeatureL( tmpPtr );
+    
+    CleanupStack::PopAndDestroy( tmpBuffer );
+    */
+
+    HBufC8* pack = TXIMPObjectPacker< CXIMPFeatureInfoImp >::PackL( *featInfo );    
+    CleanupStack::PopAndDestroy( featInfo ); 
+
+    return pack;
+    }
+    
+// End of file
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/core/srcprocessor/ximpfeaturemanager.h	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  implementation of CXIMPFeatureManager
+*
+*/
+
+#ifndef C_CPSCFEATUREMANAGER_H
+#define C_CPSCFEATUREMANAGER_H
+
+
+#include <e32base.h>
+
+class CRepository;
+
+/**
+ * ?one_line_short_description
+ *
+ * ?more_complete_description
+ *
+ * @lib ?library
+ * @since S60 v4.0
+ */
+class CXIMPFeatureManager : public CBase
+    {
+
+public:
+
+    static CXIMPFeatureManager* NewL();
+
+
+    virtual ~CXIMPFeatureManager();
+
+
+private:
+
+    CXIMPFeatureManager();
+    void ConstructL();
+
+
+public:
+
+    /**
+     * ?description
+     *
+     * @since S60 ?S60_version
+     * @param ?arg1 ?description
+     * @param ?arg2 ?description
+     * @return ?description
+     */
+    IMPORT_C HBufC8* GetFrameworkFeaturesL();
+
+
+private:
+
+
+private: // data
+
+    /**
+     * ?description_of_member
+     */
+    //?type ?member_name;
+
+    /**
+     * Pointer to a cenrep client
+     * Own. 
+     */
+    CRepository* iCenRep;
+
+    /**
+     * ?description_of_pointer_member
+     * Not own.  *** Write "Not own" if some other class owns this object.
+     */
+    //?type* ?member_name;
+
+    };
+
+
+#endif // C_CPSCFEATUREMANAGER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/core/srcprocessor/ximpglobals.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  Presence Service Connection globals holder
+ *
+*/
+
+
+#include "ximpglobals.h"
+#include "ximppluginfactory.h"
+#include "ximpfeaturemanager.h"
+#include "ximphostmanager.h"
+#include "ximpoperationfactory.h"
+#include "ximpglobalsobserver.h"
+
+// ============================ HELPER CLASS ===============================
+
+
+/**
+ * CXIMPGlobals nested structure
+ * to hold global objects.
+ */
+NONSHARABLE_STRUCT( CXIMPGlobals::SGlobals )
+    {
+    /**
+     * Plugin Factory
+     * Owned.
+     */
+    CXIMPPluginFactory* iPluginFactory;
+
+    /**
+     * Feature Manager
+     * Owned.
+     */
+    CXIMPFeatureManager* iFeatureManager;
+
+    /**
+     * Host Manager
+     * Owned.
+     */
+    CXIMPHostManager* iHostManager;
+
+    /** 
+     * Operation factory
+     * Owned.
+     */
+    MXIMPOperationFactory* iOperationFactory;
+
+    /**
+     * Observer for events from globals.
+     * Only internal hostmanager notifications for now.
+     * Not owned.
+     */
+    MXIMPGlobalsObserver* iGlobalsObserver;
+    };
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CXIMPGlobals::InstallL()
+// Singleton access method.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CXIMPGlobals::InstallL( 
+        MXIMPOperationFactory* aOperationFactory,
+        MXIMPGlobalsObserver* aGlobalsObserver
+        )
+    {
+    CXIMPGlobals* singleton = ( CXIMPGlobals* ) Dll::Tls();
+
+    if( !singleton )
+        {
+        singleton = CXIMPGlobals::NewLC( aOperationFactory, aGlobalsObserver );
+        User::LeaveIfError( Dll::SetTls( singleton ) );
+        CleanupStack::Pop( singleton );
+        }
+    else
+        {
+        User::Panic( _L("cximpglobals"), KErrAlreadyExists );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CXIMPGlobals::Instance()
+// Singleton access method.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CXIMPGlobals* CXIMPGlobals::Instance()
+    {
+    CXIMPGlobals* singleton = ( CXIMPGlobals* ) Dll::Tls();
+    if( !singleton )
+        {
+        User::Panic( _L("cximpglobals"), KErrNotFound );
+        }
+
+    return singleton;
+    }
+
+// -----------------------------------------------------------------------------
+// CXIMPGlobals::Uninstall()
+// Singleton access method.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CXIMPGlobals::UninstallD()
+    {
+    delete ( CXIMPGlobals* ) Dll::Tls();
+    }
+
+// -----------------------------------------------------------------------------
+// CXIMPGlobals::NewLC()
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CXIMPGlobals* CXIMPGlobals::NewLC( MXIMPOperationFactory* aOperationFactory,
+        MXIMPGlobalsObserver* aGlobalsObserver
+        )
+    {
+    CXIMPGlobals* self = new( ELeave ) CXIMPGlobals;
+    CleanupStack::PushL( self );
+    self->ConstructL( aOperationFactory, aGlobalsObserver );
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CXIMPGlobals::CXIMPGlobals()
+// -----------------------------------------------------------------------------
+//
+CXIMPGlobals::CXIMPGlobals()
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CXIMPGlobals::~CXIMPGlobals()
+// -----------------------------------------------------------------------------
+//
+CXIMPGlobals::~CXIMPGlobals()
+    {
+    //Destroy global objects
+    if( iGlobals )
+        {
+        delete iGlobals->iPluginFactory;
+        delete iGlobals->iFeatureManager;
+        delete iGlobals->iHostManager;
+        delete iGlobals->iOperationFactory;
+        }
+
+    //And the holder
+    delete iGlobals;
+    Dll::SetTls( NULL );
+    
+    #if _BullseyeCoverage
+    cov_write();
+    #endif
+    }
+
+// -----------------------------------------------------------------------------
+// CXIMPGlobals::ConstructL()
+// -----------------------------------------------------------------------------
+//
+void CXIMPGlobals::ConstructL( 
+        MXIMPOperationFactory* aOperationFactory,
+        MXIMPGlobalsObserver* aGlobalsObserver
+        )
+    {
+    //Reserve the object holder and zero initialize it
+    iGlobals = new ( ELeave ) SGlobals;
+    Mem::FillZ( iGlobals, sizeof( SGlobals ) );
+
+    //Construct needed global objects
+    iGlobals->iPluginFactory = CXIMPPluginFactory::NewL();
+    iGlobals->iFeatureManager = CXIMPFeatureManager::NewL();
+    iGlobals->iHostManager = CXIMPHostManager::NewL();
+    if( !aOperationFactory )
+        {
+        User::Leave( KErrArgument );
+        }
+
+    iGlobals->iOperationFactory = aOperationFactory;
+    iGlobals->iGlobalsObserver = aGlobalsObserver;
+    }
+
+
+EXPORT_C CXIMPPluginFactory* CXIMPGlobals::PluginFactory()
+       {
+       return iGlobals->iPluginFactory;
+       }
+
+
+EXPORT_C CXIMPFeatureManager* CXIMPGlobals::FeatureManager()
+       {
+       return iGlobals->iFeatureManager;
+       }
+
+EXPORT_C CXIMPHostManager* CXIMPGlobals::HostManager()
+    {
+    return iGlobals->iHostManager;
+    }
+    
+EXPORT_C MXIMPOperationFactory* CXIMPGlobals::OperationFactory()
+    {
+    return iGlobals->iOperationFactory;
+    }
+
+EXPORT_C void CXIMPGlobals::NoMoreHosts()
+    {
+    // inform the observer (PscServer) about host dying.
+    iGlobals->iGlobalsObserver->AllHostsDied();
+    }    
+
+// End of file
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/core/srcprocessor/ximpglobals.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,115 @@
+/*
+* 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 Service Connection globals holder
+ *
+*/
+
+#ifndef CPSCGLOBALS_H
+#define CPSCGLOBALS_H
+
+#include <e32base.h>
+
+class CXIMPPluginFactory;
+class CXIMPFeatureManager;
+class CXIMPHostManager;
+class MXIMPOperationFactory;
+class MXIMPGlobalsObserver;
+
+/**
+ * Singleton for XIMP Framework client IF library.
+ *
+ * @lib ximpprocessor.dll
+ * @since S60 v4.0
+ */
+class CXIMPGlobals : public CBase
+    {
+    private:
+
+        /** Private nested structure to hold global objects */
+        struct SGlobals;
+
+    public:  // singleton access
+
+        /**
+         * Singleton access method.
+         *
+         * Gets pointer to Psc Globals singleton.
+         *
+         */
+        IMPORT_C static CXIMPGlobals* Instance();
+
+        IMPORT_C static void InstallL( MXIMPOperationFactory* aOperationFactory, MXIMPGlobalsObserver* aGlobalsObserver );
+
+        IMPORT_C static void UninstallD();
+
+    private:
+
+        /**
+         * Two-phased constructor.
+         * Leaves created object on the CleanupStack.
+         */
+        static CXIMPGlobals* NewLC( MXIMPOperationFactory* aOperationFactory,
+               MXIMPGlobalsObserver* aGlobalsObserver );
+
+        
+        /**
+         * C++ default constructor.
+         */
+        CXIMPGlobals();
+
+        
+        /**
+         * Private destructor.
+         *
+         * Singleton holder is reference counted.
+         * It is automaticly destroyed when last
+         * holded object or reference is destroyed.
+         */
+        ~CXIMPGlobals();
+
+        /**
+         * Symbian 2nd phase constructor
+         */
+        void ConstructL( MXIMPOperationFactory* aOperationFactory,
+                MXIMPGlobalsObserver* aGlobalsObserver );
+
+    public:
+
+        IMPORT_C CXIMPPluginFactory* PluginFactory();
+        IMPORT_C CXIMPFeatureManager* FeatureManager();
+        IMPORT_C CXIMPHostManager* HostManager();       
+        IMPORT_C MXIMPOperationFactory* OperationFactory();
+
+        /**
+         * Host manager informs the globals that there are no more hosts.
+         * This is signalled to the server. The point is to keep the
+         * server alive for the right time.
+         */
+        IMPORT_C void NoMoreHosts();
+
+        // IMPORT_C CPscVariant* PscVariant);
+
+    private:    // Data
+
+        /**
+         * Object holder having pointers to global objects.
+         * Both holder and pointed objects owned.
+         */
+        SGlobals* iGlobals;
+
+    };
+
+#endif      // CPSCGLOBALS_H
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/core/srcprocessor/ximpglobalsobserver.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,44 @@
+/*
+* 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 Service Connection observer for events from Globals
+ *
+*/
+
+
+#ifndef XIMPCPSCGLOBALSOBSERVER_H
+#define XIMPCPSCGLOBALSOBSERVER_H
+
+#include <e32base.h>
+
+/**
+ * Observer interface for events originating from the singleton "globals"
+ * holder.
+ *
+ * @lib ximpoperation.dll
+ * @since S60 v4.0
+ */
+class MXIMPGlobalsObserver
+    {
+    public:
+
+		/**
+		 * Signal about host deletion.
+         * The server can shutdown itself after this.
+	 	 */
+		virtual void AllHostsDied() = 0;
+    };
+
+#endif      // XIMPCPSCGLOBALSOBSERVER_H
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/core/srcprocessor/ximphostimp.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,1104 @@
+/*
+* 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 connection host
+ *
+*/
+
+#include <ximpprotocolconnection.h>
+#include <ximpprotocolconnectionhostobserver.h>
+
+#include "ximpapiobjbase.h"
+#include "ximpstatusimp.h"
+#include "ximpoperationbase.h"
+#include "ximphostimp.h"
+#include "ximpglobals.h"
+#include "ximppluginfactory.h"
+#include "ximpeventmanager.h"
+#include "ximphoststates.h"
+#include "ximpcontextstateeventimp.h"
+#include "ximpobjectfactoryimp.h"
+#include "ximppanics.h"
+#include "ximppsccontextimp.h"
+#include "presencedatacacheimp.h"
+#include "ximpserviceinfoimp.h"
+#include "ximpoperationbase.h"
+#include "ximpoperationfactory.h"
+#include "ximpoperationfactory1.h"
+#include "ximpobjecthelpers.h"
+#include "ximpoperationdefs.h"
+#include "ximpcontexteventqueue.h"
+#include "ximphostmanager.h"
+#include "ximpidentityimp.h"
+#include "ximprestrictedobjectcollectionimp.h"
+#include "ximprequestcompleteeventimp.h"
+#include "ximpcontextclientinfoimp.h"
+
+#include "protocolpresencedatahostimp.h"
+
+#include "protocolpresenceauthorizationdatahostimp.h"
+#include "protocolpresencepublishingdatahostimp.h"
+#include "protocolpresencewatchingdatahostimp.h"
+#include "protocolpresentitygroupsdatahostimp.h"
+#include "ximpprotocolrequestcompleteeventimp.h"
+
+#include <protocoldatahost.h>
+
+#include "ximpdlluids.hrh"
+#include "ximptrace.h"
+
+// TODO: illegal dependency to presence operations
+#include "presenceoperationdefs.h"
+
+// ======== LOCAL FUNCTIONS ========
+const TInt KPluginArrayGranularity = 3;
+
+
+// ---------------------------------------------------------------------------
+// OrderOfObservers()
+// ---------------------------------------------------------------------------
+//
+TInt OrderOfObservers( const MXIMPProtocolConnectionHostObserver& aA, 
+                       const MXIMPProtocolConnectionHostObserver& aB )
+    {
+    if( &aA < &aB )
+        {
+        return -1;
+        }
+    else if( &aA > &aB )
+        {
+        return 1;
+        }
+    return 0;
+    }
+
+// ======== MEMBER FUNCTIONS ========
+
+using namespace NXIMPHost;
+
+// This should be variated. Branding variation can be one
+// possibility. One is to leave adaptation deside how soon
+// cleanup will be done.
+// Now 5 sec used for testing purposes. Better value could be
+// some minutes.
+const TInt KPscHostCleanerTimerLength = 5; // in sec
+
+// ---------------------------------------------------------------------------
+// CXIMPHost::CXIMPHost()
+// ---------------------------------------------------------------------------
+//
+CXIMPHost::CXIMPHost( MXIMPProtocolConnection& aConnection, TInt32 aProtocolUid  )
+: iConnection( aConnection ), iProtocolUid( aProtocolUid )
+    {
+    iState = NXIMPHost::EXIMPNotConnected;
+
+    iHostOriginatedOpIndex = 1;
+
+    iReferences = 1;
+    
+    iReqIdBuilder.SetSessionId( (unsigned) this );
+    
+    iForcedTearDown = EFalse;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPHost::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void CXIMPHost::ConstructL()
+    {
+    iObjFactory = CXIMPObjectFactoryImp::NewL();
+    iEventManager = CXIMPEventManager::NewL();
+    
+    iPresenceDataHost = CProtocolPresenceDataHostImp::NewL( *this );
+
+    iDataHostArray = new(ELeave)CArrayFixFlat<MProtocolDataHost*>(KPluginArrayGranularity);
+    
+    LoadDataHostArrayL() ;
+    
+/*    iDataCache = CPresenceDataCache::NewL( *this );
+    iAuthDataHost = CProtocolPresenceAuthorizationDataHostImp::NewL( *this );
+    iPublishingDataHost = CProtocolPresencePublishingDataHostImp::NewL( *this );
+    iWatchingDataHost = CProtocolPresenceWatchingDataHostImp::NewL( *this );
+    iGroupsDataHost = CProtocolPresentityGroupsDataHostImp::NewL( *this );
+*/
+    iCleanerTimer = CPeriodic::NewL( CActive::EPriorityStandard );
+
+    for ( int i = 0;i < 5;i++ )
+        {
+        iCallBack.Append( new ( ELeave ) CAsyncCallBack( CActive::EPriorityHigh ) );
+        }
+    
+    iCallBack[ECompleteRequestCallback]->Set( TCallBack( CompleteRequestCallback, this ) );
+    iCallBack[ECompleteAdaptationRequestCallback]->Set( TCallBack( CompleteAdaptationRequestCallback, this ) );
+    iCallBack[ECompleteSessionMgmtRequestCallback]->Set( TCallBack( CompleteSessionMgmtRequestCallback, this ) );
+    iCallBack[ECompleteInternalRequestCallback]->Set( TCallBack( CompleteInternalRequestCallback, this ) );
+    iCallBack[EStartProcessCallback]->Set( TCallBack( StartProcessCallback, this ) );
+    
+    iAdaptationReqCompleteEvent = CXIMPProtocolRequestCompleteEventImp::NewL();
+
+    StartCleanerTimer();
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPHost::NewLC()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CXIMPHost* CXIMPHost::NewLC( MXIMPProtocolConnection& aConnection, TInt32 aProtocolUid  )
+    {
+    CXIMPHost* self = new( ELeave ) CXIMPHost( aConnection, aProtocolUid );
+    CleanupClosePushL( *self );
+    self->ConstructL();
+    return self;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPHost::~CXIMPHost()
+// ---------------------------------------------------------------------------
+//
+CXIMPHost::~CXIMPHost()
+    {
+    __ASSERT_ALWAYS( iReferences == 0, User::Panic( NXIMPPrivPanic::KCategory, NXIMPPrivPanic::EHostStillReferenced ) );
+
+    delete iCleanerTimer;
+
+    delete iObjFactory;
+    iOperations.Close();
+    delete iEventManager;
+    __ASSERT_ALWAYS( iCurrentOperation == 0,
+                User::Panic( NXIMPPrivPanic::KCategory, NXIMPPrivPanic::EHostCurrentOperationStillActive ) );
+    iRegSessions.Close();
+
+    delete iPresenceDataHost;
+
+    if ( iDataHostArray )
+    {
+    	TInt idx = KErrNotFound;
+    	while( iDataHostArray->Count() )
+        {
+	        idx = iDataHostArray->Count() - 1;
+	        // Delete object
+	        delete iDataHostArray->At( idx );
+	        // Delete element
+	        iDataHostArray->Delete( idx );
+        }
+    }
+    delete iDataHostArray;
+
+  /*  delete iDataCache;
+    delete iAuthDataHost;
+    delete iPublishingDataHost;
+    delete iWatchingDataHost;
+    delete iGroupsDataHost;
+*/
+    // delete iCallBack;
+    iCallBack.ResetAndDestroy();
+
+    CXIMPGlobals::Instance()->HostManager()->DisassociateHost( this );
+    
+    delete iAdaptationReqCompleteEvent;
+    iConnectionHostObservers.Reset();
+    }
+
+// ---------------------------------------------------------------------------
+// CXIMPHost::Open()
+// ---------------------------------------------------------------------------
+//
+void CXIMPHost::Open()
+    {
+    iReferences++;
+    }
+
+// ---------------------------------------------------------------------------
+// CXIMPHost::Close()
+// ---------------------------------------------------------------------------
+//
+void CXIMPHost::Close()
+    {
+    __ASSERT_ALWAYS( iReferences >= 0, User::Panic( NXIMPPrivPanic::KCategory, NXIMPPrivPanic::EHostNegativeReferenceCount ));
+
+    iReferences--;
+
+    if ( iReferences <= 0 )
+        {
+        delete this;
+        }
+    }
+
+
+// ---------------------------------------------------------------------------
+// Implement supported interface access.
+// ---------------------------------------------------------------------------
+//
+XIMPIMP_IF_BASE_GET_INTERFACE_BEGIN( CXIMPHost, MXIMPProtocolConnectionHost )
+XIMPIMP_IF_BASE_GET_INTERFACE_END()
+XIMPIMP_IF_BASE_GET_CONST_INTERFACE_BEGIN( CXIMPHost, MXIMPProtocolConnectionHost )
+XIMPIMP_IF_BASE_GET_INTERFACE_END()
+
+
+
+// ---------------------------------------------------------------------------
+// CXIMPHost::ObjectFactory()
+// ---------------------------------------------------------------------------
+//
+MXIMPObjectFactory& CXIMPHost::ObjectFactory()
+    {
+    return *iObjFactory;
+    }
+
+// ---------------------------------------------------------------------------
+// From MXIMPProtocolConnectionHost class.
+// CXIMPHost::AuthorizationDataHost()
+// ---------------------------------------------------------------------------
+//
+MProtocolPresenceDataHost& CXIMPHost::ProtocolPresenceDataHost()
+    {
+    return *iPresenceDataHost;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPHost::RegisterObserverL()
+// ---------------------------------------------------------------------------
+//
+void CXIMPHost::RegisterObserverL(
+        MXIMPProtocolConnectionHostObserver& aObserver,
+        const TArray<TInt32>* aEventFilter /*= NULL*/ )
+    {
+    XIMP_UNUSED_FORMAL_PARAM( aEventFilter );
+    TLinearOrder< MXIMPProtocolConnectionHostObserver > order( *OrderOfObservers );
+    TInt error = iConnectionHostObservers.InsertInOrder( &aObserver, order );
+    if( error != KErrAlreadyExists )
+        {
+        User::LeaveIfError( error );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CXIMPHost::UnregisterConnectionHostObserver()
+// ---------------------------------------------------------------------------
+//
+void CXIMPHost::UnregisterConnectionHostObserver(
+        MXIMPProtocolConnectionHostObserver& aObserver )
+    {
+    TLinearOrder< MXIMPProtocolConnectionHostObserver > order( *OrderOfObservers );
+    TInt index = iConnectionHostObservers.FindInOrder( &aObserver, order );
+    if( index > KErrNotFound )
+        {
+        iConnectionHostObservers.Remove( index );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CXIMPHost::HandleRequestCompleted()
+// ---------------------------------------------------------------------------
+//
+void CXIMPHost::HandleRequestCompleted(
+    TXIMPRequestId aReqId,
+    TInt aResultCode )
+    {
+    CXIMPOperationBase& operation = OperationForRequestId( aReqId );
+
+    operation.SetResultCode( aResultCode );
+    CompleteRequest( aReqId );
+    }
+
+// ---------------------------------------------------------------------------
+// CXIMPHost::HandleRequestCompleted()
+// ---------------------------------------------------------------------------
+//
+void CXIMPHost::HandleRequestCompleted( TXIMPRequestId aReqId,
+                                       MXIMPStatus* aResult )
+    {
+    CXIMPOperationBase& operation = OperationForRequestId( aReqId );
+    
+    operation.SetStatus( aResult );
+    CompleteRequest( aReqId );
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPHost::HandleRequestCompleted()
+// ---------------------------------------------------------------------------
+//
+void CXIMPHost::HandleRequestCompleted( TXIMPRequestId aReqId,
+                                       MXIMPStatus* aResult,
+                                       MXIMPBase* aParameter )
+    {    
+    CXIMPOperationBase& operation = OperationForRequestId( aReqId );
+    
+    operation.SetObjectCollection( aParameter );
+    HandleRequestCompleted( aReqId, aResult );
+    }
+
+// ---------------------------------------------------------------------------
+// CXIMPHost::CompleteRequest()
+// ---------------------------------------------------------------------------
+//
+void CXIMPHost::CompleteRequest( TXIMPRequestId aReqId )
+    {
+    CXIMPOperationBase& operation = OperationForRequestId( aReqId );
+
+#ifdef _DEBUG
+	if ( operation.Context() )	
+		TRACE_2( _L("Operation completed for client \"%S\" with result code: %d"), 
+			 	&operation.Context()->ClientInfo()->ClientId().Identity(), 
+			 	operation.Status().ResultCode() );
+#endif			 
+			 
+    // iCallBack->Set( TCallBack( CompleteRequestCallback, this ) );
+    iCallBack[ECompleteRequestCallback]->CallBack();
+    }
+
+// ---------------------------------------------------------------------------
+// CXIMPHost::HandleConnectionTerminated()
+// ---------------------------------------------------------------------------
+//
+TXIMPRequestId CXIMPHost::HandleConnectionTerminated( MXIMPStatus* aReason )
+    {
+	TRACE_1( _L("CXIMPHost::HandleConnectionTerminated aReason = %d"), aReason );
+    // This should be set for operation as a reason.
+    XIMP_UNUSED_FORMAL_PARAM( aReason );
+/*
+    if ( iState != EXIMPConnected )
+        {
+        // we are not in a valid state
+        User::Panic( NXIMPPrivPanic::KCategory,
+                NXIMPPrivPanic::EInvalidStateForSessionLost );
+        }
+*/
+    TXIMPRequestId reqId;
+
+    // tear down
+    // we must run the cached unbinds to force teardown
+    // Right way to do this is using non leaving operation add. This can be done
+    // if operation queue is implemented as linked list. When operation queue is fixed
+    // assert should be removed.
+    TRAPD( error, reqId = AddNewOperationL( NXIMPOps::EXIMPForcedTeardown ) );
+    __ASSERT_ALWAYS( error == KErrNone, User::Panic( _L("HandleSessionLost"), -667 ) );
+
+    iForcedTearDown = ETrue;
+	
+    return reqId;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPHost::UnregisterSession()
+// ---------------------------------------------------------------------------
+//
+void CXIMPHost::UnregisterSession( CXIMPPscContext* aContext )
+    {
+    if( !aContext )
+        {
+        return;
+        }
+    iEventManager->UnregisterSessionQueue( aContext->EventQueue() );
+    TLinearOrder< CXIMPPscContext > order( *CXIMPPscContext::OrderOfContexts );
+    TInt index = iRegSessions.FindInOrder( aContext, order );
+    if( index >= 0 )
+        {
+        iPresenceDataHost->PresenceDataCache().CleanResources( *aContext );
+        iRegSessions.Remove( index );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CXIMPHost::FakeCompleteRequest()
+// ---------------------------------------------------------------------------
+//
+void CXIMPHost::FakeCompleteRequest( TXIMPRequestId aReqId, TInt aResult )
+    {
+    HandleRequestCompleted( aReqId, aResult );
+    }
+
+// ---------------------------------------------------------------------------
+// CXIMPHost::HandleAdaptationRequestCompleted()
+// ---------------------------------------------------------------------------
+//
+void CXIMPHost::HandleAdaptationRequestCompleted( TXIMPRequestId aReqId, TInt aResult )
+    {
+    CXIMPOperationBase& operation = OperationForRequestId( aReqId );
+    
+    operation.SetResultCode( aResult );
+    // iCallBack->Set( TCallBack( CompleteAdaptationRequestCallback, this ) );
+    iCallBack[ECompleteAdaptationRequestCallback]->CallBack();
+    }
+
+// ---------------------------------------------------------------------------
+// CXIMPHost::HandleSessionMgmtRequestCompleted()
+// ---------------------------------------------------------------------------
+//
+void CXIMPHost::HandleSessionMgmtRequestCompleted( TXIMPRequestId aReqId, TInt aResult )
+    {
+    CXIMPOperationBase& operation = OperationForRequestId( aReqId );
+
+    operation.SetResultCode( aResult );
+    // iCallBack->Set( TCallBack( CompleteSessionMgmtRequestCallback, this ) );
+    iCallBack[ECompleteSessionMgmtRequestCallback]->CallBack();
+    }
+
+// ---------------------------------------------------------------------------
+// CXIMPHost::HandleInternalRequestCompleted()
+// ---------------------------------------------------------------------------
+//
+void CXIMPHost::HandleInternalRequestCompleted( TXIMPRequestId aReqId, TInt aResult )
+    {
+    CXIMPOperationBase& operation = OperationForRequestId( aReqId );
+
+    operation.SetResultCode( aResult );
+    // iCallBack->Set( TCallBack( CompleteInternalRequestCallback, this ) );
+    iCallBack[ECompleteInternalRequestCallback]->CallBack();
+    }
+
+// ---------------------------------------------------------------------------
+// CXIMPHost::PresenceDataAccess()
+// ---------------------------------------------------------------------------
+//
+CProtocolPresenceDataHostImp& CXIMPHost::PresenceDataAccess()
+    {
+    return *iPresenceDataHost;
+    }
+
+// ---------------------------------------------------------------------------
+// CXIMPHost::DataAccess()
+// ---------------------------------------------------------------------------
+//
+/*CPresenceDataCache& CXIMPHost::DataAccess()
+    {
+    return *iDataCache;
+    }
+
+// ---------------------------------------------------------------------------
+// CXIMPHost::AuthorizationDataAccess()
+// ---------------------------------------------------------------------------
+//
+CProtocolPresenceAuthorizationDataHostImp& CXIMPHost::AuthorizationDataAccess()
+    {
+    return *iAuthDataHost;
+    }
+
+// ---------------------------------------------------------------------------
+// CXIMPHost::PublishingDataAccess()
+// ---------------------------------------------------------------------------
+//
+CProtocolPresencePublishingDataHostImp& CXIMPHost::PublishingDataAccess()
+    {
+    return *iPublishingDataHost;
+    }
+
+// ---------------------------------------------------------------------------
+// CXIMPHost::WatchingDataAccess()
+// ---------------------------------------------------------------------------
+//
+CProtocolPresenceWatchingDataHostImp& CXIMPHost::WatchingDataAccess()
+    {
+    return *iWatchingDataHost;
+    }
+
+// ---------------------------------------------------------------------------
+// CXIMPHost::GroupsDataAccess()
+// ---------------------------------------------------------------------------
+//
+CProtocolPresentityGroupsDataHostImp& CXIMPHost::GroupsDataAccess()
+    {
+    return *iGroupsDataHost;
+    }
+*/
+// ---------------------------------------------------------------------------
+// CXIMPHost::RegisterSessionL()
+// ---------------------------------------------------------------------------
+//
+void CXIMPHost::RegisterSessionL( CXIMPPscContext* aContext )
+    {
+    if( !aContext )
+        {
+        User::Leave( KErrArgument );
+        }
+    iEventManager->RegisterSessionQueueL( aContext->EventQueue() );
+    TLinearOrder< CXIMPPscContext > order( *CXIMPPscContext::OrderOfContexts );
+    TInt err = iRegSessions.InsertInOrder( aContext, order );
+    if( err != KErrNone )
+        {
+        iEventManager->UnregisterSessionQueue( aContext->EventQueue() );
+        User::Leave( err );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CXIMPHost::AddNewOperationL()
+// ---------------------------------------------------------------------------
+//
+void CXIMPHost::AddNewOperationL( CXIMPOperationBase& aOperation )
+    {
+    iOperations.AppendL( &aOperation );
+    aOperation.SetHost( *this );
+
+    if ( !iProcessing )
+        {
+        ActivateProcessing();
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CXIMPHost::AddNewOperationL()
+// ---------------------------------------------------------------------------
+//
+TXIMPRequestId CXIMPHost::AddNewOperationL( NXIMPOps::TXIMPOpTypes aOpType )
+    {
+    iReqIdBuilder.SetProtocolId( iProtocolUid );
+    iReqIdBuilder.SetRequestId( iAdaptationOperationIndex );
+    TXIMPRequestId reqId = iReqIdBuilder.BuildRequestId();
+
+    iAdaptationOperationIndex++;
+    CXIMPOperationBase* op =
+        CXIMPGlobals::Instance()->OperationFactory()->CreateOperationL( aOpType );
+    CleanupStack::PushL( op );
+    op->BaseConstructL( reqId, NULL );
+    op->ConstructL( KNullDesC8 );
+    AddNewOperationL( *op );
+    CleanupStack::Pop(); //operation
+    return reqId;
+    }
+
+// ---------------------------------------------------------------------------
+// CXIMPHost::AddNewOperationL()
+// ---------------------------------------------------------------------------
+//
+TXIMPRequestId CXIMPHost::AddNewOperationL( CXIMPOperationBase* aOperation )
+    {
+    iReqIdBuilder.SetProtocolId( iProtocolUid );
+    iReqIdBuilder.SetRequestId( iAdaptationOperationIndex );
+    TXIMPRequestId reqId = iReqIdBuilder.BuildRequestId();
+
+    iAdaptationOperationIndex++;
+    aOperation->BaseConstructL( reqId, NULL );
+    aOperation->ConstructL( KNullDesC8 );
+    AddNewOperationL( *aOperation );
+    return reqId;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPHost::GetConnection()
+// ---------------------------------------------------------------------------
+//
+MXIMPProtocolConnection& CXIMPHost::GetConnection() const
+    {
+    return iConnection;
+    }
+
+// ---------------------------------------------------------------------------
+// CXIMPHost::AddEventL()
+// ---------------------------------------------------------------------------
+//
+void CXIMPHost::AddEventL( CXIMPApiEventBase& aEvent, MXIMPPscContext* aContext  )
+    {
+    AddEventL( aEvent, static_cast< CXIMPPscContext* >( aContext ) );
+    }
+
+// ---------------------------------------------------------------------------
+// CXIMPHost::AddEventL()
+// ---------------------------------------------------------------------------
+//
+void CXIMPHost::AddEventL( CXIMPApiEventBase& aEvent, CXIMPPscContext* aContext  )
+    {
+    if( aContext )
+        {
+        iEventManager->AddEventL( aEvent, aContext );
+        }
+    else
+        {
+        iEventManager->AddEventL( aEvent, iRegSessions );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CXIMPHost::ActivateEventL()
+// ---------------------------------------------------------------------------
+//
+void CXIMPHost::ActivateEventL( CXIMPApiEventBase& aEvent, MXIMPPscContext* aContext  )
+    {
+    ActivateEventL( aEvent, static_cast< CXIMPPscContext* >( aContext ) );
+    }
+
+// ---------------------------------------------------------------------------
+// CXIMPHost::ActivateEventL()
+// ---------------------------------------------------------------------------
+//
+void CXIMPHost::ActivateEventL( CXIMPApiEventBase& aEvent, CXIMPPscContext* aContext  )
+    {
+    iEventManager->ActivateEventL( aEvent, aContext );
+    }
+
+// ---------------------------------------------------------------------------
+// CXIMPHost::StartProcessing()
+// ---------------------------------------------------------------------------
+//
+void CXIMPHost::StartProcessing()
+    {
+    CXIMPOperationBase* currentOperation = iCurrentOperation;
+    iCurrentOperation = NULL;
+
+    iProcessing = EFalse;
+
+    if( iOperations.Count() > 0 )
+        {
+        ActivateProcessing();
+        }
+
+    delete currentOperation; // might invoke destruction of host.
+    }
+
+// ---------------------------------------------------------------------------
+// CXIMPHost::ActivateProcessing()
+// ---------------------------------------------------------------------------
+//
+void CXIMPHost::ActivateProcessing()
+    {
+    // take the first operation from the queue
+    if( !iCurrentOperation )
+        {
+        if( iOperations.Count() <= 0 )
+            {
+            return;
+            }
+        iCurrentOperation = iOperations[0];
+        iOperations.Remove( 0 );
+        }
+
+    iCurrentOperation->BeginOperation();
+    iProcessing = ETrue;
+    // iCallBack->Set( TCallBack( StartProcessCallback, this ) );
+    iCallBack[EStartProcessCallback]->CallBack();
+    }
+
+// ---------------------------------------------------------------------------
+// CXIMPHost::StartProcessCallback()
+// ---------------------------------------------------------------------------
+//
+TInt CXIMPHost::StartProcessCallback( TAny *aInstance )
+    {
+    ( static_cast< CXIMPHost* >( aInstance ) )->DoStartProcessCallback();
+    return 0; // ignored by CAsychCallBack
+    }
+
+// ---------------------------------------------------------------------------
+// CXIMPHost::DoStartProcessCallbackL()
+// ---------------------------------------------------------------------------
+//
+void CXIMPHost::DoStartProcessCallback()
+    {
+#ifdef _DEBUG    
+    if ( iCurrentOperation->Context() )
+		TRACE_1( _L("Start processing operation for client \"%S\""), 
+			 	&iCurrentOperation->Context()->ClientInfo()->ClientId().Identity() );
+#endif
+
+    TRAPD( err, iCurrentOperation->ProcessL() );
+
+    if ( err != KErrNone )
+        {
+        HandleRequestCompleted( iCurrentOperation->RequestId(), err  );
+        // internal operation End event and deletion of iCurrentOperation happen within CompleteRequest
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CXIMPHost::CompleteRequestCallback()
+// ---------------------------------------------------------------------------
+//
+TInt CXIMPHost::CompleteRequestCallback( TAny *aInstance )
+    {
+    static_cast< CXIMPHost* >( aInstance )->DoCompleteRequestCallback();
+    return 0; // ignored by CAsychCallBack
+    }
+
+// ---------------------------------------------------------------------------
+// CXIMPHost::CompleteAdaptationRequestCallback()
+// ---------------------------------------------------------------------------
+//
+TInt CXIMPHost::CompleteAdaptationRequestCallback( TAny *aInstance )
+    {
+    static_cast< CXIMPHost* >( aInstance )->DoCompleteAdaptationRequestCallback();
+    return 0; // ignored by CAsychCallBack
+    }
+
+// ---------------------------------------------------------------------------
+// CXIMPHost::CompleteSessionMgmtRequestCallback()
+// ---------------------------------------------------------------------------
+//
+TInt CXIMPHost::CompleteSessionMgmtRequestCallback( TAny *aInstance )
+    {
+    static_cast< CXIMPHost* >( aInstance )->DoCompleteSessionMgmtRequestCallback();
+    return 0; // ignored by CAsychCallBack
+    }
+
+// ---------------------------------------------------------------------------
+// CXIMPHost::CompleteInternalRequestCallback()
+// ---------------------------------------------------------------------------
+//
+TInt CXIMPHost::CompleteInternalRequestCallback( TAny *aInstance )
+    {
+    static_cast< CXIMPHost* >( aInstance )->DoCompleteInternalRequestCallback();
+    return 0; // ignored by CAsychCallBack
+    }
+
+// ---------------------------------------------------------------------------
+// CXIMPHost::DoCompleteRequestCallback()
+// ---------------------------------------------------------------------------
+//
+void CXIMPHost::DoCompleteRequestCallback()
+    {
+    TRAPD( error, iCurrentOperation->RequestCompletedL() );
+
+    // Get event and update result code to event's status container
+    CXIMPRequestCompleteEventImp* reqCompEvent = iCurrentOperation->GetReqCompleteEvent();
+
+    if( error != KErrNone )
+        {
+        reqCompEvent->CompletionResultImp().SetResultCode( error );
+        }
+
+	if(!(iCurrentOperation->IsServerOperation()))
+    	{
+        // send the event
+        iEventManager->ActivateRequestCompleteEvent( *reqCompEvent, iCurrentOperation->Context() );
+    	}
+
+    iCurrentOperation->EndOperation();
+    StartProcessing();
+    }
+
+// ---------------------------------------------------------------------------
+// CXIMPHost::DoCompleteAdaptationRequestCallback()
+// ---------------------------------------------------------------------------
+//
+void CXIMPHost::DoCompleteAdaptationRequestCallback()
+    {
+    TInt leaveError = KErrNone;
+    TRAP( leaveError, iCurrentOperation->RequestCompletedL() ); // CSI: 42 #
+    
+    if( leaveError != KErrNone )
+        {
+        iAdaptationReqCompleteEvent->SetResultCode( leaveError );
+        }
+    else
+        {
+        const TXIMPRequestId reqId = iCurrentOperation->RequestId();        
+        const TInt result = iCurrentOperation->Status().ResultCode();
+        
+        iAdaptationReqCompleteEvent->SetRequestId( reqId );
+        iAdaptationReqCompleteEvent->SetResultCode( result );
+        }        
+        
+    
+    TInt count = iConnectionHostObservers.Count();
+    for( TInt a = 0; a < count; ++a )
+        {
+        iConnectionHostObservers[ a ]->HandleProtocolConnectionHostEvent( *this,
+                                                                          *iAdaptationReqCompleteEvent );
+        }
+
+    iCurrentOperation->EndOperation();
+
+    StartProcessing();
+    }
+
+// ---------------------------------------------------------------------------
+// CXIMPHost::DoCompleteSessionMgmtRequestCallback()
+// ---------------------------------------------------------------------------
+//
+void CXIMPHost::DoCompleteSessionMgmtRequestCallback()
+    {
+    TRAP_IGNORE( 
+        iCurrentOperation->RequestCompletedL();
+        iCurrentOperation->EndOperation();
+        )
+        
+    StartProcessing();
+    }
+
+// ---------------------------------------------------------------------------
+// CXIMPHost::DoCompleteInternalRequestCallback()
+// ---------------------------------------------------------------------------
+//
+void CXIMPHost::DoCompleteInternalRequestCallback()
+    {
+    TRAP_IGNORE( 
+        iCurrentOperation->RequestCompletedL();
+        iCurrentOperation->EndOperation();
+        )
+
+    StartProcessing();
+    }
+
+// ---------------------------------------------------------------------------
+// CXIMPHost::ForcedTeardown()
+// ---------------------------------------------------------------------------
+//
+void CXIMPHost::ForcedTeardownL()
+    {
+    // activate all cached unbinds in all contexts,
+    // first ones will do unshare, the last one will be the actual unbind.
+    // psc host FSA takes care of proper events.
+    //
+    // but if all binds failed, then there are no cached unbinds since
+    // each bind operation has destroyed the cached unbind. in that
+    // case we are already in PSCNotConnected state.
+
+    TInt foundOps = 0;
+
+    for ( TInt i = 0; i < iRegSessions.Count(); i++ )
+        {
+        CXIMPPscContext* context = iRegSessions[ i ];
+        CXIMPOperationBase* op = context->GetCachedUnbind();
+
+        // the operation might already be killed
+        if ( op )
+            {
+            op->SetServerOperation();
+            foundOps++;
+
+            // This trap can be removed after event queue is changed to 
+            // linked list. See CXIMPHost::HandleConnectionTerminated
+            TRAPD( err, AddNewOperationL( *op ); );
+            if ( err != KErrNone )
+                {
+                // could not append operation, so just delete it
+                delete op;
+                }
+            }
+        }
+
+    //__ASSERT_ALWAYS( foundOps > 0, User::Panic( NXIMPPrivPanic::KCategory, NXIMPPrivPanic::ENoCachedUnbindsFound ) );
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPHost::StartCleanerTimer()
+// ---------------------------------------------------------------------------
+//
+void CXIMPHost::StartCleanerTimer()
+    {
+    if( !iCleanerTimer->IsActive() )
+        {
+        TInt time = 1000000 * KPscHostCleanerTimerLength;
+        TCallBack callback( CleanerCallback, this );
+        iCleanerTimer->Start( time, time, callback );
+        }
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPHost::CreateOperationL()
+// ---------------------------------------------------------------------------
+//
+TXIMPRequestId CXIMPHost::AddNewOperationL( 
+    TInt aOperation, 
+    MXIMPBase* aParam, 
+    MXIMPBase* aParam2 /*=NULL*/ )
+    {
+    CXIMPRestrictedObjectCollectionImp* collection = CXIMPRestrictedObjectCollectionImp::NewLC( EFalse );
+    collection->AddOrReplaceTypeL( aParam );
+    if( aParam2 )
+        {
+        collection->AddOrReplaceTypeL( aParam2 );
+        }
+    TXIMPRequestId reqId = AddNewOperationL( aOperation, collection );
+    CleanupStack::Pop( collection );
+    return reqId;
+    } 
+    
+    
+// ---------------------------------------------------------------------------
+// CXIMPHost::AddNewOperationL()
+// ---------------------------------------------------------------------------
+//
+TXIMPRequestId CXIMPHost::AddNewOperationL( 
+    TInt aOperation, 
+    CXIMPRestrictedObjectCollectionImp* aParams )
+    {
+    CXIMPOperationBase* operation = 
+        CXIMPGlobals::Instance()->OperationFactory()->CreateOperationL( aOperation );
+    CleanupStack::PushL( operation );
+    TXIMPRequestId reqId = AddNewOperationL( operation );
+    CleanupStack::Pop( operation );
+    operation->SetObjectCollection( aParams );
+    aParams->SetObjectOwnership();
+    return reqId;
+    }
+
+// ---------------------------------------------------------------------------
+// CXIMPHost::CleanerCallback()
+// ---------------------------------------------------------------------------
+//
+TInt CXIMPHost::CleanerCallback( TAny* aMyself )
+    {
+    (static_cast<CXIMPHost*>(aMyself))->DoCleanerCallback();
+    return 0; // ignored by CPeriodic
+    }
+
+// ---------------------------------------------------------------------------
+// CXIMPHost::DoCleanerCallback()
+// ---------------------------------------------------------------------------
+//
+void CXIMPHost::DoCleanerCallback()
+    {
+    TRAPD( err, DoCleanerCallbackL() );
+
+    if ( err != KErrNone )
+        {
+        // Try to start cleaner again after interval when error happened.
+        StartCleanerTimer();
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CXIMPHost::DoCleanerCallbackL()
+// ---------------------------------------------------------------------------
+//
+void CXIMPHost::DoCleanerCallbackL()
+    {
+    // create CleanerOperation
+
+    iCleanerTimer->Cancel();  // CPeriodic must be stopped
+
+    // host originated operations have session id of 0
+    iReqIdBuilder.SetProtocolId( 0 );
+    iReqIdBuilder.SetRequestId( iHostOriginatedOpIndex );
+    TXIMPRequestId reqId = iReqIdBuilder.BuildRequestId();
+
+    iHostOriginatedOpIndex++;
+	//// for Presence Operation Cleaner
+    CXIMPOperationBase* op =
+        CXIMPGlobals::Instance()->OperationFactory()->CreateOperationL(
+                NPresenceOps::EXIMPCleaner );
+    op->BaseConstructL( reqId, NULL );
+    CleanupStack::PushL( op );
+    AddNewOperationL( *op ); // ownership was transferred to operation queue
+    CleanupStack::Pop( op );
+    
+
+	// let every protocol host create their cleanup operation
+	TInt count = iDataHostArray->Count() ;
+
+	for(TInt i=0; i<count; i++)
+		{
+		TXIMPRequestId reqIdim = iReqIdBuilder.BuildRequestId();
+		
+		TInt cleanupid = iDataHostArray->At(i)->GetCleanupOperation();
+	    CXIMPOperationBase* cleanupop =
+	        		CXIMPGlobals::Instance()->OperationFactory()->CreateOperationL(cleanupid);
+					
+		if ( cleanupop )
+			{
+			cleanupop->BaseConstructL( reqIdim, NULL );
+			CleanupStack::PushL( cleanupop );
+			AddNewOperationL( *cleanupop ); // ownership was transferred to operation queue
+			CleanupStack::Pop( cleanupop );
+			}
+		}
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPHost::OperationForRequestId()
+// ---------------------------------------------------------------------------
+//
+CXIMPOperationBase& CXIMPHost::OperationForRequestId( TXIMPRequestId aReqId )
+    {
+    __ASSERT_ALWAYS( iCurrentOperation, User::Panic( NXIMPPrivPanic::KCategory,
+            NXIMPPrivPanic::ECurrentOperationNull ) );
+
+    if ( iCurrentOperation->RequestId() != aReqId )
+        {
+        // we were not processing this request, panic the plugin (and the
+        // server, as it is...)
+        User::Panic( NXIMPPlugin::KCategory, NXIMPPlugin::EInvalidRequestId );
+        }
+    return *iCurrentOperation;
+    }
+
+// ---------------------------------------------------------------------------
+// CXIMPHost::ProtocolUID()
+// ---------------------------------------------------------------------------
+//
+TInt32 CXIMPHost::ProtocolUID()
+	{
+	return iProtocolUid;
+	}
+
+
+// ---------------------------------------------------------------------------
+// CXIMPHost::SetProtocolHosts()
+// ---------------------------------------------------------------------------
+//
+void CXIMPHost::SetProtocolHosts()
+	{
+	// enumurate through all the host plugins to set the host in corresponding protocol features 
+	TInt count = iDataHostArray->Count() ;
+
+	for(TInt i=0; i<count; i++)
+		{
+		iDataHostArray->At(i)->SetHostToProtocol() ;
+		}
+	}
+// ---------------------------------------------------------------------------
+// CXIMPHost::GetProtocolHost()
+// ---------------------------------------------------------------------------
+//
+TAny* CXIMPHost::GetProtocolHost(TInt aInterfaceId)
+	{
+	// provide interface by enumurating and getting the one
+	TAny* ptr = NULL ;
+	TInt count = iDataHostArray->Count() ;
+
+	for(TInt i=0; i<count; i++)
+		{
+		ptr = iDataHostArray->At(i)->GetInterface(aInterfaceId);
+		if(ptr)
+			{
+				break ;		
+			}
+		}
+	return ptr;
+	}
+
+void CXIMPHost::LoadDataHostArrayL() 
+	{
+	RImplInfoPtrArray pluginArray;		
+	MProtocolDataHost::ListAllImplementationsL(pluginArray) ;	
+	if ( pluginArray.Count() )
+		{
+		for( TInt i = 0; i < pluginArray.Count(); i++ )
+			{
+			MProtocolDataHost* implementation = NULL ;			
+			CImplementationInformation* info = pluginArray[ i ];        
+        	TUid id = info->ImplementationUid();        	
+        	TRAPD(err, implementation = MProtocolDataHost::NewL( id,*this) );
+        	CleanupStack::PushL(implementation);
+        	if(err == KErrNone)
+        		{
+        		iDataHostArray->AppendL( implementation );
+        		}
+        	CleanupStack::Pop(implementation);
+			}
+		}
+	pluginArray.ResetAndDestroy();
+
+	}
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/core/srcprocessor/ximphostimp.h	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  Presence connection host
+ *
+*/
+
+#ifndef CPSCHOSTIMP_H
+#define CPSCHOSTIMP_H
+
+#include <e32base.h>
+#include <ximpprotocolconnectionhost.h>
+#include <ximpcontext.h>
+
+#include "ximpapiobjbase.h"
+#include "ximphost.h"
+#include "ximpoperationdefs.h"
+#include "ximprequestidbuilder.h"
+
+
+class CXIMPOperationBase;
+class CXIMPEventManager;
+class MXIMPObjectFactory;
+class CXIMPObjectFactoryImp;
+class CXIMPPscContext;
+class MPresenceDataCache;
+class CPresenceDataCache;
+class CXIMPContextStateEventImp;
+class CPeriodic;
+class MXIMPProtocolConnection;
+class CProtocolPresenceAuthorizationDataHostImp;
+class MProtocolPresenceAuthorizationDataHost;
+class CProtocolPresencePublishingDataHostImp;
+class MProtocolPresencePublishingDataHost;
+class CProtocolPresenceWatchingDataHostImp;
+class MProtocolPresenceWatchingDataHost;
+class CProtocolPresentityGroupsDataHostImp;
+class MProtocolPresentityGroupsDataHost;
+class CXIMPRestrictedCollectionImp;
+class CXIMPProtocolRequestCompleteEventImp;
+class MProtocolPresenceDataHost;
+class CProtocolPresenceDataHostImp;
+class MProtocolDataHost;
+
+
+/**
+ * Presence connection host.
+ *
+ * @lib ximpprocessor.lib
+ * @since S60 v3.2
+ */
+class CXIMPHost : public CXIMPApiObjBase,
+                 public MXIMPProtocolConnectionHost,
+                 public MXIMPHost
+
+    {
+public:
+    /** The class ID. */
+    enum { KClassId = XIMPIMP_CLSID_CXIMPPSCHOST };
+
+public:
+
+    IMPORT_C static CXIMPHost* NewLC( MXIMPProtocolConnection& aConnection, TInt32 aProtocolUid );
+
+    /**
+     * Mark a reference to this object.
+     */
+    void Open();
+
+    /**
+     * Remove a reference to this object.
+     * Once all references are removed, the class destroys itself.
+     */
+    void Close();
+
+protected:
+
+    /**
+     * Reference counted. Use Close to remove a reference, and Open to open it.
+     * Can't be CObject-derived, since already derives from another C-class.
+     */
+    virtual ~CXIMPHost();
+
+    CXIMPHost( MXIMPProtocolConnection& aConnection, TInt32 aProtocolUid );
+    void ConstructL();
+
+public: // From MXIMPBase
+
+    /**
+     * Implementation of MXIMPBase interface methods
+     * @see MXIMPBase
+     */
+    XIMPIMP_DECLARE_IF_BASE_METHODS
+
+
+public: // From MXIMPProtocolConnectionHost
+
+    void HandleRequestCompleted( TXIMPRequestId aReqId, TInt aResultCode );
+    void HandleRequestCompleted( TXIMPRequestId aReqId, MXIMPStatus* aResult );
+    void HandleRequestCompleted( TXIMPRequestId aReqId,
+                                 MXIMPStatus* aResult,
+                                 MXIMPBase* aParameter );
+    TXIMPRequestId HandleConnectionTerminated( MXIMPStatus* aReason );
+    MXIMPObjectFactory& ObjectFactory();
+    MProtocolPresenceDataHost& ProtocolPresenceDataHost();
+    
+
+   
+    void RegisterObserverL(
+            MXIMPProtocolConnectionHostObserver& aObserver,
+            const TArray<TInt32>* aEventFilter = NULL );
+    void UnregisterConnectionHostObserver(
+            MXIMPProtocolConnectionHostObserver& aObserver );
+
+
+public: // MXIMPHost
+
+    MXIMPProtocolConnection& GetConnection() const;
+
+    void AddEventL( CXIMPApiEventBase& aEvent, MXIMPPscContext* aContext  );
+    void ActivateEventL( CXIMPApiEventBase& aEvent, MXIMPPscContext* aContext );
+
+    void UnregisterSession( CXIMPPscContext* aContext );
+
+    void FakeCompleteRequest( TXIMPRequestId aReqId, TInt aResult );
+    void HandleAdaptationRequestCompleted( TXIMPRequestId aReqId, TInt aResult );
+    void HandleSessionMgmtRequestCompleted( TXIMPRequestId aReqId, TInt aResult );
+    void HandleInternalRequestCompleted( TXIMPRequestId aReqId, TInt aResult );
+
+    CProtocolPresenceDataHostImp& PresenceDataAccess();
+    
+
+    // get corresponding protocol host from the array of hosts
+    TAny* GetProtocolHost(TInt aInterfaceId) ;
+    
+/*    CPresenceDataCache& DataAccess();
+    CProtocolPresenceAuthorizationDataHostImp& AuthorizationDataAccess();
+    CProtocolPresencePublishingDataHostImp& PublishingDataAccess();
+    CProtocolPresenceWatchingDataHostImp& WatchingDataAccess();
+    CProtocolPresentityGroupsDataHostImp& GroupsDataAccess();
+*/
+    void AddNewOperationL( CXIMPOperationBase& aOperation );
+    TXIMPRequestId AddNewOperationL( CXIMPOperationBase* aOperation );
+
+    void ForcedTeardownL();
+
+    void StartCleanerTimer();
+    
+    TXIMPRequestId AddNewOperationL( 
+                TInt aOperation, MXIMPBase* aParam, MXIMPBase* aParam2 = NULL );    
+    TXIMPRequestId AddNewOperationL( 
+                TInt aOperation, CXIMPRestrictedObjectCollectionImp* aParams );
+    
+    TInt32 ProtocolUID( );
+    
+    // to set the specific prtocol hosts
+    void SetProtocolHosts();
+
+public: // New functions
+
+    void AddEventL( CXIMPApiEventBase& aEvent, CXIMPPscContext* aContext  );
+    void ActivateEventL( CXIMPApiEventBase& aEvent, CXIMPPscContext* aContext );
+
+
+    void RegisterSessionL( CXIMPPscContext* aContext );
+
+private:
+
+    /**
+     * Delete old operation and try to launch processing.
+     */
+    void StartProcessing();
+
+    /**
+     * Activate next operation for processing and start processing.
+     */
+    void ActivateProcessing();
+
+    /**
+     * Helper for completing the request, to avoid cyclical
+     * call chain from StartProcessingL to HandleRequestCompleted and back.
+     * @param aResult The error code
+     * @see HandleRequestCompleted
+     */
+    void CompleteRequest( TXIMPRequestId aReqId );
+
+    /**
+     * Callback method for process starting.
+     */
+    static TInt StartProcessCallback( TAny *aInstance );
+
+    /**
+     * Leaving version of Callback method for process starting.
+     */
+    void DoStartProcessCallback();
+
+    /**
+     * Callback method for request complete.
+     */
+    static TInt CompleteRequestCallback( TAny *aInstance );
+    static TInt CompleteAdaptationRequestCallback( TAny* aInstance );
+    static TInt CompleteSessionMgmtRequestCallback( TAny* aInstance );
+    static TInt CompleteInternalRequestCallback( TAny* aInstance );
+
+    /**
+     * Leaving version of Callback method for request complete.
+     */
+    void DoCompleteRequestCallback();
+    void DoCompleteAdaptationRequestCallback();
+    void DoCompleteSessionMgmtRequestCallback();
+    void DoCompleteInternalRequestCallback();
+
+    /**
+     * Callback for timer cleaner
+     * @see TCallBack
+     */
+    static TInt CleanerCallback( TAny* aMyself );
+
+    /**
+     * Actual callback called from CleanerCallback.
+     */
+    void DoCleanerCallback();
+
+    /**
+     * Leaving version of cleaner timer callback.
+     */
+    void DoCleanerCallbackL();
+    
+    /**
+     * This panics if active operation is not found for requestid.
+     */
+    CXIMPOperationBase& OperationForRequestId( TXIMPRequestId aReqId );
+
+    TXIMPRequestId AddNewOperationL( NXIMPOps::TXIMPOpTypes aOpType );
+    
+     /**
+     * This is to load all the protocol hosts 
+     */
+    void LoadDataHostArrayL() ;
+    
+private: // data
+
+    /**
+     * iConnection
+     */
+    MXIMPProtocolConnection& iConnection;
+
+    /**
+     * Uid for protocol to use for request id builder
+     */
+    TInt32 iProtocolUid;
+    
+    /**
+     * Reference counter
+     */
+    TInt iReferences;
+
+    /**
+     * State identifier
+     */
+     TBool iProcessing;
+
+    /**
+     * Container for the operations. Owns the operations.
+     * Own.
+     */
+    RXIMPObjOwningPtrArray< CXIMPOperationBase > iOperations;
+
+    TBool iRunFromContextActivated;
+    CXIMPOperationBase* iCurrentOperation;
+
+    // not owned
+
+    CXIMPEventManager* iEventManager;
+
+
+    /**
+     * Container for session datas that are registered to this
+     * host.
+     * Shared ownership. Cleanup for items must be done with close method. Not delete.
+     */
+    RPointerArray< CXIMPPscContext > iRegSessions;
+
+    /**
+     * Internal state of the host
+     */
+    NXIMPHost::THostStates iState;
+
+    /**
+     * Timer for clean operation creation.
+     */
+    CPeriodic* iCleanerTimer;
+
+    /**
+     * Object factory.
+     */
+    CXIMPObjectFactoryImp*  iObjFactory;
+
+    /**
+     * Data cache
+     */
+//    CPresenceDataCache* iDataCache;
+
+    /**
+     * Data hosts
+     */
+     
+    CProtocolPresenceDataHostImp* iPresenceDataHost;
+    
+    /**
+     * array to hold data hosts
+     */
+    CArrayFixFlat<MProtocolDataHost*>* iDataHostArray;
+    
+/*    CProtocolPresenceAuthorizationDataHostImp* iAuthDataHost;
+    CProtocolPresencePublishingDataHostImp* iPublishingDataHost;
+    CProtocolPresenceWatchingDataHostImp* iWatchingDataHost;
+    CProtocolPresentityGroupsDataHostImp* iGroupsDataHost;
+*/
+    /**
+     * Operation index for host-originated operations
+     * (currently only reconnect operation)
+     */
+    TInt iHostOriginatedOpIndex;
+
+    /**
+     * Active object for async calls.
+     */
+    //CAsyncCallBack* iCallBack;
+    enum
+        {
+        ECompleteRequestCallback = 0,
+        ECompleteAdaptationRequestCallback,
+        ECompleteSessionMgmtRequestCallback,
+        ECompleteInternalRequestCallback,
+        EStartProcessCallback
+        };
+    RPointerArray< CAsyncCallBack > iCallBack;
+
+    /**
+     *
+     */
+    TInt iAdaptationOperationIndex;
+
+
+    /**
+     * Builder for TXIMPRequestIds. Owned.
+     */
+    TXIMPRequestIdBuilder iReqIdBuilder;
+    
+    /**
+     * Observers for adaptation requests.
+     */
+    RPointerArray< MXIMPProtocolConnectionHostObserver > iConnectionHostObservers;
+    
+    
+    /**
+     * Adaptation request complete event.
+     */
+    CXIMPProtocolRequestCompleteEventImp* iAdaptationReqCompleteEvent;
+    
+    /**
+     * Forced tear down flag.
+    */
+    
+    TBool iForcedTearDown;
+    };
+
+
+#endif // CPSCHOST_H
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/core/srcprocessor/ximphostmanager.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,249 @@
+/*
+* 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:  implementation of CXIMPHostManager
+ *
+*/
+
+
+
+#include <s32mem.h>
+#include <badesca.h>
+
+#include <ximpprotocolconnection.h>
+#include <ximpprotocolpluginbase.h>
+
+#include "ximphostmanager.h"
+#include "ximpserviceinfoimp.h"
+#include "ximphostimp.h"
+#include "ximpoperationdefs.h"
+#include "ximpobjecthelpers.h"
+//#include "ximpcontext.h"
+#include "ximppsccontext.h"
+#include "ximppanics.h"
+#include "ximpglobals.h"
+#include "ximppluginfactory.h"
+#include "ximpobjectfactoryimp.h"
+#include "ximppsccontextimp.h"
+#include "ximpcontextclientinfoimp.h"
+
+// ======== LOCAL FUNCTIONS ========
+
+TInt OrderOfHosts( const CXIMPHost& aFirst, const CXIMPHost& aSecond )
+    {
+    if( &aFirst.GetConnection() < &aSecond.GetConnection() )
+        {
+        return -1;
+        }
+    else if( &aFirst.GetConnection() == &aSecond.GetConnection() )
+        {
+        return 0;
+        }
+    else
+        {
+        return 1;
+        }
+    }
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// CXIMPHostManager::CXIMPHostManager()
+// ---------------------------------------------------------------------------
+//
+CXIMPHostManager::CXIMPHostManager()
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPHostManager::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void CXIMPHostManager::ConstructL()
+    {
+    iObjFactory = CXIMPObjectFactoryImp::NewL();
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPHostManager::NewL()
+// ---------------------------------------------------------------------------
+//
+CXIMPHostManager* CXIMPHostManager::NewL()
+    {
+    CXIMPHostManager* self = new( ELeave ) CXIMPHostManager;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPHostManager::~CXIMPHostManager()
+// ---------------------------------------------------------------------------
+//
+CXIMPHostManager::~CXIMPHostManager()
+    {
+    // host manager CANNOT OWN the hostimp objects.
+    // it's a fatal error to have hosts in the array
+    // at this point.
+    __ASSERT_ALWAYS( iHosts.Count() == 0, User::Panic( NXIMPPrivPanic::KCategory, NXIMPPrivPanic::EHostMgrHostsHaveNotBeenDeleted ) );
+
+    iHosts.Close();
+    delete iObjFactory;    
+    
+    if( iProtocol )
+        {
+        delete iProtocol;
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Implement supported interface access.
+// ---------------------------------------------------------------------------
+//
+XIMPIMP_IF_BASE_GET_INTERFACE_BEGIN( CXIMPHostManager, MXIMPProtocolPluginHost )
+XIMPIMP_IF_BASE_GET_INTERFACE_END()
+XIMPIMP_IF_BASE_GET_CONST_INTERFACE_BEGIN( CXIMPHostManager, MXIMPProtocolPluginHost )
+XIMPIMP_IF_BASE_GET_INTERFACE_END()
+
+
+
+// ---------------------------------------------------------------------------
+// CXIMPHostManager::DisassociateHost()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CXIMPHostManager::DisassociateHost( CXIMPHost* aHost )
+    {
+    // go backwards to avoid modifying index when removing
+    TInt count = iHosts.Count();
+    for( TInt a = count-1; a >= 0; a-- )
+        {
+        if( iHosts[ a ] == aHost )
+            {
+            // remove this host
+            MXIMPProtocolConnection& connection = aHost->GetConnection();
+            iProtocol->ReleaseConnection( connection );
+            iHosts.Remove( a );
+            }
+        }
+
+    count = iHosts.Count();
+    if ( count == 0 )
+        {
+        // no more hosts
+        CXIMPGlobals::Instance()->NoMoreHosts();
+        }
+    }
+    
+// ---------------------------------------------------------------------------
+// CXIMPHostManager::AcquireHostForContextL()
+// ---------------------------------------------------------------------------
+//
+CXIMPHost* CXIMPHostManager::AcquireHostForContextLC( CXIMPPscContext& aContext )
+    {
+    CXIMPServiceInfoImp* serviceInfo = aContext.ServiceInfo();
+    if( !iProtocol )
+        {
+        if( !serviceInfo )
+            {
+            User::Leave( KErrArgument );
+            }
+        CXIMPPluginFactory* factory = CXIMPGlobals::Instance()->PluginFactory();
+        iProtocol = factory->GetProtocolL( serviceInfo->ProtocolImplUid() );
+        iProtocol->PrimeHost( *this );
+        }
+    return GetHostForConnectionLC( 
+            iProtocol->AcquireConnectionL( *serviceInfo, *aContext.ClientInfo() ),
+            serviceInfo->ProtocolImplUid().iUid );
+    }
+
+// ---------------------------------------------------------------------------
+// CXIMPHostManager::GetHostForConnectionL()
+// ---------------------------------------------------------------------------
+//
+CXIMPHost* CXIMPHostManager::GetHostForConnectionLC( 
+    MXIMPProtocolConnection& aConnection, TInt32 aProtocolUid  )
+    {
+    CXIMPHost* newHost = CXIMPHost::NewLC( aConnection, aProtocolUid );
+    TLinearOrder< CXIMPHost > order( *OrderOfHosts );
+    TInt index = iHosts.FindInOrder( newHost, order );
+    if( index == KErrNotFound )
+        {
+        iHosts.InsertInOrderL( newHost, order );
+        aConnection.PrimeHost( *newHost );
+        // this will allow protocol hosts to set in adaptations
+        newHost->SetProtocolHosts() ;
+        }
+    else
+        {
+        User::LeaveIfError( index );
+        CleanupStack::PopAndDestroy(); //newHost
+        newHost = iHosts[ index ];
+        newHost->Open(); // CSI: 65 # Does not return a value.
+        CleanupClosePushL( *newHost );
+        }
+    return newHost;
+    }
+
+// ---------------------------------------------------------------------------
+// CXIMPHostManager::HandleRequestCompleted()
+// ---------------------------------------------------------------------------
+//
+void CXIMPHostManager::HandleRequestCompleted( TXIMPRequestId aReqId, 
+                                              TInt aResultCode )
+    {
+    XIMP_UNUSED_FORMAL_PARAM( aReqId );
+    XIMP_UNUSED_FORMAL_PARAM( aResultCode );
+    }
+
+// ---------------------------------------------------------------------------
+// CXIMPHostManager::HandleRequestCompleted()
+// ---------------------------------------------------------------------------
+//
+void CXIMPHostManager::HandleRequestCompleted( TXIMPRequestId aReqId,
+                                              MXIMPStatus* aResult )
+    {    
+    XIMP_UNUSED_FORMAL_PARAM( aReqId );
+    XIMP_UNUSED_FORMAL_PARAM( aResult );
+    }
+
+
+
+// ---------------------------------------------------------------------------
+// CXIMPHostManager::HandleRequestCompleted()
+// ---------------------------------------------------------------------------
+//
+void CXIMPHostManager::HandleRequestCompleted( TXIMPRequestId aReqId,
+                                              MXIMPStatus* aResult,
+                                              MXIMPBase* aParameter )
+    {    
+    XIMP_UNUSED_FORMAL_PARAM( aReqId );
+    XIMP_UNUSED_FORMAL_PARAM( aResult );
+    XIMP_UNUSED_FORMAL_PARAM( aParameter );
+    }
+
+
+
+// ---------------------------------------------------------------------------
+// CXIMPHostManager::ObjectFactory()
+// ---------------------------------------------------------------------------
+//
+MXIMPObjectFactory& CXIMPHostManager::ObjectFactory()
+    {
+    return *iObjFactory;
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/core/srcprocessor/ximphostmanager.h	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  implementation of CXIMPHostManager
+ *
+*/
+
+#ifndef C_PSCHOSTMANAGER_H
+#define C_PSCHOSTMANAGER_H
+
+
+#include <e32base.h>
+#include <ximpprotocolpluginhost.h>
+#include "ximphostimp.h"
+
+#include "ximpbase.h"
+
+class CXIMPOperationBase;
+class CXIMPFeatureInfoImp;
+class CXIMPPscContext;
+class CXIMPServiceInfoImp;
+class CXIMPProtocolPluginBase;
+
+/**
+ * ?one_line_short_description
+ *
+ * ?more_complete_description
+ *
+ * @lib ?library
+ * @since S60 v4.0
+ */
+class CXIMPHostManager : public CXIMPApiObjBase,
+                        public MXIMPProtocolPluginHost
+    {
+
+public: // Definitions
+
+    /** The class ID. */
+    enum { KClassId = XIMPIMP_CLSID_CXIMPPSCHOSTMANAGER };
+
+
+public:
+
+    IMPORT_C static CXIMPHostManager* NewL();
+
+    virtual ~CXIMPHostManager();
+
+
+private:
+
+    CXIMPHostManager();
+    void ConstructL();
+
+public:
+
+    /**
+     * Dissociate the given host from the list of known
+     * hosts.
+     * @param aHost The host to disassociate.
+     */
+    IMPORT_C void DisassociateHost( CXIMPHost* aHost );
+    
+    /**
+     * Acquire host for context.
+     */
+    CXIMPHost* AcquireHostForContextLC( CXIMPPscContext& aContext );
+    
+public: // From MXIMPBase
+
+    /**
+     * Implementation of MXIMPBase interface methods
+     * @see MXIMPBase
+     */
+    XIMPIMP_DECLARE_IF_BASE_METHODS
+    
+
+private: // From MXIMPProtocolPluginHost
+    
+    MXIMPObjectFactory& ObjectFactory();
+
+    void HandleRequestCompleted( TXIMPRequestId aReqId,
+                                 TInt aResultCode );
+                                 
+    void HandleRequestCompleted( TXIMPRequestId aReqId,
+                                 MXIMPStatus* aResult );    
+                                 
+    void HandleRequestCompleted( TXIMPRequestId aReqId,
+                                 MXIMPStatus* aResult,
+                                 MXIMPBase* aParameter );    
+
+private: // Helper methods
+
+    /**
+     * Get host for connection. If does not exists, create one.
+     */
+    CXIMPHost* GetHostForConnectionLC( MXIMPProtocolConnection& aConnection, 
+                                      TInt32 aProtocolUid  );
+
+private: // data
+
+    /**
+     * List of known hosts.
+     * Does not own, only knows the hosts.
+     */
+    RPointerArray<CXIMPHost> iHosts;
+    
+    /**
+     * Object factory.
+     */
+    CXIMPObjectFactoryImp*  iObjFactory;  
+    
+    /**
+     * Protocol
+     */
+    CXIMPProtocolPluginBase* iProtocol;
+    };
+
+
+#endif // C_PSCHOSTMANAGER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/core/srcprocessor/ximpoperationbase.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,290 @@
+/*
+* 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:  Base class for operations methods
+ *
+*/
+
+
+
+#include "ximprequestcompleteeventimp.h"
+#include "ximprestrictedobjectcollectionimp.h"
+#include "ximpoperationbase.h"
+#include "ximpstatusimp.h"
+#include "ximppanics.h"
+#include "ximppsccontextimp.h"
+#include "ximphost.h"
+
+// -----------------------------------------------------------------------------
+// CXIMPOperationBase::CXIMPOperationBase()
+// C++ default constructor.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CXIMPOperationBase::CXIMPOperationBase() : iServerOperation(EFalse)
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CXIMPOperationBase::BaseConstructL
+// Base class construction
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CXIMPOperationBase::BaseConstructL( TXIMPRequestId aRequestId, 
+                                            CXIMPPscContext* aContext )
+    {
+    iStatusObj = CXIMPStatusImp::NewL();    
+    iObjCollection = CXIMPRestrictedObjectCollectionImp::NewL();
+    iReqId = aRequestId;
+    SetOpL( aContext );    
+
+    CreateRequestCompleteEventL();
+    }
+
+// -----------------------------------------------------------------------------
+// CXIMPOperationBase::CreateRequestCompleteEventL()
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CXIMPOperationBase::CreateRequestCompleteEventL()
+    {
+    // Default value for request complete event to handle low memory situations.
+    iReqCompleteEvent = CXIMPRequestCompleteEventImp::NewLC( iReqId, KErrNoMemory );
+    CleanupStack::Pop(); // iReqCompleteEvent
+    }
+
+// -----------------------------------------------------------------------------
+// CXIMPOperationBase::~CXIMPOperationBase()
+// Destructor
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CXIMPOperationBase::~CXIMPOperationBase()
+    {
+    
+    GetObjCollection();
+    GetContext();
+    Type();
+    
+    delete iStatusObj;
+    delete iObjCollection;
+    
+    if ( iContext )
+        {
+        iContext->Close();
+        }
+    delete iReqCompleteEvent;
+    if( iMyHost )
+        {
+        iMyHost->Close();
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CXIMPOperationBase::SetHost()
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CXIMPOperationBase::SetHost( MXIMPHost& aMyHost )
+    {
+    if( iMyHost )
+        {
+        iMyHost->Close();
+        }
+    iMyHost = &aMyHost;
+    iMyHost->Open(); // CSI: 65 # Does not fail.
+    }
+
+// -----------------------------------------------------------------------------
+// CXIMPOperationBase::ProcessL()
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CXIMPOperationBase::ProcessL()
+    {
+    __ASSERT_ALWAYS( iMyHost, User::Panic( NXIMPPrivPanic::KCategory,
+                                           NXIMPPrivPanic::EHostNotFound ) );
+    }
+
+// -----------------------------------------------------------------------------
+// CXIMPOperationBase::RequestCompletedL()
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CXIMPOperationBase::RequestCompletedL()
+    {
+    iReqCompleteEvent->CompletionResultImp().SetResultCode( iStatusObj->ResultCode() );
+    }
+
+// -----------------------------------------------------------------------------
+// CXIMPOperationBase::GetReqCompleteEvent()
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CXIMPRequestCompleteEventImp* CXIMPOperationBase::GetReqCompleteEvent()
+    {
+    return iReqCompleteEvent;
+    }
+
+// -----------------------------------------------------------------------------
+// CXIMPOperationBase::Type()
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt CXIMPOperationBase::Type() const
+    {
+    return NXIMPOps::EPrNone; 
+    }
+
+// -----------------------------------------------------------------------------
+// CXIMPOperationBase::SetOp()
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CXIMPOperationBase::SetOpL( CXIMPPscContext* aContext )
+    {
+    if( aContext )
+        {
+        User::LeaveIfError( aContext->Open() );
+        }
+    if( iContext )
+        {
+        iContext->Close();
+        }
+    iContext = aContext;
+    }
+    
+// -----------------------------------------------------------------------------
+// CXIMPOperationBase::SetReqId()
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CXIMPOperationBase::SetReqId( TXIMPRequestId aRequestId )
+    {
+    iReqId = aRequestId;
+    iReqCompleteEvent->SetRequestId( iReqId );
+    }
+    
+// -----------------------------------------------------------------------------
+// CXIMPOperationBase::SetResultCode()
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CXIMPOperationBase::SetResultCode( TInt aResultCode )
+    {
+    iStatusObj->SetResultCode( aResultCode );
+    }
+    
+// -----------------------------------------------------------------------------
+// CXIMPOperationBase::SetResultCode()
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CXIMPOperationBase::SetStatus( MXIMPStatus* aStatus )
+    {
+    CXIMPStatusImp* status = NULL;
+    if( aStatus )
+        {
+        status =
+        TXIMPGetImpClassOrPanic< CXIMPStatusImp >::From( *aStatus );
+        delete iStatusObj;
+        iStatusObj = status;
+        }    
+    }
+    
+// -----------------------------------------------------------------------------
+// CXIMPOperationBase::SetObjectCollection()
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CXIMPOperationBase::SetObjectCollection( MXIMPBase* aCollection )
+    {
+    CXIMPRestrictedObjectCollectionImp* objectCollection = NULL;
+    if( aCollection )
+        {
+        objectCollection =
+        TXIMPGetImpClassOrPanic< CXIMPRestrictedObjectCollectionImp >::From( *aCollection );
+        delete iObjCollection;
+        iObjCollection = objectCollection;
+        }
+    
+    }
+    
+// -----------------------------------------------------------------------------
+// CXIMPOperationBase::Context()
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CXIMPPscContext* CXIMPOperationBase::Context()
+    {
+    return iContext;
+    }
+    
+// -----------------------------------------------------------------------------
+// CXIMPOperationBase::RequestId
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TXIMPRequestId CXIMPOperationBase::RequestId() const
+    {
+    return iReqId;
+    }
+
+// -----------------------------------------------------------------------------
+// CXIMPOperationBase::BeginOperationL
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CXIMPOperationBase::BeginOperation()
+    {    
+    }
+    
+// -----------------------------------------------------------------------------
+// CXIMPOperationBase::EndOperationL
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CXIMPOperationBase::EndOperation()
+    {
+    
+    }
+    
+// -----------------------------------------------------------------------------
+// CXIMPOperationBase::Status
+// -----------------------------------------------------------------------------
+//
+EXPORT_C MXIMPStatus& CXIMPOperationBase::Status() const
+    {
+    return *iStatusObj;
+    }
+
+// -----------------------------------------------------------------------------
+// CXIMPOperationBase::SetServerOperation
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CXIMPOperationBase::SetServerOperation()
+	{
+	iServerOperation = ETrue;
+	}
+	
+// -----------------------------------------------------------------------------
+// CXIMPOperationBase::IsServerOperation
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TBool CXIMPOperationBase::IsServerOperation() const
+	{
+	return iServerOperation;
+	}
+
+// -----------------------------------------------------------------------------
+// CXIMPOperationBase::GetContext
+// -----------------------------------------------------------------------------
+//
+EXPORT_C MXIMPPscContext* CXIMPOperationBase::GetContext()
+{
+	return iContext ;
+}
+
+// -----------------------------------------------------------------------------
+// CXIMPOperationBase::GetObjCollection
+// -----------------------------------------------------------------------------
+//
+EXPORT_C MXIMPRestrictedObjectCollection* CXIMPOperationBase::GetObjCollection()
+{
+	return iObjCollection ;
+}
+    
+// end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/core/srcprocessor/ximppluginfactory.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,245 @@
+/*
+* 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 Service plugin factory
+ *
+*/
+
+
+#include "ximppluginfactory.h"
+#include "ximpobjecthelpers.h"
+#include "ximpprotocolinfoimp.h"
+#include "ximpfeatureinfoimp.h"
+
+#include <ximpprotocolpluginbase.h>
+
+#include <ximpbase.h>
+#include <ecom/ecom.h>
+
+// ============================ HELPER CLASS ===============================
+// simple wrapper class with array deletion on close
+class RImplInfoPtrArray2 : public RImplInfoPtrArray
+    {
+    public:
+        void Close()
+            {
+            ResetAndDestroy();
+            }
+    };
+
+_LIT8( KProvider,          "<p>" );
+_LIT8( KFeatureId,         "<f>" );
+_LIT8( KSupportedSchema,   "<s>" );
+_LIT8( KTagMatch,          "*<?>*" );
+
+const TInt KTagLength = 3;
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CXIMPPluginFactory::NewL()
+// Singleton access method.
+// -----------------------------------------------------------------------------
+//
+CXIMPPluginFactory* CXIMPPluginFactory::NewL()
+    {
+    CXIMPPluginFactory* self = new ( ELeave ) CXIMPPluginFactory();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CXIMPPluginFactory::CXIMPPluginFactory()
+// -----------------------------------------------------------------------------
+//
+CXIMPPluginFactory::CXIMPPluginFactory()
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CXIMPPluginFactory::~CXIMPPluginFactory()
+// -----------------------------------------------------------------------------
+//
+CXIMPPluginFactory::~CXIMPPluginFactory()
+    {
+    }
+
+
+// -----------------------------------------------------------------------------
+// CXIMPPluginFactory::ConstructL()
+// -----------------------------------------------------------------------------
+//
+void CXIMPPluginFactory::ConstructL()
+    {
+    }
+
+
+// -----------------------------------------------------------------------------
+// CXIMPPluginFactory::GetProtocolsL()
+// -----------------------------------------------------------------------------
+//
+EXPORT_C HBufC8* CXIMPPluginFactory::GetProtocolsL()
+    {
+    RXIMPObjOwningPtrArray< CXIMPProtocolInfoImp > protocolInfoArray;
+    CleanupClosePushL( protocolInfoArray );
+
+    // For each valid plugin, create CXIMPProtocolInfoImp and fill it up
+    RImplInfoPtrArray2 protocols;
+    CleanupClosePushL( protocols );
+
+    REComSession::ListImplementationsL( TUid::Uid(
+                                        CXIMPProtocolPluginBase::KInterfaceId ),
+                                        protocols );
+
+    const TInt implCount = protocols.Count();
+    for( TInt i( 0 ); i < implCount; i++ )
+        {
+        CXIMPFeatureInfoImp* featInfo =
+                    ParseProtocolInfoLC( protocols[i]->OpaqueData() );
+        CXIMPProtocolInfoImp* tmpProtInfo =
+                    CXIMPProtocolInfoImp::NewLC( protocols[i]->DisplayName(),
+                                                 protocols[i]->ImplementationUid(),
+                                                 *featInfo );
+        User::LeaveIfError( protocolInfoArray.Append( tmpProtInfo ) );
+        CleanupStack::Pop( tmpProtInfo );
+        CleanupStack::PopAndDestroy( featInfo );
+        }
+
+    CleanupStack::PopAndDestroy();  // protocols
+
+
+    HBufC8* pack = TXIMPObjectPacker< CXIMPProtocolInfoImp >::PackArrayL(
+                                                            protocolInfoArray );
+    CleanupStack::PopAndDestroy(); // protocolInfoArray
+    return pack;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CXIMPPluginFactory::GetProtocolL()
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CXIMPProtocolPluginBase* CXIMPPluginFactory::GetProtocolL( 
+    TUid aProtocolUid )
+    {
+    TAny* requestedProtocol = NULL;
+    TUid destructorId;
+
+    requestedProtocol = REComSession::CreateImplementationL( aProtocolUid,
+                                                             destructorId );
+           
+    CXIMPProtocolPluginBase* plugIn = ( CXIMPProtocolPluginBase* )requestedProtocol;
+    plugIn->SetDestructorId( destructorId );
+    return plugIn;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CXIMPPluginFactory::ParseProtocolInfoLC()
+// -----------------------------------------------------------------------------
+//
+CXIMPFeatureInfoImp* CXIMPPluginFactory::ParseProtocolInfoLC(
+                                                const TDesC8& aFeaturesBuffer )
+    {
+    CXIMPFeatureInfoImp* featInfo = CXIMPFeatureInfoImp::NewLC();
+
+    ParseTaggedDataL( aFeaturesBuffer, featInfo );
+
+    return featInfo;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CXIMPPluginFactory::ParseTaggedDataL()
+// -----------------------------------------------------------------------------
+//
+void CXIMPPluginFactory::ParseTaggedDataL( const TDesC8& aData,
+                                          CXIMPFeatureInfoImp* aFeatInfo )
+    {
+    TPtrC8 data(aData);
+    TInt readPosition = 0;
+    TBool moreData = data.Length() ? ETrue : EFalse;
+    while (moreData)
+        {
+        // Assumes that this segment will begin with a tag
+        TPtrC8 restOfData = data.Mid(readPosition);
+
+        TInt endPos = restOfData.MatchF(KTagMatch);
+        if (endPos == KErrNotFound)
+            User::Leave(KErrCorrupt);
+
+        // extract the tag
+        TPtrC8 tag = restOfData.Left(KTagLength);
+
+        readPosition += KTagLength;
+
+        // Find the next tag
+        restOfData.Set(data.Mid(readPosition));
+        endPos = restOfData.MatchF(KTagMatch);
+
+        TPtrC8 tagData;
+        if (endPos == KErrNotFound)
+            {
+            // If we didn't find a tag, we must be at the end of the data
+            tagData.Set(restOfData);
+            readPosition = restOfData.Length();
+            moreData = EFalse;
+            }
+        else
+            {
+            tagData.Set(restOfData.Left(endPos));
+            readPosition += endPos;
+            }
+
+        ProcessTaggedDataL( tag, tagData, aFeatInfo );
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CXIMPPluginFactory::ProcessTaggedDataL()
+// -----------------------------------------------------------------------------
+//
+void CXIMPPluginFactory::ProcessTaggedDataL( const TDesC8& aTag,
+                                            const TDesC8& aData,
+                                            CXIMPFeatureInfoImp* aFeatInfo )
+    {
+    // This parsing handling needs to be updated when 
+    // protocol feature handling is properly defined. 
+
+    // Also CXIMPFeatureInfoImp members should be reconsidered 
+    // at that point
+
+    if ( aTag == KProvider )
+        {
+        //SetProviderL( aData );
+        }
+    else if ( aTag == KFeatureId )
+        {
+        aFeatInfo->AddFeatureL( aData );
+        }
+    else if ( aTag == KSupportedSchema )
+        {
+        //SetSupportedSchemaL( aData );
+        }
+    else
+        {
+        User::Leave(KErrCorrupt);
+        }
+    }
+// End of file
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/core/srcprocessor/ximppluginfactory.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,96 @@
+/*
+* 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 Service Connection plugin factory
+ *
+*/
+
+
+#ifndef CPSCPLUGINFACTORY_H
+#define CPSCPLUGINFACTORY_H
+
+
+#include <e32base.h>
+#include <ximpbase.h>
+
+
+class MXIMPFeatureInfo;
+class MXIMPProtocolInfo;
+class CXIMPFeatureInfoImp;
+class CXIMPProtocolPluginBase;
+
+
+/**
+ * Plugin factory and plugin utility.
+ * Class is owned by and handled as singleton by CXIMPGlobals.
+ *
+ * @lib ximpprocessor.dll
+ * @since S60 v4.0
+ */
+class CXIMPPluginFactory : public CBase
+    {
+    public:
+
+        static CXIMPPluginFactory* NewL();
+
+        ~CXIMPPluginFactory();
+
+    private:
+
+        /**
+         * C++ default constructor.
+         */
+        CXIMPPluginFactory();
+
+        /**
+         * Symbian 2nd phase constructor
+         */
+        void ConstructL();
+
+
+    public:
+
+        /**
+         * Get a list of protocols.
+         *
+         * Retrieves a list of presence protocols.
+         * @return Externalized form of RXIMPObjOwningPtrArray<
+         * CXIMPProtocolInfoImp > containing the protocols
+         */
+        IMPORT_C HBufC8* GetProtocolsL();
+
+
+        IMPORT_C CXIMPProtocolPluginBase* GetProtocolL( TUid aProtocolUid );
+
+
+        CXIMPFeatureInfoImp* ParseProtocolInfoLC( const TDesC8& aFeaturesBuffer );
+
+
+    private:
+
+        void ParseTaggedDataL( const TDesC8& aData,
+                               CXIMPFeatureInfoImp* aFeatInfo );
+
+
+        void ProcessTaggedDataL( const TDesC8& aTag,
+                                 const TDesC8& aData,
+                                 CXIMPFeatureInfoImp* aFeatInfo );
+
+
+    private:    // Data
+
+    };
+
+#endif      // CPSCPLUGINFACTORY_H
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/core/srcprocessor/ximpprotocolrequestcompleteeventimp.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,175 @@
+/*
+* 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:  MXIMPProtocolRequestCompleteEvent API object implementation.
+*
+*/
+
+#include <s32strm.h>
+#include "ximpprotocolrequestcompleteeventimp.h"
+
+
+
+// ---------------------------------------------------------------------------
+// CXIMPProtocolRequestCompleteEventImp::NewL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CXIMPProtocolRequestCompleteEventImp*
+    CXIMPProtocolRequestCompleteEventImp::NewL()
+    {
+    CXIMPProtocolRequestCompleteEventImp* self =
+            new( ELeave ) CXIMPProtocolRequestCompleteEventImp();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPProtocolRequestCompleteEventImp::NewLC()
+// ---------------------------------------------------------------------------
+//
+CXIMPProtocolRequestCompleteEventImp*
+    CXIMPProtocolRequestCompleteEventImp::NewFromStreamLC( RReadStream& aStream )
+    {
+    CXIMPProtocolRequestCompleteEventImp* self = 
+        new( ELeave ) CXIMPProtocolRequestCompleteEventImp;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    self->InternalizeL( aStream );
+    return self;
+    }
+
+
+
+// ---------------------------------------------------------------------------
+// CXIMPProtocolRequestCompleteEventImp::~CXIMPProtocolRequestCompleteEventImp()
+// ---------------------------------------------------------------------------
+//
+CXIMPProtocolRequestCompleteEventImp::~CXIMPProtocolRequestCompleteEventImp()
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPProtocolRequestCompleteEventImp::CXIMPProtocolRequestCompleteEventImp()
+// ---------------------------------------------------------------------------
+//
+CXIMPProtocolRequestCompleteEventImp::CXIMPProtocolRequestCompleteEventImp()
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPProtocolRequestCompleteEventImp::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void CXIMPProtocolRequestCompleteEventImp::ConstructL()
+    {
+    }
+
+
+
+
+// ---------------------------------------------------------------------------
+// From class MXIMPProtocolRequestCompleteEvent.
+// CXIMPProtocolRequestCompleteEventImp::RequestId()
+// ---------------------------------------------------------------------------
+//
+const TXIMPRequestId& CXIMPProtocolRequestCompleteEventImp::RequestId() const
+    {
+    return iReqId;
+    }
+
+
+// ---------------------------------------------------------------------------
+// From class MXIMPProtocolRequestCompleteEvent.
+// CXIMPProtocolRequestCompleteEventImp::ResultCode()
+// ---------------------------------------------------------------------------
+//
+TInt CXIMPProtocolRequestCompleteEventImp::ResultCode() const
+    {
+    return iResult;
+    }
+
+
+
+// ---------------------------------------------------------------------------
+// CXIMPProtocolRequestCompleteEventImp::SetRequestId()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CXIMPProtocolRequestCompleteEventImp::SetRequestId(
+    const TXIMPRequestId& aRequestId )
+    {
+    iReqId = aRequestId;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPProtocolRequestCompleteEventImp::SetResultCode()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CXIMPProtocolRequestCompleteEventImp::SetResultCode(
+    TInt aResult )
+    {
+    iResult = aResult;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPProtocolRequestCompleteEventImp::ExternalizeL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CXIMPProtocolRequestCompleteEventImp::ExternalizeL( 
+    RWriteStream& aStream ) const
+    {
+    TPckgBuf< TXIMPRequestId > bufReqId( iReqId );
+    aStream.WriteL( bufReqId );
+
+    aStream.WriteInt32L( iResult );
+    }
+    
+
+// ---------------------------------------------------------------------------
+// CXIMPProtocolRequestCompleteEventImp::InternalizeL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CXIMPProtocolRequestCompleteEventImp::InternalizeL( 
+    RReadStream& aStream )
+    {
+    TPckgBuf< TXIMPRequestId > bufReqId;
+    aStream.ReadL( bufReqId );
+    iReqId = bufReqId();
+
+    iResult = aStream.ReadInt32L();
+    }
+
+
+// ---------------------------------------------------------------------------
+// Implement supported interface access.
+// ---------------------------------------------------------------------------
+//
+XIMPIMP_IF_BASE_GET_INTERFACE_BEGIN( CXIMPProtocolRequestCompleteEventImp,
+                                     MXIMPProtocolRequestCompleteEvent )
+XIMPIMP_IF_BASE_GET_INTERFACE_END()
+
+XIMPIMP_IF_BASE_GET_CONST_INTERFACE_BEGIN( CXIMPProtocolRequestCompleteEventImp,
+                                           MXIMPProtocolRequestCompleteEvent )
+XIMPIMP_IF_BASE_GET_INTERFACE_END()
+
+
+
+
+// End of file
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/core/srcprocessor/ximpprotocolrequestcompleteeventimp.h	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  MXIMPProtocolRequestCompleteEvent API object implementation.
+*
+*/
+
+#ifndef CXIMPPROTOCOLREQUESTCOMPLETEEVENTIMP_H
+#define CXIMPPROTOCOLREQUESTCOMPLETEEVENTIMP_H
+
+#include "ximpapieventbase.h"
+#include <ximpprotocolrequestcompleteevent.h>
+
+
+class RWriteStream;
+class RReadStream;
+
+
+/**
+ * MXIMPProtocolRequestCompleteEvent API object implementation.
+ *
+ * @lib ximpdatamodel.dll
+ * @since S60 v3.2
+ */
+NONSHARABLE_CLASS( CXIMPProtocolRequestCompleteEventImp ):
+    public CXIMPApiObjBase,
+    public MXIMPProtocolRequestCompleteEvent
+    {
+    public:
+        /** The class ID. */
+        enum { KClassId = XIMPIMP_CLSID_CXIMPPROTOCOLREQUESTCOMPLETEEVENTIMP };
+
+public:
+
+    /**
+     * Exported instantiation method for initializing
+     * new event object.
+     */
+    IMPORT_C static CXIMPProtocolRequestCompleteEventImp* NewL();
+    IMPORT_C static CXIMPProtocolRequestCompleteEventImp * NewFromStreamLC( RReadStream& aStream );
+    virtual ~CXIMPProtocolRequestCompleteEventImp();
+
+private:
+    CXIMPProtocolRequestCompleteEventImp();
+    void ConstructL();
+
+
+public: // From MXIMPProtocolRequestCompleteEvent
+
+    /**
+     * Implementation of MXIMPProtocolRequestCompleteEvent interface methods
+     * @see MXIMPProtocolRequestCompleteEvent
+     */
+    const TXIMPRequestId& RequestId() const;
+    TInt ResultCode() const;
+
+
+public:
+
+    /**
+     * Set request id
+     * @param aRequestId New requestId.
+     */
+    IMPORT_C void SetRequestId( const TXIMPRequestId& aRequestId );
+
+
+    /**
+     * Set reseult code
+     * @param aResult New result.
+     */
+    IMPORT_C void SetResultCode( TInt aResult );
+
+
+    IMPORT_C void ExternalizeL( RWriteStream& aStream ) const;
+    
+    
+    IMPORT_C void InternalizeL( RReadStream& aStream );
+
+
+
+public: // From API base interfaces
+
+    /**
+     * Implementation of MXIMPBase interface methods
+     * @see MXIMPBase
+     */
+    XIMPIMP_DECLARE_IF_BASE_METHODS
+    
+
+
+
+private: // data
+
+    /**
+     * Completed request.
+     * Own.
+     */
+    TXIMPRequestId iReqId;
+
+
+    /**
+     * Request result.
+     * Own.
+     */
+    TInt iResult;
+
+    };
+
+
+#endif // CXIMPPROTOCOLREQUESTCOMPLETEEVENTIMP_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/core/srcprocessor/ximppsccontextimp.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,457 @@
+/*
+* 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:  Client context data storage.
+*
+*/
+
+#include <ximpprotocolconnection.h>
+#include <ximpidentity.h>
+
+#include "ximppsccontextimp.h"
+#include "ximpcontexteventqueue.h"
+#include "presenceinfoimp.h"
+#include "presenceinfofilterimp.h"
+#include "ximpoperationbase.h"
+#include "ximpserviceinfoimp.h"
+#include "ximpfeatureinfoimp.h"
+#include "ximpoperationdefs.h"
+#include "ximphostimp.h"
+#include "ximpglobals.h"
+#include "ximppanics.h"
+#include "ximpoperationfactory.h"
+#include "ximphostmanager.h"
+#include "ximpcontextclientinfoimp.h"
+#include "presencefilterstore.h"
+#include "ximprequestcompleteeventimp.h"
+
+#include "ximptrace.h"
+
+const TInt KXIMPFeatGranularity = 5;
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// CXIMPPscContext::CXIMPHostManager()
+// ---------------------------------------------------------------------------
+//
+CXIMPPscContext::CXIMPPscContext( TUint32 aSessionId )
+: iSessionId( aSessionId )
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPPscContext::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void CXIMPPscContext::ConstructL()
+    {
+    iEventQueue = CXIMPContextEventQueue::NewL();
+    iEventQueue->SetSessionIdOfQueue( iSessionId );
+    iPresentityFilterStore = CPresenceFilterStore::NewL();    
+    iPresentityGroupFilterStore = CPresenceFilterStore::NewL();    
+    iGrantFilterStore = CPresenceFilterStore::NewL();    
+    iGrantGroupFilterStore = CPresenceFilterStore::NewL();    
+    }
+
+// ---------------------------------------------------------------------------
+// CXIMPPscContext::NewL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CXIMPPscContext* CXIMPPscContext::NewL( TUint32 aSessionId )
+    {
+    CXIMPPscContext* self = new( ELeave ) CXIMPPscContext( aSessionId );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPPscContext::~CXIMPPscContext()
+// ---------------------------------------------------------------------------
+//
+CXIMPPscContext::~CXIMPPscContext()
+    {
+    if( iEventQueue )
+        {
+        iEventQueue->StopConsuming();
+        }
+
+    delete iEventQueue;
+
+    // destroy all cached operations
+    delete iCachedUnbind;
+
+    if ( iHost )
+        {
+        iHost->Close();
+        }
+
+    delete iOwnPif;
+    delete iServiceInfo;
+    delete iClientInfo;
+    delete iPresentityFilterStore;    
+    delete iPresentityGroupFilterStore;    
+    delete iGrantFilterStore;    
+    delete iGrantGroupFilterStore;
+    delete iGrantEveryonePif;
+    }
+
+// ---------------------------------------------------------------------------
+// CXIMPPscContext::EventQueue()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CXIMPContextEventQueue& CXIMPPscContext::EventQueue() const
+    {
+    return *iEventQueue;
+    }
+
+// ---------------------------------------------------------------------------
+// CXIMPPscContext::SessionId()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TUint32 CXIMPPscContext::SessionId() const
+    {
+    return iSessionId;
+    }
+
+// ---------------------------------------------------------------------------
+// CXIMPPscContext::OrderOfContexts()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CXIMPPscContext::OrderOfContexts( const CXIMPPscContext& aFirst,
+                                                const CXIMPPscContext& aSecond )
+    {
+    TUint32 firstSessionId = aFirst.SessionId();
+    TUint32 secondSessionId = aSecond.SessionId();
+    if( firstSessionId < secondSessionId )
+        {
+        return -1;
+        }
+    else if( firstSessionId == secondSessionId )
+        {
+        return 0;
+        }
+    else
+        {
+        return 1;
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CXIMPPscContext::PresenceInfoFilter
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CPresenceInfoFilterImp* CXIMPPscContext::PresenceInfoFilter( 
+                                                    MXIMPPscContext::TFilterStoreType aTypeOfFilter,
+                                                    const CXIMPIdentityImp* aIdentity /*= NULL*/ ) const
+    {
+    switch ( aTypeOfFilter )
+        {
+        case EOwnPresenceFilter:
+            {
+            return iOwnPif;
+            }
+        case EPresentityPresenceFilter:
+            {
+            return iPresentityFilterStore->FilterForIdentity( *aIdentity );
+            }
+        case EPresentityGroupMemberPresenceFilter:
+            {
+            return iPresentityGroupFilterStore->FilterForIdentity( *aIdentity );
+            }
+        case EGrantPresenceToEveryoneFilter:
+            {
+            return iGrantEveryonePif;
+            }
+        case EGrantPresenceToPresentityFilter:
+            {
+            return iPresentityGroupFilterStore->FilterForIdentity( *aIdentity );
+            }
+        case EGrantPresenceToGroupMemberFilter:
+            {
+            return iPresentityGroupFilterStore->FilterForIdentity( *aIdentity );
+            }
+        XIMP_DEFAULT_CASE_UNSUPPORTED( NXIMPPrivPanic::EInvalidFilterType );            
+        }
+    return NULL;
+    }
+
+// ---------------------------------------------------------------------------
+// CXIMPPscContext::SetPresenceInfoFilterL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CXIMPPscContext::SetPresenceInfoFilterL( 
+                                              MXIMPPscContext::TFilterStoreType aTypeOfFilter,
+                                              CPresenceInfoFilterImp* aPif,
+                                              const CXIMPIdentityImp* aIdentity /*= NULL*/ )
+    {
+    CPresenceFilterStore* filterStore = NULL;
+    switch ( aTypeOfFilter )
+        {
+        case EOwnPresenceFilter:
+            {
+            delete iOwnPif;
+            iOwnPif = aPif;
+            break;
+            }
+        case EPresentityPresenceFilter:
+            {
+            filterStore = iPresentityFilterStore;
+            break;
+            }
+        case EPresentityGroupMemberPresenceFilter:
+            {
+            filterStore = iPresentityGroupFilterStore;
+            break;
+            }
+        case EGrantPresenceToEveryoneFilter:
+            {
+            delete iGrantEveryonePif;
+            iGrantEveryonePif = aPif;
+            break;
+            }
+        case EGrantPresenceToPresentityFilter:
+            {
+            filterStore = iPresentityGroupFilterStore;
+            break;
+            }
+        case EGrantPresenceToGroupMemberFilter:
+            {
+            filterStore = iPresentityGroupFilterStore;
+            break;
+            }
+        XIMP_DEFAULT_CASE_UNSUPPORTED( NXIMPPrivPanic::EInvalidFilterType );            
+        }
+
+    if( filterStore )
+        {        
+        filterStore->Disassociate( *aIdentity );
+        if( aPif )
+            {
+            filterStore->AssociateL( *aIdentity, aPif );       
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CXIMPPscContext::GetCachedUnbind()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CXIMPOperationBase* CXIMPPscContext::GetCachedUnbind()
+    {
+    CXIMPOperationBase* retVal = iCachedUnbind;
+    iCachedUnbind = NULL;
+    return retVal;
+    }
+
+// ---------------------------------------------------------------------------
+// CXIMPPscContext::SetServiceInfo()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CXIMPPscContext::SetServiceInfo( CXIMPServiceInfoImp* aServiceInfo )
+    {
+    delete iServiceInfo;
+    iServiceInfo = aServiceInfo;
+    }
+
+// ---------------------------------------------------------------------------
+// CXIMPPscContext::SetServiceInfo()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CXIMPPscContext::SetClientInfo( CXIMPContextClientInfoImp* aClientInfo )
+    {
+    delete iClientInfo;
+    iClientInfo = aClientInfo;
+    }
+
+// ---------------------------------------------------------------------------
+// CXIMPPscContext::ServiceInfo()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CXIMPServiceInfoImp* CXIMPPscContext::ServiceInfo() const
+    {
+    return iServiceInfo;
+    }
+
+// ---------------------------------------------------------------------------
+// CXIMPPscContext::DestroyCachedUnbind()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CXIMPPscContext::DestroyCachedUnbind()
+    {
+    if( iCachedUnbind )
+        {
+        iEventQueue->RemoveRequestCompleteEvent( *iCachedUnbind->GetReqCompleteEvent() );
+        }    
+    delete iCachedUnbind;
+    iCachedUnbind = NULL;
+    }
+
+// ---------------------------------------------------------------------------
+// CXIMPPscContext::AppendToOpQueueL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TXIMPRequestId CXIMPPscContext::AppendToOpQueueUpdateReqIdL(
+        CXIMPOperationBase* aOperation )
+    {
+    iReqIdBuilder.SetSessionId( iSessionId );
+    iReqIdBuilder.SetRequestId( iOperationIndex );
+    TXIMPRequestId reqId = iReqIdBuilder.BuildRequestId();
+    
+    iOperationIndex++;
+    aOperation->SetReqId( reqId );
+
+    AppendToOpQueueL( aOperation );
+    return reqId;
+    }
+
+// ---------------------------------------------------------------------------
+// CXIMPPscContext::AppendToOpQueueL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CXIMPPscContext::AppendToOpQueueL(
+        CXIMPOperationBase* aOperation )
+    {
+    __ASSERT_ALWAYS( iHost, User::Panic( NXIMPPrivPanic::KCategory, NXIMPPrivPanic::EContextHasNoHost ) );
+    iHost->AddNewOperationL( *aOperation );
+    }
+
+// ---------------------------------------------------------------------------
+// CXIMPPscContext::AddNewOperationL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TXIMPRequestId CXIMPPscContext::AddNewOperationL(
+        TInt aOperation,
+        const TDesC8& aReqParams )
+    {
+    iReqIdBuilder.SetSessionId( iSessionId );
+    iReqIdBuilder.SetRequestId( iOperationIndex );
+    TXIMPRequestId reqId = iReqIdBuilder.BuildRequestId();
+
+    iOperationIndex++;
+    // XXX should the index++ be after Pop() below?
+
+    // check what kind of operation is offered and create the object
+    CXIMPOperationBase* op =
+        CXIMPGlobals::Instance()->OperationFactory()->CreateOperationL( aOperation );
+    // we have op at this point or we've panicked
+    CleanupStack::PushL( op );
+    op->BaseConstructL( reqId, this );
+    op->ConstructL( aReqParams );
+    TRACE_1( _L("New request from client \"%S\""), &ClientInfo()->ClientId().Identity() );
+
+    // Create unbind skeleton in advance for teardown bind.
+    if( NXIMPOps::EXIMPBindContext == aOperation
+        || NXIMPOps::EXIMPBindContext2 == aOperation )
+        {
+        // Locate connection from adaptation
+        ResolveHostL();
+
+        CXIMPOperationBase* unbindOp =
+            CXIMPGlobals::Instance()->OperationFactory()->CreateOperationL( NXIMPOps::EXIMPUnbindContext );
+
+		iReqIdBuilder.SetRequestId( iOperationIndex );
+        TXIMPRequestId unbindReq = iReqIdBuilder.BuildRequestId();
+        iOperationIndex++;
+
+        unbindOp->BaseConstructL( unbindReq, this );
+        unbindOp->ConstructL( KNullDesC8 );
+        iCachedUnbind = unbindOp;
+        iHost->AddEventL( *iCachedUnbind->GetReqCompleteEvent(), this );
+        }
+    __ASSERT_ALWAYS( iHost, User::Panic( NXIMPPrivPanic::KCategory, NXIMPPrivPanic::EContextHasNoHost ) );
+    
+    iHost->AddEventL( *op->GetReqCompleteEvent(), this );
+    
+    iHost->AddNewOperationL( *op );
+    CleanupStack::Pop(); // op
+    return reqId;
+    }
+
+// ---------------------------------------------------------------------------
+// CXIMPPscContext::FeaturesForSessionLC()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CXIMPFeatureInfoImp* CXIMPPscContext::FeaturesForSessionLC()
+    {
+    CXIMPFeatureInfoImp* feats = CXIMPFeatureInfoImp::NewLC();
+
+    CDesC8ArraySeg* arr = new ( ELeave ) CDesC8ArraySeg( KXIMPFeatGranularity );
+    CleanupStack::PushL( arr );
+
+/*    if ( GetStateOfHost() == NXIMPHost::EXIMPNotConnected )
+        {
+        // feature fetching not allowed. for feature fetching to be
+        // allowed there has to have been a bind operation
+        User::Leave( KErrNotReady );
+        }*/
+
+    iHost->GetConnection().GetSupportedFeaturesL( *arr );
+
+    for( TInt i = 0; i < arr->Count(); i++ )
+        {
+        feats->AddFeatureL( arr->MdcaPoint( i ) );
+        }
+    CleanupStack::PopAndDestroy( arr );
+
+    return feats;
+    }
+
+// ---------------------------------------------------------------------------
+// CXIMPPscContext::ClientInfo()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CXIMPContextClientInfoImp* CXIMPPscContext::ClientInfo() const
+    {
+    return iClientInfo;
+    }
+
+// ---------------------------------------------------------------------------
+// CXIMPPscContext::IsHostAssigned()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TBool CXIMPPscContext::IsHostAssigned() const
+    {
+    return iHost != NULL;
+    }
+    
+// ---------------------------------------------------------------------------
+// CXIMPPscContext::ResolveHostForOperationL()
+// ---------------------------------------------------------------------------
+//
+void CXIMPPscContext::ResolveHostL()
+    {
+    TRACE(_L("CXIMPPscContext::ResolveHostL() : begin" ) );
+    
+    CXIMPHost* host = CXIMPGlobals::Instance()->HostManager()->AcquireHostForContextLC( *this );
+    
+    TRACE_3(_L("CXIMPPscContext::ResolveHostL() : this =%d, host =%d , iHost=%d" ), this, host, iHost );
+    
+    if( !iHost )
+        {
+        host->RegisterSessionL( this );
+        iHost = host;
+        CleanupStack::Pop(); //host
+        }
+    else
+        {
+        CleanupStack::PopAndDestroy(); // host
+        }
+        
+    TRACE(_L("CXIMPPscContext::ResolveHostL() : end" ) );        
+    }
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/core/srcprocessor/ximppsccontextimp.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,262 @@
+/*
+* 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:  Client context data storage.
+*
+*/
+
+#ifndef C_XIMPPSCCONTEXT_H
+#define C_XIMPPSCCONTEXT_H
+
+
+#include "ximpbase.h"
+#include "ximppsccontext.h"
+#include <e32base.h>
+
+#include "ximprequestidbuilder.h"
+
+class CXIMPContextEventQueue;
+class CPresenceInfoImp;
+class CPresenceInfoFilterImp;
+class CXIMPOperationBase;
+class CXIMPServiceInfoImp;
+class CXIMPFeatureInfoImp;
+class CXIMPHost;
+class CXIMPContextClientInfoImp;
+class CPresenceFilterStore;
+class CXIMPIdentityImp;
+
+/**
+ * Client data for context.
+ *
+ * @since S60 v4.0
+ */
+class CXIMPPscContext : public CObject, 
+                        public MXIMPPscContext
+    {
+public:
+
+    /**
+     * Construction
+     */
+    IMPORT_C static CXIMPPscContext* NewL( TUint32 aSessionId );
+
+    /**
+     * Destruction
+     */
+    virtual ~CXIMPPscContext();
+
+private:
+
+    /**
+     * Construction
+     */
+    CXIMPPscContext( TUint32 aSessionId );
+
+    /**
+     * Construction
+     */
+    void ConstructL();
+
+
+public: // New methods
+
+    /**
+     * Access to eventqueue of context.
+     * return Reference to eventqueue.
+     */
+    IMPORT_C CXIMPContextEventQueue& EventQueue() const;
+    
+    /**
+     * Session id of context.
+     * @return session id.
+     */
+    IMPORT_C TUint32 SessionId() const;
+    
+    /**
+     * TLinearOrder method.
+     */
+    IMPORT_C static TInt OrderOfContexts( const CXIMPPscContext& aFirst, 
+                                          const CXIMPPscContext& aSecond );
+
+    /**
+     * Access to current presence interest. 
+     * @param Type of filter to access.
+     * @param aIdentity Identity to map filter. Default NULL
+     * @return Presence interest. NULL if not defined.
+     */
+    CPresenceInfoFilterImp* PresenceInfoFilter( TFilterStoreType aTypeOfFilter, 
+                                                    const CXIMPIdentityImp* aIdentity = NULL ) const;
+
+    /**
+     * Set new presence interest filter
+     * @param aTypeOfFilter Type of filter to access.
+     * @param aPif New presence info filter to set.
+     * @param aIdentity Identity to map filter. Default NULL
+     */
+    IMPORT_C void SetPresenceInfoFilterL( TFilterStoreType aTypeOfFilter,
+                                         CPresenceInfoFilterImp* aPif,
+                                         const CXIMPIdentityImp* aIdentity = NULL );
+        
+    /**
+     * Ownership is transferred
+     */
+    IMPORT_C CXIMPOperationBase* GetCachedUnbind();
+
+    /**
+     * When bind operation fails, the cached unbind
+     * must be destroyed.
+     */
+    IMPORT_C void DestroyCachedUnbind();
+
+    /**
+     * Set service info
+     */
+    IMPORT_C void SetServiceInfo( CXIMPServiceInfoImp* aServiceInfo );
+
+    /**
+     * Set service info
+     */
+    IMPORT_C void SetClientInfo( CXIMPContextClientInfoImp* aClientInfo );
+
+
+    /**
+     * Service info of context.
+     */
+    IMPORT_C CXIMPServiceInfoImp* ServiceInfo() const;
+
+
+    /**
+     * Append given operation to the end of the proper operation queue.
+     * The queue resides in the host associated with the given context.
+     * @param aOperation The operation to append
+     * @return Request id
+     */ 
+    IMPORT_C TXIMPRequestId AppendToOpQueueUpdateReqIdL(
+            CXIMPOperationBase* aOperation );
+    IMPORT_C void AppendToOpQueueL(
+            CXIMPOperationBase* aOperation );
+    /**
+     * Add new operation to be processed to the proper host.
+     *
+     * @param aOperation Enumeration describing the operation
+     * @param aReqParams Parameters for the operation
+     * @return The request id
+     */
+    IMPORT_C TXIMPRequestId AddNewOperationL( 
+            TInt aOperation,
+            const TDesC8& aReqParams );
+
+    /**
+     * Find cached features for this session
+     * @return The cached features
+     */
+    IMPORT_C CXIMPFeatureInfoImp* FeaturesForSessionLC();
+    
+    /**
+     * Client info of context
+     */
+    IMPORT_C CXIMPContextClientInfoImp* ClientInfo() const;
+    
+    /**
+     * Check if host is assigned.
+     * @return ETrue if host is assigned. EFalse if not
+     */
+    IMPORT_C TBool IsHostAssigned() const;
+    
+private:
+    
+    /**
+     * Resolve host for operation
+     */
+    void ResolveHostL();
+
+private: // data
+
+    /**
+     * Identifier for this session.
+     */
+    const TUint32 iSessionId;
+
+    /**
+     * Event queue for context-
+     */
+    CXIMPContextEventQueue* iEventQueue;
+    
+    /**
+     * Current presence interest.
+     */
+    CPresenceInfoFilterImp* iOwnPif;
+
+    /**
+     * Owned. Identity to filter mapping for this context.
+     */
+    CPresenceFilterStore* iPresentityFilterStore;
+
+    /**
+     * Owned. Identity to filter mapping for this context.
+     */
+    CPresenceFilterStore* iPresentityGroupFilterStore;
+    
+    /**
+     * Current grant everyone pif.
+     */
+    CPresenceInfoFilterImp* iGrantEveryonePif;
+    
+    /**
+     * Owned. Identity to filter mapping for this context.
+     */
+    CPresenceFilterStore* iGrantFilterStore;
+
+    /**
+     * Owned. Identity to filter mapping for this context.
+     */
+    CPresenceFilterStore* iGrantGroupFilterStore;
+    
+    /** 
+     * Unbind operation for need cases.
+     */
+    CXIMPOperationBase* iCachedUnbind;
+    
+    /**
+     * Service information structure.
+     * Owns.
+     */
+    CXIMPServiceInfoImp* iServiceInfo;
+
+    /**
+     * The host associated with this context.
+     * Owned via reference counting.
+     * Host has to be reference counted, since multiple contexts can own a
+     * reference to one host.
+     */
+    CXIMPHost* iHost;
+
+    /**
+     * Counter for the operations, used to build the request id.
+     */
+    TInt iOperationIndex;
+    
+    /**
+     * Client information structure
+     */
+    CXIMPContextClientInfoImp* iClientInfo;
+    
+    /**
+     * TXIMPRequestId builder
+     */
+    TXIMPRequestIdBuilder iReqIdBuilder;
+    };
+
+
+#endif // C_XIMPPSCCONTEXT_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/core/srcpscserver/ximpcontextsession.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,429 @@
+/*
+* 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:  Context session.
+ *
+*/
+
+#include "ximpcontextsession.h"
+#include "ximpsrvmessage.h"
+#include "ximpserverdefs.h"
+
+#include "ximpcontexteventqueue.h"
+#include "ximpcontexteventfilter.h"
+#include "ximphostmanager.h"
+#include "ximpglobals.h"
+#include "ximppsccontextimp.h"
+
+#include "ximpfeatureinfoimp.h"
+#include "ximpobjecthelpers.h"
+#include "ximppanics.h"
+#include "ximptrace.h"
+#include "ximpoperationdefs.h"
+#include "ximpoperationbase.h"
+
+#include "ximphoststates.h"
+
+#include <ximpbase.h>
+#include <e32base.h>
+
+using namespace NXIMPSrv;
+
+
+
+// ============================ MEMBER FUNCTIONS =============================
+
+// ---------------------------------------------------------------------------
+// CXIMPContextSession::NewL()
+// ---------------------------------------------------------------------------
+//
+CXIMPContextSession* CXIMPContextSession::NewL( TUint32 aSessionId )
+    {
+    CXIMPContextSession* self = new( ELeave ) CXIMPContextSession();
+    CleanupStack::PushL( self );
+    self->ConstructL( aSessionId );
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPContextSession::~CXIMPContextSession()
+// ---------------------------------------------------------------------------
+//
+CXIMPContextSession::~CXIMPContextSession()
+    {
+    TRACE_1( _L("CXIMPContextSession[%d]::~CXIMPContextSession()"), this );
+
+    delete iPreparedData;
+
+    if( iEventListenScout )
+        {
+        iEventListenScout->Complete( KErrCancel );
+        delete iEventListenScout;
+        }
+
+    iClientData->EventQueue().StopConsuming();
+
+    // Unbind when client has died, and unbind not send.
+    CXIMPOperationBase* operation = iClientData->GetCachedUnbind();
+
+    if( operation )
+        {
+        TRAP_IGNORE(
+            {
+            CleanupStack::PushL( operation );
+            iClientData->AppendToOpQueueL( operation );
+            CleanupStack::Pop( operation );
+            } );
+        }
+
+    iClientData->Close();
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPContextSession::CXIMPContextSession()
+// ---------------------------------------------------------------------------
+//
+CXIMPContextSession::CXIMPContextSession()
+    {
+    TRACE_1( _L("CXIMPContextSession[%d]::CXIMPContextSession()"), this );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CXIMPContextSession::ConstructL()
+// -----------------------------------------------------------------------------
+//
+void CXIMPContextSession::ConstructL( TUint32 aSessionId )
+    {
+    iClientData = CXIMPPscContext::NewL( aSessionId );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CXIMPContextSession::TryHandleMessageL()
+// From MXIMPSrvSession
+// -----------------------------------------------------------------------------
+//
+void CXIMPContextSession::TryHandleMessageL( MXIMPSrvMessage& aMessage )
+    {
+    switch( aMessage.Function() )
+        {
+        //Asynchronous context operations related
+        case NRequest::ECtxSsQueueOperation:
+            {
+            DoQueueOperationL( aMessage );
+            break;
+            }
+        //Asynchronous context operations related
+        case NRequest::ECtxSsQueueBindOperation:
+            {
+            DoQueueOperationL( aMessage );
+            break;
+            }
+
+        //Event handling related
+        case NRequest::ECtxSsInstallEventFilter:
+            {
+            DoInstallEventFilterL( aMessage );
+            break;
+            }
+
+        case NRequest::ECtxSsSetEventListenScout:
+            {
+            DoSetEventListenScoutL( aMessage );
+            break;
+            }
+
+        case NRequest::ECtxSsCancelEventListenScout:
+            {
+            DoCancelEventListenScout( aMessage );
+            break;
+            }
+
+        case NRequest::ECtxSsFetchTopEventDataSize:
+            {
+            DoFetchTopEventDataSizeL( aMessage );
+            break;
+            }
+
+        case NRequest::ECtxSsFetchTopEventData:
+            {
+            DoFetchTopEventDataL( aMessage );
+            break;
+            }
+
+        case NRequest::ECtxSsFetchTopEventReqId:
+            {
+            DoFetchTopEventReqIdL( aMessage );
+            break;
+            }
+
+        case NRequest::ECtxSsDropTopEvent:
+            {
+            DoDropTopEventL( aMessage );
+            break;
+            }
+
+        //Synchronous context data access
+        case NRequest::ECtxSsPrepareContextFeatures:
+            {
+            DoPrepareContextFeaturesL( aMessage );
+            break;
+            }
+
+        case NRequest::ECtxSsGetPreparedData:
+            {
+            DoGetPreparedDataL( aMessage );
+            break;
+            }
+
+        default:
+            {
+            //Unknown request type
+            //Nothing to do here.
+            }
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CXIMPContextSession::NewEventAvailable()
+// From MXIMPEventQueueObserver
+// -----------------------------------------------------------------------------
+//
+void CXIMPContextSession::NewEventAvailable()
+    {
+    if( iEventListenScout )
+        {
+        iEventListenScout->Complete( KErrNone );
+        delete iEventListenScout;
+        iEventListenScout = NULL;
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CXIMPContextSession::DoQueueOperationL()
+// -----------------------------------------------------------------------------
+//
+void CXIMPContextSession::DoQueueOperationL(
+    MXIMPSrvMessage& aMessage )
+    {
+    const TInt operationType = aMessage.Int( MXIMPSrvMessage::Ep0 );
+
+    TPckgBuf< TXIMPRequestId > reqIdBuf;
+
+    // We can take ready unbind from context if it exists.
+    CXIMPOperationBase* operation = NULL;
+    if( operationType == NXIMPOps::EXIMPUnbindContext )
+        {
+        operation = iClientData->GetCachedUnbind();
+        // ownership transferred
+        }
+
+    if( operation )
+        {
+        // found an unbind, so put it to the queue to be processed
+        CleanupStack::PushL( operation );
+        iClientData->AppendToOpQueueL( operation );
+        reqIdBuf() = operation->RequestId();
+        CleanupStack::Pop( operation );
+        }
+    else
+        {
+        const TInt pckSize = aMessage.GetDesLengthL( MXIMPSrvMessage::Ep1 );
+        HBufC8* paramPck = HBufC8::NewLC( pckSize );
+        TPtr8 paramPckPtr = paramPck->Des();
+        aMessage.ReadL( MXIMPSrvMessage::Ep1, paramPckPtr );
+        reqIdBuf() = iClientData->AddNewOperationL( operationType,
+                *paramPck );
+        CleanupStack::PopAndDestroy( paramPck );
+        }
+
+    aMessage.WriteL( MXIMPSrvMessage::Ep2, reqIdBuf );
+    aMessage.Complete( KErrNone );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CXIMPContextSession::DoInstallEventFilterL()
+// -----------------------------------------------------------------------------
+//
+void CXIMPContextSession::DoInstallEventFilterL(
+    MXIMPSrvMessage& aMessage )
+    {
+    const TInt pckSize = aMessage.GetDesLengthL( MXIMPSrvMessage::Ep0 );
+    HBufC8* filterPck = HBufC8::NewLC( pckSize );
+    TPtr8 filterPckPtr( filterPck->Des() );
+    aMessage.ReadL( MXIMPSrvMessage::Ep0, filterPckPtr );
+
+    CXIMPContextEventFilter* newFilter = CXIMPContextEventFilter::NewLC();
+    TXIMPObjectPacker< CXIMPContextEventFilter >::UnPackL( *newFilter,
+                                                                   *filterPck );
+
+    iClientData->EventQueue().SetEventFilter( *newFilter );
+    CleanupStack::Pop( newFilter );
+    CleanupStack::PopAndDestroy( filterPck );
+
+    aMessage.Complete( KErrNone );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CXIMPContextSession::DoSetEventListenScoutL()
+// -----------------------------------------------------------------------------
+//
+void CXIMPContextSession::DoSetEventListenScoutL(
+    MXIMPSrvMessage& aMessage )
+    {
+    __ASSERT_ALWAYS( !iEventListenScout,
+                     aMessage.PanicClientAndLeaveL(
+                     NXIMPPanic::EOnSrvAlreadyListeningEvents ) );
+
+    iClientData->EventQueue().StartConsuming( *this );
+
+    //If there is already a events in que,
+    //signal client right a way
+    if( iClientData->EventQueue().HasElements() )
+        {
+        aMessage.Complete( KErrNone );
+        }
+    else
+        {
+        aMessage.PlaceOwnershipHere( iEventListenScout );
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CXIMPContextSession::DoCancelEventListenScout()
+// -----------------------------------------------------------------------------
+//
+void CXIMPContextSession::DoCancelEventListenScout(
+    MXIMPSrvMessage& aMessage )
+    {
+    if( iEventListenScout )
+        {
+        iEventListenScout->Complete( KErrCancel );
+        delete iEventListenScout;
+        iEventListenScout = NULL;
+        }
+
+    iClientData->EventQueue().StopConsuming();
+    aMessage.Complete( KErrNone );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CXIMPContextSession::DoFetchTopEventDataSizeL()
+// -----------------------------------------------------------------------------
+//
+void CXIMPContextSession::DoFetchTopEventDataSizeL(
+    MXIMPSrvMessage&  aMessage )
+    {
+    iClientData->EventQueue().SelectTopEventIfNeededL();
+    aMessage.Complete( iClientData->EventQueue().TopEventDataL().Size() );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CXIMPContextSession::DoFetchTopEventDataL()
+// -----------------------------------------------------------------------------
+//
+void CXIMPContextSession::DoFetchTopEventDataL(
+    MXIMPSrvMessage& aMessage )
+    {
+    iClientData->EventQueue().SelectTopEventIfNeededL();
+    aMessage.WriteL( MXIMPSrvMessage::Ep0, iClientData->EventQueue().TopEventDataL() );
+    aMessage.Complete( KErrNone );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CXIMPContextSession::DoFetchTopEventReqIdL()
+// -----------------------------------------------------------------------------
+//
+void CXIMPContextSession::DoFetchTopEventReqIdL(
+    MXIMPSrvMessage& aMessage )
+    {
+    TPckgBuf< TXIMPRequestId > reqIdBuf;
+    
+    iClientData->EventQueue().SelectTopEventIfNeededL();
+    reqIdBuf() = iClientData->EventQueue().TopEventReqIdL();
+
+    aMessage.WriteL( MXIMPSrvMessage::Ep0, reqIdBuf );
+    aMessage.Complete( KErrNone );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CXIMPContextSession::DoDropTopEventL()
+// -----------------------------------------------------------------------------
+//
+void CXIMPContextSession::DoDropTopEventL(
+    MXIMPSrvMessage& aMessage )
+    {
+    iClientData->EventQueue().DropTopEvent();
+    aMessage.Complete( KErrNone );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CXIMPContextSession::DoPrepareContextFeaturesL()
+// -----------------------------------------------------------------------------
+//
+void CXIMPContextSession::DoPrepareContextFeaturesL(
+    MXIMPSrvMessage& aMessage )
+    {
+    __ASSERT_ALWAYS( !iPreparedData,
+                     aMessage.PanicClientAndLeaveL(
+                     NXIMPPanic::EOnSrvAlreadyHavingPrepearedData ) );
+
+
+    CXIMPFeatureInfoImp* feats = iClientData->FeaturesForSessionLC();
+    iPreparedData = TXIMPObjectPacker< CXIMPFeatureInfoImp >::PackL( *feats );
+    CleanupStack::PopAndDestroy( feats );
+
+    aMessage.Complete( iPreparedData->Size() );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CXIMPContextSession::DoGetPreparedDataL()
+// -----------------------------------------------------------------------------
+//
+void CXIMPContextSession::DoGetPreparedDataL(
+    MXIMPSrvMessage& aMessage )
+    {
+    //Release the prepared data from member variable
+    //Buffer gets cleaned even the copying to client side fails
+    HBufC8* tmpBuf = iPreparedData;
+    iPreparedData = NULL;
+    CleanupStack::PushL( tmpBuf );
+
+    //Assert that there is a data to copy to client
+    __ASSERT_ALWAYS( tmpBuf,
+                     aMessage.PanicClientAndLeaveL(
+                     NXIMPPanic::EOnSrvNoPrepearedDataToCopy ) );
+
+    aMessage.WriteL( MXIMPSrvMessage::Ep0, *tmpBuf );
+
+    CleanupStack::PopAndDestroy( tmpBuf );
+    aMessage.Complete( KErrNone );
+    }
+
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/core/srcpscserver/ximpcontextsession.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,95 @@
+/*
+* 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:  Context session.
+ *
+*/
+
+#ifndef XIMPCONTEXTSESSION_H
+#define XIMPCONTEXTSESSION_H
+
+
+#include "ximpsrvsession.h"
+#include "ximpeventqueueobserver.h"
+#include <e32base.h>
+
+
+class MXIMPSrvMessage;
+class CXIMPPscContext;
+
+
+/**
+ * Context session implementation.
+ */
+class CXIMPContextSession : public CBase,
+                            public MXIMPSrvSession,
+                            public MXIMPEventQueueObserver
+    {
+public:     // Constructors and destructors
+    static CXIMPContextSession* NewL( TUint32 aSessionId );
+    virtual ~CXIMPContextSession();
+
+
+protected:  // Constructors
+    CXIMPContextSession();
+    void ConstructL( TUint32 aSessionId );
+
+
+public: // From MXIMPSrvSession
+    void TryHandleMessageL( MXIMPSrvMessage& aMessage );
+
+
+public: // MXIMPEventQueueObserver
+    void NewEventAvailable();
+
+
+private:    // New methods
+
+
+    void DoQueueOperationL( MXIMPSrvMessage& aMessage );
+
+    void DoInstallEventFilterL( MXIMPSrvMessage& aMessage );
+    void DoSetEventListenScoutL( MXIMPSrvMessage& aMessage );
+    void DoCancelEventListenScout( MXIMPSrvMessage& aMessage );
+    void DoFetchTopEventDataSizeL( MXIMPSrvMessage& aMessage );
+    void DoFetchTopEventDataL( MXIMPSrvMessage& aMessage );
+    void DoFetchTopEventReqIdL( MXIMPSrvMessage& aMessage );
+    void DoDropTopEventL( MXIMPSrvMessage& aMessage );
+    
+    
+    void DoPrepareContextFeaturesL( MXIMPSrvMessage& aMessage );
+    void DoGetPreparedDataL( MXIMPSrvMessage& aMessage );
+
+
+
+private:    // Data
+
+    /**
+     *
+     */
+    MXIMPSrvMessage* iEventListenScout;
+
+    /**
+     * Buffer caching the prepared data
+     */
+    HBufC8* iPreparedData;
+    
+    /**
+     * Storage for client data.
+     */
+    CXIMPPscContext* iClientData;
+    };
+
+#endif      //  XIMPSESSION_H__
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/core/srcpscserver/ximpserver.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  XIMP Framework PSC server class
+ *
+*/
+
+#include "ximpserverdefs.h"
+#include "ximpserver.h"
+#include "ximpserversessionadapter.h"
+#include "ximptrace.h"
+#include "ximpglobals.h"
+#include "ximpoperationfactoryimp.h"
+#include <ecom/ecom.h>
+
+//Include PSC server namespace
+using namespace NXIMPSrv;
+
+
+
+// ==============================================================
+// =============== PLATSEC POLICY CONFIGURATION =================
+// ==============================================================
+static const TInt KXIMPServerPlatSecRangeCount = 3;
+
+static const TInt KXIMPServerPlatSecPolicyIndex0 = 0;
+static const TInt KXIMPServerPlatSecPolicyIndex1 = 1;
+
+//Ranges for the Request values
+static const TInt KXIMPServerPlatSecRanges[ KXIMPServerPlatSecRangeCount ] =
+    {
+    0,
+    NRequest::ECtxSsQueueBindOperation,
+    NRequest::EOpCodeTop
+    };
+
+
+// Element indexes for the defined ranges
+static const TUint8 KXIMPServerPlatSecElementsIndex[ KXIMPServerPlatSecRangeCount ] =
+    {
+    KXIMPServerPlatSecPolicyIndex0,
+    KXIMPServerPlatSecPolicyIndex1,
+    CPolicyServer::ENotSupported
+    };
+
+
+// Policy elements
+static const CPolicyServer::TPolicyElement KXIMPServerPlatSecElements[] =
+    {
+        {
+        // Policy 0, KXIMPServerPlatSecPolicyIndex0
+        _INIT_SECURITY_POLICY_C3( ECapabilityReadUserData,
+                                  ECapabilityWriteUserData,
+                                  ECapabilityNetworkServices ),
+        CPolicyServer::EFailClient
+        },
+        {
+        // Policy 1, KXIMPServerPlatSecPolicyIndex1
+        _INIT_SECURITY_POLICY_C4( ECapabilityReadDeviceData,
+                                  ECapabilityReadUserData,
+                                  ECapabilityWriteUserData,
+                                  ECapabilityNetworkServices ),
+        CPolicyServer::EFailClient
+        }
+    };
+
+
+// The platsec policy
+static const CPolicyServer::TPolicy KXIMPServerPlatSecPolicy =
+    {
+    // Shortcut to the index into Elements,that is used to check a connection attempt
+    KXIMPServerPlatSecPolicyIndex0,
+
+    // Number of ranges in the iRanges array
+    KXIMPServerPlatSecRangeCount,
+
+    // A pointer to an array of ordered ranges of request numbers
+    KXIMPServerPlatSecRanges,
+
+    // A pointer to an array of TUint8 values specifying
+    // the appropriate action to take for each range in iRanges
+    KXIMPServerPlatSecElementsIndex,
+
+    // A pointer to an array of distinct policy elements
+    KXIMPServerPlatSecElements
+    };
+
+
+
+// -----------------------------------------------------------------------------
+// CXIMPServer::ExecuteL()
+// -----------------------------------------------------------------------------
+//
+void CXIMPServer::ExecuteL()
+    {
+    // start scheduler
+    CActiveScheduler* pA = new( ELeave )CActiveScheduler;
+    CleanupStack::PushL( pA );
+    CActiveScheduler::Install( pA );
+
+    // create server
+    CXIMPServer* server = CXIMPServer::NewLC();
+
+    // rename our thread properly
+    // first, find out the UID set by process starter
+    TInt uid = 0;
+    TInt ret = User::GetTIntParameter( NStartupParam::KProtocolUidIndex,
+                                       uid );
+    User::LeaveIfError( ret );
+
+    // create the "!XIMPCtxSrv9bde667a" server name
+    HBufC* serverName = HBufC::NewLC( NName::KSymbianServer().Length() +
+                                      NStartupParam::KProtocolUidMaxLen +
+                                      1 );
+
+    serverName->Des().Copy( NName::KSymbianServer );
+    serverName->Des().AppendNumFixedWidth( uid,
+                                           EHex,
+                                           NStartupParam::KProtocolUidMaxLen );
+
+    // and set it
+    User::RenameThread( *serverName );
+    server->StartL( *serverName );
+
+    CleanupStack::PopAndDestroy( serverName );
+
+    //Signal client that we are started
+    RProcess().Rendezvous( KErrNone );
+
+    //Execute the server
+    CActiveScheduler::Start(); // CSI: 3 #
+
+    //Cleanup
+    CleanupStack::PopAndDestroy( server );//server
+    CleanupStack::PopAndDestroy( pA );
+    CActiveScheduler::Install( NULL );
+    }
+
+
+
+// -----------------------------------------------------------------------------
+// CXIMPServer::~CXIMPServer()
+// -----------------------------------------------------------------------------
+//
+CXIMPServer::~CXIMPServer()
+    {
+    CXIMPGlobals::UninstallD();
+    REComSession::FinalClose();
+
+    #if _BullseyeCoverage
+    cov_write();
+    #endif    
+    }
+
+
+// -----------------------------------------------------------------------------
+// CXIMPServer::CXIMPServer()
+// -----------------------------------------------------------------------------
+//
+CXIMPServer::CXIMPServer()
+    : CPolicyServer( CActive::EPriorityStandard, KXIMPServerPlatSecPolicy )
+    {
+    iSessionId = 1;   // start from 1. 0 reserved for host-originated operations
+    }
+
+
+// -----------------------------------------------------------------------------
+// CXIMPServer::NewLC()
+// -----------------------------------------------------------------------------
+//
+CXIMPServer* CXIMPServer::NewLC()
+    {
+    CXIMPServer* self = new( ELeave ) CXIMPServer;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CXIMPServer::ConstructL()
+// -----------------------------------------------------------------------------
+//
+void CXIMPServer::ConstructL()
+    {
+    CXIMPOperationFactory* operationFactory = CXIMPOperationFactory::NewL();
+    CleanupStack::PushL( operationFactory );
+    CXIMPGlobals::InstallL( operationFactory, this );
+    CleanupStack::Pop( operationFactory );
+    iGlobals = CXIMPGlobals::Instance();
+    }
+
+
+// -----------------------------------------------------------------------------
+// CXIMPServer::NewSessionL()
+// -----------------------------------------------------------------------------
+//
+CSession2* CXIMPServer::NewSessionL( const TVersion &aVersion,
+                                        const RMessage2& /* aMessage */ ) const
+    {
+    TVersion srvVersion( NVersion::KMajor,
+                         NVersion::KMinor,
+                         NVersion::KBuild );
+
+    if( !User::QueryVersionSupported( aVersion, srvVersion ) )
+        {
+        User::Leave( KErrNotSupported );
+        }
+
+    CXIMPServer* self = const_cast< CXIMPServer* >( this );
+    self->iSessionId++;
+    return CXIMPServerSessionAdapter::NewL( iSessionId, 
+                                               *self );
+    };
+
+
+// -----------------------------------------------------------------------------
+// CXIMPServer::SessionCreated()
+// -----------------------------------------------------------------------------
+//
+void CXIMPServer::SessionCreated()
+    {
+    iSessionCount++;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CXIMPServer::SessionDied()
+// -----------------------------------------------------------------------------
+//
+void CXIMPServer::SessionDied()
+    {
+    iSessionCount--;
+    TryToStopScheduling();
+    }
+    
+// -----------------------------------------------------------------------------
+// CXIMPServer::AllHostsDied()
+// -----------------------------------------------------------------------------
+//
+void CXIMPServer::AllHostsDied()
+    {
+    // all hosts have died.
+    iAllHostsDied = ETrue;
+    TryToStopScheduling();
+    }
+
+// -----------------------------------------------------------------------------
+// CXIMPServer::AllHostsDied()
+// -----------------------------------------------------------------------------
+//
+void CXIMPServer::TryToStopScheduling()
+    {
+    if( iSessionCount == 0 && iAllHostsDied )
+        {
+        CActiveScheduler::Stop(); // CSI: 4 #
+        }    
+    }
+
+// -----------------------------------------------------------------------------
+// CXIMPServer::TestListener()
+// -----------------------------------------------------------------------------
+//
+MXIMPSrvTestListener* CXIMPServer::TestListener() const
+    {
+    return iTestListener;
+    }
+    
+// -----------------------------------------------------------------------------
+// CXIMPServer::RegisterTestListener()
+// -----------------------------------------------------------------------------
+//
+void CXIMPServer::RegisterTestListener( MXIMPSrvTestListener* aTestSession )
+    {
+    iTestListener = aTestSession;
+    }
+    
+// -----------------------------------------------------------------------------
+// E32Main()
+// ENTRY POINT
+// -----------------------------------------------------------------------------
+//
+GLDEF_C TInt E32Main()
+    {
+    TRACE( _L("PSC Server E32Main - enter") );
+
+    __UHEAP_MARK;
+
+    CTrapCleanup* tc = CTrapCleanup::New();
+    if( !tc )
+        {
+        return KErrNoMemory;
+        }
+
+    User::RenameThread( NName::KMainThread );
+
+    TRAPD( err, CXIMPServer::ExecuteL() );
+    delete tc;
+
+    __UHEAP_MARKEND;
+
+    TRACE_1( _L("PSC Server E32Main - exit: %d"), err );
+    return err;
+    }
+
+
+//  END OF FILE
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/core/srcpscserver/ximpserver.h	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  XIMP Framework PSC server class
+ *
+*/
+
+#ifndef CXIMPPSCSERVER_H
+#define CXIMPPSCSERVER_H
+
+#include "ximpsrv.h"
+#include <ximpbase.h>
+#include "ximpglobalsobserver.h"
+
+#include <e32base.h>
+
+
+class CXIMPGlobals;
+class MXIMPSrvTestListener;
+
+
+/**
+ * Presence Service Connection (PSC) server implementation.
+ * There exists one PSC server per protocol.
+ */
+class CXIMPServer : public CPolicyServer,
+                       public MXIMPSrv,
+                       public MXIMPGlobalsObserver
+    {
+public:     // Execution and destructor
+    static void ExecuteL();
+    virtual ~CXIMPServer();
+
+public: // from MXIMPGlobalsObserver
+    void AllHostsDied();
+
+private:    // Constructors
+    static CXIMPServer* NewLC();    
+    CXIMPServer();
+    void ConstructL();
+    
+    
+private:     // From CPolicyServer
+    CSession2* NewSessionL( const TVersion& aVersion,
+                            const RMessage2& aMessage ) const;
+
+
+private:     // From MXIMPSrv
+    void SessionCreated();
+    void SessionDied();
+    MXIMPSrvTestListener* TestListener() const; 
+    void RegisterTestListener( MXIMPSrvTestListener* aTestSession );
+
+private: // Helper
+    
+    void TryToStopScheduling();
+
+private:    //Data
+
+    // OWN: Count of sessions
+    TInt iSessionCount;
+    TBool iAllHostsDied;
+
+
+    // OWN: Always increasing session id.
+    TUint32 iSessionId;
+
+    // OWN: pointer to globals singleton
+    CXIMPGlobals* iGlobals;
+    
+    // Does not own. Pointer to test listener.
+    MXIMPSrvTestListener* iTestListener;
+    };
+
+#endif      // CXIMPPSCSERVER_H
+
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/core/srcpscserver/ximpserverdefs.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,105 @@
+/*
+* 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:  Defines for XIMP Framework PSC server.
+ *
+*/
+
+#ifndef XIMPPSCSERVERDEFS_H
+#define XIMPPSCSERVERDEFS_H
+
+#include <e32std.h>
+
+/*
+ * ============================================================================
+ * Presence Service Connection (PSC) server constants
+ * ============================================================================
+ */
+namespace NXIMPSrv
+    {
+    /**
+     * PSC server version numbers
+     */
+    namespace NVersion
+        {
+        const TInt KMajor = 1;
+        const TInt KMinor = 1;
+        const TInt KBuild = 1;
+        }
+
+
+    /**
+     * PSC server names
+     */
+    namespace NName
+        {
+        _LIT( KExecutable,      "ximpserver.exe" );
+        _LIT( KMainThread,      "XIMPPscSrv" );
+        _LIT( KSymbianServer,   "!XIMPPscSrv" );
+        _LIT( KServerPattern,   "*XIMP*" );
+        }
+
+
+    /**
+     * PSC server start-up parameters
+     */
+    namespace NStartupParam
+        {
+         //RProcess parameter slot for the protocol UID
+        const TInt KProtocolUidIndex = 1;
+
+         //Maximum length for the UID string
+        const TInt KProtocolUidMaxLen = 8;
+        }
+
+
+    /**
+     * PSC server requests
+     */
+    namespace NRequest
+        {
+        //Number asynchronous message slots for PSC server
+        const TUint KMsgSlotCount = 4;
+
+        //PSC Server op codes
+        enum TOpCodes
+            {
+            EBecomeCtxSession = 1,
+
+            ECtxSsQueueOperation,
+            
+            ECtxSsInstallEventFilter,
+            ECtxSsSetEventListenScout,
+            ECtxSsCancelEventListenScout,
+            ECtxSsFetchTopEventDataSize,
+            ECtxSsFetchTopEventData,
+            ECtxSsFetchTopEventReqId,
+            ECtxSsDropTopEvent,
+            
+            ECtxSsPrepareContextFeatures,
+            ECtxSsGetPreparedData,
+
+            ECtxSsQueueBindOperation,   // 12
+
+            EOpCodeTop
+            };
+        }
+    }
+
+
+#endif  //XIMPPSCSERVERDEFS_H
+
+
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/core/srcpscserver/ximpserversessionadapter.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,88 @@
+/*
+* 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:  PSC server session adapter
+ *
+*/
+
+#include "ximpserversessionadapter.h"
+#include "ximpserverdefs.h"
+#include "ximpsrvmessage.h"
+#include "ximpcontextsession.h"
+#include "ximpsrv.h"
+#include <e32base.h>
+
+
+//Include PSC server namespace
+using namespace NXIMPSrv;
+
+
+
+// -----------------------------------------------------------------------------
+// CXIMPServerSessionAdapter::NewL()
+// -----------------------------------------------------------------------------
+//
+CXIMPServerSessionAdapter* CXIMPServerSessionAdapter::NewL( 
+    TUint32 aSessionId,
+    MXIMPSrv& aServer )
+    {
+    CXIMPServerSessionAdapter* self = 
+            new( ELeave ) CXIMPServerSessionAdapter( aSessionId,
+                                                        aServer );
+    return self;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CXIMPServerSessionAdapter::~CXIMPServerSessionAdapter()
+// -----------------------------------------------------------------------------
+//
+CXIMPServerSessionAdapter::~CXIMPServerSessionAdapter()
+    {
+    }
+
+
+// -----------------------------------------------------------------------------
+// CXIMPServerSessionAdapter::CXIMPServerSessionAdapter()
+// -----------------------------------------------------------------------------
+//
+CXIMPServerSessionAdapter::CXIMPServerSessionAdapter( 
+    TUint32 aSessionId,
+    MXIMPSrv& aServer )
+    : CXIMPSrvSessionAdapter( aServer ),
+      iSessionId( aSessionId )
+    {
+    }
+
+
+// -----------------------------------------------------------------------------
+// CXIMPServerSessionAdapter::DoInstantiateSessionL()
+// -----------------------------------------------------------------------------
+//
+MXIMPSrvSession* CXIMPServerSessionAdapter::DoInstantiateSessionL( 
+    const MXIMPSrvMessage& aMessage )
+    {
+    switch( aMessage.Function() )
+        {
+        case NRequest::EBecomeCtxSession:
+            {
+            return CXIMPContextSession::NewL( iSessionId );
+            }
+        default:
+            {
+            return NULL;
+            }        
+        }
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/core/srcpscserver/ximpserversessionadapter.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,68 @@
+/*
+* 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:  PSC server session adapter
+ *
+*/
+
+
+#ifndef XIMPPSCSERVERSESSIONADAPTER_H
+#define XIMPPSCSERVERSESSIONADAPTER_H
+
+#include <e32base.h>
+#include "ximpsrvsessionadapter.h"
+
+class MXIMPSrv;
+class MXIMPSrvSession;
+class MXIMPSrvMessage;
+
+
+/**
+ * Session adapter for XIMP Framework PSC server. 
+ */
+class CXIMPServerSessionAdapter : public CXIMPSrvSessionAdapter
+    {
+public:     // Constructors and destructors
+    static CXIMPServerSessionAdapter* NewL( TUint32 aSessionId,
+                                               MXIMPSrv& aServer );
+    virtual ~CXIMPServerSessionAdapter();
+
+protected:  // C++ constructors
+    CXIMPServerSessionAdapter( TUint32 aSessionId,
+                                  MXIMPSrv& aServer );
+
+
+public:     // From CXIMPSrvSessionAdapter
+
+    /**
+     * Template method to instantiate concrete 
+     * PSC session objects.
+     *
+     * @param aMessage The session instantiation message.
+     *
+     * @return Session implementation object or NULL if the message
+     *         isn't valid session instantiation request.
+     */
+    MXIMPSrvSession* DoInstantiateSessionL( const MXIMPSrvMessage& aMessage );
+
+
+private:    // Data
+
+    /**
+     * Identifier for this session. 
+     */
+    TUint32 iSessionId;
+    };
+
+#endif      //  XIMPPSCSERVERSESSIONADAPTER_H
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/core/srcrootserver/ximprootserver.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,246 @@
+/*
+* 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:  Root server implementation
+ *
+*/
+
+#include <ecom/ecom.h>
+
+#include "ximprootserver.h"
+#include "ximprootserversessionadapter.h"
+#include "ximprootserverdefs.h"
+#include "ximptrace.h"
+#include "ximpglobals.h"
+#include "ximpoperationfactoryimp.h"
+
+//Include Root server namespace
+using namespace NRootSrv;
+
+
+// ==============================================================
+// =============== PLATSEC POLICY CONFIGURATION =================
+// ==============================================================
+static const TInt KXIMPRootServerPlatSecRangeCount = 2;
+
+//Ranges for the Request values
+static const TInt KXIMPRootServerPlatSecRanges[ KXIMPRootServerPlatSecRangeCount ] =
+    {
+    0,
+    Max( ( TInt )NRootSrv::NRequest::EOpCodeTop, ( TInt )NRequest::EOpCodeTop )
+    };
+
+
+// Element indexes for the defined ranges
+static const TUint8 KXIMPRootServerPlatSecElementsIndex[ KXIMPRootServerPlatSecRangeCount ] =
+    {
+    0,
+    CPolicyServer::ENotSupported
+    };
+
+
+// Policy elements
+static const CPolicyServer::TPolicyElement KXIMPRootServerPlatSecElements[] =
+    {
+        {
+        _INIT_SECURITY_POLICY_C3( ECapabilityReadUserData,
+                ECapabilityWriteUserData,
+                ECapabilityNetworkServices ),
+        CPolicyServer::EFailClient
+        }
+    };
+
+
+// The platsec policy
+static const CPolicyServer::TPolicy KXIMPRootServerPlatSecPolicy =
+    {
+    // Shortcut to the index into Elements,that is used to check a connection attempt
+    0,
+
+    // Number of ranges in the iRanges array
+    KXIMPRootServerPlatSecRangeCount,
+
+    // A pointer to an array of ordered ranges of request numbers
+    KXIMPRootServerPlatSecRanges,
+
+    // A pointer to an array of TUint8 values specifying
+    // the appropriate action to take for each range in iRanges
+    KXIMPRootServerPlatSecElementsIndex,
+
+    // A pointer to an array of distinct policy elements
+    KXIMPRootServerPlatSecElements
+    };
+
+
+
+// -----------------------------------------------------------------------------
+// CXIMPRootServer::ExecuteL()
+// -----------------------------------------------------------------------------
+//
+void CXIMPRootServer::ExecuteL()
+    {
+    // start scheduler
+    CActiveScheduler* pA = new( ELeave )CActiveScheduler;
+    CleanupStack::PushL( pA );
+    CActiveScheduler::Install( pA );
+
+    // create server
+    CXIMPRootServer* server = CXIMPRootServer::NewLC();
+    server->StartL( NName::KSymbianServer );
+
+    //Signal client that we are started
+    RProcess().Rendezvous( KErrNone );
+
+    //Execute the server
+    CActiveScheduler::Start(); // CSI: 3 #
+
+    //Cleanup
+    CleanupStack::PopAndDestroy( server );//server
+    CleanupStack::PopAndDestroy( pA );
+    CActiveScheduler::Install( NULL );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CXIMPRootServer::~CXIMPRootServer()
+// -----------------------------------------------------------------------------
+//
+CXIMPRootServer::~CXIMPRootServer()
+    {
+    CXIMPGlobals::UninstallD();
+    REComSession::FinalClose();
+    
+    #if _BullseyeCoverage
+    cov_write();
+    #endif
+    }
+
+
+// -----------------------------------------------------------------------------
+// CXIMPRootServer::CXIMPRootServer()
+// -----------------------------------------------------------------------------
+//
+CXIMPRootServer::CXIMPRootServer()
+    : CPolicyServer( CActive::EPriorityStandard,
+                     KXIMPRootServerPlatSecPolicy )
+    {
+    }
+
+
+// -----------------------------------------------------------------------------
+// CXIMPRootServer::NewLC()
+// -----------------------------------------------------------------------------
+//
+CXIMPRootServer* CXIMPRootServer::NewLC()
+    {
+    CXIMPRootServer* self = new( ELeave ) CXIMPRootServer;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CXIMPRootServer::ConstructL()
+// -----------------------------------------------------------------------------
+//
+void CXIMPRootServer::ConstructL()
+    {
+    CXIMPOperationFactory* operationFactory = CXIMPOperationFactory::NewL();
+    CleanupStack::PushL( operationFactory );
+    CXIMPGlobals::InstallL( operationFactory, NULL );
+    CleanupStack::Pop( operationFactory );
+    iGlobals = CXIMPGlobals::Instance();        
+    }
+
+
+// -----------------------------------------------------------------------------
+// CXIMPRootServer::NewSessionL()
+// -----------------------------------------------------------------------------
+//
+CSession2* CXIMPRootServer::NewSessionL( const TVersion &aVersion,
+                                         const RMessage2& /* aMessage */ ) const
+    {
+    TVersion srvVersion( NVersion::KMajor,
+                         NVersion::KMinor,
+                         NVersion::KBuild );
+
+    if( !User::QueryVersionSupported( aVersion, srvVersion ) )
+        {
+        User::Leave( KErrNotSupported );
+        }
+
+    CXIMPRootServer* self = const_cast< CXIMPRootServer* >( this );
+    CSession2* session = NULL;
+   
+    TRAPD( err, session = CXIMPRootServerSessionAdapter::NewL( *self ) );
+    User::LeaveIfError( err );
+    return session;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CXIMPRootServer::SessionCreated()
+// -----------------------------------------------------------------------------
+//
+void CXIMPRootServer::SessionCreated()
+    {
+    iSessionCount++;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CXIMPRootServer::SessionDied()
+// -----------------------------------------------------------------------------
+//
+void CXIMPRootServer::SessionDied()
+    {
+    iSessionCount--;
+    if( iSessionCount == 0 )
+        {
+        CActiveScheduler::Stop(); // CSI: 4 #
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// E32Main()
+// ENTRY POINT
+// -----------------------------------------------------------------------------
+//
+GLDEF_C TInt E32Main()
+    {
+    TRACE( _L("Root E32Main - enter") );
+
+    __UHEAP_MARK;
+
+    User::RenameThread( NName::KMainThread );
+
+    CTrapCleanup* tc = CTrapCleanup::New();
+    if( !tc )
+        {
+        return KErrNoMemory;
+        }
+
+    TRAPD( err, CXIMPRootServer::ExecuteL() );
+    delete tc;
+
+    __UHEAP_MARKEND;
+
+    TRACE_1( _L("Root E32Main - exit: %d"), err );
+    return err;
+    }
+
+
+//  END OF FILE
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/core/srcrootserver/ximprootserver.h	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  Root server implementation
+ *
+*/
+
+#ifndef CXIMPROOTSERVER_H
+#define CXIMPROOTSERVER_H
+
+#include "ximpsrv.h"
+#include <e32base.h>
+#include <ximpbase.h>
+
+class CXIMPGlobals;
+class MXIMPSrvTestListener;
+
+/**
+ * Presence Root server implementation.
+ * There exists one root server.
+ */
+class CXIMPRootServer : public CPolicyServer,
+                        public MXIMPSrv
+    {
+public:     // Execution and destructor
+
+    static void ExecuteL();
+    virtual ~CXIMPRootServer();
+
+
+private:    //Constructors
+
+    static CXIMPRootServer* NewLC();
+    CXIMPRootServer();
+    void ConstructL();
+
+
+public:     // From CPolicyServer
+
+    CSession2* NewSessionL( const TVersion& aVersion,
+                            const RMessage2& aMessage ) const;
+
+
+private:     // From MXIMPSrv
+
+    void SessionCreated();
+    void SessionDied();    
+
+private:    //Data
+
+    // OWN: Count of sessions
+    TInt iSessionCount;
+
+    // OWN: pointer to globals singleton
+    CXIMPGlobals* iGlobals;
+
+    // Always increasing session id counter. Stays unique per server for
+    // up to 2^32-1 invocations of NewSessionL.
+    TUint32 iSessionIdCounter;
+    };
+
+#endif      // CXIMPROOTSERVER_H
+
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/core/srcrootserver/ximprootserverdefs.h	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  Defines for XIMP Framework Root server.
+ *
+*/
+
+#ifndef XIMPROOTSERVERDEFS_H
+#define XIMPROOTSERVERDEFS_H
+
+#include <e32std.h>
+
+/*
+ * ============================================================================
+ * XIMP Framework Root server constants
+ * ============================================================================
+ */
+namespace NRootSrv
+    {
+    /**
+     * Root server version numbers
+     */
+    namespace NVersion
+        {
+        const TInt KMajor = 1;
+        const TInt KMinor = 1;
+        const TInt KBuild = 1;
+        }
+
+
+    /**
+     * Root server names
+     */
+    namespace NName
+        {
+        _LIT( KExecutable,      "ximprootserver.exe" );
+        _LIT( KMainThread,      "XIMPRootSrv" );
+        _LIT( KSymbianServer,   "!XIMPRootSrv" );
+        _LIT( KServerPattern,   "*XIMP*" );
+        }
+
+    /**
+     * Root server requests
+     */
+    namespace NRequest
+        {
+        //Number asynchronous message slots for Root server
+        const TUint KMsgSlotCount = 4;
+
+        //Root Server op codes
+        enum TOpCodes
+            {
+            EBecomeRootSession = 1,
+
+            ERootSsPrepareProtocolList,
+            ERootSsPrepareSupportedFeatures,
+            ERootSsFetchServerSideData,
+
+            EOpCodeTop
+            };
+        }
+    }
+
+#endif  //XIMPROOTSERVERDEFS_H
+
+
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/core/srcrootserver/ximprootserversessionadapter.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  Root server session adaptation
+ *
+*/
+
+#include "ximprootserversessionadapter.h"
+#include "ximprootserverdefs.h"
+#include "ximpsrvmessage.h"
+#include "ximprootsession.h"
+#include "ximpsrv.h"
+
+#include <e32base.h>
+
+
+//Include Root server namespace
+using namespace NRootSrv;
+
+
+// -----------------------------------------------------------------------------
+// CXIMPRootServerSessionAdapter::NewL()
+// -----------------------------------------------------------------------------
+//
+CXIMPRootServerSessionAdapter*
+    CXIMPRootServerSessionAdapter::NewL( MXIMPSrv& aServer )
+    {
+    CXIMPRootServerSessionAdapter* self = 
+        new( ELeave ) CXIMPRootServerSessionAdapter( aServer );
+    return self;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CXIMPRootServerSessionAdapter::~CXIMPRootServerSessionAdapter()
+// -----------------------------------------------------------------------------
+//
+CXIMPRootServerSessionAdapter::~CXIMPRootServerSessionAdapter()
+    {
+    }
+
+
+// -----------------------------------------------------------------------------
+// CXIMPRootServerSessionAdapter::CXIMPRootServerSessionAdapter()
+// -----------------------------------------------------------------------------
+//
+CXIMPRootServerSessionAdapter::CXIMPRootServerSessionAdapter( 
+    MXIMPSrv& aServer ) 
+    : CXIMPSrvSessionAdapter( aServer )
+    {
+    }
+
+
+// -----------------------------------------------------------------------------
+// CXIMPRootServerSessionAdapter::DoInstantiateSessionL()
+// -----------------------------------------------------------------------------
+//
+MXIMPSrvSession* CXIMPRootServerSessionAdapter::DoInstantiateSessionL( 
+    const MXIMPSrvMessage& aMessage )
+    {
+    switch( aMessage.Function() )
+        {
+        case NRequest::EBecomeRootSession:
+            {
+            return CXIMPRootSession::NewL();
+            }
+        default:
+            {
+            return NULL;
+            }        
+        }    
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/core/srcrootserver/ximprootserversessionadapter.h	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  XIMP Framework Root server session adapter
+ *
+*/
+
+
+#ifndef XIMPROOTSESSIONADAPTER_H
+#define XIMPROOTSESSIONADAPTER_H
+
+#include <e32base.h>
+#include "ximpsrvsessionadapter.h"
+
+class MXIMPSrv;
+class MXIMPSrvSession;
+class MXIMPSrvMessage;
+
+
+/**
+ * Session adapter for XIMP Framework Root server. 
+ */
+class CXIMPRootServerSessionAdapter : public CXIMPSrvSessionAdapter
+    {
+public:     // Constructors and destructors
+    static CXIMPRootServerSessionAdapter* NewL( MXIMPSrv& aServer );
+    virtual ~CXIMPRootServerSessionAdapter();
+
+protected:  // C++ constructors
+    CXIMPRootServerSessionAdapter( MXIMPSrv& aServer );
+
+
+public:     // From CXIMPSrvSessionAdapter
+
+    /**
+     * Template method to instantiate concrete 
+     * Root session objects.
+     *
+     * @param aMessage The session instantiation message.
+     *
+     * @return Session implementation object or NULL if the message
+     *         isn't valid session instantiation request.
+     */
+    MXIMPSrvSession* DoInstantiateSessionL( const MXIMPSrvMessage& aMessage );
+
+    };
+
+#endif      //  XIMPROOTSESSIONADAPTER_H
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/core/srcrootserver/ximprootsession.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,149 @@
+/*
+* 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:  XIMP Framework server root session implementation
+*
+*/
+
+#include "ximpbase.h"
+#include "ximprootsession.h"
+#include "ximprootserverdefs.h"
+#include "ximpglobals.h"
+#include "ximppluginfactory.h"
+#include "ximpfeaturemanager.h"
+#include "ximpsrvmessage.h"
+#include "ximptrace.h"
+
+#include <e32base.h>
+
+
+//Import NRootSrv namespace
+using namespace NRootSrv;
+
+// -----------------------------------------------------------------------------
+// CXIMPRootSession::NewL()
+// -----------------------------------------------------------------------------
+//
+CXIMPRootSession* CXIMPRootSession::NewL()
+    {
+    CXIMPRootSession* self = new( ELeave ) CXIMPRootSession();
+    return self;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CXIMPRootSession::~CXIMPRootSession()
+// -----------------------------------------------------------------------------
+//
+CXIMPRootSession::~CXIMPRootSession()
+    {
+    delete iBuffer;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CXIMPRootSession::CXIMPRootSession()
+// -----------------------------------------------------------------------------
+//
+CXIMPRootSession::CXIMPRootSession()
+    {
+    }
+
+
+// -----------------------------------------------------------------------------
+// CXIMPRootSession::TryHandleMessageL()
+// -----------------------------------------------------------------------------
+//
+void CXIMPRootSession::TryHandleMessageL( MXIMPSrvMessage& aMessage )
+    {
+    TBool msgNeedsToBeCompleted = ETrue;
+
+    switch( aMessage.Function() )
+        {
+        case NRequest::ERootSsPrepareProtocolList:
+            {
+            DoPrepareProtocolListL( aMessage );
+            aMessage.Complete( iBuffer->Size() );
+            msgNeedsToBeCompleted = EFalse;
+            break;
+            }
+
+        case NRequest::ERootSsPrepareSupportedFeatures:
+            {
+            DoPrepareSupportedFeaturesL( aMessage );
+            aMessage.Complete( iBuffer->Size() );
+            msgNeedsToBeCompleted = EFalse;
+            break;
+            }
+
+        case NRequest::ERootSsFetchServerSideData:
+            {
+            DoFetchServerDataL( aMessage );
+            break;
+            }
+
+        default:
+            {
+            // bogus message
+            break;
+            }
+        }
+
+    if ( msgNeedsToBeCompleted )
+        {
+        aMessage.Complete( KErrNone );
+        }
+
+    }
+
+
+// -----------------------------------------------------------------------------
+// CXIMPRootSession::DoPrepareProtocolListL()
+// -----------------------------------------------------------------------------
+//
+void CXIMPRootSession::DoPrepareProtocolListL(
+    const MXIMPSrvMessage& /* aMessage */ )
+    {
+    HBufC8* tmp = CXIMPGlobals::Instance()->PluginFactory()->GetProtocolsL();
+    delete iBuffer;
+    iBuffer = tmp;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CXIMPRootSession::DoPrepareSupportedFeaturesL()
+// -----------------------------------------------------------------------------
+//
+void CXIMPRootSession::DoPrepareSupportedFeaturesL(
+    const MXIMPSrvMessage& /* aMessage */ )
+    {
+    HBufC8* tmp = CXIMPGlobals::Instance()->FeatureManager()->GetFrameworkFeaturesL();
+    delete iBuffer;
+    iBuffer = tmp;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CXIMPRootSession::DoFetchServerDataL()
+// -----------------------------------------------------------------------------
+//
+void CXIMPRootSession::DoFetchServerDataL(
+    const MXIMPSrvMessage& aMessage )
+    {
+    aMessage.WriteL( MXIMPSrvMessage::Ep0, *iBuffer );
+    delete iBuffer;
+    iBuffer = NULL;
+    }
+
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/core/srcrootserver/ximprootsession.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,68 @@
+/*
+* 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:  XIMP Framework server root session
+ *
+*/
+
+#ifndef XIMPROOTSESSION_H
+#define XIMPROOTSESSION_H
+
+#include <e32base.h>
+#include "ximpsrvsession.h"
+
+class MXIMPSrvMessage;
+
+
+/**
+ * Root session implementation.
+ */
+class CXIMPRootSession : public CBase,
+                         public MXIMPSrvSession
+    {
+public:     // Constructors and destructors
+    static CXIMPRootSession* NewL();
+    virtual ~CXIMPRootSession();
+
+protected:  // C++ constructors
+    CXIMPRootSession();
+
+
+public: // From MXIMPSrvSession
+
+    /**
+     * @see MXIMPSrvSession
+     */
+    void TryHandleMessageL( MXIMPSrvMessage& aMessage );
+
+
+
+private:
+
+    void DoPrepareProtocolListL( const MXIMPSrvMessage& aMessage );
+    void DoPrepareSupportedFeaturesL( const MXIMPSrvMessage& aMessage );
+    void DoFetchServerDataL( const MXIMPSrvMessage& aMessage );
+
+
+private:    // Data
+
+    /**
+     * Common buffer for server operations
+     */
+    HBufC8* iBuffer;
+
+    };
+
+#endif      //  XIMPROOTSESSION_H_
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/core/srcutils/ximpobjecthelpers.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,90 @@
+/*
+* 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:  Helpers for handling objects
+*
+*/
+
+#include "ximpobjecthelpers.h"
+
+// ==================== TXIMPHBuf8Packer MEMBER FUNCTIONS ====================
+
+// -----------------------------------------------------------------------------
+// TXIMPHBuf8Packer::PackArrayL()
+// -----------------------------------------------------------------------------
+//
+EXPORT_C HBufC8* TXIMPHBuf8Packer::PackArrayL( const RPointerArray< HBufC8 >& aBufferArray )
+    {
+    CBufFlat* packBuf = CBufFlat::NewL( KObjectBufGranurality );
+    CleanupStack::PushL( packBuf );
+
+    RBufWriteStream ws;
+    ws.Open( *packBuf ); // CSI: 65 #
+    CleanupClosePushL( ws );
+
+    // Get count of objects
+    TInt objCount( aBufferArray.Count() );
+    // write the count
+    ws.WriteInt32L( objCount );
+    // objects
+    for ( TInt count(0); count < objCount; count++ )
+        {
+        ws.WriteInt32L( aBufferArray[ count ]->Size() );
+        ws.WriteL( *aBufferArray[ count ] );
+        }
+
+    ws.CommitL();
+    CleanupStack::PopAndDestroy(); //ws
+
+    HBufC8* packBufDesc = packBuf->Ptr(0).AllocL();
+    CleanupStack::PopAndDestroy( packBuf );
+
+    return packBufDesc;
+    }
+
+
+// -----------------------------------------------------------------------------
+// TXIMPHBuf8Packer::UnPackArrayL()
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void TXIMPHBuf8Packer::UnPackArrayL( RPointerArray< HBufC8 >& aBufferArray, const TDesC8& aPack  )
+    {
+	CleanupClosePushL( aBufferArray );
+	// No reset
+    if ( ! aPack.Length() )
+        {
+        // empty, don't attempt to unpack
+        return;
+        }
+
+    RDesReadStream rs;
+    CleanupClosePushL( rs );
+    rs.Open( aPack ); // CSI: 65 #
+
+    // read the object count
+    TInt objCount( rs.ReadInt32L() );
+
+	for ( TInt count = 0; count < objCount; count++ )
+        {
+        TInt length = rs.ReadInt32L();
+        HBufC8* theObject = HBufC8::NewLC( length );
+        TPtr8 theObjectPtr = theObject->Des();
+        
+        rs.ReadL( theObjectPtr, length );
+        aBufferArray.AppendL( theObject );
+		}
+    CleanupStack::Pop( objCount ); // all the objects
+    CleanupStack::PopAndDestroy(); // rs   
+    CleanupStack::Pop( &aBufferArray );
+    }
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/core/srcutils/ximppanics.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  XIMP Framework panic implementation
+*
+*/
+
+// INCLUDE FILES
+#include "ximppanics.h"
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// NXIMPPrivPanic::Panic()
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void NXIMPPrivPanic::Panic( TReason aReason )
+    {
+    #ifdef __WINS__
+    // User::SetJustInTime( ETrue );
+    #endif // __WINS__
+    
+    User::Panic( NXIMPPrivPanic::KCategory, aReason );
+    }
+
+   
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/core/srcutils/ximprbufhelpers.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,123 @@
+/*
+* 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:  Helpers for handling RBuf.
+*
+*/
+
+#include "ximprbufhelpers.h"
+
+// ==================== XIMPRBuf16Helper MEMBER FUNCTIONS ====================
+
+// -----------------------------------------------------------------------------
+// XIMPRBuf16Helper::GrowIfNeededL()
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void XIMPRBuf16Helper::GrowIfNeededL( RBuf16& aBuf, const TInt aMaxLength )
+    {
+    if ( aBuf.MaxLength() < aMaxLength )
+        {
+        aBuf.ReAllocL( aMaxLength );
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// XIMPRBuf16Helper::SetNewValueL()
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void XIMPRBuf16Helper::SetNewValueL( RBuf16& aBuf,
+                                              const TDesC16& aValue )
+    {
+    GrowIfNeededL( aBuf, aValue.Length() );
+    aBuf.Copy( aValue );
+    }
+
+
+// -----------------------------------------------------------------------------
+// XIMPRBuf16Helper::ExternalizeL()
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void XIMPRBuf16Helper::ExternalizeL( const RBuf16& aBuf,
+                                              RWriteStream& aStream )
+    {
+    aStream.WriteInt32L( aBuf.Length() );
+    aStream.WriteL( aBuf );
+    }
+
+
+// -----------------------------------------------------------------------------
+// XIMPRBuf16Helper::InternalizeL()
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void XIMPRBuf16Helper::InternalizeL( RBuf16& aBuf,
+                                              RReadStream& aStream )
+    {
+    TInt length = aStream.ReadInt32L();
+    GrowIfNeededL( aBuf, length );
+    aStream.ReadL( aBuf, length );
+    }
+
+
+// ==================== XIMPRBuf8Helper MEMBER FUNCTIONS ====================
+
+// -----------------------------------------------------------------------------
+// XIMPRBuf8Helper::GrowIfNeededL()
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void XIMPRBuf8Helper::GrowIfNeededL( RBuf8& aBuf, const TInt aMaxLength )
+    {
+    if ( aBuf.MaxLength() < aMaxLength )
+        {
+        aBuf.ReAllocL( aMaxLength );
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// XIMPRBuf8Helper::SetNewValueL()
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void XIMPRBuf8Helper::SetNewValueL( RBuf8& aBuf,
+                                             const TDesC8& aValue )
+    {
+    GrowIfNeededL( aBuf, aValue.Length() );
+    aBuf.Copy( aValue );
+    }
+
+
+// -----------------------------------------------------------------------------
+// XIMPRBuf8Helper::ExternalizeL()
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void XIMPRBuf8Helper::ExternalizeL( const RBuf8& aBuf,
+                                             RWriteStream& aStream )
+    {
+    aStream.WriteInt32L( aBuf.Length() );
+    aStream.WriteL( aBuf );
+    }
+
+
+// -----------------------------------------------------------------------------
+// XIMPRBuf8Helper::InternalizeL()
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void XIMPRBuf8Helper::InternalizeL( RBuf8& aBuf,
+                                             RReadStream& aStream )
+    {
+    TInt length = aStream.ReadInt32L();
+    GrowIfNeededL( aBuf, length );
+    aStream.ReadL( aBuf, length );
+    }
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/core/srcutils/ximprequestidbuilder.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,100 @@
+/*
+* 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:  TXIMPRequestId builder.
+ *
+*/
+
+#include <ximpbase.h>
+#include "ximprequestidbuilder.h"
+
+
+/**
+ * Internal request ID layout.
+ * This structure size must match structly to TXIMPRequestId size.
+ */
+struct SXIMPRequestId
+    {
+    TUint32 iSpare;
+    TUint32 iProtocol;
+    TUint32 iSession;
+    TUint32 iRequest;
+    };
+    
+__ASSERT_COMPILE( sizeof( TXIMPRequestId ) == sizeof( SXIMPRequestId ) );    
+
+
+// -----------------------------------------------------------------------------
+// TXIMPRequestIdBuilder::TXIMPRequestIdBuilder()
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TXIMPRequestIdBuilder::TXIMPRequestIdBuilder()
+    : iSpare( 0 ),
+      iProtocol( 0 ),
+      iSession( 0 ),
+      iRequest( 0 )
+    {
+    }
+
+
+// -----------------------------------------------------------------------------
+// TXIMPRequestIdBuilder::SetProtocolId()
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void TXIMPRequestIdBuilder::SetProtocolId( TUint32 aProtocol )
+    {
+    iProtocol = aProtocol;
+    }
+
+
+// -----------------------------------------------------------------------------
+// TXIMPRequestIdBuilder::SetSessionId()
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void TXIMPRequestIdBuilder::SetSessionId( TUint32 aSession )
+    {
+    iSession = aSession;
+    }
+
+
+// -----------------------------------------------------------------------------
+// TXIMPRequestIdBuilder::SetRequestId()
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void TXIMPRequestIdBuilder::SetRequestId( TUint32 aRequest )
+    {
+    iRequest = aRequest;
+    }
+
+
+// -----------------------------------------------------------------------------
+// TXIMPRequestIdBuilder::BuildRequestId()
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TXIMPRequestId TXIMPRequestIdBuilder::BuildRequestId() const
+    {
+    SXIMPRequestId regIdStruct;
+    regIdStruct.iSpare = iSpare;
+    regIdStruct.iProtocol = iProtocol;
+    regIdStruct.iSession = iSession;
+    regIdStruct.iRequest = iRequest;
+
+    TXIMPRequestId regId;
+    Mem::Copy( &regId, &regIdStruct, sizeof( TXIMPRequestId ) );
+
+    return regId;
+    }
+
+
+
+// END OF FILE
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/core/srcutils/ximpsrv.h	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  Server Message interface.
+ *
+*/
+
+#ifndef MXIMPSRV_H
+#define MXIMPSRV_H
+
+#include <e32base.h>
+
+/**
+ * Server interface for generic server message handling.
+ */
+class MXIMPSrv
+    {
+public:
+
+    /**
+     * Notifies server from instantiation of new session.
+     */
+    virtual void SessionCreated() = 0;
+
+    /**
+     * Notifies server from cleanup of existing session.
+     */
+    virtual void SessionDied() = 0;
+
+protected:
+
+    /**
+     * Protected destructor.
+     * Objects can't be deleted through this interface.
+     */
+    virtual ~MXIMPSrv() {};
+
+    };
+
+
+#endif      //  MXIMPSRV_H
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/core/srcutils/ximpsrvmessage.h	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  Server Message interface.
+ *
+*/
+
+#ifndef XIMPSRVMESSAGE_H
+#define XIMPSRVMESSAGE_H
+
+#include "ximppanics.h"
+#include <e32base.h>
+
+
+/**
+ * Server Message interface.
+ */
+class MXIMPSrvMessage
+    {
+public:
+
+    /**
+     * Message argument indexes.
+     */
+    enum TParamIndex
+        {
+        Ep0 = 0,
+        Ep1 = 1,
+        Ep2 = 2,
+        Ep3 = 3
+        };
+
+public:     // Methods
+
+    /**
+     * Public destructor.
+     * Objects can be deleted through this interface.
+     */
+    virtual ~MXIMPSrvMessage() {};
+
+
+    /**
+     * Completes the client request with given reason.
+     *
+     * @param aReason The completion code.
+     */
+    virtual void Complete( TInt aReason ) = 0;
+
+
+    /**
+     * Tests whether this message is completed or not.
+     *
+     * @return ETrue if the message is completed.
+     *         Else EFalse.
+     */
+    virtual TBool IsCompleted() const = 0;
+
+
+    /**
+     * Returns an integer describing the function being called.
+     *
+     * @return The function being called over IPC
+     */
+    virtual TInt Function() const = 0;
+
+
+    /**
+     * Gets message argument as an integer value.
+     *
+     * @param aIndex The index value identifying the argument.
+     * @return The message argument.
+     */
+    virtual TInt Int( TParamIndex aIndex ) const = 0;
+
+
+    /**
+     * Gets the length of a descriptor argument in the client's process,
+     * leaving on failure.
+     *
+     * @param aIndex The index value identifying the argument.
+     * @return The length of the descriptor.
+     */
+    virtual TInt GetDesLengthL( TParamIndex aIndex ) const = 0;
+
+
+    /**
+     * Reads data from the specified argument into the specified
+     * 8-bit target descriptor, and leaving on failure.
+     *
+     * @param aIndex The index value identifying the argument.
+     * @param aDes The target descriptor into which the client
+     *             data is to be written.
+     */
+    virtual void ReadL( TParamIndex aIndex, TDes8& aDes ) const = 0;
+
+
+    /**
+     * Writes data from the specified source descriptor to the
+     * 8-bit descriptor argument, and leaving on failure.
+     *
+     * @param aIndex The index value identifying the argument.
+     * @param aDes The source descriptor containing the data to be written.
+     */
+    virtual void WriteL( TParamIndex aIndex, const TDesC8& aDes ) const = 0;
+
+
+    /**
+     * Panics the client.
+     *
+     * @param aReason The panic code.
+     */
+    virtual void PanicClientAndLeaveL( NXIMPPanic::TReason aReason ) const = 0;
+
+
+    /**
+     * Moves message ownership from previous pointer to new given one.
+     * (NULLifies existing pointer)
+     *
+     * @param aNewSelfPtr New self pointer where to assign object ownership.
+     *                    Only one place at time can own the message object.
+     */
+    virtual void PlaceOwnershipHere( MXIMPSrvMessage*& aNewSelfPtr ) = 0;
+    };
+
+
+#endif      //  XIMPSRVMESSAGE_H
+
+
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/core/srcutils/ximpsrvmessageimp.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  Concrete server message wrapper implementation.
+ *
+*/
+
+
+//  INCLUDE FILES
+#include "ximpsrvmessageimp.h"
+#include <e32base.h>
+
+// -----------------------------------------------------------------------------
+// CXIMPSrvMessageImp::NewOrNull()
+// -----------------------------------------------------------------------------
+//
+CXIMPSrvMessageImp* CXIMPSrvMessageImp::NewOrNull(
+    const RMessage2& aMessage,
+    MXIMPSrvMessage*& aSelfPtr,
+    CXIMPSrvMessageImp*& aSourcePtr )
+    {
+    __ASSERT_ALWAYS( !aSelfPtr,
+                     User::Panic( NXIMPPrivPanic::KCategory,
+                                  NXIMPPrivPanic::EMessageSelfPtrAlreadyOccupied ) );
+    if( !aSourcePtr )
+        {
+        aSourcePtr = new CXIMPSrvMessageImp( aMessage, aSelfPtr ); // CSI: 62 #
+                                                                              // Special non-leaving function
+        }
+    else
+        {
+        aSourcePtr->Init( aMessage, aSelfPtr );
+        }
+    return aSourcePtr;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CXIMPSrvMessageImp::~CXIMPSrvMessageImp()
+// -----------------------------------------------------------------------------
+//
+CXIMPSrvMessageImp::~CXIMPSrvMessageImp()
+    {
+    //If assert below is triggered, it means
+    //that owned message is not completed before
+    //deleting the wrapper
+    __ASSERT_ALWAYS( iMessage.IsNull(),
+                     User::Panic( NXIMPPrivPanic::KCategory,
+                                  NXIMPPrivPanic::EMessageStillPendingOnDestruction ) );
+
+    if( iSelfPtr )
+        {
+        iSelfPtr = NULL;
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CXIMPSrvMessageImp::CXIMPSrvMessageImp()
+// -----------------------------------------------------------------------------
+//
+CXIMPSrvMessageImp::CXIMPSrvMessageImp( const RMessage2& aMessage,
+                                        MXIMPSrvMessage*& aSelfPtr )
+    : iMessage( aMessage ),
+      iSelfPtr( &aSelfPtr )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CXIMPSrvMessageImp::Init()
+// -----------------------------------------------------------------------------
+//
+void CXIMPSrvMessageImp::Init( const RMessage2& aMessage,
+                                        MXIMPSrvMessage*& aSelfPtr )
+    {
+    iMessage = aMessage;
+    iSelfPtr = &aSelfPtr;
+    }
+
+// -----------------------------------------------------------------------------
+// CXIMPSrvMessageImp::Complete()
+// -----------------------------------------------------------------------------
+void CXIMPSrvMessageImp::Complete( TInt aReason )
+    {
+    if( !iMessage.IsNull() )
+        {
+        iMessage.Complete( aReason );
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CXIMPSrvMessageImp::IsCompleted()
+// -----------------------------------------------------------------------------
+TBool CXIMPSrvMessageImp::IsCompleted() const
+    {
+    return iMessage.IsNull();
+    }
+
+
+// -----------------------------------------------------------------------------
+// CXIMPSrvMessageImp::Function()
+// -----------------------------------------------------------------------------
+TInt CXIMPSrvMessageImp::Function() const
+    {
+    return iMessage.Function();
+    }
+
+
+// -----------------------------------------------------------------------------
+// CXIMPSrvMessageImp::Int()
+// -----------------------------------------------------------------------------
+TInt CXIMPSrvMessageImp::Int( TParamIndex aIndex ) const
+    {
+    TInt value = 0;
+    switch( aIndex )
+        {
+        case Ep0:
+            {
+            value = iMessage.Int0();
+            break;
+            }
+
+        case Ep1:
+            {
+            value = iMessage.Int1();
+            break;
+            }
+
+        case Ep2:
+            {
+            value = iMessage.Int2();
+            break;
+            }
+
+        case Ep3:
+            {
+            value = iMessage.Int3();
+            break;
+            }
+        }
+
+    return value;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CXIMPSrvMessageImp::GetDesLengthL()
+// -----------------------------------------------------------------------------
+TInt CXIMPSrvMessageImp::GetDesLengthL( TParamIndex aIndex ) const
+    {
+    return iMessage.GetDesLengthL( aIndex );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CXIMPSrvMessageImp::ReadL()
+// -----------------------------------------------------------------------------
+void CXIMPSrvMessageImp::ReadL( TParamIndex aIndex, TDes8& aDes ) const
+    {
+    return iMessage.ReadL( aIndex, aDes );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CXIMPSrvMessageImp::WriteL()
+// -----------------------------------------------------------------------------
+void CXIMPSrvMessageImp::WriteL( TParamIndex aIndex, const TDesC8& aDes ) const
+    {
+    return iMessage.WriteL( aIndex, aDes );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CXIMPSrvMessageImp::PanicClientAndLeaveL()
+// -----------------------------------------------------------------------------
+void CXIMPSrvMessageImp::PanicClientAndLeaveL( NXIMPPanic::TReason aReason ) const
+    {
+    iMessage.Panic( NXIMPPanic::KCategory, aReason );
+    User::Leave( KErrCompletion );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CXIMPSrvMessageImp::PlaceOwnershipHere()
+// -----------------------------------------------------------------------------
+void CXIMPSrvMessageImp::PlaceOwnershipHere( MXIMPSrvMessage*& aNewSelfPtr )
+    {
+    __ASSERT_ALWAYS( !aNewSelfPtr,
+                     User::Panic( NXIMPPrivPanic::KCategory,
+                                  NXIMPPrivPanic::EMessageSelfPtrAlreadyOccupied ) );
+
+    //remove ownership from old pointer
+    (*iSelfPtr) = NULL;
+
+    //Cache new owning pointer
+    iSelfPtr = &aNewSelfPtr;
+
+    //And setup new owning pointer to point self
+    aNewSelfPtr = this;
+    }
+
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/core/srcutils/ximpsrvmessageimp.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,88 @@
+/*
+* 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:  Concrete server message wrapper implementation.
+ *
+*/
+
+#ifndef CXIMPSRVMESSAGEIMP_H
+#define CXIMPSRVMESSAGEIMP_H
+
+#include "ximpsrvmessage.h"
+#include "ximppanics.h"
+#include <e32base.h>
+
+/**
+ * Server message wrapper implementation.
+ *
+ * @lib ximputils.dll
+ * @since S60 v3.2
+ */
+NONSHARABLE_CLASS( CXIMPSrvMessageImp ) : public CBase,
+                                          public MXIMPSrvMessage
+    {
+public:
+
+    /**
+     * Special instantiation method..
+     *
+     * Verifies that given self pointer ins't yet in use
+     * and allocates new instance. Returns NULL pointer if in OOM.
+     */
+    static CXIMPSrvMessageImp* NewOrNull( const RMessage2& aMessage,
+                                          MXIMPSrvMessage*& aSelfPtr,
+                                          CXIMPSrvMessageImp*& aSourcePtr );
+    ~CXIMPSrvMessageImp();
+
+
+private:
+    CXIMPSrvMessageImp( const RMessage2& aMessage,
+                        MXIMPSrvMessage*& aSelfPtr );
+                        
+    void Init( const RMessage2& aMessage,
+                        MXIMPSrvMessage*& aSelfPtr );
+
+
+
+public: // Methods from MXIMPSrvMessage
+
+    void Complete(TInt aReason);
+    TBool IsCompleted() const;
+    TInt Function() const;
+    TInt Int( TParamIndex aIndex ) const;
+    TInt GetDesLengthL( TParamIndex aIndex ) const;
+    void ReadL( TParamIndex aIndex, TDes8& aDes ) const;
+    void WriteL( TParamIndex aIndex, const TDesC8& aDes ) const;
+    void PanicClientAndLeaveL( NXIMPPanic::TReason aReason ) const;
+    void PlaceOwnershipHere( MXIMPSrvMessage*& aNewSelfPtr );
+
+private: // Data
+
+
+    /**
+     * The message.
+     */
+    RMessage2 iMessage;
+
+    /**
+     * Pointer to self pointer.
+     */
+    MXIMPSrvMessage** iSelfPtr;
+
+    };
+
+
+
+#endif      //  CXIMPSRVMESSAGEIMP_H
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/core/srcutils/ximpsrvsession.h	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  Abstract server session interface
+ *
+*/
+
+#ifndef MXIMPSRVSESSION_H
+#define MXIMPSRVSESSION_H
+
+#include <e32std.h>
+
+class MXIMPSrvMessage;
+
+
+/**
+ * Abstract server session interface
+ */
+class MXIMPSrvSession
+    {
+public:
+
+    /**
+     * Public destructor.
+     * Objects can be deleted through this interface.
+     */
+    virtual ~MXIMPSrvSession() { };
+
+
+    /**
+     * Message handling method.
+     * Session adapters call this to mediate message handling
+     * to concrete session objects.
+     *
+     * Rules for message handling:
+     *
+     * - If message is handled synchronously, handler must complete
+     * the message when finished with it. Handler may not cause leave
+     * exeptions after completing.
+     *
+     * - If message handling fails, it should be handled with a leave.
+     * In this case Session::ServiceError() methods take care
+     * of completing the message with leave code.
+     *
+     * - If handler wishes to complete the message asynchronously,
+     * it must take message ownership to itself by using
+     * MXIMPSrvMessage::PlaceOwnershipHere(). In this case handler
+     * is responsible both to completing and deleting the message object.
+     * After taking message ownership, message handler isn't anymore
+     * allowed to cause leave exeptions during the same message
+     * handling path.
+     *
+     * @param aMessage The message to handle.
+     */
+    virtual void TryHandleMessageL( MXIMPSrvMessage& aMessage ) = 0;
+    };
+
+
+#endif      //  MXIMPSRVSESSION_H
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/core/srcutils/ximpsrvsessionadapter.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  Server session adapter base class.
+ *
+*/
+
+
+//  INCLUDE FILES
+#include "ximpsrvsessionadapter.h"
+#include "ximpsrv.h"
+#include "ximpsrvsession.h"
+#include "ximpsrvmessageimp.h"
+#include "ximppanics.h"
+#include "ximptrace.h"
+#include <e32base.h>
+
+
+// -----------------------------------------------------------------------------
+// CXIMPSrvSessionAdapter::CXIMPSrvSessionAdapter()
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CXIMPSrvSessionAdapter::CXIMPSrvSessionAdapter( MXIMPSrv& aServer )
+    : iServer( aServer )
+    {
+    iServer.SessionCreated();
+    TRACE_1( _L("CXIMPSrvSessionAdapter[%d]::CXIMPSrvSessionAdapter()"),
+                 this );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CXIMPSrvSessionAdapter::~CXIMPSrvSessionAdapter()
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CXIMPSrvSessionAdapter::~CXIMPSrvSessionAdapter()
+    {
+    delete iMessage;
+    
+    iServer.SessionDied();
+    delete iSessionImp;
+
+    TRACE_1( _L("CXIMPSrvSessionAdapter[%d]::~CXIMPSrvSessionAdapter()"),
+                 this );
+    #if _BullseyeCoverage
+    cov_write();
+    #endif
+    }
+
+
+// -----------------------------------------------------------------------------
+// CXIMPSrvSessionAdapter::ServiceL()
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CXIMPSrvSessionAdapter::ServiceL( const RMessage2& aMessage )
+    {
+    __ASSERT_ALWAYS( !iCurrentMsg,
+                     User::Panic( NXIMPPrivPanic::KCategory,
+                                  NXIMPPrivPanic::ECurrentMsgAlreadyExists ) );
+
+    //Non leaving allocation must be used here to prevent OOM leave
+    //to ServiceError() method, without a valid iCurrentMsg
+    //==> CurrentMsg absence triggers an assert in ServiceError()
+    iCurrentMsg = CXIMPSrvMessageImp::NewOrNull( aMessage,
+                                                 ( MXIMPSrvMessage*& )iCurrentMsg, 
+                                                 iMessage );
+    iMessage = NULL;
+
+    //Handle the message
+    MXIMPSrvSession* sessionImp = DoInstantiateSessionL( *iCurrentMsg );
+    
+    if( sessionImp )
+        {
+        CleanupDeletePushL( sessionImp );
+
+        __ASSERT_ALWAYS( !iSessionImp,
+                         iCurrentMsg->PanicClientAndLeaveL(
+                         NXIMPPanic::EOnSrvSessionImpAlreadyExists ) );
+
+        iSessionImp = sessionImp;
+        CleanupStack::Pop(); //sessionImp;
+        iCurrentMsg->Complete( KErrNone );
+        }
+
+    else
+        {                
+        __ASSERT_ALWAYS( iSessionImp,
+                         iCurrentMsg->PanicClientAndLeaveL(
+                         NXIMPPanic::EOnSrvSessionImpNotFound ) );
+
+
+        iSessionImp->TryHandleMessageL( *iCurrentMsg );
+
+
+        //If current message is still not-completed, inform client
+        //that it tried to do something unknown
+        __ASSERT_ALWAYS( !IsCurrentMessageValid(),
+                         iCurrentMsg->PanicClientAndLeaveL(
+                         NXIMPPanic::EOnSrvRequestNotUnderstood) );
+        }
+
+    iMessage = iCurrentMsg;
+    iCurrentMsg = NULL;
+    }
+  
+// -----------------------------------------------------------------------------
+// CXIMPSrvSessionAdapter::ServiceError()
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CXIMPSrvSessionAdapter::ServiceError( const RMessage2& /*aMessage*/,
+                                                    TInt aError )
+    {
+    //If assert below is triggered, it means that current message ownersip
+    //is taken somewhere (to be completed asynchronously), but there has
+    //happened a leave after ownership transfer
+
+    //The place taking message ownership has to be fixed in this case
+    //not to cause exeptions after ownership transfer
+    __ASSERT_ALWAYS( iCurrentMsg,
+                     User::Panic( NXIMPPrivPanic::KCategory,
+                                  NXIMPPrivPanic::ECurrentMsgNotFoundInServiceError ) );
+
+
+    //If assert below is triggered, it means that current message is already
+    //completed, but there has happened a leave after completion
+
+    //The place completing message has to be fixed in this case
+    //not to cause exeptions after message completion
+    __ASSERT_ALWAYS( !iCurrentMsg->IsCompleted(),
+                     User::Panic( NXIMPPrivPanic::KCategory,
+                                  NXIMPPrivPanic::ECurrentMsgNotValidInServiceError ) );
+
+
+    TRACE_3( _L("CXIMPSrvSessionAdapter[%d]::ServiceError() in op[%d], code[%d]"),
+                 this, iCurrentMsg->Function(), aError );
+
+
+    iCurrentMsg->Complete( aError );
+    delete iCurrentMsg;
+    iCurrentMsg = NULL;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CXIMPSrvSessionAdapter::Server()
+// -----------------------------------------------------------------------------
+//
+EXPORT_C MXIMPSrv& CXIMPSrvSessionAdapter::Server()
+    {
+    return iServer;
+    }
+
+// -----------------------------------------------------------------------------
+// CXIMPSrvSessionAdapter::IsCurrentMessageValid()
+// -----------------------------------------------------------------------------
+//
+TBool CXIMPSrvSessionAdapter::IsCurrentMessageValid()
+    {
+    if( iCurrentMsg && !iCurrentMsg->IsCompleted() )
+        {
+        return ETrue;
+        }
+
+    return EFalse;
+    }
+
+
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/core/srcutils/ximpsrvsessionadapter.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,103 @@
+/*
+* 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:  Server session adapter base class.
+ *
+*/
+
+
+#ifndef XIMPSRVSESSIONADAPTER_H
+#define XIMPSRVSESSIONADAPTER_H
+
+#include <e32base.h>
+
+class MXIMPSrv;
+class MXIMPSrvSession;
+class MXIMPSrvMessage;
+class CXIMPSrvMessageImp;
+
+
+/**
+ * Server session adapter base class.
+ *
+ * @lib ximputils.dll
+ * @since S60 v3.2
+ */
+class CXIMPSrvSessionAdapter : public CSession2
+    {
+public:     // Constructor and destructor
+
+    IMPORT_C CXIMPSrvSessionAdapter( MXIMPSrv& aServer );
+    IMPORT_C ~CXIMPSrvSessionAdapter();
+
+
+public:     // Methods derived from CSession2
+    
+    IMPORT_C void ServiceL( const RMessage2& aMessage );
+    IMPORT_C void ServiceError( const RMessage2& aMessage,
+                                TInt aError );
+
+
+public:     // New template methods 
+
+    /**
+     * Session instantiation template method for
+     * derived implementations.
+     *
+     * @param aMessage The session instantiation message.
+     *
+     * @return Session implementation object or NULL if the message
+     *         isn't valid session instantiation request.
+     */
+    virtual MXIMPSrvSession* DoInstantiateSessionL( const MXIMPSrvMessage& aMessage ) = 0;    
+    
+protected:
+    
+    /**
+     * Access to server for derived implementations.
+     * @return Access to server object.
+     */
+    IMPORT_C MXIMPSrv& Server();
+
+private:    // Helpers 
+
+    TBool IsCurrentMessageValid();
+
+private:    // Data
+
+    /**
+     * Owning server.
+     * Referenced.
+     */
+    MXIMPSrv& iServer;
+
+    /**
+     * Real session implementation.
+     * Owned.
+     */
+    MXIMPSrvSession* iSessionImp;
+
+    /**
+     * Currently handled message.
+     * Does not own.
+     */
+    CXIMPSrvMessageImp* iCurrentMsg;
+    
+    /**
+     * Owned.
+     */
+    CXIMPSrvMessageImp* iMessage;    
+    };
+
+#endif      //  XIMPSERVERSESSIONADAPTER_H
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/core/srcutils/ximptrace.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,123 @@
+/*
+* 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:  XIMP Framework trace implementation
+*
+*/
+
+// INCLUDE FILES
+#include "ximptrace.h"
+
+#include <e32svr.h>
+#include <e32std.h>
+#include <flogger.h>
+
+
+/**
+ * Handler used by trace implementation to truncate
+ * the string rather than panic in case of buffer overflow.
+ *
+ * @since 3.0
+ */
+NONSHARABLE_CLASS( TXIMPOverflowTruncate ) : public TDes16Overflow
+    {
+    public:
+        void Overflow( TDes16& /*aDes*/ ) {}
+    };
+
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// XIMPTrace::Trace()
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void XIMPTrace::Trace( TRefByValue<const TDesC> aFmt,... )
+    {
+    TBuf< 250 > buffer;
+    buffer.Append( _L("[") );
+    buffer.Append( RThread().Name() );
+    buffer.Append( _L("] ") );
+
+    TXIMPOverflowTruncate overflowHandler;
+
+    VA_LIST list;
+    VA_START( list, aFmt );
+    buffer.AppendFormatList( aFmt, list, &overflowHandler );
+
+
+//    #ifdef __WINS__
+    RDebug::Print( _L("%S"), &buffer );
+//    #endif // __WINS__ Pia
+// Pia    #else
+
+    RFileLogger logger;
+    if( logger.Connect() == KErrNone )
+        {
+        logger.SetDateAndTime( EFalse, ETrue );
+        logger.CreateLog( KXIMPTraceLogDir,
+                          KXIMPTraceLogFile,
+                          EFileLoggingModeAppend );
+
+        logger.Write( buffer );
+        logger.CloseLog();
+        logger.Close();
+        }
+
+// Pia   #endif // __WINS__
+   }
+
+
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// TXIMPBlockTraceHandler::TXIMPBlockTraceHandler()
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TXIMPBlockTraceHandler::TXIMPBlockTraceHandler( const TText* aBlockName ) 
+    : iBlockName( aBlockName ),
+      iBlockNormalExit( EFalse )
+    {
+    TRACE_1( _L("%S - enter"), &iBlockName );  
+    }   
+
+
+// -----------------------------------------------------------------------------
+// TXIMPBlockTraceHandler::~TXIMPBlockTraceHandler()
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TXIMPBlockTraceHandler::~TXIMPBlockTraceHandler() // CSI: 82 #
+    {
+    if( !iBlockNormalExit )
+        {
+        //Normal exit not recorded so far
+        //Thus report here nonlocal exit
+        TRACE_1( _L("%S - nonlocal exit"), &iBlockName );  
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// TXIMPBlockTraceHandler::NormalExit()
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void TXIMPBlockTraceHandler::NormalExit() 
+    {
+    TRACE_1( _L("%S - exit"), &iBlockName );  
+    iBlockNormalExit = ETrue;
+    }
+    
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/core/srcutils/ximptrace.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,155 @@
+/*
+* 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:  XIMP Framework trace utilities
+*
+*/
+
+#ifndef XIMPTRACE_H__
+#define XIMPTRACE_H__
+
+#include <e32std.h>
+
+
+// CONSTANTS
+_LIT( KXIMPTraceLogDir, "ximp" );
+_LIT( KXIMPTraceLogFile, "ximp.log" );
+
+
+ //TRACE INDIRECTION
+#ifdef _DEBUG
+
+    /**
+     * Trace handlers. Different statements with 
+     * different names for handling different parameter amounts.
+     *
+     * Link against ximpdatamodel.dll to use trace
+     * services.
+     *
+     * Statements produce traces only in debug builds.
+     * In hardware debug builds traces go to file defined
+     * KXIMPTraceLogDir and KXIMPTraceLogFile.
+     */
+    #define TRACE( aStatement ) XIMPTrace::Trace( aStatement )
+    #define TRACE_1( aStatement, aP1 ) XIMPTrace::Trace( aStatement, aP1 )
+    #define TRACE_2( aStatement, aP1, aP2 ) XIMPTrace::Trace( aStatement, aP1, aP2 )
+    #define TRACE_3( aStatement, aP1, aP2, aP3 ) XIMPTrace::Trace( aStatement, aP1, aP2, aP3 )
+    #define TRACE_4( aStatement, aP1, aP2, aP3, aP4 ) XIMPTrace::Trace( aStatement, aP1, aP2, aP3, aP4 )
+    #define TRACE_5( aStatement, aP1, aP2, aP3, aP4, aP5 ) XIMPTrace::Trace( aStatement, aP1, aP2, aP3, aP4, aP5 )
+    #define TRACE_6( aStatement, aP1, aP2, aP3, aP4, aP5, aP6 ) XIMPTrace::Trace( aStatement, aP1, aP2, aP3, aP4, aP5, aP6 )
+
+
+    /**
+     * Block (and thus also function) trace handlers. These 
+     * mark block enter, exit and also non local exit to traces.
+     *
+     * Example:
+     * void CSomeClass::SomeMethod()
+     *      {
+     *      TRACE_BLOCK_ENTER( "CSomeClass::SomeMethod" );
+     *
+     *      Do your stuff here. If there happens a leave
+     *      or return before "TRACE_BLOCK_EXIT()" statement,
+     *      it is marked to traces with "CSomeClass::SomeMethod - nonlocal exit"
+     *
+     *      TRACE_BLOCK_EXIT();
+     *      }
+     */
+    #define TRACE_BLOCK_ENTER( aBlockName ) TXIMPBlockTraceHandler __blockTraceHandler( _S( aBlockName ) );
+    #define TRACE_BLOCK_EXIT() __blockTraceHandler.NormalExit();
+
+
+
+#else //NOT _DEBUG
+
+    #define TRACE( aStatement )
+    #define TRACE_1( aStatement, aP1 )
+    #define TRACE_2( aStatement, aP1, aP2 )
+    #define TRACE_3( aStatement, aP1, aP2, aP3 )
+    #define TRACE_4( aStatement, aP1, aP2, aP3, aP4 )
+    #define TRACE_5( aStatement, aP1, aP2, aP3, aP4, aP5 )
+    #define TRACE_6( aStatement, aP1, aP2, aP3, aP4, aP5, aP6 )
+    #define TRACE_BLOCK_ENTER( aBlockName )
+    #define TRACE_BLOCK_EXIT()
+
+#endif
+
+
+
+/**
+ * XIMP Framework trace sink.
+ *
+ * @lib ximpdatamodel.dll
+ * @since S60 v3.2
+ */
+class XIMPTrace
+    {
+public:
+
+    /**
+     * Trace sink.
+     *
+     * @param aFmt A format list to print to trace.
+     */
+    IMPORT_C static void Trace( TRefByValue<const TDesC> aFmt,... );
+
+
+
+private: //Prohibited construtor / destructor
+    XIMPTrace();
+    ~XIMPTrace();
+    };
+
+
+
+/**
+ * XIMP Framework block trace handler.
+ *
+ * @lib ximpdatamodel.dll
+ * @since S60 v3.2
+ */
+NONSHARABLE_CLASS( TXIMPBlockTraceHandler )
+    {
+public:
+
+    /**
+     * Block trace handler constructor.
+     *
+     * @param aBlockName Block name.
+     */
+    TXIMPBlockTraceHandler( const TText* aBlockName );
+
+
+    /**
+     * Block trace handler destructor.
+     */
+    ~TXIMPBlockTraceHandler();
+
+
+    /**
+     * Marks that block has reached its normal exit.
+     */
+    void NormalExit();
+
+
+private:
+    //Block name
+    const TPtrC   iBlockName;
+
+    //Normal exit marker
+    TBool iBlockNormalExit;
+};
+
+
+#endif  // XIMPTRACE_H__
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/group/bld.inf	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  Build information file for project Presence Framework
+*
+*/
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+../rom/ximpfw.iby CORE_MW_LAYER_IBY_EXPORT_PATH(ximpfw.iby)
+
+PRJ_MMPFILES
+../core/group/ximputils.mmp
+../core/group/ximpdatamodel.mmp
+../presence/group/presencedatamodel.mmp
+../presence/group/presencedatamodelhook.mmp
+../core/group/ximpprocessor.mmp
+../presence/group/presenceoperation.mmp  // ximpoperation depends on this
+../core/group/ximpoperations.mmp
+../core/group/ximprootserver.mmp
+../core/group/ximpserver.mmp
+../core/group/ximpsrvclient.mmp
+../core/group/ximpmanager.mmp
+../core/group/ximpecomhook.mmp
+../presence/group/presencemanager.mmp
+../presence/group/presenceecomhook.mmp
+../presence/group/presencecacheserver.mmp
+../presence/group/presencecacheclient.mmp
+../presence/group/presencecacheecomhook.mmp
+
+
+PRJ_TESTMMPFILES
+
+
+PRJ_TESTEXPORTS
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/group/ximpdlluids.hrh	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,65 @@
+/*
+* 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:  Presence Framework DLL uids
+*
+*/
+
+#ifndef XIMPDLLUIDS_HRH
+#define XIMPDLLUIDS_HRH
+
+
+// -----------------------------------------------------------------------------
+// System wide UID 2:s for different dll types.
+// -----------------------------------------------------------------------------
+//
+#define XIMP_DLL_UID_STATIC_INTERFACE                   0x1000008d
+#define XIMP_DLL_UID_ECOM_PLUGIN                        0x10009D8D
+
+
+// -----------------------------------------------------------------------------
+// Common UID 3 for the XIMP Framework dlls.
+// -----------------------------------------------------------------------------
+//
+#define XIMP_DLL_UID_COMMON                             0x10282DD8
+
+
+// -----------------------------------------------------------------------------
+// UID 3 for the XIMP Framework server exes.
+// -----------------------------------------------------------------------------
+//
+#define XIMP_EXE_UID_ROOT_SERVER                        0x10282DD9
+#define XIMP_EXE_UID_PROTOCOL_CONNECTION_SERVER         0x10282DDA
+
+
+// -----------------------------------------------------------------------------
+// ECOM implementation UID for MXIMPClient interfaces.
+// -----------------------------------------------------------------------------
+//
+#define XIMP_ECOM_IMPLEMENTATION_UID_CLIENT_INTERFACE   0x10282DDB
+#define XIMP_ECOM_IMPLEMENTATION_UID_PRESENCE_INTERFACE 0x2000B186
+#define XIMP_ECOM_IMPLEMENTATION_UID_IM_INTERFACE 		0x2000B5EA
+
+// -----------------------------------------------------------------------------
+// Other dll uids
+// -----------------------------------------------------------------------------
+//
+#define XIMP_DLL_UID_PRESENCE_HOOK                      0x2000B1AE
+#define XIMP_DLL_UID_PRESENCE_MANAGER                   0x2000B1AF
+#define XIMP_DLL_UID_IM_HOOK                      			0x2000B5EB
+#define XIMP_DLL_UID_IM_MANAGER                   			0x2000B5EC
+
+
+#endif // XIMPDLLUIDS_HRH
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/bwins/presencecacheclientu.def	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,5 @@
+EXPORTS
+	?CreateReaderL@CPresenceCacheClient@@SAPAVMPresenceCacheReader@@XZ @ 1 NONAME ; class MPresenceCacheReader * CPresenceCacheClient::CreateReaderL(void)
+	?CreateWriterL@CPresenceCacheClient@@SAPAVMPresenceCacheWriter@@XZ @ 2 NONAME ; class MPresenceCacheWriter * CPresenceCacheClient::CreateWriterL(void)
+	?NewL@CPresenceCacheClient@@SAPAV1@XZ @ 3 NONAME ; class CPresenceCacheClient * CPresenceCacheClient::NewL(void)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/bwins/presencecacheecomhooku.def	Wed Nov 03 09:32:20 2010 +0530
@@ -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/ximpfw/presence/bwins/presencedatamodelhooku.def	Wed Nov 03 09:32:20 2010 +0530
@@ -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/ximpfw/presence/bwins/presencedatamodelu.def	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,214 @@
+EXPORTS
+	??8CPresenceInfoFilterImp@@QAEHAAV0@@Z @ 1 NONAME ; int CPresenceInfoFilterImp::operator==(class CPresenceInfoFilterImp &)
+	??9CPresenceInfoFilterImp@@QAEHAAV0@@Z @ 2 NONAME ; int CPresenceInfoFilterImp::operator!=(class CPresenceInfoFilterImp &)
+	?AddConfiguratorL@CGroupMembersPresenceConfigurationItem@@QAEXPAVMXIMPPscContext@@@Z @ 3 NONAME ; void CGroupMembersPresenceConfigurationItem::AddConfiguratorL(class MXIMPPscContext *)
+	?AddOrRenewSubscriberL@CGroupContentSubscriptionItem@@QAEXPAVMXIMPPscContext@@@Z @ 4 NONAME ; void CGroupContentSubscriptionItem::AddOrRenewSubscriberL(class MXIMPPscContext *)
+	?AddSubscriberL@CPresentityGroupMembersPresenceSubscriptionItem@@QAEXPAVMXIMPPscContext@@@Z @ 5 NONAME ; void CPresentityGroupMembersPresenceSubscriptionItem::AddSubscriberL(class MXIMPPscContext *)
+	?AssociateL@CPresenceFilterStore@@QAEXABVCXIMPIdentityImp@@PAVCPresenceInfoFilterImp@@@Z @ 6 NONAME ; void CPresenceFilterStore::AssociateL(class CXIMPIdentityImp const &, class CPresenceInfoFilterImp *)
+	?BlindAddL@CPresenceBuddyInfoListImp@@QAEHPAVMPresenceBuddyInfo@@@Z @ 7 NONAME ; int CPresenceBuddyInfoListImp::BlindAddL(class MPresenceBuddyInfo *)
+	?BlockListSubscriptionItemLC@CPresenceDataCache@@QAEAAVCBlockListSubscriptionItem@@XZ @ 8 NONAME ; class CBlockListSubscriptionItem & CPresenceDataCache::BlockListSubscriptionItemLC(void)
+	?Clean@CBlockListSubscriptionItem@@QAEXXZ @ 9 NONAME ; void CBlockListSubscriptionItem::Clean(void)
+	?Clean@CGrantRequestListSubscriptionItem@@QAEXXZ @ 10 NONAME ; void CGrantRequestListSubscriptionItem::Clean(void)
+	?Clean@CGroupContentSubscriptionItem@@QAEXXZ @ 11 NONAME ; void CGroupContentSubscriptionItem::Clean(void)
+	?Clean@CGroupListSubscriptionItem@@QAEXXZ @ 12 NONAME ; void CGroupListSubscriptionItem::Clean(void)
+	?Clean@CWatcherListSubscriptionItem@@QAEXXZ @ 13 NONAME ; void CWatcherListSubscriptionItem::Clean(void)
+	?CleanExpired@CPresenceDataCache@@QAEXXZ @ 14 NONAME ; void CPresenceDataCache::CleanExpired(void)
+	?CleanResources@CPresenceDataCache@@QAEXAAVMXIMPPscContext@@@Z @ 15 NONAME ; void CPresenceDataCache::CleanResources(class MXIMPPscContext &)
+	?CollectConfigurationPifWithoutCtxL@CGroupMembersPresenceConfigurationItem@@QAEPAVCPresenceInfoFilterImp@@PAVMXIMPPscContext@@@Z @ 16 NONAME ; class CPresenceInfoFilterImp * CGroupMembersPresenceConfigurationItem::CollectConfigurationPifWithoutCtxL(class MXIMPPscContext *)
+	?CollectConfigurationPifWithoutCtxL@CPresenceConfigurationItem@@QAEPAVCPresenceInfoFilterImp@@PAVMXIMPPscContext@@@Z @ 17 NONAME ; class CPresenceInfoFilterImp * CPresenceConfigurationItem::CollectConfigurationPifWithoutCtxL(class MXIMPPscContext *)
+	?CollectConfigurationPifWithoutCtxL@CPresenceToEveryoneConfigurationItem@@QAEPAVCPresenceInfoFilterImp@@PAVMXIMPPscContext@@@Z @ 18 NONAME ; class CPresenceInfoFilterImp * CPresenceToEveryoneConfigurationItem::CollectConfigurationPifWithoutCtxL(class MXIMPPscContext *)
+	?CollectFilteredPresenceInfoLC@DocumentUtils@@SAPAVCPresenceInfoImp@@ABVCPresenceInfoFilterImp@@ABV2@@Z @ 19 NONAME ; class CPresenceInfoImp * DocumentUtils::CollectFilteredPresenceInfoLC(class CPresenceInfoFilterImp const &, class CPresenceInfoImp const &)
+	?CollectSubscriptionPifWithoutCtxL@COwnPresenceSubscriptionItem@@QAEPAVCPresenceInfoFilterImp@@PAVMXIMPPscContext@@@Z @ 20 NONAME ; class CPresenceInfoFilterImp * COwnPresenceSubscriptionItem::CollectSubscriptionPifWithoutCtxL(class MXIMPPscContext *)
+	?CollectSubscriptionPifWithoutCtxL@CPresentityGroupMembersPresenceSubscriptionItem@@QAEPAVCPresenceInfoFilterImp@@PAVMXIMPPscContext@@@Z @ 21 NONAME ; class CPresenceInfoFilterImp * CPresentityGroupMembersPresenceSubscriptionItem::CollectSubscriptionPifWithoutCtxL(class MXIMPPscContext *)
+	?CollectSubscriptionPifWithoutCtxL@CPresentityPresenceSubscriptionItem@@QAEPAVCPresenceInfoFilterImp@@PAVMXIMPPscContext@@@Z @ 22 NONAME ; class CPresenceInfoFilterImp * CPresentityPresenceSubscriptionItem::CollectSubscriptionPifWithoutCtxL(class MXIMPPscContext *)
+	?ConfigurationPif@CGroupMembersPresenceConfigurationItem@@QAEAAVCPresenceInfoFilterImp@@XZ @ 23 NONAME ; class CPresenceInfoFilterImp & CGroupMembersPresenceConfigurationItem::ConfigurationPif(void)
+	?ConfigurationPif@CPresenceConfigurationItem@@QAEAAVCPresenceInfoFilterImp@@XZ @ 24 NONAME ; class CPresenceInfoFilterImp & CPresenceConfigurationItem::ConfigurationPif(void)
+	?ConfigurationPif@CPresenceToEveryoneConfigurationItem@@QAEAAVCPresenceInfoFilterImp@@XZ @ 25 NONAME ; class CPresenceInfoFilterImp & CPresenceToEveryoneConfigurationItem::ConfigurationPif(void)
+	?Contains@CPresenceInfoFilterImp@@QAEHAAV1@@Z @ 26 NONAME ; int CPresenceInfoFilterImp::Contains(class CPresenceInfoFilterImp &)
+	?Disassociate@CPresenceFilterStore@@QAEXABVCXIMPIdentityImp@@@Z @ 27 NONAME ; void CPresenceFilterStore::Disassociate(class CXIMPIdentityImp const &)
+	?EqualsIdentity@CPresenceBuddyInfoImp@@UBEHPBVMPresenceBuddyInfo@@@Z @ 28 NONAME ; int CPresenceBuddyInfoImp::EqualsIdentity(class MPresenceBuddyInfo const *) const
+	?ExternalizeL@CPresenceBlockInfoImp@@UBEXAAVRWriteStream@@@Z @ 29 NONAME ; void CPresenceBlockInfoImp::ExternalizeL(class RWriteStream &) const
+	?ExternalizeL@CPresenceBuddyInfoImp@@UBEXAAVRWriteStream@@@Z @ 30 NONAME ; void CPresenceBuddyInfoImp::ExternalizeL(class RWriteStream &) const
+	?ExternalizeL@CPresenceBuddyInfoListImp@@UBEXAAVRWriteStream@@@Z @ 31 NONAME ; void CPresenceBuddyInfoListImp::ExternalizeL(class RWriteStream &) const
+	?ExternalizeL@CPresenceInfoFilterImp@@UBEXAAVRWriteStream@@@Z @ 32 NONAME ; void CPresenceInfoFilterImp::ExternalizeL(class RWriteStream &) const
+	?ExternalizeL@CPresenceInfoImp@@UBEXAAVRWriteStream@@@Z @ 33 NONAME ; void CPresenceInfoImp::ExternalizeL(class RWriteStream &) const
+	?FilterForIdentity@CPresenceFilterStore@@QAEPAVCPresenceInfoFilterImp@@ABVCXIMPIdentityImp@@@Z @ 34 NONAME ; class CPresenceInfoFilterImp * CPresenceFilterStore::FilterForIdentity(class CXIMPIdentityImp const &)
+	?FilteredInfoLC@CPresenceInfoImp@@QBEPAV1@ABVCPresenceInfoFilterImp@@@Z @ 35 NONAME ; class CPresenceInfoImp * CPresenceInfoImp::FilteredInfoLC(class CPresenceInfoFilterImp const &) const
+	?GrantRequestListSubscriptionItemLC@CPresenceDataCache@@QAEAAVCGrantRequestListSubscriptionItem@@XZ @ 36 NONAME ; class CGrantRequestListSubscriptionItem & CPresenceDataCache::GrantRequestListSubscriptionItemLC(void)
+	?GroupContentSubscriptionItemExists@CPresenceDataCache@@QAEHABVCXIMPIdentityImp@@@Z @ 37 NONAME ; int CPresenceDataCache::GroupContentSubscriptionItemExists(class CXIMPIdentityImp const &)
+	?GroupContentSubscriptionItemLC@CPresenceDataCache@@QAEAAVCGroupContentSubscriptionItem@@ABVCXIMPIdentityImp@@@Z @ 38 NONAME ; class CGroupContentSubscriptionItem & CPresenceDataCache::GroupContentSubscriptionItemLC(class CXIMPIdentityImp const &)
+	?GroupId@CGroupContentSubscriptionItem@@QBEABVCXIMPIdentityImp@@XZ @ 39 NONAME ; class CXIMPIdentityImp const & CGroupContentSubscriptionItem::GroupId(void) const
+	?GroupIdLinearOrder@CPresentityGroupInfoImp@@SAHABV1@0@Z @ 40 NONAME ; int CPresentityGroupInfoImp::GroupIdLinearOrder(class CPresentityGroupInfoImp const &, class CPresentityGroupInfoImp const &)
+	?GroupIdLinearOrder@CPresentityGroupMemberInfoImp@@SAHABV1@0@Z @ 41 NONAME ; int CPresentityGroupMemberInfoImp::GroupIdLinearOrder(class CPresentityGroupMemberInfoImp const &, class CPresentityGroupMemberInfoImp const &)
+	?GroupIdentity@CPresentityPresenceSubscriptionItem@@QBEPBVMXIMPIdentity@@XZ @ 42 NONAME ; class MXIMPIdentity const * CPresentityPresenceSubscriptionItem::GroupIdentity(void) const
+	?GroupListSubscriptionItemLC@CPresenceDataCache@@QAEAAVCGroupListSubscriptionItem@@XZ @ 43 NONAME ; class CGroupListSubscriptionItem & CPresenceDataCache::GroupListSubscriptionItemLC(void)
+	?GroupMemberExistsL@CGroupContentSubscriptionItem@@QBEHAAVCPresentityGroupMemberInfoImp@@@Z @ 44 NONAME ; int CGroupContentSubscriptionItem::GroupMemberExistsL(class CPresentityGroupMemberInfoImp &) const
+	?GroupMembersPresenceConfigurationItemLC@CPresenceDataCache@@QAEAAVCGroupMembersPresenceConfigurationItem@@ABVCXIMPIdentityImp@@@Z @ 45 NONAME ; class CGroupMembersPresenceConfigurationItem & CPresenceDataCache::GroupMembersPresenceConfigurationItemLC(class CXIMPIdentityImp const &)
+	?IdLinearOrder@CPresenceBlockInfoImp@@SAHABV1@0@Z @ 46 NONAME ; int CPresenceBlockInfoImp::IdLinearOrder(class CPresenceBlockInfoImp const &, class CPresenceBlockInfoImp const &)
+	?IdLinearOrder@CPresenceGrantRequestInfoImp@@SAHABV1@0@Z @ 47 NONAME ; int CPresenceGrantRequestInfoImp::IdLinearOrder(class CPresenceGrantRequestInfoImp const &, class CPresenceGrantRequestInfoImp const &)
+	?IdLinearOrder@CPresenceWatcherInfoImp@@SAHABV1@0@Z @ 48 NONAME ; int CPresenceWatcherInfoImp::IdLinearOrder(class CPresenceWatcherInfoImp const &, class CPresenceWatcherInfoImp const &)
+	?Identity@CGroupMembersPresenceConfigurationItem@@QBEABVMXIMPIdentity@@XZ @ 49 NONAME ; class MXIMPIdentity const & CGroupMembersPresenceConfigurationItem::Identity(void) const
+	?Identity@CPresenceConfigurationItem@@QBEABVMXIMPIdentity@@XZ @ 50 NONAME ; class MXIMPIdentity const & CPresenceConfigurationItem::Identity(void) const
+	?Identity@CPresentityGroupInfoImp@@QBEABVCXIMPIdentityImp@@XZ @ 51 NONAME ; class CXIMPIdentityImp const & CPresentityGroupInfoImp::Identity(void) const
+	?Identity@CPresentityGroupMembersPresenceSubscriptionItem@@QBEABVMXIMPIdentity@@XZ @ 52 NONAME ; class MXIMPIdentity const & CPresentityGroupMembersPresenceSubscriptionItem::Identity(void) const
+	?Identity@CPresentityPresenceSubscriptionItem@@QBEABVMXIMPIdentity@@XZ @ 53 NONAME ; class MXIMPIdentity const & CPresentityPresenceSubscriptionItem::Identity(void) const
+	?IdentityImp@CPresenceBlockInfoImp@@QBEABVCXIMPIdentityImp@@XZ @ 54 NONAME ; class CXIMPIdentityImp const & CPresenceBlockInfoImp::IdentityImp(void) const
+	?IdentityImp@CPresenceGrantRequestInfoImp@@QBEABVCXIMPIdentityImp@@XZ @ 55 NONAME ; class CXIMPIdentityImp const & CPresenceGrantRequestInfoImp::IdentityImp(void) const
+	?IdentityImp@CPresenceWatcherInfoImp@@QBEABVCXIMPIdentityImp@@XZ @ 56 NONAME ; class CXIMPIdentityImp const & CPresenceWatcherInfoImp::IdentityImp(void) const
+	?IdentityImp@CPresentityGroupMemberInfoImp@@QBEABVCXIMPIdentityImp@@XZ @ 57 NONAME ; class CXIMPIdentityImp const & CPresentityGroupMemberInfoImp::IdentityImp(void) const
+	?IdentityOrder@CGroupContentSubscriptionItem@@SAHPBVCXIMPIdentityImp@@ABV1@@Z @ 58 NONAME ; int CGroupContentSubscriptionItem::IdentityOrder(class CXIMPIdentityImp const *, class CGroupContentSubscriptionItem const &)
+	?IdentityOrder@CGroupMembersPresenceConfigurationItem@@SAHPBVCXIMPIdentityImp@@ABV1@@Z @ 59 NONAME ; int CGroupMembersPresenceConfigurationItem::IdentityOrder(class CXIMPIdentityImp const *, class CGroupMembersPresenceConfigurationItem const &)
+	?IdentityOrder@CPresenceConfigurationItem@@SAHPBVCXIMPIdentityImp@@ABV1@@Z @ 60 NONAME ; int CPresenceConfigurationItem::IdentityOrder(class CXIMPIdentityImp const *, class CPresenceConfigurationItem const &)
+	?IdentityOrder@CPresentityGroupMembersPresenceSubscriptionItem@@SAHPBVCXIMPIdentityImp@@ABV1@@Z @ 61 NONAME ; int CPresentityGroupMembersPresenceSubscriptionItem::IdentityOrder(class CXIMPIdentityImp const *, class CPresentityGroupMembersPresenceSubscriptionItem const &)
+	?IdentityOrder@CPresentityPresenceSubscriptionItem@@SAHPBVCXIMPIdentityImp@@ABV1@@Z @ 62 NONAME ; int CPresentityPresenceSubscriptionItem::IdentityOrder(class CXIMPIdentityImp const *, class CPresentityPresenceSubscriptionItem const &)
+	?InfoFilterUnionL@DocumentUtils@@SAPAVCPresenceInfoFilterImp@@AAV2@0@Z @ 63 NONAME ; class CPresenceInfoFilterImp * DocumentUtils::InfoFilterUnionL(class CPresenceInfoFilterImp &, class CPresenceInfoFilterImp &)
+	?InfoFilterUnionL@DocumentUtils@@SAPAVCPresenceInfoFilterImp@@ABV?$RPointerArray@VCPresenceInfoFilterImp@@@@@Z @ 64 NONAME ; class CPresenceInfoFilterImp * DocumentUtils::InfoFilterUnionL(class RPointerArray<class CPresenceInfoFilterImp> const &)
+	?InternalizeL@CDevicePresenceInfoImp@@QAEXAAVRReadStream@@@Z @ 65 NONAME ; void CDevicePresenceInfoImp::InternalizeL(class RReadStream &)
+	?InternalizeL@CPersonPresenceInfoImp@@QAEXAAVRReadStream@@@Z @ 66 NONAME ; void CPersonPresenceInfoImp::InternalizeL(class RReadStream &)
+	?InternalizeL@CPresenceBlockInfoImp@@QAEXAAVRReadStream@@@Z @ 67 NONAME ; void CPresenceBlockInfoImp::InternalizeL(class RReadStream &)
+	?InternalizeL@CPresenceBuddyInfoImp@@QAEXAAVRReadStream@@@Z @ 68 NONAME ; void CPresenceBuddyInfoImp::InternalizeL(class RReadStream &)
+	?InternalizeL@CPresenceBuddyInfoListImp@@QAEXAAVRReadStream@@@Z @ 69 NONAME ; void CPresenceBuddyInfoListImp::InternalizeL(class RReadStream &)
+	?InternalizeL@CPresenceGrantRequestInfoImp@@QAEXAAVRReadStream@@@Z @ 70 NONAME ; void CPresenceGrantRequestInfoImp::InternalizeL(class RReadStream &)
+	?InternalizeL@CPresenceInfoFieldCollectionImp@@QAEXAAVRReadStream@@@Z @ 71 NONAME ; void CPresenceInfoFieldCollectionImp::InternalizeL(class RReadStream &)
+	?InternalizeL@CPresenceInfoFieldImp@@QAEXAAVRReadStream@@@Z @ 72 NONAME ; void CPresenceInfoFieldImp::InternalizeL(class RReadStream &)
+	?InternalizeL@CPresenceInfoFieldValueBinaryImp@@QAEXAAVRReadStream@@@Z @ 73 NONAME ; void CPresenceInfoFieldValueBinaryImp::InternalizeL(class RReadStream &)
+	?InternalizeL@CPresenceInfoFieldValueEnumImp@@QAEXAAVRReadStream@@@Z @ 74 NONAME ; void CPresenceInfoFieldValueEnumImp::InternalizeL(class RReadStream &)
+	?InternalizeL@CPresenceInfoFieldValueTextImp@@QAEXAAVRReadStream@@@Z @ 75 NONAME ; void CPresenceInfoFieldValueTextImp::InternalizeL(class RReadStream &)
+	?InternalizeL@CPresenceInfoFilterImp@@QAEXAAVRReadStream@@@Z @ 76 NONAME ; void CPresenceInfoFilterImp::InternalizeL(class RReadStream &)
+	?InternalizeL@CPresenceInfoImp@@QAEXAAVRReadStream@@@Z @ 77 NONAME ; void CPresenceInfoImp::InternalizeL(class RReadStream &)
+	?InternalizeL@CPresenceWatcherInfoImp@@QAEXAAVRReadStream@@@Z @ 78 NONAME ; void CPresenceWatcherInfoImp::InternalizeL(class RReadStream &)
+	?InternalizeL@CPresentityGroupInfoImp@@QAEXAAVRReadStream@@@Z @ 79 NONAME ; void CPresentityGroupInfoImp::InternalizeL(class RReadStream &)
+	?InternalizeL@CPresentityGroupMemberInfoImp@@QAEXAAVRReadStream@@@Z @ 80 NONAME ; void CPresentityGroupMemberInfoImp::InternalizeL(class RReadStream &)
+	?InternalizeL@CServicePresenceInfoImp@@QAEXAAVRReadStream@@@Z @ 81 NONAME ; void CServicePresenceInfoImp::InternalizeL(class RReadStream &)
+	?IsGroupMemberUpdatedL@CGroupContentSubscriptionItem@@QBEHAAVCPresentityGroupMemberInfoImp@@@Z @ 82 NONAME ; int CGroupContentSubscriptionItem::IsGroupMemberUpdatedL(class CPresentityGroupMemberInfoImp &) const
+	?NewFromStreamLC@CDevicePresenceInfoImp@@SAPAVCXIMPApiDataObjBase@@AAVRReadStream@@@Z @ 83 NONAME ; class CXIMPApiDataObjBase * CDevicePresenceInfoImp::NewFromStreamLC(class RReadStream &)
+	?NewFromStreamLC@CPersonPresenceInfoImp@@SAPAVCXIMPApiDataObjBase@@AAVRReadStream@@@Z @ 84 NONAME ; class CXIMPApiDataObjBase * CPersonPresenceInfoImp::NewFromStreamLC(class RReadStream &)
+	?NewFromStreamLC@CPresenceBlockInfoImp@@SAPAVCXIMPApiDataObjBase@@AAVRReadStream@@@Z @ 85 NONAME ; class CXIMPApiDataObjBase * CPresenceBlockInfoImp::NewFromStreamLC(class RReadStream &)
+	?NewFromStreamLC@CPresenceBuddyInfoImp@@SAPAVCXIMPApiDataObjBase@@AAVRReadStream@@@Z @ 86 NONAME ; class CXIMPApiDataObjBase * CPresenceBuddyInfoImp::NewFromStreamLC(class RReadStream &)
+	?NewFromStreamLC@CPresenceBuddyInfoListImp@@SAPAVCXIMPApiDataObjBase@@AAVRReadStream@@@Z @ 87 NONAME ; class CXIMPApiDataObjBase * CPresenceBuddyInfoListImp::NewFromStreamLC(class RReadStream &)
+	?NewFromStreamLC@CPresenceGrantRequestInfoImp@@SAPAVCXIMPApiDataObjBase@@AAVRReadStream@@@Z @ 88 NONAME ; class CXIMPApiDataObjBase * CPresenceGrantRequestInfoImp::NewFromStreamLC(class RReadStream &)
+	?NewFromStreamLC@CPresenceInfoFieldCollectionImp@@SAPAVCXIMPApiDataObjBase@@AAVRReadStream@@@Z @ 89 NONAME ; class CXIMPApiDataObjBase * CPresenceInfoFieldCollectionImp::NewFromStreamLC(class RReadStream &)
+	?NewFromStreamLC@CPresenceInfoFieldImp@@SAPAVCXIMPApiDataObjBase@@AAVRReadStream@@@Z @ 90 NONAME ; class CXIMPApiDataObjBase * CPresenceInfoFieldImp::NewFromStreamLC(class RReadStream &)
+	?NewFromStreamLC@CPresenceInfoFieldValueBinaryImp@@SAPAVCXIMPApiDataObjBase@@AAVRReadStream@@@Z @ 91 NONAME ; class CXIMPApiDataObjBase * CPresenceInfoFieldValueBinaryImp::NewFromStreamLC(class RReadStream &)
+	?NewFromStreamLC@CPresenceInfoFieldValueEnumImp@@SAPAVCXIMPApiDataObjBase@@AAVRReadStream@@@Z @ 92 NONAME ; class CXIMPApiDataObjBase * CPresenceInfoFieldValueEnumImp::NewFromStreamLC(class RReadStream &)
+	?NewFromStreamLC@CPresenceInfoFieldValueTextImp@@SAPAVCXIMPApiDataObjBase@@AAVRReadStream@@@Z @ 93 NONAME ; class CXIMPApiDataObjBase * CPresenceInfoFieldValueTextImp::NewFromStreamLC(class RReadStream &)
+	?NewFromStreamLC@CPresenceInfoFilterImp@@SAPAVCXIMPApiDataObjBase@@AAVRReadStream@@@Z @ 94 NONAME ; class CXIMPApiDataObjBase * CPresenceInfoFilterImp::NewFromStreamLC(class RReadStream &)
+	?NewFromStreamLC@CPresenceInfoImp@@SAPAVCXIMPApiDataObjBase@@AAVRReadStream@@@Z @ 95 NONAME ; class CXIMPApiDataObjBase * CPresenceInfoImp::NewFromStreamLC(class RReadStream &)
+	?NewFromStreamLC@CPresenceWatcherInfoImp@@SAPAVCXIMPApiDataObjBase@@AAVRReadStream@@@Z @ 96 NONAME ; class CXIMPApiDataObjBase * CPresenceWatcherInfoImp::NewFromStreamLC(class RReadStream &)
+	?NewFromStreamLC@CPresentityGroupInfoImp@@SAPAVCXIMPApiDataObjBase@@AAVRReadStream@@@Z @ 97 NONAME ; class CXIMPApiDataObjBase * CPresentityGroupInfoImp::NewFromStreamLC(class RReadStream &)
+	?NewFromStreamLC@CPresentityGroupMemberInfoImp@@SAPAVCXIMPApiDataObjBase@@AAVRReadStream@@@Z @ 98 NONAME ; class CXIMPApiDataObjBase * CPresentityGroupMemberInfoImp::NewFromStreamLC(class RReadStream &)
+	?NewFromStreamLC@CServicePresenceInfoImp@@SAPAVCXIMPApiDataObjBase@@AAVRReadStream@@@Z @ 99 NONAME ; class CXIMPApiDataObjBase * CServicePresenceInfoImp::NewFromStreamLC(class RReadStream &)
+	?NewL@COwnPresenceEventImp@@SAPAV1@PAVCXIMPDataSubscriptionStateImp@@@Z @ 100 NONAME ; class COwnPresenceEventImp * COwnPresenceEventImp::NewL(class CXIMPDataSubscriptionStateImp *)
+	?NewL@CPresenceApiDataObjFactoryAccessor@@SAPAV1@XZ @ 101 NONAME ; class CPresenceApiDataObjFactoryAccessor * CPresenceApiDataObjFactoryAccessor::NewL(void)
+	?NewL@CPresenceBlockInfoImp@@SAPAV1@XZ @ 102 NONAME ; class CPresenceBlockInfoImp * CPresenceBlockInfoImp::NewL(void)
+	?NewL@CPresenceBuddyInfoImp@@SAPAV1@XZ @ 103 NONAME ; class CPresenceBuddyInfoImp * CPresenceBuddyInfoImp::NewL(void)
+	?NewL@CPresenceBuddyInfoListImp@@SAPAV1@ABVTDesC16@@@Z @ 104 NONAME ; class CPresenceBuddyInfoListImp * CPresenceBuddyInfoListImp::NewL(class TDesC16 const &)
+	?NewL@CPresenceDataCache@@SAPAV1@AAVMXIMPHost@@@Z @ 105 NONAME ; class CPresenceDataCache * CPresenceDataCache::NewL(class MXIMPHost &)
+	?NewL@CPresenceFilterStore@@SAPAV1@XZ @ 106 NONAME ; class CPresenceFilterStore * CPresenceFilterStore::NewL(void)
+	?NewL@CPresenceGrantRequestInfoImp@@SAPAV1@XZ @ 107 NONAME ; class CPresenceGrantRequestInfoImp * CPresenceGrantRequestInfoImp::NewL(void)
+	?NewL@CPresenceInfoFilterImp@@SAPAV1@XZ @ 108 NONAME ; class CPresenceInfoFilterImp * CPresenceInfoFilterImp::NewL(void)
+	?NewL@CPresenceInfoImp@@SAPAV1@XZ @ 109 NONAME ; class CPresenceInfoImp * CPresenceInfoImp::NewL(void)
+	?NewL@CPresenceObjectFactoryImp@@SAPAV1@XZ @ 110 NONAME ; class CPresenceObjectFactoryImp * CPresenceObjectFactoryImp::NewL(void)
+	?NewL@CPresenceWatcherInfoImp@@SAPAV1@XZ @ 111 NONAME ; class CPresenceWatcherInfoImp * CPresenceWatcherInfoImp::NewL(void)
+	?NewL@CPresentityGroupContentEventImp@@SAPAV1@AAVCXIMPIdentityImp@@PAV?$RXIMPObjOwningPtrArray@VCPresentityGroupMemberInfoImp@@@@111PAVCXIMPDataSubscriptionStateImp@@@Z @ 112 NONAME ; class CPresentityGroupContentEventImp * CPresentityGroupContentEventImp::NewL(class CXIMPIdentityImp &, class RXIMPObjOwningPtrArray<class CPresentityGroupMemberInfoImp> *, class RXIMPObjOwningPtrArray<class CPresentityGroupMemberInfoImp> *, class RXIMPObjOwningPtrArray<class CPresentityGroupMemberInfoImp> *, class RXIMPObjOwningPtrArray<class CPresentityGroupMemberInfoImp> *, class CXIMPDataSubscriptionStateImp *)
+	?NewL@CPresentityGroupInfoImp@@SAPAV1@XZ @ 113 NONAME ; class CPresentityGroupInfoImp * CPresentityGroupInfoImp::NewL(void)
+	?NewL@CPresentityGroupListEventImp@@SAPAV1@PAV?$RXIMPObjOwningPtrArray@VCPresentityGroupInfoImp@@@@000PAVCXIMPDataSubscriptionStateImp@@@Z @ 114 NONAME ; class CPresentityGroupListEventImp * CPresentityGroupListEventImp::NewL(class RXIMPObjOwningPtrArray<class CPresentityGroupInfoImp> *, class RXIMPObjOwningPtrArray<class CPresentityGroupInfoImp> *, class RXIMPObjOwningPtrArray<class CPresentityGroupInfoImp> *, class RXIMPObjOwningPtrArray<class CPresentityGroupInfoImp> *, class CXIMPDataSubscriptionStateImp *)
+	?NewL@CPresentityGroupMemberInfoImp@@SAPAV1@XZ @ 115 NONAME ; class CPresentityGroupMemberInfoImp * CPresentityGroupMemberInfoImp::NewL(void)
+	?NewL@CPresentityPresenceEventImp@@SAPAV1@PAVCXIMPDataSubscriptionStateImp@@@Z @ 116 NONAME ; class CPresentityPresenceEventImp * CPresentityPresenceEventImp::NewL(class CXIMPDataSubscriptionStateImp *)
+	?NewLC@CDevicePresenceInfoImp@@SAPAV1@XZ @ 117 NONAME ; class CDevicePresenceInfoImp * CDevicePresenceInfoImp::NewLC(void)
+	?NewLC@COwnPresenceEventImp@@SAPAV1@PAVCXIMPDataSubscriptionStateImp@@@Z @ 118 NONAME ; class COwnPresenceEventImp * COwnPresenceEventImp::NewLC(class CXIMPDataSubscriptionStateImp *)
+	?NewLC@CPersonPresenceInfoImp@@SAPAV1@XZ @ 119 NONAME ; class CPersonPresenceInfoImp * CPersonPresenceInfoImp::NewLC(void)
+	?NewLC@CPresenceBlockInfoImp@@SAPAV1@ABVMXIMPIdentity@@ABVTDesC16@@@Z @ 120 NONAME ; class CPresenceBlockInfoImp * CPresenceBlockInfoImp::NewLC(class MXIMPIdentity const &, class TDesC16 const &)
+	?NewLC@CPresenceBlockInfoImp@@SAPAV1@XZ @ 121 NONAME ; class CPresenceBlockInfoImp * CPresenceBlockInfoImp::NewLC(void)
+	?NewLC@CPresenceBlockListEventImp@@SAPAV1@PAV?$RXIMPObjOwningPtrArray@VCPresenceBlockInfoImp@@@@000PAVCXIMPDataSubscriptionStateImp@@@Z @ 122 NONAME ; class CPresenceBlockListEventImp * CPresenceBlockListEventImp::NewLC(class RXIMPObjOwningPtrArray<class CPresenceBlockInfoImp> *, class RXIMPObjOwningPtrArray<class CPresenceBlockInfoImp> *, class RXIMPObjOwningPtrArray<class CPresenceBlockInfoImp> *, class RXIMPObjOwningPtrArray<class CPresenceBlockInfoImp> *, class CXIMPDataSubscriptionStateImp *)
+	?NewLC@CPresenceBuddyInfoImp@@SAPAV1@XZ @ 123 NONAME ; class CPresenceBuddyInfoImp * CPresenceBuddyInfoImp::NewLC(void)
+	?NewLC@CPresenceBuddyInfoListImp@@SAPAV1@ABVTDesC16@@@Z @ 124 NONAME ; class CPresenceBuddyInfoListImp * CPresenceBuddyInfoListImp::NewLC(class TDesC16 const &)
+	?NewLC@CPresenceGrantRequestInfoImp@@SAPAV1@ABVMXIMPIdentity@@ABVTDesC16@@@Z @ 125 NONAME ; class CPresenceGrantRequestInfoImp * CPresenceGrantRequestInfoImp::NewLC(class MXIMPIdentity const &, class TDesC16 const &)
+	?NewLC@CPresenceGrantRequestInfoImp@@SAPAV1@XZ @ 126 NONAME ; class CPresenceGrantRequestInfoImp * CPresenceGrantRequestInfoImp::NewLC(void)
+	?NewLC@CPresenceGrantRequestListEventImp@@SAPAV1@PAV?$RXIMPObjOwningPtrArray@VCPresenceGrantRequestInfoImp@@@@00PAVCXIMPDataSubscriptionStateImp@@@Z @ 127 NONAME ; class CPresenceGrantRequestListEventImp * CPresenceGrantRequestListEventImp::NewLC(class RXIMPObjOwningPtrArray<class CPresenceGrantRequestInfoImp> *, class RXIMPObjOwningPtrArray<class CPresenceGrantRequestInfoImp> *, class RXIMPObjOwningPtrArray<class CPresenceGrantRequestInfoImp> *, class CXIMPDataSubscriptionStateImp *)
+	?NewLC@CPresenceInfoFieldCollectionImp@@SAPAV1@XZ @ 128 NONAME ; class CPresenceInfoFieldCollectionImp * CPresenceInfoFieldCollectionImp::NewLC(void)
+	?NewLC@CPresenceInfoFieldImp@@SAPAV1@ABVTDesC8@@PAVCXIMPApiDataObjBase@@@Z @ 129 NONAME ; class CPresenceInfoFieldImp * CPresenceInfoFieldImp::NewLC(class TDesC8 const &, class CXIMPApiDataObjBase *)
+	?NewLC@CPresenceInfoFieldImp@@SAPAV1@XZ @ 130 NONAME ; class CPresenceInfoFieldImp * CPresenceInfoFieldImp::NewLC(void)
+	?NewLC@CPresenceInfoFieldValueBinaryImp@@SAPAV1@H@Z @ 131 NONAME ; class CPresenceInfoFieldValueBinaryImp * CPresenceInfoFieldValueBinaryImp::NewLC(int)
+	?NewLC@CPresenceInfoFieldValueEnumImp@@SAPAV1@XZ @ 132 NONAME ; class CPresenceInfoFieldValueEnumImp * CPresenceInfoFieldValueEnumImp::NewLC(void)
+	?NewLC@CPresenceInfoFieldValueTextImp@@SAPAV1@H@Z @ 133 NONAME ; class CPresenceInfoFieldValueTextImp * CPresenceInfoFieldValueTextImp::NewLC(int)
+	?NewLC@CPresenceInfoFilterImp@@SAPAV1@XZ @ 134 NONAME ; class CPresenceInfoFilterImp * CPresenceInfoFilterImp::NewLC(void)
+	?NewLC@CPresenceInfoImp@@SAPAV1@XZ @ 135 NONAME ; class CPresenceInfoImp * CPresenceInfoImp::NewLC(void)
+	?NewLC@CPresenceWatcherInfoImp@@SAPAV1@W4TWatcherType@MPresenceWatcherInfo@@ABVMXIMPIdentity@@ABVTDesC16@@@Z @ 136 NONAME ; class CPresenceWatcherInfoImp * CPresenceWatcherInfoImp::NewLC(enum MPresenceWatcherInfo::TWatcherType, class MXIMPIdentity const &, class TDesC16 const &)
+	?NewLC@CPresenceWatcherInfoImp@@SAPAV1@XZ @ 137 NONAME ; class CPresenceWatcherInfoImp * CPresenceWatcherInfoImp::NewLC(void)
+	?NewLC@CPresenceWatcherListEventImp@@SAPAV1@PAV?$RXIMPObjOwningPtrArray@VCPresenceWatcherInfoImp@@@@00PAVCXIMPDataSubscriptionStateImp@@@Z @ 138 NONAME ; class CPresenceWatcherListEventImp * CPresenceWatcherListEventImp::NewLC(class RXIMPObjOwningPtrArray<class CPresenceWatcherInfoImp> *, class RXIMPObjOwningPtrArray<class CPresenceWatcherInfoImp> *, class RXIMPObjOwningPtrArray<class CPresenceWatcherInfoImp> *, class CXIMPDataSubscriptionStateImp *)
+	?NewLC@CPresentityGroupContentEventImp@@SAPAV1@AAVCXIMPIdentityImp@@PAV?$RXIMPObjOwningPtrArray@VCPresentityGroupMemberInfoImp@@@@111PAVCXIMPDataSubscriptionStateImp@@@Z @ 139 NONAME ; class CPresentityGroupContentEventImp * CPresentityGroupContentEventImp::NewLC(class CXIMPIdentityImp &, class RXIMPObjOwningPtrArray<class CPresentityGroupMemberInfoImp> *, class RXIMPObjOwningPtrArray<class CPresentityGroupMemberInfoImp> *, class RXIMPObjOwningPtrArray<class CPresentityGroupMemberInfoImp> *, class RXIMPObjOwningPtrArray<class CPresentityGroupMemberInfoImp> *, class CXIMPDataSubscriptionStateImp *)
+	?NewLC@CPresentityGroupContentEventImp@@SAPAV1@AAVCXIMPIdentityImp@@PAV?$RXIMPObjOwningPtrArray@VCPresentityGroupMemberInfoImp@@@@11PAVCXIMPDataSubscriptionStateImp@@@Z @ 140 NONAME ; class CPresentityGroupContentEventImp * CPresentityGroupContentEventImp::NewLC(class CXIMPIdentityImp &, class RXIMPObjOwningPtrArray<class CPresentityGroupMemberInfoImp> *, class RXIMPObjOwningPtrArray<class CPresentityGroupMemberInfoImp> *, class RXIMPObjOwningPtrArray<class CPresentityGroupMemberInfoImp> *, class CXIMPDataSubscriptionStateImp *)
+	?NewLC@CPresentityGroupInfoImp@@SAPAV1@ABVMXIMPIdentity@@ABVTDesC16@@@Z @ 141 NONAME ; class CPresentityGroupInfoImp * CPresentityGroupInfoImp::NewLC(class MXIMPIdentity const &, class TDesC16 const &)
+	?NewLC@CPresentityGroupInfoImp@@SAPAV1@XZ @ 142 NONAME ; class CPresentityGroupInfoImp * CPresentityGroupInfoImp::NewLC(void)
+	?NewLC@CPresentityGroupListEventImp@@SAPAV1@PAV?$RXIMPObjOwningPtrArray@VCPresentityGroupInfoImp@@@@000PAVCXIMPDataSubscriptionStateImp@@@Z @ 143 NONAME ; class CPresentityGroupListEventImp * CPresentityGroupListEventImp::NewLC(class RXIMPObjOwningPtrArray<class CPresentityGroupInfoImp> *, class RXIMPObjOwningPtrArray<class CPresentityGroupInfoImp> *, class RXIMPObjOwningPtrArray<class CPresentityGroupInfoImp> *, class RXIMPObjOwningPtrArray<class CPresentityGroupInfoImp> *, class CXIMPDataSubscriptionStateImp *)
+	?NewLC@CPresentityGroupListEventImp@@SAPAV1@PAV?$RXIMPObjOwningPtrArray@VCPresentityGroupInfoImp@@@@00PAVCXIMPDataSubscriptionStateImp@@@Z @ 144 NONAME ; class CPresentityGroupListEventImp * CPresentityGroupListEventImp::NewLC(class RXIMPObjOwningPtrArray<class CPresentityGroupInfoImp> *, class RXIMPObjOwningPtrArray<class CPresentityGroupInfoImp> *, class RXIMPObjOwningPtrArray<class CPresentityGroupInfoImp> *, class CXIMPDataSubscriptionStateImp *)
+	?NewLC@CPresentityGroupMemberInfoImp@@SAPAV1@ABVMXIMPIdentity@@ABVTDesC16@@@Z @ 145 NONAME ; class CPresentityGroupMemberInfoImp * CPresentityGroupMemberInfoImp::NewLC(class MXIMPIdentity const &, class TDesC16 const &)
+	?NewLC@CPresentityGroupMemberInfoImp@@SAPAV1@XZ @ 146 NONAME ; class CPresentityGroupMemberInfoImp * CPresentityGroupMemberInfoImp::NewLC(void)
+	?NewLC@CPresentityPresenceEventImp@@SAPAV1@PAVCXIMPDataSubscriptionStateImp@@@Z @ 147 NONAME ; class CPresentityPresenceEventImp * CPresentityPresenceEventImp::NewLC(class CXIMPDataSubscriptionStateImp *)
+	?NewLC@CServicePresenceInfoImp@@SAPAV1@XZ @ 148 NONAME ; class CServicePresenceInfoImp * CServicePresenceInfoImp::NewLC(void)
+	?Order@CGroupContentSubscriptionItem@@SAHABV1@0@Z @ 149 NONAME ; int CGroupContentSubscriptionItem::Order(class CGroupContentSubscriptionItem const &, class CGroupContentSubscriptionItem const &)
+	?Order@CGroupMembersPresenceConfigurationItem@@SAHABV1@0@Z @ 150 NONAME ; int CGroupMembersPresenceConfigurationItem::Order(class CGroupMembersPresenceConfigurationItem const &, class CGroupMembersPresenceConfigurationItem const &)
+	?Order@CPresenceConfigurationItem@@SAHABV1@0@Z @ 151 NONAME ; int CPresenceConfigurationItem::Order(class CPresenceConfigurationItem const &, class CPresenceConfigurationItem const &)
+	?Order@CPresentityGroupMembersPresenceSubscriptionItem@@SAHABV1@0@Z @ 152 NONAME ; int CPresentityGroupMembersPresenceSubscriptionItem::Order(class CPresentityGroupMembersPresenceSubscriptionItem const &, class CPresentityGroupMembersPresenceSubscriptionItem const &)
+	?Order@CPresentityPresenceSubscriptionItem@@SAHABV1@0@Z @ 153 NONAME ; int CPresentityPresenceSubscriptionItem::Order(class CPresentityPresenceSubscriptionItem const &, class CPresentityPresenceSubscriptionItem const &)
+	?OwnPresenceDataSubscriptionState@CPresenceDataCache@@QBEABVMXIMPDataSubscriptionState@@XZ @ 154 NONAME ; class MXIMPDataSubscriptionState const & CPresenceDataCache::OwnPresenceDataSubscriptionState(void) const
+	?OwnPresenceSubscriptionItemLC@CPresenceDataCache@@QAEAAVCOwnPresenceSubscriptionItem@@XZ @ 155 NONAME ; class COwnPresenceSubscriptionItem & CPresenceDataCache::OwnPresenceSubscriptionItemLC(void)
+	?PresenceBlockDataSubscriptionState@CPresenceDataCache@@QBEABVMXIMPDataSubscriptionState@@XZ @ 156 NONAME ; class MXIMPDataSubscriptionState const & CPresenceDataCache::PresenceBlockDataSubscriptionState(void) const
+	?PresenceConfigurationItemLC@CPresenceDataCache@@QAEAAVCPresenceConfigurationItem@@ABVCXIMPIdentityImp@@@Z @ 157 NONAME ; class CPresenceConfigurationItem & CPresenceDataCache::PresenceConfigurationItemLC(class CXIMPIdentityImp const &)
+	?PresenceGrantRequestDataSubscriptionState@CPresenceDataCache@@QBEABVMXIMPDataSubscriptionState@@XZ @ 158 NONAME ; class MXIMPDataSubscriptionState const & CPresenceDataCache::PresenceGrantRequestDataSubscriptionState(void) const
+	?PresenceToEveryoneConfigurationItemLC@CPresenceDataCache@@QAEAAVCPresenceToEveryoneConfigurationItem@@XZ @ 159 NONAME ; class CPresenceToEveryoneConfigurationItem & CPresenceDataCache::PresenceToEveryoneConfigurationItemLC(void)
+	?PresenceWatcherListDataSubscriptionState@CPresenceDataCache@@QBEABVMXIMPDataSubscriptionState@@XZ @ 160 NONAME ; class MXIMPDataSubscriptionState const & CPresenceDataCache::PresenceWatcherListDataSubscriptionState(void) const
+	?PresentityGroupContentDataSubscriptionState@CPresenceDataCache@@QBEABVMXIMPDataSubscriptionState@@ABVMXIMPIdentity@@@Z @ 161 NONAME ; class MXIMPDataSubscriptionState const & CPresenceDataCache::PresentityGroupContentDataSubscriptionState(class MXIMPIdentity const &) const
+	?PresentityGroupListDataSubscriptionState@CPresenceDataCache@@QBEABVMXIMPDataSubscriptionState@@XZ @ 162 NONAME ; class MXIMPDataSubscriptionState const & CPresenceDataCache::PresentityGroupListDataSubscriptionState(void) const
+	?PresentityGroupMembersPresenceSubscriptionItemLC@CPresenceDataCache@@QAEAAVCPresentityGroupMembersPresenceSubscriptionItem@@ABVCXIMPIdentityImp@@@Z @ 163 NONAME ; class CPresentityGroupMembersPresenceSubscriptionItem & CPresenceDataCache::PresentityGroupMembersPresenceSubscriptionItemLC(class CXIMPIdentityImp const &)
+	?PresentityPresenceDataSubscriptionState@CPresenceDataCache@@QBEABVMXIMPDataSubscriptionState@@ABVMXIMPIdentity@@@Z @ 164 NONAME ; class MXIMPDataSubscriptionState const & CPresenceDataCache::PresentityPresenceDataSubscriptionState(class MXIMPIdentity const &) const
+	?PresentityPresenceSubscriptionItemLC@CPresenceDataCache@@QAEAAVCPresentityPresenceSubscriptionItem@@ABVCXIMPIdentityImp@@@Z @ 165 NONAME ; class CPresentityPresenceSubscriptionItem & CPresenceDataCache::PresentityPresenceSubscriptionItemLC(class CXIMPIdentityImp const &)
+	?RemoveConfigurator@CGroupMembersPresenceConfigurationItem@@QAEXPAVMXIMPPscContext@@@Z @ 166 NONAME ; void CGroupMembersPresenceConfigurationItem::RemoveConfigurator(class MXIMPPscContext *)
+	?RemoveMe@?$@VCBlockListSubscriptionItem@@@CPresenceDataCache@@CAXAAPAV1@PAV1@@Z @ 167 NONAME ; void CPresenceDataCache::RemoveMe<class CBlockListSubscriptionItem>(class CBlockListSubscriptionItem * &, class CBlockListSubscriptionItem *)
+	?RemoveMe@?$@VCGrantRequestListSubscriptionItem@@@CPresenceDataCache@@CAXAAPAV1@PAV1@@Z @ 168 NONAME ; void CPresenceDataCache::RemoveMe<class CGrantRequestListSubscriptionItem>(class CGrantRequestListSubscriptionItem * &, class CGrantRequestListSubscriptionItem *)
+	?RemoveMe@?$@VCGroupListSubscriptionItem@@@CPresenceDataCache@@CAXAAPAV1@PAV1@@Z @ 169 NONAME ; void CPresenceDataCache::RemoveMe<class CGroupListSubscriptionItem>(class CGroupListSubscriptionItem * &, class CGroupListSubscriptionItem *)
+	?RemoveMe@?$@VCOwnPresenceSubscriptionItem@@@CPresenceDataCache@@CAXAAPAV1@PAV1@@Z @ 170 NONAME ; void CPresenceDataCache::RemoveMe<class COwnPresenceSubscriptionItem>(class COwnPresenceSubscriptionItem * &, class COwnPresenceSubscriptionItem *)
+	?RemoveMe@?$@VCPresenceToEveryoneConfigurationItem@@@CPresenceDataCache@@CAXAAPAV1@PAV1@@Z @ 171 NONAME ; void CPresenceDataCache::RemoveMe<class CPresenceToEveryoneConfigurationItem>(class CPresenceToEveryoneConfigurationItem * &, class CPresenceToEveryoneConfigurationItem *)
+	?RemoveMe@?$@VCWatcherListSubscriptionItem@@@CPresenceDataCache@@CAXAAPAV1@PAV1@@Z @ 172 NONAME ; void CPresenceDataCache::RemoveMe<class CWatcherListSubscriptionItem>(class CWatcherListSubscriptionItem * &, class CWatcherListSubscriptionItem *)
+	?RemoveSubscriber@CPresentityGroupMembersPresenceSubscriptionItem@@QAEXPAVMXIMPPscContext@@@Z @ 173 NONAME ; void CPresentityGroupMembersPresenceSubscriptionItem::RemoveSubscriber(class MXIMPPscContext *)
+	?SetAddedListL@CGroupContentSubscriptionItem@@QAEXPAV?$RXIMPObjOwningPtrArray@VCPresentityGroupMemberInfoImp@@@@@Z @ 174 NONAME ; void CGroupContentSubscriptionItem::SetAddedListL(class RXIMPObjOwningPtrArray<class CPresentityGroupMemberInfoImp> *)
+	?SetBlockedL@CBlockListSubscriptionItem@@QAEXPAVCPresenceBlockInfoImp@@@Z @ 175 NONAME ; void CBlockListSubscriptionItem::SetBlockedL(class CPresenceBlockInfoImp *)
+	?SetCanceledBlockIdL@CBlockListSubscriptionItem@@QAEXPAVCXIMPIdentityImp@@@Z @ 176 NONAME ; void CBlockListSubscriptionItem::SetCanceledBlockIdL(class CXIMPIdentityImp *)
+	?SetConfigurationPif@CGroupMembersPresenceConfigurationItem@@QAEXPAVCPresenceInfoFilterImp@@@Z @ 177 NONAME ; void CGroupMembersPresenceConfigurationItem::SetConfigurationPif(class CPresenceInfoFilterImp *)
+	?SetConfigurationPif@CPresenceConfigurationItem@@QAEXPAVCPresenceInfoFilterImp@@@Z @ 178 NONAME ; void CPresenceConfigurationItem::SetConfigurationPif(class CPresenceInfoFilterImp *)
+	?SetConfigurationPif@CPresenceToEveryoneConfigurationItem@@QAEXPAVCPresenceInfoFilterImp@@@Z @ 179 NONAME ; void CPresenceToEveryoneConfigurationItem::SetConfigurationPif(class CPresenceInfoFilterImp *)
+	?SetCreatedListL@CGroupListSubscriptionItem@@QAEXPAV?$RXIMPObjOwningPtrArray@VCPresentityGroupInfoImp@@@@@Z @ 180 NONAME ; void CGroupListSubscriptionItem::SetCreatedListL(class RXIMPObjOwningPtrArray<class CPresentityGroupInfoImp> *)
+	?SetDeletedListL@CGroupListSubscriptionItem@@QAEXPAV?$RXIMPObjOwningPtrArray@VCPresentityGroupInfoImp@@@@@Z @ 181 NONAME ; void CGroupListSubscriptionItem::SetDeletedListL(class RXIMPObjOwningPtrArray<class CPresentityGroupInfoImp> *)
+	?SetDisplayName@CPresenceBlockInfoImp@@QAEXPAVHBufC16@@@Z @ 182 NONAME ; void CPresenceBlockInfoImp::SetDisplayName(class HBufC16 *)
+	?SetDisplayName@CPresenceGrantRequestInfoImp@@QAEXPAVHBufC16@@@Z @ 183 NONAME ; void CPresenceGrantRequestInfoImp::SetDisplayName(class HBufC16 *)
+	?SetDisplayName@CPresenceWatcherInfoImp@@QAEXPAVHBufC16@@@Z @ 184 NONAME ; void CPresenceWatcherInfoImp::SetDisplayName(class HBufC16 *)
+	?SetGroupIdentity@CPresentityPresenceSubscriptionItem@@QAEXPAVCXIMPIdentityImp@@@Z @ 185 NONAME ; void CPresentityPresenceSubscriptionItem::SetGroupIdentity(class CXIMPIdentityImp *)
+	?SetIdentity@CGroupMembersPresenceConfigurationItem@@QAEXPAVCXIMPIdentityImp@@@Z @ 186 NONAME ; void CGroupMembersPresenceConfigurationItem::SetIdentity(class CXIMPIdentityImp *)
+	?SetIdentity@CPresenceBlockInfoImp@@QAEXPAVCXIMPIdentityImp@@@Z @ 187 NONAME ; void CPresenceBlockInfoImp::SetIdentity(class CXIMPIdentityImp *)
+	?SetIdentity@CPresenceConfigurationItem@@QAEXPAVCXIMPIdentityImp@@@Z @ 188 NONAME ; void CPresenceConfigurationItem::SetIdentity(class CXIMPIdentityImp *)
+	?SetIdentity@CPresenceGrantRequestInfoImp@@QAEXPAVCXIMPIdentityImp@@@Z @ 189 NONAME ; void CPresenceGrantRequestInfoImp::SetIdentity(class CXIMPIdentityImp *)
+	?SetIdentity@CPresenceWatcherInfoImp@@QAEXPAVCXIMPIdentityImp@@@Z @ 190 NONAME ; void CPresenceWatcherInfoImp::SetIdentity(class CXIMPIdentityImp *)
+	?SetIdentity@CPresentityGroupMembersPresenceSubscriptionItem@@QAEXPAVCXIMPIdentityImp@@@Z @ 191 NONAME ; void CPresentityGroupMembersPresenceSubscriptionItem::SetIdentity(class CXIMPIdentityImp *)
+	?SetIdentity@CPresentityPresenceSubscriptionItem@@QAEXPAVCXIMPIdentityImp@@@Z @ 192 NONAME ; void CPresentityPresenceSubscriptionItem::SetIdentity(class CXIMPIdentityImp *)
+	?SetNewListL@CBlockListSubscriptionItem@@QAEXPAV?$RXIMPObjOwningPtrArray@VCPresenceBlockInfoImp@@@@@Z @ 193 NONAME ; void CBlockListSubscriptionItem::SetNewListL(class RXIMPObjOwningPtrArray<class CPresenceBlockInfoImp> *)
+	?SetNewListL@CGrantRequestListSubscriptionItem@@QAEXPAV?$RXIMPObjOwningPtrArray@VCPresenceGrantRequestInfoImp@@@@@Z @ 194 NONAME ; void CGrantRequestListSubscriptionItem::SetNewListL(class RXIMPObjOwningPtrArray<class CPresenceGrantRequestInfoImp> *)
+	?SetNewListL@CGroupContentSubscriptionItem@@QAEXPAV?$RXIMPObjOwningPtrArray@VCPresentityGroupMemberInfoImp@@@@@Z @ 195 NONAME ; void CGroupContentSubscriptionItem::SetNewListL(class RXIMPObjOwningPtrArray<class CPresentityGroupMemberInfoImp> *)
+	?SetNewListL@CGroupListSubscriptionItem@@QAEXPAV?$RXIMPObjOwningPtrArray@VCPresentityGroupInfoImp@@@@@Z @ 196 NONAME ; void CGroupListSubscriptionItem::SetNewListL(class RXIMPObjOwningPtrArray<class CPresentityGroupInfoImp> *)
+	?SetNewListL@CWatcherListSubscriptionItem@@QAEXPAV?$RXIMPObjOwningPtrArray@VCPresenceWatcherInfoImp@@@@@Z @ 197 NONAME ; void CWatcherListSubscriptionItem::SetNewListL(class RXIMPObjOwningPtrArray<class CPresenceWatcherInfoImp> *)
+	?SetObsoletedRequestL@CGrantRequestListSubscriptionItem@@QAEXPAVCXIMPIdentityImp@@@Z @ 198 NONAME ; void CGrantRequestListSubscriptionItem::SetObsoletedRequestL(class CXIMPIdentityImp *)
+	?SetOwnObjects@CPresenceBuddyInfoListImp@@QAEXH@Z @ 199 NONAME ; void CPresenceBuddyInfoListImp::SetOwnObjects(int)
+	?SetPresenceInfoL@COwnPresenceSubscriptionItem@@QAEXPAVCPresenceInfoImp@@@Z @ 200 NONAME ; void COwnPresenceSubscriptionItem::SetPresenceInfoL(class CPresenceInfoImp *)
+	?SetPresenceInfoL@CPresentityGroupMembersPresenceSubscriptionItem@@QAEXPAVCPresenceInfoImp@@@Z @ 201 NONAME ; void CPresentityGroupMembersPresenceSubscriptionItem::SetPresenceInfoL(class CPresenceInfoImp *)
+	?SetPresenceInfoL@CPresentityPresenceSubscriptionItem@@QAEXPAVCPresenceInfoImp@@@Z @ 202 NONAME ; void CPresentityPresenceSubscriptionItem::SetPresenceInfoL(class CPresenceInfoImp *)
+	?SetReceivedRequestL@CGrantRequestListSubscriptionItem@@QAEXPAVCPresenceGrantRequestInfoImp@@@Z @ 203 NONAME ; void CGrantRequestListSubscriptionItem::SetReceivedRequestL(class CPresenceGrantRequestInfoImp *)
+	?SetRemovedListL@CGroupContentSubscriptionItem@@QAEXPAV?$RXIMPObjOwningPtrArray@VCPresentityGroupMemberInfoImp@@@@@Z @ 204 NONAME ; void CGroupContentSubscriptionItem::SetRemovedListL(class RXIMPObjOwningPtrArray<class CPresentityGroupMemberInfoImp> *)
+	?SetSubscriptionPif@COwnPresenceSubscriptionItem@@QAEXPAVCPresenceInfoFilterImp@@@Z @ 205 NONAME ; void COwnPresenceSubscriptionItem::SetSubscriptionPif(class CPresenceInfoFilterImp *)
+	?SetSubscriptionPif@CPresentityGroupMembersPresenceSubscriptionItem@@QAEXPAVCPresenceInfoFilterImp@@@Z @ 206 NONAME ; void CPresentityGroupMembersPresenceSubscriptionItem::SetSubscriptionPif(class CPresenceInfoFilterImp *)
+	?SetSubscriptionPif@CPresentityPresenceSubscriptionItem@@QAEXPAVCPresenceInfoFilterImp@@@Z @ 207 NONAME ; void CPresentityPresenceSubscriptionItem::SetSubscriptionPif(class CPresenceInfoFilterImp *)
+	?SubscriptionPif@COwnPresenceSubscriptionItem@@QAEAAVCPresenceInfoFilterImp@@XZ @ 208 NONAME ; class CPresenceInfoFilterImp & COwnPresenceSubscriptionItem::SubscriptionPif(void)
+	?SubscriptionPif@CPresentityGroupMembersPresenceSubscriptionItem@@QAEAAVCPresenceInfoFilterImp@@XZ @ 209 NONAME ; class CPresenceInfoFilterImp & CPresentityGroupMembersPresenceSubscriptionItem::SubscriptionPif(void)
+	?SubscriptionPif@CPresentityPresenceSubscriptionItem@@QAEAAVCPresenceInfoFilterImp@@XZ @ 210 NONAME ; class CPresenceInfoFilterImp & CPresentityPresenceSubscriptionItem::SubscriptionPif(void)
+	?UnionL@CPresenceInfoFilterImp@@SAPAV1@AAV1@0@Z @ 211 NONAME ; class CPresenceInfoFilterImp * CPresenceInfoFilterImp::UnionL(class CPresenceInfoFilterImp &, class CPresenceInfoFilterImp &)
+	?WatcherListSubscriptionItemLC@CPresenceDataCache@@QAEAAVCWatcherListSubscriptionItem@@XZ @ 212 NONAME ; class CWatcherListSubscriptionItem & CPresenceDataCache::WatcherListSubscriptionItemLC(void)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/bwins/presenceecomhookU.DEF	Wed Nov 03 09:32:20 2010 +0530
@@ -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/ximpfw/presence/bwins/presencemanagerU.DEF	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,3 @@
+EXPORTS
+	?NewL@CPresenceFeaturesImp@@SAPAV1@PAVMXIMPContext@@@Z @ 1 NONAME ; class CPresenceFeaturesImp * CPresenceFeaturesImp::NewL(class MXIMPContext *)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/bwins/presenceoperationu.def	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,47 @@
+EXPORTS
+	??0COperationAddPresentityGroupMember@@QAE@XZ @ 1 NONAME ; COperationAddPresentityGroupMember::COperationAddPresentityGroupMember(void)
+	??0COperationBlockPresenceForPresentity@@QAE@XZ @ 2 NONAME ; COperationBlockPresenceForPresentity::COperationBlockPresenceForPresentity(void)
+	??0COperationCancelPresenceBlockFromPresentity@@QAE@XZ @ 3 NONAME ; COperationCancelPresenceBlockFromPresentity::COperationCancelPresenceBlockFromPresentity(void)
+	??0COperationCreatePresentityGroup@@QAE@XZ @ 4 NONAME ; COperationCreatePresentityGroup::COperationCreatePresentityGroup(void)
+	??0COperationDeletePresentityGroup@@QAE@XZ @ 5 NONAME ; COperationDeletePresentityGroup::COperationDeletePresentityGroup(void)
+	??0COperationGrantPresenceToEveryone@@QAE@XZ @ 6 NONAME ; COperationGrantPresenceToEveryone::COperationGrantPresenceToEveryone(void)
+	??0COperationGrantPresenceToPresentity@@QAE@XZ @ 7 NONAME ; COperationGrantPresenceToPresentity::COperationGrantPresenceToPresentity(void)
+	??0COperationGrantPresenceToPresentityGroupMembers@@QAE@XZ @ 8 NONAME ; COperationGrantPresenceToPresentityGroupMembers::COperationGrantPresenceToPresentityGroupMembers(void)
+	??0COperationHandleOwnPresence@@QAE@XZ @ 9 NONAME ; COperationHandleOwnPresence::COperationHandleOwnPresence(void)
+	??0COperationHandlePresenceBlocking@@QAE@H@Z @ 10 NONAME ; COperationHandlePresenceBlocking::COperationHandlePresenceBlocking(int)
+	??0COperationHandlePresenceGrantRequests@@QAE@H@Z @ 11 NONAME ; COperationHandlePresenceGrantRequests::COperationHandlePresenceGrantRequests(int)
+	??0COperationHandlePresenceWatcherList@@QAE@XZ @ 12 NONAME ; COperationHandlePresenceWatcherList::COperationHandlePresenceWatcherList(void)
+	??0COperationHandlePresentityGroupContent@@QAE@XZ @ 13 NONAME ; COperationHandlePresentityGroupContent::COperationHandlePresentityGroupContent(void)
+	??0COperationHandlePresentityGroupMemberAdded@@QAE@XZ @ 14 NONAME ; COperationHandlePresentityGroupMemberAdded::COperationHandlePresentityGroupMemberAdded(void)
+	??0COperationHandlePresentityGroupMemberDisplayNameUpdated@@QAE@XZ @ 15 NONAME ; COperationHandlePresentityGroupMemberDisplayNameUpdated::COperationHandlePresentityGroupMemberDisplayNameUpdated(void)
+	??0COperationHandlePresentityGroupMemberRemoved@@QAE@XZ @ 16 NONAME ; COperationHandlePresentityGroupMemberRemoved::COperationHandlePresentityGroupMemberRemoved(void)
+	??0COperationHandlePresentityGroups@@QAE@W4TPresenceOpTypes@NPresenceOps@@@Z @ 17 NONAME ; COperationHandlePresentityGroups::COperationHandlePresentityGroups(enum NPresenceOps::TPresenceOpTypes)
+	??0COperationHandlePresentityPresence@@QAE@H@Z @ 18 NONAME ; COperationHandlePresentityPresence::COperationHandlePresentityPresence(int)
+	??0COperationLaunchCleaner@@QAE@XZ @ 19 NONAME ; COperationLaunchCleaner::COperationLaunchCleaner(void)
+	??0COperationPublishOwnPresence@@QAE@XZ @ 20 NONAME ; COperationPublishOwnPresence::COperationPublishOwnPresence(void)
+	??0COperationRemovePresentityGroupMember@@QAE@XZ @ 21 NONAME ; COperationRemovePresentityGroupMember::COperationRemovePresentityGroupMember(void)
+	??0COperationSetSubscriptionData@@QAE@W4TPresenceOpTypes@NPresenceOps@@@Z @ 22 NONAME ; COperationSetSubscriptionData::COperationSetSubscriptionData(enum NPresenceOps::TPresenceOpTypes)
+	??0COperationSubscribeBlockList@@QAE@XZ @ 23 NONAME ; COperationSubscribeBlockList::COperationSubscribeBlockList(void)
+	??0COperationSubscribeGrantRequestList@@QAE@XZ @ 24 NONAME ; COperationSubscribeGrantRequestList::COperationSubscribeGrantRequestList(void)
+	??0COperationSubscribeGroupContent@@QAE@XZ @ 25 NONAME ; COperationSubscribeGroupContent::COperationSubscribeGroupContent(void)
+	??0COperationSubscribeGroupList@@QAE@XZ @ 26 NONAME ; COperationSubscribeGroupList::COperationSubscribeGroupList(void)
+	??0COperationSubscribeOwnPresence@@QAE@XZ @ 27 NONAME ; COperationSubscribeOwnPresence::COperationSubscribeOwnPresence(void)
+	??0COperationSubscribePresentityGroupMembersPresence@@QAE@XZ @ 28 NONAME ; COperationSubscribePresentityGroupMembersPresence::COperationSubscribePresentityGroupMembersPresence(void)
+	??0COperationSubscribePresentityPresence@@QAE@XZ @ 29 NONAME ; COperationSubscribePresentityPresence::COperationSubscribePresentityPresence(void)
+	??0COperationSubscribeWatcherList@@QAE@XZ @ 30 NONAME ; COperationSubscribeWatcherList::COperationSubscribeWatcherList(void)
+	??0COperationSynthesiseSubscriptionEvent@@QAE@W4TSubscriptionType@0@H@Z @ 31 NONAME ; COperationSynthesiseSubscriptionEvent::COperationSynthesiseSubscriptionEvent(enum COperationSynthesiseSubscriptionEvent::TSubscriptionType, int)
+	??0COperationUnsubscribeBlockList@@QAE@XZ @ 32 NONAME ; COperationUnsubscribeBlockList::COperationUnsubscribeBlockList(void)
+	??0COperationUnsubscribeGrantRequestList@@QAE@XZ @ 33 NONAME ; COperationUnsubscribeGrantRequestList::COperationUnsubscribeGrantRequestList(void)
+	??0COperationUnsubscribeGroupContent@@QAE@XZ @ 34 NONAME ; COperationUnsubscribeGroupContent::COperationUnsubscribeGroupContent(void)
+	??0COperationUnsubscribeGroupList@@QAE@XZ @ 35 NONAME ; COperationUnsubscribeGroupList::COperationUnsubscribeGroupList(void)
+	??0COperationUnsubscribeOwnPresence@@QAE@XZ @ 36 NONAME ; COperationUnsubscribeOwnPresence::COperationUnsubscribeOwnPresence(void)
+	??0COperationUnsubscribePresentityGroupMembersPresence@@QAE@XZ @ 37 NONAME ; COperationUnsubscribePresentityGroupMembersPresence::COperationUnsubscribePresentityGroupMembersPresence(void)
+	??0COperationUnsubscribePresentityPresence@@QAE@XZ @ 38 NONAME ; COperationUnsubscribePresentityPresence::COperationUnsubscribePresentityPresence(void)
+	??0COperationUnsubscribeWatcherList@@QAE@XZ @ 39 NONAME ; COperationUnsubscribeWatcherList::COperationUnsubscribeWatcherList(void)
+	??0COperationUpdatePresentityGroupDisplayName@@QAE@XZ @ 40 NONAME ; COperationUpdatePresentityGroupDisplayName::COperationUpdatePresentityGroupDisplayName(void)
+	??0COperationUpdatePresentityGroupMemberDisplayName@@QAE@XZ @ 41 NONAME ; COperationUpdatePresentityGroupMemberDisplayName::COperationUpdatePresentityGroupMemberDisplayName(void)
+	??0COperationWithdrawPresenceFromEveryone@@QAE@XZ @ 42 NONAME ; COperationWithdrawPresenceFromEveryone::COperationWithdrawPresenceFromEveryone(void)
+	??0COperationWithdrawPresenceFromPresentity@@QAE@XZ @ 43 NONAME ; COperationWithdrawPresenceFromPresentity::COperationWithdrawPresenceFromPresentity(void)
+	??0COperationWithdrawPresenceFromPresentityGroupMembers@@QAE@XZ @ 44 NONAME ; COperationWithdrawPresenceFromPresentityGroupMembers::COperationWithdrawPresenceFromPresentityGroupMembers(void)
+	?NewL@CPresenceOperationFactory@@SAPAV1@XZ @ 45 NONAME ; class CPresenceOperationFactory * CPresenceOperationFactory::NewL(void)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/eabi/presencecacheclientu.def	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,7 @@
+EXPORTS
+	_ZN20CPresenceCacheClient13CreateReaderLEv @ 1 NONAME
+	_ZN20CPresenceCacheClient13CreateWriterLEv @ 2 NONAME
+	_ZN20CPresenceCacheClient4NewLEv @ 3 NONAME
+	_ZTI20CPresenceCacheClient @ 4 NONAME ; #<TI>#
+	_ZTV20CPresenceCacheClient @ 5 NONAME ; #<VT>#
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/eabi/presencecacheecomhooku.def	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,3 @@
+EXPORTS
+	_Z24ImplementationGroupProxyRi @ 1 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/eabi/presencedatamodelhooku.def	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,3 @@
+EXPORTS
+	_Z24ImplementationGroupProxyRi @ 1 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/eabi/presencedatamodelu.def	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,247 @@
+EXPORTS
+	_ZN13DocumentUtils16InfoFilterUnionLER22CPresenceInfoFilterImpS1_ @ 1 NONAME
+	_ZN13DocumentUtils16InfoFilterUnionLERK13RPointerArrayI22CPresenceInfoFilterImpE @ 2 NONAME
+	_ZN13DocumentUtils29CollectFilteredPresenceInfoLCERK22CPresenceInfoFilterImpRK16CPresenceInfoImp @ 3 NONAME
+	_ZN16CPresenceInfoImp12InternalizeLER11RReadStream @ 4 NONAME
+	_ZN16CPresenceInfoImp15NewFromStreamLCER11RReadStream @ 5 NONAME
+	_ZN16CPresenceInfoImp4NewLEv @ 6 NONAME
+	_ZN16CPresenceInfoImp5NewLCEv @ 7 NONAME
+	_ZN18CPresenceDataCache12CleanExpiredEv @ 8 NONAME
+	_ZN18CPresenceDataCache14CleanResourcesER15MXIMPPscContext @ 9 NONAME
+	_ZN18CPresenceDataCache27BlockListSubscriptionItemLCEv @ 10 NONAME
+	_ZN18CPresenceDataCache27GroupListSubscriptionItemLCEv @ 11 NONAME
+	_ZN18CPresenceDataCache27PresenceConfigurationItemLCERK16CXIMPIdentityImp @ 12 NONAME
+	_ZN18CPresenceDataCache29OwnPresenceSubscriptionItemLCEv @ 13 NONAME
+	_ZN18CPresenceDataCache29WatcherListSubscriptionItemLCEv @ 14 NONAME
+	_ZN18CPresenceDataCache30GroupContentSubscriptionItemLCERK16CXIMPIdentityImp @ 15 NONAME
+	_ZN18CPresenceDataCache34GrantRequestListSubscriptionItemLCEv @ 16 NONAME
+	_ZN18CPresenceDataCache34GroupContentSubscriptionItemExistsERK16CXIMPIdentityImp @ 17 NONAME
+	_ZN18CPresenceDataCache36PresentityPresenceSubscriptionItemLCERK16CXIMPIdentityImp @ 18 NONAME
+	_ZN18CPresenceDataCache37PresenceToEveryoneConfigurationItemLCEv @ 19 NONAME
+	_ZN18CPresenceDataCache39GroupMembersPresenceConfigurationItemLCERK16CXIMPIdentityImp @ 20 NONAME
+	_ZN18CPresenceDataCache48PresentityGroupMembersPresenceSubscriptionItemLCERK16CXIMPIdentityImp @ 21 NONAME
+	_ZN18CPresenceDataCache4NewLER9MXIMPHost @ 22 NONAME
+	_ZN18CPresenceDataCache8RemoveMeI26CBlockListSubscriptionItemEEvRPT_S3_ @ 23 NONAME
+	_ZN18CPresenceDataCache8RemoveMeI26CGroupListSubscriptionItemEEvRPT_S3_ @ 24 NONAME
+	_ZN18CPresenceDataCache8RemoveMeI28COwnPresenceSubscriptionItemEEvRPT_S3_ @ 25 NONAME
+	_ZN18CPresenceDataCache8RemoveMeI28CWatcherListSubscriptionItemEEvRPT_S3_ @ 26 NONAME
+	_ZN18CPresenceDataCache8RemoveMeI33CGrantRequestListSubscriptionItemEEvRPT_S3_ @ 27 NONAME
+	_ZN18CPresenceDataCache8RemoveMeI36CPresenceToEveryoneConfigurationItemEEvRPT_S3_ @ 28 NONAME
+	_ZN20COwnPresenceEventImp4NewLEP29CXIMPDataSubscriptionStateImp @ 29 NONAME
+	_ZN20COwnPresenceEventImp5NewLCEP29CXIMPDataSubscriptionStateImp @ 30 NONAME
+	_ZN20CPresenceFilterStore10AssociateLERK16CXIMPIdentityImpP22CPresenceInfoFilterImp @ 31 NONAME
+	_ZN20CPresenceFilterStore12DisassociateERK16CXIMPIdentityImp @ 32 NONAME
+	_ZN20CPresenceFilterStore17FilterForIdentityERK16CXIMPIdentityImp @ 33 NONAME
+	_ZN20CPresenceFilterStore4NewLEv @ 34 NONAME
+	_ZN21CPresenceBlockInfoImp11SetIdentityEP16CXIMPIdentityImp @ 35 NONAME
+	_ZN21CPresenceBlockInfoImp12InternalizeLER11RReadStream @ 36 NONAME
+	_ZN21CPresenceBlockInfoImp13IdLinearOrderERKS_S1_ @ 37 NONAME
+	_ZN21CPresenceBlockInfoImp14SetDisplayNameEP7HBufC16 @ 38 NONAME
+	_ZN21CPresenceBlockInfoImp15NewFromStreamLCER11RReadStream @ 39 NONAME
+	_ZN21CPresenceBlockInfoImp4NewLEv @ 40 NONAME
+	_ZN21CPresenceBlockInfoImp5NewLCERK13MXIMPIdentityRK7TDesC16 @ 41 NONAME
+	_ZN21CPresenceBlockInfoImp5NewLCEv @ 42 NONAME
+	_ZN21CPresenceBuddyInfoImp12InternalizeLER11RReadStream @ 43 NONAME
+	_ZN21CPresenceBuddyInfoImp15NewFromStreamLCER11RReadStream @ 44 NONAME
+	_ZN21CPresenceBuddyInfoImp4NewLEv @ 45 NONAME
+	_ZN21CPresenceBuddyInfoImp5NewLCEv @ 46 NONAME
+	_ZN21CPresenceInfoFieldImp12InternalizeLER11RReadStream @ 47 NONAME
+	_ZN21CPresenceInfoFieldImp15NewFromStreamLCER11RReadStream @ 48 NONAME
+	_ZN21CPresenceInfoFieldImp5NewLCERK6TDesC8P19CXIMPApiDataObjBase @ 49 NONAME
+	_ZN21CPresenceInfoFieldImp5NewLCEv @ 50 NONAME
+	_ZN22CDevicePresenceInfoImp12InternalizeLER11RReadStream @ 51 NONAME
+	_ZN22CDevicePresenceInfoImp15NewFromStreamLCER11RReadStream @ 52 NONAME
+	_ZN22CDevicePresenceInfoImp5NewLCEv @ 53 NONAME
+	_ZN22CPersonPresenceInfoImp12InternalizeLER11RReadStream @ 54 NONAME
+	_ZN22CPersonPresenceInfoImp15NewFromStreamLCER11RReadStream @ 55 NONAME
+	_ZN22CPersonPresenceInfoImp5NewLCEv @ 56 NONAME
+	_ZN22CPresenceInfoFilterImp12InternalizeLER11RReadStream @ 57 NONAME
+	_ZN22CPresenceInfoFilterImp15NewFromStreamLCER11RReadStream @ 58 NONAME
+	_ZN22CPresenceInfoFilterImp4NewLEv @ 59 NONAME
+	_ZN22CPresenceInfoFilterImp5NewLCEv @ 60 NONAME
+	_ZN22CPresenceInfoFilterImp6UnionLERS_S0_ @ 61 NONAME
+	_ZN22CPresenceInfoFilterImp8ContainsERS_ @ 62 NONAME
+	_ZN22CPresenceInfoFilterImpeqERS_ @ 63 NONAME
+	_ZN22CPresenceInfoFilterImpneERS_ @ 64 NONAME
+	_ZN23CPresenceWatcherInfoImp11SetIdentityEP16CXIMPIdentityImp @ 65 NONAME
+	_ZN23CPresenceWatcherInfoImp12InternalizeLER11RReadStream @ 66 NONAME
+	_ZN23CPresenceWatcherInfoImp13IdLinearOrderERKS_S1_ @ 67 NONAME
+	_ZN23CPresenceWatcherInfoImp14SetDisplayNameEP7HBufC16 @ 68 NONAME
+	_ZN23CPresenceWatcherInfoImp15NewFromStreamLCER11RReadStream @ 69 NONAME
+	_ZN23CPresenceWatcherInfoImp4NewLEv @ 70 NONAME
+	_ZN23CPresenceWatcherInfoImp5NewLCEN20MPresenceWatcherInfo12TWatcherTypeERK13MXIMPIdentityRK7TDesC16 @ 71 NONAME
+	_ZN23CPresenceWatcherInfoImp5NewLCEv @ 72 NONAME
+	_ZN23CPresentityGroupInfoImp12InternalizeLER11RReadStream @ 73 NONAME
+	_ZN23CPresentityGroupInfoImp15NewFromStreamLCER11RReadStream @ 74 NONAME
+	_ZN23CPresentityGroupInfoImp18GroupIdLinearOrderERKS_S1_ @ 75 NONAME
+	_ZN23CPresentityGroupInfoImp4NewLEv @ 76 NONAME
+	_ZN23CPresentityGroupInfoImp5NewLCERK13MXIMPIdentityRK7TDesC16 @ 77 NONAME
+	_ZN23CPresentityGroupInfoImp5NewLCEv @ 78 NONAME
+	_ZN23CServicePresenceInfoImp12InternalizeLER11RReadStream @ 79 NONAME
+	_ZN23CServicePresenceInfoImp15NewFromStreamLCER11RReadStream @ 80 NONAME
+	_ZN23CServicePresenceInfoImp5NewLCEv @ 81 NONAME
+	_ZN25CPresenceBuddyInfoListImp12InternalizeLER11RReadStream @ 82 NONAME
+	_ZN25CPresenceBuddyInfoListImp13SetOwnObjectsEi @ 83 NONAME
+	_ZN25CPresenceBuddyInfoListImp15NewFromStreamLCER11RReadStream @ 84 NONAME
+	_ZN25CPresenceBuddyInfoListImp4NewLERK7TDesC16 @ 85 NONAME
+	_ZN25CPresenceBuddyInfoListImp5NewLCERK7TDesC16 @ 86 NONAME
+	_ZN25CPresenceBuddyInfoListImp9BlindAddLEP18MPresenceBuddyInfo @ 87 NONAME
+	_ZN25CPresenceObjectFactoryImp4NewLEv @ 88 NONAME
+	_ZN26CBlockListSubscriptionItem11SetBlockedLEP21CPresenceBlockInfoImp @ 89 NONAME
+	_ZN26CBlockListSubscriptionItem11SetNewListLEP22RXIMPObjOwningPtrArrayI21CPresenceBlockInfoImpE @ 90 NONAME
+	_ZN26CBlockListSubscriptionItem19SetCanceledBlockIdLEP16CXIMPIdentityImp @ 91 NONAME
+	_ZN26CBlockListSubscriptionItem5CleanEv @ 92 NONAME
+	_ZN26CGroupListSubscriptionItem11SetNewListLEP22RXIMPObjOwningPtrArrayI23CPresentityGroupInfoImpE @ 93 NONAME
+	_ZN26CGroupListSubscriptionItem15SetCreatedListLEP22RXIMPObjOwningPtrArrayI23CPresentityGroupInfoImpE @ 94 NONAME
+	_ZN26CGroupListSubscriptionItem15SetDeletedListLEP22RXIMPObjOwningPtrArrayI23CPresentityGroupInfoImpE @ 95 NONAME
+	_ZN26CGroupListSubscriptionItem5CleanEv @ 96 NONAME
+	_ZN26CPresenceBlockListEventImp5NewLCEP22RXIMPObjOwningPtrArrayI21CPresenceBlockInfoImpES3_S3_S3_P29CXIMPDataSubscriptionStateImp @ 97 NONAME
+	_ZN26CPresenceConfigurationItem11SetIdentityEP16CXIMPIdentityImp @ 98 NONAME
+	_ZN26CPresenceConfigurationItem13IdentityOrderEPK16CXIMPIdentityImpRKS_ @ 99 NONAME
+	_ZN26CPresenceConfigurationItem16ConfigurationPifEv @ 100 NONAME
+	_ZN26CPresenceConfigurationItem19SetConfigurationPifEP22CPresenceInfoFilterImp @ 101 NONAME
+	_ZN26CPresenceConfigurationItem34CollectConfigurationPifWithoutCtxLEP15MXIMPPscContext @ 102 NONAME
+	_ZN26CPresenceConfigurationItem5OrderERKS_S1_ @ 103 NONAME
+	_ZN27CPresentityPresenceEventImp4NewLEP29CXIMPDataSubscriptionStateImp @ 104 NONAME
+	_ZN27CPresentityPresenceEventImp5NewLCEP29CXIMPDataSubscriptionStateImp @ 105 NONAME
+	_ZN28COwnPresenceSubscriptionItem15SubscriptionPifEv @ 106 NONAME
+	_ZN28COwnPresenceSubscriptionItem16SetPresenceInfoLEP16CPresenceInfoImp @ 107 NONAME
+	_ZN28COwnPresenceSubscriptionItem18SetSubscriptionPifEP22CPresenceInfoFilterImp @ 108 NONAME
+	_ZN28COwnPresenceSubscriptionItem33CollectSubscriptionPifWithoutCtxLEP15MXIMPPscContext @ 109 NONAME
+	_ZN28CPresenceGrantRequestInfoImp11SetIdentityEP16CXIMPIdentityImp @ 110 NONAME
+	_ZN28CPresenceGrantRequestInfoImp12InternalizeLER11RReadStream @ 111 NONAME
+	_ZN28CPresenceGrantRequestInfoImp13IdLinearOrderERKS_S1_ @ 112 NONAME
+	_ZN28CPresenceGrantRequestInfoImp14SetDisplayNameEP7HBufC16 @ 113 NONAME
+	_ZN28CPresenceGrantRequestInfoImp15NewFromStreamLCER11RReadStream @ 114 NONAME
+	_ZN28CPresenceGrantRequestInfoImp4NewLEv @ 115 NONAME
+	_ZN28CPresenceGrantRequestInfoImp5NewLCERK13MXIMPIdentityRK7TDesC16 @ 116 NONAME
+	_ZN28CPresenceGrantRequestInfoImp5NewLCEv @ 117 NONAME
+	_ZN28CPresenceWatcherListEventImp5NewLCEP22RXIMPObjOwningPtrArrayI23CPresenceWatcherInfoImpES3_S3_P29CXIMPDataSubscriptionStateImp @ 118 NONAME
+	_ZN28CPresentityGroupListEventImp4NewLEP22RXIMPObjOwningPtrArrayI23CPresentityGroupInfoImpES3_S3_S3_P29CXIMPDataSubscriptionStateImp @ 119 NONAME
+	_ZN28CPresentityGroupListEventImp5NewLCEP22RXIMPObjOwningPtrArrayI23CPresentityGroupInfoImpES3_S3_P29CXIMPDataSubscriptionStateImp @ 120 NONAME
+	_ZN28CPresentityGroupListEventImp5NewLCEP22RXIMPObjOwningPtrArrayI23CPresentityGroupInfoImpES3_S3_S3_P29CXIMPDataSubscriptionStateImp @ 121 NONAME
+	_ZN28CWatcherListSubscriptionItem11SetNewListLEP22RXIMPObjOwningPtrArrayI23CPresenceWatcherInfoImpE @ 122 NONAME
+	_ZN28CWatcherListSubscriptionItem5CleanEv @ 123 NONAME
+	_ZN29CGroupContentSubscriptionItem11SetNewListLEP22RXIMPObjOwningPtrArrayI29CPresentityGroupMemberInfoImpE @ 124 NONAME
+	_ZN29CGroupContentSubscriptionItem13IdentityOrderEPK16CXIMPIdentityImpRKS_ @ 125 NONAME
+	_ZN29CGroupContentSubscriptionItem13SetAddedListLEP22RXIMPObjOwningPtrArrayI29CPresentityGroupMemberInfoImpE @ 126 NONAME
+	_ZN29CGroupContentSubscriptionItem15SetRemovedListLEP22RXIMPObjOwningPtrArrayI29CPresentityGroupMemberInfoImpE @ 127 NONAME
+	_ZN29CGroupContentSubscriptionItem21AddOrRenewSubscriberLEP15MXIMPPscContext @ 128 NONAME
+	_ZN29CGroupContentSubscriptionItem5CleanEv @ 129 NONAME
+	_ZN29CGroupContentSubscriptionItem5OrderERKS_S1_ @ 130 NONAME
+	_ZN29CPresentityGroupMemberInfoImp12InternalizeLER11RReadStream @ 131 NONAME
+	_ZN29CPresentityGroupMemberInfoImp15NewFromStreamLCER11RReadStream @ 132 NONAME
+	_ZN29CPresentityGroupMemberInfoImp18GroupIdLinearOrderERKS_S1_ @ 133 NONAME
+	_ZN29CPresentityGroupMemberInfoImp4NewLEv @ 134 NONAME
+	_ZN29CPresentityGroupMemberInfoImp5NewLCERK13MXIMPIdentityRK7TDesC16 @ 135 NONAME
+	_ZN29CPresentityGroupMemberInfoImp5NewLCEv @ 136 NONAME
+	_ZN30CPresenceInfoFieldValueEnumImp12InternalizeLER11RReadStream @ 137 NONAME
+	_ZN30CPresenceInfoFieldValueEnumImp15NewFromStreamLCER11RReadStream @ 138 NONAME
+	_ZN30CPresenceInfoFieldValueEnumImp5NewLCEv @ 139 NONAME
+	_ZN30CPresenceInfoFieldValueTextImp12InternalizeLER11RReadStream @ 140 NONAME
+	_ZN30CPresenceInfoFieldValueTextImp15NewFromStreamLCER11RReadStream @ 141 NONAME
+	_ZN30CPresenceInfoFieldValueTextImp5NewLCEi @ 142 NONAME
+	_ZN31CPresenceInfoFieldCollectionImp12InternalizeLER11RReadStream @ 143 NONAME
+	_ZN31CPresenceInfoFieldCollectionImp15NewFromStreamLCER11RReadStream @ 144 NONAME
+	_ZN31CPresenceInfoFieldCollectionImp5NewLCEv @ 145 NONAME
+	_ZN31CPresentityGroupContentEventImp4NewLER16CXIMPIdentityImpP22RXIMPObjOwningPtrArrayI29CPresentityGroupMemberInfoImpES5_S5_S5_P29CXIMPDataSubscriptionStateImp @ 146 NONAME
+	_ZN31CPresentityGroupContentEventImp5NewLCER16CXIMPIdentityImpP22RXIMPObjOwningPtrArrayI29CPresentityGroupMemberInfoImpES5_S5_P29CXIMPDataSubscriptionStateImp @ 147 NONAME
+	_ZN31CPresentityGroupContentEventImp5NewLCER16CXIMPIdentityImpP22RXIMPObjOwningPtrArrayI29CPresentityGroupMemberInfoImpES5_S5_S5_P29CXIMPDataSubscriptionStateImp @ 148 NONAME
+	_ZN32CPresenceInfoFieldValueBinaryImp12InternalizeLER11RReadStream @ 149 NONAME
+	_ZN32CPresenceInfoFieldValueBinaryImp15NewFromStreamLCER11RReadStream @ 150 NONAME
+	_ZN32CPresenceInfoFieldValueBinaryImp5NewLCEi @ 151 NONAME
+	_ZN33CGrantRequestListSubscriptionItem11SetNewListLEP22RXIMPObjOwningPtrArrayI28CPresenceGrantRequestInfoImpE @ 152 NONAME
+	_ZN33CGrantRequestListSubscriptionItem19SetReceivedRequestLEP28CPresenceGrantRequestInfoImp @ 153 NONAME
+	_ZN33CGrantRequestListSubscriptionItem20SetObsoletedRequestLEP16CXIMPIdentityImp @ 154 NONAME
+	_ZN33CGrantRequestListSubscriptionItem5CleanEv @ 155 NONAME
+	_ZN33CPresenceGrantRequestListEventImp5NewLCEP22RXIMPObjOwningPtrArrayI28CPresenceGrantRequestInfoImpES3_S3_P29CXIMPDataSubscriptionStateImp @ 156 NONAME
+	_ZN34CPresenceApiDataObjFactoryAccessor4NewLEv @ 157 NONAME
+	_ZN35CPresentityPresenceSubscriptionItem11SetIdentityEP16CXIMPIdentityImp @ 158 NONAME
+	_ZN35CPresentityPresenceSubscriptionItem13IdentityOrderEPK16CXIMPIdentityImpRKS_ @ 159 NONAME
+	_ZN35CPresentityPresenceSubscriptionItem15SubscriptionPifEv @ 160 NONAME
+	_ZN35CPresentityPresenceSubscriptionItem16SetGroupIdentityEP16CXIMPIdentityImp @ 161 NONAME
+	_ZN35CPresentityPresenceSubscriptionItem16SetPresenceInfoLEP16CPresenceInfoImp @ 162 NONAME
+	_ZN35CPresentityPresenceSubscriptionItem18SetSubscriptionPifEP22CPresenceInfoFilterImp @ 163 NONAME
+	_ZN35CPresentityPresenceSubscriptionItem33CollectSubscriptionPifWithoutCtxLEP15MXIMPPscContext @ 164 NONAME
+	_ZN35CPresentityPresenceSubscriptionItem5OrderERKS_S1_ @ 165 NONAME
+	_ZN36CPresenceToEveryoneConfigurationItem16ConfigurationPifEv @ 166 NONAME
+	_ZN36CPresenceToEveryoneConfigurationItem19SetConfigurationPifEP22CPresenceInfoFilterImp @ 167 NONAME
+	_ZN36CPresenceToEveryoneConfigurationItem34CollectConfigurationPifWithoutCtxLEP15MXIMPPscContext @ 168 NONAME
+	_ZN38CGroupMembersPresenceConfigurationItem11SetIdentityEP16CXIMPIdentityImp @ 169 NONAME
+	_ZN38CGroupMembersPresenceConfigurationItem13IdentityOrderEPK16CXIMPIdentityImpRKS_ @ 170 NONAME
+	_ZN38CGroupMembersPresenceConfigurationItem16AddConfiguratorLEP15MXIMPPscContext @ 171 NONAME
+	_ZN38CGroupMembersPresenceConfigurationItem16ConfigurationPifEv @ 172 NONAME
+	_ZN38CGroupMembersPresenceConfigurationItem18RemoveConfiguratorEP15MXIMPPscContext @ 173 NONAME
+	_ZN38CGroupMembersPresenceConfigurationItem19SetConfigurationPifEP22CPresenceInfoFilterImp @ 174 NONAME
+	_ZN38CGroupMembersPresenceConfigurationItem34CollectConfigurationPifWithoutCtxLEP15MXIMPPscContext @ 175 NONAME
+	_ZN38CGroupMembersPresenceConfigurationItem5OrderERKS_S1_ @ 176 NONAME
+	_ZN47CPresentityGroupMembersPresenceSubscriptionItem11SetIdentityEP16CXIMPIdentityImp @ 177 NONAME
+	_ZN47CPresentityGroupMembersPresenceSubscriptionItem13IdentityOrderEPK16CXIMPIdentityImpRKS_ @ 178 NONAME
+	_ZN47CPresentityGroupMembersPresenceSubscriptionItem14AddSubscriberLEP15MXIMPPscContext @ 179 NONAME
+	_ZN47CPresentityGroupMembersPresenceSubscriptionItem15SubscriptionPifEv @ 180 NONAME
+	_ZN47CPresentityGroupMembersPresenceSubscriptionItem16RemoveSubscriberEP15MXIMPPscContext @ 181 NONAME
+	_ZN47CPresentityGroupMembersPresenceSubscriptionItem16SetPresenceInfoLEP16CPresenceInfoImp @ 182 NONAME
+	_ZN47CPresentityGroupMembersPresenceSubscriptionItem18SetSubscriptionPifEP22CPresenceInfoFilterImp @ 183 NONAME
+	_ZN47CPresentityGroupMembersPresenceSubscriptionItem33CollectSubscriptionPifWithoutCtxLEP15MXIMPPscContext @ 184 NONAME
+	_ZN47CPresentityGroupMembersPresenceSubscriptionItem5OrderERKS_S1_ @ 185 NONAME
+	_ZNK16CPresenceInfoImp12ExternalizeLER12RWriteStream @ 186 NONAME
+	_ZNK16CPresenceInfoImp14FilteredInfoLCERK22CPresenceInfoFilterImp @ 187 NONAME
+	_ZNK18CPresenceDataCache32OwnPresenceDataSubscriptionStateEv @ 188 NONAME
+	_ZNK18CPresenceDataCache34PresenceBlockDataSubscriptionStateEv @ 189 NONAME
+	_ZNK18CPresenceDataCache39PresentityPresenceDataSubscriptionStateERK13MXIMPIdentity @ 190 NONAME
+	_ZNK18CPresenceDataCache40PresenceWatcherListDataSubscriptionStateEv @ 191 NONAME
+	_ZNK18CPresenceDataCache40PresentityGroupListDataSubscriptionStateEv @ 192 NONAME
+	_ZNK18CPresenceDataCache41PresenceGrantRequestDataSubscriptionStateEv @ 193 NONAME
+	_ZNK18CPresenceDataCache43PresentityGroupContentDataSubscriptionStateERK13MXIMPIdentity @ 194 NONAME
+	_ZNK21CPresenceBlockInfoImp11IdentityImpEv @ 195 NONAME
+	_ZNK21CPresenceBlockInfoImp12ExternalizeLER12RWriteStream @ 196 NONAME
+	_ZNK21CPresenceBuddyInfoImp12ExternalizeLER12RWriteStream @ 197 NONAME
+	_ZNK21CPresenceBuddyInfoImp14EqualsIdentityEPK18MPresenceBuddyInfo @ 198 NONAME
+	_ZNK22CPresenceInfoFilterImp12ExternalizeLER12RWriteStream @ 199 NONAME
+	_ZNK23CPresenceWatcherInfoImp11IdentityImpEv @ 200 NONAME
+	_ZNK23CPresentityGroupInfoImp8IdentityEv @ 201 NONAME
+	_ZNK25CPresenceBuddyInfoListImp12ExternalizeLER12RWriteStream @ 202 NONAME
+	_ZNK26CPresenceConfigurationItem8IdentityEv @ 203 NONAME
+	_ZNK28CPresenceGrantRequestInfoImp11IdentityImpEv @ 204 NONAME
+	_ZNK29CGroupContentSubscriptionItem18GroupMemberExistsLER29CPresentityGroupMemberInfoImp @ 205 NONAME
+	_ZNK29CGroupContentSubscriptionItem21IsGroupMemberUpdatedLER29CPresentityGroupMemberInfoImp @ 206 NONAME
+	_ZNK29CGroupContentSubscriptionItem7GroupIdEv @ 207 NONAME
+	_ZNK29CPresentityGroupMemberInfoImp11IdentityImpEv @ 208 NONAME
+	_ZNK35CPresentityPresenceSubscriptionItem13GroupIdentityEv @ 209 NONAME
+	_ZNK35CPresentityPresenceSubscriptionItem8IdentityEv @ 210 NONAME
+	_ZNK38CGroupMembersPresenceConfigurationItem8IdentityEv @ 211 NONAME
+	_ZNK47CPresentityGroupMembersPresenceSubscriptionItem8IdentityEv @ 212 NONAME
+	_ZTI18CPresenceDataCache @ 213 NONAME ; #<TI>#
+	_ZTI20CPresenceFilterStore @ 214 NONAME ; #<TI>#
+	_ZTI25CPresenceObjectFactoryImp @ 215 NONAME ; #<TI>#
+	_ZTI26CBlockListSubscriptionItem @ 216 NONAME ; #<TI>#
+	_ZTI26CGroupListSubscriptionItem @ 217 NONAME ; #<TI>#
+	_ZTI26CPresenceConfigurationItem @ 218 NONAME ; #<TI>#
+	_ZTI28COwnPresenceSubscriptionItem @ 219 NONAME ; #<TI>#
+	_ZTI28CWatcherListSubscriptionItem @ 220 NONAME ; #<TI>#
+	_ZTI29CGroupContentSubscriptionItem @ 221 NONAME ; #<TI>#
+	_ZTI33CGrantRequestListSubscriptionItem @ 222 NONAME ; #<TI>#
+	_ZTI35CPresentityPresenceSubscriptionItem @ 223 NONAME ; #<TI>#
+	_ZTI36CPresenceToEveryoneConfigurationItem @ 224 NONAME ; #<TI>#
+	_ZTI38CGroupMembersPresenceConfigurationItem @ 225 NONAME ; #<TI>#
+	_ZTI47CPresentityGroupMembersPresenceSubscriptionItem @ 226 NONAME ; #<TI>#
+	_ZTIN20CPresenceFilterStore27CPresenceFilterStoreMappingE @ 227 NONAME ; #<TI>#
+	_ZTIN22CPresenceInfoFilterImp12CFilterFieldE @ 228 NONAME ; #<TI>#
+	_ZTV18CPresenceDataCache @ 229 NONAME ; #<VT>#
+	_ZTV20CPresenceFilterStore @ 230 NONAME ; #<VT>#
+	_ZTV25CPresenceObjectFactoryImp @ 231 NONAME ; #<VT>#
+	_ZTV26CBlockListSubscriptionItem @ 232 NONAME ; #<VT>#
+	_ZTV26CGroupListSubscriptionItem @ 233 NONAME ; #<VT>#
+	_ZTV26CPresenceConfigurationItem @ 234 NONAME ; #<VT>#
+	_ZTV28COwnPresenceSubscriptionItem @ 235 NONAME ; #<VT>#
+	_ZTV28CWatcherListSubscriptionItem @ 236 NONAME ; #<VT>#
+	_ZTV29CGroupContentSubscriptionItem @ 237 NONAME ; #<VT>#
+	_ZTV33CGrantRequestListSubscriptionItem @ 238 NONAME ; #<VT>#
+	_ZTV35CPresentityPresenceSubscriptionItem @ 239 NONAME ; #<VT>#
+	_ZTV36CPresenceToEveryoneConfigurationItem @ 240 NONAME ; #<VT>#
+	_ZTV38CGroupMembersPresenceConfigurationItem @ 241 NONAME ; #<VT>#
+	_ZTV47CPresentityGroupMembersPresenceSubscriptionItem @ 242 NONAME ; #<VT>#
+	_ZTVN20CPresenceFilterStore27CPresenceFilterStoreMappingE @ 243 NONAME ; #<VT>#
+	_ZTVN22CPresenceInfoFilterImp12CFilterFieldE @ 244 NONAME ; #<VT>#
+	_ZThn4_NK21CPresenceBuddyInfoImp14EqualsIdentityEPK18MPresenceBuddyInfo @ 245 NONAME ; #<thunk>#
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/eabi/presenceecomhooku.def	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,3 @@
+EXPORTS
+	_Z24ImplementationGroupProxyRi @ 1 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/eabi/presencemanageru.def	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,3 @@
+EXPORTS
+	_ZN20CPresenceFeaturesImp4NewLEP12MXIMPContext @ 1 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/eabi/presenceoperationu.def	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,181 @@
+EXPORTS
+	_ZN23COperationLaunchCleanerC1Ev @ 1 NONAME
+	_ZN23COperationLaunchCleanerC2Ev @ 2 NONAME
+	_ZN25CPresenceOperationFactory4NewLEv @ 3 NONAME
+	_ZN27COperationHandleOwnPresenceC1Ev @ 4 NONAME
+	_ZN27COperationHandleOwnPresenceC2Ev @ 5 NONAME
+	_ZN28COperationPublishOwnPresenceC1Ev @ 6 NONAME
+	_ZN28COperationPublishOwnPresenceC2Ev @ 7 NONAME
+	_ZN28COperationSubscribeBlockListC1Ev @ 8 NONAME
+	_ZN28COperationSubscribeBlockListC2Ev @ 9 NONAME
+	_ZN28COperationSubscribeGroupListC1Ev @ 10 NONAME
+	_ZN28COperationSubscribeGroupListC2Ev @ 11 NONAME
+	_ZN29COperationSetSubscriptionDataC1EN12NPresenceOps16TPresenceOpTypesE @ 12 NONAME
+	_ZN29COperationSetSubscriptionDataC2EN12NPresenceOps16TPresenceOpTypesE @ 13 NONAME
+	_ZN30COperationSubscribeOwnPresenceC1Ev @ 14 NONAME
+	_ZN30COperationSubscribeOwnPresenceC2Ev @ 15 NONAME
+	_ZN30COperationSubscribeWatcherListC1Ev @ 16 NONAME
+	_ZN30COperationSubscribeWatcherListC2Ev @ 17 NONAME
+	_ZN30COperationUnsubscribeBlockListC1Ev @ 18 NONAME
+	_ZN30COperationUnsubscribeBlockListC2Ev @ 19 NONAME
+	_ZN30COperationUnsubscribeGroupListC1Ev @ 20 NONAME
+	_ZN30COperationUnsubscribeGroupListC2Ev @ 21 NONAME
+	_ZN31COperationCreatePresentityGroupC1Ev @ 22 NONAME
+	_ZN31COperationCreatePresentityGroupC2Ev @ 23 NONAME
+	_ZN31COperationDeletePresentityGroupC1Ev @ 24 NONAME
+	_ZN31COperationDeletePresentityGroupC2Ev @ 25 NONAME
+	_ZN31COperationSubscribeGroupContentC1Ev @ 26 NONAME
+	_ZN31COperationSubscribeGroupContentC2Ev @ 27 NONAME
+	_ZN32COperationHandlePresenceBlockingC1Ei @ 28 NONAME
+	_ZN32COperationHandlePresenceBlockingC2Ei @ 29 NONAME
+	_ZN32COperationHandlePresentityGroupsC1EN12NPresenceOps16TPresenceOpTypesE @ 30 NONAME
+	_ZN32COperationHandlePresentityGroupsC2EN12NPresenceOps16TPresenceOpTypesE @ 31 NONAME
+	_ZN32COperationUnsubscribeOwnPresenceC1Ev @ 32 NONAME
+	_ZN32COperationUnsubscribeOwnPresenceC2Ev @ 33 NONAME
+	_ZN32COperationUnsubscribeWatcherListC1Ev @ 34 NONAME
+	_ZN32COperationUnsubscribeWatcherListC2Ev @ 35 NONAME
+	_ZN33COperationGrantPresenceToEveryoneC1Ev @ 36 NONAME
+	_ZN33COperationGrantPresenceToEveryoneC2Ev @ 37 NONAME
+	_ZN33COperationUnsubscribeGroupContentC1Ev @ 38 NONAME
+	_ZN33COperationUnsubscribeGroupContentC2Ev @ 39 NONAME
+	_ZN34COperationAddPresentityGroupMemberC1Ev @ 40 NONAME
+	_ZN34COperationAddPresentityGroupMemberC2Ev @ 41 NONAME
+	_ZN34COperationHandlePresentityPresenceC1Ei @ 42 NONAME
+	_ZN34COperationHandlePresentityPresenceC2Ei @ 43 NONAME
+	_ZN35COperationGrantPresenceToPresentityC1Ev @ 44 NONAME
+	_ZN35COperationGrantPresenceToPresentityC2Ev @ 45 NONAME
+	_ZN35COperationHandlePresenceWatcherListC1Ev @ 46 NONAME
+	_ZN35COperationHandlePresenceWatcherListC2Ev @ 47 NONAME
+	_ZN35COperationSubscribeGrantRequestListC1Ev @ 48 NONAME
+	_ZN35COperationSubscribeGrantRequestListC2Ev @ 49 NONAME
+	_ZN36COperationBlockPresenceForPresentityC1Ev @ 50 NONAME
+	_ZN36COperationBlockPresenceForPresentityC2Ev @ 51 NONAME
+	_ZN37COperationHandlePresenceGrantRequestsC1Ei @ 52 NONAME
+	_ZN37COperationHandlePresenceGrantRequestsC2Ei @ 53 NONAME
+	_ZN37COperationRemovePresentityGroupMemberC1Ev @ 54 NONAME
+	_ZN37COperationRemovePresentityGroupMemberC2Ev @ 55 NONAME
+	_ZN37COperationSubscribePresentityPresenceC1Ev @ 56 NONAME
+	_ZN37COperationSubscribePresentityPresenceC2Ev @ 57 NONAME
+	_ZN37COperationSynthesiseSubscriptionEventC1ENS_17TSubscriptionTypeEi @ 58 NONAME
+	_ZN37COperationSynthesiseSubscriptionEventC2ENS_17TSubscriptionTypeEi @ 59 NONAME
+	_ZN37COperationUnsubscribeGrantRequestListC1Ev @ 60 NONAME
+	_ZN37COperationUnsubscribeGrantRequestListC2Ev @ 61 NONAME
+	_ZN38COperationHandlePresentityGroupContentC1Ev @ 62 NONAME
+	_ZN38COperationHandlePresentityGroupContentC2Ev @ 63 NONAME
+	_ZN38COperationWithdrawPresenceFromEveryoneC1Ev @ 64 NONAME
+	_ZN38COperationWithdrawPresenceFromEveryoneC2Ev @ 65 NONAME
+	_ZN39COperationUnsubscribePresentityPresenceC1Ev @ 66 NONAME
+	_ZN39COperationUnsubscribePresentityPresenceC2Ev @ 67 NONAME
+	_ZN40COperationWithdrawPresenceFromPresentityC1Ev @ 68 NONAME
+	_ZN40COperationWithdrawPresenceFromPresentityC2Ev @ 69 NONAME
+	_ZN42COperationHandlePresentityGroupMemberAddedC1Ev @ 70 NONAME
+	_ZN42COperationHandlePresentityGroupMemberAddedC2Ev @ 71 NONAME
+	_ZN42COperationUpdatePresentityGroupDisplayNameC1Ev @ 72 NONAME
+	_ZN42COperationUpdatePresentityGroupDisplayNameC2Ev @ 73 NONAME
+	_ZN43COperationCancelPresenceBlockFromPresentityC1Ev @ 74 NONAME
+	_ZN43COperationCancelPresenceBlockFromPresentityC2Ev @ 75 NONAME
+	_ZN44COperationHandlePresentityGroupMemberRemovedC1Ev @ 76 NONAME
+	_ZN44COperationHandlePresentityGroupMemberRemovedC2Ev @ 77 NONAME
+	_ZN47COperationGrantPresenceToPresentityGroupMembersC1Ev @ 78 NONAME
+	_ZN47COperationGrantPresenceToPresentityGroupMembersC2Ev @ 79 NONAME
+	_ZN48COperationUpdatePresentityGroupMemberDisplayNameC1Ev @ 80 NONAME
+	_ZN48COperationUpdatePresentityGroupMemberDisplayNameC2Ev @ 81 NONAME
+	_ZN49COperationSubscribePresentityGroupMembersPresenceC1Ev @ 82 NONAME
+	_ZN49COperationSubscribePresentityGroupMembersPresenceC2Ev @ 83 NONAME
+	_ZN51COperationUnsubscribePresentityGroupMembersPresenceC1Ev @ 84 NONAME
+	_ZN51COperationUnsubscribePresentityGroupMembersPresenceC2Ev @ 85 NONAME
+	_ZN52COperationWithdrawPresenceFromPresentityGroupMembersC1Ev @ 86 NONAME
+	_ZN52COperationWithdrawPresenceFromPresentityGroupMembersC2Ev @ 87 NONAME
+	_ZN55COperationHandlePresentityGroupMemberDisplayNameUpdatedC1Ev @ 88 NONAME
+	_ZN55COperationHandlePresentityGroupMemberDisplayNameUpdatedC2Ev @ 89 NONAME
+	_ZTI23COperationLaunchCleaner @ 90 NONAME ; #<TI>#
+	_ZTI25CPresenceOperationFactory @ 91 NONAME ; #<TI>#
+	_ZTI27COperationHandleOwnPresence @ 92 NONAME ; #<TI>#
+	_ZTI28COperationPublishOwnPresence @ 93 NONAME ; #<TI>#
+	_ZTI28COperationSubscribeBlockList @ 94 NONAME ; #<TI>#
+	_ZTI28COperationSubscribeGroupList @ 95 NONAME ; #<TI>#
+	_ZTI29COperationSetSubscriptionData @ 96 NONAME ; #<TI>#
+	_ZTI30COperationSubscribeOwnPresence @ 97 NONAME ; #<TI>#
+	_ZTI30COperationSubscribeWatcherList @ 98 NONAME ; #<TI>#
+	_ZTI30COperationUnsubscribeBlockList @ 99 NONAME ; #<TI>#
+	_ZTI30COperationUnsubscribeGroupList @ 100 NONAME ; #<TI>#
+	_ZTI31COperationCreatePresentityGroup @ 101 NONAME ; #<TI>#
+	_ZTI31COperationDeletePresentityGroup @ 102 NONAME ; #<TI>#
+	_ZTI31COperationSubscribeGroupContent @ 103 NONAME ; #<TI>#
+	_ZTI32COperationHandlePresenceBlocking @ 104 NONAME ; #<TI>#
+	_ZTI32COperationHandlePresentityGroups @ 105 NONAME ; #<TI>#
+	_ZTI32COperationUnsubscribeOwnPresence @ 106 NONAME ; #<TI>#
+	_ZTI32COperationUnsubscribeWatcherList @ 107 NONAME ; #<TI>#
+	_ZTI33COperationGrantPresenceToEveryone @ 108 NONAME ; #<TI>#
+	_ZTI33COperationUnsubscribeGroupContent @ 109 NONAME ; #<TI>#
+	_ZTI34COperationAddPresentityGroupMember @ 110 NONAME ; #<TI>#
+	_ZTI34COperationHandlePresentityPresence @ 111 NONAME ; #<TI>#
+	_ZTI35COperationGrantPresenceToPresentity @ 112 NONAME ; #<TI>#
+	_ZTI35COperationHandlePresenceWatcherList @ 113 NONAME ; #<TI>#
+	_ZTI35COperationSubscribeGrantRequestList @ 114 NONAME ; #<TI>#
+	_ZTI36COperationBlockPresenceForPresentity @ 115 NONAME ; #<TI>#
+	_ZTI37COperationHandlePresenceGrantRequests @ 116 NONAME ; #<TI>#
+	_ZTI37COperationRemovePresentityGroupMember @ 117 NONAME ; #<TI>#
+	_ZTI37COperationSubscribePresentityPresence @ 118 NONAME ; #<TI>#
+	_ZTI37COperationSynthesiseSubscriptionEvent @ 119 NONAME ; #<TI>#
+	_ZTI37COperationUnsubscribeGrantRequestList @ 120 NONAME ; #<TI>#
+	_ZTI38COperationHandlePresentityGroupContent @ 121 NONAME ; #<TI>#
+	_ZTI38COperationWithdrawPresenceFromEveryone @ 122 NONAME ; #<TI>#
+	_ZTI39COperationUnsubscribePresentityPresence @ 123 NONAME ; #<TI>#
+	_ZTI40COperationWithdrawPresenceFromPresentity @ 124 NONAME ; #<TI>#
+	_ZTI42COperationHandlePresentityGroupMemberAdded @ 125 NONAME ; #<TI>#
+	_ZTI42COperationUpdatePresentityGroupDisplayName @ 126 NONAME ; #<TI>#
+	_ZTI43COperationCancelPresenceBlockFromPresentity @ 127 NONAME ; #<TI>#
+	_ZTI44COperationHandlePresentityGroupMemberRemoved @ 128 NONAME ; #<TI>#
+	_ZTI47COperationGrantPresenceToPresentityGroupMembers @ 129 NONAME ; #<TI>#
+	_ZTI48COperationUpdatePresentityGroupMemberDisplayName @ 130 NONAME ; #<TI>#
+	_ZTI49COperationSubscribePresentityGroupMembersPresence @ 131 NONAME ; #<TI>#
+	_ZTI51COperationUnsubscribePresentityGroupMembersPresence @ 132 NONAME ; #<TI>#
+	_ZTI52COperationWithdrawPresenceFromPresentityGroupMembers @ 133 NONAME ; #<TI>#
+	_ZTI55COperationHandlePresentityGroupMemberDisplayNameUpdated @ 134 NONAME ; #<TI>#
+	_ZTV23COperationLaunchCleaner @ 135 NONAME ; #<VT>#
+	_ZTV25CPresenceOperationFactory @ 136 NONAME ; #<VT>#
+	_ZTV27COperationHandleOwnPresence @ 137 NONAME ; #<VT>#
+	_ZTV28COperationPublishOwnPresence @ 138 NONAME ; #<VT>#
+	_ZTV28COperationSubscribeBlockList @ 139 NONAME ; #<VT>#
+	_ZTV28COperationSubscribeGroupList @ 140 NONAME ; #<VT>#
+	_ZTV29COperationSetSubscriptionData @ 141 NONAME ; #<VT>#
+	_ZTV30COperationSubscribeOwnPresence @ 142 NONAME ; #<VT>#
+	_ZTV30COperationSubscribeWatcherList @ 143 NONAME ; #<VT>#
+	_ZTV30COperationUnsubscribeBlockList @ 144 NONAME ; #<VT>#
+	_ZTV30COperationUnsubscribeGroupList @ 145 NONAME ; #<VT>#
+	_ZTV31COperationCreatePresentityGroup @ 146 NONAME ; #<VT>#
+	_ZTV31COperationDeletePresentityGroup @ 147 NONAME ; #<VT>#
+	_ZTV31COperationSubscribeGroupContent @ 148 NONAME ; #<VT>#
+	_ZTV32COperationHandlePresenceBlocking @ 149 NONAME ; #<VT>#
+	_ZTV32COperationHandlePresentityGroups @ 150 NONAME ; #<VT>#
+	_ZTV32COperationUnsubscribeOwnPresence @ 151 NONAME ; #<VT>#
+	_ZTV32COperationUnsubscribeWatcherList @ 152 NONAME ; #<VT>#
+	_ZTV33COperationGrantPresenceToEveryone @ 153 NONAME ; #<VT>#
+	_ZTV33COperationUnsubscribeGroupContent @ 154 NONAME ; #<VT>#
+	_ZTV34COperationAddPresentityGroupMember @ 155 NONAME ; #<VT>#
+	_ZTV34COperationHandlePresentityPresence @ 156 NONAME ; #<VT>#
+	_ZTV35COperationGrantPresenceToPresentity @ 157 NONAME ; #<VT>#
+	_ZTV35COperationHandlePresenceWatcherList @ 158 NONAME ; #<VT>#
+	_ZTV35COperationSubscribeGrantRequestList @ 159 NONAME ; #<VT>#
+	_ZTV36COperationBlockPresenceForPresentity @ 160 NONAME ; #<VT>#
+	_ZTV37COperationHandlePresenceGrantRequests @ 161 NONAME ; #<VT>#
+	_ZTV37COperationRemovePresentityGroupMember @ 162 NONAME ; #<VT>#
+	_ZTV37COperationSubscribePresentityPresence @ 163 NONAME ; #<VT>#
+	_ZTV37COperationSynthesiseSubscriptionEvent @ 164 NONAME ; #<VT>#
+	_ZTV37COperationUnsubscribeGrantRequestList @ 165 NONAME ; #<VT>#
+	_ZTV38COperationHandlePresentityGroupContent @ 166 NONAME ; #<VT>#
+	_ZTV38COperationWithdrawPresenceFromEveryone @ 167 NONAME ; #<VT>#
+	_ZTV39COperationUnsubscribePresentityPresence @ 168 NONAME ; #<VT>#
+	_ZTV40COperationWithdrawPresenceFromPresentity @ 169 NONAME ; #<VT>#
+	_ZTV42COperationHandlePresentityGroupMemberAdded @ 170 NONAME ; #<VT>#
+	_ZTV42COperationUpdatePresentityGroupDisplayName @ 171 NONAME ; #<VT>#
+	_ZTV43COperationCancelPresenceBlockFromPresentity @ 172 NONAME ; #<VT>#
+	_ZTV44COperationHandlePresentityGroupMemberRemoved @ 173 NONAME ; #<VT>#
+	_ZTV47COperationGrantPresenceToPresentityGroupMembers @ 174 NONAME ; #<VT>#
+	_ZTV48COperationUpdatePresentityGroupMemberDisplayName @ 175 NONAME ; #<VT>#
+	_ZTV49COperationSubscribePresentityGroupMembersPresence @ 176 NONAME ; #<VT>#
+	_ZTV51COperationUnsubscribePresentityGroupMembersPresence @ 177 NONAME ; #<VT>#
+	_ZTV52COperationWithdrawPresenceFromPresentityGroupMembers @ 178 NONAME ; #<VT>#
+	_ZTV55COperationHandlePresentityGroupMemberDisplayNameUpdated @ 179 NONAME ; #<VT>#
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/group/bld.inf	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  Build information file for project XIMP Framework Presence
+*
+*/
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+PRJ_MMPFILES
+presencedatamodel.mmp
+presencemanager.mmp
+
+presenceecomhook.mmp
+presenceoperation.mmp
+presencedatamodelhook.mmp
+
+presencecacheserver.mmp
+presencecacheclient.mmp
+presencecacheecomhook.mmp
+
+PRJ_TESTMMPFILES
+
+PRJ_TESTEXPORTS
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/group/presencecacheclient.mmp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,62 @@
+/*
+* 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:  Project definition file for Presence Cache Client
+*
+*/
+
+#include <platform_paths.hrh>
+#include <data_caging_paths.hrh>
+#include "presencedlluids.hrh"
+
+
+
+TARGET                  presencecacheclient.dll
+TARGETTYPE              dll
+UID                     XIMP_PRESENCE_DLL_UID_STATIC_INTERFACE XIMP_DLL_UID_PRESENCE_CACHE_CLIENT
+
+CAPABILITY              CAP_GENERAL_DLL
+VENDORID                VID_DEFAULT
+
+// ---------------------------------------------------------------------------
+SOURCEPATH              ../srcpresencecache/presencecacheclient
+
+SOURCE                  presencecacheclient.cpp
+SOURCE                  presencecacheclientnotification.cpp
+
+USERINCLUDE             ../srcpresencecache/presencecacheclient
+USERINCLUDE             ../srcpresencecache/presencecacheserver
+USERINCLUDE             ../../core/srcdatamodel
+USERINCLUDE             ../../core/srcutils
+USERINCLUDE             ../srcpresencedatamodel
+USERINCLUDE             ../srcpresencedatamodel/presenceinfo
+USERINCLUDE             ../srcpresencedatamodel/presencepublishing
+USERINCLUDE             ../srcpresencedatamodel/presencecache
+
+MW_LAYER_SYSTEMINCLUDE
+
+LIBRARY                 euser.lib
+LIBRARY                 ecom.lib
+LIBRARY                 estor.lib   // streams
+LIBRARY                 ximputils.lib
+LIBRARY                 presencedatamodel.lib
+LIBRARY                 ximpdatamodel.lib
+
+#if defined( ARMCC )
+DEFFILE ../eabi/ 
+#elif defined ( WINSCW )
+deffile ../bwins/ 
+#endif
+
+// End of file
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/group/presencecacheecomhook.mmp	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  Project definition file for ECom Hook
+*
+*/
+
+#include <platform_paths.hrh>
+#include <data_caging_paths.hrh>
+#include "presencedlluids.hrh"
+
+
+TARGET                  presencecacheecomhook.dll
+CAPABILITY              CAP_ECOM_PLUGIN
+TARGETTYPE              PLUGIN
+UID                     XIMP_PRESENCE_DLL_UID_ECOM_PLUGIN XIMP_DLL_UID_PRESENCE_CACHE_HOOK
+VENDORID                VID_DEFAULT
+
+
+SOURCEPATH              ../srcpresencecache/presencecacheecomhook
+START RESOURCE          presencecacheecomhook.rss
+TARGET                  presencecacheecomhook.rsc
+END
+
+
+SOURCEPATH              ../srcpresencecache/presencecacheecomhook
+SOURCE                  presencecacheecomhook.cpp
+
+
+USERINCLUDE             ../srcpresencecache/presencecacheecomhook
+USERINCLUDE             ../srcpresencecache/presencecacheclient
+USERINCLUDE             ../srcpresencecache/presencecacheserver
+USERINCLUDE             ../srcpresencedatamodel
+USERINCLUDE             .
+
+MW_LAYER_SYSTEMINCLUDE
+
+
+LIBRARY                 euser.lib
+LIBRARY                 presencecacheclient.lib
+LIBRARY                 ecom.lib
+
+#if defined( ARMCC )
+DEFFILE ../eabi/ 
+#elif defined ( WINSCW )
+deffile ../bwins/ 
+#endif
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/group/presencecacheserver.mmp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,61 @@
+/*
+* 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:  Project definition file for Presence Cache Server
+*
+*/
+
+#include <platform_paths.hrh>
+#include <data_caging_paths.hrh>
+#include "presencedlluids.hrh"
+
+
+TARGET                  presencecacheserver.exe
+TARGETTYPE              exe
+UID                     XIMP_PRESENCE_DLL_UID_STATIC_INTERFACE XIMP_DLL_UID_PRESENCE_CACHE_SERVER
+
+CAPABILITY              CAP_SERVER
+VENDORID                VID_DEFAULT
+
+
+SOURCEPATH              ../srcpresencecache/presencecacheserver
+SOURCE                  presencecacheserver.cpp
+SOURCE                  presencecachesession.cpp
+SOURCE                  presencecachebuddystore.cpp
+SOURCE                  presencecacheservicestore.cpp
+
+
+USERINCLUDE             ../srcpresencecache/presencecacheserver
+USERINCLUDE             ../srcpresencecache/presencecacheclient
+USERINCLUDE             ../srcpresencedatamodel/presencepublishing
+USERINCLUDE             ../srcpresencedatamodel/presenceinfo
+USERINCLUDE             ../srcpresencedatamodel
+USERINCLUDE             ../srcpresencedatamodel/presencecache
+USERINCLUDE             ../../core/srcdatamodel
+USERINCLUDE             ../../core/srcutils
+
+SYSTEMINCLUDE           /epoc32/include/ecom
+
+MW_LAYER_SYSTEMINCLUDE
+
+
+LIBRARY             	euser.lib
+LIBRARY                 flogger.lib
+LIBRARY                 ximputils.lib
+LIBRARY                 estor.lib   // streams
+LIBRARY                 presencedatamodel.lib
+LIBRARY                 ximpdatamodel.lib
+LIBRARY                 ecom.lib
+
+// End of file
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/group/presencedatamodel.mmp	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  Project definition file for Presence Data Model
+*
+*/
+
+#include <platform_paths.hrh>
+#include <data_caging_paths.hrh>
+#include "../../group/ximpdlluids.hrh"
+
+
+
+TARGET                  presencedatamodel.dll
+TARGETTYPE              dll
+UID                     XIMP_DLL_UID_STATIC_INTERFACE XIMP_DLL_UID_COMMON
+
+CAPABILITY              CAP_GENERAL_DLL
+VENDORID                VID_DEFAULT
+
+
+
+
+// ---------------------------------------------------------------------------
+SOURCEPATH              ../srcpresencedatamodel/presentitygroups
+// ---------------------------------------------------------------------------
+// Subscription items
+SOURCE                  grouplistsubscriptionitem.cpp
+SOURCE                  groupcontentsubscriptionitem.cpp
+
+// API data objects
+SOURCE                  presentitygroupinfoimp.cpp
+SOURCE                  presentitygroupmemberinfoimp.cpp
+
+// API data events
+SOURCE                  presentitygrouplisteventimp.cpp
+SOURCE                  presentitygroupcontenteventimp.cpp
+
+
+
+
+// ---------------------------------------------------------------------------
+SOURCEPATH              ../srcpresencedatamodel/presencewatching
+// ---------------------------------------------------------------------------
+// Subscription items
+SOURCE                  presentitypresencesubscriptionitem.cpp
+SOURCE                  presentitygroupmemberspresencesubscriptionitem.cpp
+
+// API data events
+SOURCE                  presentitypresenceeventimp.cpp
+
+
+
+
+// ---------------------------------------------------------------------------
+SOURCEPATH              ../srcpresencedatamodel/presenceauthorization
+// ---------------------------------------------------------------------------
+// Subscription items
+SOURCE                  blocklistsubscriptionitem.cpp
+SOURCE                  grantrequestlistsubscriptionitem.cpp
+
+// Configuration items
+SOURCE                  presenceconfigurationitem.cpp
+SOURCE                  presencetoeveryoneconfigurationitem.cpp
+SOURCE                  groupmemberspresenceconfigurationitem.cpp
+
+// API data objects
+SOURCE                  presenceblockinfoimp.cpp
+SOURCE                  presencegrantrequestinfoimp.cpp
+
+// API data events
+SOURCE                  presenceblocklisteventimp.cpp
+SOURCE                  presencegrantrequestlisteventimp.cpp
+
+
+
+
+// ---------------------------------------------------------------------------
+SOURCEPATH              ../srcpresencedatamodel/presencepublishing
+// ---------------------------------------------------------------------------
+// Subscription items
+SOURCE                  ownpresencesubscriptionitem.cpp
+SOURCE                  watcherlistsubscriptionitem.cpp
+
+// API data objects
+SOURCE                  presencewatcherinfoimp.cpp
+
+
+// API data events
+SOURCE                  ownpresenceeventimp.cpp
+SOURCE                  presencewatcherlisteventimp.cpp
+
+
+// Presence information
+SOURCE                  documentutils.cpp
+
+
+// ---------------------------------------------------------------------------
+SOURCEPATH              ../srcpresencedatamodel/presenceinfo
+// ---------------------------------------------------------------------------
+
+// presence info API
+SOURCE                  presenceinfofieldimp.cpp
+SOURCE                  presenceinfofieldcollectionimp.cpp
+SOURCE                  presenceinfofieldvaluetextimp.cpp
+SOURCE                  presenceinfofieldvaluebinaryimp.cpp
+SOURCE                  presenceinfofieldvalueenumimp.cpp
+SOURCE                  devicepresenceinfoimp.cpp
+SOURCE                  personpresenceinfoimp.cpp
+SOURCE                  servicepresenceinfoimp.cpp
+SOURCE                  presenceinfoimp.cpp
+SOURCE                  presenceinfofilterimp.cpp
+
+// ---------------------------------------------------------------------------
+SOURCEPATH              ../srcpresencedatamodel/presencecache
+// ---------------------------------------------------------------------------
+
+SOURCE                  presencebuddyinfoimp.cpp 
+SOURCE                  presencebuddyinfolistimp.cpp
+
+// ---------------------------------------------------------------------------
+SOURCEPATH              ../srcpresencedatamodel
+// ---------------------------------------------------------------------------
+SOURCE                  presencedatacacheimp.cpp
+SOURCE                  presenceobjectfactoryimp.cpp
+// filter store
+SOURCE                  presencefilterstore.cpp
+
+SOURCE                  presenceapidataobjfactory.cpp
+SOURCE                  presenceeventcodec.cpp
+
+SOURCE                  presenceapidataobjfactoryaccessor.cpp
+
+
+USERINCLUDE             ../../core/srcdatamodel
+USERINCLUDE             ../../core/srcprocessor
+USERINCLUDE             ../../core/srcoperations
+USERINCLUDE             ../../core/srcutils
+
+
+USERINCLUDE             ../srcpresencedatamodel
+USERINCLUDE             ../srcpresencedatamodel/presentitygroups
+USERINCLUDE             ../srcpresencedatamodel/presencewatching
+USERINCLUDE             ../srcpresencedatamodel/presenceauthorization
+USERINCLUDE             ../srcpresencedatamodel/presencepublishing
+USERINCLUDE             ../srcpresencedatamodel/presenceinfo
+USERINCLUDE             ../srcpresencedatamodel/presencecache
+USERINCLUDE             ../group
+
+// TODO remove unnecessary
+SYSTEMINCLUDE           ../../inc/core/base
+SYSTEMINCLUDE           ../../inc/core/datamodel
+SYSTEMINCLUDE           ../../inc/core/protocolplugin
+SYSTEMINCLUDE           ../../inc/core/protocolpluginhost
+SYSTEMINCLUDE           ../../inc/presence/presencedatamodel
+SYSTEMINCLUDE           ../../inc/presence/presencemanagement
+SYSTEMINCLUDE           ../../inc/presence/presenceprotocolplugin
+SYSTEMINCLUDE           ../../inc/presence/presenceprotocolpluginhost
+MW_LAYER_SYSTEMINCLUDE
+
+
+LIBRARY                 euser.lib
+LIBRARY                 bafl.lib
+LIBRARY                 estor.lib
+LIBRARY                 ximputils.lib
+LIBRARY                 ximpdatamodel.lib
+LIBRARY                 ecom.lib
+
+
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/group/presencedatamodelhook.mmp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,60 @@
+/*
+* 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:  Project definition file for Presence Event Codec ECom Hook
+*
+*/
+
+#include <platform_paths.hrh>
+#include <data_caging_paths.hrh>
+#include "presencedlluids.hrh"
+
+
+
+TARGET                  presencedatamodelhook.dll
+CAPABILITY              CAP_ECOM_PLUGIN
+TARGETTYPE              PLUGIN
+UID                     XIMP_PRESENCE_DLL_UID_ECOM_PLUGIN XIMP_DLL_UID_PRESENCE_DATAMODEL_HOOK
+VENDORID                VID_DEFAULT
+
+
+SOURCEPATH              ../srcpresencedatamodel/presencedatamodelhook
+START RESOURCE          presencedatamodelhook.rss
+TARGET                  presencedatamodelhook.rsc
+END
+
+
+SOURCEPATH              ../srcpresencedatamodel/presencedatamodelhook
+SOURCE                  presencedatamodelhook.cpp
+
+
+USERINCLUDE             .
+USERINCLUDE             ../srcpresencedatamodel/presencedatamodelhook
+USERINCLUDE             ../srcpresencedatamodel
+USERINCLUDE             ../../core/srcdatamodel
+//USERINCLUDE             ../../group
+
+
+//SYSTEMINCLUDE           ../../inc/presence/presencemanagement
+MW_LAYER_SYSTEMINCLUDE
+
+
+LIBRARY                 euser.lib
+LIBRARY                 presencedatamodel.lib
+LIBRARY                 ecom.lib
+
+#if defined( ARMCC )
+DEFFILE ../eabi/ 
+#elif defined ( WINSCW )
+deffile ../bwins/ 
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/group/presencedlluids.hrh	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,62 @@
+/*
+* 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:  XIMP Framework Presence DLL uids
+*
+*/
+
+#ifndef PRESENCEDLLUIDS_HRH
+#define PRESENCEDLLUIDS_HRH
+
+
+// -----------------------------------------------------------------------------
+// Common dll uids
+// -----------------------------------------------------------------------------
+//
+#define XIMP_PRESENCE_DLL_UID_STATIC_INTERFACE                   0x1000008d
+#define XIMP_PRESENCE_DLL_UID_ECOM_PLUGIN                        0x10009D8D
+
+// -----------------------------------------------------------------------------
+// ECOM implementation UID
+// -----------------------------------------------------------------------------
+//
+#define XIMP_ECOM_IMPLEMENTATION_UID_PRESENCE_INTERFACE   0x2000B186
+
+#define XIMP_ECOM_IMPL_UID_PRESENCE_CACHE_READER       0x2000B4EE
+#define XIMP_ECOM_IMPL_UID_PRESENCE_CACHE_WRITER       0x2000B4F0  
+
+// Factory interface for internal data structures
+#define XIMP_ECOM_IMPL_UID_PRESENCE_DATAMODEL_INTERFACE   0x2000B197
+
+// -----------------------------------------------------------------------------
+// Other dll uids
+// -----------------------------------------------------------------------------
+//
+#define XIMP_DLL_UID_PRESENCE_HOOK                      0x2000B1AE
+#define XIMP_DLL_UID_PRESENCE_MANAGER                   0x2000B1AF
+#define XIMP_DLL_UID_PRESENCE_DATAMODEL_HOOK            0x2000B198
+#define XIMP_DLL_UID_PRESENCE_CACHE_HOOK                0x2000B4E9
+#define XIMP_DLL_UID_PRESENCE_CACHE_CLIENT              0x2000B4EA
+#define XIMP_DLL_UID_PRESENCE_CACHE_SERVER              0x2000B4EB
+
+// Still have spare UIDs 0x2000B4EF, 
+
+// -----------------------------------------------------------------------------
+// ECOM Interface UIDs
+// -----------------------------------------------------------------------------
+// TODO: move it to the core side
+#define XIMP_ECOM_IF_UID_PRESENCE_EVENT_CODEC_INTERFACE   0x2000B199
+
+#endif // PRESENCEDLLUIDS_HRH
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/group/presenceecomhook.mmp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,60 @@
+/*
+* 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:  Project definition file for ECom Hook
+*
+*/
+
+#include <platform_paths.hrh>
+#include <data_caging_paths.hrh>
+#include "../../group/ximpdlluids.hrh"
+
+
+
+TARGET                  presenceecomhook.dll
+CAPABILITY              CAP_ECOM_PLUGIN
+TARGETTYPE              PLUGIN
+UID                     XIMP_DLL_UID_ECOM_PLUGIN XIMP_DLL_UID_PRESENCE_HOOK
+VENDORID                VID_DEFAULT
+
+
+SOURCEPATH              ../srcpresencefrontend/srcecomhook
+START RESOURCE          presenceecomhook.rss
+TARGET                  presenceecomhook.rsc
+END
+
+
+SOURCEPATH              ../srcpresencefrontend/srcecomhook
+SOURCE                  presenceecomhook.cpp
+
+
+USERINCLUDE             ../srcpresencefrontend/srcecomhook
+USERINCLUDE             ../srcpresencefrontend/srcpresencemanager
+USERINCLUDE             ../srcpresencedatamodel
+USERINCLUDE             ../../core/srcdatamodel
+USERINCLUDE             ../../group
+
+
+SYSTEMINCLUDE           ../../inc/presence/presencemanagement
+MW_LAYER_SYSTEMINCLUDE
+
+
+LIBRARY                 euser.lib
+LIBRARY                 presencemanager.lib
+LIBRARY                 ecom.lib
+
+#if defined( ARMCC )
+DEFFILE ../eabi/ 
+#elif defined ( WINSCW )
+deffile ../bwins/ 
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/group/presencemanager.mmp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,75 @@
+/*
+* 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:  Project definition file for Presence Manager
+*
+*/
+
+#include <platform_paths.hrh>
+#include <data_caging_paths.hrh>
+#include "../../group/ximpdlluids.hrh"
+
+
+
+TARGET                  presencemanager.dll
+TARGETTYPE              dll
+UID                     XIMP_DLL_UID_STATIC_INTERFACE XIMP_DLL_UID_PRESENCE_MANAGER
+
+CAPABILITY              CAP_GENERAL_DLL
+VENDORID                VID_DEFAULT
+
+
+SOURCEPATH              ../srcpresencefrontend/srcpresencemanager
+
+SOURCE                  presencepublishingimp.cpp
+SOURCE                  presentitygroupsimp.cpp
+SOURCE                  presencewatchingimp.cpp
+SOURCE                  presenceauthorizationimp.cpp
+SOURCE                  presencefeaturesimp.cpp
+
+USERINCLUDE             ../../core/srcfrontend/srcmanager
+USERINCLUDE             ../srcpresenceoperations
+USERINCLUDE             ../../core/srcutils
+USERINCLUDE             ../../core/srcdatamodel
+USERINCLUDE             ../../group
+USERINCLUDE             ../srcpresencedatamodel
+USERINCLUDE             ../srcpresencedatamodel/presentitygroups
+USERINCLUDE             ../srcpresencedatamodel/presencewatching
+USERINCLUDE             ../srcpresencedatamodel/presenceauthorization
+USERINCLUDE             ../srcpresencedatamodel/presencepublishing
+
+//USERINCLUDE             ../../core/inc
+//SYSTEMINCLUDE           ../../inc/base
+//SYSTEMINCLUDE           ../../inc/datamodel
+SYSTEMINCLUDE           ../../inc/presence/presencemanagement
+SYSTEMINCLUDE           ../../inc/core/management
+
+MW_LAYER_SYSTEMINCLUDE
+
+
+LIBRARY                 euser.lib
+LIBRARY                 ecom.lib
+LIBRARY                 bafl.lib
+LIBRARY                 estor.lib
+LIBRARY                 ximputils.lib
+LIBRARY                 ximpdatamodel.lib
+LIBRARY                 presencedatamodel.lib
+LIBRARY                 ximpsrvclient.lib
+
+#if defined( ARMCC )
+DEFFILE ../eabi/ 
+#elif defined ( WINSCW )
+deffile ../bwins/ 
+#endif
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/group/presenceoperation.mmp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,183 @@
+/*
+* 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:  Project definition file for Presence Operations
+*
+*/
+
+#include <platform_paths.hrh>
+#include <data_caging_paths.hrh>
+#include "../../group/ximpdlluids.hrh"
+
+
+
+TARGET                  presenceoperation.dll
+TARGETTYPE              dll
+UID                     XIMP_DLL_UID_STATIC_INTERFACE XIMP_DLL_UID_PRESENCE_MANAGER
+
+CAPABILITY              CAP_GENERAL_DLL
+VENDORID                VID_DEFAULT
+
+// ---------------------------------------------------------------------------
+SOURCEPATH              ../srcpresenceoperations
+// ---------------------------------------------------------------------------
+SOURCE                  operationlaunchcleaner.cpp
+SOURCE                  operationsynthesisesubscriptionevent.cpp
+SOURCE                  operationsetsubscriptiondata.cpp
+SOURCE                  presenceoperationfactoryimp.cpp
+
+// ---------------------------------------------------------------------------
+SOURCEPATH              ../srcpresenceoperations/presentitygroups
+// ---------------------------------------------------------------------------
+
+// Client - presentity groups
+SOURCE                  operationsubscribegrouplist.cpp
+SOURCE                  operationunsubscribegrouplist.cpp
+SOURCE                  operationcreatepresentitygroup.cpp
+SOURCE                  operationdeletepresentitygroup.cpp
+SOURCE                  operationupdatepresentitygroupdisplayname.cpp
+
+// Adaptation - presentity groups
+SOURCE                  operationhandlepresentitygroups.cpp
+
+// Client - presentity group members
+SOURCE                  operationsubscribegroupcontent.cpp
+SOURCE                  operationunsubscribegroupcontent.cpp
+SOURCE                  operationaddpresentitygroupmember.cpp
+SOURCE                  operationremovepresentitygroupmember.cpp
+SOURCE                  operationupdatepresentitygroupmemberdisplayname.cpp
+
+// Adaptation - presentity group members
+SOURCE                  operationhandlepresentitygroupcontent.cpp
+SOURCE                  operationhandlepresentitygroupmemberadded.cpp
+SOURCE                  operationhandlepresentitygroupmemberremoved.cpp
+SOURCE                  operationhandlepresentitygroupmemberdisplaynameupdated.cpp
+
+
+
+
+
+// ---------------------------------------------------------------------------
+SOURCEPATH              ../../presence/srcpresenceoperations/presencewatching
+// ---------------------------------------------------------------------------
+
+// Client - subscribe presentity presence
+SOURCE                  operationsubscribepresentitypresence.cpp
+SOURCE                  operationunsubscribepresentitypresence.cpp
+SOURCE                  operationsubscribepresentitygroupmemberspresence.cpp
+SOURCE                  operationunsubscribepresentitygroupmemberspresence.cpp
+
+// Adaptation - presentity presence recepetion
+SOURCE                  operationhandlepresentitypresence.cpp
+
+
+
+
+// ---------------------------------------------------------------------------
+SOURCEPATH              ../srcpresenceoperations/presenceauthorization
+// ---------------------------------------------------------------------------
+
+// Client - Presence grant request listening
+SOURCE                  operationsubscribegrantrequestlist.cpp
+SOURCE                  operationunsubscribegrantrequestlist.cpp
+
+// Adaptation - Reception of grant requests
+SOURCE                  operationhandlepresencegrantrequests.cpp
+
+// Client - Granting presence
+SOURCE                  operationgrantpresencetopresentity.cpp
+SOURCE                  operationwithdrawpresencefrompresentity.cpp
+SOURCE                  operationgrantpresencetopresentitygroupmembers.cpp
+SOURCE                  operationwithdrawpresencefrompresentitygroupmembers.cpp
+SOURCE                  operationgrantpresencetoeveryone.cpp
+SOURCE                  operationwithdrawpresencefromeveryone.cpp
+
+// Client - Blocking presence
+SOURCE                  operationsubscribeblocklist.cpp
+SOURCE                  operationunsubscribeblocklist.cpp
+SOURCE                  operationblockpresenceforpresentity.cpp
+SOURCE                  operationcancelpresenceblockfrompresentity.cpp
+
+// Adaptation - Reception of block information
+SOURCE                  operationhandlepresenceblocking.cpp
+
+
+
+
+
+// ---------------------------------------------------------------------------
+SOURCEPATH              ../srcpresenceoperations/presencepublishing
+// ---------------------------------------------------------------------------
+
+// Client - Publishing own presence
+SOURCE                  operationpublishownpresence.cpp
+
+// Client - Subscribing own presence
+SOURCE                  operationsubscribeownpresence.cpp
+SOURCE                  operationunsubscribeownpresence.cpp
+
+// Adaptation - Reception of own presence information
+SOURCE                  operationhandleownpresence.cpp
+
+// Client - Subscribing of presence watcher list
+SOURCE                  operationsubscribewatcherlist.cpp
+SOURCE                  operationunsubscribewatcherlist.cpp
+
+// Adaptation - Reception of presence watcher list
+SOURCE                  operationhandlepresencewatcherlist.cpp
+
+
+
+
+USERINCLUDE             ../../core/srcoperations
+//USERINCLUDE             ../srcoperations/sessionmng
+USERINCLUDE             ../srcpresenceoperations
+USERINCLUDE             ../srcpresenceoperations/presentitygroups
+USERINCLUDE             ../srcpresenceoperations/presencewatching
+USERINCLUDE             ../srcpresenceoperations/presenceauthorization
+USERINCLUDE             ../srcpresenceoperations/presencepublishing
+
+USERINCLUDE             ../../core/srcdatamodel
+USERINCLUDE             ../srcpresenceprocessor
+USERINCLUDE             ../srcpresencedatamodel
+USERINCLUDE             ../srcpresencedatamodel/presentitygroups
+USERINCLUDE             ../srcpresencedatamodel/presencewatching
+USERINCLUDE             ../srcpresencedatamodel/presenceauthorization
+USERINCLUDE             ../srcpresencedatamodel/presencepublishing
+
+
+USERINCLUDE             ../../core/srcutils
+USERINCLUDE             ../../core/srcprocessor
+
+// TODO remove unnecessary
+SYSTEMINCLUDE           ../../inc/core/base
+SYSTEMINCLUDE           ../../inc/core/datamodel
+SYSTEMINCLUDE           ../../inc/core/protocolplugin
+SYSTEMINCLUDE           ../../inc/core/protocolpluginhost
+SYSTEMINCLUDE           ../../inc/presence/presencedatamodel
+SYSTEMINCLUDE           ../../inc/presence/presencemanagement
+SYSTEMINCLUDE           ../../inc/presence/presenceprotocolplugin
+SYSTEMINCLUDE           ../../inc/presence/presenceprotocolpluginhost
+MW_LAYER_SYSTEMINCLUDE
+
+
+
+LIBRARY                 euser.lib
+LIBRARY                 estor.lib
+LIBRARY                 ximputils.lib
+LIBRARY                 ximpdatamodel.lib
+LIBRARY                 presencedatamodel.lib
+LIBRARY                 ximpprocessor.lib
+
+// End of file
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresencecache/presencecacheclient/presencecacheclient.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,733 @@
+/*
+* 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:  Implementation for presence cache client.
+*
+*/
+
+#include <e32std.h>
+#include <s32buf.h>
+
+#include <presenceinfofieldcollection.h>
+#include <presencebuddyinfo.h>
+#include <ximpidentity.h>
+#include <prescachewritehandler.h>
+#include <prescachereadhandler.h>
+#include <presencebuddyinfolist.h>
+#include <personpresenceinfo.h>
+#include <presenceinfofield.h>
+#include <presenceinfo.h>
+
+#include "presencecacheclient.h"
+#include "presencecachedefs.h"
+#include "ximpobjecthelpers.h"
+#include "presenceinfoimp.h"
+#include "personpresenceinfoimp.h"
+#include "presenceinfofieldimp.h"
+#include "ximpidentityimp.h"
+#include "presencebuddyinfoimp.h"
+#include "presencebuddyinfolistimp.h"
+#include "presenceobjectfactoryimp.h"
+#include "presencecacheclientnotification.h"
+
+
+//Include Cache server namespace
+using namespace NCacheSrv;
+
+
+// ============================ MEMBER FUNCTIONS =============================
+
+// ---------------------------------------------------------------------------
+// CPresenceCacheClient::NewL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CPresenceCacheClient* CPresenceCacheClient::NewL()
+    {
+    CPresenceCacheClient* self = new( ELeave ) CPresenceCacheClient();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+    return self;    
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceCacheClient::CreateReaderL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C MPresenceCacheReader* CPresenceCacheClient::CreateReaderL()
+    {
+    return NewL();
+    }
+    
+// ---------------------------------------------------------------------------
+// CPresenceCacheClient::CreateWriterL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C MPresenceCacheWriter* CPresenceCacheClient::CreateWriterL()
+    {
+    return NewL();
+    }
+    
+// ---------------------------------------------------------------------------
+// CPresenceCacheClient::~CPresenceCacheClient()
+// ---------------------------------------------------------------------------
+//
+CPresenceCacheClient::~CPresenceCacheClient()
+    {
+    delete iNotifyHandler;    
+    Cancel();
+    RSessionBase::Close();
+    delete iPresObjFactory;
+    }
+    
+// ---------------------------------------------------------------------------
+// CPresenceCacheClient::CPresenceCacheClient()
+// ---------------------------------------------------------------------------
+//
+CPresenceCacheClient::CPresenceCacheClient(): CActive( EPriorityStandard ), 
+                                            iWriteHandler(NULL),
+                                            iReadHandler(NULL),
+                                            iAsyncReq(NRequest::ENoRequestMade)
+    {
+        
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceCacheClient::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void CPresenceCacheClient::ConstructL()
+    {
+    Connect();
+    CActiveScheduler::Add( this );
+    iPresObjFactory = CPresenceObjectFactoryImp::NewL();      
+    }
+    
+// -----------------------------------------------------------------------------
+// CPresenceCacheClient::Connect()
+// Connects to the server and create a session.
+// -----------------------------------------------------------------------------
+//
+TInt CPresenceCacheClient::Connect()
+    {
+    TInt error = StartServer();
+
+    if ( KErrNone == error )
+        {
+        error = CreateSession( NName::KSymbianServer,
+                               Version(),
+                               NRequest::KMsgSlotCount );
+        }
+    return error;
+    }
+    
+      
+// ----------------------------------------------------
+// CPresenceCacheClient::StartServer
+//
+// ----------------------------------------------------
+//
+TInt CPresenceCacheClient::StartServer()
+    {
+    TInt result;
+    TRequestStatus status = KRequestPending; 
+
+    TFindServer findCacheServer( NName::KSymbianServer );
+    TFullName name;
+
+    result = findCacheServer.Next( name );
+    if ( result == KErrNone )
+        {
+        // Server already running
+        return KErrNone;
+        }
+
+    RProcess server;
+    result = server.Create( NName::KExecutable, KNullDesC );       
+    if( result != KErrNone )
+        return result;     
+    server.Rendezvous( status );    	
+    status != KRequestPending ? server.Kill( 0 ) : server.Resume();
+    //Wait for start or death 
+    User::WaitForRequest( status );	
+    result = server.ExitType() == EExitPanic ? KErrGeneral : status.Int();
+    server.Close();
+    
+    return result;	    
+    }
+    
+// -----------------------------------------------------------------------------
+// CPresenceCacheClient::Version()
+// Gets the version number.
+// -----------------------------------------------------------------------------
+//
+TVersion CPresenceCacheClient::Version() const
+    {
+    return( TVersion( NVersion::KMajor,
+                      NVersion::KMinor,
+                      NVersion::KBuild ) );
+    }
+ 
+
+// ---------------------------------------------------------------------------
+// CPresenceCacheClient::PresenceInfoLC()
+// ---------------------------------------------------------------------------
+//    
+MPresenceInfo* CPresenceCacheClient::PresenceInfoLC(const MXIMPIdentity& aIdentity)
+    {
+    CPresenceInfoImp* presInfo(NULL);
+    
+    if(!ValidateXspId(aIdentity.Identity()))
+        return presInfo;
+    
+    TInt sizeOfPresInfo(0);
+    TPckgBuf<TInt> sizePckg;
+    
+    HBufC8* myIdPack = PackIdentityLC(aIdentity);                
+                      
+    // Package message arguments before sending to the server
+    TIpcArgs args;
+    args.Set(1, myIdPack);
+    args.Set(2, &sizePckg);    
+        
+    // We will get either size(+ve) or error code(+ve) after this call
+    TInt err = SendReceive( NRequest::EPrepReadPresenceInfoSync, args );
+    sizeOfPresInfo = sizePckg();
+    
+    CleanupStack::PopAndDestroy(myIdPack);
+    
+    if(sizeOfPresInfo && (err==KErrNone)) // If found
+        {
+        presInfo = CPresenceInfoImp::NewLC();    
+        HBufC8* presInfoDes = HBufC8::NewLC(sizeOfPresInfo);                        
+        TPtr8 ptrBuf( presInfoDes->Des() );                        
+                               
+        SendReceive( NRequest::EGetLastPreparedPacket, TIpcArgs(&ptrBuf) );
+        
+        TXIMPObjectPacker< CPresenceInfoImp >::UnPackL( *presInfo, *presInfoDes );
+        CleanupStack::PopAndDestroy(presInfoDes);
+        }
+    
+    return presInfo;
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceCacheClient::BuddyCountInAllServices()
+// ---------------------------------------------------------------------------
+//    
+TInt CPresenceCacheClient::BuddyCountInAllServices()
+    {
+    TInt buddyCount(0);
+    TPckgBuf<TInt> buddyCountPckg;
+                      
+    // Package message arguments before sending to the server
+    TIpcArgs args(&buddyCountPckg);
+        
+    // This call waits for the server to complete the request before
+    // proceeding.
+    TInt err = SendReceive( NRequest::EBuddyCountInAllServices, args );
+    buddyCount = buddyCountPckg();
+    
+    return (err<0) ? err  : buddyCount;
+    }
+    
+// ---------------------------------------------------------------------------
+// CPresenceCacheClient::BuddyCountInService()
+// ---------------------------------------------------------------------------
+//
+TInt CPresenceCacheClient::BuddyCountInService(const TDesC& aServiceName)
+    {
+    TInt buddyCount(0);
+    TPckgBuf<TInt> buddyCountPckg;
+    
+    // Package message arguments before sending to the server
+    TIpcArgs args(&buddyCountPckg);
+    args.Set(1, &aServiceName);
+        
+    // This call waits for the server to complete the request before
+    // proceeding.
+    TInt err = SendReceive( NRequest::EBuddyCountInService, args );
+    buddyCount = buddyCountPckg();
+    
+    return (err<0) ? err  : buddyCount;
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceCacheClient::ServicesCount()
+// ---------------------------------------------------------------------------
+//
+TInt CPresenceCacheClient::ServicesCount()
+    {
+    TInt serviceCount(0);
+    TPckgBuf<TInt> serviceCountPckg;
+    
+    // Package message arguments before sending to the server
+    TIpcArgs args(&serviceCountPckg);
+        
+    // This call waits for the server to complete the request before
+    // proceeding.
+    TInt err = SendReceive( NRequest::EGetServiceCount, args );
+    serviceCount = serviceCountPckg();
+    
+    return (err<0) ? err  : serviceCount;
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceCacheClient::ServicesLC()
+// ---------------------------------------------------------------------------
+//
+/* Implementation is not updated because no one is using this functionality
+CDesC16Array* CPresenceCacheClient::ServicesLC()
+    {
+    CDesC16Array* services(NULL); 
+    
+    // This call waits for the server to complete the request before
+    // proceeding.
+    TInt size = SendReceive( NRequest::EPrepGetAllServices);
+    if(size>0)
+    	{
+        HBufC8* servicesDes = HBufC8::NewLC(size);                        
+        TPtr8 ptrBuf( servicesDes->Des() );                        
+                               
+        SendReceive( NRequest::EGetAllServices, TIpcArgs(&ptrBuf) );
+        
+        services =  UnPackServicesLC(*servicesDes);
+        CleanupStack::Pop(services);
+        CleanupStack::PopAndDestroy(servicesDes);
+        CleanupStack::PushL(services);
+    	}
+    return services;
+    }*/                               
+                                                
+// ---------------------------------------------------------------------------
+// CPresenceCacheClient::AllBuddiesPresenceInService()
+// ---------------------------------------------------------------------------
+//
+TInt CPresenceCacheClient::AllBuddiesPresenceInService(const TDesC& aServiceName, 
+                                            MPresCacheReadHandler* aHandler)
+    {
+    if (IsActive())
+        return KErrNotReady;
+    
+    if(!aHandler || (aServiceName.Length()==NULL) )
+        return KErrArgument;
+    else
+        iReadHandler = aHandler;
+    
+    // Package message arguments before sending to the server
+    TIpcArgs args(&aServiceName);
+        
+    // This call is async
+    SendReceive( NRequest::EPrepReadAllBuddiesPresenceInService, args, iStatus );
+    
+    iAsyncReq = NRequest::EPrepReadAllBuddiesPresenceInService;
+    
+    SetActive(); 
+    
+    return KErrNone;
+        
+    }
+    
+// ---------------------------------------------------------------------------
+// CPresenceCacheClient::SubscribePresenceBuddyChangeL
+// ---------------------------------------------------------------------------
+//
+TInt CPresenceCacheClient::SubscribePresenceBuddyChangeL(
+                                                const MXIMPIdentity& aIdentity)
+    {
+    if(!ValidateXspId(aIdentity.Identity()))
+        return KErrArgument;
+
+    if ( !iNotifyClient )
+    	{
+    	return KErrNotReady;
+    	}
+    
+    if ( !iNotifyHandler )
+    	{
+    	iNotifyHandler = CPresenceCacheClientNotification::NewL( *this );  	    	
+    	}
+    
+    TInt ret = iNotifyHandler->SubscribePresenceBuddyChangeL( aIdentity);
+    return ret; 
+    }  
+    
+// ---------------------------------------------------------------------------
+// CPresenceCacheClient::UnSubscribePresenceBuddyChangeL
+// ---------------------------------------------------------------------------
+//
+void CPresenceCacheClient::UnSubscribePresenceBuddyChangeL(
+                        const MXIMPIdentity& aIdentity)
+    {
+    if(!ValidateXspId(aIdentity.Identity()))
+        return;
+    
+    if ( iNotifyHandler )
+    	{
+    	iNotifyHandler->UnsubscribePresenceBuddyChangeL( aIdentity);  	    	
+    	} 
+    }      
+                                           
+// ---------------------------------------------------------------------------
+// CPresenceCacheClient::SetObserverForSubscribedNotifications
+// ---------------------------------------------------------------------------
+//
+TInt CPresenceCacheClient::SetObserverForSubscribedNotifications(
+    MPresCacheReadHandler* aHandler)
+    {
+    if ( !aHandler )
+    	{
+    	return KErrArgument;
+    	}
+    iNotifyClient = aHandler;
+    return KErrNone;               
+    }                                          
+                                             
+    
+// ---------------------------------------------------------------------------
+// CPresenceCacheClient::HandlePreparedAllBuddiesPresenceL()
+// ---------------------------------------------------------------------------
+//
+void CPresenceCacheClient::HandlePreparedAllBuddiesPresenceL(TInt aError)
+    {
+    TInt status = aError; // size comes in status
+    CPresenceBuddyInfoListImp* buddyInfoList(NULL);
+    if(status>0) // if anything found
+        {
+        buddyInfoList = CPresenceBuddyInfoListImp::NewLC(KNullDesC);    
+        HBufC8* buddyInfosDes = HBufC8::NewLC(status);                        
+        TPtr8 ptrBuf( buddyInfosDes->Des() );                        
+                               
+        status = SendReceive( NRequest::EGetLastAsyncPreparedPacket, TIpcArgs(&ptrBuf) );
+        
+        TXIMPObjectPacker< CPresenceBuddyInfoListImp >::UnPackL( *buddyInfoList, *buddyInfosDes );
+        CleanupStack::PopAndDestroy(buddyInfosDes);
+        CleanupStack::Pop(buddyInfoList); // ownership will transfer to client
+        }
+    
+    if(iReadHandler)
+        iReadHandler->HandlePresenceReadL(status, buddyInfoList);
+    else if(buddyInfoList) // if failed to transfer ownership and created object
+        delete buddyInfoList; 
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceCacheClient::WritePresenceL()
+// ---------------------------------------------------------------------------
+//
+TInt CPresenceCacheClient::WritePresenceL(
+                                const MPresenceBuddyInfo* aPresenceBuddyInfo)
+    {
+    if(!aPresenceBuddyInfo)
+        return KErrArgument;
+    
+    if(!ValidateXspId(aPresenceBuddyInfo->BuddyId()->Identity()))
+        return KErrArgument;
+        
+
+    HBufC8* presInfoPack = PackBuddyPresenceInfoLC(aPresenceBuddyInfo);
+    
+    // Package message arguments before sending to the server
+    TIpcArgs args(presInfoPack);
+                                                            
+       
+    // This call waits for the server to complete the request before
+    // proceeding.
+    TInt err = SendReceive( NRequest::EWritePresenceInfoSync, args );
+    
+    CleanupStack::PopAndDestroy(presInfoPack);    
+    
+    return err;
+    
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceCacheClient::DeletePresenceL()
+// ---------------------------------------------------------------------------
+//
+TInt CPresenceCacheClient::DeletePresenceL(const MXIMPIdentity& aIdentity)
+    {
+    HBufC8* idPack = PackIdentityLC(aIdentity);
+    
+    // Package message arguments before sending to the server
+    TIpcArgs args(idPack);
+       
+    // This call waits for the server to complete the request before
+    // proceeding.
+    TInt err = SendReceive( NRequest::EDeletePresence, args );
+    
+    CleanupStack::PopAndDestroy(idPack);    
+    
+    return err;
+    }
+    
+
+// ---------------------------------------------------------------------------
+// CPresenceCacheClient::CancelWrite()
+// ---------------------------------------------------------------------------
+//
+TInt CPresenceCacheClient::CancelWrite()
+    {
+    TInt ret(KErrNotFound);
+    if(IsActive())
+        {
+        Cancel();
+        ret = KErrNone;
+        }
+    return ret;
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceCacheClient::CancelRead()
+// ---------------------------------------------------------------------------
+//
+TInt CPresenceCacheClient::CancelRead()
+    {
+    TInt ret(KErrNotFound);
+    if(IsActive())
+        {
+        Cancel();
+        ret = KErrNone;
+        }
+    return ret;
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceCacheClient::DeleteService()
+// ---------------------------------------------------------------------------
+//
+TInt CPresenceCacheClient::DeleteService(const TDesC& aServiceName)
+    {
+    return SendReceive( NRequest::EDeleteService, TIpcArgs(&aServiceName) );
+    }
+    
+// ---------------------------------------------------------------------------
+// CPresenceCacheClient::PresenceObjectFactory()
+// ---------------------------------------------------------------------------
+//
+MPresenceObjectFactory& CPresenceCacheClient::PresenceObjectFactory() const
+    {
+    return *iPresObjFactory;
+    }
+    
+// ---------------------------------------------------------------------------
+// CPresenceCacheClient::NewIdentityLC()
+// ---------------------------------------------------------------------------
+//
+MXIMPIdentity* CPresenceCacheClient::NewIdentityLC()
+    {
+    return CXIMPIdentityImp::NewLC();  
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceCacheClient::NewPresenceInfoLC()
+// ---------------------------------------------------------------------------
+//    
+MPresenceInfo* CPresenceCacheClient::NewPresenceInfoLC()
+    {
+    return CPresenceInfoImp::NewLC();    
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceCacheClient::NewBuddyPresenceInfoLC()
+// ---------------------------------------------------------------------------
+//    
+MPresenceBuddyInfo* CPresenceCacheClient::NewBuddyPresenceInfoLC()
+    {
+    return CPresenceBuddyInfoImp::NewLC();
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceCacheClient::NewPresenceBuddyInfoListLC()
+// ---------------------------------------------------------------------------
+//    
+MPresenceBuddyInfoList* CPresenceCacheClient::NewPresenceBuddyInfoListLC(
+                                                        const TDesC& aServiceName)
+    {
+    return CPresenceBuddyInfoListImp::NewLC(aServiceName);
+    }
+                                                
+// ---------------------------------------------------------------------------
+// CPresenceCacheClient::WritePresenceL()
+// ---------------------------------------------------------------------------
+//
+TInt CPresenceCacheClient::WritePresenceL(
+                            const MPresenceBuddyInfoList* aPresenceBuddyInfos,
+                                            MPresCacheWriteHandler* aHandler)
+    {
+    if (IsActive())
+        return KErrNotReady;
+    if(!aPresenceBuddyInfos)
+        return KErrArgument;
+    
+    HBufC8* presInfoPack = PackPresenceBuddyListLC(aPresenceBuddyInfos);
+    
+    // Package message arguments before sending to the server
+    TIpcArgs args(presInfoPack);
+    args.Set(1,aPresenceBuddyInfos->Count());
+                                                            
+    // This is async call to server.
+    SendReceive( NRequest::EWritePresenceInfoAsync, args, iStatus);
+    
+    iAsyncReq = NRequest::EWritePresenceInfoAsync;
+    
+    if(aHandler)
+        iWriteHandler = aHandler;    
+    
+    CleanupStack::PopAndDestroy(presInfoPack);
+    
+    SetActive(); 
+    
+    return KErrNone;
+    }
+    
+// ---------------------------------------------------------------------------
+// CPresenceCacheClient::ValidateXspId()
+// ---------------------------------------------------------------------------
+//
+TBool CPresenceCacheClient::ValidateXspId(const TDesC& aXspId)
+    {
+    TBool ret(EFalse);
+    _LIT(KColon, ":");
+    TInt pos = aXspId.Find(KColon);
+    if(pos>0) // if colon found and there is something before colon, i.e. xsp id
+        {
+        ret = ETrue;
+        }
+    return ret;
+    }
+    
+// ---------------------------------------------------------------------------
+// CPresenceCacheClient::RunL()
+// ---------------------------------------------------------------------------
+//
+void CPresenceCacheClient::RunL()
+    {
+    
+    TInt origStatus = iStatus.Int();
+    switch (iAsyncReq)
+        {
+        case NRequest::EWritePresenceInfoAsync:
+            if(iWriteHandler) // if client had requested the call back
+                iWriteHandler->HandlePresenceWriteL(origStatus);
+            iAsyncReq = NRequest::ENoRequestMade;
+            break;
+
+        case NRequest::EPrepReadAllBuddiesPresenceInService:
+            HandlePreparedAllBuddiesPresenceL(origStatus);
+            iAsyncReq = NRequest::ENoRequestMade;
+            break;
+        
+        case NRequest::ENoRequestMade:
+        default:
+            break;
+        }   
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceCacheClient::DoCancel()
+// ---------------------------------------------------------------------------
+//
+void CPresenceCacheClient::DoCancel()
+    {
+    iAsyncReq = NRequest::ENoRequestMade;
+    iReadHandler = NULL;
+    iWriteHandler = NULL;
+    SendReceive( NRequest::ECancelAsyncOperation);
+    SendReceive( NRequest::ECancelWaitingForNotification);
+    }
+    
+// ---------------------------------------------------------------------------
+// CPresenceCacheClient::PackBuddyPresenceInfoLC()
+// ---------------------------------------------------------------------------
+//
+HBufC8* CPresenceCacheClient::PackBuddyPresenceInfoLC(
+                                    const MPresenceBuddyInfo* aBuddyPresInfo)
+    {
+    HBufC8* pack(NULL);
+    if(aBuddyPresInfo)
+        {
+        const CPresenceBuddyInfoImp* pifImp = 
+            TXIMPGetImpClassOrPanic< const CPresenceBuddyInfoImp >::From( *aBuddyPresInfo );    
+        
+        pack = TXIMPObjectPacker< const CPresenceBuddyInfoImp>::PackL( *pifImp );
+        CleanupStack::PushL( pack );
+        }
+
+    return pack;
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceCacheClient::PackPresenceBuddyListLC()
+// ---------------------------------------------------------------------------
+//
+HBufC8* CPresenceCacheClient::PackPresenceBuddyListLC(const MPresenceBuddyInfoList* aList)
+    {
+    HBufC8* pack(NULL);
+    if(aList)
+        {
+        const CPresenceBuddyInfoListImp* pifImp = 
+            TXIMPGetImpClassOrPanic< const CPresenceBuddyInfoListImp >::From( *aList );    
+        
+        pack = TXIMPObjectPacker< CPresenceBuddyInfoListImp>::PackL(*pifImp);
+        CleanupStack::PushL( pack );
+        }
+    return pack;
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceCacheClient::PackIdentityLC()
+// ---------------------------------------------------------------------------
+//
+HBufC8* CPresenceCacheClient::PackIdentityLC(const MXIMPIdentity& aIdentity)
+    {
+    HBufC8* pack(NULL);
+    
+    const CXIMPIdentityImp* pifImp = 
+        TXIMPGetImpClassOrPanic< const CXIMPIdentityImp >::From(aIdentity);    
+    
+    pack = TXIMPObjectPacker< CXIMPIdentityImp>::PackL( *pifImp );
+    CleanupStack::PushL( pack );
+
+    return pack;
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceCacheClient::UnPackServicesLC()
+// ---------------------------------------------------------------------------
+//
+/*
+CDesCArray* CPresenceCacheClient::UnPackServicesLC(TDesC8& aServicesBuffer)
+	{
+    CArrayFixFlat<TUid>* services = new (ELeave) CArrayFixFlat<TUid>(1);
+    CleanupStack::PushL(services);
+    
+    RDesReadStream rs;
+    CleanupClosePushL( rs );
+    rs.Open( aServicesBuffer ); // CSI: 65 #
+
+    // read the object count
+    TInt objCount( rs.ReadInt32L() );
+    TUid service;
+
+	for ( TInt count = 0; count < objCount; count++ )
+        {
+        rs>>service;
+		services->AppendL(service);
+		}
+
+    CleanupStack::PopAndDestroy(); // rs
+    return services;
+	}*/
+    
+// end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresencecache/presencecacheclient/presencecacheclient.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,279 @@
+/*
+* Copyright (c) 2007, 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:  Implementation for presence cache reader and writer.
+*
+*/
+
+#ifndef PRESENCECACHECLIENT_H
+#define PRESENCECACHECLIENT_H
+
+#include <presencecachereader.h>
+#include <presencecachewriter.h>
+
+#include "presencecachedefs.h"
+#include "presenceapiobjbase.h"
+
+
+class MPresenceInfo;
+class MPersonPresenceInfo;
+class MPresenceInfoField;
+class MPresenceBuddyInfo;
+class MPresCacheWriteHandler;
+class MPresCacheReadHandler;
+class MXIMPIdentity;
+class MPresenceBuddyInfoList;
+class MPresenceObjectFactory;
+class CPresenceObjectFactoryImp;
+
+class CPresenceCacheClientNotification;
+
+//Include Cache server namespace
+using namespace NCacheSrv;
+
+/**
+ * Implementation for presence cache reader and writer. This object is 
+ * instantiated either by MPresenceCacheReader or MPresenceCacheWriter using ecom framework.
+ * Apart from implementing these two objects, this is also a Symbian OS client and
+ * it communicates with presence cache server. Its also an active object.
+ *
+ * @ingroup ximpprescacheapi
+ * @since S60 v3.2
+ */
+class CPresenceCacheClient : public CActive,
+														 public MPresenceCacheReader,
+                             public MPresenceCacheWriter,
+                             public RSessionBase
+                             
+    {
+public:
+
+    /** The class ID. */
+    enum { KClassId = PRIMP_CLSID_CPRESENCECACHECLIENT };
+
+
+public:
+
+    /**
+     * Factory method to instantiate CPresenceCacheClient through the ECom. 
+     *
+     * @return The new CPresenceCacheClient object. Object
+     *         ownership is returned to caller.
+     */
+    IMPORT_C static CPresenceCacheClient* NewL();
+    
+    /**
+     * Factory method to instantiate CPresenceCacheClient through the ECom.
+     * It's returns MPresenceCacheReader
+     *
+     * @return The new CPresenceCacheClient object. Object
+     *         ownership is returned to caller.
+     */
+    IMPORT_C static MPresenceCacheReader* CreateReaderL();
+    
+    /**
+     * Factory method to instantiate CPresenceCacheClient through the ECom.
+     * It's returns MPresenceCacheWriter
+     *
+     * @return The new CPresenceCacheClient object. Object
+     *         ownership is returned to caller.
+     */
+    IMPORT_C static MPresenceCacheWriter* CreateWriterL();
+
+    /**
+     * Public destructor.
+     * Objects can be deleted through this interface.
+     */
+    virtual ~CPresenceCacheClient();
+    
+    /**
+    * Start the server
+    * @return TInt Error code
+    */
+    TInt StartServer();
+    
+    /**
+    * Version.
+    * Gets the version number.
+    * @return The version.
+    */
+    TVersion Version() const;
+        
+        
+private:
+
+    /**
+    * C++ constructor
+    */
+    CPresenceCacheClient();
+    
+    /**
+    * Symbian second phase constructor
+    */
+    void ConstructL();
+    
+    /**
+    * Connect.
+    * Connects to the server and create a session.
+    * @return Error code.
+    */
+    TInt Connect();
+    
+    /**
+    * Packs MPresenceBuddyInfo object into a buffer
+    * 
+    * @param aBuddyPresInfo, MPresenceBuddyInfo
+    * @return HBufC8* buffer
+    */
+    HBufC8* PackBuddyPresenceInfoLC(const MPresenceBuddyInfo* aBuddyPresInfo);
+    
+    /**
+    * Packs MPresenceBuddyInfoList object into a buffer
+    * 
+    * @param aList, MPresenceBuddyInfoList
+    * @return HBufC8* buffer
+    */
+    HBufC8* PackPresenceBuddyListLC(const MPresenceBuddyInfoList* aList);
+    
+    /**
+    * Packs MXIMPIdentity object into a buffer
+    * 
+    * @param MXIMPIdentity, aIdentity
+    * @return HBufC8* buffer
+    */
+    HBufC8* PackIdentityLC(const MXIMPIdentity& aIdentity);
+    
+    /**
+    * Handle asynchronous call from server that buddies presence have been prepared.
+    * This function does further processing and calls the client.
+    * 
+    * @param aError, Error came from server.
+    */
+    void HandlePreparedAllBuddiesPresenceL(TInt aError);
+    
+    /**
+    * Return true if given identity is valid xsp identity
+    * 
+    * @param ETrue if valid xsp identity
+    */
+    TBool ValidateXspId(const TDesC& aXspId);
+    
+    
+    /**
+     * Internalize the services packet from given buffer
+     * 
+     * @param aServicesBuffer, services buffer recieved from server.
+     */
+    //CDesCArray* UnPackServicesLC(TDesC8& aServicesBuffer);
+    
+
+public: //From MPresenceCacheReader and MPresenceCacheWriter
+    
+    MXIMPIdentity* NewIdentityLC();
+      
+public: //From MPresenceCacheReader
+
+
+    MPresenceInfo* PresenceInfoLC(const MXIMPIdentity& aIdentity);
+    
+    TInt BuddyCountInAllServices();
+    
+    TInt BuddyCountInService(const TDesC& aServiceName);
+    
+    TInt ServicesCount();
+    
+    //CDesCArray* ServicesLC();
+    
+    TInt CancelRead();                                        
+                                                
+    TInt SubscribePresenceBuddyChangeL(const MXIMPIdentity& aIdentity);
+                                                
+    void UnSubscribePresenceBuddyChangeL(const MXIMPIdentity& aIdentity);                             
+                                                
+
+public: //From MPresenceCacheReader, Asynchronous methods
+
+    TInt AllBuddiesPresenceInService(const TDesC& aServiceName, 
+                                        MPresCacheReadHandler* aHandler);
+
+    TInt SetObserverForSubscribedNotifications(
+                        MPresCacheReadHandler* aHandler);                             
+
+public: //From MPresenceCacheWriter
+
+    TInt WritePresenceL(const MPresenceBuddyInfo* aPresenceBuddyInfo);
+    
+    TInt DeleteService(const TDesC& aServiceName);
+    
+    TInt DeletePresenceL(const MXIMPIdentity& aIdentity);
+    
+    MPresenceObjectFactory& PresenceObjectFactory() const;
+    
+    MPresenceInfo* NewPresenceInfoLC();
+    
+    MPresenceBuddyInfo* NewBuddyPresenceInfoLC();
+    
+    MPresenceBuddyInfoList* NewPresenceBuddyInfoListLC(const TDesC& aServiceName);
+    
+    TInt CancelWrite();
+    
+
+public: //From MPresenceCacheWriter, Asynchronous methods
+
+    TInt WritePresenceL(const MPresenceBuddyInfoList* aPresenceBuddyInfos,
+                                    MPresCacheWriteHandler* aHandler);
+                                    
+public:  //Froom CActive
+
+    void RunL();
+
+    void DoCancel();
+    
+private: // Data
+    
+    //Not Owned
+    MPresCacheWriteHandler* iWriteHandler;
+    
+    //Not Owned
+    MPresCacheReadHandler* iReadHandler;
+    
+    //To store async request status
+    NRequest::TOpAsyncCodes iAsyncReq;
+    
+    /**
+     * Object factory sub interface.
+     */
+    CPresenceObjectFactoryImp* iPresObjFactory;   
+    
+    /**
+     * Client who subscribed cache notifications
+     * NOT OWN
+     */
+    MPresCacheReadHandler* iNotifyClient;   
+    
+    /**
+     * Handler for subscribed cache notifications
+     * OWN
+     */    
+    CPresenceCacheClientNotification* iNotifyHandler;
+    
+private: // friend classes
+
+	friend class CPresenceCacheClientNotification;
+
+    };
+
+#endif // PRESENCECACHECLIENT_H
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresencecache/presencecacheclient/presencecacheclientnotification.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,213 @@
+/*
+* 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:  Implementation for presence cache client.
+*
+*/
+
+#include <e32std.h>
+
+#include <prescachereadhandler.h>
+
+#include "presencecacheclientnotification.h"
+#include "presencecachedefs.h"
+#include "ximpobjecthelpers.h"
+#include "presenceinfoimp.h"
+#include "presencebuddyinfoimp.h"
+#include "personpresenceinfoimp.h"
+
+// ============================ MEMBER FUNCTIONS =============================
+
+// ---------------------------------------------------------------------------
+// CPresenceCacheClientNotification::NewL
+// ---------------------------------------------------------------------------
+//
+CPresenceCacheClientNotification* CPresenceCacheClientNotification::NewL(
+    CPresenceCacheClient& aClient)
+    {
+    CPresenceCacheClientNotification* self = new(ELeave)CPresenceCacheClientNotification(aClient);
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+    return self;    
+    }
+    
+// ---------------------------------------------------------------------------
+// CPresenceCacheClientNotification::~CPresenceCacheClientNotification
+// ---------------------------------------------------------------------------
+//
+CPresenceCacheClientNotification::~CPresenceCacheClientNotification()
+    {
+    Cancel();
+    }
+    
+// ---------------------------------------------------------------------------
+// CPresenceCacheClientNotification::CPresenceCacheClientNotification
+// ---------------------------------------------------------------------------
+//
+CPresenceCacheClientNotification::CPresenceCacheClientNotification(CPresenceCacheClient& aClient)
+: CActive( EPriorityStandard ), iClient( aClient ), iNotificationSubscribed( EFalse )
+    {        
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceCacheClientNotification::ConstructL
+// ---------------------------------------------------------------------------
+//
+void CPresenceCacheClientNotification::ConstructL()
+    {
+    CActiveScheduler::Add( this );   
+    }
+    
+// ---------------------------------------------------------------------------
+// CPresenceCacheClientNotification::RunL
+// ---------------------------------------------------------------------------
+//
+void CPresenceCacheClientNotification::RunL()
+    {    
+    TInt origStatus = iStatus.Int();
+    
+    MPresCacheReadHandler* client = ClientNotifyHandler();    
+    
+    if ( origStatus )
+        {
+        iNotificationSubscribed = EFalse;        
+        TRAP_IGNORE( client->HandlePresenceNotificationL( origStatus, NULL ));
+        }
+    else
+        {
+        StartNotifySubscription();        
+        PreseneceFromServerToClientL( *client, iSizePckg() );
+        }              
+    }
+// ----------------------------------------------------------
+// CPresenceCacheClientNotification::RunError
+// ----------------------------------------------------------
+//
+TInt CPresenceCacheClientNotification::RunError( TInt aError )
+    {         
+    if ( KErrServerTerminated == aError )
+        {
+        // When server is terminated we notify the clienrt about that
+        iNotificationSubscribed = EFalse;         
+        MPresCacheReadHandler* client = ClientNotifyHandler();
+        TRAP_IGNORE( client->HandlePresenceNotificationL( aError, NULL ));        
+        }
+    else
+        {
+        // StartNotifySubscription is already called.
+        }
+    return KErrNone;    
+    } 
+
+// ---------------------------------------------------------------------------
+// CPresenceCacheClientNotification::DoCancel
+// ---------------------------------------------------------------------------
+//
+void CPresenceCacheClientNotification::DoCancel()
+    {
+    // TODO: consider when this is safe
+    iClient.SendReceive( NRequest::ECancelWaitingForNotification );
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceCacheClientNotification::SubscribePresenceBuddyChangeL
+// ---------------------------------------------------------------------------
+//    
+TInt CPresenceCacheClientNotification::SubscribePresenceBuddyChangeL(
+	const MXIMPIdentity& aIdentity)
+    {       
+    if ( !iNotificationSubscribed )
+        {
+        StartNotifySubscription();
+        }
+    
+    HBufC8* myIdPack = iClient.PackIdentityLC(aIdentity);                
+                      
+    // Package message arguments before sending to the server
+    TIpcArgs args;
+    args.Set(1, myIdPack);  
+        
+    TInt err = iClient.SendReceive( NRequest::ESubscribeBuddyPresenceChange, args ); 
+    CleanupStack::PopAndDestroy( myIdPack );    
+        
+    return err;
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceCacheClientNotification::UnsubscribePresenceBuddyChangeL
+// ---------------------------------------------------------------------------
+//    
+void CPresenceCacheClientNotification::UnsubscribePresenceBuddyChangeL(
+	const MXIMPIdentity& aIdentity)
+    {           
+    HBufC8* myIdPack = iClient.PackIdentityLC(aIdentity);                
+                      
+    // Package message arguments before sending to the server
+    TIpcArgs args;
+    args.Set(1, myIdPack);  
+        
+    TInt err = iClient.SendReceive( NRequest::EUnSubscribeBuddyPresenceChange, args );        
+    CleanupStack::PopAndDestroy( myIdPack );
+    User::LeaveIfError( err );
+    }
+ 
+// ---------------------------------------------------------------------------
+// CPresenceCacheClientNotification::StartNotifySubscriptionL
+// ---------------------------------------------------------------------------
+//    
+void CPresenceCacheClientNotification::StartNotifySubscription()
+    {                                    
+    // Package message arguments before sending to the server
+    SetActive();
+    TIpcArgs args(&iSizePckg);            
+    iClient.SendReceive( NRequest::EWaitingForNotification, args, iStatus );
+    iNotificationSubscribed = ETrue;
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceCacheClientNotification::ClientNotifyHandler
+// ---------------------------------------------------------------------------
+//    
+MPresCacheReadHandler* CPresenceCacheClientNotification::ClientNotifyHandler()
+    {
+	return iClient.iNotifyClient;
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceCacheClientNotification::PreseneceFromServerToClientL
+// ---------------------------------------------------------------------------
+//    
+void CPresenceCacheClientNotification::PreseneceFromServerToClientL( 
+    MPresCacheReadHandler& aClient, TInt aSize )
+    {       
+    CPresenceBuddyInfoImp* buddyInfo(NULL);
+    buddyInfo = CPresenceBuddyInfoImp::NewLC();
+    HBufC8* presInfoDes = HBufC8::NewLC( aSize );
+    TPtr8 ptrBuf( presInfoDes->Des() );
+    TInt err = iClient.SendReceive( NRequest::EGetLastNotifiedtPacket, TIpcArgs( &ptrBuf ));    
+    if ( !err )
+        {
+        TXIMPObjectPacker< CPresenceBuddyInfoImp >::UnPackL( *buddyInfo, *presInfoDes );
+        CleanupStack::PopAndDestroy( presInfoDes );                          
+        aClient.HandlePresenceNotificationL( KErrNone, buddyInfo );
+        CleanupStack::Pop( buddyInfo );         
+        }
+    else
+        {
+        CleanupStack::PopAndDestroy( presInfoDes );         
+        CleanupStack::PopAndDestroy( buddyInfo );          
+        }
+    }
+
+// end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresencecache/presencecacheclient/presencecacheclientnotification.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,125 @@
+/*
+* 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:  Implementation for presence cache reader notification handling
+*
+*/
+
+#ifndef PRESENCECACHECLIENTNOTIFICATION_H
+#define PRESENCECACHECLIENTNOTIFICATION_H
+
+#include "presencecacheclient.h"
+
+#include "presencecachedefs.h"
+#include "presenceapiobjbase.h"
+
+
+/**
+ * Implementation for presence cache reader notification. This object is 
+ * instantiated by CPresenceCacheClient. This class handles client-server
+ * messaging for notifications.
+ *
+ * @ingroup ximpprescacheapi
+ * @since S60 v5.0
+ */
+ NONSHARABLE_CLASS( CPresenceCacheClientNotification ) : public CActive
+    {
+
+public:
+
+        /**
+        * Two-phased constructor.
+        * @param aClient presence cache client
+        */
+        static CPresenceCacheClientNotification* NewL( CPresenceCacheClient& aClient );
+        
+        /**
+        * Destructor.
+        */
+        virtual ~CPresenceCacheClientNotification();
+        
+        /**
+         * Subscribe for given presence buddy's change in presence. 
+         *
+         * @param aIdentity buddy id, in xsp format
+         * @return KErrNone if successful, KErrArgument if observer not set
+         * @leave Only in system error cases e.g. if failed to allocate memory.
+         */
+        TInt SubscribePresenceBuddyChangeL(const MXIMPIdentity& aIdentity);   
+        
+        /**
+         * Unsubscribe for given presence buddy's change in presence. 
+         *
+         * @param aIdentity buddy id, in xsp format
+         * @leave Only in system error cases e.g. if failed to allocate memory.
+         */
+        void UnsubscribePresenceBuddyChangeL(const MXIMPIdentity& aIdentity);          
+        
+private:
+
+    /**
+    * C++ constructor
+    */
+    CPresenceCacheClientNotification( CPresenceCacheClient& aClient );
+    
+    /**
+    * Symbian second phase constructor
+    */
+    void ConstructL();
+    
+    void StartNotifySubscription();
+    
+    /**
+     * Client callback handler Accesor 
+     */
+    MPresCacheReadHandler* ClientNotifyHandler(); 
+    
+    /**
+     * Get presence from Cache server to a client observer
+     * @param aClient client callback observer
+     * @param aSize notification size
+     */
+    void PreseneceFromServerToClientL( MPresCacheReadHandler& aClient, TInt aSize );
+       
+                                       
+public:  //From CActive
+
+    void RunL();
+
+    void DoCancel();
+    
+    TInt RunError( TInt aError );
+    
+private: // Data
+    
+        /**
+         * presence cache client handling client-server messages
+         */
+        CPresenceCacheClient& iClient;
+                
+        /**
+         * Size of presence notification for client-sever messages
+         */
+        TPckgBuf<TInt> iSizePckg;  
+        
+        /**
+         * Whether the first notification subscription is done
+         */
+        TBool iNotificationSubscribed;
+        
+    };
+
+#endif // PRESENCECACHECLIENTNOTIFICATION_H
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresencecache/presencecacheecomhook/presencecacheecomhook.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,48 @@
+/*
+* 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:  XIMP Framework's Presence Cache reader and writer Hook implementation.
+*
+*/
+
+
+#include "presencedlluids.hrh"
+#include "presencecacheclient.h"
+#include <ecom/implementationproxy.h>
+#include <e32base.h>
+
+
+// ---------------------------------------------------------------------------
+// Key value pair table to identify correct constructor
+// function for the requested interface.
+// ---------------------------------------------------------------------------
+//
+const TImplementationProxy ImplementationTable[] =
+    {
+    IMPLEMENTATION_PROXY_ENTRY( XIMP_ECOM_IMPL_UID_PRESENCE_CACHE_READER,
+                                CPresenceCacheClient::CreateReaderL ),
+    IMPLEMENTATION_PROXY_ENTRY( XIMP_ECOM_IMPL_UID_PRESENCE_CACHE_WRITER,
+                                CPresenceCacheClient::CreateWriterL )
+    };
+
+
+// ---------------------------------------------------------------------------
+// Exported function to return the implementation proxy table
+// ---------------------------------------------------------------------------
+//
+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/ximpfw/presence/srcpresencecache/presencecacheecomhook/presencecacheecomhook.rss	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  ECom registery info for ECom hook
+*
+*/
+
+
+#include <ecom/registryinfov2.rh>
+#include "presencedlluids.hrh"
+#include <presencemanagementifids.hrh>
+
+// ---------------------------------------------------------------------------
+// ECom registery info for XIMP Presence Manager ECom hook
+// ---------------------------------------------------------------------------
+//
+RESOURCE REGISTRY_INFO theInfo
+    {
+    resource_format_version = RESOURCE_FORMAT_VERSION_2;
+    dll_uid = XIMP_DLL_UID_PRESENCE_CACHE_HOOK;
+    
+    // There are two interfaces which are invoking same implementation
+    // but with different uids to invoke different functions of CPresenceCacheClient.
+    interfaces =
+        {
+        // Presence Cache reader interface
+        INTERFACE_INFO
+            {
+            interface_uid = XIMP_ECOM_IF_UID_PRESENCE_CACHE_READER;
+            implementations =
+                {
+                IMPLEMENTATION_INFO
+                    {
+                    implementation_uid = XIMP_ECOM_IMPL_UID_PRESENCE_CACHE_READER;
+                    version_no         = 1;
+                    display_name       = "S60 Default XIMP CacheReader";
+                    default_data       = XIMP_ECOM_DEFAULT_DATA_PRESENCE_INTERFACE;
+                    opaque_data        = "";
+                    }
+                };
+            },
+        // Presence cache writer interface
+        INTERFACE_INFO
+            {
+            interface_uid = XIMP_ECOM_IF_UID_PRESENCE_CACHE_WRITER;
+            implementations =
+                {
+                IMPLEMENTATION_INFO
+                    {
+                    implementation_uid = XIMP_ECOM_IMPL_UID_PRESENCE_CACHE_WRITER;
+                    version_no         = 1;
+                    display_name       = "S60 Default XIMP CacheWriter";
+                    default_data       = XIMP_ECOM_DEFAULT_DATA_PRESENCE_INTERFACE;
+                    opaque_data        = "";
+                    }
+                };
+            }            
+        };
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresencecache/presencecacheserver/presencecachebuddystore.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,269 @@
+/*
+* 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:  Store object for single buddy in a service
+*
+*/
+
+
+#include "presencecachebuddystore.h"
+#include "presencecacheservicestore.h"
+#include "presencecachesession.h"
+#include "presencetypehelpers.h"
+#include "ximpidentityimp.h"
+#include "presencebuddyinfoimp.h"
+
+// ---------------------------------------------------------------------------
+// CPresenceCacheBuddyStore::NewLC()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CPresenceCacheBuddyStore* CPresenceCacheBuddyStore::NewLC(
+                                    CPresenceCacheServiceStore* aServiceStore,
+                                    MXIMPIdentity* aIdentity)
+    {
+    CPresenceCacheBuddyStore* self = new( ELeave ) CPresenceCacheBuddyStore(
+                                            aServiceStore);
+    CleanupStack::PushL( self );
+    self->ConstructL(aIdentity);
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceCacheBuddyStore::NewL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CPresenceCacheBuddyStore* CPresenceCacheBuddyStore::NewL(
+                                    CPresenceCacheServiceStore* aServiceStore,
+                                    MXIMPIdentity* aIdentity)
+    {
+    CPresenceCacheBuddyStore* self = NewLC(aServiceStore,aIdentity);
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceCacheBuddyStore::~CPresenceCacheBuddyStore()
+// ---------------------------------------------------------------------------
+//
+CPresenceCacheBuddyStore::~CPresenceCacheBuddyStore()
+    {
+    if (iPresenceBuddyInfo)
+        delete iPresenceBuddyInfo;
+    if(iIdentity)
+        delete iIdentity;
+    iSubscribedSessions.Close();
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceCacheBuddyStore::CPresenceCacheBuddyStore()
+// ---------------------------------------------------------------------------
+//
+CPresenceCacheBuddyStore::CPresenceCacheBuddyStore(
+          CPresenceCacheServiceStore* aServiceStore):iPresenceBuddyInfo(NULL),
+                                                    iServiceStore(aServiceStore)
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceCacheBuddyStore::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void CPresenceCacheBuddyStore::ConstructL(MXIMPIdentity* aIdentity)
+    {
+    if(aIdentity)
+        iIdentity = TXIMPGetImpClassOrPanic< CXIMPIdentityImp >::From( *aIdentity );
+    else
+        iIdentity = CXIMPIdentityImp::NewL();
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceCacheBuddyStore::SetPresenceBuddyInfo()
+// ---------------------------------------------------------------------------
+//
+void CPresenceCacheBuddyStore::SetPresenceBuddyInfo(MPresenceBuddyInfo* aPresBuddyInfo)
+    {
+    if(aPresBuddyInfo)
+        {
+        if (iPresenceBuddyInfo)
+            delete iPresenceBuddyInfo;
+        iPresenceBuddyInfo = aPresBuddyInfo;
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceCacheBuddyStore::RemovePresenceBuddyInfo()
+// ---------------------------------------------------------------------------
+//
+void CPresenceCacheBuddyStore::RemovePresenceBuddyInfo()
+    {
+    if (iPresenceBuddyInfo)
+        delete iPresenceBuddyInfo;
+    iPresenceBuddyInfo = NULL;
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceCacheBuddyStore::GetSubscribedSessions()
+// ---------------------------------------------------------------------------
+//
+RPointerArray<CPresenceCacheSession>& CPresenceCacheBuddyStore::GetSubscribedSessions()
+    {
+    return iSubscribedSessions;
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceCacheBuddyStore::AddSubscribedSession()
+// ---------------------------------------------------------------------------
+//
+void CPresenceCacheBuddyStore::AddSubscribedSession(CPresenceCacheSession* aSession)
+    {
+    if(iSubscribedSessions.Find(aSession)<0)
+        iSubscribedSessions.Append(aSession);
+    }
+    
+// ---------------------------------------------------------------------------
+// CPresenceCacheBuddyStore::RemoveSubscribedSession()
+// ---------------------------------------------------------------------------
+//
+void CPresenceCacheBuddyStore::RemoveSubscribedSession(CPresenceCacheSession* aSession)
+    {
+    TInt index = iSubscribedSessions.Find(aSession);
+    if(index>-1)
+        iSubscribedSessions.Remove(index);
+    
+    // delete this object if it doesnt have any presence or subscribers
+    if(!(iPresenceBuddyInfo || HasSubscribers()))
+        {
+        if(iServiceStore)
+            {
+            iServiceStore->RemoveBlind(this);
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceCacheBuddyStore::SetBuddyId()
+// ---------------------------------------------------------------------------
+//
+void CPresenceCacheBuddyStore::SetBuddyId(MXIMPIdentity* aIdentity)
+    {
+    if(aIdentity)
+        {
+        delete iIdentity;
+            iIdentity = TXIMPGetImpClassOrPanic< CXIMPIdentityImp >::From( *aIdentity );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceCacheBuddyStore::ServiceName()
+// ---------------------------------------------------------------------------
+//
+TPtrC CPresenceCacheBuddyStore::ServiceName() const
+    {
+    _LIT(KColon, ":");
+    TInt pos = iIdentity->Identity().Find(KColon);
+    TPtrC serviceName;
+    if(pos>0) // if colon found and there is something before colon, i.e. xsp id
+        {
+        serviceName.Set(iIdentity->Identity().Left(pos));
+        }
+    else
+        serviceName.Set(TPtrC());
+    return serviceName;
+    }
+    
+// ---------------------------------------------------------------------------
+// CPresenceCacheBuddyStore::PresenceBuddyInfo()
+// ---------------------------------------------------------------------------
+//
+MPresenceBuddyInfo* CPresenceCacheBuddyStore::PresenceBuddyInfo() const
+    {
+    return iPresenceBuddyInfo;
+    }
+    
+// ---------------------------------------------------------------------------
+// CPresenceCacheBuddyStore::BuddyId()
+// ---------------------------------------------------------------------------
+//
+const MXIMPIdentity* CPresenceCacheBuddyStore::BuddyId() const
+    {
+    return iIdentity;
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceCacheBuddyStore::EqualsIdentity()
+// ---------------------------------------------------------------------------
+//
+TBool CPresenceCacheBuddyStore::EqualsIdentity(
+                    const CPresenceCacheBuddyStore* aOtherInstance ) const
+    {
+    TBool ret(EFalse);
+    if(aOtherInstance)
+        {
+        const CXIMPIdentityImp* tmp = 
+            TXIMPGetImpClassOrPanic< const CXIMPIdentityImp >::From( *(aOtherInstance->BuddyId()));
+        ret = iIdentity->EqualsContent( *tmp);
+        }
+    return ret;
+    }
+    
+// ---------------------------------------------------------------------------
+// CPresenceCacheBuddyStore::EqualsIdentity()
+// ---------------------------------------------------------------------------
+//
+TBool CPresenceCacheBuddyStore::EqualsIdentity(
+                    const MPresenceBuddyInfo* aOtherInstance ) const
+    {
+    TBool ret(EFalse);
+    if(aOtherInstance)
+        {
+        const CXIMPIdentityImp* tmp = 
+            TXIMPGetImpClassOrPanic< const CXIMPIdentityImp >::From( *(aOtherInstance->BuddyId()));
+        ret = iIdentity->EqualsContent( *tmp);
+        }
+    return ret;
+    }
+    
+// ---------------------------------------------------------------------------
+// CPresenceCacheBuddyStore::EqualsIdentity()
+// ---------------------------------------------------------------------------
+//
+TBool CPresenceCacheBuddyStore::EqualsIdentity(
+                    const MXIMPIdentity& aOtherIdentity ) const
+    {
+    const CXIMPIdentityImp* tmp = 
+            TXIMPGetImpClassOrPanic< const CXIMPIdentityImp >::From(aOtherIdentity);
+    return iIdentity->EqualsContent( *tmp);
+    }
+    
+// ---------------------------------------------------------------------------
+// CPresenceCacheBuddyStore::HasPresence()
+// ---------------------------------------------------------------------------
+//
+TBool CPresenceCacheBuddyStore::HasPresence() const
+    {
+    if(iPresenceBuddyInfo)
+        return ETrue;
+    return EFalse;
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceCacheBuddyStore::HasSubscribers()
+// ---------------------------------------------------------------------------
+//
+TBool CPresenceCacheBuddyStore::HasSubscribers() const
+    {
+    if(iSubscribedSessions.Count())
+        return ETrue;
+    return EFalse;
+    }
+    
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresencecache/presencecacheserver/presencecachebuddystore.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,213 @@
+/*
+* 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:  Store object for single buddy in a service
+*
+*/
+
+#ifndef CXIMPPRESENCECACHEBUDDYSTORE_H
+#define CXIMPPRESENCECACHEBUDDYSTORE_H
+
+
+#include "presenceapiobjbase.h"
+#include "ximpapiobjbase.h"
+
+class MPresenceBuddyInfo;
+class CXIMPIdentityImp;
+class CPresenceCacheSession;
+class MXIMPIdentity;
+class CPresenceCacheServiceStore;
+
+/**
+ * CPresenceCacheBuddyStore. Used in Presence cache for presence storage. The 
+ * identity part is always exists in this class, subscribers and presence info
+ * are not guaranteed. However, if this object doesn't contain any subscribers 
+ * or presence info, it doesnt serve its purpose and should be deleted.
+ *
+ * @lib presencecacheserver.exe
+ * @since S60 v3.2
+ */
+class CPresenceCacheBuddyStore: public CBase
+    {
+
+public:
+
+    /**
+     * Symbian constructors and c++ destructor
+     *
+     * @param aServiceStore a parent store for this object
+     * @param aIdentity identity for this object, must be in xsp format
+     */
+    IMPORT_C static CPresenceCacheBuddyStore* NewLC(
+                                    CPresenceCacheServiceStore* aServiceStore,
+                                    MXIMPIdentity* aIdentity);
+    IMPORT_C static CPresenceCacheBuddyStore* NewL(
+                                    CPresenceCacheServiceStore* aServiceStore,
+                                    MXIMPIdentity* aIdentity);
+    virtual ~CPresenceCacheBuddyStore();
+
+private:
+
+    /**
+     * c++ constructor
+     *
+     * @param aServiceStore Parent service store for this object
+     */
+    CPresenceCacheBuddyStore(CPresenceCacheServiceStore* aServiceStore);
+    
+    /**
+     * Symbian second phase constructor
+     * @param aIdentity, uses this identity if not NULL, otherwise creates new
+     */
+    void ConstructL(MXIMPIdentity* aIdentity);
+
+
+public: 
+
+    /**
+    * Service name of this object, taken from xsp prefix of the indentity
+    *
+    * @return TPtrC service name of this object
+    */
+    TPtrC ServiceName() const;
+    
+    /**
+    * Sets the presnece info to this object. Takes ownership. It deletes
+    * any old presence info. Calling this function multiple times with
+    * different presence infos doesnt harm.
+    *
+    * @param aPresBuddyInfo buddy presence info to be set to this object
+    */
+    void SetPresenceBuddyInfo(MPresenceBuddyInfo* aPresBuddyInfo);
+    
+    /**
+    * Removes presence info from this object and set it to NULL.
+    */
+    void RemovePresenceBuddyInfo();
+    
+    /**
+    * Get the subscribed sessions pointer array. The array contains all those
+    * sessions which are currently subscribed to receive changes in this object.
+    *
+    * @return reference to RPointerArray<CPresenceCacheSession>
+    */
+    RPointerArray<CPresenceCacheSession>& GetSubscribedSessions();
+    
+    /**
+    * Add session to the list of subscribed sessions. It does not take ownership.
+    * ignores if session is already there.
+    *
+    * @param aSession to add in subscribed list
+    */
+    void AddSubscribedSession(CPresenceCacheSession* aSession);
+    
+    /**
+    * Remove session to the list of subscribed sessions. It does not take ownership.
+    * ignores if session is not found.
+    *
+    * @param aSession to remove from subscribed list
+    */
+    void RemoveSubscribedSession(CPresenceCacheSession* aSession);
+
+    /**
+    * Sets the identity to this object. Takes ownership. It deletes
+    * any old identity if present. Identity must be in xsp format.
+    *
+    * @param aIdentity identity to be set to this object
+    */
+    void SetBuddyId(MXIMPIdentity* aIdentity);
+                                
+    /**
+    * Gets presence info from this object.
+    *
+    * @return pointer to MPresenceBuddyInfo
+    */
+    MPresenceBuddyInfo* PresenceBuddyInfo() const;
+    
+    /**
+    * Gets identity from this object.
+    *
+    * @return constant pointer to MXIMPIdentity
+    */
+    const MXIMPIdentity* BuddyId() const;
+    
+    /**
+    * Matches this object's identity with that of given object. Return True if
+    * matches.
+    *
+    * @param aOtherInstance other CPresenceCacheBuddyStore
+    * @return ETrue if identity matches.
+    */
+    TBool EqualsIdentity(
+                    const CPresenceCacheBuddyStore* aOtherInstance ) const;
+                    
+    /**
+    * Matches this object's identity with that of given object. Return True if
+    * matches.
+    *
+    * @param aOtherInstance MPresenceBuddyInfo object
+    * @return ETrue if identity matches.
+    */
+    TBool EqualsIdentity(
+                        const MPresenceBuddyInfo* aOtherInstance ) const;
+                    
+    /**
+    * Matches this object's identity with that of given identity. Return True if
+    * matches.
+    *
+    * @param aOtherIdentity other identity object
+    * @return ETrue if identity matches.
+    */
+    TBool EqualsIdentity(
+                            const MXIMPIdentity& aOtherIdentity ) const;
+                    
+    /**
+    * Finds whether this object has any presence info.
+    *
+    * @return ETrue if this object contains any presence info.
+    */
+    TBool HasPresence() const;
+    
+    /**
+    * Finds whether this object has any subscribers.
+    *
+    * @return ETrue if this object has any subscriber(s).
+    */
+    TBool HasSubscribers() const;          
+
+private: // data
+
+     /**
+     * OWN: Contains presence info or NULL
+     */
+    MPresenceBuddyInfo* iPresenceBuddyInfo;
+
+    /**
+     * OWN: Contains identity
+     */
+    CXIMPIdentityImp* iIdentity;
+
+    /**
+    *OWN: Sessions which  are subscribed to receive change in this buddy's presence
+    */
+    RPointerArray<CPresenceCacheSession> iSubscribedSessions;
+    
+    /**
+    *Not Owned: Pointer to this object's service store
+    */
+    CPresenceCacheServiceStore* iServiceStore;
+    
+    };
+
+
+#endif // CXIMPPRESENCECACHEBUDDYSTORE_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresencecache/presencecacheserver/presencecachedefs.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,119 @@
+/*
+* 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:  Defines for Presence Cache.
+ *
+*/
+
+#ifndef PRESENCECACHEDEFS_H
+#define PRESENCECACHEDEFS_H
+
+#include <e32std.h>
+
+/*
+ * ============================================================================
+ * Presence cache constants
+ * ============================================================================
+ */
+namespace NCacheSrv
+    {
+    /**
+     * Cache server version numbers
+     */
+    namespace NVersion
+        {
+        const TInt KMajor = 1;
+        const TInt KMinor = 1;
+        const TInt KBuild = 1;
+        }
+        
+    namespace DataBase
+        {
+        const TInt KBuddyIdMaxLen = 100;
+            
+        }    
+
+
+    /**
+     * Cache server names
+     */
+    namespace NName
+        {
+        _LIT( KExecutable,      "presencecacheserver.exe" );
+        _LIT( KMainThread,      "PrCacheSrv" );
+        _LIT( KSymbianServer,   "!XIMPCacheSrv" );
+        _LIT( KServerPattern,   "*XIMP*" );
+        }
+
+    /**
+     * Cache server requests
+     */
+    namespace NRequest
+        {
+        //Number asynchronous message slots for Cache server
+        const TUint KMsgSlotCount = 4;
+
+        //Presence cache op synch. codes
+        enum TOpSyncCodes
+            {
+            EPrepReadPresenceInfoSync = 1,
+            EGetLastPreparedPacket,
+            EGetLastAsyncPreparedPacket,
+            EBuddyCountInAllServices,
+            EBuddyCountInService,
+            EDeleteService,
+            EDeletePresence,
+            //EPrepGetAllServices,
+            //EGetAllServices,
+            EGetServiceCount,
+            EWritePresenceInfoSync,
+            
+            //Subscription/Notification
+            ESubscribeBuddyPresenceChange, // 0:aService.iUid, 1:myIdPack
+            EUnSubscribeBuddyPresenceChange,// 0:aService.iUid, 1:myIdPack
+            EGetLastNotifiedtPacket, // 0:&ptrBuf
+            
+            }; //See the starting count in TOpAsyncCodes before adding here
+               //Total number should be less than that here
+            
+        //Presence cache op asynch. codes
+        enum TOpAsyncCodes
+            {
+            ENoRequestMade = 21,
+            EWritePresenceInfoAsync,
+            ECancelAsyncOperation,
+            EPrepReadAllBuddiesPresenceInService,
+            EPrepReadAllGivenBuddiesPresence,
+            
+            //Subscription/Notification related
+            EWaitingForNotification, // 0:&sizePckg
+            ECancelWaitingForNotification // 
+            
+            };
+        }
+        
+    /**
+     * Other constants
+     */
+    namespace NConstants
+        {
+        //Number buddy infos write in each cycle of runl
+        const TUint KMaxWriteEachCycle = 5;
+        const TUint KMaxReadEachCycle  = 5;
+        const TUint KMaxServicesCount  = 10;
+        const TUint KGranularity	   = 10;
+        }
+        
+    }
+
+#endif  //PRESENCECACHEDEFS_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresencecache/presencecacheserver/presencecacheserver.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,246 @@
+/*
+* 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:  Implementation for Presence Cache Server
+*
+*/
+
+
+// INCLUDE FILES
+#include <e32svr.h>
+#include <e32base.h>
+#include <e32std.h>
+#include <ecom.h>
+
+#include "presencecacheservicestore.h"
+#include "presencecacheserver.h"
+#include "presencecachesession.h"
+#include "presencecachedefs.h"
+#include "ximptrace.h"
+
+//Include Cache server namespace
+using namespace NCacheSrv;
+
+
+// -----------------------------------------------------------------------------
+// CPresenceCacheServer::NewLC()
+// -----------------------------------------------------------------------------
+//
+CPresenceCacheServer* CPresenceCacheServer::NewLC()
+    {
+    CPresenceCacheServer* self = new( ELeave ) CPresenceCacheServer(EPriorityNormal);
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CPresenceCacheServer::~CPresenceCacheServer()
+// -----------------------------------------------------------------------------
+//
+CPresenceCacheServer::~CPresenceCacheServer()
+    {
+    DoCancel();
+    TInt count = iPresenceCache.Count();
+    for (TInt i=0;i<count;i++)
+        {
+        delete iPresenceCache[i];
+        }
+    iPresenceCache.Close();
+    REComSession::FinalClose();
+    TRACE( _L("CPresenceCacheServer::~CPresenceCacheServer - end") );
+    }
+
+// -----------------------------------------------------------------------------
+// CPresenceCacheServer::IncrementSessions()
+// -----------------------------------------------------------------------------
+//
+void CPresenceCacheServer::IncrementSessions()
+    {
+    TRACE( _L("CPresenceCacheServer::IncrementSessions - start") );
+    iSessionCount++;        
+    iShutdown.Cancel();      
+    }
+
+// -----------------------------------------------------------------------------
+// CPresenceCacheServer::DecrementSessions()
+// -----------------------------------------------------------------------------
+//
+void CPresenceCacheServer::DecrementSessions()
+    {
+    TRACE( _L("CPresenceCacheServer::DecrementSessions - start") );
+    iSessionCount--;
+    if( iSessionCount == 0 )
+        {
+        iShutdown.Start();
+        }
+    }
+    
+// -----------------------------------------------------------------------------
+// CPresenceCacheServer::SessionExists()
+// -----------------------------------------------------------------------------
+//
+TBool CPresenceCacheServer::SessionExists(CPresenceCacheSession* aSession)
+    {
+    iSessionIter.SetToFirst();
+
+    // Check TID match
+    while ( iSessionIter )
+        {
+        CSession2* session = iSessionIter;
+        iSessionIter++;
+        if (((CPresenceCacheSession*)session)==aSession)
+            return ETrue;
+        }
+    return EFalse;
+    }
+
+// -----------------------------------------------------------------------------
+// CPresenceCacheServer::RunError()
+// -----------------------------------------------------------------------------
+//
+TInt CPresenceCacheServer::RunError( TInt aError )
+    {
+    TRACE_1( _L("CPresenceCacheServer::RunError [%d] - enter"), aError );
+    Message().Complete( aError );
+
+    // The leave will result in an early return from CServer::RunL(), skipping
+    // the call to request another message. So do that now in order to keep the
+    // server running.
+    ReStart();
+
+    return KErrNone;    // Handled the error fully    
+    }
+
+// -----------------------------------------------------------------------------
+// CPresenceCacheServer::CPresenceCacheServer()
+// -----------------------------------------------------------------------------
+//
+CPresenceCacheServer::CPresenceCacheServer( TInt aPriority )
+                                    : CServer2( aPriority )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CPresenceCacheServer::ConstructL()
+// -----------------------------------------------------------------------------
+//
+void CPresenceCacheServer::ConstructL()
+    {
+    iShutdown.ConstructL();
+	// ensure that the server still exits even if the 1st client fails to connect
+	iShutdown.Start();
+    }
+
+// -----------------------------------------------------------------------------
+// CPresenceCacheServer::NewSessionL()
+// -----------------------------------------------------------------------------
+//
+CSession2* CPresenceCacheServer::NewSessionL( const TVersion& aVersion, 
+                        const RMessage2& /*aMessage */) const
+    {
+    TRACE( _L("CPresenceCacheServer::NewSessionL - enter"));
+    TVersion srvVersion( NVersion::KMajor,
+                         NVersion::KMinor,
+                         NVersion::KBuild );
+
+    if( !User::QueryVersionSupported( aVersion, srvVersion ) )
+        {
+        User::Leave( KErrNotSupported );
+        }
+
+    CPresenceCacheServer* self = const_cast< CPresenceCacheServer* >( this );
+    CSession2* session = NULL;
+   
+    session = CPresenceCacheSession::NewL( *self );
+    TRACE( _L("CPresenceCacheServer::NewSessionL - end"));
+    return session;
+    }
+    
+// -----------------------------------------------------------------------------
+// CPresenceCacheServer::ExecuteL()
+// -----------------------------------------------------------------------------
+//
+void CPresenceCacheServer::ExecuteL()
+    {
+    TRACE( _L("CPresenceCacheServer::ExecuteL - enter"));
+    // start scheduler
+    CActiveScheduler* pA = new( ELeave )CActiveScheduler;
+    CleanupStack::PushL( pA );
+    CActiveScheduler::Install( pA );
+
+    // create server
+    CPresenceCacheServer* server = CPresenceCacheServer::NewLC();
+    server->StartL( NName::KSymbianServer );
+
+    //Signal client that we are started
+    RProcess().Rendezvous( KErrNone );
+
+    //Execute the server
+    CActiveScheduler::Start(); // CSI: 3 #
+
+    //Cleanup
+    CleanupStack::PopAndDestroy( server );//server
+    CleanupStack::PopAndDestroy( pA );
+    CActiveScheduler::Install( NULL );
+    TRACE( _L("CPresenceCacheServer::ExecuteL - end"));
+    }
+    
+// -----------------------------------------------------------------------------
+// E32Main()
+// Provides the API for the operating system to start the executable.
+// Returns the address of the function to be called.
+// -----------------------------------------------------------------------------
+//
+GLDEF_C TInt E32Main()
+    {
+    TRACE( _L("Cache E32Main - enter") );
+
+    __UHEAP_MARK;
+
+    User::RenameThread( NName::KMainThread );
+
+    CTrapCleanup* tc = CTrapCleanup::New();
+    if( !tc )
+        {
+        return KErrNoMemory;
+        }
+
+    TRAPD( err, CPresenceCacheServer::ExecuteL() );
+    delete tc;
+
+    __UHEAP_MARKEND;
+
+    TRACE_1( _L("Cache E32Main - exit: %d"), err );
+    return err;
+    }
+
+// -----------------------------------------------------------------------------
+// CShutdown::RunL()
+// -----------------------------------------------------------------------------
+//
+void CShutdown::RunL()
+    {
+    CActiveScheduler::Stop();
+	}    
+    
+inline CShutdown::CShutdown()
+	:CTimer(-1)
+	{CActiveScheduler::Add(this);}
+inline void CShutdown::ConstructL()
+	{CTimer::ConstructL();}
+inline void CShutdown::Start()
+	{After(KMyShutdownDelay);}    
+
+// End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresencecache/presencecacheserver/presencecacheserver.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,149 @@
+/*
+* Copyright (c) 2007, 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:  Header file for Presence Cache Server
+*
+*/
+
+
+#ifndef PRESENCECACHESERVER_H
+#define PRESENCECACHESERVER_H
+
+// INCLUDE FILES
+#include <e32base.h>
+
+class CPresenceCacheServiceStore;
+class CPresenceCacheSession;
+
+
+/**
+ * Shutdown timer class, to help us in delayed shutdown.
+ * @ingroup ximpprescacheserver
+ * @since S60 v3.2
+ */
+class CShutdown : public CTimer
+	{
+	enum {KMyShutdownDelay=0x200000};	// approx 2s
+public:
+	inline CShutdown();
+	inline void ConstructL();
+	inline void Start();
+private:
+    //Initiate server exit when the timer expires
+	void RunL();
+	};    
+
+
+/**
+ * Presence cache server class.
+ * @ingroup ximpprescacheserver
+ * @since S60 v3.2
+ */
+class CPresenceCacheServer : public CServer2
+    {
+    public : // Constructors and destructors
+
+        /**
+        * NewLC.
+        * Two-phased constructor.
+        * @return Pointer to created CPresenceCacheServer object.
+        */
+        static CPresenceCacheServer* NewLC();
+
+        /**
+        * ~CPresenceCacheServer.
+        * Execution and Destruction.
+        */
+        virtual ~CPresenceCacheServer();
+        static void ExecuteL();
+
+    public: // New functions
+
+        /**
+        * IncrementSessions.
+        * Increments the count of the active sessions for this server.
+        */
+        void IncrementSessions();
+
+        /**
+        * DecrementSessions.
+        * Decrements the count of the active sessions for this server.
+        * If no more sessions are in use the server terminates.
+        */
+        void DecrementSessions();
+        
+        /**
+        * Finds whether given session is alive or not.
+        *
+        * @param aSession to look for.
+        * @return ETrue if session is still alive
+        */
+        TBool SessionExists(CPresenceCacheSession* aSession);
+        
+
+    protected: // Functions from base classes
+
+        // From CActive
+        TInt RunError( TInt aError );
+
+    private: // Constructors and destructors
+
+        /**
+        * CPresenceCacheServer.
+        * C++ default constructor.
+        * @param aPriority priority for this thread.
+        */
+        CPresenceCacheServer( TInt aPriority );
+
+        /**
+        * ConstructL.
+        * 2nd phase constructor.
+        */
+        void ConstructL();
+
+    private: // Functions from base classes
+
+        /**
+        * From CServer, NewSessionL.
+        * Creates a cache server session.
+        * @param aVersion The client version.
+        * @param aMessage Message from client.
+        * @return Pointer to new session.
+        */
+        CSession2* NewSessionL( const TVersion& aVersion, 
+                                const RMessage2& aMessage ) const;
+
+    private: // Data
+
+        /**
+        * iSessionCount, the number of session owned by this server.
+        */
+        TInt iSessionCount;
+        
+        
+        CShutdown iShutdown;
+        
+    public: // testing only    
+        
+        /**
+        * OWN: Main Presence cache on server side. Used by all sessions. 
+        */
+        RPointerArray<CPresenceCacheServiceStore> iPresenceCache;
+        
+    };
+    
+
+#endif // PRESENCECACHESERVER_H
+
+// End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresencecache/presencecacheserver/presencecacheservicestore.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,320 @@
+/*
+* 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:  The cache stores a single array of this type. 
+*
+*/
+
+
+#include <s32strm.h>
+#include <ximpidentity.h>
+#include <presencebuddyinfo.h>
+
+#include "presencecacheservicestore.h"
+#include "presencecachebuddystore.h"
+#include "ximpidentityimp.h"
+#include "ximptrace.h"
+
+// ---------------------------------------------------------------------------
+// CPresenceCacheServiceStore::NewLC()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CPresenceCacheServiceStore* CPresenceCacheServiceStore::NewLC()
+    {
+    CPresenceCacheServiceStore* self = new( ELeave ) CPresenceCacheServiceStore;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceCacheServiceStore::NewL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CPresenceCacheServiceStore* CPresenceCacheServiceStore::NewL()
+    {
+    CPresenceCacheServiceStore* self = NewLC();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceCacheServiceStore::~CPresenceCacheServiceStore()
+// ---------------------------------------------------------------------------
+//
+CPresenceCacheServiceStore::~CPresenceCacheServiceStore()
+    {
+    TInt count = iBuddyStoreCollection.Count();
+    for (TInt i=0;i<count;i++)
+        {
+        delete iBuddyStoreCollection[i];
+        }
+    iBuddyStoreCollection.Close();
+    if(iServiceName)
+        delete iServiceName;
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceCacheServiceStore::CPresenceCacheServiceStore()
+// ---------------------------------------------------------------------------
+//
+CPresenceCacheServiceStore::CPresenceCacheServiceStore(): iServiceName(NULL)
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceCacheServiceStore::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void CPresenceCacheServiceStore::ConstructL()
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceCacheServiceStore::SetServiceNameL()
+// ---------------------------------------------------------------------------
+//
+void CPresenceCacheServiceStore::SetServiceNameL(TDesC& aServiceName)
+    {
+    if(iServiceName)
+        {
+        delete iServiceName;
+        iServiceName = NULL;
+        }
+    iServiceName = aServiceName.AllocL();
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceCacheServiceStore::GetObjectCollection()
+// ---------------------------------------------------------------------------
+//
+RPointerArray<CPresenceCacheBuddyStore>& CPresenceCacheServiceStore::GetObjectCollection()
+    {
+    return iBuddyStoreCollection;
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceCacheServiceStore::ServiceName()
+// ---------------------------------------------------------------------------
+//
+TPtrC CPresenceCacheServiceStore::ServiceName() const
+    {
+    return *iServiceName;
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceCacheServiceStore::Count()
+// ---------------------------------------------------------------------------
+//
+TInt CPresenceCacheServiceStore::Count() const
+    {
+    return iBuddyStoreCollection.Count();
+    }
+    
+// ---------------------------------------------------------------------------
+// CPresenceCacheServiceStore::PresenceCount()
+// ---------------------------------------------------------------------------
+//
+TInt CPresenceCacheServiceStore::PresenceCount() const
+    {
+    return iPresenceCount;
+    }
+    
+// ---------------------------------------------------------------------------
+// CPresenceCacheServiceStore::AddBlind()
+// ---------------------------------------------------------------------------
+//
+TInt CPresenceCacheServiceStore::AddBlind(CPresenceCacheBuddyStore* aBuddyStore)
+    {
+    TRACE( _L("CPresenceCacheServiceStore::AddBlind - begin") );
+    TRACE_1( _L("______identity: %S"), &(aBuddyStore->BuddyId()->Identity()));
+    
+    if(!aBuddyStore)
+        return KErrArgument;
+    
+    iBuddyStoreCollection.Append(aBuddyStore);
+    
+    // now update the presence count
+    if(aBuddyStore->HasPresence())
+        {
+        iPresenceCount++;        
+        }
+        
+    TRACE( _L("CPresenceCacheServiceStore::AddBlind - return"));
+    return KErrNone;
+    }
+    
+    
+// ---------------------------------------------------------------------------
+// CPresenceCacheServiceStore::AddOrReplacePresenceL()
+// ---------------------------------------------------------------------------
+//
+CPresenceCacheBuddyStore* CPresenceCacheServiceStore::AddOrReplacePresenceL
+                                            (MPresenceBuddyInfo* aBuddyPresInfo)
+    {
+    TRACE( _L("CPresenceCacheServiceStore::AddOrReplacePresence - begin") );
+    TRACE_1( _L("______identity: %S"), &(aBuddyPresInfo->BuddyId()->Identity()));
+    
+    
+    CPresenceCacheBuddyStore* newBuddyStore(NULL);
+    if(!aBuddyPresInfo)
+        return newBuddyStore;
+    
+    TBool oldPresExists(EFalse);
+    
+    TInt count = iBuddyStoreCollection.Count();
+    for(TInt i=0;i<count;i++)
+        {
+        if( (iBuddyStoreCollection[i])->EqualsIdentity(aBuddyPresInfo) )
+            {
+            oldPresExists = (iBuddyStoreCollection[i])->HasPresence();
+            iBuddyStoreCollection[i]->SetPresenceBuddyInfo(aBuddyPresInfo);
+            newBuddyStore = iBuddyStoreCollection[i];
+            TRACE( _L("_________Match found") );
+            break;
+            }
+        }
+    
+    //if not edited, we need to add a new buddy store    
+    if(!newBuddyStore)
+        {
+        MXIMPIdentity* id = CXIMPIdentityImp::NewLC(aBuddyPresInfo->BuddyId()->Identity());
+        newBuddyStore = CPresenceCacheBuddyStore::NewLC(this,id);
+        newBuddyStore->SetPresenceBuddyInfo(aBuddyPresInfo);
+        iBuddyStoreCollection.Append(newBuddyStore);
+        CleanupStack::Pop(newBuddyStore); //newBuddyStore
+        CleanupStack::Pop(1); //id
+        }
+        
+    // new presence is certainly added, check whether it was existed
+    if(!oldPresExists)
+        {
+        iPresenceCount++;        
+        }
+
+    TRACE( _L("CPresenceCacheServiceStore::AddOrReplacePresence - return"));
+    return newBuddyStore;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CPresenceCacheServiceStore::RemoveBlind()
+// ---------------------------------------------------------------------------
+//
+void CPresenceCacheServiceStore::RemoveBlind(CPresenceCacheBuddyStore* aPresenceBuddyInfo)
+    {
+    TInt index = iBuddyStoreCollection.Find(aPresenceBuddyInfo);
+    if(index>-1)
+        {
+        delete iBuddyStoreCollection[index];
+        iBuddyStoreCollection.Remove(index);
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceCacheServiceStore::FindAndRemove()
+// ---------------------------------------------------------------------------
+//
+CPresenceCacheBuddyStore* CPresenceCacheServiceStore::FindAndRemove
+                                    (const MXIMPIdentity& aIdentity, TInt& aErr)
+    {
+    TRACE( _L("CPresenceCacheServiceStore::FindAndRemove - begin") );
+    TRACE_1( _L("______identity: %S"), &(aIdentity.Identity()));
+    TBool oldPresExists(EFalse);
+    CPresenceCacheBuddyStore* buddyStore(NULL);
+    aErr = KErrNotFound;
+
+    TInt count = iBuddyStoreCollection.Count();
+    for(TInt i=0;i<count;i++)
+        {
+        if( (iBuddyStoreCollection[i])->EqualsIdentity(aIdentity) )
+            {
+            oldPresExists = (iBuddyStoreCollection[i])->HasPresence();
+            
+            //only delete presence if there are subscribers
+            if((iBuddyStoreCollection[i])->HasSubscribers())
+                {
+                (iBuddyStoreCollection[i])->SetPresenceBuddyInfo(NULL);
+                buddyStore = iBuddyStoreCollection[i];
+                }
+            else //if there are no subscribers remove the whole package
+                {
+                delete iBuddyStoreCollection[i];
+                iBuddyStoreCollection.Remove(i);                
+                }
+            break;
+            }
+        }
+    
+    // update presence info counts
+    if(oldPresExists)
+        {
+        iPresenceCount--;
+        aErr = KErrNone;      
+        }
+
+    TRACE_1( _L("CPresenceCacheServiceStore::FindAndRemove - buddyStore=%d"),buddyStore );
+    return buddyStore;
+    }
+    
+// ---------------------------------------------------------------------------
+// CPresenceCacheServiceStore::FindAndGet()
+// ---------------------------------------------------------------------------
+//
+CPresenceCacheBuddyStore* CPresenceCacheServiceStore::FindAndGet(
+                                     const MXIMPIdentity& aIdentity) const
+    {
+    TRACE( _L("CPresenceCacheServiceStore::FindAndGet - begin") );
+    TRACE_1( _L("______identity: %S"), &(aIdentity.Identity()));
+    CPresenceCacheBuddyStore* buddyStore(NULL);
+    
+    TInt count = iBuddyStoreCollection.Count();
+    for(TInt i=0;i<count;i++)
+        {
+        if( (iBuddyStoreCollection[i])->EqualsIdentity(aIdentity))
+            {
+            buddyStore = iBuddyStoreCollection[i];
+            break;
+            }
+        }
+    TRACE_1( _L("CPresenceCacheServiceStore::FindAndGet - buddyStore=%d"),buddyStore );    
+    return buddyStore;
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceCacheServiceStore::RemoveAllPresences()
+// ---------------------------------------------------------------------------
+//
+void CPresenceCacheServiceStore::RemoveAllPresences()
+    {
+    TRACE( _L("CPresenceCacheServiceStore::RemoveAllPresences - begin") );
+        
+    TInt count = iBuddyStoreCollection.Count();
+    TRACE_1( _L("______store collection count: %d"), count);
+    for(TInt i=0;i<count;i++)
+        {
+        (iBuddyStoreCollection[i])->RemovePresenceBuddyInfo();
+        //if it doesnt have subscribers delete this whole object
+        if(!(iBuddyStoreCollection[i]->HasSubscribers()))
+            {
+            delete iBuddyStoreCollection[i];
+            iBuddyStoreCollection.Remove(i);
+            count--;
+            i--;
+            }
+        }
+    iPresenceCount = 0;
+    TRACE(_L("CPresenceCacheServiceStore::RemoveAllPresences - end"));    
+    }
+
+// eof
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresencecache/presencecacheserver/presencecacheservicestore.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,183 @@
+/*
+* 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:  The cache stores a single array of this type. 
+*
+*/
+
+#ifndef CXIMPPRESENCECACHESERVICESTORE_H
+#define CXIMPPRESENCECACHESERVICESTORE_H
+
+class MXIMPIdentity;
+class MPresenceBuddyInfo;
+class CPresenceCacheBuddyStore;
+
+/**
+ * This class is used in presence cache store. The presence server has an array
+ * of this object, each object represents the buddies in a specific service name.
+ * This class contains an array of CPresenceCacheBuddyStore. The objects are
+ * identified by their Identities.
+ *
+ * @lib presencecacheserver.exe
+ * @since S60 v3.2
+ */
+class CPresenceCacheServiceStore: public CBase                                           
+    {
+
+public:
+
+    /**
+     * Symbian constructors and c++ destructor
+     */
+    IMPORT_C static CPresenceCacheServiceStore* NewLC();
+    IMPORT_C static CPresenceCacheServiceStore* NewL();
+    virtual ~CPresenceCacheServiceStore();
+
+private:
+
+    /**
+     * c++ constructor
+     */
+    CPresenceCacheServiceStore();
+    
+    /**
+     * Symbian second phase constructor
+     */
+    void ConstructL();
+
+public:
+
+    /**
+    * Get the buddy stores pointer array contained by this object.
+    * Those stores are owned by this object.
+    *
+    * @return reference to RPointerArray<CPresenceCacheSession>
+    */
+    RPointerArray<CPresenceCacheBuddyStore>& GetObjectCollection();
+    
+
+    /**
+    * Service name of this object
+    *
+    * @return TPtrC service name of this object
+    */
+    TPtrC ServiceName() const;
+    
+
+    /**
+    * Sets service name of this object
+    *
+    * @param aServiceName service name for this object
+    */
+    void SetServiceNameL(TDesC& aServiceName);
+    
+
+    /**
+    * Count of buddy stores in this object.
+    *
+    * @return TInt number of buddy stores in this object
+    */
+    TInt Count() const;
+    
+
+    /**
+    * Count of those buddy stores who has presence info.
+    *
+    * @return TInt number of buddy stores who has presence info
+    */
+    TInt PresenceCount() const;
+
+
+    /**
+    * Adds a buddy store object, without checking whether it exists or not.
+    * Identity of the given store must be set. 
+    * It takes ownership of given buddy store.
+    *
+    * @param aPresenceBuddyInfo buddy store to add or replace.
+    * @return TInt an error code
+    */
+    TInt AddBlind(CPresenceCacheBuddyStore* aPresenceBuddyInfo);
+    
+    /**
+    * Removes a buddy store object blindly. Unlike the other addition and removal
+    * functions this will not modify the iPresenceCount. This will also not delete
+    * the provided object. It's caller's responsiblity to delete it.
+    *
+    * @param aPresenceBuddyInfo buddy store to be removed
+    */
+    void RemoveBlind(CPresenceCacheBuddyStore* aPresenceBuddyInfo);
+
+    /**
+    * Adds of replaces a buddies presence info. If the buddy is found, then only
+    * presence info is updated, leaving subscribed sessions untouched. It is
+    * recommended to use when an update to an already existing buddy receives. 
+    * It takes ownership of given presence info.
+    *
+    * @param aBuddyPresInfo buddy presence info to add or replace.
+    * @return pointer to newly created or existing CPresenceCacheBuddyStore
+    */
+    CPresenceCacheBuddyStore* AddOrReplacePresenceL(MPresenceBuddyInfo* aBuddyPresInfo);
+    
+    
+    /**
+    * Finds removed the buddy store with given identity. If the buddy does not
+    * contain any subscribed sessions, this function removes the whole buddy store.
+    * But if there are subscribed sessions to this buddy, then it only removes
+    * presence from that buddy.
+    *
+    * @param aIdentity identity of the given buddy to be searched.
+    * @param aErr the error code is returned here.
+    * @return pointer to removed CPresenceCacheBuddyStore, returns NULL if the
+    *         buddy store is completely removed, or not found.
+    */
+    CPresenceCacheBuddyStore* FindAndRemove(const MXIMPIdentity& aIdentity, TInt& aErr);
+    
+    /**
+    * Finds and get the buddy store with given identity.
+    *
+    * @param aIdentity identity of the given buddy to be searched.
+    * @return pointer to found CPresenceCacheBuddyStore, returns NULL if the
+    *         buddy store is not found.
+    */
+    CPresenceCacheBuddyStore* FindAndGet(const MXIMPIdentity& aIdentity) const;
+    
+    /**
+    * Removes presence info from all buddy stores contained in this object.
+    * Notice that those buddy stores which doesnt have any subscribed sessions,
+    * would be completely removed.
+    */
+    void RemoveAllPresences();
+    
+private: // data
+
+
+    /**
+     * Array of owned CPresenceCacheBuddyStore pointers
+     */
+    RPointerArray< CPresenceCacheBuddyStore> iBuddyStoreCollection;
+
+    /**
+     * OWN: Service name for this object
+     */
+    HBufC* iServiceName;
+    
+    /**
+    * OWN: Count of buddy stores which contain valid presence info, because there
+    * can be objects whose presences are NULL
+    */
+    TInt iPresenceCount;
+    
+    };
+
+
+#endif // CXIMPPRESENCECACHESERVICESTORE_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresencecache/presencecacheserver/presencecachesession.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,1156 @@
+/*
+* Copyright (c) 2007, 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:  Impementation for Presence Cache Server session
+*
+*/
+
+
+// INCLUDE FILES
+#include <presenceobjectfactory.h>
+#include <personpresenceinfo.h>
+#include <presencebuddyinfo.h>
+#include <presencebuddyinfolist.h>
+#include <presenceinfofieldcollection.h>
+
+#include "presencecachesession.h"
+#include "presencecacheserver.h"
+#include "ximptrace.h"
+#include "ximpobjecthelpers.h"
+#include "presenceinfoimp.h"
+#include "presencebuddyinfolistimp.h"
+#include "presencebuddyinfoimp.h"
+#include "ximpidentityimp.h"
+
+#include "presencecacheservicestore.h"
+#include "presencecachebuddystore.h"
+
+//Include Cache server namespace
+using namespace NCacheSrv;
+
+
+// ---------------------------------------------------------------------------
+// CPresenceCacheSession::NewL()
+// ---------------------------------------------------------------------------
+//
+CPresenceCacheSession* CPresenceCacheSession::NewL( CPresenceCacheServer& aServer )
+    {
+    CPresenceCacheSession* self = CPresenceCacheSession::NewLC( aServer );
+    CleanupStack::Pop(self);
+    return self;    
+    }
+    
+// ---------------------------------------------------------------------------
+// CPresenceCacheSession::NewLC()
+// ---------------------------------------------------------------------------
+//
+CPresenceCacheSession* CPresenceCacheSession::NewLC( CPresenceCacheServer& aServer )
+    {
+    CPresenceCacheSession* self = new ( ELeave ) CPresenceCacheSession( aServer );
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    return self;    
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceCacheSession::~CPresenceCacheSession()
+// ---------------------------------------------------------------------------
+//
+CPresenceCacheSession::~CPresenceCacheSession()
+    {
+    if(iDataPack)
+        delete iDataPack;
+    if(iDataPackAsync)
+        delete iDataPackAsync;
+    if(iDataPackNotifier)
+        delete iDataPackNotifier;
+    if(iBuddypresInfoList)
+        delete iBuddypresInfoList;
+    if(iActiveHelper)
+        delete iActiveHelper;
+    iServer.DecrementSessions();
+    RemoveMySubscriptions(); // remove all subscriptions subscribed by this session
+    iSubscribedStores.Close();
+    TRACE_1( _L("CPresenceCacheSession[%d]::~CPresenceCacheSession()"), this );
+    }
+
+
+// ---------------------------------------------------------------------------
+// CPresenceCacheSession::ServiceL()
+// ---------------------------------------------------------------------------
+//
+void CPresenceCacheSession::ServiceL( const RMessage2& aMessage )
+    {
+    switch ( aMessage.Function() )
+        {
+        case NRequest::EPrepReadPresenceInfoSync:
+            HandlePrepReadPresenceInfoSyncL(aMessage);
+            break;
+            
+        case NRequest::EGetLastPreparedPacket:
+            HandleGetLastPreparedPacketL(aMessage);
+            break;
+            
+        case NRequest::EGetLastAsyncPreparedPacket:
+            HandleGetLastPreparedAsyncPacketL(aMessage);
+            break;
+            
+        case NRequest::EBuddyCountInAllServices:
+            HandleBuddyCountInAllServices(aMessage);
+            break;
+            
+        case NRequest::EBuddyCountInService:
+            HandleBuddyCountInService(aMessage);
+            break;
+            
+        case NRequest::EGetServiceCount:
+            HandleGetServiceCount(aMessage);
+            break;
+            
+        case NRequest::EDeleteService:
+            HandleDeleteService(aMessage);
+            break;
+            
+        case NRequest::EDeletePresence:
+            HandleDeletePresence(aMessage);
+            break;
+            
+        case NRequest::ECancelAsyncOperation:
+            HandleCancel(aMessage);
+            break;
+
+        case NRequest::EWritePresenceInfoSync:
+            HandleWritePresenceInfoSyncL(aMessage);
+            break;
+
+        case NRequest::EWritePresenceInfoAsync:
+            HandleWritePresenceInfoAsyncL(aMessage);
+            break;
+            
+        case NRequest::EPrepReadAllBuddiesPresenceInService:
+            HandlePrepReadAllBuddiesPresenceInService(aMessage);
+            break;
+            
+        case NRequest::ESubscribeBuddyPresenceChange:// 0:aService.iUid, 1:myIdPack
+            HandleSubscribeBuddyPresenceChange(aMessage);
+            break;
+        
+        case NRequest::EUnSubscribeBuddyPresenceChange: // 0:aService.iUid, 1:myIdPack
+            HandleUnSubscribeBuddyPresenceChange(aMessage);
+            break;
+        
+        case NRequest::EGetLastNotifiedtPacket: // 0:&ptrBuf
+            HandleGetLastNotifiedtPacketL(aMessage);
+            break;
+        
+        case NRequest::EWaitingForNotification: // 0:&sizePckg
+            HandleWaitingForNotification(aMessage);
+            break;
+        
+        case NRequest::ECancelWaitingForNotification:
+            HandleCancelWaitingForNotification(aMessage);
+            break;
+
+        default:
+        	TRACE( _L("CPresenceCacheSession::ServiceL - default"));
+            aMessage.Complete(KErrArgument);
+            break;
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceCacheSession::HandlePrepReadPresenceInfoSyncL()
+// ---------------------------------------------------------------------------
+//
+void CPresenceCacheSession::HandlePrepReadPresenceInfoSyncL( const RMessage2& aMessage )
+    {
+    TRACE( _L("CPresenceCacheSession::HandlePrepReadPresenceInfoSyncL - begin"));
+
+    TInt sizeOfReturnPacket(NULL);
+ 
+    // unpacking identity
+    const TInt pckSize = aMessage.GetDesLengthL(1);
+    HBufC8* idPack = HBufC8::NewLC( pckSize );
+    TPtr8 paramPckPtr = idPack->Des();
+    aMessage.ReadL( 1, paramPckPtr );
+    CXIMPIdentityImp* identity = CXIMPIdentityImp::NewLC();
+    TXIMPObjectPacker< CXIMPIdentityImp >::UnPackL(*identity, *idPack);
+    
+    TPtrC serviceName = GetServiceName(identity->Identity());
+    
+    // now processing
+    TInt serviceCount = iServer.iPresenceCache.Count();
+    MPresenceBuddyInfo* buddyPresenceInfo(NULL);
+    CPresenceCacheBuddyStore* buddyStore(NULL);
+    
+    TRACE_1( _L("_______serviceCount[%d]"), serviceCount);
+    
+    for(TInt i=0; i<serviceCount; i++)
+        {
+        if (serviceName == (iServer.iPresenceCache[i])->ServiceName())
+            {
+            buddyStore = (iServer.iPresenceCache[i])->FindAndGet(*identity);
+            if(buddyStore)
+                buddyPresenceInfo = buddyStore->PresenceBuddyInfo();
+            break;
+            }
+        }
+    
+    CleanupStack::PopAndDestroy(identity);
+    CleanupStack::PopAndDestroy(idPack);
+    
+    TInt err = KErrNotFound;
+    
+    TRACE_1( _L("_______buddyPresenceInfo[%d]"), buddyPresenceInfo);
+    if(buddyPresenceInfo) // if found
+        {
+        const CPresenceInfoImp* presInfo = 
+            TXIMPGetImpClassOrPanic< const CPresenceInfoImp >::From(*(buddyPresenceInfo->PresenceInfo()));
+        if(iDataPack)
+            delete iDataPack; iDataPack=NULL;
+        iDataPack = PackPresenceInfoLC(*presInfo);
+        CleanupStack::Pop(iDataPack);
+        sizeOfReturnPacket = (iDataPack->Des()).Size();
+        err = KErrNone;
+        }
+    
+    TPckgBuf<TInt> p(sizeOfReturnPacket);
+    aMessage.WriteL(2,p);            
+    aMessage.Complete(err);
+    TRACE( _L("CPresenceCacheSession::HandlePrepReadPresenceInfoSyncL - end"));
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceCacheSession::HandleGetLastPreparedPacketL()
+// ---------------------------------------------------------------------------
+//
+void CPresenceCacheSession::HandleGetLastPreparedPacketL( const RMessage2& aMessage )
+    {
+    TRACE( _L("CPresenceCacheSession::HandleGetLastPreparedPacketL() - begin"));
+    if(iDataPack)
+        aMessage.WriteL(0, *(iDataPack));
+    aMessage.Complete(KErrNone);   
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceCacheSession::HandleGetLastPreparedAsyncPacketL()
+// ---------------------------------------------------------------------------
+//
+void CPresenceCacheSession::HandleGetLastPreparedAsyncPacketL( const RMessage2& aMessage )
+    {
+    if(iDataPackAsync)
+        aMessage.WriteL(0, *(iDataPackAsync));
+    aMessage.Complete(KErrNone);   
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceCacheSession::HandleWritePresenceInfoSyncL()
+// ---------------------------------------------------------------------------
+//
+void CPresenceCacheSession::HandleWritePresenceInfoSyncL(const RMessage2& aMessage )
+    {
+    TRACE( _L("CPresenceCacheSession::HandleWritePresenceInfoSyncL - begin"));
+    TInt err(KErrNone);
+    const TInt pckSize = aMessage.GetDesLengthL(0);
+    if(iDataPack)
+        delete iDataPack; iDataPack=NULL;
+    iDataPack = HBufC8::NewL( pckSize );
+    TPtr8 paramPckPtr = iDataPack->Des();
+    aMessage.ReadL( 0, paramPckPtr );
+    
+    CPresenceBuddyInfoImp* buddypresenceInfo = CPresenceBuddyInfoImp::NewLC();
+   
+
+    TXIMPObjectPacker< CPresenceBuddyInfoImp >::UnPackL(*buddypresenceInfo, *iDataPack);
+    
+    err = TryWriteBuddyToCacheL(buddypresenceInfo);
+    
+    if(err==KErrNone) //ownership transferred    
+        CleanupStack::Pop(buddypresenceInfo);
+    else
+        CleanupStack::PopAndDestroy(buddypresenceInfo);    
+    aMessage.Complete(err);
+    TRACE( _L("CPresenceCacheSession::HandleWritePresenceInfoSyncL - end"));
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceCacheSession::HandlePrepReadAllBuddiesPresenceInService()
+// ---------------------------------------------------------------------------
+//
+void CPresenceCacheSession::HandlePrepReadAllBuddiesPresenceInService
+                                                        (const RMessage2& aMessage )
+    {
+    if(iActiveHelper->IsActive())
+        aMessage.Complete(KErrServerBusy);
+    else
+        {
+        iMessage = aMessage;
+        
+        iAsyncReq = NRequest::EPrepReadAllBuddiesPresenceInService;
+        iActiveHelper->Start();
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceCacheSession::ReadAllBuddiesPresenceInServiceL()
+// ---------------------------------------------------------------------------
+//
+void CPresenceCacheSession::ReadAllBuddiesPresenceInServiceL()
+    {
+    const TInt pckSize = iMessage.GetDesLengthL(0);
+    HBufC* serviceName = HBufC16::NewLC( pckSize );
+    TPtr16 paramPckPtr = serviceName->Des();
+    iMessage.ReadL( 0, paramPckPtr );
+    
+    TInt serviceCount = iServer.iPresenceCache.Count();
+    CPresenceCacheServiceStore* serviceStore(NULL);
+    CPresenceBuddyInfoListImp* buddyPresenceInfoList(NULL);
+    CPresenceCacheBuddyStore* buddyStore(NULL);
+    MPresenceBuddyInfo* presBuddyInfo(NULL);
+    TInt presCount(0);
+    TInt count(0);
+    
+    for(TInt i=0; i<serviceCount; i++)
+        {
+        serviceStore = iServer.iPresenceCache[i];
+        if (serviceName->Des() == serviceStore->ServiceName())
+            {
+            presCount = serviceStore->PresenceCount();
+            // if it has presences
+            if(presCount)
+                {
+                buddyPresenceInfoList = CPresenceBuddyInfoListImp::NewLC(*serviceName);
+                buddyPresenceInfoList->SetOwnObjects(EFalse);
+                count = serviceStore->Count();
+                for(TInt j=0; j<count; j++)
+                    {
+                    buddyStore = serviceStore->GetObjectCollection()[j];
+                    presBuddyInfo = buddyStore->PresenceBuddyInfo();
+                    if(presBuddyInfo)
+                        buddyPresenceInfoList->BlindAddL(presBuddyInfo);    
+                    }
+                }
+            break;
+            }
+        }
+    
+    TInt size(KErrNotFound); // this may also indicate error to client if negative
+    if(buddyPresenceInfoList) // if found
+        {
+        if(iDataPackAsync)
+            delete iDataPackAsync; iDataPackAsync = NULL;
+        iDataPackAsync = TXIMPObjectPacker< CPresenceBuddyInfoListImp>::PackL( *buddyPresenceInfoList);
+        size = (iDataPackAsync->Des()).Size();
+        CleanupStack::PopAndDestroy(buddyPresenceInfoList);
+        }
+    
+    CleanupStack::PopAndDestroy(serviceName);
+    iAsyncReq = NRequest::ENoRequestMade;
+    iMessage.Complete(size);
+    }
+    
+
+// ---------------------------------------------------------------------------
+// CPresenceCacheSession::TryWriteBuddyToCache()
+// ---------------------------------------------------------------------------
+//
+TInt CPresenceCacheSession::TryWriteBuddyToCacheL(MPresenceBuddyInfo* aBuddyPresInfo)
+    {
+    if(!aBuddyPresInfo)
+        return KErrArgument;
+    
+    TPtrC serviceName = GetServiceName(aBuddyPresInfo->BuddyId()->Identity());
+    TInt serviceCount = iServer.iPresenceCache.Count();
+    CPresenceCacheBuddyStore* buddyStore(NULL);
+    
+    for(TInt i=0; i<serviceCount; i++)
+        {
+        if (serviceName == (iServer.iPresenceCache[i])->ServiceName())
+            {
+            buddyStore = (iServer.iPresenceCache[i])->AddOrReplacePresenceL(aBuddyPresInfo);
+            break;
+            }
+        }
+    if(!buddyStore) // if not written
+        {
+        CPresenceCacheServiceStore* newServiceStore = CPresenceCacheServiceStore::NewLC();
+        newServiceStore->SetServiceNameL(serviceName);
+        buddyStore = newServiceStore->AddOrReplacePresenceL(aBuddyPresInfo);
+        (iServer.iPresenceCache).Append(newServiceStore); //ownership transferred
+        CleanupStack::Pop(newServiceStore);
+        }
+        
+    if(buddyStore) //  inform to subscribers
+        NotifyAllSubscribersL(buddyStore);
+        
+    return buddyStore ? KErrNone : KErrGeneral;
+    }
+    
+
+// ---------------------------------------------------------------------------
+// CPresenceCacheSession::HandleCancel()
+// ---------------------------------------------------------------------------
+//
+void CPresenceCacheSession::HandleCancel(const RMessage2& aMessage )
+    {
+    if (iActiveHelper->IsActive())
+        iActiveHelper->Cancel(); //see also iActiveHelper->DoCancel()
+    aMessage.Complete(KErrNotFound);
+    }
+    
+// ---------------------------------------------------------------------------
+// CPresenceCacheSession::HandleBuddyCountInAllServices()
+// ---------------------------------------------------------------------------
+//
+void CPresenceCacheSession::HandleBuddyCountInAllServices(const RMessage2& aMessage )
+    {
+    TRACE( _L("CPresenceCacheSession::HandleBuddyCountInAllServices - begin"));
+    TInt count(NULL);
+    TInt serviceCount = iServer.iPresenceCache.Count();
+    
+    for(TInt i=0; i<serviceCount; i++)
+        {
+        count = (count) + ((iServer.iPresenceCache[i])->PresenceCount());
+        }
+    
+    TPckgBuf<TInt> p(count);
+    aMessage.WriteL(0,p);               
+    aMessage.Complete(KErrNone);
+    TRACE( _L("CPresenceCacheSession::HandleBuddyCountInAllServices - end"));
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceCacheSession::HandleBuddyCountInService()
+// ---------------------------------------------------------------------------
+//
+void CPresenceCacheSession::HandleBuddyCountInService(const RMessage2& aMessage )
+    {
+    TInt count(NULL);
+    
+    const TInt pckSize = aMessage.GetDesLengthL(1);
+    HBufC* serviceName = HBufC16::NewLC( pckSize );
+    TPtr16 paramPckPtr = serviceName->Des();
+    aMessage.ReadL( 1, paramPckPtr );
+    
+    TInt serviceCount = iServer.iPresenceCache.Count();
+    TInt err(KErrNotFound);
+    
+    for(TInt i=0; i<serviceCount; i++)
+        {
+        if (serviceName->Des() == (iServer.iPresenceCache[i])->ServiceName())
+            {
+            count = ((iServer.iPresenceCache[i])->PresenceCount());
+            err = KErrNone;
+            break;
+            }
+        }
+    
+    CleanupStack::PopAndDestroy(serviceName);
+    TPckgBuf<TInt> p(count);
+    aMessage.WriteL(0,p);
+    aMessage.Complete(err);    
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceCacheSession::HandleDeleteService()
+// ---------------------------------------------------------------------------
+//
+void CPresenceCacheSession::HandleDeleteService(const RMessage2& aMessage )
+    {
+    TRACE( _L("CPresenceCacheSession::HandleDeleteService - begin"));
+    TInt err(KErrNotFound);
+    
+    const TInt pckSize = aMessage.GetDesLengthL(0);
+    HBufC* serviceName = HBufC16::NewLC( pckSize );
+    TPtr16 paramPckPtr = serviceName->Des();
+    aMessage.ReadL( 0, paramPckPtr );
+    
+    TInt serviceCount = iServer.iPresenceCache.Count();
+    TInt buddyCount(NULL);
+    
+    TRACE_1( _L("_______serviceCount[%d]"), serviceCount);
+    for(TInt i=0; i<serviceCount; i++)
+        {
+        if (serviceName->Des() == (iServer.iPresenceCache[i])->ServiceName())
+            {
+            (iServer.iPresenceCache[i])->RemoveAllPresences();
+            buddyCount = (iServer.iPresenceCache[i])->GetObjectCollection().Count();
+            TRACE_1( _L("_______buddyCountAfter[%d]"), buddyCount);
+            
+            //if there are no buddies left in this service delete this whole service
+            if(buddyCount==0)
+                {
+                delete iServer.iPresenceCache[i];
+                iServer.iPresenceCache.Remove(i);
+                }
+                
+            //inform all subscribers
+            for(TInt j=0;j<buddyCount;j++)
+                {
+                NotifyAllSubscribersL((iServer.iPresenceCache[i])->GetObjectCollection()[j]);
+                }
+            err = KErrNone;
+            break;
+            }
+        }
+    CleanupStack::PopAndDestroy(serviceName);
+    aMessage.Complete(err);
+    TRACE( _L("CPresenceCacheSession::HandleDeleteService - end"));
+    }
+    
+// ---------------------------------------------------------------------------
+// CPresenceCacheSession::HandleDeletePresence()
+// ---------------------------------------------------------------------------
+//
+void CPresenceCacheSession::HandleDeletePresence(const RMessage2& aMessage )
+    {
+    const TInt pckSize = aMessage.GetDesLengthL(0);
+    HBufC8* idPack = HBufC8::NewLC( pckSize );
+    TPtr8 paramPckPtr = idPack->Des();
+    aMessage.ReadL( 0, paramPckPtr );
+    TInt err(KErrNotFound);
+    TInt buddyCount(NULL);
+    
+    CXIMPIdentityImp* identity = CXIMPIdentityImp::NewLC();
+    
+    TXIMPObjectPacker< CXIMPIdentityImp >::UnPackL(*identity, *idPack);
+    
+    TPtrC serviceName = GetServiceName(identity->Identity());
+    
+    TInt serviceCount = iServer.iPresenceCache.Count();
+    
+    CPresenceCacheBuddyStore* buddyStore(NULL);
+    for(TInt i=0; i<serviceCount; i++)
+        {
+        if(((iServer.iPresenceCache[i])->ServiceName()) == serviceName)
+            {
+            buddyStore = (iServer.iPresenceCache[i])->FindAndRemove(*identity,err);
+            
+            buddyCount = (iServer.iPresenceCache[i])->GetObjectCollection().Count();
+            TRACE_1( _L("_______buddyCountAfter[%d]"), buddyCount);
+            
+            //if there are no buddies left in this service delete this whole service
+            if(buddyCount==0)
+                {
+                delete iServer.iPresenceCache[i];
+                iServer.iPresenceCache.Remove(i);
+                }
+            break;
+            }
+        }
+    
+    CleanupStack::PopAndDestroy(identity);
+    CleanupStack::PopAndDestroy(idPack);
+    aMessage.Complete(err);
+    
+    if(buddyStore) // if subscribers
+        NotifyAllSubscribersL(buddyStore);
+    }
+    
+
+// ---------------------------------------------------------------------------
+// CPresenceCacheSession::HandleGetServiceCount()
+// ---------------------------------------------------------------------------
+//
+void CPresenceCacheSession::HandleGetServiceCount(const RMessage2& aMessage )
+    {
+    // iLastServiceCount is also used for mem aloc by client before calling
+    // GetAllServices
+    TInt serviceCount = iServer.iPresenceCache.Count();
+    iLastServiceCount = 0;
+    TRACE_1( _L("CPresenceCacheSession::HandleGetServiceCount realcount[%d]- end"),serviceCount);
+    for(TInt i=0;i<serviceCount;i++)
+        {
+        if((iServer.iPresenceCache[i])->PresenceCount())
+            iLastServiceCount++;
+        }
+
+    TPckgBuf<TInt> p(iLastServiceCount);
+    aMessage.WriteL(0,p);
+    aMessage.Complete(KErrNone);
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceCacheSession::HandleGetAllServicesL()
+// ---------------------------------------------------------------------------
+//
+/*
+void CPresenceCacheSession::HandleGetAllServicesL(const RMessage2& aMessage )   
+    {
+    TInt serviceCount = iServer.iPresenceCache.Count();
+    TInt size(NULL);
+    
+    if(serviceCount)
+    	{
+        CArrayFixFlat<TUid>* services = new (ELeave) CArrayFixFlat<TUid>(1);
+        CleanupStack::PushL(services);
+    	
+    	for(TInt i=0; i<serviceCount; i++)
+	        {
+	        if((iServer.iPresenceCache[i])->PresenceCount())
+	            services->AppendL((iServer.iPresenceCache[i])->Service());
+	        }
+	    
+	    if (iDataPack)
+	        {
+	        delete iDataPack; iDataPack = NULL;
+	        }
+	    iDataPack = PackServicesL(services);
+	    CleanupStack::PopAndDestroy(services);
+	    size = (iDataPack->Des()).Size();
+    	}
+    aMessage.Complete(size);
+    }*/
+    
+// ---------------------------------------------------------------------------
+// CPresenceCacheSession::HandleWritePresenceInfoAsyncL()
+// ---------------------------------------------------------------------------
+//
+void CPresenceCacheSession::HandleWritePresenceInfoAsyncL(const RMessage2& aMessage )
+    {
+    if(iActiveHelper->IsActive())
+        {
+        aMessage.Complete(KErrServerBusy);
+        return;        
+        }
+    iMessage = aMessage;
+    
+    const TInt pckSize = aMessage.GetDesLengthL(0);
+    if(iDataPackAsync)
+        delete iDataPackAsync; iDataPackAsync = NULL;
+    iDataPackAsync = HBufC8::NewL( pckSize );
+    TPtr8 paramPckPtr = iDataPackAsync->Des();
+    aMessage.ReadL( 0, paramPckPtr );
+    
+    if(iBuddypresInfoList)
+        delete iBuddypresInfoList; iBuddypresInfoList = NULL;
+    iBuddypresInfoList = CPresenceBuddyInfoListImp::NewLC(KNullDesC);
+    CleanupStack::Pop(iBuddypresInfoList);
+    
+    TXIMPObjectPacker< CPresenceBuddyInfoListImp >::UnPackL(*iBuddypresInfoList, *iDataPackAsync);
+    
+    iAsyncReq = NRequest::EWritePresenceInfoAsync;
+    iActiveHelper->Start();
+    return;
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceCacheSession::WritePresenceInfoAsyncL()
+// ---------------------------------------------------------------------------
+//
+void CPresenceCacheSession::WritePresenceInfoAsyncL()
+    {
+    TInt err(KErrNone);
+    TInt thisTimeWrites(0);
+    if(!iBuddypresInfoList) // return if this function is wrongly called
+        return;
+    
+    // This routine reads data from iBuddypresInfoList and tries to write 
+    // data to cache on each runl cycle. It writes either KMaxWriteEachCycle 
+    // times, or upto data is finnished. After data is written KMaxWriteEachCycle
+    // times and still more data is left, it makes this class active so that this
+    // function is again called on next RunL.
+    while(iBuddypresInfoList->Count())
+        {
+        err = TryWriteBuddyToCacheL((iBuddypresInfoList->GetObjectCollection())[0]);
+        if(err==KErrNone) // if no erroe then pop the object from list
+            (iBuddypresInfoList->GetObjectCollection()).Remove(0);
+        else
+            break; // break in case of error
+        thisTimeWrites++;    
+        if(thisTimeWrites == NConstants::KMaxWriteEachCycle) // this times writes are over
+            {
+            if(iActiveHelper->IsActive())// unusual condition
+                {
+                err = KErrGeneral;
+                break;
+                }
+            iActiveHelper->Start();
+            return; // set for next time writing.
+            }
+       }
+    // if we able to come out of while loop either writing is complete or
+    // there was some error while writing, in both cases finnish writing
+    iAsyncReq = NRequest::ENoRequestMade;
+    iMessage.Complete(err);
+    return;
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceCacheSession::HandleSubscribeBuddyPresenceChange()
+// ---------------------------------------------------------------------------
+//
+void CPresenceCacheSession::HandleSubscribeBuddyPresenceChange
+                                                (const RMessage2& aMessage )
+    {
+    TRACE( _L("CPresenceCacheSession::HandleSubscribeBuddyPresenceChange - begin"));
+
+    // Extract info from message
+    const TInt pckSize = aMessage.GetDesLengthL(1);
+    HBufC8* idPack = HBufC8::NewLC( pckSize );
+    TPtr8 paramPckPtr = idPack->Des();
+    aMessage.ReadL( 1, paramPckPtr );
+    
+    CXIMPIdentityImp* identity = CXIMPIdentityImp::NewLC();
+    
+    TXIMPObjectPacker< CXIMPIdentityImp >::UnPackL(*identity, *idPack);
+    
+    TPtrC serviceName = GetServiceName(identity->Identity());
+    
+    CPresenceCacheBuddyStore* buddyStore(NULL);
+    CPresenceCacheServiceStore* serviceStore(NULL);
+    
+    TInt err(KErrGeneral); // there must not be error in this handler
+                           // but just for debug purpose
+    
+    
+    // now processing
+    TInt serviceCount = iServer.iPresenceCache.Count();
+
+    
+    TRACE_1( _L("_______serviceCount[%d]"), serviceCount);
+    
+    for(TInt i=0; i<serviceCount; i++)
+        {
+        if (serviceName == (iServer.iPresenceCache[i])->ServiceName())
+            {
+            serviceStore = iServer.iPresenceCache[i];
+            buddyStore = (iServer.iPresenceCache[i])->FindAndGet(*identity);
+            break;
+            }
+        }
+        
+    if(!buddyStore) // if buddy was not found, create and add it
+        {
+        if(!serviceStore) //if service was also not found, create it
+            {
+            serviceStore = CPresenceCacheServiceStore::NewLC();
+            serviceStore->SetServiceNameL(serviceName);
+            (iServer.iPresenceCache).Append(serviceStore); //ownership transferred
+            CleanupStack::Pop(serviceStore);  
+            }
+        buddyStore = CPresenceCacheBuddyStore::NewLC(serviceStore,identity);
+        err = serviceStore->AddBlind(buddyStore); //ownership transferred
+        CleanupStack::Pop(buddyStore);
+        CleanupStack::Pop(identity);
+        } 
+    else
+        CleanupStack::PopAndDestroy(identity); // since in this case ownership wasnt tranferred
+    
+    CleanupStack::PopAndDestroy(idPack);
+    
+    TRACE_1( _L("buddyStore[%d]"), buddyStore);
+    if(buddyStore) // must be there, just for double check
+        {
+        buddyStore->AddSubscribedSession(this);
+        if(iSubscribedStores.Find(buddyStore) < 0) //if session not already there
+            iSubscribedStores.Append(buddyStore);
+        err = KErrNone;
+        }
+    
+    aMessage.Complete(err); // there shouldnt be any errors
+    TRACE( _L("CPresenceCacheSession::HandleSubscribeBuddyPresenceChange - end"));
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceCacheSession::HandleUnSubscribeBuddyPresenceChange()
+// ---------------------------------------------------------------------------
+//
+void CPresenceCacheSession::HandleUnSubscribeBuddyPresenceChange
+                                                (const RMessage2& aMessage )
+    {
+    TRACE( _L("CPresenceCacheSession::HandleUnSubscribeBuddyPresenceChange - begin"));
+
+    // Extract info from message
+    const TInt pckSize = aMessage.GetDesLengthL(1);
+    HBufC8* idPack = HBufC8::NewLC( pckSize );
+    TPtr8 paramPckPtr = idPack->Des();
+    aMessage.ReadL( 1, paramPckPtr );
+    TInt err(KErrNotFound);
+    
+    CXIMPIdentityImp* identity = CXIMPIdentityImp::NewLC();
+    
+    TXIMPObjectPacker< CXIMPIdentityImp >::UnPackL(*identity, *idPack);
+    
+    TPtrC serviceName = GetServiceName(identity->Identity());
+    
+    
+    // now processing
+    TInt serviceCount = iServer.iPresenceCache.Count();
+    CPresenceCacheBuddyStore* buddyStore(NULL);
+    
+    TRACE_1( _L("_______serviceCount[%d]"), serviceCount);
+    
+    for(TInt i=0; i<serviceCount; i++)
+        {
+        if (serviceName == (iServer.iPresenceCache[i])->ServiceName())
+            {
+            buddyStore = (iServer.iPresenceCache[i])->FindAndGet(*identity);
+            break;
+            }
+        }
+    
+    CleanupStack::PopAndDestroy(identity);
+    CleanupStack::PopAndDestroy(idPack);
+    
+    TRACE_1( _L("buddyStore[%d]"), buddyStore);
+    if(buddyStore) // if found
+        {
+        buddyStore->RemoveSubscribedSession(this);
+        iSubscribedStores.Remove(iSubscribedStores.Find(buddyStore));
+        err = KErrNone;
+        }
+    
+    aMessage.Complete(err);
+    TRACE_1( _L("CPresenceCacheSession::HandleUnSubscribeBuddyPresenceChange (%d) - end"),err);
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceCacheSession::HandleGetLastNotifiedtPacketL()
+// ---------------------------------------------------------------------------
+//
+void CPresenceCacheSession::HandleGetLastNotifiedtPacketL(const RMessage2& aMessage )
+    {
+    TRACE( _L("CPresenceCacheSession::HandleGetLastNotifiedtPacketL() - begin"));
+    if(iDataPackNotifier)
+        aMessage.WriteL(0, *(iDataPackNotifier));
+    aMessage.Complete(KErrNone);
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceCacheSession::HandleWaitingForNotification()
+// ---------------------------------------------------------------------------
+//
+void CPresenceCacheSession::HandleWaitingForNotification(const RMessage2& aMessage )
+    {
+    iMessageForNoti = aMessage;
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceCacheSession::HandleCancelWaitingForNotification()
+// ---------------------------------------------------------------------------
+//
+void CPresenceCacheSession::HandleCancelWaitingForNotification
+                                                    (const RMessage2& aMessage )
+    {
+    aMessage.Complete(KErrNone);
+    if(!iMessageForNoti.IsNull())
+        iMessageForNoti.Complete(KErrCancel);
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceCacheSession::NotifyPresenceChangeL()
+// ---------------------------------------------------------------------------
+//
+void CPresenceCacheSession::NotifyPresenceChangeL(
+                               const CPresenceBuddyInfoImp* aPresenceBuddyInfo)
+    {
+    TRACE( _L("CPresenceCacheSession::NotifyPresenceChangeL() - begin"));
+    TInt sizeOfReturnPacket(NULL);
+    if(aPresenceBuddyInfo && (!iMessageForNoti.IsNull())) // if pointers are valid
+        {
+        if(iDataPackNotifier)
+            delete iDataPackNotifier; iDataPackNotifier=NULL;
+        iDataPackNotifier = PackBuddyPresenceInfoLC(aPresenceBuddyInfo);
+        CleanupStack::Pop(iDataPackNotifier);
+        sizeOfReturnPacket = (iDataPackNotifier->Des()).Size();
+        TPckgBuf<TInt> p(sizeOfReturnPacket);
+        iMessageForNoti.WriteL(0,p);            
+        iMessageForNoti.Complete(KErrNone);
+        TRACE( _L("_______message was valid"));
+        }
+    TRACE( _L("CPresenceCacheSession::NotifyPresenceChangeL - end"));
+    }
+    
+// ---------------------------------------------------------------------------
+// CPresenceCacheSession::NotifyAllSubscribersL()
+// ---------------------------------------------------------------------------
+//
+void CPresenceCacheSession::NotifyAllSubscribersL
+                                        (CPresenceCacheBuddyStore* aBuddyStore)
+    {
+    TRACE( _L("CPresenceCacheSession::NotifyAllSubscribers() - begin"));
+    if(!aBuddyStore)
+        return;
+    TInt subsCount = aBuddyStore->GetSubscribedSessions().Count();
+    TRACE_1( _L("_______total subscribed sessions[%d]"), subsCount);
+    TBool ownBuddyInfo(EFalse);
+    const CPresenceBuddyInfoImp* buddyInfo;
+    
+    if(subsCount) // start processing if there are subscribers
+        {
+        //if presence has been deleted we need to identity and service id in the packed
+        //which will be sent to clients
+        if(!(aBuddyStore->PresenceBuddyInfo()))
+            {
+            CPresenceBuddyInfoImp* buddyInfoTemp = CPresenceBuddyInfoImp::NewLC();
+            MXIMPIdentity* id = CXIMPIdentityImp::NewLC(aBuddyStore->BuddyId()->Identity());
+            buddyInfoTemp->SetBuddyId(id);
+            CleanupStack::Pop(1); //id
+            ownBuddyInfo = ETrue;
+            buddyInfo = buddyInfoTemp;
+            }
+        else
+            {
+            buddyInfo = 
+                TXIMPGetImpClassOrPanic< const CPresenceBuddyInfoImp >::From( *(aBuddyStore->PresenceBuddyInfo()) );    
+            }
+            
+        CPresenceCacheSession* session(NULL);
+        for(TInt i=0;i<subsCount;i++)
+            {
+            session = aBuddyStore->GetSubscribedSessions()[i];
+            if(iServer.SessionExists(session))
+                {
+                TRACE_1( _L("_______valid session notified[%d]"), session);
+                session->NotifyPresenceChangeL(buddyInfo);
+                }
+            else
+                {
+                aBuddyStore->RemoveSubscribedSession(session);
+                subsCount--;//substract this removed session from total count
+                i--;
+                TRACE_1( _L("_______invalid session removed[%d]"), session);
+                }    
+            }
+        }
+        
+    if(ownBuddyInfo)
+        CleanupStack::PopAndDestroy(1); //buddyInfoTemp
+    TRACE( _L("CPresenceCacheSession::NotifyAllSubscribers() - end"));
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceCacheSession::GetServiceName()
+// ---------------------------------------------------------------------------
+//
+TPtrC CPresenceCacheSession::GetServiceName(const TDesC& aXspId)
+    {
+    _LIT(KColon, ":");
+    TInt pos = aXspId.Find(KColon);
+    TPtrC serviceName;
+    if(pos>0) // if colon found and there is something before colon, i.e. xsp id
+        {
+        serviceName.Set(aXspId.Left(pos));
+        }
+    else
+        serviceName.Set(TPtrC());
+    return serviceName;
+    }
+        
+// ---------------------------------------------------------------------------
+// CPresenceCacheSession::Cancel()
+// ---------------------------------------------------------------------------
+//
+void CPresenceCacheSession::Cancel()
+    {
+    if (iAsyncReq != NRequest::ENoRequestMade)
+        {
+        iMessage.Complete(KErrCancel);
+        iAsyncReq = NRequest::ENoRequestMade;
+        }
+    return;   
+    }
+    
+// ---------------------------------------------------------------------------
+// CPresenceCacheSession::PackPresenceDocLC()
+// ---------------------------------------------------------------------------
+//
+HBufC8* CPresenceCacheSession::PackPresenceInfoLC(const MPresenceInfo& aPresInfo)
+    {
+    const CPresenceInfoImp* tmp =
+        TXIMPGetImpClassOrPanic< const CPresenceInfoImp >::From(aPresInfo);
+    HBufC8* pack = TXIMPObjectPacker< CPresenceInfoImp>::PackL( *tmp);
+    CleanupStack::PushL( pack );
+
+    return pack;
+    }
+    
+// ---------------------------------------------------------------------------
+// CPresenceCacheSession::PackBuddyPresenceInfoLC()
+// ---------------------------------------------------------------------------
+//
+HBufC8* CPresenceCacheSession::PackBuddyPresenceInfoLC(
+                                    const CPresenceBuddyInfoImp* aBuddyPresInfo)
+    {
+    HBufC8* pack(NULL);
+    if(aBuddyPresInfo)
+        {
+        //const CPresenceBuddyInfoImp* pifImp = 
+        //    TXIMPGetImpClassOrPanic< const CPresenceBuddyInfoImp >::From( *aBuddyPresInfo );    
+        
+        pack = TXIMPObjectPacker< const CPresenceBuddyInfoImp>::PackL( *aBuddyPresInfo );
+        CleanupStack::PushL( pack );
+        }
+
+    return pack;
+    }
+    
+
+// ---------------------------------------------------------------------------
+// CPresenceCacheSession::PackServicesL()
+// ---------------------------------------------------------------------------
+//
+/*
+HBufC8* CPresenceCacheSession::PackServicesL(CArrayFixFlat<TUid>* aArray )
+	{
+    CBufFlat* packBuf = CBufFlat::NewL( NConstants::KGranularity );
+    CleanupStack::PushL( packBuf );
+
+    RBufWriteStream ws;
+    ws.Open( *packBuf ); // CSI: 65 #
+    CleanupClosePushL( ws );
+
+    // Get count of objects
+    TInt objCount = aArray->Count();
+    // write the count
+    ws.WriteInt32L( objCount );
+    // objects
+    for ( TInt count(0); count < objCount; count++ )
+        {
+        ws<<(aArray->At(count));
+        }
+
+    ws.CommitL();
+    CleanupStack::PopAndDestroy(); //ws
+
+    HBufC8* packBufDesc = packBuf->Ptr(0).AllocL();
+    CleanupStack::PopAndDestroy( packBuf );
+
+    return packBufDesc;
+	}*/
+
+// ---------------------------------------------------------------------------
+// CPresenceCacheSession::CPresenceCacheSession()
+// ---------------------------------------------------------------------------
+//
+CPresenceCacheSession::CPresenceCacheSession( CPresenceCacheServer& aServer )
+                                                        : iServer( aServer ),
+                                                        iLastServiceCount(0)
+    {
+    TRACE( _L("CPresenceCacheSession::CPresenceCacheSession()"));
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceCacheSession::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void CPresenceCacheSession::ConstructL()
+    {
+    iActiveHelper = CCacheSessionActiveHelper::NewL(this);    
+    iServer.IncrementSessions();
+    return;
+    }
+    
+// ---------------------------------------------------------------------------
+// CPresenceCacheSession::RemoveMySubscriptions()
+// ---------------------------------------------------------------------------
+//
+void CPresenceCacheSession::RemoveMySubscriptions()
+    {
+    TInt count = iSubscribedStores.Count();
+    for(TInt i=0;i<count;i++)
+        {
+        // it can be assumed that store is alive, since it won't be deleted
+        // until there is any session subscribed to it
+        (iSubscribedStores[i])->RemoveSubscribedSession(this);
+        }
+    }
+    
+    
+// ---------------------------------------------------------------------------
+// CCacheSessionActiveHelper::NewL()
+// ---------------------------------------------------------------------------
+//
+CCacheSessionActiveHelper* CCacheSessionActiveHelper::NewL
+                                            (CPresenceCacheSession* aSession )
+    {
+    CCacheSessionActiveHelper* self = new(ELeave) CCacheSessionActiveHelper(aSession);
+    CleanupStack::PushL( self );
+    self->ConstructL( );
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CCacheSessionActiveHelper::~CCacheSessionActiveHelper()
+// ---------------------------------------------------------------------------
+//
+CCacheSessionActiveHelper::~CCacheSessionActiveHelper( )
+    {
+    Cancel();   
+    }
+
+// ---------------------------------------------------------------------------
+// CCacheSessionActiveHelper::Start()
+// ---------------------------------------------------------------------------
+//
+void CCacheSessionActiveHelper::Start()
+    {
+    TRequestStatus* status = &iStatus;
+    User::RequestComplete(status,KErrNone);
+    SetActive();
+    }
+
+// ---------------------------------------------------------------------------
+// CCacheSessionActiveHelper::CCacheSessionActiveHelper()
+// ---------------------------------------------------------------------------
+//
+CCacheSessionActiveHelper::CCacheSessionActiveHelper(CPresenceCacheSession* aSession ) 
+                                                    : CActive(EPriorityStandard)
+    {
+    iCacheSession = aSession;
+    }
+
+// ---------------------------------------------------------------------------
+// CCacheSessionActiveHelper::RunL()
+// ---------------------------------------------------------------------------
+//
+void CCacheSessionActiveHelper::RunL()
+    {
+    switch (iCacheSession->iAsyncReq)
+        {
+        case NRequest::EWritePresenceInfoAsync:
+            iCacheSession->WritePresenceInfoAsyncL();
+            break;
+
+        case NRequest::EPrepReadAllBuddiesPresenceInService:
+            iCacheSession->ReadAllBuddiesPresenceInServiceL();
+            break;
+
+        case NRequest::ENoRequestMade:
+        default:
+            break;
+        }    
+    }
+
+// ---------------------------------------------------------------------------
+// CCacheSessionActiveHelper::DoCancel()
+// ---------------------------------------------------------------------------
+//
+void CCacheSessionActiveHelper::DoCancel()
+    {
+    iCacheSession->Cancel();
+    }
+
+// ---------------------------------------------------------------------------
+// CCacheSessionActiveHelper::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void CCacheSessionActiveHelper::ConstructL()
+    {
+	CActiveScheduler::Add(this);
+    }
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresencecache/presencecacheserver/presencecachesession.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,341 @@
+/*
+* Copyright (c) 2007, 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:  Header file for Presence Cache Server session
+*
+*/
+
+
+#ifndef PRESENCECACHESESSION_H
+#define PRESENCECACHESESSION_H
+
+// INCLUDE FILES
+#include <e32base.h>
+
+#include "presencecachedefs.h"
+
+/**
+ * Presence cache server session class.
+ * @ingroup ximpprescacheserver
+ * @since S60 v3.2
+ */
+// FORWARD DECLARATIONS
+class CPresenceCacheServer;
+class MPresenceInfo;
+class MPresenceBuddyInfo;
+class CPresenceBuddyInfoListImp;
+class CPresenceBuddyInfoImp;
+class CCacheSessionActiveHelper;
+class CPresenceCacheBuddyStore;
+
+//Include Cache server namespace
+using namespace NCacheSrv;
+
+class CPresenceCacheSession : public CSession2
+    {
+    friend class CCacheSessionActiveHelper;
+    public: // Constructors and destructors
+
+        /**
+        * Two-phased constructor.
+        * @param aServer The server.
+        * @return Pointer to created CPresenceCacheSession object.
+        */
+        static CPresenceCacheSession* NewL( CPresenceCacheServer& aServer );
+
+        /**
+        * Two-phased constructor.
+        * @param aServer The server.
+        * @return Pointer to created CPresenceCacheSession object.
+        */
+        static CPresenceCacheSession* NewLC( CPresenceCacheServer& aServer );
+
+        /**
+        * ~CPresenceCacheSession.
+        * Destructor.
+        */
+        virtual ~CPresenceCacheSession();
+        
+    public: // Functions from base classes
+
+        /**
+        * From CSession
+        */
+        void ServiceL( const RMessage2& aMessage );
+        
+    public: // own
+        
+        /**
+        * This is called by some other session to inform this session that given
+        * buddy's presence has been changed. The informing session first make
+        * sure that this session has subscribed for the changes in given buddy.
+        *
+        *@param pointer to CPresenceBuddyInfoImp, ownership doesnt transfer.
+        */
+        void NotifyPresenceChangeL(const CPresenceBuddyInfoImp* aPresenceBuddyInfo);    
+
+    private: // Constructors and destructors
+
+        /**
+        * C++ default constructor.
+        * @param aServer The server.
+        */
+        CPresenceCacheSession( CPresenceCacheServer& aServer );
+
+        /**
+        * Construct.
+        * 2nd phase constructor
+        */
+        void ConstructL();
+
+    private: // New methods
+
+        /**
+        * Packs PresenceInfo object into a data packet.
+        * @param aPresInfo PresenceInfo object.
+        * @return HBufC* data packet.
+        */
+        HBufC8* PackPresenceInfoLC(const MPresenceInfo& aPresInfo);
+        
+        /**
+        * Cancels the async request, this is called by docancel of active helper
+        */
+        void Cancel();
+        
+        /**
+        * Tries writing given buddy to presence cache
+        * @param aBuddyPresInfo object to write.
+        * @return TInt error code
+        */
+        TInt TryWriteBuddyToCacheL(MPresenceBuddyInfo* aBuddyPresInfo);
+        
+        /**
+        * Packs services array
+        * 
+        * @param CArrayFixFlat aArray
+        * @return packed object
+        */
+        //HBufC8* PackServicesL(CArrayFixFlat<TUid>* aArray );
+        
+        /**
+        * Removes all subscriptions stored by this session in iSubscribedStores
+        */
+        void RemoveMySubscriptions();
+        
+        /**
+        * Notify to subscribers in given buddy store's presence change. This method
+        * goes through all subscribed sessions and call their NotifyPresenceChangeL
+        * methods. Ownership of store is not transferred.
+        * 
+        * @param aBuddyStore pointer to changed CPresenceCacheBuddyStore
+        */
+        void NotifyAllSubscribersL(CPresenceCacheBuddyStore* aBuddyStore);
+        
+        /**
+        * Pack buddy's presence info into descriptor.
+        * 
+        * @param aBuddyPresInfo buddy's presence info, ownership doesnt transfer
+        * @param HBufC8* packed presence info
+        */
+        HBufC8* PackBuddyPresenceInfoLC(
+                                    const CPresenceBuddyInfoImp* aBuddyPresInfo);
+        
+    
+     private: // New Massage processors, these are called to process messages.
+        void HandlePrepReadPresenceInfoSyncL(const RMessage2& aMessage );
+        
+        void HandleWritePresenceInfoSyncL(const RMessage2& aMessage ); 
+        
+        void HandleGetLastPreparedPacketL( const RMessage2& aMessage );
+        
+        void HandleGetLastPreparedAsyncPacketL( const RMessage2& aMessage );
+        
+        void HandleBuddyCountInAllServices(const RMessage2& aMessage ); 
+        
+        void HandleBuddyCountInService(const RMessage2& aMessage );
+        
+        void HandleWritePresenceInfoAsyncL(const RMessage2& aMessage );
+        
+        void HandlePrepReadAllBuddiesPresenceInService(const RMessage2& aMessage );
+        
+        //void HandleGetAllServicesL(const RMessage2& aMessage );
+        
+        void HandleGetServiceCount(const RMessage2& aMessage );
+        
+        void HandleDeleteService(const RMessage2& aMessage );
+        
+        void HandleCancel(const RMessage2& aMessage );
+        
+        void HandleDeletePresence(const RMessage2& aMessage );
+        
+        
+        // subscribe notification related
+        void HandleSubscribeBuddyPresenceChange(const RMessage2& aMessage );
+        
+        void HandleUnSubscribeBuddyPresenceChange(const RMessage2& aMessage );
+        
+        void HandleGetLastNotifiedtPacketL(const RMessage2& aMessage );
+        
+        void HandleWaitingForNotification(const RMessage2& aMessage );
+        
+        void HandleCancelWaitingForNotification(const RMessage2& aMessage );
+        
+    
+    private:            
+        
+        /**
+        * Writes Presence info async. to cache, its called on each runl cycle
+        * and it takes data to write from member data holders.
+        */
+        void WritePresenceInfoAsyncL();
+        
+        /**
+        * Reads all buddies presence info in given service. It takes data from 
+        * stored message.
+        */
+        void ReadAllBuddiesPresenceInServiceL();
+        
+        /**
+         * Get Service name from given xsp id
+         * 
+         * @param aXspId xsp id e.g. ovi:xyz@nokia.com
+         * @return ServiceName returned here
+         */
+        TPtrC GetServiceName(const TDesC& aXspId);
+        
+        
+    private: // Data
+
+        /**
+        * iMessage, the message exchange data with the server.
+        */
+        RMessage2 iMessage;
+        
+        /**
+        * iMessage, the message holder for notification wating.
+        * This is always pending when some client subscribe for notifications.
+        */
+        RMessage2 iMessageForNoti;
+
+        /**
+        * iServer, reference to the server.
+        */
+        CPresenceCacheServer& iServer;
+        
+        /**
+        * Own: used for sync messages
+        */
+        HBufC8* iDataPack;
+        
+        /**
+        * Own: used for async messages
+        */
+        HBufC8* iDataPackAsync;
+        
+        /**
+        * Own: used for subscribe notify message
+        */
+        HBufC8* iDataPackNotifier;
+        
+        /**
+        * Own: used for ansync requests
+        */
+        NRequest::TOpAsyncCodes iAsyncReq;
+        
+        /**
+        *Own
+        */
+        CPresenceBuddyInfoListImp* iBuddypresInfoList;
+        
+        /**
+        *
+        */
+        TInt iLastServiceCount;
+        
+        
+        /**
+        *Own
+        */
+        CCacheSessionActiveHelper* iActiveHelper;
+        
+        /**
+        * Pointers not owned.
+        */
+        RPointerArray<CPresenceCacheBuddyStore> iSubscribedStores;
+        
+    };
+
+/**
+* This class is used by CPresenceCacheSession for dividing long running async.
+* tasks into smaller units. The CPresenceCacheSession itself was not made 
+* active, since that results in c++ ambiguousness problems in CPresenceCacheSession
+* because of inheriting twice from CBase.
+*  
+* @since S60 v3.2
+*/    
+class CCacheSessionActiveHelper : public CActive
+	{
+	public: // public functions
+	
+	    /**
+        * Default 1st phase factory method.
+        * Creates an instance of CCacheSessionActiveHelper
+        *
+        * @return created instance of the CCacheSessionActiveHelper
+        */
+        static CCacheSessionActiveHelper* NewL(CPresenceCacheSession* aSession );
+        
+        /**
+        * Destructor
+        */
+        ~CCacheSessionActiveHelper( );
+        
+        /**
+        * Active object start
+        */
+		void Start();
+	
+	private: // private functions
+        
+        /**
+        * Constructor
+        */
+        CCacheSessionActiveHelper(CPresenceCacheSession* aSession);
+
+        /**
+        * Active object RunL
+        */
+		void RunL();
+		
+        /**
+        * Active object DoCancel
+        */
+		void DoCancel();
+		
+        /**
+        * ConstructL
+        */
+		void ConstructL();
+		
+		
+        /**
+        * pointer to CPresenceCacheSession doesnt own
+        */
+		CPresenceCacheSession* iCacheSession;
+			
+	};
+    
+#endif // PRESENCECACHESESSION_H
+
+// End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresencedatamodel/apidataobjfactory.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,46 @@
+/*
+* 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:  API data object factory
+*
+*/
+
+
+
+#ifndef M_APIOBJFACTORY_H
+#define M_APIOBJFACTORY_H
+
+#include <e32std.h>
+
+class CXIMPApiDataObjBase;
+
+
+/**
+ * ?one_line_short_description
+ *
+ * ?more_complete_description
+ *
+ * @lib ?library
+ * @since S60 v4.0
+ */
+class MApiDataObjFactory
+    {  
+public:
+    
+    virtual CXIMPApiDataObjBase* NewFromStreamLC( TInt32 aDataObjInterfaceId,
+                                                            RReadStream& aStream ) = 0;
+    
+    };
+
+#endif // M_APIOBJFACTORY_H
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresencedatamodel/presenceapidataobjfactory.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,154 @@
+/*
+* 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:  Base class for API implementations.
+*
+*/
+
+#include "presenceapidataobjfactory.h"
+#include "ximpapidataobjbase.h"
+
+#include <s32strm.h>
+//#include <s32mem.h>
+
+
+// ============================ MEMBER FUNCTIONS =============================
+
+
+// ---------------------------------------------------------------------------
+// CPresenceEventCodec::NewL()
+// ---------------------------------------------------------------------------
+//
+CPresenceApiDataObjFactory* CPresenceApiDataObjFactory::NewL()
+    {
+    CPresenceApiDataObjFactory* self = new( ELeave ) CPresenceApiDataObjFactory() ;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+    return self;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CPresenceEventCodec::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void CPresenceApiDataObjFactory::ConstructL()
+    {
+    }
+
+
+/**
+ * Method to instantiate new data object object
+ * of requested type and construct it from the stream.
+ *
+ * @param aDataObjInterfaceId
+ * @return Data object constructor function.
+ */
+CXIMPApiDataObjBase* CPresenceApiDataObjFactory::NewFromStreamLC( 
+            TInt32 aDataObjInterfaceId,
+            RReadStream& aStream )
+    {
+    return NewDataObjectFromStreamLC( aDataObjInterfaceId, aStream );
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceApiDataObjFactory::CPresenceApiDataObjFactory()
+// ---------------------------------------------------------------------------
+//
+CPresenceApiDataObjFactory::CPresenceApiDataObjFactory()
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceApiDataObjFactory::~CPresenceApiDataObjFactory()
+// ---------------------------------------------------------------------------
+//
+CPresenceApiDataObjFactory::~CPresenceApiDataObjFactory()
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// PresenceApiDataObjFactory::InternalizeL
+// ---------------------------------------------------------------------------
+//
+void CPresenceApiDataObjFactory::InternalizeL( 
+        RReadStream& aStream,
+        RPresenceReqParamArray& aArray )
+    {
+    TInt32 arrLen = aStream.ReadInt32L();
+
+    for ( TInt i = 0; i < arrLen; i++ )
+        {
+        SPresenceReqParam param;
+        param.iParamType = aStream.ReadInt32L();
+        CXIMPApiDataObjBase* dataObject = NewDataObjectFromStreamLC( param.iParamType, aStream );
+        param.iParam = dataObject;
+        aArray.AppendL( param );
+        CleanupStack::Pop( dataObject );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// PresenceApiDataObjFactory::ExternalizeL
+// ---------------------------------------------------------------------------
+//
+void CPresenceApiDataObjFactory::ExternalizeL( 
+            RWriteStream& aWs,
+            const RPresenceReqParamArray& aArray )
+    {
+    // write array length
+    aWs.WriteInt32L( aArray.Count() );
+
+    for ( TInt i = 0; i < aArray.Count(); i++ )
+        {
+        // trust the type within the param struct
+        aWs.WriteInt32L( aArray[ i ].iParamType );
+
+        // write the actual object
+        CXIMPApiDataObjBase* theBase = aArray[ i ].iParam;
+        theBase->ExternalizeL( aWs );
+        }
+
+    aWs.CommitL();
+    }
+
+// ---------------------------------------------------------------------------
+// PresenceApiDataObjFactory::InternalizeLC
+// ---------------------------------------------------------------------------
+//
+CXIMPApiDataObjBase* CPresenceApiDataObjFactory::InternalizeLC(
+        RReadStream& aStream )
+    {
+    TInt32 objType = aStream.ReadInt32L();
+    CXIMPApiDataObjBase* dataObject = NewDataObjectFromStreamLC( objType, aStream );
+    return dataObject;
+    }
+
+// ---------------------------------------------------------------------------
+// PresenceApiDataObjFactory::ExternalizeL
+// ---------------------------------------------------------------------------
+//
+void CPresenceApiDataObjFactory::ExternalizeL(
+        RWriteStream& aWs,
+        const CXIMPApiDataObjBase& aDataObj )
+    {
+    aWs.WriteInt32L( aDataObj.Base().GetInterfaceId() );
+    aDataObj.ExternalizeL( aWs );
+    aWs.CommitL();
+    }
+
+
+// End of file
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresencedatamodel/presenceapidataobjfactory.h	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  Codec to pack and unpack data objects.
+*
+*/
+
+#ifndef PRESENCEAPIDATAOBJFACTORY_H
+#define PRESENCEAPIDATAOBJFACTORY_H
+
+#include <e32base.h>
+#include "presencetypehelpers.h"
+#include "ximpapidataobjbase.h"
+
+// internal interface for the factory
+#include "apidataobjfactory.h"
+
+class RReadStream;
+class RWriteStream;
+
+
+/**
+ * Codec to pack and unpack data object arrays.
+ *
+ * @lib ximpdatamodel.dll
+ * @since S60 v3.2
+ */
+NONSHARABLE_CLASS( CPresenceApiDataObjFactory ) : public CBase,
+                                                  public MApiDataObjFactory
+    {
+public:
+
+    static CPresenceApiDataObjFactory* NewL();
+    
+    // From base class
+    CXIMPApiDataObjBase* NewFromStreamLC( TInt32 aDataObjInterfaceId,
+                                          RReadStream& aStream );
+    /**
+     * Unpacks a request parameter array from a 
+     * descriptor back to array format.
+     * @param aDataObjArrayData The packed array
+     * @param aArray The array which to fill
+     */
+    static void InternalizeL( 
+            RReadStream& aStream,
+            RPresenceReqParamArray& aArray
+            );
+
+    /**
+     * Packs a given request parameter array into 
+     * a stream.
+     * @param aWs The stream to pack into
+     * @param aArray The array to pack
+     */    
+    static void ExternalizeL( 
+            RWriteStream& aWs,
+            const RPresenceReqParamArray& aArray
+            );
+
+    /**
+     * Internalize a CXIMPApiDataObjBase-derived object
+     * from the given stream, ownership is returned to the caller.
+     * @param aStream The stream
+     * @return The object instance
+     */
+    static CXIMPApiDataObjBase* InternalizeLC(
+            RReadStream& aStream );
+
+    /**
+     * Externalize a CXIMPApiDataObjBase-derived object
+     * to the given stream.
+     * @param aWs The write stream
+     * @param aDataObj The data object
+     */
+    static void ExternalizeL(
+            RWriteStream& aWs,
+            const CXIMPApiDataObjBase& aDataObj );
+    
+
+    /*
+     * Packs a given array into a stream.
+     * @param aStream The stream
+     * @param aArray The array
+     */
+    template< class INFOIMP>    
+        static inline void InternalizeL( 
+                RReadStream& aStream,
+                RPointerArray<INFOIMP>& aArray
+                );
+
+    /**
+     * Unpacks an array of info fields back to array format.
+     * @param aWs The stream
+     * @param aArray The array which to fill
+     */
+    template< class INFOIMP >
+        static inline void ExternalizeL( 
+                RWriteStream& aWs,
+                const RPointerArray<INFOIMP>& aArray
+                );
+
+
+    ~CPresenceApiDataObjFactory();
+private:
+
+    CPresenceApiDataObjFactory();
+
+    void ConstructL();
+
+    };
+
+// template methods need inline implementation
+#include "presenceapidataobjfactory.inl"
+
+#endif // PRESENCEAPIDATAOBJFACTORY_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresencedatamodel/presenceapidataobjfactory.inl	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,209 @@
+/*
+* 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:  Inline methods for codec to pack and unpack data objects.
+*
+*/
+
+
+#include <e32base.h>
+
+#include "presencetypehelpers.h"
+#include "presenceobjectfactory.h"
+#include "ximpapidataobjbase.h"
+//#include "ximpidentityimp.h"
+#include "presentitygroupmemberinfoimp.h"
+#include "presentitygroupinfoimp.h"
+//#include "ximpfeatureinfoimp.h"
+//#include "ximpcontextclientinfoimp.h"
+#include "presencegrantrequestinfoimp.h"
+#include "presencewatcherinfoimp.h"
+//#include "ximpprotocolinfoimp.h"
+//#include "ximpserviceinfoimp.h"
+//#include "ximpstatusimp.h"
+#include "presenceinfofieldimp.h"
+#include "presenceinfofieldvaluetextimp.h"
+#include "presenceinfofieldvaluebinaryimp.h"
+#include "presenceinfofieldvalueenumimp.h"
+#include "servicepresenceinfoimp.h"
+#include "devicepresenceinfoimp.h"
+
+//DATA TYPES
+
+
+// ============================ MEMBER FUNCTIONS =============================
+
+/**
+ * Type definition for exact API data object constructor signature.
+ */
+typedef CXIMPApiDataObjBase* (*TApiDataObjConstructor)( RReadStream& );
+
+
+
+/**
+ * Structure for mapping data object interface IDs to
+ * to corect API data object constructors.
+ */
+struct SApiDataObjConstructorMap
+    {
+    //Interface id
+    TInt32    iInterfaceId;
+
+    //Function pointer to data object interface implementation
+    TApiDataObjConstructor iConstructorPtr;
+    } ;
+
+
+
+/**
+ * Helper macro to initialise KApiDataObjConstructorTable members.
+ *
+ * Macro forces that each data object implementation class to have static
+ * NewFromStreamLC() member function to instantiate the object.
+ *
+ * See TApiDataObjConstructor type definition for exact constructor
+ * signature.
+ */
+#define CONSTRUCTOR_ENTRY( TheImplementedIf, TheClass ) \
+    { TheImplementedIf::KInterfaceId, TheClass::NewFromStreamLC } \
+
+/**
+ * Constructor function mapping for data object interface implementations.
+ *
+ * When new data object types are implemented, add them here.
+ */
+const SApiDataObjConstructorMap KApiDataObjConstructorTable[] =
+    {
+    CONSTRUCTOR_ENTRY( MPresentityGroupMemberInfo, CPresentityGroupMemberInfoImp ),
+    CONSTRUCTOR_ENTRY( MPresentityGroupInfo, CPresentityGroupInfoImp ),
+    CONSTRUCTOR_ENTRY( MPresenceGrantRequestInfo, CPresenceGrantRequestInfoImp ),
+    CONSTRUCTOR_ENTRY( MPresenceWatcherInfo, CPresenceWatcherInfoImp ),
+    CONSTRUCTOR_ENTRY( MPresenceInfoField, CPresenceInfoFieldImp ),
+    CONSTRUCTOR_ENTRY( MPresenceInfoFieldValueText, CPresenceInfoFieldValueTextImp ),
+    CONSTRUCTOR_ENTRY( MPresenceInfoFieldValueBinary, CPresenceInfoFieldValueBinaryImp ),
+    CONSTRUCTOR_ENTRY( MPresenceInfoFieldValueEnum, CPresenceInfoFieldValueEnumImp ),
+    CONSTRUCTOR_ENTRY( MDevicePresenceInfo, CDevicePresenceInfoImp ),
+    CONSTRUCTOR_ENTRY( MServicePresenceInfo, CServicePresenceInfoImp )
+    };
+
+
+/**
+ * Count of constructor mappings.
+ */
+const TInt KApiDataObjConstructorCount = sizeof( KApiDataObjConstructorTable )
+                                        / sizeof( SApiDataObjConstructorMap );
+
+
+
+// ============================ HELPER FUNCTIONS =============================
+
+
+namespace {
+
+    /**
+     * Helper function to locate constructor function for
+     * data object interface ID.
+     *
+     * @param aDataObjInterfaceId The data object interface ID.
+     * @return Data object constructor function.
+     */
+    TApiDataObjConstructor ConstructorForInterface( TInt32 aDataObjInterfaceId )
+    {
+        //Locate correct constructor
+        for( TInt ix = 0; ix < KApiDataObjConstructorCount; ix++ )
+        {
+            const SApiDataObjConstructorMap map = KApiDataObjConstructorTable[ ix ];
+            if( map.iInterfaceId == aDataObjInterfaceId )
+            {
+                return map.iConstructorPtr;
+            }
+        }
+
+
+        //If assertion below fails, check that data object implementation
+        //class implementing requested data object interface (aDataObjInterfaceId)
+        //is registered to KApiDataObjConstructorTable
+        __ASSERT_DEBUG( EFalse,
+                User::Panic( _L("PresenceObjectFactory"), KErrUnknown ) );
+
+        return NULL;
+    }
+
+    /**
+     * Helper function to instantiate new data object object
+     * of requested type and construct it from the stream.
+     *
+     * @param aDataObjInterfaceId
+     * @return Data object constructor function.
+     */
+    CXIMPApiDataObjBase* NewDataObjectFromStreamLC( TInt32 aDataObjInterfaceId,
+            RReadStream& aStream )
+    {
+        TApiDataObjConstructor newFromStreamLC = NULL;
+
+        //Locate correct constructor for interface ID
+        newFromStreamLC = ConstructorForInterface( aDataObjInterfaceId );
+
+        //Instantiate the object
+        CXIMPApiDataObjBase* dataObject = newFromStreamLC( aStream );
+
+        return dataObject;
+    }
+
+} // namespace
+
+// ---------------------------------------------------------------------------
+// PresenceApiDataObjFactory::InternalizeL
+// ---------------------------------------------------------------------------
+//
+template< class INFOIMP >
+inline void CPresenceApiDataObjFactory::InternalizeL( 
+        RReadStream& aStream,
+        RPointerArray<INFOIMP>& aArray )
+    {
+    TInt32 arrLen = aStream.ReadInt32L();
+
+    for ( TInt i = 0; i < arrLen; i++ )
+        {
+        TInt paramType = aStream.ReadInt32L();
+        INFOIMP* infoObj = ( INFOIMP* ) NewDataObjectFromStreamLC( paramType, aStream );
+        aArray.AppendL( infoObj );
+        CleanupStack::Pop( infoObj );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// PresenceApiDataObjFactory::ExternalizeL
+// ---------------------------------------------------------------------------
+//
+template <class INFOIMP>
+inline void CPresenceApiDataObjFactory::ExternalizeL( 
+        RWriteStream& aWs,
+        const RPointerArray<INFOIMP>& aArray )
+    {
+    aWs.WriteInt32L( aArray.Count() ); // array length
+
+    for ( TInt i = 0; i < aArray.Count(); i++ )
+        {
+        INFOIMP* infoField = aArray[ i ];
+
+        // write the type
+        aWs.WriteInt32L( infoField->Base().GetInterfaceId() );
+
+        // write the actual object
+        infoField->ExternalizeL( aWs );
+        }
+
+    aWs.CommitL();
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresencedatamodel/presenceapidataobjfactoryaccessor.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  Base class for API implementations.
+*
+*/
+
+#include "presenceapidataobjfactoryaccessor.h"
+#include "presenceeventcodec.h"
+#include "presenceapidataobjfactory.h"
+
+//DATA TYPES
+
+
+// ============================ MEMBER FUNCTIONS =============================
+
+// ---------------------------------------------------------------------------
+// CPresenceApiDataObjFactoryAccessor::NewL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CPresenceApiDataObjFactoryAccessor* CPresenceApiDataObjFactoryAccessor::NewL()
+    {
+    CPresenceApiDataObjFactoryAccessor* self = new( ELeave ) CPresenceApiDataObjFactoryAccessor() ;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+    return self;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CPresenceApiDataObjFactoryAccessor::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void CPresenceApiDataObjFactoryAccessor::ConstructL()
+    {
+    // FIXME: would be probably better to have the Event Codec and other factories as singleton
+    iPresenceEventCodec = CPresenceEventCodec::NewL();
+    
+    iPresenceApiDataObjFactory = CPresenceApiDataObjFactory::NewL();
+    }
+
+
+// ---------------------------------------------------------------------------
+// CPresenceApiDataObjFactoryAccessor::CPresenceApiDataObjFactoryAccessor()
+// ---------------------------------------------------------------------------
+//
+CPresenceApiDataObjFactoryAccessor::CPresenceApiDataObjFactoryAccessor()
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceApiDataObjFactoryAccessor::~CPresenceApiDataObjFactoryAccessor()
+// ---------------------------------------------------------------------------
+//
+CPresenceApiDataObjFactoryAccessor::~CPresenceApiDataObjFactoryAccessor()
+    {
+    delete iPresenceEventCodec;
+    delete iPresenceApiDataObjFactory;
+    }
+
+    
+// ---------------------------------------------------------------------------
+// CPresenceApiDataObjFactoryAccessor::EventCodec()
+// ---------------------------------------------------------------------------
+//
+MEventCodec& CPresenceApiDataObjFactoryAccessor::EventCodec()
+    {
+    return *iPresenceEventCodec;
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceApiDataObjFactoryAccessor::ApiDataObjFactory()
+// ---------------------------------------------------------------------------
+//
+MApiDataObjFactory& CPresenceApiDataObjFactoryAccessor::ApiDataObjFactory()
+    {
+    return *iPresenceApiDataObjFactory;
+    }
+
+
+
+// End of file
+
+
+
+
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresencedatamodel/presenceapidataobjfactoryaccessor.h	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  Codec to pack and unpack data objects.
+*
+*/
+
+#ifndef PRESENCEAPIDATAOBJFACTORYACCESSOR_H
+#define PRESENCEAPIDATAOBJFACTORYACCESSOR_H
+
+#include "apidataobjfactoryaccessor.h"
+
+class MEventCodec;
+class CPresenceEventCodec;
+class MApiDataObjFactory;
+class CPresenceApiDataObjFactory;
+
+/**
+ * Class to access the different object factories in the datamodel
+ *
+ * @lib ximpdatamodel.dll
+ * @since S60 v3.2
+ */
+NONSHARABLE_CLASS( CPresenceApiDataObjFactoryAccessor ) : public MApiDataObjFactoryAccessor
+    {
+public:
+    IMPORT_C static CPresenceApiDataObjFactoryAccessor* NewL();
+    
+    MApiDataObjFactory& ApiDataObjFactory();
+    
+    MEventCodec& EventCodec();
+    
+    ~CPresenceApiDataObjFactoryAccessor();
+
+private:
+
+    CPresenceApiDataObjFactoryAccessor();
+    void ConstructL();
+    
+//data
+private:
+    // Own
+    CPresenceEventCodec* iPresenceEventCodec;
+    
+    // Own
+    CPresenceApiDataObjFactory* iPresenceApiDataObjFactory;
+
+    };
+
+#endif // PRESENCEAPIDATAOBJFACTORYACCESSOR_H
+
+
+
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresencedatamodel/presenceapiobjbase.h	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  Base class for XIMP API implementations.
+*
+*/
+
+#ifndef PRESENCEAPIOBJBASE_H
+#define PRESENCEAPIOBJBASE_H
+
+
+/**
+ * Presence plugin class implementation UIDs.
+ *
+ * These do not have to be "real" Symbian UIDs, but such ID's,
+ * that they do not overlap with XIMP or Presence Plugin API interface IDs.
+ */
+ 
+// 90xx - ximp related
+// 91xx - presence related
+// 92xx - instant messaging related
+
+// Presence plugin events
+#define PRIMP_CLSID_CPRESENTITYEVENTIMP               9100
+#define PRIMP_CLSID_COWNPRESENCEEVENTIMP              9101
+#define PRIMP_CLSID_CPRESENCEGRANTREQUESTLISTEVENTIMP 9102
+#define PRIMP_CLSID_CPRESENTITYGROUPLISTEVENTIMP      9103
+#define PRIMP_CLSID_CPRESENTITYPRESENCEEVENTIMP       9104
+#define PRIMP_CLSID_CPRESENCEBLOCKLISTEVENTIMP        9105
+#define PRIMP_CLSID_CPRESENTITYGROUPCONTENTEVENTIMP   9106
+#define PRIMP_CLSID_CPRESENCEWATCHERLISTEVENTIMP      9107
+#define PRIMP_CLSID_CPRESENCEGRANTREQUESTINFOIMP      9108
+
+
+// Presence datamodel classes
+#define PRIMP_CLSID_CPRESENCEINFOIMP                  9110
+#define PRIMP_CLSID_CPRESENCEINFOFILTERIMP            9111
+#define PRIMP_CLSID_CPRESENCEBLOCKINFOIMP             9112
+#define PRIMP_CLSID_CPRESENTITYGROUPINFOIMP           9113
+#define PRIMP_CLSID_CPRESENTITYGROUPMEMBERINFOIMP     9114
+#define PRIMP_CLSID_CPRESENCEWATCHERINFOIMP           9115
+#define PRIMP_CLSID_CPRESENCEINFOFIELDIMP             9116
+#define PRIMP_CLSID_CPRESENCEINFOFIELDVALUETEXTIMP    9117
+#define PRIMP_CLSID_CPRESENCEINFOFIELDVALUEBINARYIMP  9118
+#define PRIMP_CLSID_CPRESENCEINFOFIELDVALUEENUMIMP    9119
+#define PRIMP_CLSID_CDEVICEPRESENCEINFOIMP            9120
+#define PRIMP_CLSID_CPERSONPRESENCEINFOIMP            9121
+#define PRIMP_CLSID_CSERVICEPRESENCEINFOIMP           9122
+#define PRIMP_CLSID_CPRESENCEINFOFIELDCOLLECTIONIMP   9123
+#define PRIMP_CLSID_CPRESENCEDATACACHE                9124
+
+
+// Presence plugin host environment classes
+#define PRIMP_CLSID_CPROTOCOLPRESENTITYGROUPSDATAHOST      9130
+#define PRIMP_CLSID_CPROTOCOLPRESENCEPUBLISHINGDATAHOST    9131
+#define PRIMP_CLSID_CPROTOCOLPRESENCEWATCHINGDATAHOST      9132
+#define PRIMP_CLSID_CPROTOCOLPRESENCEAUTHORIZATIONDATAHOST 9133
+#define PRIMP_CLSID_CPROTOCOLPRESENCEDATAHOSTIMP           9134
+
+
+// Presence Management classes
+#define PRIMP_CLSID_CPRESENCEPUBLISHINGIMP            9140
+#define PRIMP_CLSID_CPRESENTITYGROUPSIMP              9141
+#define PRIMP_CLSID_CPRESENCEWATCHINGIMP              9142
+#define PRIMP_CLSID_CPRESENCEAUTHORIZATIONIMP         9143
+#define PRIMP_CLSID_CPRESENCEFEATURESIMP              9144
+#define PRIMP_CLSID_CPRESENCEOBJECTFACTORYIMP         9145
+
+// Presence Cache classes
+#define PRIMP_CLSID_CXIMPPRESENCEBUDDYINFOIMP           9150
+#define PRIMP_CLSID_CXIMPPRESENCEBUDDYINFOLIST          9151
+#define PRIMP_CLSID_CPRESENCECACHECLIENT                9152
+
+
+
+
+#endif // PRESENCEAPIOBJBASE_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresencedatamodel/presenceauthorization/blocklistsubscriptionitem.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,269 @@
+/*
+* 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 Service Connection presence block list subscription implementation.
+*
+*/
+
+
+#include <badesca.h>
+
+#include "blocklistsubscriptionitem.h"
+#include "presenceinfofilterimp.h"
+#include "ximpitemparent.h"
+#include "ximppanics.h"
+#include "ximppsccontext.h"
+#include "documentutils.h"
+#include "ximpobjecthelpers.h"
+#include "presencetypehelpers.h"
+#include "presenceblockinfoimp.h"
+#include "presenceblocklisteventimp.h"
+#include "ximpidentityimp.h"
+#include "ximpdatasubscriptionstateimp.h"
+
+#include "ximptrace.h"
+
+// ---------------------------------------------------------------------------
+// CBlockListSubscriptionItem::CBlockListSubscriptionItem()
+// ---------------------------------------------------------------------------
+//
+CBlockListSubscriptionItem::CBlockListSubscriptionItem( MXIMPItemParentBase& aParent )
+: CXIMPSubscriptionItemBase( aParent )
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// CBlockListSubscriptionItem::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void CBlockListSubscriptionItem::ConstructL()
+    {
+    BaseConstructL();
+    // empty lists must always exist
+    iCurrent = new ( ELeave) RPrBlockInfoImpArray;
+    iAdded = new ( ELeave ) RPrBlockInfoImpArray;
+    iRemoved = new ( ELeave ) RPrBlockInfoImpArray;
+    iUpdated = new ( ELeave ) RPrBlockInfoImpArray;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CBlockListSubscriptionItem::NewL()
+// ---------------------------------------------------------------------------
+//
+CBlockListSubscriptionItem* CBlockListSubscriptionItem::NewLC( MXIMPItemParentBase& aParent )
+    {
+    CBlockListSubscriptionItem* self = new( ELeave ) CBlockListSubscriptionItem( aParent );
+    CleanupClosePushL( *self );
+    self->ConstructL();
+    return self;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CBlockListSubscriptionItem::~CBlockListSubscriptionItem()
+// ---------------------------------------------------------------------------
+//
+CBlockListSubscriptionItem::~CBlockListSubscriptionItem()
+    {
+    MXIMPItemParent* presCache = static_cast<MXIMPItemParent*>(iParent.GetInterface(PRESENCE_ITEM_PARENT));
+    presCache->RemoveMe( this );
+
+    if( iCurrent )
+        {
+        iCurrent->Close();
+        }
+    delete iCurrent;
+
+    Clean();
+    // just in case
+    delete iAdded;
+    delete iRemoved;
+    delete iUpdated;
+    }
+
+// ---------------------------------------------------------------------------
+// From MXIMPSubscriptionItem class.
+// CBlockListSubscriptionItem::SynthesiseSubscriptionEventTo()
+// ---------------------------------------------------------------------------
+//
+void CBlockListSubscriptionItem::SynthesiseSubscriptionEventToL(
+        MXIMPPscContext* aContext, TBool aForceEvent )
+    {
+    TRACE_1( _L("CBlockListSubscriptionItem::SynthesiseSubscriptionEventTo() aForce=%d"), aForceEvent );
+    CXIMPDataSubscriptionStateImp* status = StatusLC( aContext );  // << status
+
+    if( status->DataState() == MXIMPDataSubscriptionState::EDataAvailable || aForceEvent )
+        {
+        CleanupStack::Pop( status );    // >> status
+        CPresenceBlockListEventImp* newEvent = CPresenceBlockListEventImp::NewLC(
+                iAdded,
+                aForceEvent ? iCurrent : NULL,
+                iRemoved,
+                iUpdated,
+                status
+                );
+        MXIMPItemParent* presCache = static_cast<MXIMPItemParent*>(iParent.GetInterface(PRESENCE_ITEM_PARENT));
+        presCache->AddEventL( *newEvent, aContext );
+        CleanupStack::PopAndDestroy(); // >>> newEvent
+        }
+     else
+        {
+        CleanupStack::PopAndDestroy(); // >>> status
+        }
+    }
+
+
+// ---------------------------------------------------------------------------
+// CBlockListSubscriptionItem::SetNewListL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CBlockListSubscriptionItem::SetNewListL(
+                                                RPrBlockInfoImpArray* aList )
+    {
+    TRACE_1( _L("CBlockListSubscriptionItem::SetNewListL aList Count=%d"), aList->Count() );
+    RPrBlockInfoImpArray* tmp = aList;
+    CleanupDeletePushL( tmp );
+
+    TLinearOrder<CPresenceBlockInfoImp>
+        linearOrder( CPresenceBlockInfoImp::IdLinearOrder );
+
+    for ( TInt i = 0; i < tmp->Count(); i++ )
+        {
+        // compare against current pending list
+        CPresenceBlockInfoImp* info = (*tmp)[ i ];
+        TInt pos = iCurrent->FindInOrder( info, linearOrder );
+
+        if ( pos == KErrNotFound )
+            {
+            // not found in current list
+            // so must be a fresh watcher
+            iAdded->InsertInOrderL( info, linearOrder );
+            }
+        else
+            {
+            // found in current list, so it must be an updated list name
+            ////iUpdated->InsertInOrderL( info, linearOrder );
+            CPresenceBlockInfoImp* infoClone = NULL;
+            infoClone = TXIMPObjectCloner< CPresenceBlockInfoImp >::CloneLC( *info );
+            iUpdated->AppendL( infoClone ); // ownership is transferrred
+            CleanupStack::Pop( infoClone );
+
+            // remove it from the iCurrent list,
+            // so it won't get on the iRemoved after this loop
+            delete (*iCurrent)[ pos ];
+            iCurrent->Remove( pos );
+            }
+        }
+
+    // what's left in iCurrent contains the removed ones.
+    delete iRemoved;
+    iRemoved = iCurrent;
+
+    // the given list becomes the new current list
+    iCurrent = tmp;
+    CleanupStack::Pop( tmp );
+    iSubscriptionState->SetDataStateL( MXIMPDataSubscriptionState::EDataAvailable );
+    }
+
+
+// ---------------------------------------------------------------------------
+// CBlockListSubscriptionItem::SetBlockedL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CBlockListSubscriptionItem::SetBlockedL(
+                                        CPresenceBlockInfoImp* aReq )
+    {
+    TRACE( _L("CBlockListSubscriptionItem::SetBlockedL") );
+    TLinearOrder<CPresenceBlockInfoImp>
+        linearOrder( CPresenceBlockInfoImp::IdLinearOrder );
+
+    // compare against current list
+    TInt pos = iCurrent->FindInOrder( aReq, linearOrder );
+
+    if ( pos == KErrNotFound )
+        {
+        // not found in current list
+        // so must be a fresh watcher
+        iAdded->InsertInOrderL( aReq, linearOrder );
+        // and also to the pending
+        iCurrent->InsertInOrderL( aReq, linearOrder );
+        // This looks like we take ownership two times, but the way we act
+        // only iCurrent really owns it.
+        // See the comments Clean() for more about this
+
+        iSubscriptionState->SetDataStateL( MXIMPDataSubscriptionState::EDataAvailable );
+        }
+    else
+        {
+        // The request already exists in the pending list.
+        // Ignore and delete the the object
+        delete aReq;
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CBlockListSubscriptionItem::SetCanceledBlockIdL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CBlockListSubscriptionItem::SetCanceledBlockIdL(
+                                                CXIMPIdentityImp* aRemoved )
+    {
+    TRACE( _L("CBlockListSubscriptionItem::SetCanceledBlockIdL") );
+    for ( TInt i = 0; i < iCurrent->Count(); i++ )
+        {
+
+        if ( aRemoved->Compare( (*iCurrent)[ i ]->IdentityImp() ) == 0 )
+            {
+            iRemoved->AppendL( (*iCurrent)[ i ] );
+            iCurrent->Remove( i );
+            break;
+            }
+        }
+
+
+    delete aRemoved;
+    }
+
+// ---------------------------------------------------------------------------
+// CBlockListSubscriptionItem::Clean()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CBlockListSubscriptionItem::Clean()
+    {
+    TRACE( _L("CBlockListSubscriptionItem::Clean") );
+    // empty the lists.
+    // the lists must stay valid for use
+
+    // iAdded is a collection from the pending list.
+    // Do not delete items.
+    // iRemoved and iUpdated hold items. Delete those.
+
+
+    iAdded->Reset();
+    iRemoved->Close();
+    iUpdated->Close();
+    }
+
+// ---------------------------------------------------------------------------
+// From CXIMPSubscriptionItemBase class.
+// CBlockListSubscriptionItem::CleanExpired()
+// ---------------------------------------------------------------------------
+//
+void CBlockListSubscriptionItem::CleanExpired()
+    {
+
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresencedatamodel/presenceauthorization/blocklistsubscriptionitem.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,143 @@
+/*
+* 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 Service Connection presence block list subscription implementation.
+*
+*/
+
+#ifndef CPSCBLOCKLISTSUBSCRIPTIONITEM_H
+#define CPSCBLOCKLISTSUBSCRIPTIONITEM_H
+
+#include <e32base.h>
+#include "presenceinfoimp.h"
+#include "ximpsubscriptionitem.h"
+#include "presencetypehelpers.h"
+#include "ximpsubscriptionitembase.h"
+
+class MXIMPItemParentBase;
+class MXIMPPscContext;
+class CDesC16Array;
+class CPresenceGrantRequestInfoImp;
+
+/**
+ * PSC group list subscription implementation
+ *
+ * @since S60 v3.2
+ */
+class CBlockListSubscriptionItem : public CXIMPSubscriptionItemBase
+    {
+
+public: // Construction and destruction
+
+    /**
+     * Construction
+     * @param aParent. Parent has to be informed when this object is deleted by RemoveMe method.
+     */
+    static CBlockListSubscriptionItem* NewLC( MXIMPItemParentBase& aParent );
+
+    /**
+     * Destruction
+     * - Remember to inform parent about delete.
+     */
+    ~CBlockListSubscriptionItem();
+
+private: // Construction and destruction
+
+    /**
+     * Construction
+     * @param aParent. Parent has to be informed when this object is deleted by RemoveMe method.
+     */
+    CBlockListSubscriptionItem( MXIMPItemParentBase& aParent );
+
+    /**
+     * Construction
+     */
+    void ConstructL();
+
+public: // New methods
+
+    /**
+     * Resolves deltas from new list and replaces old current.
+     * Ownership is transferred!
+     * @param aList New blocklist.
+     */
+    IMPORT_C void SetNewListL( RPrBlockInfoImpArray* aList );
+
+    /**
+     * Add new blocked object to current.
+     * Ownership is transferred!
+     * @param aReq Information of new blocked item.
+     */
+    IMPORT_C void SetBlockedL( CPresenceBlockInfoImp* aReq );
+    
+    /**
+     * Cancels block from identity
+     * Ownership is transferred!
+     * @param aRemoved Identity of item not blocked anymore.
+     */
+    IMPORT_C void SetCanceledBlockIdL( CXIMPIdentityImp* aRemoved );
+
+    /**
+     * Remove the temporary lists.
+     */
+    IMPORT_C void Clean();
+
+public: // From MXIMPSubscriptionItem
+
+    /**
+     * @see MXIMPSubscriptionItem
+     */
+    void SynthesiseSubscriptionEventToL( MXIMPPscContext* aContext, TBool aForceEvent );
+
+private: // From CXIMPSubscriptionItemBase
+
+    /**
+     * @see CXIMPSubscriptionItemBase
+     */
+    void CleanExpired();
+
+
+private: // Data
+
+    /**
+     * Current list of groups.
+     * Owned.
+     */
+    RPrBlockInfoImpArray* iAdded;
+
+    /**
+     * List of created groups (new since last update).
+     * Owned.
+     */
+    RPrBlockInfoImpArray* iCurrent;
+
+    /**
+     * List of deleted groups (removed since last update).
+     * Owned.
+     */
+    RPrBlockInfoImpArray* iRemoved;
+
+    /**
+     * List of updated groups (removed since last update).
+     * Owned.
+     */
+    RPrBlockInfoImpArray* iUpdated;
+
+    };
+
+
+/* ======================================================================== */
+
+
+
+#endif // CPSCBLOCKLISTSUBSCRIPTIONITEM_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresencedatamodel/presenceauthorization/grantrequestlistsubscriptionitem.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,259 @@
+/*
+* 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 Service Connection presence watcher list subscription implementation.
+*
+*/
+
+
+#include <badesca.h>
+
+#include "grantrequestlistsubscriptionitem.h"
+#include "presenceinfofilterimp.h"
+#include "ximpitemparent.h"
+#include "ximppanics.h"
+#include "ximppsccontext.h"
+#include "documentutils.h"
+#include "ximpobjecthelpers.h"
+#include "presencetypehelpers.h"
+#include "presencegrantrequestinfoimp.h"
+#include "presencegrantrequestlisteventimp.h"
+#include "ximpidentityimp.h"
+#include "ximpdatasubscriptionstateimp.h"
+
+#include "ximptrace.h"
+
+
+// ---------------------------------------------------------------------------
+// CGrantRequestListSubscriptionItem::CGrantRequestListSubscriptionItem()
+// ---------------------------------------------------------------------------
+//
+CGrantRequestListSubscriptionItem::CGrantRequestListSubscriptionItem( MXIMPItemParentBase& aParent )
+: CXIMPSubscriptionItemBase( aParent )
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// CGrantRequestListSubscriptionItem::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void CGrantRequestListSubscriptionItem::ConstructL()
+    {
+    BaseConstructL();
+    // empty lists must always exist
+    iPending = new ( ELeave) RPrGrntReqInfoImpArray;
+    iNewRequests = new ( ELeave ) RPrGrntReqInfoImpArray;
+    iObsoleted = new ( ELeave ) RPrGrntReqInfoImpArray;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CGrantRequestListSubscriptionItem::NewL()
+// ---------------------------------------------------------------------------
+//
+CGrantRequestListSubscriptionItem* CGrantRequestListSubscriptionItem::NewLC( MXIMPItemParentBase& aParent )
+    {
+    CGrantRequestListSubscriptionItem* self = new( ELeave ) CGrantRequestListSubscriptionItem( aParent );
+    CleanupClosePushL( *self );
+    self->ConstructL();
+    return self;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CGrantRequestListSubscriptionItem::~CGrantRequestListSubscriptionItem()
+// ---------------------------------------------------------------------------
+//
+CGrantRequestListSubscriptionItem::~CGrantRequestListSubscriptionItem()
+    {
+    MXIMPItemParent* presCache = static_cast<MXIMPItemParent*>(iParent.GetInterface(PRESENCE_ITEM_PARENT));
+    presCache->RemoveMe( this );
+
+
+    if( iPending )
+        {
+        iPending->Close();
+        }
+    delete iPending;
+
+    Clean();
+    // just in case
+    delete iNewRequests;
+    delete iObsoleted;
+    }
+
+// ---------------------------------------------------------------------------
+// From MXIMPSubscriptionItem class.
+// CGrantRequestListSubscriptionItem::SynthesiseSubscriptionEventTo()
+// ---------------------------------------------------------------------------
+//
+void CGrantRequestListSubscriptionItem::SynthesiseSubscriptionEventToL(
+        MXIMPPscContext* aContext, TBool aForceEvent )
+    {
+    TRACE_1( _L("CGrantRequestListSubscriptionItem::SynthesiseSubscriptionEventTo() aForce=%d"), aForceEvent );
+    CXIMPDataSubscriptionStateImp* status = StatusLC( aContext );  // << status
+
+    if( status->DataState() == MXIMPDataSubscriptionState::EDataAvailable || aForceEvent )
+        {
+        CleanupStack::Pop( status );    // >> status
+        CPresenceGrantRequestListEventImp* newEvent = CPresenceGrantRequestListEventImp::NewLC(
+                iNewRequests,
+                aForceEvent ? iPending : NULL,
+                iObsoleted,
+                status );
+                
+        MXIMPItemParent* presCache = static_cast<MXIMPItemParent*>(iParent.GetInterface(PRESENCE_ITEM_PARENT));
+        presCache->AddEventL( *newEvent, aContext );
+        CleanupStack::PopAndDestroy(); // >>> newEvent
+        }
+     else
+        {
+        CleanupStack::PopAndDestroy(); // >>> status
+        }
+    }
+
+
+// ---------------------------------------------------------------------------
+// CGrantRequestListSubscriptionItem::SetNewListL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CGrantRequestListSubscriptionItem::SetNewListL(
+                                                RPrGrntReqInfoImpArray* aList )
+    {
+    TRACE_1( _L("CGrantRequestListSubscriptionItem::SetNewListL aList Count=%d"), aList->Count() );
+    RPrGrntReqInfoImpArray* tmp = aList;
+    CleanupDeletePushL( tmp );
+
+    TLinearOrder<CPresenceGrantRequestInfoImp>
+        linearOrder( CPresenceGrantRequestInfoImp::IdLinearOrder );
+
+    for ( TInt i = 0; i < tmp->Count(); i++ )
+        {
+        // compare against current pending list
+        CPresenceGrantRequestInfoImp* info = (*tmp)[ i ];
+        TInt pos = iPending->FindInOrder( info, linearOrder );
+
+        if ( pos == KErrNotFound )
+            {
+            // not found in current list
+            // so must be a fresh watcher
+            iNewRequests->InsertInOrderL( info, linearOrder );
+            }
+        else
+            {
+            // otherwise remove it from the iPending list,
+            // so it won't get on the iObsoleted after this loop
+            delete (*iPending)[ pos ];
+            iPending->Remove( pos );
+            }
+        }
+
+    // what's left in iPending contains the obsoleted ones.
+    delete iObsoleted;
+    iObsoleted = iPending;
+
+    // the given list becomes the new pending list
+    iPending = tmp;
+    CleanupStack::Pop( tmp );
+    iSubscriptionState->SetDataStateL( MXIMPDataSubscriptionState::EDataAvailable );
+    }
+
+
+// ---------------------------------------------------------------------------
+// CGrantRequestListSubscriptionItem::SetReceivedRequestL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CGrantRequestListSubscriptionItem::SetReceivedRequestL(
+                                        CPresenceGrantRequestInfoImp* aReq )
+    {
+    TRACE( _L("CGrantRequestListSubscriptionItem::SetReceivedRequestL") );
+    TLinearOrder<CPresenceGrantRequestInfoImp>
+        linearOrder( CPresenceGrantRequestInfoImp::IdLinearOrder );
+
+    // compare against current list
+    TInt pos = iPending->FindInOrder( aReq, linearOrder );
+
+    if ( pos == KErrNotFound )
+        {
+        // not found in current list
+        // so must be a fresh watcher
+        iNewRequests->InsertInOrderL( aReq, linearOrder );
+        // and also to the pending
+        iPending->InsertInOrderL( aReq, linearOrder );
+        // This looks like we take ownership two times, but the way we act
+        // only iPending really owns it.
+        // See the comments Clean() for more about this
+
+        iSubscriptionState->SetDataStateL( MXIMPDataSubscriptionState::EDataAvailable );
+        }
+    else
+        {
+        // The request already exists in the pending list.
+        // Ignore and delete the the object
+        delete aReq;
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CGrantRequestListSubscriptionItem::SetObsoletedRequestL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CGrantRequestListSubscriptionItem::SetObsoletedRequestL(
+                                                CXIMPIdentityImp* aObsoleted )
+    {
+    TRACE( _L("CGrantRequestListSubscriptionItem::SetObsoletedRequestL") );
+    for ( TInt i = 0; i < iPending->Count(); i++ )
+        {
+        if ( aObsoleted->Compare( (*iPending)[ i ]->IdentityImp() ) == 0 )
+            {
+            iObsoleted->AppendL( (*iPending)[ i ] );
+            iPending->Remove( i );
+            break;
+            }
+        }
+
+
+    delete aObsoleted;
+    }
+
+// ---------------------------------------------------------------------------
+// CGrantRequestListSubscriptionItem::Clean()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CGrantRequestListSubscriptionItem::Clean()
+    {
+    TRACE( _L("CGrantRequestListSubscriptionItem::Clean") );
+    // empty the lists.
+    // the lists must stay valid for use
+
+    // iNewRequests is a collection from the pending list.
+    // Do not delete items.
+    // iObsoleted is only place for items. Delete those.
+
+
+    iNewRequests->Reset();
+    iObsoleted->Close();
+    }
+
+// ---------------------------------------------------------------------------
+// From CXIMPSubscriptionItemBase class.
+// CGrantRequestListSubscriptionItem::CleanExpired()
+// ---------------------------------------------------------------------------
+//
+void CGrantRequestListSubscriptionItem::CleanExpired()
+    {
+
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresencedatamodel/presenceauthorization/grantrequestlistsubscriptionitem.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,136 @@
+/*
+* 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 Service Connection group list subscription implementation.
+*
+*/
+
+#ifndef CPSCGRANTREQUESTLISTSUBSCRIPTIONITEM_H
+#define CPSCGRANTREQUESTLISTSUBSCRIPTIONITEM_H
+
+#include <e32base.h>
+#include "presenceinfoimp.h"
+#include "ximpsubscriptionitem.h"
+#include "presencetypehelpers.h"
+#include "ximpsubscriptionitembase.h"
+
+class MXIMPItemParentBase;
+class MXIMPPscContext;
+class CDesC16Array;
+class CPresenceGrantRequestInfoImp;
+
+/**
+ * PSC group list subscription implementation
+ *
+ * @since S60 v3.2
+ */
+class CGrantRequestListSubscriptionItem : public CXIMPSubscriptionItemBase
+    {
+
+public: // Construction and destruction
+
+    /**
+     * Construction
+     * @param aParent. Parent has to be informed when this object is deleted by RemoveMe method.
+     */
+    static CGrantRequestListSubscriptionItem* NewLC( MXIMPItemParentBase& aParent );
+
+    /**
+     * Destruction
+     * - Remember to inform parent about delete.
+     */
+    ~CGrantRequestListSubscriptionItem();
+
+private: // Construction and destruction
+
+    /**
+     * Construction
+     * @param aParent. Parent has to be informed when this object is deleted by RemoveMe method.
+     */
+    CGrantRequestListSubscriptionItem( MXIMPItemParentBase& aParent );
+
+    /**
+     * Construction
+     */
+    void ConstructL();
+
+public: // New methods
+
+    /**
+     * Resolve deltas and replace old current with new list.
+     * Ownership is transferred!
+     * @param aList New current list.
+     */
+    IMPORT_C void SetNewListL( RPrGrntReqInfoImpArray* aList );
+    
+    /**
+     * New received request to current.
+     * Ownership is transferred!
+     * @param aReq New grant request.
+     */
+    IMPORT_C void SetReceivedRequestL( CPresenceGrantRequestInfoImp* aReq );
+    
+    /**
+     * Remove identity from current list.
+     * Ownership is transferred!
+     * @param aObsoleted Obsolated grant request.
+     */
+    IMPORT_C void SetObsoletedRequestL( CXIMPIdentityImp* aObsoleted );
+
+    /**
+     * Remove the temporary lists.
+     */
+    IMPORT_C void Clean();
+
+public: // From MXIMPSubscriptionItem
+
+    /**
+     * @see MXIMPSubscriptionItem
+     */
+    void SynthesiseSubscriptionEventToL( MXIMPPscContext* aContext, TBool aForceEvent );
+
+private: // From CXIMPSubscriptionItemBase
+
+    /**
+     * @see CXIMPSubscriptionItemBase
+     */
+    void CleanExpired();
+
+private: // Data
+
+    /**
+     * Current list of groups.
+     * Owned.
+     */
+    RPrGrntReqInfoImpArray* iNewRequests;
+
+    /**
+     * List of created groups (new since last update).
+     * Owned.
+     */
+    RPrGrntReqInfoImpArray* iPending;
+
+    /**
+     * List of deleted groups (removed since last update).
+     * Owned.
+     */
+    RPrGrntReqInfoImpArray* iObsoleted;
+
+    };
+
+
+/* ======================================================================== */
+
+
+
+#endif // CPSCGRANTREQUESTLISTSUBSCRIPTIONITEM_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresencedatamodel/presenceauthorization/groupcontenteventobserver.h	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  Event observer interface for group content subscription.
+*
+*/
+
+#ifndef MGROUPCONTENTEVENTOBSERVER_H
+#define MGROUPCONTENTEVENTOBSERVER_H
+
+#include "presencetypehelpers.h"
+
+/**
+ * Event observer interface for group content changes.
+ *
+ * @since S60 v3.2
+ */
+class MGroupContentEventObserver
+    {
+public: // Interface
+
+    /** 
+     * Handle event of added and removed items.
+     */
+    virtual void HandleChangeL( RPrGrpMemInfoImpArray& aAdded, RPrGrpMemInfoImpArray& aRemoved ) = 0;
+    virtual void HandleSynthesiseL( RPrGrpMemInfoImpArray& aAdded ) = 0;
+
+protected: // Destruction
+
+    /**
+     * Object cannot be deleted through this interface
+     */
+    virtual ~MGroupContentEventObserver(){}
+    };
+
+/* ======================================================================== */
+
+
+
+#endif // MGROUPCONTENTEVENTOBSERVER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresencedatamodel/presenceauthorization/groupmemberspresenceconfigurationitem.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  Group members presence configuration item
+*
+*/
+
+
+#include "groupmemberspresenceconfigurationitem.h"
+#include "groupcontentsubscriptionitem.h"
+#include "presenceinfofilterimp.h"
+#include "ximpitemparent.h"
+#include "ximppanics.h"
+#include "ximppsccontext.h"
+#include "documentutils.h" // Perhaps this should be renamed
+#include "presentitypresenceeventimp.h"
+#include "presentitygroupmemberinfoimp.h"
+#include "ximpidentityimp.h"
+
+#include "ximptrace.h"
+
+// ---------------------------------------------------------------------------
+// CGroupMembersPresenceConfigurationItem::CGroupMembersPresenceConfigurationItem()
+// ---------------------------------------------------------------------------
+//
+CGroupMembersPresenceConfigurationItem::CGroupMembersPresenceConfigurationItem( MXIMPItemParentBase& aParent, CGroupContentSubscriptionItem& aContentItem )
+: CXIMPConfigurationItemBase( aParent ), iContentItem( aContentItem )
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// CGroupMembersPresenceConfigurationItem::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void CGroupMembersPresenceConfigurationItem::ConstructL()
+    {
+    BaseConstructL();
+    iContentItem.RegisterEventObserverL( this );
+    }
+
+
+// ---------------------------------------------------------------------------
+// CGroupMembersPresenceConfigurationItem::NewLC()
+// ---------------------------------------------------------------------------
+//
+CGroupMembersPresenceConfigurationItem*
+    CGroupMembersPresenceConfigurationItem::NewLC( MXIMPItemParentBase& aParent,
+                                                   CGroupContentSubscriptionItem& aContentItem )
+    {
+    CGroupMembersPresenceConfigurationItem* self =
+        new( ELeave ) CGroupMembersPresenceConfigurationItem( aParent, aContentItem );
+    CleanupClosePushL( *self );
+    self->ConstructL();
+    return self;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CGroupMembersPresenceConfigurationItem::~CGroupMembersPresenceConfigurationItem()
+// ---------------------------------------------------------------------------
+//
+CGroupMembersPresenceConfigurationItem::~CGroupMembersPresenceConfigurationItem()
+    {
+    MXIMPItemParent* presCache = static_cast<MXIMPItemParent*>(iParent.GetInterface(PRESENCE_ITEM_PARENT));
+    presCache->RemoveMe( this );
+
+
+    delete iIdentity;
+
+    delete iPif;
+    iContentItem.UnregisterEventObserver( this );
+    }
+
+// ---------------------------------------------------------------------------
+// CGroupMembersPresenceConfigurationItem::ConfigurationPif()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CPresenceInfoFilterImp&
+            CGroupMembersPresenceConfigurationItem::ConfigurationPif()
+    {
+    TRACE(_L("CGroupMembersPresenceConfigurationItem::ConfigurationPif" ) );
+    __ASSERT_ALWAYS( iPif, User::Panic( NXIMPPrivPanic::KCategory,
+                                        NXIMPPrivPanic::EOwnPresencePifNotSet ) );
+    return *iPif;
+    }
+
+// ---------------------------------------------------------------------------
+// CGroupMembersPresenceConfigurationItem::SetConfigurationPif()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CGroupMembersPresenceConfigurationItem::SetConfigurationPif(
+                                                CPresenceInfoFilterImp* aPif )
+    {
+    TRACE(_L("CGroupMembersPresenceConfigurationItem::SetConfigurationPif" ) );
+    if ( !aPif )
+        {
+        TRACE(_L("CGroupMembersPresenceConfigurationItem::SetConfigurationPif aPif NULL" ) );
+        }
+    delete iPif;
+    iPif = aPif;
+    }
+
+// ---------------------------------------------------------------------------
+// CGroupMembersPresenceConfigurationItem::CollectSubscriptionPifWithoutCtxL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CPresenceInfoFilterImp*
+    CGroupMembersPresenceConfigurationItem::CollectConfigurationPifWithoutCtxL(
+                                                        MXIMPPscContext* aContext )
+    {
+    TRACE(_L("CGroupMembersPresenceConfigurationItem::CollectConfigurationPifWithoutCtxL" ) );
+    RPointerArray< CPresenceInfoFilterImp > arrayOfPifs;
+    CleanupClosePushL( arrayOfPifs );
+
+    TInt count = iConfigContexts.Count();
+    for( TInt a = 0; a < count; ++a )
+        {
+        if( iConfigContexts[ a ] != aContext )
+            {
+            CPresenceInfoFilterImp* filter = iConfigContexts[ a ]->PresenceInfoFilter( 
+                        MXIMPPscContext::EGrantPresenceToGroupMemberFilter, iIdentity );
+            if ( filter )
+                {
+                arrayOfPifs.AppendL( filter );
+                }
+            }
+        }
+    CPresenceInfoFilterImp* pifWithoutCtx = DocumentUtils::InfoFilterUnionL( arrayOfPifs );
+    CleanupStack::PopAndDestroy(); // arrayOfPifs
+    TRACE(_L("CGroupMembersPresenceConfigurationItem::CollectConfigurationPifWithoutCtxL done" ) );
+    return pifWithoutCtx;
+    }
+
+// ---------------------------------------------------------------------------
+// CGroupMembersPresenceConfigurationItem::Order()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CGroupMembersPresenceConfigurationItem::Order(
+                        const CGroupMembersPresenceConfigurationItem& aA,
+                        const CGroupMembersPresenceConfigurationItem& aB )
+    {
+    return IdentityOrder( aA.iIdentity, aB );
+    }
+// ---------------------------------------------------------------------------
+// CGroupMembersPresenceConfigurationItem::Order()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CGroupMembersPresenceConfigurationItem::IdentityOrder(
+                        const CXIMPIdentityImp* aA,
+                        const CGroupMembersPresenceConfigurationItem& aB )
+    {
+    return aA->Compare( *aB.iIdentity );
+    }
+
+// ---------------------------------------------------------------------------
+// CGroupMembersPresenceConfigurationItem::Identity()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C const MXIMPIdentity& CGroupMembersPresenceConfigurationItem::Identity() const
+    {
+    return *iIdentity;
+    }
+
+// ---------------------------------------------------------------------------
+// CGroupMembersPresenceConfigurationItem::SetIdentity()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CGroupMembersPresenceConfigurationItem::SetIdentity(
+                                            CXIMPIdentityImp* aIdentity )
+    {
+    delete iIdentity;
+    iIdentity = aIdentity;
+    }
+
+// ---------------------------------------------------------------------------
+// From class MXIMPSubscriptionItem.
+// CGroupMembersPresenceConfigurationItem::SynthesiseSubscriptionEventTo()
+// ---------------------------------------------------------------------------
+//
+void CGroupMembersPresenceConfigurationItem::SynthesiseSubscriptionEventToL(
+                                                    MXIMPPscContext* aContext,
+                                                    TBool aForceEvent )
+    {
+    TRACE_1( _L("CGroupMembersPresenceConfigurationItem::SynthesiseSubscriptionEventTo() aForce=%d"), aForceEvent );
+    // Synthesise event to all members
+    TInt count = iContentItem.MemberCount();
+    MXIMPItemParent* presCache = static_cast<MXIMPItemParent*>(iParent.GetInterface(PRESENCE_ITEM_PARENT));
+    for( TInt a = 0; a < count; ++a )
+        {
+        CPresentityGroupMemberInfoImp& memberInfo = iContentItem.MemberAt( a );
+        const CXIMPIdentityImp& identity = memberInfo.IdentityImp();
+
+        presCache->SynthesisePresentityPresenceSubscriptionEventToL( identity, aContext, aForceEvent );
+        }
+    TRACE(_L("CGroupMembersPresenceConfigurationItem::SynthesiseSubscriptionEventTo done" ) );
+    }
+
+
+// ---------------------------------------------------------------------------
+// CGroupMembersPresenceConfigurationItem::ActivateSubscriberL()
+// ---------------------------------------------------------------------------
+//
+void CGroupMembersPresenceConfigurationItem::ActivateSubscriberL( MXIMPPscContext* aContext )
+    {
+    TRACE_1( _L("CGroupMembersPresenceConfigurationItem::ActivateSubscriberL() aContext=%d"), aContext );
+    CXIMPSubscriptionItemBase::ActivateSubscriberL( aContext );
+
+    // Subscribe presentity presence items.
+    TInt count = iContentItem.MemberCount();
+    TRACE_1( _L("CGroupMembersPresenceConfigurationItem::ActivateSubscriberL( MXIMPPscContext* aContext ) : iContentItem.MemberCount = %d"), count );
+    MXIMPItemParent* presCache = static_cast<MXIMPItemParent*>(iParent.GetInterface(PRESENCE_ITEM_PARENT));
+    for( TInt a = 0; a < count; ++a )
+        {
+        TRACE_1( _L("CGroupMembersPresenceConfigurationItem::ActivateSubscriberL( MXIMPPscContext* aContext ) : a = %d"), a );
+        
+        CPresentityGroupMemberInfoImp& memberInfo = iContentItem.MemberAt( a );
+        const CXIMPIdentityImp& identity = memberInfo.IdentityImp();
+        TInt error ( KErrNone );
+        TRAP( error, presCache->ActivatePresentityPresenceSubscriberL( identity, this );)
+        TRACE_1( _L("CGroupMembersPresenceConfigurationItem::ActivateSubscriberL( MXIMPPscContext* aContext ) : iParent.ActivatePresentityPresenceSubscriberL : error = %d"), error );
+
+        }
+    }
+
+
+// ---------------------------------------------------------------------------
+// CGroupMembersPresenceConfigurationItem::CleanExpired()
+// ---------------------------------------------------------------------------
+//
+void CGroupMembersPresenceConfigurationItem::CleanExpired()
+    {
+
+    }
+
+// ---------------------------------------------------------------------------
+// CGroupMembersPresenceConfigurationItem::AddConfiguratorL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CGroupMembersPresenceConfigurationItem::AddConfiguratorL( MXIMPPscContext* aContext )
+    {
+    CXIMPConfigurationItemBase::AddConfiguratorL( aContext );
+
+	MXIMPItemParent* presCache = static_cast<MXIMPItemParent*>(iParent.GetInterface(PRESENCE_ITEM_PARENT));
+    // Subscribe presentity presence items.
+    TInt count = iContentItem.MemberCount();
+    for( TInt a = 0; a < count; ++a )
+        {
+        CPresentityGroupMemberInfoImp& memberInfo = iContentItem.MemberAt( a );
+        const CXIMPIdentityImp& identity = memberInfo.IdentityImp();
+
+        presCache->AddPresenceConfiguratorL( identity, this );
+        }
+    }
+
+
+// ---------------------------------------------------------------------------
+// CGroupMembersPresenceConfigurationItem::RemoveConfigurator()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CGroupMembersPresenceConfigurationItem::RemoveConfigurator( MXIMPPscContext* aContext )
+    {
+    MXIMPItemParent* presCache = static_cast<MXIMPItemParent*>(iParent.GetInterface(PRESENCE_ITEM_PARENT));
+    // Subscribe presentity presence items.
+    TInt count = iContentItem.MemberCount();
+    for( TInt a = 0; a < count; ++a )
+        {
+        CPresentityGroupMemberInfoImp& memberInfo = iContentItem.MemberAt( a );
+        const CXIMPIdentityImp& identity = memberInfo.IdentityImp();
+
+        presCache->RemovePresenceConfigurator( identity, this );
+        }
+    CXIMPConfigurationItemBase::RemoveConfigurator( aContext );
+    }
+
+
+// ---------------------------------------------------------------------------
+// CGroupMembersPresenceConfigurationItem::HandleEventL()
+// ---------------------------------------------------------------------------
+//
+void CGroupMembersPresenceConfigurationItem::HandleChangeL(
+                                RPrGrpMemInfoImpArray& aAdded, RPrGrpMemInfoImpArray& aRemoved )
+    {
+    TRACE(_L("CGroupMembersPresenceConfigurationItem::ConfigurationPif" ) );
+    MXIMPItemParent* presCache = static_cast<MXIMPItemParent*>(iParent.GetInterface(PRESENCE_ITEM_PARENT));
+    TInt count = aAdded.Count();
+    for( TInt a = 0; a < count; ++a )
+        {
+        CPresentityGroupMemberInfoImp& memberInfo = *aAdded[ a ];
+        const CXIMPIdentityImp& identity = memberInfo.IdentityImp();
+
+        presCache->AddPresenceConfiguratorL( identity, this );
+        }
+    count = aRemoved.Count();
+    for( TInt a = 0; a < count; ++a )
+        {
+        CPresentityGroupMemberInfoImp& memberInfo = *aRemoved[ a ];
+        const CXIMPIdentityImp& identity = memberInfo.IdentityImp();
+
+        presCache->RemovePresenceConfigurator( identity, this );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CGroupMembersPresenceConfigurationItem::HandleEventL()
+// ---------------------------------------------------------------------------
+//
+void CGroupMembersPresenceConfigurationItem::HandleSynthesiseL(
+                                                        RPrGrpMemInfoImpArray& aTarget )
+    {
+    TRACE(_L("CGroupMembersPresenceConfigurationItem::ConfigurationPif" ) );
+    TInt count = aTarget.Count();
+    MXIMPItemParent* presCache = static_cast<MXIMPItemParent*>(iParent.GetInterface(PRESENCE_ITEM_PARENT));
+    for( TInt a = 0; a < count; ++a )
+        {
+        CPresentityGroupMemberInfoImp& memberInfo = *aTarget[ a ];
+        const CXIMPIdentityImp& identity = memberInfo.IdentityImp();
+
+        presCache->ActivatePresentityPresenceSubscriberL( identity, this );
+        TInt contextCount = iContexts.Count();
+        for( TInt b = 0; b < contextCount; ++b )
+            {
+            presCache->SynthesisePresentityPresenceSubscriptionEventToL( identity, iContexts[ a ], EFalse );
+            }
+        }
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresencedatamodel/presenceauthorization/groupmemberspresenceconfigurationitem.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,182 @@
+/*
+* 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:  Group members presence configuration item
+*
+*/
+
+#ifndef CPSCGROUPMEMBERSPRESENCECONFIGURATIONITEM_H
+#define CPSCGROUPMEMBERSPRESENCECONFIGURATIONITEM_H
+
+#include <e32base.h>
+#include "presenceinfoimp.h"
+#include "ximpconfigurationitembase.h"
+#include "groupcontenteventobserver.h"
+
+class MXIMPItemParentBase;
+class MXIMPPscContext;
+class CPresenceInfoFilterImp;
+class MXIMPIdentity;
+class CXIMPIdentityImp;
+class CGroupContentSubscriptionItem;
+
+/**
+ * Group members presence configuration item
+ *
+ * @since S60 v3.2
+ */
+class CGroupMembersPresenceConfigurationItem : public CXIMPConfigurationItemBase, 
+                                               public MGroupContentEventObserver
+    {
+public: // Construction and destruction
+
+    /**
+     * Construction
+     * @param aParent. Parent has to be informed when this object is deleted by RemoveMe method.
+     */
+    static CGroupMembersPresenceConfigurationItem* NewLC( MXIMPItemParentBase& aParent,
+                                                          CGroupContentSubscriptionItem& aContentItem );
+
+    /**
+     * Destruction
+     * - Remember to inform parent about delete.
+     */
+    ~CGroupMembersPresenceConfigurationItem();
+
+private: // Construction and destruction
+
+    /**
+     * Construction
+     * @param aParent. Parent has to be informed when this object is deleted by RemoveMe method.
+     */
+    CGroupMembersPresenceConfigurationItem( MXIMPItemParentBase& aParent, 
+                                            CGroupContentSubscriptionItem& aContentItem );
+
+    /**
+     * Construction
+     */
+    void ConstructL();
+
+public: // New methods
+
+
+    /**
+     * Current presence information filter.
+     * @return Current presence information filter.
+     */
+    IMPORT_C CPresenceInfoFilterImp& ConfigurationPif();
+    
+    /**
+     * Set current presence information filter. Overwrites existing one.
+     * Ownership is transferred to callee.
+     * @param aPif Current presence information filter.
+     */
+    IMPORT_C void SetConfigurationPif( CPresenceInfoFilterImp* aPif );
+
+    /**
+     * Collect aggregated presence information filter without given context.
+     * @param aContext. Exluded context from aggregated pif.
+     * @return Aggregated pif without exluded context.
+     */    
+    IMPORT_C CPresenceInfoFilterImp* CollectConfigurationPifWithoutCtxL( 
+                                                    MXIMPPscContext* aContext );
+    
+    /**
+     * For ordering items.
+     * @param aA Key item for ordering.
+     * @param aB Item to compare
+     * @return -1 if aB is greater than aA
+     *          0 if they are same
+     *          1 if aA if greater than aB.
+     */    
+    IMPORT_C static TInt Order( const CGroupMembersPresenceConfigurationItem& aA,
+                         const CGroupMembersPresenceConfigurationItem& aB );
+    /**
+     * For ordering items using identity as key.
+     * @param aA Key identity for ordering.
+     * @param aB Item to compare
+     * @return -1 if aB is greater than aA
+     *          0 if they are same
+     *          1 if aA if greater than aB.
+     */    
+    IMPORT_C static TInt IdentityOrder( const CXIMPIdentityImp* aA,
+                         const CGroupMembersPresenceConfigurationItem& aB );
+    /**
+     * Identity of item.
+     * @return Identity of item.     
+     */
+    IMPORT_C const MXIMPIdentity& Identity() const;
+
+    /**
+     * Set identity for item
+     * @param aIdentity. New identity for item. Ownership is transferred.
+     */
+    IMPORT_C void SetIdentity( CXIMPIdentityImp* aIdentity );
+    
+public: // From MXIMPSubscriptionItem
+
+    /**
+     * @see MXIMPSubscriptionItem
+     */
+    void SynthesiseSubscriptionEventToL( MXIMPPscContext* aContext, TBool aForceEvent );
+    void ActivateSubscriberL( MXIMPPscContext* aContext );
+    
+private: // From CXIMPSubscriptionItemBase
+
+    /**
+     * @see CXIMPSubscriptionItemBase
+     */
+    void CleanExpired();
+
+public: // From CXIMPConfigurationItemBase
+
+    /**
+     * @see CXIMPConfigurationItemBase
+     */
+    IMPORT_C void AddConfiguratorL( MXIMPPscContext* aContext );
+    IMPORT_C void RemoveConfigurator( MXIMPPscContext* aContext );    
+        
+private: // From MGroupContentSubscriptionEventObserver    
+
+    /** 
+     * @see MGroupContentSubscriptionEventObserver
+     */
+    void HandleChangeL( RPrGrpMemInfoImpArray& aAdded, RPrGrpMemInfoImpArray& aRemoved );
+    void HandleSynthesiseL( RPrGrpMemInfoImpArray& aAdded );
+    
+private: // Data
+
+    /**
+     * Current presence information filter.
+     * Own
+     */
+    CPresenceInfoFilterImp* iPif;
+        
+    /**
+     * Identity of item.
+     * Own
+     */
+    CXIMPIdentityImp* iIdentity;
+    
+    /**
+     * Owns reference to content item. Use close for delete.
+     */
+    CGroupContentSubscriptionItem& iContentItem;
+    };
+
+
+/* ======================================================================== */
+
+
+
+#endif // CPSCGROUPMEMBERSPRESENCECONFIGURATIONITEM_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresencedatamodel/presenceauthorization/presenceblockinfoimp.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,259 @@
+/*
+* 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:  MPresenceBlockInfo API object implementation.
+*
+*/
+
+#include "presenceblockinfoimp.h"
+#include "ximpidentityimp.h"
+#include "ximprbufhelpers.h"
+#include "ximpobjecthelpers.h"
+
+
+// ============================ MEMBER FUNCTIONS =============================
+
+// ---------------------------------------------------------------------------
+// CPresenceBlockInfoImp::NewLC()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CPresenceBlockInfoImp* CPresenceBlockInfoImp::NewLC(
+                            const MXIMPIdentity& aIdentity,
+                            const TDesC16& aDisplayName )
+    {
+    CPresenceBlockInfoImp* self = new( ELeave ) CPresenceBlockInfoImp;
+    CleanupStack::PushL( self );
+    self->ConstructL( aIdentity, aDisplayName );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceBlockInfoImp::NewLC()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CPresenceBlockInfoImp* CPresenceBlockInfoImp::NewLC()
+    {
+    CPresenceBlockInfoImp* self = new( ELeave ) CPresenceBlockInfoImp;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CPresenceBlockInfoImp::NewL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CPresenceBlockInfoImp* CPresenceBlockInfoImp::NewL()
+    {
+    CPresenceBlockInfoImp* self = NewLC();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CXIMPFeatureInfoImp::NewFromStreamLC()
+// ---------------------------------------------------------------------------
+//
+XIMPIMP_IMPLEMENT_DATAOBJ_NEWFROMSTREAM( CPresenceBlockInfoImp )
+
+// ---------------------------------------------------------------------------
+// Implement supported interface access.
+// ---------------------------------------------------------------------------
+//
+XIMPIMP_IF_BASE_GET_INTERFACE_BEGIN( CPresenceBlockInfoImp, 
+                                     MPresenceBlockInfo )
+XIMPIMP_IF_BASE_GET_INTERFACE_END()
+
+XIMPIMP_IF_BASE_GET_CONST_INTERFACE_BEGIN( CPresenceBlockInfoImp, 
+                                           MPresenceBlockInfo )
+XIMPIMP_IF_BASE_GET_INTERFACE_END()
+
+
+// ---------------------------------------------------------------------------
+// CPresenceBlockInfoImp::~CPresenceBlockInfoImp()
+// ---------------------------------------------------------------------------
+//
+CPresenceBlockInfoImp::~CPresenceBlockInfoImp()
+    {
+    iDisplayName.Close();
+    delete iIdentity;
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceBlockInfoImp::CPresenceBlockInfoImp()
+// ---------------------------------------------------------------------------
+//
+CPresenceBlockInfoImp::CPresenceBlockInfoImp()
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// CPresenceBlockInfoImp::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void CPresenceBlockInfoImp::ConstructL()
+    {
+    iDisplayName.CreateL( 0 );
+    iIdentity = CXIMPIdentityImp::NewL();
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceBlockInfoImp::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void CPresenceBlockInfoImp::ConstructL(
+                            const MXIMPIdentity& aIdentity,
+                            const TDesC16& aDisplayName )
+    {
+    const CXIMPIdentityImp* sourceIdentity =
+    TXIMPGetImpClassOrPanic< const CXIMPIdentityImp>::From( aIdentity );
+
+    iIdentity = TXIMPObjectCloner< CXIMPIdentityImp >::CloneL( *sourceIdentity );
+    iDisplayName.CreateL( aDisplayName );
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceBlockInfoImp::ExternalizeL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CPresenceBlockInfoImp::ExternalizeL( RWriteStream& aStream ) const
+    {
+    iIdentity->ExternalizeL( aStream );
+    XIMPRBuf16Helper::ExternalizeL( iDisplayName, aStream );
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceBlockInfoImp::InternalizeL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CPresenceBlockInfoImp::InternalizeL( RReadStream& aStream )
+    {
+    iIdentity->InternalizeL( aStream );
+    XIMPRBuf16Helper::InternalizeL( iDisplayName, aStream );
+    }
+
+// ---------------------------------------------------------------------------
+// From MPresenceBlockInfo class.
+// CPresenceBlockInfoImp::BlockedEntityId()
+// ---------------------------------------------------------------------------
+//
+const MXIMPIdentity& CPresenceBlockInfoImp::BlockedEntityId() const
+    {
+    return *iIdentity;
+    }
+
+
+// ---------------------------------------------------------------------------
+// From MPresenceBlockInfo class.
+// CPresenceBlockInfoImp::BlockedEntityDisplayName()
+// ---------------------------------------------------------------------------
+//
+const TDesC16& CPresenceBlockInfoImp::BlockedEntityDisplayName() const
+    {
+    return iDisplayName;
+    }
+    
+
+// ---------------------------------------------------------------------------
+// From MPresenceBlockInfo class.
+// CPresenceBlockInfoImp::SetBlockedEntityIdL()
+// ---------------------------------------------------------------------------
+//
+void CPresenceBlockInfoImp::SetBlockedEntityIdL( 
+    MXIMPIdentity* aIdentity )
+    {
+    CXIMPIdentityImp* identityImp =
+    TXIMPGetImpClassOrPanic< CXIMPIdentityImp>::From( *aIdentity );
+
+    delete iIdentity;
+    iIdentity = identityImp; 
+    }
+
+
+// ---------------------------------------------------------------------------
+// From MPresenceBlockInfo class.
+// CPresenceBlockInfoImp::SetBlockedEntityDisplayNameL()
+// ---------------------------------------------------------------------------
+//
+void CPresenceBlockInfoImp::SetBlockedEntityDisplayNameL( 
+    const TDesC16& aDisplayName )
+    {
+    HBufC16* displayNameBuf = aDisplayName.AllocL();
+    iDisplayName.Close();
+    iDisplayName.Assign( displayNameBuf );
+    }
+    
+
+// ---------------------------------------------------------------------------
+// CPresenceBlockInfoImp::EqualsContent()
+// ---------------------------------------------------------------------------
+//
+TBool CPresenceBlockInfoImp::EqualsContent( const CXIMPApiDataObjBase& aOtherInstance ) const
+    {
+    const CPresenceBlockInfoImp* tmp =
+        TXIMPGetImpClassOrPanic< const CPresenceBlockInfoImp >::From( aOtherInstance.Base() );
+
+    TBool same = ETrue;
+    TBool x;
+
+    x = ( iIdentity->Compare( *tmp->iIdentity ) == 0 );
+    same &= x;
+
+    x = ( iDisplayName.Compare( tmp->iDisplayName ) == 0 );
+    same &= x;
+
+    return same;    
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceBlockInfoImp::SetIdentityL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CPresenceBlockInfoImp::SetIdentity( CXIMPIdentityImp* aIdentity )
+    {
+    delete iIdentity;
+    iIdentity = aIdentity;
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceBlockInfoImp::SetDisplayName()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CPresenceBlockInfoImp::SetDisplayName( HBufC16* aDisplayName )
+    {
+    iDisplayName.Close();
+    iDisplayName.Assign( aDisplayName );
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceBlockInfoImp::IdLinearOrder()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CPresenceBlockInfoImp::IdLinearOrder(
+        const CPresenceBlockInfoImp& aA,
+        const CPresenceBlockInfoImp& aB )
+    {
+    return aA.IdentityImp().Compare( aB.IdentityImp() );
+    }
+// ---------------------------------------------------------------------------
+// CPresenceBlockInfoImp::IdentityImp()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C const CXIMPIdentityImp& CPresenceBlockInfoImp::IdentityImp() const
+    {
+    return *iIdentity;
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresencedatamodel/presenceauthorization/presenceblockinfoimp.h	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  MPresenceBlockInfo API object implementation.
+*
+*/
+
+#ifndef CPRESENCEBLOCKINFOIMP_H
+#define CPRESENCEBLOCKINFOIMP_H
+
+#include "ximpapidataobjbase.h"
+#include "presenceapiobjbase.h"
+#include <s32strm.h>
+#include <presenceblockinfo.h>
+
+class CXIMPIdentityImp;
+
+/**
+ * MPresenceBlockInfo API object implementation.
+ *
+ * @lib ximpdatamodel.dll
+ * @since S60 v3.2
+ */
+NONSHARABLE_CLASS( CPresenceBlockInfoImp ): public CXIMPApiDataObjBase,
+                                                public MPresenceBlockInfo
+    {
+    public:
+    /** The class ID. */
+    enum { KClassId = PRIMP_CLSID_CPRESENCEBLOCKINFOIMP };
+
+public:
+
+    IMPORT_C static CPresenceBlockInfoImp* NewLC(
+                    const MXIMPIdentity& aIdentity,
+                    const TDesC16& aDisplayName );
+    IMPORT_C static CPresenceBlockInfoImp* NewLC();
+    IMPORT_C static CPresenceBlockInfoImp* NewL();
+    virtual ~CPresenceBlockInfoImp();
+
+private:
+
+    CPresenceBlockInfoImp();
+    void ConstructL();
+    void ConstructL( const MXIMPIdentity& aIdentity,
+                     const TDesC16& aDisplayName );
+
+public: // From MXIMPBase
+
+    /**
+     * Implementation of MXIMPBase interface methods
+     * @see MXIMPBase
+     */
+    XIMPIMP_DECLARE_IF_BASE_METHODS
+    
+public: // From MPresenceBlockInfo
+
+    const MXIMPIdentity& BlockedEntityId() const;
+    const TDesC16& BlockedEntityDisplayName() const;
+    void SetBlockedEntityIdL( MXIMPIdentity* aIdentity );
+    void SetBlockedEntityDisplayNameL( const TDesC16& aDisplayName );
+    
+    
+public: // From CXIMPApiDataObjBase
+
+    /**
+     * @see CXIMPApiDataObjBase
+     */
+    XIMPIMP_DECLARE_DATAOBJ_BASE_METHODS
+    
+public: // New functions
+
+    /**
+     * Internalizes object data from given stream.
+     * @param aStream Stream to read.
+     */
+    IMPORT_C void InternalizeL( RReadStream& aStream );
+
+    /**
+     * Set identity
+     */
+    IMPORT_C void SetIdentity( CXIMPIdentityImp* aIdentity );
+
+    /**
+     * Set display name
+     */
+    IMPORT_C void SetDisplayName( HBufC16* aDisplayName );
+
+    /**
+     * TLinearOrder for ordering based on stored group id,
+     * when this class is used within an RPointerArray or derivatives.
+     */
+    IMPORT_C static TInt IdLinearOrder(
+            const CPresenceBlockInfoImp& aA,
+            const CPresenceBlockInfoImp& aB );
+
+    /**
+     * Access to identity object
+     * @return Identity
+     */
+    IMPORT_C const CXIMPIdentityImp& IdentityImp() const;
+
+private: // data
+
+    /**
+     * Identity
+     */
+    CXIMPIdentityImp* iIdentity;
+
+    /**
+     * Displayname
+     */
+    RBuf16 iDisplayName;
+
+    };
+
+
+#endif // CPRESENCEBLOCKINFOIMP_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresencedatamodel/presenceauthorization/presenceblocklisteventimp.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,349 @@
+/*
+* 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 block list event implementation.
+ *
+*/
+
+#include "presenceblocklisteventimp.h"
+#include "presenceblockinfoimp.h"
+#include "ximpobjecthelpers.h"
+#include "ximpidentityimp.h"
+#include "ximpdatasubscriptionstateimp.h"
+#include <s32strm.h>
+
+
+// ---------------------------------------------------------------------------
+// CPresenceBlockListEventImp::NewLC()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CPresenceBlockListEventImp* CPresenceBlockListEventImp::NewLC(
+        RPrBlockInfoImpArray* aAdded,
+        RPrBlockInfoImpArray* aPending,
+        RPrBlockInfoImpArray* aRemoved,
+        RPrBlockInfoImpArray* aUpdated,
+        CXIMPDataSubscriptionStateImp* aState
+        )
+    {
+    CPresenceBlockListEventImp* self = new( ELeave ) CPresenceBlockListEventImp();
+    CleanupStack::PushL( self );
+    self->ConstructL( aAdded, aPending, aRemoved, aUpdated, aState );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceBlockListEventImp::NewFromStreamLC()
+// ---------------------------------------------------------------------------
+//
+CXIMPApiEventBase* CPresenceBlockListEventImp::NewFromStreamLC( RReadStream& aStream )
+    {
+    CPresenceBlockListEventImp* self = new( ELeave ) CPresenceBlockListEventImp;
+    CleanupStack::PushL( self );
+    self->ConstructL( aStream );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceBlockListEventImp::~CPresenceBlockListEventImp()
+// ---------------------------------------------------------------------------
+//
+CPresenceBlockListEventImp::~CPresenceBlockListEventImp()
+    {
+    if( iConstructedFromStream )
+        {
+        delete iAdded;
+        delete iCurrent;
+        delete iRemoved;
+        delete iUpdated;
+        iCurrent = NULL; // Must be null for next branch.
+        }
+
+    if( iOwnsCurrent )
+        {
+        delete iCurrent;
+        }
+
+    delete iSubscriptionState;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CPresenceBlockListEventImp::CPresenceBlockListEventImp()
+// ---------------------------------------------------------------------------
+//
+CPresenceBlockListEventImp::CPresenceBlockListEventImp()
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// CPresenceBlockListEventImp::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void CPresenceBlockListEventImp::ConstructL(
+        RPrBlockInfoImpArray* aAdded,
+        RPrBlockInfoImpArray* aPending,
+        RPrBlockInfoImpArray* aRemoved,
+        RPrBlockInfoImpArray* aUpdated,
+        CXIMPDataSubscriptionStateImp* aState )
+    {
+    iAdded = aAdded;
+    if( aPending )
+        {
+        iCurrent = aPending;
+        }
+    else
+        {
+        iCurrent = new ( ELeave ) RPrBlockInfoImpArray;
+        iOwnsCurrent = ETrue;
+        }
+    iRemoved = aRemoved;
+    iUpdated = aUpdated;
+    iSubscriptionState = aState;
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceBlockListEventImp::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void CPresenceBlockListEventImp::ConstructL( RReadStream& aStream )
+    {
+    iConstructedFromStream = ETrue;
+
+    iAdded = new ( ELeave ) RPrBlockInfoImpArray;
+    iCurrent = new ( ELeave ) RPrBlockInfoImpArray;
+    iRemoved = new ( ELeave ) RPrBlockInfoImpArray;
+    iUpdated = new ( ELeave ) RPrBlockInfoImpArray;
+    iSubscriptionState = CXIMPDataSubscriptionStateImp::NewL();
+
+    FillArrayFromStreamL( *iAdded, aStream );
+    FillArrayFromStreamL( *iCurrent, aStream );
+    FillArrayFromStreamL( *iRemoved, aStream );
+    FillArrayFromStreamL( *iUpdated, aStream );
+    
+    iSubscriptionState->InternalizeL( aStream );
+    }
+
+// ---------------------------------------------------------------------------
+// Implement supported interface access.
+// ---------------------------------------------------------------------------
+//
+XIMPIMP_IF_BASE_GET_INTERFACE_BEGIN( CPresenceBlockListEventImp,
+                                     MPresenceBlockListEvent )
+    XIMPIMP_IF_BASE_GET_CLASS( CXIMPApiEventBase, this )
+XIMPIMP_IF_BASE_GET_INTERFACE_END()
+
+
+XIMPIMP_IF_BASE_GET_CONST_INTERFACE_BEGIN( CPresenceBlockListEventImp,
+                                           MPresenceBlockListEvent )
+    XIMPIMP_IF_BASE_GET_CONST_CLASS( CXIMPApiEventBase, this )                                            
+XIMPIMP_IF_BASE_GET_INTERFACE_END()
+
+
+
+// ---------------------------------------------------------------------------
+// Implement methods from base event interface and base event class
+// ---------------------------------------------------------------------------
+//
+XIMPIMP_IMPLEMENT_EVENT_BASE_METHODS( CPresenceBlockListEventImp,
+                                      MPresenceBlockListEvent )
+
+
+// ---------------------------------------------------------------------------
+// CPresenceBlockListEventImp::EqualsContent()
+// ---------------------------------------------------------------------------
+//
+TBool CPresenceBlockListEventImp::EqualsContent( 
+    const CXIMPApiEventBase& aOtherInstance ) const
+    {
+    const CPresenceBlockListEventImp* tmp =
+    TXIMPGetImpClassOrPanic< const CPresenceBlockListEventImp>::From( 
+                                                       aOtherInstance.Base() );
+    TBool same = ETrue;
+    TBool x = TXIMPEqualsContent< CPresenceBlockInfoImp >::Array( *iAdded, *( tmp->iAdded ) );
+    same &= x;
+
+    x = TXIMPEqualsContent< CPresenceBlockInfoImp >::Array( *iCurrent, *( tmp->iCurrent ) );
+    same &= x;
+
+    x = TXIMPEqualsContent< CPresenceBlockInfoImp >::Array( *iRemoved, *( tmp->iRemoved ) );
+    same &= x;
+
+    x = TXIMPEqualsContent< CPresenceBlockInfoImp >::Array( *iUpdated, *( tmp->iUpdated ) );
+    same &= x;
+    
+    x = iSubscriptionState->EqualsContent( *tmp->iSubscriptionState );
+    same &= x;
+
+    return same;
+    }
+
+// ---------------------------------------------------------------------------
+// From class CXIMPApiEventBase.
+// CPresenceBlockListEventImp::ExternalizeL()
+// ---------------------------------------------------------------------------
+//
+void CPresenceBlockListEventImp::ExternalizeL( RWriteStream& aStream ) const
+    {
+    WriteArrayToStreamL( *iAdded, aStream );
+    WriteArrayToStreamL( *iCurrent, aStream );
+    WriteArrayToStreamL( *iRemoved, aStream );
+    WriteArrayToStreamL( *iUpdated, aStream );
+    iSubscriptionState->ExternalizeL( aStream );
+    }
+
+
+// ---------------------------------------------------------------------------
+// From MPresenceBlockListEvent class.
+// CPresenceBlockListEventImp::NewBlocksCount()
+// ---------------------------------------------------------------------------
+//
+TInt CPresenceBlockListEventImp::NewBlocksCount() const
+    {
+    return iAdded->Count();
+    }
+    
+
+// ---------------------------------------------------------------------------
+// From MPresenceBlockListEvent class.
+// CPresenceBlockListEventImp::NewBlock()
+// ---------------------------------------------------------------------------
+//
+const MPresenceBlockInfo&
+            CPresenceBlockListEventImp::NewBlock( TInt aIndex ) const
+    {
+    return *(*iAdded)[ aIndex ];
+    }
+    
+// ---------------------------------------------------------------------------
+// From MPresenceBlockListEvent class.
+// CPresenceBlockListEventImp::UpdatedBlocksCount()
+// ---------------------------------------------------------------------------
+//
+TInt CPresenceBlockListEventImp::UpdatedBlocksCount() const
+    {
+    return iUpdated->Count();
+    }
+
+
+// ---------------------------------------------------------------------------
+// From MPresenceBlockListEvent class.
+// CPresenceBlockListEventImp::UpdatedBlock()
+// ---------------------------------------------------------------------------
+//
+const MPresenceBlockInfo& 
+    CPresenceBlockListEventImp::UpdatedBlock( TInt aIndex ) const
+    {
+    return *(*iUpdated)[ aIndex ];
+    }
+    
+
+// ---------------------------------------------------------------------------
+// From MPresenceBlockListEvent class.
+// CPresenceBlockListEventImp::DisappearedBlocksCount()
+// ---------------------------------------------------------------------------
+//
+TInt CPresenceBlockListEventImp::DisappearedBlocksCount() const
+    {
+    return iRemoved->Count();
+    }
+    
+
+// ---------------------------------------------------------------------------
+// From MPresenceBlockListEvent class.
+// CPresenceBlockListEventImp::DisappearedBlock()
+// ---------------------------------------------------------------------------
+//
+const MPresenceBlockInfo& 
+    CPresenceBlockListEventImp::DisappearedBlock( TInt aIndex ) const
+    {
+    return *(*iRemoved)[ aIndex ];
+    }
+    
+
+// ---------------------------------------------------------------------------
+// From MPresenceBlockListEvent class.
+// CPresenceBlockListEventImp::CurrentBlocksCount()
+// ---------------------------------------------------------------------------
+//
+TInt CPresenceBlockListEventImp::CurrentBlocksCount() const
+    {
+    return iCurrent->Count();
+    }
+
+// ---------------------------------------------------------------------------
+// From MPresenceBlockListEvent class.
+// CPresenceBlockListEventImp::CurrentBlock()
+// ---------------------------------------------------------------------------
+//
+const MPresenceBlockInfo&
+    CPresenceBlockListEventImp::CurrentBlock( TInt aIndex ) const
+    {
+    return *(*iCurrent)[ aIndex ];
+    }
+
+
+// ---------------------------------------------------------------------------
+// From class MPresenceBlockListEvent.
+// CPresenceBlockListEventImp::DataSubscriptionState()
+// ---------------------------------------------------------------------------
+//
+const MXIMPDataSubscriptionState&
+    CPresenceBlockListEventImp::DataSubscriptionState() const
+    {
+    return *iSubscriptionState;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CPresenceBlockListEventImp::WriteArrayToStreamL()
+// ---------------------------------------------------------------------------
+//
+void CPresenceBlockListEventImp::WriteArrayToStreamL(
+        RPrBlockInfoImpArray& aArray, RWriteStream& aStream ) const
+    {
+    TInt count = aArray.Count();
+    aStream.WriteInt32L( count );
+        {
+        for( TInt a = 0; a < count; ++a )
+            {
+            aArray[ a ]->ExternalizeL( aStream );
+            }
+        }
+    }
+
+
+
+// ---------------------------------------------------------------------------
+// CPresenceBlockListEventImp::FillArrayFromStreamL
+// ---------------------------------------------------------------------------
+//
+void CPresenceBlockListEventImp::FillArrayFromStreamL(
+        RPrBlockInfoImpArray& aArray,
+        RReadStream& aStream )
+    {
+    TInt count = aStream.ReadInt32L();
+    for( TInt a = 0; a < count; ++a )
+        {
+        // the stream MUST be in order (since it was externalized by this class)
+        CPresenceBlockInfoImp* newInfo = CPresenceBlockInfoImp::NewLC();
+        newInfo->InternalizeL( aStream );
+        aArray.AppendL( newInfo );
+        CleanupStack::Pop(); // newInfo
+        }
+    }
+
+
+
+// End of file
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresencedatamodel/presenceauthorization/presenceblocklisteventimp.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,161 @@
+/*
+* 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:  MPresenceBlockListEvent API object implementation.
+ *
+*/
+
+#ifndef CPRESENCEBLOCKLISTEVENTIMP_H
+#define CPRESENCEBLOCKLISTEVENTIMP_H
+
+#include "ximpapieventbase.h"
+#include "presencetypehelpers.h"
+#include <presenceblocklistevent.h>
+
+
+class RReadStream;
+class CPresenceBlockInfoImp;
+class CXIMPIdentityImp;
+class CXIMPDataSubscriptionStateImp;
+
+/**
+ * MPresenceBlockListEvent API object implementation.
+ *
+ * @lib ximpdatamodel.dll
+ * @since S60 v3.2
+ */
+NONSHARABLE_CLASS( CPresenceBlockListEventImp ): public CXIMPApiEventBase,
+                                            public MPresenceBlockListEvent
+    {
+public:
+    /** The class ID. */
+    enum { KClassId = PRIMP_CLSID_CPRESENCEBLOCKLISTEVENTIMP };
+
+public:
+    /**
+     * Exported instantiation method for initializing
+     * new event object.
+     */
+    IMPORT_C static CPresenceBlockListEventImp* NewLC(
+            RPrBlockInfoImpArray* aAdded,
+            RPrBlockInfoImpArray* aPending,
+            RPrBlockInfoImpArray* aRemoved,
+            RPrBlockInfoImpArray* aUpdated,
+            CXIMPDataSubscriptionStateImp* aState
+            );
+
+    /**
+     * Instantiation method for event automation.
+     * Method signature must be exactly this to work
+     * with event delivery automation system.
+     *
+     * Event implementation must be registered to
+     * XIMPEventCodec KXIMPEventConstructorTable.
+     */
+    static CXIMPApiEventBase* NewFromStreamLC( RReadStream& aStream );
+
+    virtual ~CPresenceBlockListEventImp();
+
+private:
+    CPresenceBlockListEventImp();
+
+    void ConstructL(
+            RPrBlockInfoImpArray* aAdded,
+            RPrBlockInfoImpArray* aPending,
+            RPrBlockInfoImpArray* aRemoved,
+            RPrBlockInfoImpArray* aUpdated,
+            CXIMPDataSubscriptionStateImp* aState
+            );
+
+    void ConstructL( RReadStream& aStream );
+
+    /**
+     * Helper for externalize.
+     */
+    void WriteArrayToStreamL( RPrBlockInfoImpArray& aArray,
+            RWriteStream& aStream ) const;
+
+
+    /**
+     * Helper for internalize
+     */
+    void FillArrayFromStreamL( RPrBlockInfoImpArray& aArray,
+            RReadStream& aStream );
+
+public: // From API base interfaces
+
+    /**
+     * Implementation of MXIMPBase interface methods
+     * @see MXIMPBase
+     */
+    XIMPIMP_DECLARE_IF_BASE_METHODS
+
+
+    /**
+     * Implementation of MXIMPEventBase interface and
+     * CXIMPApiEventBase methods
+     *
+     * @see MXIMPEventBase
+     * @see CXIMPApiEventBase
+     */
+    XIMPIMP_DECLARE_EVENT_BASE_METHODS
+
+
+public: // From MPresenceBlockListEvent
+
+    TInt NewBlocksCount() const;
+    const MPresenceBlockInfo& NewBlock( TInt aIndex ) const;
+
+
+    TInt UpdatedBlocksCount() const;
+    const MPresenceBlockInfo& UpdatedBlock( TInt aIndex ) const;
+
+
+    TInt DisappearedBlocksCount() const;
+    const MPresenceBlockInfo& DisappearedBlock( TInt aIndex ) const;
+
+
+    TInt CurrentBlocksCount() const;
+    const MPresenceBlockInfo& CurrentBlock( TInt aIndex ) const;
+
+    const MXIMPDataSubscriptionState& DataSubscriptionState() const;
+
+private: // data
+
+    /**
+     * ETrue if constructed from stream.
+     */
+    TBool iConstructedFromStream;
+
+    /**
+     * Group informations.
+     * Owns if constructed from stream. Otherwise does not own.
+     */
+    RPrBlockInfoImpArray* iAdded;
+    RPrBlockInfoImpArray* iCurrent;
+    RPrBlockInfoImpArray* iRemoved;
+    RPrBlockInfoImpArray* iUpdated;
+
+    /**
+     * Subscription state
+     */
+    CXIMPDataSubscriptionStateImp* iSubscriptionState;
+    
+    /**
+     * Current array owner status
+     */
+    TBool iOwnsCurrent;
+    };
+
+
+#endif // CPRESENCEBLOCKLISTEVENTIMP_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresencedatamodel/presenceauthorization/presenceconfigurationitem.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  Presence configuration item
+*
+*/
+
+
+#include "presenceconfigurationitem.h"
+#include "ximpitemparent.h"
+#include "ximpidentityimp.h"
+#include "presenceinfofilterimp.h"
+#include "ximppanics.h"
+#include "ximppsccontext.h"
+#include "documentutils.h"
+#include "presentitypresenceeventimp.h"
+#include "ximpobjecthelpers.h"
+
+#include "ximptrace.h"
+
+// ---------------------------------------------------------------------------
+// CPresenceConfigurationItem::CPresenceConfigurationItem()
+// ---------------------------------------------------------------------------
+//
+CPresenceConfigurationItem::CPresenceConfigurationItem( MXIMPItemParentBase& aParent )
+: CXIMPConfigurationItemBase( aParent )
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// CPresenceConfigurationItem::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void CPresenceConfigurationItem::ConstructL( const CXIMPIdentityImp& aIdentity )
+    {
+    CXIMPConfigurationItemBase::BaseConstructL();
+    
+    iIdentity = TXIMPObjectCloner< CXIMPIdentityImp >::CloneL( aIdentity );
+    }
+
+
+// ---------------------------------------------------------------------------
+// CPresenceConfigurationItem::NewLC()
+// ---------------------------------------------------------------------------
+//
+CPresenceConfigurationItem*
+    CPresenceConfigurationItem::NewLC( MXIMPItemParentBase& aParent, const CXIMPIdentityImp& aIdentity )
+    {
+    CPresenceConfigurationItem* self =
+        new( ELeave ) CPresenceConfigurationItem( aParent );
+    CleanupClosePushL( *self );
+    self->ConstructL( aIdentity );
+    return self;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CPresenceConfigurationItem::~CPresenceConfigurationItem()
+// ---------------------------------------------------------------------------
+//
+CPresenceConfigurationItem::~CPresenceConfigurationItem()
+    {
+    MXIMPItemParent* presCache = static_cast<MXIMPItemParent*>(iParent.GetInterface(PRESENCE_ITEM_PARENT));
+    presCache->RemoveMe( this );
+
+    delete iIdentity;    
+    delete iPif;    
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceConfigurationItem::ConfigurationPif()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CPresenceInfoFilterImp& 
+            CPresenceConfigurationItem::ConfigurationPif()
+    {
+    TRACE(_L("CPresenceConfigurationItem::ConfigurationPif" ) );
+    __ASSERT_ALWAYS( iPif, User::Panic( NXIMPPrivPanic::KCategory, 
+                                        NXIMPPrivPanic::EOwnPresencePifNotSet ) );
+    return *iPif;
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceConfigurationItem::SetSubscriptionPif()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CPresenceConfigurationItem::SetConfigurationPif(
+                                                CPresenceInfoFilterImp* aPif )
+    {
+    TRACE(_L("CPresenceConfigurationItem::SetConfigurationPif" ) );
+    if ( !aPif )
+        {
+        TRACE(_L("CPresenceConfigurationItem::SetConfigurationPif aPif NULL" ) );
+        }
+    delete iPif;
+    iPif = aPif;
+    }
+    
+// ---------------------------------------------------------------------------
+// CPresenceConfigurationItem::CollectSubscriptionPifWithoutCtxL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CPresenceInfoFilterImp* 
+    CPresenceConfigurationItem::CollectConfigurationPifWithoutCtxL( 
+                                                        MXIMPPscContext* aContext )
+    {
+    TRACE(_L("CPresenceConfigurationItem::CollectSubscriptionPifWithoutCtxL" ) );
+    RPointerArray< CPresenceInfoFilterImp > arrayOfPifs;
+    CleanupClosePushL( arrayOfPifs );
+    
+    TInt count = iConfigContexts.Count();
+    for( TInt a = 0; a < count; ++a )
+        {
+        if( iConfigContexts[ a ] != aContext )
+            {
+            CPresenceInfoFilterImp* filter = iConfigContexts[ a ]->PresenceInfoFilter( 
+                        MXIMPPscContext::EGrantPresenceToPresentityFilter, iIdentity );
+            if ( filter )
+                {
+                arrayOfPifs.AppendL( filter );
+                }
+            }        
+        }
+    CPresenceInfoFilterImp* pifWithoutCtx = DocumentUtils::InfoFilterUnionL( arrayOfPifs );    
+    CleanupStack::PopAndDestroy(); // arrayOfPifs
+    return pifWithoutCtx;
+    }
+    
+    
+// ---------------------------------------------------------------------------
+// CPresenceConfigurationItem::Identity()
+// ---------------------------------------------------------------------------
+//    
+EXPORT_C const MXIMPIdentity& CPresenceConfigurationItem::Identity() const
+    {
+    return *iIdentity;
+    }
+    
+// ---------------------------------------------------------------------------
+// CPresenceConfigurationItem::SetIdentity()
+// ---------------------------------------------------------------------------
+//    
+EXPORT_C void CPresenceConfigurationItem::SetIdentity(
+                                            CXIMPIdentityImp* aIdentity )
+    {
+    delete iIdentity;
+    iIdentity = aIdentity;
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceConfigurationItem::Order()
+// ---------------------------------------------------------------------------
+//    
+EXPORT_C TInt CPresenceConfigurationItem::Order(
+                        const CPresenceConfigurationItem& aA,
+                        const CPresenceConfigurationItem& aB )
+    {
+    return IdentityOrder( aA.iIdentity, aB );
+    }
+// ---------------------------------------------------------------------------
+// CPresenceConfigurationItem::Order()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CPresenceConfigurationItem::IdentityOrder(
+                        const CXIMPIdentityImp* aA,
+                        const CPresenceConfigurationItem& aB )
+    {
+    return aA->Compare( *aB.iIdentity );
+    }
+
+// ---------------------------------------------------------------------------
+// From class MXIMPSubscriptionItem.
+// CPresenceConfigurationItem::SynthesiseSubscriptionEventTo()
+// ---------------------------------------------------------------------------
+//
+void CPresenceConfigurationItem::SynthesiseSubscriptionEventToL(
+                                                    MXIMPPscContext* aContext,
+                                                    TBool aForceEvent )
+    {
+    TRACE_1( _L("CPresenceConfigurationItem::SynthesiseSubscriptionEventTo() aForce=%d"), aForceEvent );
+    XIMP_UNUSED_FORMAL_PARAM( aContext );
+    XIMP_UNUSED_FORMAL_PARAM( aForceEvent );
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceConfigurationItem::CleanExpired()
+// ---------------------------------------------------------------------------
+//
+void CPresenceConfigurationItem::CleanExpired()
+    {
+    
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresencedatamodel/presenceauthorization/presenceconfigurationitem.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,133 @@
+/*
+* 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 configuration item
+*
+*/
+
+#ifndef CPSCPRESENCECONFIGURATIONITEM_H
+#define CPSCPRESENCECONFIGURATIONITEM_H
+
+#include <e32base.h>
+#include "ximpconfigurationitembase.h"
+
+class CPresenceInfoFilterImp;
+class MXIMPIdentity;
+class CXIMPIdentityImp;
+
+/**
+ * Presence configuration item
+ *
+ * @since S60 v3.2
+ */
+class CPresenceConfigurationItem : public CXIMPConfigurationItemBase
+    {
+public: // Construction and destruction
+
+    /**
+     * Construction
+     * @param aParent. Parent has to be informed when this object is deleted by RemoveMe method.
+     */
+    static CPresenceConfigurationItem* NewLC( MXIMPItemParentBase& aParent, const CXIMPIdentityImp& aIdentity );
+
+    /**
+     * Destruction
+     * - Remember to inform parent about delete.
+     */
+    ~CPresenceConfigurationItem();
+
+private: // Construction and destruction
+
+    /**
+     * Construction
+     * @param aParent. Parent has to be informed when this object is deleted by RemoveMe method.
+     */
+    CPresenceConfigurationItem( MXIMPItemParentBase& aParent );
+
+    /**
+     * Construction
+     */
+    void ConstructL( const CXIMPIdentityImp& aIdentity );
+
+public: // New methods
+
+    /**
+     * Current presence information filter.
+     * @return Current presence information filter.
+     */
+    IMPORT_C CPresenceInfoFilterImp& ConfigurationPif();
+    
+    /**
+     * Set current presence information filter. Overwrites existing one.
+     * Ownership is transferred to callee.
+     * @param aPif Current presence information filter.
+     */
+    IMPORT_C void SetConfigurationPif( CPresenceInfoFilterImp* aPif );
+
+    /**
+     * Collect aggregated presence information filter without given context.
+     * @param aContext. Exluded context from aggregated pif.
+     * @return Aggregated pif without exluded context.
+     */    
+    IMPORT_C CPresenceInfoFilterImp* CollectConfigurationPifWithoutCtxL( 
+                                                    MXIMPPscContext* aContext );    
+    
+    IMPORT_C const MXIMPIdentity& Identity() const;
+
+    IMPORT_C void SetIdentity( CXIMPIdentityImp* aIdentity );
+    
+    /**
+     * For ordering items.
+     */
+    IMPORT_C static TInt Order( const CPresenceConfigurationItem& aA,
+                         const CPresenceConfigurationItem& aB );
+    IMPORT_C static TInt IdentityOrder( const CXIMPIdentityImp* aA,
+                         const CPresenceConfigurationItem& aB );
+    
+    
+public: // From MXIMPSubscriptionItem
+
+    /**
+     * @see MXIMPSubscriptionItem
+     */
+    void SynthesiseSubscriptionEventToL( MXIMPPscContext* aContext, TBool aForceEvent );
+
+public: // From MXIMPConfigurationItem
+
+private: // From CXIMPSubscriptionItemBase
+
+    /**
+     * @see CXIMPSubscriptionItemBase
+     */
+    void CleanExpired();        
+
+private: // Data
+
+    /**
+     * Current presence information filter.
+     */
+    CPresenceInfoFilterImp* iPif;
+
+    /**
+     * Identity of item
+     * Own
+     */
+    CXIMPIdentityImp* iIdentity;
+    };
+
+
+/* ======================================================================== */
+
+
+
+#endif // CPSCPRESENCECONFIGURATIONITEM_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresencedatamodel/presenceauthorization/presencegrantrequestinfoimp.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,261 @@
+/*
+* 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:  MPresenceGrantRequestInfo API object implementation.
+*
+*/
+
+
+#include "presencegrantrequestinfoimp.h"
+#include "ximpidentityimp.h"
+#include "ximprbufhelpers.h"
+#include "ximpobjecthelpers.h"
+
+// ============================ MEMBER FUNCTIONS =============================
+
+// ---------------------------------------------------------------------------
+// CPresenceGrantRequestInfoImp::NewLC()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CPresenceGrantRequestInfoImp* CPresenceGrantRequestInfoImp::NewLC(
+                            const MXIMPIdentity& aIdentity,
+                            const TDesC16& aDisplayName )
+    {
+    CPresenceGrantRequestInfoImp* self = new( ELeave ) CPresenceGrantRequestInfoImp;
+    CleanupStack::PushL( self );
+    self->ConstructL( aIdentity, aDisplayName );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceGrantRequestInfoImp::NewLC()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CPresenceGrantRequestInfoImp* CPresenceGrantRequestInfoImp::NewLC()
+    {
+    CPresenceGrantRequestInfoImp* self = new( ELeave ) CPresenceGrantRequestInfoImp;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CPresenceGrantRequestInfoImp::NewL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CPresenceGrantRequestInfoImp* CPresenceGrantRequestInfoImp::NewL()
+    {
+    CPresenceGrantRequestInfoImp* self = NewLC();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceGrantRequestfoImp::NewFromStreamLC()
+// ---------------------------------------------------------------------------
+//
+XIMPIMP_IMPLEMENT_DATAOBJ_NEWFROMSTREAM( CPresenceGrantRequestInfoImp )
+
+// ---------------------------------------------------------------------------
+// Implement supported interface access.
+// ---------------------------------------------------------------------------
+//
+XIMPIMP_IF_BASE_GET_INTERFACE_BEGIN( CPresenceGrantRequestInfoImp, 
+                                     MPresenceGrantRequestInfo )
+XIMPIMP_IF_BASE_GET_INTERFACE_END()
+
+XIMPIMP_IF_BASE_GET_CONST_INTERFACE_BEGIN( CPresenceGrantRequestInfoImp, 
+                                           MPresenceGrantRequestInfo )
+XIMPIMP_IF_BASE_GET_INTERFACE_END()
+
+
+// ---------------------------------------------------------------------------
+// CPresenceGrantRequestInfoImp::~CPresenceGrantRequestInfoImp()
+// ---------------------------------------------------------------------------
+//
+CPresenceGrantRequestInfoImp::~CPresenceGrantRequestInfoImp()
+    {
+    iDisplayName.Close();
+    delete iIdentity;
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceGrantRequestInfoImp::CPresenceGrantRequestInfoImp()
+// ---------------------------------------------------------------------------
+//
+CPresenceGrantRequestInfoImp::CPresenceGrantRequestInfoImp()
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// CPresenceGrantRequestInfoImp::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void CPresenceGrantRequestInfoImp::ConstructL()
+    {
+    iDisplayName.CreateL( 0 );
+    iIdentity = CXIMPIdentityImp::NewLC();
+    CleanupStack::Pop( iIdentity );
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceGrantRequestInfoImp::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void CPresenceGrantRequestInfoImp::ConstructL(
+                            const MXIMPIdentity& aIdentity,
+                            const TDesC16& aDisplayName )
+    {
+    const CXIMPIdentityImp* sourceIdentity = static_cast< const CXIMPIdentityImp* >( &aIdentity );
+    iIdentity = TXIMPObjectCloner< CXIMPIdentityImp >::CloneL( *sourceIdentity );
+    iDisplayName.CreateL( aDisplayName );
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceGrantRequestInfoImp::ExternalizeL()
+// ---------------------------------------------------------------------------
+//
+void CPresenceGrantRequestInfoImp::ExternalizeL( RWriteStream& aStream ) const
+    {
+    iIdentity->ExternalizeL( aStream );
+    XIMPRBuf16Helper::ExternalizeL( iDisplayName, aStream );
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceGrantRequestInfoImp::InternalizeL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CPresenceGrantRequestInfoImp::InternalizeL( RReadStream& aStream )
+    {
+    iIdentity->InternalizeL( aStream );
+    XIMPRBuf16Helper::InternalizeL( iDisplayName, aStream );
+    }
+
+// ---------------------------------------------------------------------------
+// From MPresenceGrantRequestInfo class.
+// CPresenceGrantRequestInfoImp::RequestorId()
+// ---------------------------------------------------------------------------
+//
+
+const MXIMPIdentity& CPresenceGrantRequestInfoImp::RequestorId() const
+    {
+    return *iIdentity;
+    }
+
+// ---------------------------------------------------------------------------
+// From MPresenceGrantRequestInfo class.
+// CPresenceGrantRequestInfoImp::RequestorDisplayName()
+// ---------------------------------------------------------------------------
+//
+const TDesC16& CPresenceGrantRequestInfoImp::RequestorDisplayName() const
+    {
+    return iDisplayName;
+    }
+
+// ---------------------------------------------------------------------------
+// From MPresenceGrantRequestInfo class.
+// CPresenceGrantRequestInfoImp::SetRequestorIdL()
+// ---------------------------------------------------------------------------
+//
+void CPresenceGrantRequestInfoImp::SetRequestorIdL( 
+    MXIMPIdentity* aIdentity )
+    {
+    CXIMPIdentityImp* identityImp =
+    TXIMPGetImpClassOrPanic< CXIMPIdentityImp>::From( *aIdentity );
+
+    delete iIdentity;
+    iIdentity = identityImp; 
+    }
+
+
+// ---------------------------------------------------------------------------
+// From MPresenceGrantRequestInfo class.
+// CPresenceGrantRequestInfoImp::
+// ---------------------------------------------------------------------------
+//
+void CPresenceGrantRequestInfoImp::SetRequestorDisplayNameL( 
+    const TDesC16& aDisplayName )
+    {
+    HBufC16* displayNameBuf = aDisplayName.AllocL();
+    iDisplayName.Close();
+    iDisplayName.Assign( displayNameBuf );
+    }
+
+
+// ---------------------------------------------------------------------------
+// CPresenceGrantRequestInfoImp::SetIdentityL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CPresenceGrantRequestInfoImp::SetIdentity( CXIMPIdentityImp* aIdentity )
+    {
+    delete iIdentity;
+    iIdentity = aIdentity;
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceGrantRequestInfoImp::SetDisplayName()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CPresenceGrantRequestInfoImp::SetDisplayName( HBufC16* aDisplayName )
+    {
+    iDisplayName.Close();
+    iDisplayName.Assign( aDisplayName );
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceGrantRequestInfoImp::IdLinearOrder()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CPresenceGrantRequestInfoImp::IdLinearOrder(
+        const CPresenceGrantRequestInfoImp& aA,
+        const CPresenceGrantRequestInfoImp& aB )
+    {
+    return aA.IdentityImp().Compare( aB.IdentityImp() );
+    }
+// ---------------------------------------------------------------------------
+// CPresenceGrantRequestInfoImp::IdentityImp()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C const CXIMPIdentityImp& CPresenceGrantRequestInfoImp::IdentityImp() const
+    {
+    return *iIdentity;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CPresenceGrantRequestInfoImp::EqualsContent()
+// ---------------------------------------------------------------------------
+//
+TBool CPresenceGrantRequestInfoImp::EqualsContent(
+    const CXIMPApiDataObjBase& aOtherInstance ) const
+    {
+    const CPresenceGrantRequestInfoImp* tmp =
+    TXIMPGetImpClassOrPanic< const CPresenceGrantRequestInfoImp >::From( 
+                                                        aOtherInstance.Base() );
+    
+    TBool same = ETrue;
+    TBool x;
+    x = iIdentity->EqualsContent( *( tmp->iIdentity ) );
+    same &= x;
+
+    x = 0 == iDisplayName.Compare( tmp->iDisplayName );
+    same &= x;
+
+    // add more comparisons in a similar way...
+
+    return same;
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresencedatamodel/presenceauthorization/presencegrantrequestinfoimp.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,135 @@
+/*
+* 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:  MPresentityGroupInfo API object implementation.
+*
+*/
+
+#ifndef CPRESENCEGRANTREQUESTINFOIMP_H
+#define CPRESENCEGRANTREQUESTINFOIMP_H
+
+#include <e32std.h>
+#include <s32strm.h>
+
+#include "ximpapidataobjbase.h"
+#include "presenceapiobjbase.h"
+#include <presencegrantrequestinfo.h>
+          
+
+class CXIMPIdentityImp;
+
+/**
+ * MPresenceInfo API object implementation.
+ *
+ * @lib ximpdatamodel.dll
+ * @since S60 v3.2
+ */
+NONSHARABLE_CLASS( CPresenceGrantRequestInfoImp ): public CXIMPApiDataObjBase,
+                                                       public MPresenceGrantRequestInfo
+    {
+    public:
+    /** The class ID. */
+    enum { KClassId = PRIMP_CLSID_CPRESENCEGRANTREQUESTINFOIMP };
+
+public:
+
+    IMPORT_C static CPresenceGrantRequestInfoImp* NewLC(
+                    const MXIMPIdentity& aIdentity,
+                    const TDesC16& aDisplayName );
+    IMPORT_C static CPresenceGrantRequestInfoImp* NewLC();
+    IMPORT_C static CPresenceGrantRequestInfoImp* NewL();
+    virtual ~CPresenceGrantRequestInfoImp();
+
+private:
+
+    CPresenceGrantRequestInfoImp();
+    void ConstructL();
+    void ConstructL( const MXIMPIdentity& aIdentity,
+                     const TDesC16& aDisplayName );
+    
+    /**
+     * @see CXIMPApiDataObjBase
+     */
+    XIMPIMP_DECLARE_DATAOBJ_BASE_PRIV_METHODS
+
+public: // From MXIMPBase
+
+    /**
+     * Implementation of MXIMPBase interface methods
+     * @see MXIMPBase
+     */
+    XIMPIMP_DECLARE_IF_BASE_METHODS
+
+    /**
+     * @see CXIMPApiDataObjBase
+     */
+    XIMPIMP_DECLARE_DATAOBJ_BASE_METHODS
+
+
+public: // From MPresenceGrantRequestInfo
+
+    const MXIMPIdentity& RequestorId() const;
+    const TDesC16& RequestorDisplayName() const;
+    void SetRequestorIdL( MXIMPIdentity* aIdentity );
+    void SetRequestorDisplayNameL( const TDesC16& aDisplayName );
+    
+
+
+public: // New functions
+
+    /**
+     * Internalizes object data from given stream.
+     * @param aStream Stream to read.
+     */
+    IMPORT_C void InternalizeL( RReadStream& aStream );
+
+    /**
+     * Set identity
+     */
+    IMPORT_C void SetIdentity( CXIMPIdentityImp* aIdentity );
+
+    /**
+     * Set identity
+     */
+    IMPORT_C void SetDisplayName( HBufC16* aDisplayName );
+
+    /**
+     * TLinearOrder for ordering based on stored group id,
+     * when this class is used within an RPointerArray or derivatives.
+     */
+    IMPORT_C static TInt IdLinearOrder(
+            const CPresenceGrantRequestInfoImp& aA,
+            const CPresenceGrantRequestInfoImp& aB );
+
+    /**
+     * Access to identity object
+     * @return Identity
+     */
+    IMPORT_C const CXIMPIdentityImp& IdentityImp() const;
+
+private: // data
+
+    /**
+     * Identity
+     */
+    CXIMPIdentityImp* iIdentity;
+
+    /**
+     * Displayname
+     */
+    RBuf16 iDisplayName;
+
+    };
+
+
+#endif // CPRESENCEGRANTREQUESTINFOIMP_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresencedatamodel/presenceauthorization/presencegrantrequestlisteventimp.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  Presence watcher list event implementation.
+ *
+*/
+
+#include "presencegrantrequestlisteventimp.h"
+#include "presencegrantrequestinfoimp.h"
+#include "ximpobjecthelpers.h"
+#include "ximpidentityimp.h"
+#include "ximpdatasubscriptionstateimp.h"
+#include <s32strm.h>
+
+
+// ---------------------------------------------------------------------------
+// CPresenceGrantRequestListEventImp::NewLC()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CPresenceGrantRequestListEventImp* CPresenceGrantRequestListEventImp::NewLC(
+        RPrGrntReqInfoImpArray* aNew,
+        RPrGrntReqInfoImpArray* aPending,
+        RPrGrntReqInfoImpArray* aObsoleted,
+        CXIMPDataSubscriptionStateImp* aState
+        )
+    {
+    CPresenceGrantRequestListEventImp* self = new( ELeave ) CPresenceGrantRequestListEventImp();
+    CleanupStack::PushL( self );
+    self->ConstructL( aNew, aPending, aObsoleted, aState );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceGrantRequestListEventImp::NewFromStreamLC()
+// ---------------------------------------------------------------------------
+//
+CXIMPApiEventBase* CPresenceGrantRequestListEventImp::NewFromStreamLC( RReadStream& aStream )
+    {
+    CPresenceGrantRequestListEventImp* self = new( ELeave ) CPresenceGrantRequestListEventImp;
+    CleanupStack::PushL( self );
+    self->ConstructL( aStream );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceGrantRequestListEventImp::~CPresenceGrantRequestListEventImp()
+// ---------------------------------------------------------------------------
+//
+CPresenceGrantRequestListEventImp::~CPresenceGrantRequestListEventImp()
+    {
+    if( iConstructedFromStream )
+        {
+        delete iNewRequests;
+        delete iPending;
+        delete iObsoleted;
+        iPending = NULL;
+        }
+    if( iOwnsPending )
+        {
+        delete iPending;
+        }
+
+    delete iSubscriptionState;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CPresenceGrantRequestListEventImp::CPresenceGrantRequestListEventImp()
+// ---------------------------------------------------------------------------
+//
+CPresenceGrantRequestListEventImp::CPresenceGrantRequestListEventImp()
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// CPresenceGrantRequestListEventImp::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void CPresenceGrantRequestListEventImp::ConstructL(
+        RPrGrntReqInfoImpArray* aNew,
+        RPrGrntReqInfoImpArray* aPending,
+        RPrGrntReqInfoImpArray* aObsoleted,
+        CXIMPDataSubscriptionStateImp* aState )
+    {
+    iNewRequests = aNew;
+    if( aPending )
+        {
+        iPending = aPending;
+        }
+    else
+        {
+        iPending = new ( ELeave ) RPrGrntReqInfoImpArray;
+        iOwnsPending = ETrue;
+        }
+    iObsoleted = aObsoleted;
+    iSubscriptionState = aState;
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceGrantRequestListEventImp::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void CPresenceGrantRequestListEventImp::ConstructL( RReadStream& aStream )
+    {
+    iConstructedFromStream = ETrue;
+
+    iNewRequests = new ( ELeave ) RPrGrntReqInfoImpArray;
+    iPending = new ( ELeave ) RPrGrntReqInfoImpArray;
+    iObsoleted = new ( ELeave ) RPrGrntReqInfoImpArray;
+    iSubscriptionState = CXIMPDataSubscriptionStateImp::NewL();
+
+    FillArrayFromStreamL( *iNewRequests, aStream );
+    FillArrayFromStreamL( *iPending, aStream );
+    FillArrayFromStreamL( *iObsoleted, aStream );
+    iSubscriptionState->InternalizeL( aStream );
+    }
+
+// ---------------------------------------------------------------------------
+// Implement supported interface access.
+// ---------------------------------------------------------------------------
+//
+XIMPIMP_IF_BASE_GET_INTERFACE_BEGIN( CPresenceGrantRequestListEventImp,
+                                     MPresenceGrantRequestListEvent )
+    XIMPIMP_IF_BASE_GET_CLASS( CXIMPApiEventBase, this )
+XIMPIMP_IF_BASE_GET_INTERFACE_END()
+
+
+XIMPIMP_IF_BASE_GET_CONST_INTERFACE_BEGIN( CPresenceGrantRequestListEventImp,
+                                           MPresenceGrantRequestListEvent )
+    XIMPIMP_IF_BASE_GET_CONST_CLASS( CXIMPApiEventBase, this )                                            
+XIMPIMP_IF_BASE_GET_INTERFACE_END()
+
+// ---------------------------------------------------------------------------
+// Implement methods from base event interface and base event class
+// ---------------------------------------------------------------------------
+//
+XIMPIMP_IMPLEMENT_EVENT_BASE_METHODS( CPresenceGrantRequestListEventImp,
+                                      MPresenceGrantRequestListEvent )
+
+// ---------------------------------------------------------------------------
+// CPresenceGrantRequestListEventImp::EqualsContent()
+// ---------------------------------------------------------------------------
+//
+TBool CPresenceGrantRequestListEventImp::EqualsContent( 
+    const CXIMPApiEventBase& aOtherInstance ) const
+    {
+    const CPresenceGrantRequestListEventImp* tmp =
+    TXIMPGetImpClassOrPanic< const CPresenceGrantRequestListEventImp >::From( 
+                                                        aOtherInstance.Base() );
+    
+    TBool same = ETrue;
+    TBool x = TXIMPEqualsContent< CPresenceGrantRequestInfoImp >::Array( *iNewRequests, *( tmp->iNewRequests ) );
+    same &= x;
+
+    x = TXIMPEqualsContent< CPresenceGrantRequestInfoImp >::Array( *iPending, *( tmp->iPending ) );
+    same &= x;
+
+    x = TXIMPEqualsContent< CPresenceGrantRequestInfoImp >::Array( *iObsoleted, *( tmp->iObsoleted ) );
+    same &= x;
+
+    x = iSubscriptionState->EqualsContent( *tmp->iSubscriptionState );
+    same &= x;
+
+    return same;
+    }
+
+// ---------------------------------------------------------------------------
+// From class CXIMPApiEventBase.
+// CPresenceGrantRequestListEventImp::ExternalizeL()
+// ---------------------------------------------------------------------------
+//
+void CPresenceGrantRequestListEventImp::ExternalizeL( RWriteStream& aStream ) const
+    {
+    WriteArrayToStreamL( *iNewRequests, aStream );
+    WriteArrayToStreamL( *iPending, aStream );
+    WriteArrayToStreamL( *iObsoleted, aStream );
+    iSubscriptionState->ExternalizeL( aStream );
+    }
+
+
+
+// ---------------------------------------------------------------------------
+// From MPresenceGrantRequestListEvent class.
+// CPresenceGrantRequestListEventImp::NewRequestsCount()
+// ---------------------------------------------------------------------------
+//
+TInt CPresenceGrantRequestListEventImp::NewRequestsCount() const
+    {
+    return iNewRequests->Count();
+    }
+
+// ---------------------------------------------------------------------------
+// From MPresenceGrantRequestListEvent class.
+// CPresenceGrantRequestListEventImp::NewRequest()
+// ---------------------------------------------------------------------------
+//
+const MPresenceGrantRequestInfo&
+            CPresenceGrantRequestListEventImp::NewRequest( TInt aIndex ) const
+    {
+    return *(*iNewRequests)[ aIndex ];
+    }
+    
+    
+// ---------------------------------------------------------------------------
+// From MPresenceGrantRequestListEvent class.
+// CPresenceGrantRequestListEventImp::DisappearedRequestsCount()
+// ---------------------------------------------------------------------------
+//
+TInt CPresenceGrantRequestListEventImp::DisappearedRequestsCount() const
+    {
+    return iObsoleted->Count();
+    }
+
+// ---------------------------------------------------------------------------
+// From MPresenceGrantRequestListEvent class.
+// CPresenceGrantRequestListEventImp::DisappearedRequest()
+// ---------------------------------------------------------------------------
+//
+const MPresenceGrantRequestInfo&
+    CPresenceGrantRequestListEventImp::DisappearedRequest( TInt aIndex ) const
+    {
+    return *(*iObsoleted)[ aIndex ];
+    }
+    
+
+// ---------------------------------------------------------------------------
+// From MPresenceGrantRequestListEvent class.
+// CPresenceGrantRequestListEventImp::CurrentRequestsCount()
+// ---------------------------------------------------------------------------
+//
+TInt CPresenceGrantRequestListEventImp::CurrentRequestsCount() const
+    {
+    return iPending->Count();
+    }
+
+// ---------------------------------------------------------------------------
+// From MPresenceGrantRequestListEvent class.
+// CPresenceGrantRequestListEventImp::CurrentRequest()
+// ---------------------------------------------------------------------------
+//
+const MPresenceGrantRequestInfo&
+    CPresenceGrantRequestListEventImp::CurrentRequest( TInt aIndex ) const
+    {
+    return *(*iPending)[ aIndex ];
+    }
+
+
+
+
+
+// ---------------------------------------------------------------------------
+// From class MPresenceGrantRequestListEvent.
+// CPresenceGrantRequestListEventImp::DataSubscriptionState()
+// ---------------------------------------------------------------------------
+//
+const MXIMPDataSubscriptionState&
+    CPresenceGrantRequestListEventImp::DataSubscriptionState() const
+    {
+    return *iSubscriptionState;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CPresenceGrantRequestListEventImp::WriteArrayToStreamL()
+// ---------------------------------------------------------------------------
+//
+void CPresenceGrantRequestListEventImp::WriteArrayToStreamL(
+        RPrGrntReqInfoImpArray& aArray, RWriteStream& aStream ) const
+    {
+    TInt count = aArray.Count();
+    aStream.WriteInt32L( count );
+        {
+        for( TInt a = 0; a < count; ++a )
+            {
+            aArray[ a ]->ExternalizeL( aStream );
+            }
+        }
+    }
+
+
+// ---------------------------------------------------------------------------
+// CPresenceGrantRequestListEventImp::FillArrayFromStreamL
+// ---------------------------------------------------------------------------
+//
+void CPresenceGrantRequestListEventImp::FillArrayFromStreamL(
+        RPrGrntReqInfoImpArray& aArray,
+        RReadStream& aStream )
+    {
+    TInt count = aStream.ReadInt32L();
+    for( TInt a = 0; a < count; ++a )
+        {
+        // the stream MUST be in order (since it was externalized by this class)
+        CPresenceGrantRequestInfoImp* newInfo = CPresenceGrantRequestInfoImp::NewLC();
+        newInfo->InternalizeL( aStream );
+        aArray.AppendL( newInfo );
+        CleanupStack::Pop(); // newInfo
+        }
+    }
+
+// End of file
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresencedatamodel/presenceauthorization/presencegrantrequestlisteventimp.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,152 @@
+/*
+* 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:  MPresenceGrantRequestList API object implementation.
+ *
+*/
+
+#ifndef CPRESENCEGRANTREQUESTLISTEVENTIMP_H
+#define CPRESENCEGRANTREQUESTLISTEVENTIMP_H
+
+#include <presencegrantrequestlistevent.h>
+#include "ximpapieventbase.h"
+#include "presencetypehelpers.h"
+
+class RReadStream;
+class CPresenceGrantRequestInfoImp;
+class CXIMPIdentityImp;
+class CXIMPDataSubscriptionStateImp;
+
+/**
+ * MPresenceGrantRequestList API object implementation.
+ *
+ * @lib ximpdatamodel.dll
+ * @since S60 v3.2
+ */
+NONSHARABLE_CLASS( CPresenceGrantRequestListEventImp ): public CXIMPApiEventBase,
+                                                            public MPresenceGrantRequestListEvent
+    {
+public:
+    /** The class ID. */
+    enum { KClassId = PRIMP_CLSID_CPRESENCEGRANTREQUESTLISTEVENTIMP };
+
+public:
+    /**
+     * Exported instantiation method for initializing
+     * new event object.
+     */
+    IMPORT_C static CPresenceGrantRequestListEventImp* NewLC(
+            RPrGrntReqInfoImpArray* aNew,
+            RPrGrntReqInfoImpArray* aPending,
+            RPrGrntReqInfoImpArray* aObsoleted,
+            CXIMPDataSubscriptionStateImp* aState
+            );
+
+    /**
+     * Instantiation method for event automation.
+     * Method signature must be exactly this to work
+     * with event delivery automation system.
+     *
+     * Event implementation must be registered to
+     * XIMPEventCodec KXIMPEventConstructorTable.
+     */
+    static CXIMPApiEventBase* NewFromStreamLC( RReadStream& aStream );
+
+    virtual ~CPresenceGrantRequestListEventImp();
+
+
+private:
+    CPresenceGrantRequestListEventImp();
+
+    void ConstructL(
+            RPrGrntReqInfoImpArray* aNew,
+            RPrGrntReqInfoImpArray* aPending,
+            RPrGrntReqInfoImpArray* aObsoleted,
+            CXIMPDataSubscriptionStateImp* aState
+            );
+
+    void ConstructL( RReadStream& aStream );
+
+    /**
+     * Helper for externalize.
+     */
+    void WriteArrayToStreamL( RPrGrntReqInfoImpArray& aArray,
+            RWriteStream& aStream ) const;
+
+    /**
+     * Helper for internalize
+     */
+    void FillArrayFromStreamL( RPrGrntReqInfoImpArray& aArray,
+            RReadStream& aStream );
+
+public: // From API base interfaces
+
+    /**
+     * Implementation of MXIMPBase interface methods
+     * @see MXIMPBase
+     */
+    XIMPIMP_DECLARE_IF_BASE_METHODS
+
+
+    /**
+     * Implementation of MXIMPEventBase interface and
+     * CXIMPApiEventBase methods
+     *
+     * @see MXIMPEventBase
+     * @see CXIMPApiEventBase
+     */
+    XIMPIMP_DECLARE_EVENT_BASE_METHODS
+
+
+public: // From MPresenceGrantRequestListEvent
+
+
+    TInt NewRequestsCount() const;
+    const MPresenceGrantRequestInfo& NewRequest( TInt aIndex ) const;
+
+    TInt DisappearedRequestsCount() const;
+    const MPresenceGrantRequestInfo& DisappearedRequest( TInt aIndex ) const;
+
+    TInt CurrentRequestsCount() const;
+    const MPresenceGrantRequestInfo& CurrentRequest( TInt aIndex ) const;
+    
+    const MXIMPDataSubscriptionState& DataSubscriptionState() const;
+
+private: // data
+
+    /**
+     * ETrue if constructed from stream.
+     */
+    TBool iConstructedFromStream;
+
+    /**
+     * Group informations.
+     * Owns if constructed from stream. Otherwise does not own.
+     */
+    RPrGrntReqInfoImpArray* iNewRequests;
+    RPrGrntReqInfoImpArray* iPending;
+    RPrGrntReqInfoImpArray* iObsoleted;
+
+    /**
+     * Pending array own status
+     */
+    TBool iOwnsPending;
+
+    /**
+     * Subscription state
+     */
+    CXIMPDataSubscriptionStateImp* iSubscriptionState;
+    };
+
+
+#endif // CPRESENCEGRANTREQUESTLISTEVENTIMP_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresencedatamodel/presenceauthorization/presencetoeveryoneconfigurationitem.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,158 @@
+/*
+* 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 to everyone configuration item
+*
+*/
+
+
+#include "presencetoeveryoneconfigurationitem.h"
+#include "ximpitemparent.h"
+#include "presenceinfofilterimp.h"
+#include "ximppanics.h"
+#include "ximppsccontext.h"
+#include "documentutils.h"
+#include "presentitypresenceeventimp.h"
+
+#include "ximptrace.h"
+
+// ---------------------------------------------------------------------------
+// CPresenceToEveryoneConfigurationItem::CPresenceToEveryoneConfigurationItem()
+// ---------------------------------------------------------------------------
+//
+CPresenceToEveryoneConfigurationItem::CPresenceToEveryoneConfigurationItem( MXIMPItemParentBase& aParent )
+: CXIMPConfigurationItemBase( aParent )
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// CPresenceToEveryoneConfigurationItem::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void CPresenceToEveryoneConfigurationItem::ConstructL()
+    {
+    CXIMPConfigurationItemBase::BaseConstructL();
+    }
+
+
+// ---------------------------------------------------------------------------
+// CPresenceToEveryoneConfigurationItem::NewLC()
+// ---------------------------------------------------------------------------
+//
+CPresenceToEveryoneConfigurationItem*
+    CPresenceToEveryoneConfigurationItem::NewLC( MXIMPItemParentBase& aParent )
+    {
+    CPresenceToEveryoneConfigurationItem* self =
+        new( ELeave ) CPresenceToEveryoneConfigurationItem( aParent );
+    CleanupClosePushL( *self );
+    self->ConstructL();
+    return self;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CPresenceToEveryoneConfigurationItem::~CPresenceToEveryoneConfigurationItem()
+// ---------------------------------------------------------------------------
+//
+CPresenceToEveryoneConfigurationItem::~CPresenceToEveryoneConfigurationItem()
+    {
+    MXIMPItemParent* presCache = static_cast<MXIMPItemParent*>(iParent.GetInterface(PRESENCE_ITEM_PARENT));
+    presCache->RemoveMe( this );
+
+    delete iPif;    
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceToEveryoneConfigurationItem::ConfigurationPif()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CPresenceInfoFilterImp& 
+            CPresenceToEveryoneConfigurationItem::ConfigurationPif()
+    {
+    TRACE(_L("CPresenceToEveryoneConfigurationItem::ConfigurationPif" ) );
+    __ASSERT_ALWAYS( iPif, User::Panic( NXIMPPrivPanic::KCategory, 
+                                        NXIMPPrivPanic::EOwnPresencePifNotSet ) );
+    return *iPif;
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceToEveryoneConfigurationItem::SetSubscriptionPif()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CPresenceToEveryoneConfigurationItem::SetConfigurationPif(
+                                                CPresenceInfoFilterImp* aPif )
+    {
+    TRACE(_L("CPresenceToEveryoneConfigurationItem::SetConfigurationPif" ) );
+    if ( !aPif )
+        {
+        TRACE(_L("CPresenceToEveryoneConfigurationItem::SetConfigurationPif aPif NULL" ) );
+        }
+    delete iPif;
+    iPif = aPif;
+    }
+    
+// ---------------------------------------------------------------------------
+// CPresenceToEveryoneConfigurationItem::CollectSubscriptionPifWithoutCtxL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CPresenceInfoFilterImp* 
+    CPresenceToEveryoneConfigurationItem::CollectConfigurationPifWithoutCtxL( 
+                                                        MXIMPPscContext* aContext )
+    {
+    TRACE(_L("CPresenceToEveryoneConfigurationItem::CollectConfigurationPifWithoutCtxL" ) );
+    RPointerArray< CPresenceInfoFilterImp > arrayOfPifs;
+    CleanupClosePushL( arrayOfPifs );
+    
+    TInt count = iConfigContexts.Count();
+    for( TInt a = 0; a < count; ++a )
+        {
+        if( iConfigContexts[ a ] != aContext )
+            {
+            CPresenceInfoFilterImp* filter = iConfigContexts[ a ]->PresenceInfoFilter( 
+                        MXIMPPscContext::EGrantPresenceToEveryoneFilter );
+            if ( filter )
+                {
+                arrayOfPifs.AppendL( filter );
+                }
+            }        
+        }
+    CPresenceInfoFilterImp* pifWithoutCtx = DocumentUtils::InfoFilterUnionL( arrayOfPifs );    
+    CleanupStack::PopAndDestroy(); // arrayOfPifs
+    return pifWithoutCtx;
+    }
+
+// ---------------------------------------------------------------------------
+// From class MXIMPSubscriptionItem.
+// CPresenceToEveryoneConfigurationItem::SynthesiseSubscriptionEventTo()
+// ---------------------------------------------------------------------------
+//
+void CPresenceToEveryoneConfigurationItem::SynthesiseSubscriptionEventToL(
+                                                    MXIMPPscContext* aContext,
+                                                    TBool aForceEvent )
+    {
+    TRACE_1( _L("CPresenceToEveryoneConfigurationItem::SynthesiseSubscriptionEventTo() aForce=%d"), aForceEvent );
+    XIMP_UNUSED_FORMAL_PARAM( aContext );
+    XIMP_UNUSED_FORMAL_PARAM( aForceEvent );
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceToEveryoneConfigurationItem::CleanExpired()
+// ---------------------------------------------------------------------------
+//
+void CPresenceToEveryoneConfigurationItem::CleanExpired()
+    {
+    
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresencedatamodel/presenceauthorization/presencetoeveryoneconfigurationitem.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,113 @@
+/*
+* 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 to everyone configuration item
+*
+*/
+
+#ifndef CPSCPRESENCETOEVERYONECONFIGURATIONITEM_H
+#define CPSCPRESENCETOEVERYONECONFIGURATIONITEM_H
+
+#include <e32base.h>
+#include "ximpconfigurationitembase.h"
+
+class CPresenceInfoFilterImp;
+
+/**
+ * Presence to everyone configuration item
+ *
+ * @since S60 v3.2
+ */
+class CPresenceToEveryoneConfigurationItem : public CXIMPConfigurationItemBase
+    {
+public: // Construction and destruction
+
+    /**
+     * Construction
+     * @param aParent. Parent has to be informed when this object is deleted by RemoveMe method.
+     */
+    static CPresenceToEveryoneConfigurationItem* NewLC( MXIMPItemParentBase& aParent );
+
+    /**
+     * Destruction
+     * - Remember to inform parent about delete.
+     */
+    ~CPresenceToEveryoneConfigurationItem();
+
+private: // Construction and destruction
+
+    /**
+     * Construction
+     * @param aParent. Parent has to be informed when this object is deleted by RemoveMe method.
+     */
+    CPresenceToEveryoneConfigurationItem( MXIMPItemParentBase& aParent );
+
+    /**
+     * Construction
+     */
+    void ConstructL();
+
+public: // New methods
+
+    /**
+     * Current presence information filter.
+     * @return Current presence information filter.
+     */
+    IMPORT_C CPresenceInfoFilterImp& ConfigurationPif();
+    
+    /**
+     * Set current presence information filter. Overwrites existing one.
+     * Ownership is transferred to callee.
+     * @param aPif Current presence information filter.
+     */
+    IMPORT_C void SetConfigurationPif( CPresenceInfoFilterImp* aPif );
+
+    /**
+     * Collect aggregated presence information filter without given context.
+     * @param aContext. Exluded context from aggregated pif.
+     * @return Aggregated pif without exluded context.
+     */    
+    IMPORT_C CPresenceInfoFilterImp* CollectConfigurationPifWithoutCtxL( 
+                                                    MXIMPPscContext* aContext );    
+        
+    
+public: // From MXIMPSubscriptionItem
+
+    /**
+     * @see MXIMPSubscriptionItem
+     */
+    void SynthesiseSubscriptionEventToL( MXIMPPscContext* aContext, TBool aForceEvent );
+
+public: // From MXIMPConfigurationItem
+
+private: // From CXIMPSubscriptionItemBase
+
+    /**
+     * @see CXIMPSubscriptionItemBase
+     */
+    void CleanExpired();        
+
+private: // Data
+
+    /**
+     * Current presence information filter.
+     */
+    CPresenceInfoFilterImp* iPif;
+    };
+
+
+/* ======================================================================== */
+
+
+
+#endif // CPSCPRESENCETOEVERYONECONFIGURATIONITEM_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresencedatamodel/presencecache/presencebuddyinfoimp.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,270 @@
+/*
+* 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:  CPresenceBuddyInfoImp object implementation.
+*
+*/
+
+
+#include <s32buf.h>
+#include <ximpidentity.h>
+#include <presenceinfo.h>
+#include <personpresenceinfo.h>
+
+#include "ximpidentityimp.h"
+#include "presencebuddyinfoimp.h"
+#include "presenceinfoimp.h"
+#include "personpresenceinfoimp.h"
+
+
+// ---------------------------------------------------------------------------
+// CPresenceBuddyInfoImp::NewLC()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CPresenceBuddyInfoImp* CPresenceBuddyInfoImp::NewLC()
+    {
+    CPresenceBuddyInfoImp* self = new( ELeave ) CPresenceBuddyInfoImp;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceBuddyInfoImp::NewL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CPresenceBuddyInfoImp* CPresenceBuddyInfoImp::NewL()
+    {
+    CPresenceBuddyInfoImp* self = NewLC();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceBuddyInfoImp::~CPresenceBuddyInfoImp()
+// ---------------------------------------------------------------------------
+//
+CPresenceBuddyInfoImp::~CPresenceBuddyInfoImp()
+    {
+    if (iPresenceInfo)
+        delete iPresenceInfo;
+    if(iIdentity)
+        delete iIdentity;
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceBuddyInfoImp::CPresenceBuddyInfoImp()
+// ---------------------------------------------------------------------------
+//
+CPresenceBuddyInfoImp::CPresenceBuddyInfoImp()
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceBuddyInfoImp::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void CPresenceBuddyInfoImp::ConstructL()
+    {
+    iPresenceInfo = CPresenceInfoImp::NewL();
+    iIdentity = CXIMPIdentityImp::NewL();
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceBuddyInfoImp::Set()
+// ---------------------------------------------------------------------------
+//
+TInt CPresenceBuddyInfoImp::Set( MXIMPIdentity* aIdentity,
+                                 MPresenceInfo* aPresenceInfo)
+    {
+    TInt err(KErrArgument);
+    
+    if(aIdentity && aPresenceInfo) // Check whether data is valid
+        {
+        delete iIdentity;
+        iIdentity = TXIMPGetImpClassOrPanic< CXIMPIdentityImp >::From( *aIdentity );
+        
+        delete iPresenceInfo;
+        iPresenceInfo = NULL;
+        iPresenceInfo = 
+            TXIMPGetImpClassOrPanic< CPresenceInfoImp >::From( *aPresenceInfo );
+                
+        err = KErrNone;
+        }
+    
+    return err;
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceBuddyInfoImp::SetPresenceInfo()
+// ---------------------------------------------------------------------------
+//
+TInt CPresenceBuddyInfoImp::SetPresenceInfo(MPresenceInfo* aPresenceInfo)
+    {
+    TInt err(KErrArgument);
+    if(aPresenceInfo)
+        {
+        delete iPresenceInfo;
+        iPresenceInfo = NULL;
+        iPresenceInfo = 
+            TXIMPGetImpClassOrPanic< CPresenceInfoImp >::From( *aPresenceInfo );
+        err = KErrNone;
+        }
+    
+    return err;
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceBuddyInfoImp::SetBuddyId()
+// ---------------------------------------------------------------------------
+//
+TInt CPresenceBuddyInfoImp::SetBuddyId(MXIMPIdentity* aIdentity)
+    {
+    TInt err(KErrArgument);
+    
+    if(aIdentity)
+        {
+    delete iIdentity;
+        iIdentity = TXIMPGetImpClassOrPanic< CXIMPIdentityImp >::From( *aIdentity );
+    err = KErrNone;
+        }
+    
+    return err;
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceBuddyInfoImp::SetPersonPresenceL()
+// ---------------------------------------------------------------------------
+//
+TInt CPresenceBuddyInfoImp::SetPersonPresenceL(
+                        MPersonPresenceInfo* aPersonPresenceInfo)
+    {
+    TInt err(KErrArgument);
+    if(aPersonPresenceInfo)
+        {
+        iPresenceInfo->SetPersonPresenceL(aPersonPresenceInfo);
+        err = KErrNone;
+        }
+    
+    return err;
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceBuddyInfoImp::PresenceInfo()
+// ---------------------------------------------------------------------------
+//
+const MPresenceInfo* CPresenceBuddyInfoImp::PresenceInfo() const
+    {
+    return iPresenceInfo;        
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceBuddyInfoImp::BuddyUserId()
+// ---------------------------------------------------------------------------
+//
+const MXIMPIdentity* CPresenceBuddyInfoImp::BuddyId() const
+    {
+    return iIdentity;        
+    }
+        
+// ---------------------------------------------------------------------------
+// CPresenceBuddyInfoImp::EqualsIdentity()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TBool CPresenceBuddyInfoImp::EqualsIdentity(
+                            const MPresenceBuddyInfo* aOtherInstance ) const
+    {
+    TBool ret(EFalse);
+    if(aOtherInstance)
+        {
+        const CXIMPIdentityImp* tmp = 
+            TXIMPGetImpClassOrPanic< const CXIMPIdentityImp >::From( *(aOtherInstance->BuddyId()));
+        ret = iIdentity->EqualsContent( *tmp);
+        }
+    return ret;
+    }
+    
+// ---------------------------------------------------------------------------
+// CPresenceBuddyInfoImp::NewFromStreamLC()
+// ---------------------------------------------------------------------------
+//
+XIMPIMP_IMPLEMENT_DATAOBJ_NEWFROMSTREAM( CPresenceBuddyInfoImp )
+
+
+// ---------------------------------------------------------------------------
+// Implement supported interface access.
+// ---------------------------------------------------------------------------
+//
+XIMPIMP_IF_BASE_GET_INTERFACE_BEGIN( CPresenceBuddyInfoImp, 
+                                     MPresenceBuddyInfo )
+XIMPIMP_IF_BASE_GET_INTERFACE_END()
+
+
+XIMPIMP_IF_BASE_GET_CONST_INTERFACE_BEGIN( CPresenceBuddyInfoImp, 
+                                           MPresenceBuddyInfo )
+XIMPIMP_IF_BASE_GET_INTERFACE_END()
+
+// ---------------------------------------------------------------------------
+// CPresenceBuddyInfoImp::EqualsContent()
+// ---------------------------------------------------------------------------
+//
+TBool CPresenceBuddyInfoImp::EqualsContent( 
+    const CXIMPApiDataObjBase& aOtherInstance ) const
+    {
+    const CPresenceBuddyInfoImp* tmp =
+        TXIMPGetImpClassOrPanic< const CPresenceBuddyInfoImp >::From( aOtherInstance.Base() );
+
+    TBool same = ETrue;
+    TBool x = iPresenceInfo->EqualsContent( *tmp->iPresenceInfo );
+    same &= x;
+    
+    x = iIdentity->EqualsContent( *tmp->iIdentity );
+    same &= x;
+    
+    return same;
+    }
+    
+// ---------------------------------------------------------------------------
+// CPresenceBuddyInfoImp::ExternalizeL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CPresenceBuddyInfoImp::ExternalizeL( RWriteStream& aStream ) const
+    {
+    iPresenceInfo->ExternalizeL( aStream );
+    iIdentity->ExternalizeL( aStream );
+    }
+
+
+// ---------------------------------------------------------------------------
+// CPresenceBuddyInfoImp::InternalizeL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CPresenceBuddyInfoImp::InternalizeL( RReadStream& aStream )
+    {
+    CPresenceInfoImp* tmp = CPresenceInfoImp::NewLC();
+    tmp->InternalizeL( aStream );
+    if (iPresenceInfo)
+        delete iPresenceInfo;
+    iPresenceInfo = NULL;
+    iPresenceInfo = tmp;
+    CleanupStack::Pop( tmp );
+    
+    CXIMPIdentityImp* tmp1 = CXIMPIdentityImp::NewLC();
+    tmp1->InternalizeL( aStream );
+    if (iIdentity)
+        delete iIdentity;
+    iIdentity = tmp1;
+    CleanupStack::Pop( tmp1 );
+    
+
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresencedatamodel/presencecache/presencebuddyinfoimp.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,122 @@
+/*
+* Copyright (c) 2007, 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:  MPresenceBuddyInfo API object implementation.
+*
+*/
+
+#ifndef CXIMPPRESENCEBUDDYINFOIMP_H
+#define CXIMPPRESENCEBUDDYINFOIMP_H
+
+#include <presencebuddyinfo.h>
+
+#include "presenceapiobjbase.h"
+#include "presencetypehelpers.h"
+#include "ximpapiobjbase.h"
+
+class CPresenceInfoImp;
+class MPresenceInfo;
+class CXIMPIdentityImp;
+
+/**
+ * MPresenceBuddyInfo API object implementation.
+ *
+ * @lib ximpdatamodel.dll
+ * @since S60 v3.2
+ */
+NONSHARABLE_CLASS( CPresenceBuddyInfoImp ): public CXIMPApiDataObjBase,
+                                            public MPresenceBuddyInfo
+    {
+    public:
+    /** The class ID. */
+    enum { KClassId = PRIMP_CLSID_CXIMPPRESENCEBUDDYINFOIMP };
+
+
+public:
+
+    /**
+     * Symbian constructors and c++ destructor
+     */
+    IMPORT_C static CPresenceBuddyInfoImp* NewLC();
+    IMPORT_C static CPresenceBuddyInfoImp* NewL();
+    virtual ~CPresenceBuddyInfoImp();
+
+private:
+
+    /**
+     * c++ constructor
+     */
+    CPresenceBuddyInfoImp();
+    
+    /**
+     * Symbian second phase constructor
+     */
+    void ConstructL();
+
+public: // From MXIMPBase
+
+    /**
+     * Implementation of MXIMPBase interface methods
+     * @see MXIMPBase
+     */
+    XIMPIMP_DECLARE_IF_BASE_METHODS
+
+public: // From CXIMPApiDataObjBase
+
+    /**
+     * @see CXIMPApiDataObjBase
+     */
+    XIMPIMP_DECLARE_DATAOBJ_BASE_METHODS
+
+public: // From MPresenceBuddyInfo
+
+    TInt Set( MXIMPIdentity* aIdentity,
+              MPresenceInfo* aPresenceInfo);
+    TInt SetPresenceInfo(MPresenceInfo* aPresenceInfo);
+        
+    TInt SetBuddyId(MXIMPIdentity* aIdentity);
+                                
+    TInt SetPersonPresenceL(MPersonPresenceInfo* aPersonPresenceInfo);                                                        
+                                
+    const MPresenceInfo* PresenceInfo() const;
+    
+    const MXIMPIdentity* BuddyId() const;
+        
+    TBool EqualsIdentity(
+                    const MPresenceBuddyInfo* aOtherInstance ) const;
+
+public: // New functions
+
+    /**
+     * Internalizes object data from given stream.
+     * @param aStream Stream to read.
+     */
+    IMPORT_C void InternalizeL( RReadStream& aStream );
+    
+private: // data
+
+
+    /**
+     * OWN: 
+     */
+    CPresenceInfoImp* iPresenceInfo;
+
+    /**
+     * OWN: 
+     */
+    CXIMPIdentityImp* iIdentity;
+
+    };
+
+
+#endif // CXIMPPRESENCEBUDDYINFOIMP_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresencedatamodel/presencecache/presencebuddyinfolistimp.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,317 @@
+/*
+* Copyright (c) 2007, 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:  CPresenceBuddyInfoListImp object implementation.
+*
+*/
+
+
+#include <s32strm.h>
+#include <ximpidentity.h>
+#include <presencebuddyinfo.h>
+
+#include "presencebuddyinfolistimp.h"
+#include "presencebuddyinfoimp.h"
+#include "ximpidentityimp.h"
+#include "ximptrace.h"
+#include "ximprbufhelpers.h"
+
+_LIT(KColon, ":");
+
+// ---------------------------------------------------------------------------
+// CPresenceBuddyInfoListImp::NewLC()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CPresenceBuddyInfoListImp* CPresenceBuddyInfoListImp::NewLC(
+                                                    const TDesC& aServiceName)
+    {
+    CPresenceBuddyInfoListImp* self = new( ELeave ) CPresenceBuddyInfoListImp;
+    CleanupStack::PushL( self );
+    self->ConstructL(aServiceName);
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceBuddyInfoListImp::NewL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CPresenceBuddyInfoListImp* CPresenceBuddyInfoListImp::NewL(
+                                                    const TDesC& aServiceName)
+    {
+    CPresenceBuddyInfoListImp* self = NewLC(aServiceName);
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceBuddyInfoListImp::~CPresenceBuddyInfoListImp()
+// ---------------------------------------------------------------------------
+//
+CPresenceBuddyInfoListImp::~CPresenceBuddyInfoListImp()
+    {
+    if(iOwnDataObjects)
+        {
+        TInt count = iBuddyCollection.Count();
+        for (TInt i=0;i<count;i++)
+            {
+            delete iBuddyCollection[i];
+            }
+        }
+    iBuddyCollection.Close();
+    iService.Close();    
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceBuddyInfoListImp::CPresenceBuddyInfoListImp()
+// ---------------------------------------------------------------------------
+//
+CPresenceBuddyInfoListImp::CPresenceBuddyInfoListImp() :iOwnDataObjects(ETrue)
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceBuddyInfoListImp::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void CPresenceBuddyInfoListImp::ConstructL(const TDesC& aServiceName)
+    {
+    iService.Close();
+    iService.CreateL( aServiceName );  
+    }
+    
+// ---------------------------------------------------------------------------
+// CPresenceBuddyInfoListImp::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void CPresenceBuddyInfoListImp::ConstructL()
+    {
+    }    
+
+// ---------------------------------------------------------------------------
+// CPresenceBuddyInfoListImp::SetOwnObjects()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CPresenceBuddyInfoListImp::SetOwnObjects(TBool aOwnObjects)
+    {
+    iOwnDataObjects = aOwnObjects;
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceBuddyInfoListImp::PresenceInfo()
+// ---------------------------------------------------------------------------
+//
+RPointerArray<MPresenceBuddyInfo>& CPresenceBuddyInfoListImp::GetObjectCollection()
+    {
+    return iBuddyCollection;
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceBuddyInfoListImp::ServiceName()
+// ---------------------------------------------------------------------------
+//
+TPtrC CPresenceBuddyInfoListImp::ServiceName() const
+    {
+    return iService;
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceBuddyInfoListImp::Count()
+// ---------------------------------------------------------------------------
+//
+TInt CPresenceBuddyInfoListImp::Count() const
+    {
+    return iBuddyCollection.Count();
+    }
+    
+// ---------------------------------------------------------------------------
+// CPresenceBuddyInfoListImp::AddOrReplace()
+// ---------------------------------------------------------------------------
+//
+TInt CPresenceBuddyInfoListImp::AddOrReplace(
+    MPresenceBuddyInfo* aPresenceBuddyInfo)
+    {
+    TRACE( _L("CPresenceBuddyInfoListImp::AddOrReplace - begin") );
+    TRACE_1( _L("______identity: %S"), &(aPresenceBuddyInfo->BuddyId()->Identity()));        
+    if(!aPresenceBuddyInfo)
+        return KErrArgument;
+    
+    if ( (ServiceName() != KNullDesC) && 
+        (ExtractService( aPresenceBuddyInfo->BuddyId()->Identity()).Compare( ServiceName()) ))
+        {
+        return KErrArgument;
+        }        
+    TInt count = iBuddyCollection.Count();
+    for(TInt i=0;i<count;i++)
+        { 
+        if( ((iBuddyCollection[i])->EqualsIdentity(aPresenceBuddyInfo)))
+            {
+            delete iBuddyCollection[i];
+            iBuddyCollection.Remove(i);
+            TRACE( _L("_________Match found") );
+            break;
+            }
+        }
+    iBuddyCollection.Append(aPresenceBuddyInfo);
+    TRACE( _L("CPresenceBuddyInfoListImp::AddOrReplace - return"));
+    return KErrNone;
+    }    
+
+// ---------------------------------------------------------------------------
+// CPresenceBuddyInfoListImp::FindAndRemove()
+// ---------------------------------------------------------------------------
+//
+TInt CPresenceBuddyInfoListImp::FindAndRemove(const MXIMPIdentity& aIdentity)
+    {
+    TRACE( _L("CPresenceBuddyInfoListImp::FindAndRemove - begin") );
+    TRACE_1( _L("______identity: %S"), &(aIdentity.Identity()));
+    TInt err(KErrNotFound);
+    TInt count = iBuddyCollection.Count();
+    for(TInt i=0;i<count;i++)
+        {
+        if( ((iBuddyCollection[i])->BuddyId()->Identity())== aIdentity.Identity() )
+            {
+            delete iBuddyCollection[i];
+            iBuddyCollection.Remove(i);
+            err = KErrNone;
+            break;
+            }
+        }
+    TRACE_1( _L("CPresenceBuddyInfoListImp::FindAndRemove - err=%d"),err );
+    return err;
+    }
+    
+// ---------------------------------------------------------------------------
+// CPresenceBuddyInfoListImp::FindAndGet()
+// ---------------------------------------------------------------------------
+//
+MPresenceBuddyInfo* CPresenceBuddyInfoListImp::FindAndGet(
+                                     const MXIMPIdentity& aIdentity) const
+    {
+    TRACE( _L("CPresenceBuddyInfoListImp::FindAndGet - begin") );
+    TRACE_1( _L("______identity: %S"), &(aIdentity.Identity()));
+    MPresenceBuddyInfo* buddyPresInfo(NULL);
+    
+        TInt count = iBuddyCollection.Count();
+        for(TInt i=0;i<count;i++)
+            {
+        if( ((iBuddyCollection[i])->BuddyId()->Identity())== aIdentity.Identity() )
+                {
+                buddyPresInfo = iBuddyCollection[i];
+                break;
+                }
+            }
+    TRACE_1( _L("CPresenceBuddyInfoListImp::FindAndGet - buddyPresInfo=%d"),buddyPresInfo );    
+    return buddyPresInfo;
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceBuddyInfoListImp::NewFromStreamLC()
+// ---------------------------------------------------------------------------
+//
+XIMPIMP_IMPLEMENT_DATAOBJ_NEWFROMSTREAM( CPresenceBuddyInfoListImp )
+
+
+// ---------------------------------------------------------------------------
+// Implement supported interface access.
+// ---------------------------------------------------------------------------
+//
+XIMPIMP_IF_BASE_GET_INTERFACE_BEGIN( CPresenceBuddyInfoListImp, 
+                                     MPresenceBuddyInfoList )
+XIMPIMP_IF_BASE_GET_INTERFACE_END()
+
+
+XIMPIMP_IF_BASE_GET_CONST_INTERFACE_BEGIN( CPresenceBuddyInfoListImp, 
+                                           MPresenceBuddyInfoList )
+XIMPIMP_IF_BASE_GET_INTERFACE_END()
+
+// ---------------------------------------------------------------------------
+// CPresenceBuddyInfoListImp::ExternalizeL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CPresenceBuddyInfoListImp::ExternalizeL( RWriteStream& aStream ) const
+    {
+    TUint32 count = iBuddyCollection.Count();
+    CPresenceBuddyInfoImp* tmp(NULL);
+    
+    aStream.WriteInt32L(count);
+    for (TInt i=0;i<count;i++)
+        {
+        tmp = TXIMPGetImpClassOrPanic< CPresenceBuddyInfoImp >::From( *(iBuddyCollection[i]));
+        tmp->ExternalizeL( aStream );
+        }
+    
+    XIMPRBuf16Helper::ExternalizeL( iService, aStream );    
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceBuddyInfoListImp::InternalizeL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CPresenceBuddyInfoListImp::InternalizeL( RReadStream& aStream )
+    {
+    TUint32 internalizeCount = aStream.ReadInt32L();
+    CPresenceBuddyInfoImp* tmp(NULL);
+    for (TInt i=0;i<internalizeCount;i++)
+        {
+        tmp = CPresenceBuddyInfoImp::NewLC();
+        tmp->InternalizeL( aStream );
+        iBuddyCollection.Append(tmp);
+        CleanupStack::Pop( tmp );
+        }
+    XIMPRBuf16Helper::InternalizeL( iService, aStream );
+    }
+    
+// ---------------------------------------------------------------------------
+// CPresenceBuddyInfoListImp::EqualsContent()
+// ---------------------------------------------------------------------------
+//
+TBool CPresenceBuddyInfoListImp::EqualsContent( 
+    const CXIMPApiDataObjBase& /*aOtherInstance*/ ) const
+    {
+    //Not implemented
+    return EFalse;
+    }
+    
+// ---------------------------------------------------------------------------
+// CPresenceBuddyInfoListImp::BlindAddL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CPresenceBuddyInfoListImp::BlindAddL(
+                                    MPresenceBuddyInfo* aPresenceBuddyInfo)
+    {
+    if(!aPresenceBuddyInfo)
+        return KErrArgument;
+    iBuddyCollection.Append(aPresenceBuddyInfo);
+    return KErrNone;
+    }
+    
+// --------------------------------------------------------------------------
+// CPresenceBuddyInfoListImp::ExtractService
+// --------------------------------------------------------------------------
+//
+TPtrC CPresenceBuddyInfoListImp::ExtractService( const TDesC& aXspId )
+    {         
+    TInt pos = aXspId.Find(KColon);
+    if ( pos >= 0)
+        {
+        // ok input
+        return aXspId.Left(pos);
+        }
+    else
+        {
+        // return something in illegal input case
+        return aXspId;
+        }
+    }    
+    
+// eof
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresencedatamodel/presencecache/presencebuddyinfolistimp.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,142 @@
+/*
+* Copyright (c) 2007, 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:  MPresenceBuddyInfoList implementation.
+*
+*/
+
+#ifndef CXIMPPRESENCEBUDDYINFOLISTIMP_H
+#define CXIMPPRESENCEBUDDYINFOLISTIMP_H
+
+#include <s32buf.h>
+#include <presencebuddyinfolist.h>
+
+#include "presenceapiobjbase.h"
+#include "presencetypehelpers.h"
+#include "ximpapidataobjbase.h"
+
+class MXIMPIdentity;
+class MPresenceBuddyInfo;
+
+/**
+ * MPresenceBuddyInfoList API object implementation. By default the this
+ * list owns the MPresenceBuddyInfo objects.
+ * If the pointer array doesn't needed to own the objects, simply call
+ * SetOwnObjects(EFalse) method before delete. 
+ *
+ * @lib ximpdatamodel.dll
+ * @since S60 v3.2
+ */
+NONSHARABLE_CLASS( CPresenceBuddyInfoListImp ): public CXIMPApiDataObjBase,
+                                                public MPresenceBuddyInfoList                                                
+    {
+    public:
+    /** The class ID. */
+    enum { KClassId = PRIMP_CLSID_CXIMPPRESENCEBUDDYINFOLIST };
+
+
+public:
+    
+    //if aServiceName is KNullDesC then multiple services buddies are allowed
+    IMPORT_C static CPresenceBuddyInfoListImp* NewLC(const TDesC& aServiceName);
+    IMPORT_C static CPresenceBuddyInfoListImp* NewL(const TDesC& aServiceName);
+    virtual ~CPresenceBuddyInfoListImp();
+
+private:
+
+    CPresenceBuddyInfoListImp();
+    void ConstructL(const TDesC& aServiceName);
+    void ConstructL(); // to use with internalize
+
+public: // From MXIMPBase
+
+    /**
+     * Implementation of MXIMPBase interface methods
+     * @see MXIMPBase
+     */
+    XIMPIMP_DECLARE_IF_BASE_METHODS
+
+public: // From CXIMPApiDataObjBase
+
+    /**
+     * @see CXIMPApiDataObjBase
+     */
+    XIMPIMP_DECLARE_DATAOBJ_BASE_METHODS
+
+public: // From MPresenceBuddyInfoList
+
+    RPointerArray<MPresenceBuddyInfo>& GetObjectCollection();
+    
+    TPtrC ServiceName() const;
+    
+    TInt Count() const;
+    
+    TInt AddOrReplace(MPresenceBuddyInfo* aPresenceBuddyInfo);
+    
+    TInt FindAndRemove(const MXIMPIdentity& aIdentity);
+    
+    MPresenceBuddyInfo* FindAndGet(const MXIMPIdentity& aIdentity) const;
+    
+public: // New functions
+
+    /**
+     * Internalizes object data from given stream. Must call 
+     * SetCountForInternalize before calling this function.
+     * @param aStream Stream to read.
+     */
+    IMPORT_C void InternalizeL( RReadStream& aStream );
+    
+    /**
+     * Add buddy presence info object in this collection. Without any
+     * check for duplicates. Takes ownership.
+     * @param aPresenceBuddyInfo object to add.
+     */
+    IMPORT_C TInt BlindAddL(MPresenceBuddyInfo* aPresenceBuddyInfo);
+    
+    /**
+     * Set to own/disown objects. Call this function with EFalse to
+     * set this list not to own objects.
+     */
+    IMPORT_C void SetOwnObjects(TBool aOwnObjects);
+    
+private:
+
+    /**
+     * Extract service name from XspId
+     * @param aXspId XspId URI
+     * @return service name
+     */
+    TPtrC ExtractService( const TDesC& aXspId );    
+
+private: // data
+
+
+    /**
+     * OWN if iOwnDataObjects is true.
+     */
+    RPointerArray< MPresenceBuddyInfo> iBuddyCollection;
+
+    /**
+     * OWN: 
+     */
+    RBuf16 iService;
+    
+    /**
+    *OWN
+    */
+    TBool iOwnDataObjects;
+    
+    };
+
+
+#endif // CXIMPPRESENCEBUDDYINFOLISTIMP_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresencedatamodel/presencedatacacheimp.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,908 @@
+/*
+* 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 Service Connection data cache implementation.
+ *
+*/
+
+
+#include <badesca.h>
+#include <e32cmn.h>
+
+#include "presencedatacacheimp.h"
+#include "ximpidentityimp.h"
+#include "presenceinfoimp.h"
+#include "presencewatcherinfoimp.h"
+#include "watcherlistsubscriptionitem.h"
+#include "ximpobjecthelpers.h"
+#include "ownpresenceeventimp.h"
+#include "ownpresencesubscriptionitem.h"
+#include "grouplistsubscriptionitem.h"
+#include "groupcontentsubscriptionitem.h"
+#include "presentitypresencesubscriptionitem.h"
+#include "presentitygroupmemberspresencesubscriptionitem.h"
+#include "presentitygroupinfoimp.h"
+#include "presentitygroupmemberinfoimp.h"
+#include "presencegrantrequestinfoimp.h"
+#include "grantrequestlistsubscriptionitem.h"
+#include "ximphost.h"
+#include "ximppsccontext.h"
+#include "ximpoperationdefs.h"
+#include "presenceconfigurationitem.h"
+#include "presencetoeveryoneconfigurationitem.h"
+#include "groupmemberspresenceconfigurationitem.h"
+#include "blocklistsubscriptionitem.h"
+#include "presenceblockinfoimp.h"
+#include "presencefilterstore.h"
+//#include "presencecacheclient.h"
+
+#include "ximpapieventbase.h"
+#include <presencecachewriter.h>
+
+#include "ximptrace.h"
+
+
+// ---------------------------------------------------------------------------
+// CPresenceDataCache::CPresenceDataCache()
+// ---------------------------------------------------------------------------
+//
+CPresenceDataCache::CPresenceDataCache( MXIMPHost& aHost )
+:iHost( aHost )
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// CPresenceDataCache::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void CPresenceDataCache::ConstructL()
+    {
+    iEmptySubscriptionState = CXIMPDataSubscriptionStateImp::NewL();    
+    iExtPresenceCache = MPresenceCacheWriter::NewL();
+    }
+
+
+// ---------------------------------------------------------------------------
+// CPresenceDataCache::NewL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CPresenceDataCache* CPresenceDataCache::NewL( MXIMPHost& aHost )
+    {
+    CPresenceDataCache* self = new( ELeave ) CPresenceDataCache( aHost );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CPresenceDataCache::~CPresenceDataCache()
+// ---------------------------------------------------------------------------
+//
+CPresenceDataCache::~CPresenceDataCache()
+    {
+
+    TInt count = iExpiringSubscriptionItems.Count();
+    for( TInt a = 0; a < count; ++a )
+        {
+        iExpiringSubscriptionItems[ a ]->ForceClose();
+        }
+
+    if( iOwnSubscriptionItem )
+        {
+        iOwnSubscriptionItem->ForceClose();
+        }
+    if( iGroupListSubscriptionItem )
+        {
+        iGroupListSubscriptionItem->ForceClose();
+        }
+
+    count = iGroupContentSubscriptionItems.Count();
+    for( TInt a = 0; a < count; ++a )
+        {
+        iGroupContentSubscriptionItems[ a ]->ForceClose();
+        }
+
+    count = iPresentityPresenceSubscriptionItems.Count();
+    for( TInt a = 0; a < count; ++a )
+        {
+        iPresentityPresenceSubscriptionItems[ a ]->ForceClose();
+        }
+
+    if ( iWatcherListSubscriptionItem )
+        {
+        iWatcherListSubscriptionItem->ForceClose();
+        }
+    if ( iGrantRequestListSubscriptionItem )
+        {
+        iGrantRequestListSubscriptionItem->ForceClose();
+        }
+    if ( iBlockListSubscriptionItem )
+        {
+        iBlockListSubscriptionItem->ForceClose();
+        }
+    if( iPresenceToEveryoneConfigurationItem )
+        {
+        iPresenceToEveryoneConfigurationItem->ForceClose();
+        }
+
+    count = iGroupMembersPresenceSubscriptionItems.Count();
+    for( TInt a = 0; a < count; ++a )
+        {
+        iGroupMembersPresenceSubscriptionItems[ a ]->ForceClose();
+        }
+    count = iPresenceConfigurationItems.Count();
+    for( TInt a = 0; a < count; ++a )
+        {
+        iPresenceConfigurationItems[ a ]->ForceClose();
+        }
+    count = iGroupMembersPresenceConfigurationItems.Count();
+    for( TInt a = 0; a < count; ++a )
+        {
+        iGroupMembersPresenceConfigurationItems[ a ]->ForceClose();
+        }
+    
+    iGroupContentSubscriptionItems.Close();
+    iPresentityPresenceSubscriptionItems.Close();
+    iExpiringSubscriptionItems.Close();
+    iGroupMembersPresenceSubscriptionItems.Close();
+    iPresenceConfigurationItems.Close();
+    iGroupMembersPresenceConfigurationItems.Close();
+    
+    delete iEmptySubscriptionState;
+    delete iExtPresenceCache;
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceDataCache::RemoveMe
+// ---------------------------------------------------------------------------
+//
+template< class Type >
+EXPORT_C void CPresenceDataCache::RemoveMe( Type*& aItem, Type* aChild )
+    {
+    if( aChild == aItem )
+        {
+        aItem = NULL;
+        }
+    }
+
+
+// ---------------------------------------------------------------------------
+// CPresenceDataCache::RemoveMeFromArray
+// ---------------------------------------------------------------------------
+//
+template< class Type >
+void CPresenceDataCache::RemoveMeFromArray( RPointerArray< Type >& aItemArray, Type* aChild )
+    {
+    TInt itemCount( aItemArray.Count() );
+    for ( TInt i( 0 ); i < itemCount; i++ )
+        {
+        if ( aChild == aItemArray[ i ] )
+            {
+            aItemArray.Remove( i );
+            break;
+            }
+        }    
+    }
+
+
+
+// ---------------------------------------------------------------------------
+// CPresenceDataCache::RemoveMe
+// ---------------------------------------------------------------------------
+//
+void CPresenceDataCache::RemoveMe( COwnPresenceSubscriptionItem* aChild )
+    {
+    RemoveMe< COwnPresenceSubscriptionItem >( iOwnSubscriptionItem, aChild );
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceDataCache::RemoveMe
+// ---------------------------------------------------------------------------
+//
+void CPresenceDataCache::RemoveMe( CGroupListSubscriptionItem* aChild )
+    {
+    RemoveMe< CGroupListSubscriptionItem >( iGroupListSubscriptionItem, aChild );
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceDataCache::RemoveMe
+// ---------------------------------------------------------------------------
+//
+void CPresenceDataCache::RemoveMe( CGroupContentSubscriptionItem* aChild )
+    {
+    RemoveMeFromArray< CGroupContentSubscriptionItem >( 
+                                    iGroupContentSubscriptionItems, aChild );
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceDataCache::RemoveMe
+// ---------------------------------------------------------------------------
+//
+void CPresenceDataCache::RemoveMe( CPresentityPresenceSubscriptionItem* aChild )
+    {
+    RemoveMeFromArray< CPresentityPresenceSubscriptionItem >( 
+                                    iPresentityPresenceSubscriptionItems, aChild );
+    }
+
+
+// ---------------------------------------------------------------------------
+// CPresenceDataCache::RemoveMe
+// ---------------------------------------------------------------------------
+//
+void CPresenceDataCache::RemoveMe( CWatcherListSubscriptionItem* aChild )
+    {
+    RemoveMe< CWatcherListSubscriptionItem >( iWatcherListSubscriptionItem, aChild );
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceDataCache::RemoveMe
+// ---------------------------------------------------------------------------
+//
+void CPresenceDataCache::RemoveMe( CPresenceConfigurationItem* aChild )
+    {
+    RemoveMeFromArray< CPresenceConfigurationItem >( 
+                                    iPresenceConfigurationItems, aChild );
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceDataCache::RemoveMe
+// ---------------------------------------------------------------------------
+//
+void CPresenceDataCache::RemoveMe( CPresenceToEveryoneConfigurationItem* aChild )
+    {
+    RemoveMe< CPresenceToEveryoneConfigurationItem >( iPresenceToEveryoneConfigurationItem, aChild );
+    }
+
+
+// ---------------------------------------------------------------------------
+// CPresenceDataCache::RemoveMe
+// ---------------------------------------------------------------------------
+//
+void CPresenceDataCache::RemoveMe( CGroupMembersPresenceConfigurationItem* aChild )
+    {
+    RemoveMeFromArray< CGroupMembersPresenceConfigurationItem >( 
+                                    iGroupMembersPresenceConfigurationItems, aChild );
+    }
+
+
+// ---------------------------------------------------------------------------
+// CPresenceDataCache::RemoveMe
+// ---------------------------------------------------------------------------
+//
+void CPresenceDataCache::RemoveMe( CPresentityGroupMembersPresenceSubscriptionItem* aChild )
+    {
+    RemoveMeFromArray< CPresentityGroupMembersPresenceSubscriptionItem >( 
+                                    iGroupMembersPresenceSubscriptionItems, aChild );
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceDataCache::RemoveMe
+// ---------------------------------------------------------------------------
+//
+void CPresenceDataCache::RemoveMe( CGrantRequestListSubscriptionItem* aChild )
+    {
+    RemoveMe< CGrantRequestListSubscriptionItem >( iGrantRequestListSubscriptionItem, aChild );
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceDataCache::RemoveMe
+// ---------------------------------------------------------------------------
+//
+void CPresenceDataCache::RemoveMe( CBlockListSubscriptionItem* aChild )
+    {
+    RemoveMe< CBlockListSubscriptionItem >( iBlockListSubscriptionItem, aChild );
+    }
+
+
+// ---------------------------------------------------------------------------
+// CPresenceDataCache::AddEventL
+// ---------------------------------------------------------------------------
+//
+void CPresenceDataCache::AddEventL( CXIMPApiEventBase& aEvent, MXIMPPscContext* aContext )
+    {
+    iHost.AddEventL( aEvent, aContext );
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceDataCache::RegisterExpiringItemL
+// ---------------------------------------------------------------------------
+//
+void CPresenceDataCache::RegisterExpiringItemL( CXIMPSubscriptionItemBase* aExpireItem )
+    {
+    TInt index = iExpiringSubscriptionItems.Find( aExpireItem );
+    if( index == KErrNotFound )
+        {
+        iExpiringSubscriptionItems.AppendL( aExpireItem );
+        User::LeaveIfError( aExpireItem->Open() );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceDataCache::UnregisterExpiringItemL
+// ---------------------------------------------------------------------------
+//
+void CPresenceDataCache::UnregisterExpiringItem( CXIMPSubscriptionItemBase* aExpireItem )
+    {
+    TInt index = iExpiringSubscriptionItems.Find( aExpireItem );
+    if( index != KErrNotFound )
+        {
+        iExpiringSubscriptionItems[ index ]->Close();
+        iExpiringSubscriptionItems.Remove( index );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceDataCache::AddPresentityPresenceSubscriberL
+// ---------------------------------------------------------------------------
+//
+void CPresenceDataCache::AddPresentityPresenceSubscriberL( const CXIMPIdentityImp& aIdentity,
+                                                          CXIMPSubscriptionItemBase* aItem,
+                                                          CXIMPIdentityImp* aGroup )
+    {
+    TRACE(_L("CPresenceDataCache::AddPresentityPresenceSubscriberL() - begin" ) );
+    
+    CPresentityPresenceSubscriptionItem& presentityItem =
+                                        PresentityPresenceSubscriptionItemLC( aIdentity );
+                                       
+    presentityItem.SetGroupIdentity( aGroup );
+    
+    TInt error( KErrNone );
+    TRAP( error, presentityItem.AddSubscriberL( aItem ); );
+    TRACE_1( _L("CPresenceDataCache::AddPresentityPresenceSubscriberL() - presentityItem.AddSubscriberL( aItem )  = %d"), error );
+    
+    CleanupStack::PopAndDestroy(); // presentityItem
+    
+    TRACE(_L("CPresenceDataCache::AddPresentityPresenceSubscriberL() - end" ) ); 
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceDataCache::RemovePresentityPresenceSubscriberL
+// ---------------------------------------------------------------------------
+//
+void CPresenceDataCache::RemovePresentityPresenceSubscriber( const CXIMPIdentityImp& aIdentity,
+                                                             CXIMPSubscriptionItemBase* aItem )
+    {
+    // PresentityPresenceSubscriptionItemLC does not leave if item already exists. It just
+    // finds it. If item exists it does not matter if alloc fails or not because there will not
+    // be any subscribers in that case. This one is safe to ignore.
+    TRAP_IGNORE(
+        CPresentityPresenceSubscriptionItem& presentityItem =
+                                            PresentityPresenceSubscriptionItemLC( aIdentity );
+        presentityItem.RemoveSubscriber( aItem );
+        CleanupStack::PopAndDestroy(); // presentityItem
+        )
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceDataCache::AddPresentityPresenceConfiguratorL
+// ---------------------------------------------------------------------------
+//
+void CPresenceDataCache::AddPresenceConfiguratorL( const CXIMPIdentityImp& aIdentity,
+                                                          CXIMPConfigurationItemBase* aItem )
+    {
+    CPresenceConfigurationItem& configItem = PresenceConfigurationItemLC( aIdentity );
+    configItem.AddConfiguratorL( aItem );
+    CleanupStack::PopAndDestroy(); // configItem
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceDataCache::RemovePresentityPresenceConfigurator
+// ---------------------------------------------------------------------------
+//
+void CPresenceDataCache::RemovePresenceConfigurator( const CXIMPIdentityImp& aIdentity,
+                                                             CXIMPConfigurationItemBase* aItem )
+    {
+    // PresentityPresenceSubscriptionItemLC does not leave if item already exists. It just
+    // finds it. If item exists it does not matter if alloc fails or not because there will not
+    // be any subscribers in that case. This one is safe to ignore.
+    TRAP_IGNORE(
+        CPresenceConfigurationItem& configItem = PresenceConfigurationItemLC( aIdentity );
+        configItem.RemoveSubscriber( aItem );
+        CleanupStack::PopAndDestroy(); // configItem
+        )
+    }
+
+
+// ---------------------------------------------------------------------------
+// CPresenceDataCache::ActivatePresentityPresenceSubscriberL
+// ---------------------------------------------------------------------------
+//
+void CPresenceDataCache::ActivatePresentityPresenceSubscriberL( const CXIMPIdentityImp& aIdentity,
+                                                               CXIMPSubscriptionItemBase* aItem )
+    {
+    CPresentityPresenceSubscriptionItem& presentityItem =
+                                        PresentityPresenceSubscriptionItemLC( aIdentity );
+    presentityItem.ActivateSubscriberL( aItem );
+    CleanupStack::PopAndDestroy(); // presentityItem
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceDataCache::SynthesisePresentityPresenceSubscriptionEventToL
+// ---------------------------------------------------------------------------
+//
+void CPresenceDataCache::SynthesisePresentityPresenceSubscriptionEventToL(
+                                            const CXIMPIdentityImp& aIdentity,
+                                            MXIMPPscContext* aContext,
+                                            TBool aForceEvent )
+    {
+    CPresentityPresenceSubscriptionItem& presentityItem =
+                                        PresentityPresenceSubscriptionItemLC( aIdentity );
+    presentityItem.SynthesiseSubscriptionEventToL( aContext, aForceEvent );
+    CleanupStack::PopAndDestroy(); // presentityItem
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceDataCache::ItemLC
+// ---------------------------------------------------------------------------
+//
+template< class Type >
+Type& CPresenceDataCache::ItemLC( Type*& aItem )
+    {
+    if( !aItem )
+        {
+        aItem = Type::NewLC( *this );
+        }
+    else
+        {
+        User::LeaveIfError( aItem->Open() );
+        CleanupClosePushL( *aItem );
+        }
+    return *aItem;
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceDataCache::ArrayItemLC
+// ---------------------------------------------------------------------------
+//
+template< class Type >
+Type& CPresenceDataCache::ArrayItemLC( RPointerArray< Type >& aItemArray, const CXIMPIdentityImp& aIdentity )
+    {
+    // Search for the subscription
+    TInt pos = aItemArray.FindInOrder( aIdentity, Type::IdentityOrder );
+    if( pos == KErrNotFound )
+        {
+        // Create a new subscription item.
+        // Shared ownership of item. Item will inform this instance when it is deleted.
+        Type* newItem = Type::NewLC( *this, aIdentity );
+        
+        TLinearOrder< Type > linearOrder( Type::Order );
+        aItemArray.InsertInOrder( newItem, linearOrder );
+        return *newItem;
+        }
+    else // Found
+        {
+        // Get the existing found item
+        Type* item = aItemArray[ pos ];
+        // Increase reference count for the existing
+        User::LeaveIfError( item->Open() );
+        CleanupClosePushL( *item );
+        return *item;
+        }    
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceDataCache::ArrayItemLC
+// ---------------------------------------------------------------------------
+//
+template< class Type, class ContentType >
+Type& CPresenceDataCache::ArrayItemLC( RPointerArray< Type >& aItemArray, 
+                                      RPointerArray< ContentType>& aContentArray,
+                                      const CXIMPIdentityImp& aIdentity )
+    {
+    // Search for the subscription
+    TInt pos = aItemArray.FindInOrder( aIdentity, Type::IdentityOrder );
+    if( pos == KErrNotFound )
+        {
+        ContentType& contentItem = ArrayItemLC< ContentType >( aContentArray, aIdentity );
+
+        // Create a new subscription item.
+        // Shared ownership of item. Item will inform this instance when it is deleted.
+        Type* newItem = Type::NewLC( *this, contentItem );
+        CleanupStack::Pop(); // newItem
+        CleanupStack::PopAndDestroy(); // contentItem NewItem has taken reference to ownership of contentItem
+        CleanupClosePushL( *newItem ); // back to stack
+        CXIMPIdentityImp* identity = TXIMPObjectCloner< CXIMPIdentityImp >::CloneL( aIdentity );
+        // Set the identity
+        newItem->SetIdentity( identity ); // Ownership is transferred to callee.
+        
+        TLinearOrder< Type > linearOrder( Type::Order );
+        aItemArray.InsertInOrderL( newItem, linearOrder );
+        return *newItem;
+        }
+    else // Found
+        {
+        // Get the existing found item
+        Type* item = aItemArray[ pos ];
+        // Increase reference count for the existing
+        User::LeaveIfError( item->Open() );
+        CleanupClosePushL( *item );
+        return *item;
+        }    
+    }
+
+    
+// ---------------------------------------------------------------------------
+// CPresenceDataCache::OwnPresenceSubscriptionItemLC
+// ---------------------------------------------------------------------------
+//
+EXPORT_C COwnPresenceSubscriptionItem& CPresenceDataCache::OwnPresenceSubscriptionItemLC()
+    {
+    return ItemLC< COwnPresenceSubscriptionItem >( iOwnSubscriptionItem );
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceDataCache::GroupListSubscriptionItemLC
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CGroupListSubscriptionItem& CPresenceDataCache::GroupListSubscriptionItemLC()
+    {
+    return ItemLC< CGroupListSubscriptionItem >( iGroupListSubscriptionItem );
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceDataCache::WatcherListSubscriptionItemLC()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CWatcherListSubscriptionItem& CPresenceDataCache::WatcherListSubscriptionItemLC()
+    {
+    return ItemLC< CWatcherListSubscriptionItem >( iWatcherListSubscriptionItem );
+    }
+
+
+// ---------------------------------------------------------------------------
+// CPresenceDataCache::GrantRequestListSubscriptionItemLC()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CGrantRequestListSubscriptionItem&
+                CPresenceDataCache::GrantRequestListSubscriptionItemLC()
+    {
+    return ItemLC< CGrantRequestListSubscriptionItem >( iGrantRequestListSubscriptionItem );
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceDataCache::BlockListSubscriptionItemLC()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CBlockListSubscriptionItem&
+                CPresenceDataCache::BlockListSubscriptionItemLC()
+    {
+    return ItemLC< CBlockListSubscriptionItem >( iBlockListSubscriptionItem );
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceDataCache::GroupContentSubscriptionItemLC
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CGroupContentSubscriptionItem& CPresenceDataCache::GroupContentSubscriptionItemLC(
+                                                                    const CXIMPIdentityImp& aGroupId )
+    {
+    return ArrayItemLC< CGroupContentSubscriptionItem >( iGroupContentSubscriptionItems, aGroupId );
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceDataCache::GroupContentSubscriptionItemExistsL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TBool CPresenceDataCache::GroupContentSubscriptionItemExists(
+                                            const CXIMPIdentityImp& aGroupId )
+    {
+    // Search for the subscription
+    return iGroupContentSubscriptionItems.FindInOrder( 
+            aGroupId, CGroupContentSubscriptionItem::IdentityOrder ) != KErrNotFound;
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceDataCache::PresentityPresenceSubscriptionItemLC
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CPresentityPresenceSubscriptionItem&
+            CPresenceDataCache::PresentityPresenceSubscriptionItemLC(
+                                            const CXIMPIdentityImp& aIdentity )
+    {
+    return ArrayItemLC<CPresentityPresenceSubscriptionItem>( iPresentityPresenceSubscriptionItems, 
+                                                                    aIdentity );
+    }
+    
+// ---------------------------------------------------------------------------
+// CPresenceDataCache::PresentityGroupMembersPresenceSubscriptionItemLC
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CPresentityGroupMembersPresenceSubscriptionItem&
+            CPresenceDataCache::PresentityGroupMembersPresenceSubscriptionItemLC(
+                                            const CXIMPIdentityImp& aIdentity )
+    {
+    return ArrayItemLC< CPresentityGroupMembersPresenceSubscriptionItem,
+                        CGroupContentSubscriptionItem >( iGroupMembersPresenceSubscriptionItems,
+                                                                iGroupContentSubscriptionItems,
+                                                                aIdentity );
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceDataCache::PresenceConfigurationItemLC
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CPresenceConfigurationItem& CPresenceDataCache::PresenceConfigurationItemLC(
+                                                             const CXIMPIdentityImp& aIdentity )
+    {
+    return ArrayItemLC< CPresenceConfigurationItem >( iPresenceConfigurationItems, aIdentity );
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceDataCache::PresenceToEveryoneConfigurationItemLC
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CPresenceToEveryoneConfigurationItem& 
+                    CPresenceDataCache::PresenceToEveryoneConfigurationItemLC()
+    {
+    return ItemLC< CPresenceToEveryoneConfigurationItem >( iPresenceToEveryoneConfigurationItem );
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceDataCache::PresenceConfigurationItemLC
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CGroupMembersPresenceConfigurationItem&
+     CPresenceDataCache::GroupMembersPresenceConfigurationItemLC( const CXIMPIdentityImp& aGroupId )
+    {
+    return ArrayItemLC< CGroupMembersPresenceConfigurationItem,
+                        CGroupContentSubscriptionItem >( iGroupMembersPresenceConfigurationItems,
+                                                                iGroupContentSubscriptionItems,
+                                                                aGroupId );
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceDataCache::CleanResources
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CPresenceDataCache::CleanResources( MXIMPPscContext& aContext )
+    {
+    TRACE(_L("CPresenceDataCache::CleanResources()" ) ); 
+    if( iOwnSubscriptionItem )
+        {
+        iOwnSubscriptionItem->RemoveSubscriber( &aContext );
+        }
+    if( iGroupListSubscriptionItem )
+        {
+        iGroupListSubscriptionItem->RemoveSubscriber( &aContext );
+        }
+
+    // Groupmember items have to be cleaned before contentitems.
+    TInt count = iGroupMembersPresenceSubscriptionItems.Count();
+    for( TInt a = 0; a < count; ++a )
+        {
+        iGroupMembersPresenceSubscriptionItems[ 0 ]->RemoveSubscriber( &aContext );
+        }
+    count = iGroupMembersPresenceConfigurationItems.Count();
+    for( TInt a = 0; a < count; ++a )
+        {
+        iGroupMembersPresenceConfigurationItems[ 0 ]->RemoveConfigurator( &aContext );
+        }    
+
+    count = iPresentityPresenceSubscriptionItems.Count();
+    for( TInt a = 0; a < count; ++a )
+        {
+        iPresentityPresenceSubscriptionItems[ 0 ]->RemoveSubscriber( &aContext );
+        }
+
+    count = iGroupContentSubscriptionItems.Count();
+    for( TInt a = 0; a < count; ++a )
+        {
+        iGroupContentSubscriptionItems[ 0 ]->RemoveSubscriber( &aContext );
+        }
+        
+    if( iWatcherListSubscriptionItem )
+        {
+        iWatcherListSubscriptionItem->RemoveSubscriber( &aContext );
+        }
+
+    if( iGrantRequestListSubscriptionItem )
+        {
+        iGrantRequestListSubscriptionItem->RemoveSubscriber( &aContext );
+        }
+        
+    count = iGroupMembersPresenceSubscriptionItems.Count();
+    for( TInt a = 0; a < count; ++a )
+        {
+        iGroupMembersPresenceSubscriptionItems[ 0 ]->RemoveSubscriber( &aContext );
+        }
+
+    if( iBlockListSubscriptionItem )
+        {
+        iBlockListSubscriptionItem->RemoveSubscriber( &aContext );
+        }
+
+    count = iExpiringSubscriptionItems.Count();
+    for( TInt a = 0; a < count; ++a )
+        {
+        iExpiringSubscriptionItems[ 0 ]->RemoveSubscriber( &aContext );
+        }
+
+    count = iPresenceConfigurationItems.Count();
+    for( TInt a = 0; a < count; ++a )
+        {
+        iPresenceConfigurationItems[ 0 ]->RemoveConfigurator( &aContext );
+        }
+
+    if( iPresenceToEveryoneConfigurationItem )
+        {
+        iPresenceToEveryoneConfigurationItem->RemoveConfigurator( &aContext );
+        }
+    TRACE(_L("CPresenceDataCache::CleanResources done()" ) );
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceDataCache::CleanExpired
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CPresenceDataCache::CleanExpired()
+    {
+    TRACE(_L("CPresenceDataCache::CleanExpired()" ) );
+    // Clean those which were expired.
+    TInt count = iExpiringSubscriptionItems.Count();
+    for( TInt a = count - 1; a >= 0; --a )
+        {
+        if( iExpiringSubscriptionItems[ a ]->CleanIfExpired() )
+            {
+            iExpiringSubscriptionItems[ a ]->Close();
+            iExpiringSubscriptionItems.Remove( a );
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceDataCache::PackGroupIdLC
+// ---------------------------------------------------------------------------
+//
+HBufC8* CPresenceDataCache::PackGroupIdLC( const MXIMPIdentity& aGroupId )
+    {
+    const CXIMPIdentityImp* groupId =
+        TXIMPGetImpClassOrPanic< const CXIMPIdentityImp >::From( aGroupId );
+    
+    HBufC8* packedGroupId = TXIMPObjectPacker< const CXIMPIdentityImp >::PackL( *groupId );
+    CleanupStack::PushL( packedGroupId );
+    return packedGroupId;
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceDataCache::DataSubscriptionState
+// ---------------------------------------------------------------------------
+//
+template< class Type >
+const MXIMPDataSubscriptionState& CPresenceDataCache::DataSubscriptionState( Type* aItem ) const
+    {
+    if( aItem )
+        {
+        return aItem->DataSubscriptionState();
+        }
+    return *iEmptySubscriptionState;
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceDataCache::DataSubscriptionState
+// ---------------------------------------------------------------------------
+//
+template< class Type >
+const MXIMPDataSubscriptionState& CPresenceDataCache::DataSubscriptionState( 
+                const RPointerArray< Type >& aItemArray, const MXIMPIdentity& aIdentity ) const
+    {    
+    const CXIMPIdentityImp* identity =
+        TXIMPGetImpClassOrPanic< const CXIMPIdentityImp >::From( aIdentity );
+    TInt index = aItemArray.FindInOrder( *identity, Type::IdentityOrder );
+    if( index >=0 )
+        {
+        return aItemArray[ index ]->DataSubscriptionState();
+        }
+    return *iEmptySubscriptionState;    
+    }
+
+
+// ---------------------------------------------------------------------------
+// CPresenceDataCache::OwnPresenceDataSubscriptionState
+// ---------------------------------------------------------------------------
+//
+EXPORT_C const MXIMPDataSubscriptionState& CPresenceDataCache::OwnPresenceDataSubscriptionState() const
+    {
+    return DataSubscriptionState< COwnPresenceSubscriptionItem >( iOwnSubscriptionItem );
+    }
+    
+// ---------------------------------------------------------------------------
+// CPresenceDataCache::PresentityGroupDataSubscriptionState
+// ---------------------------------------------------------------------------
+//
+EXPORT_C const MXIMPDataSubscriptionState& CPresenceDataCache::PresentityGroupListDataSubscriptionState() const
+    {
+    return DataSubscriptionState< CGroupListSubscriptionItem >( iGroupListSubscriptionItem );
+    }
+    
+// ---------------------------------------------------------------------------
+// CPresenceDataCache::PresentityGroupMemberDataSubscriptionState
+// ---------------------------------------------------------------------------
+//
+EXPORT_C const MXIMPDataSubscriptionState& CPresenceDataCache::PresentityGroupContentDataSubscriptionState( 
+            const MXIMPIdentity& aGroupId ) const
+    {
+    return DataSubscriptionState< CGroupContentSubscriptionItem >( iGroupContentSubscriptionItems, 
+                                                                          aGroupId );
+    }
+    
+// ---------------------------------------------------------------------------
+// CPresenceDataCache::PresentityPresenceDataSubscriptionState
+// ---------------------------------------------------------------------------
+//
+EXPORT_C const MXIMPDataSubscriptionState& CPresenceDataCache::PresentityPresenceDataSubscriptionState( 
+            const MXIMPIdentity& aPresentityId ) const
+    {
+    return DataSubscriptionState< CPresentityPresenceSubscriptionItem >( iPresentityPresenceSubscriptionItems, 
+                                                                                aPresentityId );
+    }
+    
+// ---------------------------------------------------------------------------
+// CPresenceDataCache::PresenceWatcherListDataSubscriptionState
+// ---------------------------------------------------------------------------
+//
+EXPORT_C const MXIMPDataSubscriptionState& CPresenceDataCache::PresenceWatcherListDataSubscriptionState() const
+    {    
+    return DataSubscriptionState< CWatcherListSubscriptionItem >( iWatcherListSubscriptionItem );
+    }
+    
+// ---------------------------------------------------------------------------
+// CPresenceDataCache::PresenceBlockDataSubscriptionState
+// ---------------------------------------------------------------------------
+//
+EXPORT_C const MXIMPDataSubscriptionState& CPresenceDataCache::PresenceBlockDataSubscriptionState() const
+    {
+    return DataSubscriptionState< CBlockListSubscriptionItem >( iBlockListSubscriptionItem );
+    }
+    
+// ---------------------------------------------------------------------------
+// CPresenceDataCache::PresenceGrantRequestDataSubscriptionState
+// ---------------------------------------------------------------------------
+//
+EXPORT_C const MXIMPDataSubscriptionState& CPresenceDataCache::PresenceGrantRequestDataSubscriptionState() const
+    {    
+    return DataSubscriptionState< CGrantRequestListSubscriptionItem >( iGrantRequestListSubscriptionItem );
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceDataCache::ProtocolID
+// ---------------------------------------------------------------------------
+//
+TInt32 CPresenceDataCache::ProtocolUID()
+	{
+	return iHost.ProtocolUID();
+	}
+
+// ---------------------------------------------------------------------------
+// CPresenceDataCache::ProtocolID
+// ---------------------------------------------------------------------------
+//
+MPresenceCacheWriter* CPresenceDataCache::ExternalCache()
+	{
+	return iExtPresenceCache;
+	}
+
+TAny* CPresenceDataCache::GetInterface(TInt aInterfaceId)  
+	{
+		if(aInterfaceId != PRESENCE_ITEM_PARENT)
+			{
+			User::Panic( _L("CXIMPPresenceCache"), KErrExtensionNotSupported );
+			}
+
+		return static_cast<MXIMPItemParent*>(this) ;	
+
+	}
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresencedatamodel/presencedatacacheimp.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,279 @@
+/*
+* 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 Service Connection data cache implementation.
+*
+*/
+
+#ifndef CPRESENCEDATACACHEIMP_H
+#define CPRESENCEDATACACHEIMP_H
+
+#include "ximpapiobjbase.h"
+#include "presenceapiobjbase.h"
+#include "ximpitemparent.h"
+#include "presencetypehelpers.h"
+#include "ximpoperationdefs.h"
+#include "ximpapieventbase.h"
+
+class MXIMPHost;
+class COwnPresenceSubscriptionItem;
+class CPresentityPresenceSubscriptionItem;
+class CGroupContentSubscriptionItem;
+class CWatcherListSubscriptionItem;
+class MPresentityGroupInfo;
+class CXIMPIdentityImp;
+class MXIMPPscContext;
+class CXIMPSubscriptionItemBase;
+class MPresenceWatcherInfo;
+class MXIMPStatus;
+class MPresenceBlockInfo;
+class CBlockListSubscriptionItem;
+class MXIMPIdentity;
+class MPresenceInfo;
+class MXIMPDataSubscriptionState;
+class CXIMPDataSubscriptionStateImp;
+class MPresenceCacheWriter;
+
+//class CXIMPApiEventBase;
+/**
+ * PSC Presence Data Cache implementation.
+ *
+ * @since S60 v3.2
+ */
+class CPresenceDataCache : public CBase,
+                           public MXIMPItemParent
+    {
+public: // Definitions
+
+    /** The class ID. */
+    enum { KClassId = PRIMP_CLSID_CPRESENCEDATACACHE };
+
+public: // Construction and destruction
+
+    /**
+     * Construction
+     */
+    IMPORT_C static CPresenceDataCache* NewL( MXIMPHost& aHost );
+
+    /**
+     * Destruction
+     */
+    virtual ~CPresenceDataCache();
+
+private:
+
+    CPresenceDataCache( MXIMPHost& aHost );
+    void ConstructL();
+    
+private: //MXIMPItemParentBase
+	TAny* GetInterface(TInt aInterfaceId) ;
+    // Expiring items
+    void RegisterExpiringItemL( CXIMPSubscriptionItemBase* aExpireItem );
+    void UnregisterExpiringItem( CXIMPSubscriptionItemBase* aExpireItem );
+	
+    
+private: // From MXIMPItemParent
+
+    /**
+     * @see MXIMPItemParent
+     */
+    // Subscription items
+    
+    void RemoveMe( COwnPresenceSubscriptionItem* aChild );
+    void RemoveMe( CGroupListSubscriptionItem* aChild );
+    void RemoveMe( CGroupContentSubscriptionItem* aChild );
+    void RemoveMe( CPresentityPresenceSubscriptionItem* aChild );
+    void RemoveMe( CWatcherListSubscriptionItem* aChild );
+    void RemoveMe( CPresentityGroupMembersPresenceSubscriptionItem* aChild );
+    void RemoveMe( CGrantRequestListSubscriptionItem* aChild );
+    void RemoveMe( CBlockListSubscriptionItem* aChild );
+
+    void AddPresentityPresenceSubscriberL( const CXIMPIdentityImp& aIdentity, CXIMPSubscriptionItemBase* aItem, CXIMPIdentityImp* aGroup = NULL );
+    void RemovePresentityPresenceSubscriber( const CXIMPIdentityImp& aIdentity, CXIMPSubscriptionItemBase* aItem );
+    void ActivatePresentityPresenceSubscriberL( const CXIMPIdentityImp& aIdentity, CXIMPSubscriptionItemBase* aItem );
+    void SynthesisePresentityPresenceSubscriptionEventToL( const CXIMPIdentityImp& aIdentity, MXIMPPscContext* aContext, TBool aForceEvent );
+
+    // Configuration items
+    void RemoveMe( CPresenceConfigurationItem* aChild );
+    void RemoveMe( CPresenceToEveryoneConfigurationItem* aChild );
+    void RemoveMe( CGroupMembersPresenceConfigurationItem* aChild );
+
+    void AddPresenceConfiguratorL( const CXIMPIdentityImp& aIdentity, CXIMPConfigurationItemBase* aItem );
+    void RemovePresenceConfigurator( const CXIMPIdentityImp& aIdentity, CXIMPConfigurationItemBase* aItem );
+
+
+    // Other methods
+    void AddEventL( CXIMPApiEventBase& aEvent, MXIMPPscContext* aContext );
+    
+    TInt32 ProtocolUID( );
+    
+    MPresenceCacheWriter* ExternalCache();
+
+public: // New methods
+
+    /**
+     * - If OwnPresenceSubscriptionItem is not found, data cache
+     *   initializes new one and returns ownership to caller
+     * - If OwnPresenceSubscriptionItem is found, data cache increases
+     *   refcount by one, and returns the old object
+     */
+    IMPORT_C COwnPresenceSubscriptionItem& OwnPresenceSubscriptionItemLC();
+    IMPORT_C CGroupListSubscriptionItem& GroupListSubscriptionItemLC();
+    IMPORT_C CWatcherListSubscriptionItem& WatcherListSubscriptionItemLC();
+    IMPORT_C CGrantRequestListSubscriptionItem& GrantRequestListSubscriptionItemLC();
+    IMPORT_C CBlockListSubscriptionItem& BlockListSubscriptionItemLC();
+    IMPORT_C CGroupContentSubscriptionItem& GroupContentSubscriptionItemLC(
+                                                    const CXIMPIdentityImp& aGroupId );
+    IMPORT_C CPresentityPresenceSubscriptionItem& PresentityPresenceSubscriptionItemLC(
+                                                    const CXIMPIdentityImp& aIdentity );
+    IMPORT_C CPresentityGroupMembersPresenceSubscriptionItem&
+                PresentityGroupMembersPresenceSubscriptionItemLC( const CXIMPIdentityImp& aIdentity );
+
+    IMPORT_C CPresenceConfigurationItem& PresenceConfigurationItemLC( const CXIMPIdentityImp& aIdentity );
+    IMPORT_C CPresenceToEveryoneConfigurationItem& PresenceToEveryoneConfigurationItemLC();
+    IMPORT_C CGroupMembersPresenceConfigurationItem& GroupMembersPresenceConfigurationItemLC(
+                                                                    const CXIMPIdentityImp& aGroupId );
+
+
+    /**
+     * Checks if group content subscription item with given group id is found.
+     */
+    IMPORT_C TBool GroupContentSubscriptionItemExists( const CXIMPIdentityImp& aGroupId );
+
+    /**
+     * Clean resources concerning context.
+     */
+    IMPORT_C void CleanResources( MXIMPPscContext& aContext );
+
+    /**
+     *
+     */
+    IMPORT_C void CleanExpired();
+
+    /**
+     * Helper method to pack group id.
+     * @param aGroupId The group id to be packed.
+     * @return HBufC8 containing the packed group id.
+     */
+    HBufC8* PackGroupIdLC( const MXIMPIdentity& aGroupId );
+    
+    IMPORT_C const MXIMPDataSubscriptionState& OwnPresenceDataSubscriptionState() const;
+    IMPORT_C const MXIMPDataSubscriptionState& PresentityGroupListDataSubscriptionState() const;
+    IMPORT_C const MXIMPDataSubscriptionState& PresentityGroupContentDataSubscriptionState( 
+                const MXIMPIdentity& aGroupId ) const;
+    IMPORT_C const MXIMPDataSubscriptionState& PresentityPresenceDataSubscriptionState( 
+                const MXIMPIdentity& aPresentityId ) const;
+    IMPORT_C const MXIMPDataSubscriptionState& PresenceWatcherListDataSubscriptionState() const;
+    IMPORT_C const MXIMPDataSubscriptionState& PresenceBlockDataSubscriptionState() const;
+    IMPORT_C const MXIMPDataSubscriptionState& PresenceGrantRequestDataSubscriptionState() const;
+
+private: // Helper methods
+
+    /**
+     * Template method for removeMe when one subscription item is target.
+     * @param aItem Reference to subscription item pointer to remove.
+     * @param Pointer of item to remove.
+     */
+    template< class Type >
+    IMPORT_C static void RemoveMe( Type*& aItem, Type* aChild );
+
+    /**
+     * Template method for removeme if target subscription item is in array.
+     * @param aItemArray Array of subscription items where aChild should exists.
+     * @param Pointer of item to remove.
+     */
+    template< class Type >
+    void RemoveMeFromArray( RPointerArray< Type >& aItemArray, Type* aChild );
+
+    /**
+     * Templated item instance creation. If item is not found it is created.
+     * @param aItem Reference to pointer where new item should be saved.
+     * @return Reference to item created.
+     */
+    template< class Type > 
+    Type& ItemLC( Type*& aItem );
+
+    /**
+     * Templated item instance creation. If item is not found it is created.
+     * @param aItemArray Array of items where new item should be created.
+     * @param aIdentity. Key for finding item or for creating the new one.
+     * @return Reference to item created.
+     */
+    template< class Type >
+    Type& ArrayItemLC( RPointerArray< Type >& aItemArray, const CXIMPIdentityImp& aIdentity );
+    
+    /**
+     * Templated item instance creation. If item is not found it is created.
+     * @param aItemArray Array of items where new item should be created.
+     * @param aContentArray. Content array for passing to new created item.
+     * @param aIdentity. Key for finding item or for creating the new one.
+     * @return Reference to item created.
+     */
+    template< class Type, class ContentType >
+    Type& ArrayItemLC( RPointerArray< Type >& aItemArray, 
+                       RPointerArray< ContentType >& aContentArray,
+                       const CXIMPIdentityImp& aIdentity );
+
+    /**
+     * Get data subscription state for item.
+     * @param aItem Item which data subscription state should be found.
+     * @return Data subscription state.
+     */    
+    template< class Type >
+    const MXIMPDataSubscriptionState& DataSubscriptionState( Type* aItem ) const;
+    
+    /**
+     * Get data subscription state for item.
+     * @param aItemArray Item array where item should be found.
+     * @aIdentity Key for finding right item.
+     * @return Data subscription state.
+     */    
+    template< class Type >
+    const MXIMPDataSubscriptionState& DataSubscriptionState( const RPointerArray< Type >& aItemArray,
+                                                             const MXIMPIdentity& aIdentity ) const;
+    
+private: // Data
+
+    /**
+     * Access to host.
+     */
+    MXIMPHost& iHost;
+
+    /**
+     * Does not own. Removed when RemoveMe called.
+     */
+    COwnPresenceSubscriptionItem* iOwnSubscriptionItem;
+    CGroupListSubscriptionItem* iGroupListSubscriptionItem;
+    RPointerArray< CGroupContentSubscriptionItem > iGroupContentSubscriptionItems;
+    RPointerArray< CPresentityPresenceSubscriptionItem > iPresentityPresenceSubscriptionItems;
+    CWatcherListSubscriptionItem* iWatcherListSubscriptionItem;
+    CGrantRequestListSubscriptionItem* iGrantRequestListSubscriptionItem;
+    RPointerArray< CPresentityGroupMembersPresenceSubscriptionItem > iGroupMembersPresenceSubscriptionItems;
+    CBlockListSubscriptionItem* iBlockListSubscriptionItem;
+    
+    RPointerArray< CXIMPSubscriptionItemBase > iExpiringSubscriptionItems;
+
+    RPointerArray< CPresenceConfigurationItem > iPresenceConfigurationItems;
+    CPresenceToEveryoneConfigurationItem* iPresenceToEveryoneConfigurationItem;
+    RPointerArray< CGroupMembersPresenceConfigurationItem > iGroupMembersPresenceConfigurationItems;
+    
+    /**
+     * Empty subscription state to pass adaptation exists request is subscription item does not exists.
+     */
+    CXIMPDataSubscriptionStateImp* iEmptySubscriptionState;
+    
+    MPresenceCacheWriter *iExtPresenceCache;
+/* ======================================================================== */
+
+    };
+#endif // CPRESENCEDATACACHEIMP_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresencedatamodel/presencedatamodelhook/presencedatamodelhook.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,46 @@
+/*
+* 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:  XIMP Framework's Presence  Data Model Hook implementation.
+*
+*/
+
+
+#include "presencedlluids.hrh"
+#include "presenceapidataobjfactoryaccessor.h"
+#include <ecom/implementationproxy.h>
+#include <e32base.h>
+
+
+// ---------------------------------------------------------------------------
+// Key value pair table to identify correct constructor
+// function for the requested interface.
+// ---------------------------------------------------------------------------
+//
+const TImplementationProxy ImplementationTable[] =
+    {
+    IMPLEMENTATION_PROXY_ENTRY( XIMP_ECOM_IMPL_UID_PRESENCE_DATAMODEL_INTERFACE,
+                                CPresenceApiDataObjFactoryAccessor::NewL )
+    };
+
+
+// ---------------------------------------------------------------------------
+// Exported function to return the implementation proxy table
+// ---------------------------------------------------------------------------
+//
+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/ximpfw/presence/srcpresencedatamodel/presencedatamodelhook/presencedatamodelhook.rss	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  ECom registery info for ECom hook
+*
+*/
+
+
+#include <ecom/registryinfov2.rh>
+#include "../../group/presencedlluids.hrh"
+#include <presencemanagementifids.hrh>
+
+// ---------------------------------------------------------------------------
+// ECom registery info for XIMP Presence Manager ECom hook
+// ---------------------------------------------------------------------------
+//
+RESOURCE REGISTRY_INFO theInfo
+    {
+    resource_format_version = RESOURCE_FORMAT_VERSION_2;
+    dll_uid = XIMP_DLL_UID_PRESENCE_DATAMODEL_HOOK;
+
+    interfaces =
+        {
+        INTERFACE_INFO
+            {
+            interface_uid = XIMP_ECOM_IF_UID_PRESENCE_EVENT_CODEC_INTERFACE;
+            implementations =
+                {
+                IMPLEMENTATION_INFO
+                    {
+                    implementation_uid = XIMP_ECOM_IMPL_UID_PRESENCE_DATAMODEL_INTERFACE;
+                    version_no         = 1;
+                    display_name       = "S60 Default XIMP";
+                    default_data       = XIMP_ECOM_DEFAULT_DATA_PRESENCE_EVENT_CODEC;
+                    opaque_data        = "";
+                    }
+                };
+            }
+        };
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresencedatamodel/presenceeventcodec.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,285 @@
+/*
+* 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:  Base class for API implementations.
+*
+*/
+
+#include "presenceeventcodec.h"
+//#include "ximprequestcompleteeventimp.h"
+//#include "ximpcontextstateeventimp.h"
+#include "presentitygrouplisteventimp.h"
+#include "ownpresenceeventimp.h"
+#include "presentitypresenceeventimp.h"
+#include "presentitygroupcontenteventimp.h"
+#include "presencewatcherlisteventimp.h"
+#include "presencegrantrequestlisteventimp.h"
+#include "presenceblocklisteventimp.h"
+
+#include "ximpapieventbase.h"
+#include <s32strm.h>
+#include <s32mem.h>
+
+//DATA TYPES
+
+
+/**
+ * Type definition for exact API event constructor signature.
+ */
+typedef CXIMPApiEventBase* (*TApiEventConstructor)( RReadStream& );
+
+
+
+/**
+ * Structure for mapping event interface IDs to
+ * to corect API event constructors.
+ */
+struct SApiEventConstructorMap
+    {
+    //Interface id
+    TInt32    iInterfaceId;
+
+    //Function pointer to event interface implementation
+    TApiEventConstructor iConstructorPtr;
+    } ;
+
+
+
+/**
+ * Helper macro to initialise KApiEventConstructorTable members.
+ *
+ * Macro forces that each event implementation class to have static
+ * NewFromStreamLC() memeber function to instantiate the object.
+ *
+ * See TApiEventConstructor type definition for exact constructor
+ * signature.
+ */
+#define CONSTRUCTOR_ENTRY( TheImplementedIf, TheClass ) \
+    { TheImplementedIf::KInterfaceId, TheClass::NewFromStreamLC } \
+
+
+
+/**
+ * Constructor function mapping for event interface implementations.
+ *
+ * When new event types are implemented, add them here.
+ */
+const SApiEventConstructorMap KApiEventConstructorTable[] =
+    {
+//    CONSTRUCTOR_ENTRY( MXIMPRequestCompleteEvent, CXIMPRequestCompleteEventImp ),
+//    CONSTRUCTOR_ENTRY( MXIMPContextStateEvent, CXIMPContextStateEventImp ),
+    CONSTRUCTOR_ENTRY( MPresentityGroupListEvent, CPresentityGroupListEventImp ),
+    CONSTRUCTOR_ENTRY( MOwnPresenceEvent, COwnPresenceEventImp ),
+    CONSTRUCTOR_ENTRY( MPresentityPresenceEvent, CPresentityPresenceEventImp ),
+    CONSTRUCTOR_ENTRY( MPresentityGroupContentEvent, CPresentityGroupContentEventImp ),
+    CONSTRUCTOR_ENTRY( MPresenceWatcherListEvent, CPresenceWatcherListEventImp ),
+    CONSTRUCTOR_ENTRY( MPresenceGrantRequestListEvent, CPresenceGrantRequestListEventImp ),
+    CONSTRUCTOR_ENTRY( MPresenceBlockListEvent, CPresenceBlockListEventImp )
+    };
+
+
+/**
+ * Count of constructor mappings.
+ */
+const TInt KApiEventConstructorCount = sizeof( KApiEventConstructorTable )
+                                        / sizeof( SApiEventConstructorMap );
+
+
+
+// ============================ HELPER FUNCTIONS =============================
+
+
+/**
+ * Helper function to locate constructor function for
+ * event interface ID.
+ *
+ * @param aEventInterfaceId The event interface ID.
+ * @return Event object constructor function.
+ */
+TApiEventConstructor ConstructorForInterface( TInt32 aEventInterfaceId )
+    {
+    //Locate correct constructor
+    for( TInt ix = 0; ix < KApiEventConstructorCount; ix++ )
+        {
+        const SApiEventConstructorMap map = KApiEventConstructorTable[ ix ];
+        if( map.iInterfaceId == aEventInterfaceId )
+            {
+            return map.iConstructorPtr;
+            }
+        }
+
+
+    //If assertion below fails, check that event implementation
+    //class implementing requested event interface (aEventInterfaceId)
+    //is registered to KApiEventConstructorTable
+//    __ASSERT_DEBUG( EFalse,
+//                    User::Panic( _L("PresenceEventCodec"), KErrUnknown ) );
+
+    return NULL;
+    }
+
+
+/**
+ * Helper function to instantiate new event object
+ * of requested type and construct it from the stream.
+ *
+ * @param aEventInterfaceId
+ * @return Event object constructor function.
+ */
+CXIMPApiEventBase* NewEventObjectFromStreamLC( TInt32 aEventInterfaceId,
+                                               RReadStream& aStream )
+    {
+    TApiEventConstructor newFromStreamLC = NULL;
+
+    //Locate correct constructor for interface ID
+    newFromStreamLC = ConstructorForInterface( aEventInterfaceId );
+	if( ! newFromStreamLC )
+	    {
+	    return 	NULL;
+	    }
+    //Instantiate the object
+    CXIMPApiEventBase* eventObject = newFromStreamLC( aStream );
+
+
+    return eventObject;
+    }
+
+
+
+// ============================ MEMBER FUNCTIONS =============================
+
+
+// ---------------------------------------------------------------------------
+// CPresenceEventCodec::NewL()
+// ---------------------------------------------------------------------------
+//
+CPresenceEventCodec* CPresenceEventCodec::NewL()
+    {
+    CPresenceEventCodec* self = new( ELeave ) CPresenceEventCodec() ;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+    return self;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CPresenceEventCodec::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void CPresenceEventCodec::ConstructL()
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// CPresenceEventCodec::CPresenceEventCodec()
+// ---------------------------------------------------------------------------
+//
+CPresenceEventCodec::CPresenceEventCodec()
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceEventCodec::~CPresenceEventCodec()
+// ---------------------------------------------------------------------------
+//
+CPresenceEventCodec::~CPresenceEventCodec()
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceEventCodec::PackL()
+// ---------------------------------------------------------------------------
+//
+HBufC8* CPresenceEventCodec::PackL( CXIMPApiEventBase& aEventObj,
+                                        TInt32& aTypeOfEvent )
+    {
+    CBufFlat* buffer = CBufFlat::NewL( 10 ); // initial granularity to 10
+    CleanupStack::PushL( buffer );
+
+    RBufWriteStream ws;
+    CleanupClosePushL( ws );
+    ws.Open( *buffer ); // CSI: 65 #
+
+    //Ask real event type through the event base interface
+    TInt32 eventIfId = aEventObj.Base().GetInterfaceId();
+
+    //And write both event type and data
+    ws.WriteInt32L( eventIfId );
+    aEventObj.ExternalizeL( ws );
+    ws.CommitL();
+    CleanupStack::PopAndDestroy();  //ws
+
+    HBufC8* heapBuf = buffer->Ptr( 0 ).AllocL();
+
+    CleanupStack::PopAndDestroy( buffer );
+
+
+    aTypeOfEvent = eventIfId;
+    return heapBuf;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CPresenceEventCodec::PackL()
+// ---------------------------------------------------------------------------
+//
+void CPresenceEventCodec::PackL( CXIMPApiEventBase& aEventObj,
+                                     TInt32& aTypeOfEvent,
+                                     CBufFlat* aBuffer )
+    {
+    RBufWriteStream ws;
+    CleanupClosePushL( ws );
+    ws.Open( *aBuffer ); // CSI: 65 #
+
+    //Ask real event type through the event base interface
+    TInt32 eventIfId = aEventObj.Base().GetInterfaceId();
+
+    //And write both event type and data
+    ws.WriteInt32L( eventIfId );
+    aEventObj.ExternalizeL( ws );
+    ws.CommitL();
+    CleanupStack::PopAndDestroy();  //ws
+    
+    aTypeOfEvent = eventIfId;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CPresenceEventCodec::UnPackL()
+// ---------------------------------------------------------------------------
+//
+CXIMPApiEventBase* CPresenceEventCodec::UnPackL( const TDesC8& aEventData,
+                                                     TInt32& aTypeOfEvent )
+    {
+    RDesReadStream rs;
+    rs.Open( aEventData ); // CSI: 65 #
+    CleanupClosePushL( rs );
+
+    TInt32 eventIfId = rs.ReadInt32L();
+    CXIMPApiEventBase* eventObject = NewEventObjectFromStreamLC( eventIfId, rs );
+    if(eventObject)
+    	{
+    	CleanupStack::Pop(); //eventObject
+    	}
+    CleanupStack::PopAndDestroy(); // rs
+
+
+    aTypeOfEvent = eventIfId;
+    return eventObject;
+    }
+
+
+// End of file
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresencedatamodel/presenceeventcodec.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,81 @@
+/*
+* 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:  Codec to pack and unpack event objects.
+*
+*/
+
+#ifndef PRESENCEEVENTCODEC_H
+#define PRESENCEEVENTCODEC_H
+
+#include <e32base.h>
+
+#include "eventcodec.h"
+//#include "ximpapieventbase.h"
+class CXIMPApiEventBase;
+class RReadStream;
+
+
+/**
+ * Codec to pack and unpack event objects.
+ *
+ * @lib ximpdatamodel.dll
+ * @since S60 v3.2
+ */
+NONSHARABLE_CLASS( CPresenceEventCodec ): public MEventCodec
+    {
+public:
+
+    static CPresenceEventCodec* NewL();
+    
+    ~CPresenceEventCodec();
+    
+    
+    /**
+     *
+     *
+     *
+     * @param
+     *
+     * @return
+     *
+     */
+    HBufC8* PackL( CXIMPApiEventBase& aEventObj,
+                                   TInt32& aTypeOfEvent );
+    void PackL( CXIMPApiEventBase& aEventObj,
+                         TInt32& aTypeOfEvent,
+                         CBufFlat* aBuffer );
+
+    /**
+     *
+     *
+     *
+     * @param
+     *
+     * @return
+     *
+     */
+    CXIMPApiEventBase* UnPackL( const TDesC8& aEventData,
+                                                TInt32& aTypeOfEvent );
+protected:
+    void ConstructL();
+
+private:
+
+    CPresenceEventCodec();
+
+
+    };
+
+
+#endif // PRESENCEEVENTCODEC_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresencedatamodel/presencefilterstore.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,232 @@
+/*
+* 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:  XIMP Framework store for filters
+*
+*/
+
+
+#include "presencefilterstore.h"
+#include "ximpidentityimp.h"
+#include "presenceinfofilterimp.h"
+#include "ximpobjecthelpers.h"
+
+// ======== LOCAL FUNCTIONS ========
+
+// ============================ HELPER CLASS =============================
+
+// ---------------------------------------------------------------------------
+// CPresenceFilterStoreMapping::NewL
+// ---------------------------------------------------------------------------
+//
+CPresenceFilterStore::CPresenceFilterStoreMapping* 
+CPresenceFilterStore::CPresenceFilterStoreMapping::NewL()
+    {
+    CPresenceFilterStoreMapping* self = new ( ELeave ) 
+        CPresenceFilterStoreMapping();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self ); 
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceFilterStoreMapping::ConstructL
+// ---------------------------------------------------------------------------
+//
+void CPresenceFilterStore::CPresenceFilterStoreMapping::ConstructL()
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceFilterStoreMapping::CPresenceFilterStoreMapping
+// ---------------------------------------------------------------------------
+//
+CPresenceFilterStore::CPresenceFilterStoreMapping::CPresenceFilterStoreMapping() 
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceFilterStoreMapping::~CPresenceFilterStoreMapping
+// ---------------------------------------------------------------------------
+//
+CPresenceFilterStore::CPresenceFilterStoreMapping::~CPresenceFilterStoreMapping()
+    {
+    delete iIdentity;
+    delete iFilter;
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceFilterStoreMapping::Identity
+// ---------------------------------------------------------------------------
+//
+CXIMPIdentityImp& CPresenceFilterStore::CPresenceFilterStoreMapping::Identity()
+    {
+    return *iIdentity;
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceFilterStoreMapping::Filter
+// ---------------------------------------------------------------------------
+//
+CPresenceInfoFilterImp& CPresenceFilterStore::CPresenceFilterStoreMapping::Filter()
+    {
+    return *iFilter;
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceFilterStoreMapping::SetPresenceInfoFilter
+// ---------------------------------------------------------------------------
+//
+void CPresenceFilterStore::CPresenceFilterStoreMapping::SetPresenceInfoFilter( CPresenceInfoFilterImp* aFilter )
+    {
+    iFilter = aFilter;
+    }
+    
+// ---------------------------------------------------------------------------
+// CPresenceFilterStoreMapping::SetIdentity
+// ---------------------------------------------------------------------------
+//
+void CPresenceFilterStore::CPresenceFilterStoreMapping::SetIdentity( CXIMPIdentityImp* aIdentity )
+    {
+    iIdentity = aIdentity;
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceFilterStoreMapping::OrderOfMappings()
+// ---------------------------------------------------------------------------
+//
+TInt CPresenceFilterStore::CPresenceFilterStoreMapping::OrderOfMappings( 
+        const CPresenceFilterStoreMapping& aFirst, 
+        const CPresenceFilterStoreMapping& aSecond )
+    {
+    return OrderOfMappingsByIdentity( aFirst.iIdentity, aSecond );
+    }
+
+
+// ---------------------------------------------------------------------------
+// CPresenceFilterStoreMapping::OrderOfMappings()
+// ---------------------------------------------------------------------------
+//
+TInt CPresenceFilterStore::CPresenceFilterStoreMapping::OrderOfMappingsByIdentity( 
+        const CXIMPIdentityImp* aKey, 
+        const CPresenceFilterStoreMapping& aSecond )
+    {
+    return aKey->Compare( *aSecond.iIdentity );
+    }
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// CPresenceFilterStore::CPresenceFilterStore()
+// ---------------------------------------------------------------------------
+//
+CPresenceFilterStore::CPresenceFilterStore()
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// CPresenceFilterStore::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void CPresenceFilterStore::ConstructL()
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// CPresenceFilterStore::NewL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CPresenceFilterStore* CPresenceFilterStore::NewL()
+    {
+    CPresenceFilterStore* self = new( ELeave ) CPresenceFilterStore;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CPresenceFilterStore::~CPresenceFilterStore()
+// ---------------------------------------------------------------------------
+//
+CPresenceFilterStore::~CPresenceFilterStore()
+    {
+    iMappings.ResetAndDestroy();
+    }
+
+
+// ---------------------------------------------------------------------------
+// CPresenceFilterStore::AssociateL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CPresenceFilterStore::AssociateL( 
+            const CXIMPIdentityImp& aIdentity, 
+            CPresenceInfoFilterImp* aFilter )
+    {
+    TLinearOrder< CPresenceFilterStore::CPresenceFilterStoreMapping > order( CPresenceFilterStore::CPresenceFilterStoreMapping::OrderOfMappings );
+
+    if ( FilterForIdentity( aIdentity ) )
+        {
+        User::Leave( KErrAlreadyExists );
+        }
+
+    CXIMPIdentityImp* identity = TXIMPObjectCloner< CXIMPIdentityImp >::CloneL( aIdentity );
+    CleanupStack::PushL( identity );
+    CPresenceFilterStoreMapping* mapping = CPresenceFilterStoreMapping::NewL();
+    mapping->SetIdentity( identity );
+    CleanupStack::Pop( identity );
+    CleanupStack::PushL( mapping );
+    iMappings.InsertInOrderL( mapping, order );
+    CleanupStack::Pop( mapping );
+    mapping->SetPresenceInfoFilter( aFilter );
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceFilterStore::DisassociateL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CPresenceFilterStore::Disassociate( const CXIMPIdentityImp& aIdentity )
+    {
+    TInt index = iMappings.FindInOrder( aIdentity, CPresenceFilterStoreMapping::OrderOfMappingsByIdentity );
+    if( index >= 0 )
+        {
+        CPresenceFilterStoreMapping* removed = iMappings[ index ];
+        iMappings.Remove( index );
+        delete removed;
+        removed = NULL;
+        }
+    }
+    
+// ---------------------------------------------------------------------------
+// CPresenceFilterStore::FilterForIdentityL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CPresenceInfoFilterImp* CPresenceFilterStore::FilterForIdentity( 
+        const CXIMPIdentityImp& aIdentity )
+    {
+    TInt index = iMappings.FindInOrder( aIdentity, CPresenceFilterStoreMapping::OrderOfMappingsByIdentity );
+
+    if( index < 0 )
+        {
+        return NULL;
+        }
+
+    CPresenceFilterStoreMapping* entry = iMappings[ index ];
+    return (entry->iFilter);
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresencedatamodel/presencefilterstore.h	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  XIMP Framework store for filters
+*
+*/
+
+
+#ifndef C_PRESENCEFILTERSTORE_H
+#define C_PRESENCEFILTERSTORE_H
+
+#include "ximpbase.h"
+#include <e32base.h>
+
+class CXIMPIdentityImp;
+class CPresenceInfoFilterImp;
+
+/**
+ * Filter store.
+ * Defines a one-to-one mapping of an identity to a presence filter.
+ *
+ * @since S60 v4.0
+ */
+class CPresenceFilterStore : public CBase
+    {
+    private: // helper class
+
+    class CPresenceFilterStoreMapping : public CBase
+        {
+        public:
+
+            /**
+             * Takes ownership.
+             * @param aIdentity The identity
+             * @param aFilter The filter.
+             */
+            static CPresenceFilterStoreMapping* NewL();
+
+            ~CPresenceFilterStoreMapping();
+
+            /**
+             * @return The identity
+             */
+            CXIMPIdentityImp& Identity();
+
+            /**
+             * @return The filter
+             */
+            CPresenceInfoFilterImp& Filter();
+
+            static TInt OrderOfMappings(
+                    const CPresenceFilterStoreMapping& aFirst, 
+                    const CPresenceFilterStoreMapping& aSecond );
+
+            static TInt OrderOfMappingsByIdentity(
+                    const CXIMPIdentityImp* aFirst, 
+                    const CPresenceFilterStoreMapping& aSecond );
+                    
+            /**
+             * Set filter to mapping.
+             */
+            void SetPresenceInfoFilter( CPresenceInfoFilterImp* aFilter );
+            void SetIdentity( CXIMPIdentityImp* aIdentity );
+
+        private:
+
+            CPresenceFilterStoreMapping();
+
+            void ConstructL();
+
+        public:
+            // owns: the identity
+            CXIMPIdentityImp* iIdentity;
+
+            // owns: the filter
+            CPresenceInfoFilterImp* iFilter;
+        };
+
+public:
+
+    /**
+     * Construction
+     */
+    IMPORT_C static CPresenceFilterStore* NewL();
+
+    /**
+     * Destruction
+     */
+    virtual ~CPresenceFilterStore();
+
+private:
+
+    /** 
+     * Construction
+     */
+    CPresenceFilterStore();
+    
+    /** 
+     * Construction
+     */
+    void ConstructL();
+
+
+public: // New methods
+
+    /**
+     * Associate identity with filter
+     * @param aIdentity The identity
+     * @param aFilter The filter. Ownership is transferred to callee
+     * @leave KErrAlreadyExists if the association exists
+     */
+    IMPORT_C void AssociateL( 
+            const CXIMPIdentityImp& aIdentity, 
+            CPresenceInfoFilterImp* aFilter );
+
+    /**
+     * Remove association.
+     * @param aIdentity The identity
+     * @param aFilter The filter
+     * @leave KErrNotFound if the association does not exist
+     */
+    IMPORT_C void Disassociate( const CXIMPIdentityImp& aIdentity );
+    
+    /**
+     * Find the filter associated with the given identity.
+     * @param aIdentity The identity
+     * @return The filter
+     * @leave KErrNotFound if the association does not exist
+     */
+    IMPORT_C CPresenceInfoFilterImp* FilterForIdentity( const CXIMPIdentityImp& aIdentity );
+
+private: // helpers
+
+private: // data
+
+    /**
+     * Array of mappings. Items are owned
+     */
+    RXIMPObjOwningPtrArray< CPresenceFilterStoreMapping > iMappings;
+    };
+
+
+#endif // C_PRESENCEFILTERSTORE_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresencedatamodel/presenceinfo/devicepresenceinfoimp.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  Implementation of MDevicePresenceInfo object.
+*
+*/
+
+
+#include "presenceinfofield.h"
+#include "devicepresenceinfoimp.h"
+#include "presenceinfofieldcollectionimp.h"
+#include "ximprbufhelpers.h"
+#include "presenceinfofilterimp.h"
+
+// ============================ MEMBER FUNCTIONS =============================
+
+// ---------------------------------------------------------------------------
+// CDevicePresenceInfoImp::NewLC()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CDevicePresenceInfoImp* CDevicePresenceInfoImp::NewLC()
+    {
+    CDevicePresenceInfoImp* self = new( ELeave ) CDevicePresenceInfoImp;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CDevicePresenceInfoImp::NewFromStreamLC()
+// ---------------------------------------------------------------------------
+//
+XIMPIMP_IMPLEMENT_DATAOBJ_NEWFROMSTREAM( CDevicePresenceInfoImp )
+
+
+// ---------------------------------------------------------------------------
+// Implement supported interface access.
+// ---------------------------------------------------------------------------
+//
+XIMPIMP_IF_BASE_GET_INTERFACE_BEGIN( CDevicePresenceInfoImp,
+                                     MDevicePresenceInfo )
+XIMPIMP_IF_BASE_GET_INTERFACE_END()
+
+XIMPIMP_IF_BASE_GET_CONST_INTERFACE_BEGIN( CDevicePresenceInfoImp,
+                                           MDevicePresenceInfo )
+XIMPIMP_IF_BASE_GET_INTERFACE_END()
+
+// ---------------------------------------------------------------------------
+// CDevicePresenceInfoImp::~CDevicePresenceInfoImp()
+// ---------------------------------------------------------------------------
+//
+CDevicePresenceInfoImp::~CDevicePresenceInfoImp()
+    {
+    delete iFields;
+    iDeviceName.Close();
+    }
+
+
+// ---------------------------------------------------------------------------
+// CDevicePresenceInfoImp::CDevicePresenceInfoImp()
+// ---------------------------------------------------------------------------
+//
+CDevicePresenceInfoImp::CDevicePresenceInfoImp()
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// CDevicePresenceInfoImp::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void CDevicePresenceInfoImp::ConstructL()
+    {
+    iFields = CPresenceInfoFieldCollectionImp::NewLC();
+    CleanupStack::Pop( iFields );
+    
+    iDeviceName.CreateL( 0 );
+    }
+
+// ---------------------------------------------------------------------------
+// CDevicePresenceInfoImp::ExternalizeL()
+// ---------------------------------------------------------------------------
+//
+void CDevicePresenceInfoImp::ExternalizeL( RWriteStream& aStream ) const
+    {
+    XIMPRBuf8Helper::ExternalizeL( iDeviceName, aStream );
+    iFields->ExternalizeL( aStream );
+    }
+
+
+// ---------------------------------------------------------------------------
+// CDevicePresenceInfoImp::InternalizeL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CDevicePresenceInfoImp::InternalizeL( RReadStream& aStream )
+    {
+    XIMPRBuf8Helper::InternalizeL( iDeviceName, aStream );
+
+    // we only have a parameterless ConstructL which creates the fields structure...
+    CXIMPApiDataObjBase* tmp = CPresenceInfoFieldCollectionImp::NewFromStreamLC( aStream );
+    CPresenceInfoFieldCollectionImp* fields = 
+        TXIMPGetImpClassOrPanic< CPresenceInfoFieldCollectionImp >::From( tmp->Base() );
+    delete iFields;
+    iFields = fields;
+    CleanupStack::Pop( tmp );
+    }
+
+
+// ---------------------------------------------------------------------------
+// CDevicePresenceInfoImp::EqualsContent()
+// ---------------------------------------------------------------------------
+//
+TBool CDevicePresenceInfoImp::EqualsContent(
+        const CXIMPApiDataObjBase& aOtherInstance ) const
+    {
+    const CDevicePresenceInfoImp* tmp =
+        TXIMPGetImpClassOrPanic< const CDevicePresenceInfoImp >::From(
+                aOtherInstance.Base() );
+
+    TBool same = ETrue;
+    TBool x;
+    x = iFields->EqualsContent( *( tmp->iFields ) );
+    same &= x;
+
+    return same;
+    }
+
+// ---------------------------------------------------------------------------
+// From MDevicePresenceInfo class.
+// CDevicePresenceInfoImp::DeviceName()
+// ---------------------------------------------------------------------------
+//
+const TPtrC8 CDevicePresenceInfoImp::DeviceName() const
+    {
+    return iDeviceName;
+    }
+
+// ---------------------------------------------------------------------------
+// From MDevicePresenceInfo class.
+// CDevicePresenceInfoImp::SetDeviceNameL()
+// ---------------------------------------------------------------------------
+//
+void CDevicePresenceInfoImp::SetDeviceNameL( const TDesC8& aDeviceName ) 
+    {
+    HBufC8* tmp = aDeviceName.AllocL();
+    iDeviceName.Close();
+    iDeviceName.Assign( tmp );
+    }
+
+
+// ---------------------------------------------------------------------------
+// From MDevicePresenceInfo class.
+// CDevicePresenceInfoImp::Fields()
+// ---------------------------------------------------------------------------
+//
+const MPresenceInfoFieldCollection& CDevicePresenceInfoImp::Fields() const
+    {
+    return *iFields;
+    }
+
+
+// ---------------------------------------------------------------------------
+// From MDevicePresenceInfo class.
+// CDevicePresenceInfoImp::Fields()
+// ---------------------------------------------------------------------------
+//
+MPresenceInfoFieldCollection& CDevicePresenceInfoImp::Fields()
+    {
+    return *iFields;
+    }
+
+// ---------------------------------------------------------------------------
+// CDevicePresenceInfoImp::FilterWithL()
+// ---------------------------------------------------------------------------
+//
+void CDevicePresenceInfoImp::FilterWithL( const CPresenceInfoFilterImp& aFilter )
+    {
+    TInt count = iFields->FieldCount();
+
+    // must traverse backwards when removing
+    for ( TInt i = count-1; i >= 0; i-- )
+        {
+        if ( ! aFilter.MatchDeviceFilterL( 
+                    iDeviceName, 
+                    iFields->FieldAt( i ).FieldType() ) )
+            {
+            // no match, so remove the field
+            // the filter tells us which ones to ACCEPT
+            iFields->RemoveField( i );
+            }
+        }
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresencedatamodel/presenceinfo/devicepresenceinfoimp.h	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  Implementation of MDevicePresenceInfo object.
+*
+*/
+
+#ifndef CDEVICEPRESENCEINFOIMP_H
+#define CDEVICEPRESENCEINFOIMP_H
+
+#include <e32std.h>
+#include <s32strm.h>
+#include <ximpbase.h>
+#include <devicepresenceinfo.h>
+#include "ximpapidataobjbase.h"
+#include "presenceapiobjbase.h"
+
+
+class CPresenceInfoFieldCollectionImp;
+class CPresenceInfoFilterImp;
+
+/**
+ * Implementation of MDevicePresenceInfo object.
+ *
+ * @since S60 v3.2
+ */
+NONSHARABLE_CLASS( CDevicePresenceInfoImp ): public CXIMPApiDataObjBase,
+                                                 public MDevicePresenceInfo
+    {
+    public:
+
+    /** The class ID. */
+    enum { KClassId = PRIMP_CLSID_CDEVICEPRESENCEINFOIMP };
+
+public:
+
+    IMPORT_C static CDevicePresenceInfoImp* NewLC();
+
+    virtual ~CDevicePresenceInfoImp();
+
+private:
+
+    CDevicePresenceInfoImp();
+    void ConstructL();
+
+    /**
+     * @see CXIMPApiDataObjBase
+     */
+    XIMPIMP_DECLARE_DATAOBJ_BASE_PRIV_METHODS
+
+
+public: // From MXIMPBase
+
+    /**
+     * Implementation of MXIMPBase interface methods
+     * @see MXIMPBase
+     */
+    XIMPIMP_DECLARE_IF_BASE_METHODS
+
+    /**
+     * @see CXIMPApiDataObjBase
+     */
+    XIMPIMP_DECLARE_DATAOBJ_BASE_METHODS
+
+
+public: // New functions
+
+    /**
+     * Internalizes object data from given stream.
+     * @param aStream Stream to read.
+     */
+    IMPORT_C void InternalizeL( RReadStream& aStream );
+
+
+
+public: // from MDevicePresenceInfo
+
+    /**
+     * @see MDevicePresenceInfo
+     */
+    const TPtrC8 DeviceName() const;
+    void SetDeviceNameL( const TDesC8& aDeviceName );
+    const MPresenceInfoFieldCollection& Fields() const;
+    MPresenceInfoFieldCollection& Fields();
+
+public: // new methods
+
+    /**
+     * Remove from this info field implementation the fields which do not match
+     * the given filter.
+     * @param aFilter The filter implementation
+     */
+    void FilterWithL( const CPresenceInfoFilterImp& aFilter );
+
+private: // data
+
+    CPresenceInfoFieldCollectionImp* iFields;
+    
+    RBuf8 iDeviceName;
+    };
+
+
+#endif // CDEVICEPRESENCEINFOIMP_H
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresencedatamodel/presenceinfo/personpresenceinfoimp.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,166 @@
+/*
+* 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 of MPersonPresenceInfo object.
+*
+*/
+
+
+#include "presenceinfofield.h"
+#include "personpresenceinfoimp.h"
+#include "presenceinfofieldcollectionimp.h"
+#include "presenceinfofilterimp.h"
+
+// ============================ MEMBER FUNCTIONS =============================
+
+// ---------------------------------------------------------------------------
+// CPersonPresenceInfoImp::NewLC()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CPersonPresenceInfoImp* CPersonPresenceInfoImp::NewLC()
+    {
+    CPersonPresenceInfoImp* self = new( ELeave ) CPersonPresenceInfoImp;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CPersonPresenceInfoImp::NewFromStreamLC()
+// ---------------------------------------------------------------------------
+//
+XIMPIMP_IMPLEMENT_DATAOBJ_NEWFROMSTREAM( CPersonPresenceInfoImp )
+
+// ---------------------------------------------------------------------------
+// Implement supported interface access.
+// ---------------------------------------------------------------------------
+//
+XIMPIMP_IF_BASE_GET_INTERFACE_BEGIN( CPersonPresenceInfoImp,
+                                     MPersonPresenceInfo )
+XIMPIMP_IF_BASE_GET_INTERFACE_END()
+XIMPIMP_IF_BASE_GET_CONST_INTERFACE_BEGIN( CPersonPresenceInfoImp,
+                                           MPersonPresenceInfo )
+XIMPIMP_IF_BASE_GET_INTERFACE_END()
+
+// ---------------------------------------------------------------------------
+// CPersonPresenceInfoImp::~CPersonPresenceInfoImp()
+// ---------------------------------------------------------------------------
+//
+CPersonPresenceInfoImp::~CPersonPresenceInfoImp()
+    {
+    delete iFields;
+    }
+
+// ---------------------------------------------------------------------------
+// CPersonPresenceInfoImp::CPersonPresenceInfoImp()
+// ---------------------------------------------------------------------------
+//
+CPersonPresenceInfoImp::CPersonPresenceInfoImp()
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// CPersonPresenceInfoImp::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void CPersonPresenceInfoImp::ConstructL()
+    {
+    iFields = CPresenceInfoFieldCollectionImp::NewLC(); // CSI: 49 #
+    CleanupStack::Pop( iFields );
+    }
+
+// ---------------------------------------------------------------------------
+// CPersonPresenceInfoImp::ExternalizeL()
+// ---------------------------------------------------------------------------
+//
+void CPersonPresenceInfoImp::ExternalizeL( RWriteStream& aStream ) const
+    {
+    iFields->ExternalizeL( aStream );
+    }
+
+// ---------------------------------------------------------------------------
+// CPersonPresenceInfoImp::InternalizeL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CPersonPresenceInfoImp::InternalizeL( RReadStream& aStream )
+    {
+    // we only have a parameterless ConstructL which creates the fields structure...
+    CXIMPApiDataObjBase* tmp = CPresenceInfoFieldCollectionImp::NewFromStreamLC( aStream );
+    CPresenceInfoFieldCollectionImp* fields = 
+        TXIMPGetImpClassOrPanic< CPresenceInfoFieldCollectionImp >::From( tmp->Base() );
+    delete iFields;
+    iFields = fields;
+    CleanupStack::Pop( tmp );
+    }
+
+// ---------------------------------------------------------------------------
+// CPersonPresenceInfoImp::EqualsContent()
+// ---------------------------------------------------------------------------
+//
+TBool CPersonPresenceInfoImp::EqualsContent(
+        const CXIMPApiDataObjBase& aOtherInstance ) const
+    {
+    const CPersonPresenceInfoImp* tmp =
+        TXIMPGetImpClassOrPanic< const CPersonPresenceInfoImp >::From(
+                aOtherInstance.Base() );
+
+    TBool same = ETrue;
+    TBool x;
+    x = iFields->EqualsContent( *( tmp->iFields ) );
+    same &= x;
+
+    return same;
+    }
+
+
+// ---------------------------------------------------------------------------
+// From MPersonPresenceInfo class.
+// CPersonPresenceInfoImp::Fields()
+// ---------------------------------------------------------------------------
+//
+const MPresenceInfoFieldCollection& CPersonPresenceInfoImp::Fields() const
+    {
+    return *iFields;
+    }
+
+// ---------------------------------------------------------------------------
+// From MPersonPresenceInfo class.
+// CPersonPresenceInfoImp::Fields()
+// ---------------------------------------------------------------------------
+//
+MPresenceInfoFieldCollection& CPersonPresenceInfoImp::Fields()
+    {
+    return *iFields;
+    }
+
+// ---------------------------------------------------------------------------
+// CPersonPresenceInfoImp::FilterWithL()
+// ---------------------------------------------------------------------------
+//
+void CPersonPresenceInfoImp::FilterWithL( const CPresenceInfoFilterImp& aFilter )
+    {
+    TInt count = iFields->FieldCount();
+
+    // must traverse backwards when removing
+    for ( TInt i = count-1; i >= 0; i-- )
+        {
+        if ( ! aFilter.MatchPersonFilter( iFields->FieldAt( i ).FieldType() ) )
+            {
+            // no match, so remove the field
+            // the filter tells us which ones to ACCEPT
+            iFields->RemoveField( i );
+            }
+        }
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresencedatamodel/presenceinfo/personpresenceinfoimp.h	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  Implementation of MPersonPresenceInfo object.
+*
+*/
+
+#ifndef CPERSONPRESENCEINFOIMP_H
+#define CPERSONPRESENCEINFOIMP_H
+
+#include <e32std.h>
+#include <s32strm.h>
+#include <ximpbase.h>
+#include <personpresenceinfo.h>
+#include "ximpapidataobjbase.h"
+#include "presenceapiobjbase.h"
+
+
+class CPresenceInfoFieldCollectionImp;
+class CPresenceInfoFilterImp;
+
+/**
+ * Implementation of MPersonPresenceInfo object.
+ *
+ * @since S60 v3.2
+ */
+NONSHARABLE_CLASS( CPersonPresenceInfoImp ): public CXIMPApiDataObjBase,
+                                                 public MPersonPresenceInfo
+    {
+    public:
+
+    /** The class ID. */
+    enum { KClassId = PRIMP_CLSID_CPERSONPRESENCEINFOIMP };
+
+public:
+
+    IMPORT_C static CPersonPresenceInfoImp* NewLC();
+
+    virtual ~CPersonPresenceInfoImp();
+
+private:
+
+    CPersonPresenceInfoImp();
+    void ConstructL();
+
+    /**
+     * @see CXIMPApiDataObjBase
+     */
+    XIMPIMP_DECLARE_DATAOBJ_BASE_PRIV_METHODS
+
+public: // From MXIMPBase
+
+    /**
+     * Implementation of MXIMPBase interface methods
+     * @see MXIMPBase
+     */
+    XIMPIMP_DECLARE_IF_BASE_METHODS
+
+    /**
+     * @see CXIMPApiDataObjBase
+     */
+    XIMPIMP_DECLARE_DATAOBJ_BASE_METHODS
+
+public: // New functions
+
+    /**
+     * Internalizes object data from given stream.
+     * @param aStream Stream to read.
+     */
+    IMPORT_C void InternalizeL( RReadStream& aStream );
+
+
+public: // from MPersonPresenceInfo
+
+    /**
+     * @see MPersonPresenceInfo
+     */
+    const MPresenceInfoFieldCollection& Fields() const;
+    MPresenceInfoFieldCollection& Fields();
+
+public: // new methods
+
+    /**
+     * Remove from this info field implementation the fields which do not match
+     * the given filter.
+     * @param aFilter The filter implementation
+     */
+    void FilterWithL( const CPresenceInfoFilterImp& aFilter );
+
+private: // data
+
+    // owned
+    CPresenceInfoFieldCollectionImp* iFields;
+    };
+
+
+#endif // CPERSONPRESENCEINFOIMP_H
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresencedatamodel/presenceinfo/presenceinfofieldcollectionimp.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,270 @@
+/*
+* 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:  MPresenceInfoFieldValueText API object implementation.
+ *
+*/
+
+
+#include "presenceinfofield.h"
+#include "presenceinfofieldimp.h"
+#include "presenceinfofieldcollectionimp.h"
+#include "presenceapidataobjfactory.h"
+#include "ximprbufhelpers.h"
+#include "ximpobjecthelpers.h"
+#include "presencetypehelpers.h"
+
+// ============================ MEMBER FUNCTIONS =============================
+
+// ---------------------------------------------------------------------------
+// CPresenceInfoFieldCollectionImp::NewLC()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CPresenceInfoFieldCollectionImp* CPresenceInfoFieldCollectionImp::NewLC()
+    {
+    CPresenceInfoFieldCollectionImp* self = new ( ELeave ) CPresenceInfoFieldCollectionImp();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceInfoFieldCollectionImp::~CPresenceInfoFieldCollectionImp()
+// ---------------------------------------------------------------------------
+//
+CPresenceInfoFieldCollectionImp::~CPresenceInfoFieldCollectionImp()
+    {
+    iFields.Close();
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceInfoFieldCollectionImp::CPresenceInfoFieldCollectionImp()
+// ---------------------------------------------------------------------------
+//
+CPresenceInfoFieldCollectionImp::CPresenceInfoFieldCollectionImp()
+    {
+    // nothing
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceInfoFieldCollectionImp::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void CPresenceInfoFieldCollectionImp::ConstructL()
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceInfoFieldCollectionImp::NewFromStreamLC()
+// ---------------------------------------------------------------------------
+//
+XIMPIMP_IMPLEMENT_DATAOBJ_NEWFROMSTREAM( CPresenceInfoFieldCollectionImp )
+
+// ---------------------------------------------------------------------------
+// Implement supported interface access.
+// ---------------------------------------------------------------------------
+//
+XIMPIMP_IF_BASE_GET_INTERFACE_BEGIN( CPresenceInfoFieldCollectionImp, MPresenceInfoFieldCollection )
+XIMPIMP_IF_BASE_GET_INTERFACE_END()
+XIMPIMP_IF_BASE_GET_CONST_INTERFACE_BEGIN( CPresenceInfoFieldCollectionImp, MPresenceInfoFieldCollection )
+XIMPIMP_IF_BASE_GET_INTERFACE_END()
+
+
+// ---------------------------------------------------------------------------
+// CPresenceInfoFieldCollectionImp::ExternalizeL()
+// ---------------------------------------------------------------------------
+//
+void CPresenceInfoFieldCollectionImp::ExternalizeL( RWriteStream& aStream ) const
+    {
+    CPresenceApiDataObjFactory::ExternalizeL< CPresenceInfoFieldImp >
+        ( aStream, iFields );
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceInfoFieldCollectionImp::InternalizeL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CPresenceInfoFieldCollectionImp::InternalizeL( RReadStream& aStream )
+    {
+    iFields.ResetAndDestroy();
+    CPresenceApiDataObjFactory::InternalizeL< CPresenceInfoFieldImp >
+        ( aStream, iFields );
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceInfoFieldCollectionImp::EqualsContent()
+// ---------------------------------------------------------------------------
+//
+TBool CPresenceInfoFieldCollectionImp::EqualsContent( 
+        const CXIMPApiDataObjBase& aOtherInstance ) const
+    {
+    const CPresenceInfoFieldCollectionImp* tmp =
+        TXIMPGetImpClassOrPanic< const CPresenceInfoFieldCollectionImp >::From( 
+                aOtherInstance.Base() );
+
+    TBool same = ETrue;
+    TBool x;
+
+    x = TXIMPEqualsContent< CPresenceInfoFieldImp >::Array( iFields, tmp->iFields );
+    same &= x;
+
+    return same;
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceInfoFieldCollectionImp::FieldCount()
+// ---------------------------------------------------------------------------
+//
+TInt CPresenceInfoFieldCollectionImp::FieldCount() const
+    {
+    return iFields.Count();
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceInfoFieldCollectionImp::FieldAt()
+// ---------------------------------------------------------------------------
+//
+const MPresenceInfoField& CPresenceInfoFieldCollectionImp::FieldAt(
+        TInt aIndex ) const
+    {
+    CPresenceInfoFieldImp* obj = iFields[ aIndex ];
+    MPresenceInfoField* infoField = ( MPresenceInfoField* ) 
+        obj->Base().GetInterface( MPresenceInfoField::KInterfaceId, 
+                MXIMPBase::EPanicIfUnknown );
+    return *infoField;
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceInfoFieldCollectionImp::LookupFieldByFieldType()
+// ---------------------------------------------------------------------------
+//
+void CPresenceInfoFieldCollectionImp::LookupFieldByFieldType(
+            MPresenceInfoField*& aPresenceInfoField,
+            const TDesC8& aMatch ) const
+    {
+    TInt start = FindIndexOfObj( aPresenceInfoField );
+    start = start == KErrNotFound ? 0 : start;
+
+    aPresenceInfoField = NULL;
+
+    // now find the object with name
+    for ( TInt i = start; i < iFields.Count(); i++ )
+        {
+        CPresenceInfoFieldImp* field = iFields[ i ];
+
+        if ( KErrNotFound != field->FieldType().MatchF( aMatch ) )
+            {
+            // got a match with correct name
+            aPresenceInfoField = &(*field);
+            return;
+            }
+        }
+
+    return;
+    }
+    
+// ---------------------------------------------------------------------------
+// CPresenceInfoFieldCollectionImp::DeleteFieldByFieldType()
+// ---------------------------------------------------------------------------
+//
+TInt CPresenceInfoFieldCollectionImp::DeleteFieldByFieldType(
+            const TDesC8& aMatch )
+    {
+    TInt deleted(KErrNotFound);
+    // now find the object with name
+    for ( TInt i = 0; i < iFields.Count(); i++ )
+        {
+        CPresenceInfoFieldImp* field = iFields[ i ];
+
+        if ( KErrNotFound != field->FieldType().MatchF( aMatch ) )
+            {
+            // got a match with correct name
+            iFields.Remove( i );
+            delete field;
+            deleted = KErrNone;
+            }
+        }
+
+    return deleted;
+    }    
+
+// ---------------------------------------------------------------------------
+// CPresenceInfoFieldCollectionImp::AddOrReplaceFieldL()
+// ---------------------------------------------------------------------------
+//
+void CPresenceInfoFieldCollectionImp::AddOrReplaceFieldL(
+            MPresenceInfoField* aPresenceInfoField )
+    {
+    User::LeaveIfError( aPresenceInfoField == NULL ? KErrArgument : KErrNone );
+
+    TInt pos = FindIndexOfObj( aPresenceInfoField );
+    CPresenceInfoFieldImp* obj = TXIMPGetImpClassOrPanic< CPresenceInfoFieldImp >::From( *aPresenceInfoField );
+
+    if ( KErrNotFound == pos )
+        {
+        // not found, so just append
+        iFields.AppendL( obj );
+        }
+    else
+        {
+        // found it, so replace the one at "pos"
+        CPresenceInfoFieldImp* old = iFields[ pos ];
+        iFields.Remove( pos );
+        iFields.Insert( obj, pos );
+        delete old;
+        old = NULL;
+        }
+    }
+    
+    
+
+// ---------------------------------------------------------------------------
+// CPresenceInfoFieldCollectionImp::FindIndexOfObj()
+// ---------------------------------------------------------------------------
+//
+TInt CPresenceInfoFieldCollectionImp::FindIndexOfObj( MPresenceInfoField*& aObject ) const
+    {
+    TInt start = KErrNotFound;
+
+    // naive lookup, least recently used (from beginning to the end).
+    // find starting position
+    if ( aObject != NULL )
+        {
+        TBool found = EFalse;
+        for ( TInt i = 0; ( i < iFields.Count()-1 ) && ( ! found ); i++ )
+            {
+            CPresenceInfoFieldImp* gotObj = TXIMPGetImpClassOrPanic< CPresenceInfoFieldImp >::From( *aObject );
+            CPresenceInfoFieldImp* obj = iFields[ i ];
+            if ( &(gotObj->Base()) == &(obj->Base()) )
+                {
+                found = ETrue;
+                start = i;
+                }
+            }
+        }
+
+    return start;
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceInfoFieldCollectionImp::RemoveFieldL
+// ---------------------------------------------------------------------------
+//
+void CPresenceInfoFieldCollectionImp::RemoveField( TInt aIndex )
+    {
+    CPresenceInfoFieldImp* field = iFields[ aIndex ];
+    iFields.Remove( aIndex );
+    delete field;
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresencedatamodel/presenceinfo/presenceinfofieldcollectionimp.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,149 @@
+/*
+* 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 of presence info field collection.
+ *
+*/
+
+
+#ifndef CPRESENCEINFOFIELDCOLLECTIONIMP_H
+#define CPRESENCEINFOFIELDCOLLECTIONIMP_H
+
+#include <e32std.h>
+#include <s32strm.h> // RWriteStream, RReadStream
+#include <ximpbase.h>
+#include <ximpdatamodelifids.hrh>
+#include "ximpapidataobjbase.h"
+#include "presenceapiobjbase.h"
+#include "presencetypehelpers.h"
+#include "presenceinfofieldcollection.h"
+
+class MPresenceInfoField;
+class CPresenceInfoFilterImp;
+
+/**
+ * Implementation of presence info field collection.
+ *
+ *
+ *
+ *
+ * @ingroup ximpdatamodelapi
+ * @since S60 v3.2
+ */
+NONSHARABLE_CLASS( CPresenceInfoFieldCollectionImp ): public CXIMPApiDataObjBase, 
+    public MPresenceInfoFieldCollection
+    {
+public:
+
+    /** The class ID. */
+    enum { KClassId = PRIMP_CLSID_CPRESENCEINFOFIELDCOLLECTIONIMP };
+
+public:
+
+    IMPORT_C static CPresenceInfoFieldCollectionImp* NewLC();
+
+    virtual ~CPresenceInfoFieldCollectionImp();
+
+private:
+
+    CPresenceInfoFieldCollectionImp();
+
+    void ConstructL();
+
+    /**
+     * @see CXIMPApiDataObjBase
+     */
+    XIMPIMP_DECLARE_DATAOBJ_BASE_PRIV_METHODS
+
+public: // From MXIMPBase
+
+    /**
+     * Implementation of MXIMPBase interface methods
+     * @see MXIMPBase
+     */
+    XIMPIMP_DECLARE_IF_BASE_METHODS
+
+    /**
+     * @see CXIMPApiDataObjBase
+     */
+    XIMPIMP_DECLARE_DATAOBJ_BASE_METHODS
+
+public: // New functions
+
+    /**
+     * Internalizes object data from given stream.
+     * @param aStream Stream to read.
+     */
+    IMPORT_C void InternalizeL( RReadStream& aStream );
+
+
+public: // from MPresenceInfoFieldCollection
+
+    /**
+     * @see MPresenceInfoFieldCollection
+     */
+    TInt FieldCount() const;
+
+    /**
+     * @see MPresenceInfoFieldCollection
+     */
+    const MPresenceInfoField& FieldAt(
+            TInt aIndex ) const;
+
+    /**
+     * @see MPresenceInfoFieldCollection
+     */
+    void LookupFieldByFieldType(
+            MPresenceInfoField*& aPresenceInfoField,
+            const TDesC8& aMatch ) const;
+            
+    /**
+     * @see MPresenceInfoFieldCollection
+     */
+    TInt DeleteFieldByFieldType(const TDesC8& aMatch );
+
+    /**
+     * @see MPresenceInfoFieldCollection
+     */
+    void AddOrReplaceFieldL(
+            MPresenceInfoField* aPresenceInfoField );
+
+public: // new methods
+
+    /**
+     * Remove from this field collection the field
+     * at the given index.
+     */
+    void RemoveField( TInt aIndex );
+
+private: // helpers
+
+    /** 
+     * Find index, starting at the given object.
+     * @return KErrNotFound if not found
+     * @return Otherwise returns the index of given object
+     */
+    TInt FindIndexOfObj( MPresenceInfoField*& aObject ) const;
+
+private: // data
+
+    /**
+     * OWN: The fields stored in this collection
+     */
+    RPrInfoFieldArray iFields;
+    };
+
+#endif // CPRESENCEINFOFIELDCOLLECTIONIMP_H
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresencedatamodel/presenceinfo/presenceinfofieldimp.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,218 @@
+/*
+* 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:  MPresenceInfoField API object implementation.
+*
+*/
+
+
+#include "ximpbase.h"
+#include "ximpapidataobjbase.h"
+#include "presenceinfofield.h"
+#include "presenceinfofieldimp.h"
+#include "ximpidentityimp.h"
+#include "ximprbufhelpers.h"
+#include "ximpobjecthelpers.h"
+#include "presenceapidataobjfactory.h"
+
+// ============================ MEMBER FUNCTIONS =============================
+
+// ---------------------------------------------------------------------------
+// CPresenceInfoFieldImp::NewLC()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CPresenceInfoFieldImp* CPresenceInfoFieldImp::NewLC(
+    const TDesC8& aFieldName,
+    CXIMPApiDataObjBase* aFieldValue )
+    {
+    CPresenceInfoFieldImp* self = new( ELeave ) CPresenceInfoFieldImp;
+    CleanupStack::PushL( self );
+    self->ConstructL( aFieldName, aFieldValue );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceInfoFieldImp::NewLC()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CPresenceInfoFieldImp* CPresenceInfoFieldImp::NewLC()
+    {
+    CPresenceInfoFieldImp* self = new( ELeave ) CPresenceInfoFieldImp;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceInfoFieldImp::NewFromStreamLC()
+// ---------------------------------------------------------------------------
+//
+XIMPIMP_IMPLEMENT_DATAOBJ_NEWFROMSTREAM( CPresenceInfoFieldImp )
+
+// ---------------------------------------------------------------------------
+// Implement supported interface access.
+// ---------------------------------------------------------------------------
+//
+XIMPIMP_IF_BASE_GET_INTERFACE_BEGIN( CPresenceInfoFieldImp, MPresenceInfoField )
+XIMPIMP_IF_BASE_GET_INTERFACE_END()
+XIMPIMP_IF_BASE_GET_CONST_INTERFACE_BEGIN( CPresenceInfoFieldImp, MPresenceInfoField )
+XIMPIMP_IF_BASE_GET_INTERFACE_END()
+
+// ---------------------------------------------------------------------------
+// CPresenceInfoFieldImp::~CPresenceInfoFieldImp()
+// ---------------------------------------------------------------------------
+//
+CPresenceInfoFieldImp::~CPresenceInfoFieldImp()
+    {
+    iFieldName.Close();
+    delete iFieldValue;
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceInfoFieldImp::CPresenceInfoFieldImp()
+// ---------------------------------------------------------------------------
+//
+CPresenceInfoFieldImp::CPresenceInfoFieldImp()
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// CPresenceInfoFieldImp::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void CPresenceInfoFieldImp::ConstructL( const TDesC8& aFieldName,
+                                            CXIMPApiDataObjBase* aFieldValue )
+    {
+    // if you give NULL you shall suffer
+    User::LeaveIfError( aFieldValue == NULL ? KErrArgument : KErrNone );
+
+    iFieldValue = aFieldValue;
+    iFieldName.CreateL( aFieldName );
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceInfoFieldImp::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void CPresenceInfoFieldImp::ConstructL()
+    {
+    iFieldName.CreateL( 0 );
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceInfoFieldImp::ExternalizeL()
+// ---------------------------------------------------------------------------
+//
+void CPresenceInfoFieldImp::ExternalizeL( RWriteStream& aStream ) const
+    {
+    XIMPRBuf8Helper::ExternalizeL( iFieldName, aStream );
+    CPresenceApiDataObjFactory::ExternalizeL( aStream, *iFieldValue );
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceInfoFieldImp::InternalizeL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CPresenceInfoFieldImp::InternalizeL( RReadStream& aStream )
+    {
+    XIMPRBuf8Helper::InternalizeL( iFieldName, aStream );
+
+    CXIMPApiDataObjBase* tmp = CPresenceApiDataObjFactory::InternalizeLC( aStream );
+    delete iFieldValue;
+    iFieldValue = tmp;
+    CleanupStack::Pop( tmp );
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceInfoFieldImp::EqualsContent()
+// ---------------------------------------------------------------------------
+//
+TBool CPresenceInfoFieldImp::EqualsContent( 
+        const CXIMPApiDataObjBase& aOtherInstance ) const
+    {
+    const CPresenceInfoFieldImp* tmp =
+        TXIMPGetImpClassOrPanic< const CPresenceInfoFieldImp >::From( 
+                aOtherInstance.Base() );
+
+    TBool same = ETrue;
+    TBool x;
+    x = 0 == iFieldName.Compare( tmp->iFieldName );
+    same &= x;
+
+    x = iFieldValue->EqualsContent( *( tmp->iFieldValue ) );
+    same &= x;
+    return same;
+    }
+
+
+// ---------------------------------------------------------------------------
+// From MPresenceInfoField class.
+// CPresenceInfoFieldImp::FieldType()
+// ---------------------------------------------------------------------------
+//
+const TDesC8& CPresenceInfoFieldImp::FieldType() const
+    {
+    return iFieldName;
+    }
+
+
+// ---------------------------------------------------------------------------
+// From MPresenceInfoField class.
+// CPresenceInfoFieldImp::FieldValue()
+// ---------------------------------------------------------------------------
+//
+const MXIMPBase& CPresenceInfoFieldImp::FieldValue() const
+    {
+    return iFieldValue->Base();
+    }
+
+
+// ---------------------------------------------------------------------------
+// From MPresenceInfoField class.
+// CPresenceInfoFieldImp::FieldValue()
+// ---------------------------------------------------------------------------
+//
+MXIMPBase& CPresenceInfoFieldImp::FieldValue() 
+    {
+    return iFieldValue->Base();
+    }
+
+// ---------------------------------------------------------------------------
+// From MPresenceInfoField class.
+// CPresenceInfoFieldImp::SetFieldValue
+// ---------------------------------------------------------------------------
+//
+void CPresenceInfoFieldImp::SetFieldValue( MXIMPBase* aFieldValue ) 
+    {
+    CXIMPApiDataObjBase* tmp =
+        TXIMPGetImpClassOrPanic< CXIMPApiDataObjBase >::From( 
+                *aFieldValue );
+
+    delete iFieldValue;
+    iFieldValue = tmp; 
+    }
+
+// ---------------------------------------------------------------------------
+// From MPresenceInfoField class.
+// CPresenceInfoFieldImp::SetFieldTypeL
+// ---------------------------------------------------------------------------
+//
+void CPresenceInfoFieldImp::SetFieldTypeL( const TDesC8& aFieldType )
+    {
+    HBufC8* newValue = aFieldType.AllocL();
+    iFieldName.Close();
+    iFieldName.Assign( newValue );
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresencedatamodel/presenceinfo/presenceinfofieldimp.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,112 @@
+/*
+* 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 of presence info field object.
+*
+*/
+
+#ifndef CPRESENCEINFOFIELDIMP_H
+#define CPRESENCEINFOFIELDIMP_H
+
+#include <e32std.h>
+#include <s32strm.h> // RWriteStream, RReadStream
+#include <ximpbase.h>
+#include <ximpdatamodelifids.hrh>
+#include "ximpapidataobjbase.h"
+#include "presenceapiobjbase.h"
+#include "presenceinfofield.h"
+
+/**
+ * Implementation of presence info field object.
+ *
+ *
+ * @since S60 v3.2
+ */
+NONSHARABLE_CLASS( CPresenceInfoFieldImp ): public CXIMPApiDataObjBase, 
+                                                public MPresenceInfoField
+    {
+    public:
+
+    /** The class ID. */
+    enum { KClassId = PRIMP_CLSID_CPRESENCEINFOFIELDIMP };
+
+public:
+
+    IMPORT_C static CPresenceInfoFieldImp* NewLC( const TDesC8& aFieldName,
+                                                      CXIMPApiDataObjBase* aFieldValue );
+    
+    IMPORT_C static CPresenceInfoFieldImp* NewLC();
+
+    virtual ~CPresenceInfoFieldImp();
+
+private:
+
+    CPresenceInfoFieldImp();
+
+    void ConstructL( const TDesC8& aFieldName,
+                     CXIMPApiDataObjBase* aFieldValue );
+
+    void ConstructL();
+
+    /**
+     * @see CXIMPApiDataObjBase
+     */
+    XIMPIMP_DECLARE_DATAOBJ_BASE_PRIV_METHODS
+
+public: // From MXIMPBase
+
+    /**
+     * Implementation of MXIMPBase interface methods
+     * @see MXIMPBase
+     */
+    XIMPIMP_DECLARE_IF_BASE_METHODS
+
+    /**
+     * @see CXIMPApiDataObjBase
+     */
+    XIMPIMP_DECLARE_DATAOBJ_BASE_METHODS
+
+public: // New functions
+
+    /**
+     * Internalizes object data from given stream.
+     * @param aStream Stream to read.
+     */
+    IMPORT_C void InternalizeL( RReadStream& aStream );
+
+
+public: // from MPresenceInfoField
+
+    /**
+     * @see MPresenceInfoField
+     */
+    const TDesC8& FieldType() const;
+    const MXIMPBase& FieldValue() const;
+    MXIMPBase& FieldValue();
+    void SetFieldValue( MXIMPBase* aFieldValue );
+    void SetFieldTypeL( const TDesC8& aFieldType );
+
+private: // data
+
+    // owned. name of the field
+    RBuf8 iFieldName;
+
+    // owned. the actual field.
+    CXIMPApiDataObjBase* iFieldValue;
+    };
+    
+
+#endif // CPRESENCEINFOFIELDIMP_H
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresencedatamodel/presenceinfo/presenceinfofieldvaluebinaryimp.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,198 @@
+/*
+* 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:  MPresenceInfoFieldValueText API object implementation.
+ *
+*/
+
+
+#include "presenceinfofieldvaluebinaryimp.h"
+#include "presenceinfofieldvaluebinary.h"
+#include "ximprbufhelpers.h"
+#include "ximpobjecthelpers.h"
+
+// ============================ MEMBER FUNCTIONS =============================
+
+// ---------------------------------------------------------------------------
+// CPresenceInfoFieldValueBinaryImp::NewLC()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CPresenceInfoFieldValueBinaryImp* CPresenceInfoFieldValueBinaryImp::NewLC(
+        TInt aMaxLength /* = NPresenceInfo::KPrValueLengthUnlimited */
+        )
+    {
+    CPresenceInfoFieldValueBinaryImp* self = new ( ELeave ) CPresenceInfoFieldValueBinaryImp( aMaxLength );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceInfoFieldValueBinaryImp::NewFromStreamLC()
+// ---------------------------------------------------------------------------
+//
+XIMPIMP_IMPLEMENT_DATAOBJ_NEWFROMSTREAM( CPresenceInfoFieldValueBinaryImp )
+
+// ---------------------------------------------------------------------------
+// Implement supported interface access.
+// ---------------------------------------------------------------------------
+//
+XIMPIMP_IF_BASE_GET_INTERFACE_BEGIN( CPresenceInfoFieldValueBinaryImp, MPresenceInfoFieldValueBinary )
+    XIMPIMP_IF_BASE_GET_CLASS( CXIMPApiDataObjBase, this )
+XIMPIMP_IF_BASE_GET_INTERFACE_END()
+XIMPIMP_IF_BASE_GET_CONST_INTERFACE_BEGIN( CPresenceInfoFieldValueBinaryImp, MPresenceInfoFieldValueBinary )
+    XIMPIMP_IF_BASE_GET_CONST_CLASS( CXIMPApiDataObjBase, this )
+XIMPIMP_IF_BASE_GET_INTERFACE_END()
+
+// ---------------------------------------------------------------------------
+// CPresenceInfoFieldValueBinaryImp::~CPresenceInfoFieldValueBinaryImp()
+// ---------------------------------------------------------------------------
+//
+CPresenceInfoFieldValueBinaryImp::~CPresenceInfoFieldValueBinaryImp()
+    {
+    iValue.Close();
+    iMimeType.Close();
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceInfoFieldValueBinaryImp::CPresenceInfoFieldValueBinaryImp()
+// ---------------------------------------------------------------------------
+//
+CPresenceInfoFieldValueBinaryImp::CPresenceInfoFieldValueBinaryImp(
+        TInt aMaxLength )
+    {
+    iMaxLength = aMaxLength;
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceInfoFieldValueBinaryImp::CPresenceInfoFieldValueBinaryImp()
+// ---------------------------------------------------------------------------
+//
+CPresenceInfoFieldValueBinaryImp::CPresenceInfoFieldValueBinaryImp()
+    {
+    // nothing
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceInfoFieldValueBinaryImp::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void CPresenceInfoFieldValueBinaryImp::ConstructL()
+    {
+    // always allocate a 0-length here, then in the setter enforce
+    // the maximal length
+    iValue.CreateL( 0 );
+    iMimeType.CreateL( 0 );
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceInfoFieldValueBinaryImp::ExternalizeL()
+// ---------------------------------------------------------------------------
+//
+void CPresenceInfoFieldValueBinaryImp::ExternalizeL( RWriteStream& aStream ) const
+    {
+    XIMPRBuf8Helper::ExternalizeL( iValue, aStream );
+    XIMPRBuf8Helper::ExternalizeL( iMimeType, aStream );
+    aStream.WriteInt32L( iMaxLength );
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceInfoFieldValueBinaryImp::InternalizeL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CPresenceInfoFieldValueBinaryImp::InternalizeL( RReadStream& aStream )
+    {
+    XIMPRBuf8Helper::InternalizeL( iValue, aStream );
+    XIMPRBuf8Helper::InternalizeL( iMimeType, aStream );
+    iMaxLength = aStream.ReadInt32L();
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceInfoFieldValueBinaryImp::EqualsContent()
+// ---------------------------------------------------------------------------
+//
+TBool CPresenceInfoFieldValueBinaryImp::EqualsContent( 
+        const CXIMPApiDataObjBase& aOtherInstance ) const
+    {
+    const CPresenceInfoFieldValueBinaryImp* tmp =
+        TXIMPGetImpClassOrPanic< const CPresenceInfoFieldValueBinaryImp >::From( 
+                aOtherInstance.Base() );
+
+    TBool same = ETrue;
+    TBool x;
+    x = 0 == iValue.Compare( tmp->iValue );
+    same &= x;
+    
+    x = 0 == iMimeType.Compare( tmp->iMimeType );
+    same &= x;
+    
+    x = iMaxLength == tmp->iMaxLength;
+    same &= x;
+
+    return same;
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceInfoFieldValueBinaryImp::MaxLength()
+// ---------------------------------------------------------------------------
+//
+TInt CPresenceInfoFieldValueBinaryImp::MaxLength() const
+    {
+    return iMaxLength;
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceInfoFieldValueBinaryImp::BinaryValue()
+// ---------------------------------------------------------------------------
+//
+TPtrC8 CPresenceInfoFieldValueBinaryImp::BinaryValue() const
+    {
+    return iValue;
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceInfoFieldValueBinaryImp::MimeType()
+// ---------------------------------------------------------------------------
+//
+const TPtrC8 CPresenceInfoFieldValueBinaryImp::MimeType() const
+    {
+    return iMimeType;
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceInfoFieldValueBinaryImp::SetBinaryValueL()
+// ---------------------------------------------------------------------------
+//
+void CPresenceInfoFieldValueBinaryImp::SetBinaryValueL( const TDesC8& aValue )
+    {
+    // maximal length might be enforced
+    User::LeaveIfError( ( iMaxLength != NPresenceInfo::KValueLengthUnlimited ) && 
+            ( iMaxLength < aValue.Length() ) ? KErrOverflow : KErrNone ); 
+
+    HBufC8* tmp = aValue.AllocL();
+    iValue.Close();
+    iValue.Assign( tmp );
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceInfoFieldValueBinaryImp::SetMimeTypeL
+// ---------------------------------------------------------------------------
+//
+void CPresenceInfoFieldValueBinaryImp::SetMimeTypeL( const TDesC8& aValue )
+    {
+    HBufC8* tmp = aValue.AllocL();
+    iMimeType.Close();
+    iMimeType.Assign( tmp );
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresencedatamodel/presenceinfo/presenceinfofieldvaluebinaryimp.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,136 @@
+/*
+* 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 of presence info field binary value object.
+*
+*/
+
+#ifndef CPRESENCEINFOFIELDVALUEBINARYIMP_H
+#define CPRESENCEINFOFIELDVALUEBINARYIMP_H
+
+#include <e32std.h>
+#include <s32strm.h> // RWriteStream, RReadStream
+#include <ximpbase.h>
+#include <ximpdatamodelifids.hrh>
+#include "presenceinfo.h"
+#include "ximpapidataobjbase.h"
+#include "presenceinfofieldvaluebinary.h"
+#include "presenceapiobjbase.h"
+
+/**
+ * Implementation of presence info field binary value object.
+ *
+ *
+ *
+ *
+ * @ingroup ximpdatamodelapi
+ * @since S60 v3.2
+ */
+NONSHARABLE_CLASS( CPresenceInfoFieldValueBinaryImp ): public CXIMPApiDataObjBase, 
+    public MPresenceInfoFieldValueBinary
+    {
+public:
+
+    /** The class ID. */
+    enum { KClassId = PRIMP_CLSID_CPRESENCEINFOFIELDVALUEBINARYIMP };
+
+public:
+
+    /**
+     * @param aMaxLength NPresenceInfo::KPrValueLengthUnlimited to not enforce
+     * length limits
+     */
+    IMPORT_C static CPresenceInfoFieldValueBinaryImp* NewLC(
+            TInt aMaxLength = NPresenceInfo::KValueLengthUnlimited );
+
+    virtual ~CPresenceInfoFieldValueBinaryImp();
+
+private:
+
+    CPresenceInfoFieldValueBinaryImp( TInt aMaxLength );
+    CPresenceInfoFieldValueBinaryImp();
+
+    void ConstructL();
+
+    /**
+     * @see CXIMPApiDataObjBase
+     */
+    XIMPIMP_DECLARE_DATAOBJ_BASE_PRIV_METHODS
+
+public: // From MXIMPBase
+
+    /**
+     * Implementation of MXIMPBase interface methods
+     * @see MXIMPBase
+     */
+    XIMPIMP_DECLARE_IF_BASE_METHODS
+
+    /**
+     * @see CXIMPApiDataObjBase
+     */
+    XIMPIMP_DECLARE_DATAOBJ_BASE_METHODS
+
+public: // New functions
+
+    /**
+     * Internalizes object data from given stream.
+     * @param aStream Stream to read.
+     */
+    IMPORT_C void InternalizeL( RReadStream& aStream );
+
+
+public: // from MPresenceInfoFieldValueBinary
+
+    /**
+     * @see MPresenceInfoFieldValueBinary
+     */
+    TInt MaxLength() const;
+
+    /**
+     * @see MPresenceInfoFieldValueBinary
+     */
+    TPtrC8 BinaryValue() const;
+
+    /**
+     * @see MPresenceInfoFieldValueBinary
+     */
+    const TPtrC8 MimeType() const;
+
+    /**
+     * @see MPresenceInfoFieldValueBinary
+     */
+    void SetBinaryValueL(
+            const TDesC8& aValue );
+
+    /**
+     * @see MPresenceInfoFieldValueBinary
+     */
+    void SetMimeTypeL(
+            const TDesC8& aMimeType );
+
+private: // data
+
+    // owned. field value
+    RBuf8 iValue;
+
+    // owned. mime type
+    RBuf8 iMimeType;
+
+    // maximum length of field value
+    TInt iMaxLength;
+    };
+
+#endif // CPRESENCEINFOFIELDVALUEBINARYIMP_H
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresencedatamodel/presenceinfo/presenceinfofieldvalueenumimp.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  MPresenceInfoFieldValueEnum API object implementation.
+ *
+*/
+
+
+#include "presenceinfofieldvalueenumimp.h"
+#include "presenceinfofieldvalueenum.h"
+#include "ximprbufhelpers.h"
+#include "ximpobjecthelpers.h"
+
+// ============================ MEMBER FUNCTIONS =============================
+
+// ---------------------------------------------------------------------------
+// CPresenceInfoFieldValueEnumImp::NewLC()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CPresenceInfoFieldValueEnumImp* CPresenceInfoFieldValueEnumImp::NewLC()
+    {
+    CPresenceInfoFieldValueEnumImp* self = new ( ELeave ) CPresenceInfoFieldValueEnumImp();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceInfoFieldValueEnumImp::NewFromStreamLC()
+// ---------------------------------------------------------------------------
+//
+XIMPIMP_IMPLEMENT_DATAOBJ_NEWFROMSTREAM( CPresenceInfoFieldValueEnumImp )
+
+// ---------------------------------------------------------------------------
+// Implement supported interface access.
+// ---------------------------------------------------------------------------
+//
+XIMPIMP_IF_BASE_GET_INTERFACE_BEGIN( CPresenceInfoFieldValueEnumImp, MPresenceInfoFieldValueEnum )
+    XIMPIMP_IF_BASE_GET_CLASS( CXIMPApiDataObjBase, this )
+XIMPIMP_IF_BASE_GET_INTERFACE_END()
+XIMPIMP_IF_BASE_GET_CONST_INTERFACE_BEGIN( CPresenceInfoFieldValueEnumImp, MPresenceInfoFieldValueEnum )
+    XIMPIMP_IF_BASE_GET_CONST_CLASS( CXIMPApiDataObjBase, this )
+XIMPIMP_IF_BASE_GET_INTERFACE_END()
+
+// ---------------------------------------------------------------------------
+// CPresenceInfoFieldValueEnumImp::~CPresenceInfoFieldValueEnumImp()
+// ---------------------------------------------------------------------------
+//
+CPresenceInfoFieldValueEnumImp::~CPresenceInfoFieldValueEnumImp()
+    {
+    // nothing
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceInfoFieldValueEnumImp::CPresenceInfoFieldValueEnumImp()
+// ---------------------------------------------------------------------------
+//
+CPresenceInfoFieldValueEnumImp::CPresenceInfoFieldValueEnumImp()
+    {
+    // nothing
+    iMaxValue = KMaxTInt32;
+    iMinValue = KMinTInt32;
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceInfoFieldValueEnumImp::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void CPresenceInfoFieldValueEnumImp::ConstructL()
+    {
+    // nothing
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceInfoFieldValueEnumImp::ExternalizeL()
+// ---------------------------------------------------------------------------
+//
+void CPresenceInfoFieldValueEnumImp::ExternalizeL( RWriteStream& aStream ) const
+    {
+    aStream.WriteInt32L( iMaxValue );
+    aStream.WriteInt32L( iMinValue );
+    aStream.WriteInt32L( iValue );
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceInfoFieldValueEnumImp::InternalizeL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CPresenceInfoFieldValueEnumImp::InternalizeL( RReadStream& aStream )
+    {
+    iMaxValue = aStream.ReadInt32L();
+    iMinValue = aStream.ReadInt32L();
+    iValue    = aStream.ReadInt32L();
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceInfoFieldValueEnumImp::EqualsContent()
+// ---------------------------------------------------------------------------
+//
+TBool CPresenceInfoFieldValueEnumImp::EqualsContent( 
+        const CXIMPApiDataObjBase& aOtherInstance ) const
+    {
+    const CPresenceInfoFieldValueEnumImp* tmp =
+        TXIMPGetImpClassOrPanic< const CPresenceInfoFieldValueEnumImp >::From( 
+                aOtherInstance.Base() );
+
+    TBool same = ETrue;
+    TBool x = iMaxValue == tmp->iMaxValue;
+    same &= x;
+
+    x = iMinValue == tmp->iMinValue;
+    same &= x;
+
+    x = iValue == tmp->iValue;
+    same &= x;
+
+    return same;
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceInfoFieldValueEnumImp::MinValue()
+// ---------------------------------------------------------------------------
+//
+TInt CPresenceInfoFieldValueEnumImp::MinValue() const
+    {
+    return iMinValue;
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceInfoFieldValueEnumImp::MaxValue()
+// ---------------------------------------------------------------------------
+//
+TInt CPresenceInfoFieldValueEnumImp::MaxValue() const
+    {
+    return iMaxValue;
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceInfoFieldValueEnumImp::Value()
+// ---------------------------------------------------------------------------
+//
+TInt CPresenceInfoFieldValueEnumImp::Value() const
+    {
+    return iValue;
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceInfoFieldValueEnumImp::SetValueL
+// ---------------------------------------------------------------------------
+//
+void CPresenceInfoFieldValueEnumImp::SetValueL( TInt aValue )
+    {
+    User::LeaveIfError( aValue > iMaxValue ? KErrOverflow : KErrNone ); 
+    User::LeaveIfError( aValue < iMinValue ? KErrUnderflow : KErrNone ); 
+
+    iValue = aValue;
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceInfoFieldValueEnumImp::SetLimits
+// ---------------------------------------------------------------------------
+//
+void CPresenceInfoFieldValueEnumImp::SetLimits( TInt aMin, TInt aMax )
+    {
+    iMinValue = aMin;
+    iMaxValue = aMax;
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresencedatamodel/presenceinfo/presenceinfofieldvalueenumimp.h	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  Implementation of presence info field enum value object.
+*
+*/
+
+#ifndef CPRESENCEINFOFIELDVALUEENUMIMP_H
+#define CPRESENCEINFOFIELDVALUEENUMIMP_H
+
+#include <e32std.h>
+#include <s32strm.h> // RWriteStream, RReadStream
+#include <ximpbase.h>
+#include <ximpdatamodelifids.hrh>
+#include "ximpapidataobjbase.h"
+#include "presenceapiobjbase.h"
+#include "presenceinfofieldvalueenum.h"
+
+
+/**
+ * Implementation of presence info field enum value object.
+ *
+ *
+ *
+ *
+ * @ingroup ximpdatamodelapi
+ * @since S60 v3.2
+ */
+NONSHARABLE_CLASS( CPresenceInfoFieldValueEnumImp ): public CXIMPApiDataObjBase, 
+    public MPresenceInfoFieldValueEnum
+    {
+public:
+
+    /** The class ID. */
+    enum { KClassId = PRIMP_CLSID_CPRESENCEINFOFIELDVALUEENUMIMP };
+
+public:
+
+    /**
+     * @param aMaxLength KXIMPFieldValueLengthUnlimited to not enforce
+     * length limits
+     */
+    IMPORT_C static CPresenceInfoFieldValueEnumImp* NewLC();
+
+    virtual ~CPresenceInfoFieldValueEnumImp();
+
+private:
+
+    CPresenceInfoFieldValueEnumImp();
+
+    void ConstructL();
+
+    /**
+     * @see CXIMPApiDataObjBase
+     */
+    XIMPIMP_DECLARE_DATAOBJ_BASE_PRIV_METHODS
+
+public: // From MXIMPBase
+
+    /**
+     * Implementation of MXIMPBase interface methods
+     * @see MXIMPBase
+     */
+    XIMPIMP_DECLARE_IF_BASE_METHODS
+
+    /**
+     * @see CXIMPApiDataObjBase
+     */
+    XIMPIMP_DECLARE_DATAOBJ_BASE_METHODS
+
+public: // New functions
+
+    /**
+     * Internalizes object data from given stream.
+     * @param aStream Stream to read.
+     */
+    IMPORT_C void InternalizeL( RReadStream& aStream );
+
+
+public: // from MPresenceInfoFieldValueEnum
+
+    /**
+     * @see MPresenceInfoFieldValueEnum
+     */
+    TInt MinValue() const;
+    TInt MaxValue() const;
+    TInt Value() const;
+    void SetValueL( TInt aValue );
+    void SetLimits( TInt aMin, TInt aMax );
+
+private: // data
+
+    // maximum allowed value
+    TInt iMaxValue;
+
+    // minimum allowed value
+    TInt iMinValue;
+
+    // actual value
+    TInt iValue;
+    };
+
+#endif // CPRESENCEINFOFIELDVALUEENUMIMP_H
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresencedatamodel/presenceinfo/presenceinfofieldvaluetextimp.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,172 @@
+/*
+* 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:  MPresenceInfoFieldValueText API object implementation.
+ *
+*/
+
+
+#include "presenceinfofieldvaluetextimp.h"
+#include "presenceinfofieldvaluetext.h"
+#include "ximprbufhelpers.h"
+#include "ximpobjecthelpers.h"
+#include "presenceinfo.h"
+
+// ============================ MEMBER FUNCTIONS =============================
+
+// ---------------------------------------------------------------------------
+// CPresenceInfoFieldValueTextImp::NewLC()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CPresenceInfoFieldValueTextImp* CPresenceInfoFieldValueTextImp::NewLC(
+        TInt aMaxLength /* = NPresenceInfo::KValueLengthUnlimited */
+        )
+    {
+    CPresenceInfoFieldValueTextImp* self = new ( ELeave ) CPresenceInfoFieldValueTextImp( aMaxLength );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceInfoFieldValueTextImp::NewFromStreamLC()
+// ---------------------------------------------------------------------------
+//
+XIMPIMP_IMPLEMENT_DATAOBJ_NEWFROMSTREAM( CPresenceInfoFieldValueTextImp )
+
+// ---------------------------------------------------------------------------
+// Implement supported interface access.
+// ---------------------------------------------------------------------------
+//
+XIMPIMP_IF_BASE_GET_INTERFACE_BEGIN( CPresenceInfoFieldValueTextImp, MPresenceInfoFieldValueText )
+    XIMPIMP_IF_BASE_GET_CLASS( CXIMPApiDataObjBase, this )
+XIMPIMP_IF_BASE_GET_INTERFACE_END()
+XIMPIMP_IF_BASE_GET_CONST_INTERFACE_BEGIN( CPresenceInfoFieldValueTextImp, MPresenceInfoFieldValueText )
+    XIMPIMP_IF_BASE_GET_CONST_CLASS( CXIMPApiDataObjBase, this )
+XIMPIMP_IF_BASE_GET_INTERFACE_END()
+
+// ---------------------------------------------------------------------------
+// CPresenceInfoFieldValueTextImp::~CPresenceInfoFieldValueTextImp()
+// ---------------------------------------------------------------------------
+//
+CPresenceInfoFieldValueTextImp::~CPresenceInfoFieldValueTextImp()
+    {
+    iFieldValue.Close();
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceInfoFieldValueTextImp::CPresenceInfoFieldValueTextImp()
+// ---------------------------------------------------------------------------
+//
+CPresenceInfoFieldValueTextImp::CPresenceInfoFieldValueTextImp(
+        TInt aMaxLength )
+    {
+    iMaxLength = aMaxLength;
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceInfoFieldValueTextImp::CPresenceInfoFieldValueTextImp()
+// ---------------------------------------------------------------------------
+//
+CPresenceInfoFieldValueTextImp::CPresenceInfoFieldValueTextImp()
+    {
+    // nothing
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceInfoFieldValueTextImp::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void CPresenceInfoFieldValueTextImp::ConstructL()
+    {
+    // always allocate a 0-length here, then in the setter enforce
+    // the maximal length
+    iFieldValue.CreateL( 0 );
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceInfoFieldValueTextImp::ExternalizeL()
+// ---------------------------------------------------------------------------
+//
+void CPresenceInfoFieldValueTextImp::ExternalizeL( RWriteStream& aStream ) const
+    {
+    XIMPRBuf16Helper::ExternalizeL( iFieldValue, aStream );
+    aStream.WriteInt32L( iMaxLength );
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceInfoFieldValueTextImp::InternalizeL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CPresenceInfoFieldValueTextImp::InternalizeL( RReadStream& aStream )
+    {
+    XIMPRBuf16Helper::InternalizeL( iFieldValue, aStream );
+    iMaxLength = aStream.ReadInt32L();
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceInfoFieldValueTextImp::EqualsContent()
+// ---------------------------------------------------------------------------
+//
+TBool CPresenceInfoFieldValueTextImp::EqualsContent( 
+        const CXIMPApiDataObjBase& aOtherInstance ) const
+    {
+    const CPresenceInfoFieldValueTextImp* tmp =
+        TXIMPGetImpClassOrPanic< const CPresenceInfoFieldValueTextImp >::From( 
+                aOtherInstance.Base() );
+
+    TBool same = ETrue;
+    TBool x;
+    x = 0 == iFieldValue.Compare( tmp->iFieldValue );
+    same &= x;
+
+    x = iMaxLength == tmp->iMaxLength;
+    same &= x;
+
+    return same;
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceInfoFieldValueTextImp::MaxLength()
+// ---------------------------------------------------------------------------
+//
+TInt CPresenceInfoFieldValueTextImp::MaxLength() const
+    {
+    return iMaxLength;
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceInfoFieldValueTextImp::TextValue()
+// ---------------------------------------------------------------------------
+//
+TPtrC CPresenceInfoFieldValueTextImp::TextValue() const
+    {
+    return iFieldValue;
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceInfoFieldValueTextImp::SetTextValueL()
+// ---------------------------------------------------------------------------
+//
+void CPresenceInfoFieldValueTextImp::SetTextValueL( const TDesC& aValue )
+    {
+    // maximal length might be enforced
+    User::LeaveIfError( ( iMaxLength != NPresenceInfo::KValueLengthUnlimited ) 
+            && ( iMaxLength < aValue.Length() ) ? KErrOverflow : KErrNone ); 
+
+    HBufC16* tmp = aValue.AllocL();
+    iFieldValue.Close();
+    iFieldValue.Assign( tmp );
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresencedatamodel/presenceinfo/presenceinfofieldvaluetextimp.h	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  Implementation of presence info field text value object.
+*
+*/
+
+#ifndef CPRESENCEINFOFIELDVALUETEXTIMP_H
+#define CPRESENCEINFOFIELDVALUETEXTIMP_H
+
+#include <e32std.h>
+#include <s32strm.h> // RWriteStream, RReadStream
+#include <ximpbase.h>
+#include <ximpdatamodelifids.hrh>
+#include "presenceinfo.h"
+#include "ximpapidataobjbase.h"
+#include "presenceapiobjbase.h"
+#include "presenceinfofieldvaluetext.h"
+
+
+/**
+ * Implementation of presence info field text value object.
+ *
+ *
+ *
+ *
+ * @ingroup ximpdatamodelapi
+ * @since S60 v3.2
+ */
+NONSHARABLE_CLASS( CPresenceInfoFieldValueTextImp ): public CXIMPApiDataObjBase, 
+    public MPresenceInfoFieldValueText
+    {
+public:
+
+    /** The class ID. */
+    enum { KClassId = PRIMP_CLSID_CPRESENCEINFOFIELDVALUETEXTIMP };
+
+public:
+
+    /**
+     * @param aMaxLength NPresenceInfo::KPrValueLengthUnlimited to not enforce
+     * length limits
+     */
+    IMPORT_C static CPresenceInfoFieldValueTextImp* NewLC(
+            TInt aMaxLength = NPresenceInfo::KValueLengthUnlimited );
+
+    virtual ~CPresenceInfoFieldValueTextImp();
+
+private:
+
+    CPresenceInfoFieldValueTextImp( TInt aMaxLength );
+    CPresenceInfoFieldValueTextImp();
+
+    void ConstructL();
+
+    /**
+     * @see CXIMPApiDataObjBase
+     */
+    XIMPIMP_DECLARE_DATAOBJ_BASE_PRIV_METHODS
+
+public: // From MXIMPBase
+
+    /**
+     * Implementation of MXIMPBase interface methods
+     * @see MXIMPBase
+     */
+    XIMPIMP_DECLARE_IF_BASE_METHODS
+
+    /**
+     * @see CXIMPApiDataObjBase
+     */
+    XIMPIMP_DECLARE_DATAOBJ_BASE_METHODS
+
+public: // New functions
+
+    /**
+     * Internalizes object data from given stream.
+     * @param aStream Stream to read.
+     */
+    IMPORT_C void InternalizeL( RReadStream& aStream );
+
+
+public: // from MPresenceInfoFieldValueText
+
+    /**
+     * @see MPresenceInfoFieldValueText
+     */
+    TInt MaxLength() const;
+
+    /**
+     * @see MPresenceInfoFieldValueText
+     */
+    TPtrC TextValue() const;
+
+    /**
+     * @see MPresenceInfoFieldValueText
+     */
+    void SetTextValueL( const TDesC& aValue );
+
+private: // data
+
+    // owned. field value
+    RBuf16 iFieldValue;
+
+    // maximum length of field value
+    TInt iMaxLength;
+    };
+
+#endif // CPRESENCEINFOFIELDVALUETEXTIMP_H
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresencedatamodel/presenceinfo/presenceinfofilterimp.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,810 @@
+/*
+* 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:  MPresenceDocument API object implementation.
+*
+*/
+
+
+#include "presenceinfofilterimp.h"
+#include "ximprbufhelpers.h"
+#include "ximpobjecthelpers.h"
+#include "presenceinfo.h"
+#include "badesca.h"
+
+const TInt KFilterGranularity = 3;
+const TInt KFieldGranularity  = 3;
+
+using namespace NPresenceInfo;
+
+// ============================ LOCAL FUNCTIONS ==============================
+
+// ============================ HELPER CLASS =================================
+
+// ---------------------------------------------------------------------------
+// CFilterField::NewL
+// ---------------------------------------------------------------------------
+//
+CPresenceInfoFilterImp::CFilterField* 
+CPresenceInfoFilterImp::CFilterField::NewL(
+        const TDesC8& aInfoName )
+    {
+    CFilterField* self = new ( ELeave ) CFilterField();
+    CleanupStack::PushL( self );
+    self->ConstructL( aInfoName );
+    CleanupStack::Pop( self ); 
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CFilterField::NewLC
+// ---------------------------------------------------------------------------
+//
+CPresenceInfoFilterImp::CFilterField* 
+CPresenceInfoFilterImp::CFilterField::NewLC()
+    {
+    CFilterField* self = new ( ELeave ) CFilterField();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CFilterField::ConstructL
+// ---------------------------------------------------------------------------
+//
+void CPresenceInfoFilterImp::CFilterField::ConstructL(
+        const TDesC8& aInfoName )
+    {
+    HBufC8* tmp = aInfoName.AllocL();
+    iInfoName.Assign( tmp );
+    
+    iFieldNames = new ( ELeave ) CDesC8ArraySeg( KFieldGranularity ); 
+    }
+
+// ---------------------------------------------------------------------------
+// CFilterField::ConstructL
+// ---------------------------------------------------------------------------
+//
+void CPresenceInfoFilterImp::CFilterField::ConstructL()
+    {
+    iInfoName.CreateL( 0 );
+    iFieldNames = new ( ELeave ) CDesC8ArraySeg( KFieldGranularity ); 
+    }
+
+// ---------------------------------------------------------------------------
+// CFilterField::CFilterField
+// ---------------------------------------------------------------------------
+//
+CPresenceInfoFilterImp::CFilterField::CFilterField() 
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// CFilterField::~CFilterField
+// ---------------------------------------------------------------------------
+//
+CPresenceInfoFilterImp::CFilterField::~CFilterField()
+    {
+    iInfoName.Close();
+    delete iFieldNames;
+    }
+
+// ---------------------------------------------------------------------------
+// CFilterField::InfoName
+// ---------------------------------------------------------------------------
+//
+const TDesC8& CPresenceInfoFilterImp::CFilterField::InfoName()
+    {
+    return iInfoName;
+    }
+
+// ---------------------------------------------------------------------------
+// CFilterField::AddFieldNameL
+// ---------------------------------------------------------------------------
+//
+void CPresenceInfoFilterImp::CFilterField::AddFieldNameL(
+        const TDesC8& aFieldName )
+    {
+    iFieldNames->InsertIsqL( aFieldName );
+    }
+
+// ---------------------------------------------------------------------------
+// CFilterField::OrderOfFields()
+// ---------------------------------------------------------------------------
+//
+TInt CPresenceInfoFilterImp::CFilterField::OrderOfFields( 
+        const CFilterField& aFirst, 
+        const CFilterField& aSecond )
+    {
+    // order is based on the info name
+    return aFirst.iInfoName.Compare( aSecond.iInfoName );
+    }
+
+// ---------------------------------------------------------------------------
+// CFilterField::OrderOfFieldsByName()
+// ---------------------------------------------------------------------------
+//
+TInt CPresenceInfoFilterImp::CFilterField::OrderOfFieldsByName( 
+        const TDesC8* aName, 
+        const CFilterField& aSecond )
+    {
+    return aName->Compare( aSecond.iInfoName );
+    }
+
+// ---------------------------------------------------------------------------
+// CFilterField::ExternalizeL
+// ---------------------------------------------------------------------------
+//
+void CPresenceInfoFilterImp::CFilterField::ExternalizeL(
+        RWriteStream& aStream ) const
+    {
+    XIMPRBuf8Helper::ExternalizeL( iInfoName, aStream );
+    
+    aStream.WriteInt32L( iFieldNames->Count() );
+
+    for ( TInt i = 0; i < iFieldNames->Count(); i++ )
+        {
+        TPtrC8 p = iFieldNames->MdcaPoint( i );
+        aStream.WriteInt32L( p.Length() );
+        aStream.WriteL( p );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CFilterField::InternalizeL
+// ---------------------------------------------------------------------------
+//
+void CPresenceInfoFilterImp::CFilterField::InternalizeL(
+        RReadStream& aStream ) 
+    {
+    XIMPRBuf8Helper::InternalizeL( iInfoName, aStream );
+
+    TInt count = aStream.ReadInt32L();
+    for ( TInt i = 0; i < count; i++ )
+        {
+        TInt length = aStream.ReadInt32L();
+        HBufC8* buf = HBufC8::NewLC( length );
+
+        TPtr8 des = TPtr8( buf->Des() );
+        aStream.ReadL( des, length );
+        iFieldNames->InsertIsqL( *buf );
+
+        CleanupStack::PopAndDestroy( buf );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CFilterField::MergeL
+// ---------------------------------------------------------------------------
+//
+void CPresenceInfoFilterImp::CFilterField::MergeL( CFilterField& aOtherField ) 
+    {
+    // merge algorithm:
+    // add all field names from given filter field, ignoring duplicates 
+    
+    for ( TInt i = 0; i < iFieldNames->Count(); i++ )
+        {
+        TInt pos = 0;
+        TInt ret = iFieldNames->FindIsq( aOtherField.iFieldNames->MdcaPoint( i ), pos );
+
+        if ( 0 != ret )
+            {
+            iFieldNames->InsertIsqL( aOtherField.iFieldNames->MdcaPoint( i ) );
+            }
+        }
+    }
+    
+// ---------------------------------------------------------------------------
+// CFilterField::operator==
+// ---------------------------------------------------------------------------
+//
+TBool CPresenceInfoFilterImp::CFilterField::operator==( const CFilterField& aSource )
+    {
+    if( iInfoName.Compare( aSource.iInfoName ) != 0 )
+        {
+        return EFalse;
+        }
+    TInt count = iFieldNames->Count();
+    if( count != aSource.iFieldNames->Count() )
+        {
+        return EFalse;
+        }
+        
+    for ( TInt i = 0; i < count; i++ )
+        {
+        if( iFieldNames->MdcaPoint( i ).Compare( aSource.iFieldNames->MdcaPoint( i ) ) != 0 )
+            {
+            return EFalse;
+            }
+        }
+    return ETrue;
+    }    
+
+// ---------------------------------------------------------------------------
+// CFilterField::operator!=
+// ---------------------------------------------------------------------------
+//
+TBool CPresenceInfoFilterImp::CFilterField::operator!=( const CFilterField& aSource )
+    {
+    return !( *this == aSource );
+    }    
+
+// ============================ MEMBER FUNCTIONS =============================
+
+// ---------------------------------------------------------------------------
+// CPresenceInfoFilterImp::NewLC()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CPresenceInfoFilterImp* CPresenceInfoFilterImp::NewLC()
+    {
+    CPresenceInfoFilterImp* self = new( ELeave ) CPresenceInfoFilterImp;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceInfoFilterImp::NewL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CPresenceInfoFilterImp* CPresenceInfoFilterImp::NewL()
+    {
+    CPresenceInfoFilterImp* self = NewLC();
+    CleanupStack::Pop( self );
+    return self;
+    }
+// ---------------------------------------------------------------------------
+// CPresenceInfoImp::NewFromStreamLC()
+// ---------------------------------------------------------------------------
+//
+XIMPIMP_IMPLEMENT_DATAOBJ_NEWFROMSTREAM( CPresenceInfoFilterImp )
+
+// ---------------------------------------------------------------------------
+// Implement supported interface access.
+// ---------------------------------------------------------------------------
+//
+XIMPIMP_IF_BASE_GET_INTERFACE_BEGIN( CPresenceInfoFilterImp, 
+                                     MPresenceInfoFilter )
+XIMPIMP_IF_BASE_GET_INTERFACE_END()
+
+
+XIMPIMP_IF_BASE_GET_CONST_INTERFACE_BEGIN( CPresenceInfoFilterImp, 
+                                           MPresenceInfoFilter )
+XIMPIMP_IF_BASE_GET_INTERFACE_END()
+
+// ---------------------------------------------------------------------------
+// CPresenceInfoFilterImp::EqualsContent()
+// ---------------------------------------------------------------------------
+//
+TBool CPresenceInfoFilterImp::EqualsContent( 
+    const CXIMPApiDataObjBase& aOtherInstance ) const
+    {
+    const CPresenceInfoFilterImp* tmp =
+        TXIMPGetImpClassOrPanic< const CPresenceInfoFilterImp >::From( aOtherInstance.Base() );
+
+    TInt count = iPersonFilter->Count();
+    if( count != tmp->iPersonFilter->Count() )
+        {
+        return EFalse;
+        }
+        
+    for ( TInt i = 0; i < count; i++ )
+        {
+        if( iPersonFilter->MdcaPoint( i ).Compare( tmp->iPersonFilter->MdcaPoint( i ) ) != 0 )
+            {
+            return EFalse;
+            }
+        }
+        
+    count = iServiceFilter.Count();
+    if( count != tmp->iServiceFilter.Count() )
+        {
+        return EFalse;
+        }
+        
+    for( TInt a = 0; a < count; ++a )
+        {
+        if( iServiceFilter[ a ] != tmp->iServiceFilter[ a ] )
+            {
+            return EFalse;
+            }
+        }
+        
+    count = iDeviceFilter.Count();
+    if( count != tmp->iDeviceFilter.Count() )
+        {
+        return EFalse;
+        }
+        
+    for( TInt a = 0; a < count; ++a )
+        {
+        if( iDeviceFilter[ a ] != tmp->iDeviceFilter[ a ] )
+            {
+            return EFalse;
+            }
+        }
+    return ETrue;        
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceInfoFilterImp::CPresenceInfoFilterImp()
+// ---------------------------------------------------------------------------
+//
+CPresenceInfoFilterImp::CPresenceInfoFilterImp()
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// CPresenceInfoFilterImp::~CPresenceInfoFilterImp()
+// ---------------------------------------------------------------------------
+//
+CPresenceInfoFilterImp::~CPresenceInfoFilterImp()
+    {
+    delete iPersonFilter;
+    iServiceFilter.ResetAndDestroy();
+    iDeviceFilter.ResetAndDestroy();
+    }
+
+
+
+// ---------------------------------------------------------------------------
+// CPresenceInfoFilterImp::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void CPresenceInfoFilterImp::ConstructL()
+    {
+    iPersonFilter = new ( ELeave ) CDesC8ArraySeg( KFilterGranularity );
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceInfoFilterImp::ExternalizeArrayL()
+// ---------------------------------------------------------------------------
+//
+void CPresenceInfoFilterImp::ExternalizeArrayL( 
+        const CDesC8ArraySeg* aArray, RWriteStream& aStream ) const
+    {
+    aStream.WriteInt32L( aArray->Count() );
+
+    for ( TInt i = 0; i < aArray->Count(); i++ )
+        {
+        TPtrC8 p = aArray->MdcaPoint( i );
+        aStream.WriteInt32L( p.Length() );
+        aStream.WriteL( p );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceInfoFilterImp::ExternalizeFieldSetL
+// ---------------------------------------------------------------------------
+//
+void CPresenceInfoFilterImp::ExternalizeFieldSetL(
+        const RXIMPObjOwningPtrArray<CFilterField>& aFieldSet,
+        RWriteStream& aStream
+        ) const
+    {
+    TInt count = aFieldSet.Count();
+
+    aStream.WriteInt32L( count );
+    for ( TInt i = 0; i < count; i++ )
+        {
+        CFilterField* field = aFieldSet[ i ];
+        field->ExternalizeL( aStream );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceInfoFilterImp::InternalizeFieldSetL
+// ---------------------------------------------------------------------------
+//
+void CPresenceInfoFilterImp::InternalizeFieldSetL(
+        RXIMPObjOwningPtrArray<CFilterField>& aFieldSet,
+        RReadStream& aStream
+        )
+    {
+    TInt count = aStream.ReadInt32L();
+
+    for ( TInt i = 0; i < count; i++ )
+        {
+        CFilterField* field = CFilterField::NewLC();
+        field->InternalizeL( aStream );
+        aFieldSet.AppendL( field );
+        CleanupStack::Pop( field );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceInfoFilterImp::ExternalizeL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CPresenceInfoFilterImp::ExternalizeL( RWriteStream& aStream ) const
+    {
+    ExternalizeArrayL( iPersonFilter, aStream );
+    ExternalizeFieldSetL( iServiceFilter, aStream );
+    ExternalizeFieldSetL( iDeviceFilter, aStream );
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceInfoFilterImp::InternalizeArrayL()
+// ---------------------------------------------------------------------------
+//
+void CPresenceInfoFilterImp::InternalizeArrayL( 
+        CDesC8ArraySeg* aArray, RReadStream& aStream )
+    {
+    TInt count = aStream.ReadInt32L();
+    for ( TInt i = 0; i < count; i++ )
+        {
+        TInt length = aStream.ReadInt32L();
+
+        HBufC8* buf = HBufC8::NewLC( length );
+
+        TPtr8 des = TPtr8( buf->Des() );
+        aStream.ReadL( des, length );
+        aArray->InsertIsqL( des );
+
+        CleanupStack::PopAndDestroy( buf );
+        }
+    }
+
+
+// ---------------------------------------------------------------------------
+// CPresenceInfoFilterImp::InternalizeL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CPresenceInfoFilterImp::InternalizeL( RReadStream& aStream )
+    {
+    InternalizeArrayL( iPersonFilter, aStream );
+    InternalizeFieldSetL( iServiceFilter, aStream );
+    InternalizeFieldSetL( iDeviceFilter, aStream );
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceInfoFilterImp::ContainsPersonFilter
+// ---------------------------------------------------------------------------
+//
+TBool CPresenceInfoFilterImp::ContainsPersonFilter(
+        CDesC8ArraySeg* aA,
+        CDesC8ArraySeg* aCompare 
+        )
+    {
+    TInt count = aCompare->Count();
+    if ( count >= aA->Count() )
+        {
+        // impossible to be contained
+        return EFalse;
+        }
+
+    for ( TInt i = 0; i < count; i++ )
+        {
+        // all person filter strings in aCompare MUST be found in this class
+        TInt pos = 0;
+        if( 0 != aA->FindIsq( aCompare->MdcaPoint( i ), pos ) )
+            {
+            // element not contained within "this", so whole filter not contained
+            return EFalse;
+            }
+        }
+
+    return ETrue;
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceInfoFilterImp::ContainsFilterFields
+// ---------------------------------------------------------------------------
+//
+TBool CPresenceInfoFilterImp::ContainsFilterFields(
+        RXIMPObjOwningPtrArray<CFilterField>& aA,
+        RXIMPObjOwningPtrArray<CFilterField>& aCompare 
+        )
+    {
+    // check all filter fields
+    TInt count = aCompare.Count();
+    if ( count >= aA.Count() )
+        {
+        // impossible for "aCompare" to be contained, has more fields
+        return EFalse;
+        }
+
+    for( TInt i = 0; i < count; i++ )
+        {
+        // all filters in aCompare MUST be found in this class.
+        // first check for the named filter field class
+        TInt pos = 0;
+        pos = aA.FindInOrder( 
+                aCompare[ i ]->InfoName(), 
+                CFilterField::OrderOfFieldsByName );
+
+        if ( KErrNotFound == pos )
+            {
+            // element not contained within "aA", so whole filter not contained
+            return EFalse;
+            }
+
+        // now the subfields in the filter field class
+        TInt countFields = aCompare[ i ]->iFieldNames->MdcaCount();
+        if ( countFields >= aA[ pos ]->iFieldNames->MdcaCount() )
+            {
+            // impossible to be contained
+            return EFalse;
+            }
+
+        for ( TInt j = 0; j < countFields; j++ )
+            {
+            TInt dummyPos = 0;
+            if ( aA[ pos ]->iFieldNames->FindIsq( aCompare[ i ]->iFieldNames->MdcaPoint( j ), dummyPos ) )
+                {
+                // field not contained within "aA", so whole
+                // filter not contained
+                return EFalse;
+                }
+            }
+        }
+
+    return ETrue;
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceInfoFilterImp::Contains
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TBool CPresenceInfoFilterImp::Contains( CPresenceInfoFilterImp& aCompare )
+    {
+    // walk through all filters in aCompare,
+    // if a filter is NOT found in this class --> not contained
+    // if all filters are found in this class --> contained
+
+    // person filter
+    if ( ! ContainsPersonFilter( iPersonFilter, aCompare.iPersonFilter ) )
+        {
+        return EFalse;
+        }
+
+    // service filter
+    if ( ! ContainsFilterFields( iServiceFilter, aCompare.iServiceFilter ) )
+        {
+        return EFalse;
+        }
+
+    // device filter
+    if ( ! ContainsFilterFields( iDeviceFilter, aCompare.iDeviceFilter ) )
+        {
+        return EFalse;
+        }
+
+    return ETrue;
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceInfoFilterImp::operator==
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TBool CPresenceInfoFilterImp::operator==( CPresenceInfoFilterImp& aSource )
+    {
+    return EqualsContent( aSource );
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceInfoFilterImp::operator!=
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TBool CPresenceInfoFilterImp::operator!=( CPresenceInfoFilterImp& aSource )
+    {
+    return !EqualsContent( aSource );
+    }
+
+
+// ---------------------------------------------------------------------------
+// CPresenceInfoFilterImp::AcceptPersonFilterL
+// ---------------------------------------------------------------------------
+//
+void CPresenceInfoFilterImp::AcceptPersonFilterL( const TDesC8& aFieldName )
+    {
+    if ( !aFieldName.Compare( NPresenceInfo::NFieldType::KAcceptAll  ) )
+        {
+        iPersonFilter->InsertIsqL( NPresenceInfo::NFieldType::KStatusMessage );
+        iPersonFilter->InsertIsqL( NPresenceInfo::NFieldType::KAvatar );
+        iPersonFilter->InsertIsqL( NPresenceInfo::NFieldType::KAvailability );
+        }
+    else
+        {
+    iPersonFilter->InsertIsqL( aFieldName );
+    }
+    }
+    
+// ---------------------------------------------------------------------------
+// CPresenceInfoFilterImp::AcceptFilterL
+// ---------------------------------------------------------------------------
+//
+void CPresenceInfoFilterImp::AcceptFilterL( 
+            RXIMPObjOwningPtrArray< CFilterField >& aFieldSet,
+            const TDesC8& aInfoName,
+            const TDesC8& aFieldName )
+    {
+    TLinearOrder< CPresenceInfoFilterImp::CFilterField > order( 
+            CPresenceInfoFilterImp::CFilterField::OrderOfFields );
+
+    CFilterField* field = CFilterField::NewL( aInfoName );
+    CleanupStack::PushL( field );
+    field->iFieldNames->InsertIsqL( aFieldName );
+    aFieldSet.InsertInOrderL( field, order );
+    CleanupStack::Pop( field );
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceInfoFilterImp::AcceptServiceFilterL
+// ---------------------------------------------------------------------------
+//
+void CPresenceInfoFilterImp::AcceptServiceFilterL( 
+            const TDesC8& aServiceName,
+            const TDesC8& aFieldName )
+    {
+    AcceptFilterL( iServiceFilter, aServiceName, aFieldName );
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceInfoFilterImp::AcceptDeviceFilterL
+// ---------------------------------------------------------------------------
+//
+void CPresenceInfoFilterImp::AcceptDeviceFilterL( 
+            const TDesC8& aDeviceName,
+            const TDesC8& aFieldName )
+    {
+    AcceptFilterL( iDeviceFilter, aDeviceName, aFieldName );
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceInfoFilterImp::MatchPersonFilter
+// ---------------------------------------------------------------------------
+//
+TBool CPresenceInfoFilterImp::MatchPersonFilter( 
+        const TDesC8& aFieldName ) const
+    {
+    TBool found = EFalse;
+    for ( TInt i = 0; i < iPersonFilter->Count() && ! found; i++ )
+        {
+        if ( KErrNotFound != ( iPersonFilter->MdcaPoint( i ).Match( aFieldName ) ) )
+            {
+            // found it
+            return ETrue;
+            }
+        }
+
+    return EFalse;
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceInfoFilterImp::MatchFilterL
+// ---------------------------------------------------------------------------
+//
+TBool CPresenceInfoFilterImp::MatchFilterL(
+        const RXIMPObjOwningPtrArray< CFilterField >& aFieldSet, 
+        const TDesC8& aInfoName,
+        const TDesC8& aFieldName ) const
+    {
+    CFilterField* candidate = CFilterField::NewL( aInfoName );
+    CleanupStack::PushL( candidate );
+
+    TBool foundMatch = EFalse;
+
+    // walk through all fields. slow algo! use a hash to index the field set.
+    for ( TInt j = 0; j < aFieldSet.Count(); j++ )
+        {
+        // now, go through all fields in service filter which match 
+        // the candidate
+        CFilterField* field = aFieldSet[ j ];
+
+        if ( KErrNotFound != aInfoName.Match( field->iInfoName ) )
+            {
+            // field name matches, so try to find the types
+
+            for ( TInt i = 0; i < field->iFieldNames->Count(); i++ )
+                {
+                TBool found = ( KErrNotFound != aFieldName.Match( field->iFieldNames->MdcaPoint( i ) ) )
+                    ? ETrue : EFalse;
+                foundMatch |= found;
+                }
+            }
+        }
+    CleanupStack::PopAndDestroy( candidate );
+
+    return foundMatch;
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceInfoFilterImp::MatchServiceFilter
+// ---------------------------------------------------------------------------
+//
+TBool CPresenceInfoFilterImp::MatchServiceFilterL( 
+        const TDesC8& aServiceName,
+        const TDesC8& aFieldName ) const
+    {
+    return MatchFilterL( iServiceFilter, aServiceName, aFieldName );
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceInfoFilterImp::MatchDeviceFilterL
+// ---------------------------------------------------------------------------
+//
+TBool CPresenceInfoFilterImp::MatchDeviceFilterL(
+        const TDesC8& aDeviceName,
+        const TDesC8& aFieldName ) const
+    {
+    return MatchFilterL( iDeviceFilter, aDeviceName, aFieldName );
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceInfoFilterImp::UnionL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CPresenceInfoFilterImp* CPresenceInfoFilterImp::UnionL( 
+        CPresenceInfoFilterImp& aFirst,
+        CPresenceInfoFilterImp& aSecond )
+    {
+    CPresenceInfoFilterImp* cloned = TXIMPObjectCloner< CPresenceInfoFilterImp >::CloneLC( aFirst );
+
+    // union of the person filters - must not add duplicates
+    for ( TInt i = 0; i < aSecond.iPersonFilter->Count(); i++ )
+        {
+        TInt pos = 0;
+        TInt ret = cloned->iPersonFilter->FindIsq( aSecond.iPersonFilter->MdcaPoint( i ), pos );
+
+        if ( 0 != ret )
+            {
+            cloned->iPersonFilter->InsertIsqL( aSecond.iPersonFilter->MdcaPoint( i ) );
+            }
+        }
+
+    // union of service fields
+    aFirst.UnionOfFieldsL( aSecond.iServiceFilter, cloned->iServiceFilter );
+
+    // union of device fields
+    aFirst.UnionOfFieldsL( aSecond.iDeviceFilter, cloned->iDeviceFilter );
+
+    CleanupStack::Pop( cloned );
+    return cloned;
+    }
+    
+// ---------------------------------------------------------------------------
+// CPresenceInfoFilterImp::UnionOfFieldsL
+// ---------------------------------------------------------------------------
+//
+void CPresenceInfoFilterImp::UnionOfFieldsL( 
+            RXIMPObjOwningPtrArray< CFilterField>& aSource, 
+            RXIMPObjOwningPtrArray< CFilterField>& aTarget )
+    {
+    TLinearOrder< CPresenceInfoFilterImp::CFilterField > order( 
+            CPresenceInfoFilterImp::CFilterField::OrderOfFields );
+
+    for ( TInt i = 0; i < aSource.Count(); i++ )
+        {
+        CFilterField* field = aSource[ i ];
+
+        // if the field name exists in the target, merge the fields
+        TInt pos = aTarget.FindInOrder( field, order );
+        if ( pos == KErrNotFound )
+            {
+            // not found, insert the non-found one as a copy
+            CFilterField* newField = TXIMPObjectCloner< CFilterField >::CloneLC( *field );
+            aTarget.InsertInOrder( newField, order );
+            CleanupStack::Pop( newField );
+            }
+        else
+            {
+            // found one, merge them to the cloned one
+            aTarget[ pos ]->MergeL( *field );
+            }
+        }
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresencedatamodel/presenceinfo/presenceinfoimp.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,354 @@
+/*
+* 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:  MPresenceDocument API object implementation.
+*
+*/
+
+#include "presenceinfoimp.h"
+#include "personpresenceinfoimp.h"
+#include "servicepresenceinfoimp.h"
+#include "devicepresenceinfoimp.h"
+#include "presenceapidataobjfactory.h"
+#include "presencetypehelpers.h"
+#include "ximpobjecthelpers.h"
+#include "presenceinfofilterimp.h"
+
+// ============================ MEMBER FUNCTIONS =============================
+
+// ---------------------------------------------------------------------------
+// CPresenceInfoImp::NewLC()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CPresenceInfoImp* CPresenceInfoImp::NewLC()
+    {
+    CPresenceInfoImp* self = new( ELeave ) CPresenceInfoImp;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CPresenceInfoImp::NewL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CPresenceInfoImp* CPresenceInfoImp::NewL()
+    {
+    CPresenceInfoImp* self = NewLC();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CPresenceInfoImp::~CPresenceInfoImp()
+// ---------------------------------------------------------------------------
+//
+CPresenceInfoImp::~CPresenceInfoImp()
+    {
+    delete iPersonPresence;
+    iServicePresences.ResetAndDestroy();
+    iDevicePresences.ResetAndDestroy();
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceInfoImp::CPresenceInfoImp()
+// ---------------------------------------------------------------------------
+//
+CPresenceInfoImp::CPresenceInfoImp()
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// CPresenceInfoImp::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void CPresenceInfoImp::ConstructL()
+    {
+    iPersonPresence = CPersonPresenceInfoImp::NewLC();
+    CleanupStack::Pop( iPersonPresence );
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceInfoImp::NewFromStreamLC()
+// ---------------------------------------------------------------------------
+//
+XIMPIMP_IMPLEMENT_DATAOBJ_NEWFROMSTREAM( CPresenceInfoImp )
+
+
+// ---------------------------------------------------------------------------
+// Implement supported interface access.
+// ---------------------------------------------------------------------------
+//
+XIMPIMP_IF_BASE_GET_INTERFACE_BEGIN( CPresenceInfoImp, 
+                                     MPresenceInfo )
+XIMPIMP_IF_BASE_GET_INTERFACE_END()
+
+
+XIMPIMP_IF_BASE_GET_CONST_INTERFACE_BEGIN( CPresenceInfoImp, 
+                                           MPresenceInfo )
+XIMPIMP_IF_BASE_GET_INTERFACE_END()
+
+// ---------------------------------------------------------------------------
+// CPresenceInfoImp::EqualsContent()
+// ---------------------------------------------------------------------------
+//
+TBool CPresenceInfoImp::EqualsContent( 
+    const CXIMPApiDataObjBase& aOtherInstance ) const
+    {
+    const CPresenceInfoImp* tmp =
+        TXIMPGetImpClassOrPanic< const CPresenceInfoImp >::From( aOtherInstance.Base() );
+
+    TBool same = ETrue;
+    TBool x = iPersonPresence->EqualsContent( *tmp->iPersonPresence );
+    same &= x;
+    
+    x = TXIMPEqualsContent< CServicePresenceInfoImp >::Array( iServicePresences, tmp->iServicePresences );
+    same &= x;
+
+    x = TXIMPEqualsContent< CDevicePresenceInfoImp >::Array( iDevicePresences, tmp->iDevicePresences );
+    same &= x;
+    
+    return same;
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceInfoImp::ExternalizeL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CPresenceInfoImp::ExternalizeL( RWriteStream& aStream ) const
+    {
+    iPersonPresence->ExternalizeL( aStream );
+
+    CPresenceApiDataObjFactory::ExternalizeL< CServicePresenceInfoImp >
+        ( aStream, iServicePresences );
+
+    CPresenceApiDataObjFactory::ExternalizeL< CDevicePresenceInfoImp >
+        ( aStream, iDevicePresences );
+    }
+
+
+// ---------------------------------------------------------------------------
+// CPresenceInfoImp::InternalizeL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CPresenceInfoImp::InternalizeL( RReadStream& aStream )
+    {
+    CPersonPresenceInfoImp* tmp = CPersonPresenceInfoImp::NewLC();
+    tmp->InternalizeL( aStream );
+    delete iPersonPresence;
+    iPersonPresence = tmp;
+    CleanupStack::Pop( tmp );
+
+    iServicePresences.ResetAndDestroy();
+    CPresenceApiDataObjFactory::InternalizeL< CServicePresenceInfoImp >
+        ( aStream, iServicePresences );
+    
+    iDevicePresences.ResetAndDestroy();
+    CPresenceApiDataObjFactory::InternalizeL< CDevicePresenceInfoImp >
+        ( aStream, iDevicePresences );
+    }
+    
+
+// ---------------------------------------------------------------------------
+// From MPresenceInfo class.
+// CPresenceInfoImp::PersonPresence()
+// ---------------------------------------------------------------------------
+//
+const MPersonPresenceInfo* CPresenceInfoImp::PersonPresence() const
+    {
+    return iPersonPresence;
+    }
+    
+// ---------------------------------------------------------------------------
+// From MPresenceInfo class.
+// CPresenceInfoImp::PersonPresence()
+// ---------------------------------------------------------------------------
+//
+MPersonPresenceInfo* CPresenceInfoImp::PersonPresence()
+    {
+    return iPersonPresence;
+    }    
+
+
+// ---------------------------------------------------------------------------
+// From MPresenceInfo class.
+// CPresenceInfoImp::SetPersonPresenceL()
+// ---------------------------------------------------------------------------
+//
+void CPresenceInfoImp::SetPersonPresenceL( 
+    MPersonPresenceInfo* aPersonPresence )
+    {
+    User::LeaveIfError( aPersonPresence == NULL ? KErrArgument : KErrNone );
+
+    CPersonPresenceInfoImp* personPresenceImp =
+    TXIMPGetImpClassOrPanic< CPersonPresenceInfoImp >::From( *aPersonPresence );
+    
+    delete iPersonPresence;
+    iPersonPresence = personPresenceImp;
+    }
+
+
+// ---------------------------------------------------------------------------
+// From MPresenceInfo class.
+// CPresenceInfoImp::ServicePresenceCount()
+// ---------------------------------------------------------------------------
+//
+TInt CPresenceInfoImp::ServicePresenceCount() const
+    {
+    return iServicePresences.Count();
+    }
+    
+
+// ---------------------------------------------------------------------------
+// From MPresenceInfo class.
+// CPresenceInfoImp::ServicePresenceAt()
+// ---------------------------------------------------------------------------
+//
+const MServicePresenceInfo& CPresenceInfoImp::ServicePresenceAt(
+    TInt aIndex ) const
+    {
+    return *iServicePresences[ aIndex ];    
+    }
+
+
+// ---------------------------------------------------------------------------
+// From MPresenceInfo class.
+// CPresenceInfoImp::LookupServicePresenceByServiceType()
+// ---------------------------------------------------------------------------
+//
+void CPresenceInfoImp::LookupServicePresenceByServiceType( 
+    MServicePresenceInfo*& aServicePresence,
+    const TDesC8& aMatch ) const
+    {
+    TInt start = KErrNotFound;
+
+    // search from start
+    if ( aServicePresence )
+        {
+        TBool found = EFalse;
+        for ( TInt i = 0; ( i < iServicePresences.Count() ) && ( ! found ); i++ )
+            {
+            CXIMPApiDataObjBase* gotObj = TXIMPGetImpClassOrPanic< CXIMPApiDataObjBase >::From( *aServicePresence );
+            CXIMPApiDataObjBase* obj = iServicePresences[ i ];
+            if ( &(gotObj->Base()) == &(obj->Base()) )
+                {
+                found = ETrue;
+                start = i;
+                }
+            }
+        }
+
+    start = start == KErrNotFound ? 0 : start;
+    aServicePresence = NULL;
+
+    for ( TInt i = start; i < iServicePresences.Count(); i++ )
+        {
+        CServicePresenceInfoImp* srvInfo = iServicePresences[ i ];
+
+        if ( KErrNotFound != srvInfo->ServiceType().MatchF( aMatch ) )
+            {
+            // found match, return it
+            aServicePresence = srvInfo;
+            return;
+            }
+        }
+    }
+
+
+// ---------------------------------------------------------------------------
+// From MPresenceInfo class.
+// CPresenceInfoImp::AddServicePresenceL()
+// ---------------------------------------------------------------------------
+//
+void CPresenceInfoImp::AddServicePresenceL( 
+    MServicePresenceInfo* aServicePresence )
+    {
+    User::LeaveIfError( aServicePresence == NULL ? KErrArgument : KErrNone );
+    
+    CServicePresenceInfoImp* servicePresenceImp =
+    TXIMPGetImpClassOrPanic< CServicePresenceInfoImp >::From( *aServicePresence );
+
+    iServicePresences.AppendL( servicePresenceImp );
+    }
+
+
+// ---------------------------------------------------------------------------
+// From MPresenceInfo class.
+// CPresenceInfoImp::DevicePresenceCount()
+// ---------------------------------------------------------------------------
+//
+TInt CPresenceInfoImp::DevicePresenceCount() const
+    {
+    return iDevicePresences.Count();
+    }
+
+
+// ---------------------------------------------------------------------------
+// From MPresenceInfo class.
+// CPresenceInfoImp::DevicePresenceAt()
+// ---------------------------------------------------------------------------
+//
+const MDevicePresenceInfo& CPresenceInfoImp::DevicePresenceAt(
+    TInt aIndex ) const
+    {
+    return *iDevicePresences[ aIndex ];
+    }
+        
+
+// ---------------------------------------------------------------------------
+// From MPresenceInfo class.
+// CPresenceInfoImp::AddDevicePresenceL()
+// ---------------------------------------------------------------------------
+//
+void CPresenceInfoImp::AddDevicePresenceL( 
+    MDevicePresenceInfo* aDevicePresence )
+    {
+    User::LeaveIfError( aDevicePresence == NULL ? KErrArgument : KErrNone );
+
+    CDevicePresenceInfoImp* devicePresenceImp =
+    TXIMPGetImpClassOrPanic< CDevicePresenceInfoImp >::From( *aDevicePresence );
+
+    iDevicePresences.AppendL( devicePresenceImp );
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceInfoImp::FilteredInfoLC()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CPresenceInfoImp* CPresenceInfoImp::FilteredInfoLC(
+        const CPresenceInfoFilterImp& aFilter ) const
+    {
+    CPresenceInfoImp* info = TXIMPObjectCloner< CPresenceInfoImp >::CloneLC( *this );
+
+    // the info imps know how to filter themselves
+    info->iPersonPresence->FilterWithL( aFilter );
+
+    for ( TInt i = 0; i < iServicePresences.Count(); i++ )
+        {
+        info->iServicePresences[ i ]->FilterWithL( aFilter );
+        }
+    
+    for ( TInt i = 0; i < iDevicePresences.Count(); i++ )
+        {
+        info->iDevicePresences[ i ]->FilterWithL( aFilter );
+        }
+
+    return info;
+    }
+
+
+// End of file
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresencedatamodel/presenceinfo/servicepresenceinfoimp.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,201 @@
+/*
+* 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 of MServicePresenceInfo object.
+*
+*/
+
+
+#include "presenceinfofield.h"
+#include "servicepresenceinfoimp.h"
+#include "presenceinfofieldcollectionimp.h"
+#include "ximprbufhelpers.h"
+#include "presenceinfofilterimp.h"
+
+// ============================ MEMBER FUNCTIONS =============================
+
+// ---------------------------------------------------------------------------
+// CServicePresenceInfoImp::NewLC()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CServicePresenceInfoImp* CServicePresenceInfoImp::NewLC()
+    {
+    CServicePresenceInfoImp* self = new( ELeave ) CServicePresenceInfoImp;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CServicePresenceInfoImp::NewFromStreamLC()
+// ---------------------------------------------------------------------------
+//
+XIMPIMP_IMPLEMENT_DATAOBJ_NEWFROMSTREAM( CServicePresenceInfoImp )
+
+// ---------------------------------------------------------------------------
+// Implement supported interface access.
+// ---------------------------------------------------------------------------
+//
+XIMPIMP_IF_BASE_GET_INTERFACE_BEGIN( CServicePresenceInfoImp,
+                                     MServicePresenceInfo )
+XIMPIMP_IF_BASE_GET_INTERFACE_END()
+XIMPIMP_IF_BASE_GET_CONST_INTERFACE_BEGIN( CServicePresenceInfoImp,
+                                           MServicePresenceInfo )
+XIMPIMP_IF_BASE_GET_INTERFACE_END()
+
+// ---------------------------------------------------------------------------
+// CServicePresenceInfoImp::~CServicePresenceInfoImp()
+// ---------------------------------------------------------------------------
+//
+CServicePresenceInfoImp::~CServicePresenceInfoImp()
+    {
+    delete iFields;
+    iServiceType.Close();
+    }
+
+// ---------------------------------------------------------------------------
+// CServicePresenceInfoImp::CServicePresenceInfoImp()
+// ---------------------------------------------------------------------------
+//
+CServicePresenceInfoImp::CServicePresenceInfoImp()
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// CServicePresenceInfoImp::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void CServicePresenceInfoImp::ConstructL()
+    {
+    iFields = CPresenceInfoFieldCollectionImp::NewLC();
+    CleanupStack::Pop( iFields );
+
+    iServiceType.CreateL( 0 );
+    }
+
+// ---------------------------------------------------------------------------
+// CServicePresenceInfoImp::ExternalizeL()
+// ---------------------------------------------------------------------------
+//
+void CServicePresenceInfoImp::ExternalizeL( RWriteStream& aStream ) const
+    {
+    XIMPRBuf8Helper::ExternalizeL( iServiceType, aStream );
+    iFields->ExternalizeL( aStream );
+    }
+
+// ---------------------------------------------------------------------------
+// CServicePresenceInfoImp::InternalizeL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CServicePresenceInfoImp::InternalizeL( RReadStream& aStream )
+    {
+    XIMPRBuf8Helper::InternalizeL( iServiceType, aStream );
+    
+    // we only have a parameterless ConstructL which creates the fields structure...
+    CXIMPApiDataObjBase* tmp = CPresenceInfoFieldCollectionImp::NewFromStreamLC( aStream );
+    CPresenceInfoFieldCollectionImp* fields = 
+        TXIMPGetImpClassOrPanic< CPresenceInfoFieldCollectionImp >::From( tmp->Base() );
+    delete iFields;
+    iFields = fields;
+    CleanupStack::Pop( tmp );
+    }
+
+// ---------------------------------------------------------------------------
+// CServicePresenceInfoImp::EqualsContent()
+// ---------------------------------------------------------------------------
+//
+TBool CServicePresenceInfoImp::EqualsContent(
+        const CXIMPApiDataObjBase& aOtherInstance ) const
+    {
+    const CServicePresenceInfoImp* tmp =
+        TXIMPGetImpClassOrPanic< const CServicePresenceInfoImp >::From(
+                aOtherInstance.Base() );
+
+    TBool same = ETrue;
+    TBool x;
+
+    x = iFields->EqualsContent( *( tmp->iFields ) );
+    same &= x;
+
+    return same;
+    }
+
+
+// ---------------------------------------------------------------------------
+// From MServicePresenceInfo class.
+// CServicePresenceInfoImp::ServiceType()
+// ---------------------------------------------------------------------------
+//
+const TPtrC8 CServicePresenceInfoImp::ServiceType() const
+    {
+    return iServiceType;
+    }
+
+// ---------------------------------------------------------------------------
+// From MServicePresenceInfo class.
+// CServicePresenceInfoImp::SetServiceTypeL()
+// ---------------------------------------------------------------------------
+//
+void CServicePresenceInfoImp::SetServiceTypeL( const TDesC8& aServiceType ) 
+    {
+    HBufC8* tmp = aServiceType.AllocL();
+    iServiceType.Close();
+    iServiceType.Assign( tmp );
+    }
+
+
+// ---------------------------------------------------------------------------
+// From MServicePresenceInfo class.
+// CServicePresenceInfoImp::Fields()
+// ---------------------------------------------------------------------------
+//
+const MPresenceInfoFieldCollection& CServicePresenceInfoImp::Fields() const
+    {
+    return *iFields;
+    }
+
+
+// ---------------------------------------------------------------------------
+// From MServicePresenceInfo class.
+// CServicePresenceInfoImp::Fields()
+// ---------------------------------------------------------------------------
+//
+MPresenceInfoFieldCollection& CServicePresenceInfoImp::Fields()
+    {
+    return *iFields;
+    }
+
+// ---------------------------------------------------------------------------
+// CServicePresenceInfoImp::FilterWithL()
+// ---------------------------------------------------------------------------
+//
+void CServicePresenceInfoImp::FilterWithL( const CPresenceInfoFilterImp& aFilter )
+    {
+    TInt count = iFields->FieldCount();
+
+    // must traverse backwards when removing
+    for ( TInt i = count-1; i >= 0; i-- )
+        {
+        if ( ! aFilter.MatchServiceFilterL( 
+                    iServiceType, 
+                    iFields->FieldAt( i ).FieldType() ) )
+            {
+            // no match, so remove the field
+            // the filter tells us which ones to ACCEPT
+            iFields->RemoveField( i );
+            }
+        }
+    }
+
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresencedatamodel/presenceinfo/servicepresenceinfoimp.h	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  Implementation of MServicePresenceInfo object.
+ *
+*/
+
+
+#ifndef CSERVICEPRESENCEINFOIMP_H
+#define CSERVICEPRESENCEINFOIMP_H
+
+#include <e32std.h>
+#include <s32strm.h>
+#include <ximpbase.h>
+#include <servicepresenceinfo.h>
+#include "ximpapidataobjbase.h"
+#include "presenceapiobjbase.h"
+
+class CPresenceInfoFieldCollectionImp;
+class CPresenceInfoFilterImp;
+
+/**
+ * Implementation of MServicePresenceInfo object.
+ *
+ *
+ * @since S60 v3.2
+ */
+NONSHARABLE_CLASS( CServicePresenceInfoImp ): public CXIMPApiDataObjBase,
+                                                  public MServicePresenceInfo
+    {
+    public:
+
+    /** The class ID. */
+    enum { KClassId = PRIMP_CLSID_CPERSONPRESENCEINFOIMP };
+
+public:
+
+    IMPORT_C static CServicePresenceInfoImp* NewLC();
+
+    virtual ~CServicePresenceInfoImp();
+
+private:
+
+    CServicePresenceInfoImp();
+    void ConstructL();
+
+    /**
+     * @see CXIMPApiDataObjBase
+     */
+    XIMPIMP_DECLARE_DATAOBJ_BASE_PRIV_METHODS
+
+public: // From MXIMPBase
+
+    /**
+     * Implementation of MXIMPBase interface methods
+     * @see MXIMPBase
+     */
+    XIMPIMP_DECLARE_IF_BASE_METHODS
+
+    /**
+     * @see CXIMPApiDataObjBase
+     */
+    XIMPIMP_DECLARE_DATAOBJ_BASE_METHODS
+
+public: // New functions
+
+    /**
+     * Internalizes object data from given stream.
+     * @param aStream Stream to read.
+     */
+    IMPORT_C void InternalizeL( RReadStream& aStream );
+
+
+public: // from MServicePresenceInfo
+
+    /**
+     * @see MServicePresenceInfo
+     */
+    const TPtrC8 ServiceType() const;
+    void SetServiceTypeL( const TDesC8& aServiceType );
+    const MPresenceInfoFieldCollection& Fields() const;
+    MPresenceInfoFieldCollection& Fields();
+
+public: // new methods
+
+    /**
+     * Remove from this info field implementation the fields which do not match
+     * the given filter.
+     * @param aFilter The filter implementation
+     */
+    void FilterWithL( const CPresenceInfoFilterImp& aFilter );
+
+private: // data
+
+    // owned
+    CPresenceInfoFieldCollectionImp* iFields;
+
+    RBuf8 iServiceType;
+
+    };
+
+
+#endif // CSERVICEPRESENCEINFOIMP_H
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresencedatamodel/presenceobjectfactoryimp.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,217 @@
+/*
+* 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 of MPresenceManagement
+ *
+*/
+
+#include "presenceobjectfactoryimp.h"
+#include "presenceinfoimp.h"
+#include "presenceinfofilterimp.h"
+#include "ximpstatusimp.h"
+#include "ximprestrictedobjectcollectionimp.h"
+#include "ximpobjectcollectionimp.h"
+#include "ximpidentityimp.h"
+#include "presentitygroupinfoimp.h"
+#include "presentitygroupmemberinfoimp.h"
+#include "presencewatcherinfoimp.h"
+#include "presencegrantrequestinfoimp.h"
+#include "ximpdatasubscriptionstateimp.h"
+#include "personpresenceinfoimp.h"
+#include "servicepresenceinfoimp.h"
+#include "devicepresenceinfoimp.h"
+#include "presenceinfofieldimp.h"
+#include "presenceinfofieldvalueenumimp.h"
+#include "presenceinfofieldvaluetextimp.h"
+#include "presenceinfofieldvaluebinaryimp.h"
+#include "presenceblockinfoimp.h"
+
+// ============================ MEMBER FUNCTIONS =============================
+
+// ---------------------------------------------------------------------------
+// CPresenceObjectFactoryImp::NewL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CPresenceObjectFactoryImp* CPresenceObjectFactoryImp::NewL()
+    {
+    CPresenceObjectFactoryImp* self = new( ELeave ) CPresenceObjectFactoryImp;
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// Implement supported interface access.
+// ---------------------------------------------------------------------------
+//
+XIMPIMP_IF_BASE_GET_INTERFACE_BEGIN( CPresenceObjectFactoryImp, 
+                                     MPresenceObjectFactory )
+XIMPIMP_IF_BASE_GET_INTERFACE_END()
+
+
+XIMPIMP_IF_BASE_GET_CONST_INTERFACE_BEGIN( CPresenceObjectFactoryImp, 
+                                           MPresenceObjectFactory )
+XIMPIMP_IF_BASE_GET_INTERFACE_END()
+
+// ---------------------------------------------------------------------------
+// CPresenceObjectFactoryImp::~CPresenceObjectFactoryImp()
+// ---------------------------------------------------------------------------
+//
+CPresenceObjectFactoryImp::~CPresenceObjectFactoryImp()
+    {
+    #if _BullseyeCoverage
+    cov_write();
+    #endif
+    }
+
+
+// ---------------------------------------------------------------------------
+// CPresenceObjectFactoryImp::CPresenceObjectFactoryImp()
+// ---------------------------------------------------------------------------
+//
+CPresenceObjectFactoryImp::CPresenceObjectFactoryImp()
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceObjectFactoryImp::NewPresentityGroupInfoLC()
+// ---------------------------------------------------------------------------
+//
+MPresentityGroupInfo* CPresenceObjectFactoryImp::NewPresentityGroupInfoLC()
+    {
+    return CPresentityGroupInfoImp::NewLC();
+    }
+    
+
+// ---------------------------------------------------------------------------
+// CPresenceObjectFactoryImp::NewPresentityGroupMemberInfoLC()
+// ---------------------------------------------------------------------------
+//
+MPresentityGroupMemberInfo* 
+    CPresenceObjectFactoryImp::NewPresentityGroupMemberInfoLC()
+    {
+    return CPresentityGroupMemberInfoImp::NewLC();
+    }
+
+
+// ---------------------------------------------------------------------------
+// CPresenceObjectFactoryImp::NewPresenceWatcherInfoLC()
+// ---------------------------------------------------------------------------
+//
+MPresenceWatcherInfo* CPresenceObjectFactoryImp::NewPresenceWatcherInfoLC()
+    {
+    return CPresenceWatcherInfoImp::NewLC();
+    }
+
+
+// ---------------------------------------------------------------------------
+// CPresenceObjectFactoryImp::NewPresenceGrantRequestInfoLC()
+// ---------------------------------------------------------------------------
+//
+MPresenceGrantRequestInfo* 
+    CPresenceObjectFactoryImp::NewPresenceGrantRequestInfoLC()
+    {
+    return CPresenceGrantRequestInfoImp::NewLC();
+    }
+
+
+// ---------------------------------------------------------------------------
+// CPresenceObjectFactoryImp::NewPresenceInfoLC()
+// ---------------------------------------------------------------------------
+//
+MPresenceInfo* CPresenceObjectFactoryImp::NewPresenceInfoLC()
+    {
+    return CPresenceInfoImp::NewLC();
+    }
+
+
+// ---------------------------------------------------------------------------
+// CPresenceObjectFactoryImp::NewPresenceInfoFilterLC()
+// ---------------------------------------------------------------------------
+//
+MPresenceInfoFilter* CPresenceObjectFactoryImp::NewPresenceInfoFilterLC()
+    {
+    return CPresenceInfoFilterImp::NewLC();
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceObjectFactoryImp::NewPresenceInfoFieldLC()
+// ---------------------------------------------------------------------------
+//
+MPresenceInfoField* CPresenceObjectFactoryImp::NewInfoFieldLC()
+    {
+    return CPresenceInfoFieldImp::NewLC();
+    }
+    
+// ---------------------------------------------------------------------------
+// CPresenceObjectFactoryImp::NewPersonPresenceInfoLC()
+// ---------------------------------------------------------------------------
+//
+MPersonPresenceInfo* CPresenceObjectFactoryImp::NewPersonPresenceInfoLC()
+    {
+    return CPersonPresenceInfoImp::NewLC();
+    }
+    
+// ---------------------------------------------------------------------------
+// CPresenceObjectFactoryImp::NewServicePresenceInfoLC()
+// ---------------------------------------------------------------------------
+//
+MServicePresenceInfo* CPresenceObjectFactoryImp::NewServicePresenceInfoLC()
+    {
+    return CServicePresenceInfoImp::NewLC();
+    }
+    
+// ---------------------------------------------------------------------------
+// CPresenceObjectFactoryImp::NewDevicePresenceInfoLC()
+// ---------------------------------------------------------------------------
+//
+MDevicePresenceInfo* CPresenceObjectFactoryImp::NewDevicePresenceInfoLC()
+    {
+    return CDevicePresenceInfoImp::NewLC();
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceObjectFactoryImp::NewEnumInfoFieldLC()
+// ---------------------------------------------------------------------------
+//
+MPresenceInfoFieldValueEnum* CPresenceObjectFactoryImp::NewEnumInfoFieldLC()
+    {
+    return CPresenceInfoFieldValueEnumImp::NewLC();
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceObjectFactoryImp::NewTextInfoFieldLC()
+// ---------------------------------------------------------------------------
+//
+MPresenceInfoFieldValueText* CPresenceObjectFactoryImp::NewTextInfoFieldLC()
+    {
+    return CPresenceInfoFieldValueTextImp::NewLC();
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceObjectFactoryImp::NewBinaryInfoFieldLC()
+// ---------------------------------------------------------------------------
+//
+MPresenceInfoFieldValueBinary* CPresenceObjectFactoryImp::NewBinaryInfoFieldLC()
+    {
+    return CPresenceInfoFieldValueBinaryImp::NewLC();
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceObjectFactoryImp::NewPresenceBlockInfoLC()
+// ---------------------------------------------------------------------------
+//
+MPresenceBlockInfo* CPresenceObjectFactoryImp::NewPresenceBlockInfoLC()
+    {
+    return CPresenceBlockInfoImp::NewLC();
+    }
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresencedatamodel/presenceobjectfactoryimp.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,81 @@
+/*
+* 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 of MPresenceObjectFactory
+ *
+*/
+
+#ifndef CPRESENCEOBJECTFACTORYIMP_H
+#define CPRESENCEOBJECTFACTORYIMP_H
+
+#include <presenceobjectfactory.h>
+#include "ximpapiobjbase.h"
+#include "presenceapiobjbase.h"
+
+
+
+
+/**
+ * MPresenceObjectFactory API object implementation.
+ *
+ * @lib presencemanager.dll
+ * @since S60 v3.2
+ */
+class CPresenceObjectFactoryImp: public CXIMPApiObjBase,
+                                 public MPresenceObjectFactory
+    {
+    public:
+    /** The class ID. */
+    enum { KClassId = PRIMP_CLSID_CPRESENCEOBJECTFACTORYIMP };
+
+
+public:
+
+    IMPORT_C static CPresenceObjectFactoryImp* NewL();
+    ~CPresenceObjectFactoryImp();
+
+private:
+    CPresenceObjectFactoryImp();
+
+
+
+public: // From MXIMPBase
+
+    /**
+     * Implementation of MXIMPBase interface methods
+     * @see MXIMPBase
+     */
+    XIMPIMP_DECLARE_IF_BASE_METHODS
+
+
+public: //From MPresenceObjectFactory
+
+   
+    MPresentityGroupInfo* NewPresentityGroupInfoLC();
+    MPresentityGroupMemberInfo* NewPresentityGroupMemberInfoLC();
+    MPresenceWatcherInfo* NewPresenceWatcherInfoLC();
+    MPresenceGrantRequestInfo* NewPresenceGrantRequestInfoLC();
+    MPresenceInfo* NewPresenceInfoLC();
+    MPresenceInfoFilter* NewPresenceInfoFilterLC();
+    MPersonPresenceInfo* NewPersonPresenceInfoLC();
+    MServicePresenceInfo* NewServicePresenceInfoLC();
+    MDevicePresenceInfo* NewDevicePresenceInfoLC();
+    MPresenceInfoField* NewInfoFieldLC();
+    MPresenceInfoFieldValueEnum* NewEnumInfoFieldLC();
+    MPresenceInfoFieldValueText* NewTextInfoFieldLC();
+    MPresenceInfoFieldValueBinary* NewBinaryInfoFieldLC();
+    MPresenceBlockInfo* NewPresenceBlockInfoLC();
+    };
+
+
+#endif // CPRESENCEOBJECTFACTORYIMP_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresencedatamodel/presencepublishing/documentutils.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  Document utils
+*
+*/
+
+#include "documentutils.h"
+#include "presenceinfoimp.h"
+#include "presenceinfofilterimp.h"
+#include "ximpobjecthelpers.h"
+
+
+// ============================ MEMBER FUNCTIONS =============================
+
+// ---------------------------------------------------------------------------
+// DocumentUtils::InfoFilterUnionL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CPresenceInfoFilterImp* DocumentUtils::InfoFilterUnionL(
+        CPresenceInfoFilterImp& aSource1,
+        CPresenceInfoFilterImp& aSource2 )
+    {
+    RPointerArray< CPresenceInfoFilterImp > array;
+    CleanupClosePushL( array );
+    array.AppendL( &aSource1 );
+    array.AppendL( &aSource2 );
+    CPresenceInfoFilterImp* retVal = InfoFilterUnionL( array );
+    CleanupStack::PopAndDestroy(); // array
+    return retVal;
+    }
+
+
+// ---------------------------------------------------------------------------
+// DocumentUtils::DocumentUnionL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CPresenceInfoFilterImp* DocumentUtils::InfoFilterUnionL(
+        const RPointerArray< CPresenceInfoFilterImp >& aSources )
+    {
+    CPresenceInfoFilterImp* target = NULL;
+    TInt countOfSources = aSources.Count();
+    if( countOfSources == 0 ) // No sources to combine.
+        {
+        target = CPresenceInfoFilterImp::NewLC();
+        CleanupStack::Pop(); // target
+        return target;
+        }
+
+    // Create a new one instead of cloning the first to avoid possible duplicates.
+    // Algorithm is: given filters a,b,c: 
+    //   new = empty. 
+    //   new = union(new,a)
+    //   new = union(new,b)
+    //   new = union(new,c)
+    // result in new.
+   
+    target = CPresenceInfoFilterImp::NewL();
+
+    for ( TInt i = 0; i < aSources.Count(); i++ )
+        {
+        CleanupStack::PushL( target );
+
+        CPresenceInfoFilterImp* filter = aSources[ i ];
+        CPresenceInfoFilterImp* tmp = CPresenceInfoFilterImp::UnionL( *target, *filter );
+
+        CleanupStack::PopAndDestroy( target );
+
+        target = tmp;
+        }
+
+    return target;
+    }
+
+
+EXPORT_C CPresenceInfoImp* DocumentUtils::CollectFilteredPresenceInfoLC(
+        const CPresenceInfoFilterImp& aPif,
+        const CPresenceInfoImp& aSource )
+    {
+    CPresenceInfoImp* newInfo = aSource.FilteredInfoLC( aPif );
+    return newInfo;
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresencedatamodel/presencepublishing/documentutils.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,68 @@
+/*
+* 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:  Document utils
+*
+*/
+
+#ifndef CDOCUMENTUTILS_H
+#define CDOCUMENTUTILS_H
+
+#include <e32std.h>
+
+class CPresenceInfoImp;
+class CPresenceInfoFilterImp;
+
+/**
+ * Document utils
+ *
+ * @lib ximpdatamodel.dll
+ * @since S60 v3.2
+ */
+class DocumentUtils
+    {
+
+public:
+
+    /**
+     * Create union of two source info filters.
+     * @param aSource1 First source filter
+     * @param aSource2 Second source filter
+     * @return New created filter. Ownership is transferred to caller.
+     */
+    IMPORT_C static CPresenceInfoFilterImp* InfoFilterUnionL(
+                                                CPresenceInfoFilterImp& aSource1,
+                                                CPresenceInfoFilterImp& aSource2 );
+    /**
+     * Create union of filters
+     * @param aSources Array of sources for union.
+     * @return New created filter. Ownership is transferred to caller.
+     */
+    IMPORT_C static CPresenceInfoFilterImp* InfoFilterUnionL(
+                    const RPointerArray< CPresenceInfoFilterImp >& aSources );
+
+    /**
+     *
+     */
+    IMPORT_C static CPresenceInfoImp* CollectFilteredPresenceInfoLC(
+                                                const CPresenceInfoFilterImp& aPif,
+                                                const CPresenceInfoImp& aSource );
+private:
+
+
+    };
+
+
+#endif // CDOCUMENTUTILS_H
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresencedatamodel/presencepublishing/ownpresenceeventimp.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,206 @@
+/*
+* 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:  MOwnPresenceEvent API object implementation.
+ *
+*/
+
+#include "ownpresenceeventimp.h"
+#include "presenceinfoimp.h"
+#include "ximpobjecthelpers.h"
+#include "ximpdatasubscriptionstateimp.h"
+#include <s32strm.h>
+
+
+// ---------------------------------------------------------------------------
+// COwnPresenceEventImp::NewLC()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C COwnPresenceEventImp* COwnPresenceEventImp::NewLC(
+    CXIMPDataSubscriptionStateImp* aState )
+    {
+    COwnPresenceEventImp* self = new( ELeave ) COwnPresenceEventImp();
+    CleanupStack::PushL( self );
+    self->ConstructL( aState );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// COwnPresenceEventImp::NewL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C COwnPresenceEventImp* COwnPresenceEventImp::NewL(
+    CXIMPDataSubscriptionStateImp* aState )
+    {
+    COwnPresenceEventImp* self = NewLC( aState );
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+
+// ---------------------------------------------------------------------------
+// COwnPresenceEventImp::NewFromStreamLC()
+// ---------------------------------------------------------------------------
+//
+CXIMPApiEventBase* COwnPresenceEventImp::NewFromStreamLC( RReadStream& aStream )
+    {
+    COwnPresenceEventImp* self = new( ELeave ) COwnPresenceEventImp;
+    CleanupStack::PushL( self );
+    self->ConstructL( aStream );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// COwnPresenceEventImp::~COwnPresenceEventImp()
+// ---------------------------------------------------------------------------
+//
+COwnPresenceEventImp::~COwnPresenceEventImp()
+    {
+    delete iPresenceInfo;
+    delete iSubscriptionState;
+    }
+
+
+// ---------------------------------------------------------------------------
+// COwnPresenceEventImp::COwnPresenceEventImp()
+// ---------------------------------------------------------------------------
+//
+COwnPresenceEventImp::COwnPresenceEventImp()
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// COwnPresenceEventImp::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void COwnPresenceEventImp::ConstructL( CXIMPDataSubscriptionStateImp* aState )
+    {
+    iSubscriptionState = aState;
+    iPresenceInfo = CPresenceInfoImp::NewL();
+    }
+
+// ---------------------------------------------------------------------------
+// COwnPresenceEventImp::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void COwnPresenceEventImp::ConstructL( RReadStream& aStream )
+    {
+    iSubscriptionState = CXIMPDataSubscriptionStateImp::NewL();
+    iPresenceInfo = CPresenceInfoImp::NewL();
+    InternalizeL( aStream );
+    }
+
+// ---------------------------------------------------------------------------
+// Implement supported interface access.
+// ---------------------------------------------------------------------------
+//
+XIMPIMP_IF_BASE_GET_INTERFACE_BEGIN( COwnPresenceEventImp,
+                                     MOwnPresenceEvent )
+    XIMPIMP_IF_BASE_GET_CLASS( CXIMPApiEventBase, this )
+XIMPIMP_IF_BASE_GET_INTERFACE_END()
+
+
+XIMPIMP_IF_BASE_GET_CONST_INTERFACE_BEGIN( COwnPresenceEventImp,
+                                           MOwnPresenceEvent )
+    XIMPIMP_IF_BASE_GET_CONST_CLASS( CXIMPApiEventBase, this )                                            
+XIMPIMP_IF_BASE_GET_INTERFACE_END()
+
+
+
+// ---------------------------------------------------------------------------
+// Implement methods from base event interface and base event class
+// ---------------------------------------------------------------------------
+//
+XIMPIMP_IMPLEMENT_EVENT_BASE_METHODS( COwnPresenceEventImp,
+                                      MOwnPresenceEvent )
+
+// ---------------------------------------------------------------------------
+// COwnPresenceEventImp::EqualsContent()
+// ---------------------------------------------------------------------------
+//
+TBool COwnPresenceEventImp::EqualsContent( 
+    const CXIMPApiEventBase& aOtherInstance ) const
+    {
+    const COwnPresenceEventImp* tmp =
+    TXIMPGetImpClassOrPanic< const COwnPresenceEventImp>::From( aOtherInstance.Base() );
+
+
+    TBool same = ETrue;
+
+    TBool x = iPresenceInfo->EqualsContent( *tmp->iPresenceInfo );
+    same &= x;
+    
+    x = iSubscriptionState->EqualsContent( *tmp->iSubscriptionState );
+    same &= x;
+
+    return same;
+    }
+
+// ---------------------------------------------------------------------------
+// From class CXIMPApiEventBase.
+// COwnPresenceEventImp::ExternalizeL()
+// ---------------------------------------------------------------------------
+//
+void COwnPresenceEventImp::ExternalizeL( RWriteStream& aStream ) const
+    {
+    iPresenceInfo->ExternalizeL( aStream );
+    iSubscriptionState->ExternalizeL( aStream );
+    }
+
+
+// ---------------------------------------------------------------------------
+// COwnPresenceEventImp::InternalizeL()
+// ---------------------------------------------------------------------------
+//
+void COwnPresenceEventImp::InternalizeL( RReadStream& aStream )
+    {
+    iPresenceInfo->InternalizeL( aStream );
+    iSubscriptionState->InternalizeL( aStream );
+    }
+
+
+// ---------------------------------------------------------------------------
+// From class MOwnPresenceEvent.
+// COwnPresenceEventImp::Status()
+// ---------------------------------------------------------------------------
+//
+const MXIMPDataSubscriptionState&
+    COwnPresenceEventImp::DataSubscriptionState() const
+    {
+    return *iSubscriptionState;
+    }
+
+
+// ---------------------------------------------------------------------------
+// From class MOwnPresenceEvent.
+// COwnPresenceEventImp::SubscribedPresence()
+// ---------------------------------------------------------------------------
+//
+const MPresenceInfo& 
+    COwnPresenceEventImp::SubscribedPresence() const
+    {
+    return *iPresenceInfo;
+    }
+
+// ---------------------------------------------------------------------------
+// COwnPresenceEventImp::SetPresenceInfo
+// ---------------------------------------------------------------------------
+//
+void COwnPresenceEventImp::SetPresenceInfo( CPresenceInfoImp* aInfoImp )
+    {
+    delete iPresenceInfo;
+    iPresenceInfo = aInfoImp;
+    }
+
+// End of file
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresencedatamodel/presencepublishing/ownpresenceeventimp.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,128 @@
+/*
+* 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:  MOwnPresenceEvent API object implementation.
+ *
+*/
+
+#ifndef COWNPRESENCEEVENTIMP_H
+#define COWNPRESENCEEVENTIMP_H
+
+#include <ownpresenceevent.h>
+#include "ximpapieventbase.h"
+#include "presenceinfo.h"
+#include "ximpdatasubscriptionstateimp.h"
+#include "presenceapiobjbase.h"
+
+
+class RReadStream;
+class CPresenceInfoImp;
+class CXIMPDataSubscriptionStateImp;
+
+/**
+ * MOwnPresenceEvent API object implementation.
+ *
+ * @lib ximpdatamodel.dll
+ * @since S60 v3.2
+ */
+NONSHARABLE_CLASS( COwnPresenceEventImp ): public CXIMPApiEventBase,
+                                               public MOwnPresenceEvent
+    {
+public:
+    /** The class ID. */
+    enum { KClassId = PRIMP_CLSID_COWNPRESENCEEVENTIMP };
+
+public:
+    /**
+     * Exported instantiation method for initializing
+     * new event object.
+     */
+    IMPORT_C static COwnPresenceEventImp* NewLC(
+        CXIMPDataSubscriptionStateImp* aState );
+    IMPORT_C static COwnPresenceEventImp* NewL(
+        CXIMPDataSubscriptionStateImp* aState );
+
+
+    /**
+     * Instantiation method for event automation.
+     * Method signature must be exactly this to work
+     * with event delivery automation system.
+     *
+     * Event implementation must be registered to
+     * XIMPEventCodec KXIMPEventConstructorTable.
+     */
+    static CXIMPApiEventBase* NewFromStreamLC( RReadStream& aStream );
+
+    virtual ~COwnPresenceEventImp();
+
+
+private:
+    COwnPresenceEventImp();
+    void ConstructL( CXIMPDataSubscriptionStateImp* aState );
+    void ConstructL( RReadStream& aStream );
+
+public: // From API base interfaces
+
+    /**
+     * Implementation of MXIMPBase interface methods
+     * @see MXIMPBase
+     */
+    XIMPIMP_DECLARE_IF_BASE_METHODS
+
+
+    /**
+     * Implementation of MXIMPEventBase interface and
+     * CXIMPApiEventBase methods
+     *
+     * @see MXIMPEventBase
+     * @see CXIMPApiEventBase
+     */
+    XIMPIMP_DECLARE_EVENT_BASE_METHODS
+
+    void InternalizeL( RReadStream& aStream );
+
+
+public: // From MOwnPresenceEvent
+
+    /**
+     * Implementation of MOwnPresenceEvent interface methods
+     * @see MOwnPresenceEvent
+     */
+    const MPresenceInfo& SubscribedPresence() const;
+    const MXIMPDataSubscriptionState& DataSubscriptionState() const;
+
+public:  // new methods
+
+    /**
+     * Set new presence info.
+     * Ownership transferred.
+     * @param aInfoImp The info imp
+     */
+    void SetPresenceInfo( CPresenceInfoImp* aInfoImp );
+
+private: // data
+
+    /**
+     * Presence Document
+     * Own.
+     */
+     CPresenceInfoImp* iPresenceInfo;
+
+    /**
+     *
+     */
+    CXIMPDataSubscriptionStateImp* iSubscriptionState;
+    };
+
+
+#endif // COWNPRESENCEEVENTIMP_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresencedatamodel/presencepublishing/ownpresencesubscriptionitem.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  Presence Service Connection own presence subscription implementation.
+*
+*/
+
+
+#include "ownpresencesubscriptionitem.h"
+#include "presenceinfofilterimp.h"
+#include "ximpitemparent.h"
+#include "ximppanics.h"
+#include "ximppsccontext.h"
+#include "documentutils.h"
+#include "ownpresenceeventimp.h"
+
+#include "ximptrace.h"
+
+// ---------------------------------------------------------------------------
+// COwnPresenceSubscriptionItem::COwnPresenceSubscriptionItem()
+// ---------------------------------------------------------------------------
+//
+COwnPresenceSubscriptionItem::COwnPresenceSubscriptionItem( MXIMPItemParentBase& aParent )
+: CXIMPSubscriptionItemBase( aParent )
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// COwnPresenceSubscriptionItem::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void COwnPresenceSubscriptionItem::ConstructL()
+    {
+    BaseConstructL();
+    }
+
+
+// ---------------------------------------------------------------------------
+// COwnPresenceSubscriptionItem::NewL()
+// ---------------------------------------------------------------------------
+//
+COwnPresenceSubscriptionItem* COwnPresenceSubscriptionItem::NewLC( MXIMPItemParentBase& aParent )
+    {
+    COwnPresenceSubscriptionItem* self = new( ELeave ) COwnPresenceSubscriptionItem( aParent );
+    CleanupClosePushL( *self );
+    self->ConstructL();
+    return self;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPHost::~CXIMPHost()
+// ---------------------------------------------------------------------------
+//
+COwnPresenceSubscriptionItem::~COwnPresenceSubscriptionItem()
+    {
+    MXIMPItemParent* presCache = static_cast<MXIMPItemParent*>(iParent.GetInterface(PRESENCE_ITEM_PARENT));
+    presCache->RemoveMe( this );
+
+    delete iPif;
+    delete iPresenceInfo;
+    }
+
+// ---------------------------------------------------------------------------
+// COwnPresenceSubscriptionItem::SubscriptionPif()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CPresenceInfoFilterImp& COwnPresenceSubscriptionItem::SubscriptionPif()
+    {
+    TRACE(_L("COwnPresenceSubscriptionItem::SubscriptionPif" ) );
+    __ASSERT_ALWAYS( iPif, User::Panic( NXIMPPrivPanic::KCategory,
+                                        NXIMPPrivPanic::EOwnPresencePifNotSet ) );
+    return *iPif;
+    }
+// ---------------------------------------------------------------------------
+// COwnPresenceSubscriptionItem::SynthesiseSubscriptionEventToL()
+// ---------------------------------------------------------------------------
+//
+void COwnPresenceSubscriptionItem::SynthesiseSubscriptionEventToL(
+                                       MXIMPPscContext* aContext, TBool aForceEvent )
+    {
+    TRACE_1( _L("COwnPresenceSubscriptionItem::SynthesiseSubscriptionEventTo() aForce=%d"), aForceEvent );
+    CXIMPDataSubscriptionStateImp* status = StatusLC( aContext );
+
+    COwnPresenceEventImp* newEvent = NULL;
+    if( status->DataState() == MXIMPDataSubscriptionState::EDataAvailable )
+        {
+        __ASSERT_ALWAYS( iPresenceInfo, User::Panic( NXIMPPrivPanic::KCategory,
+                                            NXIMPPrivPanic::EOwnPresencePresenceInfoDoesNotExist ) );
+
+        CPresenceInfoImp* filteredPresenceInfo = DocumentUtils::CollectFilteredPresenceInfoLC(
+                *( aContext->PresenceInfoFilter( MXIMPPscContext::EOwnPresenceFilter ) ), *iPresenceInfo );
+
+        newEvent = COwnPresenceEventImp::NewL( status ); // CSI: 35 # Event is put to cleanupstack in next branch.
+        newEvent->SetPresenceInfo( filteredPresenceInfo );
+        CleanupStack::Pop( filteredPresenceInfo );
+        }
+    else if( aForceEvent )
+        {
+        newEvent = COwnPresenceEventImp::NewL( status ); // CSI: 35 # Event is put to cleanupstack in next branch.
+        }
+
+    if( newEvent )
+        {
+        CleanupStack::Pop(); //status
+        CleanupStack::PushL( newEvent );
+        MXIMPItemParent* presCache = static_cast<MXIMPItemParent*>(iParent.GetInterface(PRESENCE_ITEM_PARENT));
+        presCache->AddEventL( *newEvent, aContext );
+        }
+    CleanupStack::PopAndDestroy(); //status || newEvent depending on branch
+    }
+
+// ---------------------------------------------------------------------------
+// COwnPresenceSubscriptionItem::SetSubscriptionPif()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void COwnPresenceSubscriptionItem::SetSubscriptionPif( CPresenceInfoFilterImp* aPif )
+    {
+    TRACE(_L("COwnPresenceSubscriptionItem::SetSubscriptionPif" ) );
+    delete iPif;
+    iPif = aPif;
+    }
+
+// ---------------------------------------------------------------------------
+// COwnPresenceSubscriptionItem::CollectSubscriptionPifWithoutCtxL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CPresenceInfoFilterImp*
+    COwnPresenceSubscriptionItem::CollectSubscriptionPifWithoutCtxL(
+                                                        MXIMPPscContext* aContext )
+    {
+    TRACE(_L("COwnPresenceSubscriptionItem::CollectSubscriptionPifWithoutCtxL" ) );
+    RPointerArray< CPresenceInfoFilterImp > arrayOfPifs;
+    CleanupClosePushL( arrayOfPifs );
+
+    TInt count = iContexts.Count();
+    for( TInt a = 0; a < count; ++a )
+        {
+        if( iContexts[ a ] != aContext )
+            {
+            CPresenceInfoFilterImp* filter = iContexts[ a ]->PresenceInfoFilter( 
+                        MXIMPPscContext::EOwnPresenceFilter );
+            if ( filter )
+                {
+                arrayOfPifs.AppendL( filter );
+                }
+            }
+        }
+    CPresenceInfoFilterImp* pifWithoutCtx = DocumentUtils::InfoFilterUnionL( arrayOfPifs );
+    CleanupStack::PopAndDestroy(); // arrayOfPifs
+    return pifWithoutCtx;
+    }
+
+
+// ---------------------------------------------------------------------------
+// COwnPresenceSubscriptionItem::SetPresenceInfoL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void COwnPresenceSubscriptionItem::SetPresenceInfoL(
+                                            CPresenceInfoImp* aPresenceInfo )
+    {
+    TRACE(_L("COwnPresenceSubscriptionItem::SetPresenceInfoL" ) );
+    delete iPresenceInfo;
+    iPresenceInfo = aPresenceInfo;
+    iSubscriptionState->SetDataStateL( MXIMPDataSubscriptionState::EDataAvailable );
+    }
+
+// ---------------------------------------------------------------------------
+// COwnPresenceSubscriptionItem::CleanExpired()
+// ---------------------------------------------------------------------------
+//
+void COwnPresenceSubscriptionItem::CleanExpired()
+    {
+
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresencedatamodel/presencepublishing/ownpresencesubscriptionitem.h	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  Presence Service Connection own presence subscription implementation.
+*
+*/
+
+#ifndef CPSCOWNPRESENCESUBSCRIPTIONITEM_H
+#define CPSCOWNPRESENCESUBSCRIPTIONITEM_H
+
+#include <e32base.h>
+#include "presenceinfoimp.h"
+#include "ximpsubscriptionitem.h"
+#include "ximpsubscriptionitembase.h"
+
+class MXIMPItemParentBase;
+class MXIMPPscContext;
+class CPresenceInfoFilterImp;
+class COwnPresenceEventImp;
+
+/**
+ * PSC own presence subscription implementation
+ *
+ * @since S60 v3.2
+ */
+class COwnPresenceSubscriptionItem : public CXIMPSubscriptionItemBase
+    {
+    
+public: // Construction and destruction
+
+    /**
+     * Construction
+     * @param aParent. Parent has to be informed when this object is deleted by RemoveMe method.
+     */
+    static COwnPresenceSubscriptionItem* NewLC( MXIMPItemParentBase& aParent );
+
+    /**
+     * Destruction
+     * - Remember to inform parent about delete.
+     */
+    virtual ~COwnPresenceSubscriptionItem();
+
+private: // Construction and destruction
+
+    /**
+     * Construction
+     * @param aParent. Parent has to be informed when this object is deleted by RemoveMe method.
+     */
+    COwnPresenceSubscriptionItem( MXIMPItemParentBase& aParent );
+    
+    /**
+     * Construction
+     */
+    void ConstructL();
+    
+public: // New methods
+    
+    /**
+     * Current presence information filter.
+     * @return Current presence information filter.
+     */
+    IMPORT_C CPresenceInfoFilterImp& SubscriptionPif();
+    
+    /**
+     * Set current presence information filter. Overwrites existing one.
+     * Ownership is transferred to callee.
+     * @param aPif Current presence information filter.
+     */
+    IMPORT_C void SetSubscriptionPif( CPresenceInfoFilterImp* aPif );
+
+    /**
+     * Collect aggregated presence information filter wihtout given context.
+     * @param aContext. Exluded context from aggregated pif.
+     * @return Aggregated pif without exluded context.
+     */    
+    IMPORT_C CPresenceInfoFilterImp* CollectSubscriptionPifWithoutCtxL( 
+                                                    MXIMPPscContext* aContext );
+    
+    /**
+     * Set presence information. Overwrites existing one.
+     * @param aPresenceInfo. New presence information.
+     */
+    IMPORT_C void SetPresenceInfoL( CPresenceInfoImp* aPresenceInfo );
+            
+public: // From MXIMPSubscriptionItem
+
+    /**
+     * Synthesise own presence information to given context.
+     * Presence information is filtered with context pif.
+     * @param aContext. Target context for own presence information.
+     */    
+    void SynthesiseSubscriptionEventToL( MXIMPPscContext* aContext, TBool aForceEvent );
+    
+private: // From CXIMPSubscriptionItemBase
+
+    /**
+     * @see CXIMPSubscriptionItemBase
+     */
+    void CleanExpired();        
+        
+private: // Data
+
+    /**
+     * Current presence information filter.
+     */
+    CPresenceInfoFilterImp* iPif;
+    
+    /**
+     * Current presence info
+     */
+    CPresenceInfoImp* iPresenceInfo;
+    };
+
+
+/* ======================================================================== */
+
+
+
+#endif // CPSCOWNPRESENCESUBSCRIPTIONITEM_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresencedatamodel/presencepublishing/presenceinfofilterimp.h	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  MPresenceInfoFilter API object implementation.
+*
+*/
+
+#ifndef CPRESENCEINFOFILTERIMP_H
+#define CPRESENCEINFOFILTERIMP_H
+
+#include "ximpapidataobjbase.h"
+#include "presenceapiobjbase.h"
+#include <presenceinfofilter.h>
+#include <s32strm.h>
+
+class CDesC8ArraySeg;
+
+/**
+ * MPresenceInfoFilter API object implementation.
+ *
+ * @lib ximpdatamodel.dll
+ * @since S60 v3.2
+ */
+NONSHARABLE_CLASS( CPresenceInfoFilterImp ): public CXIMPApiDataObjBase,
+                                                 public MPresenceInfoFilter
+    {
+    private:
+
+    /**
+     * Container class to do 1:many infoname -> fieldname mappings.
+     */
+    class CFilterField : public CBase
+        {
+        public:
+
+            /**
+             * @param aInfoName The name of info associated
+             * with this filter
+             */
+            static CFilterField* NewL( 
+                    const TDesC8& aFieldName );
+
+            static CFilterField* NewLC();
+
+            ~CFilterField();
+
+            /**
+             * @return The info name
+             */
+            const TDesC8& InfoName();
+
+            /**
+             * Add a field name
+             * @param aFieldName The name of field
+             */
+            void AddFieldNameL( const TDesC8& aFieldName );
+
+            static TInt OrderOfFields(
+                    const CFilterField& aFirst, 
+                    const CFilterField& aSecond );
+
+            static TInt OrderOfFieldsByName(
+                    const TDesC8* aName, 
+                    const CFilterField& aSecond );
+
+            void ExternalizeL( RWriteStream& aStream ) const; 
+            void InternalizeL( RReadStream& aStream );
+
+            /**
+             * Merge the contents of given filter field into this filter field.
+             * The field name of the fields must match! Otherwise this routine
+             * is meaningless.
+             */
+            void MergeL( CFilterField& aOtherField );
+            
+            /**
+             * Check if source is same as this
+             * @param aSource Source for check
+             * @return ETrue if objects are same             
+             */
+            TBool operator==( const CFilterField& aSource );
+            TBool operator!=( const CFilterField& aSource );
+
+        private:
+
+            CFilterField();
+            void ConstructL( const TDesC8& aInfoName );
+            void ConstructL();
+
+        public:
+            // owns, accepted info name
+            RBuf8 iInfoName;
+
+            // owns: accepted field names
+            CDesC8ArraySeg* iFieldNames;
+        };
+
+
+    public:
+
+    /** The class ID. */
+    enum { KClassId = PRIMP_CLSID_CPRESENCEINFOFILTERIMP };
+
+
+public:
+
+    IMPORT_C static CPresenceInfoFilterImp* NewLC();
+    IMPORT_C static CPresenceInfoFilterImp* NewL();
+    virtual ~CPresenceInfoFilterImp();
+
+private:
+
+    CPresenceInfoFilterImp();
+    void ConstructL();
+
+public: // From MXIMPBase
+
+    /**
+     * Implementation of MXIMPBase interface methods
+     * @see MXIMPBase
+     */
+    XIMPIMP_DECLARE_IF_BASE_METHODS
+
+public: // From CXIMPApiDataObjBase
+
+    /**
+     * @see CXIMPApiDataObjBase
+     */
+    XIMPIMP_DECLARE_DATAOBJ_BASE_METHODS
+
+
+public: // From MPresenceInfoFilter
+
+    /**
+     * @see MPresenceInfoFilter
+     */
+    void AcceptPersonFilterL( const TDesC8& aFieldName );
+    
+    void AcceptServiceFilterL( 
+            const TDesC8& aServiceName,
+            const TDesC8& aFieldName );
+    
+    void AcceptDeviceFilterL( 
+            const TDesC8& aDeviceName,
+            const TDesC8& aFieldName );
+    
+    TBool MatchPersonFilter( const TDesC8& aFieldName ) const;
+    
+    TBool MatchServiceFilterL( 
+            const TDesC8& aServiceName,
+            const TDesC8& aFieldName ) const;
+    
+    TBool MatchDeviceFilterL( 
+            const TDesC8& aDeviceName,
+            const TDesC8& aFieldName ) const;
+
+public: // Internal versions of api
+
+public: // New functions
+    /**
+     * Internalizes object data from given stream.
+     * @param aStream Stream to read.
+     */
+    IMPORT_C void InternalizeL( RReadStream& aStream );
+
+    /**
+     * Compares this filter to the given filter in a set-theoretic
+     * sense, whether aSource is a proper subset of this class.
+     * @param aCompare The filter to compare with 
+     * @return ETrue if the given filter is a proper subset of this filter
+     */
+    IMPORT_C TBool Contains( CPresenceInfoFilterImp& aCompare );
+
+    /**
+     * Compares this filter to the given filter
+     * @param aSource The filter to compare with 
+     * @return ETrue if the given filter is same
+     */
+    IMPORT_C TBool operator==( CPresenceInfoFilterImp& aSource );
+
+    /**
+     * Compares this filter to the given filter
+     * @param aSource The filter to compare with 
+     * @return ETrue if the given filter is not same
+     */
+    IMPORT_C TBool operator!=( CPresenceInfoFilterImp& aSource );
+
+    /**
+     * Create a new filter which is the union of "first" filter and the 
+     * "second" filter.
+     * @param aFirst The first filter to use
+     * @param aSecond The second filter to use
+     * @return A new filter which is the union, ownership transferred
+     */
+    IMPORT_C static CPresenceInfoFilterImp* UnionL( 
+            CPresenceInfoFilterImp& aFirst,
+            CPresenceInfoFilterImp& aSecond );
+
+private: // Helper functions
+
+    /**
+     * Check if the collection of one-to-many filter infoname to fieldnames
+     * mappings accepts the given filter parameters.
+     * @param aFieldSet The field set to use
+     * @param aInfoName The info name string with wildcards (*, ?)
+     * @param aFieldName The field name string with wildcards (*, ?)
+     * @return ETrue if there was a match
+     */
+    TBool MatchFilterL(
+            const RXIMPObjOwningPtrArray< CFilterField >& aFieldSet, 
+            const TDesC8& aInfoName,
+            const TDesC8& aFieldName ) const;
+
+    /**
+     * Externalize given array.
+     */
+    void ExternalizeArrayL( 
+        const CDesC8ArraySeg* aArray, RWriteStream& aStream ) const;
+
+    /**
+     * Internalize given array.
+     */
+    void InternalizeArrayL( 
+        CDesC8ArraySeg* aArray, RReadStream& aStream );
+
+    /**
+     * Externalize a field set.
+     */
+    void ExternalizeFieldSetL(
+            const RXIMPObjOwningPtrArray<CFilterField>& aFieldSet,
+            RWriteStream& aStream ) const;
+    
+    /**
+     * Internalize a field set.
+     */
+    void InternalizeFieldSetL(
+            RXIMPObjOwningPtrArray<CFilterField>& aFieldSet,
+            RReadStream& aStream );
+
+    /**
+     * Helper for adding a filter field to the filter field
+     * set.
+     * @param aFieldSet the set into which to add
+     * @param aServiceType The service type
+     * @param aFieldType The field type
+     */
+    void AcceptFilterL( 
+            RXIMPObjOwningPtrArray< CFilterField >& aFieldSet,
+            const TDesC8& aServiceType,
+            const TDesC8& aFieldType );
+
+    /**
+     * Create an union of the given field sets.
+     * @aSource Source for union
+     * @aTarget Target for union
+     */
+    void UnionOfFieldsL( 
+            RXIMPObjOwningPtrArray< CFilterField>& aSource, 
+            RXIMPObjOwningPtrArray< CFilterField>& aTarget );
+
+    /** 
+     * @return ETrue iff aCompare is a proper subset of aA, i.e. it's contained fully,
+     * based on person filter fields
+     */
+    TBool ContainsPersonFilter( 
+            CDesC8ArraySeg* aA,
+            CDesC8ArraySeg* aCompare );
+
+    /**
+     * @return ETrue iff aCompare is a proper subset of aA, i.e. it's contained fully,
+     * based on filter field array comparison
+     */
+    TBool ContainsFilterFields(
+            RXIMPObjOwningPtrArray<CFilterField>& aA,
+            RXIMPObjOwningPtrArray<CFilterField>& aCompare 
+            );
+
+private: // data
+
+    // owned
+    CDesC8ArraySeg* iPersonFilter;
+
+    // owned, set of fields
+    RXIMPObjOwningPtrArray<CFilterField> iServiceFilter;
+    
+    // owned, set of fields
+    RXIMPObjOwningPtrArray<CFilterField> iDeviceFilter;
+    };
+
+
+#endif // CPRESENCEINFOFILTERIMP_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresencedatamodel/presencepublishing/presenceinfoimp.h	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  MPresenceInfo API object implementation.
+*
+*/
+
+#ifndef CPRESENCEINFOIMP_H
+#define CPRESENCEINFOIMP_H
+
+#include "ximpapidataobjbase.h"
+#include "presenceapiobjbase.h"
+#include <presenceinfo.h>
+#include <s32strm.h>
+#include "presencetypehelpers.h"
+
+class CPersonPresenceInfoImp;
+class CServicePresenceInfoImp;
+class CDevicePresenceInfoImp;
+class CPresenceInfoFilterImp;
+
+
+/**
+ * MPresenceInfo API object implementation.
+ *
+ * @lib ximpdatamodel.dll
+ * @since S60 v3.2
+ */
+NONSHARABLE_CLASS( CPresenceInfoImp ): public CXIMPApiDataObjBase,
+                                           public MPresenceInfo
+    {
+    public:
+    /** The class ID. */
+    enum { KClassId = PRIMP_CLSID_CPRESENCEINFOIMP };
+
+
+public:
+
+    IMPORT_C static CPresenceInfoImp* NewLC();
+    IMPORT_C static CPresenceInfoImp* NewL();
+    virtual ~CPresenceInfoImp();
+
+private:
+
+    CPresenceInfoImp();
+    void ConstructL();
+
+public: // From MXIMPBase
+
+    /**
+     * Implementation of MXIMPBase interface methods
+     * @see MXIMPBase
+     */
+    XIMPIMP_DECLARE_IF_BASE_METHODS
+
+public: // From CXIMPApiDataObjBase
+
+    /**
+     * @see CXIMPApiDataObjBase
+     */
+    XIMPIMP_DECLARE_DATAOBJ_BASE_METHODS
+
+public: // From MPresenceInfo
+
+    const MPersonPresenceInfo* PersonPresence() const;
+    MPersonPresenceInfo* PersonPresence();
+    void SetPersonPresenceL( MPersonPresenceInfo* aPersonPresence );
+
+    TInt ServicePresenceCount() const;
+    const MServicePresenceInfo& ServicePresenceAt( TInt aIndex ) const;
+    void LookupServicePresenceByServiceType( MServicePresenceInfo*& aServicePresence,
+                                             const TDesC8& aMatch ) const;
+    void AddServicePresenceL( MServicePresenceInfo* aServicePresence );
+
+    TInt DevicePresenceCount() const;
+    const MDevicePresenceInfo& DevicePresenceAt( TInt aIndex ) const;
+    void AddDevicePresenceL( MDevicePresenceInfo* aDevicePresence );
+
+public: // New functions
+
+    /**
+     * Internalizes object data from given stream.
+     * @param aStream Stream to read.
+     */
+    IMPORT_C void InternalizeL( RReadStream& aStream );
+
+    /**
+     * Creates and returns a filtered copy of this class, according
+     * to the given filter.
+     * Ownership transferred.
+     * @param aFilter The filter to use
+     * @return New filtered info imp instance
+     */
+    IMPORT_C CPresenceInfoImp* FilteredInfoLC(
+            const CPresenceInfoFilterImp& aFilter
+            ) const;
+
+private: // data
+
+
+    /**
+     * OWN: 
+     */
+    CPersonPresenceInfoImp* iPersonPresence;
+
+    /**
+     * OWN: 
+     */
+    RPrServicePrInfoArray iServicePresences;
+
+    /**
+     * OWN: 
+     */
+    RPrDevicePrInfoArray iDevicePresences;
+
+    };
+
+
+#endif // CPRESENCEINFOIMP_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresencedatamodel/presencepublishing/presencewatcherinfoimp.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,297 @@
+/*
+* 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:  MPresenceWatcherInfo API object implementation.
+*
+*/
+
+
+#include "presencewatcherinfoimp.h"
+#include "ximpidentityimp.h"
+#include "ximprbufhelpers.h"
+#include "ximpobjecthelpers.h"
+
+// ============================ MEMBER FUNCTIONS =============================
+
+// ---------------------------------------------------------------------------
+// CPresenceWatcherInfoImp::NewLC()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CPresenceWatcherInfoImp* CPresenceWatcherInfoImp::NewLC(
+                            const MPresenceWatcherInfo::TWatcherType aType,
+                            const MXIMPIdentity& aIdentity,
+                            const TDesC16& aDisplayName )
+    {
+    CPresenceWatcherInfoImp* self = new( ELeave ) CPresenceWatcherInfoImp;
+    CleanupStack::PushL( self );
+    self->ConstructL( aType, aIdentity, aDisplayName );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceWatcherInfoImp::NewLC()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CPresenceWatcherInfoImp* CPresenceWatcherInfoImp::NewLC()
+    {
+    CPresenceWatcherInfoImp* self = new( ELeave ) CPresenceWatcherInfoImp;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CPresenceWatcherInfoImp::NewL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CPresenceWatcherInfoImp* CPresenceWatcherInfoImp::NewL()
+    {
+    CPresenceWatcherInfoImp* self = NewLC();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceWatcherInfoImp::NewFromStreamLC()
+// ---------------------------------------------------------------------------
+//
+XIMPIMP_IMPLEMENT_DATAOBJ_NEWFROMSTREAM( CPresenceWatcherInfoImp )
+
+
+// ---------------------------------------------------------------------------
+// Implement supported interface access.
+// ---------------------------------------------------------------------------
+//
+XIMPIMP_IF_BASE_GET_INTERFACE_BEGIN( CPresenceWatcherInfoImp, 
+                                     MPresenceWatcherInfo )
+XIMPIMP_IF_BASE_GET_INTERFACE_END()
+
+
+XIMPIMP_IF_BASE_GET_CONST_INTERFACE_BEGIN( CPresenceWatcherInfoImp, 
+                                           MPresenceWatcherInfo )
+XIMPIMP_IF_BASE_GET_INTERFACE_END()
+
+// ---------------------------------------------------------------------------
+// CPresenceWatcherInfoImp::~CPresenceWatcherInfoImp()
+// ---------------------------------------------------------------------------
+//
+CPresenceWatcherInfoImp::~CPresenceWatcherInfoImp()
+    {
+    iDisplayName.Close();
+    delete iIdentity;
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceWatcherInfoImp::CPresenceWatcherInfoImp()
+// ---------------------------------------------------------------------------
+//
+CPresenceWatcherInfoImp::CPresenceWatcherInfoImp()
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// CPresenceWatcherInfoImp::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void CPresenceWatcherInfoImp::ConstructL()
+    {
+    iDisplayName.CreateL( 0 );
+    iIdentity = CXIMPIdentityImp::NewLC();
+    CleanupStack::Pop( iIdentity );
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceWatcherInfoImp::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void CPresenceWatcherInfoImp::ConstructL(
+                            const MPresenceWatcherInfo::TWatcherType aType,
+                            const MXIMPIdentity& aIdentity,
+                            const TDesC16& aDisplayName )
+    {
+    iType = aType;
+
+    const CXIMPIdentityImp* sourceIdentity =
+    TXIMPGetImpClassOrPanic< const CXIMPIdentityImp >::From( aIdentity );
+    iIdentity = TXIMPObjectCloner< CXIMPIdentityImp >::CloneL( *sourceIdentity );
+    
+    iDisplayName.CreateL( aDisplayName );
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceWatcherInfoImp::ExternalizeL()
+// ---------------------------------------------------------------------------
+//
+void CPresenceWatcherInfoImp::ExternalizeL( RWriteStream& aStream ) const
+    {
+    aStream.WriteInt32L( iType );
+    iIdentity->ExternalizeL( aStream );
+    XIMPRBuf16Helper::ExternalizeL( iDisplayName, aStream );
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceWatcherInfoImp::InternalizeL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CPresenceWatcherInfoImp::InternalizeL( RReadStream& aStream )
+    {
+    iType = ( MPresenceWatcherInfo::TWatcherType ) aStream.ReadInt32L();
+    iIdentity->InternalizeL( aStream );
+    XIMPRBuf16Helper::InternalizeL( iDisplayName, aStream );
+    }
+
+// ---------------------------------------------------------------------------
+// From MPresenceWatcherInfo class.
+// CPresenceWatcherInfoImp::WatcherId()
+// ---------------------------------------------------------------------------
+//
+const MXIMPIdentity& CPresenceWatcherInfoImp::WatcherId() const
+    {
+    return *iIdentity;
+    }
+
+// ---------------------------------------------------------------------------
+// From MPresenceWatcherInfo class.
+// CPresenceWatcherInfoImp::WatcherDisplayName()
+// ---------------------------------------------------------------------------
+//
+const TDesC16& CPresenceWatcherInfoImp::WatcherDisplayName() const
+    {
+    return iDisplayName;
+    }
+    
+    
+
+// ---------------------------------------------------------------------------
+// From MPresenceWatcherInfo class.
+// CPresenceWatcherInfoImp::WatcherType()
+// ---------------------------------------------------------------------------
+//
+MPresenceWatcherInfo::TWatcherType CPresenceWatcherInfoImp::WatcherType() const
+    {
+    return iType;
+    }    
+    
+    
+// ---------------------------------------------------------------------------
+// From MPresenceWatcherInfo class.
+// CPresenceWatcherInfoImp::SetWatcherIdL()
+// ---------------------------------------------------------------------------
+//
+void CPresenceWatcherInfoImp::SetWatcherIdL( MXIMPIdentity* aIdentity )
+    {
+    User::LeaveIfError( aIdentity == NULL ? KErrArgument : KErrNone );
+
+    CXIMPIdentityImp* identityImp =
+    TXIMPGetImpClassOrPanic< CXIMPIdentityImp>::From( *aIdentity );
+
+    delete iIdentity;
+    iIdentity = identityImp; 
+    }    
+
+
+// ---------------------------------------------------------------------------
+// From MPresenceWatcherInfo class.
+// CPresenceWatcherInfoImp::SetWatcherDisplayNameL()
+// ---------------------------------------------------------------------------
+//
+void CPresenceWatcherInfoImp::SetWatcherDisplayNameL( 
+    const TDesC16& aDisplayName )
+    {
+    HBufC16* displayNameBuf = aDisplayName.AllocL();
+    iDisplayName.Close();
+    iDisplayName.Assign( displayNameBuf );
+    }    
+
+
+// ---------------------------------------------------------------------------
+// From MPresenceWatcherInfo class.
+// CPresenceWatcherInfoImp::SetWatcherTypeL()
+// ---------------------------------------------------------------------------
+//
+void CPresenceWatcherInfoImp::SetWatcherTypeL( 
+    MPresenceWatcherInfo::TWatcherType aType )
+    {
+    iType = aType;
+    }    
+
+
+// ---------------------------------------------------------------------------
+// CPresenceWatcherInfoImp::SetIdentityL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CPresenceWatcherInfoImp::SetIdentity( CXIMPIdentityImp* aIdentity )
+    {
+    delete iIdentity;
+    iIdentity = aIdentity;
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceWatcherInfoImp::SetIdentityL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CPresenceWatcherInfoImp::SetDisplayName( HBufC16* aDisplayName )
+    {
+    iDisplayName.Close();
+    iDisplayName.Assign( aDisplayName );
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceWatcherInfoImp::GroupIdLinearOrder()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CPresenceWatcherInfoImp::IdLinearOrder(
+        const CPresenceWatcherInfoImp& aA,
+        const CPresenceWatcherInfoImp& aB )
+    {
+    return aA.IdentityImp().Compare( aB.IdentityImp() );
+    }
+// ---------------------------------------------------------------------------
+// CPresenceWatcherInfoImp::Identity()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C const CXIMPIdentityImp& CPresenceWatcherInfoImp::IdentityImp() const
+    {
+    return *iIdentity;
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceWatcherInfoImp::EqualsContent()
+// ---------------------------------------------------------------------------
+//
+TBool CPresenceWatcherInfoImp::EqualsContent( 
+    const CXIMPApiDataObjBase& aOtherInstance ) const
+    {
+    const CPresenceWatcherInfoImp* tmp =
+    TXIMPGetImpClassOrPanic< const CPresenceWatcherInfoImp >::From( 
+                                                        aOtherInstance.Base() );
+
+    TBool same = ETrue;
+    TBool x;
+    x = iIdentity->EqualsContent( *( tmp->iIdentity ) );
+    same &= x;
+
+    x = 0 == iDisplayName.Compare( tmp->iDisplayName );
+    same &= x;
+
+    x = iType == iType;
+    same &= x;
+
+    // add more comparisons in a similar way...
+
+    return same;
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresencedatamodel/presencepublishing/presencewatcherinfoimp.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,143 @@
+/*
+* 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:  MPresentityGroupInfo API object implementation.
+*
+*/
+
+#ifndef CPRESENTITYWATCHERINFOIMP_H
+#define CPRESENTITYWATCHERINFOIMP_H
+
+#include <e32std.h>
+#include <s32strm.h>
+#include <presencewatcherinfo.h>
+#include "ximpapidataobjbase.h"
+#include "presenceapiobjbase.h"
+
+
+class CXIMPIdentityImp;
+
+/**
+ * MPresenceInfo API object implementation.
+ *
+ * @lib ximpdatamodel.dll
+ * @since S60 v3.2
+ */
+NONSHARABLE_CLASS( CPresenceWatcherInfoImp ): public CXIMPApiDataObjBase,
+                                                  public MPresenceWatcherInfo
+    {
+    public:
+    /** The class ID. */
+    enum { KClassId = PRIMP_CLSID_CPRESENCEWATCHERINFOIMP };
+
+public:
+
+    IMPORT_C static CPresenceWatcherInfoImp* NewLC(
+                    const MPresenceWatcherInfo::TWatcherType aType,
+                    const MXIMPIdentity& aIdentity,
+                    const TDesC16& aDisplayName );
+    IMPORT_C static CPresenceWatcherInfoImp* NewLC();
+    IMPORT_C static CPresenceWatcherInfoImp* NewL();
+    virtual ~CPresenceWatcherInfoImp();
+
+private:
+
+    CPresenceWatcherInfoImp();
+    void ConstructL();
+    void ConstructL( const MPresenceWatcherInfo::TWatcherType aType,
+                     const MXIMPIdentity& aIdentity,
+                     const TDesC16& aDisplayName );
+    
+    /**
+     * @see CXIMPApiDataObjBase
+     */
+    XIMPIMP_DECLARE_DATAOBJ_BASE_PRIV_METHODS
+
+public: // From MXIMPBase
+
+    /**
+     * Implementation of MXIMPBase interface methods
+     * @see MXIMPBase
+     */
+    XIMPIMP_DECLARE_IF_BASE_METHODS
+
+    /**
+     * @see CXIMPApiDataObjBase
+     */
+    XIMPIMP_DECLARE_DATAOBJ_BASE_METHODS
+
+public: // From MPresenceWatcherInfo
+
+    const MXIMPIdentity& WatcherId() const;
+    const TDesC16& WatcherDisplayName() const;
+    MPresenceWatcherInfo::TWatcherType WatcherType() const;
+    void SetWatcherIdL( MXIMPIdentity* aIdentity );
+    void SetWatcherDisplayNameL( const TDesC16& aDisplayName );
+    void SetWatcherTypeL( MPresenceWatcherInfo::TWatcherType aType );    
+    
+    
+
+
+public: // New functions
+
+    /**
+     * Internalizes object data from given stream.
+     * @param aStream Stream to read.
+     */
+    IMPORT_C void InternalizeL( RReadStream& aStream );
+
+    /**
+     * Set identity
+     */
+    IMPORT_C void SetIdentity( CXIMPIdentityImp* aIdentity );
+
+    /**
+     * Set identity
+     */
+    IMPORT_C void SetDisplayName( HBufC16* aDisplayName );
+
+    /**
+     * TLinearOrder for ordering based on stored group id,
+     * when this class is used within an RPointerArray or derivatives.
+     */
+    IMPORT_C static TInt IdLinearOrder(
+            const CPresenceWatcherInfoImp& aA,
+            const CPresenceWatcherInfoImp& aB );
+
+    /**
+     * Access to identity object
+     * @return Identity
+     */
+    IMPORT_C const CXIMPIdentityImp& IdentityImp() const;
+
+private: // data
+
+    /**
+     * Identity
+     */
+    CXIMPIdentityImp* iIdentity;
+
+    /**
+     * Displayname
+     */
+    RBuf16 iDisplayName;
+
+    /**
+     * Watcher type
+     */
+    MPresenceWatcherInfo::TWatcherType iType;
+    
+    };
+
+
+#endif // CPRESENTITYWATCHERINFOIMP_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresencedatamodel/presencepublishing/presencewatcherlisteventimp.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,313 @@
+/*
+* 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 watcher list event implementation.
+ *
+*/
+
+#include "presencewatcherlisteventimp.h"
+#include "presencewatcherinfoimp.h"
+#include "ximpobjecthelpers.h"
+#include "ximpidentityimp.h"
+#include "ximpdatasubscriptionstateimp.h"
+#include <s32strm.h>
+
+
+// ---------------------------------------------------------------------------
+// CPresenceWatcherListEventImp::NewLC()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CPresenceWatcherListEventImp* CPresenceWatcherListEventImp::NewLC(
+        RPrWatLstInfoImpArray* aNew,
+        RPrWatLstInfoImpArray* aCurrent,
+        RPrWatLstInfoImpArray* aDisappeared,
+        CXIMPDataSubscriptionStateImp* aState
+        )
+    {
+    CPresenceWatcherListEventImp* self = new( ELeave ) CPresenceWatcherListEventImp();
+    CleanupStack::PushL( self );
+    self->ConstructL( aNew, aCurrent, aDisappeared, aState );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceWatcherListEventImp::NewFromStreamLC()
+// ---------------------------------------------------------------------------
+//
+CXIMPApiEventBase* CPresenceWatcherListEventImp::NewFromStreamLC( RReadStream& aStream )
+    {
+    CPresenceWatcherListEventImp* self = new( ELeave ) CPresenceWatcherListEventImp;
+    CleanupStack::PushL( self );
+    self->ConstructL( aStream );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceWatcherListEventImp::~CPresenceWatcherListEventImp()
+// ---------------------------------------------------------------------------
+//
+CPresenceWatcherListEventImp::~CPresenceWatcherListEventImp()
+    {
+    if( iConstructedFromStream )
+        {
+        delete iNewWatchers;
+        delete iCurrent;
+        delete iDisappeared;
+        iCurrent = NULL;
+        }
+    if( iOwnsCurrent )
+        {
+        delete iCurrent;
+        }
+
+    delete iSubscriptionState;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CPresenceWatcherListEventImp::CPresenceWatcherListEventImp()
+// ---------------------------------------------------------------------------
+//
+CPresenceWatcherListEventImp::CPresenceWatcherListEventImp()
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// CPresenceWatcherListEventImp::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void CPresenceWatcherListEventImp::ConstructL(
+        RPrWatLstInfoImpArray* aNew,
+        RPrWatLstInfoImpArray* aCurrent,
+        RPrWatLstInfoImpArray* aDisappeared,
+        CXIMPDataSubscriptionStateImp* aState )
+    {
+    iNewWatchers = aNew;
+    if( iCurrent )
+        {
+        iCurrent = aCurrent;
+        }
+    else
+        {
+        iCurrent = new ( ELeave ) RPrWatLstInfoImpArray;
+        iOwnsCurrent = ETrue;
+        }
+    iDisappeared = aDisappeared;
+    iSubscriptionState = aState;
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceWatcherListEventImp::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void CPresenceWatcherListEventImp::ConstructL( RReadStream& aStream )
+    {
+    iConstructedFromStream = ETrue;
+
+    iNewWatchers = new ( ELeave ) RPrWatLstInfoImpArray;
+    iCurrent = new ( ELeave ) RPrWatLstInfoImpArray;
+    iDisappeared = new ( ELeave ) RPrWatLstInfoImpArray;
+    iSubscriptionState = CXIMPDataSubscriptionStateImp::NewL();
+
+    FillArrayFromStreamL( *iNewWatchers, aStream );
+    FillArrayFromStreamL( *iCurrent, aStream );
+    FillArrayFromStreamL( *iDisappeared, aStream );
+    
+    iSubscriptionState->InternalizeL( aStream );
+    }
+
+// ---------------------------------------------------------------------------
+// Implement supported interface access.
+// ---------------------------------------------------------------------------
+//
+XIMPIMP_IF_BASE_GET_INTERFACE_BEGIN( CPresenceWatcherListEventImp,
+                                     MPresenceWatcherListEvent )
+    XIMPIMP_IF_BASE_GET_CLASS( CXIMPApiEventBase, this )
+XIMPIMP_IF_BASE_GET_INTERFACE_END()
+
+XIMPIMP_IF_BASE_GET_CONST_INTERFACE_BEGIN( CPresenceWatcherListEventImp,
+                                           MPresenceWatcherListEvent )
+    XIMPIMP_IF_BASE_GET_CONST_CLASS( CXIMPApiEventBase, this )                                            
+XIMPIMP_IF_BASE_GET_INTERFACE_END()
+
+
+
+// ---------------------------------------------------------------------------
+// Implement methods from base event interface and base event class
+// ---------------------------------------------------------------------------
+//
+XIMPIMP_IMPLEMENT_EVENT_BASE_METHODS( CPresenceWatcherListEventImp,
+                                      MPresenceWatcherListEvent )
+
+// ---------------------------------------------------------------------------
+// CPresenceWatcherListEventImp::EqualsContent()
+// ---------------------------------------------------------------------------
+//
+TBool CPresenceWatcherListEventImp::EqualsContent( 
+    const CXIMPApiEventBase& aOtherInstance ) const
+    {
+    const CPresenceWatcherListEventImp* tmp =
+    TXIMPGetImpClassOrPanic< const CPresenceWatcherListEventImp >::From( 
+                                                        aOtherInstance.Base() );
+    TBool same = ETrue;
+    TBool x = TXIMPEqualsContent< CPresenceWatcherInfoImp >::Array( *iNewWatchers, *( tmp->iNewWatchers ) );
+    same &= x;
+
+    x = TXIMPEqualsContent< CPresenceWatcherInfoImp >::Array( *iCurrent, *( tmp->iCurrent ) );
+    same &= x;
+
+    x = TXIMPEqualsContent< CPresenceWatcherInfoImp >::Array( *iDisappeared, *( tmp->iDisappeared ) );
+    same &= x;
+
+    x = iSubscriptionState->EqualsContent( *tmp->iSubscriptionState );
+    same &= x;
+
+    return same;
+    }
+
+// ---------------------------------------------------------------------------
+// From class CXIMPApiEventBase.
+// CPresenceWatcherListEventImp::ExternalizeL()
+// ---------------------------------------------------------------------------
+//
+void CPresenceWatcherListEventImp::ExternalizeL( RWriteStream& aStream ) const
+    {
+    WriteArrayToStreamL( *iNewWatchers, aStream );
+    WriteArrayToStreamL( *iCurrent, aStream );
+    WriteArrayToStreamL( *iDisappeared, aStream );
+    iSubscriptionState->ExternalizeL( aStream );
+    }
+
+
+// ---------------------------------------------------------------------------
+// From MPresenceWatcherListEvent class.
+// CPresenceWatcherListEventImp::NewWatchersCount()
+// ---------------------------------------------------------------------------
+//
+TInt CPresenceWatcherListEventImp::NewWatchersCount() const
+    {
+    return iNewWatchers->Count();
+    }
+
+// ---------------------------------------------------------------------------
+// From MPresenceWatcherListEvent class.
+// CPresenceWatcherListEventImp::NewWatcher()
+// ---------------------------------------------------------------------------
+//
+const MPresenceWatcherInfo&
+            CPresenceWatcherListEventImp::NewWatcher( TInt aIndex ) const
+    {
+    return *(*iNewWatchers)[ aIndex ];
+    }
+
+// ---------------------------------------------------------------------------
+// From MPresenceWatcherListEvent class.
+// CPresenceWatcherListEventImp::DisappearedWatchersCount()
+// ---------------------------------------------------------------------------
+//
+TInt CPresenceWatcherListEventImp::DisappearedWatchersCount() const
+    {
+    return iDisappeared->Count();
+    }
+
+// ---------------------------------------------------------------------------
+// From MPresenceWatcherListEvent class.
+// CPresenceWatcherListEventImp::DisappearedWatcher()
+// ---------------------------------------------------------------------------
+//
+const MPresenceWatcherInfo&
+            CPresenceWatcherListEventImp::DisappearedWatcher( TInt aIndex ) const
+    {
+    return *(*iDisappeared)[ aIndex ];
+    }
+
+
+// ---------------------------------------------------------------------------
+// From MPresenceWatcherListEvent class.
+// CPresenceWatcherListEventImp::CurrentWatchersCount()
+// ---------------------------------------------------------------------------
+//
+TInt CPresenceWatcherListEventImp::CurrentWatchersCount() const
+    {
+    return iCurrent->Count();
+    }
+
+// ---------------------------------------------------------------------------
+// From MPresenceWatcherListEvent class.
+// CPresenceWatcherListEventImp::CurrentWatcher()
+// ---------------------------------------------------------------------------
+//
+const MPresenceWatcherInfo&
+            CPresenceWatcherListEventImp::CurrentWatcher( TInt aIndex ) const
+    {
+    return *(*iCurrent)[ aIndex ];
+    }
+
+
+
+
+
+
+// ---------------------------------------------------------------------------
+// From class MPresenceWatcherListEvent.
+// CPresenceWatcherListEventImp::DataSubscriptionState()
+// ---------------------------------------------------------------------------
+//
+const MXIMPDataSubscriptionState&
+    CPresenceWatcherListEventImp::DataSubscriptionState() const
+    {
+    return *iSubscriptionState;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CPresenceWatcherListEventImp::WriteArrayToStreamL()
+// ---------------------------------------------------------------------------
+//
+void CPresenceWatcherListEventImp::WriteArrayToStreamL(
+        RPrWatLstInfoImpArray& aArray, RWriteStream& aStream ) const
+    {
+    TInt count = aArray.Count();
+    aStream.WriteInt32L( count );
+        {
+        for( TInt a = 0; a < count; ++a )
+            {
+            aArray[ a ]->ExternalizeL( aStream );
+            }
+        }
+    }
+
+
+// ---------------------------------------------------------------------------
+// CPresenceWatcherListEventImp::FillArrayFromStreamL
+// ---------------------------------------------------------------------------
+//
+void CPresenceWatcherListEventImp::FillArrayFromStreamL(
+        RPrWatLstInfoImpArray& aArray,
+        RReadStream& aStream )
+    {
+    TInt count = aStream.ReadInt32L();
+    for( TInt a = 0; a < count; ++a )
+        {
+        // the stream MUST be in order (since it was externalized by this class)
+        CPresenceWatcherInfoImp* newInfo = CPresenceWatcherInfoImp::NewLC();
+        newInfo->InternalizeL( aStream );
+        aArray.AppendL( newInfo );
+        CleanupStack::Pop(); // newInfo
+        }
+    }
+
+
+// End of file
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresencedatamodel/presencepublishing/presencewatcherlisteventimp.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,152 @@
+/*
+* 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:  MPresentityGroupList API object implementation.
+ *
+*/
+
+#ifndef CPRESENCEWATCHERLISTEVENTIMP_H
+#define CPRESENCEWATCHERLISTEVENTIMP_H
+
+#include <presencewatcherlistevent.h>
+#include "ximpapieventbase.h"
+#include "presencetypehelpers.h"
+
+class RReadStream;
+class CPresenceWatcherInfoImp;
+class CXIMPIdentityImp;
+class CXIMPDataSubscriptionStateImp;
+
+/**
+ * MOwnPresenceEvent API object implementation.
+ *
+ * @lib ximpdatamodel.dll
+ * @since S60 v3.2
+ */
+NONSHARABLE_CLASS( CPresenceWatcherListEventImp ): public CXIMPApiEventBase,
+                                                       public MPresenceWatcherListEvent
+    {
+public:
+    /** The class ID. */
+    enum { KClassId = PRIMP_CLSID_CPRESENCEWATCHERLISTEVENTIMP };
+
+public:
+    /**
+     * Exported instantiation method for initializing
+     * new event object.
+     */
+    IMPORT_C static CPresenceWatcherListEventImp* NewLC(
+            RPrWatLstInfoImpArray* aNew,
+            RPrWatLstInfoImpArray* aCurrent,
+            RPrWatLstInfoImpArray* aDisappeared,
+            CXIMPDataSubscriptionStateImp* aState
+            );
+
+    /**
+     * Instantiation method for event automation.
+     * Method signature must be exactly this to work
+     * with event delivery automation system.
+     *
+     * Event implementation must be registered to
+     * XIMPEventCodec KXIMPEventConstructorTable.
+     */
+    static CXIMPApiEventBase* NewFromStreamLC( RReadStream& aStream );
+
+    virtual ~CPresenceWatcherListEventImp();
+
+private:
+    CPresenceWatcherListEventImp();
+
+    void ConstructL(
+            RPrWatLstInfoImpArray* aNew,
+            RPrWatLstInfoImpArray* aCurrent,
+            RPrWatLstInfoImpArray* aDisappeared,
+            CXIMPDataSubscriptionStateImp* aState
+            );
+
+    void ConstructL( RReadStream& aStream );
+
+    /**
+     * Helper for externalize.
+     */
+    void WriteArrayToStreamL( RPrWatLstInfoImpArray& aArray,
+            RWriteStream& aStream ) const;
+
+    /**
+     * Helper for internalize
+     */
+    void FillArrayFromStreamL( RPrWatLstInfoImpArray& aArray,
+            RReadStream& aStream );
+
+
+public: // From API base interfaces
+
+    /**
+     * Implementation of MXIMPBase interface methods
+     * @see MXIMPBase
+     */
+    XIMPIMP_DECLARE_IF_BASE_METHODS
+
+
+    /**
+     * Implementation of MXIMPEventBase interface and
+     * CXIMPApiEventBase methods
+     *
+     * @see MXIMPEventBase
+     * @see CXIMPApiEventBase
+     */
+    XIMPIMP_DECLARE_EVENT_BASE_METHODS
+
+
+public: // From MPresenceWatcherListEvent
+
+    TInt NewWatchersCount() const;
+    const MPresenceWatcherInfo& NewWatcher( TInt aIndex ) const;
+
+    TInt DisappearedWatchersCount() const;
+    const MPresenceWatcherInfo& DisappearedWatcher( TInt aIndex ) const;
+
+    TInt CurrentWatchersCount() const;
+    const MPresenceWatcherInfo& CurrentWatcher( TInt aIndex ) const;
+
+
+    const MXIMPDataSubscriptionState& DataSubscriptionState() const;
+
+private: // data
+
+    /**
+     * ETrue if constructed from stream.
+     */
+    TBool iConstructedFromStream;
+
+    /**
+     * Group informations.
+     * Owns if constructed from stream. Otherwise does not own.
+     */
+    RPrWatLstInfoImpArray* iNewWatchers;
+    RPrWatLstInfoImpArray* iCurrent;
+    RPrWatLstInfoImpArray* iDisappeared;
+
+    /**
+     * Current array owning status
+     */
+    TBool iOwnsCurrent;
+
+    /**    
+     * Subscription state
+     */
+    CXIMPDataSubscriptionStateImp* iSubscriptionState;
+    };
+
+
+#endif // CPRESENCEWATCHERLISTEVENTIMP_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresencedatamodel/presencepublishing/watcherlistsubscriptionitem.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,200 @@
+/*
+* 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 Service Connection presence watcher list subscription implementation.
+*
+*/
+
+
+#include <badesca.h>
+
+#include "watcherlistsubscriptionitem.h"
+#include "presenceinfofilterimp.h"
+#include "ximpitemparent.h"
+#include "ximppanics.h"
+#include "ximppsccontext.h"
+#include "documentutils.h"
+#include "presencewatcherlisteventimp.h"
+#include "ximpobjecthelpers.h"
+#include "presencetypehelpers.h"
+#include "presencewatcherinfoimp.h"
+#include "ximpidentityimp.h"
+#include "ximpdatasubscriptionstateimp.h"
+
+#include "ximptrace.h"
+
+// ---------------------------------------------------------------------------
+// CWatcherListSubscriptionItem::CWatcherListSubscriptionItem()
+// ---------------------------------------------------------------------------
+//
+CWatcherListSubscriptionItem::CWatcherListSubscriptionItem( MXIMPItemParentBase& aParent )
+: CXIMPSubscriptionItemBase( aParent )
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// CWatcherListSubscriptionItem::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void CWatcherListSubscriptionItem::ConstructL()
+    {
+    BaseConstructL();
+    // empty lists must always exist
+    iCurrentList = new ( ELeave) RPrWatLstInfoImpArray;
+    iNewWatchers = new ( ELeave ) RPrWatLstInfoImpArray;
+    iDisappeared = new ( ELeave ) RPrWatLstInfoImpArray;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CWatcherListSubscriptionItem::NewL()
+// ---------------------------------------------------------------------------
+//
+CWatcherListSubscriptionItem* CWatcherListSubscriptionItem::NewLC( MXIMPItemParentBase& aParent )
+    {
+    CWatcherListSubscriptionItem* self = new( ELeave ) CWatcherListSubscriptionItem( aParent );
+    CleanupClosePushL( *self );
+    self->ConstructL();
+    return self;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CWatcherListSubscriptionItem::~CWatcherListSubscriptionItem()
+// ---------------------------------------------------------------------------
+//
+CWatcherListSubscriptionItem::~CWatcherListSubscriptionItem()
+    {
+    MXIMPItemParent* presCache = static_cast<MXIMPItemParent*>(iParent.GetInterface(PRESENCE_ITEM_PARENT));
+    presCache->RemoveMe( this );
+
+
+    if( iCurrentList )
+        {
+        iCurrentList->Close();
+        }
+    delete iCurrentList;
+
+    Clean();
+    // just in case
+    delete iNewWatchers;
+    delete iDisappeared;
+    }
+
+// ---------------------------------------------------------------------------
+// From MXIMPSubscriptionItem class.
+// CWatcherListSubscriptionItem::SynthesiseSubscriptionEventTo()
+// ---------------------------------------------------------------------------
+//
+void CWatcherListSubscriptionItem::SynthesiseSubscriptionEventToL(
+        MXIMPPscContext* aContext, TBool aForceEvent )
+    {
+    TRACE_1( _L("CWatcherListSubscriptionItem::SynthesiseSubscriptionEventTo() aForce=%d"), aForceEvent );
+    CXIMPDataSubscriptionStateImp* status = StatusLC( aContext );   /// << status
+
+    if( status->DataState() == MXIMPDataSubscriptionState::EDataAvailable || aForceEvent )
+        {
+        CleanupStack::Pop( status );    // >> status
+        CPresenceWatcherListEventImp* newEvent = CPresenceWatcherListEventImp::NewLC(
+                iNewWatchers,
+                aForceEvent ? iCurrentList : NULL,
+                iDisappeared,
+                status );
+                
+        MXIMPItemParent* presCache = static_cast<MXIMPItemParent*>(iParent.GetInterface(PRESENCE_ITEM_PARENT));
+        presCache->AddEventL( *newEvent, aContext );
+        CleanupStack::PopAndDestroy(); // >>> newEvent
+        }
+     else
+        {
+        CleanupStack::PopAndDestroy(); // >>> status
+        }
+    }
+
+
+// ---------------------------------------------------------------------------
+// CWatcherListSubscriptionItem::SetNewListL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CWatcherListSubscriptionItem::SetNewListL(
+                                                RPrWatLstInfoImpArray* aList )
+    {
+    TRACE_1( _L("CWatcherListSubscriptionItem::SetNewListL aList Count=%d"), aList->Count() );
+    RPrWatLstInfoImpArray* tmp = aList;
+    CleanupDeletePushL( tmp );
+
+    TLinearOrder<CPresenceWatcherInfoImp>
+        linearOrder( CPresenceWatcherInfoImp::IdLinearOrder );
+
+    for ( TInt i = 0; i < tmp->Count(); i++ )
+        {
+        // compare against current list
+        CPresenceWatcherInfoImp* info = (*tmp)[ i ];
+        TInt pos = iCurrentList->FindInOrder( info, linearOrder );
+
+        if ( pos == KErrNotFound )
+            {
+            // not found in current list
+            // so must be a fresh watcher
+            iNewWatchers->InsertInOrderL( info, linearOrder );
+            }
+        else
+            {
+            delete (*iCurrentList)[ pos ];
+            iCurrentList->Remove( pos );
+
+            // we must remove the found ones from iCurrentList,
+            // otherwise we will not know what was left. and finding out
+            // the deleted items will be difficult.
+            }
+        }
+
+    // what's left in iCurrentList contains the deleted ones.
+    delete iDisappeared;
+    iDisappeared = iCurrentList;
+
+    // the given list becomes the new list
+    iCurrentList = tmp;
+    CleanupStack::Pop( tmp );
+    iSubscriptionState->SetDataStateL( MXIMPDataSubscriptionState::EDataAvailable );
+    }
+
+// ---------------------------------------------------------------------------
+// CWatcherListSubscriptionItem::Clean()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CWatcherListSubscriptionItem::Clean()
+    {
+    TRACE( _L("CWatcherListSubscriptionItem::Clean") );
+    // empty the lists.
+    // the lists must stay valid for use
+
+    // iNewWatchers and iUpdated are collection from currentlist. Do not delete items.
+    // iDisappeared is only place for items. Delete those.
+
+    iNewWatchers->Reset();
+    iDisappeared->Close();
+    }
+
+// ---------------------------------------------------------------------------
+// From CXIMPSubscriptionItemBase class.
+// CWatcherListSubscriptionItem::CleanExpired()
+// ---------------------------------------------------------------------------
+//
+void CWatcherListSubscriptionItem::CleanExpired()
+    {
+
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresencedatamodel/presencepublishing/watcherlistsubscriptionitem.h	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  Presence Service Connection group list subscription implementation.
+*
+*/
+
+#ifndef CPSCWATCHERLISTSUBSCRIPTIONITEM_H
+#define CPSCWATCHERLISTSUBSCRIPTIONITEM_H
+
+#include <e32base.h>
+#include "presenceinfoimp.h"
+#include "ximpsubscriptionitem.h"
+#include "presencetypehelpers.h"
+#include "ximpsubscriptionitembase.h"
+
+class MXIMPItemParentBase;
+class MXIMPPscContext;
+class CDesC16Array;
+class CPresenceWatcherInfoImp;
+
+/**
+ * PSC group list subscription implementation
+ *
+ * @since S60 v3.2
+ */
+class CWatcherListSubscriptionItem : public CXIMPSubscriptionItemBase
+    {
+
+public: // Construction and destruction
+
+    /**
+     * Construction
+     * @param aParent. Parent has to be informed when this object is deleted by RemoveMe method.
+     */
+    static CWatcherListSubscriptionItem* NewLC( MXIMPItemParentBase& aParent );
+
+    /**
+     * Destruction
+     * - Remember to inform parent about delete.
+     */
+    ~CWatcherListSubscriptionItem();
+
+private: // Construction and destruction
+
+    /**
+     * Construction
+     * @param aParent. Parent has to be informed when this object is deleted by RemoveMe method.
+     */
+    CWatcherListSubscriptionItem( MXIMPItemParentBase& aParent );
+
+    /**
+     * Construction
+     */
+    void ConstructL();
+
+public: // New methods
+
+    /**
+     * Resolve deltas and replace old current with new list.
+     * @param aList New current list.
+     */
+    IMPORT_C void SetNewListL( RPrWatLstInfoImpArray* aList );
+    
+    /**
+     * Remove the temporary lists.
+     */
+    IMPORT_C void Clean();
+
+public: // From MXIMPSubscriptionItem
+
+    /**
+     * @see MXIMPSubscriptionItem
+     */
+    void SynthesiseSubscriptionEventToL( MXIMPPscContext* aContext, TBool aForceEvent );
+
+private: // From CXIMPSubscriptionItemBase
+
+    /**
+     * @see CXIMPSubscriptionItemBase
+     */
+    void CleanExpired();
+
+
+private: // Data
+
+    /**
+     * Current list of groups.
+     * Owned.
+     */
+    RPrWatLstInfoImpArray* iCurrentList;
+
+    /**
+     * List of created groups (new since last update).
+     * Owned.
+     */
+    RPrWatLstInfoImpArray* iNewWatchers;
+
+    /**
+     * List of deleted groups (removed since last update).
+     * Owned.
+     */
+    RPrWatLstInfoImpArray* iDisappeared;
+
+    };
+
+
+/* ======================================================================== */
+
+
+
+#endif // CPSCWATCHERLISTSUBSCRIPTIONITEM_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresencedatamodel/presencetypehelpers.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,67 @@
+/*
+* 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:  Typedef helpers for really long typenames.
+ *
+*/
+
+#ifndef PRESENCETYPEHELPERS_H
+#define PRESENCETYPEHELPERS_H
+
+#include "ximpapiobjbase.h"
+#include "presenceapiobjbase.h"
+#include <e32base.h>
+
+class CPresentityGroupInfoImp;
+class CPresentityGroupMemberInfoImp;
+class CPresenceWatcherInfoImp;
+class CXIMPIdentityImp;
+class CPresenceGrantRequestInfoImp;
+class CXIMPApiDataObjBase;
+class CPresenceBlockInfoImp;
+class CPresenceInfoFieldImp;
+class CServicePresenceInfoImp;
+class CDevicePresenceInfoImp;
+
+// Key for opening up the typedefs:
+//
+// R(Xyz)Array = RXIMPObjOwningPtrArray<xyz>
+// Pr = Presentity
+// GrpInfo = GroupInfo
+// GrpMemInfo = GroupMemberInfo
+// WatLstInfo = WatcherListInfo
+//
+// When adding new types, follow these conventions.
+//
+
+typedef RXIMPObjOwningPtrArray<CPresentityGroupInfoImp> RPrGrpInfoImpArray;
+typedef RXIMPObjOwningPtrArray<CPresentityGroupMemberInfoImp> RPrGrpMemInfoImpArray;
+typedef RXIMPObjOwningPtrArray<CPresenceWatcherInfoImp> RPrWatLstInfoImpArray;
+typedef RXIMPObjOwningPtrArray<CXIMPIdentityImp> RPrIdImpArray;
+typedef RXIMPObjOwningPtrArray<CPresenceGrantRequestInfoImp> RPrGrntReqInfoImpArray;
+typedef RXIMPObjOwningPtrArray<CPresenceBlockInfoImp> RPrBlockInfoImpArray;
+typedef RXIMPObjOwningPtrArray<CPresenceInfoFieldImp> RPrInfoFieldArray;
+typedef RXIMPObjOwningPtrArray<CServicePresenceInfoImp> RPrServicePrInfoArray;
+typedef RXIMPObjOwningPtrArray<CDevicePresenceInfoImp> RPrDevicePrInfoArray;
+
+struct SPresenceReqParam
+    {
+    CXIMPApiDataObjBase* iParam;
+    TInt iParamType;
+    };
+
+typedef RArray<SPresenceReqParam> RPresenceReqParamArray;
+
+#endif // PRESENCETYPEHELPERS_H
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresencedatamodel/presencewatching/presentitygroupmemberspresencesubscriptionitem.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,363 @@
+/*
+* 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 Service Connection group list subscription implementation.
+*
+*/
+
+
+#include "presentitygroupmemberspresencesubscriptionitem.h"
+#include "groupcontentsubscriptionitem.h"
+#include "presenceinfofilterimp.h"
+#include "ximpitemparent.h"
+#include "ximppanics.h"
+#include "ximppsccontext.h"
+#include "documentutils.h" // Perhaps this should be renamed
+#include "presentitypresenceeventimp.h"
+#include "presentitygroupmemberinfoimp.h"
+#include "ximpidentityimp.h"
+
+#include "ximptrace.h"
+
+// ---------------------------------------------------------------------------
+// CPresentityGroupMembersPresenceSubscriptionItem::CPresentityGroupMembersPresenceSubscriptionItem()
+// ---------------------------------------------------------------------------
+//
+CPresentityGroupMembersPresenceSubscriptionItem::CPresentityGroupMembersPresenceSubscriptionItem( MXIMPItemParentBase& aParent, CGroupContentSubscriptionItem& aContentItem )
+: CXIMPSubscriptionItemBase( aParent ), iContentItem( aContentItem )
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// CPresentityGroupMembersPresenceSubscriptionItem::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void CPresentityGroupMembersPresenceSubscriptionItem::ConstructL()
+    {
+    BaseConstructL();
+    iContentItem.RegisterEventObserverL( this );
+    }
+
+
+// ---------------------------------------------------------------------------
+// CPresentityGroupMembersPresenceSubscriptionItem::NewLC()
+// ---------------------------------------------------------------------------
+//
+CPresentityGroupMembersPresenceSubscriptionItem*
+    CPresentityGroupMembersPresenceSubscriptionItem::NewLC( MXIMPItemParentBase& aParent,
+                                                            CGroupContentSubscriptionItem& aContentItem )
+    {
+    CleanupClosePushL( aContentItem );
+    CPresentityGroupMembersPresenceSubscriptionItem* self =
+        new( ELeave ) CPresentityGroupMembersPresenceSubscriptionItem( aParent, aContentItem );
+    CleanupStack::Pop(); //aContentItem
+    CleanupClosePushL( *self );
+    self->ConstructL();
+    return self;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CPresentityGroupMembersPresenceSubscriptionItem::~CPresentityGroupMembersPresenceSubscriptionItem()
+// ---------------------------------------------------------------------------
+//
+CPresentityGroupMembersPresenceSubscriptionItem::~CPresentityGroupMembersPresenceSubscriptionItem()
+    {
+    MXIMPItemParent* presCache = static_cast<MXIMPItemParent*>(iParent.GetInterface(PRESENCE_ITEM_PARENT));
+    presCache->RemoveMe( this );
+
+
+    delete iIdentity;
+    delete iPresenceInfo;
+
+    delete iPif;
+    iContentItem.UnregisterEventObserver( this );
+    }
+
+// ---------------------------------------------------------------------------
+// CPresentityGroupMembersPresenceSubscriptionItem::SubscriptionPif()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CPresenceInfoFilterImp&
+            CPresentityGroupMembersPresenceSubscriptionItem::SubscriptionPif()
+    {
+    TRACE(_L("CPresentityGroupMembersPresenceSubscriptionItem::SubscriptionPif" ) );
+    __ASSERT_ALWAYS( iPif, User::Panic( NXIMPPrivPanic::KCategory,
+                                        NXIMPPrivPanic::EOwnPresencePifNotSet ) );
+    return *iPif;
+    }
+
+// ---------------------------------------------------------------------------
+// CPresentityGroupMembersPresenceSubscriptionItem::SetSubscriptionPif()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CPresentityGroupMembersPresenceSubscriptionItem::SetSubscriptionPif(
+                                                CPresenceInfoFilterImp* aPif )
+    {
+    TRACE(_L("CPresentityGroupMembersPresenceSubscriptionItem::SetSubscriptionPif" ) );
+    delete iPif;
+    iPif = aPif;
+    }
+
+// ---------------------------------------------------------------------------
+// CPresentityGroupMembersPresenceSubscriptionItem::CollectSubscriptionPifWithoutCtxL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CPresenceInfoFilterImp*
+    CPresentityGroupMembersPresenceSubscriptionItem::CollectSubscriptionPifWithoutCtxL(
+                                                        MXIMPPscContext* aContext )
+    {
+    TRACE(_L("CPresentityGroupMembersPresenceSubscriptionItem::CollectSubscriptionPifWithoutCtxL" ) );
+    RPointerArray< CPresenceInfoFilterImp > arrayOfPifs;
+    CleanupClosePushL( arrayOfPifs );
+
+    TInt count = iContexts.Count();
+    for( TInt a = 0; a < count; ++a )
+        {
+        if( iContexts[ a ] != aContext )
+            {
+            CPresenceInfoFilterImp* filter = iContexts[ a ]->PresenceInfoFilter( 
+                        MXIMPPscContext::EPresentityGroupMemberPresenceFilter, iIdentity );
+            if ( filter )
+                {
+                arrayOfPifs.AppendL( filter );
+                }
+            }
+        }
+    CPresenceInfoFilterImp* pifWithoutCtx = DocumentUtils::InfoFilterUnionL( arrayOfPifs );
+    CleanupStack::PopAndDestroy(); // arrayOfPifs
+    TRACE(_L("CPresentityGroupMembersPresenceSubscriptionItem::CollectSubscriptionPifWithoutCtxL done" ) );
+    return pifWithoutCtx;
+    }
+
+// ---------------------------------------------------------------------------
+// CPresentityGroupMembersPresenceSubscriptionItem::SetPresenceInfoL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CPresentityGroupMembersPresenceSubscriptionItem::SetPresenceInfoL(
+                                            CPresenceInfoImp* aPresenceInfo )
+    {
+    TRACE(_L("CPresentityGroupMembersPresenceSubscriptionItem::SetPresenceInfoL" ) );
+    delete iPresenceInfo;
+    iPresenceInfo = aPresenceInfo;
+    iSubscriptionState->SetDataStateL( MXIMPDataSubscriptionState::EDataAvailable );
+    }
+
+// ---------------------------------------------------------------------------
+// CPresentityGroupMembersPresenceSubscriptionItem::Order()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CPresentityGroupMembersPresenceSubscriptionItem::Order(
+                        const CPresentityGroupMembersPresenceSubscriptionItem& aA,
+                        const CPresentityGroupMembersPresenceSubscriptionItem& aB )
+    {
+    return IdentityOrder( aA.iIdentity, aB );
+    }
+// ---------------------------------------------------------------------------
+// CPresentityGroupMembersPresenceSubscriptionItem::Order()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CPresentityGroupMembersPresenceSubscriptionItem::IdentityOrder(
+                        const CXIMPIdentityImp* aA,
+                        const CPresentityGroupMembersPresenceSubscriptionItem& aB )
+    {
+    return aA->Compare( *aB.iIdentity );
+    }
+
+// ---------------------------------------------------------------------------
+// CPresentityGroupMembersPresenceSubscriptionItem::Identity()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C const MXIMPIdentity& CPresentityGroupMembersPresenceSubscriptionItem::Identity() const
+    {
+    return *iIdentity;
+    }
+
+// ---------------------------------------------------------------------------
+// CPresentityGroupMembersPresenceSubscriptionItem::SetIdentity()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CPresentityGroupMembersPresenceSubscriptionItem::SetIdentity(
+                                            CXIMPIdentityImp* aIdentity )
+    {
+    delete iIdentity;
+    iIdentity = aIdentity;
+    }
+
+// ---------------------------------------------------------------------------
+// From class MXIMPSubscriptionItem.
+// CPresentityGroupMembersPresenceSubscriptionItem::SynthesiseSubscriptionEventTo()
+// ---------------------------------------------------------------------------
+//
+void CPresentityGroupMembersPresenceSubscriptionItem::SynthesiseSubscriptionEventToL(
+                                                    MXIMPPscContext* aContext,
+                                                    TBool aForceEvent )
+    {
+    TRACE_1( _L("CPresentityGroupMembersPresenceSubscriptionItem::SynthesiseSubscriptionEventTo() aForce=%d"), aForceEvent );
+    // Synthesise event to all members
+    TInt count = iContentItem.MemberCount();
+    TRACE_1( _L("CPresentityGroupMembersPresenceSubscriptionItem::SynthesiseSubscriptionEventTo() iContentItem.MemberCount=%d"), count );
+
+	MXIMPItemParent* presCache = static_cast<MXIMPItemParent*>(iParent.GetInterface(PRESENCE_ITEM_PARENT));    
+    for( TInt a = 0; a < count; ++a )
+        {
+        CPresentityGroupMemberInfoImp& memberInfo = iContentItem.MemberAt( a );
+        const CXIMPIdentityImp& identity = memberInfo.IdentityImp();
+
+        presCache->SynthesisePresentityPresenceSubscriptionEventToL( identity, aContext, aForceEvent );
+        }
+    }
+
+
+// ---------------------------------------------------------------------------
+// CPresentityGroupMembersPresenceSubscriptionItem::ActivateSubscriberL()
+// ---------------------------------------------------------------------------
+//
+void CPresentityGroupMembersPresenceSubscriptionItem::ActivateSubscriberL( MXIMPPscContext* aContext )
+    {
+    TRACE_1( _L("CPresentityGroupMembersPresenceSubscriptionItem::ActivateSubscriberL(aContext ) : aContext = %d"), aContext );
+    
+    CXIMPSubscriptionItemBase::ActivateSubscriberL( aContext );
+
+    // Subscribe presentity presence items.
+    TInt count = iContentItem.MemberCount();
+    TRACE_1( _L("CPresentityGroupMembersPresenceSubscriptionItem::ActivateSubscriberL(aContext ) : iContentItem.MemberCount = %d"), count );
+    MXIMPItemParent* presCache = static_cast<MXIMPItemParent*>(iParent.GetInterface(PRESENCE_ITEM_PARENT));
+    for( TInt a = 0; a < count; ++a )
+        {
+        TRACE_1( _L("CPresentityGroupMembersPresenceSubscriptionItem::ActivateSubscriberL(aContext ) : a = %d"), a );
+        CPresentityGroupMemberInfoImp& memberInfo = iContentItem.MemberAt( a );
+        const CXIMPIdentityImp& identity = memberInfo.IdentityImp();
+        TInt error ( KErrNone );
+        TRAP( error , presCache->ActivatePresentityPresenceSubscriberL( identity, this ););
+        TRACE_1( _L("CPresentityGroupMembersPresenceSubscriptionItem::ActivateSubscriberL( aContext ) i...eSubscriberL = %d"), error );
+        }
+    }
+
+
+// ---------------------------------------------------------------------------
+// CPresentityGroupMembersPresenceSubscriptionItem::CleanExpired()
+// ---------------------------------------------------------------------------
+//
+void CPresentityGroupMembersPresenceSubscriptionItem::CleanExpired()
+    {
+
+    }
+
+// ---------------------------------------------------------------------------
+// CPresentityGroupMembersPresenceSubscriptionItem::AddSubscriberL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CPresentityGroupMembersPresenceSubscriptionItem::AddSubscriberL( MXIMPPscContext* aContext )
+    {
+    TRACE_1( _L("CPresentityGroupMembersPresenceSubscriptionItem::AddSubscriberL( MXIMPPscContext* aContext ) : aContext = %d"), aContext );
+
+    CXIMPSubscriptionItemBase::AddSubscriberL( aContext );
+
+    // Subscribe presentity presence items.
+    TInt count = iContentItem.MemberCount();
+    TRACE_1( _L("CPresentityGroupMembersPresenceSubscriptionItem::AddSubscriberL( MXIMPPscContext* aContext ) : iContentItem.MemberCount = %d"), count );
+    MXIMPItemParent* presCache = static_cast<MXIMPItemParent*>(iParent.GetInterface(PRESENCE_ITEM_PARENT));
+    for( TInt a = 0; a < count; ++a )
+        {
+        TRACE_1( _L("CPresentityGroupMembersPresenceSubscriptionItem::AddSubscriberL( MXIMPPscContext* aContext ) : a = %d"), a );
+        
+        CPresentityGroupMemberInfoImp& memberInfo = iContentItem.MemberAt( a );
+        const CXIMPIdentityImp& identity = memberInfo.IdentityImp();
+        TInt error ( KErrNone );
+        TRAP( error , presCache->AddPresentityPresenceSubscriberL( identity, this, iIdentity ););
+        TRACE_1( _L("CPresentityGroupMembersPresenceSubscriptionItem::AddSubscriberL( MXIMPPscContext* aContext ) : TRAPD( error , iParent.AddPresentityPresenceSubscriberL = %d"), error );
+
+        }
+    }
+
+
+// ---------------------------------------------------------------------------
+// CPresentityGroupMembersPresenceSubscriptionItem::RemoveSubscriber()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CPresentityGroupMembersPresenceSubscriptionItem::RemoveSubscriber( MXIMPPscContext* aContext )
+    {
+    TRACE_1( _L("CPresentityGroupMembersPresenceSubscriptionItem::RemoveSubscriber( MXIMPPscContext* aContext ) : aContext = %d"), aContext );
+    
+    // Subscribe presentity presence items.
+    TInt count = iContentItem.MemberCount();
+    TRACE_1( _L("CPresentityGroupMembersPresenceSubscriptionItem::RemoveSubscriber( MXIMPPscContext* aContext ) : iContentItem.MemberCount = %d"), count );
+    MXIMPItemParent* presCache = static_cast<MXIMPItemParent*>(iParent.GetInterface(PRESENCE_ITEM_PARENT));
+    for( TInt a = 0; a < count; ++a )
+        {
+        TRACE_1( _L("CPresentityGroupMembersPresenceSubscriptionItem::RemoveSubscriber( MXIMPPscContext* aContext ) : a = %d"), a );
+        
+        CPresentityGroupMemberInfoImp& memberInfo = iContentItem.MemberAt( a );
+        const CXIMPIdentityImp& identity = memberInfo.IdentityImp();
+
+        presCache->RemovePresentityPresenceSubscriber( identity, this );
+        }
+
+    TRACE( _L("CPresentityGroupMembersPresenceSubscriptionItem::RemoveSubscriber( MXIMPPscContext* aContext ) : CXIMPSubscriptionItemBase::RemoveSubscriber( aContext )") );
+    CXIMPSubscriptionItemBase::RemoveSubscriber( aContext );
+    }
+
+// ---------------------------------------------------------------------------
+// CPresentityGroupMembersPresenceSubscriptionItem::HandleChangeL()
+// ---------------------------------------------------------------------------
+//
+void CPresentityGroupMembersPresenceSubscriptionItem::HandleChangeL(
+                                RPrGrpMemInfoImpArray& aAdded, RPrGrpMemInfoImpArray& aRemoved )
+    {
+    TRACE_2( _L("CPresentityGroupMembersPresenceSubscriptionItem::HandleChangeL aAdded =%d aRemoved=%d"), aAdded.Count(), aRemoved.Count() );
+    TInt count = aAdded.Count();
+    MXIMPItemParent* presCache = static_cast<MXIMPItemParent*>(iParent.GetInterface(PRESENCE_ITEM_PARENT));
+    for( TInt a = 0; a < count; ++a )
+        {
+        CPresentityGroupMemberInfoImp& memberInfo = *aAdded[ a ];
+        const CXIMPIdentityImp& identity = memberInfo.IdentityImp();
+
+        presCache->AddPresentityPresenceSubscriberL( identity, this, iIdentity );
+        }
+    count = aRemoved.Count();
+    for( TInt a = 0; a < count; ++a )
+        {
+        CPresentityGroupMemberInfoImp& memberInfo = *aRemoved[ a ];
+        const CXIMPIdentityImp& identity = memberInfo.IdentityImp();
+
+        presCache->RemovePresentityPresenceSubscriber( identity, this );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CPresentityGroupMembersPresenceSubscriptionItem::HandleSynthesiseL()
+// ---------------------------------------------------------------------------
+//
+void CPresentityGroupMembersPresenceSubscriptionItem::HandleSynthesiseL(
+                                                        RPrGrpMemInfoImpArray& aTarget )
+    {
+    TInt count = aTarget.Count();
+    TRACE_1( _L("CPresentityGroupMembersPresenceSubscriptionItem::HandleSynthesiseL aTarget=%d"), aTarget.Count() );
+    MXIMPItemParent* presCache = static_cast<MXIMPItemParent*>(iParent.GetInterface(PRESENCE_ITEM_PARENT));
+    for( TInt a = 0; a < count; ++a )
+        {
+        CPresentityGroupMemberInfoImp& memberInfo = *aTarget[ a ];
+        const CXIMPIdentityImp& identity = memberInfo.IdentityImp();
+
+        presCache->ActivatePresentityPresenceSubscriberL( identity, this );
+        TInt contextCount = iContexts.Count();
+        for( TInt b = 0; b < contextCount; ++b )
+            {
+            presCache->SynthesisePresentityPresenceSubscriptionEventToL( identity, iContexts[ a ], EFalse );
+            }
+        }
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresencedatamodel/presencewatching/presentitygroupmemberspresencesubscriptionitem.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,209 @@
+/*
+* 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 Service Connection presentity presence subscription implementation.
+*
+*/
+
+#ifndef CPSCPRESENTITYGROUPMEMBERSPRESENCESUBSCRIPTIONITEM_H
+#define CPSCPRESENTITYGROUPMEMBERSPRESENCESUBSCRIPTIONITEM_H
+
+#include <e32base.h>
+#include "presenceinfoimp.h"
+#include "ximpsubscriptionitembase.h"
+#include "groupcontenteventobserver.h"
+
+class MXIMPItemParent;
+class MXIMPPscContext;
+class CPresenceInfoFilterImp;
+class MXIMPIdentity;
+class CXIMPIdentityImp;
+class CGroupContentSubscriptionItem;
+
+
+/**
+ * PSC group list subscription implementation
+ *
+ * @since S60 v3.2
+ */
+class CPresentityGroupMembersPresenceSubscriptionItem : public CXIMPSubscriptionItemBase, 
+                                                               public MGroupContentEventObserver
+    {
+public: // Construction and destruction
+
+    /**
+     * Construction
+     * @param aParent. Parent has to be informed when this object is deleted by RemoveMe method.
+     */
+    static CPresentityGroupMembersPresenceSubscriptionItem* NewLC( MXIMPItemParentBase& aParent,
+                                                                          CGroupContentSubscriptionItem& aContentItem );
+
+    /**
+     * Destruction
+     * - Remember to inform parent about delete.
+     */
+    ~CPresentityGroupMembersPresenceSubscriptionItem();
+
+private: // Construction and destruction
+
+    /**
+     * Construction
+     * @param aParent. Parent has to be informed when this object is deleted by RemoveMe method.
+     */
+    CPresentityGroupMembersPresenceSubscriptionItem( MXIMPItemParentBase& aParent, 
+                                                            CGroupContentSubscriptionItem& aContentItem );
+
+    /**
+     * Construction
+     */
+    void ConstructL();
+
+public: // New methods
+
+
+    /**
+     * Current presence information filter.
+     * @return Current presence information filter.
+     */
+    IMPORT_C CPresenceInfoFilterImp& SubscriptionPif();
+    
+    /**
+     * Set current presence information filter. Overwrites existing one.
+     * Ownership is transferred to callee.
+     * @param aPif Current presence information filter.
+     */
+    IMPORT_C void SetSubscriptionPif( CPresenceInfoFilterImp* aPif );
+
+    /**
+     * Collect aggregated presence information filter without given context.
+     * @param aContext. Exluded context from aggregated pif.
+     * @return Aggregated pif without exluded context.
+     */    
+    IMPORT_C CPresenceInfoFilterImp* CollectSubscriptionPifWithoutCtxL( 
+                                                    MXIMPPscContext* aContext );
+    
+    /**
+     * Set presence information. Overwrites existing one.
+     * @param aPresenceInfo. New presence information.
+     */
+    IMPORT_C void SetPresenceInfoL( CPresenceInfoImp* aPresenceInfo );
+    
+    
+    /**
+     * For ordering items.
+     * @param aA Key item for ordering.
+     * @param aB Item to compare
+     * @return -1 if aB is greater than aA
+     *          0 if they are same
+     *          1 if aA if greater than aB.
+     */    
+    IMPORT_C static TInt Order( const CPresentityGroupMembersPresenceSubscriptionItem& aA,
+                         const CPresentityGroupMembersPresenceSubscriptionItem& aB );
+                         
+    /**
+     * For ordering items using identity as key.
+     * @param aA Key identity for ordering.
+     * @param aB Item to compare
+     * @return -1 if aB is greater than aA
+     *          0 if they are same
+     *          1 if aA if greater than aB.
+     */    
+    IMPORT_C static TInt IdentityOrder( const CXIMPIdentityImp* aA,
+                         const CPresentityGroupMembersPresenceSubscriptionItem& aB );
+
+    /**
+     * Identity of item.
+     * @return Identity of item.     
+     */
+    IMPORT_C const MXIMPIdentity& Identity() const;
+
+    /**
+     * Set identity for item
+     * @param aIdentity. New identity for item. Ownership is transferred.
+     */
+    IMPORT_C void SetIdentity( CXIMPIdentityImp* aIdentity );
+    
+public: // From MXIMPSubscriptionItem
+
+    /**
+     * @see MXIMPSubscriptionItem
+     */
+    void SynthesiseSubscriptionEventToL( MXIMPPscContext* aContext, TBool aForceEvent );
+
+    /**
+     * @see MXIMPSubscriptionItem
+     */
+    void ActivateSubscriberL( MXIMPPscContext* aContext );
+    
+private: // From CXIMPSubscriptionItemBase
+
+    /**
+     * @see CXIMPSubscriptionItemBase
+     */
+    void CleanExpired();
+
+public: // From CXIMPSubscriptionItemBase
+
+    /**
+     * @see CXIMPSubscriptionItemBase
+     */
+    IMPORT_C void AddSubscriberL( MXIMPPscContext* aContext );
+
+    /**
+     * @see CXIMPSubscriptionItemBase
+     */
+    IMPORT_C void RemoveSubscriber( MXIMPPscContext* aContext );    
+    
+private: // From MGroupContentSubscriptionEventObserver    
+
+    /** 
+     * @see MGroupContentSubscriptionEventObserver
+     */
+    void HandleChangeL( RPrGrpMemInfoImpArray& aAdded, RPrGrpMemInfoImpArray& aRemoved );
+
+    /** 
+     * @see MGroupContentSubscriptionEventObserver
+     */
+    void HandleSynthesiseL( RPrGrpMemInfoImpArray& aAdded );
+    
+private: // Data
+
+    /**
+     * Current presence information filter.
+     */
+    CPresenceInfoFilterImp* iPif;
+        
+    /**
+     * Current presence info for item
+     * Own
+     */
+    CPresenceInfoImp* iPresenceInfo;
+    
+    /**
+     * Identity of item.
+     * Own
+     */
+    CXIMPIdentityImp* iIdentity;
+    
+    /**
+     * Owns reference to content item. Use close for delete.
+     */
+    CGroupContentSubscriptionItem& iContentItem;
+    };
+
+
+/* ======================================================================== */
+
+
+
+#endif // CPSCPRESENTITYGROUPMEMBERSPRESENCESUBSCRIPTIONITEM_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresencedatamodel/presencewatching/presentitypresenceeventimp.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,238 @@
+/*
+* 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:  MPresentityPresenceEvent API object implementation.
+ *
+*/
+
+#include "presentitypresenceeventimp.h"
+#include "presenceinfoimp.h"
+#include "ximpidentityimp.h"
+#include "ximpdatasubscriptionstateimp.h"
+#include "ximpobjecthelpers.h"
+#include <s32strm.h>
+
+
+
+// ---------------------------------------------------------------------------
+// CPresentityPresenceEventImp::NewLC()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CPresentityPresenceEventImp* CPresentityPresenceEventImp::NewLC(
+    CXIMPDataSubscriptionStateImp* aState )
+    {
+    CPresentityPresenceEventImp* self = new( ELeave ) CPresentityPresenceEventImp();
+    CleanupStack::PushL( self );
+    self->ConstructL( aState );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CPresentityPresenceEventImp::NewL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CPresentityPresenceEventImp* CPresentityPresenceEventImp::NewL(
+    CXIMPDataSubscriptionStateImp* aState )
+    {
+    CPresentityPresenceEventImp* self = NewLC( aState );
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CPresentityPresenceEventImp::NewFromStreamLC()
+// ---------------------------------------------------------------------------
+//
+CXIMPApiEventBase* CPresentityPresenceEventImp::NewFromStreamLC( RReadStream& aStream )
+    {
+    CPresentityPresenceEventImp* self = new( ELeave ) CPresentityPresenceEventImp;
+    CleanupStack::PushL( self );
+    self->ConstructL( aStream );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CPresentityPresenceEventImp::~CPresentityPresenceEventImp()
+// ---------------------------------------------------------------------------
+//
+CPresentityPresenceEventImp::~CPresentityPresenceEventImp()
+    {
+    delete iPresentityIdentity;
+    delete iSubscriptionState;
+    delete iPresenceInfo;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CPresentityPresenceEventImp::CPresentityPresenceEventImp()
+// ---------------------------------------------------------------------------
+//
+CPresentityPresenceEventImp::CPresentityPresenceEventImp()
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// CPresentityPresenceEventImp::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void CPresentityPresenceEventImp::ConstructL( CXIMPDataSubscriptionStateImp* aState )
+    {
+    iPresentityIdentity = CXIMPIdentityImp::NewL();
+    iPresenceInfo = CPresenceInfoImp::NewL();
+    
+    iSubscriptionState = aState;
+    }
+
+// ---------------------------------------------------------------------------
+// CPresentityGroupContentEventImp::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void CPresentityPresenceEventImp::ConstructL( RReadStream& aStream )
+    {
+    iPresentityIdentity = CXIMPIdentityImp::NewL();
+    iPresenceInfo = CPresenceInfoImp::NewL();
+    iSubscriptionState = CXIMPDataSubscriptionStateImp::NewL();
+    InternalizeL( aStream );
+    }
+
+// ---------------------------------------------------------------------------
+// Implement supported interface access.
+// ---------------------------------------------------------------------------
+//
+XIMPIMP_IF_BASE_GET_INTERFACE_BEGIN( CPresentityPresenceEventImp,
+                                     MPresentityPresenceEvent )
+    XIMPIMP_IF_BASE_GET_CLASS( CXIMPApiEventBase, this )
+XIMPIMP_IF_BASE_GET_INTERFACE_END()
+
+XIMPIMP_IF_BASE_GET_CONST_INTERFACE_BEGIN( CPresentityPresenceEventImp,
+                                           MPresentityPresenceEvent )
+    XIMPIMP_IF_BASE_GET_CONST_CLASS( CXIMPApiEventBase, this )                                            
+XIMPIMP_IF_BASE_GET_INTERFACE_END()
+
+
+
+// ---------------------------------------------------------------------------
+// Implement methods from base event interface and base event class
+// ---------------------------------------------------------------------------
+//
+XIMPIMP_IMPLEMENT_EVENT_BASE_METHODS( CPresentityPresenceEventImp,
+                                      MPresentityPresenceEvent )
+
+// ---------------------------------------------------------------------------
+// CPresentityPresenceEventImp::EqualsContent
+// ---------------------------------------------------------------------------
+//
+TBool CPresentityPresenceEventImp::EqualsContent( 
+    const CXIMPApiEventBase& aOtherInstance ) const 
+    {
+    const CPresentityPresenceEventImp* tmp =
+    TXIMPGetImpClassOrPanic< const CPresentityPresenceEventImp >::From( 
+                                                        aOtherInstance.Base() );
+    TBool same = ETrue;
+    TBool x = iPresentityIdentity->EqualsContent( *tmp->iPresentityIdentity );
+    same &= x;
+
+    x = iSubscriptionState->EqualsContent( *tmp->iSubscriptionState );
+    same &= x;
+
+    x = iPresenceInfo->EqualsContent( *tmp->iPresenceInfo );
+    same &= x;
+
+    return same;
+    }
+
+// ---------------------------------------------------------------------------
+// From class CXIMPApiEventBase
+// CPresentityPresenceEventImp::ExternalizeL
+// ---------------------------------------------------------------------------
+//
+void CPresentityPresenceEventImp::ExternalizeL( RWriteStream& aStream ) const
+    {
+    iPresentityIdentity->ExternalizeL( aStream );
+    iSubscriptionState->ExternalizeL( aStream );
+    iPresenceInfo->ExternalizeL( aStream );
+    }
+
+
+
+// ---------------------------------------------------------------------------
+// CPresentityPresenceEventImp::InternalizeL()
+// ---------------------------------------------------------------------------
+//
+void CPresentityPresenceEventImp::InternalizeL( RReadStream& aStream )
+    {
+    iPresentityIdentity->InternalizeL( aStream );
+    iSubscriptionState->InternalizeL( aStream );
+    iPresenceInfo->InternalizeL( aStream );
+    }
+
+
+// ---------------------------------------------------------------------------
+// From class MPresentityPresenceEvent.
+// CPresentityPresenceEventImp::PresentityId()
+// ---------------------------------------------------------------------------
+//
+const MXIMPIdentity& CPresentityPresenceEventImp::PresentityId() const
+    {
+    return *iPresentityIdentity;
+    }
+
+
+// ---------------------------------------------------------------------------
+// From class MPresentityPresenceEvent.
+// CPresentityPresenceEventImp::SubscribedPresence()
+// ---------------------------------------------------------------------------
+//
+const MPresenceInfo& 
+    CPresentityPresenceEventImp::SubscribedPresence() const
+    {
+    return *iPresenceInfo;
+    }
+    
+
+// ---------------------------------------------------------------------------
+// From class MPresentityPresenceEvent.
+// COwnPresenceEventImp::Status()
+// ---------------------------------------------------------------------------
+//
+const MXIMPDataSubscriptionState&
+    CPresentityPresenceEventImp::DataSubscriptionState() const
+    {
+    return *iSubscriptionState;
+    }
+
+// ---------------------------------------------------------------------------
+// COwnPresenceEventImp::SetPresenceInfo
+// ---------------------------------------------------------------------------
+//
+void CPresentityPresenceEventImp::SetPresenceInfo( CPresenceInfoImp* aInfoImp )
+    {
+    delete iPresenceInfo;
+    iPresenceInfo = aInfoImp;
+    }
+
+// ---------------------------------------------------------------------------
+// COwnPresenceEventImp::SetIdentityL()
+// ---------------------------------------------------------------------------
+//
+void CPresentityPresenceEventImp::SetIdentityL( const CXIMPIdentityImp& aIdentity )
+    {
+    CXIMPIdentityImp* id = TXIMPObjectCloner< CXIMPIdentityImp >::CloneL( aIdentity );
+    delete iPresentityIdentity;
+    iPresentityIdentity = id;
+    }
+
+
+// End of file
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresencedatamodel/presencewatching/presentitypresenceeventimp.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,148 @@
+/*
+* 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:  MPresentityPresenceEvent API object implementation.
+ *
+*/
+
+#ifndef CPRESENTIYPRESENCEEVENT_H
+#define CPRESENTIYPRESENCEEVENT_H
+
+#include "ximpapieventbase.h"
+#include <presentitypresenceevent.h>
+#include "ximpdatasubscriptionstateimp.h"
+#include "presenceinfo.h"
+#include "presenceapiobjbase.h"
+
+class RReadStream;
+class CXIMPIdentityImp;
+class CPresenceInfoImp;
+class CXIMPDataSubscriptionStateImp;
+
+
+/**
+ * MPresentityPresenceEvent API object implementation.
+ *
+ * @lib ximpdatamodel.dll
+ * @since S60 v3.2
+ */
+NONSHARABLE_CLASS( CPresentityPresenceEventImp ): public CXIMPApiEventBase,
+                                                      public MPresentityPresenceEvent
+    {
+public:
+    /** The class ID. */
+    enum { KClassId = PRIMP_CLSID_CPRESENTITYPRESENCEEVENTIMP };
+
+public:
+    /**
+     * Exported instantiation method for initializing
+     * new event object.
+     */
+    IMPORT_C static CPresentityPresenceEventImp* NewLC(
+            CXIMPDataSubscriptionStateImp* aState );
+    IMPORT_C static CPresentityPresenceEventImp* NewL(
+            CXIMPDataSubscriptionStateImp* aState );
+
+
+    /**
+     * Instantiation method for event automation.
+     * Method signature must be exactly this to work
+     * with event delivery automation system.
+     *
+     * Event implementation must be registered to
+     * XIMPEventCodec KXIMPEventConstructorTable.
+     */
+    static CXIMPApiEventBase* NewFromStreamLC( RReadStream& aStream );
+
+    virtual ~CPresentityPresenceEventImp();
+
+
+private:
+    CPresentityPresenceEventImp();
+    void ConstructL( CXIMPDataSubscriptionStateImp* aState );
+    void ConstructL( RReadStream& aStream );
+
+public: // From API base interfaces
+
+    /**
+     * Implementation of MXIMPBase interface methods
+     * @see MXIMPBase
+     */
+    XIMPIMP_DECLARE_IF_BASE_METHODS
+
+
+    /**
+     * Implementation of MXIMPEventBase interface and
+     * CXIMPApiEventBase methods
+     *
+     * @see MXIMPEventBase
+     * @see CXIMPApiEventBase
+     */
+    XIMPIMP_DECLARE_EVENT_BASE_METHODS
+
+
+    void InternalizeL( RReadStream& aStream );
+
+
+public: // From MPresentityPresenceEvent
+
+    /**
+     * Implementation of MPresentityPresenceEvent interface methods
+     * @see MPresentityPresenceEvent
+     */
+    const MXIMPIdentity& PresentityId() const;
+    const MPresenceInfo& SubscribedPresence() const;
+    const MXIMPDataSubscriptionState& DataSubscriptionState() const;
+
+public:  // new methods
+
+    /**
+     * Set new presence info.
+     * Ownership transferred.
+     * @param aInfoImp The info imp
+     */
+    void SetPresenceInfo( CPresenceInfoImp* aInfoImp );
+
+    /**
+     * Set identity. 
+     * Copy is made.
+     * @param aIdentity The identity
+     */
+    void SetIdentityL( const CXIMPIdentityImp& aIdentity );
+
+private: // data
+
+    /**
+     * Presentity
+     * Own.
+     */
+    CXIMPIdentityImp* iPresentityIdentity;
+
+
+    /**
+     *
+     */
+    CXIMPDataSubscriptionStateImp* iSubscriptionState;
+
+
+    /**
+     * Presence Info
+     * Own.
+     */
+     CPresenceInfoImp* iPresenceInfo;
+
+
+    };
+
+
+#endif // CPRESENTIYPRESENCEEVENT_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresencedatamodel/presencewatching/presentitypresencesubscriptionitem.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,361 @@
+/*
+* 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 Service Connection group list subscription implementation.
+*
+*/
+
+
+#include "presentitypresencesubscriptionitem.h"
+#include "presenceinfofilterimp.h"
+#include "ximpitemparent.h"
+#include "ximppanics.h"
+#include "ximppsccontext.h"
+#include "documentutils.h"
+#include "presentitypresenceeventimp.h"
+#include "ximpdatasubscriptionstateimp.h"
+#include "ximpidentityimp.h"
+#include "ximpobjecthelpers.h"
+#include <presencecachewriter.h>
+#include <presencebuddyinfo.h>
+
+#include "ximptrace.h"
+
+// ---------------------------------------------------------------------------
+// CPresentityPresenceSubscriptionItem::CPresentityPresenceSubscriptionItem()
+// ---------------------------------------------------------------------------
+//
+CPresentityPresenceSubscriptionItem::CPresentityPresenceSubscriptionItem( MXIMPItemParentBase& aParent )
+: CXIMPSubscriptionItemBase( aParent )
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// CPresentityPresenceSubscriptionItem::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void CPresentityPresenceSubscriptionItem::ConstructL( const CXIMPIdentityImp& aIdentity )
+    {
+    BaseConstructL();
+    
+    iIdentity = TXIMPObjectCloner< CXIMPIdentityImp >::CloneL( aIdentity );
+    }
+
+
+// ---------------------------------------------------------------------------
+// CPresentityPresenceSubscriptionItem::NewLC()
+// ---------------------------------------------------------------------------
+//
+CPresentityPresenceSubscriptionItem*
+    CPresentityPresenceSubscriptionItem::NewLC( MXIMPItemParentBase& aParent, const CXIMPIdentityImp& aIdentity )
+    {
+    CPresentityPresenceSubscriptionItem* self =
+        new( ELeave ) CPresentityPresenceSubscriptionItem( aParent );
+    CleanupClosePushL( *self );
+    self->ConstructL( aIdentity );
+    return self;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CPresentityPresenceSubscriptionItem::~CPresentityPresenceSubscriptionItem()
+// ---------------------------------------------------------------------------
+//
+CPresentityPresenceSubscriptionItem::~CPresentityPresenceSubscriptionItem()
+    {
+    // Remove it also from the external cache
+    MXIMPItemParent* presCache = static_cast<MXIMPItemParent*>(iParent.GetInterface(PRESENCE_ITEM_PARENT));
+    if(presCache)
+        {
+            MPresenceCacheWriter* extCache = presCache->ExternalCache();
+            if(extCache && iIdentity)
+                TRAP_IGNORE( extCache->DeletePresenceL( *iIdentity ) );
+            presCache->RemoveMe( this );
+        }
+    delete iIdentity;
+    delete iPresenceInfo;
+    delete iPif;
+    }
+
+// ---------------------------------------------------------------------------
+// CPresentityPresenceSubscriptionItem::SubscriptionPif()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CPresenceInfoFilterImp&
+            CPresentityPresenceSubscriptionItem::SubscriptionPif()
+    {
+    TRACE(_L("CPresentityPresenceSubscriptionItem::SubscriptionPif" ) );
+    // assert removed
+    return *iPif;
+    }
+
+// ---------------------------------------------------------------------------
+// CPresentityPresenceSubscriptionItem::SetSubscriptionPif()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CPresentityPresenceSubscriptionItem::SetSubscriptionPif(
+                                                CPresenceInfoFilterImp* aPif )
+    {
+    TRACE(_L("CPresentityPresenceSubscriptionItem::SetSubscriptionPif" ) );
+    if ( !aPif )
+        {
+        TRACE(_L("CPresentityPresenceSubscriptionItem::SetSubscriptionPif aPif NULL" ) );
+        }
+    delete iPif;
+    iPif = aPif;
+    }
+
+// ---------------------------------------------------------------------------
+// CPresentityPresenceSubscriptionItem::CollectSubscriptionPifWithoutCtxL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CPresenceInfoFilterImp*
+    CPresentityPresenceSubscriptionItem::CollectSubscriptionPifWithoutCtxL(
+                                                        MXIMPPscContext* aContext )
+    {
+    TRACE(_L("CPresentityPresenceSubscriptionItem::CollectSubscriptionPifWithoutCtxL" ) );
+    RPointerArray< CPresenceInfoFilterImp > arrayOfPifs;
+    CleanupClosePushL( arrayOfPifs );
+
+    TInt count = iContexts.Count();
+    for( TInt a = 0; a < count; ++a )
+        {
+        if( iContexts[ a ] != aContext )
+            {
+            CPresenceInfoFilterImp* filter = iContexts[ a ]->PresenceInfoFilter( 
+                        MXIMPPscContext::EPresentityPresenceFilter, iIdentity );
+            if ( filter )
+                {
+                arrayOfPifs.AppendL( filter );
+                }
+            }
+        }
+    CPresenceInfoFilterImp* pifWithoutCtx = DocumentUtils::InfoFilterUnionL( arrayOfPifs );
+    CleanupStack::PopAndDestroy(); // arrayOfPifs
+    return pifWithoutCtx;
+    }
+
+// ---------------------------------------------------------------------------
+// CPresentityPresenceSubscriptionItem::SetPresenceInfoL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CPresentityPresenceSubscriptionItem::SetPresenceInfoL(
+                                            CPresenceInfoImp* aPresenceInfo )
+    {
+    TRACE(_L("CPresentityPresenceSubscriptionItem::SetPresenceInfoL" ) );
+    delete iPresenceInfo;
+    iPresenceInfo = aPresenceInfo;
+    iSubscriptionState->SetDataStateL( MXIMPDataSubscriptionState::EDataAvailable );
+    
+    // Now let's update the external presence cache
+    MXIMPItemParent* presCache = static_cast<MXIMPItemParent*>(iParent.GetInterface(PRESENCE_ITEM_PARENT));
+    MPresenceCacheWriter* extCache = presCache->ExternalCache();
+    MPresenceBuddyInfo* buddyPresence = extCache->NewBuddyPresenceInfoLC();
+    
+    // we need to clonce the parameters since the ownership is transfered
+    CXIMPIdentityImp* identity = TXIMPObjectCloner<CXIMPIdentityImp>::CloneL(*iIdentity);
+    buddyPresence->SetBuddyId( identity );
+    
+    CPresenceInfoImp* presenceInfo = TXIMPObjectCloner<CPresenceInfoImp>::CloneL(*iPresenceInfo);
+    buddyPresence->SetPresenceInfo( presenceInfo );
+
+    // No harm to do this, because the internal cache is still working
+    // we just lose the external update
+    TRAP_IGNORE( extCache->WritePresenceL( buddyPresence ) );
+
+    CleanupStack::PopAndDestroy( 1 ); // buddyPresence
+    
+    }
+
+// ---------------------------------------------------------------------------
+// CPresentityPresenceSubscriptionItem::Order()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CPresentityPresenceSubscriptionItem::Order(
+                        const CPresentityPresenceSubscriptionItem& aA,
+                        const CPresentityPresenceSubscriptionItem& aB )
+    {
+    return IdentityOrder( aA.iIdentity, aB );
+    }
+// ---------------------------------------------------------------------------
+// CPresentityPresenceSubscriptionItem::Order()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CPresentityPresenceSubscriptionItem::IdentityOrder(
+                        const CXIMPIdentityImp* aA,
+                        const CPresentityPresenceSubscriptionItem& aB )
+    {
+    return aA->Compare( *aB.iIdentity );
+    }
+
+
+// ---------------------------------------------------------------------------
+// CPresentityPresenceSubscriptionItem::Identity()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C const MXIMPIdentity& CPresentityPresenceSubscriptionItem::Identity() const
+    {
+    return *iIdentity;
+    }
+
+// ---------------------------------------------------------------------------
+// CPresentityPresenceSubscriptionItem::GroupIdentity()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C const MXIMPIdentity* CPresentityPresenceSubscriptionItem::GroupIdentity() const
+    {
+    return iGroupIdentity;
+    }
+
+// ---------------------------------------------------------------------------
+// CPresentityPresenceSubscriptionItem::SetIdentity()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CPresentityPresenceSubscriptionItem::SetIdentity(
+                                            CXIMPIdentityImp* aIdentity )
+    {
+    delete iIdentity;
+    iIdentity = aIdentity;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CPresentityPresenceSubscriptionItem::SetGroupIdentity()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CPresentityPresenceSubscriptionItem::SetGroupIdentity(
+                                            CXIMPIdentityImp* aGroup )
+    {
+    delete iGroupIdentity;
+    iGroupIdentity = aGroup;
+    }
+
+// ---------------------------------------------------------------------------
+// From class MXIMPSubscriptionItem.
+// CPresentityPresenceSubscriptionItem::SynthesiseSubscriptionEventTo()
+// ---------------------------------------------------------------------------
+//
+void CPresentityPresenceSubscriptionItem::SynthesiseSubscriptionEventToL(
+                                                    MXIMPPscContext* aContext,
+                                                    TBool aForceEvent )
+    {
+    TRACE_1( _L("CPresentityPresenceSubscriptionItem::SynthesiseSubscriptionEventTo() aForce=%d"), aForceEvent );
+    CXIMPDataSubscriptionStateImp* status = StatusLC( aContext ); // << status
+
+    CPresentityPresenceEventImp* newEvent = NULL;
+    if( status->DataState() == MXIMPDataSubscriptionState::EDataAvailable )
+        {
+        TRACE(_L("CPresentityPresenceSubscriptionItem::SynthesiseSubscriptionEventToL 2" ) );
+        __ASSERT_ALWAYS( iPresenceInfo, User::Panic( NXIMPPrivPanic::KCategory,
+                                            NXIMPPrivPanic::EPresentityPresencePresenceInfoDoesNotExist ) );
+        TRACE(_L("CPresentityPresenceSubscriptionItem::SynthesiseSubscriptionEventToL 3" ) );
+		// ERIK TODO: Logic is the following:
+		// 1 - Find all the groups where the iIdentity belongs to
+		// 2 - Collect the filters from those groups
+		// 3 - collect the filter from the individual subscription item also own
+		// 4 - make a union of the filters
+        
+        CPresenceInfoFilterImp* groupPif = NULL;
+        if ( iGroupIdentity ) 
+            { 
+            groupPif = aContext->PresenceInfoFilter( MXIMPPscContext::EPresentityGroupMemberPresenceFilter, iGroupIdentity );
+            if ( !iPif )
+                {
+                TRACE(_L("CPresentityPresenceSubscriptionItem::SynthesiseSubscriptionEventToL ownPif found" ) );
+                iPif = TXIMPObjectCloner< CPresenceInfoFilterImp >::CloneLC( *groupPif );
+                CleanupStack::Pop();
+                }
+            }
+        TRACE(_L("CPresentityPresenceSubscriptionItem::SynthesiseSubscriptionEventToL 4_0" ) );
+        CPresenceInfoFilterImp* ownPif = aContext->PresenceInfoFilter( MXIMPPscContext::EOwnPresenceFilter, iIdentity );
+        TRACE(_L("CPresentityPresenceSubscriptionItem::SynthesiseSubscriptionEventToL 4_1" ) );
+        CPresenceInfoFilterImp* presentityPif = aContext->PresenceInfoFilter( MXIMPPscContext::EPresentityPresenceFilter, iIdentity );
+        TRACE(_L("CPresentityPresenceSubscriptionItem::SynthesiseSubscriptionEventToL 4_2" ) );
+    	RPointerArray< CPresenceInfoFilterImp > arrayOfPifs;    // << arrayOfPifs
+    	CleanupClosePushL( arrayOfPifs );
+    
+        if ( groupPif )
+            {
+            TRACE(_L("CPresentityPresenceSubscriptionItem::SynthesiseSubscriptionEventToL groupPif found" ) );
+            arrayOfPifs.AppendL( groupPif );
+            if ( !iPif )
+                {
+                TRACE(_L("CPresentityPresenceSubscriptionItem::SynthesiseSubscriptionEventToL iPif created" ) );
+                SetSubscriptionPif( groupPif );
+                //iPif = TXIMPObjectCloner< CPresenceInfoFilterImp >::CloneLC( groupPif );
+                //CleanupStack::Pop();
+                }
+            }
+        if ( ownPif )
+            {
+            TRACE(_L("CPresentityPresenceSubscriptionItem::SynthesiseSubscriptionEventToL ownPif found" ) );
+            arrayOfPifs.AppendL( ownPif );
+            }
+        if ( presentityPif )
+            {
+            TRACE(_L("CPresentityPresenceSubscriptionItem::SynthesiseSubscriptionEventToL presentityPif found" ) );
+            arrayOfPifs.AppendL( presentityPif );
+            }
+        TRACE(_L("CPresentityPresenceSubscriptionItem::SynthesiseSubscriptionEventToL 4_3" ) );
+		CPresenceInfoFilterImp* unionPif = NULL;
+    	unionPif = DocumentUtils::InfoFilterUnionL( arrayOfPifs );    
+    	if ( unionPif ) 
+    	    {
+    	    TRACE(_L("CPresentityPresenceSubscriptionItem::SynthesiseSubscriptionEventToL unionPif found" ) );
+    	    }
+    	CleanupStack::PopAndDestroy(); // >>> arrayOfPifs
+    	CleanupStack::PushL( unionPif );    // << unionPif
+
+        TRACE(_L("CPresentityPresenceSubscriptionItem::SynthesiseSubscriptionEventToL 5" ) );
+        CPresenceInfoImp* filteredPresenceInfo = 
+                DocumentUtils::CollectFilteredPresenceInfoLC(
+                    *unionPif, 
+                    *iPresenceInfo );   // << filteredPresenceInfo
+        
+        CleanupStack::Pop( filteredPresenceInfo ); // >> filteredPresenceInfo
+        CleanupStack::PopAndDestroy( unionPif );    // >>> unionPif
+        CleanupStack::PushL( filteredPresenceInfo );    // << filteredPresenceInfo
+        TRACE(_L("CPresentityPresenceSubscriptionItem::SynthesiseSubscriptionEventToL 6" ) );
+        newEvent = CPresentityPresenceEventImp::NewL( status ); // CSI: 35 # Event is put to cleanupstack in next branch.
+        newEvent->SetPresenceInfo( filteredPresenceInfo );
+        CleanupStack::Pop( filteredPresenceInfo ); // >> filteredPresenceInfo
+        CleanupStack::Pop( status );    // >> status
+        newEvent->SetIdentityL( *iIdentity );
+        }
+    else if( aForceEvent )
+        {
+        newEvent = CPresentityPresenceEventImp::NewL( status ); // CSI: 35 # Event is put to cleanupstack in next branch.
+        CleanupStack::Pop( status );
+        newEvent->SetIdentityL( *iIdentity );
+        }
+
+    if( newEvent )
+        {
+        CleanupStack::PushL( newEvent );
+        MXIMPItemParent* presCache = static_cast<MXIMPItemParent*>(iParent.GetInterface(PRESENCE_ITEM_PARENT));
+        presCache->AddEventL( *newEvent, aContext );
+        }
+    CleanupStack::PopAndDestroy(); //status || newEvent depending on branch
+    }
+
+// ---------------------------------------------------------------------------
+// CPresentityPresenceSubscriptionItem::CleanExpired()
+// ---------------------------------------------------------------------------
+//
+void CPresentityPresenceSubscriptionItem::CleanExpired()
+    {
+
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresencedatamodel/presencewatching/presentitypresencesubscriptionitem.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,189 @@
+/*
+* 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 Service Connection presentity presence subscription implementation.
+*
+*/
+
+#ifndef CPSCPRESENTITYPRESENCESUBSCRIPTIONITEM_H
+#define CPSCPRESENTITYPRESENCESUBSCRIPTIONITEM_H
+
+#include <e32base.h>
+#include "presenceinfoimp.h"
+#include "ximpsubscriptionitembase.h"
+
+class MXIMPItemParentBase;
+class MXIMPPscContext;
+class CPresenceInfoFilterImp;
+class MXIMPIdentity;
+class CXIMPIdentityImp;
+
+
+/**
+ * PSC group list subscription implementation
+ *
+ * @since S60 v3.2
+ */
+class CPresentityPresenceSubscriptionItem : public CXIMPSubscriptionItemBase
+    {
+public: // Construction and destruction
+
+    /**
+     * Construction
+     * @param aParent. Parent has to be informed when this object is deleted by RemoveMe method.
+     */
+    static CPresentityPresenceSubscriptionItem* NewLC( MXIMPItemParentBase& aParent, 
+                                                              const CXIMPIdentityImp& aIdentity );
+    /**
+     * Destruction
+     * - Remember to inform parent about delete.
+     */
+    ~CPresentityPresenceSubscriptionItem();
+
+private: // Construction and destruction
+
+    /**
+     * Construction
+     * @param aParent. Parent has to be informed when this object is deleted by RemoveMe method.
+     */
+    CPresentityPresenceSubscriptionItem( MXIMPItemParentBase& aParent );
+
+    /**
+     * Construction
+     */
+    void ConstructL( const CXIMPIdentityImp& aIdentity );
+
+public: // New methods
+
+
+    /**
+     * Current presence information filter.
+     * @return Current presence information filter.
+     */
+    IMPORT_C CPresenceInfoFilterImp& SubscriptionPif();
+    
+    /**
+     * Set current presence information filter. Overwrites existing one.
+     * Ownership is transferred to callee.
+     * @param aPif Current presence information filter.
+     */
+    IMPORT_C void SetSubscriptionPif( CPresenceInfoFilterImp* aPif );
+
+    /**
+     * Collect aggregated presence information filter without given context.
+     * @param aContext. Exluded context from aggregated pif.
+     * @return Aggregated pif without exluded context.
+     */    
+    IMPORT_C CPresenceInfoFilterImp* CollectSubscriptionPifWithoutCtxL( 
+                                                    MXIMPPscContext* aContext );
+    
+    /**
+     * Set presence information. Overwrites existing one.
+     * @param aPresenceInfo. New presence information.
+     */
+    IMPORT_C void SetPresenceInfoL( CPresenceInfoImp* aPresenceInfo );
+    
+    
+    /**
+     * For ordering items.
+     * @param aA Key item for ordering.
+     * @param aB Item to compare
+     * @return -1 if aB is greater than aA
+     *          0 if they are same
+     *          1 if aA if greater than aB.
+     */    
+    IMPORT_C static TInt Order( const CPresentityPresenceSubscriptionItem& aA,
+                         const CPresentityPresenceSubscriptionItem& aB );
+
+    /**
+     * For ordering items using identity as key.
+     * @param aA Key identity for ordering.
+     * @param aB Item to compare
+     * @return -1 if aB is greater than aA
+     *          0 if they are same
+     *          1 if aA if greater than aB.
+     */    
+    IMPORT_C static TInt IdentityOrder( const CXIMPIdentityImp* aA,
+                         const CPresentityPresenceSubscriptionItem& aB );
+    /**
+     * Identity of item.
+     * @return Identity of item.     
+     */
+    IMPORT_C const MXIMPIdentity& Identity() const;
+
+    /**
+     * Group Identity of item.
+     * @return the Group identity of item.     
+     */
+    IMPORT_C const MXIMPIdentity* GroupIdentity() const;
+
+    /**
+     * Set identity for item
+     * @param aIdentity. New identity for item. Ownership is transferred.(??)
+     */
+    IMPORT_C void SetIdentity( CXIMPIdentityImp* aIdentity );
+    
+     /**
+     * Set group identity for item
+     * @param aGroup. New identity for item. Ownership is transferred.
+     */
+    IMPORT_C void SetGroupIdentity( CXIMPIdentityImp* aGroup );
+
+    
+public: // From MXIMPSubscriptionItem
+
+    /**
+     * @see MXIMPSubscriptionItem
+     */
+    void SynthesiseSubscriptionEventToL( MXIMPPscContext* aContext, TBool aForceEvent );
+    
+private: // From CXIMPSubscriptionItemBase
+
+    /**
+     * @see CXIMPSubscriptionItemBase
+     */
+    void CleanExpired();
+
+private: // Data
+
+    /**
+     * Current presence information filter.
+     */
+    CPresenceInfoFilterImp* iPif;
+        
+    /**
+     * Current presence info for item
+     * Own
+     */
+    CPresenceInfoImp* iPresenceInfo;
+    
+    /**
+     * Identity of item
+     * Own
+     */
+    CXIMPIdentityImp* iIdentity;
+
+    /**
+     * Identity of group item
+     * TODO: must be an array
+     * own
+     */
+    CXIMPIdentityImp* iGroupIdentity;
+    };
+
+
+/* ======================================================================== */
+
+
+
+#endif // CPSCPRESENTITYPRESENCESUBSCRIPTIONITEM_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresencedatamodel/presentitygroups/groupcontentsubscriptionitem.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,545 @@
+/*
+* 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 Service Connection group member subscription implementation.
+*
+*/
+
+
+#include <badesca.h>
+
+#include "groupcontentsubscriptionitem.h"
+#include "presenceinfofilterimp.h"
+#include "ximpitemparent.h"
+#include "ximppanics.h"
+#include "ximppsccontext.h"
+#include "documentutils.h"
+#include "presentitygroupcontenteventimp.h"
+#include "presencetypehelpers.h"
+#include "ximpobjecthelpers.h"
+#include "presentitygroupmemberinfoimp.h"
+#include "ximpidentityimp.h"
+#include "groupcontenteventobserver.h"
+
+#include "ximptrace.h"
+// ---------------------------------------------------------------------------
+// CGroupContentSubscriptionItem::CGroupContentSubscriptionItem()
+// ---------------------------------------------------------------------------
+//
+CGroupContentSubscriptionItem::CGroupContentSubscriptionItem( MXIMPItemParentBase& aParent )
+: CXIMPSubscriptionItemBase( aParent )
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// CGroupContentSubscriptionItem::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void CGroupContentSubscriptionItem::ConstructL( const CXIMPIdentityImp& aGroupId )
+    {
+    BaseConstructL();
+    
+    iGroupId = TXIMPObjectCloner< CXIMPIdentityImp >::CloneL( aGroupId );
+
+    // empty lists must always exist
+    iCurrentMembers = new ( ELeave) RPrGrpMemInfoImpArray;
+
+    iAdded = new ( ELeave ) RPrGrpMemInfoImpArray;
+    iUpdated = new ( ELeave ) RPrGrpMemInfoImpArray;
+    iRemoved = new ( ELeave ) RPrGrpMemInfoImpArray;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CGroupContentSubscriptionItem::NewLC()
+// ---------------------------------------------------------------------------
+//
+CGroupContentSubscriptionItem*
+        CGroupContentSubscriptionItem::NewLC( MXIMPItemParentBase& aParent,
+                                                     const CXIMPIdentityImp& aGroupId )
+    {
+    CGroupContentSubscriptionItem* self =
+                new( ELeave ) CGroupContentSubscriptionItem( aParent );
+    CleanupClosePushL( *self );
+    self->ConstructL( aGroupId );
+    return self;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CGroupContentSubscriptionItem::~CGroupContentSubscriptionItem()
+// ---------------------------------------------------------------------------
+//
+CGroupContentSubscriptionItem::~CGroupContentSubscriptionItem()
+    {
+        MXIMPItemParent* presCache = static_cast<MXIMPItemParent*>(iParent.GetInterface(PRESENCE_ITEM_PARENT));
+    presCache->RemoveMe( this );
+
+
+    if ( iCurrentMembers )
+        {
+        iCurrentMembers->Close();
+        }
+    delete iCurrentMembers;
+
+    Clean();
+    delete iAdded;
+    delete iUpdated;
+    delete iRemoved;
+
+    delete iGroupId;
+
+    iEventObservers.Close();
+    }
+
+
+// ---------------------------------------------------------------------------
+// CGroupContentSubscriptionItem::AddOrRenewSubscriberL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CGroupContentSubscriptionItem::AddOrRenewSubscriberL(
+        MXIMPPscContext* aContext )
+    {
+    TInt index = iContexts.Find( aContext );
+    if( index == KErrNotFound )
+        {
+        iContexts.AppendL( aContext );
+        User::LeaveIfError( Open() );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CGroupContentSubscriptionItem::GroupId()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C const CXIMPIdentityImp& CGroupContentSubscriptionItem::GroupId() const
+    {
+    return *iGroupId;
+    }
+
+// ---------------------------------------------------------------------------
+// CGroupContentSubscriptionItem::Order()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CGroupContentSubscriptionItem::Order(
+                        const CGroupContentSubscriptionItem& aA,
+                        const CGroupContentSubscriptionItem& aB )
+    {
+    return IdentityOrder( aA.iGroupId, aB );
+    }
+// ---------------------------------------------------------------------------
+// CPresentityPresenceSubscriptionItem::Order()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CGroupContentSubscriptionItem::IdentityOrder(
+                        const CXIMPIdentityImp* aA,
+                        const CGroupContentSubscriptionItem& aB )
+    {
+    return aA->Compare( *aB.iGroupId );
+    }
+
+// ---------------------------------------------------------------------------
+// From MXIMPSubscriptionItem class.
+// CGroupContentSubscriptionItem::SynthesiseSubscriptionEventTo()
+// ---------------------------------------------------------------------------
+//
+void CGroupContentSubscriptionItem::SynthesiseSubscriptionEventToL(
+        MXIMPPscContext* aContext, TBool aForceEvent )
+    {
+    TRACE_1( _L("CGroupContentSubscriptionItem::SynthesiseSubscriptionEventTo() aForce=%d"), aForceEvent );
+    CXIMPDataSubscriptionStateImp* status = StatusLC( aContext );
+
+    if( status->DataState() == MXIMPDataSubscriptionState::EDataAvailable || aForceEvent )
+        {
+        CPresentityGroupContentEventImp* newEvent =
+            CPresentityGroupContentEventImp::NewL( *iGroupId,
+                    iAdded,
+                    iUpdated,
+                    iRemoved,
+                    aForceEvent ? iCurrentMembers : NULL,
+                    status
+                    );
+        CleanupStack::Pop(); //status
+        CleanupStack::PushL( newEvent );
+        MXIMPItemParent* presCache = static_cast<MXIMPItemParent*>(iParent.GetInterface(PRESENCE_ITEM_PARENT));
+        presCache->AddEventL( *newEvent, aContext );
+        }        
+    CleanupStack::PopAndDestroy(); // status || newEvent. Depending on branch.
+    }
+
+// ---------------------------------------------------------------------------
+// CGroupContentSubscriptionItem::SynthesiseSubscriptionEventToAllCtxsL()
+// ---------------------------------------------------------------------------
+//
+void CGroupContentSubscriptionItem::SynthesiseSubscriptionEventToAllCtxsL()
+{
+
+TRACE_1( _L("CGroupContentSubscriptionItem::SynthesiseSubscriptionEventToAllCtxsL() iEventObservers.Count()=%d"), iEventObservers.Count() );
+TRACE_1( _L("CGroupContentSubscriptionItem::SynthesiseSubscriptionEventToAllCtxsL() iAdded->Count()=%d"), iAdded->Count() );
+TRACE_1( _L("CGroupContentSubscriptionItem::SynthesiseSubscriptionEventToAllCtxsL() iUpdated->Count()=%d"), iUpdated->Count() );
+TRACE_1( _L("CGroupContentSubscriptionItem::SynthesiseSubscriptionEventToAllCtxsL() iRemoved->Count()=%d"), iRemoved->Count() );
+
+    TInt count = iEventObservers.Count();
+    if( count && iAdded->Count() )
+    {
+        for( TInt a = 0; a < count; ++a )
+        {
+        TRACE_1( _L("CGroupContentSubscriptionItem::SynthesiseSubscriptionEventToAllCtxsL() observer = iEventObservers[ a ] =%d"), a );
+            MGroupContentEventObserver* observer = iEventObservers[ a ];
+        TInt error ( KErrNone );
+        TRAP( error, observer->HandleSynthesiseL( *iAdded ););
+        TRACE_1( _L("CGroupContentSubscriptionItem::SynthesiseSubscriptionEventToAllCtxsL()  TRAPD( error, observer->HandleSynthesiseL =%d"), error );
+        }
+    }
+
+  TRACE( _L("CGroupContentSubscriptionItem::SynthesiseSubscriptionEventToAllCtxsL - Call to CXIMPSubscriptionItemBase::SynthesiseSubscriptionEventToAllCtxsL Now ") );
+    CXIMPSubscriptionItemBase::SynthesiseSubscriptionEventToAllCtxsL();
+}
+
+// ---------------------------------------------------------------------------
+// CGroupContentSubscriptionItem::SetNewListL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CGroupContentSubscriptionItem::SetNewListL(
+        RPrGrpMemInfoImpArray* aMemberList )
+    {
+    TRACE_1( _L("CGroupContentSubscriptionItem::SetNewListL() aMemberList Count=%d"), aMemberList->Count() );
+    // we will eventually take ownership to this
+    RPrGrpMemInfoImpArray* tmp = aMemberList;
+    CleanupStack::PushL( tmp );
+
+    // the list is already sorted. when a copy was made in datacacheimp, the
+    // InsertInOrder method was used
+
+    // The below algorithm has complexity of (roughly):
+    //   - aMemberList length M
+    //   - iCurrentMembers final length N
+    //
+    //   Final complexity:
+    //     M*(    1     // indexed accessor
+    //          + logN  // find (ordered)
+    //          + logN  // insert in order (find+insert)
+    //          + O(1)  // delete
+    //          + O(1)  // remove
+    //        ) + O(1)  // updating iRemoved and iCurrentMembers
+    //     = M(2logN+3) + 2MlogN+3M = O(cMlogM).
+    //
+    // Should be fast enough. The complexity is not fully accurate because
+    // array size grows as we insert into it.
+    //
+    TLinearOrder<CPresentityGroupMemberInfoImp>
+        linearOrder( CPresentityGroupMemberInfoImp::GroupIdLinearOrder );
+
+    for ( TInt i = 0; i < tmp->Count(); i++ )
+        {
+        // compare against current list
+        CPresentityGroupMemberInfoImp* info = (*tmp)[ i ];
+        TInt pos = iCurrentMembers->FindInOrder( info, linearOrder );
+
+        if ( pos == KErrNotFound )
+            {
+            // not found in current list
+            // so must be a fresh created list name
+            iAdded->InsertInOrderL( info, linearOrder );
+            }
+        else
+            {
+            // found in current list, so it must be an updated list name
+            iUpdated->InsertInOrderL( info, linearOrder );
+
+            delete (*iCurrentMembers)[ pos ];
+            iCurrentMembers->Remove( pos );
+
+            // we must remove the found ones from iCurrentMembers,
+            // otherwise we will not know what was left. and finding out
+            // the removed items will be difficult.
+            }
+        }
+
+    // what's left in iCurrentMembers contains the deleted ones.
+    delete iRemoved;
+    iRemoved = iCurrentMembers;
+
+    // the given list becomes the new list
+    iCurrentMembers = tmp;
+    CleanupStack::Pop( tmp );
+    iSubscriptionState->SetDataStateL( MXIMPDataSubscriptionState::EDataAvailable );
+    InformObserversL();
+    }
+
+
+// ---------------------------------------------------------------------------
+// CGroupContentSubscriptionItem::SetAddedListL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CGroupContentSubscriptionItem::SetAddedListL(
+        RPrGrpMemInfoImpArray* aMemberList )
+    {
+    TRACE_1( _L("CGroupContentSubscriptionItem::SetAddedListL() aMemberList Count=%d"), aMemberList->Count() );
+    // we took ownership to the given list
+    RPrGrpMemInfoImpArray* tmp = aMemberList;
+    CleanupDeletePushL( tmp );
+
+    // see also SetNewListL.
+
+    // the list is already sorted. when a copy was made in datacacheimp, the
+    // InsertInOrder method was used
+    TLinearOrder<CPresentityGroupMemberInfoImp>
+        linearOrder( CPresentityGroupMemberInfoImp::GroupIdLinearOrder );
+
+    // update the list of created and updated groups
+    for ( TInt i = 0; i < tmp->Count(); i++ )
+        {
+        // compare against current list
+        CPresentityGroupMemberInfoImp* info = (*tmp)[ i ];
+        TInt pos = iCurrentMembers->FindInOrder( info, linearOrder );
+
+        if ( pos == KErrNotFound )
+            {
+            // not found in current list
+            // so must be a fresh created list name.
+            // this cannot come when the HandleDisplayNameUpdatedListL method
+            // is called.
+            iCurrentMembers->InsertInOrderL( info, linearOrder );
+            ( *tmp )[ i ] = NULL;
+            iAdded->InsertInOrderL( info, linearOrder );
+            }
+        else
+            {
+            // This can be checked if really had changed if needed. Now
+            // we trust server that changes are reasonable.
+            
+            // change the display name of the updated group in the current list
+            (*iCurrentMembers)[ pos ]->SetGroupMemberDisplayNameL( info->GroupMemberDisplayName() );
+
+            // found in current list, so it must be an updated list name
+            iUpdated->InsertInOrderL( (*iCurrentMembers)[ pos ], linearOrder );
+            }
+        }
+
+    // current list may get updated display name to the existing elements,
+    // otherwise the list is unchanged. list of deleted groups stays empty.
+    // updated and created lists were updated. the input parameter list can be
+    // deleted
+    CleanupStack::PopAndDestroy( tmp );
+    iSubscriptionState->SetDataStateL( MXIMPDataSubscriptionState::EDataAvailable );
+
+    InformObserversL();
+    }
+
+// ---------------------------------------------------------------------------
+// CGroupContentSubscriptionItem::SetRemovedListL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CGroupContentSubscriptionItem::SetRemovedListL(
+        RPrGrpMemInfoImpArray* aMemberList )
+    {
+    TRACE_1( _L("CGroupContentSubscriptionItem::SetRemovedListL() aMemberList Count=%d"), aMemberList->Count() );
+    // we will eventually take ownership to this
+    RPrGrpMemInfoImpArray* tmp = aMemberList;
+    CleanupStack::PushL( tmp );
+
+    // see also SetNewListL.
+
+    // the list is already sorted. when a copy was made in datacacheimp, the
+    // InsertInOrder method was used
+    TLinearOrder<CPresentityGroupMemberInfoImp>
+        linearOrder( CPresentityGroupMemberInfoImp::GroupIdLinearOrder );
+
+    // remove the deleted ones from the current list
+    for ( TInt i = 0; i < tmp->Count(); i++ )
+        {
+        // compare against current list
+        CPresentityGroupMemberInfoImp* info = (*tmp)[ i ];
+        TInt pos = iCurrentMembers->FindInOrder( info, linearOrder );
+
+        // found in current list, so it must be a deleted list name
+        if ( pos != KErrNotFound )
+            {
+            // remove from current list
+            delete (*iCurrentMembers)[ pos ];
+            iCurrentMembers->Remove( pos );
+            }
+        }
+
+    // the given list becomes the new list of
+    // removed ones
+    delete iRemoved;
+    iRemoved = tmp;
+    CleanupStack::Pop( tmp );
+    iSubscriptionState->SetDataStateL( MXIMPDataSubscriptionState::EDataAvailable );
+    InformObserversL();
+    }
+
+// ---------------------------------------------------------------------------
+// CGroupContentSubscriptionItem::Clean()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CGroupContentSubscriptionItem::Clean()
+    {
+    TRACE( _L("CGroupContentSubscriptionItem::Clean") );
+    // empty the lists.
+    // the lists must stay valid for use
+
+    // iAdded and iUpdated are collection from currentlist. Do not delete items.
+    // iRemoved is only place for items. Delete those.
+
+    iAdded->Reset();
+    iUpdated->Reset();
+    iRemoved->Close();
+    }
+
+
+// ---------------------------------------------------------------------------
+// CGroupContentSubscriptionItem::GroupMemberExistsL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TBool CGroupContentSubscriptionItem::GroupMemberExistsL(
+                            CPresentityGroupMemberInfoImp& aMemberInfo ) const
+    {
+    TBool found( EFalse );
+
+    CPresentityGroupMemberInfoImp* memberInfo =
+        TXIMPObjectCloner< CPresentityGroupMemberInfoImp >::CloneL( aMemberInfo );
+    CleanupStack::PushL( memberInfo );
+
+
+    TLinearOrder<CPresentityGroupMemberInfoImp>
+        linearOrder( CPresentityGroupMemberInfoImp::GroupIdLinearOrder );
+    TInt pos = iCurrentMembers->FindInOrder( memberInfo, linearOrder );
+    if ( pos != KErrNotFound )
+        {
+        found = ETrue;
+        }
+
+    CleanupStack::PopAndDestroy( memberInfo );
+    TRACE_1( _L("CGroupContentSubscriptionItem::GroupMemberExistsL() returns=%d"), found );
+    return found;
+    }
+
+// ---------------------------------------------------------------------------
+// CGroupContentSubscriptionItem::IsGroupMemberUpdatedL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TBool CGroupContentSubscriptionItem::IsGroupMemberUpdatedL(
+                            CPresentityGroupMemberInfoImp& aMemberInfo ) const
+    {
+    TBool updated( EFalse );
+
+    if ( !GroupMemberExistsL( aMemberInfo ) )
+        {
+        return updated;
+        }
+
+    CPresentityGroupMemberInfoImp* memberInfo =
+        TXIMPObjectCloner< CPresentityGroupMemberInfoImp >::CloneL( aMemberInfo );
+    CleanupStack::PushL( memberInfo );
+
+
+    TLinearOrder<CPresentityGroupMemberInfoImp>
+        linearOrder( CPresentityGroupMemberInfoImp::GroupIdLinearOrder );
+    TInt pos = iCurrentMembers->FindInOrder( memberInfo, linearOrder );
+    // it exists, otherwise we would've returned after GroupMemberExistsL call
+
+    CPresentityGroupMemberInfoImp* foundMember = (*iCurrentMembers)[ pos ];
+    // Compare identity and displayname
+    if ( memberInfo->GroupMemberId().Identity().Compare(
+                            foundMember->GroupMemberId().Identity() ) != 0
+                            ||
+         memberInfo->GroupMemberDisplayName().Compare(
+                            foundMember->GroupMemberDisplayName() ) != 0 )
+        {
+        updated = ETrue;
+        }
+
+    CleanupStack::PopAndDestroy( memberInfo );
+    TRACE_1( _L("CGroupContentSubscriptionItem::IsGroupMemberUpdatedL() returns=%d"), updated );
+    return updated;
+    }
+
+// ---------------------------------------------------------------------------
+// CGroupContentSubscriptionItem::MemberCount()
+// ---------------------------------------------------------------------------
+//
+TInt CGroupContentSubscriptionItem::MemberCount() const
+    {
+    TRACE_1( _L("CGroupContentSubscriptionItem::MemberCount() returns=%d"), iCurrentMembers->Count() );
+    return iCurrentMembers->Count();
+    }
+
+// ---------------------------------------------------------------------------
+// CGroupContentSubscriptionItem::MemberAt()
+// ---------------------------------------------------------------------------
+//
+CPresentityGroupMemberInfoImp& CGroupContentSubscriptionItem::MemberAt( TInt aIndex )
+    {
+    return *( *iCurrentMembers )[ aIndex ];
+    }
+
+// ---------------------------------------------------------------------------
+// CGroupContentSubscriptionItem::RegisterEventObserverL()
+// ---------------------------------------------------------------------------
+//
+void CGroupContentSubscriptionItem::RegisterEventObserverL(
+                        MGroupContentEventObserver* aEventObserver )
+    {
+    TInt indexOfObserver = iEventObservers.Find( aEventObserver );
+    if( indexOfObserver == KErrNotFound )
+        {
+        iEventObservers.AppendL( aEventObserver );
+        User::LeaveIfError( Open() );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CGroupContentSubscriptionItem::UnregisterEventObserver()
+// ---------------------------------------------------------------------------
+//
+void CGroupContentSubscriptionItem::UnregisterEventObserver(
+                        MGroupContentEventObserver* aEventObserver )
+    {
+    TInt indexOfObserver = iEventObservers.Find( aEventObserver );
+    if( indexOfObserver != KErrNotFound )
+        {
+        iEventObservers.Remove( indexOfObserver );
+        Close();
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CGroupContentSubscriptionItem::CleanExpired()
+// ---------------------------------------------------------------------------
+//
+void CGroupContentSubscriptionItem::CleanExpired()
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// CGroupContentSubscriptionItem::InformObserversL()
+// ---------------------------------------------------------------------------
+//
+void CGroupContentSubscriptionItem::InformObserversL()
+    {
+    TInt count = iEventObservers.Count();
+    if( count && ( iAdded->Count() || iRemoved->Count() ) )
+        {
+        for( TInt a = 0; a < count; ++a )
+            {
+            MGroupContentEventObserver* observer = iEventObservers[ a ];
+            observer->HandleChangeL( *iAdded, *iRemoved );
+            }
+        }
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresencedatamodel/presentitygroups/groupcontentsubscriptionitem.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,239 @@
+/*
+* 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 Service Connection group member subscription implementation.
+*
+*/
+
+#ifndef CPSCGROUPCONTENTSUBSCRIPTIONITEM_H
+#define CPSCGROUPCONTENTSUBSCRIPTIONITEM_H
+
+#include <e32base.h>
+#include "presenceinfoimp.h"
+#include "ximpsubscriptionitembase.h"
+#include "presencetypehelpers.h"
+
+class MXIMPItemParentBase;
+class MXIMPPscContext;
+class CDesC16Array;
+class MXIMPIdentity;
+class CXIMPIdentityImp;
+class MGroupContentEventObserver;
+
+/**
+ * PSC group list subscription implementation
+ *
+ * @since S60 v3.2
+ */
+class CGroupContentSubscriptionItem : public CXIMPSubscriptionItemBase
+    {
+
+public: // Construction and destruction
+
+    /**
+     * Construction
+     * @param aParent. Parent has to be informed when this object is deleted by RemoveMe method.
+     */
+    static CGroupContentSubscriptionItem* NewLC( MXIMPItemParentBase& aParent,
+                                                        const CXIMPIdentityImp& aGroupId );
+
+    /**
+     * Destruction
+     * - Remember to inform parent about delete.
+     */
+    virtual ~CGroupContentSubscriptionItem();
+
+private: // Construction and destruction
+
+    /**
+     * Construction
+     * @param aParent. Parent has to be informed when this object is deleted by RemoveMe method.
+     */
+    CGroupContentSubscriptionItem( MXIMPItemParentBase& aParent );
+
+    /**
+     * Construction
+     */
+    void ConstructL( const CXIMPIdentityImp& aGroupId );
+
+public: // New methods
+
+    /**
+     * Add subscriber for group content if it hasn't subscribed already.
+     * @param aContext. Context to be added.
+     */
+    IMPORT_C void AddOrRenewSubscriberL( MXIMPPscContext* aContext );
+
+    /**
+     * Set the new list of members. Will create and set
+     * the temporary lists for added, removed and updated lists.
+     * Ownership is transferred!
+     * @param aMemberList The list of groups
+     */
+    IMPORT_C void SetNewListL( RPrGrpMemInfoImpArray* aMemberList );
+
+    /**
+     * Set the added list of members.
+     * Ownership is transferred!
+     * @param aMemberList The list of groups
+     */
+    IMPORT_C void SetAddedListL( RPrGrpMemInfoImpArray* aMemberList );
+
+    /**
+     * Set the removed list of members. Will set
+     * other lists accordingly.
+     * Ownership is transferred!
+     * @param aMemberList The list of groups
+     */
+    IMPORT_C void SetRemovedListL( RPrGrpMemInfoImpArray* aMemberList );
+
+    /**
+     * Used as method for TLinearOrder when ordering items.
+     * @param aA First object for ordering.
+     * @param aB Second object for ordering.
+     * @return Order of params like compare function( -1 0 1 )
+     */
+    IMPORT_C static TInt Order( const CGroupContentSubscriptionItem& aA,
+                         const CGroupContentSubscriptionItem& aB );
+
+    /**
+     * Used as method for TLinearOrder when ordering items.
+     * @param aA First object used as key for ordering.
+     * @param aB Second object for ordering.
+     * @return Order of params like compare function( -1 0 1 )
+     */
+    IMPORT_C static TInt IdentityOrder( const CXIMPIdentityImp* aA,
+                         const CGroupContentSubscriptionItem& aB );
+                         
+    /**
+     * Access to group id.
+     * @return Group id.
+     */
+    IMPORT_C const CXIMPIdentityImp& GroupId() const;
+    
+    /**
+     * Remove the temporary lists.
+     */
+    IMPORT_C void Clean();
+
+    /**
+     * Check if group member exists.
+     * @param aMemberInfo Group member to check
+     * @return ETrue if group member exists. EFalse if not.
+     */    
+    IMPORT_C TBool GroupMemberExistsL( CPresentityGroupMemberInfoImp& aMemberInfo ) const;
+    
+    /**
+     * Check if group member is updated.
+     * @param aMemberInfo Group member to check
+     * @return ETrue if group member updated. EFalse if not.
+     */
+    IMPORT_C TBool IsGroupMemberUpdatedL( CPresentityGroupMemberInfoImp& aMemberInfo ) const;
+    
+public: // Methods for accessing array of current members
+
+    /**
+     * Count of current members
+     * @return Count of current members
+     */
+    TInt MemberCount() const;
+    
+    /**
+     * Access member in index.
+     * @param aIndex. Index of group member info to get.
+     * @return Group member info from index.
+     */
+    CPresentityGroupMemberInfoImp& MemberAt( TInt aIndex );
+    
+    /**
+     * Register event observer
+     * @param aEvent Observer New observer to observe events.
+     */
+    void RegisterEventObserverL( MGroupContentEventObserver* aEventObserver );
+    
+    /**
+     * Unregister event observer
+     * @param aEventObserver Canceling observer.
+     */
+    void UnregisterEventObserver( MGroupContentEventObserver* aEventObserver );
+    
+public: // From MXIMPSubscriptionItem
+
+    /**
+     * @see MXIMPSubscriptionItem
+     */
+    void SynthesiseSubscriptionEventToL( MXIMPPscContext* aContext, TBool aForceEvent );
+    
+    /**
+     * @see MXIMPSubscriptionItem
+     */
+    void SynthesiseSubscriptionEventToAllCtxsL();
+    
+private: // From CXIMPSubscriptionItemBase
+    
+    /**
+     * @see CXIMPSubscriptionItemBase
+     */
+    void CleanExpired();    
+
+private: // Helper methods
+
+    /**
+     * Inform observer about change.
+     */
+    void InformObserversL();
+
+private: // Data
+
+    /**
+     * Group identity
+     * Own.
+     */
+    CXIMPIdentityImp* iGroupId;
+
+    /**
+     * Current members.
+     * Own.
+     */
+    RPrGrpMemInfoImpArray* iCurrentMembers;
+
+    /**
+     * List of added members (new since last update).
+     * Own.
+     */
+    RPrGrpMemInfoImpArray* iAdded;
+
+    /**
+     * List of removed members (removed since last update).
+     * Own.
+     */
+    RPrGrpMemInfoImpArray* iRemoved;
+
+    /**
+     * List of updated members (same as in last update).
+     * Own.
+     */
+    RPrGrpMemInfoImpArray* iUpdated;
+    
+    /**
+     * Event observers of subscription item.
+     */
+    RPointerArray< MGroupContentEventObserver > iEventObservers;
+    };
+
+
+/* ======================================================================== */
+
+
+
+#endif // CPSCGROUPCONTENTSUBSCRIPTIONITEM_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresencedatamodel/presentitygroups/grouplistsubscriptionitem.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,320 @@
+/*
+* 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 Service Connection group list subscription implementation.
+*
+*/
+
+
+#include <badesca.h>
+
+#include "grouplistsubscriptionitem.h"
+#include "presenceinfofilterimp.h"
+#include "ximpitemparent.h"
+#include "ximppanics.h"
+#include "ximppsccontext.h"
+#include "documentutils.h"
+#include "presentitygrouplisteventimp.h"
+#include "presencetypehelpers.h"
+#include "presentitygroupinfoimp.h"
+//#include "ximpapieventbase.h"
+
+#include "ximptrace.h"
+// ---------------------------------------------------------------------------
+// CGroupListSubscriptionItem::CGroupListSubscriptionItem()
+// ---------------------------------------------------------------------------
+//
+CGroupListSubscriptionItem::CGroupListSubscriptionItem( MXIMPItemParentBase& aParent )
+: CXIMPSubscriptionItemBase( aParent )
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// CGroupListSubscriptionItem::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void CGroupListSubscriptionItem::ConstructL()
+    {
+    BaseConstructL();
+    // empty lists must always exist
+    iCurrentList = new ( ELeave) RPrGrpInfoImpArray;
+
+    iCreated = new ( ELeave ) RPrGrpInfoImpArray;
+    iUpdated = new ( ELeave ) RPrGrpInfoImpArray;
+    iDeleted = new ( ELeave ) RPrGrpInfoImpArray;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CGroupListSubscriptionItem::NewL()
+// ---------------------------------------------------------------------------
+//
+CGroupListSubscriptionItem* CGroupListSubscriptionItem::NewLC( MXIMPItemParentBase& aParent )
+    {
+    CGroupListSubscriptionItem* self = new( ELeave ) CGroupListSubscriptionItem( aParent );
+    CleanupClosePushL( *self );
+    self->ConstructL();
+    return self;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CGroupListSubscriptionItem::~CGroupListSubscriptionItem()
+// ---------------------------------------------------------------------------
+//
+CGroupListSubscriptionItem::~CGroupListSubscriptionItem()
+    {
+        MXIMPItemParent* presCache = static_cast<MXIMPItemParent*>(iParent.GetInterface(PRESENCE_ITEM_PARENT));
+    presCache->RemoveMe( this );
+
+    if( iCurrentList )
+        {
+        iCurrentList->Close();
+        }
+    delete iCurrentList;
+
+    Clean();
+    // just in case
+    delete iCreated;
+    delete iDeleted;
+    delete iUpdated;
+    }
+
+// ---------------------------------------------------------------------------
+// CGroupListSubscriptionItem::SynthesiseSubscriptionEventTo()
+// ---------------------------------------------------------------------------
+//
+void CGroupListSubscriptionItem::SynthesiseSubscriptionEventToL(
+        MXIMPPscContext* aContext, TBool aForceEvent )
+    {
+    TRACE_1( _L("CGroupListSubscriptionItem::SynthesiseSubscriptionEventTo() aForce=%d"), aForceEvent );
+    CXIMPDataSubscriptionStateImp* status = StatusLC( aContext );
+
+    if( status->DataState() == MXIMPDataSubscriptionState::EDataAvailable || aForceEvent )
+        {
+        CPresentityGroupListEventImp* newEvent = CPresentityGroupListEventImp::NewL(
+                iCreated,
+                iUpdated,
+                iDeleted,
+                aForceEvent ? iCurrentList : NULL,
+                status
+                );
+        CleanupStack::Pop( status );
+        CleanupStack::PushL( newEvent );
+        
+        MXIMPItemParent* presCache = static_cast<MXIMPItemParent*>(iParent.GetInterface(PRESENCE_ITEM_PARENT));
+        presCache->AddEventL( *newEvent, aContext );
+        
+        }
+    CleanupStack::PopAndDestroy(); //status || newEvent. Depending on branch.
+    }
+
+
+// ---------------------------------------------------------------------------
+// CGroupListSubscriptionItem::SetNewListL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CGroupListSubscriptionItem::SetNewListL(
+        RPrGrpInfoImpArray* aGroupList )
+    {
+    TRACE_1( _L("CGroupListSubscriptionItem::SetNewListL() aGroupList Count=%d"), aGroupList->Count() );
+    // we will eventually take ownership to this
+    RPrGrpInfoImpArray* tmp = aGroupList;
+    CleanupDeletePushL( tmp );
+
+    // the list is already sorted. when a copy was made in datacacheimp, the
+    // InsertInOrder method was used
+
+    // The below algorithm has complexity of (roughly):
+    //   - aGroupList length M
+    //   - iCurrentList final length N
+    //
+    //   Final complexity:
+    //     M*(    1     // indexed accessor
+    //          + logN  // find (ordered)
+    //          + logN  // insert in order (find+insert)
+    //          + O(1)  // delete
+    //          + O(1)  // remove
+    //        ) + O(1)  // updating iDeleted and iCurrentList
+    //     = M(2logN+3) + 2MlogN+3M = O(cMlogM).
+    //
+    // Should be fast enough. The complexity is not fully accurate because
+    // array size grows as we insert into it.
+    //
+    TLinearOrder<CPresentityGroupInfoImp>
+        linearOrder( CPresentityGroupInfoImp::GroupIdLinearOrder );
+
+    for ( TInt i = 0; i < tmp->Count(); i++ )
+        {
+        // compare against current list
+        CPresentityGroupInfoImp* info = (*tmp)[ i ];
+        TInt pos = iCurrentList->FindInOrder( info, linearOrder );
+
+        if ( pos == KErrNotFound )
+            {
+            // not found in current list
+            // so must be a fresh created list name
+            iCreated->InsertInOrderL( info, linearOrder );
+            }
+        else
+            {
+            // found in current list, so it must be an updated list name
+            iUpdated->InsertInOrderL( info, linearOrder );
+
+            delete (*iCurrentList)[ pos ];
+            iCurrentList->Remove( pos );
+
+            // we must remove the found ones from iCurrentList,
+            // otherwise we will not know what was left. and finding out
+            // the deleted items will be difficult.
+            }
+        }
+
+    // what's left in iCurrentList contains the deleted ones.
+    delete iDeleted;
+    iDeleted = iCurrentList;
+
+    // the given list becomes the new list
+    iCurrentList = tmp;
+    CleanupStack::Pop( tmp );
+    iSubscriptionState->SetDataStateL( MXIMPDataSubscriptionState::EDataAvailable );
+    }
+
+// ---------------------------------------------------------------------------
+// CGroupListSubscriptionItem::SetCreatedListL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CGroupListSubscriptionItem::SetCreatedListL(
+        RPrGrpInfoImpArray* aGroupList )
+    {
+    TRACE_1( _L("CGroupListSubscriptionItem::SetCreatedListL() aGroupList Count=%d"), aGroupList->Count() );
+    // we took ownership to the given list
+    RPrGrpInfoImpArray* tmp = aGroupList;
+    CleanupDeletePushL( tmp );
+
+    // see also SetNewListL.
+
+    // the list is already sorted. when a copy was made in datacacheimp, the
+    // InsertInOrder method was used
+    TLinearOrder<CPresentityGroupInfoImp>
+        linearOrder( CPresentityGroupInfoImp::GroupIdLinearOrder );
+
+    // update the list of created and updated groups
+    for ( TInt i = 0; i < tmp->Count(); i++ )
+        {
+        // compare against current list
+        CPresentityGroupInfoImp* info = (*tmp)[ i ];
+        TInt pos = iCurrentList->FindInOrder( info, linearOrder );
+
+        if ( pos == KErrNotFound )
+            {
+            // not found in current list
+            // so must be a fresh created list name.
+            // this cannot come when the HandleDisplayNameUpdatedListL method
+            // is called.
+            iCurrentList->InsertInOrderL( info, linearOrder );
+            ( *tmp )[ i ] = NULL;
+            iCreated->InsertInOrderL( info, linearOrder );
+            }
+        else
+            {
+            // This can be checked if really had changed if needed. Now
+            // we trust server that changes are reasonable.
+
+            // change the display name of the updated group in the current list
+            (*iCurrentList)[ pos ]->SetGroupDisplayNameL( info->GroupDisplayName() );
+
+            // found in current list, so it must be an updated list name
+            iUpdated->InsertInOrderL( (*iCurrentList)[ pos ], linearOrder );
+            }
+        }
+
+    // current list may get updated display name to the existing elements,
+    // otherwise the list is unchanged. list of deleted groups stays empty.
+    // updated and created lists were updated. the input parameter list can be
+    // deleted
+    CleanupStack::PopAndDestroy( tmp );
+    iSubscriptionState->SetDataStateL( MXIMPDataSubscriptionState::EDataAvailable );
+    }
+
+// ---------------------------------------------------------------------------
+// CGroupListSubscriptionItem::SetDeletedListL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CGroupListSubscriptionItem::SetDeletedListL(
+        RPrGrpInfoImpArray* aGroupList )
+    {
+    TRACE_1( _L("CGroupListSubscriptionItem::SetDeletedListL() aGroupList Count=%d"), aGroupList->Count() );
+    // we will eventually take ownership to this
+    RPrGrpInfoImpArray* tmp = aGroupList;
+    CleanupDeletePushL( tmp );
+
+    // see also SetNewListL.
+
+    // the list is already sorted. when a copy was made in datacacheimp, the
+    // InsertInOrder method was used
+    TLinearOrder<CPresentityGroupInfoImp>
+        linearOrder( CPresentityGroupInfoImp::GroupIdLinearOrder );
+
+    // remove the deleted ones from the current list
+    for ( TInt i = 0; i < tmp->Count(); i++ )
+        {
+        // compare against current list
+        CPresentityGroupInfoImp* info = (*tmp)[ i ];
+        TInt pos = iCurrentList->FindInOrder( info, linearOrder );
+
+        // found in current list, so it must be a deleted list name
+        if ( pos != KErrNotFound )
+            {
+            // remove from current list
+            delete (*iCurrentList)[ pos ];
+            iCurrentList->Remove( pos );
+            }
+        }
+
+    // the given list becomes the new list of
+    // deleted ones
+    delete iDeleted;
+    iDeleted = tmp;
+    CleanupStack::Pop( tmp );
+    iSubscriptionState->SetDataStateL( MXIMPDataSubscriptionState::EDataAvailable );
+    }
+
+// ---------------------------------------------------------------------------
+// CGroupListSubscriptionItem::Clean
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CGroupListSubscriptionItem::Clean()
+    {
+    TRACE( _L("CGroupListSubscriptionItem::Clean()") );
+    // empty the lists.
+    // the lists must stay valid for use
+
+    // iCreated and iUpdated are collection from currentlist. Do not delete items.
+    // iDeleted is only place for items. Delete those.
+
+    iCreated->Reset();
+    iUpdated->Reset();
+    iDeleted->Close();
+    }
+
+// ---------------------------------------------------------------------------
+// CGroupListSubscriptionItem::CleanExpired()
+// ---------------------------------------------------------------------------
+//
+void CGroupListSubscriptionItem::CleanExpired()
+    {
+
+    }
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresencedatamodel/presentitygroups/grouplistsubscriptionitem.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,148 @@
+/*
+* 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 Service Connection group list subscription implementation.
+*
+*/
+
+#ifndef CPSCGROUPLISTSUBSCRIPTIONITEM_H
+#define CPSCGROUPLISTSUBSCRIPTIONITEM_H
+
+#include <e32base.h>
+#include "presenceinfoimp.h"
+#include "ximpsubscriptionitem.h"
+#include "presencetypehelpers.h"
+#include "ximpsubscriptionitembase.h"
+
+class MXIMPItemParentBase;
+class MXIMPPscContext;
+class CDesC16Array;
+class CPresentityGroupInfoImp;
+
+/**
+ * PSC group list subscription implementation
+ *
+ * @since S60 v3.2
+ */
+class CGroupListSubscriptionItem : public CXIMPSubscriptionItemBase
+    {
+    
+public: // Construction and destruction
+
+    /**
+     * Construction
+     * @param aParent. Parent has to be informed when this object is deleted by RemoveMe method.
+     */
+    static CGroupListSubscriptionItem* NewLC( MXIMPItemParentBase& aParent );
+
+    /**
+     * Destruction
+     * - Remember to inform parent about delete.
+     */
+    ~CGroupListSubscriptionItem();
+
+private: // Construction and destruction
+
+    /**
+     * Construction
+     * @param aParent. Parent has to be informed when this object is deleted by RemoveMe method.
+     */
+    CGroupListSubscriptionItem( MXIMPItemParentBase& aParent );
+
+    /**
+     * Construction
+     */
+    void ConstructL();
+
+public: // New methods
+
+    /**
+     * Set the new list of groups. Will create and set
+     * the temporary lists for created, deleted and updated lists.
+     * Ownership is transferred!
+     * @param aGroupList The list of groups
+     */
+    IMPORT_C void SetNewListL( RPrGrpInfoImpArray* aGroupList );
+
+    /**
+     * Set the created list of groups. Will set
+     * other lists accordingly. If there are no new elements (=no created groups),
+     * will simply update the display names of the existing groups, i.e.
+     * HandlePresentityGroupDisplayNameUpdatedL call handling.
+     * Ownership is transferred!
+     * @param aGroupList The list of groups
+     */
+    IMPORT_C void SetCreatedListL( RPrGrpInfoImpArray* aGroupList );
+
+    /**
+     * Set the deleted list of groups. Will set
+     * other lists accordingly.
+     * Ownership is transferred!
+     * @param aGroupList The list of groups
+     */
+    IMPORT_C void SetDeletedListL( RPrGrpInfoImpArray* aGroupList );
+    
+    /**
+     * Remove the temporary lists.
+     */
+    IMPORT_C void Clean();
+
+public: // From MXIMPSubscriptionItem        
+
+    /**
+     * @see MXIMPSubscriptionItem
+     */
+    void SynthesiseSubscriptionEventToL( MXIMPPscContext* aContext, TBool aForceEvent );
+      
+private: // From CXIMPSubscriptionItemBase
+
+    /**
+     * @see CXIMPSubscriptionItemBase
+     */
+    void CleanExpired();        
+        
+      
+private: // Data
+
+    /**
+     * Current list of groups.
+     * Owned.
+     */
+    RPrGrpInfoImpArray* iCurrentList;
+
+    /**
+     * List of created groups (new since last update).
+     * Owned.
+     */
+    RPrGrpInfoImpArray* iCreated;
+
+    /**
+     * List of deleted groups (removed since last update).
+     * Owned.
+     */
+    RPrGrpInfoImpArray* iDeleted;
+
+    /**
+     * List of updated groups (same as in last update).
+     * Owned.
+     */
+    RPrGrpInfoImpArray* iUpdated;
+
+    };
+
+
+/* ======================================================================== */
+
+
+
+#endif // CPSCGROUPLISTSUBSCRIPTIONITEM_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresencedatamodel/presentitygroups/presentitygroupcontenteventimp.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,456 @@
+/*
+* 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:  MPresentityGroupContentEvent API object implementation.
+ *
+*/
+
+#include "presentitygroupcontenteventimp.h"
+#include "presentitygroupmemberinfoimp.h"
+#include "ximpidentityimp.h"
+#include "ximpdatasubscriptionstateimp.h"
+#include "ximpobjecthelpers.h"
+#include <s32strm.h>
+
+
+// ---------------------------------------------------------------------------
+// CPresentityGroupContentEventImp::NewLC()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CPresentityGroupContentEventImp* CPresentityGroupContentEventImp::NewLC(
+        CXIMPIdentityImp& aGroupId,
+        RPrGrpMemInfoImpArray* aAdded,
+        RPrGrpMemInfoImpArray* aUpdated,
+        RPrGrpMemInfoImpArray* aRemoved,
+        CXIMPDataSubscriptionStateImp* aState
+        )
+    {
+    CPresentityGroupContentEventImp* self = new( ELeave ) CPresentityGroupContentEventImp();
+    CleanupStack::PushL( self );
+    self->ConstructL( aGroupId, aAdded, aUpdated, aRemoved, aState );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CPresentityGroupContentEventImp::NewLC()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CPresentityGroupContentEventImp* CPresentityGroupContentEventImp::NewLC(
+        CXIMPIdentityImp& aGroupId,
+        RPrGrpMemInfoImpArray* aAdded,
+        RPrGrpMemInfoImpArray* aUpdated,
+        RPrGrpMemInfoImpArray* aRemoved,
+        RPrGrpMemInfoImpArray* aCurrent,
+        CXIMPDataSubscriptionStateImp* aState
+        )
+    {
+    CPresentityGroupContentEventImp* self = new( ELeave ) CPresentityGroupContentEventImp();
+    CleanupStack::PushL( self );
+    if( aCurrent )
+        {
+        self->ConstructL( aGroupId, aAdded, aUpdated, aRemoved, aCurrent, aState );
+        }
+    else
+        {
+        self->ConstructL( aGroupId, aAdded, aUpdated, aRemoved, aState );
+        }
+    return self;
+    }
+// ---------------------------------------------------------------------------
+// CPresentityGroupContentEventImp::NewL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CPresentityGroupContentEventImp* CPresentityGroupContentEventImp::NewL(
+        CXIMPIdentityImp& aGroupId,
+        RPrGrpMemInfoImpArray* aAdded,
+        RPrGrpMemInfoImpArray* aUpdated,
+        RPrGrpMemInfoImpArray* aRemoved,
+        RPrGrpMemInfoImpArray* aCurrent,
+        CXIMPDataSubscriptionStateImp* aState
+        )
+    {
+    CPresentityGroupContentEventImp* self = 
+        NewLC( aGroupId, aAdded, aUpdated, aRemoved, aCurrent, aState );
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CPresentityGroupContentEventImp::NewFromStreamLC()
+// ---------------------------------------------------------------------------
+//
+CXIMPApiEventBase* CPresentityGroupContentEventImp::NewFromStreamLC( RReadStream& aStream )
+    {
+    CPresentityGroupContentEventImp* self = new( ELeave ) CPresentityGroupContentEventImp();
+    CleanupStack::PushL( self );
+    self->ConstructL( aStream );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CPresentityGroupContentEventImp::~CPresentityGroupContentEventImp()
+// ---------------------------------------------------------------------------
+//
+CPresentityGroupContentEventImp::~CPresentityGroupContentEventImp()
+    {
+    delete iGroupId;
+
+    if( iConstructedFromStream )
+        {
+        delete iAddedMembers;
+        delete iUpdatedMembers;
+        delete iRemovedMembers;
+        delete iCurrentMembers;
+        iCurrentMembers = NULL;  // must be null to skip double deletion below
+        }
+
+    if ( iOwnsCurrentMembersArray )
+        {
+        delete iCurrentMembers;
+        }
+
+    delete iSubscriptionState;
+    }
+
+// ---------------------------------------------------------------------------
+// CPresentityGroupContentEventImp::CPresentityGroupContentEventImp()
+// ---------------------------------------------------------------------------
+//
+CPresentityGroupContentEventImp::CPresentityGroupContentEventImp()
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// CPresentityGroupContentEventImp::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void CPresentityGroupContentEventImp::ConstructL(
+        CXIMPIdentityImp& aGroupId,
+        RPrGrpMemInfoImpArray* aAdded,
+        RPrGrpMemInfoImpArray* aUpdated,
+        RPrGrpMemInfoImpArray* aRemoved,
+        CXIMPDataSubscriptionStateImp* aState
+         )
+    {
+    iGroupId = TXIMPObjectCloner< CXIMPIdentityImp >::CloneL( aGroupId );
+    iAddedMembers = aAdded;
+    iUpdatedMembers = aUpdated;
+    iRemovedMembers = aRemoved;
+
+    iCurrentMembers = new ( ELeave ) RPrGrpMemInfoImpArray;
+    iOwnsCurrentMembersArray = ETrue;
+    
+    iSubscriptionState = aState;
+    }
+
+// ---------------------------------------------------------------------------
+// CPresentityGroupContentEventImp::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void CPresentityGroupContentEventImp::ConstructL(
+        CXIMPIdentityImp& aGroupId,
+        RPrGrpMemInfoImpArray* aAdded,
+        RPrGrpMemInfoImpArray* aUpdated,
+        RPrGrpMemInfoImpArray* aRemoved,
+        RPrGrpMemInfoImpArray* aCurrent,
+        CXIMPDataSubscriptionStateImp* aState )
+    {
+    iGroupId = TXIMPObjectCloner< CXIMPIdentityImp >::CloneL( aGroupId );
+    iAddedMembers = aAdded;
+    iUpdatedMembers = aUpdated;
+    iRemovedMembers = aRemoved;
+    iCurrentMembers = aCurrent;
+
+    iSubscriptionState = aState;
+    }
+
+// ---------------------------------------------------------------------------
+// CPresentityGroupContentEventImp::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void CPresentityGroupContentEventImp::ConstructL( RReadStream& aStream )
+    {
+    iConstructedFromStream = ETrue;
+    iAddedMembers = new ( ELeave ) RPrGrpMemInfoImpArray;
+    iUpdatedMembers = new ( ELeave ) RPrGrpMemInfoImpArray;
+    iRemovedMembers = new ( ELeave ) RPrGrpMemInfoImpArray;
+    iCurrentMembers = new ( ELeave ) RPrGrpMemInfoImpArray;
+
+    iGroupId = CXIMPIdentityImp::NewLC();
+    CleanupStack::Pop( 1 ); // iGroupId
+
+    iGroupId->InternalizeL( aStream );
+    FillArrayFromStreamL( *iAddedMembers, aStream );
+    FillArrayFromStreamL( *iUpdatedMembers, aStream );
+    FillArrayFromStreamL( *iRemovedMembers, aStream );
+    FillArrayFromStreamL( *iCurrentMembers, aStream );
+
+
+    iSubscriptionState = CXIMPDataSubscriptionStateImp::NewL();
+    iSubscriptionState->InternalizeL( aStream );
+    }
+
+// ---------------------------------------------------------------------------
+// Implement supported interface access.
+// ---------------------------------------------------------------------------
+//
+XIMPIMP_IF_BASE_GET_INTERFACE_BEGIN( CPresentityGroupContentEventImp,
+                                     MPresentityGroupContentEvent )
+    XIMPIMP_IF_BASE_GET_CLASS( CXIMPApiEventBase, this )
+XIMPIMP_IF_BASE_GET_INTERFACE_END()
+
+XIMPIMP_IF_BASE_GET_CONST_INTERFACE_BEGIN( CPresentityGroupContentEventImp,
+                                           MPresentityGroupContentEvent )
+    XIMPIMP_IF_BASE_GET_CONST_CLASS( CXIMPApiEventBase, this )                                            
+XIMPIMP_IF_BASE_GET_INTERFACE_END()
+
+
+
+// ---------------------------------------------------------------------------
+// Implement methods from base event interface and base event class
+// ---------------------------------------------------------------------------
+//
+XIMPIMP_IMPLEMENT_EVENT_BASE_METHODS( CPresentityGroupContentEventImp,
+                                      MPresentityGroupContentEvent )
+
+
+// ---------------------------------------------------------------------------
+// CPresentityGroupContentEventImp::EqualsContent()
+// ---------------------------------------------------------------------------
+//
+TBool CPresentityGroupContentEventImp::EqualsContent( 
+    const CXIMPApiEventBase& aOtherInstance ) const
+    {
+    const CPresentityGroupContentEventImp* tmp =
+    TXIMPGetImpClassOrPanic< const CPresentityGroupContentEventImp >::From( 
+                                                        aOtherInstance.Base() );
+
+    TBool same = ETrue;
+
+    TBool x = 0 == GroupId().Identity().Compare( tmp->GroupId().Identity() );
+    same &= x;
+
+    x = CompareArrays( iAddedMembers, tmp->iAddedMembers );
+    same &= x;
+
+    x = CompareArrays( iUpdatedMembers, tmp->iUpdatedMembers );
+    same &= x;
+
+    x = CompareArrays( iRemovedMembers, tmp->iRemovedMembers );
+    same &= x;
+
+    x = CompareArrays( iCurrentMembers, tmp->iCurrentMembers );
+    same &= x;
+
+    x = iSubscriptionState->EqualsContent( *tmp->iSubscriptionState );
+    same &= x;
+
+    return same;
+    }
+
+// ---------------------------------------------------------------------------
+// CPresentityGroupContentEventImp::CompareArrays
+// ---------------------------------------------------------------------------
+//
+TBool CPresentityGroupContentEventImp::CompareArrays(
+        RPrGrpMemInfoImpArray* aA, RPrGrpMemInfoImpArray* aB )
+    {
+    TBool same = ETrue;
+
+    TBool x;
+    x = aA->Count() == aB->Count();   // counts must match
+    same &= x;
+
+    if ( ! same )
+        {
+        // don't bother checking further if counts mismatch
+        return same;
+        }
+
+    // now check whole array, arrays have equal length
+    for ( TInt i = 0; i < aA->Count(); i++ )
+        {
+        x = 0 == ( (*aA)[ i ]->IdentityImp().Compare(
+                    (*aB)[ i ]->IdentityImp() ) );
+        same &= x;
+
+        x = 0 == ( (*aA)[ i ]->GroupMemberDisplayName().Compare(
+                    (*aB)[ i ]->GroupMemberDisplayName() ) );
+        same &= x;
+        }
+
+    return same;
+    }
+
+// ---------------------------------------------------------------------------
+// From class CXIMPApiEventBase.
+// CPresentityGroupContentEventImp::ExternalizeL()
+// ---------------------------------------------------------------------------
+//
+void CPresentityGroupContentEventImp::ExternalizeL( RWriteStream& aStream ) const
+    {
+    iGroupId->ExternalizeL( aStream );
+    WriteArrayToStreamL( *iAddedMembers, aStream );
+    WriteArrayToStreamL( *iUpdatedMembers, aStream );
+    WriteArrayToStreamL( *iRemovedMembers, aStream );
+    WriteArrayToStreamL( *iCurrentMembers, aStream );
+
+    iSubscriptionState->ExternalizeL( aStream );
+    }
+
+
+// ---------------------------------------------------------------------------
+// From class MPresentityGroupContentEvent.
+// CPresentityGroupContentEventImp::GroupId()
+// ---------------------------------------------------------------------------
+//
+const MXIMPIdentity& CPresentityGroupContentEventImp::GroupId() const
+    {
+    return *iGroupId;
+    }
+
+// ---------------------------------------------------------------------------
+// From class MPresentityGroupContentEvent.
+// CPresentityGroupContentEventImp::NewMembersCount()
+// ---------------------------------------------------------------------------
+//
+TInt CPresentityGroupContentEventImp::NewMembersCount() const
+    {
+    return iAddedMembers->Count();
+    }
+
+// ---------------------------------------------------------------------------
+// From class MPresentityGroupContentEvent.
+// CPresentityGroupContentEventImp::NewMember()
+// ---------------------------------------------------------------------------
+//
+const MPresentityGroupMemberInfo& 
+    CPresentityGroupContentEventImp::NewMember( TInt aIndex ) const
+    {
+    return *(*iAddedMembers)[ aIndex ];
+    }
+
+// ---------------------------------------------------------------------------
+// From class MPresentityGroupContentEvent.
+// CPresentityGroupContentEventImp::UpdatedMembersCount()
+// ---------------------------------------------------------------------------
+//
+TInt CPresentityGroupContentEventImp::UpdatedMembersCount() const
+    {
+    return iUpdatedMembers->Count();
+    }
+
+// ---------------------------------------------------------------------------
+// From class MPresentityGroupContentEvent.
+// CPresentityGroupContentEventImp::UpdatedMember()
+// ---------------------------------------------------------------------------
+//
+const MPresentityGroupMemberInfo& 
+    CPresentityGroupContentEventImp::UpdatedMember( TInt aIndex ) const
+    {
+    return *(*iUpdatedMembers)[ aIndex ];
+    }
+
+// ---------------------------------------------------------------------------
+// From class MPresentityGroupContentEvent.
+// CPresentityGroupContentEventImp::DisappearedMembersCount()
+// ---------------------------------------------------------------------------
+//
+TInt CPresentityGroupContentEventImp::DisappearedMembersCount() const
+    {
+    return iRemovedMembers->Count();
+    }
+
+// ---------------------------------------------------------------------------
+// From class MPresentityGroupContentEvent.
+// CPresentityGroupContentEventImp::DisappearedMember()
+// ---------------------------------------------------------------------------
+//
+const MPresentityGroupMemberInfo& 
+    CPresentityGroupContentEventImp::DisappearedMember( TInt aIndex ) const
+    {
+    return *(*iRemovedMembers)[ aIndex ];
+    }
+
+// ---------------------------------------------------------------------------
+// From class MPresentityGroupContentEvent.
+// CPresentityGroupContentEventImp::CurrentMembersCount()
+// ---------------------------------------------------------------------------
+//
+TInt CPresentityGroupContentEventImp::CurrentMembersCount() const
+    {
+    return iCurrentMembers->Count();
+    }
+
+// ---------------------------------------------------------------------------
+// From class MPresentityGroupContentEvent.
+// CPresentityGroupContentEventImp::CurrentMember()
+// ---------------------------------------------------------------------------
+//
+const MPresentityGroupMemberInfo& 
+    CPresentityGroupContentEventImp::CurrentMember( TInt aIndex ) const
+    {
+    return *(*iCurrentMembers)[ aIndex ];
+    }
+
+// ---------------------------------------------------------------------------
+// From class MPresentityGroupContentEvent.
+// CPresentityGroupContentEventImp::Status()
+// ---------------------------------------------------------------------------
+//
+const MXIMPDataSubscriptionState&
+    CPresentityGroupContentEventImp::DataSubscriptionState() const
+    {
+    return *iSubscriptionState;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CPresentityGroupContentEventImp::WriteArrayToStreamL()
+// ---------------------------------------------------------------------------
+//
+void CPresentityGroupContentEventImp::WriteArrayToStreamL(
+        RPrGrpMemInfoImpArray& aArray, RWriteStream& aStream ) const
+    {
+    TInt count = aArray.Count();
+    aStream.WriteInt32L( count );
+        {
+        for( TInt a = 0; a < count; ++a )
+            {
+            aArray[ a ]->ExternalizeL( aStream );
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CPresentityGroupContentEventImp::FillArrayFromStreamL
+// ---------------------------------------------------------------------------
+//
+void CPresentityGroupContentEventImp::FillArrayFromStreamL(
+        RPrGrpMemInfoImpArray& aArray,
+        RReadStream& aStream )
+    {
+    TInt count = aStream.ReadInt32L();
+    for( TInt a = 0; a < count; ++a )
+        {
+        // the stream MUST be in order (since it was externalized by this class)
+        CPresentityGroupMemberInfoImp* newInfo = CPresentityGroupMemberInfoImp::NewLC();
+        newInfo->InternalizeL( aStream );
+        aArray.AppendL( newInfo );
+        CleanupStack::Pop(); // newInfo
+        }
+    }
+
+// End of file
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresencedatamodel/presentitygroups/presentitygroupcontenteventimp.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,207 @@
+/*
+* 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:  MPresentityGroupContentEvent API object implementation.
+ *
+*/
+
+#ifndef CPRESENTITYGROUPCONTENTEVENTIMP_H
+#define CPRESENTITYGROUPCONTENTEVENTIMP_H
+
+
+#include "ximpapieventbase.h"
+#include "presencetypehelpers.h"
+#include "ximpdatasubscriptionstateimp.h"
+#include <presentitygroupcontentevent.h>
+
+
+class RReadStream;
+class CXIMPIdentityImp;
+class CPresentityGroupInfoImp;
+class CXIMPDataSubscriptionStateImp;
+
+/**
+ * MOwnPresenceEvent API object implementation.
+ *
+ * @lib ximpdatamodel.dll
+ * @since S60 v3.2
+ */
+NONSHARABLE_CLASS( CPresentityGroupContentEventImp ): public CXIMPApiEventBase,
+                                                       public MPresentityGroupContentEvent
+    {
+public:
+    /** The class ID. */
+    enum { KClassId = PRIMP_CLSID_CPRESENTITYGROUPCONTENTEVENTIMP };
+
+public:
+
+    /**
+     * Exported instantiation method for initializing
+     * new event object.
+     */
+    IMPORT_C static CPresentityGroupContentEventImp* NewLC(
+            CXIMPIdentityImp& aGroupId,
+            RPrGrpMemInfoImpArray* aAdded,
+            RPrGrpMemInfoImpArray* aUpdated,
+            RPrGrpMemInfoImpArray* aRemoved,
+            CXIMPDataSubscriptionStateImp* aState
+            );
+
+    IMPORT_C static CPresentityGroupContentEventImp* NewLC(
+            CXIMPIdentityImp& aGroupId,
+            RPrGrpMemInfoImpArray* aAdded,
+            RPrGrpMemInfoImpArray* aUpdated,
+            RPrGrpMemInfoImpArray* aRemoved,
+            RPrGrpMemInfoImpArray* aCurrent,
+            CXIMPDataSubscriptionStateImp* aState
+            );
+
+    IMPORT_C static CPresentityGroupContentEventImp* NewL(
+            CXIMPIdentityImp& aGroupId,
+            RPrGrpMemInfoImpArray* aAdded,
+            RPrGrpMemInfoImpArray* aUpdated,
+            RPrGrpMemInfoImpArray* aRemoved,
+            RPrGrpMemInfoImpArray* aCurrent,
+            CXIMPDataSubscriptionStateImp* aState
+            );
+
+    /**
+     * Instantiation method for event automation.
+     * Method signature must be exactly this to work
+     * with event delivery automation system.
+     *
+     * Event implementation must be registered to
+     * XIMPEventCodec KXIMPEventConstructorTable.
+     */
+    static CXIMPApiEventBase* NewFromStreamLC( RReadStream& aStream );
+
+    virtual ~CPresentityGroupContentEventImp();
+
+
+private:
+    CPresentityGroupContentEventImp();
+
+    void ConstructL( CXIMPIdentityImp& aGroupId,
+            RPrGrpMemInfoImpArray* aAdded,
+            RPrGrpMemInfoImpArray* aUpdated,
+            RPrGrpMemInfoImpArray* aRemoved,
+            CXIMPDataSubscriptionStateImp* aState
+            );
+
+    void ConstructL( CXIMPIdentityImp& aGroupId,
+            RPrGrpMemInfoImpArray* aAdded,
+            RPrGrpMemInfoImpArray* aUpdated,
+            RPrGrpMemInfoImpArray* aRemoved,
+            RPrGrpMemInfoImpArray* aCurrent,
+            CXIMPDataSubscriptionStateImp* aState );
+
+    void ConstructL( RReadStream& aStream );
+
+    /**
+     * Helper for externalize.
+     */
+    void WriteArrayToStreamL( RPrGrpMemInfoImpArray& aArray,
+            RWriteStream& aStream ) const;
+
+    /**
+     * Helper for internalize
+     */
+    void FillArrayFromStreamL( RPrGrpMemInfoImpArray& aArray,
+            RReadStream& aStream );
+
+public: // From API base interfaces
+
+    /**
+     * Implementation of MXIMPBase interface methods
+     * @see MXIMPBase
+     */
+    XIMPIMP_DECLARE_IF_BASE_METHODS
+
+
+    /**
+     * Implementation of MXIMPEventBase interface and
+     * CXIMPApiEventBase methods
+     *
+     * @see MXIMPEventBase
+     * @see CXIMPApiEventBase
+     */
+    XIMPIMP_DECLARE_EVENT_BASE_METHODS
+
+
+public: // From MPresentityGroupContentEvent
+
+    const MXIMPIdentity& GroupId() const;
+
+    TInt NewMembersCount() const;
+    const MPresentityGroupMemberInfo& NewMember( TInt aIndex ) const;
+
+    TInt UpdatedMembersCount() const;
+    const MPresentityGroupMemberInfo& UpdatedMember( TInt aIndex ) const;
+
+    TInt DisappearedMembersCount() const;
+    const MPresentityGroupMemberInfo& DisappearedMember( TInt aIndex ) const;
+
+    TInt CurrentMembersCount() const;
+    const MPresentityGroupMemberInfo& CurrentMember( TInt aIndex ) const;
+
+    const MXIMPDataSubscriptionState& DataSubscriptionState() const;
+
+private:
+
+    /**
+     * Compare the given arrays for equality.
+     * Arrays must be sorted. This is a method specific
+     * to the group info imp array.
+     * @return ETrue if the arrays match, EFalse otherwise.
+     */
+    static TBool CompareArrays( RPrGrpMemInfoImpArray* aA, RPrGrpMemInfoImpArray* aB );
+
+private: // data
+
+    /**
+     * ETrue if constructed from stream.
+     */
+    TBool iConstructedFromStream;
+
+    /**
+     * Kludge to fix current members ownership issues.
+     */
+    TBool iOwnsCurrentMembersArray;
+
+    /**
+     * Group id
+     *
+     */
+    CXIMPIdentityImp* iGroupId;
+
+    /**
+     * Group member informations.
+     * Owns if constructed from stream. Otherwise does not own.
+     * Might own current members in some cases, in which
+     * iOwnsCurrentMembersArray
+     * will be set.
+     */
+    RPrGrpMemInfoImpArray* iAddedMembers;
+    RPrGrpMemInfoImpArray* iUpdatedMembers;
+    RPrGrpMemInfoImpArray* iRemovedMembers;
+    RPrGrpMemInfoImpArray* iCurrentMembers;
+
+
+    /**
+     *
+     */
+    CXIMPDataSubscriptionStateImp* iSubscriptionState;
+    };
+
+
+#endif // CPRESENTITYGROUPCONTENTEVENTIMP_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresencedatamodel/presentitygroups/presentitygroupinfoimp.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,236 @@
+/*
+* 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:  MPresencetityGrpouInfo API object implementation.
+*
+*/
+
+
+#include "presentitygroupinfoimp.h"
+#include "ximpidentityimp.h"
+#include "ximprbufhelpers.h"
+#include "ximpobjecthelpers.h"
+
+// ============================ MEMBER FUNCTIONS =============================
+
+// ---------------------------------------------------------------------------
+// CPresentityGroupInfoImp::NewLC()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CPresentityGroupInfoImp* CPresentityGroupInfoImp::NewLC( 
+                                                const MXIMPIdentity& aIdentity, 
+                                                const TDesC16& aDisplayName )
+    {
+    CPresentityGroupInfoImp* self = new( ELeave ) CPresentityGroupInfoImp;
+    CleanupStack::PushL( self );
+    self->ConstructL( aIdentity, aDisplayName );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CPresentityGroupInfoImp::NewLC()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CPresentityGroupInfoImp* CPresentityGroupInfoImp::NewLC()
+    {
+    CPresentityGroupInfoImp* self = new( ELeave ) CPresentityGroupInfoImp;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CPresentityGroupInfoImp::NewL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CPresentityGroupInfoImp* CPresentityGroupInfoImp::NewL()
+    {
+    CPresentityGroupInfoImp* self = NewLC();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CPresentityGroupInfoImp::NewFromStreamLC()
+// ---------------------------------------------------------------------------
+//
+XIMPIMP_IMPLEMENT_DATAOBJ_NEWFROMSTREAM( CPresentityGroupInfoImp )
+
+// ---------------------------------------------------------------------------
+// Implement supported interface access.
+// ---------------------------------------------------------------------------
+//
+XIMPIMP_IF_BASE_GET_INTERFACE_BEGIN( CPresentityGroupInfoImp, MPresentityGroupInfo )
+XIMPIMP_IF_BASE_GET_INTERFACE_END()
+XIMPIMP_IF_BASE_GET_CONST_INTERFACE_BEGIN( CPresentityGroupInfoImp, MPresentityGroupInfo )
+XIMPIMP_IF_BASE_GET_INTERFACE_END()
+
+// ---------------------------------------------------------------------------
+// CPresentityGroupInfoImp::~CPresentityGroupInfoImp()
+// ---------------------------------------------------------------------------
+//
+CPresentityGroupInfoImp::~CPresentityGroupInfoImp()
+    {
+    iDisplayName.Close();
+    delete iIdentity;
+    }
+
+// ---------------------------------------------------------------------------
+// CPresentityGroupInfoImp::CPresentityGroupInfoImp()
+// ---------------------------------------------------------------------------
+//
+CPresentityGroupInfoImp::CPresentityGroupInfoImp()
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// CPresentityGroupInfoImp::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void CPresentityGroupInfoImp::ConstructL()
+    {
+    iDisplayName.CreateL( 0 );
+    iIdentity = CXIMPIdentityImp::NewLC();
+    CleanupStack::Pop( iIdentity );
+    }
+
+// ---------------------------------------------------------------------------
+// CPresentityGroupInfoImp::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void CPresentityGroupInfoImp::ConstructL( const MXIMPIdentity& aIdentity, 
+                                              const TDesC16& aDisplayName )
+    {
+    const CXIMPIdentityImp* sourceIdentity =
+    TXIMPGetImpClassOrPanic< const CXIMPIdentityImp >::From( aIdentity );
+    iIdentity = TXIMPObjectCloner< CXIMPIdentityImp >::CloneL( *sourceIdentity );
+
+    iDisplayName.CreateL( aDisplayName );
+    }
+
+// ---------------------------------------------------------------------------
+// CPresentityGroupInfoImp::ExternalizeL()
+// ---------------------------------------------------------------------------
+//
+void CPresentityGroupInfoImp::ExternalizeL( RWriteStream& aStream ) const
+    {
+    iIdentity->ExternalizeL( aStream );
+    XIMPRBuf16Helper::ExternalizeL( iDisplayName, aStream );
+    }
+
+// ---------------------------------------------------------------------------
+// CPresentityGroupInfoImp::InternalizeL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CPresentityGroupInfoImp::InternalizeL( RReadStream& aStream )
+    {
+    iIdentity->InternalizeL( aStream );
+    XIMPRBuf16Helper::InternalizeL( iDisplayName, aStream );
+    }
+    
+// ---------------------------------------------------------------------------
+// From MPresentityGroupInfo class.
+// CPresentityGroupInfoImp::GroupId()
+// ---------------------------------------------------------------------------
+//
+const MXIMPIdentity& CPresentityGroupInfoImp::GroupId() const
+    {
+    return *iIdentity;
+    }
+
+
+// ---------------------------------------------------------------------------
+// From MPresentityGroupInfo class.
+// CPresentityGroupInfoImp::GroupDisplayName()
+// ---------------------------------------------------------------------------
+//
+const TDesC16& CPresentityGroupInfoImp::GroupDisplayName() const
+    {
+    return iDisplayName;
+    }
+
+
+// ---------------------------------------------------------------------------
+// From MPresentityGroupInfo class.
+// CPresentityGroupInfoImp::SetGroupIdL()
+// ---------------------------------------------------------------------------
+//
+void CPresentityGroupInfoImp::SetGroupIdL( MXIMPIdentity* aIdentity )
+    {
+    CXIMPIdentityImp* identityImp =
+    TXIMPGetImpClassOrPanic< CXIMPIdentityImp>::From( *aIdentity );
+
+    delete iIdentity;
+    iIdentity = identityImp; 
+    }
+  
+
+// ---------------------------------------------------------------------------
+// From MPresentityGroupInfo class.
+// CPresentityGroupInfoImp::SetGroupDisplayNameL()
+// ---------------------------------------------------------------------------
+//
+void CPresentityGroupInfoImp::SetGroupDisplayNameL( 
+    const TDesC16& aDisplayName )
+    {
+    HBufC16* displayNameBuf = aDisplayName.AllocL();
+    iDisplayName.Close();
+    iDisplayName.Assign( displayNameBuf );
+    }
+    
+    
+// ---------------------------------------------------------------------------
+// CPresentityGroupInfoImp::GroupIdLinearOrder
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CPresentityGroupInfoImp::GroupIdLinearOrder( 
+        const CPresentityGroupInfoImp& aA,
+        const CPresentityGroupInfoImp& aB )
+    {
+    return aA.Identity().Compare( aB.Identity() );
+    }
+
+// ---------------------------------------------------------------------------
+// CPresentityGroupInfoImp::Identity
+// ---------------------------------------------------------------------------
+//
+EXPORT_C const CXIMPIdentityImp& CPresentityGroupInfoImp::Identity() const
+    {
+    return *iIdentity;
+    }
+
+// ---------------------------------------------------------------------------
+// CPresentityGroupInfoImp::EqualsContent()
+// ---------------------------------------------------------------------------
+//
+TBool CPresentityGroupInfoImp::EqualsContent( 
+    const CXIMPApiDataObjBase& aOtherInstance ) const
+    {
+    const CPresentityGroupInfoImp* tmp =
+    TXIMPGetImpClassOrPanic< const CPresentityGroupInfoImp >::From( 
+                                                        aOtherInstance.Base() );
+    
+    TBool same = ETrue;
+    TBool x;
+    x = iIdentity->EqualsContent( *( tmp->iIdentity ) );
+    same &= x;
+
+    x = 0 == iDisplayName.Compare( tmp->iDisplayName );
+    same &= x;
+
+    return same;
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresencedatamodel/presentitygroups/presentitygroupinfoimp.h	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  MPresentityGroupInfo API object implementation.
+*
+*/
+
+#ifndef CPRESENTITYGROUPINFOIMP_H
+#define CPRESENTITYGROUPINFOIMP_H
+
+#include "ximpapidataobjbase.h"
+#include "presenceapiobjbase.h"
+#include <presentitygroupinfo.h>
+
+#include <e32std.h>
+#include <s32strm.h>
+
+class CXIMPIdentityImp;
+
+/**
+ * MPresenceInfo API object implementation.
+ *
+ * @lib ximpdatamodel.dll
+ * @since S60 v3.2
+ */
+NONSHARABLE_CLASS( CPresentityGroupInfoImp ): public CXIMPApiDataObjBase,
+                                                  public MPresentityGroupInfo
+    {
+    public:
+    /** The class ID. */
+    enum { KClassId = PRIMP_CLSID_CPRESENTITYGROUPINFOIMP };
+
+public:
+
+    IMPORT_C static CPresentityGroupInfoImp* NewLC( 
+                    const MXIMPIdentity& aIdentity, 
+                    const TDesC16& aDisplayName );
+    IMPORT_C static CPresentityGroupInfoImp* NewLC();
+    IMPORT_C static CPresentityGroupInfoImp* NewL();
+    virtual ~CPresentityGroupInfoImp();
+
+private:
+
+    CPresentityGroupInfoImp();
+    void ConstructL();
+    void ConstructL( const MXIMPIdentity& aIdentity, 
+                     const TDesC16& aDisplayName );
+   
+    /**
+     * @see CXIMPApiDataObjBase
+     */
+    XIMPIMP_DECLARE_DATAOBJ_BASE_PRIV_METHODS
+
+public: // From MXIMPBase
+
+    /**
+     * Implementation of MXIMPBase interface methods
+     * @see MXIMPBase
+     */
+    XIMPIMP_DECLARE_IF_BASE_METHODS
+
+    /**
+     * @see CXIMPApiDataObjBase
+     */
+    XIMPIMP_DECLARE_DATAOBJ_BASE_METHODS
+
+
+public: // From MPresentityGroupInfo
+
+    const MXIMPIdentity& GroupId() const;
+    const TDesC16& GroupDisplayName() const;
+    void SetGroupIdL( MXIMPIdentity* aIdentity );
+    void SetGroupDisplayNameL( const TDesC16& aDisplayName );    
+    
+    
+public: // New functions
+
+    /**
+     * Internalizes object data from given stream.
+     * @param aStream Stream to read.
+     */
+    IMPORT_C void InternalizeL( RReadStream& aStream );
+
+
+    /**
+     * TLinearOrder for ordering based on stored group id,
+     * when this class is used within an RPointerArray or derivatives.
+     */
+    IMPORT_C static TInt GroupIdLinearOrder( 
+            const CPresentityGroupInfoImp& aA,
+            const CPresentityGroupInfoImp& aB );
+            
+    /**
+     * Access to identity object
+     * @return Identity
+     */
+    IMPORT_C const CXIMPIdentityImp& Identity() const;
+
+private: // data
+
+    /**
+     * Identity
+     */
+    CXIMPIdentityImp* iIdentity;
+    
+    /**
+     * Displayname
+     */
+    RBuf16 iDisplayName;
+
+    };
+
+
+#endif // CPRESENTITYGROUPINFOIMP_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresencedatamodel/presentitygroups/presentitygrouplisteventimp.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,426 @@
+/*
+* 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:  MOwnPresenceEvent API object implementation.
+ *
+*/
+
+#include "presentitygrouplisteventimp.h"
+#include "presentitygroupinfoimp.h"
+#include "ximpobjecthelpers.h"
+#include "ximpdatasubscriptionstateimp.h"
+#include "ximpidentityimp.h"
+#include <s32strm.h>
+
+
+// ---------------------------------------------------------------------------
+// CPresentityGroupListEventImp::NewLC()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CPresentityGroupListEventImp* CPresentityGroupListEventImp::NewLC(
+        RPrGrpInfoImpArray* aCreated,
+        RPrGrpInfoImpArray* aUpdated,
+        RPrGrpInfoImpArray* aDeleted,
+        CXIMPDataSubscriptionStateImp* aState )
+    {
+    CPresentityGroupListEventImp* self = new( ELeave ) CPresentityGroupListEventImp();
+    CleanupStack::PushL( self );
+    self->ConstructL( aCreated, aUpdated, aDeleted, aState );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CPresentityGroupListEventImp::NewLC()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CPresentityGroupListEventImp* CPresentityGroupListEventImp::NewLC(
+        RPrGrpInfoImpArray* aCreated,
+        RPrGrpInfoImpArray* aUpdated,
+        RPrGrpInfoImpArray* aDeleted,
+        RPrGrpInfoImpArray* aCurrent,
+        CXIMPDataSubscriptionStateImp* aState
+        )
+    {
+    CPresentityGroupListEventImp* self = new( ELeave ) CPresentityGroupListEventImp();
+    CleanupStack::PushL( self );
+    if( aCurrent )
+        {
+        self->ConstructL( aCreated, aUpdated, aDeleted, aCurrent, aState );
+        }
+    else
+        {
+        self->ConstructL( aCreated, aUpdated, aDeleted, aState );
+        }
+    return self;
+    }
+    
+// ---------------------------------------------------------------------------
+// CPresentityGroupListEventImp::NewLC()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CPresentityGroupListEventImp* CPresentityGroupListEventImp::NewL(
+        RPrGrpInfoImpArray* aCreated,
+        RPrGrpInfoImpArray* aUpdated,
+        RPrGrpInfoImpArray* aDeleted,
+        RPrGrpInfoImpArray* aCurrent,
+        CXIMPDataSubscriptionStateImp* aState
+        )
+    {
+    CPresentityGroupListEventImp* self = NewLC( aCreated, aUpdated, aDeleted, aCurrent, aState );
+    CleanupStack::Pop( self );
+    return self;
+    }
+    
+// ---------------------------------------------------------------------------
+// CPresentityGroupListEventImp::NewFromStreamLC()
+// ---------------------------------------------------------------------------
+//
+CXIMPApiEventBase* CPresentityGroupListEventImp::NewFromStreamLC( RReadStream& aStream )
+    {
+    CPresentityGroupListEventImp* self = new( ELeave ) CPresentityGroupListEventImp;
+    CleanupStack::PushL( self );
+    self->ConstructL( aStream );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CPresentityGroupListEventImp::~CPresentityGroupListEventImp()
+// ---------------------------------------------------------------------------
+//
+CPresentityGroupListEventImp::~CPresentityGroupListEventImp()
+    {
+    if( iConstructedFromStream )
+        {
+        delete iCreatedGroups;
+        delete iUpdatedGroups;
+        delete iDeletedGroups;
+        delete iCurrentGroups;
+        iCurrentGroups = NULL;
+        }
+
+    if ( iOwnsCurrentGroupsArray )
+        {
+        delete iCurrentGroups;
+        }
+
+    delete iSubscriptionState;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CPresentityGroupListEventImp::CPresentityGroupListEventImp()
+// ---------------------------------------------------------------------------
+//
+CPresentityGroupListEventImp::CPresentityGroupListEventImp()
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// CPresentityGroupListEventImp::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void CPresentityGroupListEventImp::ConstructL(
+        RPrGrpInfoImpArray* aCreated,
+        RPrGrpInfoImpArray* aUpdated,
+        RPrGrpInfoImpArray* aDeleted,
+        CXIMPDataSubscriptionStateImp* aState )
+    {
+    iCreatedGroups = aCreated;
+    iUpdatedGroups = aUpdated;
+    iDeletedGroups = aDeleted;
+
+    iCurrentGroups = new ( ELeave ) RPrGrpInfoImpArray;
+    iOwnsCurrentGroupsArray = ETrue;
+    iSubscriptionState = aState;
+    }
+
+// ---------------------------------------------------------------------------
+// CPresentityGroupListEventImp::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void CPresentityGroupListEventImp::ConstructL(
+        RPrGrpInfoImpArray* aCreated,
+        RPrGrpInfoImpArray* aUpdated,
+        RPrGrpInfoImpArray* aDeleted,
+        RPrGrpInfoImpArray* aCurrent,
+        CXIMPDataSubscriptionStateImp* aState
+        )
+    {
+    iCreatedGroups = aCreated;
+    iUpdatedGroups = aUpdated;
+    iDeletedGroups = aDeleted;
+    iCurrentGroups = aCurrent;
+    iSubscriptionState = aState;
+    }
+
+// ---------------------------------------------------------------------------
+// CPresentityGroupListEventImp::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void CPresentityGroupListEventImp::ConstructL( RReadStream& aStream )
+    {
+    iConstructedFromStream = ETrue;
+
+    iCreatedGroups = new ( ELeave ) RPrGrpInfoImpArray;
+    iUpdatedGroups = new ( ELeave ) RPrGrpInfoImpArray;
+    iDeletedGroups = new ( ELeave ) RPrGrpInfoImpArray;
+    iCurrentGroups = new ( ELeave ) RPrGrpInfoImpArray;
+
+    FillArrayFromStreamL( *iCreatedGroups, aStream );
+    FillArrayFromStreamL( *iUpdatedGroups, aStream );
+    FillArrayFromStreamL( *iDeletedGroups, aStream );
+    FillArrayFromStreamL( *iCurrentGroups, aStream );
+
+    iSubscriptionState = CXIMPDataSubscriptionStateImp::NewL();
+    iSubscriptionState->InternalizeL( aStream );
+    }
+
+// ---------------------------------------------------------------------------
+// Implement supported interface access.
+// ---------------------------------------------------------------------------
+//
+XIMPIMP_IF_BASE_GET_INTERFACE_BEGIN( CPresentityGroupListEventImp,
+                                     MPresentityGroupListEvent )
+    XIMPIMP_IF_BASE_GET_CLASS( CXIMPApiEventBase, this )
+XIMPIMP_IF_BASE_GET_INTERFACE_END()
+
+XIMPIMP_IF_BASE_GET_CONST_INTERFACE_BEGIN( CPresentityGroupListEventImp,
+                                           MPresentityGroupListEvent )
+    XIMPIMP_IF_BASE_GET_CONST_CLASS( CXIMPApiEventBase, this )                                            
+XIMPIMP_IF_BASE_GET_INTERFACE_END()
+
+
+// ---------------------------------------------------------------------------
+// Implement methods from base event interface and base event class
+// ---------------------------------------------------------------------------
+//
+XIMPIMP_IMPLEMENT_EVENT_BASE_METHODS( CPresentityGroupListEventImp,
+                                      MPresentityGroupListEvent )
+
+
+// ---------------------------------------------------------------------------
+// CPresentityGroupListEventImp::EqualsContent()
+// ---------------------------------------------------------------------------
+//
+TBool CPresentityGroupListEventImp::EqualsContent( 
+    const CXIMPApiEventBase& aOtherInstance ) const
+    {
+    const CPresentityGroupListEventImp* tmp =
+    TXIMPGetImpClassOrPanic< const CPresentityGroupListEventImp >::From( 
+                                                        aOtherInstance.Base() );
+    
+    TBool same = ETrue;
+
+    TBool x;
+    x = CompareArrays( iCreatedGroups, tmp->iCreatedGroups );
+    same &= x;
+
+    x = CompareArrays( iUpdatedGroups, tmp->iUpdatedGroups );
+    same &= x;
+
+    x = CompareArrays( iDeletedGroups, tmp->iDeletedGroups );
+    same &= x;
+    
+    x = CompareArrays( iCurrentGroups, tmp->iCurrentGroups );
+    same &= x;
+
+    x = iSubscriptionState->EqualsContent( *tmp->iSubscriptionState );
+    same &= x;
+
+    return same;
+    }
+
+// ---------------------------------------------------------------------------
+// CPresentityGroupListEventImp::CompareArrays
+// ---------------------------------------------------------------------------
+//
+TBool CPresentityGroupListEventImp::CompareArrays(
+        RPrGrpInfoImpArray* aA, RPrGrpInfoImpArray* aB )
+    {
+    TBool same = ETrue;
+
+    TBool x;
+    x = aA->Count() == aB->Count();   // counts must match
+    same &= x;
+
+    if ( ! same )
+        {
+        // don't bother checking further if counts mismatch
+        return same;
+        }
+
+    // now check whole array, arrays have equal length
+    for ( TInt i = 0; i < aA->Count(); i++ )
+        {
+        x = 0 == ( (*aA)[ i ]->GroupId().Identity().Compare(
+                    (*aB)[ i ]->GroupId().Identity() ) );
+        same &= x;
+
+        x = 0 == ( (*aA)[ i ]->GroupDisplayName().Compare(
+                    (*aB)[ i ]->GroupDisplayName() ) );
+        same &= x;
+        }
+
+    return same;
+    }
+
+// ---------------------------------------------------------------------------
+// From class CXIMPApiEventBase.
+// CPresentityGroupListEventImp::ExternalizeL()
+// ---------------------------------------------------------------------------
+//
+void CPresentityGroupListEventImp::ExternalizeL( RWriteStream& aStream ) const
+    {
+    WriteArrayToStreamL( *iCreatedGroups, aStream );
+    WriteArrayToStreamL( *iUpdatedGroups, aStream );
+    WriteArrayToStreamL( *iDeletedGroups, aStream );
+    WriteArrayToStreamL( *iCurrentGroups, aStream );
+
+    iSubscriptionState->ExternalizeL( aStream );
+    }
+
+
+// ---------------------------------------------------------------------------
+// From class MPresentityGroupListEvent.
+// CPresentityGroupListEventImp::NewGroupsCount()
+// ---------------------------------------------------------------------------
+//
+TInt CPresentityGroupListEventImp::NewGroupsCount() const
+    {
+    return iCreatedGroups->Count();
+    }
+
+// ---------------------------------------------------------------------------
+// From class MPresentityGroupListEvent.
+// CPresentityGroupListEventImp::NewGroup()
+// ---------------------------------------------------------------------------
+//
+const MPresentityGroupInfo&
+            CPresentityGroupListEventImp::NewGroup( TInt aIndex ) const
+    {
+    return *(*iCreatedGroups)[ aIndex ];
+    }
+
+// ---------------------------------------------------------------------------
+// From class MPresentityGroupListEvent.
+// CPresentityGroupListEventImp::UpdatedGroupsCount()
+// ---------------------------------------------------------------------------
+//
+TInt CPresentityGroupListEventImp::UpdatedGroupsCount() const
+    {
+    return iUpdatedGroups->Count();
+    }
+
+// ---------------------------------------------------------------------------
+// From class MPresentityGroupListEvent.
+// CPresentityGroupListEventImp::UpdatedGroup()
+// ---------------------------------------------------------------------------
+//
+const MPresentityGroupInfo&
+        CPresentityGroupListEventImp::UpdatedGroup( TInt aIndex ) const
+    {
+    return *(*iUpdatedGroups)[ aIndex ];
+    }
+
+// ---------------------------------------------------------------------------
+// From class MPresentityGroupListEvent.
+// CPresentityGroupListEventImp::DisappearedGroupsCount()
+// ---------------------------------------------------------------------------
+//
+TInt CPresentityGroupListEventImp::DisappearedGroupsCount() const
+    {
+    return iDeletedGroups->Count();
+    }
+
+// ---------------------------------------------------------------------------
+// From class MPresentityGroupListEvent.
+// CPresentityGroupListEventImp::DisappearedGroup()
+// ---------------------------------------------------------------------------
+//
+const MPresentityGroupInfo&
+CPresentityGroupListEventImp::DisappearedGroup( TInt aIndex ) const
+    {
+    return *(*iDeletedGroups)[ aIndex ];
+    }
+
+// ---------------------------------------------------------------------------
+// From class MPresentityGroupListEvent.
+// CPresentityGroupListEventImp::CurrentGroupsCount()
+// ---------------------------------------------------------------------------
+//
+TInt CPresentityGroupListEventImp::CurrentGroupsCount() const
+    {
+    return iCurrentGroups->Count();
+    }
+
+// ---------------------------------------------------------------------------
+// From class MPresentityGroupListEvent.
+// CPresentityGroupListEventImp::CurrentGroup()
+// ---------------------------------------------------------------------------
+//
+const MPresentityGroupInfo& 
+    CPresentityGroupListEventImp::CurrentGroup( TInt aIndex ) const
+    {
+    return *(*iCurrentGroups)[ aIndex ];
+    }
+
+// ---------------------------------------------------------------------------
+// From class MPresentityGroupListEvent.
+// CPresentityGroupListEventImp::Status()
+// ---------------------------------------------------------------------------
+//
+const MXIMPDataSubscriptionState&
+    CPresentityGroupListEventImp::DataSubscriptionState() const
+    {
+    return *iSubscriptionState;
+    }
+
+// ---------------------------------------------------------------------------
+// CPresentityGroupListEventImp::WriteArrayToStreamL()
+// ---------------------------------------------------------------------------
+//
+void CPresentityGroupListEventImp::WriteArrayToStreamL(
+        RPrGrpInfoImpArray& aArray, RWriteStream& aStream ) const
+    {
+    TInt count = aArray.Count();
+    aStream.WriteInt32L( count );
+        {
+        for( TInt a = 0; a < count; ++a )
+            {
+            aArray[ a ]->ExternalizeL( aStream );
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CPresentityGroupListEventImp::FillArrayFromStreamL
+// ---------------------------------------------------------------------------
+//
+void CPresentityGroupListEventImp::FillArrayFromStreamL(
+        RPrGrpInfoImpArray& aArray,
+        RReadStream& aStream )
+    {
+    TInt count = aStream.ReadInt32L();
+    for( TInt a = 0; a < count; ++a )
+        {
+        // the stream MUST be in order (since it was externalized by this class)
+        CPresentityGroupInfoImp* newInfo = CPresentityGroupInfoImp::NewLC();
+        newInfo->InternalizeL( aStream );
+        aArray.AppendL( newInfo );
+        CleanupStack::Pop(); // newInfo
+        }
+    }
+
+// End of file
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresencedatamodel/presentitygroups/presentitygrouplisteventimp.h	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  MPresentityGroupList API object implementation.
+ *
+*/
+
+#ifndef CPRESENTITYGROUPLISTEVENTIMP_H
+#define CPRESENTITYGROUPLISTEVENTIMP_H
+
+#include "ximpapieventbase.h"
+#include "presencetypehelpers.h"
+#include "ximpdatasubscriptionstateimp.h"
+#include <presentitygrouplistevent.h>
+
+class RReadStream;
+class CPresentityGroupInfoImp;
+class CXIMPDataSubscriptionStateImp;
+
+/**
+ * MOwnPresenceEvent API object implementation.
+ *
+ * @lib ximpdatamodel.dll
+ * @since S60 v3.2
+ */
+NONSHARABLE_CLASS( CPresentityGroupListEventImp ): public CXIMPApiEventBase,
+                                                       public MPresentityGroupListEvent
+    {
+public:
+    /** The class ID. */
+    enum { KClassId = PRIMP_CLSID_CPRESENTITYGROUPLISTEVENTIMP };
+
+public:
+    /**
+     * Exported instantiation method for initializing
+     * new event object.
+     */
+    IMPORT_C static CPresentityGroupListEventImp* NewLC(
+            RPrGrpInfoImpArray* aCreated,
+            RPrGrpInfoImpArray* aUpdated,
+            RPrGrpInfoImpArray* aDeleted,
+            CXIMPDataSubscriptionStateImp* aState
+            );
+
+    /**
+     * Exported instantiation method for initializing
+     * new event object.
+     */
+    IMPORT_C static CPresentityGroupListEventImp* NewLC(
+            RPrGrpInfoImpArray* aCreated,
+            RPrGrpInfoImpArray* aUpdated,
+            RPrGrpInfoImpArray* aDeleted,
+            RPrGrpInfoImpArray* aCurrent,
+            CXIMPDataSubscriptionStateImp* aState
+            );
+    IMPORT_C static CPresentityGroupListEventImp* NewL(
+            RPrGrpInfoImpArray* aCreated,
+            RPrGrpInfoImpArray* aUpdated,
+            RPrGrpInfoImpArray* aDeleted,
+            RPrGrpInfoImpArray* aCurrent,
+            CXIMPDataSubscriptionStateImp* aState
+            );
+
+    /**
+     * Instantiation method for event automation.
+     * Method signature must be exactly this to work
+     * with event delivery automation system.
+     *
+     * Event implementation must be registered to
+     * XIMPEventCodec KXIMPEventConstructorTable.
+     */
+    static CXIMPApiEventBase* NewFromStreamLC( RReadStream& aStream );
+
+    virtual ~CPresentityGroupListEventImp();
+
+
+private:
+    CPresentityGroupListEventImp();
+
+    void ConstructL(
+            RPrGrpInfoImpArray* aCreated,
+            RPrGrpInfoImpArray* aUpdated,
+            RPrGrpInfoImpArray* aDeleted,
+            CXIMPDataSubscriptionStateImp* aState
+            );
+
+    void ConstructL(
+            RPrGrpInfoImpArray* aCreated,
+            RPrGrpInfoImpArray* aUpdated,
+            RPrGrpInfoImpArray* aDeleted,
+            RPrGrpInfoImpArray* aCurrent,
+            CXIMPDataSubscriptionStateImp* aState
+            );
+
+    void ConstructL( RReadStream& aStream );
+
+    /**
+     * Helper for externalize.
+     */
+    void WriteArrayToStreamL( RPrGrpInfoImpArray& aArray,
+            RWriteStream& aStream ) const;
+
+    /**
+     * Helper for internalize
+     */
+    void FillArrayFromStreamL( RPrGrpInfoImpArray& aArray,
+            RReadStream& aStream );
+
+public: // From API base interfaces
+
+    /**
+     * Implementation of MXIMPBase interface methods
+     * @see MXIMPBase
+     */
+    XIMPIMP_DECLARE_IF_BASE_METHODS
+
+
+    /**
+     * Implementation of MXIMPEventBase interface and
+     * CXIMPApiEventBase methods
+     *
+     * @see MXIMPEventBase
+     * @see CXIMPApiEventBase
+     */
+    XIMPIMP_DECLARE_EVENT_BASE_METHODS
+
+
+public: // From MPresentityGroupList
+
+    TInt NewGroupsCount() const;
+    const MPresentityGroupInfo& NewGroup( TInt aIndex ) const;
+
+    TInt UpdatedGroupsCount() const;
+    const MPresentityGroupInfo& UpdatedGroup( TInt aIndex ) const;
+
+    TInt DisappearedGroupsCount() const;
+    const MPresentityGroupInfo& DisappearedGroup( TInt aIndex ) const;
+
+    TInt CurrentGroupsCount() const;
+    const MPresentityGroupInfo& CurrentGroup( TInt aIndex ) const;
+
+    const MXIMPDataSubscriptionState& DataSubscriptionState() const;
+
+private:
+
+    /**
+     * Compare the given arrays for equality.
+     * Arrays must be sorted. This is a method specific
+     * to the group info imp array.
+     * @return ETrue if the arrays match, EFalse otherwise.
+     */
+    static TBool CompareArrays( RPrGrpInfoImpArray* aA, RPrGrpInfoImpArray* aB );
+
+private: // data
+
+    /**
+     * ETrue if constructed from stream.
+     */
+    TBool iConstructedFromStream;
+
+    /**
+     * ETrue if current groups array is owned.
+     */
+    TBool iOwnsCurrentGroupsArray;
+
+    /**
+     * Group informations.
+     * Owns if constructed from stream. Otherwise does not own.
+     */
+    RPrGrpInfoImpArray* iCreatedGroups;
+    RPrGrpInfoImpArray* iUpdatedGroups;
+    RPrGrpInfoImpArray* iDeletedGroups;
+    RPrGrpInfoImpArray* iCurrentGroups;
+
+    /**
+     *
+     */
+    CXIMPDataSubscriptionStateImp* iSubscriptionState;
+    };
+
+
+#endif // CPRESENTITYGROUPLISTEVENTIMP_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresencedatamodel/presentitygroups/presentitygroupmemberinfoimp.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  MPresentityGroupMemberInfo API object implementation.
+*
+*/
+
+
+#include "presentitygroupmemberinfoimp.h"
+#include "ximpidentityimp.h"
+#include "ximprbufhelpers.h"
+#include "ximpobjecthelpers.h"
+
+// ============================ MEMBER FUNCTIONS =============================
+
+// ---------------------------------------------------------------------------
+// CPresentityGroupMemberInfoImp::NewLC()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CPresentityGroupMemberInfoImp* CPresentityGroupMemberInfoImp::NewLC(
+                                                const MXIMPIdentity& aIdentity,
+                                                const TDesC16& aDisplayName )
+    {
+    CPresentityGroupMemberInfoImp* self = new( ELeave ) CPresentityGroupMemberInfoImp;
+    CleanupStack::PushL( self );
+    self->ConstructL( aIdentity, aDisplayName );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CPresentityGroupMemberInfoImp::NewLC()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CPresentityGroupMemberInfoImp* CPresentityGroupMemberInfoImp::NewLC()
+    {
+    CPresentityGroupMemberInfoImp* self = new( ELeave ) CPresentityGroupMemberInfoImp;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CPresentityGroupMemberInfoImp::NewL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CPresentityGroupMemberInfoImp* CPresentityGroupMemberInfoImp::NewL()
+    {
+    CPresentityGroupMemberInfoImp* self = NewLC();
+    CleanupStack::Pop( self );
+    return self;
+    }
+    
+// ---------------------------------------------------------------------------
+// CPresentityGroupMemberInfoImp::NewFromStreamLC()
+// ---------------------------------------------------------------------------
+//
+XIMPIMP_IMPLEMENT_DATAOBJ_NEWFROMSTREAM( CPresentityGroupMemberInfoImp )
+
+// ---------------------------------------------------------------------------
+// Implement supported interface access.
+// ---------------------------------------------------------------------------
+//
+XIMPIMP_IF_BASE_GET_INTERFACE_BEGIN( CPresentityGroupMemberInfoImp, MPresentityGroupMemberInfo )
+XIMPIMP_IF_BASE_GET_INTERFACE_END()
+XIMPIMP_IF_BASE_GET_CONST_INTERFACE_BEGIN( CPresentityGroupMemberInfoImp, MPresentityGroupMemberInfo )
+XIMPIMP_IF_BASE_GET_INTERFACE_END()
+
+// ---------------------------------------------------------------------------
+// CPresentityGroupMemberInfoImp::~CPresentityGroupMemberInfoImp()
+// ---------------------------------------------------------------------------
+//
+CPresentityGroupMemberInfoImp::~CPresentityGroupMemberInfoImp()
+    {
+    iDisplayName.Close();
+    delete iIdentity;
+    }
+
+// ---------------------------------------------------------------------------
+// CPresentityGroupMemberInfoImp::CPresentityGroupMemberInfoImp()
+// ---------------------------------------------------------------------------
+//
+CPresentityGroupMemberInfoImp::CPresentityGroupMemberInfoImp()
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// CPresentityGroupMemberInfoImp::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void CPresentityGroupMemberInfoImp::ConstructL()
+    {
+    iDisplayName.CreateL( 0 );
+    iIdentity = CXIMPIdentityImp::NewLC();
+    CleanupStack::Pop( iIdentity );
+    }
+
+// ---------------------------------------------------------------------------
+// CPresentityGroupMemberInfoImp::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void CPresentityGroupMemberInfoImp::ConstructL( const MXIMPIdentity& aIdentity,
+                                              const TDesC16& aDisplayName )
+    {
+    CXIMPIdentityImp* identity = CXIMPIdentityImp::NewLC();
+    identity->SetIdentityL( aIdentity.Identity() );
+    iDisplayName.CreateL( aDisplayName );
+    iIdentity = identity;
+    CleanupStack::Pop(); // identity
+    }
+
+// ---------------------------------------------------------------------------
+// CPresentityGroupMemberInfoImp::ExternalizeL()
+// ---------------------------------------------------------------------------
+//
+void CPresentityGroupMemberInfoImp::ExternalizeL( RWriteStream& aStream ) const
+    {
+    iIdentity->ExternalizeL( aStream );
+    XIMPRBuf16Helper::ExternalizeL( iDisplayName, aStream );
+    }
+
+// ---------------------------------------------------------------------------
+// CPresentityGroupMemberInfoImp::InternalizeL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CPresentityGroupMemberInfoImp::InternalizeL( RReadStream& aStream )
+    {
+    iIdentity->InternalizeL( aStream );
+    XIMPRBuf16Helper::InternalizeL( iDisplayName, aStream );
+    }
+
+// ---------------------------------------------------------------------------
+// From MPresentityGroupMemberInfo class.
+// CPresentityGroupMemberInfoImp::GroupMemberId()
+// ---------------------------------------------------------------------------
+//
+const MXIMPIdentity& CPresentityGroupMemberInfoImp::GroupMemberId() const
+    {
+    return *iIdentity;
+    }
+    
+
+// ---------------------------------------------------------------------------
+// From MPresentityGroupMemberInfo class.
+// CPresentityGroupMemberInfoImp::GroupMemberDisplayName()
+// ---------------------------------------------------------------------------
+//
+const TDesC16& CPresentityGroupMemberInfoImp::GroupMemberDisplayName() const
+    {
+    return iDisplayName;
+    }
+
+
+// ---------------------------------------------------------------------------
+// From MPresentityGroupMemberInfo class.
+// CPresentityGroupMemberInfoImp::SetGroupMemberIdL()
+// ---------------------------------------------------------------------------
+//
+void CPresentityGroupMemberInfoImp::SetGroupMemberIdL( 
+    MXIMPIdentity* aIdentity )
+    {
+    CXIMPIdentityImp* identityImp =
+    TXIMPGetImpClassOrPanic< CXIMPIdentityImp>::From( *aIdentity );
+
+    delete iIdentity;
+    iIdentity = identityImp; 
+    }
+
+
+
+// ---------------------------------------------------------------------------
+// From MPresentityGroupMemberInfo class.
+// CPresentityGroupMemberInfoImp::SetGroupMemberDisplayNameL()
+// ---------------------------------------------------------------------------
+//
+void CPresentityGroupMemberInfoImp::SetGroupMemberDisplayNameL( 
+    const TDesC16& aDisplayName )
+    {
+    HBufC16* displayNameBuf = aDisplayName.AllocL();
+    iDisplayName.Close();
+    iDisplayName.Assign( displayNameBuf );
+    }
+    
+
+
+// ---------------------------------------------------------------------------
+// CPresentityGroupMemberInfoImp::GroupIdLinearOrder
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CPresentityGroupMemberInfoImp::GroupIdLinearOrder(
+        const CPresentityGroupMemberInfoImp& aA,
+        const CPresentityGroupMemberInfoImp& aB )
+    {
+    // identity is used as primary key
+    return aA.iIdentity->Compare( *aB.iIdentity );
+    }
+
+// ---------------------------------------------------------------------------
+// CPresentityGroupMemberInfoImp::Identity()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C const CXIMPIdentityImp& CPresentityGroupMemberInfoImp::IdentityImp() const
+    {
+    return *iIdentity;
+    }
+
+// ---------------------------------------------------------------------------
+// CPresentityGroupMemberInfoImp::EqualsContent()
+// ---------------------------------------------------------------------------
+//
+TBool CPresentityGroupMemberInfoImp::EqualsContent( 
+    const CXIMPApiDataObjBase& aOtherInstance ) const
+    {
+    const CPresentityGroupMemberInfoImp* tmp =
+    TXIMPGetImpClassOrPanic< const CPresentityGroupMemberInfoImp >::From( 
+                                                        aOtherInstance.Base() );
+
+    TBool same = ETrue;
+
+    TBool x;
+    x = iIdentity->EqualsContent( *(tmp->iIdentity) );
+    same &= x;
+
+    x = 0 == iDisplayName.Compare( tmp->iDisplayName );
+    same &= x;
+
+    return same;
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresencedatamodel/presentitygroups/presentitygroupmemberinfoimp.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,132 @@
+/*
+* 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:  MPresentityGroupMemberInfo API object implementation.
+*
+*/
+
+#ifndef CPRESENTITYGROUPMEMBERINFOIMP_H
+#define CPRESENTITYGROUPMEMBERINFOIMP_H
+
+#include <e32std.h>
+#include <s32strm.h>
+
+#include "ximpapidataobjbase.h"
+#include "presenceapiobjbase.h"
+#include <presentitygroupmemberinfo.h>
+
+class CXIMPIdentityImp;
+
+/**
+ * MPresenceInfo API object implementation.
+ *
+ * @lib ximpdatamodel.dll
+ * @since S60 v3.2
+ */
+NONSHARABLE_CLASS( CPresentityGroupMemberInfoImp ): public CXIMPApiDataObjBase,
+                                                  public MPresentityGroupMemberInfo
+    {
+    public:
+    /** The class ID. */
+    enum { KClassId = PRIMP_CLSID_CPRESENTITYGROUPMEMBERINFOIMP };
+
+public:
+
+    IMPORT_C static CPresentityGroupMemberInfoImp* NewLC(
+                    const MXIMPIdentity& aIdentity,
+                    const TDesC16& aDisplayName );
+    IMPORT_C static CPresentityGroupMemberInfoImp* NewLC();
+    IMPORT_C static CPresentityGroupMemberInfoImp* NewL();
+    virtual ~CPresentityGroupMemberInfoImp();
+
+private:
+
+    CPresentityGroupMemberInfoImp();
+    void ConstructL();
+    void ConstructL( const MXIMPIdentity& aIdentity,
+                     const TDesC16& aDisplayName );
+
+    /**
+     * @see CXIMPApiDataObjBase
+     */
+    XIMPIMP_DECLARE_DATAOBJ_BASE_PRIV_METHODS
+
+public: // From MXIMPBase
+
+    /**
+     * Implementation of MXIMPBase interface methods
+     * @see MXIMPBase
+     */
+    XIMPIMP_DECLARE_IF_BASE_METHODS
+
+    /**
+     * @see CXIMPApiDataObjBase
+     */
+    XIMPIMP_DECLARE_DATAOBJ_BASE_METHODS
+
+public: // From MPresentityGroupMemberInfo
+
+    const MXIMPIdentity& GroupMemberId() const;
+    const TDesC16& GroupMemberDisplayName() const;
+    void SetGroupMemberIdL( MXIMPIdentity* aIdentity );
+    void SetGroupMemberDisplayNameL( const TDesC16& aDisplayName );
+
+
+public: // New functions
+
+    /**
+     * Extenalizes object data to given stream.
+     * @param aStream Stream to write.
+     */
+    //IMPORT_C void ExternalizeL( RWriteStream& aStream ) const;
+
+
+    /**
+     * Internalizes object data from given stream.
+     * @param aStream Stream to read.
+     */
+    IMPORT_C void InternalizeL( RReadStream& aStream );
+
+
+    /**
+     * TLinearOrder for ordering based on stored group id,
+     * when this class is used within an RPointerArray or derivatives.
+     */
+    IMPORT_C static TInt GroupIdLinearOrder(
+            const CPresentityGroupMemberInfoImp& aA,
+            const CPresentityGroupMemberInfoImp& aB );
+            
+    /**
+     * Access to identity object
+     * @return Identity
+     */
+    IMPORT_C const CXIMPIdentityImp& IdentityImp() const;            
+
+private: // data
+
+    /**
+     * Identity
+     * Own.
+     */
+    CXIMPIdentityImp* iIdentity;
+
+    /**
+     * Displayname
+     * Own.
+     */
+    RBuf16 iDisplayName;
+
+    };
+
+
+#endif // CPRESENTITYGROUPMEMBERINFOIMP_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresencefrontend/srcecomhook/presenceecomhook.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,46 @@
+/*
+* 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:  XIMP Framework's Presence Manager Ecom Hook implementation.
+*
+*/
+
+
+#include "ximpdlluids.hrh"
+#include "presencefeaturesimp.h"
+#include <ecom/implementationproxy.h>
+#include <e32base.h>
+
+
+// ---------------------------------------------------------------------------
+// Key value pair table to identify correct constructor
+// function for the requested interface.
+// ---------------------------------------------------------------------------
+//
+const TImplementationProxy ImplementationTable[] =
+    {
+    IMPLEMENTATION_PROXY_ENTRY( XIMP_ECOM_IMPLEMENTATION_UID_PRESENCE_INTERFACE,
+                                CPresenceFeaturesImp::NewL )
+    };
+
+
+// ---------------------------------------------------------------------------
+// Exported function to return the implementation proxy table
+// ---------------------------------------------------------------------------
+//
+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/ximpfw/presence/srcpresencefrontend/srcecomhook/presenceecomhook.rss	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  ECom registery info for ECom hook
+*
+*/
+
+
+#include <ecom/registryinfov2.rh>
+#include <presencemanagementifids.hrh>
+#include "ximpdlluids.hrh"
+
+// ---------------------------------------------------------------------------
+// ECom registery info for XIMP Presence Manager ECom hook
+// ---------------------------------------------------------------------------
+//
+RESOURCE REGISTRY_INFO theInfo
+    {
+    resource_format_version = RESOURCE_FORMAT_VERSION_2;
+    dll_uid = XIMP_DLL_UID_PRESENCE_HOOK;
+
+    interfaces =
+        {
+        INTERFACE_INFO
+            {
+            interface_uid = XIMP_ECOM_IF_UID_PRESENCE_INTERFACE;
+            implementations =
+                {
+                IMPLEMENTATION_INFO
+                    {
+                    implementation_uid = XIMP_ECOM_IMPLEMENTATION_UID_PRESENCE_INTERFACE;
+                    version_no         = 1;
+                    display_name       = "S60 Default XIMP";
+                    default_data       = XIMP_ECOM_DEFAULT_DATA_PRESENCE_INTERFACE;
+                    opaque_data        = "";
+                    }
+                };
+            }
+        };
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresencefrontend/srcpresencemanager/presenceauthorizationimp.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,333 @@
+/*
+* 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 of MPresenceAuthorization
+ *
+*/
+
+#include "presenceauthorizationimp.h"
+#include "presenceinfofilterimp.h"
+#include "ximpobjecthelpers.h"
+#include "presenceoperationdefs.h"
+#include "ximpidentityimp.h"
+#include "ximpcontextinternal.h"
+
+
+// ============================ MEMBER FUNCTIONS =============================
+
+// ---------------------------------------------------------------------------
+// CPresenceAuthorizationImp::NewL()
+// ---------------------------------------------------------------------------
+//
+CPresenceAuthorizationImp* CPresenceAuthorizationImp::NewL(
+    MXIMPContextInternal& aContext )
+    {
+    CPresenceAuthorizationImp* self =
+        new( ELeave ) CPresenceAuthorizationImp( aContext );
+
+    return self;
+    }
+
+
+// ---------------------------------------------------------------------------
+// Implement supported interface access.
+// ---------------------------------------------------------------------------
+//
+XIMPIMP_IF_BASE_GET_INTERFACE_BEGIN( CPresenceAuthorizationImp, 
+                                     MPresenceAuthorization )
+XIMPIMP_IF_BASE_GET_INTERFACE_END()
+
+
+XIMPIMP_IF_BASE_GET_CONST_INTERFACE_BEGIN( CPresenceAuthorizationImp, 
+                                           MPresenceAuthorization )
+XIMPIMP_IF_BASE_GET_INTERFACE_END()
+
+// ---------------------------------------------------------------------------
+// CPresenceAuthorizationImp::~CPresenceAuthorizationImp()
+// ---------------------------------------------------------------------------
+//
+CPresenceAuthorizationImp::~CPresenceAuthorizationImp()
+    {
+    //iContext not own
+    }
+
+
+// ---------------------------------------------------------------------------
+// CPresenceAuthorizationImp::CPresenceAuthorizationImp()
+// ---------------------------------------------------------------------------
+//
+CPresenceAuthorizationImp::CPresenceAuthorizationImp(
+    MXIMPContextInternal& aContext )
+    : iContext( aContext )
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// CPresenceAuthorizationImp::SubscribePresenceGrantRequestListL()
+// ---------------------------------------------------------------------------
+//
+TXIMPRequestId CPresenceAuthorizationImp::SubscribePresenceGrantRequestListL()
+    {
+    return iContext.QueueOperationL(
+                       NPresenceOps::EPrSubscribePresenceGrantRequestList,
+                       KNullDesC8 );
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceAuthorizationImp::UnsubscribePresenceGrantRequestListL()
+// ---------------------------------------------------------------------------
+//
+TXIMPRequestId CPresenceAuthorizationImp::UnsubscribePresenceGrantRequestListL()
+    {
+    return iContext.QueueOperationL(
+                       NPresenceOps::EPrUnsubscribePresenceGrantRequestList,
+                       KNullDesC8 );
+    }
+
+
+// ---------------------------------------------------------------------------
+// CPresenceAuthorizationImp::GrantPresenceForPresentityL()
+// ---------------------------------------------------------------------------
+//
+TXIMPRequestId CPresenceAuthorizationImp::GrantPresenceForPresentityL(
+    const MXIMPIdentity& aPresentityId,
+    const MPresenceInfoFilter& aPif )
+    {
+    return QueueOperationL( NPresenceOps::EPrGrantPresenceToPresentity,
+                            aPif, aPresentityId );
+    }
+
+
+// ---------------------------------------------------------------------------
+// CPresenceAuthorizationImp::WithdrawPresenceGrantFromPresentityL()
+// ---------------------------------------------------------------------------
+//
+TXIMPRequestId CPresenceAuthorizationImp::WithdrawPresenceGrantFromPresentityL(
+    const MXIMPIdentity& aPresentityId )
+    {
+    HBufC8* idPack = PackPresentityLC( aPresentityId );
+
+    TXIMPRequestId reqId =
+        iContext.QueueOperationL(
+                        NPresenceOps::EPrWithdrawPresenceFromPresentity,
+                        *idPack );
+    CleanupStack::PopAndDestroy( idPack );
+    return reqId;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CPresenceAuthorizationImp::GrantPresenceForPresentityGroupMembersL()
+// ---------------------------------------------------------------------------
+//
+TXIMPRequestId CPresenceAuthorizationImp::GrantPresenceForPresentityGroupMembersL(
+    const MXIMPIdentity& aGroupId,
+    const MPresenceInfoFilter& aPif )
+    {
+    return QueueOperationL( NPresenceOps::EPrGrantPresenceToPresentityGroupMembers,
+                            aPif, aGroupId );
+    }
+
+
+// ---------------------------------------------------------------------------
+// CPresenceAuthorizationImp::WithdrawPresenceGrantFromPresentityGroupMembersL()
+// ---------------------------------------------------------------------------
+//
+TXIMPRequestId
+    CPresenceAuthorizationImp::WithdrawPresenceGrantFromPresentityGroupMembersL(
+    const MXIMPIdentity& aGroupId )
+    {
+    HBufC8* idPack = PackPresentityLC( aGroupId );
+
+
+    TXIMPRequestId reqId =
+        iContext.QueueOperationL(
+                        NPresenceOps::EPrWithdrawPresenceFromPresentityGroupMembers,
+                        *idPack );
+
+    CleanupStack::PopAndDestroy( idPack );
+    return reqId;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CPresenceAuthorizationImp::GrantPresenceForPresentityL()
+// ---------------------------------------------------------------------------
+//
+TXIMPRequestId CPresenceAuthorizationImp::GrantPresenceForEveryoneL( 
+    const MPresenceInfoFilter& aPif )
+    {
+    HBufC8* pifPack = PackPresenceInfoFilterLC( aPif );
+
+    TXIMPRequestId reqId =
+        iContext.QueueOperationL( 
+                        NPresenceOps::EPrGrantPresenceToEveryone,
+                        *pifPack );
+    CleanupStack::PopAndDestroy( pifPack );
+    return reqId;            
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceAuthorizationImp::WithdrawPresenceGrantFromPresentityL()
+// ---------------------------------------------------------------------------
+//
+TXIMPRequestId CPresenceAuthorizationImp::WithdrawPresenceGrantFromEveryoneL()
+    {
+    TXIMPRequestId reqId =
+        iContext.QueueOperationL( 
+                        NPresenceOps::EPrWithdrawPresenceFromEveryone,
+                        KNullDesC8 );
+    return reqId;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CPresenceAuthorizationImp::SubscribePresenceBlockListL()
+// ---------------------------------------------------------------------------
+//
+TXIMPRequestId CPresenceAuthorizationImp::SubscribePresenceBlockListL()
+    {
+    // Queue the operation
+    return  iContext.QueueOperationL(
+                        NPresenceOps::EPrSubscribeBlockList,
+                        KNullDesC8 );
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceAuthorizationImp::UnsubscribePresenceBlockListL()
+// ---------------------------------------------------------------------------
+//
+TXIMPRequestId CPresenceAuthorizationImp::UnsubscribePresenceBlockListL()
+    {
+    // Queue the operation
+    return iContext.QueueOperationL(
+                        NPresenceOps::EPrUnsubscribeBlockList,
+                        KNullDesC8 );
+    }
+
+
+// ---------------------------------------------------------------------------
+// CPresenceAuthorizationImp::BlockPresenceForPresentityL()
+// ---------------------------------------------------------------------------
+//
+TXIMPRequestId CPresenceAuthorizationImp::BlockPresenceForPresentityL(
+    const MXIMPIdentity& aPresentityId )
+    {
+    HBufC8* idPack = PackPresentityLC( aPresentityId );
+
+    TXIMPRequestId reqId =
+        iContext.QueueOperationL(
+                        NPresenceOps::EPrBlockPresenceForPresentity,
+                        *idPack );
+
+    CleanupStack::PopAndDestroy( idPack );
+    return reqId;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CPresenceAuthorizationImp::CancelPresenceBlockFromPresentityL()
+// ---------------------------------------------------------------------------
+//
+TXIMPRequestId CPresenceAuthorizationImp::CancelPresenceBlockFromPresentityL(
+    const MXIMPIdentity& aPresentityId )
+    {
+    HBufC8* idPack = PackPresentityLC( aPresentityId );
+
+    TXIMPRequestId reqId =
+        iContext.QueueOperationL(
+                        NPresenceOps::EPrCancelPresenceBlockFromPresentity,
+                        *idPack );
+
+    CleanupStack::PopAndDestroy( idPack );
+    return reqId;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CPresenceAuthorizationImp::PackPresenceDocLC()
+// ---------------------------------------------------------------------------
+//
+HBufC8* CPresenceAuthorizationImp::PackPresenceInfoFilterLC(
+    const MPresenceInfoFilter& aPif )
+    {
+    const CPresenceInfoFilterImp* pifImp = 
+        TXIMPGetImpClassOrPanic< const CPresenceInfoFilterImp >::From( aPif );
+    
+    HBufC8* pack = TXIMPObjectPacker< CPresenceInfoFilterImp>::PackL( *pifImp );
+    CleanupStack::PushL( pack );
+
+    return pack;
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceAuthorizationImp::QueueOperationL()
+// ---------------------------------------------------------------------------
+//
+TXIMPRequestId CPresenceAuthorizationImp::QueueOperationL(
+    NPresenceOps::TPresenceOpTypes aOperation,
+    const MPresenceInfoFilter& aPif,
+    const MXIMPIdentity& aIdentity )
+    {
+    CBufFlat* buffer = CBufFlat::NewL( 10 );
+    CleanupStack::PushL( buffer );
+
+    RBufWriteStream ws;
+    CleanupClosePushL( ws );
+    ws.Open( *buffer ); // CSI: 65 # Does not return a value
+
+    // pif
+    const CPresenceInfoFilterImp* pifImp =
+        TXIMPGetImpClassOrPanic< const CPresenceInfoFilterImp >::From( aPif );
+    pifImp->ExternalizeL( ws );
+
+
+    // identity
+    const CXIMPIdentityImp* identityImp =
+        TXIMPGetImpClassOrPanic< const CXIMPIdentityImp >::From( aIdentity );
+    identityImp->ExternalizeL( ws );
+
+    ws.CommitL();
+    CleanupStack::PopAndDestroy();  //ws
+
+    HBufC8* packedBuf = buffer->Ptr( 0 ).AllocL();
+    CleanupStack::PopAndDestroy( buffer );
+    CleanupStack::PushL( packedBuf );
+
+    // Queue the operation
+    TXIMPRequestId reqId =
+        iContext.QueueOperationL( aOperation, *packedBuf );
+    CleanupStack::PopAndDestroy( packedBuf );
+
+    return reqId;
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceAuthorizationImp::PackPresentityLC()
+// ---------------------------------------------------------------------------
+//
+HBufC8* CPresenceAuthorizationImp::PackPresentityLC( const MXIMPIdentity& aIdentity )
+    {
+    const CXIMPIdentityImp* identityImp =
+            TXIMPGetImpClassOrPanic< const CXIMPIdentityImp >::From( aIdentity );
+    
+    HBufC8* pack = TXIMPObjectPacker< const CXIMPIdentityImp >::PackL( *identityImp );
+    CleanupStack::PushL( pack );
+
+    return pack;
+    }
+
+
+// End of file
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresencefrontend/srcpresencemanager/presenceauthorizationimp.h	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  Implementation of MPresenceWatching
+*
+*/
+
+#ifndef CPRESENCEAUTHORIZATIONIMP_H
+#define CPRESENCEAUTHORIZATIONIMP_H
+
+#include <presenceauthorization.h>
+#include "ximpapiobjbase.h"
+#include "presenceapiobjbase.h"
+#include "presenceoperationdefs.h"
+
+class MXIMPContextInternal;
+
+/**
+ * MPresencePublishing API object implementation.
+ *
+ * @lib ximpmanager.dll
+ * @since S60 v3.2
+ */
+NONSHARABLE_CLASS( CPresenceAuthorizationImp ): public CXIMPApiObjBase,
+                                                    public MPresenceAuthorization
+    {
+    public:
+    /** The class ID. */
+    enum { KClassId = PRIMP_CLSID_CPRESENCEAUTHORIZATIONIMP };
+
+
+public:
+    static CPresenceAuthorizationImp* NewL( MXIMPContextInternal& aContext );
+    ~CPresenceAuthorizationImp();
+
+
+public:
+    CPresenceAuthorizationImp( MXIMPContextInternal& aContext );
+
+
+public: // From MXIMPBase
+
+    /**
+     * Implementation of MXIMPBase interface methods
+     * @see MXIMPBase
+     */
+    XIMPIMP_DECLARE_IF_BASE_METHODS
+
+
+public: //From MPresenceAuthorization
+
+    TXIMPRequestId SubscribePresenceGrantRequestListL();
+    
+    TXIMPRequestId UnsubscribePresenceGrantRequestListL();
+    
+    TXIMPRequestId GrantPresenceForPresentityL(
+                    const MXIMPIdentity& aPresentityId,
+                    const MPresenceInfoFilter& aPif );
+    
+    TXIMPRequestId WithdrawPresenceGrantFromPresentityL(
+                    const MXIMPIdentity& aPresentityId );
+
+    TXIMPRequestId GrantPresenceForPresentityGroupMembersL(
+                    const MXIMPIdentity& aGroupId,
+                    const MPresenceInfoFilter& aPif );
+
+    TXIMPRequestId WithdrawPresenceGrantFromPresentityGroupMembersL(
+                    const MXIMPIdentity& aGroupId );
+
+    TXIMPRequestId GrantPresenceForEveryoneL(
+                    const MPresenceInfoFilter& aPif );
+    
+    TXIMPRequestId WithdrawPresenceGrantFromEveryoneL();
+
+
+    TXIMPRequestId SubscribePresenceBlockListL();
+
+    TXIMPRequestId UnsubscribePresenceBlockListL();
+
+    TXIMPRequestId BlockPresenceForPresentityL(
+                    const MXIMPIdentity& aPresentityId );
+
+    TXIMPRequestId CancelPresenceBlockFromPresentityL(
+                    const MXIMPIdentity& aPresentityId );
+
+
+private: //Helpers
+
+    /**
+     * Pack info filter for queue.
+     */
+    HBufC8* PackPresenceInfoFilterLC( const MPresenceInfoFilter& aPif );
+
+    /**
+     * Pack pif and identity for operation
+     */
+    TXIMPRequestId QueueOperationL( NPresenceOps::TPresenceOpTypes aOperation,
+                                    const MPresenceInfoFilter& aPif,
+                                    const MXIMPIdentity& aIdentity );
+                                    
+    /**
+     * Pack presentity
+     */
+    HBufC8* PackPresentityLC( const MXIMPIdentity& aIdentity );
+
+private: // data
+
+    /**
+     * Context session proxy for accessing context server.
+     * Ref.
+     */
+    MXIMPContextInternal& iContext;
+
+    };
+
+
+#endif // CPRESENCEAUTHORIZATIONIMP_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresencefrontend/srcpresencemanager/presencefeaturesimp.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,160 @@
+/*
+* 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:  Implementation of MXIMPContext
+ *
+*/
+
+
+#include <ximpcontext.h>
+#include "presencefeaturesimp.h"
+#include "presenceobjectfactoryimp.h"
+#include "presencepublishingimp.h"
+#include "presentitygroupsimp.h"
+#include "presencewatchingimp.h"
+#include "presenceauthorizationimp.h"
+#include "ximpcontextclientinfoimp.h"
+#include "ximpidentityimp.h"
+#include "ximpcontextinternal.h"
+
+
+
+// ============================ MEMBER FUNCTIONS =============================
+
+// ---------------------------------------------------------------------------
+// CPresenceFeaturesImp::NewL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CPresenceFeaturesImp* CPresenceFeaturesImp::NewL(MXIMPContext* aContext)
+    {
+    CPresenceFeaturesImp* self = new( ELeave ) CPresenceFeaturesImp() ;
+    CleanupStack::PushL( self );
+    self->ConstructL(aContext);
+    CleanupStack::Pop();
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// Implement supported interface access.
+// ---------------------------------------------------------------------------
+//
+
+XIMPIMP_IF_BASE_GET_INTERFACE_BEGIN( CPresenceFeaturesImp, 
+                                     MPresenceFeatures )
+XIMPIMP_IF_BASE_GET_INTERFACE_END()
+
+
+XIMPIMP_IF_BASE_GET_CONST_INTERFACE_BEGIN( CPresenceFeaturesImp, 
+                                           MPresenceFeatures )
+XIMPIMP_IF_BASE_GET_INTERFACE_END()
+
+// ---------------------------------------------------------------------------
+// CPresenceFeaturesImp::~CPresenceFeaturesImp()
+// ---------------------------------------------------------------------------
+//
+CPresenceFeaturesImp::~CPresenceFeaturesImp()
+    {
+    delete iPresGroup;
+    delete iPresWatch;
+    delete iPresAuth;
+    delete iPresPub;
+    delete iPresObjFactory;
+    iCtxInternal = NULL;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CPresenceFeaturesImp::CPresenceFeaturesImp( CXIMPContextClientProxy& aCtxProxy )
+// ---------------------------------------------------------------------------
+//
+CPresenceFeaturesImp::CPresenceFeaturesImp()
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceFeaturesImp::SetCtxL(MXIMPContext* aContext)
+// ---------------------------------------------------------------------------
+//
+void CPresenceFeaturesImp::SetCtxL(MXIMPContext* aContext)
+    {
+    if(!aContext)
+        User::Leave(KErrArgument);
+    iCtxInternal = TXIMPGetInterface<MXIMPContextInternal>::From(*aContext,EReturnNullIfUnknown);
+                       
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceFeaturesImp::ConstructL(MXIMPContext* aContext)
+// ---------------------------------------------------------------------------
+//
+void CPresenceFeaturesImp::ConstructL(MXIMPContext* aContext)
+    {
+    SetCtxL(aContext);
+
+    iPresObjFactory = CPresenceObjectFactoryImp::NewL();
+    iPresPub = CPresencePublishingImp::NewL( *iCtxInternal );
+    iPresWatch = CPresenceWatchingImp::NewL( *iCtxInternal );
+    iPresGroup = CPresentityGroupsImp::NewL( *iCtxInternal );
+    iPresAuth = CPresenceAuthorizationImp::NewL(*iCtxInternal );
+    }
+
+
+// ---------------------------------------------------------------------------
+// CPresenceFeaturesImp::PresenceObjectFactory()
+// ---------------------------------------------------------------------------
+//
+MPresenceObjectFactory& CPresenceFeaturesImp::PresenceObjectFactory() const
+    {
+    return *iPresObjFactory;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CPresenceFeaturesImp::PresencePublishing()
+// ---------------------------------------------------------------------------
+//
+MPresencePublishing& CPresenceFeaturesImp::PresencePublishing() const
+    {
+    return *iPresPub;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CPresenceFeaturesImp::PresentityGroups()
+// ---------------------------------------------------------------------------
+//
+MPresentityGroups& CPresenceFeaturesImp::PresentityGroups() const
+    {
+    return *iPresGroup;
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceFeaturesImp::PresenceWatching()
+// ---------------------------------------------------------------------------
+//
+MPresenceWatching& CPresenceFeaturesImp::PresenceWatching() const
+    {
+    return *iPresWatch;
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceFeaturesImp::PresenceWatching()
+// ---------------------------------------------------------------------------
+//
+MPresenceAuthorization& CPresenceFeaturesImp::PresenceAuthorization() const
+    {
+    return *iPresAuth;
+    }
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresencefrontend/srcpresencemanager/presencefeaturesimp.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,130 @@
+/*
+* 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:  Implementation of MXIMPContext
+*
+*/
+
+#ifndef CPRESENCEFEATURESIMP_H
+#define CPRESENCEFEATURESIMP_H
+
+#include <presencefeatures.h>
+#include "ximpapiobjbase.h"
+#include "presenceapiobjbase.h"
+
+class CPresencePublishingImp;
+class CPresenceObjectFactoryImp;
+class CPresentityGroupsImp;
+class CPresenceWatchingImp;
+class CPresenceAuthorizationImp;
+class MXIMPContext;
+class MXIMPContextInternal;
+
+
+/**
+ * MXIMPContext API object implementation.
+ *
+ * @lib ximpmanager.dll
+ * @since S60 v3.2
+ */
+NONSHARABLE_CLASS( CPresenceFeaturesImp ):  public MPresenceFeatures,
+                                            public CXIMPApiObjBase
+                                           
+    {
+    public:
+    /** The class ID. */
+    enum { KClassId = PRIMP_CLSID_CPRESENCEFEATURESIMP };
+
+
+public:
+
+    IMPORT_C static CPresenceFeaturesImp* NewL( MXIMPContext* aContext );
+    virtual ~CPresenceFeaturesImp();
+
+
+private:
+
+    CPresenceFeaturesImp();
+    void SetCtxL(MXIMPContext* aContext);
+    void ConstructL(MXIMPContext* aContext);
+
+
+public: // From MXIMPBase
+
+    /**
+     * Implementation of MXIMPBase interface methods
+     * @see MXIMPBase
+     */
+    XIMPIMP_DECLARE_IF_BASE_METHODS
+
+
+public: //From MPresenceFeatures
+
+   
+    MPresenceObjectFactory& PresenceObjectFactory() const;
+    MPresenceWatching& PresenceWatching() const;
+    MPresencePublishing& PresencePublishing() const;
+    MPresentityGroups& PresentityGroups() const;
+    MPresenceAuthorization& PresenceAuthorization() const;
+
+//private: // Helpers
+
+    /**
+     * Converts a string to a uid.
+     * String must be in Hex and begin with "0x".
+     */
+    //void ConvertStringToUidL( const TDesC8& aData, TUid& aUid );
+
+
+private: // data
+
+    /**
+     * Context for having a connection context server.
+     */
+    MXIMPContextInternal* iCtxInternal;
+    
+
+    /**
+     * Object factory sub interface.
+     */
+    CPresenceObjectFactoryImp* iPresObjFactory;
+
+    /**
+     * Own presence management sub interface.
+     */
+    CPresencePublishingImp* iPresPub;
+
+    /**
+     * Presentity group management sub interface
+     */
+    CPresentityGroupsImp* iPresGroup;
+
+    /**
+     * Presence watching management sub interface
+     */
+    CPresenceWatchingImp* iPresWatch;
+    
+    /**
+     * Presence authorization management sub interface
+     */
+    CPresenceAuthorizationImp* iPresAuth;
+    
+    /**
+     * Event pump.
+     * Own.
+     */
+   // CXIMPContextEventPump* iEventPump;
+    };
+
+
+#endif // CPRESENCEFEATURESIMP_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresencefrontend/srcpresencemanager/presencepublishingimp.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,178 @@
+/*
+* 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:  Implementation of MPresenceManagement
+ *
+*/
+
+#include "presencepublishingimp.h"
+#include "presenceinfoimp.h"
+#include "presenceinfofilterimp.h"
+#include "ximpobjecthelpers.h"
+#include "presenceoperationdefs.h"
+#include "ximpcontextinternal.h"
+
+
+// ============================ MEMBER FUNCTIONS =============================
+
+// ---------------------------------------------------------------------------
+// CPresencePublishingImp::NewL()
+// ---------------------------------------------------------------------------
+//
+CPresencePublishingImp* CPresencePublishingImp::NewL( 
+    MXIMPContextInternal& aContext)
+    {
+    CPresencePublishingImp* self = 
+        new( ELeave ) CPresencePublishingImp( aContext);
+
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// Implement supported interface access.
+// ---------------------------------------------------------------------------
+//
+XIMPIMP_IF_BASE_GET_INTERFACE_BEGIN( CPresencePublishingImp, 
+                                     MPresencePublishing )
+XIMPIMP_IF_BASE_GET_INTERFACE_END()
+
+
+XIMPIMP_IF_BASE_GET_CONST_INTERFACE_BEGIN( CPresencePublishingImp, 
+                                           MPresencePublishing )
+XIMPIMP_IF_BASE_GET_INTERFACE_END()
+
+// ---------------------------------------------------------------------------
+// CPresencePublishingImp::~CPresencePublishingImp()
+// ---------------------------------------------------------------------------
+//
+CPresencePublishingImp::~CPresencePublishingImp()
+    {
+    //iContext not own
+    }
+
+
+// ---------------------------------------------------------------------------
+// CPresencePublishingImp::CPresencePublishingImp()
+// ---------------------------------------------------------------------------
+//
+CPresencePublishingImp::CPresencePublishingImp(
+    MXIMPContextInternal& aContext)
+    : iContext( aContext)
+    {
+    }
+    
+// ---------------------------------------------------------------------------
+// From class MPresencePublishing.
+// CPresencePublishingImp::SubscribeOwnPresenceL()
+// ---------------------------------------------------------------------------
+//
+TXIMPRequestId CPresencePublishingImp::SubscribeOwnPresenceL( 
+                                            const MPresenceInfoFilter& aPif )
+    {
+    HBufC8* pifPack = PackPresenceInfoFilterLC( aPif );
+
+    TXIMPRequestId reqId =
+        iContext.QueueOperationL( NPresenceOps::EPrSubscribeOwnPresence,
+                                   *pifPack );
+    CleanupStack::PopAndDestroy( pifPack );
+
+    return reqId;    
+    }
+
+// ---------------------------------------------------------------------------
+// From class MPresencePublishing.
+// CPresencePublishingImp::UnsubscribeOwnPresenceL()
+// ---------------------------------------------------------------------------
+//
+TXIMPRequestId CPresencePublishingImp::UnsubscribeOwnPresenceL()
+    {
+    return iContext.QueueOperationL( NPresenceOps::EPrUnsubscribeOwnPresence, 
+                                      KNullDesC8 );
+    }
+
+// ---------------------------------------------------------------------------
+// From class MPresencePublishing.
+// CPresencePublishingImp::PublishOwnPresenceL()
+// ---------------------------------------------------------------------------
+//
+TXIMPRequestId CPresencePublishingImp::PublishOwnPresenceL(
+    const MPresenceInfo& aPresence )
+    {
+    HBufC8* docPack = PackPresenceDocLC( aPresence );
+
+    TXIMPRequestId reqId =
+        iContext.QueueOperationL( NPresenceOps::EPrPublishOwnPresence,
+                                   *docPack );
+    CleanupStack::PopAndDestroy( docPack );
+
+    return reqId;
+    }
+
+
+
+// ---------------------------------------------------------------------------
+// From class MPresencePublishing.
+// CPresencePublishingImp::SubscribePresenceWatcherListL()
+// ---------------------------------------------------------------------------
+//
+TXIMPRequestId CPresencePublishingImp::SubscribePresenceWatcherListL()
+    {
+    return iContext.QueueOperationL(
+                           NPresenceOps::EPrSubscribePresenceWatcherList,
+                           KNullDesC8 );    
+    }
+
+// ---------------------------------------------------------------------------
+// From class MPresencePublishing.
+// CPresencePublishingImp::UnsubscribePresenceWatcherListL()
+// ---------------------------------------------------------------------------
+//
+TXIMPRequestId CPresencePublishingImp::UnsubscribePresenceWatcherListL()
+    {
+    return iContext.QueueOperationL(
+                           NPresenceOps::EPrUnsubscribePresenceWatcherList,
+                           KNullDesC8 );    
+    }
+
+
+// ---------------------------------------------------------------------------
+// CPresencePublishingImp::PackPresenceDocLC()
+// ---------------------------------------------------------------------------
+//
+HBufC8* CPresencePublishingImp::PackPresenceDocLC(
+    const MPresenceInfo& aPresence )
+    {
+    const CPresenceInfoImp* docImp = 
+    TXIMPGetImpClassOrPanic< const CPresenceInfoImp >::From( aPresence );
+    
+    HBufC8* pack = TXIMPObjectPacker< const CPresenceInfoImp >::PackL( *docImp );
+    CleanupStack::PushL( pack );
+
+    return pack;
+    }
+
+// ---------------------------------------------------------------------------
+// CPresencePublishingImp::PackPresenceDocLC()
+// ---------------------------------------------------------------------------
+//
+HBufC8* CPresencePublishingImp::PackPresenceInfoFilterLC(
+    const MPresenceInfoFilter& aPif )
+    {
+    const CPresenceInfoFilterImp* pifImp = 
+    TXIMPGetImpClassOrPanic< const CPresenceInfoFilterImp >::From( aPif );    
+    
+    HBufC8* pack = TXIMPObjectPacker< CPresenceInfoFilterImp>::PackL( *pifImp );
+    CleanupStack::PushL( pack );
+
+    return pack;
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresencefrontend/srcpresencemanager/presencepublishingimp.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,88 @@
+/*
+* 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:  Implementation of MPresencePublishing
+*
+*/
+
+#ifndef CPRESENCEPUBLISHINGIMP_H
+#define CPRESENCEPUBLISHINGIMP_H
+
+#include <presencepublishing.h>
+#include "ximpapiobjbase.h"
+#include "presenceapiobjbase.h"
+
+class MXIMPContextInternal;
+
+
+/**
+ * MPresencePublishing API object implementation.
+ *
+ * @lib ximpmanager.dll
+ * @since S60 v3.2
+ */
+NONSHARABLE_CLASS( CPresencePublishingImp ): public CXIMPApiObjBase,
+                                             public MPresencePublishing
+    {
+    public:
+    /** The class ID. */
+    enum { KClassId = PRIMP_CLSID_CPRESENCEPUBLISHINGIMP };
+
+
+public:
+    static CPresencePublishingImp* NewL( MXIMPContextInternal& aContext );
+    ~CPresencePublishingImp();
+    
+    
+public:
+    CPresencePublishingImp( MXIMPContextInternal& aContext);
+
+
+public: // From MXIMPBase
+
+    /**
+     * Implementation of MXIMPBase interface methods
+     * @see MXIMPBase
+     */
+    XIMPIMP_DECLARE_IF_BASE_METHODS
+
+
+public: //From MPresencePublishing
+
+    TXIMPRequestId SubscribeOwnPresenceL( const MPresenceInfoFilter& aPif );
+    TXIMPRequestId UnsubscribeOwnPresenceL();
+    TXIMPRequestId PublishOwnPresenceL( const MPresenceInfo& aPresence );
+    TXIMPRequestId SubscribePresenceWatcherListL();
+    TXIMPRequestId UnsubscribePresenceWatcherListL();
+    TXIMPRequestId SubscribePresenceGrantRequestListL();
+    TXIMPRequestId UnsubscribePresenceGrantRequestListL();
+
+
+public: //Helpers
+
+    HBufC8* PackPresenceDocLC( const MPresenceInfo& aPresence );
+    HBufC8* PackPresenceInfoFilterLC( const MPresenceInfoFilter& aPif );
+
+
+private: // data
+
+    /**
+     * Context session proxy for accessing context server.
+     * Ref.
+     */
+    MXIMPContextInternal& iContext;
+
+    };
+
+
+#endif // CPRESENCEPUBLISHINGIMP_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresencefrontend/srcpresencemanager/presencewatchingimp.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,221 @@
+/*
+* 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:  Implementation of MPresenceWatching
+ *
+*/
+
+#include "presencewatchingimp.h"
+#include "presenceinfofilterimp.h"
+#include "ximpobjecthelpers.h"
+#include "presenceoperationdefs.h"
+#include "ximpidentityimp.h"
+#include "ximpcontextinternal.h"
+
+
+// ============================ MEMBER FUNCTIONS =============================
+
+// ---------------------------------------------------------------------------
+// CPresenceWatchingImp::NewL()
+// ---------------------------------------------------------------------------
+//
+CPresenceWatchingImp* CPresenceWatchingImp::NewL(
+    MXIMPContextInternal& aContext )
+    {
+    CPresenceWatchingImp* self =
+        new( ELeave ) CPresenceWatchingImp( aContext );
+
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// Implement supported interface access.
+// ---------------------------------------------------------------------------
+//
+XIMPIMP_IF_BASE_GET_INTERFACE_BEGIN( CPresenceWatchingImp, 
+                                     MPresenceWatching )
+XIMPIMP_IF_BASE_GET_INTERFACE_END()
+
+
+XIMPIMP_IF_BASE_GET_CONST_INTERFACE_BEGIN( CPresenceWatchingImp, 
+                                           MPresenceWatching )
+XIMPIMP_IF_BASE_GET_INTERFACE_END()
+
+
+// ---------------------------------------------------------------------------
+// CPresenceWatchingImp::~CPresenceWatchingImp()
+// ---------------------------------------------------------------------------
+//
+CPresenceWatchingImp::~CPresenceWatchingImp()
+    {
+    //iContext not own
+    }
+
+
+// ---------------------------------------------------------------------------
+// CPresenceWatchingImp::CPresenceWatchingImp()
+// ---------------------------------------------------------------------------
+//
+CPresenceWatchingImp::CPresenceWatchingImp(
+    MXIMPContextInternal& aContext )
+    : iContext( aContext )
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// CPresenceWatchingImp::SubscribePresentityPresenceL()
+// ---------------------------------------------------------------------------
+//
+TXIMPRequestId CPresenceWatchingImp::SubscribePresentityPresenceL( 
+        const MXIMPIdentity& aPresentityId,
+        const MPresenceInfoFilter& aPif )
+    {
+    RXIMPObjOwningPtrArray< HBufC8 > packArray;
+    CleanupClosePushL( packArray );
+
+    // Pack the identity
+    HBufC8* idPack = PackPresentityLC( aPresentityId );
+    packArray.Append( idPack );
+    CleanupStack::Pop( idPack );
+
+    // pack the filter
+    HBufC8* filterPack = PackFilterLC( aPif );
+    packArray.Append( filterPack );
+    CleanupStack::Pop( filterPack );
+
+    // pack the array to a string
+    HBufC8* packedBuf = TXIMPHBuf8Packer::PackArrayL( packArray );
+    CleanupStack::PushL( packedBuf );
+
+    // Queue the operation
+    TXIMPRequestId reqId =
+        iContext.QueueOperationL( NPresenceOps::EPrSubscribePresentityPresence,
+                                   *packedBuf );
+
+    CleanupStack::PopAndDestroy( packedBuf );
+    CleanupStack::PopAndDestroy(); // packArray
+
+    return reqId;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CPresenceWatchingImp::UnsubscribePresentityPresenceL()
+// ---------------------------------------------------------------------------
+//
+TXIMPRequestId CPresenceWatchingImp::UnsubscribePresentityPresenceL( 
+    const MXIMPIdentity& aPresentityId )
+    {
+    // Pack the identity
+    HBufC8* idPack = PackPresentityLC( aPresentityId );
+    // Queue the operation
+    TXIMPRequestId reqId =
+        iContext.QueueOperationL( NPresenceOps::EPrUnsubscribePresentityPresence,
+                                   *idPack );
+    CleanupStack::PopAndDestroy( idPack );
+    return reqId;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CPresenceWatchingImp::SubscribePresentityGroupMembersPresenceL()
+// ---------------------------------------------------------------------------
+//
+TXIMPRequestId CPresenceWatchingImp::SubscribePresentityGroupMembersPresenceL(
+    const MXIMPIdentity& aGroupId,
+    const MPresenceInfoFilter& aPif )
+    {
+    RXIMPObjOwningPtrArray< HBufC8 > packArray;
+    CleanupClosePushL( packArray );
+
+    // Pack the identity
+    HBufC8* idPack = PackPresentityLC( aGroupId );
+    packArray.Append( idPack );
+    CleanupStack::Pop( idPack );
+
+    // pack the filter
+    HBufC8* filterPack = PackFilterLC( aPif );
+    packArray.Append( filterPack );
+    CleanupStack::Pop( filterPack );
+
+    // pack the array to a string
+    HBufC8* packedBuf = TXIMPHBuf8Packer::PackArrayL( packArray );
+    CleanupStack::PushL( packedBuf );
+
+    // Queue the operation
+    TXIMPRequestId reqId =
+        iContext.QueueOperationL( NPresenceOps::EPrSubscribePresentityGroupMembersPresence,
+                                   *packedBuf );
+
+    CleanupStack::PopAndDestroy( packedBuf );
+    CleanupStack::PopAndDestroy(); // packArray
+
+    return reqId;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CPresenceWatchingImp::UnsubscribePresentityGroupMembersPresenceL()
+// ---------------------------------------------------------------------------
+//
+TXIMPRequestId CPresenceWatchingImp::UnsubscribePresentityGroupMembersPresenceL(
+    const MXIMPIdentity& aGroupId )
+    {
+    // Pack the identity
+    HBufC8* idPack = PackPresentityLC( aGroupId );
+    // Queue the operation
+    TXIMPRequestId reqId =
+        iContext.QueueOperationL(
+                        NPresenceOps::EPrUnsubscribePresentityGroupMembersPresence,
+                        *idPack );
+    CleanupStack::PopAndDestroy( idPack );
+    return reqId;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CPresenceWatchingImp::PackPresentityLC()
+// ---------------------------------------------------------------------------
+//
+HBufC8* CPresenceWatchingImp::PackPresentityLC( 
+    const MXIMPIdentity& aIdentity )
+    {
+    const CXIMPIdentityImp* identityImp =
+        TXIMPGetImpClassOrPanic< const CXIMPIdentityImp >::From( aIdentity );
+    
+    HBufC8* pack = TXIMPObjectPacker< const CXIMPIdentityImp >::PackL( *identityImp );
+    CleanupStack::PushL( pack );
+
+    return pack;
+    }
+
+// ---------------------------------------------------------------------------
+// CPresenceWatchingImp::PackFilterLC()
+// ---------------------------------------------------------------------------
+//
+HBufC8* CPresenceWatchingImp::PackFilterLC( 
+    const MPresenceInfoFilter& aFilter )
+    {
+    const CPresenceInfoFilterImp* filterImp =
+        TXIMPGetImpClassOrPanic< const CPresenceInfoFilterImp >::From( aFilter );
+    
+    HBufC8* pack = TXIMPObjectPacker< const CPresenceInfoFilterImp >::PackL( *filterImp );
+    CleanupStack::PushL( pack );
+
+    return pack;
+    }
+
+
+// End of file
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresencefrontend/srcpresencemanager/presencewatchingimp.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,88 @@
+/*
+* 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:  Implementation of MPresenceWatching
+*
+*/
+
+#ifndef CPRESENCEWATCHINGIMP_H
+#define CPRESENCEWATCHINGIMP_H
+
+#include <presencewatching.h>
+#include "ximpapiobjbase.h"
+#include "presenceapiobjbase.h"
+
+class MXIMPContextInternal;
+class MXIMPIdentity;
+class MPresenceInfoFilter;
+
+/**
+ * MPresencePublishing API object implementation.
+ *
+ * @lib ximpmanager.dll
+ * @since S60 v3.2
+ */
+NONSHARABLE_CLASS( CPresenceWatchingImp ): public CXIMPApiObjBase,
+                                               public MPresenceWatching
+    {
+    public:
+    /** The class ID. */
+    enum { KClassId = PRIMP_CLSID_CPRESENCEWATCHINGIMP };
+
+
+public:
+    static CPresenceWatchingImp* NewL( MXIMPContextInternal& aContext );
+    ~CPresenceWatchingImp();
+
+
+public:
+    CPresenceWatchingImp( MXIMPContextInternal& aContext );
+
+
+public: // From MXIMPBase
+
+    /**
+     * Implementation of MXIMPBase interface methods
+     * @see MXIMPBase
+     */
+    XIMPIMP_DECLARE_IF_BASE_METHODS
+
+
+public: //From MPresenceWatching
+
+    TXIMPRequestId SubscribePresentityPresenceL( const MXIMPIdentity& aPresentityId,
+                                                 const MPresenceInfoFilter& aPif );
+    TXIMPRequestId UnsubscribePresentityPresenceL( const MXIMPIdentity& aPresentityId );
+    TXIMPRequestId SubscribePresentityGroupMembersPresenceL( const MXIMPIdentity& aGroupId,
+                                                             const MPresenceInfoFilter& aPif );
+    TXIMPRequestId UnsubscribePresentityGroupMembersPresenceL( const MXIMPIdentity& aGroupId );
+
+
+private: //Helpers
+
+    HBufC8* PackPresentityLC( const MXIMPIdentity& aIdentity );
+
+    HBufC8* PackFilterLC( const MPresenceInfoFilter& aFilter );
+
+private: // data
+
+    /**
+     * Context session proxy for accessing context server.
+     * Ref.
+     */
+    MXIMPContextInternal& iContext;
+
+    };
+
+
+#endif // CPRESENCEWATCHINGIMP_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresencefrontend/srcpresencemanager/presentitygroupsimp.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,339 @@
+/*
+* 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:  Implementation of MPresenceManagement
+ *
+*/
+
+#include "presentitygroupsimp.h"
+#include "presenceinfoimp.h"
+#include "presenceinfofilterimp.h"
+#include "ximpobjecthelpers.h"
+#include "presentitygroupinfoimp.h"
+#include "presentitygroupmemberinfoimp.h"
+#include "ximpidentityimp.h"
+#include "ximpcontextinternal.h"
+
+
+// ============================ MEMBER FUNCTIONS =============================
+
+// ---------------------------------------------------------------------------
+// CPresentityGroupsImp::NewL()
+// ---------------------------------------------------------------------------
+//
+CPresentityGroupsImp* CPresentityGroupsImp::NewL( 
+    MXIMPContextInternal& aContext )
+    {
+    CPresentityGroupsImp* self = 
+        new( ELeave ) CPresentityGroupsImp( aContext );
+
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// Implement supported interface access.
+// ---------------------------------------------------------------------------
+//
+XIMPIMP_IF_BASE_GET_INTERFACE_BEGIN( CPresentityGroupsImp, 
+                                     MPresentityGroups )
+XIMPIMP_IF_BASE_GET_INTERFACE_END()
+
+XIMPIMP_IF_BASE_GET_CONST_INTERFACE_BEGIN( CPresentityGroupsImp, 
+                                           MPresentityGroups )
+XIMPIMP_IF_BASE_GET_INTERFACE_END()
+
+// ---------------------------------------------------------------------------
+// CPresentityGroupsImp::~CPresentityGroupsImp()
+// ---------------------------------------------------------------------------
+//
+CPresentityGroupsImp::~CPresentityGroupsImp()
+    {
+    //iContext not own
+    }
+
+
+// ---------------------------------------------------------------------------
+// CPresentityGroupsImp::CPresentityGroupsImp()
+// ---------------------------------------------------------------------------
+//
+CPresentityGroupsImp::CPresentityGroupsImp(
+    MXIMPContextInternal& aContext )
+    : iContext( aContext )
+    {
+    }
+    
+// ---------------------------------------------------------------------------
+// CPresentityGroupsImp::SubscribeOwnPresenceL()
+// ---------------------------------------------------------------------------
+//
+TXIMPRequestId CPresentityGroupsImp::SubscribePresentityGroupListL()
+    {
+    return iContext.QueueOperationL( NPresenceOps::EPrSubscribeGroupList,
+                                      KNullDesC8 );
+    }
+
+// ---------------------------------------------------------------------------
+// CPresentityGroupsImp::SubscribeOwnPresenceL()
+// ---------------------------------------------------------------------------
+//
+TXIMPRequestId CPresentityGroupsImp::UnsubscribePresentityGroupListL()
+    {
+    return iContext.QueueOperationL( NPresenceOps::EPrUnsubscribeGroupList,
+                                      KNullDesC8 );    
+    }
+
+// ---------------------------------------------------------------------------
+// CPresentityGroupsImp::SubscribeOwnPresenceL()
+// ---------------------------------------------------------------------------
+//
+TXIMPRequestId CPresentityGroupsImp::CreatePresentityGroupL( const MXIMPIdentity& aGroupId,
+                                                                 const TDesC16& aGroupDisplayName )
+    {
+    return QueueOperationL( NPresenceOps::EPrCreatePresentityGroup, aGroupId, aGroupDisplayName );
+    }
+                                               
+// ---------------------------------------------------------------------------
+// CPresentityGroupsImp::DeletePresentityGroupL()
+// ---------------------------------------------------------------------------
+//
+TXIMPRequestId CPresentityGroupsImp::DeletePresentityGroupL( const MXIMPIdentity& aGroupId )
+    {
+    return QueueOperationL( NPresenceOps::EPrDeletePresentityGroup, aGroupId, KNullDesC );
+    }
+
+// ---------------------------------------------------------------------------
+// CPresentityGroupsImp::UpdatePresentityGroupDisplayNameL()
+// ---------------------------------------------------------------------------
+//
+TXIMPRequestId CPresentityGroupsImp::UpdatePresentityGroupDisplayNameL( const MXIMPIdentity& aGroupId,
+                                                                            const TDesC16& aGroupDisplayName )
+    {
+    return QueueOperationL( NPresenceOps::EPrUpdatePresentityGroupDisplayName, aGroupId, aGroupDisplayName );
+    }
+
+
+// ---------------------------------------------------------------------------
+// From MPresentityGroups class.
+// CPresentityGroupsImp::SubscribePresentityGroupContentL
+// ---------------------------------------------------------------------------
+//
+TXIMPRequestId CPresentityGroupsImp::SubscribePresentityGroupContentL(
+                                                const MXIMPIdentity& aGroupId )
+    {
+    HBufC8* idPack = PackIdentityLC( aGroupId );
+
+    TXIMPRequestId reqId =
+        iContext.QueueOperationL( NPresenceOps::EPrSubscribePresentityGroupContent,
+                                   *idPack );
+    CleanupStack::PopAndDestroy( idPack );
+    return reqId;    
+    }
+// ---------------------------------------------------------------------------
+// From MPresentityGroups class.
+// CPresentityGroupsImp::UnsubscribePresentityGroupContentL
+// ---------------------------------------------------------------------------
+//
+TXIMPRequestId CPresentityGroupsImp::UnsubscribePresentityGroupContentL(
+                                                const MXIMPIdentity& aGroupId )
+    {
+    HBufC8* idPack = PackIdentityLC( aGroupId );
+
+    TXIMPRequestId reqId =
+        iContext.QueueOperationL( NPresenceOps::EPrUnsubscribePresentityGroupContent,
+                                   *idPack );
+    CleanupStack::PopAndDestroy( idPack );
+    return reqId;    
+    }
+    
+// ---------------------------------------------------------------------------
+// From MPresentityGroups class.
+// CPresentityGroupsImp::AddPresentityGroupMemberL
+// ---------------------------------------------------------------------------
+//
+TXIMPRequestId CPresentityGroupsImp::AddPresentityGroupMemberL(
+                                            const MXIMPIdentity& aGroupId,
+                                            const MXIMPIdentity& aMemberId,
+                                            const TDesC16& aMemberDisplayName )
+    {
+    return QueueOperationL( NPresenceOps::EPrAddPresentityGroupMember,
+                            aGroupId,
+                            aMemberId,
+                            aMemberDisplayName );
+    }
+    
+// ---------------------------------------------------------------------------
+// From MPresentityGroups class.
+// CPresentityGroupsImp::RemovePresentityGroupMemberL
+// ---------------------------------------------------------------------------
+//
+TXIMPRequestId CPresentityGroupsImp::RemovePresentityGroupMemberL(
+                                            const MXIMPIdentity& aGroupId,
+                                            const MXIMPIdentity& aMemberId )
+    {
+    return QueueOperationL( NPresenceOps::EPrRemovePresentityGroupMember,
+                            aGroupId,
+                            aMemberId );
+    }
+    
+// ---------------------------------------------------------------------------
+// From MPresentityGroups class.
+// CPresentityGroupsImp::UpdatePresentityGroupMemberDisplayNameL
+// ---------------------------------------------------------------------------
+//
+TXIMPRequestId CPresentityGroupsImp::UpdatePresentityGroupMemberDisplayNameL(
+                                                    const MXIMPIdentity& aGroupId,
+                                                    const MXIMPIdentity& aMemberId,
+                                                    const TDesC16& aMemberDisplayName )
+    {
+    return QueueOperationL( NPresenceOps::EPrUpdatePresentityGroupMemberDisplayName,
+                            aGroupId,
+                            aMemberId,
+                            aMemberDisplayName );
+    }
+
+// ---------------------------------------------------------------------------
+// CPresentityGroupsImp::QueueOperationL()
+// ---------------------------------------------------------------------------
+//
+TXIMPRequestId CPresentityGroupsImp::QueueOperationL( NPresenceOps::TPresenceOpTypes aOperation,
+                                                          const MXIMPIdentity& aGroupId,
+                                                          const TDesC16& aGroupDisplayName )
+    {
+    CPresentityGroupInfoImp* groupInfo = 
+                    CPresentityGroupInfoImp::NewLC( aGroupId, aGroupDisplayName );    
+    HBufC8* infoPack = PackGroupInfoLC( *groupInfo );
+
+    TXIMPRequestId reqId =
+        iContext.QueueOperationL( aOperation, *infoPack );
+    CleanupStack::PopAndDestroy( 2, groupInfo );
+
+    return reqId;
+    }
+
+// ---------------------------------------------------------------------------
+// CPresentityGroupsImp::QueueOperationL()
+// ---------------------------------------------------------------------------
+//
+TXIMPRequestId CPresentityGroupsImp::QueueOperationL( NPresenceOps::TPresenceOpTypes aOperation,
+                                                          const MXIMPIdentity& aGroupId,
+                                                          const MXIMPIdentity& aMemberId,
+                                                          const TDesC16& aMemberDisplayName )
+    {
+    CBufFlat* buffer = CBufFlat::NewL( 10 ); // set granularity to 10
+    CleanupStack::PushL( buffer );
+    
+    RBufWriteStream ws;
+    CleanupClosePushL( ws );
+    ws.Open( *buffer ); // CSI: 65 # Does not return a value
+
+    // group id
+    const CXIMPIdentityImp* identityImp =
+    TXIMPGetImpClassOrPanic< const CXIMPIdentityImp >::From( aGroupId );
+    identityImp->ExternalizeL( ws );
+    
+    
+    // member id
+    identityImp =
+        TXIMPGetImpClassOrPanic< const CXIMPIdentityImp >::From( aMemberId );
+    identityImp->ExternalizeL( ws );
+    
+    
+    // member display name
+    ws.WriteInt32L( aMemberDisplayName.Length() );
+    ws.WriteL( aMemberDisplayName );
+    
+    ws.CommitL();
+    CleanupStack::PopAndDestroy();  //ws
+
+    HBufC8* packedBuf = buffer->Ptr( 0 ).AllocL();
+    CleanupStack::PopAndDestroy( buffer );
+    CleanupStack::PushL( packedBuf );
+    
+    // Queue the operation
+    TXIMPRequestId reqId =
+        iContext.QueueOperationL( aOperation, *packedBuf );
+    CleanupStack::PopAndDestroy( packedBuf );
+
+    return reqId;
+    }
+
+// ---------------------------------------------------------------------------
+// CPresentityGroupsImp::QueueOperationL()
+// ---------------------------------------------------------------------------
+//
+TXIMPRequestId CPresentityGroupsImp::QueueOperationL( NPresenceOps::TPresenceOpTypes aOperation,
+                                                          const MXIMPIdentity& aGroupId,
+                                                          const MXIMPIdentity& aMemberId )
+    {
+    CBufFlat* buffer = CBufFlat::NewL( 10 ); // set granularity to 10
+    CleanupStack::PushL( buffer );
+    
+    RBufWriteStream ws;
+    CleanupClosePushL( ws );
+    ws.Open( *buffer ); // CSI: 65 # Does not return a value
+
+    // group id
+    const CXIMPIdentityImp* identityImp =
+        TXIMPGetImpClassOrPanic< const CXIMPIdentityImp >::From( aGroupId );
+    identityImp->ExternalizeL( ws );
+
+
+    // member id
+    identityImp =
+        TXIMPGetImpClassOrPanic< const CXIMPIdentityImp >::From( aMemberId );    
+    identityImp->ExternalizeL( ws );
+
+    ws.CommitL();
+    CleanupStack::PopAndDestroy();  //ws
+
+    HBufC8* packedBuf = buffer->Ptr( 0 ).AllocL();
+    CleanupStack::PopAndDestroy( buffer );
+    CleanupStack::PushL( packedBuf );
+
+    // Queue the operation
+    TXIMPRequestId reqId =
+        iContext.QueueOperationL( aOperation, *packedBuf );
+    CleanupStack::PopAndDestroy( packedBuf );
+
+    return reqId;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CPresentityGroupsImp::PackGroupInfoLC()
+// ---------------------------------------------------------------------------
+//
+HBufC8* CPresentityGroupsImp::PackGroupInfoLC( const CPresentityGroupInfoImp& infoImp )
+    {
+    HBufC8* pack = TXIMPObjectPacker< const CPresentityGroupInfoImp >::PackL( infoImp );
+    CleanupStack::PushL( pack );
+    return pack;
+    }
+
+// ---------------------------------------------------------------------------
+// CPresentityGroupsImp::PackIdentityLC()
+// ---------------------------------------------------------------------------
+//
+HBufC8* CPresentityGroupsImp::PackIdentityLC( const MXIMPIdentity& aIdentity )
+    {
+    const CXIMPIdentityImp* identityImp =
+        TXIMPGetImpClassOrPanic< const CXIMPIdentityImp >::From( aIdentity );    
+
+    HBufC8* pack = TXIMPObjectPacker< const CXIMPIdentityImp >::PackL( *identityImp );
+    CleanupStack::PushL( pack );
+
+    return pack;
+    }
+
+// End of file
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresencefrontend/srcpresencemanager/presentitygroupsimp.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,108 @@
+/*
+* 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:  Implementation of MPresencePublishing
+*
+*/
+
+#ifndef CPRESENTITYGROUPSIMP_H
+#define CPRESENTITYGROUPSIMP_H
+
+#include <presentitygroups.h>
+#include "ximpapiobjbase.h"
+#include "presenceapiobjbase.h"
+#include "presenceoperationdefs.h"
+
+class MXIMPContextInternal;
+class CPresentityGroupInfoImp;
+
+/**
+ * MPresencePublishing API object implementation.
+ *
+ * @lib ximpmanager.dll
+ * @since S60 v3.2
+ */
+NONSHARABLE_CLASS( CPresentityGroupsImp ): public CXIMPApiObjBase,
+                                           public MPresentityGroups
+    {
+    public:
+    /** The class ID. */
+    enum { KClassId = PRIMP_CLSID_CPRESENTITYGROUPSIMP };
+
+
+public:
+    static CPresentityGroupsImp* NewL( MXIMPContextInternal& aContext );
+    ~CPresentityGroupsImp();
+    
+    
+public:
+    CPresentityGroupsImp( MXIMPContextInternal& aContext );
+
+
+public: // From MXIMPBase
+
+    /**
+     * Implementation of MXIMPBase interface methods
+     * @see MXIMPBase
+     */
+    XIMPIMP_DECLARE_IF_BASE_METHODS
+
+
+public: //From MPresentityGroups
+
+    TXIMPRequestId SubscribePresentityGroupListL();
+    TXIMPRequestId UnsubscribePresentityGroupListL();
+    TXIMPRequestId CreatePresentityGroupL( const MXIMPIdentity& aGroupId,
+                                                   const TDesC16& aGroupDisplayName );
+    TXIMPRequestId DeletePresentityGroupL( const MXIMPIdentity& aGroupId );
+    TXIMPRequestId UpdatePresentityGroupDisplayNameL( const MXIMPIdentity& aGroupId,
+                                                      const TDesC16& aGroupDisplayName );
+                                                      
+    TXIMPRequestId SubscribePresentityGroupContentL( const MXIMPIdentity& aGroupId );
+    TXIMPRequestId UnsubscribePresentityGroupContentL( const MXIMPIdentity& aGroupId );
+    TXIMPRequestId AddPresentityGroupMemberL( const MXIMPIdentity& aGroupId,
+                                              const MXIMPIdentity& aMemberId,
+                                              const TDesC16& aMemberDisplayName );
+    TXIMPRequestId RemovePresentityGroupMemberL( const MXIMPIdentity& aGroupId,
+                                                 const MXIMPIdentity& aMemberId );
+    TXIMPRequestId UpdatePresentityGroupMemberDisplayNameL( const MXIMPIdentity& aGroupId,
+                                                            const MXIMPIdentity& aMemberId,
+                                                            const TDesC16& aMemberDisplayName );
+                                                          
+public: //Helpers
+
+    HBufC8* PackGroupInfoLC( const CPresentityGroupInfoImp& infoImp );
+    HBufC8* PackIdentityLC( const MXIMPIdentity& aIdentity );
+    TXIMPRequestId QueueOperationL( NPresenceOps::TPresenceOpTypes aOperation,
+                                    const MXIMPIdentity& aGroupId,
+                                    const TDesC16& aGroupDisplayName );
+    TXIMPRequestId QueueOperationL( NPresenceOps::TPresenceOpTypes aOperation,
+                                    const MXIMPIdentity& aGroupId,
+                                    const MXIMPIdentity& aMemberId,
+                                    const TDesC16& aMemberDisplayName );
+    TXIMPRequestId QueueOperationL( NPresenceOps::TPresenceOpTypes aOperation,
+                                    const MXIMPIdentity& aGroupId,
+                                    const MXIMPIdentity& aMemberId );
+
+private: // data
+
+    /**
+     * Context session proxy for accessing context server.
+     * Ref.
+     */
+    MXIMPContextInternal& iContext;
+
+    };
+
+
+#endif // CPRESENTITYGROUPSIMP_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresenceoperations/operationlaunchcleaner.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,100 @@
+/*
+* 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:  Internal operation for launching cleaner
+ *
+*/
+
+
+#include "operationlaunchcleaner.h"
+#include "protocolpresencedatahostimp.h"
+#include "presencedatacacheimp.h"
+#include "ximphost.h"
+
+#include "ximptrace.h"
+
+// ============================ MEMBER FUNCTIONS =============================
+
+// ---------------------------------------------------------------------------
+// COperationLaunchCleaner::COperationLaunchCleaner()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C COperationLaunchCleaner::COperationLaunchCleaner()
+    {
+    }
+
+
+
+// ---------------------------------------------------------------------------
+// COperationLaunchCleaner::~COperationLaunchCleaner()
+// ---------------------------------------------------------------------------
+//
+COperationLaunchCleaner::~COperationLaunchCleaner()
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// COperationLaunchCleaner::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void COperationLaunchCleaner::ConstructL( const TDesC8& /*aParamPck*/ )
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// COperationLaunchCleaner::ProcessL()
+// ---------------------------------------------------------------------------
+//
+void COperationLaunchCleaner::ProcessL()
+    {
+    TRACE(_L("COperationLaunchCleaner::ProcessL()" ) );
+    CXIMPOperationBase::ProcessL();
+
+    iMyHost->PresenceDataAccess().PresenceDataCache().CleanExpired();
+
+    iMyHost->HandleInternalRequestCompleted( iReqId, KErrNone );
+    }
+
+// ---------------------------------------------------------------------------
+// COperationLaunchCleaner::RequestCompleted()
+// ---------------------------------------------------------------------------
+//
+void COperationLaunchCleaner::RequestCompletedL()
+    {
+    TRACE(_L("COperationLaunchCleaner::RequestCompletedL()" ) );
+    CXIMPOperationBase::RequestCompletedL();
+    }
+
+
+// ---------------------------------------------------------------------------
+// COperationLaunchCleaner::Type()
+// ---------------------------------------------------------------------------
+//
+TInt
+    COperationLaunchCleaner::Type() const
+    {
+    return NPresenceOps::EXIMPCleaner;
+    }
+
+// ---------------------------------------------------------------------------
+// COperationLaunchCleaner::EndOperation()
+// ---------------------------------------------------------------------------
+//
+void COperationLaunchCleaner::EndOperation()
+    {
+    CXIMPOperationBase::EndOperation();
+    iMyHost->StartCleanerTimer();
+    }
+
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresenceoperations/operationlaunchcleaner.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,59 @@
+/*
+* 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:  Internal operation for launching cleaner
+ *
+*/
+
+#ifndef CPSCOPERATIONLAUNCHCLEANER_H
+#define CPSCOPERATIONLAUNCHCLEANER_H
+
+
+#include <e32base.h>
+#include <ximpbase.h>
+#include "ximpoperationbase.h"
+#include "presenceoperationdefs.h"
+
+
+/**
+ * Internal synthesise own subscription event operation
+ *
+ * @lib ximpoperations.lib
+ * @since S60 v4.0
+ */
+class COperationLaunchCleaner : public CXIMPOperationBase
+    {
+    public:
+
+        IMPORT_C COperationLaunchCleaner();
+
+        void ConstructL( const TDesC8& aParamPck );
+
+        ~COperationLaunchCleaner();
+
+
+    public: // from CXIMPOperationBase
+
+        void ProcessL();
+
+        void RequestCompletedL();
+
+        TInt Type() const;
+        
+        void EndOperation();
+
+    private: // data
+    };
+
+
+#endif // CPSCOPERATIONLAUNCHCLEANER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresenceoperations/operationsetsubscriptiondata.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  Set subscription data
+ *
+*/
+
+
+#include "operationsetsubscriptiondata.h"
+#include "ximpsubscriptionitem.h"
+#include "ximphost.h"
+#include "ownpresencesubscriptionitem.h"
+#include "grouplistsubscriptionitem.h"
+#include "groupcontentsubscriptionitem.h"
+#include "presentitypresencesubscriptionitem.h"
+#include "presentitygroupmemberspresencesubscriptionitem.h"
+#include "watcherlistsubscriptionitem.h"
+#include "grantrequestlistsubscriptionitem.h"
+#include "blocklistsubscriptionitem.h"
+#include "ximpobjecthelpers.h"
+#include "ximppanics.h"
+#include "ximpidentityimp.h"
+#include "ximppsccontextimp.h"
+#include "ximprestrictedobjectcollectionimp.h"
+#include "ximpstatusimp.h"
+#include "ximpdatasubscriptionstateimp.h"
+#include "presencedatacacheimp.h"
+#include "protocolpresencedatahostimp.h"
+
+#include "ximptrace.h"
+
+// ============================ MEMBER FUNCTIONS =============================
+
+// ---------------------------------------------------------------------------
+// COperationSetSubscriptionData::COperationSetSubscriptionData()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C COperationSetSubscriptionData::COperationSetSubscriptionData(
+    NPresenceOps::TPresenceOpTypes aType )
+    :iType( aType )
+    {
+    }
+
+
+
+// ---------------------------------------------------------------------------
+// COperationSetSubscriptionData::~COperationSetSubscriptionData()
+// ---------------------------------------------------------------------------
+//
+COperationSetSubscriptionData::~COperationSetSubscriptionData()
+    {
+    delete iStatus;
+    delete iSubscriptionState;
+    delete iIdentity;
+    }
+
+// ---------------------------------------------------------------------------
+// COperationSetSubscriptionData::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void COperationSetSubscriptionData::ConstructL( const TDesC8& /*aParamPck*/ )
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// COperationSynthesiseSubscriptionEvent::ProcessL()
+// ---------------------------------------------------------------------------
+//
+void COperationSetSubscriptionData::ProcessL()
+    {
+    TRACE(_L("COperationSetSubscriptionData::ProcessL()" ) );
+    CXIMPOperationBase::ProcessL();
+
+    MXIMPBase* object = NULL;
+    iObjCollection->GetByType( object, MXIMPIdentity::KInterfaceId );
+    if( object )
+        {
+        iIdentity = TXIMPGetImpClassOrPanic< CXIMPIdentityImp >::From( *object );        
+        }
+
+    iObjCollection->GetByType( object, MXIMPDataSubscriptionState::KInterfaceId );
+    if( object )
+        {
+        iSubscriptionState = TXIMPGetImpClassOrPanic< CXIMPDataSubscriptionStateImp >::From( *object );        
+        }
+    else
+        {
+        User::Leave( KErrArgument );
+        }
+
+    iObjCollection->GetByType( object, MXIMPDataSubscriptionState::KInterfaceId );
+    if( object )
+        {
+        iSubscriptionState = TXIMPGetImpClassOrPanic< CXIMPDataSubscriptionStateImp >::From( *object );        
+        }
+    else
+        {
+        User::Leave( KErrArgument );
+        }
+
+    iObjCollection->GetByType( object, MXIMPStatus::KInterfaceId );
+    if( object )
+        {
+        iStatus = TXIMPGetImpClassOrPanic< CXIMPStatusImp >::From( *object );        
+        }
+    
+    MXIMPSubscriptionItem* subscriptionItem = NULL;
+    switch( iType )
+        {
+        case NPresenceOps::EPrSetOwnPresenceDataSubscriptionState:
+            {
+            subscriptionItem = &iMyHost->PresenceDataAccess().PresenceDataCache().OwnPresenceSubscriptionItemLC();
+            break;
+            }
+        case NPresenceOps::EPrSetPresenceBlockDataSubscriptionState:
+            {
+            subscriptionItem = &iMyHost->PresenceDataAccess().PresenceDataCache().BlockListSubscriptionItemLC();
+            break;
+            }
+        case NPresenceOps::EPrSetPresenceGrantRequestDataSubscriptionState:
+            {
+            subscriptionItem = &iMyHost->PresenceDataAccess().PresenceDataCache().GrantRequestListSubscriptionItemLC();
+            break;
+            }
+        case NPresenceOps::EPrSetPresenceWatcherListDataSubscriptionState:
+            {
+            subscriptionItem = &iMyHost->PresenceDataAccess().PresenceDataCache().WatcherListSubscriptionItemLC();
+            break;
+            }
+        case NPresenceOps::EPrSetPresentityGroupListDataSubscriptionState:
+            {
+            subscriptionItem = &iMyHost->PresenceDataAccess().PresenceDataCache().GroupListSubscriptionItemLC();
+            break;
+            }
+        case NPresenceOps::EPrSetPresentityGroupContentDataSubscriptionState:
+            {
+            if( !iIdentity )
+                {
+                User::Leave( KErrArgument );
+                }
+            subscriptionItem = &iMyHost->PresenceDataAccess().PresenceDataCache().GroupContentSubscriptionItemLC( *iIdentity );
+            break;
+            }
+        case NPresenceOps::EPrSetPresentityPresenceDataSubscriptionState:
+            {
+            if( !iIdentity )
+                {
+                User::Leave( KErrArgument );
+                }
+            subscriptionItem = &iMyHost->PresenceDataAccess().PresenceDataCache().PresentityPresenceSubscriptionItemLC( *iIdentity );
+            break;
+            }
+
+        XIMP_DEFAULT_CASE_UNSUPPORTED( NXIMPPrivPanic::EInvalidSubscriptionType );
+        }
+
+    subscriptionItem->SetDataSubscriptionStateL( *iSubscriptionState );
+    iSubscriptionState = NULL;
+
+    iMyHost->HandleAdaptationRequestCompleted( iReqId, KErrNone );
+    }
+
+// ---------------------------------------------------------------------------
+// COperationSetSubscriptionData::RequestCompleted()
+// ---------------------------------------------------------------------------
+//
+void COperationSetSubscriptionData::RequestCompletedL()
+    {
+    TRACE(_L("COperationSetSubscriptionData::RequestCompletedL()" ) );
+    CXIMPOperationBase::RequestCompletedL();
+    }
+
+
+// ---------------------------------------------------------------------------
+// COperationSetSubscriptionData::Type()
+// ---------------------------------------------------------------------------
+//
+TInt
+    COperationSetSubscriptionData::Type() const
+    {
+    return iType;
+    }
+
+
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresenceoperations/operationsetsubscriptiondata.h	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  Set subscription data
+ *
+*/
+
+#ifndef CPSCOPERATIONSETSUBSCRIPTIONDATA_H
+#define CPSCOPERATIONSETSUBSCRIPTIONDATA_H
+
+
+#include <e32base.h>
+#include <ximpbase.h>
+
+#include "ximpoperationbase.h"
+#include "presenceoperationdefs.h"
+
+class CXIMPIdentityImp;
+
+class CXIMPDataSubscriptionStateImp;
+
+/**
+ * Set subscription data for items
+ *
+ * @lib ximpoperations.lib
+ * @since S60 v4.0
+ */
+class COperationSetSubscriptionData : public CXIMPOperationBase
+    {
+    public: // Definitions
+
+    public:
+
+        IMPORT_C COperationSetSubscriptionData( NPresenceOps::TPresenceOpTypes aType );
+
+        void ConstructL( const TDesC8& aParamPck );
+
+        ~COperationSetSubscriptionData();
+
+    public: // from CXIMPOperationBase
+
+        void ProcessL();
+
+        void RequestCompletedL();
+
+        TInt Type() const;
+
+    private: // data
+
+    /**
+     * Identity for presentity presence synthetization.
+     */
+    CXIMPIdentityImp* iIdentity;
+    
+    /**
+     * Type of operation
+     */
+    NPresenceOps::TPresenceOpTypes iType;
+    
+    /**
+     * New subscription state
+     */
+    CXIMPDataSubscriptionStateImp* iSubscriptionState;
+    
+    /**
+     * Status reason for change.
+     */
+    CXIMPStatusImp* iStatus;
+
+    };
+
+
+#endif // CPSCOPERATIONSETSUBSCRIPTIONDATA_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresenceoperations/operationsynthesisesubscriptionevent.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,182 @@
+/*
+* 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:  Internal synthesise subscription event operation
+ *
+*/
+
+
+#include "operationsynthesisesubscriptionevent.h"
+#include "ownpresencesubscriptionitem.h"
+#include "grouplistsubscriptionitem.h"
+#include "groupcontentsubscriptionitem.h"
+#include "presentitypresencesubscriptionitem.h"
+#include "presentitygroupmemberspresencesubscriptionitem.h"
+#include "watcherlistsubscriptionitem.h"
+#include "grantrequestlistsubscriptionitem.h"
+#include "blocklistsubscriptionitem.h"
+#include "presencedatacacheimp.h"
+#include "protocolpresencedatahostimp.h"
+#include "ximpobjecthelpers.h"
+#include "ximpidentityimp.h"
+#include "ximphost.h"
+#include "ximppanics.h"
+#include "ximppsccontextimp.h"
+
+#include "ximptrace.h"
+// ============================ MEMBER FUNCTIONS =============================
+
+// ---------------------------------------------------------------------------
+// COperationSynthesiseSubscriptionEvent::COperationSynthesiseSubscriptionEvent()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C COperationSynthesiseSubscriptionEvent::COperationSynthesiseSubscriptionEvent(
+    COperationSynthesiseSubscriptionEvent::TSubscriptionType aType, TBool aForceEvent )
+    : iType( aType ), iForceEvent( aForceEvent )
+    {
+    }
+
+
+
+// ---------------------------------------------------------------------------
+// COperationSynthesiseSubscriptionEvent::~COperationSynthesiseSubscriptionEvent()
+// ---------------------------------------------------------------------------
+//
+COperationSynthesiseSubscriptionEvent::~COperationSynthesiseSubscriptionEvent()
+    {
+    delete iIdentity;
+    }
+
+// ---------------------------------------------------------------------------
+// COperationSynthesiseSubscriptionEvent::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void COperationSynthesiseSubscriptionEvent::ConstructL( const TDesC8& /*aParamPck*/ )
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// COperationSynthesiseSubscriptionEvent::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void COperationSynthesiseSubscriptionEvent::ConstructL( const CXIMPIdentityImp& aIdentity )
+    {
+    iIdentity = TXIMPObjectCloner< CXIMPIdentityImp >::CloneL( aIdentity );
+    }
+
+// ---------------------------------------------------------------------------
+// COperationSynthesiseSubscriptionEvent::ProcessL()
+// ---------------------------------------------------------------------------
+//
+void COperationSynthesiseSubscriptionEvent::ProcessL()
+    {
+    TRACE(_L("COperationSynthesiseSubscriptionEvent::ProcessL()" ) );
+    CXIMPOperationBase::ProcessL();
+
+    MXIMPSubscriptionItem* subscriptionItem = NULL;
+    switch( iType )
+        {
+        case EOwnPresence:
+            {
+            TRACE(_L("COperationSynthesiseSubscriptionEvent::ProcessL() : case EOwnPresence" ) );
+            subscriptionItem = &iMyHost->PresenceDataAccess().PresenceDataCache().OwnPresenceSubscriptionItemLC();
+            break;
+            }
+        case EPresenceBlockList:
+            {
+            TRACE(_L("COperationSynthesiseSubscriptionEvent::ProcessL() : case EPresenceBlockList" ) );
+            subscriptionItem = &iMyHost->PresenceDataAccess().PresenceDataCache().BlockListSubscriptionItemLC();
+            break;
+            }
+        case EPresenceGrantRequestList:
+            {
+            TRACE(_L("COperationSynthesiseSubscriptionEvent::ProcessL() : case EPresenceGrantRequestList" ) );
+            subscriptionItem = &iMyHost->PresenceDataAccess().PresenceDataCache().GrantRequestListSubscriptionItemLC();
+            break;
+            }
+        case EPresenceWatcherList:
+            {
+            TRACE(_L("COperationSynthesiseSubscriptionEvent::ProcessL() : case EPresenceWatcherList" ) );
+            subscriptionItem = &iMyHost->PresenceDataAccess().PresenceDataCache().WatcherListSubscriptionItemLC();
+            break;
+            }
+        case EPresentityGroupList:
+            {
+            TRACE(_L("COperationSynthesiseSubscriptionEvent::ProcessL() : case EPresentityGroupList" ) );
+            subscriptionItem = &iMyHost->PresenceDataAccess().PresenceDataCache().GroupListSubscriptionItemLC();
+            break;
+            }
+        case EPresentityGroupContent:
+            {
+            TRACE(_L("COperationSynthesiseSubscriptionEvent::ProcessL() : case EPresentityGroupContent" ) );
+            subscriptionItem = &iMyHost->PresenceDataAccess().PresenceDataCache().GroupContentSubscriptionItemLC( *iIdentity );
+            break;
+            }
+        case EPresentityPresence:
+            {
+            TRACE(_L("COperationSynthesiseSubscriptionEvent::ProcessL() : case EPresentityPresence" ) );
+            subscriptionItem = &iMyHost->PresenceDataAccess().PresenceDataCache().PresentityPresenceSubscriptionItemLC( *iIdentity );
+            break;
+            }
+        case EPresentityGroupMembersPresence:
+            {
+            TRACE(_L("COperationSynthesiseSubscriptionEvent::ProcessL() : case EPresentityGroupMembersPresence" ) );
+            subscriptionItem = &iMyHost->PresenceDataAccess().PresenceDataCache().PresentityGroupMembersPresenceSubscriptionItemLC( *iIdentity );
+            break;
+            }
+
+        
+        XIMP_DEFAULT_CASE_UNSUPPORTED( NXIMPPrivPanic::EInvalidSubscriptionType );
+        }
+
+    if( iContext )
+        {
+        TRACE(_L("COperationSynthesiseSubscriptionEvent::ProcessL() : subscriptionItem->ActivateSubscriberL( iContext )" ) );    
+        subscriptionItem->ActivateSubscriberL( iContext );
+        subscriptionItem->SynthesiseSubscriptionEventToL( iContext, iForceEvent );
+        }
+    else
+        {
+        TRACE(_L("COperationSynthesiseSubscriptionEvent::ProcessL() : subscriptionItem->SynthesiseSubscriptionEventToAllCtxsL" ) );    
+        subscriptionItem->SynthesiseSubscriptionEventToAllCtxsL();
+        }
+        
+    CleanupStack::PopAndDestroy(); // subscriptionItem
+    iMyHost->HandleInternalRequestCompleted( iReqId, KErrNone );
+    }
+
+// ---------------------------------------------------------------------------
+// COperationSynthesiseSubscriptionEvent::RequestCompleted()
+// ---------------------------------------------------------------------------
+//
+void COperationSynthesiseSubscriptionEvent::RequestCompletedL()
+    {
+    TRACE(_L("COperationSynthesiseSubscriptionEvent::RequestCompletedL()" ) );
+    CXIMPOperationBase::RequestCompletedL();
+    }
+
+
+// ---------------------------------------------------------------------------
+// COperationSynthesiseSubscriptionEvent::Type()
+// ---------------------------------------------------------------------------
+//
+TInt
+    COperationSynthesiseSubscriptionEvent::Type() const
+    {
+    return NPresenceOps::EPrSynthesisePresenceSubscription;
+    }
+
+
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresenceoperations/operationsynthesisesubscriptionevent.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,91 @@
+/*
+* 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:  Internal synthesise subscription event operation
+ *
+*/
+
+#ifndef CPSCOPERATIONSYNTHESISESUBSCRIPTIONEVENT_H
+#define CPSCOPERATIONSYNTHESISESUBSCRIPTIONEVENT_H
+
+
+#include <e32base.h>
+#include <ximpbase.h>
+
+#include "ximpoperationbase.h"
+#include "presenceoperationdefs.h"
+
+class CXIMPIdentityImp;
+
+/**
+ * Internal synthesise own subscription event operation
+ *
+ * @lib ximpoperations.lib
+ * @since S60 v4.0
+ */
+class COperationSynthesiseSubscriptionEvent : public CXIMPOperationBase
+    {
+    public: // Definitions
+
+        enum TSubscriptionType
+            {
+            EOwnPresence,
+            EPresenceBlockList,
+            EPresenceGrantRequestList,
+            EPresenceWatcherList,
+            EPresentityGroupList,
+            EPresentityGroupContent,
+            EPresentityPresence,
+            EPresentityGroupMembersPresence,
+            };
+
+    public:
+
+        IMPORT_C COperationSynthesiseSubscriptionEvent( TSubscriptionType aType,
+                                                           TBool aForceEvent );
+
+        void ConstructL( const CXIMPIdentityImp& aIdentity );
+        void ConstructL( const TDesC8& aParamPck );
+
+        ~COperationSynthesiseSubscriptionEvent();
+
+
+    public: // from CXIMPOperationBase
+
+        void ProcessL();
+
+        void RequestCompletedL();
+
+        TInt Type() const;
+
+    private: // data
+
+    /**
+     * Type of subscription to synthesise.
+     */
+    TSubscriptionType iType;
+
+    /**
+     * Identity for presentity presence synthetization.
+     */
+    CXIMPIdentityImp* iIdentity;
+
+    /**
+     * If event should be forced.
+     */
+    TBool iForceEvent;
+
+    };
+
+
+#endif // CPSCOPERATIONSYNTHESISESUBSCRIPTIONEVENT_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresenceoperations/presenceauthorization/operationblockpresenceforpresentity.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,150 @@
+/*
+* 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:  Block presence for presentity operation
+ *
+*/
+
+
+#include <ximpprotocolconnection.h>
+#include <protocolpresenceauthorization.h>
+#include <protocolpresencefeatures.h>
+
+#include "operationblockpresenceforpresentity.h"
+#include "presenceblockinfoimp.h"
+#include "ximpidentityimp.h"
+#include "protocolpresenceauthorizationdatahostimp.h"
+#include "ximpobjecthelpers.h"
+#include "ximprestrictedobjectcollectionimp.h"
+#include "ximphost.h"
+#include "ximpstatusimp.h"
+#include "protocolpresencedatahostimp.h"
+
+#include "ximptrace.h"
+
+// ============================ MEMBER FUNCTIONS =============================
+
+// ---------------------------------------------------------------------------
+// COperationBlockPresenceForPresentity::COperationBlockPresenceForPresentity()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C COperationBlockPresenceForPresentity::COperationBlockPresenceForPresentity()
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// COperationBlockPresenceForPresentity::~COperationBlockPresenceForPresentity()
+// ---------------------------------------------------------------------------
+//
+COperationBlockPresenceForPresentity::~COperationBlockPresenceForPresentity()
+    {
+    delete iIdentity;
+    delete iBlockInfo;
+    }
+
+// ---------------------------------------------------------------------------
+// COperationBlockPresenceForPresentity::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void COperationBlockPresenceForPresentity::ConstructL( const TDesC8& aParamPck )
+    {
+    // Read params. identity
+    RDesReadStream rs;
+    rs.Open( aParamPck ); // CSI: 65 # Does not return a value.
+    CleanupClosePushL( rs );
+
+    // identity
+    iIdentity = CXIMPIdentityImp::NewLC();
+    CleanupStack::Pop( iIdentity );
+    iIdentity->InternalizeL( rs );
+
+    CleanupStack::PopAndDestroy(); // rs
+    }
+
+
+// ---------------------------------------------------------------------------
+// COperationBlockPresenceForPresentity::ProcessL()
+// ---------------------------------------------------------------------------
+//
+void COperationBlockPresenceForPresentity::ProcessL()
+    {
+    TRACE(_L("COperationBlockPresenceForPresentity::ProcessL()" ) );
+    CXIMPOperationBase::ProcessL();
+
+    MProtocolPresenceAuthorization& authorization =
+                            iMyHost->GetConnection().ProtocolPresenceFeatures().PresenceAuthorization();
+
+    authorization.DoBlockPresenceForPresentityL( *iIdentity, iReqId );
+
+    }
+
+// ---------------------------------------------------------------------------
+// COperationBlockPresenceForPresentity::RequestCompleted()
+// ---------------------------------------------------------------------------
+//
+void COperationBlockPresenceForPresentity::RequestCompletedL()
+    {
+    TRACE(_L("COperationBlockPresenceForPresentity::RequestCompletedL()" ) );
+    CXIMPOperationBase::RequestCompletedL();
+
+    MXIMPBase* object = NULL;
+    iObjCollection->GetByType( object,
+                       MPresenceBlockInfo::KInterfaceId );
+    if( object )
+        {
+        CPresenceBlockInfoImp* blockInfo = 
+            TXIMPGetImpClassOrPanic< CPresenceBlockInfoImp >::From( *object );
+        
+        delete iBlockInfo;
+        iBlockInfo = blockInfo;
+        }
+    else // If adaptation didn't return info, wrap the id inside block info
+        {
+        delete iBlockInfo;
+        iBlockInfo = NULL;
+        iBlockInfo = CPresenceBlockInfoImp::NewLC( *iIdentity, KNullDesC );
+        CleanupStack::Pop(); // iBlockinfo
+        }        
+
+    if ( iStatusObj->ResultCode() == KErrNone )
+        {
+        iMyHost->PresenceDataAccess().AuthorizationDataAccess().HandlePresenceBlockedL( iBlockInfo );
+        iBlockInfo = NULL;
+        }
+
+    SynthesiseEventL();
+    }
+
+
+// ---------------------------------------------------------------------------
+// COperationBlockPresenceForPresentity::Type()
+// ---------------------------------------------------------------------------
+//
+TInt
+    COperationBlockPresenceForPresentity::Type() const
+    {
+    return NPresenceOps::EPrBlockPresenceForPresentity;
+    }
+
+// ---------------------------------------------------------------------------
+// COperationBlockPresenceForPresentity::SynthesiseEventL()
+// ---------------------------------------------------------------------------
+//
+void COperationBlockPresenceForPresentity::SynthesiseEventL()
+    {
+    }
+
+
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresenceoperations/presenceauthorization/operationblockpresenceforpresentity.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,82 @@
+/*
+* 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:  Block presence for presentity operation
+ *
+*/
+
+#ifndef CPSCOPERATIONBLOCKPRESENCEFORPRESENTITY_H
+#define CPSCOPERATIONBLOCKPRESENCEFORPRESENTITY_H
+
+
+#include <e32base.h>
+
+#include <ximpbase.h>
+#include "ximpoperationbase.h"
+
+#include "presenceoperationdefs.h"
+
+class CXIMPIdentityImp;
+class CPresenceBlockInfoImp;
+
+/**
+ * Grant presence to presentity operation
+ *
+ * @lib ximpoperations.lib
+ * @since S60 v4.0
+ */
+class COperationBlockPresenceForPresentity : public CXIMPOperationBase
+    {
+
+    public:
+
+        IMPORT_C COperationBlockPresenceForPresentity();
+
+        void ConstructL( const TDesC8& aParamPck );
+
+        ~COperationBlockPresenceForPresentity();
+
+
+    public: // from CXIMPOperationBase
+
+        void ProcessL();
+
+        void RequestCompletedL();
+
+        TInt Type() const;
+
+    private: // Helper methods
+
+        /**
+         * Synthesise event after completion
+         */
+        void SynthesiseEventL();
+
+    private: // data
+
+        /**
+         * Identity
+         * Own.
+         */
+        CXIMPIdentityImp* iIdentity;
+        
+        /**
+         * Block info
+         * Own.
+         */
+        CPresenceBlockInfoImp* iBlockInfo;
+
+    };
+
+
+#endif // CPSCOPERATIONBLOCKPRESENCEFORPRESENTITY_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresenceoperations/presenceauthorization/operationcancelpresenceblockfrompresentity.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,136 @@
+/*
+* 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:  Withdraw presence from presentity
+ *
+*/
+
+
+#include <ximpprotocolconnection.h>
+#include <protocolpresenceauthorization.h>
+#include <protocolpresencefeatures.h>
+
+#include "operationcancelpresenceblockfrompresentity.h"
+#include "presenceblockinfoimp.h"
+#include "ximpidentityimp.h"
+#include "ximpobjecthelpers.h"
+#include "protocolpresenceauthorizationdatahostimp.h"
+#include "ximprestrictedobjectcollectionimp.h"
+#include "ximphost.h"
+#include "ximpstatusimp.h"
+#include "protocolpresencedatahostimp.h"
+
+#include "ximptrace.h"
+
+// ============================ MEMBER FUNCTIONS =============================
+
+// ---------------------------------------------------------------------------
+// COperationCancelPresenceBlockFromPresentity::COperationCancelPresenceBlockFromPresentity()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C COperationCancelPresenceBlockFromPresentity::COperationCancelPresenceBlockFromPresentity()
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// COperationCancelPresenceBlockFromPresentity::~COperationCancelPresenceBlockFromPresentity()
+// ---------------------------------------------------------------------------
+//
+COperationCancelPresenceBlockFromPresentity::~COperationCancelPresenceBlockFromPresentity()
+    {
+    delete iIdentity;
+    }
+
+// ---------------------------------------------------------------------------
+// COperationCancelPresenceBlockFromPresentity::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void COperationCancelPresenceBlockFromPresentity::ConstructL( const TDesC8& aParamPck )
+    {
+    iIdentity = CXIMPIdentityImp::NewLC();
+    CleanupStack::Pop( iIdentity );
+    TXIMPObjectPacker< CXIMPIdentityImp >::UnPackL( *iIdentity, aParamPck );
+    }
+
+
+// ---------------------------------------------------------------------------
+// COperationCancelPresenceBlockFromPresentity::ProcessL()
+// ---------------------------------------------------------------------------
+//
+void COperationCancelPresenceBlockFromPresentity::ProcessL()
+    {
+    TRACE(_L("COperationCancelPresenceBlockFromPresentity::ProcessL()" ) );
+    CXIMPOperationBase::ProcessL();
+
+    MProtocolPresenceAuthorization& authorization =
+                            iMyHost->GetConnection().ProtocolPresenceFeatures().PresenceAuthorization();
+
+    authorization.DoCancelPresenceBlockFromPresentityL( *iIdentity, iReqId );
+
+    }
+
+// ---------------------------------------------------------------------------
+// COperationCancelPresenceBlockFromPresentity::RequestCompleted()
+// ---------------------------------------------------------------------------
+//
+void COperationCancelPresenceBlockFromPresentity::RequestCompletedL()
+    {
+    TRACE(_L("COperationCancelPresenceBlockFromPresentity::RequestCompletedL()" ) );
+    CXIMPOperationBase::RequestCompletedL();
+
+    MXIMPBase* object = NULL;
+    iObjCollection->GetByType( object,
+                       MPresenceBlockInfo::KInterfaceId );
+    if( object )
+        {
+        CPresenceBlockInfoImp* blockInfo = 
+            TXIMPGetImpClassOrPanic< CPresenceBlockInfoImp >::From( *object );
+        CleanupStack::PushL( blockInfo );
+        delete iIdentity;
+        iIdentity = NULL;
+        iIdentity = TXIMPObjectCloner< CXIMPIdentityImp >::CloneL(
+                                            blockInfo->IdentityImp() );
+        CleanupStack::PopAndDestroy( blockInfo );
+        }
+
+    if ( iStatusObj->ResultCode() == KErrNone )
+        {
+        iMyHost->PresenceDataAccess().AuthorizationDataAccess().HandlePresenceBlockCanceledL( iIdentity );
+        iIdentity = NULL;
+        }
+    SynthesiseEventL();
+    }
+
+
+// ---------------------------------------------------------------------------
+// COperationCancelPresenceBlockFromPresentity::Type()
+// ---------------------------------------------------------------------------
+//
+TInt
+    COperationCancelPresenceBlockFromPresentity::Type() const
+    {
+    return NPresenceOps::EPrCancelPresenceBlockFromPresentity;
+    }
+
+// ---------------------------------------------------------------------------
+// COperationCancelPresenceBlockFromPresentity::SynthesiseEventL()
+// ---------------------------------------------------------------------------
+//
+void COperationCancelPresenceBlockFromPresentity::SynthesiseEventL()
+    {
+    }
+
+
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresenceoperations/presenceauthorization/operationcancelpresenceblockfrompresentity.h	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  Withdraw presence from presentity
+ *
+*/
+
+#ifndef CPSCOPERATIONCANCELBLOCKFROMPRESENTITY_H
+#define CPSCOPERATIONCANCELBLOCKFROMPRESENTITY_H
+
+
+#include <e32base.h>
+#include <ximpbase.h>
+
+#include "ximpoperationbase.h"
+#include "presenceoperationdefs.h"
+
+class CXIMPIdentityImp;
+
+/**
+ * Withdraw presence from presentity
+ *
+ * @lib ximpoperations.lib
+ * @since S60 v4.0
+ */
+class COperationCancelPresenceBlockFromPresentity : public CXIMPOperationBase
+    {
+
+    public:
+
+        IMPORT_C COperationCancelPresenceBlockFromPresentity();
+
+        void ConstructL( const TDesC8& aParamPck );
+
+        ~COperationCancelPresenceBlockFromPresentity();
+
+
+    public: // from CXIMPOperationBase
+
+        void ProcessL();
+
+        void RequestCompletedL();
+
+        TInt Type() const;
+
+    private: // Helper methods
+
+        /**
+         * Synthesise event after completion
+         */
+        void SynthesiseEventL();
+
+    private: // data
+
+        /**
+         * Identity
+         */
+        CXIMPIdentityImp* iIdentity;
+
+    };
+
+
+#endif // CPSCOPERATIONCANCELBLOCKFROMPRESENTITY_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresenceoperations/presenceauthorization/operationgrantpresencetoeveryone.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  Grant presence to everyone
+ *
+*/
+
+
+#include <ximpprotocolconnection.h>
+#include <protocolpresenceauthorization.h>
+#include <protocolpresencefeatures.h>
+
+#include "operationgrantpresencetoeveryone.h"
+#include "presenceinfofilterimp.h"
+#include "presencedatacacheimp.h"
+#include "ximpobjecthelpers.h"
+#include "documentutils.h"
+#include "ximprestrictedobjectcollectionimp.h"
+#include "ximphost.h"
+#include "ximpstatusimp.h"
+#include "ximppsccontextimp.h"
+#include "ximppanics.h"
+#include "protocolpresencedatahostimp.h"
+
+#include "ximptrace.h"
+// ============================ MEMBER FUNCTIONS =============================
+
+// ---------------------------------------------------------------------------
+// COperationGrantPresenceToEveryone::COperationGrantPresenceToEveryone()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C COperationGrantPresenceToEveryone::COperationGrantPresenceToEveryone()
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// COperationGrantPresenceToEveryone::~COperationGrantPresenceToEveryone()
+// ---------------------------------------------------------------------------
+//
+COperationGrantPresenceToEveryone::~COperationGrantPresenceToEveryone()
+    {
+    delete iPif;
+    delete iMergedPif;
+    
+    if( iConfItem )
+        {
+        iConfItem->Close();
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// COperationGrantPresenceToEveryone::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void COperationGrantPresenceToEveryone::ConstructL( const TDesC8& aParamPck )
+    {
+    // group id
+    iPif = CPresenceInfoFilterImp::NewLC();
+    CleanupStack::Pop( iPif );
+    TXIMPObjectPacker< CPresenceInfoFilterImp >::UnPackL( *iPif, aParamPck );
+    }
+
+
+// ---------------------------------------------------------------------------
+// COperationGrantPresenceToEveryone::ProcessL()
+// ---------------------------------------------------------------------------
+//
+void COperationGrantPresenceToEveryone::ProcessL()
+    {
+    TRACE(_L("COperationGrantPresenceToEveryone::ProcessL()" ) );
+    CXIMPOperationBase::ProcessL();
+    
+    CPresenceToEveryoneConfigurationItem& confItem =
+                iMyHost->PresenceDataAccess().PresenceDataCache().PresenceToEveryoneConfigurationItemLC();
+    CleanupStack::Pop(); // subItem
+    iConfItem = &confItem;
+
+    // Get the subscription status
+    iConfigurationStatus = iConfItem->ConfigurationStatus( iContext );
+
+    MProtocolPresenceAuthorization& authorization = 
+                            iMyHost->GetConnection().ProtocolPresenceFeatures().PresenceAuthorization();
+
+    switch( iConfigurationStatus )
+        {
+        case CPresenceToEveryoneConfigurationItem::ENotConfiguredAtAll:
+            {
+            iMergedPif = TXIMPObjectCloner< CPresenceInfoFilterImp >::CloneL( *iPif );
+            authorization.DoGrantPresenceForEveryoneL( *iMergedPif, iReqId );
+            break;
+            }
+        case CPresenceToEveryoneConfigurationItem::EConfiguredForOtherCtxOnly:
+            {
+            // Aggregate subscription and context pifs
+            // Check aggregate and if needed.. update subscription
+            iMergedPif = DocumentUtils::InfoFilterUnionL( iConfItem->ConfigurationPif(), *iPif );
+            if( iMergedPif->Contains( iConfItem->ConfigurationPif() ) )
+                {
+                authorization.DoUpdatePresenceGrantPifForEveryoneL( *iMergedPif, iReqId );
+                }
+            else
+                {
+                iMyHost->FakeCompleteRequest( iReqId, KErrNone );
+                }
+            break;
+            }
+
+        case CPresenceToEveryoneConfigurationItem::EConfiguredForCtxOnly:
+        case CPresenceToEveryoneConfigurationItem::EConfiguredForCtxAndOthers:
+            {
+            CPresenceInfoFilterImp* oldPif = 
+                    iContext->PresenceInfoFilter( MXIMPPscContext::EGrantPresenceToEveryoneFilter );
+            CPresenceInfoFilterImp& oldMergedPif = iConfItem->ConfigurationPif();
+            if( *oldPif != *iPif )
+                {
+                iDoNotForce = ETrue;
+                CPresenceInfoFilterImp* withoutPif = 
+                            iConfItem->CollectConfigurationPifWithoutCtxL( iContext );
+                iMergedPif = DocumentUtils::InfoFilterUnionL( *withoutPif, *iPif );
+                }
+            else
+                {
+                iMergedPif = TXIMPObjectCloner< CPresenceInfoFilterImp >::CloneL( oldMergedPif );
+                }
+                
+            if( iMergedPif->Contains( oldMergedPif ) )
+                {
+                iDoNotForce = ETrue;
+                authorization.DoUpdatePresenceGrantPifForEveryoneL( *iMergedPif, iReqId );
+                }
+            else
+                {
+                iMyHost->FakeCompleteRequest( iReqId, KErrNone );
+                }
+            break;
+            }
+
+        XIMP_DEFAULT_CASE_UNSUPPORTED( NXIMPPrivPanic::EInvalidSubscriptionStatus );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// COperationGrantPresenceToEveryone::RequestCompleted()
+// ---------------------------------------------------------------------------
+//
+void COperationGrantPresenceToEveryone::RequestCompletedL()
+    {
+    TRACE(_L("COperationGrantPresenceToEveryone::RequestCompletedL()" ) );
+    CXIMPOperationBase::RequestCompletedL();
+
+    if( iStatusObj->ResultCode() == KErrNone )
+        {
+        switch( iConfigurationStatus )
+            {
+            case CPresenceToEveryoneConfigurationItem::ENotConfiguredAtAll:
+            case CPresenceToEveryoneConfigurationItem::EConfiguredForOtherCtxOnly:
+                {
+                iContext->SetPresenceInfoFilterL( MXIMPPscContext::EGrantPresenceToEveryoneFilter, iPif );
+                iPif = NULL;
+                iConfItem->SetConfigurationPif( iMergedPif );
+                iMergedPif = NULL;
+                iConfItem->AddConfiguratorL( iContext );
+
+                break;
+                }
+            case CPresenceToEveryoneConfigurationItem::EConfiguredForCtxOnly:
+            case CPresenceToEveryoneConfigurationItem::EConfiguredForCtxAndOthers:
+                {
+                break;
+                }
+            
+            XIMP_DEFAULT_CASE_UNSUPPORTED( NXIMPPrivPanic::EInvalidSubscriptionStatus );
+            }
+
+        SynthesiseEventL();
+        }     
+    }
+
+
+// ---------------------------------------------------------------------------
+// COperationGrantPresenceToEveryone::Type()
+// ---------------------------------------------------------------------------
+//
+TInt 
+    COperationGrantPresenceToEveryone::Type() const
+    {
+    return NPresenceOps::EPrGrantPresenceToEveryone;
+    }
+
+// ---------------------------------------------------------------------------
+// COperationGrantPresenceToEveryone::SynthesiseEventL()
+// ---------------------------------------------------------------------------
+//
+void COperationGrantPresenceToEveryone::SynthesiseEventL()
+    {   
+    }
+
+
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresenceoperations/presenceauthorization/operationgrantpresencetoeveryone.h	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  Grant presence to everyone
+ *
+*/
+
+#ifndef CPSCOPERATIONGRANTPRESENCETOEVERYONE_H
+#define CPSCOPERATIONGRANTPRESENCETOEVERYONE_H
+
+
+#include <e32base.h>
+
+#include <ximpbase.h>
+#include "ximpoperationbase.h"
+#include "presencetoeveryoneconfigurationitem.h"
+
+#include "presenceoperationdefs.h"
+
+class CXIMPIdentityImp;
+
+/**
+ * Grant presence to everyone
+ *
+ * @lib ximpoperations.lib
+ * @since S60 v4.0
+ */
+class COperationGrantPresenceToEveryone : public CXIMPOperationBase
+    {
+
+    public:
+
+        IMPORT_C COperationGrantPresenceToEveryone();
+
+        void ConstructL( const TDesC8& aParamPck );
+
+        ~COperationGrantPresenceToEveryone();
+
+
+    public: // from CXIMPOperationBase
+
+        void ProcessL();
+
+        void RequestCompletedL();
+
+        TInt Type() const;
+        
+    private: // Helper methods
+    
+        /**
+         * Synthesise event after completion
+         */
+        void SynthesiseEventL();      
+
+    private: // data
+
+        /**
+         * Presence information filter
+         */
+        CPresenceInfoFilterImp* iPif;
+        
+        /**
+         * Merged pif with other contexts.
+         */
+        CPresenceInfoFilterImp* iMergedPif;
+
+        /**
+         * Authorization item for configuration
+         */
+        CPresenceToEveryoneConfigurationItem* iConfItem;
+        
+        /**
+         * Subscription status
+         */
+        CPresenceToEveryoneConfigurationItem::TConfigurationStatus iConfigurationStatus;
+        
+        /**
+         * Don't force event.
+         */
+        TBool iDoNotForce;        
+    };
+
+
+#endif // CPSCOPERATIONGRANTPRESENCETOEVERYONE_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresenceoperations/presenceauthorization/operationgrantpresencetopresentity.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,251 @@
+/*
+* 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:  Grant presence to presentity operation
+ *
+*/
+
+
+#include <ximpprotocolconnection.h>
+#include <protocolpresenceauthorization.h>
+#include <protocolpresencefeatures.h>
+
+#include "operationgrantpresencetopresentity.h"
+#include "presenceinfofilterimp.h"
+#include "ximpidentityimp.h"
+#include "presencedatacacheimp.h"
+#include "ximpobjecthelpers.h"
+#include "documentutils.h"
+#include "ximprestrictedobjectcollectionimp.h"
+#include "ximphost.h"
+#include "ximpstatusimp.h"
+#include "ximppsccontextimp.h"
+#include "ximppanics.h"
+#include "protocolpresencedatahostimp.h"
+
+#include "ximptrace.h"
+
+// ============================ MEMBER FUNCTIONS =============================
+
+// ---------------------------------------------------------------------------
+// COperationGrantPresenceToPresentity::COperationGrantPresenceToPresentity()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C COperationGrantPresenceToPresentity::COperationGrantPresenceToPresentity()
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// COperationGrantPresenceToPresentity::~COperationGrantPresenceToPresentity()
+// ---------------------------------------------------------------------------
+//
+COperationGrantPresenceToPresentity::~COperationGrantPresenceToPresentity()
+    {
+    delete iPif;
+    delete iIdentity;
+    delete iMergedPif;
+    
+    if( iConfItem )
+        {
+        iConfItem->Close();
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// COperationGrantPresenceToPresentity::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void COperationGrantPresenceToPresentity::ConstructL( const TDesC8& aParamPck )
+    {
+    // Read params. PIF and identity    
+    RDesReadStream rs;
+    rs.Open( aParamPck ); // CSI: 65 # Does not return a value.
+    CleanupClosePushL( rs );
+
+    // group id
+    iPif = CPresenceInfoFilterImp::NewLC();
+    CleanupStack::Pop( iPif );
+    iPif->InternalizeL( rs );
+
+    // identity
+    iIdentity = CXIMPIdentityImp::NewLC();
+    CleanupStack::Pop( iIdentity );
+    iIdentity->InternalizeL( rs );
+    
+    CleanupStack::PopAndDestroy(); // rs
+    }
+
+
+// ---------------------------------------------------------------------------
+// COperationGrantPresenceToPresentity::ProcessL()
+// ---------------------------------------------------------------------------
+//
+void COperationGrantPresenceToPresentity::ProcessL()
+    {
+    TRACE(_L("COperationGrantPresenceToPresentity::ProcessL()" ) );
+    CXIMPOperationBase::ProcessL();
+    
+    CPresenceConfigurationItem& confItem =
+                iMyHost->PresenceDataAccess().PresenceDataCache().PresenceConfigurationItemLC( *iIdentity );
+    CleanupStack::Pop(); // subItem
+    iConfItem = &confItem;
+
+    // Get the subscription status
+    iConfigurationStatus = iConfItem->ConfigurationStatus( iContext );
+
+    MProtocolPresenceAuthorization& authorization = 
+                            iMyHost->GetConnection().ProtocolPresenceFeatures().PresenceAuthorization();
+
+    switch( iConfigurationStatus )
+        {
+        case CPresenceConfigurationItem::ENotConfiguredAtAll:
+        case CPresenceConfigurationItem::EConfiguredForCtxOnly:
+            {
+            iMergedPif = TXIMPObjectCloner< CPresenceInfoFilterImp >::CloneL( *iPif );
+            authorization.DoGrantPresenceForPresentityL( iConfItem->Identity(),
+                                                      *iMergedPif,
+                                                      iReqId );
+            break;
+            }
+        case CPresenceConfigurationItem::EConfiguredForOtherCtxOnly:
+            {
+            // Aggregate subscription and context pifs
+            // Check aggregate and if needed.. update subscription
+            iMergedPif = DocumentUtils::InfoFilterUnionL( iConfItem->ConfigurationPif(), *iPif );
+            if( iMergedPif->Contains( iConfItem->ConfigurationPif() ) )
+                {
+                authorization.DoUpdatePresenceGrantPifForPresentityL( iConfItem->Identity(),
+                                                                  *iMergedPif,
+                                                                  iReqId );
+                }
+            else
+                {
+                iMyHost->FakeCompleteRequest( iReqId, KErrNone );
+                }
+            break;
+            }
+        //case CPresenceConfigurationItem::EConfiguredForCtxOnly:
+        case CPresenceConfigurationItem::EConfiguredForCtxAndOthers:
+            {
+            CPresenceInfoFilterImp* oldPif = 
+                iContext->PresenceInfoFilter( MXIMPPscContext::EGrantPresenceToPresentityFilter, iIdentity );
+            CPresenceInfoFilterImp& oldMergedPif = iConfItem->ConfigurationPif();
+            TBool makeUnion( EFalse );
+            if( !oldPif )
+                {
+                TRACE(_L("COperationGrantPresenceToPresentity::ProcessL() no old pif" ) );
+                makeUnion = ETrue;
+                }
+            else if ( *oldPif != *iPif ) 
+                {
+                makeUnion = ETrue;
+                }
+            if( makeUnion )
+                {
+                iDoNotForce = ETrue;
+                CPresenceInfoFilterImp* withoutPif = 
+                            iConfItem->CollectConfigurationPifWithoutCtxL( iContext );
+                iMergedPif = DocumentUtils::InfoFilterUnionL( *withoutPif, *iPif );
+                }
+            else
+                {
+                iMergedPif = TXIMPObjectCloner< CPresenceInfoFilterImp >::CloneL( oldMergedPif );
+                }
+                
+            if( iMergedPif->Contains( oldMergedPif ) )
+                {
+                iDoNotForce = ETrue;
+                authorization.DoUpdatePresenceGrantPifForPresentityL( *iIdentity, *iMergedPif, iReqId );
+                }
+            else
+                {
+                iMyHost->FakeCompleteRequest( iReqId, KErrNone );
+                }
+            break;
+            }
+            
+        XIMP_DEFAULT_CASE_UNSUPPORTED( NXIMPPrivPanic::EInvalidSubscriptionStatus );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// COperationGrantPresenceToPresentity::RequestCompleted()
+// ---------------------------------------------------------------------------
+//
+void COperationGrantPresenceToPresentity::RequestCompletedL()
+    {
+    TRACE(_L("COperationGrantPresenceToPresentity::RequestCompletedL()" ) );
+    CXIMPOperationBase::RequestCompletedL();
+
+    if( iStatusObj->ResultCode() == KErrNone )
+        {
+        if( iConfigurationStatus == CPresenceConfigurationItem::ENotSubscribedAtAll )
+            {
+            MXIMPBase* object = NULL; 
+            iObjCollection->GetByType( object, MXIMPIdentity::KInterfaceId );
+            if( object )
+                {
+                delete iIdentity;
+                iIdentity = TXIMPGetImpClassOrPanic< CXIMPIdentityImp >::From( *object );
+
+                // Got altered identity. If it differs from original
+                // we'll create a new subscription item and close the old.
+                CPresenceConfigurationItem& altSubItem = 
+                    iMyHost->PresenceDataAccess().PresenceDataCache().PresenceConfigurationItemLC( *iIdentity );
+
+                iConfItem->Close();
+                iConfItem = &altSubItem;
+
+                CleanupStack::Pop(); // altSubItem                    
+                }            
+            }
+            
+        if( iConfigurationStatus == CPresenceConfigurationItem::ENotSubscribedAtAll ||
+            iConfigurationStatus == CPresenceConfigurationItem::ESubscribedForOtherCtxOnly )
+            {
+            iConfItem->AddConfiguratorL( iContext );        
+            }
+            
+        iContext->SetPresenceInfoFilterL( MXIMPPscContext::EGrantPresenceToPresentityFilter,
+                iPif, iIdentity );
+        iPif = NULL;
+        iConfItem->SetConfigurationPif( iMergedPif );
+        iMergedPif = NULL;
+
+        SynthesiseEventL();
+        }     
+    }
+
+
+// ---------------------------------------------------------------------------
+// COperationGrantPresenceToPresentity::Type()
+// ---------------------------------------------------------------------------
+//
+TInt 
+    COperationGrantPresenceToPresentity::Type() const
+    {
+    return NPresenceOps::EPrGrantPresenceToPresentity;
+    }
+
+// ---------------------------------------------------------------------------
+// COperationGrantPresenceToPresentity::SynthesiseEventL()
+// ---------------------------------------------------------------------------
+//
+void COperationGrantPresenceToPresentity::SynthesiseEventL()
+    {   
+    }
+
+
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresenceoperations/presenceauthorization/operationgrantpresencetopresentity.h	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  Grant presence to presentity operation
+ *
+*/
+
+#ifndef CPSCOPERATIONGRANTPRESENCETOPRESENTITY_H
+#define CPSCOPERATIONGRANTPRESENCETOPRESENTITY_H
+
+
+#include <e32base.h>
+
+#include <ximpbase.h>
+#include "ximpoperationbase.h"
+#include "presenceconfigurationitem.h"
+
+#include "presenceoperationdefs.h"
+
+class CXIMPIdentityImp;
+
+/**
+ * Grant presence to presentity operation
+ *
+ * @lib ximpoperations.lib
+ * @since S60 v4.0
+ */
+class COperationGrantPresenceToPresentity : public CXIMPOperationBase
+    {
+
+    public:
+
+        IMPORT_C COperationGrantPresenceToPresentity();
+
+        void ConstructL( const TDesC8& aParamPck );
+
+        ~COperationGrantPresenceToPresentity();
+
+
+    public: // from CXIMPOperationBase
+
+        void ProcessL();
+
+        void RequestCompletedL();
+
+        TInt Type() const;
+        
+    private: // Helper methods
+    
+        /**
+         * Synthesise event after completion
+         */
+        void SynthesiseEventL();      
+
+    private: // data
+
+        /**
+         * Presence information filter
+         */
+        CPresenceInfoFilterImp* iPif;
+        
+        /**
+         * Merged pif with other contexts.
+         */
+        CPresenceInfoFilterImp* iMergedPif;
+
+        /**
+         * Identity 
+         */
+        CXIMPIdentityImp* iIdentity;
+        
+        /**
+         * Authorization item for configuration
+         */
+        CPresenceConfigurationItem* iConfItem;
+        
+        /**
+         * Subscription status
+         */
+        CPresenceConfigurationItem::TConfigurationStatus iConfigurationStatus;
+        
+        /**
+         * Don't force event.
+         */
+        TBool iDoNotForce;                
+    };
+
+
+#endif // CPSCOPERATIONGRANTPRESENCETOPRESENTITY_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresenceoperations/presenceauthorization/operationgrantpresencetopresentitygroupmembers.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,252 @@
+/*
+* 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:  Grant presence to presentity group members operation
+ *
+*/
+
+ 
+#include <ximpprotocolconnection.h>
+#include <protocolpresenceauthorization.h>
+#include <protocolpresencefeatures.h>
+
+#include "operationgrantpresencetopresentitygroupmembers.h"
+#include "presenceinfofilterimp.h"
+#include "ximpidentityimp.h"
+#include "presencedatacacheimp.h"
+#include "ximpobjecthelpers.h"
+#include "documentutils.h"
+#include "ximprestrictedobjectcollectionimp.h"
+#include "ximphost.h"
+#include "ximpstatusimp.h"
+#include "ximppsccontextimp.h"
+#include "ximppanics.h"
+#include "protocolpresencedatahostimp.h"
+
+#include "ximptrace.h"
+// ============================ MEMBER FUNCTIONS =============================
+
+// ---------------------------------------------------------------------------
+// COperationGrantPresenceToPresentityGroupMembers::COperationGrantPresenceToPresentityGroupMembers()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C COperationGrantPresenceToPresentityGroupMembers::COperationGrantPresenceToPresentityGroupMembers()
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// COperationGrantPresenceToPresentityGroupMembers::~COperationGrantPresenceToPresentityGroupMembers()
+// ---------------------------------------------------------------------------
+//
+COperationGrantPresenceToPresentityGroupMembers::~COperationGrantPresenceToPresentityGroupMembers()
+    {
+    delete iPif;
+    delete iGroupId;
+    delete iMergedPif;
+    
+    if( iConfItem )
+        {
+        iConfItem->Close();
+        }    
+    }
+
+// ---------------------------------------------------------------------------
+// COperationGrantPresenceToPresentityGroupMembers::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void COperationGrantPresenceToPresentityGroupMembers::ConstructL( const TDesC8& aParamPck )
+    {
+    // Read params. PIF and identity    
+    RDesReadStream rs;
+    rs.Open( aParamPck ); // CSI: 65 # Does not return a value.
+    CleanupClosePushL( rs );
+
+    // group id
+    iPif = CPresenceInfoFilterImp::NewLC();
+    CleanupStack::Pop( iPif );
+    iPif->InternalizeL( rs );
+
+    // identity
+    iGroupId = CXIMPIdentityImp::NewLC();
+    CleanupStack::Pop( iGroupId );
+    iGroupId->InternalizeL( rs );
+    
+    CleanupStack::PopAndDestroy(); // rs    
+    }
+
+
+// ---------------------------------------------------------------------------
+// COperationGrantPresenceToPresentityGroupMembers::ProcessL()
+// ---------------------------------------------------------------------------
+//
+void COperationGrantPresenceToPresentityGroupMembers::ProcessL()
+    {
+    TRACE(_L("COperationGrantPresenceToPresentityGroupMembers::ProcessL()" ) );
+    CXIMPOperationBase::ProcessL();
+    
+    CGroupMembersPresenceConfigurationItem& confItem =
+                iMyHost->PresenceDataAccess().PresenceDataCache().GroupMembersPresenceConfigurationItemLC( *iGroupId );
+    CleanupStack::Pop(); // subItem
+    iConfItem = &confItem;
+
+    iConfigurationStatus = iConfItem->ConfigurationStatus( iContext );
+
+    MProtocolPresenceAuthorization& authorization = 
+                        iMyHost->GetConnection().ProtocolPresenceFeatures().PresenceAuthorization();
+
+    switch( iConfigurationStatus )
+        {
+        case CGroupMembersPresenceConfigurationItem::ENotConfiguredAtAll:
+            {
+            iMergedPif = TXIMPObjectCloner< CPresenceInfoFilterImp >::CloneL( *iPif );
+            authorization.DoGrantPresenceForPresentityGroupMembersL(  *iGroupId,
+                                                                   *iMergedPif,
+                                                                   iReqId );
+            break;
+            }
+        case CGroupMembersPresenceConfigurationItem::EConfiguredForOtherCtxOnly:
+            {
+            // Aggregate subscription and context pifs
+            // Check aggregate and if needed.. update subscription
+            iMergedPif = DocumentUtils::InfoFilterUnionL( iConfItem->ConfigurationPif(), *iPif );
+            if( iMergedPif->Contains( iConfItem->ConfigurationPif() ) )
+                {
+                authorization.DoUpdatePresenceGrantPifForPresentityGroupMembersL( *iGroupId,
+                                                                                  *iMergedPif,
+                                                                                  iReqId );
+                }
+            else
+                {
+                iMyHost->FakeCompleteRequest( iReqId, KErrNone );
+                }
+            break;
+            }
+        case CGroupMembersPresenceConfigurationItem::EConfiguredForCtxOnly:
+        case CGroupMembersPresenceConfigurationItem::EConfiguredForCtxAndOthers:
+            {
+            CPresenceInfoFilterImp* oldPif = 
+                iContext->PresenceInfoFilter( MXIMPPscContext::EGrantPresenceToGroupMemberFilter, iGroupId );
+            CPresenceInfoFilterImp& oldMergedPif = iConfItem->ConfigurationPif();
+            TBool makeUnion( EFalse );
+            if( !oldPif )
+                {
+                TRACE(_L("COperationGrantPresenceToPresentityGroupMembers::ProcessL() no old pif" ) );
+                makeUnion = ETrue;
+                }
+            else if ( *oldPif != *iPif ) 
+                {
+                makeUnion = ETrue;
+                }
+            if( makeUnion )
+                {
+                iDoNotForce = ETrue;
+                CPresenceInfoFilterImp* withoutPif = 
+                            iConfItem->CollectConfigurationPifWithoutCtxL( iContext );
+                iMergedPif = DocumentUtils::InfoFilterUnionL( *withoutPif, *iPif );
+                }
+            else
+                {
+                iMergedPif = TXIMPObjectCloner< CPresenceInfoFilterImp >::CloneL( oldMergedPif );
+                }
+                
+            if( iMergedPif->Contains( oldMergedPif ) )
+                {
+                iDoNotForce = ETrue;
+                authorization.DoUpdatePresenceGrantPifForPresentityGroupMembersL( *iGroupId, 
+                                                                                  *iMergedPif, 
+                                                                                  iReqId );
+                }
+            else
+                {
+                iMyHost->FakeCompleteRequest( iReqId, KErrNone );
+                }
+            break;
+            }
+            
+        XIMP_DEFAULT_CASE_UNSUPPORTED( NXIMPPrivPanic::EInvalidSubscriptionStatus );            
+        }
+    }
+
+
+// ---------------------------------------------------------------------------
+// COperationGrantPresenceToPresentityGroupMembers::RequestCompleted()
+// ---------------------------------------------------------------------------
+//
+void COperationGrantPresenceToPresentityGroupMembers::RequestCompletedL()
+    {
+    TRACE(_L("COperationGrantPresenceToPresentityGroupMembers::RequestCompletedL()" ) );
+    CXIMPOperationBase::RequestCompletedL();
+
+    if( iStatusObj->ResultCode() == KErrNone )
+        {
+        
+        if( iConfigurationStatus == CGroupMembersPresenceConfigurationItem::ENotSubscribedAtAll )
+            {
+            MXIMPBase* object = NULL; 
+            iObjCollection->GetByType( object, MXIMPIdentity::KInterfaceId );
+            if( object )
+                {
+                delete iGroupId;
+                iGroupId = TXIMPGetImpClassOrPanic< CXIMPIdentityImp >::From( *object );
+
+                // Got altered identity. If it differs from original
+                // we'll create a new subscription item and close the old.
+                CGroupMembersPresenceConfigurationItem& altSubItem = 
+                    iMyHost->PresenceDataAccess().PresenceDataCache().GroupMembersPresenceConfigurationItemLC( *iGroupId );
+
+                iConfItem->Close();
+                iConfItem = &altSubItem;
+
+                CleanupStack::Pop(); // altSubItem                    
+                }            
+            }
+            
+        if( iConfigurationStatus == CGroupMembersPresenceConfigurationItem::ENotSubscribedAtAll ||
+            iConfigurationStatus == CGroupMembersPresenceConfigurationItem::ESubscribedForOtherCtxOnly )
+            {
+            iConfItem->AddConfiguratorL( iContext );        
+            }
+            
+        iContext->SetPresenceInfoFilterL( MXIMPPscContext::EGrantPresenceToGroupMemberFilter,
+                iPif, iGroupId );
+        iPif = NULL;
+        iConfItem->SetConfigurationPif( iMergedPif );
+        iMergedPif = NULL;
+
+        SynthesiseEventL();
+        }     
+    }
+
+
+// ---------------------------------------------------------------------------
+// COperationGrantPresenceToPresentityGroupMembers::Type()
+// ---------------------------------------------------------------------------
+//
+TInt 
+    COperationGrantPresenceToPresentityGroupMembers::Type() const
+    {
+    return NPresenceOps::EPrGrantPresenceToPresentityGroupMembers;
+    }
+
+// ---------------------------------------------------------------------------
+// COperationGrantPresenceToPresentityGroupMembers::SynthesiseEventL()
+// ---------------------------------------------------------------------------
+//
+void COperationGrantPresenceToPresentityGroupMembers::SynthesiseEventL()
+    {   
+    }
+
+
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresenceoperations/presenceauthorization/operationgrantpresencetopresentitygroupmembers.h	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  Grant presence to presentity group members operation
+ *
+*/
+
+#ifndef CPSCOPERATIONGRANTPRESENCETOPRESENTITYGROUPMEMBERS_H
+#define CPSCOPERATIONGRANTPRESENCETOPRESENTITYGROUPMEMBERS_H
+
+
+#include <e32base.h>
+
+#include <ximpbase.h>
+#include "ximpoperationbase.h"
+#include "groupmemberspresenceconfigurationitem.h"
+
+#include "presenceoperationdefs.h"
+
+class CXIMPIdentityImp;
+
+/**
+ * Grant presence to presentity group members operation
+ *
+ * @lib ximpoperations.lib
+ * @since S60 v4.0
+ */
+class COperationGrantPresenceToPresentityGroupMembers : public CXIMPOperationBase
+    {
+
+    public:
+
+        IMPORT_C COperationGrantPresenceToPresentityGroupMembers();
+
+        void ConstructL( const TDesC8& aParamPck );
+
+        ~COperationGrantPresenceToPresentityGroupMembers();
+
+
+    public: // from CXIMPOperationBase
+
+        void ProcessL();
+
+        void RequestCompletedL();
+
+        TInt Type() const;
+        
+    private: // Helper methods
+    
+        /**
+         * Synthesise event after completion
+         */
+        void SynthesiseEventL();      
+
+    private: // data
+
+        /**
+         * Presence information filter
+         */
+        CPresenceInfoFilterImp* iPif;
+
+        /**
+         * Identity 
+         */
+        CXIMPIdentityImp* iGroupId;
+        
+        /**
+         * Subscription item
+         */
+        CGroupMembersPresenceConfigurationItem* iConfItem;
+        
+        /**
+         * Presence info filter having new presence info filter for context.
+         * Own.
+         */
+        CPresenceInfoFilterImp* iMergedPif; 
+        
+        /**
+         * Subscription status
+         */
+        CGroupMembersPresenceConfigurationItem::TConfigurationStatus iConfigurationStatus;
+        
+        /**
+         * Don't force event.
+         */
+        TBool iDoNotForce;        
+
+    };
+
+
+#endif // CPSCOPERATIONGRANTPRESENCETOPRESENTITYGROUPMEMBERS_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresenceoperations/presenceauthorization/operationhandlepresenceblocking.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  Handle presence blocking operations
+ *
+*/
+
+
+#include "operationhandlepresenceblocking.h"
+#include "ximpobjecthelpers.h"
+#include "blocklistsubscriptionitem.h"
+#include "presencedatacacheimp.h"
+#include "presenceblockinfoimp.h"
+#include "ximpidentityimp.h"
+#include "ximphost.h"
+#include "ximpstatusimp.h"
+#include "ximppanics.h"
+#include "ximprestrictedobjectcollectionimp.h"
+#include "ximpobjectcollectionimp.h"
+#include "protocolpresencedatahostimp.h"
+
+#include "ximptrace.h"
+// ============================ MEMBER FUNCTIONS =============================
+
+// ---------------------------------------------------------------------------
+// COperationHandlePresenceBlocking::~COperationHandlePresenceBlocking()
+// ---------------------------------------------------------------------------
+//
+COperationHandlePresenceBlocking::~COperationHandlePresenceBlocking()
+    {
+    delete iBlockList;
+    delete iBlocked;
+    delete iCanceledBlockId;
+    }
+
+// ---------------------------------------------------------------------------
+// COperationHandlePresenceBlocking::COperationHandlePresenceBlocking()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C COperationHandlePresenceBlocking::COperationHandlePresenceBlocking(
+        TInt aMyType )
+    {
+    iMyType = aMyType;
+    }
+
+// ---------------------------------------------------------------------------
+// COperationHandlePresenceBlocking::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void COperationHandlePresenceBlocking::ConstructL( const TDesC8& /*aParamPck*/ )
+    {
+    iBlockList = new( ELeave ) RPrBlockInfoImpArray;
+    }
+
+// ---------------------------------------------------------------------------
+// COperationHandlePresenceBlocking::ProcessL()
+// ---------------------------------------------------------------------------
+//
+void COperationHandlePresenceBlocking::ProcessL()
+    {
+    TRACE(_L("COperationHandlePresenceBlocking::ProcessL()") );
+    CXIMPOperationBase::ProcessL();
+
+    CBlockListSubscriptionItem& subItem =
+        iMyHost->PresenceDataAccess().PresenceDataCache().BlockListSubscriptionItemLC();
+    // clean out temporary lists
+    subItem.Clean();
+
+    switch ( iMyType )
+        {
+        case NPresenceOps::EPrHandlePresenceBlockList:
+            {
+            MXIMPBase* object = NULL;
+            iObjCollection->GetByType( object, MXIMPObjectCollection::KInterfaceId );
+            if( object )
+                {
+                CXIMPObjectCollectionImp* objectCollection = 
+                        TXIMPGetImpClassOrPanic< CXIMPObjectCollectionImp >::From( *object );
+                CleanupStack::PushL( objectCollection );
+                TLinearOrder< CPresenceBlockInfoImp > order( CPresenceBlockInfoImp::IdLinearOrder );
+                TXIMPObjectMover< MPresenceBlockInfo, CPresenceBlockInfoImp >::
+                                            MoveFromCollectionToArrayL( *objectCollection, *iBlockList, order );
+                CleanupStack::PopAndDestroy( objectCollection );        
+                }
+            else
+                {
+                User::Leave( KErrArgument );
+                }
+
+            subItem.SetNewListL( iBlockList );
+            iBlockList = NULL;
+            break;
+            }
+
+        case NPresenceOps::EPrHandlePresenceBlocked:
+            {
+            MXIMPBase* object = NULL;
+            iObjCollection->GetByType( object, MPresenceBlockInfo::KInterfaceId );
+            if( object )
+                {
+                iBlocked = TXIMPGetImpClassOrPanic< CPresenceBlockInfoImp >::From( *object );
+                }
+            else
+                {
+                User::Leave( KErrArgument );
+                }            
+            subItem.SetBlockedL( iBlocked );
+            iBlocked = NULL; // ownership was transferred
+            break;
+            }
+
+        case NPresenceOps::EPrHandlePresenceBlockCanceled:
+            {
+            MXIMPBase* object = NULL;
+            iObjCollection->GetByType( object, MXIMPIdentity::KInterfaceId );
+            if( object )
+                {
+                iCanceledBlockId = TXIMPGetImpClassOrPanic< CXIMPIdentityImp >::From( *object );
+                }
+            else
+                {
+                User::Leave( KErrArgument );
+                }            
+            subItem.SetCanceledBlockIdL( iCanceledBlockId );
+            iCanceledBlockId = NULL; // ownership was transferred
+            break;
+            }
+
+        XIMP_DEFAULT_CASE_UNSUPPORTED( NXIMPPrivPanic::EInvalidOperationType );
+        }
+
+    // synthesize the event to all contexts
+    TRAPD( err, subItem.SynthesiseSubscriptionEventToAllCtxsL() );
+
+    CleanupStack::PopAndDestroy(); // subItem
+
+    err = KErrNone;
+    iMyHost->HandleAdaptationRequestCompleted( iReqId, err );
+    }
+
+// ---------------------------------------------------------------------------
+// COperationHandlePresenceBlocking::RequestCompleted()
+// ---------------------------------------------------------------------------
+//
+void COperationHandlePresenceBlocking::RequestCompletedL()
+    {
+    TRACE(_L("COperationHandlePresenceBlocking::RequestCompletedL()" ) );
+    CXIMPOperationBase::RequestCompletedL();
+
+    // no special handling for error situations
+    }
+
+
+// ---------------------------------------------------------------------------
+// COperationHandlePresenceBlocking::Type()
+// ---------------------------------------------------------------------------
+//
+TInt COperationHandlePresenceBlocking::Type() const
+    {
+    return iMyType;
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresenceoperations/presenceauthorization/operationhandlepresenceblocking.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,86 @@
+/*
+* 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:  Handle presence blocking operations
+ *
+*/
+
+#ifndef CPSCOPERATIONHANDLEPRESENCEBLOCKING_H
+#define CPSCOPERATIONHANDLEPRESENCEBLOCKING_H
+
+
+#include <e32base.h>
+#include <ximpbase.h>
+
+#include "ximpoperationbase.h"
+#include "presencetypehelpers.h"
+#include "presenceoperationdefs.h"
+
+class CXIMPIdentityImp;
+
+/**
+ * Handle presentity group related operations.
+ *
+ * @lib ximpoperations.lib
+ * @since S60 v4.0
+ */
+class COperationHandlePresenceBlocking : public CXIMPOperationBase
+    {
+
+    public:
+
+        IMPORT_C COperationHandlePresenceBlocking(
+                TInt aMyType );
+
+        void ConstructL( const TDesC8& aParamPck );
+
+        ~COperationHandlePresenceBlocking();
+
+    public: // from CXIMPOperationBase
+
+        void ProcessL();
+
+        void RequestCompletedL();
+
+        TInt Type() const;
+
+    private: // data
+
+        /**
+         * Array blocked presentities.
+         * Owned.
+         */
+        RPrBlockInfoImpArray* iBlockList;
+
+        /**
+         * Blocked presentity
+         * Owned.
+         */
+        CPresenceBlockInfoImp* iBlocked;
+
+        /**
+         * Canceled block presentity
+         * Owned.
+         */
+        CXIMPIdentityImp* iCanceledBlockId;
+
+        /**
+         * This is an internal and polymorphic operation.
+         * The actual type will be defined by this variable,
+         * set during operation creation.
+         */
+        TInt iMyType;
+    };
+
+
+#endif // CPSCOPERATIONHANDLEPRESENCEBLOCKING_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresenceoperations/presenceauthorization/operationhandlepresencegrantrequests.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -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: handle of operational grant presence request
+ *
+*/
+
+
+#include "operationhandlepresencegrantrequests.h"
+#include "ximpobjecthelpers.h"
+#include "grantrequestlistsubscriptionitem.h"
+#include "presencedatacacheimp.h"
+#include "presencegrantrequestinfoimp.h"
+#include "ximpidentityimp.h"
+#include "ximphost.h"
+#include "ximpstatusimp.h"
+#include "ximppanics.h"
+#include "ximprestrictedobjectcollectionimp.h"
+#include "ximpobjectcollectionimp.h"
+#include "protocolpresencedatahostimp.h"
+
+#include "ximptrace.h"
+// ============================ MEMBER FUNCTIONS =============================
+
+// ---------------------------------------------------------------------------
+// COperationHandlePresenceGrantRequests::~COperationHandlePresenceGrantRequests()
+// ---------------------------------------------------------------------------
+//
+COperationHandlePresenceGrantRequests::~COperationHandlePresenceGrantRequests()
+    {
+    delete iGrantReqList;
+    delete iObsoletedId;
+    delete iReceivedReq;
+    }
+
+// ---------------------------------------------------------------------------
+// COperationHandlePresenceGrantRequests::COperationHandlePresenceGrantRequests()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C COperationHandlePresenceGrantRequests::COperationHandlePresenceGrantRequests(
+        TInt aMyType )
+    {
+    iMyType = aMyType;
+    }
+
+// ---------------------------------------------------------------------------
+// COperationHandlePresenceGrantRequests::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void COperationHandlePresenceGrantRequests::ConstructL( const TDesC8& /*aParamPck*/ )
+    {
+    iGrantReqList = new( ELeave ) RPrGrntReqInfoImpArray;
+    }
+
+// ---------------------------------------------------------------------------
+// COperationHandlePresenceGrantRequests::ProcessL()
+// ---------------------------------------------------------------------------
+//
+void COperationHandlePresenceGrantRequests::ProcessL()
+    {
+    TRACE(_L("COperationHandlePresenceGrantRequests::ProcessL()") );
+    CXIMPOperationBase::ProcessL();
+
+    CGrantRequestListSubscriptionItem& subItem =
+        iMyHost->PresenceDataAccess().PresenceDataCache().GrantRequestListSubscriptionItemLC();
+    // clean out temporary lists
+    subItem.Clean();
+    switch ( iMyType )
+        {
+        case NPresenceOps::EPrHandlePresenceGrantRequestList:
+            {
+            MXIMPBase* object = NULL;
+            iObjCollection->GetByType( object, MXIMPObjectCollection::KInterfaceId );
+            if( object )
+                {
+                CXIMPObjectCollectionImp* objectCollection = 
+                        TXIMPGetImpClassOrPanic< CXIMPObjectCollectionImp >::From( *object );
+                CleanupStack::PushL( objectCollection );
+                TLinearOrder< CPresenceGrantRequestInfoImp > order( CPresenceGrantRequestInfoImp::IdLinearOrder );
+                TXIMPObjectMover< MPresenceGrantRequestInfo, CPresenceGrantRequestInfoImp >::
+                                            MoveFromCollectionToArrayL( *objectCollection, *iGrantReqList, order );
+                CleanupStack::PopAndDestroy( objectCollection );        
+                }
+            else
+                {
+                User::Leave( KErrArgument );
+                }
+            subItem.SetNewListL( iGrantReqList );
+            iGrantReqList = NULL;
+            // ownership was transferred            
+            break;
+            }
+
+        case NPresenceOps::EPrHandlePresenceGrantRequestReceived:
+            {
+            MXIMPBase* object = NULL;
+            iObjCollection->GetByType( object, MPresenceGrantRequestInfo::KInterfaceId );
+            if( object )
+                {
+                iReceivedReq = 
+                    TXIMPGetImpClassOrPanic< CPresenceGrantRequestInfoImp >::From( *object );
+                }
+            else
+                {
+                User::Leave( KErrArgument );
+                }            
+            subItem.SetReceivedRequestL( iReceivedReq );
+            iReceivedReq = NULL; // ownership was transferred
+            break;
+            }
+
+        case NPresenceOps::EPrHandlePresenceGrantRequestObsoleted:
+            {
+            MXIMPBase* object = NULL;
+            iObjCollection->GetByType( object, MXIMPIdentity::KInterfaceId );
+            if( object )
+                {
+                iObsoletedId = TXIMPGetImpClassOrPanic< CXIMPIdentityImp >::From( *object );
+                }
+            else
+                {
+                User::Leave( KErrArgument );
+                }            
+            subItem.SetObsoletedRequestL( iObsoletedId );
+            iObsoletedId = NULL; // ownership was transferred
+            break;
+            }
+
+        XIMP_DEFAULT_CASE_UNSUPPORTED( NXIMPPrivPanic::EInvalidOperationType );
+        }
+
+    // synthesize the event to all contexts
+    TRAPD( err, subItem.SynthesiseSubscriptionEventToAllCtxsL() );
+
+    CleanupStack::PopAndDestroy(); // subItem
+
+    err = KErrNone;
+    iMyHost->HandleAdaptationRequestCompleted( iReqId, err );
+    }
+
+// ---------------------------------------------------------------------------
+// COperationHandlePresenceGrantRequests::RequestCompleted()
+// ---------------------------------------------------------------------------
+//
+void COperationHandlePresenceGrantRequests::RequestCompletedL()
+    {
+    TRACE(_L("COperationHandlePresenceGrantRequests::RequestCompletedL()" ) );
+    CXIMPOperationBase::RequestCompletedL();
+
+    // no special handling for error situations
+    }
+
+
+// ---------------------------------------------------------------------------
+// COperationHandlePresenceGrantRequests::Type()
+// ---------------------------------------------------------------------------
+//
+TInt COperationHandlePresenceGrantRequests::Type() const
+    {
+    return iMyType;
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresenceoperations/presenceauthorization/operationhandlepresencegrantrequests.h	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  Handle presentity group list operations
+ *
+*/
+
+#ifndef CPSCOPERATIONHANDLEPRESENCEGRANTREQUESTS_H
+#define CPSCOPERATIONHANDLEPRESENCEGRANTREQUESTS_H
+
+
+#include <e32base.h>
+#include <ximpbase.h>
+
+#include "ximpoperationbase.h"
+#include "presencetypehelpers.h"
+#include "presenceoperationdefs.h"
+
+/**
+ * Handle presentity group related operations.
+ *
+ * @lib ximpoperations.lib
+ * @since S60 v4.0
+ */
+class COperationHandlePresenceGrantRequests : public CXIMPOperationBase
+    {
+
+    public:
+
+        IMPORT_C COperationHandlePresenceGrantRequests(
+                TInt aMyType );
+
+        void ConstructL( const TDesC8& aParamPck );
+
+        ~COperationHandlePresenceGrantRequests();
+
+    public: // from CXIMPOperationBase
+
+        void ProcessL();
+
+        void RequestCompletedL();
+
+        TInt Type() const;
+
+    private: // data
+
+        /**
+         * Array of group identities.
+         * Owned.
+         */
+        RPrGrntReqInfoImpArray* iGrantReqList;
+
+        /**
+         * Obsoleted
+         * Owned.
+         */
+        CXIMPIdentityImp* iObsoletedId;
+
+        /**
+         * Received request
+         * Owned.
+         */
+        CPresenceGrantRequestInfoImp* iReceivedReq;
+
+        /**
+         * This is an internal and polymorphic operation.
+         * The actual type will be defined by this variable,
+         * set during operation creation.
+         */
+        TInt iMyType;
+    };
+
+
+#endif // CPSCOPERATIONHANDLEPRESENCEGRANTREQUESTS_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresenceoperations/presenceauthorization/operationsubscribeblocklist.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  Presence block list subscribe operation
+ *
+*/
+
+#include <ximpprotocolconnection.h>
+#include <protocolpresenceauthorization.h>
+#include <protocolpresencefeatures.h>
+
+#include "operationsubscribeblocklist.h"
+#include "presencedatacacheimp.h"
+#include "ximppanics.h"
+#include "operationsynthesisesubscriptionevent.h"
+#include "ximphost.h"
+#include "ximpstatusimp.h"
+#include "ximppsccontextimp.h"
+#include "protocolpresencedatahostimp.h"
+
+#include "ximptrace.h"
+
+
+// ============================ MEMBER FUNCTIONS =============================
+
+// ---------------------------------------------------------------------------
+// COperationSubscribeBlockList::COperationSubscribeBlockList()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C COperationSubscribeBlockList::COperationSubscribeBlockList()
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// COperationSubscribeBlockList::~COperationSubscribeBlockList()
+// ---------------------------------------------------------------------------
+//
+COperationSubscribeBlockList::~COperationSubscribeBlockList()
+    {
+    if( iBlockList )
+        {
+        iBlockList->Close();
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// COperationSubscribeBlockList::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void COperationSubscribeBlockList::ConstructL( const TDesC8& /*aParamPck*/ )
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// COperationSubscribeBlockList::ProcessL()
+// ---------------------------------------------------------------------------
+//
+void COperationSubscribeBlockList::ProcessL()
+    {
+    TRACE(_L("COperationSubscribeBlockList::ProcessL()" ) );
+    CXIMPOperationBase::ProcessL();
+
+    CBlockListSubscriptionItem& subItem =
+                            iMyHost->PresenceDataAccess().PresenceDataCache().BlockListSubscriptionItemLC();
+    CleanupStack::Pop(); // subItem
+    iBlockList = &subItem;
+
+    iSubscriptionStatus = iBlockList->SubscriptionStatus( iContext );
+
+    MProtocolPresenceAuthorization& authorization = iMyHost->GetConnection().ProtocolPresenceFeatures().PresenceAuthorization();
+
+    switch( iSubscriptionStatus )
+        {
+        case CBlockListSubscriptionItem::ENotSubscribedAtAll:
+            {
+            authorization.DoSubscribePresenceBlockListL( iReqId );
+            break;
+            }
+
+        case CBlockListSubscriptionItem::ESubscribedForOtherCtxOnly:
+        case CBlockListSubscriptionItem::ESubscribedForCtxOnly:
+        case CBlockListSubscriptionItem::ESubscribedForCtxAndOthers:
+            {
+            iMyHost->FakeCompleteRequest( iReqId, KErrNone );
+            break;
+            }
+        
+        XIMP_DEFAULT_CASE_UNSUPPORTED( NXIMPPrivPanic::EInvalidSubscriptionStatus );
+        }
+    }
+
+
+// ---------------------------------------------------------------------------
+// COperationSubscribeBlockList::RequestCompleted()
+// ---------------------------------------------------------------------------
+//
+void COperationSubscribeBlockList::RequestCompletedL()
+    {
+    TRACE(_L("COperationSubscribeBlockList::RequestCompletedL()" ) );
+    CXIMPOperationBase::RequestCompletedL();
+
+    if( iStatusObj->ResultCode() == KErrNone )
+        {
+        switch( iSubscriptionStatus )
+            {
+            case CBlockListSubscriptionItem::ENotSubscribedAtAll:
+            case CBlockListSubscriptionItem::ESubscribedForOtherCtxOnly:
+                {
+                iBlockList->AddSubscriberL( iContext );
+                break;
+                }
+                
+            case CBlockListSubscriptionItem::ESubscribedForCtxOnly:
+            case CBlockListSubscriptionItem::ESubscribedForCtxAndOthers:
+                {
+                break;
+                }
+                
+            XIMP_DEFAULT_CASE_UNSUPPORTED( NXIMPPrivPanic::EInvalidSubscriptionStatus );
+            }
+        SynthesiseEventL();
+        }
+    }
+
+
+// ---------------------------------------------------------------------------
+// COperationSubscribeBlockList::Type()
+// ---------------------------------------------------------------------------
+//
+TInt
+    COperationSubscribeBlockList::Type() const
+    {
+    return NPresenceOps::EPrSubscribeBlockList;
+    }
+
+// ---------------------------------------------------------------------------
+// COperationSubscribeBlockList::SynthesiseEventL()
+// ---------------------------------------------------------------------------
+//
+void COperationSubscribeBlockList::SynthesiseEventL()
+    {
+    TBool force =
+    ( iSubscriptionStatus == CBlockListSubscriptionItem::ESubscribedForCtxOnly ||
+      iSubscriptionStatus == CBlockListSubscriptionItem::ESubscribedForCtxAndOthers ) ? ETrue : EFalse;
+
+    COperationSynthesiseSubscriptionEvent* synthOp =
+            new ( ELeave ) COperationSynthesiseSubscriptionEvent(
+                             COperationSynthesiseSubscriptionEvent::EPresenceBlockList,
+                             force );
+    CleanupStack::PushL( synthOp );
+    synthOp->BaseConstructL( TXIMPRequestId(), iContext );
+    iMyHost->AddNewOperationL( *synthOp );
+    CleanupStack::Pop( synthOp );
+    }
+
+
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresenceoperations/presenceauthorization/operationsubscribeblocklist.h	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  Presence block list subscribe operation
+ *
+*/
+
+#ifndef CPSCOPERATIONSUBSCRIBEBLOCKLIST_H
+#define CPSCOPERATIONSUBSCRIBEBLOCKLIST_H
+
+
+#include <e32base.h>
+
+#include "ximpbase.h"
+#include "ximpoperationbase.h"
+#include "blocklistsubscriptionitem.h"
+
+#include "presenceoperationdefs.h"
+
+class MXIMPHost;
+
+/**
+ * Presence grant request list subscribe operation.
+ *
+ * @lib ximpoperations.lib
+ * @since S60 v4.0
+ */
+class COperationSubscribeBlockList : public CXIMPOperationBase
+    {
+
+    public:
+
+        IMPORT_C COperationSubscribeBlockList();
+
+        void ConstructL( const TDesC8& aParamPck );
+
+        ~COperationSubscribeBlockList();
+
+
+    public: // from CXIMPOperationBase
+
+        void ProcessL();
+
+        void RequestCompletedL();
+
+        TInt Type() const;
+
+    private: // Helper methods
+
+        /**
+         * Synthesise event after completion
+         */
+        void SynthesiseEventL();
+
+    private: // data
+
+        /**
+         * Grant request list access.
+         */
+        CBlockListSubscriptionItem* iBlockList;
+
+        /**
+         * Subscription status
+         */
+        CBlockListSubscriptionItem::TSubscriptionStatus iSubscriptionStatus;
+    };
+
+
+#endif // CPSCOPERATIONSUBSCRIBEBLOCKLIST_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresenceoperations/presenceauthorization/operationsubscribegrantrequestlist.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  Presence grant request list subscribe operation
+ *
+*/
+
+
+#include <ximpprotocolconnection.h>
+#include <protocolpresenceauthorization.h>
+#include <protocolpresencefeatures.h>
+
+#include "operationsubscribegrantrequestlist.h"
+#include "presencedatacacheimp.h"
+#include "ximppanics.h"
+#include "operationsynthesisesubscriptionevent.h"
+#include "ximphost.h"
+#include "ximpstatusimp.h"
+#include "ximppsccontextimp.h"
+#include "protocolpresencedatahostimp.h"
+
+#include "ximptrace.h"
+// ============================ MEMBER FUNCTIONS =============================
+
+// ---------------------------------------------------------------------------
+// COperationSubscribeGrantRequestList::COperationSubscribeGrantRequestList()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C COperationSubscribeGrantRequestList::COperationSubscribeGrantRequestList()
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// COperationSubscribeGrantRequestList::~COperationSubscribeGrantRequestList()
+// ---------------------------------------------------------------------------
+//
+COperationSubscribeGrantRequestList::~COperationSubscribeGrantRequestList()
+    {
+    if( iGrantRequestList )
+        {
+        iGrantRequestList->Close();
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// COperationSubscribeGrantRequestList::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void COperationSubscribeGrantRequestList::ConstructL( const TDesC8& /*aParamPck*/ )
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// COperationSubscribeGrantRequestList::ProcessL()
+// ---------------------------------------------------------------------------
+//
+void COperationSubscribeGrantRequestList::ProcessL()
+    {
+    TRACE(_L("COperationSubscribeGrantRequestList::ProcessL()" ) );
+    CXIMPOperationBase::ProcessL();
+
+    CGrantRequestListSubscriptionItem& grantReqList =
+                            iMyHost->PresenceDataAccess().PresenceDataCache().GrantRequestListSubscriptionItemLC();
+    CleanupStack::Pop(); // grantReqList
+    iGrantRequestList = &grantReqList;
+
+    iSubscriptionStatus = iGrantRequestList->SubscriptionStatus( iContext );
+    MProtocolPresenceAuthorization& authorization = iMyHost->GetConnection().ProtocolPresenceFeatures().PresenceAuthorization();
+
+    switch( iSubscriptionStatus )
+        {
+        case CGrantRequestListSubscriptionItem::ENotSubscribedAtAll:
+            {
+            authorization.DoSubscribePresenceGrantRequestListL( iReqId );
+            break;
+            }
+        case CGrantRequestListSubscriptionItem::ESubscribedForOtherCtxOnly:
+        case CGrantRequestListSubscriptionItem::ESubscribedForCtxOnly:
+        case CGrantRequestListSubscriptionItem::ESubscribedForCtxAndOthers:
+            {
+            iMyHost->FakeCompleteRequest( iReqId, KErrNone );
+            break;
+            }
+
+        XIMP_DEFAULT_CASE_UNSUPPORTED( NXIMPPrivPanic::EInvalidSubscriptionStatus );            
+        }
+    }
+
+
+// ---------------------------------------------------------------------------
+// COperationSubscribeGrantRequestList::RequestCompleted()
+// ---------------------------------------------------------------------------
+//
+void COperationSubscribeGrantRequestList::RequestCompletedL()
+    {
+    TRACE(_L("COperationSubscribeGrantRequestList::RequestCompletedL()" ) );
+    CXIMPOperationBase::RequestCompletedL();
+
+    if( iStatusObj->ResultCode() == KErrNone )
+        {
+        switch( iSubscriptionStatus )
+            {
+            case CGrantRequestListSubscriptionItem::ENotSubscribedAtAll:
+            case CGrantRequestListSubscriptionItem::ESubscribedForOtherCtxOnly:
+                {
+                iGrantRequestList->AddSubscriberL( iContext );
+                break;
+                }
+            case CGrantRequestListSubscriptionItem::ESubscribedForCtxOnly:
+            case CGrantRequestListSubscriptionItem::ESubscribedForCtxAndOthers:
+                {
+                break;
+                }
+
+            XIMP_DEFAULT_CASE_UNSUPPORTED( NXIMPPrivPanic::EInvalidSubscriptionStatus );
+            }
+
+        SynthesiseEventL();
+        }
+    }
+
+
+// ---------------------------------------------------------------------------
+// COperationSubscribeGrantRequestList::Type()
+// ---------------------------------------------------------------------------
+//
+TInt
+    COperationSubscribeGrantRequestList::Type() const
+    {
+    return NPresenceOps::EPrSubscribePresenceGrantRequestList;
+    }
+
+// ---------------------------------------------------------------------------
+// COperationSubscribeGrantRequestList::SynthesiseEventL()
+// ---------------------------------------------------------------------------
+//
+void COperationSubscribeGrantRequestList::SynthesiseEventL()
+    {
+    TBool force =
+    ( iSubscriptionStatus == CGrantRequestListSubscriptionItem::ESubscribedForCtxOnly ||
+      iSubscriptionStatus == CGrantRequestListSubscriptionItem::ESubscribedForCtxAndOthers ) ? ETrue : EFalse;
+
+    COperationSynthesiseSubscriptionEvent* synthOp =
+            new ( ELeave ) COperationSynthesiseSubscriptionEvent(
+                             COperationSynthesiseSubscriptionEvent::EPresenceGrantRequestList,
+                             force );
+    CleanupStack::PushL( synthOp );
+    synthOp->BaseConstructL( TXIMPRequestId(), iContext );
+    iMyHost->AddNewOperationL( *synthOp );
+    CleanupStack::Pop( synthOp );
+    }
+
+
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresenceoperations/presenceauthorization/operationsubscribegrantrequestlist.h	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  Presence grant request list subscribe operation
+ *
+*/
+
+#ifndef CPSCOPERATIONSUBSCRIBEGRANTREQUESTLIST_H
+#define CPSCOPERATIONSUBSCRIBEGRANTREQUESTLIST_H
+
+
+#include <e32base.h>
+#include <ximpbase.h>
+
+#include "ximpoperationbase.h"
+#include "grantrequestlistsubscriptionitem.h"
+#include "presenceoperationdefs.h"
+
+/**
+ * Presence grant request list subscribe operation.
+ *
+ * @lib ximpoperations.lib
+ * @since S60 v4.0
+ */
+class COperationSubscribeGrantRequestList : public CXIMPOperationBase
+    {
+
+    public:
+
+        IMPORT_C COperationSubscribeGrantRequestList();
+
+        void ConstructL( const TDesC8& aParamPck );
+
+        ~COperationSubscribeGrantRequestList();
+
+
+    public: // from CXIMPOperationBase
+
+        void ProcessL();
+
+        void RequestCompletedL();
+
+        TInt Type() const;
+
+    private: // Helper methods
+
+        /**
+         * Synthesise event after completion
+         */
+        void SynthesiseEventL();
+
+    private: // data
+
+        /**
+         * Grant request list access.
+         */
+        CGrantRequestListSubscriptionItem* iGrantRequestList;
+
+        /**
+         * Subscription status
+         */
+        CGrantRequestListSubscriptionItem::TSubscriptionStatus iSubscriptionStatus;
+    };
+
+
+#endif // CPSCOPERATIONSUBSCRIBEGRANTREQUESTLIST_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresenceoperations/presenceauthorization/operationunsubscribeblocklist.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  Presence block list unsubscription operation
+ *
+*/
+
+
+#include <ximpprotocolconnection.h>
+#include <protocolpresenceauthorization.h>
+#include <protocolpresencefeatures.h>
+
+#include "operationunsubscribeblocklist.h"
+#include "presencedatacacheimp.h"
+#include "ximppanics.h"
+#include "operationsynthesisesubscriptionevent.h"
+#include "ximphost.h"
+#include "ximpstatusimp.h"
+#include "ximppsccontextimp.h"
+#include "protocolpresencedatahostimp.h"
+
+#include "ximptrace.h"
+
+// ============================ MEMBER FUNCTIONS =============================
+
+// ---------------------------------------------------------------------------
+// COperationUnsubscribeBlockList::COperationUnsubscribeBlockList()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C COperationUnsubscribeBlockList::COperationUnsubscribeBlockList()
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// COperationUnsubscribeBlockList::~COperationUnsubscribeBlockList()
+// ---------------------------------------------------------------------------
+//
+COperationUnsubscribeBlockList::~COperationUnsubscribeBlockList()
+    {
+    if( iBlockList )
+        {
+        iBlockList->Close();
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// COperationUnsubscribeBlockList::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void COperationUnsubscribeBlockList::ConstructL( const TDesC8& /*aParamPck*/ )
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// COperationUnsubscribeBlockList::ProcessL()
+// ---------------------------------------------------------------------------
+//
+void COperationUnsubscribeBlockList::ProcessL()
+    {
+    TRACE(_L("COperationUnsubscribeBlockList::ProcessL()" ) );
+    CXIMPOperationBase::ProcessL();
+
+    CBlockListSubscriptionItem& subItem =
+                            iMyHost->PresenceDataAccess().PresenceDataCache().BlockListSubscriptionItemLC();
+    CleanupStack::Pop(); // subItem
+    iBlockList = &subItem;
+
+    iSubscriptionStatus = iBlockList->SubscriptionStatus( iContext );
+
+    MProtocolPresenceAuthorization& authorization = iMyHost->GetConnection().ProtocolPresenceFeatures().PresenceAuthorization();
+
+
+    switch( iSubscriptionStatus )
+        {
+        case CBlockListSubscriptionItem::ESubscribedForCtxOnly:
+            {
+            authorization.DoUnsubscribePresenceBlockListL( iReqId );
+            break;
+            }
+            
+        case CBlockListSubscriptionItem::ESubscribedForCtxAndOthers:
+            {
+            iMyHost->FakeCompleteRequest( iReqId, KErrNone );
+            break;
+            }
+            
+        case CBlockListSubscriptionItem::ENotSubscribedAtAll:
+        case CBlockListSubscriptionItem::ESubscribedForOtherCtxOnly:
+            {
+            iMyHost->FakeCompleteRequest( iReqId, KErrNone );
+            break;
+            }
+            
+        XIMP_DEFAULT_CASE_UNSUPPORTED( NXIMPPrivPanic::EInvalidSubscriptionStatus );
+        }
+    }
+
+
+// ---------------------------------------------------------------------------
+// COperationUnsubscribeBlockList::RequestCompleted()
+// ---------------------------------------------------------------------------
+//
+void COperationUnsubscribeBlockList::RequestCompletedL()
+    {
+    TRACE(_L("COperationUnsubscribeBlockList::RequestCompletedL()" ) );
+    CXIMPOperationBase::RequestCompletedL();
+
+    if( iStatusObj->ResultCode() == KErrNone )
+        {
+        switch( iSubscriptionStatus )
+            {
+            case CBlockListSubscriptionItem::ESubscribedForCtxOnly:
+            case CBlockListSubscriptionItem::ESubscribedForCtxAndOthers:
+                {
+                iBlockList->RemoveSubscriber( iContext );
+                break;
+                }
+            case CBlockListSubscriptionItem::ENotSubscribedAtAll:
+            case CBlockListSubscriptionItem::ESubscribedForOtherCtxOnly:
+                {
+                break;
+                }
+                
+            XIMP_DEFAULT_CASE_UNSUPPORTED( NXIMPPrivPanic::EInvalidSubscriptionStatus );                
+            }
+        SynthesiseEventL();
+        }
+    }
+
+
+// ---------------------------------------------------------------------------
+// COperationUnsubscribeBlockList::Type()
+// ---------------------------------------------------------------------------
+//
+TInt
+    COperationUnsubscribeBlockList::Type() const
+    {
+    return NPresenceOps::EPrUnsubscribeBlockList;
+    }
+
+// ---------------------------------------------------------------------------
+// COperationUnsubscribeBlockList::SynthesiseEventL()
+// ---------------------------------------------------------------------------
+//
+void COperationUnsubscribeBlockList::SynthesiseEventL()
+    {
+    COperationSynthesiseSubscriptionEvent* synthOp =
+            new ( ELeave ) COperationSynthesiseSubscriptionEvent(
+                COperationSynthesiseSubscriptionEvent::EPresenceBlockList,
+                EFalse );
+    CleanupStack::PushL( synthOp );
+    synthOp->BaseConstructL( TXIMPRequestId(), iContext );
+    iMyHost->AddNewOperationL( *synthOp );
+    CleanupStack::Pop( synthOp );
+    }
+
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresenceoperations/presenceauthorization/operationunsubscribeblocklist.h	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  Presence block list unsubscription operation
+ *
+*/
+
+#ifndef CPSCOPERATIONUNSUBSCRIBEBLOCKLIST_H
+#define CPSCOPERATIONUNSUBSCRIBEBLOCKLIST_H
+
+
+#include <e32base.h>
+
+#include "ximpbase.h"
+#include "ximpoperationbase.h"
+#include "blocklistsubscriptionitem.h"
+
+#include "presenceoperationdefs.h"
+
+class MXIMPHost;
+
+/**
+ * Presence grant request list unsubscribe operation.
+ *
+ * @lib ximpoperations.lib
+ * @since S60 v4.0
+ */
+class COperationUnsubscribeBlockList : public CXIMPOperationBase
+    {
+    public:
+
+        IMPORT_C COperationUnsubscribeBlockList();
+
+        void ConstructL( const TDesC8& aParamPck );
+
+        ~COperationUnsubscribeBlockList();
+
+
+    public: // from CXIMPOperationBase
+
+        void ProcessL();
+
+        void RequestCompletedL();
+
+        TInt Type() const;
+
+    private: // Helper methods
+
+        /**
+         * Synthesise event after completion
+         */
+        void SynthesiseEventL();
+
+    private: // data
+
+        /**
+         * Group list access.
+         */
+        CBlockListSubscriptionItem* iBlockList;
+
+        /**
+         * Subscription status
+         */
+        CBlockListSubscriptionItem::TSubscriptionStatus iSubscriptionStatus;
+    };
+
+
+#endif // CPSCOPERATIONUNSUBSCRIBEBLOCKLIST_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresenceoperations/presenceauthorization/operationunsubscribegrantrequestlist.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  Presence grant request list unsubscription operation
+ *
+*/
+
+
+#include <ximpprotocolconnection.h>
+#include <protocolpresenceauthorization.h>
+#include <protocolpresencefeatures.h>
+
+#include "operationunsubscribegrantrequestlist.h"
+#include "presencedatacacheimp.h"
+#include "ximppanics.h"
+#include "operationsynthesisesubscriptionevent.h"
+#include "ximphost.h"
+#include "ximpstatusimp.h"
+#include "ximppsccontextimp.h"
+#include "protocolpresencedatahostimp.h"
+
+#include "ximptrace.h"
+// ============================ MEMBER FUNCTIONS =============================
+
+// ---------------------------------------------------------------------------
+// COperationUnsubscribeGrantRequestList::COperationUnsubscribeGrantRequestList()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C COperationUnsubscribeGrantRequestList::COperationUnsubscribeGrantRequestList()
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// COperationUnsubscribeGrantRequestList::~COperationUnsubscribeGrantRequestList()
+// ---------------------------------------------------------------------------
+//
+COperationUnsubscribeGrantRequestList::~COperationUnsubscribeGrantRequestList()
+    {
+    if( iGrantRequestList )
+        {
+        iGrantRequestList->Close();
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// COperationUnsubscribeGrantRequestList::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void COperationUnsubscribeGrantRequestList::ConstructL( const TDesC8& /*aParamPck*/ )
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// COperationUnsubscribeGrantRequestList::ProcessL()
+// ---------------------------------------------------------------------------
+//
+void COperationUnsubscribeGrantRequestList::ProcessL()
+    {
+    TRACE(_L("COperationUnsubscribeGrantRequestList::ProcessL()" ) );
+    CXIMPOperationBase::ProcessL();
+
+    CGrantRequestListSubscriptionItem& grantReqList =
+                            iMyHost->PresenceDataAccess().PresenceDataCache().GrantRequestListSubscriptionItemLC();
+    CleanupStack::Pop(); // grantReqList
+    iGrantRequestList = &grantReqList;
+
+    iSubscriptionStatus = iGrantRequestList->SubscriptionStatus( iContext );
+
+    MProtocolPresenceAuthorization& authorization = iMyHost->GetConnection().ProtocolPresenceFeatures().PresenceAuthorization();
+
+    switch( iSubscriptionStatus )
+        {
+        case CGrantRequestListSubscriptionItem::ESubscribedForCtxOnly:
+            {
+            authorization.DoUnsubscribePresenceGrantRequestListL( iReqId );
+            break;
+            }
+
+        case CGrantRequestListSubscriptionItem::ESubscribedForCtxAndOthers:
+            {
+            iMyHost->FakeCompleteRequest( iReqId, KErrNone );
+            break;
+            }
+
+        case CGrantRequestListSubscriptionItem::ENotSubscribedAtAll:
+        case CGrantRequestListSubscriptionItem::ESubscribedForOtherCtxOnly:
+            {
+            iMyHost->FakeCompleteRequest( iReqId, KErrNone );
+            break;
+            }
+
+        XIMP_DEFAULT_CASE_UNSUPPORTED( NXIMPPrivPanic::EInvalidSubscriptionStatus );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// COperationUnsubscribeGrantRequestList::RequestCompleted()
+// ---------------------------------------------------------------------------
+//
+void COperationUnsubscribeGrantRequestList::RequestCompletedL()
+    {
+    TRACE(_L("COperationUnsubscribeGrantRequestList::RequestCompletedL()" ) );
+    CXIMPOperationBase::RequestCompletedL();
+
+    if( iStatusObj->ResultCode() == KErrNone )
+        {
+        switch( iSubscriptionStatus )
+            {
+            case CGrantRequestListSubscriptionItem::ESubscribedForCtxOnly:
+            case CGrantRequestListSubscriptionItem::ESubscribedForCtxAndOthers:
+                {
+                iGrantRequestList->RemoveSubscriber( iContext );
+                break;
+                }
+            case CGrantRequestListSubscriptionItem::ENotSubscribedAtAll:
+            case CGrantRequestListSubscriptionItem::ESubscribedForOtherCtxOnly:
+                {
+                break;
+                }
+
+            XIMP_DEFAULT_CASE_UNSUPPORTED( NXIMPPrivPanic::EInvalidSubscriptionStatus );
+            }
+        SynthesiseEventL();
+        }
+    }
+
+
+// ---------------------------------------------------------------------------
+// COperationUnsubscribeGrantRequestList::Type()
+// ---------------------------------------------------------------------------
+//
+TInt
+    COperationUnsubscribeGrantRequestList::Type() const
+    {
+    return NPresenceOps::EPrUnsubscribePresenceGrantRequestList;
+    }
+
+// ---------------------------------------------------------------------------
+// COperationUnsubscribeGrantRequestList::SynthesiseEventL()
+// ---------------------------------------------------------------------------
+//
+void COperationUnsubscribeGrantRequestList::SynthesiseEventL()
+    {
+    COperationSynthesiseSubscriptionEvent* synthOp =
+            new ( ELeave ) COperationSynthesiseSubscriptionEvent(
+                COperationSynthesiseSubscriptionEvent::EPresenceGrantRequestList,
+                EFalse );
+    CleanupStack::PushL( synthOp );
+    synthOp->BaseConstructL( TXIMPRequestId(), iContext );
+    iMyHost->AddNewOperationL( *synthOp );
+    CleanupStack::Pop( synthOp );
+    }
+
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresenceoperations/presenceauthorization/operationunsubscribegrantrequestlist.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,75 @@
+/*
+* 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 grant request list unsubscription operation
+ *
+*/
+
+#ifndef CPSCOPERATIONUNSUBSCRIBEGRANTREQUESTLIST_H
+#define CPSCOPERATIONUNSUBSCRIBEGRANTREQUESTLIST_H
+
+
+#include <e32base.h>
+
+#include <ximpbase.h>
+#include "ximpoperationbase.h"
+#include "grantrequestlistsubscriptionitem.h"
+#include "presenceoperationdefs.h"
+
+/**
+ * Presence grant request list unsubscribe operation.
+ *
+ * @lib ximpoperations.lib
+ * @since S60 v4.0
+ */
+class COperationUnsubscribeGrantRequestList : public CXIMPOperationBase
+    {
+    public:
+
+        IMPORT_C COperationUnsubscribeGrantRequestList();
+
+        void ConstructL( const TDesC8& aParamPck );
+
+        ~COperationUnsubscribeGrantRequestList();
+
+
+    public: // from CXIMPOperationBase
+
+        void ProcessL();
+
+        void RequestCompletedL();
+
+        TInt Type() const;
+
+    private: // Helper methods
+
+        /**
+         * Synthesise event after completion
+         */
+        void SynthesiseEventL();
+
+    private: // data
+
+        /**
+         * Group list access.
+         */
+        CGrantRequestListSubscriptionItem* iGrantRequestList;
+
+        /**
+         * Subscription status
+         */
+        CGrantRequestListSubscriptionItem::TSubscriptionStatus iSubscriptionStatus;
+    };
+
+
+#endif // CPSCOPERATIONUNSUBSCRIBEGRANTREQUESTLIST_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresenceoperations/presenceauthorization/operationwithdrawpresencefromeveryone.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,185 @@
+/*
+* 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:  Withdraw presence from everyone
+ *
+*/
+
+
+#include <ximpprotocolconnection.h>
+#include <protocolpresenceauthorization.h>
+#include <protocolpresencefeatures.h>
+
+#include "operationwithdrawpresencefromeveryone.h"
+#include "ximpidentityimp.h"
+#include "ximpobjecthelpers.h"
+#include "presencedatacacheimp.h"
+#include "presenceinfofilterimp.h"
+#include "ximphost.h"
+#include "ximpstatusimp.h"
+#include "ximppsccontextimp.h"
+#include "ximppanics.h"
+#include "protocolpresencedatahostimp.h"
+
+#include "ximptrace.h"
+// ============================ MEMBER FUNCTIONS =============================
+
+// ---------------------------------------------------------------------------
+// COperationWithdrawPresenceFromEveryone::COperationWithdrawPresenceFromEveryone()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C COperationWithdrawPresenceFromEveryone::COperationWithdrawPresenceFromEveryone()
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// COperationWithdrawPresenceFromEveryone::~COperationWithdrawPresenceFromEveryone()
+// ---------------------------------------------------------------------------
+//
+COperationWithdrawPresenceFromEveryone::~COperationWithdrawPresenceFromEveryone()
+    {
+    if( iConfItem )
+        {
+        iConfItem->Close();
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// COperationWithdrawPresenceFromEveryone::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void COperationWithdrawPresenceFromEveryone::ConstructL( const TDesC8& /*aParamPck*/ )
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// COperationWithdrawPresenceFromEveryone::ProcessL()
+// ---------------------------------------------------------------------------
+//
+void COperationWithdrawPresenceFromEveryone::ProcessL()
+    {
+    TRACE(_L("COperationWithdrawPresenceFromEveryone::ProcessL()" ) );
+    CXIMPOperationBase::ProcessL();
+    
+    CPresenceToEveryoneConfigurationItem& confItem =
+                iMyHost->PresenceDataAccess().PresenceDataCache().PresenceToEveryoneConfigurationItemLC();
+    CleanupStack::Pop(); // subItem
+    iConfItem = &confItem;
+
+    iConfigurationStatus = iConfItem->ConfigurationStatus( iContext );
+
+    MProtocolPresenceAuthorization& authorization = iMyHost->GetConnection().ProtocolPresenceFeatures().PresenceAuthorization();
+
+    iContext->SetPresenceInfoFilterL( MXIMPPscContext::EGrantPresenceToEveryoneFilter,
+            NULL, NULL );
+
+    switch( iConfigurationStatus )
+        {
+        case CPresenceToEveryoneConfigurationItem::EConfiguredForCtxOnly:
+            {
+            authorization.DoWithdrawPresenceGrantFromEveryoneL( iReqId );
+            iConfItem->RemoveConfigurator( iContext );
+            break;
+            }
+
+        case CPresenceToEveryoneConfigurationItem::EConfiguredForCtxAndOthers:
+            {
+            CPresenceInfoFilterImp* pifWithoutCtx =
+                iConfItem->CollectConfigurationPifWithoutCtxL( iContext );
+            CleanupStack::PushL( pifWithoutCtx );
+
+            if ( iConfItem->ConfigurationPif().Contains( *pifWithoutCtx ) )
+                {
+                authorization.DoUpdatePresenceGrantPifForEveryoneL( *pifWithoutCtx, iReqId );
+                }
+            else
+                {
+                iMyHost->FakeCompleteRequest( iReqId, KErrNone );
+                }
+
+            CleanupStack::PopAndDestroy( pifWithoutCtx );
+            break;
+            }
+
+        case CPresenceToEveryoneConfigurationItem::ENotConfiguredAtAll:
+            {
+            // OPAA-73BCS8
+            authorization.DoWithdrawPresenceGrantFromEveryoneL( iReqId );
+            break;
+            }
+        case CPresenceToEveryoneConfigurationItem::EConfiguredForOtherCtxOnly:
+            {
+            iMyHost->FakeCompleteRequest( iReqId, KErrNone );
+            break;
+            }
+
+        XIMP_DEFAULT_CASE_UNSUPPORTED( NXIMPPrivPanic::EInvalidSubscriptionStatus );
+        }    
+    }
+
+// ---------------------------------------------------------------------------
+// COperationWithdrawPresenceFromEveryone::RequestCompleted()
+// ---------------------------------------------------------------------------
+//
+void COperationWithdrawPresenceFromEveryone::RequestCompletedL()
+    {
+    TRACE(_L("COperationWithdrawPresenceFromEveryone::RequestCompletedL()" ) );
+    CXIMPOperationBase::RequestCompletedL();
+
+    if( iStatusObj->ResultCode() == KErrNone )
+        {
+        switch( iConfigurationStatus )
+            {
+            case CPresenceToEveryoneConfigurationItem::EConfiguredForCtxOnly:
+            case CPresenceToEveryoneConfigurationItem::EConfiguredForCtxAndOthers:
+                {
+                iConfItem->RemoveConfigurator( iContext );
+                break;
+                }
+            
+            case CPresenceToEveryoneConfigurationItem::ENotConfiguredAtAll:
+            case CPresenceToEveryoneConfigurationItem::EConfiguredForOtherCtxOnly:
+                {
+                break;
+                }
+            
+            XIMP_DEFAULT_CASE_UNSUPPORTED( NXIMPPrivPanic::EInvalidSubscriptionStatus );
+            }
+        SynthesiseEventL();
+        }     
+    }
+
+
+// ---------------------------------------------------------------------------
+// COperationWithdrawPresenceFromEveryone::Type()
+// ---------------------------------------------------------------------------
+//
+TInt 
+    COperationWithdrawPresenceFromEveryone::Type() const
+    {
+    return NPresenceOps::EPrWithdrawPresenceFromEveryone;
+    }
+
+// ---------------------------------------------------------------------------
+// COperationWithdrawPresenceFromEveryone::SynthesiseEventL()
+// ---------------------------------------------------------------------------
+//
+void COperationWithdrawPresenceFromEveryone::SynthesiseEventL()
+    {   
+    }
+
+
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresenceoperations/presenceauthorization/operationwithdrawpresencefromeveryone.h	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  Withdraw presence from everyone
+ *
+*/
+
+#ifndef CPSCOPERATIONWITHDRAWPRESENCEFROMEVERYONE_H
+#define CPSCOPERATIONWITHDRAWPRESENCEFROMEVERYONE_H
+
+
+#include <e32base.h>
+#include <ximpbase.h>
+
+#include "ximpoperationbase.h"
+#include "presencetoeveryoneconfigurationitem.h"
+#include "presenceoperationdefs.h"
+
+/**
+ * Withdraw presence from everyone
+ *
+ * @lib ximpoperations.lib
+ * @since S60 v4.0
+ */
+class COperationWithdrawPresenceFromEveryone : public CXIMPOperationBase
+    {
+
+    public:
+
+        IMPORT_C COperationWithdrawPresenceFromEveryone();
+
+        void ConstructL( const TDesC8& aParamPck );
+
+        ~COperationWithdrawPresenceFromEveryone();
+
+
+    public: // from CXIMPOperationBase
+
+        void ProcessL();
+
+        void RequestCompletedL();
+
+        TInt Type() const;
+        
+    private: // Helper methods
+    
+        /**
+         * Synthesise event after completion
+         */
+        void SynthesiseEventL();      
+
+    private: // data
+
+        /**
+         * Presence configuration item
+         * Own.
+         */
+        CPresenceToEveryoneConfigurationItem* iConfItem;
+
+        /**
+         * Subscription status
+         */
+        CPresenceToEveryoneConfigurationItem::TConfigurationStatus iConfigurationStatus;
+
+    };
+
+
+#endif // CPSCOPERATIONWITHDRAWPRESENCEFROMEVERYONE_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresenceoperations/presenceauthorization/operationwithdrawpresencefrompresentity.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,191 @@
+/*
+* 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:  Withdraw presence from presentity
+ *
+*/
+
+
+#include <ximpprotocolconnection.h>
+#include <protocolpresenceauthorization.h>
+#include <protocolpresencefeatures.h>
+
+#include "operationwithdrawpresencefrompresentity.h"
+#include "ximpidentityimp.h"
+#include "ximpobjecthelpers.h"
+#include "presencedatacacheimp.h"
+#include "presenceinfofilterimp.h"
+#include "ximphost.h"
+#include "ximpstatusimp.h"
+#include "ximppsccontextimp.h"
+#include "ximppanics.h"
+#include "protocolpresencedatahostimp.h"
+
+#include "ximptrace.h"
+
+// ============================ MEMBER FUNCTIONS =============================
+
+// ---------------------------------------------------------------------------
+// COperationWithdrawPresenceFromPresentity::COperationWithdrawPresenceFromPresentity()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C COperationWithdrawPresenceFromPresentity::COperationWithdrawPresenceFromPresentity()
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// COperationWithdrawPresenceFromPresentity::~COperationWithdrawPresenceFromPresentity()
+// ---------------------------------------------------------------------------
+//
+COperationWithdrawPresenceFromPresentity::~COperationWithdrawPresenceFromPresentity()
+    {
+    delete iIdentity;
+    
+    if( iConfItem )
+        {
+        iConfItem->Close();
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// COperationWithdrawPresenceFromPresentity::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void COperationWithdrawPresenceFromPresentity::ConstructL( const TDesC8& aParamPck )
+    {
+    iIdentity = CXIMPIdentityImp::NewLC();
+    CleanupStack::Pop( iIdentity );
+    TXIMPObjectPacker< CXIMPIdentityImp >::UnPackL( *iIdentity, aParamPck );    
+    }
+
+
+// ---------------------------------------------------------------------------
+// COperationWithdrawPresenceFromPresentity::ProcessL()
+// ---------------------------------------------------------------------------
+//
+void COperationWithdrawPresenceFromPresentity::ProcessL()
+    {
+    TRACE(_L("COperationWithdrawPresenceFromPresentity::ProcessL()" ) );
+    CXIMPOperationBase::ProcessL();
+    
+    CPresenceConfigurationItem& confItem =
+                iMyHost->PresenceDataAccess().PresenceDataCache().PresenceConfigurationItemLC( *iIdentity );
+    CleanupStack::Pop(); // subItem
+    iConfItem = &confItem;
+
+    iConfigurationStatus = iConfItem->ConfigurationStatus( iContext );
+
+    MProtocolPresenceAuthorization& authorization = iMyHost->GetConnection().ProtocolPresenceFeatures().PresenceAuthorization();
+
+    iContext->SetPresenceInfoFilterL( MXIMPPscContext::EGrantPresenceToPresentityFilter,
+            NULL, iIdentity );
+
+    switch( iConfigurationStatus )
+        {
+        case CPresenceConfigurationItem::EConfiguredForCtxOnly:
+            {
+            authorization.DoWithdrawPresenceGrantFromPresentityL( *iIdentity, iReqId );
+            iConfItem->RemoveConfigurator( iContext );
+            break;
+            }
+
+        case CPresenceConfigurationItem::EConfiguredForCtxAndOthers:
+            {
+            CPresenceInfoFilterImp* pifWithoutCtx =
+                iConfItem->CollectConfigurationPifWithoutCtxL( iContext );
+            CleanupStack::PushL( pifWithoutCtx );
+
+            if ( iConfItem->ConfigurationPif().Contains( *pifWithoutCtx ) )
+                {
+                authorization.DoUpdatePresenceGrantPifForPresentityL( *iIdentity, *pifWithoutCtx, iReqId );
+                }
+            else
+                {
+                iMyHost->FakeCompleteRequest( iReqId, KErrNone );
+                }
+
+            CleanupStack::PopAndDestroy( pifWithoutCtx );
+            break;
+            }
+
+        case CPresenceConfigurationItem::ENotConfiguredAtAll:
+            {
+            // OPAA-73BCS8
+            authorization.DoWithdrawPresenceGrantFromPresentityL( *iIdentity, iReqId );
+            break;
+            }
+        case CPresenceConfigurationItem::EConfiguredForOtherCtxOnly:
+            {
+            iMyHost->FakeCompleteRequest( iReqId, KErrNone );
+            break;
+            }
+            
+        XIMP_DEFAULT_CASE_UNSUPPORTED( NXIMPPrivPanic::EInvalidSubscriptionStatus );            
+        }    
+    }
+
+// ---------------------------------------------------------------------------
+// COperationWithdrawPresenceFromPresentity::RequestCompleted()
+// ---------------------------------------------------------------------------
+//
+void COperationWithdrawPresenceFromPresentity::RequestCompletedL()
+    {
+    TRACE(_L("COperationWithdrawPresenceFromPresentity::RequestCompletedL()" ) );
+    CXIMPOperationBase::RequestCompletedL();
+
+    if( iStatusObj->ResultCode() == KErrNone )
+        {
+        switch( iConfigurationStatus )
+            {
+            case CPresenceConfigurationItem::EConfiguredForCtxOnly:
+            case CPresenceConfigurationItem::EConfiguredForCtxAndOthers:
+                {
+                iConfItem->RemoveConfigurator( iContext );
+                break;
+                }
+                
+            case CPresenceConfigurationItem::ENotConfiguredAtAll:
+            case CPresenceConfigurationItem::EConfiguredForOtherCtxOnly:
+                {
+                break;
+                }
+                
+            XIMP_DEFAULT_CASE_UNSUPPORTED( NXIMPPrivPanic::EInvalidSubscriptionStatus );
+            }
+        SynthesiseEventL();
+        }     
+    }
+
+
+// ---------------------------------------------------------------------------
+// COperationWithdrawPresenceFromPresentity::Type()
+// ---------------------------------------------------------------------------
+//
+TInt 
+    COperationWithdrawPresenceFromPresentity::Type() const
+    {
+    return NPresenceOps::EPrWithdrawPresenceFromPresentity;
+    }
+
+// ---------------------------------------------------------------------------
+// COperationWithdrawPresenceFromPresentity::SynthesiseEventL()
+// ---------------------------------------------------------------------------
+//
+void COperationWithdrawPresenceFromPresentity::SynthesiseEventL()
+    {   
+    }
+
+
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresenceoperations/presenceauthorization/operationwithdrawpresencefrompresentity.h	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  Withdraw presence from presentity
+ *
+*/
+
+#ifndef CPSCOPERATIONWITHDRAWPRESENCEFROMPRESENTITY_H
+#define CPSCOPERATIONWITHDRAWPRESENCEFROMPRESENTITY_H
+
+
+#include <e32base.h>
+#include <ximpbase.h>
+
+#include "ximpoperationbase.h"
+#include "presenceconfigurationitem.h"
+#include "presenceoperationdefs.h"
+
+/**
+ * Withdraw presence from presentity
+ *
+ * @lib ximpoperations.lib
+ * @since S60 v4.0
+ */
+class COperationWithdrawPresenceFromPresentity : public CXIMPOperationBase
+    {
+
+    public:
+
+        IMPORT_C COperationWithdrawPresenceFromPresentity();
+
+        void ConstructL( const TDesC8& aParamPck );
+
+        ~COperationWithdrawPresenceFromPresentity();
+
+
+    public: // from CXIMPOperationBase
+
+        void ProcessL();
+
+        void RequestCompletedL();
+
+        TInt Type() const;
+        
+    private: // Helper methods
+    
+        /**
+         * Synthesise event after completion
+         */
+        void SynthesiseEventL();      
+
+    private: // data
+
+        /**
+         * Identity 
+         */
+        CXIMPIdentityImp* iIdentity;
+
+        /**
+         * Presence configuration item
+         * Own.
+         */
+        CPresenceConfigurationItem* iConfItem;
+
+        /**
+         * Subscription status
+         */
+        CPresenceConfigurationItem::TConfigurationStatus iConfigurationStatus;
+
+    };
+
+
+#endif // CPSCOPERATIONWITHDRAWPRESENCEFROMPRESENTITY_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresenceoperations/presenceauthorization/operationwithdrawpresencefrompresentitygroupmembers.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,191 @@
+/*
+* 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:  Withdraw presence from presentity group members operation
+ *
+*/
+
+
+#include <ximpprotocolconnection.h>
+#include <protocolpresenceauthorization.h>
+#include <protocolpresencefeatures.h>
+
+#include "operationwithdrawpresencefrompresentitygroupmembers.h"
+#include "ximpidentityimp.h"
+#include "ximpobjecthelpers.h"
+#include "presencedatacacheimp.h"
+#include "presenceinfofilterimp.h"
+#include "ximphost.h"
+#include "ximpstatusimp.h"
+#include "ximppsccontextimp.h"
+#include "ximppanics.h"
+#include "protocolpresencedatahostimp.h"
+
+#include "ximptrace.h"
+// ============================ MEMBER FUNCTIONS =============================
+
+// ---------------------------------------------------------------------------
+// COperationWithdrawPresenceFromPresentityGroupMembers::COperationWithdrawPresenceFromPresentityGroupMembers()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C COperationWithdrawPresenceFromPresentityGroupMembers::COperationWithdrawPresenceFromPresentityGroupMembers()
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// COperationWithdrawPresenceFromPresentityGroupMembers::~COperationWithdrawPresenceFromPresentityGroupMembers()
+// ---------------------------------------------------------------------------
+//
+COperationWithdrawPresenceFromPresentityGroupMembers::~COperationWithdrawPresenceFromPresentityGroupMembers()
+    {
+    delete iGroupId;
+
+    if( iConfItem )
+        {
+        iConfItem->Close();
+        }    
+    }
+
+// ---------------------------------------------------------------------------
+// COperationWithdrawPresenceFromPresentityGroupMembers::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void COperationWithdrawPresenceFromPresentityGroupMembers::ConstructL( const TDesC8& aParamPck )
+    {
+    iGroupId = CXIMPIdentityImp::NewLC();
+    CleanupStack::Pop( iGroupId );
+    TXIMPObjectPacker< CXIMPIdentityImp >::UnPackL( *iGroupId, aParamPck );    
+    }
+
+
+// ---------------------------------------------------------------------------
+// COperationWithdrawPresenceFromPresentityGroupMembers::ProcessL()
+// ---------------------------------------------------------------------------
+//
+void COperationWithdrawPresenceFromPresentityGroupMembers::ProcessL()
+    {
+    TRACE(_L("COperationWithdrawPresenceFromPresentityGroupMembers::ProcessL()" ) );
+    CXIMPOperationBase::ProcessL();
+    
+    CGroupMembersPresenceConfigurationItem& confItem =
+                iMyHost->PresenceDataAccess().PresenceDataCache().GroupMembersPresenceConfigurationItemLC( *iGroupId );
+    CleanupStack::Pop(); // subItem
+    iConfItem = &confItem;
+
+    iConfigurationStatus = iConfItem->ConfigurationStatus( iContext );
+
+    MProtocolPresenceAuthorization& authorization = iMyHost->GetConnection().ProtocolPresenceFeatures().PresenceAuthorization();
+
+    iContext->SetPresenceInfoFilterL( MXIMPPscContext::EGrantPresenceToGroupMemberFilter,
+            NULL, iGroupId );
+
+    switch( iConfigurationStatus )
+        {
+        case CGroupMembersPresenceConfigurationItem::ESubscribedForCtxOnly:
+            {
+            authorization.DoWithdrawPresenceGrantFromPresentityGroupMembersL( *iGroupId, iReqId );
+            iConfItem->RemoveConfigurator( iContext );
+            break;
+            }
+
+        case CGroupMembersPresenceConfigurationItem::ESubscribedForCtxAndOthers:
+            {
+            CPresenceInfoFilterImp* pifWithoutCtx =
+                iConfItem->CollectConfigurationPifWithoutCtxL( iContext );
+            CleanupStack::PushL( pifWithoutCtx );
+
+            if ( iConfItem->ConfigurationPif().Contains( *pifWithoutCtx ) )
+                {
+                authorization.DoUpdatePresenceGrantPifForPresentityGroupMembersL( *iGroupId, *pifWithoutCtx, iReqId );
+                }
+            else
+                {
+                iMyHost->FakeCompleteRequest( iReqId, KErrNone );
+                }
+
+            CleanupStack::PopAndDestroy( pifWithoutCtx );
+            break;
+            }
+
+        case CGroupMembersPresenceConfigurationItem::ENotSubscribedAtAll:
+            {
+            // OPAA-73BCS8
+            authorization.DoWithdrawPresenceGrantFromPresentityGroupMembersL( *iGroupId, iReqId );
+            break;
+            }
+        case CGroupMembersPresenceConfigurationItem::ESubscribedForOtherCtxOnly:
+            {
+            iMyHost->FakeCompleteRequest( iReqId, KErrNone );
+            break;
+            }
+
+        XIMP_DEFAULT_CASE_UNSUPPORTED( NXIMPPrivPanic::EInvalidSubscriptionStatus );
+        }    
+    }
+
+
+// ---------------------------------------------------------------------------
+// COperationWithdrawPresenceFromPresentityGroupMembers::RequestCompleted()
+// ---------------------------------------------------------------------------
+//
+void COperationWithdrawPresenceFromPresentityGroupMembers::RequestCompletedL()
+    {
+    TRACE(_L("COperationWithdrawPresenceFromPresentityGroupMembers::RequestCompletedL()" ) );
+    CXIMPOperationBase::RequestCompletedL();
+
+    if( iStatusObj->ResultCode() == KErrNone )
+        {
+        switch( iConfigurationStatus )
+            {
+            case CGroupMembersPresenceConfigurationItem::ESubscribedForCtxOnly:
+            case CGroupMembersPresenceConfigurationItem::ESubscribedForCtxAndOthers:
+                {
+                iConfItem->RemoveConfigurator( iContext );
+                break;
+                }
+            
+            case CGroupMembersPresenceConfigurationItem::ENotSubscribedAtAll:
+            case CGroupMembersPresenceConfigurationItem::ESubscribedForOtherCtxOnly:
+                {
+                break;
+                }
+            
+            XIMP_DEFAULT_CASE_UNSUPPORTED( NXIMPPrivPanic::EInvalidSubscriptionStatus );
+            }
+        SynthesiseEventL();
+        }     
+    }
+
+
+// ---------------------------------------------------------------------------
+// COperationWithdrawPresenceFromPresentityGroupMembers::Type()
+// ---------------------------------------------------------------------------
+//
+TInt 
+    COperationWithdrawPresenceFromPresentityGroupMembers::Type() const
+    {
+    return NPresenceOps::EPrWithdrawPresenceFromPresentityGroupMembers;
+    }
+
+// ---------------------------------------------------------------------------
+// COperationWithdrawPresenceFromPresentityGroupMembers::SynthesiseEventL()
+// ---------------------------------------------------------------------------
+//
+void COperationWithdrawPresenceFromPresentityGroupMembers::SynthesiseEventL()
+    {   
+    }
+
+
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresenceoperations/presenceauthorization/operationwithdrawpresencefrompresentitygroupmembers.h	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  Withdraw presence from presentity group members operation
+ *
+*/
+
+#ifndef CPSCOPERATIONWITHDRAWPRESENCEFROMPRESENTITYGROUPMEMBERS_H
+#define CPSCOPERATIONWITHDRAWPRESENCEFROMPRESENTITYGROUPMEMBERS_H
+
+
+#include <e32base.h>
+#include <ximpbase.h>
+
+#include "ximpoperationbase.h"
+#include "groupmemberspresenceconfigurationitem.h"
+#include "presenceoperationdefs.h"
+
+/**
+ * Withdraw presence from presentity group members operation
+ *
+ * @lib ximpoperations.lib
+ * @since S60 v4.0
+ */
+class COperationWithdrawPresenceFromPresentityGroupMembers : public CXIMPOperationBase
+    {
+
+    public:
+
+        IMPORT_C COperationWithdrawPresenceFromPresentityGroupMembers();
+
+        void ConstructL( const TDesC8& aParamPck );
+
+        ~COperationWithdrawPresenceFromPresentityGroupMembers();
+
+
+    public: // from CXIMPOperationBase
+
+        void ProcessL();
+
+        void RequestCompletedL();
+
+        TInt Type() const;
+        
+    private: // Helper methods
+    
+        /**
+         * Synthesise event after completion
+         */
+        void SynthesiseEventL();      
+
+    private: // data
+
+        /**
+         * Identity 
+         */
+        CXIMPIdentityImp* iGroupId;
+        
+        /**
+         * Presence configuration item
+         * Own.
+         */
+        CGroupMembersPresenceConfigurationItem* iConfItem;
+
+        /**
+         * Configuration status
+         */
+        CGroupMembersPresenceConfigurationItem::TConfigurationStatus iConfigurationStatus;
+
+    };
+
+
+#endif // CPSCOPERATIONWITHDRAWPRESENCEFROMPRESENTITYGROUPMEMBERS_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresenceoperations/presenceoperationdefs.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,131 @@
+/*
+* 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:  XIMP framework presence operation definitions.
+ *
+*/
+
+#ifndef PRESENCEOPERATIONDEFS_H
+#define PRESENCEOPERATIONDEFS_H
+
+#include <e32std.h>
+
+// TODO: use ranges for operations types, that will make sure that
+// the core, presence and IM operations won't overlap
+
+/**
+ * PSC operations.
+ */
+namespace NPresenceOps
+    {
+    enum TPresenceOpTypes
+        {
+        // -----------------------------------------------
+        // From client
+        //
+        EPrPublishOwnPresence = 10,                    // 10
+        EPrSubscribeOwnPresence,                       // 11
+        EPrUnsubscribeOwnPresence,                     // 12
+
+        EPrSubscribeGroupList,                         // 13
+        EPrUnsubscribeGroupList,                       // 14
+
+        EPrCreatePresentityGroup,                      // 15
+
+        EPrSubscribePresentityPresence,                // 16
+        EPrUnsubscribePresentityPresence,              // 17
+
+        EPrDeletePresentityGroup,                      // 18
+        EPrUpdatePresentityGroupDisplayName,           // 19
+
+        EPrSubscribePresentityGroupContent,            // 20
+        EPrUnsubscribePresentityGroupContent,          // 21
+
+        EPrAddPresentityGroupMember,                   // 22
+        EPrRemovePresentityGroupMember,                // 23
+        EPrUpdatePresentityGroupMemberDisplayName,     // 24
+        EPrSynthesisePresenceSubscription,             // 25
+        EPrSubscribeGroupContent,                      // 26
+        EPrUnsubscribeGroupContent,                    // 27
+
+        EPrPresentityGroupChange,                      // 28
+        EPrPresentityGroupContentChange,               // 29
+
+        EPrSubscribePresenceWatcherList,               // 30
+        EPrUnsubscribePresenceWatcherList,             // 31
+
+        EPrSubscribePresentityGroupMembersPresence,    // 32
+        EPrUnsubscribePresentityGroupMembersPresence,  // 33
+
+        EPrSubscribePresenceGrantRequestList,          // 34
+        EPrUnsubscribePresenceGrantRequestList,        // 35
+
+        EPrGrantPresenceToPresentity,                  // 36
+        EPrWithdrawPresenceFromPresentity,             // 37
+        EPrGrantPresenceToPresentityGroupMembers,      // 38
+        EPrWithdrawPresenceFromPresentityGroupMembers, // 39
+        EPrGrantPresenceToEveryone,                    // 40
+        EPrWithdrawPresenceFromEveryone,               // 41
+
+        EPrSubscribeBlockList,                         // 42
+        EPrUnsubscribeBlockList,                       // 43
+        EPrBlockPresenceForPresentity,                 // 44
+        EPrCancelPresenceBlockFromPresentity,          // 45
+
+        // -----------------------------------------------
+        // From adaptation
+        //
+        EPrHandleOwnPresence = 50,                         // 50
+        EPrSetOwnPresenceDataSubscriptionState,            // 51
+        EPrHandlePresentityPresence,                       // 52
+        EPrSetPresentityPresenceDataSubscriptionState,     // 53
+        EPrHandlePresentityPresenceTerminated,             // 54
+        EPrHandlePresenceWatcherList,                      // 55
+        EPrSetPresenceWatcherListDataSubscriptionState,    // 56
+
+        // Following map internally to the same operation
+        EPrHandlePresenceGrantRequestList,                 // 57
+        EPrHandlePresenceGrantRequestReceived,             // 58
+        EPrHandlePresenceGrantRequestObsoleted,            // 59
+        EPrSetPresenceGrantRequestDataSubscriptionState,   // 60
+
+        // these map internally to the same operation
+        EPrHandlePresenceBlockList,                // 61
+        EPrHandlePresenceBlocked,                  // 62
+        EPrHandlePresenceBlockCanceled,            // 63
+        EPrSetPresenceBlockDataSubscriptionState,  // 64
+
+        // these map internally to the same operation
+        EPrHandlePresentityGroupList = 70,             // 70 - new list
+        EPrHandlePresentityGroupCreated,               // 71 - created/updated groups
+        EPrHandlePresentityGroupDeleted,               // 72 - deleted groups
+        EPrHandlePresentityGroupDisplayNameUpdated,    // 73 - display name updated
+        EPrSetPresentityGroupListDataSubscriptionState,// 74
+
+        EPrHandlePresentityGroupContent = 80,              // 80
+        EPrHandlePresentityGroupMemberAdded,               // 81
+        EPrHandlePresentityGroupMemberRemoved,             // 82
+        EPrHandlePresentityGroupMemberDisplayNameUpdated,  // 83
+        EPrSetPresentityGroupContentDataSubscriptionState,  // 84
+        
+        EXIMPCleaner = 90,                       // 90 - Internal operation for cleaning.
+
+        };
+    }
+
+#endif  //PRESENCEOPERATIONDEFS_H
+
+
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresenceoperations/presenceoperationfactoryimp.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,442 @@
+/*
+* 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 service operation factory
+ *
+*/
+
+
+#include "presenceoperationfactoryimp.h"
+#include "presenceoperationdefs.h"
+#include "operationpublishownpresence.h"
+#include "operationsubscribeownpresence.h"
+#include "operationunsubscribeownpresence.h"
+#include "operationhandleownpresence.h"
+#include "operationhandlepresentitygroups.h"
+#include "ximpoperationbase.h"
+#include "operationsubscribegrouplist.h"
+#include "operationunsubscribegrouplist.h"
+#include "operationcreatepresentitygroup.h"
+#include "operationsubscribepresentitypresence.h"
+#include "operationunsubscribepresentitypresence.h"
+#include "operationdeletepresentitygroup.h"
+#include "operationupdatepresentitygroupdisplayname.h"
+#include "operationhandlepresentitypresence.h"
+#include "operationsubscribegroupcontent.h"
+#include "operationunsubscribegroupcontent.h"
+#include "operationaddpresentitygroupmember.h"
+#include "operationremovepresentitygroupmember.h"
+#include "operationupdatepresentitygroupmemberdisplayname.h"
+#include "operationhandlepresentitygroupcontent.h"
+#include "operationhandlepresentitygroupmemberadded.h"
+#include "operationhandlepresentitygroupmemberremoved.h"
+#include "operationhandlepresentitygroupmemberdisplaynameupdated.h"
+#include "operationlaunchcleaner.h"
+#include "operationsubscribewatcherlist.h"
+#include "operationunsubscribewatcherlist.h"
+#include "operationhandlepresencewatcherlist.h"
+#include "operationsubscribepresentitygroupmemberspresence.h"
+#include "operationunsubscribepresentitygroupmemberspresence.h"
+#include "operationsubscribegrantrequestlist.h"
+#include "operationunsubscribegrantrequestlist.h"
+#include "operationhandlepresencegrantrequests.h"
+#include "operationgrantpresencetopresentity.h"
+#include "operationwithdrawpresencefrompresentity.h"
+#include "operationgrantpresencetopresentitygroupmembers.h"
+#include "operationwithdrawpresencefrompresentitygroupmembers.h"
+#include "operationsubscribeblocklist.h"
+#include "operationunsubscribeblocklist.h"
+#include "operationblockpresenceforpresentity.h"
+#include "operationcancelpresenceblockfrompresentity.h"
+#include "operationhandlepresenceblocking.h"
+#include "operationgrantpresencetoeveryone.h"
+#include "operationwithdrawpresencefromeveryone.h"
+#include "operationsetsubscriptiondata.h"
+#include "ximppanics.h"
+#include "ximptrace.h"
+
+using namespace NPresenceOps;
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CXIMPOperationFactory::NewL()
+// Singleton access method.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CPresenceOperationFactory* CPresenceOperationFactory::NewL()
+    {
+    CPresenceOperationFactory* self = new ( ELeave ) CPresenceOperationFactory();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CXIMPOperationFactory::CXIMPOperationFactory()
+// -----------------------------------------------------------------------------
+//
+CPresenceOperationFactory::CPresenceOperationFactory()
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CXIMPOperationFactory::~CXIMPOperationFactory()
+// -----------------------------------------------------------------------------
+//
+CPresenceOperationFactory::~CPresenceOperationFactory()
+    {
+    #if _BullseyeCoverage
+    cov_write();
+    #endif
+    }
+
+
+// -----------------------------------------------------------------------------
+// CXIMPOperationFactory::ConstructL()
+// -----------------------------------------------------------------------------
+//
+void CPresenceOperationFactory::ConstructL()
+    {
+    }
+
+
+// -----------------------------------------------------------------------------
+// CXIMPOperationFactory::CreateOperationL()
+// -----------------------------------------------------------------------------
+//
+CXIMPOperationBase* CPresenceOperationFactory::CreateOperationL( TInt aOperation )
+    {
+    CXIMPOperationBase* op = NULL;
+    NPresenceOps::TPresenceOpTypes operation = ( NPresenceOps::TPresenceOpTypes ) aOperation;
+    switch( aOperation )
+        {
+
+        case EPrPublishOwnPresence:
+            {
+            op = new ( ELeave ) COperationPublishOwnPresence();
+            TRACE( _L("Operation PublishOwnPresence created") );
+            break;
+            }
+
+        case EPrSubscribeOwnPresence:
+            {
+            op = new ( ELeave ) COperationSubscribeOwnPresence();
+            TRACE( _L("Operation SubscribeOwnPresence created") );
+            break;
+            }
+
+        case EPrUnsubscribeOwnPresence:
+            {
+            op = new ( ELeave ) COperationUnsubscribeOwnPresence();
+            TRACE( _L("Operation UnsubscribeOwnPresence created") );
+            break;
+            }
+
+        case EPrHandleOwnPresence:
+            {
+            op = new ( ELeave ) COperationHandleOwnPresence();
+            TRACE( _L("Operation HandleOwnPresence created") );
+            break;
+            }
+
+        case EPrSubscribeGroupList:
+            {
+            op = new ( ELeave ) COperationSubscribeGroupList();
+            TRACE( _L("Operation UnsubscribeOwnPresence created") );
+            break;
+            }
+
+        case EPrUnsubscribeGroupList:
+            {
+            op = new ( ELeave ) COperationUnsubscribeGroupList();
+            TRACE( _L("Operation SubscribeGroupList created") );
+            break;
+            }
+
+        case EPrCreatePresentityGroup:
+            {
+            op = new ( ELeave ) COperationCreatePresentityGroup();
+            TRACE( _L("Operation CreatePresentityGroup created") );
+            break;
+            }
+
+        case EPrDeletePresentityGroup:
+            {
+            op = new ( ELeave ) COperationDeletePresentityGroup();
+            TRACE( _L("Operation DeletePresentityGroup created") );
+            break;
+            }
+
+        case EPrUpdatePresentityGroupDisplayName:
+            {
+            op = new ( ELeave ) COperationUpdatePresentityGroupDisplayName();
+            TRACE( _L("Operation UpdatePresentityGroupDisplayName created") );
+            break;
+            }
+
+        case EPrSubscribePresentityGroupContent:
+            {
+            op = new ( ELeave ) COperationSubscribeGroupContent();
+            TRACE( _L("Operation SubscribeGroupContent created") );
+            break;
+            }
+
+        case EPrUnsubscribePresentityGroupContent:
+            {
+            op = new ( ELeave ) COperationUnsubscribeGroupContent();
+            TRACE( _L("Operation UnsubscribeGroupContent created") );
+            break;
+            }
+
+        case EPrAddPresentityGroupMember:
+            {
+            op = new ( ELeave ) COperationAddPresentityGroupMember();
+            TRACE( _L("Operation AddPresentityGroupMember created") );
+            break;
+            }
+
+        case EPrRemovePresentityGroupMember:
+            {
+            op = new ( ELeave ) COperationRemovePresentityGroupMember();
+            TRACE( _L("Operation RemovePresentityGroupMember created") );
+            break;
+            }
+
+        case EPrUpdatePresentityGroupMemberDisplayName:
+            {
+            op = new ( ELeave ) COperationUpdatePresentityGroupMemberDisplayName();
+            TRACE( _L("Operation UpdatePresentityGroupMemberDisplayName created") );
+            break;
+            }
+
+        case EPrSubscribePresentityPresence:
+            {
+            op = new ( ELeave ) COperationSubscribePresentityPresence();
+            TRACE( _L("Operation SubscribePresentityPresence created") );
+            break;
+            }
+
+        case EPrUnsubscribePresentityPresence:
+            {
+            op = new ( ELeave ) COperationUnsubscribePresentityPresence();
+            TRACE( _L("Operation UnsubscribePresentityPresence created") );
+            break;
+            }
+
+        case EPrSubscribePresenceWatcherList:
+            {
+            op = new ( ELeave ) COperationSubscribeWatcherList();
+            TRACE( _L("Operation SubscribeWatcherList created") );
+            break;
+            }
+        case EPrUnsubscribePresenceWatcherList:
+            {
+            op = new ( ELeave ) COperationUnsubscribeWatcherList();
+            TRACE( _L("Operation UnsubscribeWatcherList created") );
+            break;
+            }
+
+        case EPrHandlePresentityPresence: // Flowthrough
+        case EPrHandlePresentityPresenceTerminated:
+            {
+            op = new ( ELeave ) COperationHandlePresentityPresence( aOperation );
+            TRACE( _L("Operation HandlePresentityPresence created") );
+            break;
+            }
+
+        case EPrHandlePresenceWatcherList:
+            {
+            op = new ( ELeave ) COperationHandlePresenceWatcherList();
+            TRACE( _L("Operation HandlePresenceWatcherList created") );
+            break;
+            }
+
+        case EPrHandlePresentityGroupList:
+        case EPrHandlePresentityGroupCreated:
+        case EPrHandlePresentityGroupDeleted:
+        case EPrHandlePresentityGroupDisplayNameUpdated:        
+            {
+            op = new ( ELeave ) COperationHandlePresentityGroups( operation );
+            TRACE( _L("Operation HandlePresentityGroups created") );
+            break;
+            }
+
+        case EPrHandlePresentityGroupContent:
+            {
+            op = new ( ELeave ) COperationHandlePresentityGroupContent();
+            TRACE( _L("Operation HandlePresentityGroupContent created") );
+            break;
+            }
+
+        case EPrHandlePresentityGroupMemberAdded:
+            {
+            op = new ( ELeave ) COperationHandlePresentityGroupMemberAdded();
+            TRACE( _L("Operation HandlePresentityGroupMemberAdded created") );
+            break;
+            }
+
+        case EPrHandlePresentityGroupMemberRemoved:
+            {
+            op = new ( ELeave ) COperationHandlePresentityGroupMemberRemoved();
+            TRACE( _L("Operation HandlePresentityGroupMemberRemoved created") );
+            break;
+            }
+
+        case EPrHandlePresentityGroupMemberDisplayNameUpdated:
+            {
+            op = new ( ELeave ) COperationHandlePresentityGroupMemberDisplayNameUpdated();
+            TRACE( _L("Operation HandlePresentityGroupMemberDisplayNameUpdated created") );
+            break;
+            }
+
+        case EPrSubscribePresentityGroupMembersPresence:
+            {
+            op = new ( ELeave ) COperationSubscribePresentityGroupMembersPresence();
+            TRACE( _L("Operation SubscribePresentityGroupMembersPresence created") );
+            break;
+            }
+
+        case EPrUnsubscribePresentityGroupMembersPresence:
+            {
+            op = new ( ELeave ) COperationUnsubscribePresentityGroupMembersPresence();
+            TRACE( _L("Operation UnsubscribePresentityGroupMembersPresence created") );
+            break;
+            }
+
+        case EPrSubscribePresenceGrantRequestList:
+            {
+            op = new ( ELeave ) COperationSubscribeGrantRequestList();
+            TRACE( _L("Operation SubscribeGrantRequestList created") );
+            break;
+            }
+
+        case EPrUnsubscribePresenceGrantRequestList:
+            {
+            op = new ( ELeave ) COperationUnsubscribeGrantRequestList();
+            TRACE( _L("Operation UnsubscribeGrantRequestList created") );
+            break;
+            }
+
+        case EPrHandlePresenceGrantRequestList:
+        case EPrHandlePresenceGrantRequestReceived:
+        case EPrHandlePresenceGrantRequestObsoleted:
+            {
+            op = new ( ELeave ) COperationHandlePresenceGrantRequests( operation );
+            TRACE( _L("Operation HandlePresenceGrantRequests created") );
+            break;
+            }
+        case EPrGrantPresenceToPresentity:
+            {
+            op = new ( ELeave ) COperationGrantPresenceToPresentity();
+            TRACE( _L("Operation GrantPresenceToPresentity created") );
+            break;
+            }
+        case EPrWithdrawPresenceFromPresentity:
+            {
+            op = new ( ELeave ) COperationWithdrawPresenceFromPresentity();
+            TRACE( _L("Operation WithdrawPresenceFromPresentity created") );
+            break;
+            }
+        case EPrGrantPresenceToPresentityGroupMembers:
+            {
+            op = new ( ELeave ) COperationGrantPresenceToPresentityGroupMembers();
+            TRACE( _L("Operation GrantPresenceToPresentityGroupMembers created") );
+            break;
+            }
+        case EPrWithdrawPresenceFromPresentityGroupMembers:
+            {
+            op = new ( ELeave ) COperationWithdrawPresenceFromPresentityGroupMembers();
+            TRACE( _L("Operation WithdrawPresenceFromPresentityGroupMembers created") );
+            break;
+            }
+
+        case EPrGrantPresenceToEveryone:
+            {
+            op = new ( ELeave ) COperationGrantPresenceToEveryone();
+            TRACE( _L("Operation GrantPresenceToEveryone created") );
+            break;
+            }
+        case EPrWithdrawPresenceFromEveryone:
+            {
+            op = new ( ELeave ) COperationWithdrawPresenceFromEveryone();
+            TRACE( _L("Operation WithdrawPresenceFromEveryone created") );
+            break;
+            }
+
+        case EXIMPCleaner:
+            {
+            op = new ( ELeave ) COperationLaunchCleaner();
+            TRACE( _L("Operation LaunchCleaner created") );
+            break;
+            }
+
+        case EPrSubscribeBlockList:
+            {
+            op = new ( ELeave ) COperationSubscribeBlockList();
+            TRACE( _L("Operation SubscribeBlockList created") );
+            break;
+            }
+        case EPrUnsubscribeBlockList:
+            {
+            op = new ( ELeave ) COperationUnsubscribeBlockList();
+            TRACE( _L("Operation UnsubscribeBlockList created") );
+            break;
+            }
+
+        case EPrBlockPresenceForPresentity:
+            {
+            op = new ( ELeave ) COperationBlockPresenceForPresentity();
+            TRACE( _L("Operation BlockPresenceForPresentity created") );
+            break;
+            }
+
+        case EPrCancelPresenceBlockFromPresentity:
+            {
+            op = new ( ELeave ) COperationCancelPresenceBlockFromPresentity();
+            TRACE( _L("Operation CancelPresenceBlockFromPresentity created") );
+            break;
+            }
+
+        case EPrHandlePresenceBlockList:
+        case EPrHandlePresenceBlocked:
+        case EPrHandlePresenceBlockCanceled:
+            {
+            op = new ( ELeave ) COperationHandlePresenceBlocking( operation );
+            TRACE( _L("Operation HandlePresenceBlocking created") );
+            break;
+            }
+
+        case EPrSetOwnPresenceDataSubscriptionState:
+        case EPrSetPresenceBlockDataSubscriptionState:
+        case EPrSetPresenceGrantRequestDataSubscriptionState:
+        case EPrSetPresenceWatcherListDataSubscriptionState:
+        case EPrSetPresentityGroupListDataSubscriptionState:
+        case EPrSetPresentityGroupContentDataSubscriptionState:
+        case EPrSetPresentityPresenceDataSubscriptionState:
+            {
+            op = new ( ELeave ) COperationSetSubscriptionData( operation );
+            TRACE( _L("Operation SetSubscriptionData created") );
+            break;
+            }
+        
+        // commented by pankaj.
+        //XIMP_DEFAULT_CASE_UNSUPPORTED( NXIMPPrivPanic::EInvalidOperationType );
+        }
+
+    return op;
+    }
+// End of file
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresenceoperations/presenceoperationfactoryimp.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,69 @@
+/*
+* 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 Service Connection operation factory
+ *
+*/
+
+
+#ifndef PRESENCECPSCOPERATIONFACTORYIMP_H
+#define PRESENCECPSCOPERATIONFACTORYIMP_H
+
+
+#include <e32base.h>
+class CXIMPOperationBase;
+
+#include "ximpoperationfactory.h"
+
+/**
+ * Operation factory
+ * Class is owned by and handled as singleton by CXIMPGlobals.
+ *
+ * @lib presenceoperation.dll
+ * @since S60 v4.0
+ */
+class CPresenceOperationFactory : public CBase, 
+                                  public MXIMPOperationFactory
+    {
+    public: // Construction and desctruction
+
+        IMPORT_C static CPresenceOperationFactory* NewL();
+
+        ~CPresenceOperationFactory();
+
+    private: // Construction
+
+        /**
+         * C++ default constructor.
+         */
+        CPresenceOperationFactory();
+
+        /**
+         * Symbian 2nd phase constructor
+         */
+        void ConstructL();
+
+
+    public: // From MXIMPOperationFactory
+
+		/**
+		 * @see MXIMPOperationFactory
+	 	 */
+		CXIMPOperationBase* CreateOperationL( TInt aOperation );
+
+    private:    // Data
+
+    };
+
+#endif      // PRESENCECPSCOPERATIONFACTORYIMP_H
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresenceoperations/presencepublishing/operationhandleownpresence.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -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: implementation of COperationHandleOwnPresence 
+ *
+*/
+
+
+#include "operationhandleownpresence.h"
+
+#include "presenceinfoimp.h"
+#include "ximpobjecthelpers.h"
+#include "ownpresencesubscriptionitem.h"
+#include "presencedatacacheimp.h"
+#include "ximphost.h"
+
+#include "ximprestrictedobjectcollectionimp.h"
+#include "protocolpresencedatahostimp.h"
+
+#include "ximptrace.h"
+
+// ============================ MEMBER FUNCTIONS =============================
+
+// ---------------------------------------------------------------------------
+// COperationHandleOwnPresence::~COperationHandleOwnPresence()
+// ---------------------------------------------------------------------------
+//
+COperationHandleOwnPresence::~COperationHandleOwnPresence()
+    {
+    delete iPresInfo;
+    }
+
+
+// ---------------------------------------------------------------------------
+// COperationHandleOwnPresence::COperationHandleOwnPresence()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C COperationHandleOwnPresence::COperationHandleOwnPresence()
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// COperationHandleOwnPresence::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void COperationHandleOwnPresence::ConstructL( const TDesC8& /* aParamPck */ )
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// COperationHandleOwnPresence::ProcessL()
+// ---------------------------------------------------------------------------
+//
+void COperationHandleOwnPresence::ProcessL()
+    {
+    TRACE(_L("COperationHandleOwnPresence::ProcessL()") );
+    CXIMPOperationBase::ProcessL();
+
+    MXIMPBase* object = NULL;
+    iObjCollection->GetByType( object, MPresenceInfo::KInterfaceId );
+    if ( object )
+        {
+        iPresInfo = TXIMPGetImpClassOrPanic< CPresenceInfoImp >::From( *object );
+        }
+    else
+        {
+        User::Leave( KErrArgument );
+        }
+    
+
+    COwnPresenceSubscriptionItem& ownPresence = 
+                            iMyHost->PresenceDataAccess().PresenceDataCache().OwnPresenceSubscriptionItemLC();
+    ownPresence.SetPresenceInfoL( iPresInfo );
+    iPresInfo = NULL;
+    TRAPD( err, ownPresence.SynthesiseSubscriptionEventToAllCtxsL() );
+    CleanupStack::PopAndDestroy(); // ownPresence
+    iMyHost->HandleAdaptationRequestCompleted( iReqId, err );    
+    }
+
+// ---------------------------------------------------------------------------
+// COperationHandleOwnPresence::RequestCompleted()
+// ---------------------------------------------------------------------------
+//
+void COperationHandleOwnPresence::RequestCompletedL()
+    {
+    TRACE(_L("COperationHandleOwnPresence::RequestCompletedL()" ) );
+    CXIMPOperationBase::RequestCompletedL();
+    
+    // no special handling for error situations
+    }
+
+
+// ---------------------------------------------------------------------------
+// COperationHandleOwnPresence::Type()
+// ---------------------------------------------------------------------------
+//
+TInt COperationHandleOwnPresence::Type() const
+    {
+    return NPresenceOps::EPrHandleOwnPresence;
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresenceoperations/presencepublishing/operationhandleownpresence.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,65 @@
+/*
+* 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:  Handle own presence operation
+ *
+*/
+
+#ifndef CPSCOPERATIONHANDLEOWNPRESENCE_H
+#define CPSCOPERATIONHANDLEOWNPRESENCE_H
+
+
+#include <e32base.h>
+
+#include <ximpbase.h>
+#include "ximpoperationbase.h"
+#include "presenceoperationdefs.h"
+
+class CPresenceInfoImp;
+
+/**
+ * Publish presence operation.
+ *
+ * @lib ximpoperations.lib
+ * @since S60 v4.0
+ */
+class COperationHandleOwnPresence : public CXIMPOperationBase
+    {
+
+    public:
+
+        IMPORT_C COperationHandleOwnPresence();
+
+        void ConstructL( const TDesC8& aParamPck );
+
+        ~COperationHandleOwnPresence();
+
+    public: // from CXIMPOperationBase
+
+        void ProcessL();
+
+        void RequestCompletedL();
+
+        TInt Type() const;
+
+    private: // data
+
+        /**
+         * Presence document to handle. 
+         * Own.
+         */
+        CPresenceInfoImp* iPresInfo;
+    };
+
+
+#endif // CPSCOPERATIONHANDLEOWNPRESENCE_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresenceoperations/presencepublishing/operationhandlepresencewatcherlist.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,137 @@
+/*
+* 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:  Handle presence watcher list operation
+ *
+*/
+
+
+#include "operationhandlepresencewatcherlist.h"
+
+#include "presencedatacacheimp.h"
+
+#include "presencewatcherinfoimp.h"
+#include "watcherlistsubscriptionitem.h"
+#include "ximphost.h"
+#include "ximpstatusimp.h"
+
+#include "ximpobjecthelpers.h"
+#include "ximprestrictedobjectcollectionimp.h"
+#include "ximpobjectcollectionimp.h"
+#include "protocolpresencedatahostimp.h"
+
+#include "ximptrace.h"
+
+// ============================ MEMBER FUNCTIONS =============================
+
+// ---------------------------------------------------------------------------
+// COperationHandlePresenceWatcherList::~COperationHandlePresenceWatcherList()
+// ---------------------------------------------------------------------------
+//
+COperationHandlePresenceWatcherList::~COperationHandlePresenceWatcherList()
+    {
+    delete iWatcherList;
+    }
+
+// ---------------------------------------------------------------------------
+// COperationHandlePresenceWatcherList::COperationHandlePresenceWatcherList()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C COperationHandlePresenceWatcherList::COperationHandlePresenceWatcherList()
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// COperationHandlePresenceWatcherList::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void COperationHandlePresenceWatcherList::ConstructL( const TDesC8& /* aParamPck */ )
+    {
+    iWatcherList = new ( ELeave ) RPrWatLstInfoImpArray;
+    }
+
+// ---------------------------------------------------------------------------
+// From CXIMPOperationBase class.
+// COperationHandlePresenceWatcherList::ProcessL()
+// ---------------------------------------------------------------------------
+//
+void COperationHandlePresenceWatcherList::ProcessL()
+    {
+    TRACE(_L("COperationHandlePresenceWatcherList::ProcessL()") );
+    CXIMPOperationBase::ProcessL();
+
+    MXIMPBase* object = NULL;
+    iObjCollection->GetByType( object, MXIMPObjectCollection::KInterfaceId );
+    if( object )
+        {
+        CXIMPObjectCollectionImp* objectCollection = 
+                TXIMPGetImpClassOrPanic< CXIMPObjectCollectionImp >::From( *object );
+        CleanupStack::PushL( objectCollection );
+        TLinearOrder< CPresenceWatcherInfoImp > order( 
+                                CPresenceWatcherInfoImp::IdLinearOrder );
+        TXIMPObjectMover< MPresenceWatcherInfo, CPresenceWatcherInfoImp >::MoveFromCollectionToArrayL(
+                                                            *objectCollection,
+                                                            *iWatcherList,
+                                                            order );
+        CleanupStack::PopAndDestroy( objectCollection );        
+        }
+    else
+        {
+        User::Leave( KErrArgument );
+        }
+
+    CWatcherListSubscriptionItem& subItem =
+        iMyHost->PresenceDataAccess().PresenceDataCache().WatcherListSubscriptionItemLC();
+
+    // clean out temporary lists
+    subItem.Clean();
+
+    subItem.SetNewListL( iWatcherList );
+    iWatcherList = NULL; // ownership was transferred
+    subItem.UpdateSubscriptionStateL(
+                    CXIMPSubscriptionItemBase::ECompleteDataReceived );
+
+    // synthesize the event to all contexts
+    TRAPD( err, subItem.SynthesiseSubscriptionEventToAllCtxsL() );
+
+    CleanupStack::PopAndDestroy(); // subItem
+
+    err = KErrNone;
+    iMyHost->HandleAdaptationRequestCompleted( iReqId, err );
+    }
+
+// ---------------------------------------------------------------------------
+// From CXIMPOperationBase class.
+// COperationHandlePresenceWatcherList::RequestCompleted()
+// ---------------------------------------------------------------------------
+//
+void COperationHandlePresenceWatcherList::RequestCompletedL()
+    {
+    TRACE(_L("COperationHandlePresenceWatcherList::RequestCompletedL()" ) );
+    CXIMPOperationBase::RequestCompletedL();
+
+    // no special handling for error situations
+    }
+
+// ---------------------------------------------------------------------------
+// From CXIMPOperationBase class.
+// COperationHandlePresenceWatcherList::Type()
+// ---------------------------------------------------------------------------
+//
+TInt COperationHandlePresenceWatcherList::Type() const
+    {
+    return NPresenceOps::EPrHandlePresenceWatcherList;
+    }
+
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresenceoperations/presencepublishing/operationhandlepresencewatcherlist.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,64 @@
+/*
+* 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:  Handle presentity group list operations
+ *
+*/
+
+#ifndef CPSCOPERATIONHANDLEPRESENCEWATCHERLIST_H
+#define CPSCOPERATIONHANDLEPRESENCEWATCHERLIST_H
+
+
+#include <e32base.h>
+#include <ximpbase.h>
+
+#include "ximpoperationbase.h"
+#include "presencetypehelpers.h"
+#include "presenceoperationdefs.h"
+
+/**
+ * Handle presentity group related operations.
+ *
+ * @lib ximpoperations.lib
+ * @since S60 v4.0
+ */
+class COperationHandlePresenceWatcherList : public CXIMPOperationBase
+    {
+
+    public:
+
+        IMPORT_C COperationHandlePresenceWatcherList();
+
+        void ConstructL( const TDesC8& aParamPck );
+
+        ~COperationHandlePresenceWatcherList();
+
+    public: // from CXIMPOperationBase
+
+        void ProcessL();
+
+        void RequestCompletedL();
+
+        TInt Type() const;
+
+    private: // data
+
+        /**
+         * Array of group identities.
+         * Owned.
+         */
+        RPrWatLstInfoImpArray* iWatcherList;
+    };
+
+
+#endif // CPSCOPERATIONHANDLEPRESENCEWATCHERLIST_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresenceoperations/presencepublishing/operationpublishownpresence.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,100 @@
+/*
+* 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 of COperationPublishOwnPresence
+ *
+*/
+
+
+#include <ximpprotocolconnection.h>
+#include <protocolpresencepublishing.h>
+#include <protocolpresencefeatures.h>
+
+#include "operationpublishownpresence.h"
+#include "presenceinfoimp.h"
+#include "ximpobjecthelpers.h"
+#include "ximphost.h"
+#include "ximpstatusimp.h"
+
+#include "ximptrace.h"
+
+// ============================ MEMBER FUNCTIONS =============================
+
+// ---------------------------------------------------------------------------
+// COperationPublishOwnPresence::~COperationPublishOwnPresence()
+// ---------------------------------------------------------------------------
+//
+COperationPublishOwnPresence::~COperationPublishOwnPresence()
+    {
+    delete iPresInfo;
+    }
+
+
+// ---------------------------------------------------------------------------
+// COperationPublishOwnPresence::COperationPublishOwnPresence()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C COperationPublishOwnPresence::COperationPublishOwnPresence()
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// COperationPublishOwnPresence::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void COperationPublishOwnPresence::ConstructL( const TDesC8& aParamPck )
+    {
+    iPresInfo = CPresenceInfoImp::NewL();
+    TXIMPObjectPacker< CPresenceInfoImp >::UnPackL( *iPresInfo,
+            aParamPck );
+    }
+
+
+// ---------------------------------------------------------------------------
+// COperationPublishOwnPresence::ProcessL()
+// ---------------------------------------------------------------------------
+//
+void COperationPublishOwnPresence::ProcessL()
+    {
+    TRACE(_L("COperationPublishOwnPresence::ProcessL()" ) );
+    CXIMPOperationBase::ProcessL();
+    
+    MProtocolPresencePublishing& publishing = iMyHost->GetConnection().ProtocolPresenceFeatures().PresencePublishing();
+    publishing.DoPublishOwnPresenceL( *iPresInfo, iReqId );
+    }
+
+
+// ---------------------------------------------------------------------------
+// COperationPublishOwnPresence::RequestCompleted()
+// ---------------------------------------------------------------------------
+//
+void COperationPublishOwnPresence::RequestCompletedL()
+    {
+    TRACE(_L("COperationPublishOwnPresence::RequestCompletedL()" ) );
+    CXIMPOperationBase::RequestCompletedL();
+    
+    // no special handling for error situations
+    }
+
+
+// ---------------------------------------------------------------------------
+// COperationPublishOwnPresence::Type()
+// ---------------------------------------------------------------------------
+//
+TInt COperationPublishOwnPresence::Type() const
+    {
+    return NPresenceOps::EPrPublishOwnPresence;
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresenceoperations/presencepublishing/operationpublishownpresence.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,65 @@
+/*
+* 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:  Publish presence operation
+ *
+*/
+
+#ifndef CPSCOPERATIONPUBLISHOWNPRESENCE_H
+#define CPSCOPERATIONPUBLISHOWNPRESENCE_H
+
+
+#include <e32base.h>
+#include <ximpbase.h>
+
+#include "ximpoperationbase.h"
+#include "presenceoperationdefs.h"
+
+class CPresenceInfoImp;
+
+/**
+ * Publish presence operation.
+ *
+ * @lib ximpoperations.lib
+ * @since S60 v4.0
+ */
+class COperationPublishOwnPresence : public CXIMPOperationBase
+    {
+
+    public:
+
+        IMPORT_C COperationPublishOwnPresence();
+
+        void ConstructL( const TDesC8& aParamPck );
+
+        ~COperationPublishOwnPresence();
+
+    public: // from CXIMPOperationBase
+
+        void ProcessL();
+
+        void RequestCompletedL();
+
+        TInt Type() const;
+
+    private: // data
+
+        /**
+         * Presence document to publish. 
+         * Own.
+         */
+        CPresenceInfoImp* iPresInfo;
+    };
+
+
+#endif // CPSCOPERATIONPUBLISHOWNPRESENCE_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresenceoperations/presencepublishing/operationsubscribeownpresence.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,232 @@
+/*
+* 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 of COperationSubscribeOwnPresence
+ *
+*/
+
+
+#include <ximpprotocolconnection.h>
+#include <protocolpresencepublishing.h>
+#include <protocolpresencefeatures.h>
+
+#include "operationsubscribeownpresence.h"
+#include "presenceinfofilterimp.h"
+#include "ximpobjecthelpers.h"
+#include "documentutils.h"
+#include "presencedatacacheimp.h"
+#include "ximppanics.h"
+#include "operationsynthesisesubscriptionevent.h"
+#include "ximphost.h"
+#include "ximpstatusimp.h"
+#include "ximppsccontextimp.h"
+#include "protocolpresencedatahostimp.h"
+
+#include "ximptrace.h"
+// ============================ MEMBER FUNCTIONS =============================
+
+// ---------------------------------------------------------------------------
+// COperationSubscribeOwnPresence::COperationSubscribeOwnPresence()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C COperationSubscribeOwnPresence::COperationSubscribeOwnPresence()
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// COperationSubscribeOwnPresence::~COperationSubscribeOwnPresence()
+// ---------------------------------------------------------------------------
+//
+COperationSubscribeOwnPresence::~COperationSubscribeOwnPresence()
+    {
+    delete iPif;
+    delete iMergedPif;
+    if( iOwnPresence )
+        {
+        iOwnPresence->Close();
+        }    
+    }
+
+// ---------------------------------------------------------------------------
+// COperationSubscribeOwnPresence::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void COperationSubscribeOwnPresence::ConstructL( const TDesC8& aParamPck )
+    {
+    iPif = CPresenceInfoFilterImp::NewL();
+    TXIMPObjectPacker< CPresenceInfoFilterImp >::UnPackL( *iPif,
+            aParamPck );
+    }
+
+
+// ---------------------------------------------------------------------------
+// COperationSubscribeOwnPresence::ProcessL()
+// ---------------------------------------------------------------------------
+//
+void COperationSubscribeOwnPresence::ProcessL()
+    {
+    TRACE(_L("COperationSubscribeOwnPresence::ProcessL()" ) );
+    CXIMPOperationBase::ProcessL();
+
+    COwnPresenceSubscriptionItem& ownPresence = 
+        iMyHost->PresenceDataAccess().PresenceDataCache().OwnPresenceSubscriptionItemLC();
+    CleanupStack::Pop(); // ownPresence    
+    iOwnPresence = &ownPresence;
+
+    iSubscriptionStatus = iOwnPresence->SubscriptionStatus( iContext );
+
+    MProtocolPresencePublishing& publishing = iMyHost->GetConnection().ProtocolPresenceFeatures().PresencePublishing();
+
+    switch( iSubscriptionStatus )
+        {
+        case COwnPresenceSubscriptionItem::ENotSubscribedAtAll:
+            {
+            // Do subscribe
+            iMergedPif = TXIMPObjectCloner< CPresenceInfoFilterImp >::CloneL( *iPif );
+            publishing.DoSubscribeOwnPresenceL( *iMergedPif, iReqId );
+            break;
+            }
+        case COwnPresenceSubscriptionItem::ESubscribedForOtherCtxOnly:
+            {
+            // Check aggregate and if needed.. update subscription
+            iMergedPif = DocumentUtils::InfoFilterUnionL( iOwnPresence->SubscriptionPif(), *iPif );
+            if( iMergedPif->Contains( *iPif ) )
+                {
+                publishing.DoUpdateOwnPresenceSubscriptionPifL( *iMergedPif, iReqId );
+                }
+            else
+                {
+                iMyHost->FakeCompleteRequest( iReqId, KErrNone );
+                }
+            break;
+            }
+            
+        case COwnPresenceSubscriptionItem::ESubscribedForCtxOnly:
+        case COwnPresenceSubscriptionItem::ESubscribedForCtxAndOthers:
+            {
+            CPresenceInfoFilterImp* oldPif = 
+                    iContext->PresenceInfoFilter( MXIMPPscContext::EOwnPresenceFilter );
+            CPresenceInfoFilterImp& oldMergedPif = iOwnPresence->SubscriptionPif();
+            TBool fake = ETrue;
+            TBool makeUnion( EFalse );
+            if( !oldPif )
+                {
+                TRACE(_L("COperationSubscribeOwnPresence::ProcessL() no old pif" ) );
+                makeUnion = ETrue;
+                }
+            else if ( *oldPif != *iPif ) 
+                {
+                makeUnion = ETrue;
+                }
+            if( makeUnion )
+                {
+                iDoNotForce = ETrue;
+                CPresenceInfoFilterImp* withoutPif = 
+                            iOwnPresence->CollectSubscriptionPifWithoutCtxL( iContext );
+                CleanupStack::PushL( withoutPif );
+                iMergedPif = DocumentUtils::InfoFilterUnionL( *withoutPif, *iPif );
+                CleanupStack::PopAndDestroy( withoutPif );
+                if( iMergedPif->Contains( oldMergedPif ) )
+                    {
+                    fake = EFalse;
+                    publishing.DoUpdateOwnPresenceSubscriptionPifL( *iMergedPif, iReqId );
+                    }
+                }
+            else
+                {
+                iMergedPif = TXIMPObjectCloner< CPresenceInfoFilterImp >::CloneL( oldMergedPif );
+                }
+                
+            if( fake )
+                {
+                iMyHost->FakeCompleteRequest( iReqId, KErrNone );
+                }
+            break;
+            }
+        XIMP_DEFAULT_CASE_UNSUPPORTED( NXIMPPrivPanic::EInvalidSubscriptionStatus );
+        }
+    }
+
+
+// ---------------------------------------------------------------------------
+// COperationSubscribeOwnPresence::RequestCompleted()
+// ---------------------------------------------------------------------------
+//
+void COperationSubscribeOwnPresence::RequestCompletedL()
+    {
+    TRACE(_L("COperationSubscribeOwnPresence::RequestCompletedL()" ) );
+    CXIMPOperationBase::RequestCompletedL();
+
+    if( iStatusObj->ResultCode() == KErrNone )
+        {
+        iContext->SetPresenceInfoFilterL( MXIMPPscContext::EOwnPresenceFilter,
+                iPif, NULL );
+        iPif = NULL;
+        iOwnPresence->SetSubscriptionPif( iMergedPif );
+        iMergedPif = NULL;
+
+        switch( iSubscriptionStatus )
+            {
+            case COwnPresenceSubscriptionItem::ENotSubscribedAtAll:
+            case COwnPresenceSubscriptionItem::ESubscribedForOtherCtxOnly:
+                {
+                iOwnPresence->AddSubscriberL( iContext );
+                break;
+                }
+            case COwnPresenceSubscriptionItem::ESubscribedForCtxOnly:
+            case COwnPresenceSubscriptionItem::ESubscribedForCtxAndOthers:
+                {
+                break;
+                }
+
+            XIMP_DEFAULT_CASE_UNSUPPORTED( NXIMPPrivPanic::EInvalidSubscriptionStatus );
+            }
+        
+        SynthesiseEventL();
+        }     
+    }
+
+
+// ---------------------------------------------------------------------------
+// COperationSubscribeOwnPresence::Type()
+// ---------------------------------------------------------------------------
+//
+TInt 
+    COperationSubscribeOwnPresence::Type() const
+    {
+    return NPresenceOps::EPrSubscribeOwnPresence;
+    }
+
+// ---------------------------------------------------------------------------
+// COperationSubscribeOwnPresence::SynthesiseEventL()
+// ---------------------------------------------------------------------------
+//
+void COperationSubscribeOwnPresence::SynthesiseEventL()
+    {
+    TBool force = 
+    ( iSubscriptionStatus == COwnPresenceSubscriptionItem::ESubscribedForCtxOnly ||
+      iSubscriptionStatus == COwnPresenceSubscriptionItem::ESubscribedForCtxAndOthers ) ? ETrue : EFalse;
+    
+    COperationSynthesiseSubscriptionEvent* synthOp = 
+            new ( ELeave ) COperationSynthesiseSubscriptionEvent( 
+                             COperationSynthesiseSubscriptionEvent::EOwnPresence, force && !iDoNotForce );
+    CleanupStack::PushL( synthOp );
+    synthOp->BaseConstructL( TXIMPRequestId(), iContext );        
+    iMyHost->AddNewOperationL( *synthOp );
+    CleanupStack::Pop( synthOp );    
+    }
+
+
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresenceoperations/presencepublishing/operationsubscribeownpresence.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,88 @@
+/*
+* 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 interest registration operation
+ *
+*/
+
+#ifndef CPSCOPERATIONSUBSCRIBEOWNPRESENCE_H
+#define CPSCOPERATIONSUBSCRIBEOWNPRESENCE_H
+
+
+#include <e32base.h>
+#include <ximpbase.h>
+
+#include "ximpoperationbase.h"
+#include "ownpresencesubscriptionitem.h"
+#include "presenceoperationdefs.h"
+
+/**
+ * Presence interest registration operation.
+ *
+ * @lib ximpoperations.lib
+ * @since S60 v4.0
+ */
+class COperationSubscribeOwnPresence : public CXIMPOperationBase
+    {
+
+    public:
+
+        IMPORT_C COperationSubscribeOwnPresence();
+
+        void ConstructL( const TDesC8& aParamPck );
+
+        ~COperationSubscribeOwnPresence();
+
+
+    public: // from CXIMPOperationBase
+
+        void ProcessL();
+
+        void RequestCompletedL();
+
+        TInt Type() const;
+        
+    private: // Helper methods
+    
+        /**
+         * Synthesise event after completion
+         */
+        void SynthesiseEventL();      
+
+    private: // data
+
+        /**
+         * Presence info filter having new presence info filter for context.
+         * Own.
+         */
+        CPresenceInfoFilterImp* iPif;
+        CPresenceInfoFilterImp* iMergedPif;
+        
+        /**
+         *
+         */
+        COwnPresenceSubscriptionItem::TSubscriptionStatus iSubscriptionStatus;
+        
+        /**
+         *
+         */
+        COwnPresenceSubscriptionItem* iOwnPresence;
+        
+        /**
+         * Don't force event.
+         */
+        TBool iDoNotForce;
+    };
+
+
+#endif // CPSCOPERATIONSUBSCRIBEOWNPRESENCE_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresenceoperations/presencepublishing/operationsubscribewatcherlist.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  Presence watcher list subscription operator
+ *
+*/
+
+
+#include <ximpprotocolconnection.h>
+#include <protocolpresencepublishing.h>
+#include <protocolpresencefeatures.h>
+
+#include "operationsubscribewatcherlist.h"
+#include "presencedatacacheimp.h"
+#include "ximppanics.h"
+#include "operationsynthesisesubscriptionevent.h"
+#include "ximphost.h"
+#include "ximpstatusimp.h"
+#include "ximppsccontextimp.h"
+#include "protocolpresencedatahostimp.h"
+
+#include "ximptrace.h"
+
+// ============================ MEMBER FUNCTIONS =============================
+
+// ---------------------------------------------------------------------------
+// COperationSubscribeWatcherList::COperationSubscribeWatcherList()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C COperationSubscribeWatcherList::COperationSubscribeWatcherList()
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// COperationSubscribeWatcherList::~COperationSubscribeWatcherList()
+// ---------------------------------------------------------------------------
+//
+COperationSubscribeWatcherList::~COperationSubscribeWatcherList()
+    {
+    if( iWatcherList )
+        {
+        iWatcherList->Close();
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// COperationSubscribeWatcherList::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void COperationSubscribeWatcherList::ConstructL( const TDesC8& /*aParamPck*/ )
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// COperationSubscribeWatcherList::ProcessL()
+// ---------------------------------------------------------------------------
+//
+void COperationSubscribeWatcherList::ProcessL()
+    {
+    TRACE(_L("COperationSubscribeWatcherList::ProcessL()" ) );
+    CXIMPOperationBase::ProcessL();
+
+    CWatcherListSubscriptionItem& watcherList =
+                            iMyHost->PresenceDataAccess().PresenceDataCache().WatcherListSubscriptionItemLC();
+    CleanupStack::Pop(); // watcherList
+    iWatcherList = &watcherList;
+
+    iSubscriptionStatus = iWatcherList->SubscriptionStatus( iContext );
+    MProtocolPresencePublishing& publishing = iMyHost->GetConnection().ProtocolPresenceFeatures().PresencePublishing();
+
+    switch( iSubscriptionStatus )
+        {
+        case CWatcherListSubscriptionItem::ENotSubscribedAtAll:
+            {
+            publishing.DoSubscribePresenceWatcherListL( iReqId );
+            break;
+            }
+            
+        case CWatcherListSubscriptionItem::ESubscribedForOtherCtxOnly:
+        case CWatcherListSubscriptionItem::ESubscribedForCtxOnly:
+        case CWatcherListSubscriptionItem::ESubscribedForCtxAndOthers:
+            {
+            iMyHost->FakeCompleteRequest( iReqId, KErrNone );
+            break;
+            }
+
+        XIMP_DEFAULT_CASE_UNSUPPORTED( NXIMPPrivPanic::EInvalidSubscriptionStatus );
+        }
+    }
+
+
+// ---------------------------------------------------------------------------
+// COperationSubscribeWatcherList::RequestCompleted()
+// ---------------------------------------------------------------------------
+//
+void COperationSubscribeWatcherList::RequestCompletedL()
+    {
+    TRACE(_L("COperationSubscribeWatcherList::RequestCompletedL()" ) );
+    CXIMPOperationBase::RequestCompletedL();
+
+    if( iStatusObj->ResultCode() == KErrNone )
+        {
+        switch( iSubscriptionStatus )
+            {
+            case CWatcherListSubscriptionItem::ENotSubscribedAtAll:
+            case CWatcherListSubscriptionItem::ESubscribedForOtherCtxOnly:
+                {
+                iWatcherList->AddSubscriberL( iContext );
+                break;
+                }
+                
+            case CWatcherListSubscriptionItem::ESubscribedForCtxOnly:
+            case CWatcherListSubscriptionItem::ESubscribedForCtxAndOthers:
+                {
+                break;
+                }
+                
+            XIMP_DEFAULT_CASE_UNSUPPORTED( NXIMPPrivPanic::EInvalidSubscriptionStatus );
+            }
+
+        SynthesiseEventL();
+        }
+    }
+
+
+// ---------------------------------------------------------------------------
+// COperationSubscribeWatcherList::Type()
+// ---------------------------------------------------------------------------
+//
+TInt
+    COperationSubscribeWatcherList::Type() const
+    {
+    return NPresenceOps::EPrSubscribePresenceWatcherList;
+    }
+
+// ---------------------------------------------------------------------------
+// COperationSubscribeWatcherList::SynthesiseEventL()
+// ---------------------------------------------------------------------------
+//
+void COperationSubscribeWatcherList::SynthesiseEventL()
+    {
+    TBool force =
+    ( iSubscriptionStatus == CWatcherListSubscriptionItem::ESubscribedForCtxOnly ||
+      iSubscriptionStatus == CWatcherListSubscriptionItem::ESubscribedForCtxAndOthers ) ? ETrue : EFalse;
+
+    COperationSynthesiseSubscriptionEvent* synthOp =
+            new ( ELeave ) COperationSynthesiseSubscriptionEvent(
+                             COperationSynthesiseSubscriptionEvent::EPresenceWatcherList,
+                             force );
+    CleanupStack::PushL( synthOp );
+    synthOp->BaseConstructL( TXIMPRequestId(), iContext );
+    iMyHost->AddNewOperationL( *synthOp );
+    CleanupStack::Pop( synthOp );
+    }
+
+
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresenceoperations/presencepublishing/operationsubscribewatcherlist.h	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  Presentity group list subscription operator
+ *
+*/
+
+#ifndef CPSCOPERATIONSUBSCRIBEWATCHERLIST_H
+#define CPSCOPERATIONSUBSCRIBEWATCHERLIST_H
+
+
+#include <e32base.h>
+#include <ximpbase.h>
+
+#include "ximpoperationbase.h"
+#include "watcherlistsubscriptionitem.h"
+#include "presenceoperationdefs.h"
+
+/**
+ * Presence interest registration operation.
+ *
+ * @lib ximpoperations.lib
+ * @since S60 v4.0
+ */
+class COperationSubscribeWatcherList : public CXIMPOperationBase
+    {
+
+    public:
+
+        IMPORT_C COperationSubscribeWatcherList();
+
+        void ConstructL( const TDesC8& aParamPck );
+
+        ~COperationSubscribeWatcherList();
+
+
+    public: // from CXIMPOperationBase
+
+        void ProcessL();
+
+        void RequestCompletedL();
+
+        TInt Type() const;
+
+    private: // Helper methods
+
+        /**
+         * Synthesise event after completion
+         */
+        void SynthesiseEventL();
+
+    private: // data
+
+        /**
+         * Group list access.
+         */
+        CWatcherListSubscriptionItem* iWatcherList;
+
+        /**
+         * Subscription status
+         */
+        CWatcherListSubscriptionItem::TSubscriptionStatus iSubscriptionStatus;
+    };
+
+
+#endif // CPSCOPERATIONSUBSCRIBEWATCHERLIST_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresenceoperations/presencepublishing/operationunsubscribeownpresence.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -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: implementation of COperationUnsubscribeOwnPresence
+ *
+*/
+
+
+#include <ximpprotocolconnection.h>
+#include <protocolpresencepublishing.h>
+#include <protocolpresencefeatures.h>
+
+#include "operationunsubscribeownpresence.h"
+#include "presenceinfofilterimp.h"
+#include "presencedatacacheimp.h"
+#include "ximppanics.h"
+#include "operationsynthesisesubscriptionevent.h"
+#include "ximphost.h"
+#include "ximpstatusimp.h"
+#include "ximppsccontextimp.h"
+#include "protocolpresencedatahostimp.h"
+
+#include "ximptrace.h"
+// ============================ MEMBER FUNCTIONS =============================
+
+// ---------------------------------------------------------------------------
+// COperationUnsubscribeOwnPresence::COperationUnsubscribeOwnPresence()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C COperationUnsubscribeOwnPresence::COperationUnsubscribeOwnPresence()
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// COperationUnsubscribeOwnPresence::~COperationUnsubscribeOwnPresence()
+// ---------------------------------------------------------------------------
+//
+COperationUnsubscribeOwnPresence::~COperationUnsubscribeOwnPresence()
+    {
+    if( iOwnPresence )
+        {
+        iOwnPresence->Close();
+        }    
+    delete iPifWithoutCtx;
+    }
+
+// ---------------------------------------------------------------------------
+// COperationUnsubscribeOwnPresence::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void COperationUnsubscribeOwnPresence::ConstructL( const TDesC8& /*aParamPck*/ )
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// COperationUnsubscribeOwnPresence::ProcessL()
+// ---------------------------------------------------------------------------
+//
+void COperationUnsubscribeOwnPresence::ProcessL()
+    {
+    TRACE(_L("COperationUnsubscribeOwnPresence::ProcessL()" ) );
+    CXIMPOperationBase::ProcessL();
+    
+    COwnPresenceSubscriptionItem& ownPresence = 
+                            iMyHost->PresenceDataAccess().PresenceDataCache().OwnPresenceSubscriptionItemLC();
+    CleanupStack::Pop(); // ownPresence    
+    iOwnPresence = &ownPresence;
+    
+    iSubscriptionStatus = iOwnPresence->SubscriptionStatus( iContext );
+
+    MProtocolPresencePublishing& publishing = iMyHost->GetConnection().ProtocolPresenceFeatures().PresencePublishing();
+
+    switch( iSubscriptionStatus )
+        {
+        case COwnPresenceSubscriptionItem::ESubscribedForCtxOnly:
+            {
+            // Do subscribe
+            publishing.DoUnsubscribeOwnPresenceL( iReqId );
+            break;
+            }
+        case COwnPresenceSubscriptionItem::ESubscribedForCtxAndOthers:
+            {
+            iPifWithoutCtx = iOwnPresence->CollectSubscriptionPifWithoutCtxL( iContext );
+
+            if ( iOwnPresence->SubscriptionPif().Contains( *iPifWithoutCtx ) ) 
+                {
+                publishing.DoUpdateOwnPresenceSubscriptionPifL( *iPifWithoutCtx, iReqId );
+                }
+            else
+                {
+                iMyHost->FakeCompleteRequest( iReqId, KErrNone );
+                }                
+            break;
+            }
+
+        case COwnPresenceSubscriptionItem::ENotSubscribedAtAll:
+        case COwnPresenceSubscriptionItem::ESubscribedForOtherCtxOnly:
+            {
+            iMyHost->FakeCompleteRequest( iReqId, KErrNone );
+            break;
+            }
+
+        XIMP_DEFAULT_CASE_UNSUPPORTED( NXIMPPrivPanic::EInvalidSubscriptionStatus );
+        }    
+    }
+
+// ---------------------------------------------------------------------------
+// COperationUnsubscribeOwnPresence::RequestCompleted()
+// ---------------------------------------------------------------------------
+//
+void COperationUnsubscribeOwnPresence::RequestCompletedL()
+    {
+    TRACE(_L("COperationUnsubscribeWatcherList::RequestCompletedL()" ) );
+    CXIMPOperationBase::RequestCompletedL();
+
+    if( iStatusObj->ResultCode() == KErrNone )
+        {
+        iContext->SetPresenceInfoFilterL( MXIMPPscContext::EOwnPresenceFilter,
+                NULL, NULL );
+
+        switch( iSubscriptionStatus )
+            {
+            case COwnPresenceSubscriptionItem::ESubscribedForCtxOnly:
+            case COwnPresenceSubscriptionItem::ESubscribedForCtxAndOthers:
+                {
+                iOwnPresence->RemoveSubscriber( iContext );
+                iContext->SetPresenceInfoFilterL( MXIMPPscContext::EOwnPresenceFilter, NULL );
+                if( iPifWithoutCtx )
+                    {
+                    iOwnPresence->SetSubscriptionPif( iPifWithoutCtx );
+                    iPifWithoutCtx = NULL;
+                    }
+                break;
+                }
+            
+            case COwnPresenceSubscriptionItem::ENotSubscribedAtAll:
+            case COwnPresenceSubscriptionItem::ESubscribedForOtherCtxOnly:
+                {
+                break;
+                }
+                
+            XIMP_DEFAULT_CASE_UNSUPPORTED( NXIMPPrivPanic::EInvalidSubscriptionStatus );                
+            }
+            
+        SynthesiseEventL();
+        }     
+    }
+
+
+// ---------------------------------------------------------------------------
+// COperationUnsubscribeOwnPresence::Type()
+// ---------------------------------------------------------------------------
+//
+TInt 
+    COperationUnsubscribeOwnPresence::Type() const
+    {
+    return NPresenceOps::EPrUnsubscribeOwnPresence;
+    }
+
+// ---------------------------------------------------------------------------
+// COperationUnsubscribeOwnPresence::SynthesiseEventL()
+// ---------------------------------------------------------------------------
+//
+void COperationUnsubscribeOwnPresence::SynthesiseEventL()
+    {
+    COperationSynthesiseSubscriptionEvent* synthOp = 
+            new ( ELeave ) COperationSynthesiseSubscriptionEvent( 
+                             COperationSynthesiseSubscriptionEvent::EOwnPresence, EFalse );
+    CleanupStack::PushL( synthOp );
+    synthOp->BaseConstructL( TXIMPRequestId(), iContext );        
+    iMyHost->AddNewOperationL( *synthOp );
+    CleanupStack::Pop( synthOp );    
+    }
+
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresenceoperations/presencepublishing/operationunsubscribeownpresence.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,82 @@
+/*
+* 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 interest registration operation
+ *
+*/
+
+#ifndef CPSCOPERATIONUNSUBSCRIBEOWNPRESENCE_H
+#define CPSCOPERATIONUNSUBSCRIBEOWNPRESENCE_H
+
+
+#include <e32base.h>
+#include <ximpbase.h>
+
+#include "ximpoperationbase.h"
+#include "ownpresencesubscriptionitem.h"
+#include "presenceoperationdefs.h"
+
+/**
+ * Presence interest registration operation.
+ *
+ * @lib ximpoperations.lib
+ * @since S60 v4.0
+ */
+class COperationUnsubscribeOwnPresence : public CXIMPOperationBase
+    {
+    public:
+
+        IMPORT_C COperationUnsubscribeOwnPresence();
+
+        void ConstructL( const TDesC8& aParamPck );
+
+        ~COperationUnsubscribeOwnPresence();
+
+
+    public: // from CXIMPOperationBase
+
+        void ProcessL();
+
+        void RequestCompletedL();
+
+        TInt Type() const;
+        
+    private: // Helper methods
+    
+        /**
+         * Synthesise event after completion
+         */
+        void SynthesiseEventL();
+
+    private: // data
+
+        /**
+         *
+         */
+        COwnPresenceSubscriptionItem::TSubscriptionStatus iSubscriptionStatus;
+        
+        /**
+         *
+         */
+        COwnPresenceSubscriptionItem* iOwnPresence;
+        
+        /**
+         *
+         */
+        CPresenceInfoFilterImp* iPifWithoutCtx;
+                    
+        
+    };
+
+
+#endif // CPSCOPERATIONUNSUBSCRIBEOWNPRESENCE_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresenceoperations/presencepublishing/operationunsubscribewatcherlist.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  Presentity group list unsubscription operation
+ *
+*/
+
+
+#include <ximpprotocolconnection.h>
+#include <protocolpresencepublishing.h>
+#include <protocolpresencefeatures.h>
+
+#include "operationunsubscribewatcherlist.h"
+#include "presencedatacacheimp.h"
+#include "ximppanics.h"
+#include "operationsynthesisesubscriptionevent.h"
+#include "ximphost.h"
+#include "ximpstatusimp.h"
+#include "ximppsccontextimp.h"
+#include "protocolpresencedatahostimp.h"
+
+#include "ximptrace.h"
+
+// ============================ MEMBER FUNCTIONS =============================
+
+// ---------------------------------------------------------------------------
+// COperationUnsubscribeWatcherList::COperationUnsubscribeWatcherList()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C COperationUnsubscribeWatcherList::COperationUnsubscribeWatcherList()
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// COperationUnsubscribeWatcherList::~COperationUnsubscribeWatcherList()
+// ---------------------------------------------------------------------------
+//
+COperationUnsubscribeWatcherList::~COperationUnsubscribeWatcherList()
+    {
+    if( iWatcherList )
+        {
+        iWatcherList->Close();
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// COperationUnsubscribeWatcherList::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void COperationUnsubscribeWatcherList::ConstructL( const TDesC8& /*aParamPck*/ )
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// COperationUnsubscribeWatcherList::ProcessL()
+// ---------------------------------------------------------------------------
+//
+void COperationUnsubscribeWatcherList::ProcessL()
+    {
+    TRACE(_L("COperationUnsubscribeWatcherList::ProcessL()" ) );
+    CXIMPOperationBase::ProcessL();
+
+    CWatcherListSubscriptionItem& watcherList =
+                            iMyHost->PresenceDataAccess().PresenceDataCache().WatcherListSubscriptionItemLC();
+    CleanupStack::Pop(); // watcherList
+    iWatcherList = &watcherList;
+
+    iSubscriptionStatus = iWatcherList->SubscriptionStatus( iContext );
+
+    MProtocolPresencePublishing& publishing = iMyHost->GetConnection().ProtocolPresenceFeatures().PresencePublishing();
+
+    switch( iSubscriptionStatus )
+        {
+        case CWatcherListSubscriptionItem::ESubscribedForCtxOnly:
+            {
+            publishing.DoUnsubscribePresenceWatcherListL( iReqId );
+            break;
+            }
+            
+        case CWatcherListSubscriptionItem::ESubscribedForCtxAndOthers:
+            {
+            iMyHost->FakeCompleteRequest( iReqId, KErrNone );
+            break;
+            }
+            
+        case CWatcherListSubscriptionItem::ENotSubscribedAtAll:
+        case CWatcherListSubscriptionItem::ESubscribedForOtherCtxOnly:
+            {
+            iMyHost->FakeCompleteRequest( iReqId, KErrNone );
+            break;
+            }
+
+        XIMP_DEFAULT_CASE_UNSUPPORTED( NXIMPPrivPanic::EInvalidSubscriptionStatus );
+        }
+    }
+
+
+// ---------------------------------------------------------------------------
+// COperationUnsubscribeWatcherList::RequestCompleted()
+// ---------------------------------------------------------------------------
+//
+void COperationUnsubscribeWatcherList::RequestCompletedL()
+    {
+    TRACE(_L("COperationUnsubscribeWatcherList::RequestCompletedL()" ) );
+    CXIMPOperationBase::RequestCompletedL();
+
+    if( iStatusObj->ResultCode() == KErrNone )
+        {
+        switch( iSubscriptionStatus )
+            {
+            case CWatcherListSubscriptionItem::ESubscribedForCtxOnly:
+            case CWatcherListSubscriptionItem::ESubscribedForCtxAndOthers:
+                {
+                iWatcherList->RemoveSubscriber( iContext );
+                break;
+                }
+                
+            case CWatcherListSubscriptionItem::ENotSubscribedAtAll:
+            case CWatcherListSubscriptionItem::ESubscribedForOtherCtxOnly:
+                {
+                break;
+                }
+                
+            XIMP_DEFAULT_CASE_UNSUPPORTED( NXIMPPrivPanic::EInvalidSubscriptionStatus );
+            }
+        SynthesiseEventL();
+        }
+    }
+
+
+// ---------------------------------------------------------------------------
+// COperationUnsubscribeWatcherList::Type()
+// ---------------------------------------------------------------------------
+//
+TInt
+    COperationUnsubscribeWatcherList::Type() const
+    {
+    return NPresenceOps::EPrUnsubscribePresenceWatcherList;
+    }
+
+// ---------------------------------------------------------------------------
+// COperationUnsubscribeWatcherList::SynthesiseEventL()
+// ---------------------------------------------------------------------------
+//
+void COperationUnsubscribeWatcherList::SynthesiseEventL()
+    {
+    COperationSynthesiseSubscriptionEvent* synthOp =
+            new ( ELeave ) COperationSynthesiseSubscriptionEvent(
+                COperationSynthesiseSubscriptionEvent::EPresenceWatcherList,
+                EFalse );
+    CleanupStack::PushL( synthOp );
+    synthOp->BaseConstructL( TXIMPRequestId(), iContext );
+    iMyHost->AddNewOperationL( *synthOp );
+    CleanupStack::Pop( synthOp );
+    }
+
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresenceoperations/presencepublishing/operationunsubscribewatcherlist.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,75 @@
+/*
+* 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 watcher list unsubscription operation
+ *
+*/
+
+#ifndef CPSCOPERATIONUNSUBSCRIBEWATCHERLIST_H
+#define CPSCOPERATIONUNSUBSCRIBEWATCHERLIST_H
+
+
+#include <e32base.h>
+#include <ximpbase.h>
+
+#include "ximpoperationbase.h"
+#include "watcherlistsubscriptionitem.h"
+#include "presenceoperationdefs.h"
+
+/**
+ * Presence interest registration operation.
+ *
+ * @lib ximpoperations.lib
+ * @since S60 v4.0
+ */
+class COperationUnsubscribeWatcherList : public CXIMPOperationBase
+    {
+    public:
+
+        IMPORT_C COperationUnsubscribeWatcherList();
+
+        void ConstructL( const TDesC8& aParamPck );
+
+        ~COperationUnsubscribeWatcherList();
+
+
+    public: // from CXIMPOperationBase
+
+        void ProcessL();
+
+        void RequestCompletedL();
+
+        TInt Type() const;
+
+    private: // Helper methods
+
+        /**
+         * Synthesise event after completion
+         */
+        void SynthesiseEventL();
+
+    private: // data
+
+        /**
+         * Group list access.
+         */
+        CWatcherListSubscriptionItem* iWatcherList;
+
+        /**
+         * Subscription status
+         */
+        CWatcherListSubscriptionItem::TSubscriptionStatus iSubscriptionStatus;
+    };
+
+
+#endif // CPSCOPERATIONUNSUBSCRIBEWATCHERLIST_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresenceoperations/presencewatching/operationhandlepresentitypresence.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  implementation of COperationHandlePresentityPresence
+ *
+*/
+
+
+#include "operationhandlepresentitypresence.h"
+#include "presenceinfoimp.h"
+#include "ximpobjecthelpers.h"
+#include "presencedatacacheimp.h"
+#include "ximpidentityimp.h"
+#include "presentitypresencesubscriptionitem.h"
+#include "ximphost.h"
+
+#include "ximprestrictedobjectcollectionimp.h"
+#include "protocolpresencedatahostimp.h"
+
+#include "ximptrace.h"
+// ============================ MEMBER FUNCTIONS =============================
+
+// ---------------------------------------------------------------------------
+// COperationHandlePresentityPresence::~COperationHandlePresentityPresence()
+// ---------------------------------------------------------------------------
+//
+COperationHandlePresentityPresence::~COperationHandlePresentityPresence()
+    {
+    delete iIdentity;
+    delete iPresenceInfo;
+    }
+
+// ---------------------------------------------------------------------------
+// COperationHandlePresentityPresence::COperationHandlePresentityPresence()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C COperationHandlePresentityPresence::COperationHandlePresentityPresence( TInt aOperation )
+: iOperation( aOperation )
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// COperationHandlePresentityPresence::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void COperationHandlePresentityPresence::ConstructL( const TDesC8& /* aParamPck */ )
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// COperationHandlePresentityPresence::ProcessL()
+// ---------------------------------------------------------------------------
+//
+void COperationHandlePresentityPresence::ProcessL()
+    {
+    TRACE(_L("COperationHandlePresentityPresence::ProcessL()") );
+    CXIMPOperationBase::ProcessL();
+
+    MXIMPBase* object = NULL;
+    iObjCollection->GetByType( object, MXIMPIdentity::KInterfaceId );
+    if ( object )
+        {
+        iIdentity = TXIMPGetImpClassOrPanic< CXIMPIdentityImp >::From( *object );
+        }
+    else
+        {
+        User::Leave( KErrArgument );
+        }
+    object = NULL;
+    iObjCollection->GetByType( object, MPresenceInfo::KInterfaceId );
+    if( object )
+        {
+        iPresenceInfo = TXIMPGetImpClassOrPanic< CPresenceInfoImp >::From( *object );
+        }
+    else
+        {
+        User::Leave( KErrArgument );
+        }
+    
+    CPresentityPresenceSubscriptionItem& presenceItem = 
+        iMyHost->PresenceDataAccess().PresenceDataCache().PresentityPresenceSubscriptionItemLC( *iIdentity );
+    presenceItem.SetPresenceInfoL( iPresenceInfo );        
+    iPresenceInfo = NULL;
+    
+    if( iOperation == NPresenceOps::EPrHandlePresentityPresenceTerminated )
+        {
+        //presenceItem.SetSubscriptionState( MPresenceInfo::EDataSubscriptionTerminated );
+        }
+    
+    TRAPD( err, presenceItem.SynthesiseSubscriptionEventToAllCtxsL() );
+    CleanupStack::PopAndDestroy(); // presenceItem
+    iMyHost->HandleAdaptationRequestCompleted( iReqId, err );
+    }
+
+// ---------------------------------------------------------------------------
+// COperationHandlePresentityPresence::RequestCompleted()
+// ---------------------------------------------------------------------------
+//
+void COperationHandlePresentityPresence::RequestCompletedL()
+    {
+    TRACE(_L("COperationHandlePresentityPresence::RequestCompletedL()" ) );
+    CXIMPOperationBase::RequestCompletedL();    
+    // no special handling for error situations
+    }
+
+
+// ---------------------------------------------------------------------------
+// COperationHandlePresentityPresence::Type()
+// ---------------------------------------------------------------------------
+//
+TInt COperationHandlePresentityPresence::Type() const
+    {
+    return ( TInt) iOperation;
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresenceoperations/presencewatching/operationhandlepresentitypresence.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,75 @@
+/*
+* 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:  Handle presentity group list operation
+ *
+*/
+
+#ifndef CPSCOPERATIONHANDLEPRESENTITYPRESENCE_H
+#define CPSCOPERATIONHANDLEPRESENTITYPRESENCE_H
+
+
+#include <e32base.h>
+#include <ximpbase.h>
+
+#include "ximpoperationbase.h"
+#include "presenceoperationdefs.h"
+
+class CXIMPIdentityImp;
+class CPresenceInfoImp;
+
+/**
+ * Publish presence operation.
+ *
+ * @lib ximpoperations.lib
+ * @since S60 v4.0
+ */
+class COperationHandlePresentityPresence : public CXIMPOperationBase
+    {
+
+    public:
+
+        IMPORT_C COperationHandlePresentityPresence( TInt aOperation );
+
+        void ConstructL( const TDesC8& aParamPck );
+
+        ~COperationHandlePresentityPresence();
+
+    public: // from CXIMPOperationBase
+
+        void ProcessL();
+
+        void RequestCompletedL();
+
+        TInt Type() const;
+
+    private: // data
+        
+        /**
+         * Identity
+         */
+        CXIMPIdentityImp* iIdentity;
+        
+        /**
+         * Presence info
+         */
+        CPresenceInfoImp* iPresenceInfo;
+        
+        /**
+         * Operation. 
+         */
+        TInt iOperation;
+    };
+
+
+#endif // CPSCOPERATIONHANDLEPRESENTITYPRESENCE_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresenceoperations/presencewatching/operationsubscribepresentitygroupmemberspresence.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -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: implementation of COperationSubscribePresentityGroupMembersPresence
+ *
+*/
+
+
+#include <ximpprotocolconnection.h>
+#include <protocolpresencewatching.h>
+#include <protocolpresencefeatures.h>
+
+#include "operationsubscribepresentitygroupmemberspresence.h"
+#include "presenceinfofilterimp.h"
+#include "ximpidentityimp.h"
+#include "ximpobjecthelpers.h"
+#include "presencedatacacheimp.h"
+#include "documentutils.h"
+#include "ximprestrictedobjectcollectionimp.h"
+#include "operationsynthesisesubscriptionevent.h"
+#include "ximphost.h"
+#include "ximpstatusimp.h"
+#include "ximppsccontextimp.h"
+#include "ximppanics.h"
+#include "protocolpresencedatahostimp.h"
+
+#include "ximptrace.h"
+// ============================ MEMBER FUNCTIONS =============================
+
+// ---------------------------------------------------------------------------
+// COperationSubscribePresentityGroupMembersPresence::COperationSubscribePresentityGroupMembersPresence()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C COperationSubscribePresentityGroupMembersPresence::COperationSubscribePresentityGroupMembersPresence()
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// COperationSubscribePresentityGroupMembersPresence::~COperationSubscribePresentityGroupMembersPresence()
+// ---------------------------------------------------------------------------
+//
+COperationSubscribePresentityGroupMembersPresence::~COperationSubscribePresentityGroupMembersPresence()
+    {
+    delete iMergedPif;
+    delete iPif;
+    delete iGroupId;
+    if( iSubItem )
+        {
+        iSubItem->Close();
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// COperationSubscribePresentityGroupMembersPresence::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void COperationSubscribePresentityGroupMembersPresence::ConstructL( const TDesC8& aParamPck )
+    {
+    RXIMPObjOwningPtrArray< HBufC8 > packArray;
+    CleanupClosePushL( packArray );
+    TXIMPHBuf8Packer::UnPackArrayL( packArray, aParamPck );
+
+    iGroupId = CXIMPIdentityImp::NewLC();
+    CleanupStack::Pop( iGroupId );
+    TXIMPObjectPacker< CXIMPIdentityImp >::UnPackL( *iGroupId, *( packArray[ 0 ] ) );
+
+    iPif = CPresenceInfoFilterImp::NewLC();
+    CleanupStack::Pop( iPif );
+    TXIMPObjectPacker< CPresenceInfoFilterImp >::UnPackL( *iPif, *( packArray[ 1 ] ) );
+
+    CleanupStack::PopAndDestroy(); // packArray    
+    }
+
+
+// ---------------------------------------------------------------------------
+// COperationSubscribePresentityGroupMembersPresence::ProcessL()
+// ---------------------------------------------------------------------------
+//
+void COperationSubscribePresentityGroupMembersPresence::ProcessL()
+    {
+    TRACE(_L("COperationSubscribePresentityGroupMembersPresence::ProcessL() - begin" ) );
+    CXIMPOperationBase::ProcessL();
+    
+    CPresentityGroupMembersPresenceSubscriptionItem& subItem =  
+                iMyHost->PresenceDataAccess().PresenceDataCache().PresentityGroupMembersPresenceSubscriptionItemLC( *iGroupId );
+    CleanupStack::Pop(); // subItem
+    iSubItem = &subItem;
+
+    // Get the subscription status
+    // Notice that if there is more than one client and clients are using identity
+    // which will alternate for request complete, this will affect wrong logic mapping
+    // for subscription operation. 
+    
+    // For example: Client 1 is subscription "name" and server alters it to name@domain.com
+    // Client 2 subscribes with "name" and it will get subscription status ENotSubscribedAtAll
+    // when it should get ESubscribedForOtherCtxOnly.
+    iSubscriptionStatus = iSubItem->SubscriptionStatus( iContext );
+
+    MProtocolPresenceWatching& watching = iMyHost->GetConnection().ProtocolPresenceFeatures().PresenceWatching();
+
+    TRACE(_L("COperationSubscribePresentityGroupMembersPresence::ProcessL() - start action" ) );
+    
+    switch( iSubscriptionStatus )
+        {
+        case CPresentityGroupMembersPresenceSubscriptionItem::ENotSubscribedAtAll:
+            {
+            TRACE(_L("COperationSubscribePresentityGroupMembersPresence::ProcessL() - case CPresentityGroupMembersPresenceSubscriptionItem::ENotSubscribedAtAll" ) );
+            
+            iMergedPif = TXIMPObjectCloner< CPresenceInfoFilterImp >::CloneL( *iPif );
+            watching.DoSubscribePresentityGroupMembersPresenceL( *iGroupId,
+                                                                   *iMergedPif,
+                                                                   iReqId );
+            break;
+            }
+        case CPresentityGroupMembersPresenceSubscriptionItem::ESubscribedForOtherCtxOnly:
+            {
+            TRACE(_L("COperationSubscribePresentityGroupMembersPresence::ProcessL() - case CPresentityGroupMembersPresenceSubscriptionItem::ESubscribedForOtherCtxOnly" ) );
+            
+            // Aggregate subscription and context pifs
+            // Check aggregate and if needed.. update subscription
+            iMergedPif = DocumentUtils::InfoFilterUnionL( iSubItem->SubscriptionPif(), *iPif );
+            if( iMergedPif->Contains( iSubItem->SubscriptionPif() ) )
+                {
+                TRACE(_L("COperationSubscribePresentityGroupMembersPresence::ProcessL() -  if( iMergedPif->Contains( iSubItem->SubscriptionPif() ) ) " ) );                            
+                            
+                watching.DoUpdatePresentityGroupMembersPresenceSubscriptionPifL( *iGroupId, 
+                                                                                *iMergedPif, 
+                                                                                iReqId );
+                }
+            else
+                {
+                TRACE(_L("COperationSubscribePresentityGroupMembersPresence::ProcessL() - iMyHost->FakeCompleteRequest" ) );                            
+                iMyHost->FakeCompleteRequest( iReqId, KErrNone );
+                }
+            break;
+            }
+        case CPresentityGroupMembersPresenceSubscriptionItem::ESubscribedForCtxOnly:
+        case CPresentityGroupMembersPresenceSubscriptionItem::ESubscribedForCtxAndOthers:
+            {
+            TRACE(_L("COperationSubscribePresentityGroupMembersPresence::ProcessL() - case CPresentityGroupMembersPresenceSubscriptionItem::ESubscribedForCtxOnly and ESubscribedForCtxAndOthers" ) );
+            
+            CPresenceInfoFilterImp* oldPif = 
+                    iContext->PresenceInfoFilter( MXIMPPscContext::EPresentityGroupMemberPresenceFilter, iGroupId );
+            CPresenceInfoFilterImp& oldMergedPif = iSubItem->SubscriptionPif();
+            TBool makeUnion( EFalse );
+            if( !oldPif )
+                {
+                TRACE(_L("COperationSubscribePresentityGroupMembersPresence::ProcessL() no old pif" ) );
+                makeUnion = ETrue;
+                }
+            else if ( *oldPif != *iPif ) 
+                {
+                makeUnion = ETrue;
+                }
+            if( makeUnion )
+                {
+                TRACE(_L("COperationSubscribePresentityGroupMembersPresence::ProcessL() - if( *oldPif != *iPif )" ) );                            
+                
+                iDoNotForce = ETrue;
+                CPresenceInfoFilterImp* withoutPif = 
+                            iSubItem->CollectSubscriptionPifWithoutCtxL( iContext );
+                iMergedPif = DocumentUtils::InfoFilterUnionL( *withoutPif, *iPif );
+                }
+            else
+                {
+                TRACE(_L("COperationSubscribePresentityGroupMembersPresence::ProcessL() -  iMergedPif = TXIMPObjectCloner< CPresenceInfoFilterImp >::CloneL( oldMergedPif );" ) );                            
+                
+                iMergedPif = TXIMPObjectCloner< CPresenceInfoFilterImp >::CloneL( oldMergedPif );
+                }
+                
+            if( iMergedPif->Contains( oldMergedPif ) )
+                {
+                TRACE(_L("COperationSubscribePresentityGroupMembersPresence::ProcessL() -  if( iMergedPif->Contains( oldMergedPif ) )" ) );                            
+                
+                iDoNotForce = ETrue;
+                watching.DoUpdatePresentityGroupMembersPresenceSubscriptionPifL( *iGroupId, *iMergedPif, iReqId );
+                }
+            else
+                {
+                TRACE(_L("COperationSubscribePresentityGroupMembersPresence::ProcessL() -  iMyHost->FakeCompleteRequest( iReqId, KErrNone );" ) );                            
+                
+                iMyHost->FakeCompleteRequest( iReqId, KErrNone );
+                }
+            break;
+            }
+        
+        XIMP_DEFAULT_CASE_UNSUPPORTED( NXIMPPrivPanic::EInvalidSubscriptionStatus );            
+        }
+        
+    TRACE(_L("COperationSubscribePresentityGroupMembersPresence::ProcessL() - end" ) );
+    }
+
+
+// ---------------------------------------------------------------------------
+// COperationSubscribePresentityGroupMembersPresence::RequestCompletedL()
+// ---------------------------------------------------------------------------
+//
+void COperationSubscribePresentityGroupMembersPresence::RequestCompletedL()
+    {
+    TRACE(_L("COperationSubscribePresentityGroupMembersPresence::RequestCompletedL() - begin" ) );
+    CXIMPOperationBase::RequestCompletedL();
+
+    TRACE(_L("COperationSubscribePresentityGroupMembersPresence::RequestCompletedL() : after CXIMPOperationBase::RequestCompletedL" ) );
+    if( iStatusObj->ResultCode() == KErrNone )
+        {
+        TRACE(_L("COperationSubscribePresentityGroupMembersPresence::RequestCompletedL() : iStatusObj->ResultCode() == KErrNone " ) );
+        
+        if( iSubscriptionStatus == 
+                    CPresentityGroupMembersPresenceSubscriptionItem::ENotSubscribedAtAll )
+            {
+            TRACE(_L("COperationSubscribePresentityGroupMembersPresence::RequestCompletedL() : iSubscriptionStatus == ENotSubscribedAtAll " ) );
+            
+            MXIMPBase* object = NULL; 
+            iObjCollection->GetByType( object, MXIMPIdentity::KInterfaceId );
+            if( object )
+                {
+                TRACE(_L("COperationSubscribePresentityGroupMembersPresence::RequestCompletedL got altered identity()"));
+                delete iGroupId;
+                iGroupId = TXIMPGetImpClassOrPanic< CXIMPIdentityImp >::From( *object );
+
+                // Got altered identity. If it differs from original
+                // we'll create a new subscription item and close the old.
+                CPresentityGroupMembersPresenceSubscriptionItem& altSubItem = 
+                    iMyHost->PresenceDataAccess().PresenceDataCache().PresentityGroupMembersPresenceSubscriptionItemLC( *iGroupId );
+
+                iSubItem->Close();
+                iSubItem = &altSubItem;
+
+                CleanupStack::Pop(); // altSubItem                    
+                }            
+            }
+            
+        TRACE(_L("COperationSubscribePresentityGroupMembersPresence::RequestCompletedL() : before iSubItem->AddSubscriberL"));            
+        TRACE_1(_L(" iSubscriptionStatus = %d" ), (TInt)iSubscriptionStatus );  
+        if( iSubscriptionStatus == 
+                    CPresentityGroupMembersPresenceSubscriptionItem::ENotSubscribedAtAll ||
+            iSubscriptionStatus == 
+                    CPresentityGroupMembersPresenceSubscriptionItem::ESubscribedForOtherCtxOnly )
+            {
+            iSubItem->AddSubscriberL( iContext );        
+            TRACE(_L("COperationSubscribePresentityGroupMembersPresence::RequestCompletedL():  iSubItem->AddSubscriberL( iContext ) called:  " ) );     
+            }
+            
+        iContext->SetPresenceInfoFilterL( MXIMPPscContext::EPresentityGroupMemberPresenceFilter,
+                iPif, iGroupId );
+        iPif = NULL;
+        iSubItem->SetSubscriptionPif( iMergedPif );
+        iMergedPif = NULL;
+
+        SynthesiseEventL();
+        }
+    
+    TRACE(_L("COperationSubscribePresentityGroupMembersPresence::RequestCompletedL():  end " ) );        
+    }
+
+// ---------------------------------------------------------------------------
+// COperationSubscribePresentityGroupMembersPresence::Type()
+// ---------------------------------------------------------------------------
+//
+TInt
+    COperationSubscribePresentityGroupMembersPresence::Type() const
+    {
+    return NPresenceOps::EPrSubscribePresentityGroupMembersPresence;
+    }
+
+// ---------------------------------------------------------------------------
+// COperationSubscribePresentityGroupMembersPresence::SynthesiseEventL()
+// ---------------------------------------------------------------------------
+//
+void COperationSubscribePresentityGroupMembersPresence::SynthesiseEventL()
+    {
+    TBool force = 
+    ( iSubscriptionStatus == CPresentityGroupMembersPresenceSubscriptionItem::ESubscribedForCtxOnly ||
+      iSubscriptionStatus == CPresentityGroupMembersPresenceSubscriptionItem::ESubscribedForCtxAndOthers ) ? ETrue : EFalse;
+    TRACE_1(_L("COperationSubscribePresentityGroupMembersPresence::SynthesiseEventL - force=%d" ) , force);
+    COperationSynthesiseSubscriptionEvent* synthOp =
+        new ( ELeave ) COperationSynthesiseSubscriptionEvent(
+            COperationSynthesiseSubscriptionEvent::EPresentityGroupMembersPresence, force && !iDoNotForce );
+    CleanupStack::PushL( synthOp );    
+    synthOp->BaseConstructL( TXIMPRequestId(), iContext );
+    synthOp->ConstructL( *iGroupId );
+    iMyHost->AddNewOperationL( *synthOp );
+    CleanupStack::Pop( synthOp );    
+    }
+
+
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresenceoperations/presencewatching/operationsubscribepresentitygroupmemberspresence.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,97 @@
+/*
+* 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: Operationon SubscribePresentityGroupMembers Presence
+ *
+*/
+
+#ifndef CPSCOPERATIONSUBSCRIBEPRESENTITYGROUPMEMBERSPRESENCE_H
+#define CPSCOPERATIONSUBSCRIBEPRESENTITYGROUPMEMBERSPRESENCE_H
+
+
+#include <e32base.h>
+#include <ximpbase.h>
+
+#include "ximpoperationbase.h"
+#include "presentitygroupmemberspresencesubscriptionitem.h"
+
+/**
+ * Group members presence subscription
+ *
+ * @lib ximpoperations.lib
+ * @since S60 v4.0
+ */
+class COperationSubscribePresentityGroupMembersPresence : public CXIMPOperationBase
+    {
+
+    public:
+
+        IMPORT_C COperationSubscribePresentityGroupMembersPresence();
+
+        void ConstructL( const TDesC8& aParamPck );
+
+        ~COperationSubscribePresentityGroupMembersPresence();
+
+
+    public: // from CXIMPOperationBase
+
+        void ProcessL();
+
+        void RequestCompletedL();
+
+        TInt Type() const;
+
+    private: // Helper methods
+
+        /**
+         * Synthesise event after completion
+         */
+        void SynthesiseEventL();
+
+    private: // data
+
+        /**
+         * Presentity address
+         * Own.
+         */
+        CXIMPIdentityImp* iGroupId;
+
+        /**
+         * Subscription item
+         */
+        CPresentityGroupMembersPresenceSubscriptionItem* iSubItem;
+        
+        /**
+         * Presence info filter having new presence info filter for context.
+         * Own.
+         */
+        CPresenceInfoFilterImp* iMergedPif; 
+        
+        /**
+         * Pif from call
+         */
+        CPresenceInfoFilterImp* iPif;
+        
+        /**
+         * Subscription status
+         */
+        CPresentityGroupMembersPresenceSubscriptionItem::TSubscriptionStatus iSubscriptionStatus;
+        
+        /**
+         * Don't force event.
+         */
+        TBool iDoNotForce;        
+    };
+
+
+#endif // CPSCOPERATIONSUBSCRIBEPRESENTITYGROUPMEMBERSPRESENCE_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresenceoperations/presencewatching/operationsubscribepresentitypresence.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,279 @@
+/*
+* 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 of COperationSubscribePresentityPresence
+ *
+*/
+
+
+#include <ximpprotocolconnection.h>
+#include <protocolpresencewatching.h>
+#include <protocolpresencefeatures.h>
+
+#include "operationsubscribepresentitypresence.h"
+#include "presenceinfofilterimp.h"
+#include "ximpidentityimp.h"
+#include "ximpobjecthelpers.h"
+#include "documentutils.h"
+#include "presencedatacacheimp.h"
+#include "ximppanics.h"
+#include "operationsynthesisesubscriptionevent.h"
+#include "ximprestrictedobjectcollectionimp.h"
+#include "ximphost.h"
+#include "ximpstatusimp.h"
+#include "ximppsccontextimp.h"
+#include "protocolpresencedatahostimp.h"
+
+#include "ximptrace.h"
+
+// ============================ MEMBER FUNCTIONS =============================
+
+// ---------------------------------------------------------------------------
+// COperationSubscribePresentityPresence::COperationSubscribePresentityPresence()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C COperationSubscribePresentityPresence::COperationSubscribePresentityPresence()
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// COperationSubscribePresentityPresence::~COperationSubscribePresentityPresence()
+// ---------------------------------------------------------------------------
+//
+COperationSubscribePresentityPresence::~COperationSubscribePresentityPresence()
+    {
+    delete iPif;
+    delete iMergedPif;
+    delete iIdentity;
+    if( iSubItem )
+        {
+        iSubItem->Close();
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// COperationSubscribePresentityPresence::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void COperationSubscribePresentityPresence::ConstructL( const TDesC8& aParamPck )
+    {
+    RXIMPObjOwningPtrArray< HBufC8 > packArray;
+    CleanupClosePushL( packArray );
+    TXIMPHBuf8Packer::UnPackArrayL( packArray, aParamPck );
+
+    iIdentity = CXIMPIdentityImp::NewLC();
+    CleanupStack::Pop( iIdentity );
+    TXIMPObjectPacker< CXIMPIdentityImp >::UnPackL( *iIdentity, *( packArray[ 0 ] ) );
+
+    iPif = CPresenceInfoFilterImp::NewLC();
+    CleanupStack::Pop( iPif );
+    TXIMPObjectPacker< CPresenceInfoFilterImp >::UnPackL( *iPif, *( packArray[ 1 ] ) );
+
+    CleanupStack::PopAndDestroy(); // packArray
+    }
+
+
+// ---------------------------------------------------------------------------
+// COperationSubscribePresentityPresence::ProcessL()
+// ---------------------------------------------------------------------------
+//
+void COperationSubscribePresentityPresence::ProcessL()
+    {
+    TRACE(_L("COperationSubscribePresentityPresence::ProcessL()" ) );
+    CXIMPOperationBase::ProcessL();
+
+    // MatchAddressTo( subscriptions, iIdentity )
+    CPresentityPresenceSubscriptionItem& subItem =
+                iMyHost->PresenceDataAccess().PresenceDataCache().PresentityPresenceSubscriptionItemLC( *iIdentity );
+    CleanupStack::Pop(); // subItem
+    iSubItem = &subItem;
+
+    // Get the subscription status
+    // Notice that if there is more than one client and clients are using identity
+    // which will alternate for request complete, this will affect wrong logic mapping
+    // for subscription operation. 
+    
+    // For example: Client 1 is subscription "name" and server alters it to name@domain.com
+    // Client 2 subscribes with "name" and it will get subscription status ENotSubscribedAtAll
+    // when it should get ESubscribedForOtherCtxOnly.
+    iSubscriptionStatus = iSubItem->SubscriptionStatus( iContext );
+
+    MProtocolPresenceWatching& watching = iMyHost->GetConnection().ProtocolPresenceFeatures().PresenceWatching();
+
+    switch( iSubscriptionStatus )
+        {
+        case CPresentityPresenceSubscriptionItem::ENotSubscribedAtAll:
+            {
+            TRACE(_L("COperationSubscribePresentityPresence::ProcessL() not subscribed" ) );
+            iMergedPif = TXIMPObjectCloner< CPresenceInfoFilterImp >::CloneL( *iPif );
+            // If this leaves, subscription is not created
+            watching.DoSubscribePresentityPresenceL( iSubItem->Identity(),
+                    *iMergedPif,
+                    iReqId );
+            break;
+            }
+        case CPresentityPresenceSubscriptionItem::ESubscribedForOtherCtxOnly:
+            {
+            TRACE(_L("COperationSubscribePresentityPresence::ProcessL() subscribed for other ctx" ) );
+            // Aggregate subscription and context pifs
+            // Check aggregate and if needed.. update subscription
+            iMergedPif = DocumentUtils::InfoFilterUnionL( iSubItem->SubscriptionPif(), *iPif );
+            if( iMergedPif->Contains( iSubItem->SubscriptionPif() ) )
+                {
+                TRACE(_L("COperationSubscribePresentityPresence::ProcessL() DoUpdatePresentityPresenceSubscriptionPifL 1" ) );
+                // If this leaves, subscription is not created
+                watching.DoUpdatePresentityPresenceSubscriptionPifL( *iIdentity, *iMergedPif, iReqId );
+                }
+            else
+                {
+                TRACE(_L("COperationSubscribePresentityPresence::ProcessL() FakeCompleteRequest" ) );
+                iMyHost->FakeCompleteRequest( iReqId, KErrNone );
+                }
+            break;
+            }
+        case CPresentityPresenceSubscriptionItem::ESubscribedForCtxOnly:
+        case CPresentityPresenceSubscriptionItem::ESubscribedForCtxAndOthers:
+            {
+            TRACE(_L("COperationSubscribePresentityPresence::ProcessL() subscribed" ) );
+            CPresenceInfoFilterImp* oldPif = 
+                    iContext->PresenceInfoFilter( MXIMPPscContext::EPresentityPresenceFilter, iIdentity );
+            CPresenceInfoFilterImp& oldMergedPif = iSubItem->SubscriptionPif();
+            TBool fake( ETrue );
+            TBool makeUnion( EFalse );
+            if( !oldPif )
+                {
+                TRACE(_L("COperationSubscribePresentityPresence::ProcessL() no old pif" ) );
+                makeUnion = ETrue;
+                }
+            else if ( *oldPif != *iPif ) 
+                {
+                makeUnion = ETrue;
+                }
+            if( makeUnion )
+                {
+                iDoNotForce = ETrue;
+                CPresenceInfoFilterImp* withoutPif = 
+                            iSubItem->CollectSubscriptionPifWithoutCtxL( iContext );
+                iMergedPif = DocumentUtils::InfoFilterUnionL( *withoutPif, *iPif );
+                if( iMergedPif->Contains( oldMergedPif ) )
+                    {
+                    fake = EFalse;
+                    TRACE(_L("COperationSubscribePresentityPresence::ProcessL() DoUpdatePresentityPresenceSubscriptionPifL 2" ) );
+                    watching.DoUpdatePresentityPresenceSubscriptionPifL( *iIdentity, *iMergedPif, iReqId );
+                    }
+                }
+            else
+                {
+                iMergedPif = TXIMPObjectCloner< CPresenceInfoFilterImp >::CloneL( oldMergedPif );
+                }
+
+            if( fake )
+                {
+                TRACE(_L("COperationSubscribePresentityPresence::ProcessL() FakeCompleteRequest" ) );
+                iMyHost->FakeCompleteRequest( iReqId, KErrNone );
+                }
+            break;
+            }
+
+        XIMP_DEFAULT_CASE_UNSUPPORTED( NXIMPPrivPanic::EInvalidSubscriptionStatus );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// COperationSubscribePresentityPresence::RequestCompletedL()
+// ---------------------------------------------------------------------------
+//
+void COperationSubscribePresentityPresence::RequestCompletedL()
+    {
+    TRACE(_L("COperationSubscribePresentityPresence::RequestCompletedL()" ) );
+    CXIMPOperationBase::RequestCompletedL();
+
+    if( iStatusObj->ResultCode() == KErrNone )
+        {
+        if( iSubscriptionStatus == CPresentityPresenceSubscriptionItem::ENotSubscribedAtAll )
+            {
+            TRACE(_L("COperationSubscribePresentityPresence::RequestCompletedL() ENotSubscribedAtAll" ) );
+            MXIMPBase* object = NULL; 
+            iObjCollection->GetByType( object, MXIMPIdentity::KInterfaceId );
+            if( object )
+                {
+                TRACE(_L("COperationSubscribePresentityPresence::RequestCompletedL() identity change" ) );
+                delete iIdentity;
+                iIdentity = TXIMPGetImpClassOrPanic< CXIMPIdentityImp >::From( *object );
+
+                // Got altered identity. If it differs from original
+                // we'll create a new subscription item and close the old.
+                CPresentityPresenceSubscriptionItem& altSubItem = 
+                    iMyHost->PresenceDataAccess().PresenceDataCache().PresentityPresenceSubscriptionItemLC( *iIdentity );
+
+                iSubItem->Close();
+                iSubItem = &altSubItem;
+
+                CleanupStack::Pop(); // altSubItem                    
+                }            
+            }
+            
+        if( iSubscriptionStatus == CPresentityPresenceSubscriptionItem::ENotSubscribedAtAll ||
+            iSubscriptionStatus == CPresentityPresenceSubscriptionItem::ESubscribedForOtherCtxOnly )
+            {
+            TRACE(_L("COperationSubscribePresentityPresence::RequestCompletedL() calling iSubItem->AddSubscriberL" ) );
+            TInt error ( KErrNone );
+            TRAP( error, iSubItem->AddSubscriberL( iContext ) );
+            TRACE_1( _L("COperationSubscribePresentityPresence::RequestCompletedL():  iSubItem->AddSubscriberL : error =%d"), error );
+            }
+            
+        iContext->SetPresenceInfoFilterL( MXIMPPscContext::EPresentityPresenceFilter,
+                iPif, iIdentity );
+        iPif = NULL;
+        iSubItem->SetSubscriptionPif( iMergedPif );
+        iMergedPif = NULL;
+
+        SynthesiseEventL();
+        }
+    }
+
+
+// ---------------------------------------------------------------------------
+// COperationSubscribePresentityPresence::Type()
+// ---------------------------------------------------------------------------
+//
+TInt
+    COperationSubscribePresentityPresence::Type() const
+    {
+    return NPresenceOps::EPrSubscribePresentityPresence;
+    }
+
+// ---------------------------------------------------------------------------
+// COperationSubscribePresentityPresence::SynthesiseEventL()
+// ---------------------------------------------------------------------------
+//
+void COperationSubscribePresentityPresence::SynthesiseEventL()
+    {
+    TBool force =
+    ( iSubscriptionStatus == CPresentityPresenceSubscriptionItem::ESubscribedForCtxOnly ||
+      iSubscriptionStatus == CPresentityPresenceSubscriptionItem::ESubscribedForCtxAndOthers ) ? ETrue : EFalse;
+
+    COperationSynthesiseSubscriptionEvent* synthOp =
+            new ( ELeave ) COperationSynthesiseSubscriptionEvent(
+                COperationSynthesiseSubscriptionEvent::EPresentityPresence, force && !iDoNotForce  );
+    CleanupStack::PushL( synthOp );
+    synthOp->BaseConstructL( TXIMPRequestId(), iContext );
+    synthOp->ConstructL( *iIdentity );
+    iMyHost->AddNewOperationL( *synthOp );
+    CleanupStack::Pop( synthOp );
+    }
+
+
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresenceoperations/presencewatching/operationsubscribepresentitypresence.h	Wed Nov 03 09:32:20 2010 +0530
@@ -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: implementation of COperationSubscribePresentityPresence
+ *
+*/
+
+#ifndef CPSCOPERATIONSUBSCRIBEPRESENTITYPRESENCE_H
+#define CPSCOPERATIONSUBSCRIBEPRESENTITYPRESENCE_H
+
+
+#include <e32base.h>
+#include <ximpbase.h>
+
+#include "ximpoperationbase.h"
+#include "presentitypresencesubscriptionitem.h"
+
+class CPresenceInfoFilterImp;
+
+/**
+ * Presence interest registration operation.
+ *
+ * @lib ximpoperations.lib
+ * @since S60 v4.0
+ */
+class COperationSubscribePresentityPresence : public CXIMPOperationBase
+    {
+
+    public:
+
+        IMPORT_C COperationSubscribePresentityPresence();
+
+        void ConstructL( const TDesC8& aParamPck );
+
+        ~COperationSubscribePresentityPresence();
+
+
+    public: // from CXIMPOperationBase
+
+        void ProcessL();
+
+        void RequestCompletedL();
+
+        TInt Type() const;
+
+    private: // Helper methods
+
+        /**
+         * Synthesise event after completion
+         */
+        void SynthesiseEventL();
+
+    private: // data
+        
+        /**
+         * Presence info filter having new presence info filter for context.
+         * Own.
+         */
+        CPresenceInfoFilterImp* iMergedPif;
+        
+        /**
+         * Presentity subscription item
+         * Own.
+         */
+        CPresentityPresenceSubscriptionItem* iSubItem;
+        
+        /**
+         * Presentity address
+         * Own.
+         */
+        CXIMPIdentityImp* iIdentity;
+        
+        /**
+         * Filter
+         * Own.
+         */
+        CPresenceInfoFilterImp* iPif;
+        
+        /**
+         * Subscription status
+         */
+        CPresentityPresenceSubscriptionItem::TSubscriptionStatus iSubscriptionStatus;
+        
+        /**
+         * Don't force event.
+         */
+        TBool iDoNotForce;
+    };
+
+
+#endif // CPSCOPERATIONSUBSCRIBEPRESENTITYPRESENCE_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresenceoperations/presencewatching/operationunsubscribepresentitygroupmemberspresence.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  Presentity group members presence unsubscription operation
+ *
+*/
+
+
+#include <ximpprotocolconnection.h>
+#include <protocolpresencewatching.h>
+#include <protocolpresencefeatures.h>
+
+#include "operationunsubscribepresentitygroupmemberspresence.h"
+#include "ximpobjecthelpers.h"
+#include "ximpidentityimp.h"
+#include "presencedatacacheimp.h"
+#include "presenceinfofilterimp.h"
+#include "operationsynthesisesubscriptionevent.h"
+#include "ximphost.h"
+#include "ximpstatusimp.h"
+#include "ximppsccontextimp.h"
+#include "ximppanics.h"
+#include "protocolpresencedatahostimp.h"
+
+#include "ximptrace.h"
+// ============================ MEMBER FUNCTIONS =============================
+
+// ---------------------------------------------------------------------------
+// COperationUnsubscribePresentityGroupMembersPresence::COperationUnsubscribePresentityGroupMembersPresence()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C COperationUnsubscribePresentityGroupMembersPresence::COperationUnsubscribePresentityGroupMembersPresence()
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// COperationUnsubscribePresentityGroupMembersPresence::~COperationUnsubscribePresentityGroupMembersPresence()
+// ---------------------------------------------------------------------------
+//
+COperationUnsubscribePresentityGroupMembersPresence::~COperationUnsubscribePresentityGroupMembersPresence()
+    {
+    delete iGroupId;
+    if( iSubItem )
+        {
+        iSubItem->Close();
+        }    
+    }
+
+// ---------------------------------------------------------------------------
+// COperationUnsubscribePresentityGroupMembersPresence::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void COperationUnsubscribePresentityGroupMembersPresence::ConstructL( const TDesC8& aParamPck )
+    {
+    iGroupId = CXIMPIdentityImp::NewLC();
+    CleanupStack::Pop( iGroupId );
+    TXIMPObjectPacker< CXIMPIdentityImp >::UnPackL( *iGroupId, aParamPck );
+    }
+
+
+// ---------------------------------------------------------------------------
+// COperationUnsubscribePresentityGroupMembersPresence::ProcessL()
+// ---------------------------------------------------------------------------
+//
+void COperationUnsubscribePresentityGroupMembersPresence::ProcessL()
+    {
+    TRACE(_L("COperationUnsubscribePresentityGroupMembersPresence::ProcessL()" ) );
+    CXIMPOperationBase::ProcessL();
+    
+    CPresentityGroupMembersPresenceSubscriptionItem& subItem =
+                iMyHost->PresenceDataAccess().PresenceDataCache().PresentityGroupMembersPresenceSubscriptionItemLC( *iGroupId );
+    CleanupStack::Pop(); // subItem
+    iSubItem = &subItem;
+
+    iSubscriptionStatus = iSubItem->SubscriptionStatus( iContext );
+
+    MProtocolPresenceWatching& watching = iMyHost->GetConnection().ProtocolPresenceFeatures().PresenceWatching();
+
+    switch( iSubscriptionStatus )
+        {
+        case CPresentityGroupMembersPresenceSubscriptionItem::ESubscribedForCtxOnly:
+            {
+            watching.DoUnsubscribePresentityGroupMembersPresenceL( *iGroupId, iReqId );
+            iSubItem->RemoveSubscriber( iContext );
+            break;
+            }
+            
+        case CPresentityGroupMembersPresenceSubscriptionItem::ESubscribedForCtxAndOthers:
+            {
+            CPresenceInfoFilterImp* pifWithoutCtx =
+                iSubItem->CollectSubscriptionPifWithoutCtxL( iContext );
+            CleanupStack::PushL( pifWithoutCtx );
+
+            if ( iSubItem->SubscriptionPif().Contains( *pifWithoutCtx ) )
+                {
+                watching.DoUpdatePresentityGroupMembersPresenceSubscriptionPifL( *iGroupId, *pifWithoutCtx, iReqId );
+                }
+            else
+                {
+                iMyHost->FakeCompleteRequest( iReqId, KErrNone );
+                }
+
+            CleanupStack::PopAndDestroy( pifWithoutCtx );
+            break;
+            }
+            
+        case CPresentityGroupMembersPresenceSubscriptionItem::ENotSubscribedAtAll:
+        case CPresentityGroupMembersPresenceSubscriptionItem::ESubscribedForOtherCtxOnly:
+            {
+            iMyHost->FakeCompleteRequest( iReqId, KErrNone );
+            break;
+            }
+            
+        XIMP_DEFAULT_CASE_UNSUPPORTED( NXIMPPrivPanic::EInvalidSubscriptionStatus );
+        }    
+    }
+
+// ---------------------------------------------------------------------------
+// COperationUnsubscribePresentityGroupMembersPresence::RequestCompleted()
+// ---------------------------------------------------------------------------
+//
+void COperationUnsubscribePresentityGroupMembersPresence::RequestCompletedL()
+    {
+    TRACE(_L("COperationUnsubscribePresentityGroupMembersPresence::RequestCompletedL()" ) );
+    CXIMPOperationBase::RequestCompletedL();
+
+    if( iStatusObj->ResultCode() == KErrNone )
+        {
+        iContext->SetPresenceInfoFilterL( MXIMPPscContext::EPresentityGroupMemberPresenceFilter,
+                NULL, iGroupId );
+
+        switch( iSubscriptionStatus )
+            {
+            case CPresentityGroupMembersPresenceSubscriptionItem::ESubscribedForCtxOnly:
+            case CPresentityGroupMembersPresenceSubscriptionItem::ESubscribedForCtxAndOthers:
+                {
+                iSubItem->RemoveSubscriber( iContext );
+                break;
+                }
+                
+            case CPresentityGroupMembersPresenceSubscriptionItem::ENotSubscribedAtAll:
+            case CPresentityGroupMembersPresenceSubscriptionItem::ESubscribedForOtherCtxOnly:
+                {
+                break;
+                }
+                
+            XIMP_DEFAULT_CASE_UNSUPPORTED( NXIMPPrivPanic::EInvalidSubscriptionStatus );
+            }
+
+        SynthesiseEventL();
+        }
+    }
+
+
+// ---------------------------------------------------------------------------
+// COperationUnsubscribePresentityGroupMembersPresence::Type()
+// ---------------------------------------------------------------------------
+//
+TInt
+    COperationUnsubscribePresentityGroupMembersPresence::Type() const
+    {
+    return NPresenceOps::EPrUnsubscribePresentityGroupMembersPresence;
+    }
+
+// ---------------------------------------------------------------------------
+// COperationUnsubscribePresentityGroupMembersPresence::SynthesiseEventL()
+// ---------------------------------------------------------------------------
+//
+void COperationUnsubscribePresentityGroupMembersPresence::SynthesiseEventL()
+    {
+    COperationSynthesiseSubscriptionEvent* synthOp =
+            new ( ELeave ) COperationSynthesiseSubscriptionEvent(
+                             COperationSynthesiseSubscriptionEvent::EPresentityGroupMembersPresence, EFalse );
+    CleanupStack::PushL( synthOp );
+    synthOp->BaseConstructL( TXIMPRequestId(), iContext );
+    synthOp->ConstructL( *iGroupId );
+    iMyHost->AddNewOperationL( *synthOp );
+    CleanupStack::Pop( synthOp );
+    }
+
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresenceoperations/presencewatching/operationunsubscribepresentitygroupmemberspresence.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,82 @@
+/*
+* 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:  Presentity group members presence unsubscription operation
+ *
+*/
+
+#ifndef CPSCOPERATIONUNSUBSCRIBEPRESENTITYGROUPMEMBERSPRESENCE_H
+#define CPSCOPERATIONUNSUBSCRIBEPRESENTITYGROUPMEMBERSPRESENCE_H
+
+
+#include <e32base.h>
+#include <ximpbase.h>
+
+#include "ximpoperationbase.h"
+#include "presentitygroupmemberspresencesubscriptionitem.h"
+
+/**
+ * Group members presence unsubscription
+ *
+ * @lib ximpoperations.lib
+ * @since S60 v4.0
+ */
+class COperationUnsubscribePresentityGroupMembersPresence : public CXIMPOperationBase
+    {
+    public:
+
+        IMPORT_C COperationUnsubscribePresentityGroupMembersPresence();
+
+        void ConstructL( const TDesC8& aParamPck );
+
+        ~COperationUnsubscribePresentityGroupMembersPresence();
+
+
+    public: // from CXIMPOperationBase
+
+        void ProcessL();
+
+        void RequestCompletedL();
+
+        TInt Type() const;
+
+    private: // Helper methods
+
+        /**
+         * Synthesise event after completion
+         */
+        void SynthesiseEventL();
+
+    private: // data
+
+        /**
+         * Presence subscription item
+         * Own.
+         */
+        CPresentityGroupMembersPresenceSubscriptionItem* iSubItem;
+
+        /**
+         * Presentity address
+         * Own.
+         */
+        CXIMPIdentityImp* iGroupId;
+
+        /**
+         * Subscription status
+         */
+        CPresentityGroupMembersPresenceSubscriptionItem::TSubscriptionStatus iSubscriptionStatus;
+
+    };
+
+
+#endif // CPSCOPERATIONUNSUBSCRIBEPRESENTITYGROUPMEMBERSPRESENCE_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresenceoperations/presencewatching/operationunsubscribepresentitypresence.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  Presentity presence unsubscription operation
+ *
+*/
+
+
+#include <ximpprotocolconnection.h>
+#include <protocolpresencewatching.h>
+#include <protocolpresencefeatures.h>
+
+#include "operationunsubscribepresentitypresence.h"
+#include "presenceinfofilterimp.h"
+#include "ximpidentityimp.h"
+#include "ximpobjecthelpers.h"
+#include "presencedatacacheimp.h"
+#include "ximppanics.h"
+#include "operationsynthesisesubscriptionevent.h"
+#include "ximphost.h"
+#include "ximpstatusimp.h"
+#include "ximppsccontextimp.h"
+#include "protocolpresencedatahostimp.h"
+
+#include "ximptrace.h"
+// ============================ MEMBER FUNCTIONS =============================
+
+// ---------------------------------------------------------------------------
+// COperationUnsubscribePresentityPresence::COperationUnsubscribePresentityPresence()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C COperationUnsubscribePresentityPresence::COperationUnsubscribePresentityPresence()
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// COperationUnsubscribePresentityPresence::~COperationUnsubscribePresentityPresence()
+// ---------------------------------------------------------------------------
+//
+COperationUnsubscribePresentityPresence::~COperationUnsubscribePresentityPresence()
+    {
+    delete iIdentity;
+    if( iSubItem )
+        {
+        iSubItem->Close();
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// COperationUnsubscribePresentityPresence::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void COperationUnsubscribePresentityPresence::ConstructL( const TDesC8& aParamPck )
+    {
+    iIdentity = CXIMPIdentityImp::NewLC();
+    CleanupStack::Pop( iIdentity );
+    TXIMPObjectPacker< CXIMPIdentityImp >::UnPackL( *iIdentity, aParamPck );
+    }
+
+
+// ---------------------------------------------------------------------------
+// COperationUnsubscribePresentityPresence::ProcessL()
+// ---------------------------------------------------------------------------
+//
+void COperationUnsubscribePresentityPresence::ProcessL()
+    {
+    TRACE(_L("COperationUnsubscribePresentityPresence::ProcessL()" ) );
+    CXIMPOperationBase::ProcessL();
+
+    CPresentityPresenceSubscriptionItem& subItem =
+                iMyHost->PresenceDataAccess().PresenceDataCache().PresentityPresenceSubscriptionItemLC( *iIdentity );
+    CleanupStack::Pop(); // subItem
+    iSubItem = &subItem;
+
+    iSubscriptionStatus = iSubItem->SubscriptionStatus( iContext );
+
+    MProtocolPresenceWatching& watching = iMyHost->GetConnection().ProtocolPresenceFeatures().PresenceWatching();
+
+    iContext->SetPresenceInfoFilterL( MXIMPPscContext::EPresentityPresenceFilter,
+            NULL, iIdentity );
+
+    switch( iSubscriptionStatus )
+        {
+        case CPresentityPresenceSubscriptionItem::ESubscribedForCtxOnly:
+            {
+            TRACE(_L("COperationUnsubscribePresentityPresence::ProcessL() DoUnsubscribePresentityPresenceL" ) );
+            TInt err ( KErrNone );
+            // If this fails, subscription needs to be removed anyway,
+            // if everything went ok, subscription is removed in RequestCompleted
+            TRAP( err, watching.DoUnsubscribePresentityPresenceL( *iIdentity, iReqId ) );
+            if ( KErrNone != err )
+                {
+                iSubItem->RemoveSubscriber( iContext );
+                User::Leave( err );
+                }
+            break;
+            }
+
+        case CPresentityPresenceSubscriptionItem::ESubscribedForCtxAndOthers:
+            {
+            CPresenceInfoFilterImp* pifWithoutCtx =
+                iSubItem->CollectSubscriptionPifWithoutCtxL( iContext );
+            CleanupStack::PushL( pifWithoutCtx );
+
+            if ( iSubItem->SubscriptionPif().Contains( *pifWithoutCtx ) )
+                {
+                TRACE(_L("COperationUnsubscribePresentityPresence::ProcessL() DoUpdatePresentityPresenceSubscriptionPifL" ) );
+                TInt err ( KErrNone );
+                // If this fails, subscription needs to be removed anyway,
+                // if everything went ok, subscription is removed in RequestCompleted
+                TRAP( err, watching.DoUpdatePresentityPresenceSubscriptionPifL( *iIdentity, *pifWithoutCtx, iReqId ) );
+                if ( KErrNone != err )
+                    {
+                    iSubItem->RemoveSubscriber( iContext );
+                    User::Leave( err );
+                    }
+                }
+            else
+                {
+                TRACE(_L("COperationUnsubscribePresentityPresence::ProcessL() FakeCompleteRequest 1" ) );
+                iMyHost->FakeCompleteRequest( iReqId, KErrNone );
+                }
+
+            CleanupStack::PopAndDestroy( pifWithoutCtx );
+            break;
+            }
+
+        case CPresentityPresenceSubscriptionItem::ENotSubscribedAtAll:
+        case CPresentityPresenceSubscriptionItem::ESubscribedForOtherCtxOnly:
+            {
+            TRACE(_L("COperationUnsubscribePresentityPresence::ProcessL() FakeCompleteRequest 2" ) );
+            iMyHost->FakeCompleteRequest( iReqId, KErrNone );
+            break;
+            }
+            
+        XIMP_DEFAULT_CASE_UNSUPPORTED( NXIMPPrivPanic::EInvalidSubscriptionStatus );            
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// COperationUnsubscribePresentityPresence::RequestCompleted()
+// ---------------------------------------------------------------------------
+//
+void COperationUnsubscribePresentityPresence::RequestCompletedL()
+    {
+    TRACE(_L("COperationUnsubscribePresentityPresence::RequestCompletedL()" ) );
+    CXIMPOperationBase::RequestCompletedL();
+    TRACE_1(_L("COperationUnsubscribePresentityPresence::RequestCompletedL() result=%d" ),iStatusObj->ResultCode() );
+    if( iStatusObj->ResultCode() == KErrNone )
+        {
+        switch( iSubscriptionStatus )
+            {
+            case CPresentityPresenceSubscriptionItem::ESubscribedForCtxOnly:
+            case CPresentityPresenceSubscriptionItem::ESubscribedForCtxAndOthers:
+                {
+                TRACE(_L("COperationUnsubscribePresentityPresence::RequestCompletedL() removing context" ) );
+                iSubItem->RemoveSubscriber( iContext );
+                break;
+                }
+            
+            case CPresentityPresenceSubscriptionItem::ENotSubscribedAtAll:
+            case CPresentityPresenceSubscriptionItem::ESubscribedForOtherCtxOnly:
+                {
+                TRACE(_L("COperationUnsubscribePresentityPresence::RequestCompletedL() nothing to do" ) );
+                break;
+                }
+            
+            XIMP_DEFAULT_CASE_UNSUPPORTED( NXIMPPrivPanic::EInvalidSubscriptionStatus );
+            }
+
+        SynthesiseEventL();
+        }
+    }
+
+
+// ---------------------------------------------------------------------------
+// COperationUnsubscribePresentityPresence::Type()
+// ---------------------------------------------------------------------------
+//
+TInt COperationUnsubscribePresentityPresence::Type() const
+    {
+    return NPresenceOps::EPrUnsubscribePresentityPresence;
+    }
+
+
+// ---------------------------------------------------------------------------
+// COperationUnsubscribePresentityPresence::SynthesiseEventL()
+// ---------------------------------------------------------------------------
+//
+void COperationUnsubscribePresentityPresence::SynthesiseEventL()
+    {
+    COperationSynthesiseSubscriptionEvent* synthOp =
+            new ( ELeave ) COperationSynthesiseSubscriptionEvent(
+                             COperationSynthesiseSubscriptionEvent::EPresentityPresence, EFalse );
+    CleanupStack::PushL( synthOp );
+    synthOp->BaseConstructL( TXIMPRequestId(), iContext );
+    synthOp->ConstructL( *iIdentity );
+    iMyHost->AddNewOperationL( *synthOp );
+    CleanupStack::Pop( synthOp );
+    }
+
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresenceoperations/presencewatching/operationunsubscribepresentitypresence.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,82 @@
+/*
+* 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:  Presentity presence unsubscription operation
+ *
+*/
+
+#ifndef CPSCOPERATIONUNSUBSCRIBEPRESENTITYPRESENCE_H
+#define CPSCOPERATIONUNSUBSCRIBEPRESENTITYPRESENCE_H
+
+
+#include <e32base.h>
+#include <ximpbase.h>
+
+#include "ximpoperationbase.h"
+#include "presentitypresencesubscriptionitem.h"
+#include "presenceoperationdefs.h"
+
+/**
+ * Presence interest registration operation.
+ *
+ * @lib ximpoperations.lib
+ * @since S60 v4.0
+ */
+class COperationUnsubscribePresentityPresence : public CXIMPOperationBase
+    {
+    public:
+
+        IMPORT_C COperationUnsubscribePresentityPresence();
+
+        void ConstructL( const TDesC8& aParamPck );
+
+        ~COperationUnsubscribePresentityPresence();
+
+
+    public: // from CXIMPOperationBase
+
+        void ProcessL();
+
+        void RequestCompletedL();
+
+        TInt Type() const;
+
+    private: // Helper methods
+
+        /**
+         * Synthesise event after completion
+         */
+        void SynthesiseEventL();
+
+    private: // data
+
+        /**
+         * Presence subscription item
+         * Own.
+         */
+        CPresentityPresenceSubscriptionItem* iSubItem;
+
+        /**
+         * Presentity address
+         * Own.
+         */
+        CXIMPIdentityImp* iIdentity;
+
+        /**
+         * Subscription status
+         */
+        CPresentityPresenceSubscriptionItem::TSubscriptionStatus iSubscriptionStatus;
+    };
+
+
+#endif // CPSCOPERATIONUNSUBSCRIBEPRESENTITYPRESENCE_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresenceoperations/presentitygroups/operationaddpresentitygroupmember.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,152 @@
+/*
+* 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:  Add Presentity Group Member operation
+ *
+*/
+
+#include <s32mem.h>
+#include <ximpprotocolconnection.h>
+#include <protocolpresentitygroups.h>
+#include <protocolpresencefeatures.h>
+
+#include "operationaddpresentitygroupmember.h"
+#include "presentitygroupmemberinfoimp.h"
+#include "ximpidentityimp.h"
+#include "ximprbufhelpers.h"
+#include "ximprestrictedobjectcollectionimp.h"
+#include "protocolpresentitygroupsdatahostimp.h"
+#include "ximphost.h"
+#include "ximpstatusimp.h"
+#include "ximprequestcompleteeventimp.h"
+#include "ximpobjecthelpers.h"
+#include "protocolpresencedatahostimp.h"
+
+#include "ximptrace.h"
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// COperationAddPresentityGroupMember::COperationAddPresentityGroupMember()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C COperationAddPresentityGroupMember::COperationAddPresentityGroupMember()
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// COperationAddPresentityGroupMember::ConstructL
+// ---------------------------------------------------------------------------
+//
+void COperationAddPresentityGroupMember::ConstructL( const TDesC8& aParamPck )
+    {
+    RDesReadStream rs;
+    rs.Open( aParamPck ); // CSI: 65 # Does not return a value.
+    CleanupClosePushL( rs );
+
+    // group id
+    iGroupId = CXIMPIdentityImp::NewLC();
+    CleanupStack::Pop( iGroupId );
+    iGroupId->InternalizeL( rs );
+
+    // member id
+    CXIMPIdentityImp* memberId = CXIMPIdentityImp::NewLC();
+    memberId->InternalizeL( rs );
+
+    // member display name
+    RBuf16 dispName;
+    CleanupClosePushL( dispName );
+    XIMPRBuf16Helper::InternalizeL( dispName, rs );
+
+    iMemberInfo = CPresentityGroupMemberInfoImp::NewLC( *memberId, dispName );
+    CleanupStack::Pop( iMemberInfo );
+    CleanupStack::PopAndDestroy( 3 ); // dispName, memberId, rs
+    }
+
+// ---------------------------------------------------------------------------
+// COperationAddPresentityGroupMember::~COperationAddPresentityGroupMember()
+// ---------------------------------------------------------------------------
+//
+COperationAddPresentityGroupMember::~COperationAddPresentityGroupMember()
+    {
+    delete iGroupId;
+    delete iMemberInfo;
+    }
+
+// ---------------------------------------------------------------------------
+// COperationAddPresentityGroupMember::ProcessL()
+// ---------------------------------------------------------------------------
+//
+void COperationAddPresentityGroupMember::ProcessL()
+    {
+    TRACE(_L("COperationAddPresentityGroupMember::ProcessL()" ) );
+    CXIMPOperationBase::ProcessL();
+
+    MProtocolPresentityGroups& connection = iMyHost->GetConnection().ProtocolPresenceFeatures().PresentityGroups();
+
+    connection.DoAddPresentityGroupMemberL( *iGroupId,
+                                            iMemberInfo->GroupMemberId(),
+                                            iMemberInfo->GroupMemberDisplayName(),
+                                            iReqId );
+    }
+
+// ---------------------------------------------------------------------------
+// COperationAddPresentityGroupMember::RequestCompletedL()
+// ---------------------------------------------------------------------------
+//
+void COperationAddPresentityGroupMember::RequestCompletedL()
+    {
+    TRACE(_L("COperationAddPresentityGroupMember::RequestCompletedL()" ) );
+    CXIMPOperationBase::RequestCompletedL();
+
+    MXIMPBase* object = NULL;
+    iObjCollection->GetByType( object, MPresentityGroupMemberInfo::KInterfaceId );
+    if( object )
+        {
+        CPresentityGroupMemberInfoImp* memberInfo = 
+        TXIMPGetImpClassOrPanic< CPresentityGroupMemberInfoImp >::From( *object );            
+        
+        delete iMemberInfo;
+        iMemberInfo = memberInfo;
+        }
+
+    if ( iStatusObj->ResultCode() == KErrNone )
+        {
+        CXIMPIdentityImp* groupId = 
+                TXIMPObjectCloner< CXIMPIdentityImp >::CloneL( *iGroupId );
+        CleanupStack::PushL( groupId );
+        CPresentityGroupMemberInfoImp* memberInfo = 
+                TXIMPObjectCloner< CPresentityGroupMemberInfoImp >::CloneL( *iMemberInfo );
+        CleanupStack::PushL( memberInfo );
+        iMyHost->PresenceDataAccess().GroupsDataAccess().HandlePresentityGroupMemberAddedL( groupId, memberInfo );
+        CleanupStack::Pop( 2, groupId );
+        }
+
+    // Set information for request complete event.
+    iReqCompleteEvent->AppendParamL( iGroupId );
+    iGroupId = NULL;
+    iReqCompleteEvent->AppendParamL( iMemberInfo );
+    iMemberInfo = NULL;
+    }
+
+// ---------------------------------------------------------------------------
+// COperationAddPresentityGroupMember::Type()
+// ---------------------------------------------------------------------------
+//
+TInt COperationAddPresentityGroupMember::Type() const
+    {
+    return NPresenceOps::EPrAddPresentityGroupMember;
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresenceoperations/presentitygroups/operationaddpresentitygroupmember.h	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  Add Presentity Group Member operation
+ *
+*/
+
+#ifndef PSCOPERATIONADDPRESENTITYGROUPMEMBER_H
+#define PSCOPERATIONADDPRESENTITYGROUPMEMBER_H
+
+#include <e32base.h>
+#include <ximpbase.h>
+
+#include "ximpoperationbase.h"
+#include "presenceoperationdefs.h"
+
+class CPresentityGroupMemberInfoImp;
+class CXIMPIdentityImp;
+
+/**
+ * Add presentity group member operation
+ *
+ * @lib presenceoperation.lib
+ * @since S60 v4.0
+ */
+class COperationAddPresentityGroupMember : public CXIMPOperationBase
+    {
+
+    public:
+
+        IMPORT_C COperationAddPresentityGroupMember();
+
+        void ConstructL( const TDesC8& aParamPck );
+
+        ~COperationAddPresentityGroupMember();
+
+    public: // from CXIMPOperationBase
+
+        void ProcessL();
+
+        void RequestCompletedL();
+
+        TInt Type() const;
+        
+    private: // data
+
+        /**
+         * Group id
+         * Own.
+         */
+        CXIMPIdentityImp* iGroupId;
+        
+        /**
+         * Group member info
+         * Own.
+         */
+        CPresentityGroupMemberInfoImp* iMemberInfo;
+    };
+
+
+#endif // PSCOPERATIONADDPRESENTITYGROUPMEMBER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresenceoperations/presentitygroups/operationcreatepresentitygroup.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  Concrete bind operation
+ *
+*/
+
+#include <ximpprotocolconnection.h>
+#include <protocolpresentitygroups.h>
+#include <protocolpresencefeatures.h>
+
+#include "operationcreatepresentitygroup.h"
+#include "presentitygroupinfoimp.h"
+#include "ximpobjecthelpers.h"
+#include "ximprestrictedobjectcollectionimp.h"
+#include "protocolpresentitygroupsdatahostimp.h"
+#include "ximphost.h"
+#include "ximpstatusimp.h"
+#include "ximprequestcompleteeventimp.h"
+#include "protocolpresencedatahostimp.h"
+
+#include "ximptrace.h"
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// COperationCreatePresentityGroup::COperationCreatePresentityGroup()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C COperationCreatePresentityGroup::COperationCreatePresentityGroup()
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// COperationCreatePresentityGroup::ConstructL
+// ---------------------------------------------------------------------------
+//
+void COperationCreatePresentityGroup::ConstructL( const TDesC8& aParamPck )
+    {
+    CPresentityGroupInfoImp* groupInfo = CPresentityGroupInfoImp::NewLC();
+    TXIMPObjectPacker< CPresentityGroupInfoImp >::UnPackL( *groupInfo,
+            aParamPck );
+    CleanupStack::Pop( groupInfo );
+    iGroupInfo = groupInfo;
+    }
+
+// ---------------------------------------------------------------------------
+// COperationCreatePresentityGroup::~COperationCreatePresentityGroup()
+// ---------------------------------------------------------------------------
+//
+COperationCreatePresentityGroup::~COperationCreatePresentityGroup()
+    {
+    delete iGroupInfo;
+    }
+
+// ---------------------------------------------------------------------------
+// COperationCreatePresentityGroup::ProcessL()
+// ---------------------------------------------------------------------------
+//
+void COperationCreatePresentityGroup::ProcessL()
+    {
+    TRACE(_L("COperationCreatePresentityGroup::ProcessL()" ) );
+    CXIMPOperationBase::ProcessL();
+    MProtocolPresentityGroups& presentityGroups = iMyHost->GetConnection().ProtocolPresenceFeatures().PresentityGroups();
+
+    presentityGroups.DoCreatePresentityGroupL( iGroupInfo->GroupId(),
+                                               iGroupInfo->GroupDisplayName(), iReqId );
+    }
+
+// ---------------------------------------------------------------------------
+// COperationCreatePresentityGroup::RequestCompleted()
+// ---------------------------------------------------------------------------
+//
+void COperationCreatePresentityGroup::RequestCompletedL()
+    {
+    TRACE(_L("COperationCreatePresentityGroup::RequestCompletedL()" ) );
+    CXIMPOperationBase::RequestCompletedL();
+
+    MXIMPBase* object = NULL;
+    iObjCollection->GetByType( object, MPresentityGroupInfo::KInterfaceId );
+    if( object )
+        {
+        CPresentityGroupInfoImp* groupInfo = 
+        TXIMPGetImpClassOrPanic< CPresentityGroupInfoImp >::From( *object );
+        
+        delete iGroupInfo;
+        iGroupInfo = groupInfo;
+        }
+
+    if ( iStatusObj->ResultCode() == KErrNone )
+        {
+        CPresentityGroupInfoImp* groupInfo = 
+                TXIMPObjectCloner< CPresentityGroupInfoImp >::CloneL( *iGroupInfo );
+        CleanupStack::PushL( groupInfo );
+        iMyHost->PresenceDataAccess().GroupsDataAccess().HandlePresentityGroupCreatedL( groupInfo );
+        CleanupStack::Pop( groupInfo );
+        }
+
+    // Set information for request complete event.
+    iReqCompleteEvent->AppendParamL( ( CXIMPApiDataObjBase* ) iGroupInfo );
+    iGroupInfo = NULL;
+    }
+
+// ---------------------------------------------------------------------------
+// COperationCreatePresentityGroup::Type()
+// ---------------------------------------------------------------------------
+//
+TInt COperationCreatePresentityGroup::Type() const
+    {
+    return NPresenceOps::EPrCreatePresentityGroup;
+    }
+
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresenceoperations/presentitygroups/operationcreatepresentitygroup.h	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  Bind operation
+ *
+*/
+
+#ifndef C_PSCOPERATIONCREATEPRESENTITYGROUP_H
+#define C_PSCOPERATIONCREATEPRESENTITYGROUP_H
+
+#include <e32base.h>
+#include <ximpbase.h>
+
+#include "ximpoperationbase.h"
+#include "presenceoperationdefs.h"
+
+class CPresentityGroupInfoImp;
+
+/**
+ * Create presentity group operation
+ *
+ * @lib presenceoperation.lib
+ * @since S60 v4.0
+ */
+class COperationCreatePresentityGroup : public CXIMPOperationBase
+    {
+
+    public:
+        
+        IMPORT_C COperationCreatePresentityGroup();
+
+        void ConstructL( const TDesC8& aParamPck );
+
+        ~COperationCreatePresentityGroup();
+
+    public: // from CXIMPOperationBase
+        
+        void ProcessL();
+
+        void RequestCompletedL();
+        
+        TInt Type() const;
+        
+    private: // data
+    
+        /**
+         * groupinfo
+         */
+        CPresentityGroupInfoImp* iGroupInfo;
+    };
+
+
+#endif // C_PSCOPERATIONCREATEPRESENTITYGROUP_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresenceoperations/presentitygroups/operationdeletepresentitygroup.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  Concrete bind operation
+ *
+*/
+
+#include <ximpprotocolconnection.h>
+#include <protocolpresentitygroups.h>
+#include <protocolpresencefeatures.h>
+
+#include "operationdeletepresentitygroup.h"
+#include "presentitygroupinfoimp.h"
+#include "ximpobjecthelpers.h"
+#include "protocolpresentitygroupsdatahostimp.h"
+#include "ximphost.h"
+#include "ximpstatusimp.h"
+#include "ximpidentityimp.h"
+#include "protocolpresencedatahostimp.h"
+
+#include "ximptrace.h"
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// COperationDeletePresentityGroup::COperationDeletePresentityGroup()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C COperationDeletePresentityGroup::COperationDeletePresentityGroup()
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// COperationDeletePresentityGroup::ConstructL
+// ---------------------------------------------------------------------------
+//
+void COperationDeletePresentityGroup::ConstructL( const TDesC8& aParamPck )
+    {
+    CPresentityGroupInfoImp* groupInfo = CPresentityGroupInfoImp::NewLC();
+    TXIMPObjectPacker< CPresentityGroupInfoImp >::UnPackL( *groupInfo,
+            aParamPck );
+    CleanupStack::Pop( groupInfo );
+    iGroupInfo = groupInfo; 
+    }
+
+// ---------------------------------------------------------------------------
+// COperationDeletePresentityGroup::~COperationDeletePresentityGroup()
+// ---------------------------------------------------------------------------
+//
+COperationDeletePresentityGroup::~COperationDeletePresentityGroup()
+    {
+    delete iGroupInfo;
+    }
+
+// ---------------------------------------------------------------------------
+// COperationDeletePresentityGroup::ProcessL()
+// ---------------------------------------------------------------------------
+//
+void COperationDeletePresentityGroup::ProcessL()
+    {
+    TRACE(_L("COperationDeletePresentityGroup::ProcessL()" ) );
+    CXIMPOperationBase::ProcessL();
+    
+    MProtocolPresentityGroups& presentityGroups = iMyHost->GetConnection().ProtocolPresenceFeatures().PresentityGroups();
+
+    presentityGroups.DoDeletePresentityGroupL( iGroupInfo->GroupId(), iReqId );
+    }
+
+// ---------------------------------------------------------------------------
+// COperationDeletePresentityGroup::RequestCompleted()
+// ---------------------------------------------------------------------------
+//
+void COperationDeletePresentityGroup::RequestCompletedL()
+    {
+    TRACE(_L("COperationDeletePresentityGroup::RequestCompletedL()" ) );
+    CXIMPOperationBase::RequestCompletedL();
+
+    if ( iStatusObj->ResultCode() == KErrNone )
+        { 
+        CXIMPIdentityImp* identity = CXIMPIdentityImp::NewLC( iGroupInfo->Identity().Identity() );
+        iMyHost->PresenceDataAccess().GroupsDataAccess().HandlePresentityGroupDeletedL( identity );
+        CleanupStack::Pop( identity );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// COperationDeletePresentityGroup::Type()
+// ---------------------------------------------------------------------------
+//
+TInt COperationDeletePresentityGroup::Type() const
+    {
+    return NPresenceOps::EPrDeletePresentityGroup;
+    }
+
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresenceoperations/presentitygroups/operationdeletepresentitygroup.h	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  Bind operation
+ *
+*/
+
+#ifndef C_PSCOPERATIONDELETEPRESENTITYGROUP_H
+#define C_PSCOPERATIONDELETEPRESENTITYGROUP_H
+
+#include <e32base.h>
+#include <ximpbase.h>
+
+#include "ximpoperationbase.h"
+#include "presenceoperationdefs.h"
+
+class CPresentityGroupInfoImp;
+
+/**
+ * Create presentity group operation
+ *
+ * @lib presenceoperation.lib
+ * @since S60 v4.0
+ */
+class COperationDeletePresentityGroup : public CXIMPOperationBase
+    {
+
+    public:
+        
+        IMPORT_C COperationDeletePresentityGroup();
+
+        void ConstructL( const TDesC8& aParamPck );
+
+        ~COperationDeletePresentityGroup();
+
+    public: // from CXIMPOperationBase
+        
+        void ProcessL();
+
+        void RequestCompletedL();
+        
+        TInt Type() const;
+        
+    private: // data
+    
+        /**
+         * groupinfo
+         */
+        CPresentityGroupInfoImp* iGroupInfo;
+    };
+
+
+#endif // C_PSCOPERATIONDELETEPRESENTITYGROUP_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresenceoperations/presentitygroups/operationhandlepresentitygroupcontent.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,144 @@
+/*
+* 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:  Handle presentity group content operations
+ *
+*/
+
+
+#include "operationhandlepresentitygroupcontent.h"
+#include "ximpobjecthelpers.h"
+#include "groupcontentsubscriptionitem.h"
+#include "presencedatacacheimp.h"
+#include "presentitygroupmemberinfoimp.h"
+#include "ximpidentityimp.h"
+#include "ximphost.h"
+#include "ximpstatusimp.h"
+#include "ximprestrictedobjectcollectionimp.h"
+#include "ximpobjectcollectionimp.h"
+#include "protocolpresencedatahostimp.h"
+
+#include "ximptrace.h"
+// ============================ MEMBER FUNCTIONS =============================
+
+// ---------------------------------------------------------------------------
+// COperationHandlePresentityGroupContent::~COperationHandlePresentityGroupContent()
+// ---------------------------------------------------------------------------
+//
+COperationHandlePresentityGroupContent::~COperationHandlePresentityGroupContent()
+    {
+    delete iGroupMemberList;
+    delete iGroupId;
+    }
+
+
+// ---------------------------------------------------------------------------
+// COperationHandlePresentityGroupContent::COperationHandlePresentityGroupContent()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C COperationHandlePresentityGroupContent::COperationHandlePresentityGroupContent()
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// COperationHandlePresentityGroupContent::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void COperationHandlePresentityGroupContent::ConstructL( const TDesC8& /*aParamPck*/ )
+    {
+    iGroupMemberList = new ( ELeave ) RPrGrpMemInfoImpArray;
+    }
+
+
+// ---------------------------------------------------------------------------
+// COperationHandlePresentityGroupContent::ProcessL()
+// ---------------------------------------------------------------------------
+//
+void COperationHandlePresentityGroupContent::ProcessL()
+    {
+    TRACE(_L("COperationHandlePresentityGroupContent::ProcessL()") );
+    CXIMPOperationBase::ProcessL();
+
+    MXIMPBase* object = NULL;
+    iObjCollection->GetByType( object, MXIMPIdentity::KInterfaceId );
+    if( object )
+        {
+        iGroupId = TXIMPGetImpClassOrPanic< CXIMPIdentityImp >::From( *object );        
+        }
+    else
+        {
+        User::Leave( KErrArgument );
+        }
+        
+    object = NULL;
+    iObjCollection->GetByType( object, MXIMPObjectCollection::KInterfaceId );
+    if( object )
+        {
+        CXIMPObjectCollectionImp* objectCollection = 
+                TXIMPGetImpClassOrPanic< CXIMPObjectCollectionImp >::From( *object );
+        CleanupStack::PushL( objectCollection );
+        TLinearOrder< CPresentityGroupMemberInfoImp > order( CPresentityGroupMemberInfoImp::GroupIdLinearOrder );
+        TXIMPObjectMover< MPresentityGroupMemberInfo, CPresentityGroupMemberInfoImp >::
+                                    MoveFromCollectionToArrayL( *objectCollection, *iGroupMemberList, order );
+        CleanupStack::PopAndDestroy( objectCollection );        
+        }
+    else
+        {
+        User::Leave( KErrArgument );
+        }
+
+    // recreate temporary lists
+    CGroupContentSubscriptionItem& subItem =
+        iMyHost->PresenceDataAccess().PresenceDataCache().GroupContentSubscriptionItemLC( *iGroupId );
+
+    // clean out temporary lists
+    subItem.Clean();
+    
+    subItem.SetNewListL( iGroupMemberList );
+    iGroupMemberList = NULL; // ownership was transferred
+    
+    subItem.UpdateSubscriptionStateL( CXIMPSubscriptionItemBase::ECompleteDataReceived );
+
+    // synthesize the event to all contexts
+    TRAPD( err, subItem.SynthesiseSubscriptionEventToAllCtxsL() );
+
+    CleanupStack::PopAndDestroy(); // subItem
+
+    err = KErrNone;
+    iMyHost->HandleAdaptationRequestCompleted( iReqId, err );
+    }
+
+// ---------------------------------------------------------------------------
+// COperationHandlePresentityGroupContent::RequestCompleted()
+// ---------------------------------------------------------------------------
+//
+void COperationHandlePresentityGroupContent::RequestCompletedL()
+    {
+    TRACE(_L("COperationHandlePresentityGroupContent::RequestCompletedL()" ) );
+    CXIMPOperationBase::RequestCompletedL();
+    // no special handling for error situations
+    }
+    
+    
+// ---------------------------------------------------------------------------
+// COperationHandlePresentityGroupContent::Type()
+// ---------------------------------------------------------------------------
+//
+TInt
+    COperationHandlePresentityGroupContent::Type() const
+    {
+    return NPresenceOps::EPrHandlePresentityGroupContent;
+    }    
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresenceoperations/presentitygroups/operationhandlepresentitygroupcontent.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,72 @@
+/*
+* 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:  Handle presentity group content operations
+ *
+*/
+
+#ifndef CPSCOPERATIONHANDLEPRESENTITYGROUPCONTENT_H
+#define CPSCOPERATIONHANDLEPRESENTITYGROUPCONTENT_H
+
+
+#include <e32base.h>
+#include <ximpbase.h>
+
+#include "ximpoperationbase.h"
+#include "presencetypehelpers.h"
+#include "presenceoperationdefs.h"
+
+class CXIMPIdentityImp;
+
+/**
+ * Handle presentity group related operations.
+ *
+ * @lib ximpoperations.lib
+ * @since S60 v4.0
+ */
+class COperationHandlePresentityGroupContent : public CXIMPOperationBase
+    {
+
+    public:
+
+        IMPORT_C COperationHandlePresentityGroupContent();
+
+        void ConstructL( const TDesC8& aParamPck );
+
+        ~COperationHandlePresentityGroupContent();
+
+    public: // from CXIMPOperationBase
+
+        void ProcessL();
+
+        void RequestCompletedL();
+        TInt Type() const;
+
+    private: // data
+
+        /**
+         * Array of group identities.
+         * Owned.
+         */
+        CXIMPIdentityImp* iGroupId;
+
+        /**
+         * Array of group identities.
+         * Owned.
+         */
+        RPrGrpMemInfoImpArray* iGroupMemberList;
+
+    };
+
+
+#endif // CPSCOPERATIONHandlePresentityGroups_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresenceoperations/presentitygroups/operationhandlepresentitygroupmemberadded.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  Handle presentity group content operations
+ *
+*/
+
+
+#include "operationhandlepresentitygroupmemberadded.h"
+#include "ximpobjecthelpers.h"
+#include "groupcontentsubscriptionitem.h"
+#include "presencedatacacheimp.h"
+#include "presentitygroupmemberinfoimp.h"
+#include "ximpidentityimp.h"
+#include "ximphost.h"
+#include "ximpstatusimp.h"
+#include "ximprestrictedobjectcollectionimp.h"
+#include "protocolpresencedatahostimp.h"
+
+#include "ximptrace.h"
+// ============================ MEMBER FUNCTIONS =============================
+
+// ---------------------------------------------------------------------------
+// COperationHandlePresentityGroupMemberAdded::~COperationHandlePresentityGroupMemberAdded()
+// ---------------------------------------------------------------------------
+//
+COperationHandlePresentityGroupMemberAdded::~COperationHandlePresentityGroupMemberAdded()
+    {
+    delete iMemberInfo;
+    delete iGroupId;
+    }
+
+
+// ---------------------------------------------------------------------------
+// COperationHandlePresentityGroupMemberAdded::COperationHandlePresentityGroupMemberAdded()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C COperationHandlePresentityGroupMemberAdded::COperationHandlePresentityGroupMemberAdded()
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// COperationHandlePresentityGroupMemberAdded::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void COperationHandlePresentityGroupMemberAdded::ConstructL( const TDesC8& /*aParamPck*/ )
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// COperationHandlePresentityGroupMemberAdded::ProcessL()
+// ---------------------------------------------------------------------------
+//
+void COperationHandlePresentityGroupMemberAdded::ProcessL()
+    {
+    TRACE(_L("COperationHandlePresentityGroupMemberAdded::ProcessL()") );
+    CXIMPOperationBase::ProcessL();
+
+    MXIMPBase* object = NULL;
+    iObjCollection->GetByType( object, MXIMPIdentity::KInterfaceId );
+    if( object )
+        {
+        iGroupId = TXIMPGetImpClassOrPanic< CXIMPIdentityImp >::From( *object );        
+        }
+    else
+        {
+        User::Leave( KErrArgument );
+        }
+        
+    object = NULL;
+    iObjCollection->GetByType( object, MPresentityGroupMemberInfo::KInterfaceId );
+    if( object )
+        {
+        iMemberInfo = TXIMPGetImpClassOrPanic< CPresentityGroupMemberInfoImp >::From( *object );
+        }
+    else
+        {
+        User::Leave( KErrArgument );
+        }
+
+    // Check if the item exits, only full subscriptions are allowed to
+    // create new ones.
+    if ( iMyHost->PresenceDataAccess().PresenceDataCache().GroupContentSubscriptionItemExists( *iGroupId ) )
+        {
+        CGroupContentSubscriptionItem& subItem =
+            iMyHost->PresenceDataAccess().PresenceDataCache().GroupContentSubscriptionItemLC( *iGroupId );
+
+        // clean out temporary lists
+        subItem.Clean();
+
+        if ( !subItem.GroupMemberExistsL( *iMemberInfo ) )
+            {
+            // New member
+            RPrGrpMemInfoImpArray* added = new ( ELeave ) RPrGrpMemInfoImpArray;
+            CleanupStack::PushL( added );
+            added->AppendL( iMemberInfo );
+            iMemberInfo = NULL; // ownership was transferred
+
+            subItem.SetAddedListL( added );
+            CleanupStack::Pop( added ); // ownership was transferred
+
+            // synthesize the event to all contexts
+            TRAP_IGNORE( subItem.SynthesiseSubscriptionEventToAllCtxsL() );
+            }
+        else if ( subItem.IsGroupMemberUpdatedL( *iMemberInfo ) )
+            {
+            // Existing member updated (actually this implementation might be redundant
+            // because of the implementation of subcription item. Refactor if needed.
+            RPrGrpMemInfoImpArray* updated = new ( ELeave ) RPrGrpMemInfoImpArray;
+            CleanupStack::PushL( updated );
+            updated->AppendL( iMemberInfo );
+            iMemberInfo = NULL; // ownership was transferred
+
+            subItem.SetAddedListL( updated );
+            CleanupStack::Pop( updated ); // ownership was transferred
+
+            // synthesize the event to all contexts
+            TRAP_IGNORE( subItem.SynthesiseSubscriptionEventToAllCtxsL() );
+            }
+            
+        CleanupStack::PopAndDestroy(); // subItem
+        }
+
+    iMyHost->HandleAdaptationRequestCompleted( iReqId, KErrNone );
+    }
+
+// ---------------------------------------------------------------------------
+// COperationHandlePresentityGroupMemberAdded::RequestCompleted()
+// ---------------------------------------------------------------------------
+//
+void COperationHandlePresentityGroupMemberAdded::RequestCompletedL()
+    {
+    TRACE(_L("COperationHandlePresentityGroupMemberAdded::RequestCompletedL()" ) );
+    CXIMPOperationBase::RequestCompletedL();
+
+    // no special handling for error situations
+    }
+
+
+// ---------------------------------------------------------------------------
+// COperationHandlePresentityGroupMemberAdded::Type()
+// ---------------------------------------------------------------------------
+//
+TInt
+    COperationHandlePresentityGroupMemberAdded::Type() const
+    {
+    return NPresenceOps::EPrHandlePresentityGroupMemberAdded;
+    }
+
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresenceoperations/presentitygroups/operationhandlepresentitygroupmemberadded.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,72 @@
+/*
+* 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:  Handle presentity group content operations
+ *
+*/
+
+#ifndef CPSCOPERATIONHANDLEPRESENTITYGROUPMEMBERADDED_H
+#define CPSCOPERATIONHANDLEPRESENTITYGROUPMEMBERADDED_H
+
+
+#include <e32base.h>
+#include <ximpbase.h>
+
+#include "ximpoperationbase.h"
+#include "presencetypehelpers.h"
+#include "presenceoperationdefs.h"
+
+class CXIMPIdentityImp;
+
+/**
+ * Handle presentity group related operations.
+ *
+ * @lib ximpoperations.lib
+ * @since S60 v4.0
+ */
+class COperationHandlePresentityGroupMemberAdded : public CXIMPOperationBase
+    {
+
+    public:
+
+        IMPORT_C COperationHandlePresentityGroupMemberAdded();
+
+        void ConstructL( const TDesC8& aParamPck );
+
+        ~COperationHandlePresentityGroupMemberAdded();
+
+    public: // from CXIMPOperationBase
+
+        void ProcessL();
+
+        void RequestCompletedL();
+        TInt Type() const;
+
+    private: // data
+
+        /**
+         * Array of group identities.
+         * Owned.
+         */
+        CXIMPIdentityImp* iGroupId;
+
+        /**
+         * Array of group identities.
+         * Owned.
+         */
+        CPresentityGroupMemberInfoImp* iMemberInfo;
+
+    };
+
+
+#endif // CPSCOPERATIONHANDLEPRESENTITYGROUPMEMBERADDED_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresenceoperations/presentitygroups/operationhandlepresentitygroupmemberdisplaynameupdated.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,147 @@
+/*
+* 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:  Handle presentity group content operations
+ *
+*/
+
+
+#include "operationhandlepresentitygroupmemberdisplaynameupdated.h"
+#include "ximpobjecthelpers.h"
+#include "groupcontentsubscriptionitem.h"
+#include "presencedatacacheimp.h"
+#include "presentitygroupmemberinfoimp.h"
+#include "ximpidentityimp.h"
+#include "ximphost.h"
+#include "ximpstatusimp.h"
+#include "ximprestrictedobjectcollectionimp.h"
+#include "protocolpresencedatahostimp.h"
+
+#include "ximptrace.h"
+// ============================ MEMBER FUNCTIONS =============================
+
+// ---------------------------------------------------------------------------
+// COperationHandlePresentityGroupMemberDisplayNameUpdated::~COperationHandlePresentityGroupMemberDisplayNameUpdated()
+// ---------------------------------------------------------------------------
+//
+COperationHandlePresentityGroupMemberDisplayNameUpdated::~COperationHandlePresentityGroupMemberDisplayNameUpdated()
+    {
+    delete iMemberInfo;
+    delete iGroupId;
+    }
+
+
+// ---------------------------------------------------------------------------
+// COperationHandlePresentityGroupMemberDisplayNameUpdated::COperationHandlePresentityGroupMemberDisplayNameUpdated()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C COperationHandlePresentityGroupMemberDisplayNameUpdated::COperationHandlePresentityGroupMemberDisplayNameUpdated()
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// COperationHandlePresentityGroupMemberDisplayNameUpdated::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void COperationHandlePresentityGroupMemberDisplayNameUpdated::ConstructL( const TDesC8& /*aParamPck*/ )
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// COperationHandlePresentityGroupMemberDisplayNameUpdated::ProcessL()
+// ---------------------------------------------------------------------------
+//
+void COperationHandlePresentityGroupMemberDisplayNameUpdated::ProcessL()
+    {
+    TRACE(_L("COperationHandlePresentityGroupMemberDisplayNameUpdated::ProcessL()") );
+    CXIMPOperationBase::ProcessL();
+
+    MXIMPBase* object = NULL;
+    iObjCollection->GetByType( object, MXIMPIdentity::KInterfaceId );
+    if( object )
+        {
+        iGroupId = TXIMPGetImpClassOrPanic< CXIMPIdentityImp >::From( *object );        
+        }
+    else
+        {
+        User::Leave( KErrArgument );
+        }
+        
+    object = NULL;
+    iObjCollection->GetByType( object, MPresentityGroupMemberInfo::KInterfaceId );
+    if( object )
+        {
+        iMemberInfo = TXIMPGetImpClassOrPanic< CPresentityGroupMemberInfoImp >::From( *object );
+        }
+    else
+        {
+        User::Leave( KErrArgument );
+        }
+
+    TInt err = KErrNone;
+
+    if ( iMyHost->PresenceDataAccess().PresenceDataCache().GroupContentSubscriptionItemExists( *iGroupId ) )
+        {
+        CGroupContentSubscriptionItem& subItem =
+            iMyHost->PresenceDataAccess().PresenceDataCache().GroupContentSubscriptionItemLC( *iGroupId );
+
+        // clean out temporary lists
+        subItem.Clean();
+
+        if ( subItem.GroupMemberExistsL( *iMemberInfo )  &&
+             subItem.IsGroupMemberUpdatedL( *iMemberInfo ) )
+            {
+            RPrGrpMemInfoImpArray* updated = new ( ELeave ) RPrGrpMemInfoImpArray;
+            CleanupStack::PushL( updated );
+            updated->AppendL( iMemberInfo );
+            iMemberInfo = NULL; // ownership was transferred
+
+            subItem.SetAddedListL( updated );
+            CleanupStack::Pop( updated ); // ownership was transferred
+
+            // synthesize the event to all contexts
+            TRAP( err, subItem.SynthesiseSubscriptionEventToAllCtxsL() );
+            }
+            
+        CleanupStack::PopAndDestroy(); // subItem
+        }
+
+    iMyHost->HandleAdaptationRequestCompleted( iReqId, err );  // error code means subsc. synth. error
+    }
+
+// ---------------------------------------------------------------------------
+// COperationHandlePresentityGroupMemberDisplayNameUpdated::RequestCompleted()
+// ---------------------------------------------------------------------------
+//
+void COperationHandlePresentityGroupMemberDisplayNameUpdated::RequestCompletedL()
+    {
+    TRACE(_L("COperationHandlePresentityGroupMemberDisplayNameUpdated::RequestCompletedL()" ) );
+    CXIMPOperationBase::RequestCompletedL();
+
+    // no special handling for error situations
+    }
+    
+
+// ---------------------------------------------------------------------------
+// COperationHandlePresentityGroupMemberDisplayNameUpdated::Type()
+// ---------------------------------------------------------------------------
+//
+TInt
+    COperationHandlePresentityGroupMemberDisplayNameUpdated::Type() const
+    {
+    return NPresenceOps::EPrHandlePresentityGroupMemberDisplayNameUpdated;
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresenceoperations/presentitygroups/operationhandlepresentitygroupmemberdisplaynameupdated.h	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  Handle presentity group content operations
+ *
+*/
+
+#ifndef CPSCOPERATIONHANDLEPRESENTITYGROUPMEMBERDISPLAYNAMEUPDATED_H
+#define CPSCOPERATIONHANDLEPRESENTITYGROUPMEMBERDISPLAYNAMEUPDATED_H
+
+
+#include <e32base.h>
+
+#include <ximpbase.h>
+#include "ximpoperationbase.h"
+#include "presencetypehelpers.h"
+#include "presenceoperationdefs.h"
+
+class CXIMPIdentityImp;
+
+/**
+ * Handle presentity group related operations.
+ *
+ * @lib ximpoperations.lib
+ * @since S60 v4.0
+ */
+class COperationHandlePresentityGroupMemberDisplayNameUpdated : public CXIMPOperationBase
+    {
+
+    public:
+
+        IMPORT_C COperationHandlePresentityGroupMemberDisplayNameUpdated();
+
+        void ConstructL( const TDesC8& aParamPck );
+
+        ~COperationHandlePresentityGroupMemberDisplayNameUpdated();
+
+    public: // from CXIMPOperationBase
+
+        void ProcessL();
+
+        void RequestCompletedL();
+
+        TInt Type() const;
+
+    private: // data
+
+        /**
+         * Array of group identities.
+         * Owned.
+         */
+        CXIMPIdentityImp* iGroupId;
+
+        /**
+         * Group member information.
+         * Owned.
+         */
+        CPresentityGroupMemberInfoImp* iMemberInfo;
+
+    };
+
+
+#endif // CPSCOPERATIONHANDLEPRESENTITYGROUPMEMBERDISPLAYNAMEUPDATED_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresenceoperations/presentitygroups/operationhandlepresentitygroupmemberremoved.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,143 @@
+/*
+* 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:  Handle presentity group content operations
+ *
+*/
+
+
+#include "operationhandlepresentitygroupmemberremoved.h"
+#include "ximpobjecthelpers.h"
+#include "groupcontentsubscriptionitem.h"
+#include "presencedatacacheimp.h"
+#include "presentitygroupmemberinfoimp.h"
+#include "ximpidentityimp.h"
+#include "ximphost.h"
+#include "ximpstatusimp.h"
+#include "ximprestrictedobjectcollectionimp.h"
+#include "protocolpresencedatahostimp.h"
+
+#include "ximptrace.h"
+
+// ============================ MEMBER FUNCTIONS =============================
+
+// ---------------------------------------------------------------------------
+// COperationHandlePresentityGroupMemberRemoved::~COperationHandlePresentityGroupMemberRemoved()
+// ---------------------------------------------------------------------------
+//
+COperationHandlePresentityGroupMemberRemoved::~COperationHandlePresentityGroupMemberRemoved()
+    {
+    delete iMemberInfo;
+    delete iGroupId;
+    }
+
+
+// ---------------------------------------------------------------------------
+// COperationHandlePresentityGroupMemberRemoved::COperationHandlePresentityGroupMemberRemoved()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C COperationHandlePresentityGroupMemberRemoved::COperationHandlePresentityGroupMemberRemoved()
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// COperationHandlePresentityGroupMemberRemoved::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void COperationHandlePresentityGroupMemberRemoved::ConstructL( const TDesC8& /*aParamPck*/ )
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// COperationHandlePresentityGroupMemberRemoved::ProcessL()
+// ---------------------------------------------------------------------------
+//
+void COperationHandlePresentityGroupMemberRemoved::ProcessL()
+    {
+    TRACE(_L("COperationHandlePresentityGroupMemberRemoved::ProcessL()") );
+    CXIMPOperationBase::ProcessL();
+
+    MXIMPBase* object = NULL;
+    iObjCollection->GetByType( object, MXIMPIdentity::KInterfaceId );
+    if( object )
+        {
+        iGroupId = TXIMPGetImpClassOrPanic< CXIMPIdentityImp >::From( *object );        
+        }
+    else
+        {
+        User::Leave( KErrArgument );
+        }
+        
+    object = NULL;
+    iObjCollection->GetByType( object, MPresentityGroupMemberInfo::KInterfaceId );
+    if( object )
+        {
+        iMemberInfo = TXIMPGetImpClassOrPanic< CPresentityGroupMemberInfoImp >::From( *object );
+        }
+    else
+        {
+        User::Leave( KErrArgument );
+        }
+
+    if ( iMyHost->PresenceDataAccess().PresenceDataCache().GroupContentSubscriptionItemExists( *iGroupId ) )
+        {
+        CGroupContentSubscriptionItem& subItem =
+        iMyHost->PresenceDataAccess().PresenceDataCache().GroupContentSubscriptionItemLC( *iGroupId );
+
+        if ( subItem.GroupMemberExistsL( *iMemberInfo ) )
+            {
+            // clean out temporary lists
+            subItem.Clean();
+
+            RPrGrpMemInfoImpArray* removed = new ( ELeave ) RPrGrpMemInfoImpArray;
+            CleanupStack::PushL( removed );
+            removed->AppendL( iMemberInfo );
+            iMemberInfo = NULL;
+            subItem.SetRemovedListL( removed );
+            CleanupStack::Pop( removed ); // ownership was transferred
+
+            // synthesize the event to all contexts
+            TRAP_IGNORE( subItem.SynthesiseSubscriptionEventToAllCtxsL() );
+            }
+        CleanupStack::PopAndDestroy(); // subItem
+        }
+
+    iMyHost->HandleAdaptationRequestCompleted( iReqId, KErrNone );
+    }
+
+// ---------------------------------------------------------------------------
+// COperationHandlePresentityGroupMemberRemoved::RequestCompleted()
+// ---------------------------------------------------------------------------
+//
+void COperationHandlePresentityGroupMemberRemoved::RequestCompletedL()
+    {
+    TRACE(_L("COperationHandlePresentityGroupMemberRemoved::RequestCompletedL()" ) );
+    CXIMPOperationBase::RequestCompletedL();
+
+    // no special handling for error situations
+    }
+
+
+// ---------------------------------------------------------------------------
+// COperationHandlePresentityGroupMemberRemoved::Type()
+// ---------------------------------------------------------------------------
+//
+TInt
+    COperationHandlePresentityGroupMemberRemoved::Type() const
+    {
+    return NPresenceOps::EPrHandlePresentityGroupMemberRemoved;
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresenceoperations/presentitygroups/operationhandlepresentitygroupmemberremoved.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,72 @@
+/*
+* 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:  Handle presentity group content operations
+ *
+*/
+
+#ifndef CPSCOPERATIONHANDLEPRESENTITYGROUPMEMBERREMOVED_H
+#define CPSCOPERATIONHANDLEPRESENTITYGROUPMEMBERREMOVED_H
+
+
+#include <e32base.h>
+#include <ximpbase.h>
+
+#include "ximpoperationbase.h"
+#include "presencetypehelpers.h"
+#include "presenceoperationdefs.h"
+
+class CXIMPIdentityImp;
+
+/**
+ * Handle presentity group related operations.
+ *
+ * @lib ximpoperations.lib
+ * @since S60 v4.0
+ */
+class COperationHandlePresentityGroupMemberRemoved : public CXIMPOperationBase
+    {
+
+    public:
+
+        IMPORT_C COperationHandlePresentityGroupMemberRemoved();
+
+        void ConstructL( const TDesC8& aParamPck );
+
+        ~COperationHandlePresentityGroupMemberRemoved();
+
+    public: // from CXIMPOperationBase
+
+        void ProcessL();
+
+        void RequestCompletedL();
+        TInt Type() const;
+
+    private: // data
+
+        /**
+         * Array of group identities.
+         * Owned.
+         */
+        CXIMPIdentityImp* iGroupId;
+
+        /**
+         * Array of group identities.
+         * Owned.
+         */
+        CPresentityGroupMemberInfoImp* iMemberInfo;
+
+    };
+
+
+#endif // CPSCOPERATIONHANDLEPRESENTITYGROUPMEMBERREMOVED_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresenceoperations/presentitygroups/operationhandlepresentitygroups.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  implementation of COperationHandlePresentityGroups
+ *
+*/
+
+
+#include "operationhandlepresentitygroups.h"
+#include "grouplistsubscriptionitem.h"
+#include "presencedatacacheimp.h"
+#include "presentitygroupinfoimp.h"
+#include "ximphost.h"
+#include "ximpstatusimp.h"
+#include "ximppanics.h"
+#include "ximprestrictedobjectcollectionimp.h"
+#include "ximpobjectcollectionimp.h"
+#include "ximpobjecthelpers.h"
+#include "ximpidentityimp.h"
+#include "protocolpresencedatahostimp.h"
+
+#include "ximptrace.h"
+
+// ============================ MEMBER FUNCTIONS =============================
+
+// ---------------------------------------------------------------------------
+// COperationHandlePresentityGroups::~COperationHandlePresentityGroups()
+// ---------------------------------------------------------------------------
+//
+COperationHandlePresentityGroups::~COperationHandlePresentityGroups()
+    {
+    delete iGroupAddressList;
+    }
+
+
+// ---------------------------------------------------------------------------
+// COperationHandlePresentityGroups::COperationHandlePresentityGroups()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C COperationHandlePresentityGroups::COperationHandlePresentityGroups(
+        NPresenceOps::TPresenceOpTypes aMyType )
+    {
+    iMyType = aMyType;
+    }
+
+
+// ---------------------------------------------------------------------------
+// COperationHandlePresentityGroups::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void COperationHandlePresentityGroups::ConstructL( const TDesC8& /* aParamPck */ )
+    {
+    iGroupAddressList = new ( ELeave ) RPrGrpInfoImpArray;
+    }
+
+
+// ---------------------------------------------------------------------------
+// COperationHandlePresentityGroups::ProcessL()
+// ---------------------------------------------------------------------------
+//
+void COperationHandlePresentityGroups::ProcessL()
+    {
+    TRACE(_L("COperationHandlePresentityGroups::ProcessL()") );
+    CXIMPOperationBase::ProcessL();
+
+    // recreate temporary lists
+    CGroupListSubscriptionItem& groupListSubs = 
+        iMyHost->PresenceDataAccess().PresenceDataCache().GroupListSubscriptionItemLC();
+
+    // clean out temporary lists
+    groupListSubs.Clean();
+
+    switch ( iMyType )
+        {
+        case NPresenceOps::EPrHandlePresentityGroupList :
+            {
+            MXIMPBase* object = NULL;
+            iObjCollection->GetByType( object, MXIMPObjectCollection::KInterfaceId );
+            if( object )
+                {
+                CXIMPObjectCollectionImp* objectCollection = 
+                        TXIMPGetImpClassOrPanic< CXIMPObjectCollectionImp >::From( *object );
+                CleanupStack::PushL( objectCollection );
+                TLinearOrder< CPresentityGroupInfoImp > order( CPresentityGroupInfoImp::GroupIdLinearOrder );
+                TXIMPObjectMover< MPresentityGroupInfo, CPresentityGroupInfoImp >::
+                                            MoveFromCollectionToArrayL( *objectCollection, *iGroupAddressList, order );
+                CleanupStack::PopAndDestroy( objectCollection );        
+                }
+            else
+                {
+                User::Leave( KErrArgument );
+                }
+
+            // handling a list of groups
+            groupListSubs.SetNewListL( iGroupAddressList );
+            break;
+            }
+
+        case NPresenceOps::EPrHandlePresentityGroupCreated : // fall-through
+        case NPresenceOps::EPrHandlePresentityGroupDisplayNameUpdated :
+            {
+            // handling a list of only created groups and/or
+            // handling a list of groups which have display
+            // name updated
+            MXIMPBase* object = NULL;
+            iObjCollection->GetByType( object, MPresentityGroupInfo::KInterfaceId );
+            CPresentityGroupInfoImp* createdInfo = NULL;
+            if( object )
+                {
+                createdInfo = 
+                    TXIMPGetImpClassOrPanic< CPresentityGroupInfoImp >::From( *object );
+                }
+            else
+                {
+                User::Leave( KErrArgument );
+                }
+                        
+            CleanupStack::PushL( createdInfo );
+            iGroupAddressList->AppendL( createdInfo );
+            CleanupStack::Pop( createdInfo );
+            groupListSubs.SetCreatedListL( iGroupAddressList );
+            break;
+            }
+
+        case NPresenceOps::EPrHandlePresentityGroupDeleted :
+            {
+            MXIMPBase* object = NULL;
+            iObjCollection->GetByType( object, MXIMPIdentity::KInterfaceId );
+            CXIMPIdentityImp* identity = NULL;
+            if( object )
+                {
+                identity = TXIMPGetImpClassOrPanic< CXIMPIdentityImp >::From( *object );
+                CleanupStack::PushL( identity );
+                }
+            else
+                {
+                User::Leave( KErrArgument );
+                }
+            CPresentityGroupInfoImp* deletedInfo = CPresentityGroupInfoImp::NewLC( *identity, KNullDesC );            
+            iGroupAddressList->AppendL( deletedInfo );
+            CleanupStack::Pop( deletedInfo );
+            CleanupStack::PopAndDestroy( identity );
+            // handling a list of only deleted groups
+            groupListSubs.SetDeletedListL( iGroupAddressList );
+            break;
+            }
+
+        XIMP_DEFAULT_CASE_UNSUPPORTED( NXIMPPrivPanic::EInvalidOperationType );
+        }
+
+    iGroupAddressList = NULL;
+    // ownership was transferred
+
+    // synthesize the event to all contexts
+    TRAP_IGNORE( groupListSubs.SynthesiseSubscriptionEventToAllCtxsL() );
+ 
+    CleanupStack::PopAndDestroy(); // groupListSubs
+
+    iMyHost->HandleAdaptationRequestCompleted( iReqId, KErrNone );
+    }
+
+// ---------------------------------------------------------------------------
+// COperationHandlePresentityGroups::RequestCompleted()
+// ---------------------------------------------------------------------------
+//
+void COperationHandlePresentityGroups::RequestCompletedL()
+    {
+    TRACE(_L("COperationHandlePresentityGroups::RequestCompletedL()" ) );
+    CXIMPOperationBase::RequestCompletedL();    
+    // no special handling for error situations
+    }
+
+
+// ---------------------------------------------------------------------------
+// COperationHandlePresentityGroups::Type()
+// ---------------------------------------------------------------------------
+//
+TInt COperationHandlePresentityGroups::Type() const
+    {
+    return iMyType;
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresenceoperations/presentitygroups/operationhandlepresentitygroups.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,72 @@
+/*
+* 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:  Handle presentity group list operations
+ *
+*/
+
+#ifndef CPSCOPERATIONHANDLEPRESENTITYGROUPS_H
+#define CPSCOPERATIONHANDLEPRESENTITYGROUPS_H
+
+
+#include <e32base.h>
+#include <ximpbase.h>
+
+#include "ximpoperationbase.h"
+#include "presencetypehelpers.h"
+#include "presenceoperationdefs.h"
+
+/**
+ * Handle presentity group related operations.
+ *
+ * @lib ximpoperations.lib
+ * @since S60 v4.0
+ */
+class COperationHandlePresentityGroups : public CXIMPOperationBase
+    {
+
+    public:
+
+        IMPORT_C COperationHandlePresentityGroups(
+                NPresenceOps::TPresenceOpTypes aMyType );
+
+        void ConstructL( const TDesC8& aParamPck );
+
+        ~COperationHandlePresentityGroups();
+
+    public: // from CXIMPOperationBase
+
+        void ProcessL();
+
+        void RequestCompletedL();
+
+        TInt Type() const;
+
+    private: // data
+
+        /**
+         * Array of group identities.
+         * Owned.
+         */
+        RPrGrpInfoImpArray* iGroupAddressList;
+
+        /**
+         * This is an internal and polymorphic operation.
+         * The actual type will be defined by this variable,
+         * set during operation creation.
+         */
+        NPresenceOps::TPresenceOpTypes iMyType;
+    };
+
+
+#endif // CPSCOPERATIONHandlePresentityGroups_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresenceoperations/presentitygroups/operationremovepresentitygroupmember.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,119 @@
+/*
+* 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:  Remove Presentity Group Member operation
+ *
+*/
+
+#include <s32mem.h>
+#include <ximpprotocolconnection.h>
+#include <protocolpresentitygroups.h>
+#include <protocolpresencefeatures.h>
+
+#include "operationremovepresentitygroupmember.h"
+#include "ximpidentityimp.h"
+#include "protocolpresentitygroupsdatahostimp.h"
+#include "ximphost.h"
+#include "ximpstatusimp.h"
+#include "protocolpresencedatahostimp.h"
+
+#include "ximptrace.h"
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// COperationRemovePresentityGroupMember::COperationRemovePresentityGroupMember()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C COperationRemovePresentityGroupMember::COperationRemovePresentityGroupMember()
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// COperationRemovePresentityGroupMember::ConstructL
+// ---------------------------------------------------------------------------
+//
+void COperationRemovePresentityGroupMember::ConstructL( const TDesC8& aParamPck )
+    {
+    RDesReadStream rs;
+    rs.Open( aParamPck ); // CSI: 65 # Does not return a value.
+    CleanupClosePushL( rs );
+
+    // group id
+    iGroupId = CXIMPIdentityImp::NewLC();
+    CleanupStack::Pop( iGroupId );
+    iGroupId->InternalizeL( rs );
+
+    // member id
+    iMemberId = CXIMPIdentityImp::NewLC();
+    CleanupStack::Pop( iMemberId );
+    iMemberId->InternalizeL( rs );
+
+
+    CleanupStack::PopAndDestroy( 1 ); // rs
+    }
+
+// ---------------------------------------------------------------------------
+// COperationRemovePresentityGroupMember::~COperationRemovePresentityGroupMember()
+// ---------------------------------------------------------------------------
+//
+COperationRemovePresentityGroupMember::~COperationRemovePresentityGroupMember()
+    {
+    delete iGroupId;
+    delete iMemberId;
+    }
+
+// ---------------------------------------------------------------------------
+// COperationRemovePresentityGroupMember::ProcessL()
+// ---------------------------------------------------------------------------
+//
+void COperationRemovePresentityGroupMember::ProcessL()
+    {
+    TRACE(_L("COperationRemovePresentityGroupMember::ProcessL()" ) );
+    CXIMPOperationBase::ProcessL();
+
+    MProtocolPresentityGroups& presentityGroups = iMyHost->GetConnection().ProtocolPresenceFeatures().PresentityGroups();
+
+    presentityGroups.DoRemovePresentityGroupMemberL( *iGroupId,
+                                               *iMemberId,
+                                               iReqId );
+    }
+
+// ---------------------------------------------------------------------------
+// COperationRemovePresentityGroupMember::RequestCompleted()
+// ---------------------------------------------------------------------------
+//
+void COperationRemovePresentityGroupMember::RequestCompletedL()
+    {
+    TRACE(_L("COperationRemovePresentityGroupMember::RequestCompletedL()" ) );
+    CXIMPOperationBase::RequestCompletedL();
+
+    if ( iStatusObj->ResultCode() == KErrNone )
+        {
+        iMyHost->PresenceDataAccess().GroupsDataAccess().HandlePresentityGroupMemberRemovedL( iGroupId, iMemberId );
+        iGroupId = NULL;
+        iMemberId = NULL;
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// COperationRemovePresentityGroupMember::Type()
+// ---------------------------------------------------------------------------
+//
+TInt COperationRemovePresentityGroupMember::Type() const
+    {
+    return NPresenceOps::EPrRemovePresentityGroupMember;
+    }
+
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresenceoperations/presentitygroups/operationremovepresentitygroupmember.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,65 @@
+/*
+* 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:  Remove Presentity Group Member operation
+ *
+*/
+
+#ifndef PSCOPERATIONREMOVEPRESENTITYGROUPMEMBER_H
+#define PSCOPERATIONREMOVEPRESENTITYGROUPMEMBER_H
+
+#include <e32base.h>
+#include <ximpbase.h>
+
+#include "ximpoperationbase.h"
+#include "presenceoperationdefs.h"
+
+class CXIMPIdentityImp;
+
+/**
+ * Remove presentity group member operation
+ *
+ * @lib presenceoperation.lib
+ * @since S60 v4.0
+ */
+class COperationRemovePresentityGroupMember : public CXIMPOperationBase
+    {
+
+    public:
+
+        IMPORT_C COperationRemovePresentityGroupMember();
+
+        void ConstructL( const TDesC8& aParamPck );
+
+        ~COperationRemovePresentityGroupMember();
+
+    public: // from CXIMPOperationBase
+
+        void ProcessL();
+
+        void RequestCompletedL();
+
+        TInt Type() const;
+
+    private: // data
+
+        /**
+         * Group id
+         * Own.
+         */
+        CXIMPIdentityImp* iGroupId;
+        CXIMPIdentityImp* iMemberId;
+    };
+
+
+#endif // PSCOPERATIONREMOVEPRESENTITYGROUPMEMBER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresenceoperations/presentitygroups/operationsubscribegroupcontent.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,208 @@
+/*
+* 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:  Presentity group content subscription operator
+ *
+*/
+
+
+#include <ximpprotocolconnection.h>
+#include <protocolpresentitygroups.h>
+#include <protocolpresencefeatures.h>
+
+#include "operationsubscribegroupcontent.h"
+#include "ximpobjecthelpers.h"
+#include "presencedatacacheimp.h"
+#include "ximppanics.h"
+#include "operationsynthesisesubscriptionevent.h"
+#include "ximprestrictedobjectcollectionimp.h"
+#include "ximpidentityimp.h"
+#include "ximphost.h"
+#include "ximpstatusimp.h"
+#include "ximppsccontextimp.h"
+#include "protocolpresencedatahostimp.h"
+
+#include "ximptrace.h"
+
+// ============================ MEMBER FUNCTIONS =============================
+
+// ---------------------------------------------------------------------------
+// COperationSubscribeGroupContent::COperationSubscribeGroupContent()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C COperationSubscribeGroupContent::COperationSubscribeGroupContent()
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// COperationSubscribeGroupContent::~COperationSubscribeGroupContent()
+// ---------------------------------------------------------------------------
+//
+COperationSubscribeGroupContent::~COperationSubscribeGroupContent()
+    {
+    if( iSubItem )
+        {
+        iSubItem->Close();
+        }
+    delete iGroupId;
+    }
+
+// ---------------------------------------------------------------------------
+// COperationSubscribeGroupContent::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void COperationSubscribeGroupContent::ConstructL( const TDesC8& aParamPck )
+    {
+    iGroupId = CXIMPIdentityImp::NewLC();
+    CleanupStack::Pop( iGroupId );
+    TXIMPObjectPacker< CXIMPIdentityImp >::UnPackL( *iGroupId, aParamPck );
+    }
+
+
+// ---------------------------------------------------------------------------
+// COperationSubscribeGroupContent::ProcessL()
+// ---------------------------------------------------------------------------
+//
+void COperationSubscribeGroupContent::ProcessL()
+    {
+    TRACE(_L("COperationSubscribeGroupContent::ProcessL()" ) );
+    CXIMPOperationBase::ProcessL();
+
+    CGroupContentSubscriptionItem& subItem =
+                            iMyHost->PresenceDataAccess().PresenceDataCache().GroupContentSubscriptionItemLC( *iGroupId );
+    CleanupStack::Pop(); // subItem
+    iSubItem = &subItem;
+    iSubscriptionStatus = iSubItem->SubscriptionStatus( iContext );
+    MProtocolPresentityGroups& presentityGroups = iMyHost->GetConnection().ProtocolPresenceFeatures().PresentityGroups();
+
+    switch( iSubscriptionStatus )
+        {
+        case CGroupContentSubscriptionItem::ENotSubscribedAtAll:
+            {
+            presentityGroups.DoSubscribePresentityGroupContentL( *iGroupId, iReqId );
+            break;
+            }
+        
+        case CGroupContentSubscriptionItem::ESubscribedForOtherCtxOnly:
+        case CGroupContentSubscriptionItem::ESubscribedForCtxOnly:
+        case CGroupContentSubscriptionItem::ESubscribedForCtxAndOthers:
+            {
+            iMyHost->FakeCompleteRequest( iReqId, KErrNone );
+            break;
+            }
+            
+        XIMP_DEFAULT_CASE_UNSUPPORTED( NXIMPPrivPanic::EInvalidSubscriptionStatus );            
+        }
+    }
+
+
+// ---------------------------------------------------------------------------
+// COperationSubscribeGroupContent::RequestCompleted()
+// ---------------------------------------------------------------------------
+//
+void COperationSubscribeGroupContent::RequestCompletedL()
+    {
+    TRACE(_L("COperationSubscribeGroupContent::RequestCompletedL()" ) );
+    CXIMPOperationBase::RequestCompletedL();
+
+    if( iStatusObj->ResultCode() == KErrNone )
+        {
+        switch( iSubscriptionStatus )
+            {
+            case CGroupContentSubscriptionItem::ENotSubscribedAtAll:
+                {
+                CXIMPIdentityImp* altGroupId = NULL;
+                MXIMPBase* object = NULL;
+                iObjCollection->GetByType( object, MXIMPIdentity::KInterfaceId );
+                if( object )
+                    {
+                    // Got altered identity
+                    altGroupId = TXIMPGetImpClassOrPanic< CXIMPIdentityImp >::From( *object );
+                    CleanupStack::PushL( altGroupId );
+                    }
+
+                if ( altGroupId && iGroupId->Identity().Compare( altGroupId->Identity() ) != 0 )
+                    {
+                    CGroupContentSubscriptionItem& altSubItem =
+                        iMyHost->PresenceDataAccess().PresenceDataCache().GroupContentSubscriptionItemLC( *altGroupId );
+                    CleanupStack::Pop(); // altSubItem
+                    iSubItem->Close();
+                    iSubItem = &altSubItem;
+                    iSubItem->AddOrRenewSubscriberL( iContext );
+                    }
+                else
+                    {
+                    iSubItem->AddSubscriberL( iContext );
+                    }
+
+                if( altGroupId )
+                    {
+                    CleanupStack::PopAndDestroy( altGroupId );
+                    }                
+                break;
+                }
+            
+            case CGroupContentSubscriptionItem::ESubscribedForOtherCtxOnly:
+                {
+                iSubItem->AddSubscriberL( iContext );
+                break;
+                }
+            
+            case CGroupContentSubscriptionItem::ESubscribedForCtxOnly:
+            case CGroupContentSubscriptionItem::ESubscribedForCtxAndOthers:
+                {
+                break;
+                }
+
+            XIMP_DEFAULT_CASE_UNSUPPORTED( NXIMPPrivPanic::EInvalidSubscriptionStatus );            
+            }
+
+        SynthesiseEventL();
+        }
+    }
+
+
+// ---------------------------------------------------------------------------
+// COperationSubscribeGroupContent::Type()
+// ---------------------------------------------------------------------------
+//
+TInt
+    COperationSubscribeGroupContent::Type() const
+    {
+    return NPresenceOps::EPrSubscribeGroupContent;
+    }
+
+// ---------------------------------------------------------------------------
+// COperationSubscribeGroupContent::SynthesiseEventL()
+// ---------------------------------------------------------------------------
+//
+void COperationSubscribeGroupContent::SynthesiseEventL()
+    {
+    TBool force =
+    ( iSubscriptionStatus == CGroupContentSubscriptionItem::ESubscribedForCtxOnly ||
+      iSubscriptionStatus == CGroupContentSubscriptionItem::ESubscribedForCtxAndOthers ) ? ETrue : EFalse;
+
+    COperationSynthesiseSubscriptionEvent* synthOp =
+            new ( ELeave ) COperationSynthesiseSubscriptionEvent(
+                             COperationSynthesiseSubscriptionEvent::EPresentityGroupContent, force );
+    CleanupStack::PushL( synthOp );
+    synthOp->BaseConstructL( TXIMPRequestId(), iContext );
+    synthOp->ConstructL( *iGroupId );
+    iMyHost->AddNewOperationL( *synthOp );
+    CleanupStack::Pop( synthOp );
+    }
+
+
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresenceoperations/presentitygroups/operationsubscribegroupcontent.h	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  Presentity group content subscription operator
+ *
+*/
+
+#ifndef CPSCOPERATIONSUBSCRIBEGROUPCONTENT_H
+#define CPSCOPERATIONSUBSCRIBEGROUPCONTENT_H
+
+
+#include <e32base.h>
+#include <ximpbase.h>
+
+#include "ximpoperationbase.h"
+#include "presenceoperationdefs.h"
+#include "groupcontentsubscriptionitem.h"
+
+/**
+ * Presence interest registration operation.
+ *
+ * @lib ximpoperations.lib
+ * @since S60 v4.0
+ */
+class COperationSubscribeGroupContent : public CXIMPOperationBase
+    {
+
+    public:
+
+        IMPORT_C COperationSubscribeGroupContent();
+
+        void ConstructL( const TDesC8& aParamPck );
+
+        ~COperationSubscribeGroupContent();
+
+
+    public: // from CXIMPOperationBase
+
+        void ProcessL();
+
+        void RequestCompletedL();
+
+        TInt Type() const;
+
+    private: // Helper methods
+
+        /**
+         * Synthesise event after completion
+         */
+        void SynthesiseEventL();
+
+    private: // data
+
+        /**
+         * Group list access.
+         */
+        CGroupContentSubscriptionItem* iSubItem;
+
+        /**
+         * Subscription status
+         */
+        CGroupContentSubscriptionItem::TSubscriptionStatus iSubscriptionStatus;
+        
+        /**
+         * Subscribed Group Id 
+         * Own.
+         */
+        CXIMPIdentityImp* iGroupId;
+        
+    };
+
+
+#endif // CPSCOPERATIONSUBSCRIBEGROUPCONTENT_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresenceoperations/presentitygroups/operationsubscribegrouplist.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,166 @@
+/*
+* 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:  Presentity group list subscription operator
+ *
+*/
+
+
+#include <ximpprotocolconnection.h>
+#include <protocolpresentitygroups.h>
+#include <protocolpresencefeatures.h>
+
+#include "operationsubscribegrouplist.h"
+#include "presencedatacacheimp.h"
+#include "ximppanics.h"
+#include "operationsynthesisesubscriptionevent.h"
+#include "ximphost.h"
+#include "ximppsccontextimp.h"
+#include "ximpstatusimp.h"
+#include "protocolpresencedatahostimp.h"
+
+#include "ximptrace.h"
+// ============================ MEMBER FUNCTIONS =============================
+
+// ---------------------------------------------------------------------------
+// COperationSubscribeGroupList::COperationSubscribeGroupList()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C COperationSubscribeGroupList::COperationSubscribeGroupList()
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// COperationSubscribeGroupList::~COperationSubscribeGroupList()
+// ---------------------------------------------------------------------------
+//
+COperationSubscribeGroupList::~COperationSubscribeGroupList()
+    {
+    if( iGroupList )
+        {
+        iGroupList->Close();
+        }      
+    }
+
+// ---------------------------------------------------------------------------
+// COperationSubscribeGroupList::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void COperationSubscribeGroupList::ConstructL( const TDesC8& /*aParamPck*/ )
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// COperationSubscribeGroupList::ProcessL()
+// ---------------------------------------------------------------------------
+//
+void COperationSubscribeGroupList::ProcessL()
+    {
+    TRACE(_L("COperationSubscribeGroupList::ProcessL()" ) );
+    CXIMPOperationBase::ProcessL();    
+    
+    CGroupListSubscriptionItem& groupList = 
+                            iMyHost->PresenceDataAccess().PresenceDataCache().GroupListSubscriptionItemLC();
+    CleanupStack::Pop(); // groupList
+    iGroupList = &groupList;
+    
+    iSubscriptionStatus = iGroupList->SubscriptionStatus( iContext );
+    MProtocolPresentityGroups& presentityGroups = iMyHost->GetConnection().ProtocolPresenceFeatures().PresentityGroups();
+    
+    switch( iSubscriptionStatus )
+        {
+        case CGroupListSubscriptionItem::ENotSubscribedAtAll:
+            {
+            // Do subscribe
+            presentityGroups.DoSubscribePresentityGroupListL( iReqId );
+            break;
+            }
+        case CGroupListSubscriptionItem::ESubscribedForOtherCtxOnly:
+        case CGroupListSubscriptionItem::ESubscribedForCtxOnly:
+        case CGroupListSubscriptionItem::ESubscribedForCtxAndOthers:
+            {
+            iMyHost->FakeCompleteRequest( iReqId, KErrNone );
+            break;
+            }
+        
+        
+        XIMP_DEFAULT_CASE_UNSUPPORTED( NXIMPPrivPanic::EInvalidSubscriptionStatus );
+        }    
+    }
+
+// ---------------------------------------------------------------------------
+// COperationSubscribeGroupList::RequestCompleted()
+// ---------------------------------------------------------------------------
+//
+void COperationSubscribeGroupList::RequestCompletedL()
+    {
+    TRACE(_L("COperationSubscribeGroupList::RequestCompletedL()" ) );
+    CXIMPOperationBase::RequestCompletedL();
+
+    if( iStatusObj->ResultCode() == KErrNone )
+        {
+        switch( iSubscriptionStatus )
+            {
+            case CGroupListSubscriptionItem::ENotSubscribedAtAll:
+            case CGroupListSubscriptionItem::ESubscribedForOtherCtxOnly:
+                {
+                iGroupList->AddSubscriberL( iContext );
+                break;
+                }
+            case CGroupListSubscriptionItem::ESubscribedForCtxOnly:
+            case CGroupListSubscriptionItem::ESubscribedForCtxAndOthers:
+                {
+                break;
+                }
+                
+            XIMP_DEFAULT_CASE_UNSUPPORTED( NXIMPPrivPanic::EInvalidSubscriptionStatus );
+            }        
+        SynthesiseEventL();
+        }     
+    }
+
+
+// ---------------------------------------------------------------------------
+// COperationSubscribeGroupList::Type()
+// ---------------------------------------------------------------------------
+//
+TInt 
+    COperationSubscribeGroupList::Type() const
+    {
+    return NPresenceOps::EPrSubscribeGroupList;
+    }
+
+// ---------------------------------------------------------------------------
+// COperationSubscribeGroupList::SynthesiseEventL()
+// ---------------------------------------------------------------------------
+//
+void COperationSubscribeGroupList::SynthesiseEventL()
+    {
+    TBool force = 
+    ( iSubscriptionStatus == CGroupListSubscriptionItem::ESubscribedForCtxOnly ||
+      iSubscriptionStatus == CGroupListSubscriptionItem::ESubscribedForCtxAndOthers ) ? ETrue : EFalse;
+    
+    COperationSynthesiseSubscriptionEvent* synthOp = 
+            new ( ELeave ) COperationSynthesiseSubscriptionEvent( 
+                             COperationSynthesiseSubscriptionEvent::EPresentityGroupList, force );
+    CleanupStack::PushL( synthOp );
+    synthOp->BaseConstructL( TXIMPRequestId(), iContext );        
+    iMyHost->AddNewOperationL( *synthOp );
+    CleanupStack::Pop( synthOp );    
+    }
+
+
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresenceoperations/presentitygroups/operationsubscribegrouplist.h	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  Presentity group list subscription operator
+ *
+*/
+
+#ifndef CPSCOPERATIONSUBSCRIBEGROUPLIST_H
+#define CPSCOPERATIONSUBSCRIBEGROUPLIST_H
+
+
+#include <e32base.h>
+#include <ximpbase.h>
+
+#include "ximpoperationbase.h"
+#include "grouplistsubscriptionitem.h"
+#include "presenceoperationdefs.h"
+
+/**
+ * Presence interest registration operation.
+ *
+ * @lib ximpoperations.lib
+ * @since S60 v4.0
+ */
+class COperationSubscribeGroupList : public CXIMPOperationBase
+    {
+
+    public:
+
+        IMPORT_C COperationSubscribeGroupList();
+
+        void ConstructL( const TDesC8& aParamPck );
+
+        ~COperationSubscribeGroupList();
+
+
+    public: // from CXIMPOperationBase
+
+        void ProcessL();
+
+        void RequestCompletedL();
+
+        TInt Type() const;
+        
+    private: // Helper methods
+    
+        /**
+         * Synthesise event after completion
+         */
+        void SynthesiseEventL();      
+
+    private: // data
+
+        /**
+         * Group list access.
+         */
+        CGroupListSubscriptionItem* iGroupList;
+        
+        /**
+         * Subscription status
+         */
+        CGroupListSubscriptionItem::TSubscriptionStatus iSubscriptionStatus;
+    };
+
+
+#endif // CPSCOPERATIONSUBSCRIBEGROUPLIST_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresenceoperations/presentitygroups/operationunsubscribegroupcontent.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,169 @@
+/*
+* 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:  Presentity group content unsubscribe operator
+ *
+*/
+
+
+#include <ximpprotocolconnection.h>
+#include <protocolpresentitygroups.h>
+#include <protocolpresencefeatures.h>
+
+#include "operationunsubscribegroupcontent.h"
+#include "ximpobjecthelpers.h"
+#include "presencedatacacheimp.h"
+#include "ximppanics.h"
+#include "operationsynthesisesubscriptionevent.h"
+#include "ximpidentityimp.h"
+#include "ximphost.h"
+#include "ximpstatusimp.h"
+#include "ximppsccontextimp.h"
+#include "protocolpresencedatahostimp.h"
+
+#include "ximptrace.h"
+// ============================ MEMBER FUNCTIONS =============================
+
+// ---------------------------------------------------------------------------
+// COperationUnsubscribeGroupContent::COperationUnsubscribeGroupContent()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C COperationUnsubscribeGroupContent::COperationUnsubscribeGroupContent()
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// COperationUnsubscribeGroupContent::~COperationUnsubscribeGroupContent()
+// ---------------------------------------------------------------------------
+//
+COperationUnsubscribeGroupContent::~COperationUnsubscribeGroupContent()
+    {
+    if( iSubItem )
+        {
+        iSubItem->Close();
+        }
+    delete iGroupId;
+    }
+
+// ---------------------------------------------------------------------------
+// COperationUnsubscribeGroupContent::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void COperationUnsubscribeGroupContent::ConstructL( const TDesC8& aParamPck )
+    {
+    iGroupId = CXIMPIdentityImp::NewLC();
+    CleanupStack::Pop( iGroupId );
+    TXIMPObjectPacker< CXIMPIdentityImp >::UnPackL( *iGroupId, aParamPck );
+    }
+
+
+// ---------------------------------------------------------------------------
+// COperationUnsubscribeGroupContent::ProcessL()
+// ---------------------------------------------------------------------------
+//
+void COperationUnsubscribeGroupContent::ProcessL()
+    {
+    TRACE(_L("COperationUnsubscribeGroupContent::ProcessL()" ) );
+    CXIMPOperationBase::ProcessL();
+
+    CGroupContentSubscriptionItem& subItem =
+                            iMyHost->PresenceDataAccess().PresenceDataCache().GroupContentSubscriptionItemLC( *iGroupId );
+    CleanupStack::Pop(); // subItem
+    iSubItem = &subItem;
+
+    iSubscriptionStatus = iSubItem->SubscriptionStatus( iContext );
+    MProtocolPresentityGroups& presentityGroups = iMyHost->GetConnection().ProtocolPresenceFeatures().PresentityGroups();
+
+    switch( iSubscriptionStatus )
+        {
+        case CGroupContentSubscriptionItem::ESubscribedForCtxOnly:
+            {
+            presentityGroups.DoUnsubscribePresentityGroupContentL( *iGroupId, iReqId );
+            break;
+            }
+
+        case CGroupContentSubscriptionItem::ENotSubscribedAtAll:
+        case CGroupContentSubscriptionItem::ESubscribedForCtxAndOthers:
+        case CGroupContentSubscriptionItem::ESubscribedForOtherCtxOnly:
+            {
+            iMyHost->FakeCompleteRequest( iReqId, KErrNone );
+            break;
+            }
+
+        XIMP_DEFAULT_CASE_UNSUPPORTED( NXIMPPrivPanic::EInvalidSubscriptionStatus ); 
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// COperationUnsubscribeGroupContent::RequestCompleted()
+// ---------------------------------------------------------------------------
+//
+void COperationUnsubscribeGroupContent::RequestCompletedL()
+    {
+    TRACE(_L("COperationUnsubscribeGroupContent::RequestCompletedL()" ) );
+    CXIMPOperationBase::RequestCompletedL();
+
+    if( iStatusObj->ResultCode() == KErrNone )
+        {
+        switch( iSubscriptionStatus )
+            {
+            case CGroupContentSubscriptionItem::ESubscribedForCtxOnly:
+            case CGroupContentSubscriptionItem::ESubscribedForCtxAndOthers:
+                {
+                iSubItem->RemoveSubscriber( iContext );
+                break;
+                }
+            case CGroupContentSubscriptionItem::ENotSubscribedAtAll:
+            case CGroupContentSubscriptionItem::ESubscribedForOtherCtxOnly:
+                {
+                break;
+                }
+                
+            XIMP_DEFAULT_CASE_UNSUPPORTED( NXIMPPrivPanic::EInvalidSubscriptionStatus );                 
+            }
+
+        SynthesiseEventL();
+        }
+    }
+
+
+// ---------------------------------------------------------------------------
+// COperationUnsubscribeGroupContent::Type()
+// ---------------------------------------------------------------------------
+//
+TInt
+    COperationUnsubscribeGroupContent::Type() const
+    {
+    return NPresenceOps::EPrUnsubscribeGroupContent;
+    }
+
+// ---------------------------------------------------------------------------
+// COperationUnsubscribeGroupContent::SynthesiseEventL()
+// ---------------------------------------------------------------------------
+//
+void COperationUnsubscribeGroupContent::SynthesiseEventL()
+    {
+    COperationSynthesiseSubscriptionEvent* synthOp =
+            new ( ELeave ) COperationSynthesiseSubscriptionEvent(
+                             COperationSynthesiseSubscriptionEvent::EPresentityGroupContent, ETrue );
+    CleanupStack::PushL( synthOp );
+    synthOp->BaseConstructL( TXIMPRequestId(), iContext );
+    synthOp->ConstructL( *iGroupId );    
+    iMyHost->AddNewOperationL( *synthOp );
+    CleanupStack::Pop( synthOp );
+    }
+
+
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresenceoperations/presentitygroups/operationunsubscribegroupcontent.h	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  Presentity group content unsubscribe operator
+ *
+*/
+
+#ifndef CPSCOPERATIONUNSUBSCRIBEGROUPCONTENT_H
+#define CPSCOPERATIONUNSUBSCRIBEGROUPCONTENT_H
+
+
+#include <e32base.h>
+#include <ximpbase.h>
+
+#include "ximpoperationbase.h"
+#include "groupcontentsubscriptionitem.h"
+#include "presenceoperationdefs.h"
+
+/**
+ * Presence interest registration operation.
+ *
+ * @lib ximpoperations.lib
+ * @since S60 v4.0
+ */
+class COperationUnsubscribeGroupContent : public CXIMPOperationBase
+    {
+
+    public:
+
+        IMPORT_C COperationUnsubscribeGroupContent();
+
+        void ConstructL( const TDesC8& aParamPck );
+
+        ~COperationUnsubscribeGroupContent();
+
+
+    public: // from CXIMPOperationBase
+
+        void ProcessL();
+
+        void RequestCompletedL();
+
+        TInt Type() const;
+
+    private: // Helper methods
+
+        /**
+         * Synthesise event after completion
+         */
+        void SynthesiseEventL();
+
+    private: // data
+
+        /**
+         * Group content access.
+         */
+        CGroupContentSubscriptionItem* iSubItem;
+
+        /**
+         * Subscription status
+         */
+        CGroupContentSubscriptionItem::TSubscriptionStatus iSubscriptionStatus;
+
+        /**
+         * Subscribed Group Id
+         * Own.
+         */
+        CXIMPIdentityImp* iGroupId;
+
+    };
+
+
+#endif // CPSCOPERATIONUNSUBSCRIBEGROUPCONTENT_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresenceoperations/presentitygroups/operationunsubscribegrouplist.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  Presentity group list unsubscription operation
+ *
+*/
+
+
+#include <ximpprotocolconnection.h>
+#include <protocolpresentitygroups.h>
+#include <protocolpresencefeatures.h>
+
+#include "operationunsubscribegrouplist.h"
+#include "presencedatacacheimp.h"
+#include "ximppanics.h"
+#include "operationsynthesisesubscriptionevent.h"
+#include "ximphost.h"
+#include "ximppsccontextimp.h"
+#include "ximpstatusimp.h"
+#include "protocolpresencedatahostimp.h"
+
+#include "ximptrace.h"
+// ============================ MEMBER FUNCTIONS =============================
+
+// ---------------------------------------------------------------------------
+// COperationUnsubscribeGroupList::COperationUnsubscribeGroupList()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C COperationUnsubscribeGroupList::COperationUnsubscribeGroupList()
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// COperationUnsubscribeGroupList::~COperationUnsubscribeGroupList()
+// ---------------------------------------------------------------------------
+//
+COperationUnsubscribeGroupList::~COperationUnsubscribeGroupList()
+    {
+    if( iGroupList )
+        {
+        iGroupList->Close();
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// COperationUnsubscribeGroupList::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void COperationUnsubscribeGroupList::ConstructL( const TDesC8& /*aParamPck*/ )
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// COperationUnsubscribeGroupList::ProcessL()
+// ---------------------------------------------------------------------------
+//
+void COperationUnsubscribeGroupList::ProcessL()
+    {
+    TRACE(_L("COperationUnsubscribeGroupList::ProcessL()" ) );
+    CXIMPOperationBase::ProcessL();
+
+    CGroupListSubscriptionItem& groupList =
+                            iMyHost->PresenceDataAccess().PresenceDataCache().GroupListSubscriptionItemLC();
+    CleanupStack::Pop(); // ownPresence
+    iGroupList = &groupList;
+
+    iSubscriptionStatus = iGroupList->SubscriptionStatus( iContext );
+
+    MProtocolPresentityGroups& presentityGroups = iMyHost->GetConnection().ProtocolPresenceFeatures().PresentityGroups();
+
+    switch( iSubscriptionStatus )
+        {
+        case CGroupListSubscriptionItem::ESubscribedForCtxOnly:
+            {
+            // Do subscribe
+            presentityGroups.DoUnsubscribePresentityGroupListL( iReqId );
+            break;
+            }
+        case CGroupListSubscriptionItem::ESubscribedForCtxAndOthers:
+        case CGroupListSubscriptionItem::ENotSubscribedAtAll:
+        case CGroupListSubscriptionItem::ESubscribedForOtherCtxOnly:
+            {
+            // Everything is ok. We are not handling updates through this one.
+            // Already subscribed -> complete request.
+            iMyHost->FakeCompleteRequest( iReqId, KErrNone );
+            break;
+            }
+
+        XIMP_DEFAULT_CASE_UNSUPPORTED( NXIMPPrivPanic::EInvalidSubscriptionStatus );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// COperationUnsubscribeGroupList::RequestCompleted()
+// ---------------------------------------------------------------------------
+//
+void COperationUnsubscribeGroupList::RequestCompletedL()
+    {
+    TRACE(_L("COperationUnsubscribeGroupList::RequestCompletedL()" ) );
+    CXIMPOperationBase::RequestCompletedL();
+
+    if( iStatusObj->ResultCode() == KErrNone )
+        {
+        switch( iSubscriptionStatus )
+            {
+            case CGroupListSubscriptionItem::ESubscribedForCtxOnly:
+            case CGroupListSubscriptionItem::ESubscribedForCtxAndOthers:
+                {
+                iGroupList->RemoveSubscriber( iContext );
+                break;
+                }
+            case CGroupListSubscriptionItem::ENotSubscribedAtAll:
+            case CGroupListSubscriptionItem::ESubscribedForOtherCtxOnly:
+                {
+                break;
+                }
+                
+            XIMP_DEFAULT_CASE_UNSUPPORTED( NXIMPPrivPanic::EInvalidSubscriptionStatus );                
+            }
+        SynthesiseEventL();
+        }
+    }
+
+
+// ---------------------------------------------------------------------------
+// COperationUnsubscribeGroupList::Type()
+// ---------------------------------------------------------------------------
+//
+TInt
+    COperationUnsubscribeGroupList::Type() const
+    {
+    return NPresenceOps::EPrUnsubscribeGroupList;
+    }
+
+// ---------------------------------------------------------------------------
+// COperationUnsubscribeGroupList::SynthesiseEventL()
+// ---------------------------------------------------------------------------
+//
+void COperationUnsubscribeGroupList::SynthesiseEventL()
+    {
+    COperationSynthesiseSubscriptionEvent* synthOp =
+            new ( ELeave ) COperationSynthesiseSubscriptionEvent(
+                             COperationSynthesiseSubscriptionEvent::EPresentityGroupList, ETrue );
+    CleanupStack::PushL( synthOp );
+    synthOp->BaseConstructL( TXIMPRequestId(), iContext );
+    iMyHost->AddNewOperationL( *synthOp );
+    CleanupStack::Pop( synthOp );
+    }
+
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresenceoperations/presentitygroups/operationunsubscribegrouplist.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,75 @@
+/*
+* 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:  Presentity group list unsubscription operation
+ *
+*/
+
+#ifndef CPSCOPERATIONUNSUBSCRIBEGROUPLIST_H
+#define CPSCOPERATIONUNSUBSCRIBEGROUPLIST_H
+
+
+#include <e32base.h>
+#include <ximpbase.h>
+
+#include "ximpoperationbase.h"
+#include "grouplistsubscriptionitem.h"
+#include "presenceoperationdefs.h"
+
+/**
+ * Presence interest registration operation.
+ *
+ * @lib ximpoperations.lib
+ * @since S60 v4.0
+ */
+class COperationUnsubscribeGroupList : public CXIMPOperationBase
+    {
+    public:
+
+        IMPORT_C COperationUnsubscribeGroupList();
+
+        void ConstructL( const TDesC8& aParamPck );
+
+        ~COperationUnsubscribeGroupList();
+
+
+    public: // from CXIMPOperationBase
+
+        void ProcessL();
+
+        void RequestCompletedL();
+
+        TInt Type() const;
+        
+    private: // Helper methods
+    
+        /**
+         * Synthesise event after completion
+         */
+        void SynthesiseEventL();
+
+    private: // data
+
+        /**
+         * Group list access.
+         */
+        CGroupListSubscriptionItem* iGroupList;
+        
+        /**
+         * Subscription status
+         */
+        CGroupListSubscriptionItem::TSubscriptionStatus iSubscriptionStatus;
+    };
+
+
+#endif // CPSCOPERATIONUNSUBSCRIBEGROUPLIST_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresenceoperations/presentitygroups/operationupdatepresentitygroupdisplayname.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,126 @@
+/*
+* 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:  Concrete bind operation
+ *
+*/
+
+
+#include <ximpprotocolconnection.h>
+#include <protocolpresentitygroups.h>
+#include <protocolpresencefeatures.h>
+
+#include "operationupdatepresentitygroupdisplayname.h"
+#include "presentitygroupinfoimp.h"
+#include "ximpobjecthelpers.h"
+#include "ximpidentity.h"
+#include "ximprestrictedobjectcollectionimp.h"
+#include "protocolpresentitygroupsdatahostimp.h"
+#include "ximphost.h"
+#include "ximpstatusimp.h"
+#include "ximprequestcompleteeventimp.h"
+#include "protocolpresencedatahostimp.h"
+
+#include "ximptrace.h"
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// COperationUpdatePresentityGroupDisplayName::COperationUpdatePresentityGroupDisplayName()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C COperationUpdatePresentityGroupDisplayName::COperationUpdatePresentityGroupDisplayName()
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// COperationUpdatePresentityGroupDisplayName::ConstructL
+// ---------------------------------------------------------------------------
+//
+void COperationUpdatePresentityGroupDisplayName::ConstructL( const TDesC8& aParamPck )
+    {
+    CPresentityGroupInfoImp* groupInfo = CPresentityGroupInfoImp::NewLC();
+    TXIMPObjectPacker< CPresentityGroupInfoImp >::UnPackL( *groupInfo,
+            aParamPck );
+    CleanupStack::Pop( groupInfo );
+    iGroupInfo = groupInfo;
+    }
+
+// ---------------------------------------------------------------------------
+// COperationUpdatePresentityGroupDisplayName::~COperationUpdatePresentityGroupDisplayName()
+// ---------------------------------------------------------------------------
+//
+COperationUpdatePresentityGroupDisplayName::~COperationUpdatePresentityGroupDisplayName()
+    {
+    delete iGroupInfo;
+    }
+
+// ---------------------------------------------------------------------------
+// COperationUpdatePresentityGroupDisplayName::ProcessL()
+// ---------------------------------------------------------------------------
+//
+void COperationUpdatePresentityGroupDisplayName::ProcessL()
+    {
+    TRACE(_L("COperationUpdatePresentityGroupDisplayName::ProcessL()" ) );
+    CXIMPOperationBase::ProcessL();
+
+    MProtocolPresentityGroups& presentityGroups = iMyHost->GetConnection().ProtocolPresenceFeatures().PresentityGroups();
+
+    presentityGroups.DoUpdatePresentityGroupDisplayNameL( iGroupInfo->GroupId(),
+                                                          iGroupInfo->GroupDisplayName(), iReqId );
+    }
+
+// ---------------------------------------------------------------------------
+// COperationUpdatePresentityGroupDisplayName::RequestCompleted()
+// ---------------------------------------------------------------------------
+//
+void COperationUpdatePresentityGroupDisplayName::RequestCompletedL()
+    {
+    TRACE(_L("COperationUpdatePresentityGroupDisplayName::RequestCompletedL()" ) );
+    CXIMPOperationBase::RequestCompletedL();
+
+    MXIMPBase* object = NULL;
+    iObjCollection->GetByType( object, MPresentityGroupInfo::KInterfaceId );
+    if( object )
+        {
+        CPresentityGroupInfoImp* groupInfo = 
+                TXIMPGetImpClassOrPanic< CPresentityGroupInfoImp >::From( *object );
+
+        delete iGroupInfo;
+        iGroupInfo = groupInfo;
+        }
+
+    if ( iStatusObj->ResultCode() == KErrNone )
+        {
+        CPresentityGroupInfoImp* groupInfo = 
+                TXIMPObjectCloner< CPresentityGroupInfoImp >::CloneL( *iGroupInfo );
+        CleanupStack::PushL( groupInfo );
+        iMyHost->PresenceDataAccess().GroupsDataAccess().HandlePresentityGroupDisplayNameUpdatedL( groupInfo );
+        CleanupStack::Pop( groupInfo );
+        }
+
+    // Set information for request complete event.
+    iReqCompleteEvent->AppendParamL( ( CXIMPApiDataObjBase* ) iGroupInfo );
+    iGroupInfo = NULL;
+    }
+
+// ---------------------------------------------------------------------------
+// COperationUpdatePresentityGroupDisplayName::Type()
+// ---------------------------------------------------------------------------
+//
+TInt COperationUpdatePresentityGroupDisplayName::Type() const
+    {
+    return NPresenceOps::EPrUpdatePresentityGroupDisplayName;
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresenceoperations/presentitygroups/operationupdatepresentitygroupdisplayname.h	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  Bind operation
+ *
+*/
+
+#ifndef C_PSCOPERATIONUPDATEPRESENTITYGROUPDISPLAYNAME_H
+#define C_PSCOPERATIONUPDATEPRESENTITYGROUPDISPLAYNAME_H
+
+#include <e32base.h>
+#include <ximpbase.h>
+
+#include "ximpoperationbase.h"
+#include "presenceoperationdefs.h"
+
+class CPresentityGroupInfoImp;
+
+/**
+ * Create presentity group operation
+ *
+ * @lib presenceoperation.lib
+ * @since S60 v4.0
+ */
+class COperationUpdatePresentityGroupDisplayName : public CXIMPOperationBase
+    {
+
+    public:
+        
+        IMPORT_C COperationUpdatePresentityGroupDisplayName();
+
+        void ConstructL( const TDesC8& aParamPck );
+
+        ~COperationUpdatePresentityGroupDisplayName();
+
+    public: // from CXIMPOperationBase
+        
+        void ProcessL();
+
+        void RequestCompletedL();
+        
+        TInt Type() const;
+        
+    private: // data
+    
+        /**
+         * groupinfo
+         */
+        CPresentityGroupInfoImp* iGroupInfo;
+    };
+
+
+#endif // C_PSCOPERATIONUPDATEPRESENTITYGROUPDISPLAYNAME_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresenceoperations/presentitygroups/operationupdatepresentitygroupmemberdisplayname.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  Update Presentity Group Member Display Name operation
+ *
+*/
+
+#include <s32mem.h>
+#include <protocolpresentitygroups.h>
+#include <ximpprotocolconnection.h>
+#include <protocolpresencefeatures.h>
+
+#include "operationupdatepresentitygroupmemberdisplayname.h"
+#include "presentitygroupmemberinfoimp.h"
+#include "ximpidentityimp.h"
+#include "protocolpresentitygroupsdatahostimp.h"
+#include "ximprbufhelpers.h"
+#include "ximprestrictedobjectcollectionimp.h"
+#include "ximphost.h"
+#include "ximpstatusimp.h"
+#include "ximprequestcompleteeventimp.h"
+#include "ximpobjecthelpers.h"
+#include "protocolpresencedatahostimp.h"
+
+#include "ximptrace.h"
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// COperationUpdatePresentityGroupMemberDisplayName::COperationUpdatePresentityGroupMemberDisplayName()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C COperationUpdatePresentityGroupMemberDisplayName::COperationUpdatePresentityGroupMemberDisplayName()
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// COperationUpdatePresentityGroupMemberDisplayName::ConstructL
+// ---------------------------------------------------------------------------
+//
+void COperationUpdatePresentityGroupMemberDisplayName::ConstructL( const TDesC8& aParamPck )
+    {
+    RDesReadStream rs;
+    rs.Open( aParamPck ); // CSI: 65 # Does not return a value.
+    CleanupClosePushL( rs );
+
+    // group id
+    iGroupId = CXIMPIdentityImp::NewLC();
+    CleanupStack::Pop( iGroupId );
+    iGroupId->InternalizeL( rs );
+
+    // member id
+    CXIMPIdentityImp* memberId = CXIMPIdentityImp::NewLC();
+    memberId->InternalizeL( rs );
+
+    // member display name
+    RBuf16 dispName;
+    CleanupClosePushL( dispName );
+    XIMPRBuf16Helper::InternalizeL( dispName, rs );
+
+    iMemberInfo = CPresentityGroupMemberInfoImp::NewLC( *memberId, dispName );
+    CleanupStack::Pop( iMemberInfo );
+    CleanupStack::PopAndDestroy( 3 ); // dispName, memberId, rs
+    }
+
+// ---------------------------------------------------------------------------
+// COperationUpdatePresentityGroupMemberDisplayName::~COperationUpdatePresentityGroupMemberDisplayName()
+// ---------------------------------------------------------------------------
+//
+COperationUpdatePresentityGroupMemberDisplayName::~COperationUpdatePresentityGroupMemberDisplayName()
+    {
+    delete iGroupId;
+    delete iMemberInfo;
+    }
+
+// ---------------------------------------------------------------------------
+// COperationUpdatePresentityGroupMemberDisplayName::ProcessL()
+// ---------------------------------------------------------------------------
+//
+void COperationUpdatePresentityGroupMemberDisplayName::ProcessL()
+    {
+    TRACE(_L("COperationUpdatePresentityGroupMemberDisplayName::ProcessL()" ) );
+    CXIMPOperationBase::ProcessL();
+
+    MProtocolPresentityGroups& presentityGroups = iMyHost->GetConnection().ProtocolPresenceFeatures().PresentityGroups();
+
+    presentityGroups.DoUpdatePresentityGroupMemberDisplayNameL(
+                                                *iGroupId,
+                                                iMemberInfo->GroupMemberId(),
+                                                iMemberInfo->GroupMemberDisplayName(),
+                                                iReqId );
+    }
+
+// ---------------------------------------------------------------------------
+// COperationUpdatePresentityGroupMemberDisplayName::RequestCompleted()
+// ---------------------------------------------------------------------------
+//
+void COperationUpdatePresentityGroupMemberDisplayName::RequestCompletedL()
+    {
+    TRACE(_L("COperationUpdatePresentityGroupMemberDisplayName::RequestCompletedL()" ) );
+    CXIMPOperationBase::RequestCompletedL();
+
+    MXIMPBase* object = NULL;
+    iObjCollection->GetByType( object, MPresentityGroupMemberInfo::KInterfaceId );
+    if( object )
+        {
+        CPresentityGroupMemberInfoImp* memberInfo = 
+            TXIMPGetImpClassOrPanic< CPresentityGroupMemberInfoImp >::From( *object );
+        delete iMemberInfo;
+        iMemberInfo = memberInfo;
+        }
+
+    if ( iStatusObj->ResultCode() == KErrNone )
+        {
+        CXIMPIdentityImp* groupId = 
+                TXIMPObjectCloner< CXIMPIdentityImp >::CloneL( *iGroupId );
+        CleanupStack::PushL( groupId );
+        CPresentityGroupMemberInfoImp* memberInfo = 
+                TXIMPObjectCloner< CPresentityGroupMemberInfoImp >::CloneL( *iMemberInfo );
+        CleanupStack::PushL( memberInfo );        
+        iMyHost->PresenceDataAccess().GroupsDataAccess().HandlePresentityGroupMemberDisplayNameUpdatedL( groupId, memberInfo );
+        CleanupStack::Pop( 2, groupId );
+        }
+
+    // Set information for request complete event.
+    iReqCompleteEvent->AppendParamL( iGroupId );
+    iGroupId = NULL;
+    iReqCompleteEvent->AppendParamL( iMemberInfo );
+    iMemberInfo = NULL;
+    }
+
+// ---------------------------------------------------------------------------
+// COperationUpdatePresentityGroupMemberDisplayName::Type()
+// ---------------------------------------------------------------------------
+//
+TInt COperationUpdatePresentityGroupMemberDisplayName::Type() const
+    {
+    return NPresenceOps::EPrUpdatePresentityGroupMemberDisplayName;
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresenceoperations/presentitygroups/operationupdatepresentitygroupmemberdisplayname.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,72 @@
+/*
+* 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:  Update Presentity Group Member Display Name operation
+ *
+*/
+
+#ifndef PSCOPERATIONUPDATEPRESENTITYGROUPMEMBERDISPLAYNAME_H
+#define PSCOPERATIONUPDATEPRESENTITYGROUPMEMBERDISPLAYNAME_H
+
+#include <e32base.h>
+#include <ximpbase.h>
+
+#include "ximpoperationbase.h"
+#include "presenceoperationdefs.h"
+
+class CXIMPIdentityImp;
+class CPresentityGroupMemberInfoImp;
+
+/**
+ * Update presentity group member display name operation
+ *
+ * @lib presenceoperation.lib
+ * @since S60 v4.0
+ */
+class COperationUpdatePresentityGroupMemberDisplayName : public CXIMPOperationBase
+    {
+
+    public:
+
+        IMPORT_C COperationUpdatePresentityGroupMemberDisplayName();
+
+        void ConstructL( const TDesC8& aParamPck );
+
+        ~COperationUpdatePresentityGroupMemberDisplayName();
+
+    public: // from CXIMPOperationBase
+
+        void ProcessL();
+
+        void RequestCompletedL();
+
+        TInt Type() const;
+
+    private: // data
+
+
+        /**
+         * Group id
+         * Own.
+         */
+        CXIMPIdentityImp* iGroupId;
+        
+        /**
+         * Group member info
+         * Own.
+         */
+        CPresentityGroupMemberInfoImp* iMemberInfo;
+    };
+
+
+#endif // PSCOPERATIONUPDATEPRESENTITYGROUPMEMBERDISPLAYNAME_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresenceprocessor/protocolpresenceauthorizationdatahostimp.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,206 @@
+/*
+* 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 managing cached authorization information.
+ *
+*/
+
+
+//#include <badesca.h>
+//#include <e32cmn.h>
+
+#include <ximpobjectcollection.h>
+#include <presencegrantrequestinfo.h>
+#include <ximpidentity.h>
+#include <presenceblockinfo.h>
+#include <ximpdatasubscriptionstate.h>
+#include <ximpstatus.h>
+
+#include "protocolpresencedatahostimp.h"
+#include "protocolpresenceauthorizationdatahostimp.h"
+#include "ximprestrictedobjectcollectionimp.h"
+#include "ximpoperationbase.h"
+#include "ximpglobals.h"
+#include "ximpoperationfactory.h"
+#include "ximphost.h"
+#include "presencedatacacheimp.h"
+#include "presenceoperationdefs.h"
+#include "ximptrace.h"
+
+// ---------------------------------------------------------------------------
+// CProtocolPresenceAuthorizationDataHostImp::CProtocolPresenceAuthorizationDataHostImp()
+// ---------------------------------------------------------------------------
+//
+CProtocolPresenceAuthorizationDataHostImp::CProtocolPresenceAuthorizationDataHostImp( MXIMPHost& aHost )
+:iHost( aHost )
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// CProtocolPresenceAuthorizationDataHostImp::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void CProtocolPresenceAuthorizationDataHostImp::ConstructL()
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// CProtocolPresenceAuthorizationDataHostImp::NewL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CProtocolPresenceAuthorizationDataHostImp* CProtocolPresenceAuthorizationDataHostImp::NewL( MXIMPHost& aHost )
+    {
+    CProtocolPresenceAuthorizationDataHostImp* self = new( ELeave ) CProtocolPresenceAuthorizationDataHostImp( aHost );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// Implement supported interface access.
+// ---------------------------------------------------------------------------
+//
+XIMPIMP_IF_BASE_GET_INTERFACE_BEGIN( CProtocolPresenceAuthorizationDataHostImp,
+                                     MProtocolPresenceAuthorizationDataHost )
+XIMPIMP_IF_BASE_GET_INTERFACE_END()
+
+
+XIMPIMP_IF_BASE_GET_CONST_INTERFACE_BEGIN( CProtocolPresenceAuthorizationDataHostImp,
+                                           MProtocolPresenceAuthorizationDataHost )
+XIMPIMP_IF_BASE_GET_INTERFACE_END()
+
+// ---------------------------------------------------------------------------
+// CProtocolPresenceAuthorizationDataHostImp::~CProtocolPresenceAuthorizationDataHostImp()
+// ---------------------------------------------------------------------------
+//
+CProtocolPresenceAuthorizationDataHostImp::~CProtocolPresenceAuthorizationDataHostImp()
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// CProtocolPresenceAuthorizationDataHostImp::HandlePresenceGrantRequestListL()
+// ---------------------------------------------------------------------------
+//
+TXIMPRequestId CProtocolPresenceAuthorizationDataHostImp::HandlePresenceGrantRequestListL(
+            MXIMPObjectCollection* aGrantRequestList )
+    {
+    TRACE(_L("CProtocolPresenceAuthorizationDataHostImp::HandlePresenceGrantRequestListL") );
+    return iHost.AddNewOperationL( NPresenceOps::EPrHandlePresenceGrantRequestList, aGrantRequestList );
+    }
+// ---------------------------------------------------------------------------
+// CProtocolPresenceAuthorizationDataHostImp::HandlePresenceGrantRequestReceivedL()
+// ---------------------------------------------------------------------------
+//
+TXIMPRequestId CProtocolPresenceAuthorizationDataHostImp::HandlePresenceGrantRequestReceivedL(
+            MPresenceGrantRequestInfo* aGrantRequest )
+    {
+    TRACE(_L("CProtocolPresenceAuthorizationDataHostImp::HandlePresenceGrantRequestReceivedL") );
+    return iHost.AddNewOperationL( NPresenceOps::EPrHandlePresenceGrantRequestReceived, aGrantRequest );
+    }
+
+// ---------------------------------------------------------------------------
+// CProtocolPresenceAuthorizationDataHostImp::HandlePresenceGrantRequestObsoletedL()
+// ---------------------------------------------------------------------------
+//
+TXIMPRequestId CProtocolPresenceAuthorizationDataHostImp::HandlePresenceGrantRequestObsoletedL(
+            MXIMPIdentity* aGrantRequestor )
+    {
+    TRACE(_L("CProtocolPresenceAuthorizationDataHostImp::HandlePresenceGrantRequestObsoletedL") );
+    return iHost.AddNewOperationL( NPresenceOps::EPrHandlePresenceGrantRequestObsoleted, aGrantRequestor );
+    }
+    
+// ---------------------------------------------------------------------------
+// CProtocolPresenceAuthorizationDataHostImp::PresenceGrantRequestDataSubscriptionState()
+// ---------------------------------------------------------------------------
+//
+const MXIMPDataSubscriptionState& 
+       CProtocolPresenceAuthorizationDataHostImp::PresenceGrantRequestDataSubscriptionState() const
+    {
+    TRACE(_L("CProtocolPresenceAuthorizationDataHostImp::PresenceGrantRequestDataSubscriptionState") );
+    return iHost.PresenceDataAccess().PresenceDataCache().PresenceGrantRequestDataSubscriptionState();
+    }
+    
+// ---------------------------------------------------------------------------
+// CProtocolPresenceAuthorizationDataHostImp::SetPresenceGrantRequestDataSubscriptionStateL()
+// ---------------------------------------------------------------------------
+//
+TXIMPRequestId 
+    CProtocolPresenceAuthorizationDataHostImp::SetPresenceGrantRequestDataSubscriptionStateL( 
+            MXIMPDataSubscriptionState* aSubscriptionState, 
+            MXIMPStatus* aStatus )
+    {
+    TRACE(_L("CProtocolPresenceAuthorizationDataHostImp::SetPresenceGrantRequestDataSubscriptionStateL") );
+    return iHost.AddNewOperationL( NPresenceOps::EPrSetPresenceGrantRequestDataSubscriptionState,
+                                   aSubscriptionState, aStatus );
+    }
+
+// ---------------------------------------------------------------------------
+// CProtocolPresenceAuthorizationDataHostImp::HandlePresenceBlockListL()
+// ---------------------------------------------------------------------------
+//
+TXIMPRequestId CProtocolPresenceAuthorizationDataHostImp::HandlePresenceBlockListL(
+            MXIMPObjectCollection* aBlockList )
+    {
+    TRACE(_L("CProtocolPresenceAuthorizationDataHostImp::HandlePresenceBlockListL") );
+    return iHost.AddNewOperationL( NPresenceOps::EPrHandlePresenceBlockList, aBlockList );
+    }
+
+// ---------------------------------------------------------------------------
+// CProtocolPresenceAuthorizationDataHostImp::HandlePresenceBlockedL()
+// ---------------------------------------------------------------------------
+//
+TXIMPRequestId CProtocolPresenceAuthorizationDataHostImp::HandlePresenceBlockedL(
+            MPresenceBlockInfo* aBlockInfo )
+    {
+    TRACE(_L("CProtocolPresenceAuthorizationDataHostImp::HandlePresenceBlockedL") );
+    return iHost.AddNewOperationL( NPresenceOps::EPrHandlePresenceBlocked, aBlockInfo );
+    }
+// ---------------------------------------------------------------------------
+// CProtocolPresenceAuthorizationDataHostImp::HandlePresenceBlockCanceledL()
+// ---------------------------------------------------------------------------
+//
+TXIMPRequestId CProtocolPresenceAuthorizationDataHostImp::HandlePresenceBlockCanceledL(
+            MXIMPIdentity* aBlockedIdentity )
+    {
+    TRACE(_L("CProtocolPresenceAuthorizationDataHostImp::HandlePresenceBlockCanceledL") );
+    return iHost.AddNewOperationL( NPresenceOps::EPrHandlePresenceBlockCanceled, aBlockedIdentity );
+    }
+    
+// ---------------------------------------------------------------------------
+// CProtocolPresenceAuthorizationDataHostImp::PresenceBlockDataSubscriptionState()
+// ---------------------------------------------------------------------------
+//
+const MXIMPDataSubscriptionState& 
+    CProtocolPresenceAuthorizationDataHostImp::PresenceBlockDataSubscriptionState() const
+    {
+    TRACE(_L("CProtocolPresenceAuthorizationDataHostImp::PresenceBlockDataSubscriptionState") );
+    return iHost.PresenceDataAccess().PresenceDataCache().PresenceBlockDataSubscriptionState();
+    }
+
+// ---------------------------------------------------------------------------
+// CProtocolPresenceAuthorizationDataHostImp::SetPresenceBlockDataSubscriptionStateL()
+// ---------------------------------------------------------------------------
+//
+TXIMPRequestId CProtocolPresenceAuthorizationDataHostImp::SetPresenceBlockDataSubscriptionStateL(
+            MXIMPDataSubscriptionState* aSubscriptionState, 
+            MXIMPStatus* aStatus )               
+    {
+    TRACE(_L("CProtocolPresenceAuthorizationDataHostImp::SetPresenceBlockDataSubscriptionStateL") );
+    return iHost.AddNewOperationL( NPresenceOps::EPrSetPresenceBlockDataSubscriptionState,
+                                   aSubscriptionState, aStatus );
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresenceprocessor/protocolpresenceauthorizationdatahostimp.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,108 @@
+/*
+* 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 managing cached authorization information.
+*
+*/
+
+#ifndef CPROTOCOLPRESENCEAUTHORIZATIONDATAHOSTIMP
+#define CPROTOCOLPRESENCEAUTHORIZATIONDATAHOSTIMP
+
+#include <protocolpresenceauthorizationdatahost.h>
+
+#include "ximpapiobjbase.h"
+#include "presenceapiobjbase.h"
+#include "ximpitemparent.h"
+#include "presencetypehelpers.h"
+#include "ximpoperationdefs.h"
+
+class MXIMPHost;
+
+/**
+ * Implementation for managing cached authorization information
+ *
+ * @since S60 v3.2
+ */
+class CProtocolPresenceAuthorizationDataHostImp : public CXIMPApiObjBase,
+                                                      public MProtocolPresenceAuthorizationDataHost
+    {
+public: // Definitions
+
+    /** The class ID. */
+    enum { KClassId = PRIMP_CLSID_CPROTOCOLPRESENCEAUTHORIZATIONDATAHOST };
+
+public: // Construction and destruction
+
+    /**
+     * Construction
+     */
+    IMPORT_C static CProtocolPresenceAuthorizationDataHostImp* NewL( MXIMPHost& aHost );
+
+    /**
+     * Destruction
+     */
+    virtual ~CProtocolPresenceAuthorizationDataHostImp();
+
+private:
+
+    CProtocolPresenceAuthorizationDataHostImp( MXIMPHost& aHost );
+    void ConstructL();
+
+public: // From MXIMPBase
+
+    /**
+     * Implementation of MXIMPBase interface methods
+     * @see MXIMPBase
+     */
+    XIMPIMP_DECLARE_IF_BASE_METHODS
+
+public: //From MProtocolPresenceAuthorizationDataHost
+
+    TXIMPRequestId HandlePresenceGrantRequestListL(
+                MXIMPObjectCollection* aGrantRequestList );
+    TXIMPRequestId HandlePresenceGrantRequestReceivedL(
+                MPresenceGrantRequestInfo* aGrantRequest );
+    TXIMPRequestId HandlePresenceGrantRequestObsoletedL(
+                MXIMPIdentity* aGrantRequestor );
+    const MXIMPDataSubscriptionState& PresenceGrantRequestDataSubscriptionState() const;
+    TXIMPRequestId SetPresenceGrantRequestDataSubscriptionStateL(
+                MXIMPDataSubscriptionState* aSubscriptionState, 
+                MXIMPStatus* aStatus );
+                
+    // Handling presence blocking
+
+    TXIMPRequestId HandlePresenceBlockListL(
+                MXIMPObjectCollection* aBlockList );
+    TXIMPRequestId HandlePresenceBlockedL(
+                MPresenceBlockInfo* aBlockInfo );
+    TXIMPRequestId HandlePresenceBlockCanceledL(
+                MXIMPIdentity* aBlockedIdentity );
+    const MXIMPDataSubscriptionState& PresenceBlockDataSubscriptionState() const;
+    TXIMPRequestId SetPresenceBlockDataSubscriptionStateL(
+                MXIMPDataSubscriptionState* aSubscriptionState, 
+                MXIMPStatus* aStatus );                
+                
+private: // Data
+
+    /**
+     * Access to host.
+     */
+    MXIMPHost& iHost;
+    };
+
+
+/* ======================================================================== */
+
+
+
+#endif // CPROTOCOLPRESENCEAUTHORIZATIONDATAHOSTIMP
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresenceprocessor/protocolpresencedatahostimp.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  Presence connection host
+ *
+*/
+
+//#include <ximpprotocolconnection.h>
+//#include <ximpprotocolconnectionhostobserver.h>
+#include <protocolpresencedatahost.h>
+#include <presenceobjectfactory.h>
+#include <protocolpresenceauthorizationdatahost.h>
+#include <protocolpresencepublishingdatahost.h>
+#include <protocolpresencewatchingdatahost.h>
+#include <protocolpresentitygroupsdatahost.h>
+
+#include "ximpapiobjbase.h"
+#include "presenceapiobjbase.h"
+//#include "ximpstatusimp.h"
+//#include "ximpoperationbase.h"
+
+#include "protocolpresencedatahostimp.h"
+#include "presenceobjectfactoryimp.h"
+#include "presencedatacacheimp.h"
+//#include "ximpglobals.h"
+/*#include "ximppluginfactory.h"
+#include "ximpeventmanager.h"
+#include "ximphoststates.h"
+#include "ximpcontextstateeventimp.h"
+#include "ximpobjectfactoryimp.h"
+#include "ximppanics.h"
+#include "ximppsccontextimp.h"*/
+#include "presencedatacacheimp.h"
+/*#include "ximpserviceinfoimp.h"
+#include "ximpoperationbase.h"
+#include "ximpoperationfactory.h"
+#include "ximpobjecthelpers.h"
+#include "ximpoperationdefs.h"
+#include "ximpcontexteventqueue.h"
+#include "ximphostmanager.h"
+#include "ximpidentityimp.h"
+#include "ximprestrictedobjectcollectionimp.h"
+#include "ximprequestcompleteeventimp.h"
+*/
+#include "protocolpresenceauthorizationdatahostimp.h"
+#include "protocolpresencepublishingdatahostimp.h"
+#include "protocolpresencewatchingdatahostimp.h"
+#include "protocolpresentitygroupsdatahostimp.h"
+#include "ximpprotocolrequestcompleteeventimp.h"
+
+#include "ximpdlluids.hrh"
+
+// ======== LOCAL FUNCTIONS ========
+
+
+
+// ======== MEMBER FUNCTIONS ========
+
+
+// This should be variated. Branding variation can be one
+// possibility. One is to leave adaptation deside how soon
+// cleanup will be done.
+// Now 5 sec used for testing purposes. Better value could be
+// some minutes.
+
+// ---------------------------------------------------------------------------
+// CProtocolPresenceDataHostImp::CProtocolPresenceDataHostImp()
+// ---------------------------------------------------------------------------
+//
+CProtocolPresenceDataHostImp::CProtocolPresenceDataHostImp( MXIMPHost& aHost )
+:iHost( aHost )
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// CProtocolPresenceDataHostImp::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void CProtocolPresenceDataHostImp::ConstructL()
+    {
+    iPresenceDataCache = CPresenceDataCache::NewL( iHost );
+    iPresenceObjFactory = CPresenceObjectFactoryImp::NewL();
+    iAuthDataHost = CProtocolPresenceAuthorizationDataHostImp::NewL( iHost );
+    iPublishingDataHost = CProtocolPresencePublishingDataHostImp::NewL( iHost );
+    iWatchingDataHost = CProtocolPresenceWatchingDataHostImp::NewL( iHost );
+    iGroupsDataHost = CProtocolPresentityGroupsDataHostImp::NewL( iHost );
+    }
+
+
+// ---------------------------------------------------------------------------
+// CProtocolPresenceDataHostImp::NewLC()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CProtocolPresenceDataHostImp* CProtocolPresenceDataHostImp::NewLC( MXIMPHost& aHost )
+    {
+    CProtocolPresenceDataHostImp* self = new( ELeave ) CProtocolPresenceDataHostImp( aHost );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CProtocolPresenceDataHostImp::NewL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CProtocolPresenceDataHostImp* CProtocolPresenceDataHostImp::NewL( MXIMPHost& aHost )
+    {
+    CProtocolPresenceDataHostImp* self = new( ELeave ) CProtocolPresenceDataHostImp( aHost );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+// ---------------------------------------------------------------------------
+// CProtocolPresenceDataHostImp::~CProtocolPresenceDataHostImp()
+// ---------------------------------------------------------------------------
+//
+CProtocolPresenceDataHostImp::~CProtocolPresenceDataHostImp()
+    {
+    delete iPresenceDataCache;
+    delete iPresenceObjFactory;
+    delete iAuthDataHost;
+    delete iPublishingDataHost;
+    delete iWatchingDataHost;
+    delete iGroupsDataHost;
+
+    }
+
+// ---------------------------------------------------------------------------
+// Implement supported interface access.
+// ---------------------------------------------------------------------------
+//
+XIMPIMP_IF_BASE_GET_INTERFACE_BEGIN( CProtocolPresenceDataHostImp, MProtocolPresenceDataHost )
+XIMPIMP_IF_BASE_GET_INTERFACE_END()
+XIMPIMP_IF_BASE_GET_CONST_INTERFACE_BEGIN( CProtocolPresenceDataHostImp, MProtocolPresenceDataHost )
+XIMPIMP_IF_BASE_GET_INTERFACE_END()
+
+
+
+// ---------------------------------------------------------------------------
+// CProtocolPresenceDataHostImp::PresenceObjectFactory()
+// ---------------------------------------------------------------------------
+//
+MPresenceObjectFactory& CProtocolPresenceDataHostImp::PresenceObjectFactory()
+    {
+    return *iPresenceObjFactory;
+    }
+
+// ---------------------------------------------------------------------------
+// CProtocolPresenceDataHostImp::AuthorizationDataHost()
+// ---------------------------------------------------------------------------
+//
+MProtocolPresenceAuthorizationDataHost& CProtocolPresenceDataHostImp::AuthorizationDataHost()
+    {
+    return *iAuthDataHost;
+    }
+
+// ---------------------------------------------------------------------------
+// CProtocolPresenceDataHostImp::PublishingDataHost()
+// ---------------------------------------------------------------------------
+//
+MProtocolPresencePublishingDataHost& CProtocolPresenceDataHostImp::PublishingDataHost()
+    {
+    return *iPublishingDataHost;
+    }
+
+// ---------------------------------------------------------------------------
+// CProtocolPresenceDataHostImp::WatchingDataHost()
+// ---------------------------------------------------------------------------
+//
+MProtocolPresenceWatchingDataHost& CProtocolPresenceDataHostImp::WatchingDataHost()
+    {
+    return *iWatchingDataHost;
+    }
+
+// ---------------------------------------------------------------------------
+// CProtocolPresenceDataHostImp::GroupsDataHost()
+// ---------------------------------------------------------------------------
+//
+MProtocolPresentityGroupsDataHost& CProtocolPresenceDataHostImp::GroupsDataHost()
+    {
+    return *iGroupsDataHost;
+    }
+    
+    
+EXPORT_C CPresenceDataCache& CProtocolPresenceDataHostImp::PresenceDataCache()
+    {
+    return *iPresenceDataCache;
+    }
+EXPORT_C CProtocolPresenceAuthorizationDataHostImp& CProtocolPresenceDataHostImp::AuthorizationDataAccess()
+    {
+    return *iAuthDataHost;
+    }
+EXPORT_C CProtocolPresencePublishingDataHostImp& CProtocolPresenceDataHostImp::PublishingDataAccess()
+    {
+    return *iPublishingDataHost;
+    }
+EXPORT_C CProtocolPresenceWatchingDataHostImp& CProtocolPresenceDataHostImp::WatchingDataAccess()
+    {
+    return *iWatchingDataHost;
+    }
+EXPORT_C CProtocolPresentityGroupsDataHostImp& CProtocolPresenceDataHostImp::GroupsDataAccess()
+    {
+    return *iGroupsDataHost;
+    }
+
+// End of file
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresenceprocessor/protocolpresencedatahostimp.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,176 @@
+/*
+* 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 connection host
+ *
+*/
+
+#ifndef CPROTOCOLPRESENCEDATAHOSTIMP_H
+#define CPROTOCOLPRESENCEDATAHOSTIMP_H
+
+//#include <e32base.h>
+//#include <ximpprotocolconnectionhost.h>
+//#include <ximpcontext.h>
+#include <protocolpresencedatahost.h>
+
+#include "ximpapiobjbase.h"
+#include "presenceapiobjbase.h"
+#include "ximpitemparent.h"
+//#include "ximphost.h"
+#include "ximpoperationdefs.h"
+#include "ximprequestidbuilder.h"
+
+
+class MXIMPHost;
+class MPresenceObjectFactory;
+class CPresenceObjectFactoryImp;
+
+//class CXIMPPscContext;
+class MPresenceDataCache;
+class CPresenceDataCache;
+/*class CXIMPContextStateEventImp;
+class CPeriodic;
+class MXIMPProtocolConnection;*/
+class CProtocolPresenceAuthorizationDataHostImp;
+class MProtocolPresenceAuthorizationDataHost;
+class CProtocolPresencePublishingDataHostImp;
+class MProtocolPresencePublishingDataHost;
+class CProtocolPresenceWatchingDataHostImp;
+class MProtocolPresenceWatchingDataHost;
+class CProtocolPresentityGroupsDataHostImp;
+class MProtocolPresentityGroupsDataHost;
+//class CXIMPRestrictedCollectionImp;
+//class CXIMPProtocolRequestCompleteEventImp;
+
+
+
+/**
+ * Presence connection host.
+ *
+ * @lib ximpprocessor.lib
+ * @since S60 v3.2
+ */
+class CProtocolPresenceDataHostImp : public CXIMPApiObjBase,
+                                     public MProtocolPresenceDataHost
+
+    {
+public:
+    /** The class ID. */
+    enum { KClassId = PRIMP_CLSID_CPROTOCOLPRESENCEDATAHOSTIMP };
+
+public:
+
+    IMPORT_C static CProtocolPresenceDataHostImp* NewL( MXIMPHost& aHost );
+
+    IMPORT_C static CProtocolPresenceDataHostImp* NewLC( MXIMPHost& aHost );
+
+    virtual ~CProtocolPresenceDataHostImp();
+
+private:
+
+    CProtocolPresenceDataHostImp( MXIMPHost& aHost );
+    void ConstructL();
+
+public: // From MXIMPBase
+
+    /**
+     * Implementation of MXIMPBase interface methods
+     * @see MXIMPBase
+     */
+    XIMPIMP_DECLARE_IF_BASE_METHODS
+
+
+public: // MProtocolPresenceDataHost
+   
+    MPresenceObjectFactory& PresenceObjectFactory();
+
+    MProtocolPresenceAuthorizationDataHost& AuthorizationDataHost();
+
+    MProtocolPresencePublishingDataHost& PublishingDataHost();
+
+    MProtocolPresenceWatchingDataHost& WatchingDataHost();
+
+    MProtocolPresentityGroupsDataHost& GroupsDataHost();
+
+public: 
+    
+    IMPORT_C CPresenceDataCache& PresenceDataCache();
+    IMPORT_C CProtocolPresenceAuthorizationDataHostImp& AuthorizationDataAccess();
+    IMPORT_C CProtocolPresencePublishingDataHostImp& PublishingDataAccess();
+    IMPORT_C CProtocolPresenceWatchingDataHostImp& WatchingDataAccess();
+    IMPORT_C CProtocolPresentityGroupsDataHostImp& GroupsDataAccess();
+    
+// MXIMPHost
+
+/*    MXIMPProtocolConnection& GetConnection() const;
+
+    void AddEventL( CXIMPApiEventBase& aEvent, MXIMPPscContext* aContext  );
+    void ActivateEventL( CXIMPApiEventBase& aEvent, MXIMPPscContext* aContext );
+
+    void UnregisterSession( CXIMPPscContext* aContext );
+
+    void FakeCompleteRequest( TXIMPRequestId aReqId, TInt aResult );
+    void HandleAdaptationRequestCompleted( TXIMPRequestId aReqId, TInt aResult );
+    void HandleSessionMgmtRequestCompleted( TXIMPRequestId aReqId, TInt aResult );
+    void HandleInternalRequestCompleted( TXIMPRequestId aReqId, TInt aResult );
+
+    CPresenceDataCache& DataAccess();
+    CProtocolPresenceAuthorizationDataHostImp& AuthorizationDataAccess();
+    CProtocolPresencePublishingDataHostImp& PublishingDataAccess();
+    CProtocolPresenceWatchingDataHostImp& WatchingDataAccess();
+    CProtocolPresentityGroupsDataHostImp& GroupsDataAccess();
+
+    void AddNewOperationL( CXIMPOperationBase& aOperation );
+    TXIMPRequestId AddNewOperationL( CXIMPOperationBase* aOperation );
+
+    void ForcedTeardownL();
+
+    void StartCleanerTimer();
+    
+    TXIMPRequestId AddNewOperationL( 
+                TInt aOperation, MXIMPBase* aParam, MXIMPBase* aParam2 = NULL );    
+    TXIMPRequestId AddNewOperationL( 
+                TInt aOperation, CXIMPRestrictedObjectCollectionImp* aParams );
+
+public: // New functions
+
+    void AddEventL( CXIMPApiEventBase& aEvent, CXIMPPscContext* aContext  );
+    void ActivateEventL( CXIMPApiEventBase& aEvent, CXIMPPscContext* aContext );
+
+
+    void RegisterSessionL( CXIMPPscContext* aContext );*/
+
+private: // data
+
+    MXIMPHost& iHost;
+    /**
+     * Data cache
+     */
+    CPresenceDataCache* iPresenceDataCache;
+    
+    CPresenceObjectFactoryImp* iPresenceObjFactory;
+
+    /**
+     * Data hosts
+     */
+    CProtocolPresenceAuthorizationDataHostImp* iAuthDataHost;
+    CProtocolPresencePublishingDataHostImp* iPublishingDataHost;
+    CProtocolPresenceWatchingDataHostImp* iWatchingDataHost;
+    CProtocolPresentityGroupsDataHostImp* iGroupsDataHost;
+
+
+    };
+
+
+#endif // CPROTOCOLPRESENCEDATAHOSTIMP_H
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresenceprocessor/protocolpresencepublishingdatahostimp.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,175 @@
+/*
+* 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 managing cached presence publish information.
+ *
+*/
+
+
+#include <ximpobjectcollection.h>
+#include <presenceinfo.h>
+#include <ximpdatasubscriptionstate.h>
+#include <ximpstatus.h>
+
+#include "protocolpresencedatahostimp.h"
+#include "protocolpresencepublishingdatahostimp.h"
+
+#include "ximpoperationbase.h"
+#include "ximpoperationfactory.h"
+#include "ximprestrictedobjectcollectionimp.h"
+#include "ximpglobals.h"
+#include "ximphost.h"
+#include "presencedatacacheimp.h"
+#include "presenceoperationdefs.h"
+#include "ximptrace.h"
+
+// ======== LOCAL FUNCTIONS ========
+
+
+// ======== MEMBER FUNCTIONS ========
+
+
+// ---------------------------------------------------------------------------
+// CProtocolPresencePublishingDataHostImp::NewL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CProtocolPresencePublishingDataHostImp*
+        CProtocolPresencePublishingDataHostImp::NewL( MXIMPHost& aHost )
+    {
+    CProtocolPresencePublishingDataHostImp* self =
+                new( ELeave ) CProtocolPresencePublishingDataHostImp( aHost );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+
+// ---------------------------------------------------------------------------
+// Implement supported interface access.
+// ---------------------------------------------------------------------------
+//
+XIMPIMP_IF_BASE_GET_INTERFACE_BEGIN( CProtocolPresencePublishingDataHostImp,
+                                     MProtocolPresencePublishingDataHost )
+XIMPIMP_IF_BASE_GET_INTERFACE_END()
+
+XIMPIMP_IF_BASE_GET_CONST_INTERFACE_BEGIN( CProtocolPresencePublishingDataHostImp,
+                                           MProtocolPresencePublishingDataHost )
+XIMPIMP_IF_BASE_GET_INTERFACE_END()
+
+
+// ---------------------------------------------------------------------------
+// CProtocolPresencePublishingDataHostImp::~CProtocolPresencePublishingDataHostImp()
+// ---------------------------------------------------------------------------
+//
+CProtocolPresencePublishingDataHostImp::~CProtocolPresencePublishingDataHostImp()
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// CProtocolPresencePublishingDataHostImp::CProtocolPresencePublishingDataHostImp()
+// ---------------------------------------------------------------------------
+//
+CProtocolPresencePublishingDataHostImp::CProtocolPresencePublishingDataHostImp(
+                                                                    MXIMPHost& aHost )
+    : iHost( aHost )
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// CProtocolPresencePublishingDataHostImp::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void CProtocolPresencePublishingDataHostImp::ConstructL()
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// CProtocolPresencePublishingDataHostImp::HandleSubscribedOwnPresenceL()
+// ---------------------------------------------------------------------------
+//
+TXIMPRequestId
+    CProtocolPresencePublishingDataHostImp::HandleSubscribedOwnPresenceL(
+                                        MPresenceInfo* aPresenceInfo )
+    {
+    TRACE(_L("CProtocolPresencePublishingDataHostImp::HandleSubscribedOwnPresenceL") );
+    return iHost.AddNewOperationL( NPresenceOps::EPrHandleOwnPresence,
+                                   aPresenceInfo );
+    }
+
+
+// ---------------------------------------------------------------------------
+// CProtocolPresencePublishingDataHostImp::OwnPresenceDataSubscriptionState()
+// ---------------------------------------------------------------------------
+//
+const MXIMPDataSubscriptionState& 
+    CProtocolPresencePublishingDataHostImp::OwnPresenceDataSubscriptionState() const
+    {
+    TRACE(_L("CProtocolPresencePublishingDataHostImp::OwnPresenceDataSubscriptionState") );
+    return iHost.PresenceDataAccess().PresenceDataCache().OwnPresenceDataSubscriptionState();
+    }
+
+// ---------------------------------------------------------------------------
+// CProtocolPresencePublishingDataHostImp::SetOwnPresenceDataSubscriptionStateL()
+// ---------------------------------------------------------------------------
+//
+TXIMPRequestId CProtocolPresencePublishingDataHostImp::SetOwnPresenceDataSubscriptionStateL( 
+            MXIMPDataSubscriptionState* aSubscriptionState, 
+            MXIMPStatus* aStatus )
+    {
+    TRACE(_L("CProtocolPresencePublishingDataHostImp::SetOwnPresenceDataSubscriptionStateL") );
+    return iHost.AddNewOperationL( NPresenceOps::EPrSetOwnPresenceDataSubscriptionState,
+                             aSubscriptionState, aStatus );
+    }
+
+// ---------------------------------------------------------------------------
+// CProtocolPresencePublishingDataHostImp::HandlePresenceWatcherListL()
+// ---------------------------------------------------------------------------
+//
+TXIMPRequestId
+    CProtocolPresencePublishingDataHostImp::HandlePresenceWatcherListL(
+                                        MXIMPObjectCollection* aWatcherList )
+    {
+    TRACE(_L("CProtocolPresencePublishingDataHostImp::HandlePresenceWatcherListL") );
+    return iHost.AddNewOperationL( NPresenceOps::EPrHandlePresenceWatcherList,
+                             aWatcherList );
+    }
+
+// ---------------------------------------------------------------------------
+// CProtocolPresencePublishingDataHostImp::HandlePresenceWatcherListL()
+// ---------------------------------------------------------------------------
+//
+const MXIMPDataSubscriptionState& 
+    CProtocolPresencePublishingDataHostImp::PresenceWatcherListDataSubscriptionState() const
+    {
+    TRACE(_L("CProtocolPresencePublishingDataHostImp::PresenceWatcherListDataSubscriptionState") );
+    return iHost.PresenceDataAccess().PresenceDataCache().PresenceWatcherListDataSubscriptionState();
+    }
+
+// ---------------------------------------------------------------------------
+// CProtocolPresencePublishingDataHostImp::HandlePresenceWatcherListL()
+// ---------------------------------------------------------------------------
+//
+TXIMPRequestId 
+    CProtocolPresencePublishingDataHostImp::SetPresenceWatcherListDataSubscriptionStateL(
+            MXIMPDataSubscriptionState* aSubscriptionState, 
+            MXIMPStatus* aStatus )
+    {
+    TRACE(_L("CProtocolPresencePublishingDataHostImp::SetPresenceWatcherListDataSubscriptionStateL") );
+    return iHost.AddNewOperationL( NPresenceOps::EPrSetPresenceWatcherListDataSubscriptionState,
+                             aSubscriptionState, aStatus );    
+    }
+
+// End of file
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresenceprocessor/protocolpresencepublishingdatahostimp.h	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  Implementation for managing cached presence publish information.
+*
+*/
+
+#ifndef CPROTOCOLPRESENCEPUBLISHINGDATAHOSTIMP_H
+#define CPROTOCOLPRESENCEPUBLISHINGDATAHOSTIMP_H
+
+#include <protocolpresencepublishingdatahost.h>
+
+#include "ximpapiobjbase.h"
+#include "presenceapiobjbase.h"
+#include "ximpitemparent.h"
+#include "presencetypehelpers.h"
+#include "ximpoperationdefs.h"
+
+class MXIMPHost;
+class MPresenceInfo;
+class MXIMPObjectCollection;
+
+
+/**
+ * Implementation for managing cached presence publish information.
+ *
+ * @since S60 v3.2
+ */
+class CProtocolPresencePublishingDataHostImp : public CXIMPApiObjBase,
+                                                public MProtocolPresencePublishingDataHost
+    {
+public: // Definitions
+
+    /** The class ID. */
+    enum { KClassId = PRIMP_CLSID_CPROTOCOLPRESENCEPUBLISHINGDATAHOST };
+
+public: // Construction and destruction
+
+    /**
+     * Construction
+     */
+    IMPORT_C static CProtocolPresencePublishingDataHostImp* NewL( MXIMPHost& aHost );
+
+    /**
+     * Destruction
+     */
+    virtual ~CProtocolPresencePublishingDataHostImp();
+
+private:
+
+    CProtocolPresencePublishingDataHostImp( MXIMPHost& aHost );
+    void ConstructL();
+
+public: // From MXIMPBase
+
+    /**
+     * Implementation of MXIMPBase interface methods
+     * @see MXIMPBase
+     */
+    XIMPIMP_DECLARE_IF_BASE_METHODS
+
+public: //From MProtocolPresencePublishingDataHost
+
+    // Handling user own presence information
+    TXIMPRequestId HandleSubscribedOwnPresenceL( MPresenceInfo* aPresenceInfo );
+    const MXIMPDataSubscriptionState& OwnPresenceDataSubscriptionState() const;
+    TXIMPRequestId SetOwnPresenceDataSubscriptionStateL( 
+                MXIMPDataSubscriptionState* aSubscriptionState, 
+                MXIMPStatus* aStatus );    
+    
+
+    // Handling presence watcher list content
+    TXIMPRequestId HandlePresenceWatcherListL( MXIMPObjectCollection* aWatcherList );
+    const MXIMPDataSubscriptionState& PresenceWatcherListDataSubscriptionState() const;
+    TXIMPRequestId SetPresenceWatcherListDataSubscriptionStateL(
+                MXIMPDataSubscriptionState* aSubscriptionState, 
+                MXIMPStatus* aStatus );
+
+private: // Data
+
+    /**
+     * Access to host.
+     */
+    MXIMPHost& iHost;
+
+    };
+
+
+#endif // CPROTOCOLPRESENCEPUBLISHINGDATAHOSTIMP_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresenceprocessor/protocolpresencewatchingdatahostimp.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,148 @@
+/*
+* 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 managing cached subscribed presence information.
+ *
+*/
+
+
+#include <ximpobjectcollection.h>
+#include <ximpidentity.h>
+#include <presenceinfo.h>
+#include <ximpdatasubscriptionstate.h>
+#include <ximpstatus.h>
+
+#include "protocolpresencedatahostimp.h"
+#include "protocolpresencewatchingdatahostimp.h"
+
+#include "ximpoperationbase.h"
+#include "ximpoperationfactory.h"
+#include "ximprestrictedobjectcollectionimp.h"
+#include "ximpglobals.h"
+#include "ximphost.h"
+#include "presencedatacacheimp.h"
+#include "presenceoperationdefs.h"
+#include "ximptrace.h"
+
+// ======== LOCAL FUNCTIONS ========
+
+
+// ======== MEMBER FUNCTIONS ========
+
+
+// ---------------------------------------------------------------------------
+// CProtocolPresenceWatchingDataHostImp::NewL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CProtocolPresenceWatchingDataHostImp*
+        CProtocolPresenceWatchingDataHostImp::NewL( MXIMPHost& aHost )
+    {
+    CProtocolPresenceWatchingDataHostImp* self =
+                new( ELeave ) CProtocolPresenceWatchingDataHostImp( aHost );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// Implement supported interface access.
+// ---------------------------------------------------------------------------
+//
+XIMPIMP_IF_BASE_GET_INTERFACE_BEGIN( CProtocolPresenceWatchingDataHostImp,
+                                     MProtocolPresenceWatchingDataHost )
+XIMPIMP_IF_BASE_GET_INTERFACE_END()
+
+XIMPIMP_IF_BASE_GET_CONST_INTERFACE_BEGIN( CProtocolPresenceWatchingDataHostImp,
+                                           MProtocolPresenceWatchingDataHost )
+XIMPIMP_IF_BASE_GET_INTERFACE_END()
+
+// ---------------------------------------------------------------------------
+// CProtocolPresenceWatchingDataHostImp::~CProtocolPresenceWatchingDataHostImp()
+// ---------------------------------------------------------------------------
+//
+CProtocolPresenceWatchingDataHostImp::~CProtocolPresenceWatchingDataHostImp()
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// CProtocolPresenceWatchingDataHostImp::CProtocolPresenceWatchingDataHostImp()
+// ---------------------------------------------------------------------------
+//
+CProtocolPresenceWatchingDataHostImp::CProtocolPresenceWatchingDataHostImp(
+                                                                    MXIMPHost& aHost )
+    : iHost( aHost )
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// CProtocolPresenceWatchingDataHostImp::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void CProtocolPresenceWatchingDataHostImp::ConstructL()
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// CProtocolPresenceWatchingDataHostImp::HandleSubscribedPresentityPresenceL()
+// ---------------------------------------------------------------------------
+//
+TXIMPRequestId
+    CProtocolPresenceWatchingDataHostImp::HandleSubscribedPresentityPresenceL(
+                MXIMPIdentity* aPresentityId,
+                MPresenceInfo* aPresenceInfo )
+    {
+    TRACE(_L("CProtocolPresenceWatchingDataHostImp::HandleSubscribedPresentityPresenceL") );
+    return iHost.AddNewOperationL( NPresenceOps::EPrHandlePresentityPresence, 
+                                   aPresentityId, aPresenceInfo );
+    }
+
+// ---------------------------------------------------------------------------
+// CProtocolPresenceWatchingDataHostImp::PresentityPresenceDataSubscriptionState()
+// ---------------------------------------------------------------------------
+//
+const MXIMPDataSubscriptionState& 
+    CProtocolPresenceWatchingDataHostImp::PresentityPresenceDataSubscriptionState( 
+            const MXIMPIdentity& aPresentityId ) const
+    {
+    TRACE(_L("CProtocolPresenceWatchingDataHostImp::PresentityPresenceDataSubscriptionState") );
+    return iHost.PresenceDataAccess().PresenceDataCache().PresentityPresenceDataSubscriptionState( aPresentityId );
+    }
+// ---------------------------------------------------------------------------
+// CProtocolPresenceWatchingDataHostImp::SetPresentityPresenceDataSubscriptionStateL()
+// ---------------------------------------------------------------------------
+//
+TXIMPRequestId CProtocolPresenceWatchingDataHostImp::SetPresentityPresenceDataSubscriptionStateL( 
+            MXIMPIdentity* aPresentityId, 
+            MXIMPDataSubscriptionState* aSubscriptionState, 
+            MXIMPStatus* aStatus )
+    {
+    TRACE(_L("CProtocolPresenceWatchingDataHostImp::SetPresentityPresenceDataSubscriptionStateL") );
+    CXIMPRestrictedObjectCollectionImp* collection = CXIMPRestrictedObjectCollectionImp::NewLC( ETrue );
+    collection->AddOrReplaceTypeL( aPresentityId );
+    collection->AddOrReplaceTypeL( aSubscriptionState );
+    collection->AddOrReplaceTypeL( aStatus );    
+    TXIMPRequestId reqId = 
+        iHost.AddNewOperationL( NPresenceOps::EPrSetPresentityPresenceDataSubscriptionState,
+                                collection );
+    CleanupStack::Pop( collection );
+    return reqId;    
+    }
+
+
+
+
+// End of file
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresenceprocessor/protocolpresencewatchingdatahostimp.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,92 @@
+/*
+* 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 managing cached subscribed presence information.
+*
+*/
+
+#ifndef CPROTOCOLPRESENCEWATCHINGDATAHOSTIMP_H
+#define CPROTOCOLPRESENCEWATCHINGDATAHOSTIMP_H
+
+#include <protocolpresencewatchingdatahost.h>
+
+#include "ximpapiobjbase.h"
+#include "presenceapiobjbase.h"
+#include "ximpitemparent.h"
+#include "presencetypehelpers.h"
+#include "ximpoperationdefs.h"
+
+class MXIMPHost;
+class MPresenceInfo;
+class MXIMPObjectCollection;
+
+/**
+ * Implementation for managing cached subscribed presence information.
+ *
+ * @since S60 v3.2
+ */
+class CProtocolPresenceWatchingDataHostImp : public CXIMPApiObjBase,
+                                                public MProtocolPresenceWatchingDataHost
+    {
+public: // Definitions
+
+    /** The class ID. */
+    enum { KClassId = PRIMP_CLSID_CPROTOCOLPRESENCEWATCHINGDATAHOST };
+
+public: // Construction and destruction
+
+    /**
+     * Construction
+     */
+    IMPORT_C static CProtocolPresenceWatchingDataHostImp* NewL( MXIMPHost& aHost );
+
+    /**
+     * Destruction
+     */
+    virtual ~CProtocolPresenceWatchingDataHostImp();
+
+private:
+
+    CProtocolPresenceWatchingDataHostImp( MXIMPHost& aHost );
+    void ConstructL();
+
+public: // From MXIMPBase
+
+    /**
+     * Implementation of MXIMPBase interface methods
+     * @see MXIMPBase
+     */
+    XIMPIMP_DECLARE_IF_BASE_METHODS
+
+public: //From MProtocolPresenceWatchingDataHost
+
+    TXIMPRequestId HandleSubscribedPresentityPresenceL(
+                MXIMPIdentity* aPresentityId,
+                MPresenceInfo* aPresenceInfo );
+    const MXIMPDataSubscriptionState& PresentityPresenceDataSubscriptionState( 
+                const MXIMPIdentity& aPresentityId ) const;
+    TXIMPRequestId SetPresentityPresenceDataSubscriptionStateL( 
+                MXIMPIdentity* aPresentityId, 
+                MXIMPDataSubscriptionState* aSubscriptionState, 
+                MXIMPStatus* aStatus );
+private: // Data
+
+    /**
+     * Access to host.
+     */
+    MXIMPHost& iHost;
+
+    };
+
+
+#endif // CPROTOCOLPRESENCEWATCHINGDATAHOSTIMP_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresenceprocessor/protocolpresentitygroupsdatahostimp.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,248 @@
+/*
+* 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 managing cached presentity group information.
+ *
+*/
+
+
+#include <ximpobjectcollection.h>
+#include <presentitygroupinfo.h>
+#include <ximpidentity.h>
+#include <ximpdatasubscriptionstate.h>
+#include <ximpstatus.h>
+
+#include "protocolpresencedatahostimp.h"
+#include "protocolpresentitygroupsdatahostimp.h"
+
+#include "presentitygroupmemberinfoimp.h"
+#include "ximpoperationbase.h"
+#include "ximprestrictedobjectcollectionimp.h"
+#include "ximpglobals.h"
+#include "ximpoperationfactory.h"
+#include "ximphost.h"
+#include "presencedatacacheimp.h"
+#include "presenceoperationdefs.h"
+#include "ximptrace.h"
+
+// ---------------------------------------------------------------------------
+// CProtocolPresentityGroupsDataHostImp::CProtocolPresentityGroupsDataHostImp()
+// ---------------------------------------------------------------------------
+//
+CProtocolPresentityGroupsDataHostImp::CProtocolPresentityGroupsDataHostImp( MXIMPHost& aHost )
+:iHost( aHost )
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// CProtocolPresentityGroupsDataHostImp::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void CProtocolPresentityGroupsDataHostImp::ConstructL()
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// CProtocolPresentityGroupsDataHostImp::NewL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CProtocolPresentityGroupsDataHostImp* CProtocolPresentityGroupsDataHostImp::NewL( MXIMPHost& aHost )
+    {
+    CProtocolPresentityGroupsDataHostImp* self = new( ELeave ) CProtocolPresentityGroupsDataHostImp( aHost );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// Implement supported interface access.
+// ---------------------------------------------------------------------------
+//
+XIMPIMP_IF_BASE_GET_INTERFACE_BEGIN( CProtocolPresentityGroupsDataHostImp,
+                                     MProtocolPresentityGroupsDataHost )
+XIMPIMP_IF_BASE_GET_INTERFACE_END()
+
+
+XIMPIMP_IF_BASE_GET_CONST_INTERFACE_BEGIN( CProtocolPresentityGroupsDataHostImp,
+                                           MProtocolPresentityGroupsDataHost )
+XIMPIMP_IF_BASE_GET_INTERFACE_END()
+
+// ---------------------------------------------------------------------------
+// CProtocolPresentityGroupsDataHostImp::~CProtocolPresentityGroupsDataHostImp()
+// ---------------------------------------------------------------------------
+//
+CProtocolPresentityGroupsDataHostImp::~CProtocolPresentityGroupsDataHostImp()
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// CProtocolPresentityGroupsDataHostImp::HandlePresentityGroupListL
+// ---------------------------------------------------------------------------
+//
+TXIMPRequestId CProtocolPresentityGroupsDataHostImp::HandlePresentityGroupListL(
+        MXIMPObjectCollection* aGroupList )
+    {
+    TRACE(_L("CProtocolPresentityGroupsDataHostImp::HandlePresentityGroupListL") );
+    return iHost.AddNewOperationL( NPresenceOps::EPrHandlePresentityGroupList, aGroupList );
+    }
+
+// ---------------------------------------------------------------------------
+// CProtocolPresentityGroupsDataHostImp::HandlePresentityGroupCreatedL
+// ---------------------------------------------------------------------------
+//
+TXIMPRequestId CProtocolPresentityGroupsDataHostImp::HandlePresentityGroupCreatedL(
+        MPresentityGroupInfo* aGroupInfo )
+    {
+    TRACE(_L("CProtocolPresentityGroupsDataHostImp::HandlePresentityGroupCreatedL") );
+    return iHost.AddNewOperationL( NPresenceOps::EPrHandlePresentityGroupCreated, aGroupInfo );
+    }
+
+// ---------------------------------------------------------------------------
+// CProtocolPresentityGroupsDataHostImp::HandlePresentityGroupDeletedL
+// ---------------------------------------------------------------------------
+//
+TXIMPRequestId CProtocolPresentityGroupsDataHostImp::HandlePresentityGroupDeletedL(
+        MXIMPIdentity* aGroupId )
+    {
+    TRACE(_L("CProtocolPresentityGroupsDataHostImp::HandlePresentityGroupDeletedL") );
+    return iHost.AddNewOperationL( NPresenceOps::EPrHandlePresentityGroupDeleted, aGroupId );
+    }
+
+// ---------------------------------------------------------------------------
+// CProtocolPresentityGroupsDataHostImp::HandlePresentityGroupDisplayNameUpdatedL
+// ---------------------------------------------------------------------------
+//
+TXIMPRequestId CProtocolPresentityGroupsDataHostImp::HandlePresentityGroupDisplayNameUpdatedL(
+        MPresentityGroupInfo* aGroupInfo )
+    {
+    TRACE(_L("CProtocolPresentityGroupsDataHostImp::HandlePresentityGroupDisplayNameUpdatedL") );
+    return iHost.AddNewOperationL( NPresenceOps::EPrHandlePresentityGroupDisplayNameUpdated, aGroupInfo );
+    }
+
+// ---------------------------------------------------------------------------
+// CProtocolPresentityGroupsDataHostImp::PresentityGroupDataSubscriptionState
+// ---------------------------------------------------------------------------
+//
+const MXIMPDataSubscriptionState& 
+    CProtocolPresentityGroupsDataHostImp::PresentityGroupListDataSubscriptionState() const
+    {
+    TRACE(_L("CProtocolPresentityGroupsDataHostImp::PresentityGroupListDataSubscriptionState") );
+    return iHost.PresenceDataAccess().PresenceDataCache().PresentityGroupListDataSubscriptionState();
+    }
+
+// ---------------------------------------------------------------------------
+// CProtocolPresentityGroupsDataHostImp::SetPresentityGroupDataSubscriptionStateL
+// ---------------------------------------------------------------------------
+//
+TXIMPRequestId CProtocolPresentityGroupsDataHostImp::SetPresentityGroupListDataSubscriptionStateL(
+            MXIMPDataSubscriptionState* aSubscriptionState, 
+            MXIMPStatus* aStatus )
+    {
+    TRACE(_L("CProtocolPresentityGroupsDataHostImp::SetPresentityGroupListDataSubscriptionStateL") );
+    return iHost.AddNewOperationL( NPresenceOps::EPrSetPresentityGroupListDataSubscriptionState, 
+                                   aSubscriptionState, aStatus );
+    }
+
+// ---------------------------------------------------------------------------
+// From MProtocolPresentityGroupsDataHost class.
+// CProtocolPresentityGroupsDataHostImp::HandlePresentityGroupContentL
+// ---------------------------------------------------------------------------
+//
+TXIMPRequestId CProtocolPresentityGroupsDataHostImp::HandlePresentityGroupContentL(
+            MXIMPIdentity* aGroupId, MXIMPObjectCollection* aGroupMembers )
+    {
+    TRACE(_L("CProtocolPresentityGroupsDataHostImp::HandlePresentityGroupContentL") );
+    return iHost.AddNewOperationL( NPresenceOps::EPrHandlePresentityGroupContent, aGroupId, aGroupMembers );
+    }
+
+// ---------------------------------------------------------------------------
+// From MProtocolPresentityGroupsDataHost class.
+// CProtocolPresentityGroupsDataHostImp::HandlePresentityGroupMemberAddedL
+// ---------------------------------------------------------------------------
+//
+TXIMPRequestId CProtocolPresentityGroupsDataHostImp::HandlePresentityGroupMemberAddedL(
+        MXIMPIdentity* aGroupId, MPresentityGroupMemberInfo* aGroupMember )
+    {
+    TRACE(_L("CProtocolPresentityGroupsDataHostImp::HandlePresentityGroupMemberAddedL") );
+    return iHost.AddNewOperationL( NPresenceOps::EPrHandlePresentityGroupMemberAdded, aGroupId, aGroupMember );
+    }
+
+// ---------------------------------------------------------------------------
+// From MProtocolPresentityGroupsDataHost class.
+// CProtocolPresentityGroupsDataHostImp::HandlePresentityGroupMemberRemovedL
+// ---------------------------------------------------------------------------
+//
+TXIMPRequestId CProtocolPresentityGroupsDataHostImp::HandlePresentityGroupMemberRemovedL(
+            MXIMPIdentity* aGroupId, MXIMPIdentity* aGroupMemberId )
+    {
+    TRACE(_L("CProtocolPresentityGroupsDataHostImp::HandlePresentityGroupMemberRemovedL") );
+    CPresentityGroupMemberInfoImp* infoImp = CPresentityGroupMemberInfoImp::NewLC(
+                                                                    *aGroupMemberId, KNullDesC );
+    TXIMPRequestId reqId = iHost.AddNewOperationL( 
+                    NPresenceOps::EPrHandlePresentityGroupMemberRemoved, aGroupId, infoImp );
+    CleanupStack::Pop( infoImp );
+    delete aGroupMemberId;
+    return reqId;
+    }
+
+// ---------------------------------------------------------------------------
+// From MProtocolPresentityGroupsDataHost class.
+// CProtocolPresentityGroupsDataHostImp::HandlePresentityGroupMemberUpdatedL
+// ---------------------------------------------------------------------------
+//
+TXIMPRequestId CProtocolPresentityGroupsDataHostImp::HandlePresentityGroupMemberDisplayNameUpdatedL(
+            MXIMPIdentity* aGroupId, MPresentityGroupMemberInfo* aGroupMember )
+    {
+    TRACE(_L("CProtocolPresentityGroupsDataHostImp::HandlePresentityGroupMemberDisplayNameUpdatedL") );
+    return iHost.AddNewOperationL( NPresenceOps::EPrHandlePresentityGroupMemberDisplayNameUpdated, aGroupId, aGroupMember );
+    }
+
+// ---------------------------------------------------------------------------
+// CProtocolPresentityGroupsDataHostImp::PresentityGroupMemberDataSubscriptionState
+// ---------------------------------------------------------------------------
+//
+const MXIMPDataSubscriptionState& 
+    CProtocolPresentityGroupsDataHostImp::PresentityGroupContentDataSubscriptionState( 
+            const MXIMPIdentity& aGroupId ) const
+    {
+    TRACE(_L("CProtocolPresentityGroupsDataHostImp::PresentityGroupContentDataSubscriptionState") );
+    return iHost.PresenceDataAccess().PresenceDataCache().PresentityGroupContentDataSubscriptionState( aGroupId );
+    }
+
+// ---------------------------------------------------------------------------
+// CProtocolPresentityGroupsDataHostImp::SetPresentityGroupContentDataSubscriptionStateL
+// ---------------------------------------------------------------------------
+//
+TXIMPRequestId 
+    CProtocolPresentityGroupsDataHostImp::SetPresentityGroupContentDataSubscriptionStateL( 
+            MXIMPIdentity* aGroupId, 
+            MXIMPDataSubscriptionState* aSubscriptionState, 
+            MXIMPStatus* aStatus )
+    {
+    TRACE(_L("CProtocolPresentityGroupsDataHostImp::SetPresentityGroupContentDataSubscriptionState") );
+    CXIMPRestrictedObjectCollectionImp* collection = CXIMPRestrictedObjectCollectionImp::NewLC( ETrue );
+    collection->AddOrReplaceTypeL( aGroupId );
+    collection->AddOrReplaceTypeL( aSubscriptionState );
+    collection->AddOrReplaceTypeL( aStatus );    
+    TXIMPRequestId reqId = 
+        iHost.AddNewOperationL( NPresenceOps::EPrSetPresentityGroupContentDataSubscriptionState,
+                                collection );
+    CleanupStack::Pop( collection );
+    return reqId;    
+    }
+    
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/presence/srcpresenceprocessor/protocolpresentitygroupsdatahostimp.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,131 @@
+/*
+* 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 managing cached presentity group information.
+*
+*/
+
+#ifndef CPROTOCOLPRESENTITYGROUPSDATAHOSTIMP
+#define CPROTOCOLPRESENTITYGROUPSDATAHOSTIMP
+
+#include <protocolpresentitygroupsdatahost.h>
+
+#include "ximpapiobjbase.h"
+#include "presenceapiobjbase.h"
+#include "ximpitemparent.h"
+#include "presencetypehelpers.h"
+#include "ximpoperationdefs.h"
+
+class MXIMPHost;
+class COwnPresenceSubscriptionItem;
+class CPresentityPresenceSubscriptionItem;
+class CGroupContentSubscriptionItem;
+class CWatcherListSubscriptionItem;
+class MPresentityGroupInfo;
+class CXIMPIdentityImp;
+class MXIMPContext;
+class CXIMPSubscriptionItemBase;
+class MPresenceWatcherInfo;
+class MXIMPStatus;
+class MPresenceBlockInfo;
+class CBlockListSubscriptionItem;
+
+/**
+ * Implementation for managing cached presentity group information
+ *
+ * @since S60 v3.2
+ */
+class CProtocolPresentityGroupsDataHostImp : public CXIMPApiObjBase,
+                                                 public MProtocolPresentityGroupsDataHost
+    {
+public: // Definitions
+
+    /** The class ID. */
+    enum { KClassId = PRIMP_CLSID_CPROTOCOLPRESENTITYGROUPSDATAHOST };
+
+public: // Construction and destruction
+
+    /**
+     * Construction
+     */
+    IMPORT_C static CProtocolPresentityGroupsDataHostImp* NewL( MXIMPHost& aHost );
+
+    /**
+     * Destruction
+     */
+    virtual ~CProtocolPresentityGroupsDataHostImp();
+
+private:
+
+    CProtocolPresentityGroupsDataHostImp( MXIMPHost& aHost );
+    void ConstructL();
+
+public: // From MXIMPBase
+
+    /**
+     * Implementation of MXIMPBase interface methods
+     * @see MXIMPBase
+     */
+    XIMPIMP_DECLARE_IF_BASE_METHODS
+
+public: //From MProtocolPresentityGroupsDataHost
+
+    // Handling presentity groups
+    TXIMPRequestId HandlePresentityGroupListL(
+                MXIMPObjectCollection* aGroupList );
+    TXIMPRequestId HandlePresentityGroupCreatedL(
+                MPresentityGroupInfo* aGroupInfo );
+    TXIMPRequestId HandlePresentityGroupDeletedL(
+                MXIMPIdentity* aGroupId );
+    TXIMPRequestId HandlePresentityGroupDisplayNameUpdatedL(
+                MPresentityGroupInfo* aGroupInfo );
+    const MXIMPDataSubscriptionState& PresentityGroupListDataSubscriptionState() const;
+    TXIMPRequestId SetPresentityGroupListDataSubscriptionStateL( 
+                MXIMPDataSubscriptionState* aSubscriptionState, 
+                MXIMPStatus* aStatus );
+                
+    // Handling presentity group content
+
+    TXIMPRequestId HandlePresentityGroupContentL(
+                MXIMPIdentity* aGroupId,
+                MXIMPObjectCollection* aGroupMembers );
+    TXIMPRequestId HandlePresentityGroupMemberAddedL(
+                MXIMPIdentity* aGroupId,
+                MPresentityGroupMemberInfo* aGroupMember );
+    TXIMPRequestId HandlePresentityGroupMemberRemovedL(
+                MXIMPIdentity* aGroupId,
+                MXIMPIdentity* aGroupMemberId );
+    TXIMPRequestId HandlePresentityGroupMemberDisplayNameUpdatedL(
+                MXIMPIdentity* aGroupId,
+                MPresentityGroupMemberInfo* aGroupMember );
+    const MXIMPDataSubscriptionState& PresentityGroupContentDataSubscriptionState( 
+                const MXIMPIdentity& aGroupId ) const;
+    TXIMPRequestId SetPresentityGroupContentDataSubscriptionStateL( 
+                MXIMPIdentity* aGroupId, 
+                MXIMPDataSubscriptionState* aSubscriptionState, 
+                MXIMPStatus* aStatus );                
+
+private: // Data
+
+    /**
+     * Access to host.
+     */
+    MXIMPHost& iHost;
+    };
+
+
+/* ======================================================================== */
+
+
+
+#endif // CPROTOCOLPRESENTITYGROUPSDATAHOSTIMP
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/rom/ximpfw.iby	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  Image description file for project XIMP Framework
+*
+*/
+
+#ifndef PRESENCEFW_IBY
+#define PRESENCEFW_IBY
+
+#ifdef __PRESENCE_FRAMEWORK
+
+#include <data_caging_paths_for_iby.hrh>
+
+// XIMP Framework components
+file=ABI_DIR\BUILD_DIR\ximputils.dll              SHARED_LIB_DIR\ximputils.dll
+file=ABI_DIR\BUILD_DIR\ximpoperations.dll         SHARED_LIB_DIR\ximpoperations.dll
+file=ABI_DIR\BUILD_DIR\ximpprocessor.dll          SHARED_LIB_DIR\ximpprocessor.dll
+file=ABI_DIR\BUILD_DIR\ximpsrvclient.dll          SHARED_LIB_DIR\ximpsrvclient.dll
+file=ABI_DIR\BUILD_DIR\ximpdatamodel.dll          SHARED_LIB_DIR\ximpdatamodel.dll
+file=ABI_DIR\BUILD_DIR\ximpmanager.dll            SHARED_LIB_DIR\ximpmanager.dll
+
+
+// XIMP Framework server
+file=ABI_DIR\BUILD_DIR\ximpserver.exe             PROGRAMS_DIR\ximpserver.exe
+file=ABI_DIR\BUILD_DIR\ximprootserver.exe         PROGRAMS_DIR\ximprootserver.exe
+
+// XIMP ECOM Hook plugin
+ECOM_PLUGIN( ximpecomhook.dll, ximpecomhook.rsc )
+
+// Presence Plugin components
+file=ABI_DIR\BUILD_DIR\presencemanager.dll        SHARED_LIB_DIR\presencemanager.dll
+file=ABI_DIR\BUILD_DIR\presencedatamodel.dll      SHARED_LIB_DIR\presencedatamodel.dll  
+file=ABI_DIR\BUILD_DIR\presenceoperation.dll      SHARED_LIB_DIR\presenceoperation.dll
+file=ABI_DIR\BUILD_DIR\presencecacheclient.dll    SHARED_LIB_DIR\presencecacheclient.dll
+
+// Presence Plugin server
+file=ABI_DIR\BUILD_DIR\presencecacheserver.exe    PROGRAMS_DIR\presencecacheserver.exe
+
+// Presence Plugin ECOM Hook plugins
+ECOM_PLUGIN( presenceecomhook.dll, presenceecomhook.rsc ) 
+ECOM_PLUGIN( presencedatamodelhook.dll, presencedatamodelhook.rsc )
+ECOM_PLUGIN( presencecacheecomhook.dll, presencecacheecomhook.rsc )
+
+// ximpfw SIS, provides support for SIS upgrading
+//data=DATAZ_\system\install\ximpfw.sis     system\install\ximpfw.sis
+
+
+#endif // __PRESENCE_FRAMEWORK
+
+#endif //PRESENCEFW_IBY
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/rom/ximpfw_install.pkg	Wed Nov 03 09:32:20 2010 +0530
@@ -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: pkg file for ximpfw_install
+;
+;Language
+&EN
+
+;Header
+#{"XIMPFramework"}, (0x10282DDC), 1, 0, 0, TYPE=SA
+
+
+;Localised VendorID
+%{"Nokia"}
+
+;VendorID
+:"Nokia"
+
+(0x101F7961), 0, 0, 0, {"Series60ProductID"}
+
+
+;binaries
+"\EPOC32\RELEASE\ARMV5\UREL\ximpdatamodel.dll"-"!:\sys\bin\ximpdatamodel.dll"
+"\EPOC32\RELEASE\ARMV5\UREL\ximpoperations.dll"-"!:\sys\bin\ximpoperations.dll"
+"\EPOC32\RELEASE\ARMV5\UREL\ximpprocessor.dll"-"!:\sys\bin\ximpprocessor.dll"
+"\EPOC32\RELEASE\ARMV5\UREL\ximpserver.exe"-"!:\sys\bin\ximpserver.exe"
+"\EPOC32\RELEASE\ARMV5\UREL\ximprootserver.exe"-"!:\sys\bin\ximprootserver.exe"
+"\EPOC32\RELEASE\ARMV5\UREL\ximpsrvclient.dll"-"!:\sys\bin\ximpsrvclient.dll"
+"\EPOC32\RELEASE\ARMV5\UREL\ximpmanager.dll"-"!:\sys\bin\ximpmanager.dll"
+"\EPOC32\RELEASE\ARMV5\UREL\ximpecomhook.dll"-"!:\sys\bin\ximpecomhook.dll"
+"\EPOC32\RELEASE\ARMV5\UREL\ximputils.dll"-"!:\sys\bin\ximputils.dll"
+"\EPOC32\RELEASE\ARMV5\UREL\presencemanager.dll"-"!:\sys\bin\presencemanager.dll"
+"\EPOC32\RELEASE\ARMV5\UREL\presencedatamodel.dll"-"!:\sys\bin\presencedatamodel.dll"
+"\EPOC32\RELEASE\ARMV5\UREL\presenceoperation.dll"-"!:\sys\bin\presenceoperation.dll"
+"\EPOC32\RELEASE\ARMV5\UREL\presencedatamodelhook.dll"-"!:\sys\bin\presencedatamodelhook.dll"
+"\EPOC32\RELEASE\ARMV5\UREL\presenceecomhook.dll"-"!:\sys\bin\presenceecomhook.dll"
+"\EPOC32\RELEASE\ARMV5\UREL\presencecacheclient.dll"-"!:\sys\bin\presencecacheclient.dll"
+"\EPOC32\RELEASE\ARMV5\UREL\presencecacheecomhook.dll"-"!:\sys\bin\presencecacheecomhook.dll"
+"\EPOC32\RELEASE\ARMV5\UREL\presencecacheserver.exe"-"!:\sys\bin\presencecacheserver.exe"
+"\EPOC32\RELEASE\ARMV5\UREL\immanager.dll"-"!:\sys\bin\immanager.dll"
+"\EPOC32\RELEASE\ARMV5\UREL\imdatamodel.dll"-"!:\sys\bin\imdatamodel.dll"
+"\EPOC32\RELEASE\ARMV5\UREL\imoperation.dll"-"!:\sys\bin\imoperation.dll"
+"\EPOC32\RELEASE\ARMV5\UREL\imdatamodelhook.dll"-"!:\sys\bin\imdatamodelhook.dll"
+"\EPOC32\RELEASE\ARMV5\UREL\imecomhook.dll"-"!:\sys\bin\imecomhook.dll"
+
+;resources
+"\EPOC32\DATA\Z\Resource\Plugins\ximpecomhook.RSC"-"!:\resource\plugins\ximpecomhook.rsc"
+"\EPOC32\DATA\Z\Resource\Plugins\presenceecomhook.RSC"-"!:\resource\plugins\presenceecomhook.rsc"
+"\EPOC32\DATA\Z\Resource\Plugins\presencedatamodelhook.RSC"-"!:\resource\plugins\presencedatamodelhook.rsc"
+"\EPOC32\DATA\Z\Resource\Plugins\presencecacheecomhook.RSC"-"!:\resource\plugins\presencecacheecomhook.rsc"
+"\EPOC32\DATA\Z\Resource\Plugins\imecomhook.RSC"-"!:\resource\plugins\imecomhook.rsc"
+"\EPOC32\DATA\Z\Resource\Plugins\imdatamodelhook.RSC"-"!:\resource\plugins\imdatamodelhook.rsc"
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/sis/metadata.xml	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,72 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ad:metadata xmlns="http://nokia.com/arrow/repository/ia_component" xmlns:ad="http://nokia.com/arrow/application_metadata">
+    <iaSearchCriteria>ABC:ABC</iaSearchCriteria>
+    <!--
+    The appResources element contains all the language metadata of one IAC.
+    IAC may have one or more language-specific component names
+    and descriptions inside appResource element.
+
+    Language ID 1 should be always defined as this is the default language
+    in case other languages supported by the client cannot be found.
+    -->
+    <appResources>
+        <appResource>
+            <!-- Language ID -->
+            <language>1</language>
+            <!-- Name in given language -->
+            <iacName>XIMPFramework</iacName>
+            <!-- Description in given language -->
+            <iacDescription>Update for XIMPFramework</iacDescription>
+        </appResource>
+    </appResources>
+    <!-- Specifies for what versions of what platform this component is for. -->
+    <swPlatformDep>
+    <!-- platform code -->
+        <platform>S60</platform>
+        <versionFrom>
+            <!--
+            platform version number separated in major and minor number (i.e.
+            3.0 has 3 as major and 0 as minor)
+            -->
+            <major>5</major>
+            <minor>2</minor>
+            <!--
+            date-element can be used to pinpoint platform version number to even
+            more specific one. It is not currently used in the system.
+            -->
+            <date>
+                <year>2007</year>
+                <week>1</week>
+            </date>
+        </versionFrom>
+        <!-- the latest platform version this component is for -->
+        <versionTo>
+            <major>5</major>
+            <minor>2</minor>
+            <date>
+                <year>2009</year>
+                <week>52</week>
+            </date>
+        </versionTo>
+    </swPlatformDep>
+    <!-- specifies dependencies to other IACs -->
+    <interDeps>
+        <interDep>
+        <!-- SISX UID of the package this component is dependent of -->
+        <sisxUid>0x10282DDC</sisxUid>
+            <!-- the earliest version this component is dependent of -->
+            <versionFrom>
+                <major>1</major>
+                <minor>0</minor>
+                <build>0</build>
+            </versionFrom>
+            <!-- the latest version this component is dependent of -->
+            <versionTo>
+                <major>2</major>
+                <minor>2</minor>
+                <build>2</build>
+            </versionTo>
+        </interDep>
+    </interDeps>
+<firmwareDependencies xmlns="http://nokia.com/arrow/repository/ia_component" xmlns:ad="http://nokia.com/arrow/application_metadata"/>
+</ad:metadata>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/sis/ximpfw.pkg	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,55 @@
+;
+; 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: 
+;
+;Language
+&EN
+
+;Header
+#{"XIMPFramework"}, (0x10282DDC), 1, 1, 0, TYPE=SA, RU
+
+;Localised VendorID
+%{"Nokia"}
+
+;VendorID
+:"Nokia"
+
+;Supports Series 60 v 5.2; Needs to be updated when platform is changed
+(0x20022E6D ), 0, 0, 0, {"Series60ProductID"}
+
+;binaries
+"\EPOC32\RELEASE\ARMV5\UREL\ximpdatamodel.dll"-"!:\sys\bin\ximpdatamodel.dll"
+"\EPOC32\RELEASE\ARMV5\UREL\ximpoperations.dll"-"!:\sys\bin\ximpoperations.dll"
+"\EPOC32\RELEASE\ARMV5\UREL\ximpprocessor.dll"-"!:\sys\bin\ximpprocessor.dll"
+"\EPOC32\RELEASE\ARMV5\UREL\ximpserver.exe"-"!:\sys\bin\ximpserver.exe"
+"\EPOC32\RELEASE\ARMV5\UREL\ximprootserver.exe"-"!:\sys\bin\ximprootserver.exe"
+"\EPOC32\RELEASE\ARMV5\UREL\ximpsrvclient.dll"-"!:\sys\bin\ximpsrvclient.dll"
+"\EPOC32\RELEASE\ARMV5\UREL\ximpmanager.dll"-"!:\sys\bin\ximpmanager.dll"
+"\EPOC32\RELEASE\ARMV5\UREL\ximpecomhook.dll"-"!:\sys\bin\ximpecomhook.dll"
+"\EPOC32\RELEASE\ARMV5\UREL\ximputils.dll"-"!:\sys\bin\ximputils.dll"
+"\EPOC32\RELEASE\ARMV5\UREL\presencemanager.dll"-"!:\sys\bin\presencemanager.dll"
+"\EPOC32\RELEASE\ARMV5\UREL\presencedatamodel.dll"-"!:\sys\bin\presencedatamodel.dll"
+"\EPOC32\RELEASE\ARMV5\UREL\presenceoperation.dll"-"!:\sys\bin\presenceoperation.dll"
+"\EPOC32\RELEASE\ARMV5\UREL\presencedatamodelhook.dll"-"!:\sys\bin\presencedatamodelhook.dll"
+"\EPOC32\RELEASE\ARMV5\UREL\presenceecomhook.dll"-"!:\sys\bin\presenceecomhook.dll"
+"\EPOC32\RELEASE\ARMV5\UREL\presencecacheclient.dll"-"!:\sys\bin\presencecacheclient.dll"
+"\EPOC32\RELEASE\ARMV5\UREL\presencecacheecomhook.dll"-"!:\sys\bin\presencecacheecomhook.dll"
+"\EPOC32\RELEASE\ARMV5\UREL\presencecacheserver.exe"-"!:\sys\bin\presencecacheserver.exe"
+
+;resources
+"\EPOC32\DATA\Z\Resource\Plugins\ximpecomhook.RSC"-"!:\resource\plugins\ximpecomhook.rsc"
+"\EPOC32\DATA\Z\Resource\Plugins\presenceecomhook.RSC"-"!:\resource\plugins\presenceecomhook.rsc"
+"\EPOC32\DATA\Z\Resource\Plugins\presencedatamodelhook.RSC"-"!:\resource\plugins\presencedatamodelhook.rsc"
+"\EPOC32\DATA\Z\Resource\Plugins\presencecacheecomhook.RSC"-"!:\resource\plugins\presencecacheecomhook.rsc"
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/sis/ximpfwstub.pkg	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,67 @@
+;
+; 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: 
+;
+;
+; Package file for presencefw SIS stub in ROM
+; and a ximp framework upgrade SIS.
+; Including the stub in ROM enables components
+; defined in stub to be updated by SIS installer.
+; When adding or removing components from presencefw
+; please update this pkg file and create an updated
+; stub to group directory.
+;
+; To create SIS stub: makesis -s ximpfw_upgrade.pkg ximpfwstub.sis
+; Copy ximpfwstub.sis to z:\system\install\ximpfwstub.sis
+; or use abld export to export it automatically.
+;
+
+;Language
+&EN
+
+;Header
+#{"XIMPFramework"}, (0x10282DDC), 1, 0, 0, TYPE=SA
+
+
+;Localised VendorID
+%{"Nokia"}
+
+;VendorID
+:"Nokia"
+
+;binaries
+""-"z:\sys\bin\ximpdatamodel.dll"
+""-"z:\sys\bin\ximpoperations.dll"
+""-"z:\sys\bin\ximpprocessor.dll"
+""-"z:\sys\bin\ximpserver.exe"
+""-"z:\sys\bin\ximprootserver.exe"
+""-"z:\sys\bin\ximpsrvclient.dll"
+""-"z:\sys\bin\ximpmanager.dll"
+""-"z:\sys\bin\ximpecomhook.dll"
+""-"z:\sys\bin\ximputils.dll"
+""-"z:\sys\bin\presencemanager.dll"
+""-"z:\sys\bin\presencedatamodel.dll"
+""-"z:\sys\bin\presenceoperation.dll"
+""-"z:\sys\bin\presencedatamodelhook.dll"
+""-"z:\sys\bin\presenceecomhook.dll"
+""-"z:\sys\bin\presencecacheclient.dll"
+""-"z:\sys\bin\presencecacheecomhook.dll"
+""-"z:\sys\bin\presencecacheserver.exe"
+
+;resources
+""-"z:\resource\plugins\ximpecomhook.rsc"
+""-"z:\resource\plugins\presenceecomhook.rsc"
+""-"z:\resource\plugins\presencedatamodelhook.rsc"
+""-"z:\resource\plugins\presencecacheecomhook.rsc"
+
Binary file ximpfw/sis/ximpfwstub.sis has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/tsrc/docs/readme.txt	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,336 @@
+Conventions for writing test cases and using decorators for them.
+
+-----------------------------------------------------------------------
+
+******************************************
+*     WHICH DECORATOR I SHOULD USE       *
+******************************************
+#1 Do no use static test decorators. Decorators are used dynamically.
+  - 1. Ok to use decorator -> Use PRFW_DECORATED_TEST
+  - 2. nok to use decorator -> Use PRFW_NOT_DECORATED_TEST
+
+
+-----------------------------------------------------------------------
+****************************************
+* HOW TO USE THE TEST CONTEXT WRAPPERS *
+****************************************
+
+Relevant files:
+testcaseutils/prfwtestcontextwrapper.h
+testcaseutils/prfwtestcontextwrappermgr.h
+testcaseutils/prfwtestcontextwrapper.cpp
+testcaseutils/prfwtestcontextwrappermgr.cpp
+   
+    >>> Feel free to remove unused stuff or add more! <<<
+
+Main idea: simplify test code by wrapping each testing "context" in one
+class which contains:
+  - prfw client
+  - prfw context (not the same as testing "context")
+  - the plugin instance
+  - event listener
+  - messenger (see below)
+  - etc.
+
+For example usage see:
+  t_sessionmng
+  pr_prfwtestprotocol
+
+Mini how-to:
+
+1. Create wrappers with wrapper manager using CreateWrapperL call.
+
+2. Then access the wrappers using GetWrapper( TInt aIndex ). The caller is
+responsible for keeping note of which index is used for what (e.g. in
+the case of two connections).
+
+3. Wrapper has methods BindL and UnbindL if you just want to get the
+   connection up:
+
+   Somewhere, e.g. Setup method:
+
+    iWrapperMgr = CPrFwTestContextWrapperMgr::NewL();
+    iWrapperMgr->CreateWrapperL();
+   
+   Bind:
+
+    CPrFwTestContextWrapper* wrapper0 = iWrapperMgr->GetWrapperL( 0 );
+    wrapper0->BindL( 0 );
+
+    // now you are "connected to network" (=faked by test plugin)
+
+   Unbind:
+    
+    CPrFwTestContextWrapper* wrapper0 = iWrapperMgr->GetWrapperL( 0 );
+    wrapper0->UnbindL();
+
+    // now you are no longer connected. 
+
+   Destructor:
+     
+    delete iWrapperMgr; 
+
+4. You can access messenger class etc. using the various Get* methods.
+
+    IMPORT_C MXIMPContext* GetContext();
+    IMPORT_C CPrFwTestStatusEventListener* GetEventListener();
+    IMPORT_C CPrFwTestMessenger* GetMessenger();
+    IMPORT_C MXIMPClient* GetClient();
+    IMPORT_C RArray<TPrFwTestStatusEventSnapshot>* GetStatusTraits();
+
+5. Other convenience methods are also provided, please see t_sessionmng
+   for illustrative code. The below method tests the bind with wait.
+   The Assert* methods are used to check if test protocol plugin was
+   correctly called.
+
+Setup:
+
+    iWrapperMgr = CPrFwTestContextWrapperMgr::NewL();
+    iWrapperMgr->CreateWrapperL();
+
+Teardown:
+
+    delete iWrapperMgr;
+
+void T_SessionMng::T_Simple_Bind_Wait_Unbind_L()
+    {
+    EUNIT_PRINT( _L("Simple context Bind/Unbind test.") );
+    EUNIT_PRINT( _L("Client side waits bind completion before issuing unbind.") );
+
+    CPrFwTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    MXIMPContext* context = wrapper->GetContext();
+    CPrFwTestStatusEventListener* eventListener = wrapper->GetEventListener();
+    CPrFwTestMessenger* messenger = wrapper->GetMessenger();
+    
+    //Do bind, wait and verify events
+    wrapper->SetupListenerL( EPrFwTestStatusEvents_BindingOk );
+    messenger->SetNoError(); 
+
+    messenger->SetPluginIndex( 0 );
+    TUid protocol = { 0x1100ff55 };
+    TXIMPRequestId reqId = context->BindToL( 
+            protocol,
+            _L("www.imps.no/wv"),
+            _L("user"),
+            _L("password"),
+            1 );
+
+    wrapper->WaitRequestAndStackEvents( reqId );
+    wrapper->VerifyEventStackL( _L8("Binding single context: ") );
+
+    AssertOpenSession( 0 );
+
+    //Verify features availability
+    MXIMPFeatureInfo* ctxFeats = context->GetContextFeaturesLC();
+    EUNIT_ASSERT_DESC( ctxFeats->FeatureIds().MdcaCount() > 0, "No features from context" );
+    CleanupStack::PopAndDestroy(); //ctxFeats
+
+    //Do unbind, wait and verify events
+    wrapper->SetupListenerL( EPrFwTestStatusEvents_UnbindingOk );
+    messenger->SetNoError();
+    reqId = context->UnbindL();
+
+    wrapper->WaitRequestAndStackEvents( reqId );
+    wrapper->VerifyEventStackL( _L8("Unbinding single context: ") );
+
+    AssertCloseSession( 0 );
+    AssertPluginDied( 0 );
+    }
+
+The Assert* methods can be found from t_sessionmng (they should be moved
+elsewhere). See below for messenger functionality.
+
+-----------------------------------------------------------------------
+***************************************************
+* HOW TO USE THE TEST CASE - PLUGIN COMMUNICATION *
+***************************************************
+
+Relevant files:
+testcaseutils/prfwtestmessaging.h    - Keys, value enumerations etc.
+testcaseutils/prfwtestmessenger.h    - Messenger header (READ THIS)
+testcaseutils/prfwtestmessenger.cpp  - Messenger implementation
+ 
+    >>> Feel free to remove unused stuff or add more! <<<
+
+For example usage see:
+  t_sessionmng
+  t_presencemng
+  pr_prfwtestprotocol
+
+The idea is:
+  - there's publish & subscribe facility to send messages from
+    test code to plugin
+  - test protocol reads the message and changes its behaviour
+    accordingly, e.g. doing a leave on next HandleRequestCompleted
+
+More details:
+
+(prfwtestmessaging.h)
+
+* TPrFwTestPropertyKeys determines the keys.
+  You can add more messages here.
+
+* TPrFwTestPropertyValues determines certain pre-defined values,
+  e.g. EPrFwPrtValSessionLostReconnect (which is used to cause the
+  plugin to signal a "session lost, try to reconnect" to the 
+  Presence Framework.
+
+* TPrFwTestMsg is the protocol message. It consists of the key specifier
+  and the value to be set. Currently only integer parameters are
+  supported.
+
+* Each CPrFwTestMessenger takes an index into the constructor. This is
+  needed to create a two-way communications channel from the test case
+  to plugin and vice versa.
+
+* Creation of messenger is handled by the wrapper (which is created via
+  wrapper manager).
+
+* MINIMAL USAGE:
+ 
+  * To set "happy path", no errors will be artificially caused:
+    SetNoError()
+
+  * To make next operation fail with some error code: 
+    SetError( TInt aErrorCOde )
+
+  * To make next operation leave:
+    SetLeave( TInt aLeaveCode )
+
+  * Call HandleLeaveL in the test protocol plugin to automatically
+    leave, if leave was requested. (So you don't have to do 
+    "GetValueFor.. if (leave){User::Leave..")
+
+  * To set a boolean-valued (1 or 0) key, use SetBoolean. Read with
+    GetBoolean. These are used to signal the calling of some method,
+    and to read whether the method was called or not.
+
+  * For generic stuff use SetValueFor and GetValueFor.
+
+NOTES:
+
+If you add more keys, BE SURE TO RESET THEM IN THE MESSENGER
+CONSTRUCTION. 
+
+If you use multiple messengers, use different indexes!!!
+
+Please see t_sessionmng and t_presencemng for details.
+
+-----------------------------------------------------------------------
+********************************************
+* HOW TO USE THE EVENT LISTENER CLASS      *
+********************************************
+
+There are 2 event listener classes implemented:
+CPrFwTestListener
+CPrFwTestStatusEventListener
+
+The context wrapper has support for the CPrFwTestStatusEventListener.
+See the description there.
+
+CPrFwTestListener is the one which is more commonly used in the test cases.
+This listener supports creating exact events to be accepted by the test case,
+including the data inside the events, so use this class to verify the data.
+The event with the expected data can be send to the test protocol using
+the filetool, see below.
+
+The usage of the listener is fairly simple:
+
+    // create the listener since not created by the wrapper
+    CPrFwTestListener* listener2 = CPrFwTestListener::NewL( context );
+    CleanupStack::PushL( listener2 );
+
+    // initialize it to accept new events
+    listener2->Reset();
+
+    // create the event which is expected, here the RequestCompleteEvent
+    // RequestID is not checked in the assertion! 
+    TXIMPRequestId reqIdDummy;
+    CXIMPRequestCompleteEventImp* evReqComplete =
+                    CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+                    
+    // add the created event to the listener, ownership is transfered
+    listener2->ExpectL( evReqComplete );
+    CleanupStack::Pop( evReqComplete );
+
+    // call the desired XIMPFW method 
+    TXIMPRequestId reqId = presPub->SubscribePresenceWatcherListL();
+
+    // Wait for events on the request
+    // Assertion is done based on the content on the event by comparing
+    // the received event with the expected one.
+    EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Subscribe failed" );
+    
+    // clean it up
+    CleanupStack::PopAndDestroy( listener2 );
+
+-----------------------------------------------------------------------
+********************************************
+* HOW TO USE THE PSEUDO-IPC FILETOOL CLASS *
+********************************************
+
+The FileTool writes given serialized objects to a directory. It can also
+internalize them. Thus with FileTool you can check whether the presence
+data you put into the framework goes through OK.
+
+Server could also be used, and in a perfect world such a thing would
+have been written with big smiles, but in reality it would take much
+much longer to create and debug than this kind of FileTool, so here's
+FileTool!
+
+Relevant files:
+testcaseutils/prfwtestfiletool.h
+testcaseutils/prfwtestfiletool.cpp
+
+As of now, the FileTool is not yet integrated to any tests.
+
+FileTool API:
+
+Let's say you choose to use index 0. If you have two connections or
+such, then you would create two FileTools with indexes 0 and 1,
+respectively.
+
+Wipe old stuff away, destroy the directory, etc.:
+  - CleanL( 0 )
+
+Create the new directory:
+  - PrepareL( 0 ) 
+
+Store an object:
+  - StoreL( 0, externalizedObjectAsTDesC8 )
+
+Get number of objects stored:
+  - numObjects = NumObjectsL( 0 )
+
+Restore an object:
+  - i is a looping from 0..NumObjectsL( 0 )-1.
+  - CXIMPApiEventBase* restored = RestoreLC( 0, i );
+  - For example in this way you can check the whole directory.
+
+After the object is restored, compare in test code side to that which it
+SHOULD HAVE been.
+
+-----------------------------------------------------------------------
+********************************************
+* HOW TO USE THE "ROBUSTNESS HELPERS"      *
+********************************************
+
+It's good to kill the servers and removing all temporary FileTool files
+when starting a test case. This ensures that there are no unexpected
+messages, events or state lingering in the server.
+
+1. Add to MMP file:
+
+  #include "..\..\tsrcutils\processmaster\pm.h"
+
+If your stuff is not in internal\tsrc, then view the pm.h contents and
+adapt it.
+
+2. Add to test case:
+
+  #include "prfwtestrobustnesstools.h"
+
+3. Add to test case SetupL as the first line:
+
+  PrfwTestRobustness::DoPreCleaning();
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/tsrc/group/bld.inf	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  Build information file for test dlls and related helpers
+*
+*/
+
+
+// tsrc utils, including test mover
+//#include "../tsrcutils/bld.inf"
+
+// Test protocols
+//#include "../tsrcprotocols/bld.inf"
+
+// Module release tests
+//#include "../src/t_rootservices/bld.inf"
+//#include "../src/t_sessionmng/bld.inf"
+//#include "../src/t_presencepublishing/bld.inf"
+//#include "../src/t_presencewatching/bld.inf"
+//#include "../src/t_presencegrouplistmngt/bld.inf"
+//#include "../src/t_presencegroupmembermngt/bld.inf"
+//#include "../src/t_presencewatcherlistmngt/bld.inf"
+//#include "../src/t_presencegrantrequestmngt/bld.inf"
+//#include "../src/t_presenceauthorization/bld.inf"
+//#"../src/t_presenceblocking/bld.inf"
+//#include "../src/t_utils/bld.inf"
+//#include "../src/t_presenceall/bld.inf"
+
+PRJ_TESTMMPFILES
+../tsrcutils/testcaseutils/prfwtestcaseutils.mmp
+../tsrcutils/processmaster/prfwtestprocessmaster.mmp
+../tsrcprotocols/pr_prfwtestprotocol/pr_prfwtestprotocol.mmp
+../src/t_rootservices/t_rootservices.mmp
+../src/t_sessionmng/t_sessionmng.mmp
+../src/t_presencepublishing/t_presencepublishing.mmp
+../src/t_presencewatching/t_presencewatching.mmp
+../src/t_presencegrouplistmngt/t_presencegrouplistmngt.mmp
+../src/t_presencegroupmembermngt/t_presencegroupmembermngt.mmp
+../src/t_presencewatcherlistmngt/t_presencewatcherlistmngt.mmp
+../src/t_presencegrantrequestmngt/t_presencegrantrequestmngt.mmp
+../src/t_presenceauthorization/t_presenceauthorization.mmp
+../src/t_presenceblocking/t_presenceblocking.mmp
+../src/t_utils/t_utils.mmp
+../src/t_presenceall/t_presenceall.mmp
+
+// Export the .iby for module release tests
+
+PRJ_TESTEXPORTS
+ximpfwmrt.iby  /epoc32/rom/include/ximpfwmrt.iby
+
+#ifdef WINSCW_UDEB
+GNUMAKEFILE test_mover.make
+#endif 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/tsrc/group/test_mover.make	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,20 @@
+FINAL :
+	echo Copying test DLL to z\sys\bin
+	copy %epocroot%epoc32\release\winscw\udeb\pr_prfwtestprotocol.dll 	%epocroot%epoc32\release\winscw\UDEB\z\sys\bin /y
+ 	copy %epocroot%epoc32\release\winscw\udeb\prfwtestcaseutils.lib	%epocroot%epoc32\release\winscw\UDEB\z\sys\bin /y
+	copy %epocroot%epoc32\release\winscw\udeb\prfwtestcaseutils.dll 	 %epocroot%epoc32\release\winscw\UDEB\z\sys\bin /y
+	copy %epocroot%epoc32\release\winscw\udeb\t_presenceall.dll 	      %epocroot%epoc32\release\winscw\UDEB\z\sys\bin /y
+	copy %epocroot%epoc32\release\winscw\udeb\t_utils.dll 								%epocroot%epoc32\release\winscw\UDEB\z\sys\bin /y
+	copy %epocroot%epoc32\release\winscw\udeb\t_presenceauthorization.dll 	%epocroot%epoc32\release\winscw\UDEB\z\sys\bin /y
+  copy %epocroot%epoc32\release\winscw\udeb\t_presencegrantrequestmngt.dll 	%epocroot%epoc32\release\winscw\UDEB\z\sys\bin /y
+  copy %epocroot%epoc32\release\winscw\udeb\t_presencewatcherlistmngt.dll 	%epocroot%epoc32\release\winscw\UDEB\z\sys\bin /y
+  copy %epocroot%epoc32\release\winscw\udeb\t_presencegroupmembermngt.dll 	%epocroot%epoc32\release\winscw\UDEB\z\sys\bin /y
+  copy %epocroot%epoc32\release\winscw\udeb\t_presencegrouplistmngt.dll 	%epocroot%epoc32\release\winscw\UDEB\z\sys\bin /y
+  copy %epocroot%epoc32\release\winscw\udeb\t_presencewatching.dll 				%epocroot%epoc32\release\winscw\UDEB\z\sys\bin /y
+  copy %epocroot%epoc32\release\winscw\udeb\t_presencepublishing.dll 		%epocroot%epoc32\release\winscw\UDEB\z\sys\bin /y
+  copy %epocroot%epoc32\release\winscw\udeb\t_sessionmng.dll 					%epocroot%epoc32\release\winscw\UDEB\z\sys\bin /y
+  copy %epocroot%epoc32\release\winscw\udeb\t_rootservices.dll 				%epocroot%epoc32\release\winscw\UDEB\z\sys\bin /y
+  copy %epocroot%epoc32\release\winscw\udeb\t_presenceblocking.dll 		%epocroot%epoc32\release\winscw\UDEB\z\sys\bin /y
+	copy %epocroot%epoc32\release\winscw\udeb\prfwtestprocessmaster.exe 	%epocroot%epoc32\release\winscw\UDEB\z\sys\bin /y
+	
+MAKMAKE FREEZE LIB CLEANLIB RESOURCE RELEASABLES CLEAN BLD SAVESPACE :
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/tsrc/group/ximpfw_release_tests.pkg	Wed Nov 03 09:32:20 2010 +0530
@@ -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: XIMP Framewor Test code Package File
+;
+;Header
+#{"XIMPFW ReleaseTests"}, (0x10282DE4), 1, 0, 0
+
+;Language
+&EN
+
+;Localised VendorID
+%{"Nokia"}
+
+;VendorID
+:"Nokia"
+
+
+;Supports Series 60 v 0.9
+(0x101F6F88), 0, 0, 0,
+{"Series60ProductID"}
+
+
+;Needed test protocols and test helpers
+"\EPOC32\RELEASE\ARMV5\UREL\pr_prfwtestprotocol.dll" - "!:\sys\bin\pr_prfwtestprotocol.dll"
+"\EPOC32\DATA\Z\Resource\Plugins\pr_prfwtestprotocol.RSC"-"!:\resource\plugins\pr_prfwtestprotocol.rsc"
+"\EPOC32\RELEASE\ARMV5\UREL\prfwtestcaseutils.dll" - "!:\sys\bin\prfwtestcaseutils.dll"
+
+
+;EUnit test dlls
+;"\EPOC32\RELEASE\ARMV5\UREL\t_presenceall.dll" - "!:\sys\bin\t_presenceall.dll"
+"\EPOC32\RELEASE\ARMV5\UREL\t_rootservices.dll" - "!:\sys\bin\t_rootservices.dll"
+"\EPOC32\RELEASE\ARMV5\UREL\t_sessionmng.dll" - "!:\sys\bin\t_sessionmng.dll"
+"\EPOC32\RELEASE\ARMV5\UREL\t_presencepublishing.dll" - "!:\sys\bin\t_presencepublishing.dll"
+"\EPOC32\RELEASE\ARMV5\UREL\t_presencewatching.dll" - "!:\sys\bin\t_presencewatching.dll"
+"\EPOC32\RELEASE\ARMV5\UREL\t_presencegrouplistmngt.dll" - "!:\sys\bin\t_presencegrouplistmngt.dll"
+"\EPOC32\RELEASE\ARMV5\UREL\t_presencegroupmembermngt.dll" - "!:\sys\bin\t_presencegroupmembermngt.dll"
+"\EPOC32\RELEASE\ARMV5\UREL\t_presencewatcherlistmngt.dll" - "!:\sys\bin\t_presencewatcherlistmngt.dll"
+"\EPOC32\RELEASE\ARMV5\UREL\t_presencegrantrequestmngt.dll" - "!:\sys\bin\t_presencegrantrequestmngt.dll"
+"\EPOC32\RELEASE\ARMV5\UREL\t_presenceauthorization.dll" - "!:\sys\bin\t_presenceauthorization.dll"
+"\EPOC32\RELEASE\ARMV5\UREL\t_presenceblocking.dll" - "!:\sys\bin\t_presenceblocking.dll"
+"\EPOC32\RELEASE\ARMV5\UREL\t_utils.dll" - "!:\sys\bin\t_utils.dll"
+
+;ProcessMaster
+"\EPOC32\RELEASE\ARMV5\UREL\prfwtestprocessmaster.exe" - "!:\sys\bin\prfwtestprocessmaster.exe"
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/tsrc/group/ximpfwmrt.iby	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  Image description file for module release tests
+*
+*/
+
+#ifndef __prfwmrt_iby__
+#define __prfwmrt_iby__
+
+#include <bldvariant.hrh>
+
+// Test protocol (ECOM plugin)
+ECOM_PLUGIN( pr_prfwtestprotocol.dll, pr_prfwtestprotocol.rsc )
+
+// Test utils and helpers
+file=ABI_DIR\BUILD_DIR\prfwtestcaseutils.dll    SHARED_LIB_DIR\prfwtestcaseutils.dll
+
+// Test dlls
+file=ABI_DIR\BUILD_DIR\t_presenceall.dll                SHARED_LIB_DIR\t_presenceall.dll
+file=ABI_DIR\BUILD_DIR\t_rootservices.dll               SHARED_LIB_DIR\t_rootservices.dll
+file=ABI_DIR\BUILD_DIR\t_sessionmng.dll                 SHARED_LIB_DIR\t_sessionmng.dll
+file=ABI_DIR\BUILD_DIR\t_presencepublishing.dll         SHARED_LIB_DIR\t_presencepublishing.dll
+file=ABI_DIR\BUILD_DIR\t_presencewatching.dll           SHARED_LIB_DIR\t_presencewatching.dll
+file=ABI_DIR\BUILD_DIR\t_presencegrouplistmngt.dll      SHARED_LIB_DIR\t_presencegrouplistmngt.dll
+file=ABI_DIR\BUILD_DIR\t_presencegroupmembermngt.dll    SHARED_LIB_DIR\t_presencegroupmembermngt.dll
+file=ABI_DIR\BUILD_DIR\t_presencewatcherlistmngt.dll    SHARED_LIB_DIR\t_presencewatcherlistmngt.dll
+file=ABI_DIR\BUILD_DIR\t_presenceauthorization.dll      SHARED_LIB_DIR\t_presenceauthorization.dll
+file=ABI_DIR\BUILD_DIR\t_presenceblocking.dll           SHARED_LIB_DIR\t_presenceblocking.dll
+file=ABI_DIR\BUILD_DIR\t_utils.dll                      SHARED_LIB_DIR\t_utils.dll
+file=ABI_DIR\BUILD_DIR\t_presencegrantrequestmngt.dll              SHARED_LIB_DIR\t_presencegrantrequestmngt.dll
+
+//ProcessMaster
+file=ABI_DIR\BUILD_DIR\prfwtestprocessmaster.exe        SHARED_LIB_DIR\prfwtestprocessmaster.exe
+
+#endif //__prfwmrt_iby__
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/tsrc/init/ximpfw_install.pkg	Wed Nov 03 09:32:20 2010 +0530
@@ -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: XIMP Framework Package File
+;
+;Language
+&EN
+
+;Header
+#{"XIMPFramework"}, (0x10282DDC), 1, 0, 0, TYPE=SA
+
+
+;Localised VendorID
+%{"Nokia"}
+
+;VendorID
+:"Nokia"
+
+(0x101F7961), 0, 0, 0, {"Series60ProductID"}
+
+
+;binaries
+"\EPOC32\RELEASE\ARMV5\UDEB\ximpdatamodel.dll"-"!:\sys\bin\ximpdatamodel.dll"
+"\EPOC32\RELEASE\ARMV5\UDEB\ximpoperations.dll"-"!:\sys\bin\ximpoperations.dll"
+"\EPOC32\RELEASE\ARMV5\UDEB\ximpprocessor.dll"-"!:\sys\bin\ximpprocessor.dll"
+"\EPOC32\RELEASE\ARMV5\UDEB\ximpserver.exe"-"!:\sys\bin\ximpserver.exe"
+"\EPOC32\RELEASE\ARMV5\UDEB\ximprootserver.exe"-"!:\sys\bin\ximprootserver.exe"
+"\EPOC32\RELEASE\ARMV5\UDEB\ximpsrvclient.dll"-"!:\sys\bin\ximpsrvclient.dll"
+"\EPOC32\RELEASE\ARMV5\UDEB\ximpmanager.dll"-"!:\sys\bin\ximpmanager.dll"
+"\EPOC32\RELEASE\ARMV5\UDEB\ximpecomhook.dll"-"!:\sys\bin\ximpecomhook.dll"
+"\EPOC32\RELEASE\ARMV5\UDEB\ximputils.dll"-"!:\sys\bin\ximputils.dll"
+"\EPOC32\RELEASE\ARMV5\UDEB\presencemanager.dll"-"!:\sys\bin\presencemanager.dll"
+"\EPOC32\RELEASE\ARMV5\UDEB\presencedatamodel.dll"-"!:\sys\bin\presencedatamodel.dll"
+"\EPOC32\RELEASE\ARMV5\UDEB\presenceoperation.dll"-"!:\sys\bin\presenceoperation.dll"
+"\EPOC32\RELEASE\ARMV5\UDEB\presencedatamodelhook.dll"-"!:\sys\bin\presencedatamodelhook.dll"
+"\EPOC32\RELEASE\ARMV5\UDEB\presenceecomhook.dll"-"!:\sys\bin\presenceecomhook.dll"
+"\EPOC32\RELEASE\ARMV5\UDEB\presencecacheclient.dll"-"!:\sys\bin\presencecacheclient.dll"
+"\EPOC32\RELEASE\ARMV5\UDEB\presencecacheecomhook.dll"-"!:\sys\bin\presencecacheecomhook.dll"
+"\EPOC32\RELEASE\ARMV5\UDEB\presencecacheserver.exe"-"!:\sys\bin\presencecacheserver.exe"
+"\EPOC32\RELEASE\ARMV5\UDEB\immanager.dll"-"!:\sys\bin\immanager.dll"
+"\EPOC32\RELEASE\ARMV5\UDEB\imdatamodel.dll"-"!:\sys\bin\imdatamodel.dll"
+"\EPOC32\RELEASE\ARMV5\UDEB\imoperation.dll"-"!:\sys\bin\imoperation.dll"
+"\EPOC32\RELEASE\ARMV5\UDEB\imdatamodelhook.dll"-"!:\sys\bin\imdatamodelhook.dll"
+"\EPOC32\RELEASE\ARMV5\UDEB\imecomhook.dll"-"!:\sys\bin\imecomhook.dll"
+
+;resources
+"\EPOC32\DATA\Z\Resource\Plugins\ximpecomhook.RSC"-"!:\resource\plugins\ximpecomhook.rsc"
+"\EPOC32\DATA\Z\Resource\Plugins\presenceecomhook.RSC"-"!:\resource\plugins\presenceecomhook.rsc"
+"\EPOC32\DATA\Z\Resource\Plugins\presencedatamodelhook.RSC"-"!:\resource\plugins\presencedatamodelhook.rsc"
+"\EPOC32\DATA\Z\Resource\Plugins\presencecacheecomhook.RSC"-"!:\resource\plugins\presencecacheecomhook.rsc"
+"\EPOC32\DATA\Z\Resource\Plugins\imecomhook.RSC"-"!:\resource\plugins\imecomhook.rsc"
+"\EPOC32\DATA\Z\Resource\Plugins\imdatamodelhook.RSC"-"!:\resource\plugins\imdatamodelhook.rsc"
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/tsrc/init/ximpfw_upgrade.pkg	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,75 @@
+;
+; 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: XIMP Framework Package File
+;
+;
+; Package file for presencefw SIS stub in ROM
+; and a ximp framework upgrade SIS.
+; Including the stub in ROM enables components
+; defined in stub to be updated by SIS installer.
+; When adding or removing components from presencefw
+; please update this pkg file and create an updated
+; stub to group directory.
+;
+; To create SIS stub: makesis -s ximpfw_upgrade.pkg ximpfwstub.sis
+; Copy ximpfwstub.sis to z:\system\install\ximpfwstub.sis
+; or use abld export to export it automatically.
+;
+
+;Language
+&EN
+
+;Header
+#{"PresenceFramework"}, (0x10282DDC), 1, 0, 0, TYPE=PU
+
+
+;Localised VendorID
+%{"Nokia"}
+
+;VendorID
+:"Nokia"
+
+(0x101F7961), 0, 0, 0, {"Series60ProductID"}
+
+
+;binaries
+"\EPOC32\RELEASE\ARMV5\UREL\ximpdatamodel.dll"-"z:\sys\bin\ximpdatamodel.dll"
+"\EPOC32\RELEASE\ARMV5\UREL\ximpoperations.dll"-"z:\sys\bin\ximpoperations.dll"
+"\EPOC32\RELEASE\ARMV5\UREL\ximpprocessor.dll"-"z:\sys\bin\ximpprocessor.dll"
+"\EPOC32\RELEASE\ARMV5\UREL\ximpserver.exe"-"z:\sys\bin\ximpserver.exe"
+"\EPOC32\RELEASE\ARMV5\UREL\ximprootserver.exe"-"z:\sys\bin\ximprootserver.exe"
+"\EPOC32\RELEASE\ARMV5\UREL\ximpsrvclient.dll"-"z:\sys\bin\ximpsrvclient.dll"
+"\EPOC32\RELEASE\ARMV5\UREL\ximpmanager.dll"-"z:\sys\bin\ximpmanager.dll"
+"\EPOC32\RELEASE\ARMV5\UREL\ximpecomhook.dll"-"z:\sys\bin\ximpecomhook.dll"
+"\EPOC32\RELEASE\ARMV5\UREL\ximputils.dll"-"z:\sys\bin\ximputils.dll"
+"\EPOC32\RELEASE\ARMV5\UREL\presencemanager.dll"-"z:\sys\bin\presencemanager.dll"
+"\EPOC32\RELEASE\ARMV5\UREL\presencedatamodel.dll"-"z:\sys\bin\presencedatamodel.dll"
+"\EPOC32\RELEASE\ARMV5\UREL\presenceoperation.dll"-"z:\sys\bin\presenceoperation.dll"
+"\EPOC32\RELEASE\ARMV5\UREL\presencecacheclient.dll"-"z:\sys\bin\presencecacheclient.dll"
+"\EPOC32\RELEASE\ARMV5\UREL\presencecacheecomhook.dll"-"z:\sys\bin\presencecacheecomhook.dll"
+"\EPOC32\RELEASE\ARMV5\UREL\presencecacheserver.exe"-"z:\sys\bin\presencecacheserver.exe"
+"\EPOC32\RELEASE\ARMV5\UREL\immanager.dll"-"z:\sys\bin\immanager.dll"
+"\EPOC32\RELEASE\ARMV5\UREL\imdatamodel.dll"-"z:\sys\bin\imdatamodel.dll"
+"\EPOC32\RELEASE\ARMV5\UREL\imoperation.dll"-"z:\sys\bin\imoperation.dll"
+"\EPOC32\RELEASE\ARMV5\UREL\imdatamodelhook.dll"-"z:\sys\bin\imdatamodelhook.dll"
+"\EPOC32\RELEASE\ARMV5\UREL\imecomhook.dll"-"z:\sys\bin\imecomhook.dll"
+
+;resources
+"\EPOC32\DATA\z\Resource\Plugins\ximpecomhook.RSC"-"z:\resource\plugins\ximpecomhook.rsc"
+"\EPOC32\DATA\z\Resource\Plugins\presenceecomhook.RSC"-"z:\resource\plugins\presenceecomhook.rsc"
+"\EPOC32\DATA\z\Resource\Plugins\presencedatamodelhook.RSC"-"z:\resource\plugins\presencedatamodelhook.rsc"
+"\EPOC32\DATA\z\Resource\Plugins\presencecacheecomhook.RSC"-"z:\resource\plugins\presencecacheecomhook.rsc"
+"\EPOC32\DATA\z\Resource\Plugins\imecomhook.RSC"-"z:\resource\plugins\imecomhook.rsc"
+"\EPOC32\DATA\z\Resource\Plugins\imdatamodelhook.RSC"-"z:\resource\plugins\imdatamodelhook.rsc"
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/tsrc/sis/ximpfw_release_tests.pkg	Wed Nov 03 09:32:20 2010 +0530
@@ -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: XIMP Framewor Test code Package File
+;
+;Header
+#{"XIMPFW ReleaseTests"}, (0x10282DE4), 1, 0, 0
+
+;Language
+&EN
+
+;Localised VendorID
+%{"Nokia"}
+
+;VendorID
+:"Nokia"
+
+
+;Supports Series 60 v 0.9
+(0x101F6F88), 0, 0, 0,
+{"Series60ProductID"}
+
+
+;Needed test protocols and test helpers
+"\EPOC32\RELEASE\ARMV5\UREL\pr_prfwtestprotocol.dll" - "!:\sys\bin\pr_prfwtestprotocol.dll"
+"\EPOC32\DATA\Z\Resource\Plugins\pr_prfwtestprotocol.RSC"-"!:\resource\plugins\pr_prfwtestprotocol.rsc"
+"\EPOC32\RELEASE\ARMV5\UREL\prfwtestcaseutils.dll" - "!:\sys\bin\prfwtestcaseutils.dll"
+
+
+;EUnit test dlls
+"\EPOC32\RELEASE\ARMV5\UREL\t_presenceall.dll" - "!:\sys\bin\t_presenceall.dll"
+"\EPOC32\RELEASE\ARMV5\UREL\t_rootservices.dll" - "!:\sys\bin\t_rootservices.dll"
+"\EPOC32\RELEASE\ARMV5\UREL\t_sessionmng.dll" - "!:\sys\bin\t_sessionmng.dll"
+"\EPOC32\RELEASE\ARMV5\UREL\t_presencepublishing.dll" - "!:\sys\bin\t_presencepublishing.dll"
+"\EPOC32\RELEASE\ARMV5\UREL\t_presencewatching.dll" - "!:\sys\bin\t_presencewatching.dll"
+"\EPOC32\RELEASE\ARMV5\UREL\t_presencegrouplistmngt.dll" - "!:\sys\bin\t_presencegrouplistmngt.dll"
+"\EPOC32\RELEASE\ARMV5\UREL\t_presencegroupmembermngt.dll" - "!:\sys\bin\t_presencegroupmembermngt.dll"
+"\EPOC32\RELEASE\ARMV5\UREL\t_presencewatcherlistmngt.dll" - "!:\sys\bin\t_presencewatcherlistmngt.dll"
+"\EPOC32\RELEASE\ARMV5\UREL\t_presencegrantrequestmngt.dll" - "!:\sys\bin\t_presencegrantrequestmngt.dll"
+"\EPOC32\RELEASE\ARMV5\UREL\t_presenceauthorization.dll" - "!:\sys\bin\t_presenceauthorization.dll"
+"\EPOC32\RELEASE\ARMV5\UREL\t_presenceblocking.dll" - "!:\sys\bin\t_presenceblocking.dll"
+"\EPOC32\RELEASE\ARMV5\UREL\t_utils.dll" - "!:\sys\bin\t_utils.dll"
+
+;ProcessMaster
+"\EPOC32\RELEASE\ARMV5\UREL\prfwtestprocessmaster.exe" - "!:\sys\bin\prfwtestprocessmaster.exe"
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/tsrc/src/t_eunittemplate/bld.inf	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,22 @@
+/*
+* 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 T_EunitTemplate test dll.
+*
+*/
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_TESTMMPFILES
+t_eunittemplate.mmp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/tsrc/src/t_eunittemplate/t_eunittemplate.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -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: XIMP Framework Test Code 
+*
+*/
+
+#include "t_eunittemplate.h"
+#include "eunittools.h"
+#include <eunitmacros.h>
+
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// CONSTRUCTION
+T_EunitTemplate* T_EunitTemplate::NewL()
+    {
+    T_EunitTemplate* self = new( ELeave ) T_EunitTemplate;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+
+    return self;
+    }
+
+
+T_EunitTemplate::~T_EunitTemplate()
+    {
+    }
+
+
+void T_EunitTemplate::ConstructL()
+    {
+    CEUnitTestSuiteClass::ConstructL();
+    }
+
+
+T_EunitTemplate::T_EunitTemplate()
+    {
+    }
+
+
+
+// ===========================================================================
+// TEST CASE SETUP & TEARDOWN METHODS
+// ===========================================================================
+//
+void T_EunitTemplate::Setup_L()
+    {
+    }
+
+
+
+void T_EunitTemplate::Teardown()
+    {
+    }
+
+
+
+// ===========================================================================
+// TODO: Test case description & grouping
+// ===========================================================================
+//
+void T_EunitTemplate::TestSomething_L()
+    {
+    EUNIT_ASSERT( EFalse );
+    }
+
+
+
+
+// ===========================================================================
+// TEST CASE TABLE
+// ===========================================================================
+//
+EUNIT_BEGIN_TEST_TABLE(
+    T_EunitTemplate,
+    "Add test suite description here.",
+    "MODULE" )
+
+    PRFW_NOT_DECORATED_TEST(
+        "Empty test skeleton",
+        "Add tested class name here",
+        "Add tested function names here",
+        "FUNCTIONALITY ERRORHANDLING BOUNDARY",
+        Setup_L,
+        TestSomething_L,
+        Teardown )
+
+
+EUNIT_END_TEST_TABLE
+
+
+
+
+
+// ===========================================================================
+// TEST SUITE CONSTRUCTION
+// ===========================================================================
+//
+EXPORT_C MEUnitTest* CreateTestSuiteL()
+    {
+    return T_EunitTemplate::NewL();
+    }
+
+
+// end of file
+
+
+
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/tsrc/src/t_eunittemplate/t_eunittemplate.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,96 @@
+/*
+* 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: XIMP Framework Test Code 
+*
+*/
+
+#ifndef T_EUNITTEMPLATE_H
+#define T_EUNITTEMPLATE_H
+
+#include <ceunittestsuiteclass.h>
+
+
+
+
+
+/**
+ * XIMP Framework Eunit tests.
+ *
+ * TODO: Add test description here.
+ *
+ * @since S60 v4.0
+ */
+class T_EunitTemplate : public CEUnitTestSuiteClass
+    {
+
+public:
+
+    /**  ?description */
+    //enum ?declaration
+
+    /**  ?description */
+    //typedef ?declaration
+
+    static T_EunitTemplate* NewL();
+    virtual ~T_EunitTemplate();
+
+private:
+
+    T_EunitTemplate();
+    void ConstructL();
+
+
+
+private:    // Test case functions
+
+    void Setup_L();
+    void Teardown();
+
+    void TestSomething_L();
+
+
+
+private:    // Test helpers
+
+
+
+
+
+private: // Test data
+
+
+    /**
+     * Eunit test case table declaration.
+     */
+    EUNIT_DECLARE_TEST_TABLE;
+
+
+    /**
+     *
+     * Own. / Not own.
+     */
+    //?type* ?member_name;
+
+    };
+
+
+#endif      //  T_EUNITTEMPLATE_H
+
+
+
+// end of file
+
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/tsrc/src/t_eunittemplate/t_eunittemplate.mmp	Wed Nov 03 09:32:20 2010 +0530
@@ -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: XIMP Framework Test Code 
+*
+*/
+
+#include "../../tsrcutils/eunitcommon/eunittstdllbase.mmh"
+
+TARGET                  t_eunittemplate.dll
+
+
+SOURCEPATH              .
+SOURCE                  t_eunittemplate.cpp
+
+
+
+// Dependencies to system components
+//LIBRARY
+
+
+
+// end of file
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/tsrc/src/t_presenceall/bld.inf	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,25 @@
+/*
+* 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 t_presenceall.dll
+*
+*/
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+PRJ_TESTMMPFILES
+t_presenceall.mmp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/tsrc/src/t_presenceall/t_presenceall.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,1001 @@
+/*
+* 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: XIMP Framework Test Code 
+*
+*/
+
+
+#include "eunittools.h"
+
+
+#include <platform/digia/eunit/eunitmacros.h>
+#include <platform/digia/eunit/teunitassertioninfo.h>
+#include <ecom/ecom.h>
+#include <badesca.h>
+
+#include <ximpbase.h>
+#include <ximpclient.h>
+#include <ximpcontext.h>
+#include <ximpcontextstateevent.h>
+#include <ximprequestcompleteevent.h>
+#include <ximpstatus.h>
+#include <presencefeatures.h>
+#include <presencewatching.h>
+#include <presencepublishing.h>
+#include <presentitypresenceevent.h>
+#include <ximpobjectfactory.h>
+
+#include <presentitygroups.h>
+#include <presentitygroupinfo.h>
+#include <presentitygrouplistevent.h>
+
+
+#include <presentitygroups.h>
+#include <presentitygroupmemberinfo.h>
+#include <presentitygroupcontentevent.h>
+
+#include <presenceauthorization.h>
+#include <presenceblocklistevent.h>
+#include <presenceblockinfo.h>
+
+#include "t_presenceall.h"
+#include "prfwteststatuseventlistener.h"
+#include "prfwtestmessaging.h"
+#include "prfwtestmessenger.h"
+#include "prfwtestcontextwrappermgr.h"
+#include "prfwtestcontextwrapper.h"
+
+#include "presenceinfoimp.h"
+#include "presenceinfofilterimp.h"
+#include "prfwtestpresencedatautils.h"
+#include "ximpidentityimp.h"
+#include "presentitygroupmemberinfoimp.h"
+#include "ximpobjecthelpers.h"
+#include "prfwtestfilesrvmsg.h"
+#include "prfwtestwaithelper.h"
+#include "prfwtestlistener.h"
+
+
+#include "presentitygroupcontenteventimp.h"
+#include "ximprequestcompleteeventimp.h"
+#include "presentitygroupinfoimp.h"
+#include "presentitygrouplisteventimp.h"
+#include "presentitygroupmemberinfoimp.h"
+#include "ximprequestcompleteeventimp.h"
+#include "ximprestrictedobjectcollection.h"
+#include "ximpobjectfactoryimp.h"
+
+#include "prfwtesteventfactory.h"
+
+#include "prfwtestpresencedatautils.h"
+
+#include "ximpobjecthelpers.h"
+#include "presentitygroupinfoimp.h"
+#include "presentitygrouplisteventimp.h"
+#include "presentitygroupcontenteventimp.h"
+
+#include "prfwtestfiletool.h"
+
+
+#include "prfwtestrobustnesstools.h"
+
+_LIT8( KPrefix1, "PreA_" );
+_LIT8( KPrefix2, "PreB_" );
+_LIT8( KPrefix3, "PreC_" );
+_LIT8( KPrefix4, "PreD_" );
+
+_LIT( KPrefix5, "PreXX_" );
+_LIT( KPrefix6, "PreYY_" );
+
+_LIT( KIdentity, "TestId@hello.world" );
+
+
+_LIT( KMemberId1, "tel:user1@foo.bar" );
+_LIT( KMemberDisplayName1,  "user1" );
+
+_LIT( KMemberId2, "tel:user2@foo.bar" );
+_LIT( KMemberDisplayName2,  "user2" );
+
+_LIT( KGroupId, "PrsDemoGrp" );
+_LIT( KGroupDisplayName,  "demo group" );
+
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// CONSTRUCTION
+T_PresenceAll* T_PresenceAll::NewL()
+    {
+    T_PresenceAll* self = new( ELeave ) T_PresenceAll;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+
+    return self;
+    }
+
+
+T_PresenceAll::~T_PresenceAll()
+    {
+    }
+
+
+void T_PresenceAll::ConstructL()
+    {
+    CEUnitTestSuiteClass::ConstructL();
+    }
+
+
+T_PresenceAll::T_PresenceAll()
+    {
+    }
+
+
+
+// ===========================================================================
+// TEST CASE SETUP & TEARDOWN METHODS
+// ===========================================================================
+//
+
+void T_PresenceAll::Setup_L()
+    {
+    __UHEAP_MARK;
+    PrfwTestRobustness::DoPreCleaning();
+
+    iWrapperMgr = CXIMPTestContextWrapperMgr::NewL();
+    iWrapperMgr->CreateWrapperL();
+    }
+
+void T_PresenceAll::SetupMultiple_L()
+    {
+    PrfwTestRobustness::DoPreCleaning();
+
+    iWrapperMgr = CXIMPTestContextWrapperMgr::NewL();
+    iWrapperMgr->CreateWrapperL();
+    iWrapperMgr->CreateWrapperL();
+    iWrapperMgr->CreateWrapperL();
+    }
+
+
+void T_PresenceAll::BindL()
+    {
+    CXIMPTestContextWrapper* wrapper0 = iWrapperMgr->GetWrapperL( 0 );
+
+    wrapper0->BindL( 0 );
+    }
+
+void T_PresenceAll::BindAllL()
+    {
+    for( TInt a = 0; a < iWrapperMgr->WrapperCount(); ++a )
+        {
+        CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a );
+        wrapper->BindL( 0 );
+        }
+    }
+
+
+void T_PresenceAll::Teardown()
+    {
+    delete iWrapperMgr;
+    iWrapperMgr = NULL;
+
+    REComSession::FinalClose();
+
+    PrfwTestRobustness::DoPreCleaning();
+    User::SetJustInTime( ETrue );
+    __UHEAP_MARKEND;
+    }
+
+void T_PresenceAll::UnbindL()
+    {
+    // Do unbind
+    CXIMPTestContextWrapper* wrapper0 = iWrapperMgr->GetWrapperL( 0 );
+    wrapper0->UnbindL();
+    }
+
+void T_PresenceAll::UnbindAllL()
+    {
+    for( TInt a = 0; a < iWrapperMgr->WrapperCount(); ++a )
+        {
+        CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a );
+        wrapper->UnbindL();
+        }
+    }
+
+
+// ===========================================================================
+// TEST CASES for presentity presence subscription
+// ===========================================================================
+
+// Jani
+void T_PresenceAll::T_TMO_demo_Startup_L()
+    {
+    EUNIT_PRINT( _L("T_TMO_demo_Startup_L") );
+
+    BindL();
+
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    MXIMPContext* context = wrapper->GetContext();
+    CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+    // Tell the protocol it should act normally
+    messenger->SetNoError();
+    
+        
+    // Get the interfaces
+    MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+    MPresencePublishing& presPub = presFeat->PresencePublishing();
+    MPresenceAuthorization& presAuth = presFeat->PresenceAuthorization();
+    MPresentityGroups& presGroup = presFeat->PresentityGroups();
+    MPresenceWatching& presWatch = presFeat->PresenceWatching();
+    
+    
+    
+    //////////////////////////////////////////////////////////////////////////
+    // SUBSCRIBE OWN PRESENCE
+    //////////////////////////////////////////////////////////////////////////
+
+    // Create own presence info filter
+    CPresenceInfoFilterImp* ownPif = CPresenceInfoFilterImp::NewLC(); // << ownPif
+    ownPif->AcceptPersonFilterL( NPresenceInfo::NFieldType::KAcceptAll );
+    //ownPif->AcceptPersonFilterL( NPresenceInfo::NFieldType::KStatusMessage );
+    //ownPif->AcceptPersonFilterL( NPresenceInfo::NFieldType::KAvatar );
+
+    // Setup status event listener for RequestComplete
+    SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk );
+
+    // subscribe own presence
+    TXIMPRequestId reqId = presPub.SubscribeOwnPresenceL( *ownPif );
+    
+    // Wait for events on the request
+    wrapper->WaitRequestAndStackEvents( reqId );
+    wrapper->VerifyEventStackL( _L8("Subscribing own presence, complete with error: ") );
+
+    // verify that SubscribeOwnPresenceL was called
+    COMMONASSERT( messenger, EXIMPPlgTestSubscribeOwnPresenceCalled, "SubscribeOwnPresenceL was not called", ETrue, NULL );
+    
+    //////////////////////////////////////////////////////////////////////////
+    // SUBSCRIBE PRESENCE WATCHER LIST
+    //////////////////////////////////////////////////////////////////////////
+
+    // Setup status event listener for RequestComplete
+    SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk );
+
+    // subscribe
+    reqId = presPub.SubscribePresenceWatcherListL();
+    
+    // Wait for events on the request
+    wrapper->WaitRequestAndStackEvents( reqId );
+    wrapper->VerifyEventStackL( _L8("Subscribing presence watcher list, complete with error: ") );
+
+    COMMONASSERT( messenger, EXIMPPlgTestSubscribePresenceWatcherListCalled, "SubscribeWatcherListL was not called", ETrue, NULL );
+    
+
+    //////////////////////////////////////////////////////////////////////////
+    // SUBSCRIBE PRESENCE BLOCK LIST
+    //////////////////////////////////////////////////////////////////////////
+
+    // Setup status event listener for RequestComplete
+    SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk );
+
+    // subscribe
+    reqId = presAuth.SubscribePresenceBlockListL();
+    
+    // Wait for events on the request
+    wrapper->WaitRequestAndStackEvents( reqId );
+    wrapper->VerifyEventStackL( _L8("Subscribing presence watcher list, complete with error: ") );
+
+    // verify that SubscribeBlockListL was called
+    COMMONASSERT( messenger, EXIMPPlgTestSubscribePresenceBlockListCalled, "SubscribeBlockListL was not called", ETrue, NULL );
+    
+
+    
+    //////////////////////////////////////////////////////////////////////////
+    // SUBSCRIBE PRESENTITY GROUP LIST
+    //////////////////////////////////////////////////////////////////////////
+    
+    // Setup status event listener for RequestComplete
+    SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk );
+
+    // subscribe
+    reqId = presGroup.SubscribePresentityGroupListL();
+    
+    // Wait for events on the request
+    wrapper->WaitRequestAndStackEvents( reqId );
+    wrapper->VerifyEventStackL( _L8("Subscribing presentity group list, complete with error: ") );
+    
+    // verify that SubscribePresentityGroupListL was called
+    messenger->AssertSubscribePresentityGroupListCalled( ETrue );
+    
+    
+    //////////////////////////////////////////////////////////////////////////
+    // EMPTY GROUP LIST EVENT
+    /////////////////////////////////////////////////////////////////////////
+    // According to design, this should not be called
+    // because the group list is empty, this can be removed
+    // Create help listener
+
+/*    CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context );
+    CleanupStack::PushL( listener2 );    // << listener2    
+    
+    // Create faked server message about group list
+    SendSrvMsgL( CXIMPTestFileSrvMsg::ETestSrvMsgPresentityGroupList );
+
+    // expect empty MPresentityGroupList event.
+    CPresentityGroupListEventImp* event = XIMPTestEventFactory::CreateGroupListEventLCX(
+            KNullDesC, KNullDesC,
+            XIMPTestEventFactory::ETestPGLEmpty,
+            KNullDesC, KNullDesC,
+            MXIMPDataSubscriptionState::ESubscriptionActive,
+            MXIMPDataSubscriptionState::EDataAvailable
+            );
+
+    listener2->ExpectL( event );
+    CleanupStack::Pop( event ); // 4 more items in cleanupstack
+
+    EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "HandlePresentityGroupListL failed" );
+    CleanupStack::PopAndDestroy( 4 ); // lists
+    CleanupStack::PopAndDestroy( listener2 );   // >>> listener2
+
+*/        
+    //////////////////////////////////////////////////////////////////////////
+    // CREATE PRESENTITY GROUP
+    /////////////////////////////////////////////////////////////////////////
+    
+    // Setup status event listener for RequestComplete
+    // This will also produce HandlePresentityGroupListEvent, since the
+    // the group is subscribed
+    SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk );
+
+
+    MXIMPIdentity* groupId = context->ObjectFactory().NewIdentityLC();
+    CleanupStack::Pop(); // groupId
+    groupId->SetIdentityL( KGroupId );
+    
+    // subscribe
+    reqId = presGroup.CreatePresentityGroupL( *groupId, KGroupDisplayName );
+    
+    // Wait for events on the request
+    wrapper->WaitRequestAndStackEvents( reqId );
+    wrapper->VerifyEventStackL( _L8("CreatePresentityGroupL failed, complete with error: ") );
+    
+    // verify that SubscribePresentityGroupListL was called
+    messenger->AssertCreatePresentityGroupCalled( ETrue );
+
+    
+  
+    //////////////////////////////////////////////////////////////////////////
+    // ADD PRESENTITY GROUP MEMBER
+    ////////////////////////////////////////////////////////////////////////// 
+    
+    CXIMPTestListener* listener4 = CXIMPTestListener::NewL( context );
+    CleanupStack::PushL( listener4 );    // << listener4
+    
+    MXIMPIdentity* member = context->ObjectFactory().NewIdentityLC(); // << member
+    member->SetIdentityL( KMemberId1 );
+
+
+    // request complete
+    TXIMPRequestId reqIdDummy;
+    CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+
+    // group id
+    CXIMPIdentityImp* identity2 = CXIMPIdentityImp::NewLC( groupId->Identity() );
+    evReqComplete->AppendParamL( identity2 );
+    CleanupStack::Pop(identity2); // identity2
+
+    // id for member info
+    CXIMPIdentityImp* miId = CXIMPIdentityImp::NewLC( KMemberId1 );
+    // member info
+    CPresentityGroupMemberInfoImp* memInfoImp =
+        CPresentityGroupMemberInfoImp::NewLC( *miId, KMemberDisplayName1 );
+    evReqComplete->AppendParamL( memInfoImp );
+    CleanupStack::Pop(memInfoImp); // memInfoImp owned by AppendParamL
+    CleanupStack::PopAndDestroy( miId ); // copy was made
+
+    listener4->ExpectL( evReqComplete );
+    CleanupStack::Pop( evReqComplete );
+
+    // do the call
+    reqId = presGroup.AddPresentityGroupMemberL(
+            *groupId, *member, KMemberDisplayName1 );
+
+    // and wait
+    EUNIT_ASSERT_DESC( KErrNone == listener4->WaitAndAssertL(), "AddPresentityGroupMemberL (not subscribed) failed" );
+
+    messenger->AssertAddPresentityGroupMemberCalled( ETrue );
+    CleanupStack::PopAndDestroy(); // >>> member
+    CleanupStack::PopAndDestroy( listener4 );// >>> listener4
+
+
+    //////////////////////////////////////////////////////////////////////////
+    // SUBSCRIBE PRESENTITY GROUP CONTENT
+    //////////////////////////////////////////////////////////////////////////    
+
+    // Setup status event listener for RequestComplete
+    SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk );
+    
+    // subscribe group content
+    MXIMPIdentity* identity = context->ObjectFactory().NewIdentityLC();
+    identity->SetIdentityL( KGroupId ); // << identity
+
+    reqId = presGroup.SubscribePresentityGroupContentL( *identity );
+    
+    // Wait for events on the request
+    wrapper->WaitRequestAndStackEvents( reqId );
+    wrapper->VerifyEventStackL( _L8("Subscribe presentity group content, complete with error: ") );
+
+    COMMONASSERT( messenger, EXIMPPlgTestSubscribePresentityGroupContentCalled, "SubscribeGroupContentL was not called", ETrue, NULL );
+    
+    //////////////////////////////////////////////////////////////////////////
+    // SUBSCRIBE PRESENTITY GROUP MEMBERS PRESENCE
+    ////////////////////////////////////////////////////////////////////////// 
+        
+    // Setup status event listener for RequestComplete
+    SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk );
+
+    // This is the group we are interested in
+    MXIMPIdentity* group = context->ObjectFactory().NewIdentityLC();
+    CleanupStack::Pop(); // group
+    group->SetIdentityL( KGroupId );
+    // Set filter for the group
+    //CPresenceInfoFilterImp* gpif = CPresenceInfoFilterImp::NewLC();
+    //gpif->AcceptPersonFilterL( NPresenceInfo::NFieldType::KStatusMessage  );
+    //gpif->AcceptPersonFilterL( NPresenceInfo::NFieldType::KAvatar );
+    
+    
+    
+    CPresenceInfoFilterImp* gpif =
+                XIMPTestPresenceDataUtils::GenerateInfoFilterLC( &KPrefix1 );
+    
+    CleanupStack::Pop(gpif); // gpif
+
+    // register interest
+    reqId = presWatch.SubscribePresentityGroupMembersPresenceL( *group, *gpif );
+
+    // Wait for events on the request
+    wrapper->WaitRequestAndStackEvents( reqId );
+    wrapper->VerifyEventStackL( _L8("Subscribe presentity group members, complete with error: ") );
+        
+    // verify that UpdateInterest was called
+    COMMONASSERT( messenger, EXIMPPlgTestSubscribePresentityGroupMembersPresesenceCalled, "SubscribePresentityGroupMembersPresenceL was not called", ETrue, NULL );
+
+    delete gpif;
+
+    
+    //////////////////////////////////////////////////////////////////////////
+    // ADD PRESENTITY GROUP MEMBER, GROUP CONTENT SUBSCRIBED
+    ////////////////////////////////////////////////////////////////////////// 
+    
+    // Setup status event listener for RequestComplete
+    // This will also produce HandlePresentityGroupMemberAddedL, since the
+    // the group is subscribed
+    SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk );
+    
+    MXIMPIdentity* member2 = context->ObjectFactory().NewIdentityLC(); // << member2
+    member2->SetIdentityL( KMemberId2 );
+
+    // do the call
+    reqId = presGroup.AddPresentityGroupMemberL(
+            *groupId, *member2, KMemberDisplayName2 );
+            
+    // Wait for events on the request
+    wrapper->WaitRequestAndStackEvents( reqId );
+    wrapper->VerifyEventStackL( _L8("AddPresentityGroupMemberL (subscribed) failed, complete with error: ") );
+
+
+    messenger->AssertAddPresentityGroupMemberCalled( ETrue );
+    CleanupStack::PopAndDestroy(); // >>> member2
+
+
+   
+    //////////////////////////////////////////////////////////////////////////
+    // GRANT PRESENTITY GROUP MEMBER
+    //////////////////////////////////////////////////////////////////////////
+
+    // This is the group we are interested in
+    MXIMPIdentity* ggroup = context->ObjectFactory().NewIdentityLC();
+    CleanupStack::Pop(); // ggroup
+    ggroup->SetIdentityL( KGroupId );
+    // Set filter for the group
+    CPresenceInfoFilterImp* ggpif = CPresenceInfoFilterImp::NewLC();
+    //ggpif->AcceptPersonFilterL( NPresenceInfo::NFieldType::KAcceptAll  );
+    CleanupStack::Pop(); // ggpif
+
+    // Setup status event listener for RequestComplete
+    SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk );
+
+    // grant for all
+    reqId = presAuth.GrantPresenceForPresentityGroupMembersL( *ggroup, *ggpif );
+
+    // Wait for events on the request
+    wrapper->WaitRequestAndStackEvents( reqId );
+    
+    // verify that UpdateInterest was called
+    COMMONASSERT( messenger, EXIMPPlgTestGrantPresenceForPresentityGroupMembersCalled, 
+        "GrantPresenceForPresentityGroupMembersL was not called", ETrue, NULL );
+        
+    delete ggpif;    
+
+
+    //////////////////////////////////////////////////////////////////////////
+    // WITHDRAW PRESENTITY GROUP MEMBER
+    //////////////////////////////////////////////////////////////////////////
+
+
+    // Setup status event listener for RequestComplete
+    SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk );
+
+    // withdraw from all
+    reqId = presAuth.WithdrawPresenceGrantFromPresentityGroupMembersL( *ggroup );
+
+    // Wait for events on the request
+    wrapper->WaitRequestAndStackEvents( reqId );
+    // verify that UpdateInterest was called
+    COMMONASSERT( messenger, EXIMPPlgTestGrantPresenceForPresentityGroupMembersCalled, 
+        "GrantPresenceForPresentityGroupMembersL was not called", ETrue, NULL );
+    
+    delete ggroup;
+            
+
+    //////////////////////////////////////////////////////////////////////////
+    // UNSUBSCRIBE PRESENTITY GROUP MEMBERS
+    ////////////////////////////////////////////////////////////////////////// 
+        
+    // Setup status event listener for RequestComplete
+    SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk );
+
+    // unregister interest
+    reqId = presWatch.UnsubscribePresentityGroupMembersPresenceL( *group );
+
+    // Wait for events on the request
+    wrapper->WaitRequestAndStackEvents( reqId );
+    wrapper->VerifyEventStackL( _L8("Unsubscribe presentity group members, complete with error: ") );
+        
+    // verify that UpdateInterest was called
+    COMMONASSERT( messenger, EXIMPPlgTestUnsubscribePresentityGroupMembersPresesenceCalled, "UnsubscribePresentityGroupMembersPresenceL was not called", ETrue, NULL );
+
+
+    
+    //////////////////////////////////////////////////////////////////////////
+    // UNSUBSCRIBE PRESENTITY GROUP CONTENT
+    ////////////////////////////////////////////////////////////////////////// 
+    
+    // Setup status event listener for RequestComplete
+    SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk );
+    
+    // unsubscribe
+    reqId = presGroup.UnsubscribePresentityGroupContentL( *identity );
+        
+    // Wait for events on the request
+    wrapper->WaitRequestAndStackEvents( reqId );
+    wrapper->VerifyEventStackL( _L8("Unsubscribe presentity group content, complete with error: ") );
+
+    // verify that UnsubscribePresentityGroupContentL was called
+    messenger->AssertUnsubscribePresentityGroupContentCalled( ETrue );
+    
+    CleanupStack::PopAndDestroy(); // >>> identity
+
+    //////////////////////////////////////////////////////////////////////////
+    // UNSUBSCRIBE PRESENCE BLOCK LIST
+    //////////////////////////////////////////////////////////////////////////
+
+    // Setup status event listener for RequestComplete
+    SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk );
+
+    // subscribe
+    reqId = presAuth.UnsubscribePresenceBlockListL();
+    
+    // Wait for events on the request
+    wrapper->WaitRequestAndStackEvents( reqId );
+    wrapper->VerifyEventStackL( _L8("Unsubscribing presence watcher list, complete with error: ") );
+
+    // verify that SubscribeBlockListL was called
+    COMMONASSERT( messenger, EXIMPPlgTestUnsubscribePresenceBlockListCalled, "UnubscribeBlockListL was not called", ETrue, NULL );
+    
+    //////////////////////////////////////////////////////////////////////////
+    // UNSUBSCRIBE PRESENTITY GROUP LIST
+    //////////////////////////////////////////////////////////////////////////
+    
+    // Setup status event listener for RequestComplete
+    SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk );
+
+    // unsubscribe
+    reqId = presGroup.UnsubscribePresentityGroupListL();
+    
+    // Wait for events on the request
+    wrapper->WaitRequestAndStackEvents( reqId );
+    wrapper->VerifyEventStackL( _L8("Unsubscribing presentity group list, complete with error: ") );
+    
+    // verify that SubscribePresentityGroupListL was called
+    messenger->AssertUnsubscribePresentityGroupListCalled( ETrue );
+   
+
+    //////////////////////////////////////////////////////////////////////////
+    // UNSUBSCRIBE PRESENCE WATCHER LIST
+    //////////////////////////////////////////////////////////////////////////
+
+    // Setup status event listener for RequestComplete
+    SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk );
+
+    // unsubscribe
+    reqId = presPub.UnsubscribePresenceWatcherListL();
+
+    // Wait for events on the request
+    wrapper->WaitRequestAndStackEvents( reqId );
+    wrapper->VerifyEventStackL( _L8("Unsubscribing presence watcher list, complete with error: ") );
+
+    // verify that UnsubscribeWatcherListL was called
+    COMMONASSERT( messenger, EXIMPPlgTestUnsubscribePresenceWatcherListCalled, "UnsubscribeWatcherListL was not called", ETrue, NULL );
+
+
+    ////////////////////////////////////////////////////////////////////////////
+    // UNSUBSCRIBE OWN PRESENCE
+    ////////////////////////////////////////////////////////////////////////////
+    // Setup status event listener for RequestComplete
+    SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk );    
+    
+    // unsubscribe own presence
+    reqId = presPub.UnsubscribeOwnPresenceL();
+    
+    // Wait for events on the request
+    wrapper->WaitRequestAndStackEvents( reqId );
+    
+    wrapper->VerifyEventStackL( _L8("Unsubscribing own presence, complete with error: ") );
+        
+    // verify that UnsubscribeOwnPresenceL was called
+    COMMONASSERT( messenger, EXIMPPlgTestUnsubscribeOwnPresenceCalled, "UnsubscribeOwnPresenceL was not called", ETrue, NULL );
+
+    CleanupStack::PopAndDestroy( ownPif ); // >>> ownPif
+    delete group;
+    delete groupId;
+   
+
+    UnbindL();
+    
+    wrapper = NULL;
+    context = NULL;
+    messenger = NULL;
+    
+
+
+    }
+
+// Grant/Withdraw from group
+void T_PresenceAll::T_GrantWithdrawGroup_L()
+    {
+    EUNIT_PRINT( _L("T_GrantWithdrawGroup_L") );
+
+    BindL();
+
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    MXIMPContext* context = wrapper->GetContext();
+    CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+    // Tell the protocol it should act normally
+    messenger->SetNoError();
+    
+        
+    // Get the interfaces
+    MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+    MPresencePublishing& presPub = presFeat->PresencePublishing();
+    MPresenceAuthorization& presAuth = presFeat->PresenceAuthorization();
+    MPresentityGroups& presGroup = presFeat->PresentityGroups();
+    MPresenceWatching& presWatch = presFeat->PresenceWatching();
+    
+    
+    
+    //////////////////////////////////////////////////////////////////////////
+    // CREATE PRESENTITY GROUP
+    /////////////////////////////////////////////////////////////////////////
+    
+    // Setup status event listener for RequestComplete
+    // This will also produce HandlePresentityGroupListEvent, since the
+    // the group is subscribed
+    SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk );
+
+
+    MXIMPIdentity* groupId = context->ObjectFactory().NewIdentityLC();
+    CleanupStack::Pop(); // groupId
+    groupId->SetIdentityL( KGroupId );
+    
+    // subscribe
+    TXIMPRequestId reqId = presGroup.CreatePresentityGroupL( *groupId, KGroupDisplayName );
+    
+    // Wait for events on the request
+    wrapper->WaitRequestAndStackEvents( reqId );
+    wrapper->VerifyEventStackL( _L8("CreatePresentityGroupL failed, complete with error: ") );
+    
+    // verify that SubscribePresentityGroupListL was called
+    messenger->AssertCreatePresentityGroupCalled( ETrue );
+
+    
+  
+    //////////////////////////////////////////////////////////////////////////
+    // ADD PRESENTITY GROUP MEMBER
+    ////////////////////////////////////////////////////////////////////////// 
+    
+    CXIMPTestListener* listener4 = CXIMPTestListener::NewL( context );
+    CleanupStack::PushL( listener4 );    // << listener4
+    
+    MXIMPIdentity* member = context->ObjectFactory().NewIdentityLC(); // << member
+    member->SetIdentityL( KMemberId1 );
+
+
+    // request complete
+    TXIMPRequestId reqIdDummy;
+    CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+
+    // group id
+    CXIMPIdentityImp* identity2 = CXIMPIdentityImp::NewLC( groupId->Identity() );
+    evReqComplete->AppendParamL( identity2 );
+    CleanupStack::Pop(); // identity2
+
+    // id for member info
+    CXIMPIdentityImp* miId = CXIMPIdentityImp::NewLC( KMemberId1 );
+    // member info
+    CPresentityGroupMemberInfoImp* memInfoImp =
+        CPresentityGroupMemberInfoImp::NewLC( *miId, KMemberDisplayName1 );
+    evReqComplete->AppendParamL( memInfoImp );
+    CleanupStack::Pop(); // memInfoImp owned by AppendParamL
+    CleanupStack::PopAndDestroy( miId ); // copy was made
+
+    listener4->ExpectL( evReqComplete );
+    CleanupStack::Pop( evReqComplete );
+
+    // do the call
+    reqId = presGroup.AddPresentityGroupMemberL(
+            *groupId, *member, KMemberDisplayName1 );
+
+    // and wait
+    EUNIT_ASSERT_DESC( KErrNone == listener4->WaitAndAssertL(), "AddPresentityGroupMemberL (not subscribed) failed" );
+
+    messenger->AssertAddPresentityGroupMemberCalled( ETrue );
+    CleanupStack::PopAndDestroy(); // >>> member
+    CleanupStack::PopAndDestroy( listener4 );// >>> listener4
+    
+    delete groupId;
+
+    //////////////////////////////////////////////////////////////////////////
+    // ADD PRESENTITY GROUP MEMBER, GROUP CONTENT SUBSCRIBED
+    ////////////////////////////////////////////////////////////////////////// 
+    
+    // Setup status event listener for RequestComplete
+    // This will also produce HandlePresentityGroupMemberAddedL, since the
+    // the group is subscribed
+    SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk );
+    
+    MXIMPIdentity* member2 = context->ObjectFactory().NewIdentityLC(); // << member2
+    member2->SetIdentityL( KMemberId2 );
+
+    // do the call
+    reqId = presGroup.AddPresentityGroupMemberL(
+            *groupId, *member2, KMemberDisplayName2 );
+            
+    // Wait for events on the request
+    wrapper->WaitRequestAndStackEvents( reqId );
+    wrapper->VerifyEventStackL( _L8("AddPresentityGroupMemberL (subscribed) failed, complete with error: ") );
+
+
+    messenger->AssertAddPresentityGroupMemberCalled( ETrue );
+    CleanupStack::PopAndDestroy(); // >>> member2
+
+
+   
+    //////////////////////////////////////////////////////////////////////////
+    // GRANT PRESENTITY GROUP MEMBER
+    //////////////////////////////////////////////////////////////////////////
+
+    // This is the group we are interested in
+    MXIMPIdentity* ggroup = context->ObjectFactory().NewIdentityLC();
+    CleanupStack::Pop(); // ggroup
+    ggroup->SetIdentityL( KGroupId );
+    // Set filter for the group
+    CPresenceInfoFilterImp* ggpif = CPresenceInfoFilterImp::NewLC();
+    ggpif->AcceptPersonFilterL( NPresenceInfo::NFieldType::KAcceptAll  );
+    CleanupStack::Pop(); // ggpif
+
+    // Setup status event listener for RequestComplete
+    SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk );
+
+    // grant for all
+    reqId = presAuth.GrantPresenceForPresentityGroupMembersL( *ggroup, *ggpif );
+
+    // Wait for events on the request
+    wrapper->WaitRequestAndStackEvents( reqId );
+    
+    // verify that UpdateInterest was called
+    COMMONASSERT( messenger, EXIMPPlgTestGrantPresenceForPresentityGroupMembersCalled, 
+        "GrantPresenceForPresentityGroupMembersL was not called", ETrue, NULL );
+    
+    delete ggpif;
+    
+
+
+    //////////////////////////////////////////////////////////////////////////
+    // WITHDRAW PRESENTITY GROUP MEMBER
+    //////////////////////////////////////////////////////////////////////////
+
+
+    // Setup status event listener for RequestComplete
+    SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk );
+
+    // withdraw from all
+    reqId = presAuth.WithdrawPresenceGrantFromPresentityGroupMembersL( *ggroup );
+
+    // Wait for events on the request
+    wrapper->WaitRequestAndStackEvents( reqId );
+    // verify that UpdateInterest was called
+    COMMONASSERT( messenger, EXIMPPlgTestGrantPresenceForPresentityGroupMembersCalled, 
+        "GrantPresenceForPresentityGroupMembersL was not called", ETrue, NULL );
+    
+    delete ggroup;        
+
+    UnbindL();
+    
+    wrapper = NULL;
+    context = NULL;
+    messenger = NULL;
+
+    }
+
+
+// ===========================================================================
+// SETUP HELPERS FOR THE LISTENER
+// ===========================================================================
+//
+void T_PresenceAll::SetupListenerReqCompleteL( CXIMPTestContextWrapper* aWrapper, TXIMPTestStatusEventTemplate aEventType )
+    {
+    RArray< TInt32 > array;
+    CleanupClosePushL( array );
+    array.Append( MXIMPContextStateEvent::KInterfaceId );
+    array.Append( MPresentityPresenceEvent::KInterfaceId );
+    aWrapper->SetupListenerReqCompleteL( aEventType, &array );
+    CleanupStack::PopAndDestroy(); // array
+    }
+
+void T_PresenceAll::SetupListenerReqCompleteAllowEventsL(  CXIMPTestContextWrapper* aWrapper, TXIMPTestStatusEventTemplate aEventType )
+    {
+    RArray< TInt32 > array;
+    CleanupClosePushL( array );
+    array.AppendL( MXIMPRequestCompleteEvent::KInterfaceId );
+    array.AppendL( MXIMPContextStateEvent::KInterfaceId );
+    array.AppendL( MPresentityPresenceEvent::KInterfaceId );
+    aWrapper->SetupListenerReqCompleteL( aEventType, &array );
+    CleanupStack::PopAndDestroy(); // array
+    }
+
+void T_PresenceAll::SendSrvMsgL(
+        const TDesC& aUri, const TDesC& aDispName,
+        TInt aMsgType )
+    {
+    // we'll use hard-coded wrapper 0 instance for now.
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+
+    // create a group info contained within the server-originated
+    // faked message
+    CXIMPIdentityImp* groupId = CXIMPIdentityImp::NewLC( aUri );
+    CPresentityGroupInfoImp* groupItem = CPresentityGroupInfoImp::NewLC( *groupId, aDispName );
+    HBufC8* packet = NULL;
+    if( aMsgType == CXIMPTestFileSrvMsg::ETestSrvMsgPresentityGroupDelete )
+        {
+        packet = TXIMPObjectPacker< CXIMPIdentityImp >::PackL( *groupId );        
+        }
+    else
+        {
+        packet = TXIMPObjectPacker< CPresentityGroupInfoImp >::PackL( *groupItem );        
+        }
+    CleanupStack::PushL( packet );
+    
+    // use filetool to send it for plugin.
+    CXIMPTestFileSrvMsg* srvMsg = CXIMPTestFileSrvMsg::NewL( aMsgType, *packet );
+    CleanupStack::PushL( srvMsg );
+    wrapper->FileTool().CleanAllL();
+    wrapper->FileTool().SrvMsgStoreL( srvMsg );
+    CleanupStack::PopAndDestroy( 4, groupId ); // srvMsg, packet, groupItem, groupId
+    }
+
+// send a faked server-originated message with empty contents
+//
+void T_PresenceAll::SendSrvMsgL( TInt aMsgType )
+    {
+    // we'll use hard-coded wrapper 0 instance for now.
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+
+    // create a server-originated faked message with empty contents
+    RXIMPObjOwningPtrArray<CPresentityGroupInfoImp> groupList;
+
+    HBufC8* packedArray = TXIMPObjectPacker<CPresentityGroupInfoImp>::PackArrayL( groupList );
+    CleanupStack::PushL( packedArray );
+
+    // use filetool to send it for plugin.
+    CXIMPTestFileSrvMsg* srvMsg = CXIMPTestFileSrvMsg::NewL( aMsgType,
+            *packedArray );
+    CleanupStack::PushL( srvMsg );
+    wrapper->FileTool().CleanAllL();
+    wrapper->FileTool().SrvMsgStoreL( srvMsg );
+    CleanupStack::PopAndDestroy( 2 ); // srvMsg, packedArray
+    }
+    
+    
+void T_PresenceAll::T_BindUnbindL()
+    {
+    EUNIT_PRINT( _L("T_BindUnbindL") );
+
+    BindL();
+
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    MXIMPContext* context = wrapper->GetContext();
+    CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+    // Tell the protocol it should act normally
+    messenger->SetNoError();
+    
+        
+    UnbindL();
+    
+    wrapper = NULL;
+    context = NULL;
+    messenger = NULL;
+    }
+// ===========================================================================
+// TEST CASE TABLE
+// ===========================================================================
+//
+EUNIT_BEGIN_TEST_TABLE(
+        T_PresenceAll,
+        "XIMP presence all tests",
+        "MODULE" )
+        
+PRFW_DECORATED_TEST(
+        "TMO_demo_Startup",
+        "",
+        "",
+        "FUNCTIONALITY",
+        Setup_L,
+        T_TMO_demo_Startup_L,
+        Teardown )
+        
+PRFW_DECORATED_TEST(
+        "BindUnbind",
+        "",
+        "",
+        "FUNCTIONALITY",
+        Setup_L,
+        T_BindUnbindL,
+        Teardown )
+        
+PRFW_DECORATED_TEST(
+        "GrantWithdrawGroup",
+        "",
+        "",
+        "FUNCTIONALITY",
+        Setup_L,
+        T_GrantWithdrawGroup_L,
+        Teardown )
+
+EUNIT_END_TEST_TABLE
+
+
+// ===========================================================================
+// TEST SUITE CONSTRUCTION
+// ===========================================================================
+//
+EXPORT_C MEUnitTest* CreateTestSuiteL()
+    {
+    return T_PresenceAll::NewL();
+    }
+
+
+// end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/tsrc/src/t_presenceall/t_presenceall.h	Wed Nov 03 09:32:20 2010 +0530
@@ -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: XIMP Framework Test Code 
+*
+*/
+
+#ifndef T_PRESENCEALL_H
+#define T_PRESENCEALL_H
+
+
+//  EXTERNAL INCLUDES
+#include <platform/digia/eunit/ceunittestsuiteclass.h>
+#include <platform/digia/eunit/EUnitDecorators.h>
+#include <ximpbase.h>
+#include "prfwteststatuseventlistener.h"
+#include "prfwtestmessaging.h"
+
+class CXIMPTestContextWrapper;
+class CXIMPTestContextWrapperMgr;
+class CXIMPTestMessenger;
+
+/**
+ * XIMP Framework Eunit tests.
+ *
+ * Tests for XIMP session management services.
+ *
+ * @since S60 v4.0
+ */
+class T_PresenceAll : public CEUnitTestSuiteClass
+    {
+
+public:
+    static T_PresenceAll* NewL();
+    virtual ~T_PresenceAll();
+
+
+private:
+    T_PresenceAll();
+    void ConstructL();
+
+
+
+private:    // Test case functions
+
+    void Setup_L();
+    void SetupMultiple_L();
+    void BindL();
+    void BindAllL();
+    void Teardown();
+    void UnbindL();
+    void UnbindAllL();
+
+    void T_TMO_demo_Startup_L();
+    void T_GrantWithdrawGroup_L();
+    
+    void T_BindUnbindL();
+ 
+private:    // Test helpers
+
+void SendSrvMsgL(
+        const TDesC& aUri, const TDesC& aDispName,
+        TInt aMsgType );
+
+
+// send a faked server-originated message with empty contents
+//
+void SendSrvMsgL( TInt aMsgType );
+
+    void SetupListenerReqCompleteL( CXIMPTestContextWrapper* aWrapper, TXIMPTestStatusEventTemplate aEventType );
+    void SetupListenerReqCompleteAllowEventsL( CXIMPTestContextWrapper* aWrapper, TXIMPTestStatusEventTemplate aEventTypes );
+
+private: // Test data
+
+    /**
+     * Eunit test case table declaration.
+     */
+    EUNIT_DECLARE_TEST_TABLE;
+
+    // owned
+    CXIMPTestContextWrapperMgr* iWrapperMgr;
+
+    };
+
+
+#endif      //  t_presenceall_H
+
+
+
+// end of file
+
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/tsrc/src/t_presenceall/t_presenceall.mmp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,65 @@
+/*
+* 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: XIMP Framework Test Code 
+*
+*/
+
+#include            "../../tsrcutils/eunitcommon/eunittstdllbase.hrh"
+#include            "../../tsrcutils/processmaster/pm.h"
+
+#include<platform_paths.hrh>
+#include<eunitcaps.h>
+TARGET              t_presenceall.dll
+//CAPABILITY              ALL - TCB - DRM
+CAPABILITY      EUNIT_CAPS
+
+SOURCEPATH          .
+SOURCE              t_presenceall.cpp
+
+
+USERINCLUDE             ../../../core/srcdatamodel
+USERINCLUDE             ../../../presence/srcpresencedatamodel
+USERINCLUDE             ../../../presence/srcpresencedatamodel/presentitygroups
+USERINCLUDE             ../../../presence/srcpresencedatamodel/presencewatching
+USERINCLUDE             ../../../presence/srcpresencedatamodel/presenceauthorization
+USERINCLUDE             ../../../presence/srcpresencedatamodel/presencepublishing
+USERINCLUDE             ../../../presence/srcpresencedatamodel/presenceinfo
+USERINCLUDE             ../../../core/srcutils
+
+
+#if defined ( OS_LAYER_SYSTEMINCLUDE )
+OS_LAYER_SYSTEMINCLUDE
+#else
+SYSTEMINCLUDE     /epoc32/include
+#endif
+
+ #if defined ( APP_LAYER_SYSTEMINCLUDE )
+ APP_LAYER_SYSTEMINCLUDE
+ #else
+ SYSTEMINCLUDE     \epoc32\include
+ #endif
+
+LIBRARY             ecom.lib
+LIBRARY             bafl.lib
+LIBRARY             ximpdatamodel.lib
+LIBRARY             presencedatamodel.lib
+LIBRARY             estor.lib
+LIBRARY             ximputils.lib
+LIBRARY             eunit.lib
+LIBRARY             eunitutil.lib
+LIBRARY             euser.lib
+
+// end of file
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/tsrc/src/t_presenceauthorization/bld.inf	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,25 @@
+/*
+* 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 t_presenceauthorization.dll
+*
+*/
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+PRJ_TESTMMPFILES
+t_presenceauthorization.mmp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/tsrc/src/t_presenceauthorization/t_presenceauthorization.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,2065 @@
+/*
+* 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: XIMP Framework Test Code 
+*
+*/
+
+
+#include "eunittools.h"
+
+
+
+#include <platform/digia/eunit/eunitmacros.h>
+#include <platform/digia/eunit/teunitassertioninfo.h>
+
+#include <ecom/ecom.h>
+#include <badesca.h>
+
+#include <ximpbase.h>
+#include <ximpclient.h>
+#include <ximpcontext.h>
+#include <ximpcontextstateevent.h>
+#include <ximprequestcompleteevent.h>
+#include <ximpstatus.h>
+#include <presencefeatures.h>
+#include <presenceauthorization.h>
+#include <presencepublishing.h>
+#include <presentitypresenceevent.h>
+#include <ximpobjectfactory.h>
+
+#include "prfwtestlistener.h"
+
+#include <presentitygroups.h>
+#include <presentitygroupinfo.h>
+#include <presentitygrouplistevent.h>
+
+#include "t_presenceauthorization.h"
+#include "prfwteststatuseventlistener.h"
+#include "prfwtestmessaging.h"
+#include "prfwtestmessenger.h"
+#include "prfwtestcontextwrappermgr.h"
+#include "prfwtestcontextwrapper.h"
+
+#include "presenceinfoimp.h"
+#include "presenceinfofilterimp.h"
+#include "prfwtestpresencedatautils.h"
+#include "ximpidentityimp.h"
+#include "presentitygroupmemberinfoimp.h"
+#include "ximpobjecthelpers.h"
+#include "prfwtestfilesrvmsg.h"
+#include "prfwtestwaithelper.h"
+
+#include "prfwtestrobustnesstools.h"
+
+
+#include "presentitygroupcontenteventimp.h"
+#include "ximprequestcompleteeventimp.h"
+#include "presentitygroupinfoimp.h"
+#include "presentitygrouplisteventimp.h"
+#include "presentitygroupmemberinfoimp.h"
+#include "ximprequestcompleteeventimp.h"
+#include "ximprestrictedobjectcollection.h"
+#include "ximpobjectfactoryimp.h"
+
+_LIT8( KIdentity1, "Identity1" );
+_LIT8( KIdentity2, "Identity2" );
+_LIT8( KIdentity3, "Identity3" );
+
+_LIT( KIdentity1_16, "Identity1" );
+_LIT( KIdentity2_16, "Identity2" );
+_LIT( KIdentity3_16, "Identity3" );
+
+
+_LIT( KGroupId,  "Group" );
+_LIT( KGroupId1, "Group1" );
+_LIT( KGroupId2, "Group2" );
+
+
+_LIT( KGroupDisplayName, "GroupDisplayName" );
+
+
+_LIT8( KPrefix1, "PreA_" );
+_LIT8( KPrefix2, "PreB_" );
+_LIT8( KPrefix3, "PreC_" );
+_LIT8( KPrefix4, "PreD_" );
+
+_LIT( KIdentity, "TestId@hello.world" );
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// CONSTRUCTION
+T_PresenceAuthorization* T_PresenceAuthorization::NewL()
+    {
+    T_PresenceAuthorization* self = new( ELeave ) T_PresenceAuthorization;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+
+    return self;
+    }
+
+
+T_PresenceAuthorization::~T_PresenceAuthorization()
+    {
+    }
+
+
+void T_PresenceAuthorization::ConstructL()
+    {
+    CEUnitTestSuiteClass::ConstructL();
+    }
+
+
+T_PresenceAuthorization::T_PresenceAuthorization()
+    {
+    }
+
+
+
+// ===========================================================================
+// TEST CASE SETUP & TEARDOWN METHODS
+// ===========================================================================
+//
+
+void T_PresenceAuthorization::Setup_L()
+    {
+    PrfwTestRobustness::DoPreCleaning();
+
+    iWrapperMgr = CXIMPTestContextWrapperMgr::NewL();
+    iWrapperMgr->CreateWrapperL();
+    }
+
+void T_PresenceAuthorization::SetupMultiple_L()
+    {
+    PrfwTestRobustness::DoPreCleaning();
+
+    iWrapperMgr = CXIMPTestContextWrapperMgr::NewL();
+    iWrapperMgr->CreateWrapperL();
+    iWrapperMgr->CreateWrapperL();
+    iWrapperMgr->CreateWrapperL();
+    }
+
+
+void T_PresenceAuthorization::BindL()
+    {
+    CXIMPTestContextWrapper* wrapper0 = iWrapperMgr->GetWrapperL( 0 );
+
+    wrapper0->BindL( 0 );
+    }
+
+void T_PresenceAuthorization::BindAllL()
+    {
+    for( TInt a = 0; a < iWrapperMgr->WrapperCount(); ++a )
+        {
+        CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a );
+        wrapper->BindL( 0 );
+        }
+    }
+
+
+void T_PresenceAuthorization::Teardown()
+    {
+    delete iWrapperMgr;
+    iWrapperMgr = NULL;
+
+    REComSession::FinalClose();
+
+    PrfwTestRobustness::DoPreCleaning();
+    }
+
+void T_PresenceAuthorization::UnbindL()
+    {
+    // Do unbind
+    CXIMPTestContextWrapper* wrapper0 = iWrapperMgr->GetWrapperL( 0 );
+    wrapper0->UnbindL();
+    }
+
+void T_PresenceAuthorization::UnbindAllL()
+    {
+    for( TInt a = 0; a < iWrapperMgr->WrapperCount(); ++a )
+        {
+        CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a );
+        wrapper->UnbindL();
+        }
+    }
+
+
+// ===========================================================================
+// TEST CASES for presentity authorization
+// ===========================================================================
+
+void T_PresenceAuthorization::T_GrantPresenceForPresentity_L()
+    {
+    EUNIT_PRINT( _L("Grant presence for presentity") );
+
+// INITIALIZE
+
+    BindL();
+
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    MXIMPContext* context = wrapper->GetContext();
+    CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+    // Tell the protocol it should act normally
+    messenger->SetNoError();
+
+    // Get the interfaces
+    MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+    MPresenceAuthorization& presAuth = presFeat->PresenceAuthorization();
+
+    CXIMPIdentityImp* identity = XIMPTestPresenceDataUtils::GenerateIdentityLC( &KNullDesC8 );
+    CPresenceInfoFilterImp* pif =
+                XIMPTestPresenceDataUtils::GenerateInfoFilterLC( &KPrefix1 );
+
+// GRANT
+
+    // Setup status event listener for RequestComplete
+    SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk );
+
+    // register interest
+    TXIMPRequestId reqId = presAuth.GrantPresenceForPresentityL( *identity, *pif );
+
+    // Wait for events on the request
+    wrapper->WaitRequestAndStackEvents( reqId );
+    // verify that UpdateInterest was called
+    COMMONASSERT( messenger, EXIMPPlgTestGrantPresenceForPresentityCalled, 
+                        "GrantPresenceForPresentityL was not called", ETrue, NULL );
+
+// GRANT AGAIN
+
+    // Setup status event listener for RequestComplete
+    SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk );
+    messenger->SetValueFor( EXIMPPlgTestGrantPresenceForPresentityCalled, 0 );
+    
+    // register interest
+    reqId = presAuth.GrantPresenceForPresentityL( *identity, *pif );
+
+    // Wait for events on the request
+    wrapper->WaitRequestAndStackEvents( reqId );
+    
+    // verify that UpdateInterest was called
+    COMMONASSERT( messenger, EXIMPPlgTestGrantPresenceForPresentityCalled, 
+                        "GrantPresenceForPresentityL was not called", EFalse, 
+                        "GrantPresenceForPresentityL was called" );
+
+// WITHDRAW
+
+    SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk );
+    // register interest
+    reqId = presAuth.WithdrawPresenceGrantFromPresentityL( *identity );
+
+    // Wait for events on the request
+    wrapper->WaitRequestAndStackEvents( reqId );
+    wrapper->VerifyEventStackL( _L8("Grantin presence to presentity, complete with error: ") );
+    // verify that UpdateInterest was called
+    COMMONASSERT( messenger, EXIMPPlgTestWithdrawPresenceFromPresentityCalled, 
+                            "WithdrawPresenceForPresentityL was not called", ETrue, NULL );
+
+// DEINITIALIZE
+
+    CleanupStack::PopAndDestroy( 2, identity ); //pif, identity
+    UnbindL();
+    }
+
+// ==============================================================================================
+
+void T_PresenceAuthorization::T_WithdrawNotGrantedPresenceFromPresentity_L()
+    {
+    EUNIT_PRINT( _L("Withdraw presence from presentity not granted") );
+
+// INITIALIZE
+
+    BindL();
+
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    MXIMPContext* context = wrapper->GetContext();
+    CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+    // Tell the protocol it should act normally
+    messenger->SetNoError();
+
+    // Get the interfaces
+    MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+    MPresenceAuthorization& presAuth = presFeat->PresenceAuthorization();
+
+    CXIMPIdentityImp* identity = XIMPTestPresenceDataUtils::GenerateIdentityLC( &KNullDesC8 );
+
+// WITHDRAW
+
+    SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk );
+    // register interest
+    TXIMPRequestId reqId = presAuth.WithdrawPresenceGrantFromPresentityL( *identity );
+
+    // Wait for events on the request
+    wrapper->WaitRequestAndStackEvents( reqId );
+    wrapper->VerifyEventStackL( _L8("Grantin presence to presentity, complete with error: ") );
+    // Changed for OPAA-73BCS(
+    // verify that UpdateInterest was called
+    COMMONASSERT( messenger, EXIMPPlgTestWithdrawPresenceFromPresentityCalled, 
+                        "WithdrawPresenceForPresentityL was not called", ETrue/*EFalse*/, 
+                        "WithdrawPresenceForPresentityL was called" );
+
+// DEINITIALIZE
+
+    CleanupStack::PopAndDestroy( identity ); //identity
+    UnbindL();
+    }
+
+// ==============================================================================================
+
+
+void T_PresenceAuthorization::T_GrantPresenceForPresentityChangeId_L()
+    {
+    EUNIT_PRINT( _L("Grant presence for presentity change id") );
+
+// INITIALIZE
+
+    BindL();
+
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    MXIMPContext* context = wrapper->GetContext();
+    CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+    // Tell the protocol it should act normally
+    messenger->SetNoError();
+
+    // Get the management interface
+    // Get the interfaces
+    MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+    MPresenceAuthorization& presAuth = presFeat->PresenceAuthorization();
+
+
+    CXIMPIdentityImp* identity = XIMPTestPresenceDataUtils::GenerateIdentityLC( &KNullDesC8 );
+    CPresenceInfoFilterImp* pif =
+                XIMPTestPresenceDataUtils::GenerateInfoFilterLC( &KPrefix1 );
+
+// ID CHANGE REQUEST TO ADAPTATION
+
+    MXIMPIdentity* identityParam = context->ObjectFactory().NewIdentityLC();
+    identityParam->SetIdentityL( KIdentity );
+    
+    CXIMPIdentityImp* identityParamImp =
+             ( CXIMPIdentityImp* ) identityParam->GetInterface(
+                                        CXIMPIdentityImp::KClassId,
+                                        MXIMPBase::EPanicIfUnknown );
+    HBufC8* packedId = TXIMPObjectPacker< CXIMPIdentityImp >::PackL( *identityParamImp );
+    CleanupStack::PopAndDestroy(); // identityParam
+    CleanupStack::PushL( packedId );
+    CXIMPTestFileSrvMsg* srvMsg = CXIMPTestFileSrvMsg::NewL( CXIMPTestFileSrvMsg::ETestSrvMsgReqParamIdentity, 
+                                                             *packedId );
+    CleanupStack::PopAndDestroy( packedId );
+    CleanupStack::PushL( srvMsg );
+    wrapper->FileTool().SrvMsgStoreL( srvMsg );
+    CleanupStack::PopAndDestroy( srvMsg );
+
+    // Wait for server to handle srvmsg.
+    CXIMPTestWaitHelper* wait = CXIMPTestWaitHelper::NewL();
+    CleanupStack::PushL( wait );
+    wait->WaitForL( 2 );
+    CleanupStack::PopAndDestroy( wait );
+
+// GRANT
+
+    // Setup status event listener for RequestComplete
+    SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk );
+
+    // register interest
+    TXIMPRequestId reqId = presAuth.GrantPresenceForPresentityL( *identity, *pif );
+
+    // Wait for events on the request
+    wrapper->WaitRequestAndStackEvents( reqId );
+    // verify that UpdateInterest was called
+    COMMONASSERT( messenger, EXIMPPlgTestGrantPresenceForPresentityCalled, 
+                        "GrantPresenceForPresentityL was not called", ETrue, NULL );
+
+// DEINITIALIZE
+
+    CleanupStack::PopAndDestroy( 2, identity ); //pif, identity
+    UnbindL();
+    }
+
+// ==============================================================================================
+
+void T_PresenceAuthorization::T_WithdrawNotGrantedPresenceFromPresentity_Multiple_L()
+    {
+    EUNIT_PRINT( _L("Withdraw presence from presentity not granted multiple clients") );
+
+    BindAllL();
+
+    CXIMPIdentityImp* identity = XIMPTestPresenceDataUtils::GenerateIdentityLC( &KNullDesC8 );
+    CPresenceInfoFilterImp* pif =
+                XIMPTestPresenceDataUtils::GenerateInfoFilterLC( &KPrefix1 );
+
+// GRANT ALL BUT FIRST
+
+    TInt countOfWrappers = iWrapperMgr->WrapperCount();
+    TInt a(0);
+    for( a = countOfWrappers - 1; a >= 1; --a )
+        {
+        CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a );
+        MXIMPContext* context = wrapper->GetContext();
+        CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+        // Tell the protocol it should act normally
+        messenger->SetNoError();
+
+        // Get the interfaces
+        MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+        MPresenceAuthorization& presAuth = presFeat->PresenceAuthorization();
+
+        // Setup status event listener for RequestComplete
+        SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk );
+
+        // register interest
+        TXIMPRequestId reqId = presAuth.GrantPresenceForPresentityL( *identity, *pif );
+
+        // Wait for events on the request
+        wrapper->WaitRequestAndStackEvents( reqId );
+        // verify that UpdateInterest was called
+        COMMONASSERT( messenger, EXIMPPlgTestGrantPresenceForPresentityCalled,
+            "GrantPresenceForPresentityL was not called",
+            ( a > 1 ) ? ETrue : EFalse,
+            "GrantPresenceForPresentityL was called" );
+        }
+        
+// WITHDRAW
+        
+    for( a = 0; a < countOfWrappers; ++a )
+        {
+        CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a );
+        MXIMPContext* context = wrapper->GetContext();
+        CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+        
+        // Get the interfaces
+        MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+        MPresenceAuthorization& presAuth = presFeat->PresenceAuthorization();
+
+        // Setup status event listener for RequestComplete
+        SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); // allow events after reqcomplete
+
+        // register interest
+        TXIMPRequestId reqId = presAuth.WithdrawPresenceGrantFromPresentityL( *identity );
+
+        // Wait for events on the request
+        wrapper->WaitRequestAndStackEvents( reqId );
+        wrapper->VerifyEventStackL( _L8("Subscribing presentity presence, complete with error: ") );
+        // Changed for OPAA-73BCS8
+        // verify that UpdateInterest was called
+        COMMONASSERT( messenger, EXIMPPlgTestWithdrawPresenceFromPresentityCalled, 
+            "WithdrawPresenceForPresentityL was not called",
+            ( a < ( countOfWrappers -1 ) /*a < 2*/ ) ? EFalse : ETrue,
+            "WithdrawPresenceForPresentityL was called" );
+        }
+    
+    CleanupStack::PopAndDestroy( pif );
+    CleanupStack::PopAndDestroy( identity );
+        
+    UnbindAllL();    
+    }
+
+
+// ==============================================================================================
+
+void T_PresenceAuthorization::T_ErrFromPlg_LeaveOnGrantPresenceForPresentity_L()
+    {
+    EUNIT_PRINT( _L("Error from plug-in in grant presence for presentity") );    
+
+// INITIALIZE
+
+    BindL();
+
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    MXIMPContext* context = wrapper->GetContext();
+    CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+    // Tell the protocol it should act normally
+    messenger->SetNoError();
+
+    // Get the interfaces
+    MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+    MPresenceAuthorization& presAuth = presFeat->PresenceAuthorization();
+
+
+    CXIMPIdentityImp* identity = XIMPTestPresenceDataUtils::GenerateIdentityLC( &KNullDesC8 );
+    CPresenceInfoFilterImp* pif =
+                XIMPTestPresenceDataUtils::GenerateInfoFilterLC( &KPrefix1 );
+
+// GRANT
+
+    messenger->SetLeave( KErrAbort );
+
+    // Setup status event listener for RequestComplete
+    SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_PresentitySubscribeFailKErrAbort );
+
+    // register interest
+    TXIMPRequestId reqId = presAuth.GrantPresenceForPresentityL( *identity, *pif );
+
+    // Wait for events on the request
+    wrapper->WaitRequestAndStackEvents( reqId );
+    // verify that UpdateInterest was called
+    COMMONASSERT( messenger, EXIMPPlgTestGrantPresenceForPresentityCalled, 
+                        "GrantPresenceForPresentityL was not called", EFalse, 
+                        "GrantPresenceForPresentityL was called" );
+
+    messenger->SetLeave( KErrNone );
+
+// DEINITIALIZE
+
+    CleanupStack::PopAndDestroy( 2, identity ); //pif, identity
+    UnbindL();
+    }
+
+
+// ==============================================================================================
+
+void T_PresenceAuthorization::T_ErrFromPlg_LeaveOnWithdrawPresenceFromPresentity_L()
+    {
+    EUNIT_PRINT( _L("Error from plug-in in withdraw presence from presentity") );    
+
+// INITIALIZE
+
+    BindL();
+
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    MXIMPContext* context = wrapper->GetContext();
+    CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+    // Tell the protocol it should act normally
+    messenger->SetNoError();
+
+    // Get the interfaces
+    MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+    MPresenceAuthorization& presAuth = presFeat->PresenceAuthorization();
+
+
+    CXIMPIdentityImp* identity = XIMPTestPresenceDataUtils::GenerateIdentityLC( &KNullDesC8 );
+    CPresenceInfoFilterImp* pif =
+                XIMPTestPresenceDataUtils::GenerateInfoFilterLC( &KPrefix1 );
+
+// GRANT
+
+    // Setup status event listener for RequestComplete
+    SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk );
+
+    // register interest
+    TXIMPRequestId reqId = presAuth.GrantPresenceForPresentityL( *identity, *pif );
+
+    // Wait for events on the request
+    wrapper->WaitRequestAndStackEvents( reqId );
+    // verify that UpdateInterest was called
+    COMMONASSERT( messenger, EXIMPPlgTestGrantPresenceForPresentityCalled, 
+                        "GrantPresenceForPresentityL was not called", ETrue, 
+                        "GrantPresenceForPresentityL was called" );
+
+// WITHDRAW
+
+    messenger->SetLeave( KErrAbort );
+
+    SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_PresentitySubscribeFailKErrAbort );
+    // register interest
+    reqId = presAuth.WithdrawPresenceGrantFromPresentityL( *identity );
+
+    // Wait for events on the request
+    wrapper->WaitRequestAndStackEvents( reqId );
+    wrapper->VerifyEventStackL( _L8("Grantin presence to presentity, complete with error: ") );
+    // verify that UpdateInterest was called
+    COMMONASSERT( messenger, EXIMPPlgTestWithdrawPresenceFromPresentityCalled, 
+                        "WithdrawPresenceGrantFromPresentityL was not called", EFalse, 
+                        "WithdrawPresenceGrantFromPresentityL was called" );
+
+    messenger->SetLeave( KErrNone );
+
+// DEINITIALIZE
+
+    CleanupStack::PopAndDestroy( 2, identity ); //pif, identity
+    UnbindL();
+    }
+
+// ==============================================================================================
+
+void T_PresenceAuthorization::T_GrantPresenceForPresentity_Multiple_L()
+    {
+    EUNIT_PRINT( _L("Grant presence for presentity multiple clients") );
+
+    BindAllL();
+
+    CXIMPIdentityImp* identity = XIMPTestPresenceDataUtils::GenerateIdentityLC( &KNullDesC8 );
+    CPresenceInfoFilterImp* pif =
+                XIMPTestPresenceDataUtils::GenerateInfoFilterLC( &KPrefix1 );
+
+// GRANT
+
+    TInt countOfWrappers = iWrapperMgr->WrapperCount();
+    TInt a(0);
+    for( a = 0; a < countOfWrappers; ++a )
+        {
+        CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a );
+        MXIMPContext* context = wrapper->GetContext();
+        CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+        // Tell the protocol it should act normally
+        messenger->SetNoError();
+
+    // Get the interfaces
+    MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+    MPresenceAuthorization& presAuth = presFeat->PresenceAuthorization();
+
+
+        // Setup status event listener for RequestComplete
+        SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk );
+
+        // register interest
+        TXIMPRequestId reqId = presAuth.GrantPresenceForPresentityL( *identity, *pif );
+
+        // Wait for events on the request
+        wrapper->WaitRequestAndStackEvents( reqId );
+        // verify that UpdateInterest was called
+        COMMONASSERT( messenger, EXIMPPlgTestGrantPresenceForPresentityCalled, 
+            "GrantPresenceForPresentityL was not called",
+            ( a == 0 ) ? ETrue : EFalse,
+            "GrantPresenceForPresentityL was called" );
+        }
+        
+// GRANT AGAIN        
+
+    for( a = 0; a < countOfWrappers; ++a )
+        {
+        CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a );
+        MXIMPContext* context = wrapper->GetContext();
+        CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+        // Tell the protocol it should act normally
+        messenger->SetNoError();
+
+        // Get the interfaces
+        MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+        MPresenceAuthorization& presAuth = presFeat->PresenceAuthorization();
+
+        // Setup status event listener for RequestComplete
+        SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk );
+        messenger->SetValueFor( EXIMPPlgTestGrantPresenceForPresentityCalled, 0 );
+
+        // register interest
+        TXIMPRequestId reqId = presAuth.GrantPresenceForPresentityL( *identity, *pif );
+
+        // Wait for events on the request
+        wrapper->WaitRequestAndStackEvents( reqId );
+        // verify that UpdateInterest was called
+        COMMONASSERT( messenger, EXIMPPlgTestGrantPresenceForPresentityCalled, 
+            "GrantPresenceForPresentityL was not called", EFalse,
+            "GrantPresenceForPresentityL was called" );
+        }
+
+        
+// WITHDRAW
+        
+    for( a = 0; a < countOfWrappers; ++a )
+        {
+        CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a );
+        MXIMPContext* context = wrapper->GetContext();
+        CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+        
+    // Get the interfaces
+    MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+    MPresenceAuthorization& presAuth = presFeat->PresenceAuthorization();
+
+
+        // Setup status event listener for RequestComplete
+        SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); // allow events after reqcomplete
+
+        // register interest
+        TXIMPRequestId reqId = presAuth.WithdrawPresenceGrantFromPresentityL( *identity );
+
+        // Wait for events on the request
+        wrapper->WaitRequestAndStackEvents( reqId );
+        wrapper->VerifyEventStackL( _L8("Subscribing presentity presence, complete with error: ") );
+        // verify that UpdateInterest was called
+        COMMONASSERT( messenger, EXIMPPlgTestWithdrawPresenceFromPresentityCalled, 
+            "WithdrawPresenceForPresentityL was not called",
+            ( a < 2 ) ? EFalse : ETrue,
+            "WithdrawPresenceForPresentityL was called" );
+        }
+    
+    CleanupStack::PopAndDestroy( pif );
+    CleanupStack::PopAndDestroy( identity );
+        
+    UnbindAllL();    
+    }
+
+
+// ==============================================================================================
+
+void T_PresenceAuthorization::T_WithdrawNotGrantedPresenceFromGroupMembers_L()
+    {
+    EUNIT_PRINT( _L("Withdraw presence from group members not granted") );
+
+// INITIALIZE
+
+    BindL();
+
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    MXIMPContext* context = wrapper->GetContext();
+    CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+    // Tell the protocol it should act normally
+    messenger->SetNoError();
+
+    // Get the interfaces
+    MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+    MPresenceAuthorization& presAuth = presFeat->PresenceAuthorization();
+
+
+    CXIMPIdentityImp* identity = XIMPTestPresenceDataUtils::GenerateIdentityLC( &KNullDesC8 );
+
+// WITHDRAW
+
+    SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk );
+    // register interest
+    TXIMPRequestId reqId = presAuth.WithdrawPresenceGrantFromPresentityGroupMembersL( *identity );
+
+    // Wait for events on the request
+    wrapper->WaitRequestAndStackEvents( reqId );
+    wrapper->VerifyEventStackL( _L8("Withdraw not granted group members, complete with error: ") );
+    // Changed for OPAA-73BCS8
+    COMMONASSERT( messenger, EXIMPPlgTestWithdrawPresenceFromPresentityGroupMembersCalled, 
+                        "WithdrawPresenceGrantFromPresentityGroupMembersL was not called", ETrue/*EFalse*/, 
+                        "WithdrawPresenceGrantFromPresentityGroupMembersL was called" );
+
+// DEINITIALIZE
+
+    CleanupStack::PopAndDestroy( identity ); //identity
+    UnbindL();
+    }
+
+
+// ==============================================================================================
+
+void T_PresenceAuthorization::T_WithdrawNotGrantedPresenceFromGroupMembers_Multiple_L()
+    {
+    EUNIT_PRINT( _L("Withdraw presence from group members not granted multiple clients") );
+
+    BindAllL();
+
+    CXIMPIdentityImp* identity = XIMPTestPresenceDataUtils::GenerateIdentityLC( &KNullDesC8 );
+    CPresenceInfoFilterImp* pif =
+                XIMPTestPresenceDataUtils::GenerateInfoFilterLC( &KPrefix1 );
+
+// GRANT ALL BUT FIRST
+
+    TInt countOfWrappers = iWrapperMgr->WrapperCount();
+    TInt a(0);
+    for( a = countOfWrappers - 1; a >= 1; --a )
+        {
+        CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a );
+        MXIMPContext* context = wrapper->GetContext();
+        CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+        // Tell the protocol it should act normally
+        messenger->SetNoError();
+
+        // Get the interfaces
+        MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+        MPresenceAuthorization& presAuth = presFeat->PresenceAuthorization();
+
+
+        // Setup status event listener for RequestComplete
+        SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk );
+
+        // register interest
+        TXIMPRequestId reqId = presAuth.GrantPresenceForPresentityGroupMembersL( *identity, *pif );
+
+        // Wait for events on the request
+        wrapper->WaitRequestAndStackEvents( reqId );
+        // verify that UpdateInterest was called
+        COMMONASSERT( messenger, EXIMPPlgTestGrantPresenceForPresentityGroupMembersCalled,
+            "GrantPresenceForPresentityGroupMembersL was not called",
+            ( a > 1 ) ? ETrue : EFalse,
+            "GrantPresenceForPresentityGroupMembersL was called" );
+        }
+        
+// WITHDRAW
+        
+    for( a = 0; a < countOfWrappers; ++a )
+        {
+        CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a );
+        MXIMPContext* context = wrapper->GetContext();
+        CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+        
+        // Get the interfaces
+        MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+        MPresenceAuthorization& presAuth = presFeat->PresenceAuthorization();
+
+
+        // Setup status event listener for RequestComplete
+        SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); // allow events after reqcomplete
+
+        // register interest
+        TXIMPRequestId reqId = presAuth.WithdrawPresenceGrantFromPresentityGroupMembersL( *identity );
+
+        // Wait for events on the request
+        wrapper->WaitRequestAndStackEvents( reqId );
+        wrapper->VerifyEventStackL( _L8("Subscribing presentity presence, complete with error: ") );
+        // Changed for OPAA-73BCS8
+        // verify that UpdateInterest was called
+        COMMONASSERT( messenger, EXIMPPlgTestWithdrawPresenceFromPresentityGroupMembersCalled, 
+            "WithdrawPresenceForPresentityGroupMembersL was not called",
+            ( a < ( countOfWrappers - 1 )/*a < 2*/ ) ? EFalse : ETrue,
+            "WithdrawPresenceForPresentityGroupMembersL was called" );
+        }
+    
+    CleanupStack::PopAndDestroy( pif );
+    CleanupStack::PopAndDestroy( identity );
+        
+    UnbindAllL();    
+    }
+
+// ==============================================================================================
+
+
+void T_PresenceAuthorization::T_GrantPresenceForGroupMembers_Multiple_L()
+    {
+    EUNIT_PRINT( _L("Grant presence for group members multiple clients") );
+
+    BindAllL();
+
+    CXIMPIdentityImp* identity = XIMPTestPresenceDataUtils::GenerateIdentityLC( &KNullDesC8 );
+    CPresenceInfoFilterImp* pif =
+                XIMPTestPresenceDataUtils::GenerateInfoFilterLC( &KPrefix1 );
+
+// GRANT
+
+    TInt countOfWrappers = iWrapperMgr->WrapperCount();
+    TInt a(0);
+    for( a = 0; a < countOfWrappers; ++a )
+        {
+        CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a );
+        MXIMPContext* context = wrapper->GetContext();
+        CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+        // Tell the protocol it should act normally
+        messenger->SetNoError();
+
+        // Get the interfaces
+        MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+        MPresenceAuthorization& presAuth = presFeat->PresenceAuthorization();
+
+
+        // Setup status event listener for RequestComplete
+        SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk );
+
+        // register interest
+        TXIMPRequestId reqId = presAuth.GrantPresenceForPresentityGroupMembersL( *identity, *pif );
+
+        // Wait for events on the request
+        wrapper->WaitRequestAndStackEvents( reqId );
+        // verify that UpdateInterest was called
+        COMMONASSERT( messenger, EXIMPPlgTestGrantPresenceForPresentityGroupMembersCalled, 
+            "GrantPresenceForPresentityGroupMembersL was not called",
+            ( a == 0 ) ? ETrue : EFalse,
+            "GrantPresenceForPresentityGroupMembersL was called" );
+        }
+        
+// GRANT AGAIN        
+
+    for( a = 0; a < countOfWrappers; ++a )
+        {
+        CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a );
+        MXIMPContext* context = wrapper->GetContext();
+        CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+        // Tell the protocol it should act normally
+        messenger->SetNoError();
+
+        // Get the interfaces
+        MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+        MPresenceAuthorization& presAuth = presFeat->PresenceAuthorization();
+
+
+        // Setup status event listener for RequestComplete
+        SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk );
+        messenger->SetValueFor( EXIMPPlgTestGrantPresenceForPresentityGroupMembersCalled, 0 );        
+
+        // register interest
+        TXIMPRequestId reqId = presAuth.GrantPresenceForPresentityGroupMembersL( *identity, *pif );
+
+        // Wait for events on the request
+        wrapper->WaitRequestAndStackEvents( reqId );
+        // verify that UpdateInterest was called
+        COMMONASSERT( messenger, EXIMPPlgTestGrantPresenceForPresentityGroupMembersCalled, 
+            "GrantPresenceForPresentityGroupMembersL was not called", EFalse,
+            "GrantPresenceForPresentityGroupMembersL was called" );
+        }
+
+        
+// WITHDRAW
+        
+    for( a = 0; a < countOfWrappers; ++a )
+        {
+        CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a );
+        MXIMPContext* context = wrapper->GetContext();
+        CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+        
+    // Get the interfaces
+    MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+    MPresenceAuthorization& presAuth = presFeat->PresenceAuthorization();
+
+
+        // Setup status event listener for RequestComplete
+        SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); // allow events after reqcomplete
+
+        // register interest
+        TXIMPRequestId reqId = presAuth.WithdrawPresenceGrantFromPresentityGroupMembersL( *identity );
+
+        // Wait for events on the request
+        wrapper->WaitRequestAndStackEvents( reqId );
+        wrapper->VerifyEventStackL( _L8("Subscribing presentity presence, complete with error: ") );
+        // verify that UpdateInterest was called
+        COMMONASSERT( messenger, EXIMPPlgTestWithdrawPresenceFromPresentityGroupMembersCalled, 
+            "WithdrawPresenceForPresentityGroupMembersL was not called",
+            ( a < 2 ) ? EFalse : ETrue,
+            "WithdrawPresenceForPresentityGroupMembersL was called" );
+        }
+    
+    CleanupStack::PopAndDestroy( pif );
+    CleanupStack::PopAndDestroy( identity );
+        
+    UnbindAllL();    
+    }
+
+// ==============================================================================================
+
+void T_PresenceAuthorization::T_ErrFromPlg_LeaveOnGrantPresenceForGroupMembers_L()
+    {
+    EUNIT_PRINT( _L("Error from plug-in in grant presence for group members") );    
+
+// INITIALIZE
+
+    BindL();
+
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    MXIMPContext* context = wrapper->GetContext();
+    CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+    // Tell the protocol it should act normally
+    messenger->SetNoError();
+
+    // Get the interfaces
+    MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+    MPresenceAuthorization& presAuth = presFeat->PresenceAuthorization();
+
+    CXIMPIdentityImp* identity = XIMPTestPresenceDataUtils::GenerateIdentityLC( &KNullDesC8 );
+    CPresenceInfoFilterImp* pif =
+                XIMPTestPresenceDataUtils::GenerateInfoFilterLC( &KPrefix1 );
+
+// GRANT
+
+    messenger->SetLeave( KErrAbort );
+
+    // Setup status event listener for RequestComplete
+    SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_PresentitySubscribeFailKErrAbort );
+
+    // register interest
+    TXIMPRequestId reqId = presAuth.GrantPresenceForPresentityGroupMembersL( *identity, *pif );
+
+    // Wait for events on the request
+    wrapper->WaitRequestAndStackEvents( reqId );
+    // verify that UpdateInterest was called
+    COMMONASSERT( messenger, EXIMPPlgTestGrantPresenceForPresentityGroupMembersCalled, 
+                        "GrantPresenceForPresentityGroupMembersL was not called", EFalse, 
+                        "GrantPresenceForPresentityGroupMembersL was called" );
+
+    messenger->SetLeave( KErrNone );
+
+// DEINITIALIZE
+
+    CleanupStack::PopAndDestroy( 2, identity ); //pif, identity
+    UnbindL();
+    }
+
+// ==============================================================================================
+
+void T_PresenceAuthorization::T_ErrFromPlg_LeaveOnWithdrawPresenceFromGroupMembers_L()
+    {
+    EUNIT_PRINT( _L("Error from plug-in in withdraw presence from group members") );    
+
+// INITIALIZE
+
+    BindL();
+
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    MXIMPContext* context = wrapper->GetContext();
+    CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+    // Tell the protocol it should act normally
+    messenger->SetNoError();
+
+    // Get the interfaces
+    MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+    MPresenceAuthorization& presAuth = presFeat->PresenceAuthorization();
+
+    CXIMPIdentityImp* identity = XIMPTestPresenceDataUtils::GenerateIdentityLC( &KNullDesC8 );
+    CPresenceInfoFilterImp* pif =
+                XIMPTestPresenceDataUtils::GenerateInfoFilterLC( &KPrefix1 );
+
+// GRANT
+
+    // Setup status event listener for RequestComplete
+    SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk );
+
+    // register interest
+    TXIMPRequestId reqId = presAuth.GrantPresenceForPresentityGroupMembersL( *identity, *pif );
+
+    // Wait for events on the request
+    wrapper->WaitRequestAndStackEvents( reqId );
+    // verify that UpdateInterest was called
+    COMMONASSERT( messenger, EXIMPPlgTestGrantPresenceForPresentityGroupMembersCalled, 
+                        "GrantPresenceForPresentityGroupMembersL was not called", ETrue, 
+                        "GrantPresenceForPresentityGroupMembersL was called" );
+
+// WITHDRAW
+
+    messenger->SetLeave( KErrAbort );
+
+    SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_PresentitySubscribeFailKErrAbort );
+    // register interest
+    reqId = presAuth.WithdrawPresenceGrantFromPresentityGroupMembersL( *identity );
+
+    // Wait for events on the request
+    wrapper->WaitRequestAndStackEvents( reqId );
+    wrapper->VerifyEventStackL( _L8("Grantin presence to presentity, complete with error: ") );
+    // verify that UpdateInterest was called
+    COMMONASSERT( messenger, EXIMPPlgTestWithdrawPresenceFromPresentityGroupMembersCalled, 
+                        "WithdrawPresenceGrantFromPresentityGroupMembersL was not called", EFalse, 
+                        "WithdrawPresenceGrantFromPresentityGroupMembersL was called" );
+
+    messenger->SetLeave( KErrNone );
+
+// DEINITIALIZE
+
+    CleanupStack::PopAndDestroy( 2, identity ); //pif, identity
+    UnbindL();
+    }
+
+// ==============================================================================================
+
+// To Everyone, empty filter
+void T_PresenceAuthorization::T_GrantPresenceForEveryone_L()
+    {
+    EUNIT_PRINT( _L("Grant presence for everyone") );
+
+    BindL();
+
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    MXIMPContext* context = wrapper->GetContext();
+    CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+    // Tell the protocol it should act normally
+    messenger->SetNoError();
+
+    // Get the interfaces
+    MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+    MPresenceAuthorization& presAuth = presFeat->PresenceAuthorization();
+
+    CPresenceInfoFilterImp* pif = XIMPTestPresenceDataUtils::GenerateInfoFilterLC( &KPrefix1 );
+
+// GRANT
+
+    // Setup status event listener for RequestComplete
+    SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk );
+
+    TXIMPRequestId reqId = presAuth.GrantPresenceForEveryoneL( *pif );
+
+    // Wait for events on the request
+    wrapper->WaitRequestAndStackEvents( reqId );
+    // verify that UpdateInterest was called
+    COMMONASSERT( messenger, EXIMPPlgTestGrantPresenceForEveryoneCalled, "GrantPresenceForEveryoneL was not called", ETrue, NULL );
+
+// GRANT AGAIN
+
+    // Setup status event listener for RequestComplete
+    SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk );
+    messenger->SetValueFor( EXIMPPlgTestGrantPresenceForEveryoneCalled, 0 );    
+
+    reqId = presAuth.GrantPresenceForEveryoneL( *pif );
+
+    // Wait for events on the request
+    wrapper->WaitRequestAndStackEvents( reqId );
+    // verify that UpdateInterest was called
+    COMMONASSERT( messenger, EXIMPPlgTestGrantPresenceForEveryoneCalled, "GrantPresenceForEveryoneL was not called", EFalse, "GrantPresenceForEveryoneL was called" );
+
+// WITHDRAW
+
+    SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk );
+    // register interest
+    reqId = presAuth.WithdrawPresenceGrantFromEveryoneL();
+
+    // Wait for events on the request
+    wrapper->WaitRequestAndStackEvents( reqId );
+    wrapper->VerifyEventStackL( _L8("Granting presence to everyone, complete with error: ") );
+    // verify that UpdateInterest was called
+    COMMONASSERT( messenger, EXIMPPlgTestWithdrawPresenceFromEveryoneCalled, "WithdrawPresenceForEveryoneL was not called", ETrue, NULL );
+
+    CleanupStack::PopAndDestroy( pif ); //pif
+    UnbindL();
+    }    
+    
+// ==============================================================================================
+
+void T_PresenceAuthorization::T_ErrFromPlg_LeaveOnGrantPresenceForEveryone_L()
+    {
+    EUNIT_PRINT( _L("Error from plug-in in grant presence for everyone") );    
+
+// INITIALIZE
+
+    BindL();
+
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    MXIMPContext* context = wrapper->GetContext();
+    CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+    // Tell the protocol it should act normally
+    messenger->SetNoError();
+
+    // Get the interfaces
+    MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+    MPresenceAuthorization& presAuth = presFeat->PresenceAuthorization();
+
+    CPresenceInfoFilterImp* pif =
+                XIMPTestPresenceDataUtils::GenerateInfoFilterLC( &KPrefix1 );
+
+// GRANT
+
+    messenger->SetLeave( KErrAbort );
+
+    // Setup status event listener for RequestComplete
+    SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_PresentitySubscribeFailKErrAbort );
+
+    // register interest
+    TXIMPRequestId reqId = presAuth.GrantPresenceForEveryoneL( *pif );
+
+    // Wait for events on the request
+    wrapper->WaitRequestAndStackEvents( reqId );
+    // verify that UpdateInterest was called
+    COMMONASSERT( messenger, EXIMPPlgTestGrantPresenceForEveryoneCalled, 
+                        "GrantPresenceForEveryoneL was not called", EFalse, 
+                        "GrantPresenceForEveryoneL was called" );
+
+    messenger->SetLeave( KErrNone );
+
+// DEINITIALIZE
+
+    CleanupStack::PopAndDestroy( pif ); //pif
+    UnbindL();
+    }
+
+// ==============================================================================================
+
+void T_PresenceAuthorization::T_GrantPresenceForEveryone_Multiple_L()
+    {
+    EUNIT_PRINT( _L("Grant presence for presentity multiple clients") );
+
+    BindAllL();
+
+    CPresenceInfoFilterImp* pif =
+                XIMPTestPresenceDataUtils::GenerateInfoFilterLC( &KPrefix1 );
+
+// GRANT
+
+    TInt countOfWrappers = iWrapperMgr->WrapperCount();
+    TInt a(0);
+    for( a = 0; a < countOfWrappers; ++a )
+        {
+        CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a );
+        MXIMPContext* context = wrapper->GetContext();
+        CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+        // Tell the protocol it should act normally
+        messenger->SetNoError();
+
+        // Get the interfaces
+        MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+        MPresenceAuthorization& presAuth = presFeat->PresenceAuthorization();
+
+        // Setup status event listener for RequestComplete
+        SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk );
+
+        // register interest
+        TXIMPRequestId reqId = presAuth.GrantPresenceForEveryoneL( *pif );
+
+        // Wait for events on the request
+        wrapper->WaitRequestAndStackEvents( reqId );
+        // verify that UpdateInterest was called
+        COMMONASSERT( messenger, EXIMPPlgTestGrantPresenceForEveryoneCalled, 
+            "GrantPresenceForEveryoneL was not called",
+            ( a == 0 ) ? ETrue : EFalse,
+            "GrantPresenceForEveryoneL was called" );
+        }
+        
+// GRANT AGAIN        
+
+    for( a = 0; a < countOfWrappers; ++a )
+        {
+        CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a );
+        MXIMPContext* context = wrapper->GetContext();
+        CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+        // Tell the protocol it should act normally
+        messenger->SetNoError();
+
+        // Get the interfaces
+        MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+        MPresenceAuthorization& presAuth = presFeat->PresenceAuthorization();
+
+        // Setup status event listener for RequestComplete
+        SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk );
+        messenger->SetValueFor( EXIMPPlgTestGrantPresenceForEveryoneCalled, 0 );
+
+
+        // register interest
+        TXIMPRequestId reqId = presAuth.GrantPresenceForEveryoneL( *pif );
+
+        // Wait for events on the request
+        wrapper->WaitRequestAndStackEvents( reqId );
+        // verify that UpdateInterest was called
+        COMMONASSERT( messenger, EXIMPPlgTestGrantPresenceForEveryoneCalled, 
+            "GrantPresenceForEveryoneL was not called", EFalse,
+            "GrantPresenceForEveryoneL was called" );
+        }
+
+        
+// WITHDRAW
+        
+    for( a = 0; a < countOfWrappers; ++a )
+        {
+        CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a );
+        MXIMPContext* context = wrapper->GetContext();
+        CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+        
+    // Get the interfaces
+    MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+    MPresenceAuthorization& presAuth = presFeat->PresenceAuthorization();
+
+        // Setup status event listener for RequestComplete
+        SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); // allow events after reqcomplete
+
+        // register interest
+        TXIMPRequestId reqId = presAuth.WithdrawPresenceGrantFromEveryoneL();
+
+        // Wait for events on the request
+        wrapper->WaitRequestAndStackEvents( reqId );
+        wrapper->VerifyEventStackL( _L8("Subscribing presentity presence, complete with error: ") );
+        // verify that UpdateInterest was called
+        COMMONASSERT( messenger, EXIMPPlgTestWithdrawPresenceFromEveryoneCalled, 
+            "WithdrawPresenceGrantFromEveryoneL was not called",
+            ( a < 2 ) ? EFalse : ETrue,
+            "WithdrawPresenceGrantFromEveryoneL was called" );
+        }
+    
+    CleanupStack::PopAndDestroy( pif );
+        
+    UnbindAllL();    
+    }
+
+
+// ==============================================================================================
+
+void T_PresenceAuthorization::T_ErrFromPlg_LeaveOnWithdrawPresenceFromEveryone_L()
+    {
+    EUNIT_PRINT( _L("Error from plug-in in withdraw presence from everyone") );    
+
+// INITIALIZE
+
+    BindL();
+
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    MXIMPContext* context = wrapper->GetContext();
+    CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+    // Tell the protocol it should act normally
+    messenger->SetNoError();
+
+    // Get the interfaces
+    MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+    MPresenceAuthorization& presAuth = presFeat->PresenceAuthorization();
+
+    CPresenceInfoFilterImp* pif =
+                XIMPTestPresenceDataUtils::GenerateInfoFilterLC( &KPrefix1 );
+
+// GRANT
+
+    // Setup status event listener for RequestComplete
+    SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk );
+
+    // register interest
+    TXIMPRequestId reqId = presAuth.GrantPresenceForEveryoneL( *pif );
+
+    // Wait for events on the request
+    wrapper->WaitRequestAndStackEvents( reqId );
+    // verify that UpdateInterest was called
+    COMMONASSERT( messenger, EXIMPPlgTestGrantPresenceForEveryoneCalled, 
+                        "GrantPresenceForEveryoneL was not called", ETrue, 
+                        "GrantPresenceForEveryoneL was called" );
+
+// WITHDRAW
+
+    messenger->SetLeave( KErrAbort );
+
+    SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_PresentitySubscribeFailKErrAbort );
+    // register interest
+    reqId = presAuth.WithdrawPresenceGrantFromEveryoneL();
+
+    // Wait for events on the request
+    wrapper->WaitRequestAndStackEvents( reqId );
+    wrapper->VerifyEventStackL( _L8("Grantin presence to presentity, complete with error: ") );
+    // verify that UpdateInterest was called
+    COMMONASSERT( messenger, EXIMPPlgTestWithdrawPresenceFromPresentityCalled, 
+                        "WithdrawPresenceGrantFromEveryoneL was not called", EFalse, 
+                        "WithdrawPresenceGrantFromEveryoneL was called" );
+
+    messenger->SetLeave( KErrNone );
+
+// DEINITIALIZE
+
+    CleanupStack::PopAndDestroy( pif ); //pif
+    UnbindL();
+    }
+    
+    
+
+// ==============================================================================================
+
+void T_PresenceAuthorization::T_GrantPresenceForGroupMembers_L()
+    {
+    EUNIT_PRINT( _L("Grant presence for presentity group members") );
+
+    BindL();
+
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    MXIMPContext* context = wrapper->GetContext();
+    CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+    // Tell the protocol it should act normally
+    messenger->SetNoError();
+
+    // Get the interfaces
+    MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+    MPresenceAuthorization& presAuth = presFeat->PresenceAuthorization();
+
+    CXIMPIdentityImp* identity = XIMPTestPresenceDataUtils::GenerateIdentityLC( &KNullDesC8 );
+    CPresenceInfoFilterImp* pif =
+                XIMPTestPresenceDataUtils::GenerateInfoFilterLC( &KPrefix1 );
+
+// GRANT
+
+    // Setup status event listener for RequestComplete
+    SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk );
+
+    // register interest
+    TXIMPRequestId reqId = presAuth.GrantPresenceForPresentityGroupMembersL( *identity, *pif );
+
+    // Wait for events on the request
+    wrapper->WaitRequestAndStackEvents( reqId );
+    // verify that UpdateInterest was called
+    COMMONASSERT( messenger, EXIMPPlgTestGrantPresenceForPresentityGroupMembersCalled, "GrantPresenceForPresentityGroupMembers was not called", ETrue, NULL );
+
+    // Setup status event listener for RequestComplete
+    SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); // allow events after reqcomplete
+
+// GRANT AGAIN
+
+    // Setup status event listener for RequestComplete
+    SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk );
+    messenger->SetValueFor( EXIMPPlgTestGrantPresenceForPresentityGroupMembersCalled, 0 );
+     
+    reqId = presAuth.GrantPresenceForPresentityGroupMembersL( *identity, *pif );
+
+    // Wait for events on the request
+    wrapper->WaitRequestAndStackEvents( reqId );
+    // verify that UpdateInterest was called
+    COMMONASSERT( messenger, EXIMPPlgTestGrantPresenceForPresentityGroupMembersCalled, "GrantPresenceForPresentityGroupMembers was not called", EFalse, "GrantPresenceForPresentityGroupMembers was called" );
+
+    // Setup status event listener for RequestComplete
+    SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); // allow events after reqcomplete
+
+// WITHDRAW
+    // register interest
+    reqId = presAuth.WithdrawPresenceGrantFromPresentityGroupMembersL( *identity );
+
+    // Wait for events on the request
+    wrapper->WaitRequestAndStackEvents( reqId );
+    wrapper->VerifyEventStackL( _L8("Granting presence for presentity group members complete with error: ") );
+    // verify that UpdateInterest was called
+    COMMONASSERT( messenger, EXIMPPlgTestWithdrawPresenceFromPresentityGroupMembersCalled, "WithdrawPresenceFromPresentityGroupMembers was not called", ETrue, NULL );
+
+    CleanupStack::PopAndDestroy( 2, identity ); //pif, identity
+    UnbindL();
+    }
+
+// ==============================================================================================
+
+void T_PresenceAuthorization::T_GrantPresenceForGroupMembersChangeId_L()
+    {
+    EUNIT_PRINT( _L("Grant presence for presentity group members change id") );
+
+// INITIALIZE
+
+    BindL();
+
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    MXIMPContext* context = wrapper->GetContext();
+    CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+    // Tell the protocol it should act normally
+    messenger->SetNoError();
+
+    // Get the interfaces
+    MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+    MPresenceAuthorization& presAuth = presFeat->PresenceAuthorization();
+
+// ID CHANGE REQUEST TO ADAPTATION
+
+    MXIMPIdentity* identityParam = context->ObjectFactory().NewIdentityLC();
+    identityParam->SetIdentityL( KIdentity );
+    
+    CXIMPIdentityImp* identityParamImp =
+             ( CXIMPIdentityImp* ) identityParam->GetInterface(
+                                        CXIMPIdentityImp::KClassId,
+                                        MXIMPBase::EPanicIfUnknown );
+    HBufC8* packedId = TXIMPObjectPacker< CXIMPIdentityImp >::PackL( *identityParamImp );
+    CleanupStack::PopAndDestroy(); // identityParam
+    CleanupStack::PushL( packedId );
+    CXIMPTestFileSrvMsg* srvMsg = CXIMPTestFileSrvMsg::NewL( CXIMPTestFileSrvMsg::ETestSrvMsgReqParamIdentity, 
+                                                             *packedId );
+    CleanupStack::PopAndDestroy( packedId );
+    CleanupStack::PushL( srvMsg );
+    wrapper->FileTool().SrvMsgStoreL( srvMsg );
+    CleanupStack::PopAndDestroy( srvMsg );
+
+    // Wait for server to handle srvmsg.
+    CXIMPTestWaitHelper* wait = CXIMPTestWaitHelper::NewL();
+    CleanupStack::PushL( wait );
+    wait->WaitForL( 2 );
+    CleanupStack::PopAndDestroy( wait );
+
+// GRANT
+
+    // Setup status event listener for RequestComplete
+    SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk );
+
+    CXIMPIdentityImp* identity = XIMPTestPresenceDataUtils::GenerateIdentityLC( &KNullDesC8 );
+    CPresenceInfoFilterImp* pif =
+                XIMPTestPresenceDataUtils::GenerateInfoFilterLC( &KPrefix1 );
+
+    // register interest
+    TXIMPRequestId reqId = presAuth.GrantPresenceForPresentityGroupMembersL( *identity, *pif );
+
+    // Wait for events on the request
+    wrapper->WaitRequestAndStackEvents( reqId );
+    // verify that UpdateInterest was called
+    COMMONASSERT( messenger, EXIMPPlgTestGrantPresenceForPresentityGroupMembersCalled, "GrantPresenceForPresentityGroupMembers was not called", ETrue, NULL );
+
+// DEINITIALIZE
+
+    CleanupStack::PopAndDestroy( 2, identity ); //pif, identity
+    UnbindL();
+    }
+
+
+// ==============================================================================================
+
+void T_PresenceAuthorization::T_WithdrawNotGrantedPresenceFromEveryone_L()
+    {
+    EUNIT_PRINT( _L("Withdraw presence from everyone not granted") );
+
+// INITIALIZE
+
+    BindL();
+
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    MXIMPContext* context = wrapper->GetContext();
+    CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+    // Tell the protocol it should act normally
+    messenger->SetNoError();
+
+    // Get the interfaces
+    MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+    MPresenceAuthorization& presAuth = presFeat->PresenceAuthorization();
+
+// WITHDRAW
+
+    SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk );
+    // register interest
+    TXIMPRequestId reqId = presAuth.WithdrawPresenceGrantFromEveryoneL();
+
+    // Wait for events on the request
+    wrapper->WaitRequestAndStackEvents( reqId );
+    // Changed for OPAA-73BCS8
+    wrapper->VerifyEventStackL( _L8("Withdraw not granted everyone, complete with error: ") );
+    COMMONASSERT( messenger, EXIMPPlgTestWithdrawPresenceFromEveryoneCalled, 
+                        "WithdrawPresenceGrantFromEveryoneL was not called", ETrue /*EFalse*/, 
+                        "WithdrawPresenceGrantFromEveryoneL was called" );
+
+// DEINITIALIZE
+    UnbindL();
+    }
+
+
+// ==============================================================================================
+
+void T_PresenceAuthorization::T_WithdrawNotGrantedPresenceFromEveryone_Multiple_L()
+    {
+    EUNIT_PRINT( _L("Withdraw presence from everyone not granted multiple clients") );
+
+    BindAllL();
+
+    CPresenceInfoFilterImp* pif =
+                XIMPTestPresenceDataUtils::GenerateInfoFilterLC( &KPrefix1 );
+
+// GRANT ALL BUT FIRST
+
+    TInt countOfWrappers = iWrapperMgr->WrapperCount();
+    TInt a(0);
+    for( a = countOfWrappers - 1; a >= 1; --a )
+        {
+        CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a );
+        MXIMPContext* context = wrapper->GetContext();
+        CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+        // Tell the protocol it should act normally
+        messenger->SetNoError();
+
+        // Get the interfaces
+        MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+        MPresenceAuthorization& presAuth = presFeat->PresenceAuthorization();
+
+        // Setup status event listener for RequestComplete
+        SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk );
+
+        // register interest
+        TXIMPRequestId reqId = presAuth.GrantPresenceForEveryoneL( *pif );
+
+        // Wait for events on the request
+        wrapper->WaitRequestAndStackEvents( reqId );
+        // verify that UpdateInterest was called
+        COMMONASSERT( messenger, EXIMPPlgTestGrantPresenceForEveryoneCalled,
+            "GrantPresenceForEveryoneL was not called",
+            ( a > 1 ) ? ETrue : EFalse,
+            "GrantPresenceForEveryoneL was called" );
+        }
+        
+// WITHDRAW
+        
+    for( a = 0; a < countOfWrappers; ++a )
+        {
+        CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a );
+        MXIMPContext* context = wrapper->GetContext();
+        CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+        
+        // Get the interfaces
+        MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+        MPresenceAuthorization& presAuth = presFeat->PresenceAuthorization();
+
+        // Setup status event listener for RequestComplete
+        SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); // allow events after reqcomplete
+
+        // register interest
+        TXIMPRequestId reqId = presAuth.WithdrawPresenceGrantFromEveryoneL();
+
+        // Wait for events on the request
+        wrapper->WaitRequestAndStackEvents( reqId );
+        wrapper->VerifyEventStackL( _L8("Subscribing presentity presence, complete with error: ") );
+        // verify that UpdateInterest was called
+        // Changed for OPAA-73BCS8
+        COMMONASSERT( messenger, EXIMPPlgTestWithdrawPresenceFromEveryoneCalled, 
+            "WithdrawPresenceGrantFromEveryoneL was not called",
+            ( a < ( countOfWrappers -1 )/*a < 2^*/ ) ? EFalse : ETrue,
+            "WithdrawPresenceGrantFromEveryoneL was called" );
+        }
+    
+    CleanupStack::PopAndDestroy( pif );
+        
+    UnbindAllL();    
+    }
+
+
+// ==============================================================================================
+void T_PresenceAuthorization::T_MakeAndGrantGroup_WithdrawOneID_L()
+    {
+    EUNIT_PRINT( _L("T_MakeAndGrantGroup_WithdrawOneID_L") );
+
+    BindL();
+
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    MXIMPContext* context = wrapper->GetContext();
+    CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+    // Tell the protocol it should act normally
+    messenger->SetNoError();
+            
+    // Get the interfaces
+    MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+    MPresenceAuthorization& presAuth = presFeat->PresenceAuthorization();
+    MPresentityGroups& presGroup = presFeat->PresentityGroups();
+    
+    
+    // CREATE PRESENTITY GROUP
+    
+    // Setup status event listener for RequestComplete
+    // This will also produce HandlePresentityGroupListEvent, since the
+    // the group is subscribed
+    SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk );
+
+
+    MXIMPIdentity* groupId = context->ObjectFactory().NewIdentityLC();
+    CleanupStack::Pop(); // groupId
+    groupId->SetIdentityL( KGroupId );
+    
+    // subscribe
+    TXIMPRequestId reqId;
+    reqId = presGroup.CreatePresentityGroupL( *groupId, KGroupDisplayName );
+    
+    // Wait for events on the request
+    wrapper->WaitRequestAndStackEvents( reqId );
+    wrapper->VerifyEventStackL( _L8("CreatePresentityGroupL failed, complete with error: ") );
+    
+    // verify that SubscribePresentityGroupListL was called
+    messenger->AssertCreatePresentityGroupCalled( ETrue );
+
+    
+    // ADD PRESENTITY GROUP MEMBER 1
+    
+    CXIMPTestListener* listener4 = CXIMPTestListener::NewL( context );
+    CleanupStack::PushL( listener4 );    // << listener4
+    
+    MXIMPIdentity* member = context->ObjectFactory().NewIdentityLC(); // << member
+    member->SetIdentityL( KIdentity1_16 );
+
+
+    // request complete
+    TXIMPRequestId reqIdDummy;
+    CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+
+    // group id
+    CXIMPIdentityImp* identity2 = CXIMPIdentityImp::NewLC( groupId->Identity() );
+    evReqComplete->AppendParamL( identity2 );
+    CleanupStack::Pop(identity2); // identity2
+
+    // id for member info
+    CXIMPIdentityImp* miId = CXIMPIdentityImp::NewLC( KIdentity1_16 );
+    // member info
+    CPresentityGroupMemberInfoImp* memInfoImp =
+        CPresentityGroupMemberInfoImp::NewLC( *miId, KIdentity1_16 );
+    evReqComplete->AppendParamL( memInfoImp );
+    CleanupStack::Pop(memInfoImp); // memInfoImp owned by AppendParamL
+    CleanupStack::PopAndDestroy( miId ); // copy was made
+
+    listener4->ExpectL( evReqComplete );
+    CleanupStack::Pop( evReqComplete );
+
+    // do the call
+    reqId = presGroup.AddPresentityGroupMemberL(
+            *groupId, *member, KIdentity1_16 );
+
+    // and wait
+    EUNIT_ASSERT_DESC( KErrNone == listener4->WaitAndAssertL(), "AddPresentityGroupMemberL (not subscribed) failed" );
+
+    messenger->AssertAddPresentityGroupMemberCalled( ETrue );
+    CleanupStack::PopAndDestroy(); // >>> member
+    CleanupStack::PopAndDestroy( listener4 );// >>> listener4
+    
+    // ADD PRESENTITY GROUP MEMBER 2
+    
+    listener4 = CXIMPTestListener::NewL( context );
+    CleanupStack::PushL( listener4 );    // << listener4
+    
+    member = context->ObjectFactory().NewIdentityLC(); // << member
+    member->SetIdentityL( KIdentity2_16 );
+
+
+    // request complete
+    evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+
+    // group id
+    //delete identity2;
+    identity2 = CXIMPIdentityImp::NewLC( groupId->Identity() );
+    evReqComplete->AppendParamL( identity2 );
+    CleanupStack::Pop(identity2); // identity2
+
+    // id for member info
+    miId = CXIMPIdentityImp::NewLC( KIdentity2_16 );
+    // member info
+    memInfoImp = CPresentityGroupMemberInfoImp::NewLC( *miId, KIdentity2_16 );
+    evReqComplete->AppendParamL( memInfoImp );
+    CleanupStack::Pop(memInfoImp); // memInfoImp owned by AppendParamL
+    CleanupStack::PopAndDestroy( miId ); // copy was made
+
+    listener4->ExpectL( evReqComplete );
+    CleanupStack::Pop( evReqComplete );
+
+    // do the call
+    reqId = presGroup.AddPresentityGroupMemberL( *groupId, *member, KIdentity2_16 );
+
+    // and wait
+    EUNIT_ASSERT_DESC( KErrNone == listener4->WaitAndAssertL(), "AddPresentityGroupMemberL (not subscribed) failed" );
+
+    messenger->AssertAddPresentityGroupMemberCalled( ETrue );
+    CleanupStack::PopAndDestroy(); // >>> member
+    CleanupStack::PopAndDestroy( listener4 );// >>> listener4
+
+    // ADD PRESENTITY GROUP MEMBER 3
+    
+    //delete identity2;
+    listener4 = CXIMPTestListener::NewL( context );
+    CleanupStack::PushL( listener4 );    // << listener4
+    
+    member = context->ObjectFactory().NewIdentityLC(); // << member
+    member->SetIdentityL( KIdentity3_16 );
+
+
+    // request complete
+    evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+
+    // group id
+    identity2 = CXIMPIdentityImp::NewLC( groupId->Identity() );
+    evReqComplete->AppendParamL( identity2 );
+    CleanupStack::Pop(identity2); // identity2
+
+    // id for member info
+    miId = CXIMPIdentityImp::NewLC( KIdentity3_16 );
+    // member info
+    memInfoImp = CPresentityGroupMemberInfoImp::NewLC( *miId, KIdentity3_16 );
+    evReqComplete->AppendParamL( memInfoImp );
+    CleanupStack::Pop(memInfoImp); // memInfoImp owned by AppendParamL
+    CleanupStack::PopAndDestroy( miId ); // copy was made
+
+    listener4->ExpectL( evReqComplete );
+    CleanupStack::Pop( evReqComplete );
+
+    // do the call
+    reqId = presGroup.AddPresentityGroupMemberL(
+            *groupId, *member, KIdentity3_16 );
+
+    // and wait
+    EUNIT_ASSERT_DESC( KErrNone == listener4->WaitAndAssertL(), "AddPresentityGroupMemberL (not subscribed) failed" );
+
+    messenger->AssertAddPresentityGroupMemberCalled( ETrue );
+    CleanupStack::PopAndDestroy(); // >>> member
+    CleanupStack::PopAndDestroy( listener4 );// >>> listener4
+
+
+    // GRANT PRESENTITY GROUP MEMBER
+
+    // This is the group we are interested in
+    MXIMPIdentity* ggroup = context->ObjectFactory().NewIdentityLC();
+    CleanupStack::Pop(); // ggroup
+    ggroup->SetIdentityL( KGroupId );
+    // Set filter for the group
+    CPresenceInfoFilterImp* ggpif = CPresenceInfoFilterImp::NewLC();
+    //ggpif->AcceptPersonFilterL( NPresenceInfo::NFieldType::KAcceptAll  );
+    CleanupStack::Pop(ggpif); // ggpif
+
+    // Setup status event listener for RequestComplete
+    SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk );
+
+    // grant for all
+    reqId = presAuth.GrantPresenceForPresentityGroupMembersL( *ggroup, *ggpif );
+
+    // Wait for events on the request
+    wrapper->WaitRequestAndStackEvents( reqId );
+    
+    // verify that UpdateInterest was called
+    COMMONASSERT( messenger, EXIMPPlgTestGrantPresenceForPresentityGroupMembersCalled, 
+        "GrantPresenceForPresentityGroupMembersL was not called", ETrue, NULL );
+    delete ggroup;
+    delete ggpif;
+
+
+    // Withdraw one of group's member's ID
+    
+    MXIMPIdentity* identity = context->ObjectFactory().NewIdentityLC();
+    identity->SetIdentityL( KIdentity2_16 ); // << identity
+
+    
+    SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk );
+    // register interest
+    reqId = presAuth.WithdrawPresenceGrantFromPresentityL( *identity );
+
+    // Wait for events on the request
+    wrapper->WaitRequestAndStackEvents( reqId );
+    wrapper->VerifyEventStackL( _L8("Grantin presence to presentity, complete with error: ") );
+    
+    // Changed for OPAA-73BCS8
+    // verify that UpdateInterest was called
+    COMMONASSERT( messenger, EXIMPPlgTestWithdrawPresenceFromPresentityCalled, 
+                        "WithdrawPresenceForPresentityL was not called", ETrue/*EFalse*/, 
+                        "WithdrawPresenceForPresentityL was called" );
+                            
+    CleanupStack::PopAndDestroy(); // identity
+    delete groupId;
+
+    UnbindL();
+    
+    wrapper = NULL;
+    context = NULL;
+    messenger = NULL;
+    }
+
+
+// ===========================================================================
+// SETUP HELPERS FOR THE LISTENER
+// ===========================================================================
+//
+void T_PresenceAuthorization::SetupListenerReqCompleteL( CXIMPTestContextWrapper* aWrapper, TXIMPTestStatusEventTemplate aEventType )
+    {
+    RArray< TInt32 > array;
+    CleanupClosePushL( array );
+    array.Append( MXIMPContextStateEvent::KInterfaceId );
+    array.Append( MPresentityPresenceEvent::KInterfaceId );
+    aWrapper->SetupListenerReqCompleteL( aEventType, &array );
+    CleanupStack::PopAndDestroy(); // array
+    }
+
+void T_PresenceAuthorization::SetupListenerReqCompleteAllowEventsL(  CXIMPTestContextWrapper* aWrapper, TXIMPTestStatusEventTemplate aEventType )
+    {
+    RArray< TInt32 > array;
+    CleanupClosePushL( array );
+    array.AppendL( MXIMPRequestCompleteEvent::KInterfaceId );
+    array.AppendL( MXIMPContextStateEvent::KInterfaceId );
+    array.AppendL( MPresentityPresenceEvent::KInterfaceId );
+    aWrapper->SetupListenerReqCompleteL( aEventType, &array );
+    CleanupStack::PopAndDestroy(); // array
+    }
+
+// ===========================================================================
+// TEST CASE TABLE
+// ===========================================================================
+//
+EUNIT_BEGIN_TEST_TABLE(
+        T_PresenceAuthorization,
+        "XIMP presence authorization tests",
+        "MODULE" )
+
+PRFW_DECORATED_TEST(
+        "Grant presence for presentity",
+        "",
+        "",
+        "FUNCTIONALITY",
+        Setup_L,
+        T_GrantPresenceForPresentity_L,
+        Teardown )
+
+        
+PRFW_DECORATED_TEST(
+        "MakeAndGrantGroup_WithdrawOneID",
+        "",
+        "",
+        "FUNCTIONALITY",
+        Setup_L,
+        T_MakeAndGrantGroup_WithdrawOneID_L,
+        Teardown )
+        
+        
+PRFW_DECORATED_TEST(
+        "Grant presence for presentity multiple",
+        "",
+        "",
+        "FUNCTIONALITY",
+        SetupMultiple_L,
+        T_GrantPresenceForPresentity_Multiple_L,
+        Teardown )
+
+
+PRFW_DECORATED_TEST(
+        "Withdraw not granted presence for presentity",
+        "",
+        "",
+        "FUNCTIONALITY",
+        Setup_L,
+        T_WithdrawNotGrantedPresenceFromPresentity_L,
+        Teardown )
+
+
+PRFW_DECORATED_TEST(
+        "Grant presence for presentity change id",
+        "",
+        "",
+        "FUNCTIONALITY",
+        Setup_L,
+        T_GrantPresenceForPresentityChangeId_L,
+        Teardown )
+
+PRFW_DECORATED_TEST(
+        "Grant presence for group members change id",
+        "",
+        "",
+        "FUNCTIONALITY",
+        Setup_L,
+        T_GrantPresenceForGroupMembersChangeId_L,
+        Teardown )
+
+
+PRFW_DECORATED_TEST(
+        "Withdraw not granted presence from presentity multiple",
+        "",
+        "",
+        "FUNCTIONALITY",
+        SetupMultiple_L,
+        T_WithdrawNotGrantedPresenceFromPresentity_Multiple_L,
+        Teardown )
+
+PRFW_DECORATED_TEST(
+        "ErrorPlugin - Leave on grant",
+        "",
+        "",
+        "ERRORHANDLING",
+        Setup_L,
+        T_ErrFromPlg_LeaveOnGrantPresenceForPresentity_L,
+        Teardown )
+
+PRFW_DECORATED_TEST(
+        "ErrorPlugin - Leave on withdraw",
+        "",
+        "",
+        "ERRORHANDLING",
+        Setup_L,
+        T_ErrFromPlg_LeaveOnWithdrawPresenceFromPresentity_L,
+        Teardown )
+
+PRFW_DECORATED_TEST(
+        "Withdraw not granted presence for group members",
+        "",
+        "",
+        "FUNCTIONALITY",
+        Setup_L,
+        T_WithdrawNotGrantedPresenceFromGroupMembers_L,
+        Teardown )
+
+PRFW_DECORATED_TEST(
+        "Withdraw not granted presence for group members multiple",
+        "",
+        "",
+        "FUNCTIONALITY",
+        SetupMultiple_L,
+        T_WithdrawNotGrantedPresenceFromGroupMembers_Multiple_L,
+        Teardown )
+
+PRFW_DECORATED_TEST(
+        "Grant presence for group members",
+        "",
+        "",
+        "FUNCTIONALITY",
+        Setup_L,
+        T_GrantPresenceForGroupMembers_L,
+        Teardown )
+
+
+PRFW_DECORATED_TEST(
+        "Grant presence for group members multiple",
+        "",
+        "",
+        "FUNCTIONALITY",
+        SetupMultiple_L,
+        T_GrantPresenceForGroupMembers_Multiple_L,
+        Teardown )
+
+
+PRFW_DECORATED_TEST(
+        "ErrorPlugin - Leave on withdraw for group members",
+        "",
+        "",
+        "ERRORHANDLING",
+        Setup_L,
+        T_ErrFromPlg_LeaveOnGrantPresenceForGroupMembers_L,
+        Teardown )
+
+PRFW_DECORATED_TEST(
+        "ErrorPlugin - Leave on withdraw from group members",
+        "",
+        "",
+        "ERRORHANDLING",
+        Setup_L,
+        T_ErrFromPlg_LeaveOnWithdrawPresenceFromGroupMembers_L,
+        Teardown )
+
+PRFW_DECORATED_TEST(
+        "Grant presence for everyone",
+        "",
+        "",
+        "FUNCTIONALITY",
+        Setup_L,
+        T_GrantPresenceForEveryone_L,
+        Teardown )
+        
+PRFW_DECORATED_TEST(
+        "ErrorPlugin - Leave on grant to everyone",
+        "",
+        "",
+        "ERRORHANDLING",
+        Setup_L,
+        T_ErrFromPlg_LeaveOnGrantPresenceForEveryone_L,
+        Teardown )
+
+PRFW_DECORATED_TEST(
+        "ErrorPlugin - Leave on withdraw from everyone",
+        "",
+        "",
+        "ERRORHANDLING",
+        Setup_L,
+        T_ErrFromPlg_LeaveOnWithdrawPresenceFromEveryone_L,
+        Teardown )
+
+PRFW_DECORATED_TEST(
+        "Grant presence for everyone multiple ",
+        "",
+        "",
+        "FUNCTIONALITY",
+        SetupMultiple_L,
+        T_GrantPresenceForEveryone_Multiple_L,
+        Teardown )
+
+PRFW_DECORATED_TEST(
+        "Withdraw not granted presence from everyone",
+        "",
+        "",
+        "FUNCTIONALITY",
+        Setup_L,
+        T_WithdrawNotGrantedPresenceFromEveryone_L,
+        Teardown )
+
+PRFW_DECORATED_TEST(
+        "Withdraw not granted presence from everyone multiple",
+        "",
+        "",
+        "FUNCTIONALITY",
+        SetupMultiple_L,
+        T_WithdrawNotGrantedPresenceFromEveryone_Multiple_L,
+        Teardown )
+        
+
+EUNIT_END_TEST_TABLE
+
+
+// ===========================================================================
+// TEST SUITE CONSTRUCTION
+// ===========================================================================
+//
+EXPORT_C MEUnitTest* CreateTestSuiteL()
+    {
+    return T_PresenceAuthorization::NewL();
+    }
+
+
+
+// end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/tsrc/src/t_presenceauthorization/t_presenceauthorization.h	Wed Nov 03 09:32:20 2010 +0530
@@ -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: XIMP Framework Test Code 
+*
+*/
+
+#ifndef T_PRESENCEAUTHORIZATION_H
+#define T_PRESENCEAUTHORIZATION_H
+
+
+//  EXTERNAL INCLUDES
+#include <platform/digia/eunit/ceunittestsuiteclass.h>
+#include <platform/digia/eunit/EUnitDecorators.h>
+
+#include <ximpbase.h>
+#include "prfwteststatuseventlistener.h"
+#include "prfwtestmessaging.h"
+
+class CXIMPTestContextWrapper;
+class CXIMPTestContextWrapperMgr;
+class CXIMPTestMessenger;
+
+/**
+ * XIMP Framework Eunit tests.
+ *
+ * Tests for XIMP session management services.
+ *
+ * @since S60 v4.0
+ */
+class T_PresenceAuthorization : public CEUnitTestSuiteClass
+    {
+
+public:
+    static T_PresenceAuthorization* NewL();
+    virtual ~T_PresenceAuthorization();
+
+
+private:
+    T_PresenceAuthorization();
+    void ConstructL();
+
+private:    // Test case functions
+
+    void Setup_L();
+    void SetupMultiple_L();
+    void BindL();
+    void BindAllL();
+    void Teardown();
+    void UnbindL();
+    void UnbindAllL();
+
+    void T_GrantPresenceForPresentity_L();
+    void T_GrantPresenceForPresentityChangeId_L();
+    void T_WithdrawNotGrantedPresenceFromPresentity_L();
+    void T_ErrFromPlg_LeaveOnGrantPresenceForPresentity_L();
+    void T_ErrFromPlg_LeaveOnWithdrawPresenceFromPresentity_L();
+
+    void T_GrantPresenceForPresentity_Multiple_L();
+    void T_WithdrawNotGrantedPresenceFromPresentity_Multiple_L();
+    
+    void T_GrantPresenceForGroupMembers_L();
+    void T_GrantPresenceForGroupMembersChangeId_L();
+    void T_ErrFromPlg_LeaveOnGrantPresenceForGroupMembers_L();
+    void T_ErrFromPlg_LeaveOnWithdrawPresenceFromGroupMembers_L();
+
+    void T_GrantPresenceForGroupMembers_Multiple_L();
+    void T_WithdrawNotGrantedPresenceFromGroupMembers_L();
+    void T_WithdrawNotGrantedPresenceFromGroupMembers_Multiple_L();
+
+    void T_GrantPresenceForEveryone_L();
+    void T_ErrFromPlg_LeaveOnGrantPresenceForEveryone_L();
+    void T_ErrFromPlg_LeaveOnWithdrawPresenceFromEveryone_L();
+
+    void T_GrantPresenceForEveryone_Multiple_L();
+    void T_WithdrawNotGrantedPresenceFromEveryone_L();
+    void T_WithdrawNotGrantedPresenceFromEveryone_Multiple_L();
+
+    void T_MakeAndGrantGroup_WithdrawOneID_L();
+
+private:    // Test helpers
+
+    void SetupListenerReqCompleteL( CXIMPTestContextWrapper* aWrapper, TXIMPTestStatusEventTemplate aEventType );
+    void SetupListenerReqCompleteAllowEventsL( CXIMPTestContextWrapper* aWrapper, TXIMPTestStatusEventTemplate aEventTypes );
+
+private: // Test data
+
+    /**
+     * Eunit test case table declaration.
+     */
+    EUNIT_DECLARE_TEST_TABLE;
+
+    // owned
+    CXIMPTestContextWrapperMgr* iWrapperMgr;
+    };
+
+
+#endif      //  T_PRESENCEAUTHORIZATION_H
+
+
+
+// end of file
+
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/tsrc/src/t_presenceauthorization/t_presenceauthorization.mmp	Wed Nov 03 09:32:20 2010 +0530
@@ -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: XIMP Framework Test Code 
+*
+*/
+
+#include            "../../tsrcutils/eunitcommon/eunittstdllbase.hrh"
+#include            "../../tsrcutils/processmaster/pm.h"
+
+#include<platform_paths.hrh>
+#include<eunitcaps.h>
+
+TARGET              t_presenceauthorization.dll
+//CAPABILITY              ALL - TCB - DRM
+CAPABILITY      EUNIT_CAPS
+
+SOURCEPATH          .
+SOURCE              t_presenceauthorization.cpp
+
+
+USERINCLUDE             ../../../core/srcdatamodel
+USERINCLUDE             ../../../presence/srcpresencedatamodel
+USERINCLUDE             ../../../presence/srcpresencedatamodel/presentitygroups
+USERINCLUDE             ../../../presence/srcpresencedatamodel/presencewatching
+USERINCLUDE             ../../../presence/srcpresencedatamodel/presenceauthorization
+USERINCLUDE             ../../../presence/srcpresencedatamodel/presencepublishing
+USERINCLUDE             ../../../presence/srcpresencedatamodel/presenceinfo
+USERINCLUDE             ../../../core/srcutils
+
+// TODO remove unnecessary
+#if defined ( OS_LAYER_SYSTEMINCLUDE )
+OS_LAYER_SYSTEMINCLUDE
+#else
+SYSTEMINCLUDE     /epoc32/include
+#endif
+
+ #if defined ( APP_LAYER_SYSTEMINCLUDE )
+ APP_LAYER_SYSTEMINCLUDE
+ #else
+ SYSTEMINCLUDE     \epoc32\include
+ #endif
+ 
+ 
+SYSTEMINCLUDE           ../../../inc/core/base
+SYSTEMINCLUDE           ../../../inc/core/datamodel
+SYSTEMINCLUDE           ../../../inc/core/protocolplugin
+SYSTEMINCLUDE           ../../../inc/core/protocolpluginhost
+SYSTEMINCLUDE           ../../../inc/presence/presencedatamodel
+SYSTEMINCLUDE           ../../../inc/presence/presencemanagement
+SYSTEMINCLUDE           ../../../inc/presence/presenceprotocolplugin
+SYSTEMINCLUDE           ../../../inc/presence/presenceprotocolpluginhost
+
+LIBRARY             ecom.lib
+LIBRARY             bafl.lib
+LIBRARY             ximpdatamodel.lib
+LIBRARY             presencedatamodel.lib
+LIBRARY             estor.lib
+LIBRARY             ximputils.lib
+LIBRARY             eunit.lib
+LIBRARY             eunitutil.lib
+LIBRARY             euser.lib
+
+// end of file
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/tsrc/src/t_presenceblocking/bld.inf	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,23 @@
+/*
+* 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 t_presenceblocking.dll
+*
+*/
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_TESTMMPFILES
+t_presenceblocking.mmp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/tsrc/src/t_presenceblocking/t_presenceblocking.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,1282 @@
+/*
+* 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: XIMP Framework Test Code 
+*
+*/
+
+
+#include "eunittools.h"
+
+
+#include <platform/digia/eunit/eunitmacros.h>
+#include <platform/digia/eunit/teunitassertioninfo.h>
+#include <ecom/ecom.h>
+#include <badesca.h>
+
+
+#include <presencefeatures.h>
+#include <presenceauthorization.h>
+#include <presenceblocklistevent.h>
+#include <presenceblockinfo.h>
+
+
+#include <ximpclient.h>
+#include <ximpcontext.h>
+#include <presencefeatures.h>
+
+#include "t_presenceblocking.h"
+
+// blocking includes
+#include "presenceblockinfoimp.h"
+#include "presenceblocklisteventimp.h"
+
+// other datamodel and utils includes
+#include "ximpidentityimp.h"
+#include "ximpobjecthelpers.h"
+
+
+// testing tool includes
+#include "prfwtestpresencedatautils.h"
+
+#include "prfwtestmessaging.h"
+#include "prfwtestmessenger.h"
+#include "prfwtestcontextwrappermgr.h"
+#include "prfwtestcontextwrapper.h"
+
+
+#include "prfwtestfilesrvmsg.h"
+#include "prfwtestfiletool.h"
+#include "prfwtestlistener.h"
+#include "ximprequestcompleteeventimp.h"
+
+#include "prfwtestrobustnesstools.h"
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// CONSTRUCTION
+T_PresenceBlocking* T_PresenceBlocking::NewL()
+    {
+    T_PresenceBlocking* self = new( ELeave ) T_PresenceBlocking;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+
+    return self;
+    }
+
+
+T_PresenceBlocking::~T_PresenceBlocking()
+    {
+    PrfwTestRobustness::DoPreCleaning();
+    }
+
+
+void T_PresenceBlocking::ConstructL()
+    {
+    CEUnitTestSuiteClass::ConstructL();
+    }
+
+
+T_PresenceBlocking::T_PresenceBlocking()
+    {
+    }
+
+
+
+// ===========================================================================
+// TEST CASE SETUP & TEARDOWN METHODS
+// ===========================================================================
+//
+
+void T_PresenceBlocking::Setup_L()
+    {
+    PrfwTestRobustness::DoPreCleaning();
+
+    iWrapperMgr = CXIMPTestContextWrapperMgr::NewL();
+    iWrapperMgr->CreateWrapperL();
+    }
+
+void T_PresenceBlocking::SetupMultiple_L()
+    {
+    PrfwTestRobustness::DoPreCleaning();
+
+    iWrapperMgr = CXIMPTestContextWrapperMgr::NewL();
+    iWrapperMgr->CreateWrapperL();
+    iWrapperMgr->CreateWrapperL();
+    iWrapperMgr->CreateWrapperL();
+    }
+
+
+void T_PresenceBlocking::BindL()
+    {
+    CXIMPTestContextWrapper* wrapper0 = iWrapperMgr->GetWrapperL( 0 );
+
+    wrapper0->BindL( 0 );
+    }
+
+void T_PresenceBlocking::BindAllL()
+    {
+    for( TInt a = 0; a < iWrapperMgr->WrapperCount(); ++a )
+        {
+        CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a );
+        wrapper->BindL( 0 );
+        }
+    }
+
+
+void T_PresenceBlocking::Teardown()
+    {
+    delete iWrapperMgr;
+    iWrapperMgr = NULL;
+    
+    REComSession::FinalClose();
+
+    PrfwTestRobustness::DoPreCleaning();
+    }
+
+void T_PresenceBlocking::UnbindL()
+    {
+    // Do unbind
+    CXIMPTestContextWrapper* wrapper0 = iWrapperMgr->GetWrapperL( 0 );
+    wrapper0->UnbindL();
+    }
+
+void T_PresenceBlocking::UnbindAllL()
+    {
+    for( TInt a = 0; a < iWrapperMgr->WrapperCount(); ++a )
+        {
+        CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a );
+        wrapper->UnbindL();
+        }
+    }
+
+
+// ===========================================================================
+// TEST CASES for presentity presence subscription
+// ===========================================================================
+
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+// Single client, empty filter
+void T_PresenceBlocking::T_SubscribeBlockList_Single_L()
+    {
+    EUNIT_PRINT( _L("Single presence block list subscription") );
+
+    BindL();
+
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    MXIMPContext* context = wrapper->GetContext();
+    CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+    CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context );
+    CleanupStack::PushL( listener2 );
+
+    // Tell the protocol it should act normally
+    messenger->SetNoError();
+
+    // Get the interfaces
+    MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+    
+    MPresenceAuthorization& presAuth = presFeat->PresenceAuthorization();
+
+    // Setup status event listener for RequestComplete
+    // ---------------------------------------------
+    listener2->Reset();
+
+    // normal request complete
+    TXIMPRequestId reqIdDummy;  // not checked
+    CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+    listener2->ExpectL( evReqComplete );
+    CleanupStack::Pop( evReqComplete );
+    // ---------------------------------------------
+
+    // subscribe
+    // ---------------------------------------------
+    TXIMPRequestId reqId = presAuth.SubscribePresenceBlockListL();
+    EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Subscribe failed" );
+    // ---------------------------------------------
+
+    // verify that SubscribeBlockListL was called
+    COMMONASSERT( messenger, EXIMPPlgTestSubscribePresenceBlockListCalled, "SubscribeBlockListL was not called", ETrue, NULL );
+
+    // Setup status event listener for RequestComplete
+    // ---------------------------------------------
+    listener2->Reset();
+
+    evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+    listener2->ExpectL( evReqComplete );
+    CleanupStack::Pop( evReqComplete );
+    // ---------------------------------------------
+
+    // unsubscribe
+    // ---------------------------------------------
+    reqId = presAuth.UnsubscribePresenceBlockListL();
+    EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Unsubscribe failed" );
+    // ---------------------------------------------
+
+    // verify that UnsubscribeBlockListL was called
+    COMMONASSERT( messenger, EXIMPPlgTestUnsubscribePresenceBlockListCalled, "UnsubscribeBlockListL was not called", ETrue, NULL );
+
+    // Deinitiliaze event source from listener.
+    listener2->SetEventSourceL( NULL );
+
+    UnbindL();
+
+    //CleanupStack::Pop(presFeat);
+    //delete presFeat;
+    //CleanupStack::PopAndDestroy();
+    CleanupStack::PopAndDestroy( listener2 );
+    }
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+// Single client, empty filter
+void T_PresenceBlocking::T_SubscribeBlockListRefresh_Single_L()
+    {
+    EUNIT_PRINT( _L("Single presence block list subscription refresh") );
+
+    BindL();
+
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    MXIMPContext* context = wrapper->GetContext();
+    CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+    CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context );
+    CleanupStack::PushL( listener2 );
+
+    // Tell the protocol it should act normally
+    messenger->SetNoError();
+
+    // Get the interfaces
+    MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+    MPresenceAuthorization& presAuth = presFeat->PresenceAuthorization();
+
+    // Setup status event listener for RequestComplete
+    // ---------------------------------------------
+    listener2->Reset();
+
+    // normal request complete
+    TXIMPRequestId reqIdDummy;  // not checked
+    CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+    listener2->ExpectL( evReqComplete );
+    CleanupStack::Pop( evReqComplete );
+    // ---------------------------------------------
+
+    // subscribe
+    // ---------------------------------------------
+    TXIMPRequestId reqId = presAuth.SubscribePresenceBlockListL();
+    EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Subscribe failed" );
+    // ---------------------------------------------
+
+    // verify that SubscribeBlockListL was called
+    COMMONASSERT( messenger, EXIMPPlgTestSubscribePresenceBlockListCalled, "SubscribeBlockListL was not called", ETrue, NULL );
+
+    // Setup status event listener for RequestComplete
+    // ---------------------------------------------
+    listener2->Reset();
+
+    evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+    listener2->ExpectL( evReqComplete );
+    CleanupStack::Pop( evReqComplete );
+
+    RPrBlockInfoImpArray* currentList(NULL);
+    CPresenceBlockListEventImp* event = CreateBlockListEventLCX(
+        KNullDesC, KNullDesC,
+        MXIMPDataSubscriptionState::ESubscriptionActive,
+        MXIMPDataSubscriptionState::EDataUnavailable,
+        ETestPBlCurrent, currentList );
+    listener2->ExpectL( event );
+    CleanupStack::Pop(); //event 4 to go.
+    // ---------------------------------------------
+
+    // subscribe again
+    // ---------------------------------------------
+    reqId = presAuth.SubscribePresenceBlockListL();
+    EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Refresh failed" );
+    CleanupStack::PopAndDestroy( 4 ); // rest of the items.
+    // ---------------------------------------------
+
+    // Setup status event listener for RequestComplete
+    // ---------------------------------------------
+    listener2->Reset();
+
+    evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+    listener2->ExpectL( evReqComplete );
+    CleanupStack::Pop( evReqComplete );
+    // ---------------------------------------------
+
+    // unsubscribe
+    // ---------------------------------------------
+    reqId = presAuth.UnsubscribePresenceBlockListL();
+    EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Unsubscribe failed" );
+    // ---------------------------------------------
+
+    // verify that UnsubscribeBlockListL was called
+    COMMONASSERT( messenger, EXIMPPlgTestUnsubscribePresenceBlockListCalled, "UnsubscribeBlockListL was not called", ETrue, NULL );
+
+    listener2->SetEventSourceL( NULL );
+
+    UnbindL();
+
+    CleanupStack::PopAndDestroy( listener2 );
+    }
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+// Single client, empty filter
+void T_PresenceBlocking::T_SubscribeBlockList_Multiple_L()
+    {
+    EUNIT_PRINT( _L("Multiple presence block list subscription") );
+
+    BindAllL();
+
+    TInt countOfWrappers = iWrapperMgr->WrapperCount();
+    TInt a(0);
+    for( a = 0; a < countOfWrappers; ++a )
+        {
+        CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a );
+        MXIMPContext* context = wrapper->GetContext();
+        CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+        // Get the interfaces
+        MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+        MPresenceAuthorization& presAuth = presFeat->PresenceAuthorization();
+
+        CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context );
+        CleanupStack::PushL( listener2 );
+
+        // Tell the protocol it should act normally
+        messenger->SetNoError();
+
+        // expect normal request complete
+        TXIMPRequestId reqIdDummy;  // not checked
+        CXIMPRequestCompleteEventImp* evReqComplete =
+                                CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+        listener2->ExpectL( evReqComplete );
+        CleanupStack::Pop( evReqComplete );
+
+        // subscribe
+        TXIMPRequestId reqId = presAuth.SubscribePresenceBlockListL();
+
+        EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Subscribe failed" );
+
+        // verify that SubscribePresenceBlockListL was called
+        COMMONASSERT( messenger, EXIMPPlgTestSubscribePresenceBlockListCalled, "SubscribePresenceBlockListL was not called", ETrue, NULL );
+
+        CleanupStack::PopAndDestroy( listener2 );
+        }
+
+    for( a = 0; a < countOfWrappers; ++a )
+        {
+        CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a );
+        MXIMPContext* context = wrapper->GetContext();
+        CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+        // Get the interfaces
+        MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+        MPresenceAuthorization& presAuth = presFeat->PresenceAuthorization();
+
+        CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context );
+        CleanupStack::PushL( listener2 );
+
+        // Tell the protocol it should act normally
+        messenger->SetNoError();
+
+        // expect normal request complete
+        TXIMPRequestId reqIdDummy;  // not checked
+        CXIMPRequestCompleteEventImp* evReqComplete =
+                            CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+        listener2->ExpectL( evReqComplete );
+        CleanupStack::Pop( evReqComplete );
+
+        // unsubscribe
+        TXIMPRequestId reqId = presAuth.UnsubscribePresenceBlockListL();
+
+        EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Unsubscribe failed" );
+
+        // verify that EXIMPPlgTestUnsubscribeBlockListCalled was called
+        COMMONASSERT( messenger, EXIMPPlgTestUnsubscribePresenceBlockListCalled,
+                "UnsubscribePresenceBlockListL was not called",
+                ( a < 2 ) ? EFalse : ETrue,
+                "UnsubscribePresenceBlockListL was called" );
+
+        CleanupStack::PopAndDestroy( listener2 );
+        }
+
+    UnbindAllL();
+    }
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+void T_PresenceBlocking::SubscribeL()
+    {
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    MXIMPContext* context = wrapper->GetContext();
+    CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+    // Get the interfaces
+    MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+    MPresenceAuthorization& presAuth = presFeat->PresenceAuthorization();
+
+    CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context );
+    CleanupStack::PushL( listener2 );
+
+    // ------------------------------------------------------
+    // expect normal request complete
+    TXIMPRequestId reqIdDummy;  // not checked
+    CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+    listener2->ExpectL( evReqComplete );
+    CleanupStack::Pop( evReqComplete );
+    // ------------------------------------------------------
+
+    // subscribe
+    TXIMPRequestId reqId = presAuth.SubscribePresenceBlockListL();
+    EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Subscribe failed" );
+
+    COMMONASSERT( messenger, EXIMPPlgTestSubscribePresenceBlockListCalled, "SubscribeBlockListL was not called", ETrue, NULL );
+
+    CleanupStack::PopAndDestroy( listener2 );
+    }
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+void T_PresenceBlocking::UnsubscribeL()
+    {
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    MXIMPContext* context = wrapper->GetContext();
+    CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+    // Get the interfaces
+    MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+    MPresenceAuthorization& presAuth = presFeat->PresenceAuthorization();
+
+    CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context );
+    CleanupStack::PushL( listener2 );
+
+    // ------------------------------------------------------
+    // expect normal request complete
+    TXIMPRequestId reqIdDummy;  // not checked
+    CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+    listener2->ExpectL( evReqComplete );
+    CleanupStack::Pop( evReqComplete );
+    // ------------------------------------------------------
+
+    // unsubscribe
+    TXIMPRequestId reqId = presAuth.UnsubscribePresenceBlockListL();
+    EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Unsubscribe failed" );
+
+    COMMONASSERT( messenger, EXIMPPlgTestUnsubscribePresenceBlockListCalled, "UnsubscribeBlockListL was not called", ETrue, NULL );
+
+    CleanupStack::PopAndDestroy( listener2 );
+    }
+
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+void T_PresenceBlocking::T_HandlePresenceBlockList_L()
+    {
+    EUNIT_PRINT( _L("Handle presence block list.") );
+
+    // log in and subscribe a block list
+    BindL();
+    SubscribeL();
+
+    // ------------------------------------------------------
+    // some startup stuff
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    MXIMPContext* context = wrapper->GetContext();
+
+    CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context );
+    CleanupStack::PushL( listener2 );
+    // ------------------------------------------------------
+
+    // Tell the protocol it should act normally
+    wrapper->GetMessenger()->SetNoError();
+
+    // ------------------------------------------------------
+    // 1. Create faked server message about block list
+    SendSrvMsgL( CXIMPTestFileSrvMsg::ETestSrvMsgPresenceBlockList );
+
+    // ------------------------------------------------------
+    // expect current(empty) MPresenceBlockList event.
+    RPrBlockInfoImpArray* currentList(NULL);
+    CPresenceBlockListEventImp* event = CreateBlockListEventLCX(
+            KNullDesC, KNullDesC,
+            MXIMPDataSubscriptionState::ESubscriptionActive,
+            MXIMPDataSubscriptionState::EDataAvailable,
+            ETestPBlCurrent, currentList);
+
+    listener2->ExpectL( event );
+    CleanupStack::Pop( event ); // 4 more items in cleanupstack
+
+    EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "HandlePresenceBlockListL failed" );
+    CleanupStack::PopAndDestroy( 4 ); // lists
+    // ------------------------------------------------------
+
+    CleanupStack::PopAndDestroy( listener2 );
+
+    // clean it up
+    UnsubscribeL();
+    UnbindL();
+    }
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+// Single client, empty filter
+void T_PresenceBlocking::T_BlockPresence_L()
+    {
+    EUNIT_PRINT( _L("Block presence") );
+
+    BindL();
+
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    MXIMPContext* context = wrapper->GetContext();
+    CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+    CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context );
+    CleanupStack::PushL( listener2 );
+
+    // Tell the protocol it should act normally
+    messenger->SetNoError();
+
+    // Get the interfaces
+    MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+    MPresenceAuthorization& presAuth = presFeat->PresenceAuthorization();
+
+    // Setup status event listener for RequestComplete
+    // ---------------------------------------------
+    listener2->Reset();
+
+    // normal request complete
+    TXIMPRequestId reqIdDummy;  // not checked
+    CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+    listener2->ExpectL( evReqComplete );
+    CleanupStack::Pop( evReqComplete );
+
+    // subscribe
+    TXIMPRequestId reqId = presAuth.SubscribePresenceBlockListL();
+    EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Subscribe failed" );
+
+    // verify that SubscribePresenceBlockListL was called
+    COMMONASSERT( messenger, EXIMPPlgTestSubscribePresenceBlockListCalled, "SubscribePresenceBlockListL was not called", ETrue, NULL );
+
+
+    // ---------------------------------------------
+    //  1. Block presence
+
+    CXIMPIdentityImp* identity = XIMPTestPresenceDataUtils::GenerateIdentityLC( &KNullDesC8 );
+    _LIT16( KDisplayName1, "DispnameA, LoremI" );
+
+
+    // Setup status event listener for RequestComplete
+    // ---------------------------------------------
+    listener2->Reset();
+
+    evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+    listener2->ExpectL( evReqComplete );
+    CleanupStack::Pop( evReqComplete );
+
+    RPrBlockInfoImpArray* currentList(NULL);
+    CPresenceBlockListEventImp* event =
+            CreateBlockListEventLCX( identity->Identity(),
+                                     KNullDesC,
+                                     MXIMPDataSubscriptionState::ESubscriptionActive,
+                                     MXIMPDataSubscriptionState::EDataAvailable,
+                                     ETestPBlAdded, currentList );
+
+    listener2->ExpectL( event );
+    CleanupStack::Pop( event );
+
+    // block
+    reqId = presAuth.BlockPresenceForPresentityL( *identity );
+    
+    //Waqas: fixed current list in event
+    EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Block failed" );
+
+    // verify that BlockPresenceForPresentityL was called
+    COMMONASSERT( messenger, EXIMPPlgTestBlockPresenceForPresentityCalled, "BlockPresenceForPresentityL was not called", ETrue, NULL );
+
+    CleanupStack::PopAndDestroy( 4 ); // lists
+    // ---------------------------------------------
+
+
+    // ---------------------------------------------
+    //  2. Re-block
+
+    // Setup status event listener for RequestComplete
+    listener2->Reset();
+
+    evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+    listener2->ExpectL( evReqComplete );
+    CleanupStack::Pop( evReqComplete );
+
+    // we need to create current list to give to the event
+    currentList = new ( ELeave ) RPrBlockInfoImpArray; // previous is destroyed
+    CleanupDeletePushL( currentList );
+            // create the group info
+    CPresenceBlockInfoImp* blockInfoForEvent = 
+                            CPresenceBlockInfoImp::NewLC( *identity, KNullDesC );
+    currentList->AppendL( blockInfoForEvent );
+    CleanupStack::Pop( blockInfoForEvent );
+    CleanupStack::Pop( currentList );
+    
+    // now make the event
+    event = CreateBlockListEventLCX( identity->Identity(),
+                                     KNullDesC,
+                                     MXIMPDataSubscriptionState::ESubscriptionActive,
+                                     MXIMPDataSubscriptionState::EDataAvailable,
+                                     ETestPBlCurrent, currentList );
+
+    listener2->ExpectL( event );
+    CleanupStack::Pop( event );
+
+    // re-block
+    reqId = presAuth.BlockPresenceForPresentityL( *identity );
+
+    EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Block failed" );
+
+    // verify that BlockPresenceForPresentityL was called
+    COMMONASSERT( messenger, EXIMPPlgTestBlockPresenceForPresentityCalled, "BlockPresenceForPresentityL was not called", ETrue, NULL );
+
+
+    CleanupStack::PopAndDestroy( 4 ); // lists
+
+
+    // Deinitiliaze event source from listener.
+    listener2->SetEventSourceL( NULL );
+
+    UnbindL();
+    
+    CleanupStack::PopAndDestroy( identity );
+
+    CleanupStack::PopAndDestroy( listener2 );
+    
+    }
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+// Single client, empty filter
+void T_PresenceBlocking::T_CancelBlockedPresence_L()
+    {
+    EUNIT_PRINT( _L("Cancel presence block") );
+
+    BindL();
+
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    MXIMPContext* context = wrapper->GetContext();
+    CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+    CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context );
+    CleanupStack::PushL( listener2 );
+
+    // Tell the protocol it should act normally
+    messenger->SetNoError();
+
+    // Get the interfaces
+    MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+    MPresenceAuthorization& presAuth = presFeat->PresenceAuthorization();
+
+    // Setup status event listener for RequestComplete
+    // ---------------------------------------------
+    listener2->Reset();
+
+    // normal request complete
+    TXIMPRequestId reqIdDummy;  // not checked
+    CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+    listener2->ExpectL( evReqComplete );
+    CleanupStack::Pop( evReqComplete );
+    // ---------------------------------------------
+
+    // subscribe
+    // ---------------------------------------------
+    TXIMPRequestId reqId = presAuth.SubscribePresenceBlockListL();
+    EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Subscribe failed" );
+    // ---------------------------------------------
+
+    // verify that SubscribePresenceBlockListL was called
+    COMMONASSERT( messenger, EXIMPPlgTestSubscribePresenceBlockListCalled, "SubscribePresenceBlockListL was not called", ETrue, NULL );
+
+
+    CXIMPIdentityImp* identity = XIMPTestPresenceDataUtils::GenerateIdentityLC( &KNullDesC8 );
+
+    // ---------------------------------------------
+    //  1. Cancel non-existing block (no blocks)
+    
+    // Setup status event listener for RequestComplete
+    listener2->Reset();
+
+    evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+    listener2->ExpectL( evReqComplete );
+    CleanupStack::Pop( evReqComplete );
+
+    RPrBlockInfoImpArray* currentList(NULL);
+    CPresenceBlockListEventImp* event =
+            CreateBlockListEventLCX( KNullDesC,
+                                     KNullDesC,
+                                     MXIMPDataSubscriptionState::ESubscriptionActive,
+                                     MXIMPDataSubscriptionState::EDataUnavailable,
+                                     ETestPBlRemoved, currentList );
+    listener2->ExpectL( event );
+    CleanupStack::Pop( event );
+
+    // cancel nonexisting block
+    reqId = presAuth.CancelPresenceBlockFromPresentityL( *identity );
+    EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Cancel failed" );
+    // ---------------------------------------------
+
+    // verify that method was called
+    COMMONASSERT( messenger, EXIMPPlgTestCancelPresenceBlockFromPresentityCalled, "CancelPresenceBlockFromPresentityL was not called", ETrue, NULL );
+
+    CleanupStack::PopAndDestroy( 4 ); // lists
+
+    
+    // ---------------------------------------------
+    //  2. Cancel block 
+    
+
+    // Setup status event listener for RequestComplete
+    listener2->Reset();
+
+    evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+    listener2->ExpectL( evReqComplete );
+    CleanupStack::Pop( evReqComplete );
+
+    currentList = NULL;  // previous is destroyed
+    event = CreateBlockListEventLCX( identity->Identity(),
+                                     KNullDesC,
+                                     MXIMPDataSubscriptionState::ESubscriptionActive,
+                                     MXIMPDataSubscriptionState::EDataAvailable,
+                                     ETestPBlAdded, currentList );
+    listener2->ExpectL( event );
+    CleanupStack::Pop( event );
+
+    // block a presentity
+    reqId = presAuth.BlockPresenceForPresentityL( *identity );
+    // Waqas: Fixed current list in event
+    EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Block failed" );
+
+    // verify that method was called
+    COMMONASSERT( messenger, EXIMPPlgTestBlockPresenceForPresentityCalled, "BlockPresenceForPresentityL was not called", ETrue, NULL );
+    CleanupStack::PopAndDestroy( 4 ); // lists
+    // ---------------------------------------------
+
+
+    // Setup status event listener for RequestComplete
+    listener2->Reset();
+
+    evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+    listener2->ExpectL( evReqComplete );
+    CleanupStack::Pop( evReqComplete );
+
+    // we need to create current list to give to the event
+    currentList = new ( ELeave ) RPrBlockInfoImpArray; // previous is destroyed
+    CleanupDeletePushL( currentList );
+    CPresenceBlockInfoImp* blockInfoForEvent = 
+                        CPresenceBlockInfoImp::NewLC( *identity, KNullDesC );
+    currentList->AppendL( blockInfoForEvent );
+    CleanupStack::Pop( blockInfoForEvent );
+    CleanupStack::Pop( currentList );
+    
+    // now create event and give currentList to it
+    event = CreateBlockListEventLCX( identity->Identity(),
+                                     KNullDesC,
+                                     MXIMPDataSubscriptionState::ESubscriptionActive,
+                                     MXIMPDataSubscriptionState::EDataAvailable,
+                                     ETestPBlRemoved, currentList );
+    listener2->ExpectL( event );
+    CleanupStack::Pop( event );
+
+    // cancel the existing block
+    reqId = presAuth.CancelPresenceBlockFromPresentityL( *identity );
+    // Waqas: Fixed current list in event
+    EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Cancel block failed" );
+
+    // verify that method was called
+    COMMONASSERT( messenger, EXIMPPlgTestCancelPresenceBlockFromPresentityCalled, "CancelPresenceBlockFromPresentityL was not called", ETrue, NULL );
+    CleanupStack::PopAndDestroy( 4 ); // lists
+    // ---------------------------------------------
+
+
+    // ---------------------------------------------
+    //  TODO 3. Cancel block (non-existing block, other blocks exist)
+
+
+    // Deinitiliaze event source from listener.
+    listener2->SetEventSourceL( NULL );
+
+    UnbindL();
+    
+    CleanupStack::PopAndDestroy( identity );
+
+    CleanupStack::PopAndDestroy( listener2 );
+    }
+
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+void T_PresenceBlocking::T_HandlePresenceBlocked_L()
+    {
+    EUNIT_PRINT( _L("Handle presence blocked") );
+
+    // log in and subscribe a block list
+    BindL();
+    SubscribeL();
+
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    MXIMPContext* context = wrapper->GetContext();
+
+    CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context );
+    CleanupStack::PushL( listener2 );
+
+    // Tell the protocol it should act normally
+    wrapper->GetMessenger()->SetNoError();
+
+
+    CXIMPIdentityImp* identity = XIMPTestPresenceDataUtils::GenerateIdentityLC( &KNullDesC8 );
+    
+    // ------------------------------------------------------
+    // 1. Create faked server message about blocked
+    SendBlockedSrvMsgL( identity->Identity(),
+                        KNullDesC,
+                        CXIMPTestFileSrvMsg::ETestSrvMsgPresenceBlocked );
+
+    RPrBlockInfoImpArray* currentList(NULL);
+    CPresenceBlockListEventImp* event = CreateBlockListEventLCX(
+            identity->Identity(), KNullDesC,
+            MXIMPDataSubscriptionState::ESubscriptionActive,
+            MXIMPDataSubscriptionState::EDataAvailable,
+            ETestPBlAdded, currentList );
+
+    listener2->ExpectL( event );
+    CleanupStack::Pop( event ); // 4 more items in cleanupstack
+
+    // Waqas: Fixed current list handling
+    EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "HandlePresenceBlocked failed" );
+    
+    CleanupStack::PopAndDestroy( 4 ); // lists
+    // ------------------------------------------------------
+
+    CleanupStack::PopAndDestroy( identity );
+    CleanupStack::PopAndDestroy( listener2 );
+
+    // clean it up
+    UnsubscribeL();
+    UnbindL();
+    
+    }
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+void T_PresenceBlocking::T_HandlePresenceBlockCanceled_L()
+    {
+    
+    EUNIT_PRINT( _L("Handle presence block canceled") );
+
+    // log in and subscribe a block list
+    BindL();
+    SubscribeL();
+
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    MXIMPContext* context = wrapper->GetContext();
+
+    CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context );
+    CleanupStack::PushL( listener2 );
+
+    // Tell the protocol it should act normally
+    wrapper->GetMessenger()->SetNoError();
+
+
+    CXIMPIdentityImp* identity = XIMPTestPresenceDataUtils::GenerateIdentityLC( &KNullDesC8 );
+    
+    // ------------------------------------------------------
+    // 1. Cancel block (with no blocks)
+    SendCanceledSrvMsgL( identity->Identity(),
+                        KNullDesC,
+                        CXIMPTestFileSrvMsg::ETestSrvMsgPresenceBlockCanceled );
+
+    RPrBlockInfoImpArray* currentList(NULL);
+    CPresenceBlockListEventImp* event = CreateBlockListEventLCX(
+            KNullDesC, KNullDesC,
+            MXIMPDataSubscriptionState::ESubscriptionActive,
+            MXIMPDataSubscriptionState::EDataUnavailable,
+            ETestPBlRemoved, currentList );
+
+    listener2->ExpectL( event );
+    CleanupStack::Pop( event ); // 4 more items in cleanupstack
+
+    EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "HandlePresenceBlockCanceled failed" );
+    CleanupStack::PopAndDestroy( 4 ); // lists
+    // ------------------------------------------------------
+
+    CleanupStack::PopAndDestroy( identity );
+    CleanupStack::PopAndDestroy( listener2 );
+
+    // clean it up
+    UnsubscribeL();
+    UnbindL();    
+    }
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+// send a faked server-originated message with group info made
+// from the given uri and displayname
+//
+void T_PresenceBlocking::SendSrvMsgL(
+        const TDesC& aUri, const TDesC& aDispName,
+        TInt aMsgType )
+    {
+    // we'll use hard-coded wrapper 0 instance for now.
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+
+    // create a grant req info contained within the server-originated
+    // faked message
+    RXIMPObjOwningPtrArray<CPresenceBlockInfoImp> blockList;
+    CleanupClosePushL( blockList );
+
+    CXIMPIdentityImp* blockId = CXIMPIdentityImp::NewLC( aUri );
+    CPresenceBlockInfoImp* blockItem =
+                CPresenceBlockInfoImp::NewLC( *blockId, aDispName );
+    blockList.AppendL( blockItem );
+    CleanupStack::Pop( blockItem );
+    CleanupStack::PopAndDestroy( blockId );
+
+    HBufC8* packedArray =
+        TXIMPObjectPacker<CPresenceBlockInfoImp>::PackArrayL( blockList );
+    CleanupStack::PushL( packedArray );
+
+    // use filetool to send it for plugin.
+    CXIMPTestFileSrvMsg* srvMsg = CXIMPTestFileSrvMsg::NewL( aMsgType,
+            *packedArray );
+    CleanupStack::PushL( srvMsg );
+    wrapper->FileTool().CleanAllL();
+    wrapper->FileTool().SrvMsgStoreL( srvMsg );
+    CleanupStack::PopAndDestroy( 3 ); // srvMsg, packedArray, blockList
+    }
+    
+void T_PresenceBlocking::SendBlockedSrvMsgL(
+        const TDesC& aUri, const TDesC& aDispName,
+        TInt aMsgType )
+    {
+    // we'll use hard-coded wrapper 0 instance for now.
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+
+    // create a grant req info contained within the server-originated
+    // faked message
+    CXIMPIdentityImp* blockId = CXIMPIdentityImp::NewLC( aUri );
+    CPresenceBlockInfoImp* blockItem =
+                CPresenceBlockInfoImp::NewLC( *blockId, aDispName );
+
+
+    HBufC8* packedArray =
+        TXIMPObjectPacker<CPresenceBlockInfoImp>::PackL( *blockItem );
+    CleanupStack::PushL( packedArray );
+
+    // use filetool to send it for plugin.
+    CXIMPTestFileSrvMsg* srvMsg = CXIMPTestFileSrvMsg::NewL( aMsgType,
+            *packedArray );
+    CleanupStack::PushL( srvMsg );
+    wrapper->FileTool().CleanAllL();
+    wrapper->FileTool().SrvMsgStoreL( srvMsg );
+    CleanupStack::PopAndDestroy( 4 ); // blockId, blockItem, packedArray, srvMsg
+    }
+    
+void T_PresenceBlocking::SendCanceledSrvMsgL(
+        const TDesC& aUri, const TDesC& aDispName,
+        TInt aMsgType )
+    {
+    // we'll use hard-coded wrapper 0 instance for now.
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+
+    CXIMPIdentityImp* blockId = CXIMPIdentityImp::NewLC( aUri );
+
+    HBufC8* packedArray =
+        TXIMPObjectPacker<CXIMPIdentityImp>::PackL( *blockId );
+    CleanupStack::PushL( packedArray );
+
+    // use filetool to send it for plugin.
+    CXIMPTestFileSrvMsg* srvMsg = CXIMPTestFileSrvMsg::NewL( aMsgType,
+            *packedArray );
+    CleanupStack::PushL( srvMsg );
+    wrapper->FileTool().CleanAllL();
+    wrapper->FileTool().SrvMsgStoreL( srvMsg );
+    CleanupStack::PopAndDestroy( 3 ); // blockId, packedArray, srvMsg
+    }
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+// send a faked server-originated message with empty contents
+//
+void T_PresenceBlocking::SendSrvMsgL( TInt aMsgType )
+    {
+    // we'll use hard-coded wrapper 0 instance for now.
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+
+    // create a server-originated faked message with empty contents
+    RXIMPObjOwningPtrArray<CPresenceBlockInfoImp> blockList;
+
+    HBufC8* packedArray = TXIMPObjectPacker<CPresenceBlockInfoImp>::PackArrayL( blockList );
+    CleanupStack::PushL( packedArray );
+
+    // use filetool to send it for plugin.
+    CXIMPTestFileSrvMsg* srvMsg = CXIMPTestFileSrvMsg::NewL( aMsgType,
+            *packedArray );
+    CleanupStack::PushL( srvMsg );
+    wrapper->FileTool().CleanAllL();
+    wrapper->FileTool().SrvMsgStoreL( srvMsg );
+    CleanupStack::PopAndDestroy( 2 ); // srvMsg, packedArray
+    }
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+// create a block list event with given arrays
+//
+CPresenceBlockListEventImp*
+    T_PresenceBlocking::CreateBlockListEventLCX(
+        const TDesC& aUri,
+        const TDesC& aDispName,
+        MXIMPDataSubscriptionState::TSubscriptionState aSubscriptionState,
+        MXIMPDataSubscriptionState::TDataState aDataState,
+        TTestPBlOperationSpecifier aOperation,
+        RPrBlockInfoImpArray* aCurrentList)
+    {
+    // create the arrays
+
+    // new list
+    RPrBlockInfoImpArray* newList = new ( ELeave ) RPrBlockInfoImpArray;
+    CleanupDeletePushL( newList );
+
+    // current list, created by caller
+    if(!aCurrentList) // if client didnt created the list
+        aCurrentList = new ( ELeave ) RPrBlockInfoImpArray;
+    CleanupDeletePushL( aCurrentList );
+
+    // removed list
+    RPrBlockInfoImpArray* removedList = new ( ELeave ) RPrBlockInfoImpArray;
+    CleanupDeletePushL( removedList );
+
+    // updated list
+    RPrBlockInfoImpArray* updatedList = new ( ELeave ) RPrBlockInfoImpArray;
+    CleanupDeletePushL( updatedList );
+    
+	// create subscription state
+	CXIMPDataSubscriptionStateImp* subsState = CXIMPDataSubscriptionStateImp::NewLC();
+	 
+
+    // create the group info
+    CPresenceBlockInfoImp* blockInfoForEvent1 = NULL;
+            {
+            CXIMPIdentityImp* idForEvent = CXIMPIdentityImp::NewLC( aUri );
+            blockInfoForEvent1 = CPresenceBlockInfoImp::NewLC( *idForEvent, aDispName );
+            
+            CleanupStack::Pop( blockInfoForEvent1 );        
+            CleanupStack::PopAndDestroy( idForEvent ); 
+            CleanupStack::PushL( blockInfoForEvent1 );        
+            }
+
+    CPresenceBlockInfoImp* blockInfoForEvent2 = 
+            TXIMPObjectCloner< CPresenceBlockInfoImp >::CloneLC( *blockInfoForEvent1 );
+    
+    TInt count(0);
+    TBool found(EFalse);
+    TInt i(0);
+
+    // put the given group info into the specified array
+    switch ( aOperation )
+        {
+        case ETestPBlAdded:
+            {
+            newList->AppendL( blockInfoForEvent2 );
+            CleanupStack::Pop( blockInfoForEvent2 );
+            
+            aCurrentList->AppendL( blockInfoForEvent1 );
+            CleanupStack::Pop( blockInfoForEvent1 );
+            
+            break;
+            }
+
+        case ETestPBlRemoved:
+            {
+            // search the given id in current list
+            count = aCurrentList->Count();
+            for(i=0;i<count;i++)
+                {
+                // if dispname and id are same
+                if (( ((((*aCurrentList)[i])->BlockedEntityId()).Identity()) == aUri )
+                    && ( (((*aCurrentList)[i])->BlockedEntityDisplayName()) == aDispName ))
+                    {
+                    found = ETrue;
+            break;
+            }
+                }
+            if(found) // do we need to leave if error? Waqas
+            {
+                delete (*aCurrentList)[i];
+                aCurrentList->Remove(i);
+                removedList->AppendL( blockInfoForEvent2 );
+                CleanupStack::Pop( blockInfoForEvent2 );
+                }
+            else
+                CleanupStack::PopAndDestroy( blockInfoForEvent2 );
+            
+            CleanupStack::PopAndDestroy( blockInfoForEvent1 );
+            }
+            break;
+        case ETestPBlUpdated:
+            {
+            updatedList->AppendL( blockInfoForEvent2 );
+            CleanupStack::Pop( blockInfoForEvent2);
+            CleanupStack::PopAndDestroy( blockInfoForEvent1 );
+            }
+            break;
+
+        case ETestPBlCurrent:
+            {
+            // don't add, thus return what user has given
+            CleanupStack::PopAndDestroy( blockInfoForEvent2 ); // blockInfoForEvent2
+            CleanupStack::PopAndDestroy( blockInfoForEvent1 ); // blockInfoForEvent1
+            }
+            break;
+        
+        default:
+            {
+            User::Leave( KErrArgument );
+            }
+            break;
+        }
+
+	subsState->SetSubscriptionStateL(aSubscriptionState);
+    subsState->SetDataStateL(aDataState);
+	
+    // create the actual event
+    CPresenceBlockListEventImp* tmp =
+        CPresenceBlockListEventImp::NewLC(
+                newList,
+                aCurrentList,
+                removedList,
+                updatedList,
+                subsState );
+
+    // subState is owned by the event, we need to pop it out from the stack
+    CleanupStack::Pop( tmp );        
+    CleanupStack::Pop( subsState ); 
+    CleanupStack::PushL( tmp );        
+
+    /*
+     * In cleanupstack there are 5 items, FIFO
+     *   - added/new list
+     *   - current list
+     *   - removed list
+     *   - updated list
+     *   - event imp
+     */
+
+    return tmp;
+    }
+
+// ===========================================================================
+// TEST CASE TABLE
+// ===========================================================================
+//
+EUNIT_BEGIN_TEST_TABLE(
+        T_PresenceBlocking,
+        "XIMPFW presence blocking tests",
+        "MODULE" )
+
+PRFW_DECORATED_TEST(
+        "Subscribe block list",
+        "",
+        "",
+        "FUNCTIONALITY",
+        Setup_L,
+        T_SubscribeBlockList_Single_L,
+        Teardown )
+
+PRFW_DECORATED_TEST(
+        "Refresh block list subscription",
+        "",
+        "",
+        "FUNCTIONALITY",
+        Setup_L,
+        T_SubscribeBlockListRefresh_Single_L,
+        Teardown )
+
+PRFW_DECORATED_TEST(
+        "Subscribe block list, multiple",
+        "",
+        "",
+        "FUNCTIONALITY",
+        SetupMultiple_L,
+        T_SubscribeBlockList_Multiple_L,
+        Teardown )
+
+
+PRFW_DECORATED_TEST(
+        "Handle presence block list",
+        "",
+        "",
+        "FUNCTIONALITY",
+        Setup_L,
+        T_HandlePresenceBlockList_L,
+        Teardown )
+
+PRFW_DECORATED_TEST(
+        "Block presence",
+        "",
+        "",
+        "FUNCTIONALITY",
+        Setup_L,
+        T_BlockPresence_L,
+        Teardown )
+        
+PRFW_DECORATED_TEST(
+        "Cancel presence block",
+        "",
+        "",
+        "FUNCTIONALITY",
+        Setup_L,
+        T_CancelBlockedPresence_L,
+        Teardown )
+
+PRFW_DECORATED_TEST(
+        "Handle blocked and canceled blocks",
+        "",
+        "",
+        "FUNCTIONALITY",
+        Setup_L,
+        T_HandlePresenceBlocked_L,
+        Teardown )
+
+PRFW_DECORATED_TEST(
+        "Handle blocked and canceled blocks",
+        "",
+        "",
+        "FUNCTIONALITY",
+        Setup_L,
+        T_HandlePresenceBlockCanceled_L,
+        Teardown )
+
+EUNIT_END_TEST_TABLE
+
+
+// ===========================================================================
+// TEST SUITE CONSTRUCTION
+// ===========================================================================
+//
+EXPORT_C MEUnitTest* CreateTestSuiteL()
+    {
+    return T_PresenceBlocking::NewL();
+    }
+
+
+// end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/tsrc/src/t_presenceblocking/t_presenceblocking.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,180 @@
+/*
+* 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: XIMP Framework Test Code 
+*
+*/
+
+#ifndef T_PRESENCEBLOCKING_H
+#define T_PRESENCEBLOCKING_H
+
+
+//  EXTERNAL INCLUDES
+#include <platform/digia/eunit/ceunittestsuiteclass.h>
+#include <platform/digia/eunit/EUnitDecorators.h>
+#include <ximpbase.h>
+#include "prfwteststatuseventlistener.h"
+#include "prfwtestmessaging.h"
+#include "ximpdatasubscriptionstateimp.h"
+#include "presencetypehelpers.h"
+
+class CXIMPTestContextWrapper;
+class CXIMPTestContextWrapperMgr;
+class CXIMPTestMessenger;
+class CPresenceBlockInfoImp;
+class CPresenceBlockListEventImp;
+
+/**
+ * XIMP Framework Eunit tests.
+ *
+ * Tests for XIMP session management services.
+ *
+ * @since S60 v4.0
+ */
+class T_PresenceBlocking : public CEUnitTestSuiteClass
+    {
+
+public:
+    static T_PresenceBlocking* NewL();
+    virtual ~T_PresenceBlocking();
+
+
+private:
+    T_PresenceBlocking();
+    void ConstructL();
+
+private:    // Test case functions
+
+    void Setup_L();
+    void SetupMultiple_L();
+    void BindL();
+    void BindAllL();
+    void Teardown();
+    void UnbindL();
+    void UnbindAllL();
+    void SubscribeL();
+    void UnsubscribeL();
+
+    void T_SubscribeBlockList_Single_L();
+    void T_SubscribeBlockListRefresh_Single_L();
+    void T_SubscribeBlockList_Multiple_L();
+    void T_HandlePresenceBlockList_L();
+    void T_BlockPresence_L();
+    void T_CancelBlockedPresence_L();
+    void T_HandlePresenceBlocked_L();
+    void T_HandlePresenceBlockCanceled_L();
+    
+
+private:    // Test helpers
+
+    /**
+     * Fake a server-originated (=mobile terminated) message.
+     * The message appears to adaptation and framework as if
+     * it came from the network. Uses only one group.
+     * @param aUri The URI of group
+     * @param aDispName The display name for the group
+     * @param aMsgType The message type for CXIMPTestFileSrvMsg
+     */
+    void SendSrvMsgL(
+            const TDesC& aUri, const TDesC& aDispName,
+            TInt aMsgType );
+    void SendBlockedSrvMsgL(
+            const TDesC& aUri, const TDesC& aDispName,
+            TInt aMsgType );
+    void SendCanceledSrvMsgL(
+            const TDesC& aUri, const TDesC& aDispName,
+            TInt aMsgType );
+
+    /**
+     * Fake a server-originated message with empty content.
+     * Whether to use this depends on the event you expect.
+     * @see SendSrvMsgL
+     */
+    void SendSrvMsgL( TInt aMsgType );
+
+    // @see below
+    /*
+    enum TTestPBlArraySpecifier   //Waqas: Not used anymore, use next one
+        {
+        ETestPBlNewList = 0,    // new block list
+        ETestPBlAdded,     // added block
+        ETestPBlCurrent,        // current block list
+        ETestPBlRemoved,        // removed block
+        ETestPBlUpdated,        // updated block
+        ETestPBlEmpty,          // make an empty array for empty event
+        };*/
+        
+    enum TTestPBlOperationSpecifier
+        {
+        ETestPBlAdded = 0,      // added block
+        ETestPBlCurrent,        // current block list
+        ETestPBlRemoved,        // removed block
+        ETestPBlUpdated        // updated block
+        };
+
+    /**
+     * Creates an event for adding, current, removing or updating
+     * block list. The caller provides an identity and current blocked list
+     * and depending on the provided operation an event is created. 
+     *
+     * In cleanupstack there are 4 items, FIFO:
+     *   - created list
+     *   - updated list
+     *   - deleted list
+     *   - event imp
+     *
+     * This is because this event won't take ownership to the arrays
+     * when created this way.
+     *
+     * @param aUri Uri
+     * @param aDispName Displayname
+     * @param aOperation operation for which caller wants to generates event
+     * @param aCurrentList Current blocked list provided by caller, method takes
+     *         ownership of the current list, and it is included in above 4 items. 
+     *         a NULL pointer with operation ETestPBlCurrent causes empty event. 
+     * @return The suitably filled event.     
+     */
+    CPresenceBlockListEventImp* CreateBlockListEventLCX(
+            const TDesC& aUri,
+            const TDesC& aDispName,
+            MXIMPDataSubscriptionState::TSubscriptionState aSubscriptionState,
+            MXIMPDataSubscriptionState::TDataState aDataState,
+            TTestPBlOperationSpecifier aOperation,
+            RPrBlockInfoImpArray* aCurrentList = NULL
+            );
+
+
+private: // Test data
+
+    /**
+     * Eunit test case table declaration.
+     */
+    EUNIT_DECLARE_TEST_TABLE;
+
+    // owned
+    CXIMPTestContextWrapperMgr* iWrapperMgr;
+
+    //
+    TInt iLastError;
+    RXIMPObjOwningPtrArray< CPresenceBlockInfoImp > iValidateArray;
+    };
+
+
+#endif      //  T_PRESENCEBLOCKING_H
+
+
+
+// end of file
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/tsrc/src/t_presenceblocking/t_presenceblocking.mmp	Wed Nov 03 09:32:20 2010 +0530
@@ -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: XIMP Framework Test Code 
+*
+*/
+
+#include            "../../tsrcutils/eunitcommon/eunittstdllbase.hrh"
+#include            "../../tsrcutils/processmaster/pm.h"
+
+#include<platform_paths.hrh>
+#include<eunitcaps.h>
+TARGET              t_presenceblocking.dll
+//CAPABILITY              ALL - TCB - DRM
+CAPABILITY      EUNIT_CAPS
+
+SOURCEPATH          .
+SOURCE              t_presenceblocking.cpp
+
+
+USERINCLUDE             ../../../core/srcdatamodel
+USERINCLUDE             ../../../presence/srcpresencedatamodel
+USERINCLUDE             ../../../presence/srcpresencedatamodel/presentitygroups
+USERINCLUDE             ../../../presence/srcpresencedatamodel/presencewatching
+USERINCLUDE             ../../../presence/srcpresencedatamodel/presenceauthorization
+USERINCLUDE             ../../../presence/srcpresencedatamodel/presencepublishing
+USERINCLUDE             ../../../presence/srcpresencedatamodel/presenceinfo
+USERINCLUDE             ../../../core/srcutils
+
+// TODO remove unnecessary
+#if defined ( OS_LAYER_SYSTEMINCLUDE )
+OS_LAYER_SYSTEMINCLUDE
+#else
+SYSTEMINCLUDE     /epoc32/include
+#endif
+
+ #if defined ( APP_LAYER_SYSTEMINCLUDE )
+ APP_LAYER_SYSTEMINCLUDE
+ #else
+ SYSTEMINCLUDE     \epoc32\include
+ #endif
+ 
+ 
+SYSTEMINCLUDE           ../../../inc/core/base
+SYSTEMINCLUDE           ../../../inc/core/datamodel
+SYSTEMINCLUDE           ../../../inc/core/protocolplugin
+SYSTEMINCLUDE           ../../../inc/core/protocolpluginhost
+SYSTEMINCLUDE           ../../../inc/presence/presencedatamodel
+SYSTEMINCLUDE           ../../../inc/presence/presencemanagement
+SYSTEMINCLUDE           ../../../inc/presence/presenceprotocolplugin
+SYSTEMINCLUDE           ../../../inc/presence/presenceprotocolpluginhost
+
+LIBRARY             ecom.lib
+LIBRARY             bafl.lib
+LIBRARY             ximpdatamodel.lib
+LIBRARY             presencedatamodel.lib
+LIBRARY             estor.lib
+LIBRARY             ximputils.lib
+LIBRARY             eunit.lib
+LIBRARY             eunitutil.lib
+LIBRARY             euser.lib
+
+
+// end of file
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/tsrc/src/t_presencecache/T_PresenceCache.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,978 @@
+/*
+* 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: XIMP Framework Test Code 
+*
+*/
+
+
+//  CLASS HEADER
+#include "T_PresenceCache.h"
+
+//  EXTERNAL INCLUDES
+#include <EUnitMacros.h>
+#include <EUnitDecorators.h>
+
+
+#include <presenceinfoimp.h>
+#include <presenceinfo.h>
+#include <personpresenceinfoimp.h>
+#include <presenceinfofieldimp.h>
+#include <presenceinfofield.h>
+#include <presenceinfofieldcollectionimp.h>
+#include <presenceinfofieldcollection.h>
+#include <ximpbase.h>
+#include <presenceinfofieldvaluetext.h>
+#include <presenceinfofieldvaluetextimp.h>
+#include <presencebuddyinfo.h>
+#include <presencebuddyinfolist.h>
+#include <presencecacheclient.h>
+#include <ximpidentityimp.h>
+#include <ximpidentity.h>
+#include <presenceinfofieldvaluebinary.h>
+#include <presenceinfofieldvaluebinaryimp.h>
+
+#include <presencefeeder.h>
+
+
+// Implementation files used for testing only
+#include "presencebuddyinfoimp.h"
+#include "presenceinfoimp.h"
+#include "presencebuddyinfolistimp.h"
+
+
+// CONSTANTS
+_LIT8( KIdentityField, "Identity" );
+
+_LIT( KBuddyId1sip, "sip:BuddyId1@xyz.com" );
+_LIT( KBuddyId2sip, "sip:BuddyId2@xyz.com" );
+_LIT( KBuddyId3sip, "sip:BuddyId3@xyz.com" );
+_LIT( KBuddyId1ECE, "ECE:BuddyId1@xyz.com" );
+_LIT( KBuddyId2ECE, "ECE:BuddyId2@xyz.com" );
+_LIT( KBuddyId3ECE, "ECE:BuddyId3@xyz.com" );
+_LIT( KBuddyId1MSN, "MSN:BuddyId1@xyz.com" );
+_LIT( KBuddyId2MSN, "MSN:BuddyId2@xyz.com" );
+_LIT( KBuddyId3MSN, "MSN:BuddyId3@xyz.com" );
+_LIT( KBuddyId1VoIP, "VoIP:BuddyId1@xyz.com" );
+_LIT( KBuddyId2VoIP, "VoIP:BuddyId2@xyz.com" );
+_LIT( KBuddyId3VoIP, "VoIP:BuddyId3@xyz.com" );
+_LIT( KBuddyId1ICQ, "ICQ:BuddyId1@xyz.com" );
+_LIT( KBuddyId2ICQ, "ICQ:BuddyId2@xyz.com" );
+_LIT( KBuddyId3ICQ, "ICQ:BuddyId3@xyz.com" );
+_LIT( KBuddyId1no, "no:BuddyId1@xyz.com" );
+_LIT( KBuddyId2no, "no:BuddyId2@xyz.com" );
+_LIT( KBuddyId3no, "no:BuddyId3@xyz.com" );
+
+_LIT( KBuddyId1, "BuddyId1@xyz.com" );
+_LIT( KBuddyId2, "BuddyId2@xyz.com" );
+_LIT( KBuddyId3, "BuddyId3@xyz.com" );
+
+_LIT( KText1, "KText1" );
+_LIT( KText2, "KText2" );
+_LIT( KText3, "KText3" );
+_LIT( KText4, "KText4" );
+_LIT( KText5, "KText5" );
+_LIT( KText6, "KText6" );
+
+_LIT( KService1, "sip" );
+_LIT( KService2, "ECE" );
+_LIT( KService3, "MSN" );
+_LIT( KService4, "VoIP" );
+_LIT( KService5, "ICQ" );
+_LIT( KService6, "no" );
+
+//  INTERNAL INCLUDES
+
+
+// CONSTRUCTION
+T_PresenceCache* T_PresenceCache::NewL()
+    {
+    T_PresenceCache* self = T_PresenceCache::NewLC();
+    CleanupStack::Pop();
+
+    return self;
+    }
+
+T_PresenceCache* T_PresenceCache::NewLC()
+    {
+    T_PresenceCache* self = new( ELeave ) T_PresenceCache();
+    CleanupStack::PushL( self );
+
+    self->ConstructL();
+
+    return self;
+    }
+
+// Destructor (virtual by CBase)
+T_PresenceCache::~T_PresenceCache()
+    {
+    }
+
+// Default constructor
+T_PresenceCache::T_PresenceCache()
+    {
+    }
+
+// Second phase construct
+void T_PresenceCache::ConstructL()
+    {
+    // The ConstructL from the base class CEUnitTestSuiteClass must be called.
+    // It generates the test case table.
+    CEUnitTestSuiteClass::ConstructL();
+    
+    iCoverageTesting=EFalse;
+    }
+
+//  METHODS
+
+
+void T_PresenceCache::SetupL(  )
+    {
+    __UHEAP_MARK;
+    iMPresenceCacheWriter = MPresenceCacheWriter::NewL();
+    iMPresenceCacheReader = MPresenceCacheReader::NewL();
+    
+    iPresenceFeeder = MPresenceFeeder::NewL(KService6);
+    }
+    
+
+void T_PresenceCache::Teardown(  )
+    {
+    if(iMPresenceCacheReader)
+        delete iMPresenceCacheReader;
+    delete iMPresenceCacheWriter;
+    delete iPresenceFeeder;
+    delete iExpectedNotifyContent;
+    
+    if(iPresBuddyInfoList)
+        delete iPresBuddyInfoList;
+    REComSession::FinalClose();
+    User::SetJustInTime( ETrue );
+    __UHEAP_MARKEND;
+    }
+    
+void T_PresenceCache::T__PresenceInfoL()
+    {
+    // Try to read while empty
+    MXIMPIdentity* identity = iMPresenceCacheReader->NewIdentityLC();
+    identity->SetIdentityL(KBuddyId1);
+    
+    //KErrArgument
+    MPresenceInfo* presInfoRead = iMPresenceCacheReader->PresenceInfoLC(*identity);
+    EUNIT_ASSERT_EQUALS( (TInt)presInfoRead, NULL );
+    
+    //empty read
+    identity->SetIdentityL(KBuddyId1sip);
+    presInfoRead = iMPresenceCacheReader->PresenceInfoLC(*identity);
+    EUNIT_ASSERT_EQUALS( (TInt)presInfoRead, NULL );
+    
+    // write buddy presence info
+    MPresenceBuddyInfo* buddyPresInfoWrite = 
+                        MakeBuddyPresenceInfoLC(KBuddyId1sip, KText1);
+    TInt err = iMPresenceCacheWriter->WritePresenceL(buddyPresInfoWrite);
+                                                
+    // Now read it
+    presInfoRead = iMPresenceCacheReader->PresenceInfoLC(*identity);
+    
+    
+    //Now verify it
+    const CPresenceInfoImp* actualInfo = 
+        TXIMPGetImpClassOrPanic<const CPresenceInfoImp>::From(*(buddyPresInfoWrite->PresenceInfo()));
+        
+    CPresenceInfoImp* readInfo = 
+        TXIMPGetImpClassOrPanic<CPresenceInfoImp>::From(*presInfoRead);    
+    
+    TBool same = actualInfo->EqualsContent(*readInfo);
+
+    CleanupStack::PopAndDestroy(3); //identity, buddyPresInfoWrite, presInfoRead;   
+                                                
+    EUNIT_ASSERT_EQUALS( same, ETrue );
+    }
+    
+   
+void T_PresenceCache::T_WriteReadPresenceAsyncL()
+    {
+  
+    //MPresenceBuddyInfoList* buddyInfoList = CPresenceBuddyInfoListImp::NewLC(); 
+    MPresenceBuddyInfoList* buddyInfoList =  
+                            iMPresenceCacheWriter->NewPresenceBuddyInfoListLC(KNullDesC);
+    //buddyInfoList->SetServiceNameL(KService1);
+    // write buddies in all services
+    MPresenceBuddyInfo* buddyPresInfoWrite(NULL);
+    
+    TInt err2(KErrNone);
+    
+    buddyPresInfoWrite =MakeBuddyPresenceInfoLC(KBuddyId1sip, KText1);
+    buddyInfoList->AddOrReplace(buddyPresInfoWrite);CleanupStack::Pop(1);
+    
+    buddyPresInfoWrite =MakeBuddyPresenceInfoLC(KBuddyId2sip, KText1);
+    buddyInfoList->AddOrReplace(buddyPresInfoWrite);CleanupStack::Pop(1);
+
+    buddyPresInfoWrite =MakeBuddyPresenceInfoLC(KBuddyId3sip, KText1);
+    buddyInfoList->AddOrReplace(buddyPresInfoWrite);CleanupStack::Pop(1);
+
+    buddyPresInfoWrite =MakeBuddyPresenceInfoLC(KBuddyId1ECE, KText1);
+    buddyInfoList->AddOrReplace(buddyPresInfoWrite);CleanupStack::Pop(1);
+    
+    buddyPresInfoWrite =MakeBuddyPresenceInfoLC(KBuddyId2ECE, KText1);
+    buddyInfoList->AddOrReplace(buddyPresInfoWrite);CleanupStack::Pop(1);
+
+    buddyPresInfoWrite =MakeBuddyPresenceInfoLC(KBuddyId3ECE, KText1);
+    buddyInfoList->AddOrReplace(buddyPresInfoWrite);CleanupStack::Pop(1);
+
+    buddyPresInfoWrite =MakeBuddyPresenceInfoLC(KBuddyId1MSN, KText1);
+    buddyInfoList->AddOrReplace(buddyPresInfoWrite);CleanupStack::Pop(1);
+    
+    buddyPresInfoWrite =MakeBuddyPresenceInfoLC(KBuddyId2MSN, KText1);
+    buddyInfoList->AddOrReplace(buddyPresInfoWrite);CleanupStack::Pop(1);
+
+    buddyPresInfoWrite =MakeBuddyPresenceInfoLC(KBuddyId3MSN, KText1);
+    buddyInfoList->AddOrReplace(buddyPresInfoWrite);CleanupStack::Pop(1);
+
+        
+    //Only For increasing coverage for lists
+    MXIMPIdentity* identity = CXIMPIdentityImp::NewLC();
+    identity->SetIdentityL(KBuddyId3no);
+    EUNIT_ASSERT_EQUALS( buddyInfoList->FindAndRemove(*identity), KErrNotFound);
+    EUNIT_ASSERT_EQUALS( buddyInfoList->Count(), 9);
+    buddyPresInfoWrite =MakeBuddyPresenceInfoLC(KBuddyId3no, KText1);
+    EUNIT_ASSERT_EQUALS( buddyInfoList->AddOrReplace(buddyPresInfoWrite), KErrNone);
+    
+    EUNIT_ASSERT_EQUALS( buddyInfoList->Count(), 10);
+    EUNIT_ASSERT_EQUALS( buddyInfoList->FindAndRemove(*identity), KErrNone);
+    EUNIT_ASSERT_EQUALS( buddyInfoList->Count(), 9);
+    EUNIT_ASSERT_EQUALS( buddyInfoList->FindAndRemove(*identity), KErrNotFound);
+    CleanupStack::Pop(1); // buddyPresInfoWrite
+    EUNIT_ASSERT_EQUALS( (TInt)(buddyInfoList->FindAndGet(*identity)), NULL);
+    CleanupStack::PopAndDestroy(1); // identity
+    
+    //calling async write function
+    TInt err = iMPresenceCacheWriter->WritePresenceL(buddyInfoList,this);
+    //if (err==KErrNone)
+    //    WaitComplete();
+   //Try Cancelling
+    err = iMPresenceCacheWriter->CancelWrite(); //always cancels receiving callback
+    //Write Again
+    err = iMPresenceCacheWriter->WritePresenceL(buddyInfoList,this);
+    if (err==KErrNone)
+        WaitComplete();
+    else //Try again
+        {
+        err = iMPresenceCacheWriter->WritePresenceL(buddyInfoList,this);
+        if (err==KErrNone)
+            WaitComplete();
+        }
+    EUNIT_ASSERT_EQUALS( iErrorFromHandler, KErrNone);
+    
+    
+    // read from 3rd service MSN
+    err = iMPresenceCacheReader->AllBuddiesPresenceInService(KService3, this);
+    //Try Cancelling
+    err = iMPresenceCacheReader->CancelRead();
+    // Try reading again
+    err = iMPresenceCacheReader->AllBuddiesPresenceInService(KService3, this);
+    if (err+1)
+        WaitComplete();
+    EUNIT_ASSERT_EQUALS( iErrorFromHandler, KErrNone);
+    
+        
+    //Now verify it, pick something to verify
+    CPresenceBuddyInfoImp* actualInfo(NULL);
+    CPresenceBuddyInfoImp* readInfo(NULL);
+    RPointerArray<MPresenceBuddyInfo> myArraywrite = buddyInfoList->GetObjectCollection();
+    
+    RPointerArray<MPresenceBuddyInfo> myArrayread; // wont be owned
+    
+    TBool same1(EFalse);
+    if(iPresBuddyInfoList) // if list is received, compare for 3rd service MSN
+    	{
+    	myArrayread = iPresBuddyInfoList->GetObjectCollection(); //not owned
+        //1
+        actualInfo = 
+            TXIMPGetImpClassOrPanic<CPresenceBuddyInfoImp>::From(*(myArraywrite[6]));
+            
+        readInfo = 
+            TXIMPGetImpClassOrPanic<CPresenceBuddyInfoImp>::From(*(myArrayread[0]));   
+        
+        same1 = actualInfo->EqualsContent(*readInfo);
+    	}
+    
+    
+    // read for first service sip	
+    err = iMPresenceCacheReader->AllBuddiesPresenceInService(KService1, this);
+    if (err+1)
+        WaitComplete();
+    EUNIT_ASSERT_EQUALS( iErrorFromHandler, KErrNone);
+    TBool same2(EFalse);
+    if(iPresBuddyInfoList) // if list is received, compare for 1st service SIP
+        {
+        myArrayread = iPresBuddyInfoList->GetObjectCollection(); //not owned 
+        
+        actualInfo = 
+            TXIMPGetImpClassOrPanic<CPresenceBuddyInfoImp>::From(*(myArraywrite[2]));
+            
+        readInfo = 
+            TXIMPGetImpClassOrPanic<CPresenceBuddyInfoImp>::From(*(myArrayread[2]));   
+        
+        same2 = actualInfo->EqualsContent(*readInfo);  	
+     	}
+    
+    
+    // All buddies count
+    TInt count = iMPresenceCacheReader->BuddyCountInAllServices();
+    
+    // buddies count in specific service
+    TInt count2 = iMPresenceCacheReader->BuddyCountInService(KService2);
+    
+    
+    // Testing DeletePresenceL    
+    MXIMPIdentity* identity2 = CXIMPIdentityImp::NewLC();
+    identity2->SetIdentityL(KBuddyId3MSN);
+    TInt remove = iMPresenceCacheWriter->DeletePresenceL(*identity2);
+    EUNIT_ASSERT_EQUALS( remove, KErrNone );
+    remove = iMPresenceCacheWriter->DeletePresenceL(*identity2);
+    EUNIT_ASSERT_EQUALS( remove, KErrNotFound );
+    identity2->SetIdentityL(KBuddyId3ICQ);
+    remove = iMPresenceCacheWriter->DeletePresenceL(*identity2);
+    EUNIT_ASSERT_EQUALS( remove, KErrNotFound );
+    CleanupStack::PopAndDestroy(1); //identity2;   
+
+   
+   
+    TInt serviceCount = iMPresenceCacheReader->ServicesCount();
+    
+    CleanupStack::PopAndDestroy(1); //buddyInfoList;   
+                                                
+    EUNIT_ASSERT_EQUALS( same1, ETrue );
+    EUNIT_ASSERT_EQUALS( same2, ETrue );
+    EUNIT_ASSERT_EQUALS( count, 9 );
+    EUNIT_ASSERT_EQUALS( count2, 3 );
+    EUNIT_ASSERT_EQUALS( serviceCount, 3 );
+    
+    }
+    
+    
+void T_PresenceCache::T_DeletingAndCancellingL()
+    {
+    //Empty Reading
+    MXIMPIdentity* identity = CXIMPIdentityImp::NewLC();
+    identity->SetIdentityL(KBuddyId1);
+  
+    
+    CleanupStack::PopAndDestroy(1); //identity
+    
+    //Empty counting functions
+    
+    // All buddies count
+    TInt count = iMPresenceCacheReader->BuddyCountInAllServices();
+    EUNIT_ASSERT_EQUALS( count, 0 );
+    
+    // buddies count in specific service
+    TInt count2 = iMPresenceCacheReader->BuddyCountInService(KService2);
+    EUNIT_ASSERT_EQUALS( count2, KErrNotFound );
+
+   
+    //Services count
+    TInt serviceCount = iMPresenceCacheReader->ServicesCount();
+    EUNIT_ASSERT_EQUALS( serviceCount, 0 );
+    
+    
+    //Empty async reading
+    TInt err = iMPresenceCacheReader->AllBuddiesPresenceInService(KService3, this);
+    if (err+1)
+        WaitComplete();
+    EUNIT_ASSERT_EQUALS( iErrorFromHandler, KErrNotFound);
+    
+    //Writing async and verify results// this checks cancelling also
+    T_WriteReadPresenceAsyncL();
+    
+    // Now try deleting
+    err = iMPresenceCacheWriter->DeleteService(KService3);
+    EUNIT_ASSERT_EQUALS( err, KErrNone);
+    
+    //Try deleting again
+    err = iMPresenceCacheWriter->DeleteService(KService3);
+    EUNIT_ASSERT_EQUALS( err, KErrNotFound);
+    
+    //Try reading the deleted presence
+    err = iMPresenceCacheReader->AllBuddiesPresenceInService(KService3, this);
+    if (err==KErrNone)
+        WaitComplete();
+    EUNIT_ASSERT_EQUALS( iErrorFromHandler, KErrNotFound);
+    }
+    
+void T_PresenceCache::T_PerformanceL()
+    {
+    
+    
+    
+    
+    }
+    
+void T_PresenceCache::T_RunAllL()
+    {
+    T__PresenceInfoL();    
+    T_DeleteAllCacheL();
+    
+    T_WriteReadPresenceAsyncL();
+    T_DeleteAllCacheL();
+    
+    T_DeletingAndCancellingL();
+    // let the destructor delete the cache
+    }
+    
+    
+//Utility Functions    
+MPresenceInfo* T_PresenceCache::MakePresenceInfoLC()
+    {
+    MPresenceInfo* presInfo = CPresenceInfoImp::NewLC();
+    
+    MPresenceInfoFieldValueText* value = CPresenceInfoFieldValueTextImp::NewLC();
+    value->SetTextValueL(KBuddyId1);
+    
+    MPresenceInfoField* infoField = CPresenceInfoFieldImp::NewLC();
+    infoField->SetFieldTypeL(KIdentityField);
+    infoField->SetFieldValue(value);
+    
+    
+    MPersonPresenceInfo* personPres = CPersonPresenceInfoImp::NewLC();
+    MPresenceInfoFieldCollection& fieldCol = personPres->Fields();
+    fieldCol.AddOrReplaceFieldL(infoField);
+    TInt fieldCount= fieldCol.FieldCount();
+        
+    presInfo->SetPersonPresenceL(personPres);
+    
+    CleanupStack::Pop(3);//personPres,infoField,value
+    
+    return presInfo;
+    }
+
+// Utility function but also test some code
+MPresenceBuddyInfo* T_PresenceCache::MakeBuddyPresenceInfoLC(
+                                                const TDesC& id, const TDesC& text)
+    {
+    // it sets objects differently for different flag values of iCoverageTesting
+    // just of code coverage purpose
+    if(iCoverageTesting) 
+        { // make the new 
+        iCoverageTesting = !iCoverageTesting;
+        MPresenceBuddyInfo* buddyPresInfo = iMPresenceCacheWriter->NewBuddyPresenceInfoLC();
+        MPresenceInfo* presInfo = iMPresenceCacheWriter->NewPresenceInfoLC();
+        
+        MPresenceInfoFieldValueText* value = CPresenceInfoFieldValueTextImp::NewLC();
+        value->SetTextValueL(text);
+        
+        MPresenceInfoField* infoField = CPresenceInfoFieldImp::NewLC();
+        infoField->SetFieldTypeL(KIdentityField);
+        infoField->SetFieldValue(value);
+        
+        
+        MPersonPresenceInfo* personPres = CPersonPresenceInfoImp::NewLC();
+        MPresenceInfoFieldCollection& fieldCol = personPres->Fields();
+        fieldCol.AddOrReplaceFieldL(infoField);
+        TInt fieldCount= fieldCol.FieldCount();
+            
+        presInfo->SetPersonPresenceL(personPres);
+        
+        MXIMPIdentity* identity = CXIMPIdentityImp::NewLC();
+        identity->SetIdentityL(id);
+        
+        buddyPresInfo->Set(identity, presInfo);
+        
+        CleanupStack::Pop(5);//personPres,infoField,value,buddyPresInfo, identity
+        
+        return buddyPresInfo;
+        }
+    
+    iCoverageTesting = !iCoverageTesting;    
+    MPresenceBuddyInfo* buddyPresInfo = iMPresenceCacheWriter->NewBuddyPresenceInfoLC();
+    MPresenceInfo* presInfo = iMPresenceCacheWriter->NewPresenceInfoLC();
+    
+    MPresenceInfoFieldValueText* value = CPresenceInfoFieldValueTextImp::NewLC();
+    value->SetTextValueL(text);
+    
+    MPresenceInfoField* infoField = CPresenceInfoFieldImp::NewLC();
+    infoField->SetFieldTypeL(KIdentityField);
+    infoField->SetFieldValue(value);
+    
+    
+    MPersonPresenceInfo* personPres = CPersonPresenceInfoImp::NewLC();
+    MPresenceInfoFieldCollection& fieldCol = personPres->Fields();
+    fieldCol.AddOrReplaceFieldL(infoField);
+    TInt fieldCount= fieldCol.FieldCount();
+        
+    presInfo->SetPersonPresenceL(personPres);
+    
+    MXIMPIdentity* identity = CXIMPIdentityImp::NewLC();
+    identity->SetIdentityL(id);
+    
+   
+    //Call again for the sake of code coverage
+    EUNIT_ASSERT_EQUALS( buddyPresInfo->SetBuddyId(identity), KErrNone);
+    EUNIT_ASSERT_EQUALS( buddyPresInfo->SetPresenceInfo(presInfo), KErrNone);
+    
+    CleanupStack::Pop(5);//personPres,infoField,value,buddyPresInfo, identity
+    
+    return buddyPresInfo;
+    }
+    
+void T_PresenceCache::T_DeleteAllCacheL()
+    {
+    // all service uids
+    TInt count = iMPresenceCacheReader->ServicesCount();
+    TInt err(KErrNone);
+    
+    err = iMPresenceCacheWriter->DeleteService(KService1);
+    err = iMPresenceCacheWriter->DeleteService(KService2);
+    err = iMPresenceCacheWriter->DeleteService(KService3);
+    err = iMPresenceCacheWriter->DeleteService(KService4);
+    err = iMPresenceCacheWriter->DeleteService(KService5);
+    err = iMPresenceCacheWriter->DeleteService(KService6);
+    }
+    
+void T_PresenceCache::T_MakePerformancePreconditionsL()
+    {
+    }
+
+// Buddy with status text and avater    
+MPresenceBuddyInfo*  T_PresenceCache::T_MakePerformanceBuddyLC(const TDesC& /*id*/ )
+    {
+    /*
+    MPresenceBuddyInfo* buddyPresInfo = iMPresenceCacheWriter->NewBuddyPresenceInfoLC();
+    MPresenceInfo* presInfo = iMPresenceCacheWriter->NewPresenceInfoLC();
+    
+    //Text field
+    MPresenceInfoFieldValueText* value = CPresenceInfoFieldValueTextImp::NewLC();
+    value->SetTextValueL(text);
+    
+    MPresenceInfoField* infoField = CPresenceInfoFieldImp::NewLC();
+    infoField->SetFieldTypeL(KIdentityField);
+    infoField->SetFieldValue(value);
+    
+    //Binary field
+    MPresenceInfoFieldValueBinay* value = CPresenceInfoFieldValueBinaryImp::NewLC();
+    value->SetBinaryValueL(text);
+    
+    MPresenceInfoField* infoField = CPresenceInfoFieldImp::NewLC();
+    infoField->SetFieldTypeL(KIdentityField);
+    infoField->SetFieldValue(value);
+    
+    
+    
+    MPersonPresenceInfo* personPres = CPersonPresenceInfoImp::NewLC();
+    MPresenceInfoFieldCollection& fieldCol = personPres->Fields();
+    fieldCol.AddOrReplaceFieldL(infoField);
+    TInt fieldCount= fieldCol.FieldCount();
+        
+    presInfo->SetPersonPresenceL(personPres);
+    
+    MXIMPIdentity* identity = CXIMPIdentityImp::NewLC();
+    identity->SetIdentityL(id);
+    
+    TUid serviceid;
+    serviceid.iUid = service;
+    
+    buddyPresInfo->Set(serviceid, identity, presInfo);
+    
+    CleanupStack::Pop(5);//personPres,infoField,value,buddyPresInfo, identity
+    
+    return buddyPresInfo;*/
+    }
+
+
+void T_PresenceCache::T_SubscribeBuddy1Response()
+    {    
+    // Notice: First set the initial state for User1, this is needed at least now. 
+    MPresenceBuddyInfo* initInfo = MakeBuddyPresenceInfoLC(KBuddyId1no, KText1);        
+    TInt err = iMPresenceCacheWriter->WritePresenceL(initInfo);
+    CleanupStack::PopAndDestroy(  ); // initInfo      
+    EUNIT_ASSERT_EQUALS( err, 0 );    
+        
+    err = iMPresenceCacheReader->SetObserverForSubscribedNotifications( this );   
+    EUNIT_ASSERT_EQUALS( err, 0 );    
+    
+    MXIMPIdentity* identity = CXIMPIdentityImp::NewLC();
+    identity->SetIdentityL(KBuddyId1no);
+    
+    err = iMPresenceCacheReader->SubscribePresenceBuddyChangeL( *identity);      
+    CleanupStack::PopAndDestroy(1); //identity    
+    EUNIT_ASSERT_EQUALS( err, 0 );
+    
+    // Presence feeder 
+    iExpectedNotifyStatus = KErrNone;
+    iNbrNotifys = 1;
+    iPresenceFeeder->SetAvailabilityL( KBuddyId1, MPresenceFeeder::ENotAvailable, KText2);
+        
+    // TODO: 
+    delete iExpectedNotifyContent;
+    iExpectedNotifyContent = NULL;
+    iExpectedNotifyContent = 
+        MakeBuddyPresenceInfoLC(KBuddyId1no, KText2);
+    CleanupStack::Pop(  );  // iExpectedNotifyContent
+    err = iMPresenceCacheWriter->WritePresenceL(iExpectedNotifyContent);    
+    EUNIT_ASSERT_EQUALS( err, 0 );
+    
+    iPresenceFeeder->RemoveAvailabilityL(KBuddyId2);                
+    
+    // Now we start to wait callback method HandlePresenceNotificationL  
+    WaitComplete();
+    }
+
+void T_PresenceCache::T_SubscribeBuddyAndUnsubscribe()
+    {
+    // Test few error cases first
+            
+    // Test null parameter error case
+    TInt err = iMPresenceCacheReader->SetObserverForSubscribedNotifications( NULL );   
+    EUNIT_ASSERT_EQUALS( err, KErrArgument );
+    
+    // Test subscription without callback registeration
+    MXIMPIdentity* identity = CXIMPIdentityImp::NewLC();
+    identity->SetIdentityL(KBuddyId1ECE);    
+ 
+    err = iMPresenceCacheReader->SubscribePresenceBuddyChangeL( *identity); 
+    EUNIT_ASSERT_EQUALS( err, KErrNotReady );    
+    
+    // Now make successful subscription  
+    err = iMPresenceCacheReader->SetObserverForSubscribedNotifications( this );   
+    EUNIT_ASSERT_EQUALS( err, 0 );    
+    err = iMPresenceCacheReader->SubscribePresenceBuddyChangeL( *identity);     
+    EUNIT_ASSERT_EQUALS( err, 0);
+    
+    // Make successful unsubscription    
+    iMPresenceCacheReader->UnSubscribePresenceBuddyChangeL( *identity);        
+    
+    CleanupStack::PopAndDestroy(1); //identity        
+    // Now we start to wait callback method HandlePresenceNotificationL    
+    }
+
+void T_PresenceCache::T_SubscribeBuddyManyResponses()
+    {  
+    // Notice: First set the initial state for User1, this is needed at least now. 
+    MPresenceBuddyInfo* initInfo = MakeBuddyPresenceInfoLC(KBuddyId1no, KText1);        
+    TInt err = iMPresenceCacheWriter->WritePresenceL(initInfo);
+    CleanupStack::PopAndDestroy(  ); // initInfo      
+    EUNIT_ASSERT_EQUALS( err, 0 );  
+    
+    err = iMPresenceCacheReader->SetObserverForSubscribedNotifications( this );   
+    EUNIT_ASSERT_EQUALS( err, 0 );    
+    
+    MXIMPIdentity* identity = CXIMPIdentityImp::NewLC();
+    identity->SetIdentityL(KBuddyId1no);
+    
+    err = iMPresenceCacheReader->SubscribePresenceBuddyChangeL( *identity);      
+    CleanupStack::PopAndDestroy(1); //identity    
+    EUNIT_ASSERT_EQUALS( err, 0 );
+    
+    // Presence feeder 
+    iExpectedNotifyStatus = KErrNone;
+    iNbrNotifys = 4;
+    iPresenceFeeder->SetAvailabilityL( KBuddyId1, MPresenceFeeder::ENotAvailable, KText2);
+        
+    delete iExpectedNotifyContent;
+    iExpectedNotifyContent = NULL;
+    iExpectedNotifyContent = 
+        MakeBuddyPresenceInfoLC(KBuddyId1no, KText1);
+    CleanupStack::Pop(  );  // iExpectedNotifyContent 
+    err = iMPresenceCacheWriter->WritePresenceL(iExpectedNotifyContent);    
+    EUNIT_ASSERT_EQUALS( err, 0 );
+                   
+    // Now we start to wait callback method HandlePresenceNotificationL  
+    WaitComplete();        
+    }
+    
+void T_PresenceCache::T_DeleteBeforeNotify()
+    {
+    // Notice: First set the initial state for User1, this is needed at least now. 
+    TInt err;
+    /*
+    MPresenceBuddyInfo* initInfo = MakeBuddyPresenceInfoLC( KServiceUid6, KBuddyId1, KText1);        
+    TInt err = iMPresenceCacheWriter->WritePresenceL(initInfo);
+    CleanupStack::PopAndDestroy(  ); // initInfo      
+    EUNIT_ASSERT_EQUALS( err, 0 ); */   
+        
+    err = iMPresenceCacheReader->SetObserverForSubscribedNotifications( this );   
+    EUNIT_ASSERT_EQUALS( err, 0 );    
+    
+    MXIMPIdentity* identity = CXIMPIdentityImp::NewLC();
+    identity->SetIdentityL(KBuddyId1no);
+    
+    err = iMPresenceCacheReader->SubscribePresenceBuddyChangeL( *identity);      
+    CleanupStack::PopAndDestroy(1); //identity    
+    EUNIT_ASSERT_EQUALS( err, 0 );
+    
+    // Presence feeder 
+    iExpectedNotifyStatus = KErrNone;
+    iNbrNotifys = 1;
+    
+    
+    delete iMPresenceCacheReader;
+    iMPresenceCacheReader = NULL;
+        
+    // TODO: 
+    delete iExpectedNotifyContent;
+    iExpectedNotifyContent = NULL;
+    iExpectedNotifyContent = 
+        MakeBuddyPresenceInfoLC(KBuddyId1no, KText2);
+    CleanupStack::Pop(  );  // iExpectedNotifyContent
+    err = iMPresenceCacheWriter->WritePresenceL(iExpectedNotifyContent);    
+    EUNIT_ASSERT_EQUALS( err, 0 );
+    
+    //no notification should come, since we have deleted the subscriber
+    }
+
+
+// Callback observers
+    
+void T_PresenceCache::HandlePresenceWriteL(TInt aErrorCode)
+    {
+	EUNIT_PRINT(_L("HandlePresenceWriteL"));
+	EUNIT_PRINT(_L("    aErrorCode: %d"), aErrorCode);
+    iCbReceived = ETrue;
+    iErrorFromHandler = aErrorCode;
+
+    if( iWait.IsStarted() )
+        {
+        iWait.AsyncStop();
+        }
+    }
+
+void T_PresenceCache::HandlePresenceReadL(TInt aErrorCode,
+                    MPresenceBuddyInfoList* aPresenceBuddyInfoList)
+    {
+	EUNIT_PRINT(_L("HandlePresenceReadL"));
+	EUNIT_PRINT(_L("    aErrorCode: %d"), aErrorCode);
+    iCbReceived = ETrue;
+    iErrorFromHandler = aErrorCode;
+    
+    
+    if(iPresBuddyInfoList)
+    	delete iPresBuddyInfoList; iPresBuddyInfoList=NULL;
+    iPresBuddyInfoList = aPresenceBuddyInfoList;
+    
+    if( iWait.IsStarted() )
+        {
+        iWait.AsyncStop();
+        }
+    }
+    
+// *****************************************************************************   
+                            
+void T_PresenceCache::HandlePresenceNotificationL(TInt aErrorCode,
+                            MPresenceBuddyInfo* aPresenceBuddyInfo)
+    {
+	EUNIT_PRINT(_L("HandlePresenceNotiicationL"));
+	EUNIT_PRINT(_L("    aErrorCode: %d"), aErrorCode);
+    iCbReceived = ETrue;
+    iErrorFromHandler = aErrorCode;
+    
+    // check what is expected
+    EUNIT_ASSERT_EQUALS( aErrorCode, iExpectedNotifyStatus );     
+    
+    if ( aPresenceBuddyInfo )
+        {
+        // We do not want to get anything when not expecting it.
+        TBool isNull = iExpectedNotifyContent ? EFalse : ETrue;
+        EUNIT_ASSERT_EQUALS( isNull, EFalse  ); 
+        // just check that this does not crash
+        const MXIMPIdentity* buddyId = aPresenceBuddyInfo->BuddyId();
+        // Then test the whole content 
+        TBool eq = iExpectedNotifyContent->EqualsIdentity( aPresenceBuddyInfo );  
+        EUNIT_ASSERT_EQUALS( eq, ETrue );          
+        }
+    else
+        {
+        EUNIT_PRINT(_L("  received buddyInfo is NULL"));        
+        }
+               
+    delete aPresenceBuddyInfo; 
+    
+    iNbrNotifys--;
+    
+    /* The test sequence of complicated case is
+     * sub Usr1
+     * write Usr1 -> Notify
+     * sub Usr2
+     * write Usr1 -> Notify
+     * write Usr2 -> Notify
+     * unsub Usr2
+     * write Usr2
+     * delete Usr1 -> notify(empty)
+     */
+    
+    switch ( iNbrNotifys )
+        {
+        case 3: 
+            // subscribe U2
+            {   
+            // Notice: First set the initial state for User1, this is needed at least now. 
+            MPresenceBuddyInfo* initInfo = MakeBuddyPresenceInfoLC(KBuddyId2no, KText2);        
+            TInt err = iMPresenceCacheWriter->WritePresenceL(initInfo);
+            CleanupStack::PopAndDestroy(  ); // initInfo      
+            EUNIT_ASSERT_EQUALS( err, 0 ); 
+            
+            MXIMPIdentity* identity = CXIMPIdentityImp::NewLC();
+            identity->SetIdentityL(KBuddyId2no);            
+            err = iMPresenceCacheReader->SubscribePresenceBuddyChangeL( *identity);      
+            CleanupStack::PopAndDestroy(1); //identity    
+            EUNIT_ASSERT_EQUALS( err, 0 );
+            
+            // Presence feeder 
+            iExpectedNotifyStatus = KErrNone;                
+            delete iExpectedNotifyContent;
+            iExpectedNotifyContent = NULL;
+            iExpectedNotifyContent = 
+                MakeBuddyPresenceInfoLC(KBuddyId1no, KText1);
+            CleanupStack::Pop(  );  // iExpectedNotifyContent       
+            err = iMPresenceCacheWriter->WritePresenceL(iExpectedNotifyContent);    
+            EUNIT_ASSERT_EQUALS( err, 0 );   
+            // Now we start to wait callback method HandlePresenceNotificationL               
+            }
+            break;
+        case 2: 
+            {
+            // Presence feeder 
+            iExpectedNotifyStatus = KErrNone;                
+            delete iExpectedNotifyContent;
+            iExpectedNotifyContent = NULL;
+            iExpectedNotifyContent = 
+                MakeBuddyPresenceInfoLC(KBuddyId2no, KText3);
+            CleanupStack::Pop(  );  // iExpectedNotifyContent       
+            TInt err = iMPresenceCacheWriter->WritePresenceL(iExpectedNotifyContent);    
+            EUNIT_ASSERT_EQUALS( err, 0 );   
+            // Now we start to wait callback method HandlePresenceNotificationL          
+            }
+            break;
+        case 1:
+            {
+            // Unsubscribe Usr2
+            MXIMPIdentity* identity = CXIMPIdentityImp::NewLC();
+            identity->SetIdentityL(KBuddyId2no);            
+            iMPresenceCacheReader->UnSubscribePresenceBuddyChangeL( *identity );      
+            CleanupStack::PopAndDestroy(1); //identity    
+            
+            // Write Usr2 
+            iExpectedNotifyStatus = KErrNone;                
+            delete iExpectedNotifyContent;
+            iExpectedNotifyContent = NULL;   
+            
+            // delete Usr1
+            iPresenceFeeder->RemovePresenceL(KBuddyId1no); 
+            iExpectedNotifyContent = 
+               MakeBuddyPresenceInfoLC( KBuddyId1no, KText3);
+            TInt err =  iExpectedNotifyContent->SetPresenceInfo( NULL );
+            EUNIT_ASSERT_EQUALS( err, KErrArgument ); 
+            CleanupStack::Pop(  );  // iExpectedNotifyContent            
+            
+            // Now we start to wait callback method HandlePresenceNotificationL
+            }
+            break;
+        case 0:
+        default:         
+            if( iWait.IsStarted() )
+                {
+                iWait.AsyncStop();
+                }
+            break;   
+        };
+    
+    }  
+    
+// *****************************************************************************                                  
+    
+    
+void T_PresenceCache::T_TestFeeder()
+    {
+    iPresenceFeeder->SetAvailabilityL(KBuddyId1,MPresenceFeeder::ENotAvailable,KText2);
+    iPresenceFeeder->SetAvailabilityL(KBuddyId1,MPresenceFeeder::ENotAvailable,KText2);
+    iPresenceFeeder->RemoveAvailabilityL(KBuddyId2);
+    iPresenceFeeder->RemoveAvailabilityL(KBuddyId1);
+    iPresenceFeeder->SetAvailabilityL(KBuddyId1,MPresenceFeeder::ENotAvailable,KText2);
+    iPresenceFeeder->RemovePresenceL(KBuddyId2);
+    iPresenceFeeder->RemovePresenceL(KBuddyId1);
+    iPresenceFeeder->SetAvailabilityL(KBuddyId1,MPresenceFeeder::ENotAvailable,KText2);
+    iPresenceFeeder->RemoveAllPresences();
+    }
+    
+//  TEST TABLE
+EUNIT_BEGIN_TEST_TABLE(
+    T_PresenceCache,
+    "Presence Cache module tests.",
+    "MODULE" )
+    
+EUNIT_TEST(
+    "T__PresenceInfoL",
+    "PresenceCache",
+    "T__PresenceInfoL",
+    "FUNCTIONALITY",
+    SetupL, T__PresenceInfoL, Teardown)
+    
+EUNIT_TEST(
+    "T_WriteReadPresenceAsyncL",
+    "PresenceCache",
+    "T_WriteReadPresenceAsyncL",
+    "FUNCTIONALITY",
+    SetupL, T_WriteReadPresenceAsyncL, Teardown)
+    
+EUNIT_TEST(
+	    "T_DeletingAndCancellingL",
+	    "PresenceCache",
+	    "T_DeletingAndCancellingL",
+	    "FUNCTIONALITY",
+	    SetupL, T_DeletingAndCancellingL, Teardown)    
+    
+EUNIT_TEST(
+	    "T_RunAllL",
+	    "PresenceCache",
+	    "T_RunAllL",
+	    "FUNCTIONALITY",
+	    SetupL, T_RunAllL, Teardown)
+	    
+EUNIT_TEST(
+	    "T_TestFeeder",
+	    "PresenceFeeder",
+	    "T_TestFeeder",
+	    "FUNCTIONALITY",
+	    SetupL, T_TestFeeder, Teardown)
+    
+EUNIT_TEST(
+	    "T_SubscribeBuddyAndUnsubscribe",
+	    "PresenceCache",
+	    "T_SubscribeBuddyAndUnsubscribe",
+	    "FUNCTIONALITY",
+	    SetupL, T_SubscribeBuddyAndUnsubscribe, Teardown)	    
+	    
+EUNIT_TEST(
+	    "T_SubscribeBuddy1Response",
+	    "PresenceCache",
+	    "T_SubscribeBuddy1Response",
+	    "FUNCTIONALITY",
+	    SetupL, T_SubscribeBuddy1Response, Teardown)
+        
+EUNIT_TEST(
+        "T_SubscribeBuddyManyResponses",
+        "PresenceCache",
+        "T_SubscribeBuddyManyResponses",
+        "FUNCTIONALITY",
+        SetupL, T_SubscribeBuddyManyResponses, Teardown)
+        
+EUNIT_TEST(
+        "T_DeleteBeforeNotify",
+        "PresenceCache",
+        "T_DeleteBeforeNotify",
+        "FUNCTIONALITY",
+        SetupL, T_DeleteBeforeNotify, Teardown)
+        
+EUNIT_END_TEST_TABLE
+
+//  END OF FILE
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/tsrc/src/t_presencecache/T_PresenceCache.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,161 @@
+/*
+* 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: XIMP Framework Test Code 
+*
+*/
+
+
+#ifndef __T_MPRESENCECACHEREADER_H__
+#define __T_MPRESENCECACHEREADER_H__
+
+//  EXTERNAL INCLUDES
+#include <CEUnitTestSuiteClass.h>
+#include <EUnitDecorators.h>
+#include <presencecachereader.h>
+#include <presencecachewriter.h>
+#include <prescachereadhandler.h>
+#include <prescachewritehandler.h>
+
+#include <e32cmn.h>
+
+class MPresenceBuddyInfo;
+class MPresenceFeeder;
+
+
+//  INTERNAL INCLUDES
+
+
+//  FORWARD DECLARATIONS
+
+
+//  CLASS DEFINITION
+/**
+ * TODO Auto-generated EUnit test suite
+ *
+ */
+NONSHARABLE_CLASS( T_PresenceCache )
+	: public CEUnitTestSuiteClass,
+	  public MPresCacheReadHandler,
+	  public MPresCacheWriteHandler
+    {
+    public:     // Constructors and destructors
+
+        /**
+         * Two phase construction
+         */
+        static T_PresenceCache* NewL();
+        static T_PresenceCache* NewLC();
+        /**
+         * Destructor
+         */
+        ~T_PresenceCache();
+        
+    public:     // from handlers
+        void HandlePresenceWriteL(TInt aErrorCode);    
+        void HandlePresenceReadL(TInt aErrorCode,
+            MPresenceBuddyInfoList* aPresenceBuddyInfoList);
+        void HandlePresenceNotificationL(TInt aErrorCode,
+                            MPresenceBuddyInfo* aPresenceBuddyInfo);            
+            
+    private:    // Constructors and destructors
+
+        T_PresenceCache();
+        void ConstructL();
+
+    private:    // New methods
+
+         void SetupL();
+        
+         void Teardown();
+         
+         void T__PresenceInfoL();
+        
+         void T_WriteReadPresenceAsyncL();
+        
+         void T_DeletingAndCancellingL();
+         
+         void T_PerformanceL();
+         
+         void T_RunAllL();
+         
+         void T_TestFeeder();
+        
+         void T_SubscribeBuddy1Response();
+         
+         void T_SubscribeBuddyAndUnsubscribe(); 
+         
+         void T_SubscribeBuddyManyResponses();
+         
+         void T_DeleteBeforeNotify();
+         
+       
+    private:    // utilities
+         MPresenceInfo* MakePresenceInfoLC();
+         
+         MPresenceBuddyInfo* MakeBuddyPresenceInfoLC(
+                                         const TDesC& id, const TDesC& text);
+                                         
+         void T_DeleteAllCacheL();
+         
+         void T_MakePerformancePreconditionsL();
+         
+         MPresenceBuddyInfo* T_MakePerformanceBuddyLC(const TDesC& id);                  
+         
+         inline void WaitComplete();
+        
+
+    private:    // Data
+		
+        MPresenceCacheReader* iMPresenceCacheReader;
+        MPresenceCacheWriter* iMPresenceCacheWriter;
+        
+        MPresenceFeeder* iPresenceFeeder;
+        
+        
+        MPresenceBuddyInfoList* iPresBuddyInfoList;
+        
+        EUNIT_DECLARE_TEST_TABLE;
+        TUid iUid;
+        
+        TBool iCoverageTesting;
+        
+        // we will record the error from handler here
+        TInt iErrorFromHandler;
+		
+		//OWN: Active scheduler wait and Cb received indication
+        CActiveSchedulerWait iWait;
+        TBool iCbReceived;
+        
+        // expected status of next notification
+        TInt iExpectedNotifyStatus; 
+        // How many notifications are waicted until test is done.
+        TInt iNbrNotifys;
+        // Expected content of notification
+        // OWN
+        MPresenceBuddyInfo* iExpectedNotifyContent;        
+        
+    };
+    
+inline void T_PresenceCache::WaitComplete()
+    {
+    iCbReceived = EFalse;
+    if( !iCbReceived )
+        {
+        iWait.Start();
+        }
+    }
+    
+#endif      //  __T_MPRESENCECACHEREADER_H__
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/tsrc/src/t_presencecache/T_PresenceCache.mmp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,72 @@
+/*
+* 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: XIMP Framework Test Code 
+*
+*/
+
+#include <platform_paths.hrh>
+
+
+TARGET          t_presencecache.dll
+TARGETTYPE      dll
+UID             0x1000af5a 0x01700000
+
+CAPABILITY              ALL -TCB
+VENDORID                0x00000000
+
+SOURCEPATH              .
+SOURCE                  t_presencecache.cpp
+SOURCE                  t_presencecache_dllmain.cpp
+
+
+USERINCLUDE             .
+USERINCLUDE             ../../../presence/srcpresencedatamodel
+USERINCLUDE             ../../../presence/srcpresencedatamodel/presencecache
+
+SYSTEMINCLUDE           /epoc32/../../epoc32/include
+SYSTEMINCLUDE           /epoc32/../../epoc32/include/Digia/EUnit
+
+// System include folders required by the tested code
+//SYSTEMINCLUDE           ../../../inc/presence/presencecache
+SYSTEMINCLUDE           ../../../inc/presence/presencedatamodel
+
+
+//Following internal headers we are using
+SYSTEMINCLUDE           ../../../core/srcdatamodel
+SYSTEMINCLUDE           ../../../core/srcutils
+
+
+SYSTEMINCLUDE           ../../../presence/srcpresencedatamodel/presencepublishing
+SYSTEMINCLUDE           ../../../presence/srcpresencedatamodel/presenceinfo
+SYSTEMINCLUDE           ../../../presence/srcpresencedatamodel/presentitygroups
+SYSTEMINCLUDE           ../../../presence/srcpresencedatamodel
+SYSTEMINCLUDE           ../../../presence/srcpresencedatamodel/presencewatching
+SYSTEMINCLUDE           ../../../presence/srcpresencedatamodel/presenceauthorization
+SYSTEMINCLUDE           ../../../presence/srcpresencecache/presencecacheclient
+SYSTEMINCLUDE           ../../../presence/srcpresencecache/presencecacheserver
+
+MW_LAYER_SYSTEMINCLUDE
+
+LIBRARY                 EUnit.lib
+LIBRARY                 EUnitUtil.lib
+LIBRARY                 euser.lib
+LIBRARY                 ecom.lib
+LIBRARY                 presencedatamodel.lib
+LIBRARY                 ximpdatamodel.lib
+LIBRARY                 presencecacheclient.lib
+LIBRARY                 ximputils.lib
+
+LIBRARY                 presencefeeder.lib
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/tsrc/src/t_presencecache/T_PresenceCache_DllMain.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -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: XIMP Framework Test Code 
+*
+*/
+
+
+//  CLASS HEADER
+#include "T_PresenceCache.h"
+
+//  EXTERNAL INCLUDES
+#include <CEUnitTestSuite.h>
+
+EXPORT_C MEUnitTest* CreateTestSuiteL()
+    {
+    return T_PresenceCache::NewL();
+    }
+
+#ifndef EKA2
+GLDEF_C TInt E32Dll( TDllReason )
+	{
+	return KErrNone;
+	}
+#endif
+
+//  END OF FILE
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/tsrc/src/t_presencecache/bld.inf	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,28 @@
+/*
+* 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: XIMP Framework Test Code 
+*
+*/
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+// /epoc32/release/winscw/udeb/t_presencecache.dll	/epoc32/release/winscw/udeb/z/sys/bin/t_presencecache.dll
+
+PRJ_TESTMMPFILES
+T_PresenceCache.mmp
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/tsrc/src/t_presencegrantrequestmngt/bld.inf	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,25 @@
+/*
+* 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 t_presencegrantrequestmngt.dll
+*
+*/
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+PRJ_TESTMMPFILES
+t_presencegrantrequestmngt.mmp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/tsrc/src/t_presencegrantrequestmngt/t_presencegrantrequestmngt.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,914 @@
+/*
+* 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: XIMP Framework Test Code 
+*
+*/
+
+
+#include "eunittools.h"
+
+
+#include <platform/digia/eunit/eunitmacros.h>
+#include <platform/digia/eunit/teunitassertioninfo.h>
+
+#include <ecom/ecom.h>
+#include <badesca.h>
+
+#include <ximpbase.h>
+#include <ximpclient.h>
+#include <ximpcontext.h>
+#include <presencefeatures.h>
+#include <presenceauthorization.h>
+
+#include "t_presencegrantrequestmngt.h"
+
+#include "ximprequestcompleteeventimp.h"
+
+//#include "prfwtestpresencedatautils.h"
+
+// grant req includes
+#include "presencegrantrequestinfoimp.h"
+#include "presencegrantrequestlisteventimp.h"
+
+
+// other data model includes
+#include "ximpidentityimp.h"
+
+// utils includes
+#include "ximpobjecthelpers.h"
+
+// testing tool includes
+#include "prfwtestmessaging.h"
+#include "prfwtestmessenger.h"
+#include "prfwtestcontextwrappermgr.h"
+#include "prfwtestcontextwrapper.h"
+
+#include "prfwtestfilesrvmsg.h"
+#include "prfwtestfiletool.h"
+#include "prfwtestlistener.h"
+
+#include "prfwtestrobustnesstools.h"
+
+_LIT8( KPrefix1, "PreA_" );
+_LIT8( KPrefix2, "PreB_" );
+_LIT8( KPrefix3, "PreC_" );
+_LIT8( KPrefix4, "PreD_" );
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// CONSTRUCTION
+T_PresenceGrantRequestManagement* T_PresenceGrantRequestManagement::NewL()
+    {
+    T_PresenceGrantRequestManagement* self = new( ELeave ) T_PresenceGrantRequestManagement;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+
+    return self;
+    }
+
+
+T_PresenceGrantRequestManagement::~T_PresenceGrantRequestManagement()
+    {
+    PrfwTestRobustness::DoPreCleaning();
+    }
+
+
+void T_PresenceGrantRequestManagement::ConstructL()
+    {
+    CEUnitTestSuiteClass::ConstructL();
+    }
+
+
+T_PresenceGrantRequestManagement::T_PresenceGrantRequestManagement()
+    {
+    }
+
+
+
+// ===========================================================================
+// TEST CASE SETUP & TEARDOWN METHODS
+// ===========================================================================
+//
+
+void T_PresenceGrantRequestManagement::Setup_L()
+    {
+    PrfwTestRobustness::DoPreCleaning();
+
+    iWrapperMgr = CXIMPTestContextWrapperMgr::NewL();
+    iWrapperMgr->CreateWrapperL();
+    }
+
+void T_PresenceGrantRequestManagement::SetupMultiple_L()
+    {
+    PrfwTestRobustness::DoPreCleaning();
+
+    iWrapperMgr = CXIMPTestContextWrapperMgr::NewL();
+    iWrapperMgr->CreateWrapperL();
+    iWrapperMgr->CreateWrapperL();
+    iWrapperMgr->CreateWrapperL();
+    }
+
+
+void T_PresenceGrantRequestManagement::BindL()
+    {
+    CXIMPTestContextWrapper* wrapper0 = iWrapperMgr->GetWrapperL( 0 );
+
+    wrapper0->BindL( 0 );
+    }
+
+void T_PresenceGrantRequestManagement::BindAllL()
+    {
+    for( TInt a = 0; a < iWrapperMgr->WrapperCount(); ++a )
+        {
+        CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a );
+        wrapper->BindL( 0 );
+        }
+    }
+
+
+void T_PresenceGrantRequestManagement::Teardown()
+    {
+    delete iWrapperMgr;
+    iWrapperMgr = NULL;
+
+    REComSession::FinalClose();
+
+    PrfwTestRobustness::DoPreCleaning();
+    }
+
+void T_PresenceGrantRequestManagement::UnbindL()
+    {
+    // Do unbind
+    CXIMPTestContextWrapper* wrapper0 = iWrapperMgr->GetWrapperL( 0 );
+    wrapper0->UnbindL();
+    }
+
+void T_PresenceGrantRequestManagement::UnbindAllL()
+    {
+    for( TInt a = 0; a < iWrapperMgr->WrapperCount(); ++a )
+        {
+        CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a );
+        wrapper->UnbindL();
+        }
+    }
+
+
+// ===========================================================================
+// TEST CASES for presentity presence subscription
+// ===========================================================================
+
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+void T_PresenceGrantRequestManagement::T_SubscribeGrantRequestList_Single_L()
+    {
+    EUNIT_PRINT( _L("Single presence grant request list subscription") );
+
+    BindL();
+
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    MXIMPContext* context = wrapper->GetContext();
+    CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+    CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context );
+    CleanupStack::PushL( listener2 );
+
+    // Tell the protocol it should act normally
+    messenger->SetNoError();
+
+    // Get the interfaces
+    MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+    MPresenceAuthorization& presAuth = presFeat->PresenceAuthorization();
+
+    // ---------------------------------------------
+    // 1. Subscribe grant request list
+
+    // Setup status event listener for RequestComplete
+    listener2->Reset();
+
+    // normal request complete
+    TXIMPRequestId reqIdDummy;  // not checked
+    CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+    listener2->ExpectL( evReqComplete );
+    CleanupStack::Pop( evReqComplete );
+    // ---------------------------------------------
+
+    // subscribe
+    // ---------------------------------------------
+    TXIMPRequestId reqId = presAuth.SubscribePresenceGrantRequestListL();
+    EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Subscribe failed" );
+    // ---------------------------------------------
+
+    // verify that SubscribeGrantListL was called
+    COMMONASSERT( messenger, EXIMPPlgTestSubscribePresenceGrantRequestListCalled, "SubscribeGrantListL was not called", ETrue, NULL );
+
+
+    // ---------------------------------------------
+    // 2. refresh subscription
+    
+    // Setup status event listener for RequestComplete
+    listener2->Reset();
+
+    evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+    listener2->ExpectL( evReqComplete );
+    CleanupStack::Pop( evReqComplete );
+
+    RPrGrntReqInfoImpArray* pendingList(NULL);
+    CPresenceGrantRequestListEventImp* event = CreateGrantRequestListEventLCX(
+        KNullDesC, KNullDesC,
+        MXIMPDataSubscriptionState::ESubscriptionActive,
+        MXIMPDataSubscriptionState::EDataUnavailable,
+        ETestPGRPending, pendingList );
+    listener2->ExpectL( event );
+    CleanupStack::Pop(); //event 3 to go.
+
+    // refresh subscription
+    // ---------------------------------------------
+    reqId = presAuth.SubscribePresenceGrantRequestListL();
+    EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Refresh failed" );
+    CleanupStack::PopAndDestroy( 3 ); // rest of the items.
+
+
+    // ---------------------------------------------
+    // 3. Unsubscribe grant request list
+
+    // Setup status event listener for RequestComplete
+    listener2->Reset();
+
+    evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+    listener2->ExpectL( evReqComplete );
+    CleanupStack::Pop( evReqComplete );
+
+    // unsubscribe
+    // ---------------------------------------------
+    reqId = presAuth.UnsubscribePresenceGrantRequestListL();
+    EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Unsubscribe failed" );
+
+
+    // verify that UnsubscribeGrantListL was called
+    COMMONASSERT( messenger, EXIMPPlgTestUnsubscribePresenceGrantRequestListCalled, "UnsubscribeGrantListL was not called", ETrue, NULL );
+    
+
+    // ---------------------------------------------
+    // 4. Unsubscribe grant request list (non-subscribed)
+
+    // Setup status event listener for RequestComplete
+    listener2->Reset();
+
+    evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+    listener2->ExpectL( evReqComplete );
+    CleanupStack::Pop( evReqComplete );
+
+    // unsubscribe
+    // ---------------------------------------------
+    reqId = presAuth.UnsubscribePresenceGrantRequestListL();
+
+    EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Unsubscribe failed" );
+
+    // verify that UnsubscribeGrantListL was called
+    COMMONASSERT( messenger, EXIMPPlgTestUnsubscribePresenceGrantRequestListCalled, "UnsubscribeGrantListL was not called", ETrue, NULL );
+
+    // Deinitiliaze event source from listener.
+    listener2->SetEventSourceL( NULL );
+
+    UnbindL();
+
+    CleanupStack::PopAndDestroy( listener2 );
+    }
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+void T_PresenceGrantRequestManagement::T_SubscribeGrantRequestList_Multiple_L()
+    {
+    EUNIT_PRINT( _L("Multiple presence grant request list subscription") );
+
+    BindAllL();
+
+    TInt countOfWrappers = iWrapperMgr->WrapperCount();
+    TInt a(0);
+    for( a = 0; a < countOfWrappers; ++a )
+        {
+        CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a );
+        MXIMPContext* context = wrapper->GetContext();
+        CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+        // Get the interfaces
+        MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+        MPresenceAuthorization& presAuth = presFeat->PresenceAuthorization();
+
+        CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context );
+        CleanupStack::PushL( listener2 );
+
+        // Tell the protocol it should act normally
+        messenger->SetNoError();
+
+        // expect normal request complete
+        TXIMPRequestId reqIdDummy;  // not checked
+        CXIMPRequestCompleteEventImp* evReqComplete =
+                                CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+        listener2->ExpectL( evReqComplete );
+        CleanupStack::Pop( evReqComplete );
+
+        // subscribe
+        TXIMPRequestId reqId = presAuth.SubscribePresenceGrantRequestListL();
+
+        EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Subscribe failed" );
+
+        // verify that SubscribePresenceGrantRequestListL was called
+        COMMONASSERT( messenger, EXIMPPlgTestSubscribePresenceGrantRequestListCalled, "SubscribePresenceGrantRequestListL was not called", ETrue, NULL );
+
+        CleanupStack::PopAndDestroy( listener2 );
+        }
+
+    for( a = 0; a < countOfWrappers; ++a )
+        {
+        CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a );
+        MXIMPContext* context = wrapper->GetContext();
+        CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+        
+        // Get the interfaces
+        MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+        MPresenceAuthorization& presAuth = presFeat->PresenceAuthorization();
+
+        CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context );
+        CleanupStack::PushL( listener2 );
+
+        // Tell the protocol it should act normally
+        messenger->SetNoError();
+
+        // expect normal request complete
+        TXIMPRequestId reqIdDummy;  // not checked
+        CXIMPRequestCompleteEventImp* evReqComplete =
+                            CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+        listener2->ExpectL( evReqComplete );
+        CleanupStack::Pop( evReqComplete );
+
+        // unsubscribe
+        TXIMPRequestId reqId = presAuth.UnsubscribePresenceGrantRequestListL();
+
+        EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Unsubscribe failed" );
+
+        // verify that EXIMPPlgTestUnsubscribeGroupListCalled was called
+        COMMONASSERT( messenger, EXIMPPlgTestUnsubscribeGroupListCalled,
+                "UnsubscribePresenceGrantRequestListL was not called",
+                EFalse,
+                "UnsubscribePresenceGrantRequestListL was called" );
+
+        CleanupStack::PopAndDestroy( listener2 );
+        }
+
+    UnbindAllL();
+    }
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+void T_PresenceGrantRequestManagement::SubscribeL()
+    {
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    MXIMPContext* context = wrapper->GetContext();
+    CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+    // Get the interfaces
+    MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+    MPresenceAuthorization& presAuth = presFeat->PresenceAuthorization();
+
+    CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context );
+    CleanupStack::PushL( listener2 );
+
+    // ------------------------------------------------------
+    // expect normal request complete
+    TXIMPRequestId reqIdDummy;  // not checked
+    CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+    listener2->ExpectL( evReqComplete );
+    CleanupStack::Pop( evReqComplete );
+    // ------------------------------------------------------
+
+    // subscribe
+    TXIMPRequestId reqId = presAuth.SubscribePresenceGrantRequestListL();
+    EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Subscribe failed" );
+
+    COMMONASSERT( messenger, EXIMPPlgTestSubscribePresenceGrantRequestListCalled, "SubscribeGrantRequestListL was not called", ETrue, NULL );
+
+    CleanupStack::PopAndDestroy( listener2 );
+    }
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+void T_PresenceGrantRequestManagement::UnsubscribeL()
+    {
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    MXIMPContext* context = wrapper->GetContext();
+    CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+    // Get the interfaces
+    MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+    MPresenceAuthorization& presAuth = presFeat->PresenceAuthorization();
+
+    CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context );
+    CleanupStack::PushL( listener2 );
+
+    // ------------------------------------------------------
+    // expect normal request complete
+    TXIMPRequestId reqIdDummy;  // not checked
+    CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+    listener2->ExpectL( evReqComplete );
+    CleanupStack::Pop( evReqComplete );
+    // ------------------------------------------------------
+
+    // unsubscribe
+    TXIMPRequestId reqId = presAuth.UnsubscribePresenceGrantRequestListL();
+    EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Unsubscribe failed" );
+
+    COMMONASSERT( messenger, EXIMPPlgTestUnsubscribePresenceGrantRequestListCalled, "UnsubscribeGrantRequestListL was not called", ETrue, NULL );
+
+    CleanupStack::PopAndDestroy( listener2 );
+    }
+
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+void T_PresenceGrantRequestManagement::T_HandlePresenceGrantRequestList_L()
+    {
+    EUNIT_PRINT( _L("Handle presence grant request list.") );
+
+    // log in and subscribe a group list
+    BindL();
+    SubscribeL();
+
+    // ------------------------------------------------------
+    // some startup stuff
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    MXIMPContext* context = wrapper->GetContext();
+
+    CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context );
+    CleanupStack::PushL( listener2 );
+    // ------------------------------------------------------
+
+    // Tell the protocol it should act normally
+    wrapper->GetMessenger()->SetNoError();
+
+    // ------------------------------------------------------
+    // 1. Create faked server message about grant req list (empty)
+    SendSrvMsgL( CXIMPTestFileSrvMsg::ETestSrvMsgPresenceGrantRequestList );
+
+    // ------------------------------------------------------
+    // expect empty MPresentityGroupList event.
+
+    RPrGrntReqInfoImpArray* pendingList(NULL);
+    CPresenceGrantRequestListEventImp* event = CreateGrantRequestListEventLCX(
+            KNullDesC, KNullDesC,
+            MXIMPDataSubscriptionState::ESubscriptionActive,
+            MXIMPDataSubscriptionState::EDataAvailable,
+            ETestPGRPending, pendingList );
+
+    listener2->ExpectL( event );
+    CleanupStack::Pop( event ); // 3 more items in cleanupstack
+
+    EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "HandlePresenceGrantRequestListL failed" );
+    CleanupStack::PopAndDestroy( 3 ); // lists
+    // ------------------------------------------------------
+
+
+    _LIT16( KGrantReqUri,      "http://carpe.diem.com" );
+    _LIT16( KGrantReqDispName, "DispnameA, LoremI" );
+
+    // ------------------------------------------------------
+    // 2. Create faked server message about grant req list (new)
+    listener2->Reset();
+
+    pendingList = NULL; // previous one was destroyed
+    event = CreateGrantRequestListEventLCX( KGrantReqUri,
+                                            KGrantReqDispName,
+                                            MXIMPDataSubscriptionState::ESubscriptionActive,
+                                            MXIMPDataSubscriptionState::EDataAvailable,
+                                            ETestPGRNewReq, pendingList  );
+
+    SendSrvMsgL( KGrantReqUri,
+                     KGrantReqDispName,
+                     CXIMPTestFileSrvMsg::ETestSrvMsgPresenceGrantRequestList );
+
+    listener2->ExpectL( event );
+    CleanupStack::Pop( event ); // 3 more items in cleanupstack
+
+    // Waqas: Fixed Ticket #18
+    EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "HandlePresenceGrantRequestListL failed" );
+    
+    CleanupStack::PopAndDestroy( 3 ); // lists
+    // ------------------------------------------------------
+
+
+    CleanupStack::PopAndDestroy( listener2 );
+
+    // clean it up
+    UnsubscribeL();
+    UnbindL();
+    }
+
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+_LIT16(  KPresentUri1,      "http://lorem.ipsum.com" );
+_LIT16(  KPresentUri2,      "http://carpe.diem.com" );
+_LIT16( KPresentDispName1, "DispnameA, LoremI" );
+_LIT16( KPresentDispName2, "DispnameB, CarpeD" );
+_LIT16( KPresentProtAddr1, "ABC" );
+_LIT16( KPresentProtAddr2, "HIJ" );
+
+void T_PresenceGrantRequestManagement::T_HandlePresenceGrantRequestReceivedObsoleted_L()
+    {
+    EUNIT_PRINT( _L("Handle presence grant request received") );
+
+    BindL();
+    SubscribeL();
+
+    // ------------------------------------------------------
+    // some startup stuff
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    MXIMPContext* context = wrapper->GetContext();
+
+    CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context );
+    CleanupStack::PushL( listener2 );
+    // ------------------------------------------------------
+
+    // Tell the protocol it should act normally
+    wrapper->GetMessenger()->SetNoError();
+
+    // ------------------------------------------------------
+    // 1. Create faked server message about grant req received
+    SendSrvMsgInfoL( KPresentUri1,
+                     KPresentDispName1,
+                     CXIMPTestFileSrvMsg::ETestSrvMsgPresenceGrantRequestReceived );
+
+    // ------------------------------------------------------
+    // expect MPresenceGrantRequestList event.
+
+    CPresenceGrantRequestListEventImp* event = CreateGrantRequestListEventLCX(
+            KPresentUri1, KPresentDispName1,
+            MXIMPDataSubscriptionState::ESubscriptionActive,
+            MXIMPDataSubscriptionState::EDataAvailable,
+            ETestPGRNewReq, NULL );
+
+    listener2->ExpectL( event );
+    CleanupStack::Pop( event ); // 3 more items in cleanupstack
+
+    // Waqas: Fixed Ticket #18
+    EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "HandlePresenceGrantRequesReceivedL failed" );
+
+
+    CleanupStack::PopAndDestroy( 3 ); // lists
+    // ------------------------------------------------------
+
+
+    // ------------------------------------------------------
+    // 2. Create faked server message about grant req obsoleted
+    listener2->Reset();
+
+    SendSrvMsgInfoL( KPresentUri1,
+                     KPresentDispName1,
+                     CXIMPTestFileSrvMsg::ETestSrvMsgPresenceGrantRequestObsoleted );
+
+                     
+    // we need to create pending list to give to the event
+    RPrGrntReqInfoImpArray* pendingList = new ( ELeave ) RPrGrntReqInfoImpArray;
+    CleanupDeletePushL( pendingList );
+            // create the group info
+    CXIMPIdentityImp* idForEvent = CXIMPIdentityImp::NewLC( KPresentUri1 );
+    CPresenceGrantRequestInfoImp* grantInfoForEvent = 
+                            CPresenceGrantRequestInfoImp::NewLC( *idForEvent, KPresentDispName1 );
+    pendingList->AppendL( grantInfoForEvent );
+    CleanupStack::Pop( grantInfoForEvent );
+    CleanupStack::PopAndDestroy( idForEvent );
+    CleanupStack::Pop( pendingList );
+    
+    //Now create the event
+    event = CreateGrantRequestListEventLCX(
+            KPresentUri1, KPresentDispName1,
+            MXIMPDataSubscriptionState::ESubscriptionActive,
+            MXIMPDataSubscriptionState::EDataAvailable,
+            ETestPGRObsoleted, pendingList );
+
+    listener2->ExpectL( event );
+    CleanupStack::Pop( event ); // 3 more items in cleanupstack
+
+    // Waqas: Fixed Ticket #18
+    EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "HandlePresenceGrantRequesObsoletedL failed" );
+
+    CleanupStack::PopAndDestroy( 3 ); // lists
+    // ------------------------------------------------------
+
+    CleanupStack::PopAndDestroy( listener2 );
+
+    // clean it up
+    UnsubscribeL();
+    UnbindL();
+    }
+
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+// send a faked server-originated message with grant request list made
+// from the given uri and displayname
+//
+void T_PresenceGrantRequestManagement::SendSrvMsgL(
+        const TDesC& aUri, const TDesC& aDispName,
+        TInt aMsgType )
+    {
+    // we'll use hard-coded wrapper 0 instance for now.
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+
+    // create a grant req info contained within the server-originated
+    // faked message
+    RXIMPObjOwningPtrArray<CPresenceGrantRequestInfoImp> grantList;
+    CleanupClosePushL( grantList );
+
+    CXIMPIdentityImp* grantId = CXIMPIdentityImp::NewLC( aUri );
+    CPresenceGrantRequestInfoImp* grantItem =
+                CPresenceGrantRequestInfoImp::NewLC( *grantId, aDispName );
+    grantList.AppendL( grantItem );
+    CleanupStack::Pop( grantItem );
+    CleanupStack::PopAndDestroy( grantId );
+
+    HBufC8* packedArray =
+        TXIMPObjectPacker<CPresenceGrantRequestInfoImp>::PackArrayL( grantList );
+    CleanupStack::PushL( packedArray );
+
+    // use filetool to send it for plugin.
+    CXIMPTestFileSrvMsg* srvMsg = CXIMPTestFileSrvMsg::NewL( aMsgType,
+            *packedArray );
+    CleanupStack::PushL( srvMsg );
+    wrapper->FileTool().CleanAllL();
+    wrapper->FileTool().SrvMsgStoreL( srvMsg );
+    CleanupStack::PopAndDestroy( 3 ); // srvMsg, packedArray, grantList
+    }
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+// send a faked server-originated message with grant request info made
+// from the given uri and displayname
+//
+void T_PresenceGrantRequestManagement::SendSrvMsgInfoL(
+        const TDesC& aUri, const TDesC& aDispName,
+        TInt aMsgType )
+    {
+    // we'll use hard-coded wrapper 0 instance for now.
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+
+    CXIMPIdentityImp* grantId = CXIMPIdentityImp::NewLC( aUri );
+    CPresenceGrantRequestInfoImp* grantItem =
+                CPresenceGrantRequestInfoImp::NewLC( *grantId, aDispName );
+
+    HBufC8* packedInfo =
+        TXIMPObjectPacker<CPresenceGrantRequestInfoImp>::PackL( *grantItem );
+    CleanupStack::PushL( packedInfo );
+
+    // use filetool to send it for plugin.
+    CXIMPTestFileSrvMsg* srvMsg = CXIMPTestFileSrvMsg::NewL( aMsgType,
+            *packedInfo );
+    CleanupStack::PushL( srvMsg );
+    wrapper->FileTool().CleanAllL();
+    wrapper->FileTool().SrvMsgStoreL( srvMsg );
+    CleanupStack::PopAndDestroy( 4 ); // srvMsg, packedItem, grantItem, grantId
+    }
+
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+// send a faked server-originated message with empty contents
+//
+void T_PresenceGrantRequestManagement::SendSrvMsgL( TInt aMsgType )
+    {
+    // we'll use hard-coded wrapper 0 instance for now.
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+
+    // create a server-originated faked message with empty contents
+    RXIMPObjOwningPtrArray<CPresenceGrantRequestInfoImp> grantList;
+
+    HBufC8* packedArray = TXIMPObjectPacker<CPresenceGrantRequestInfoImp>::PackArrayL( grantList );
+    CleanupStack::PushL( packedArray );
+
+    // use filetool to send it for plugin.
+    CXIMPTestFileSrvMsg* srvMsg = CXIMPTestFileSrvMsg::NewL( aMsgType,
+            *packedArray );
+    CleanupStack::PushL( srvMsg );
+    wrapper->FileTool().CleanAllL();
+    wrapper->FileTool().SrvMsgStoreL( srvMsg );
+    CleanupStack::PopAndDestroy( 2 ); // srvMsg, packedArray
+    }
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+// create a grant request list event with given arrays
+//
+CPresenceGrantRequestListEventImp*
+    T_PresenceGrantRequestManagement::CreateGrantRequestListEventLCX(
+        const TDesC& aUri,
+        const TDesC& aDispName,
+        MXIMPDataSubscriptionState::TSubscriptionState aSubscriptionState,
+        MXIMPDataSubscriptionState::TDataState aDataState,
+        TTestPGROperation aOperation,
+        RPrGrntReqInfoImpArray* aPendingList
+        )
+    {
+    // create the arrays
+
+
+    // new list
+    RPrGrntReqInfoImpArray* newList = new ( ELeave ) RPrGrntReqInfoImpArray;
+    CleanupDeletePushL( newList );
+
+    // pending list
+    if(!aPendingList) // if client didnt created the list
+        aPendingList = new ( ELeave ) RPrGrntReqInfoImpArray;
+    CleanupDeletePushL( aPendingList );
+
+    // obsoleted list
+    RPrGrntReqInfoImpArray* obsoletedList = new ( ELeave ) RPrGrntReqInfoImpArray;
+    CleanupDeletePushL( obsoletedList );
+
+	// create subscription state
+	CXIMPDataSubscriptionStateImp* subsState = CXIMPDataSubscriptionStateImp::NewLC();
+
+    // create the group info
+    CPresenceGrantRequestInfoImp* grantInfoForEvent1 = NULL;
+            {
+            CXIMPIdentityImp* idForEvent = CXIMPIdentityImp::NewLC( aUri );
+            grantInfoForEvent1 = CPresenceGrantRequestInfoImp::NewLC( *idForEvent, aDispName );
+            CleanupStack::Pop( grantInfoForEvent1 );        
+            CleanupStack::PopAndDestroy( idForEvent ); 
+            CleanupStack::PushL( grantInfoForEvent1 );        
+            }
+    
+    CPresenceGrantRequestInfoImp* grantInfoForEvent2 = 
+            TXIMPObjectCloner< CPresenceGrantRequestInfoImp >::CloneLC( *grantInfoForEvent1 );
+    
+    TInt count(0);
+    TBool found(EFalse);
+    TInt i(0);
+   
+
+    // put the given grant info into the specified array
+    switch ( aOperation )
+        {
+        case ETestPGRNewReq:
+            {
+            newList->AppendL( grantInfoForEvent2 );
+            CleanupStack::Pop( grantInfoForEvent2 );
+            
+            aPendingList->AppendL( grantInfoForEvent1 );
+            CleanupStack::Pop( grantInfoForEvent1 );
+            
+            break;
+            }
+        case ETestPGRPending:
+            {
+            // don't add, thus return what user has given
+            CleanupStack::PopAndDestroy( grantInfoForEvent2 ); // grantInfoForEvent2
+            CleanupStack::PopAndDestroy( grantInfoForEvent1 ); // grantInfoForEvent1
+            break;
+            }
+
+        case ETestPGRObsoleted:
+            {
+            // search the given id in pending list
+            count = aPendingList->Count();
+            for(i=0;i<count;i++)
+                {
+                // if dispname and id are same
+                if (( ((((*aPendingList)[i])->RequestorId()).Identity()) == aUri )
+                    && ( (((*aPendingList)[i])->RequestorDisplayName()) == aDispName ))
+                    {
+                    found = ETrue;
+            break;
+            }
+                }
+            if(found) // do we need to leave if error? Waqas
+            {
+                delete (*aPendingList)[i];
+                aPendingList->Remove(i);
+                obsoletedList->AppendL( grantInfoForEvent2 );
+                CleanupStack::Pop( grantInfoForEvent2 );
+                }
+            else
+                CleanupStack::PopAndDestroy( grantInfoForEvent2 );
+            
+            CleanupStack::PopAndDestroy( grantInfoForEvent1 );
+            break;
+            }
+
+        default:
+            {
+            User::Leave( KErrArgument );
+            break;
+            }
+        };
+
+	subsState->SetSubscriptionStateL(aSubscriptionState);
+    subsState->SetDataStateL(aDataState);
+
+    // create the actual event
+    CPresenceGrantRequestListEventImp* tmp =
+        CPresenceGrantRequestListEventImp::NewLC(
+                newList,
+                aPendingList,
+                obsoletedList,
+                subsState );
+
+    // subState is owned by the event, we need to pop it out from the stack
+    CleanupStack::Pop( tmp );        
+    CleanupStack::Pop( subsState ); 
+    CleanupStack::PushL( tmp );        
+
+    /*
+     * In cleanupstack there are 4 items, FIFO:
+     *   - new list
+     *   - pending list
+     *   - obsoleted list
+     *   - event imp
+     */
+
+    return tmp;
+    }
+
+// ===========================================================================
+// TEST CASE TABLE
+// ===========================================================================
+//
+EUNIT_BEGIN_TEST_TABLE(
+        T_PresenceGrantRequestManagement,
+        "XIMP presence grant request management tests",
+        "MODULE" )
+
+PRFW_DECORATED_TEST(
+        "Grant request list subscription, single client",
+        "",
+        "",
+        "FUNCTIONALITY",
+        Setup_L,
+        T_SubscribeGrantRequestList_Single_L,
+        Teardown )
+
+PRFW_DECORATED_TEST(
+        "Grant request list subscription, multiple clients",
+        "",
+        "",
+        "FUNCTIONALITY",
+        SetupMultiple_L,
+        T_SubscribeGrantRequestList_Multiple_L,
+        Teardown )
+
+PRFW_DECORATED_TEST(
+        "Handle presence grant request List",
+        "",
+        "",
+        "FUNCTIONALITY",
+        Setup_L,
+        T_HandlePresenceGrantRequestList_L,
+        Teardown )
+
+PRFW_DECORATED_TEST(
+        "Handle presence grant request received and obsoleted",
+        "",
+        "",
+        "FUNCTIONALITY",
+        Setup_L,
+        T_HandlePresenceGrantRequestReceivedObsoleted_L,
+        Teardown )
+
+
+/*
+PRFW_DECORATED_TEST(
+        "New and obsolete request.",
+        "",
+        "",
+        "FUNCTIONALITY",
+        Setup_L,
+        T_HandlePresentityGroupCreateAndDelete_L,
+        Teardown )
+*/
+
+EUNIT_END_TEST_TABLE
+
+
+// ===========================================================================
+// TEST SUITE CONSTRUCTION
+// ===========================================================================
+//
+EXPORT_C MEUnitTest* CreateTestSuiteL()
+    {
+    return T_PresenceGrantRequestManagement::NewL();
+    }
+
+
+// end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/tsrc/src/t_presencegrantrequestmngt/t_presencegrantrequestmngt.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,172 @@
+/*
+* 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: XIMP Framework Test Code 
+*
+*/
+
+#ifndef T_PRESENCEGRANTREQUESTMANAGEMENT_H
+#define T_PRESENCEGRANTREQUESTMANAGEMENT_H
+
+
+//  EXTERNAL INCLUDES
+#include <platform/digia/eunit/ceunittestsuiteclass.h>
+#include <platform/digia/eunit/EUnitDecorators.h>
+
+#include <ximpbase.h>
+#include "prfwteststatuseventlistener.h"
+#include "prfwtestmessaging.h"
+#include "ximpdatasubscriptionstateimp.h"
+#include "presencetypehelpers.h"
+
+class CXIMPTestContextWrapper;
+class CXIMPTestContextWrapperMgr;
+class CXIMPTestMessenger;
+class CPresenceGrantRequestInfoImp;
+class CPresenceGrantRequestListEventImp;
+
+/**
+ * XIMP Framework Eunit tests.
+ *
+ * Tests for XIMP session management services.
+ *
+ * @since S60 v4.0
+ */
+class T_PresenceGrantRequestManagement : public CEUnitTestSuiteClass
+    {
+
+public:
+    static T_PresenceGrantRequestManagement* NewL();
+    virtual ~T_PresenceGrantRequestManagement();
+
+
+private:
+    T_PresenceGrantRequestManagement();
+    void ConstructL();
+
+private:    // Test case functions
+
+    void Setup_L();
+    void SetupMultiple_L();
+    void BindL();
+    void BindAllL();
+    void Teardown();
+    void UnbindL();
+    void UnbindAllL();
+    void SubscribeL();
+    void UnsubscribeL();
+
+    void T_SubscribeGrantRequestList_Single_L();
+    void T_SubscribeGrantRequestListRefresh_Single_L();
+    void T_SubscribeGrantRequestList_Multiple_L();
+    void T_HandlePresenceGrantRequestList_L();
+    void T_HandlePresenceGrantRequestReceivedObsoleted_L();
+
+private:    // Test helpers
+
+    /**
+     * Fake a server-originated (=mobile terminated) message.
+     * The message appears to adaptation and framework as if
+     * it came from the network. Uses only one group.
+     * @param aUri The URI of group
+     * @param aDispName The display name for the group
+     * @param aMsgType The message type for CXIMPTestFileSrvMsg
+     */
+    void SendSrvMsgL(
+            const TDesC& aUri, const TDesC& aDispName,
+            TInt aMsgType );
+
+    // version for sending just the info instead of array
+    void SendSrvMsgInfoL(
+            const TDesC& aUri, const TDesC& aDispName,
+            TInt aMsgType );
+    /**
+     * Fake a server-originated message with empty content.
+     * Whether to use this depends on the event you expect.
+     * @see SendSrvMsgL
+     */
+    void SendSrvMsgL( TInt aMsgType );
+
+    // @see below
+    /*
+    enum TTestPGRArraySpecifier //Waqas: Not used anymore, use the next one
+        {
+        ETestPGRNewList = 0,    // grant request list
+        ETestPGRNewReq,         // new grant request
+        ETestPGRPending,         // new grant request
+        ETestPGRObsoleted,      // obsoleted grant request
+        ETestPGREmpty,          // make an empty array for empty event
+        };*/
+        
+    enum TTestPGROperation
+        {
+        ETestPGRNewReq = 0,     // new grant request i.e. new req comes
+        ETestPGRPending,        // new grant request i.e. subscribe to
+        ETestPGRObsoleted      // obsoleted grant request i.e. req expired                        
+        };
+
+    /**
+     * Creates an event for newRequest, pending, or obselete presence grant
+     * request list. The caller provides an identity and current presence grant
+     * request listand depending on the provided operation an event is created. 
+     *
+     * In cleanupstack there are 4 items, FIFO:
+     *   - new list
+     *   - pending list
+     *   - obsoleted list
+     *   - event imp
+     *
+     * This is because this event won't take ownership to the arrays
+     * when created this way.
+     *
+     * @param aUri Uri
+     * @param aDispName Displayname
+     * @param aOperation operation for which caller wants to generates event
+     * @param aPendingList Current pending list provided by caller, method takes
+     *         ownership of the pending list, and it is included in above 3 lists.
+     *         a NULL pointer with operation ETestPGRPending causes empty event.
+     * @return The suitably filled event.
+     */
+    CPresenceGrantRequestListEventImp* CreateGrantRequestListEventLCX(
+            const TDesC& aUri,
+            const TDesC& aDispName,
+            MXIMPDataSubscriptionState::TSubscriptionState aSubscriptionState,
+            MXIMPDataSubscriptionState::TDataState aDataState,
+            TTestPGROperation aOperation,
+            RPrGrntReqInfoImpArray* aPendingList = NULL
+            );
+
+private: // Test data
+
+    /**
+     * Eunit test case table declaration.
+     */
+    EUNIT_DECLARE_TEST_TABLE;
+
+    // owned
+    CXIMPTestContextWrapperMgr* iWrapperMgr;
+
+    //
+    TInt iLastError;
+    RXIMPObjOwningPtrArray< CPresenceGrantRequestInfoImp > iValidateArray;
+    };
+
+
+#endif      //  T_PRESENCEGRANTREQUESTMANAGEMENT_H
+
+
+
+// end of file
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/tsrc/src/t_presencegrantrequestmngt/t_presencegrantrequestmngt.mmp	Wed Nov 03 09:32:20 2010 +0530
@@ -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: XIMP Framework Test Code 
+*
+*/
+
+#include            "../../tsrcutils/eunitcommon/eunittstdllbase.hrh"
+#include            "../../tsrcutils/processmaster/pm.h"
+
+#include<platform_paths.hrh>
+#include<eunitcaps.h>
+TARGET              t_presencegrantrequestmngt.dll
+//CAPABILITY              ALL - TCB - DRM
+CAPABILITY      EUNIT_CAPS
+
+SOURCEPATH          .
+SOURCE              t_presencegrantrequestmngt.cpp
+
+
+USERINCLUDE             ../../../core/srcdatamodel
+USERINCLUDE             ../../../presence/srcpresencedatamodel
+USERINCLUDE             ../../../presence/srcpresencedatamodel/presentitygroups
+USERINCLUDE             ../../../presence/srcpresencedatamodel/presencewatching
+USERINCLUDE             ../../../presence/srcpresencedatamodel/presenceauthorization
+USERINCLUDE             ../../../presence/srcpresencedatamodel/presencepublishing
+USERINCLUDE             ../../../presence/srcpresencedatamodel/presenceinfo
+USERINCLUDE             ../../../core/srcutils
+
+// TODO remove unnecessary
+#if defined ( OS_LAYER_SYSTEMINCLUDE )
+OS_LAYER_SYSTEMINCLUDE
+#else
+SYSTEMINCLUDE     /epoc32/include
+#endif
+
+ #if defined ( APP_LAYER_SYSTEMINCLUDE )
+ APP_LAYER_SYSTEMINCLUDE
+ #else
+ SYSTEMINCLUDE     \epoc32\include
+ #endif
+ 
+ 
+SYSTEMINCLUDE           ../../../inc/core/base
+SYSTEMINCLUDE           ../../../inc/core/datamodel
+SYSTEMINCLUDE           ../../../inc/core/protocolplugin
+SYSTEMINCLUDE           ../../../inc/core/protocolpluginhost
+SYSTEMINCLUDE           ../../../inc/presence/presencedatamodel
+SYSTEMINCLUDE           ../../../inc/presence/presencemanagement
+SYSTEMINCLUDE           ../../../inc/presence/presenceprotocolplugin
+SYSTEMINCLUDE           ../../../inc/presence/presenceprotocolpluginhost
+
+LIBRARY             ecom.lib
+LIBRARY             bafl.lib
+LIBRARY             ximpdatamodel.lib
+LIBRARY             presencedatamodel.lib
+LIBRARY             estor.lib
+LIBRARY             ximputils.lib
+LIBRARY             eunit.lib
+LIBRARY             eunitutil.lib
+LIBRARY             euser.lib
+
+
+// end of file
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/tsrc/src/t_presencegrouplistmngt/bld.inf	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,23 @@
+/*
+* 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 t_presencegrouplistmngt.dll
+*
+*/
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_TESTMMPFILES
+t_presencegrouplistmngt.mmp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/tsrc/src/t_presencegrouplistmngt/t_presencegrouplistmngt.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,1451 @@
+/*
+* 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: XIMP Framework Test Code 
+*
+*/
+
+
+#include "eunittools.h"
+
+
+
+#include <platform/digia/eunit/eunitmacros.h>
+#include <platform/digia/eunit/teunitassertioninfo.h>
+
+#include <ecom/ecom.h>
+#include <badesca.h>
+
+#include <ximpbase.h>
+#include <ximpclient.h>
+#include <ximpcontext.h>
+#include <presencefeatures.h>
+#include <presentitygroups.h>
+#include <presentitygroupinfo.h>
+#include <presentitygrouplistevent.h>
+#include <ximpobjectfactory.h>
+
+#include "ximpstatusimp.h"
+#include "ximprequestcompleteeventimp.h"
+#include "t_presencegrouplistmngt.h"
+#include "prfwteststatuseventlistener.h"
+#include "prfwtestmessaging.h"
+#include "prfwtestmessenger.h"
+#include "prfwtestcontextwrappermgr.h"
+#include "prfwtestcontextwrapper.h"
+#include "prfwtesteventfactory.h"
+
+#include "presenceinfoimp.h"
+#include "presenceinfofilterimp.h"
+#include "prfwtestpresencedatautils.h"
+#include "ximpidentityimp.h"
+#include "ximpobjecthelpers.h"
+#include "presentitygroupinfoimp.h"
+#include "presentitygrouplisteventimp.h"
+#include "presentitygroupcontenteventimp.h"
+#include "prfwtestfilesrvmsg.h"
+#include "prfwtestfiletool.h"
+#include "prfwtestlistener.h"
+
+#include "prfwtestrobustnesstools.h"
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// CONSTRUCTION
+T_PresenceGroupListManagement* T_PresenceGroupListManagement::NewL()
+    {
+    T_PresenceGroupListManagement* self = new( ELeave ) T_PresenceGroupListManagement;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+
+    return self;
+    }
+
+
+T_PresenceGroupListManagement::~T_PresenceGroupListManagement()
+    {
+    PrfwTestRobustness::DoPreCleaning();
+    }
+
+
+void T_PresenceGroupListManagement::ConstructL()
+    {
+    CEUnitTestSuiteClass::ConstructL();
+    }
+
+
+T_PresenceGroupListManagement::T_PresenceGroupListManagement()
+    {
+    }
+
+
+
+// ===========================================================================
+// TEST CASE SETUP & TEARDOWN METHODS
+// ===========================================================================
+//
+
+void T_PresenceGroupListManagement::Setup_L()
+    {
+    PrfwTestRobustness::DoPreCleaning();
+
+    iWrapperMgr = CXIMPTestContextWrapperMgr::NewL();
+    iWrapperMgr->CreateWrapperL();
+    }
+
+void T_PresenceGroupListManagement::SetupMultiple_L()
+    {
+    PrfwTestRobustness::DoPreCleaning();
+
+
+    iWrapperMgr = CXIMPTestContextWrapperMgr::NewL();
+    iWrapperMgr->CreateWrapperL();
+    iWrapperMgr->CreateWrapperL();
+    iWrapperMgr->CreateWrapperL();
+    }
+
+
+void T_PresenceGroupListManagement::BindL()
+    {
+    CXIMPTestContextWrapper* wrapper0 = iWrapperMgr->GetWrapperL( 0 );
+
+    wrapper0->BindL( 0 );
+    }
+
+void T_PresenceGroupListManagement::BindAllL()
+    {
+    for( TInt a = 0; a < iWrapperMgr->WrapperCount(); ++a )
+        {
+        CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a );
+        wrapper->BindL( 0 );
+        }
+    }
+
+
+void T_PresenceGroupListManagement::Teardown()
+    {
+    delete iWrapperMgr;
+    iWrapperMgr = NULL;
+
+    REComSession::FinalClose();
+
+    PrfwTestRobustness::DoPreCleaning();
+    }
+
+void T_PresenceGroupListManagement::UnbindL()
+    {
+    // Do unbind
+    CXIMPTestContextWrapper* wrapper0 = iWrapperMgr->GetWrapperL( 0 );
+    wrapper0->UnbindL();
+    }
+
+void T_PresenceGroupListManagement::UnbindAllL()
+    {
+    for( TInt a = 0; a < iWrapperMgr->WrapperCount(); ++a )
+        {
+        CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a );
+        wrapper->UnbindL();
+        }
+    }
+
+
+// ===========================================================================
+// TEST CASES for presentity presence subscription
+// ===========================================================================
+
+
+// Single client, empty filter
+void T_PresenceGroupListManagement::T_SubscribePresentityGroup_Single_L()
+    {
+    EUNIT_PRINT( _L("Single presentity group list subscription") );
+
+    BindL();
+
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    MXIMPContext* context = wrapper->GetContext();
+    CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+    // Get the interfaces
+    MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+    MPresentityGroups& presGroup = presFeat->PresentityGroups();
+
+
+    CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context );
+    CleanupStack::PushL( listener2 );
+
+    // Tell the protocol it should act normally
+    messenger->SetNoError();
+
+    // ---------------------------------------------
+    // normal request complete
+    TXIMPRequestId reqIdDummy;  // not checked
+    CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+    listener2->ExpectL( evReqComplete );
+    CleanupStack::Pop( evReqComplete );
+
+    // subscribe
+    TXIMPRequestId reqId = presGroup.SubscribePresentityGroupListL();
+    EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Subscribe failed" );
+    messenger->AssertSubscribePresentityGroupListCalled( ETrue );
+
+    // ---------------------------------------------
+    evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+    listener2->ExpectL( evReqComplete );
+    CleanupStack::Pop( evReqComplete );
+
+
+
+    CPresentityGroupListEventImp* event = XIMPTestEventFactory::CreateGroupListEventLCX(
+            KNullDesC, KNullDesC,
+            XIMPTestEventFactory::ETestPGLEmpty,
+            KNullDesC, KNullDesC,
+            MXIMPDataSubscriptionState::ESubscriptionInactive,
+            MXIMPDataSubscriptionState::EDataUnavailable
+            );
+
+    listener2->ExpectL( event );
+    CleanupStack::Pop( event ); // 4 more items in cleanupstack
+
+    // unsubscribe
+    // ---------------------------------------------
+    reqId = presGroup.UnsubscribePresentityGroupListL();
+    EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Unsubscribe failed" );
+    CleanupStack::PopAndDestroy( 4 ); // group list event imp
+    messenger->AssertUnsubscribePresentityGroupListCalled( ETrue );
+
+    CleanupStack::PopAndDestroy( listener2 );
+
+    UnbindL();
+    }
+
+// Single client, empty filter, error in unsubscribe
+void T_PresenceGroupListManagement::T_UnsubscribePresentityGroup_Error_Single_L()
+    {
+    EUNIT_PRINT( _L("Single presentity group list unsubscribe with error") );
+
+    BindL();
+
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    MXIMPContext* context = wrapper->GetContext();
+    CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+    // Get the interfaces
+    MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+    MPresentityGroups& presGroup = presFeat->PresentityGroups();
+
+    CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context );
+    CleanupStack::PushL( listener2 );
+
+    // Tell the protocol it should act normally
+    messenger->SetNoError();
+
+    // ---------------------------------------------
+    // subscribe
+    TXIMPRequestId reqIdDummy;  // not checked
+    CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+    listener2->ExpectL( evReqComplete );
+    CleanupStack::Pop( evReqComplete );
+
+    TXIMPRequestId reqId = presGroup.SubscribePresentityGroupListL();
+    EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Subscribe failed" );
+    messenger->AssertSubscribePresentityGroupListCalled( ETrue );
+
+    // ---------------------------------------------
+    // unsubscribe
+    messenger->SetError( KErrArgument );
+    evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+    evReqComplete->CompletionResultImp().SetResultCode( KErrArgument );
+    listener2->ExpectL( evReqComplete );
+    CleanupStack::Pop( evReqComplete );
+
+    reqId = presGroup.UnsubscribePresentityGroupListL();
+    EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Unsubscribe failed" );
+    messenger->AssertUnsubscribePresentityGroupListCalled( ETrue );
+
+    CleanupStack::PopAndDestroy( listener2 );
+
+    UnbindL();
+    }
+
+// Single client, empty filter, error in sub
+void T_PresenceGroupListManagement::T_SubscribePresentityGroup_Error_Single_L()
+    {
+    EUNIT_PRINT( _L("Single presentity group list subscribe with error") );
+
+    BindL();
+
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    MXIMPContext* context = wrapper->GetContext();
+    CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+    // Get the interfaces
+    MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+    MPresentityGroups& presGroup = presFeat->PresentityGroups();
+
+    CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context );
+    CleanupStack::PushL( listener2 );
+
+    // Tell the protocol it should act normally
+    messenger->SetError( KErrArgument );
+
+    // ---------------------------------------------
+    // subscribe
+    TXIMPRequestId reqIdDummy;  // not checked
+    CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+    evReqComplete->CompletionResultImp().SetResultCode( KErrArgument );
+    listener2->ExpectL( evReqComplete );
+    CleanupStack::Pop( evReqComplete );
+
+    TXIMPRequestId reqId = presGroup.SubscribePresentityGroupListL();
+    EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Subscribe failed" );
+    messenger->AssertSubscribePresentityGroupListCalled( ETrue );
+
+    CleanupStack::PopAndDestroy( listener2 );
+
+    UnbindL();
+    }
+
+
+// multiple clients, all subscribe + unsubscribe
+void T_PresenceGroupListManagement::T_SubscribePresentityGroup_Multiple_L()
+    {
+    EUNIT_PRINT( _L("Multiple presentity group list subscription") );
+
+    BindAllL();
+
+    TInt countOfWrappers = iWrapperMgr->WrapperCount();
+    for( TInt a = 0; a < countOfWrappers; ++a )
+        {
+        CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a );
+        MXIMPContext* context = wrapper->GetContext();
+        CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+        // Get the interfaces
+        MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+        MPresentityGroups& presGroup = presFeat->PresentityGroups();
+
+        CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context );
+        CleanupStack::PushL( listener2 );
+
+        // Tell the protocol it should act normally
+        messenger->SetNoError();
+
+        // expect normal request complete
+        TXIMPRequestId reqIdDummy;  // not checked
+        CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+        listener2->ExpectL( evReqComplete );
+        CleanupStack::Pop( evReqComplete );
+
+        // subscribe
+        TXIMPRequestId reqId = presGroup.SubscribePresentityGroupListL();
+        EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Subscribe failed" );
+        messenger->AssertSubscribePresentityGroupListCalled( ETrue );
+
+        CleanupStack::PopAndDestroy( listener2 );
+        }
+
+    for( TInt a = 0; a < countOfWrappers; ++a )
+        {
+        CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a );
+        MXIMPContext* context = wrapper->GetContext();
+        CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+        // Get the interfaces
+        MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+        MPresentityGroups& presGroup = presFeat->PresentityGroups();
+
+        CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context );
+        CleanupStack::PushL( listener2 );
+
+        // Tell the protocol it should act normally
+        messenger->SetNoError();
+
+        // expect normal request complete
+        TXIMPRequestId reqIdDummy;  // not checked
+        CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+        listener2->ExpectL( evReqComplete );
+        CleanupStack::Pop( evReqComplete );
+
+        CPresentityGroupListEventImp* event = XIMPTestEventFactory::CreateGroupListEventLCX(
+                KNullDesC, KNullDesC,
+                XIMPTestEventFactory::ETestPGLEmpty,
+                KNullDesC, KNullDesC,
+                MXIMPDataSubscriptionState::ESubscriptionInactive,
+                MXIMPDataSubscriptionState::EDataUnavailable
+                );
+
+        listener2->ExpectL( event );
+        CleanupStack::Pop( event ); // 4 more items in cleanupstack
+
+        // unsubscribe
+        TXIMPRequestId reqId = presGroup.UnsubscribePresentityGroupListL();
+        EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Unsubscribe failed" );
+        CleanupStack::PopAndDestroy( 4 ); // group list event imp
+        messenger->AssertUnsubscribePresentityGroupListCalled( a == countOfWrappers-1 ? ETrue : EFalse );
+
+        CleanupStack::PopAndDestroy( listener2 );
+        }
+
+    UnbindAllL();
+    }
+
+// Multiple clients, all subscribe and refresh
+void T_PresenceGroupListManagement::T_RefreshPresentityGroup_Multiple_L()
+    {
+    EUNIT_PRINT( _L("Multiple presentity group list subscription refresh") );
+
+    BindAllL();
+
+    // SUBSCRIBE
+    TInt countOfWrappers = iWrapperMgr->WrapperCount();
+    for( TInt a = 0; a < countOfWrappers; ++a )
+        {
+        CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a );
+        MXIMPContext* context = wrapper->GetContext();
+        CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+        // Get the interfaces
+        MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+        MPresentityGroups& presGroup = presFeat->PresentityGroups();
+
+        CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context );
+        CleanupStack::PushL( listener2 );
+
+        // Tell the protocol it should act normally
+        messenger->SetNoError();
+
+        // expect normal request complete
+        TXIMPRequestId reqIdDummy;  // not checked
+        CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+        listener2->ExpectL( evReqComplete );
+        CleanupStack::Pop( evReqComplete );
+
+        // subscribe
+        TXIMPRequestId reqId = presGroup.SubscribePresentityGroupListL();
+        EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Subscribe failed" );
+        messenger->AssertSubscribePresentityGroupListCalled( ETrue );
+
+        CleanupStack::PopAndDestroy( listener2 );
+        }
+
+    // REFRESH
+    for( TInt a = 0; a < countOfWrappers; ++a )
+        {
+        CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a );
+        MXIMPContext* context = wrapper->GetContext();
+        CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+        // Get the interfaces
+        MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+        MPresentityGroups& presGroup = presFeat->PresentityGroups();
+
+        CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context );
+        CleanupStack::PushL( listener2 );
+
+        // Tell the protocol it should act normally
+        messenger->SetNoError();
+
+        // refresh subscription
+        TXIMPRequestId reqIdDummy;  // not checked
+        CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+        listener2->ExpectL( evReqComplete );
+        CleanupStack::Pop( evReqComplete );
+
+        CPresentityGroupListEventImp* event = XIMPTestEventFactory::CreateGroupListEventLCX(
+                KNullDesC, KNullDesC,
+                XIMPTestEventFactory::ETestPGLUpdated,
+                KNullDesC, KNullDesC,
+                MXIMPDataSubscriptionState::ESubscriptionActive,
+                MXIMPDataSubscriptionState::EDataUnavailable
+                );
+
+        listener2->ExpectL( event );
+        CleanupStack::Pop( event ); // 4 more items in cleanupstack
+
+        TXIMPRequestId reqId = presGroup.SubscribePresentityGroupListL();
+        EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Subscribe failed" );
+        CleanupStack::PopAndDestroy( 4 ); // group list event imp
+        messenger->AssertSubscribePresentityGroupListCalled( ETrue );
+
+        CleanupStack::PopAndDestroy( listener2 );
+        }
+
+    // unsubscribe all
+    for( TInt a = 0; a < countOfWrappers; ++a )
+        {
+        CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a );
+        MXIMPContext* context = wrapper->GetContext();
+        CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+        // Get the interfaces
+        MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+        MPresentityGroups& presGroup = presFeat->PresentityGroups();
+        
+        CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context );
+        CleanupStack::PushL( listener2 );
+
+        // Tell the protocol it should act normally
+        messenger->SetNoError();
+
+        // expect normal request complete
+        TXIMPRequestId reqIdDummy;  // not checked
+        CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+        listener2->ExpectL( evReqComplete );
+        CleanupStack::Pop( evReqComplete );
+
+        CPresentityGroupListEventImp* event = XIMPTestEventFactory::CreateGroupListEventLCX(
+                KNullDesC, KNullDesC,
+                XIMPTestEventFactory::ETestPGLEmpty,
+                KNullDesC, KNullDesC,
+                MXIMPDataSubscriptionState::ESubscriptionInactive,
+                MXIMPDataSubscriptionState::EDataUnavailable
+                );
+
+        listener2->ExpectL( event );
+        CleanupStack::Pop( event ); // 4 more items in cleanupstack
+
+        // unsubscribe
+        TXIMPRequestId reqId = presGroup.UnsubscribePresentityGroupListL();
+        EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Unsubscribe failed" );
+        CleanupStack::PopAndDestroy( 4 ); // group list event imp
+        messenger->AssertUnsubscribePresentityGroupListCalled( a == countOfWrappers-1 ? ETrue : EFalse );
+
+        CleanupStack::PopAndDestroy( listener2 );
+        }
+
+    UnbindAllL();
+    }
+
+
+// Multiple clients, all but one subscribe and all do unsubscribe
+void T_PresenceGroupListManagement::T_SubscribeAll_One_Unsub_Multiple_L()
+    {
+    EUNIT_PRINT( _L("Multiple, all but one subscribes and all unsubscribe") );
+
+    BindAllL();
+
+    // SUBSCRIBE
+    TInt countOfWrappers = iWrapperMgr->WrapperCount();
+    TInt skipIndex = 1;
+    for( TInt a = 0; a < countOfWrappers; ++a )
+        {
+        if ( skipIndex != a )
+            {
+            CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a );
+            MXIMPContext* context = wrapper->GetContext();
+            CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+            // Get the interfaces
+            MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+            MPresentityGroups& presGroup = presFeat->PresentityGroups();
+
+            CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context );
+            CleanupStack::PushL( listener2 );
+
+            // Tell the protocol it should act normally
+            messenger->SetNoError();
+
+            // expect normal request complete
+            TXIMPRequestId reqIdDummy;  // not checked
+            CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+            listener2->ExpectL( evReqComplete );
+            CleanupStack::Pop( evReqComplete );
+
+            // subscribe
+            TXIMPRequestId reqId = presGroup.SubscribePresentityGroupListL();
+            EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Subscribe failed" );
+            messenger->AssertSubscribePresentityGroupListCalled( ETrue );
+
+            CleanupStack::PopAndDestroy( listener2 );
+            }
+        }
+
+    // unsubscribe all
+    for( TInt a = 0; a < countOfWrappers; ++a )
+        {
+        CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a );
+        MXIMPContext* context = wrapper->GetContext();
+        CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+        // Get the interfaces
+        MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+        MPresentityGroups& presGroup = presFeat->PresentityGroups();
+
+        CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context );
+        CleanupStack::PushL( listener2 );
+
+        // Tell the protocol it should act normally
+        messenger->SetNoError();
+
+        // expect normal request complete
+        TXIMPRequestId reqIdDummy;  // not checked
+        CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+        listener2->ExpectL( evReqComplete );
+        CleanupStack::Pop( evReqComplete );
+
+        CPresentityGroupListEventImp* event = XIMPTestEventFactory::CreateGroupListEventLCX(
+                KNullDesC, KNullDesC,
+                XIMPTestEventFactory::ETestPGLEmpty,
+                KNullDesC, KNullDesC,
+                MXIMPDataSubscriptionState::ESubscriptionInactive,
+                MXIMPDataSubscriptionState::EDataUnavailable
+                );
+
+        listener2->ExpectL( event );
+        CleanupStack::Pop( event ); // 4 more items in cleanupstack
+
+        // unsubscribe
+        TXIMPRequestId reqId = presGroup.UnsubscribePresentityGroupListL();
+        EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Unsubscribe failed" );
+        CleanupStack::PopAndDestroy( 4 ); // group list event imp
+
+        messenger->AssertUnsubscribePresentityGroupListCalled( a == countOfWrappers-1 ? ETrue : EFalse );
+
+        CleanupStack::PopAndDestroy( listener2 );
+        }
+
+    UnbindAllL();
+    }
+
+// Multiple clients, refresh case for one
+void T_PresenceGroupListManagement::T_RefreshPresentityGroup_One_Multiple_L()
+    {
+    EUNIT_PRINT( _L("Multiple, one context does presentity group list refresh") );
+
+    BindAllL();
+
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    MXIMPContext* context = wrapper->GetContext();
+    CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+ 
+     // Get the interfaces
+    MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+    MPresentityGroups& presGroup = presFeat->PresentityGroups();
+    
+    CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context );
+    CleanupStack::PushL( listener2 );
+
+    // Tell the protocol it should act normally
+    messenger->SetNoError();
+
+    // ---------------------------------------------
+    // subscribe
+    TXIMPRequestId reqIdDummy;  // not checked
+    CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+    listener2->ExpectL( evReqComplete );
+    CleanupStack::Pop( evReqComplete );
+
+    TXIMPRequestId reqId = presGroup.SubscribePresentityGroupListL();
+    EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Subscribe failed" );
+    messenger->AssertSubscribePresentityGroupListCalled( ETrue );
+
+    // ---------------------------------------------
+    // refresh subscribe
+
+    messenger->SetValueFor(
+            EXIMPPlgTestSubscribeGroupListCalled,
+            EFalse );
+
+    evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+    listener2->ExpectL( evReqComplete );
+    CleanupStack::Pop( evReqComplete );
+
+    CPresentityGroupListEventImp* event = XIMPTestEventFactory::CreateGroupListEventLCX(
+            KNullDesC, KNullDesC,
+            XIMPTestEventFactory::ETestPGLUpdated,
+            KNullDesC, KNullDesC,
+            MXIMPDataSubscriptionState::ESubscriptionActive,
+            MXIMPDataSubscriptionState::EDataUnavailable
+            );
+
+    listener2->ExpectL( event );
+    CleanupStack::Pop( event ); // 4 more items in cleanupstack
+
+    reqId = presGroup.SubscribePresentityGroupListL();
+    EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Subscribe refresh failed" );
+    CleanupStack::PopAndDestroy( 4 ); // group list event imp
+    messenger->AssertSubscribePresentityGroupListCalled( EFalse );
+
+    // ---------------------------------------------
+    // unsubscribe
+    evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+    listener2->ExpectL( evReqComplete );
+    CleanupStack::Pop( evReqComplete );
+
+    event = XIMPTestEventFactory::CreateGroupListEventLCX(
+            KNullDesC, KNullDesC,
+            XIMPTestEventFactory::ETestPGLEmpty,
+            KNullDesC, KNullDesC,
+            MXIMPDataSubscriptionState::ESubscriptionInactive,
+            MXIMPDataSubscriptionState::EDataUnavailable
+            );
+
+    listener2->ExpectL( event );
+    CleanupStack::Pop( event ); // 4 more items in cleanupstack
+
+    reqId = presGroup.UnsubscribePresentityGroupListL();
+    EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Unsubscribe failed" );
+    CleanupStack::PopAndDestroy( 4 ); // group list event imp
+    messenger->AssertUnsubscribePresentityGroupListCalled( ETrue );
+
+    CleanupStack::PopAndDestroy( listener2 );
+
+    UnbindAllL();
+    }
+
+
+
+void T_PresenceGroupListManagement::SubscribeL()
+    {
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    MXIMPContext* context = wrapper->GetContext();
+    CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+    // Get the interfaces
+    MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+    MPresentityGroups& presGroup = presFeat->PresentityGroups();
+
+    CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context );
+    CleanupStack::PushL( listener2 );
+
+    // ------------------------------------------------------
+    // expect normal request complete
+    TXIMPRequestId reqIdDummy;  // not checked
+    CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+    listener2->ExpectL( evReqComplete );
+    CleanupStack::Pop( evReqComplete );
+    // ------------------------------------------------------
+
+    // subscribe
+    TXIMPRequestId reqId = presGroup.SubscribePresentityGroupListL();
+    EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Subscribe failed" );
+    messenger->AssertSubscribePresentityGroupListCalled( ETrue );
+
+    CleanupStack::PopAndDestroy( listener2 );
+    }
+
+
+
+void T_PresenceGroupListManagement::SubscribeGroupL( const TDesC& aGroupId )
+    {
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    MXIMPContext* context = wrapper->GetContext();
+    CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+    // Get the interfaces
+    MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+    MPresentityGroups& presGroup = presFeat->PresentityGroups();
+
+    CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context );
+    CleanupStack::PushL( listener2 );
+
+    // ------------------------------------------------------
+    // expect normal request complete
+    TXIMPRequestId reqIdDummy;  // not checked
+    CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+    listener2->ExpectL( evReqComplete );
+    CleanupStack::Pop( evReqComplete );
+    // ------------------------------------------------------
+
+    // subscribe group content
+    MXIMPIdentity* identity = context->ObjectFactory().NewIdentityLC();
+    identity->SetIdentityL( aGroupId );
+
+    TXIMPRequestId reqId = presGroup.SubscribePresentityGroupContentL( *identity );
+    EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Subscribe content failed" );
+
+    COMMONASSERT( messenger, EXIMPPlgTestSubscribePresentityGroupContentCalled, "SubscribeGroupContentL was not called", ETrue, NULL );
+
+    CleanupStack::PopAndDestroy(); // identity
+    CleanupStack::PopAndDestroy( listener2 );
+    }
+
+
+
+void T_PresenceGroupListManagement::UnsubscribeL()
+    {
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    MXIMPContext* context = wrapper->GetContext();
+    CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+    // Get the interfaces
+    MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+    MPresentityGroups& presGroup = presFeat->PresentityGroups();
+
+    CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context );
+    CleanupStack::PushL( listener2 );
+
+    // ------------------------------------------------------
+    // expect normal request complete
+    TXIMPRequestId reqIdDummy;  // not checked
+    CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+    listener2->ExpectL( evReqComplete );
+    CleanupStack::Pop( evReqComplete );
+
+    CPresentityGroupListEventImp* event = XIMPTestEventFactory::CreateGroupListEventLCX(
+            KNullDesC, KNullDesC,
+            XIMPTestEventFactory::ETestPGLEmpty,
+            KNullDesC, KNullDesC,
+            MXIMPDataSubscriptionState::ESubscriptionInactive,
+            MXIMPDataSubscriptionState::EDataUnavailable
+            );
+
+    listener2->ExpectL( event );
+    CleanupStack::Pop( event ); // 4 more items in cleanupstack
+
+    // unsubscribe
+    TXIMPRequestId reqId = presGroup.UnsubscribePresentityGroupListL();
+    EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Unsubscribe failed" );
+    CleanupStack::PopAndDestroy( 4 ); // group list event imp
+    messenger->AssertUnsubscribePresentityGroupListCalled( ETrue );
+
+    CleanupStack::PopAndDestroy( listener2 );
+    }
+
+
+void T_PresenceGroupListManagement::UnsubscribeGroupL( const TDesC& aGroupId )
+    {
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    MXIMPContext* context = wrapper->GetContext();
+    CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+    // Get the interfaces
+    MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+    MPresentityGroups& presGroup = presFeat->PresentityGroups();
+
+    CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context );
+    CleanupStack::PushL( listener2 );
+
+    // ------------------------------------------------------
+    // expect normal request complete
+    TXIMPRequestId reqIdDummy;  // not checked
+    CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+    listener2->ExpectL( evReqComplete );
+    CleanupStack::Pop( evReqComplete );
+
+    // and a group content event, IF we have subscribed the group beforehand
+    // i.e. SubscribeGroupL has been called before this
+
+    MXIMPIdentity* identity = context->ObjectFactory().NewIdentityLC();
+    identity->SetIdentityL( aGroupId );
+
+    CPresentityGroupContentEventImp* groupCntEvent =
+        XIMPTestEventFactory::CreateGroupContentEventLCX(
+                aGroupId,
+                KNullDesC,
+                KNullDesC,
+                XIMPTestEventFactory::ETestPGLCntRemoved,
+                KNullDesC,
+                KNullDesC,
+                MXIMPDataSubscriptionState::ESubscriptionInactive,
+                MXIMPDataSubscriptionState::EDataUnavailable
+                );
+
+    listener2->ExpectL( groupCntEvent );
+    CleanupStack::Pop( groupCntEvent );
+
+    // ------------------------------------------------------
+
+    // unsubscribe
+
+    TXIMPRequestId reqId = presGroup.UnsubscribePresentityGroupContentL( *identity );
+    EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Unsubscribe group content failed" );
+    messenger->AssertUnsubscribePresentityGroupContentCalled( ETrue );
+
+    CleanupStack::PopAndDestroy( 5 ); // rest of the group content event
+    CleanupStack::PopAndDestroy(); // identity
+
+    CleanupStack::PopAndDestroy( listener2 );
+    }
+
+
+
+// Single client, empty filter
+void T_PresenceGroupListManagement::T_HandlePresentityGroupList_L()
+    {
+    EUNIT_PRINT( _L("Handle presentity group list.") );
+
+    // log in and subscribe a group list
+    BindL();
+    SubscribeL();
+
+    // ------------------------------------------------------
+    // some startup stuff
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    MXIMPContext* context = wrapper->GetContext();
+
+    CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context );
+    CleanupStack::PushL( listener2 );
+    // ------------------------------------------------------
+
+    // Tell the protocol it should act normally
+    wrapper->GetMessenger()->SetNoError();
+
+    // ------------------------------------------------------
+    // 1. Create faked server message about group list
+    SendSrvMsgL( CXIMPTestFileSrvMsg::ETestSrvMsgPresentityGroupList );
+
+    // ------------------------------------------------------
+    // expect empty MPresentityGroupList event.
+
+    CPresentityGroupListEventImp* event = XIMPTestEventFactory::CreateGroupListEventLCX(
+            KNullDesC, KNullDesC,
+            XIMPTestEventFactory::ETestPGLEmpty,
+            KNullDesC, KNullDesC,
+            MXIMPDataSubscriptionState::ESubscriptionActive,
+            MXIMPDataSubscriptionState::EDataAvailable
+            );
+
+    listener2->ExpectL( event );
+    CleanupStack::Pop( event ); // 4 more items in cleanupstack
+
+    EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "HandlePresentityGroupListL failed" );
+    CleanupStack::PopAndDestroy( 4 ); // lists
+    // ------------------------------------------------------
+
+    CleanupStack::PopAndDestroy( listener2 );
+
+    // clean it up
+    UnsubscribeL();
+    UnbindL();
+    }
+
+
+
+_LIT16(  KPresentUri1,      "http://lorem.ipsum.com" );
+_LIT16(  KPresentUri2,      "http://carpe.diem.com" );
+_LIT16( KPresentDispName1, "DispnameA, LoremI" );
+_LIT16( KPresentDispName2, "DispnameB, CarpeD" );
+_LIT16( KPresentProtAddr1, "ABC" );
+_LIT16( KPresentProtAddr2, "HIJ" );
+
+void T_PresenceGroupListManagement::T_HandlePresentityGroupCreateAndDelete_L()
+    {
+    EUNIT_PRINT( _L("Handle presentity group creation and deletion.") );
+
+    // log in and subscribe a group list
+    BindL();
+    SubscribeL();
+
+    // ------------------------------------------------------
+    // some startup stuff
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    MXIMPContext* context = wrapper->GetContext();
+
+    CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context );
+    CleanupStack::PushL( listener2 );
+    // ------------------------------------------------------
+
+    // Tell the protocol it should act normally
+    wrapper->GetMessenger()->SetNoError();
+
+    // ------------------------------------------------------
+    // 1. Create faked notification about create
+    SendSrvMsgL( KPresentUri1, KPresentDispName1,
+            CXIMPTestFileSrvMsg::ETestSrvMsgPresentityGroupCreate );
+
+    // ------------------------------------------------------
+    // expect MPresentityGroupList event.
+    CPresentityGroupListEventImp* event = XIMPTestEventFactory::CreateGroupListEventLCX(
+            KPresentUri1, KPresentDispName1,
+            XIMPTestEventFactory::ETestPGLCreated,
+
+            KPresentUri1, KPresentDispName1,
+            MXIMPDataSubscriptionState::ESubscriptionActive,
+            MXIMPDataSubscriptionState::EDataAvailable
+            );
+
+    listener2->ExpectL( event );
+    CleanupStack::Pop( event ); // 4 more items in cleanupstack
+
+    EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "HandlePresentityGroupListL failed (Creation)" );
+    CleanupStack::PopAndDestroy( 4 ); // lists
+
+    // ------------------------------------------------------
+    // Send a faked delete message
+
+    SendSrvMsgL( KPresentUri1, KPresentDispName1,
+            CXIMPTestFileSrvMsg::ETestSrvMsgPresentityGroupDelete );
+
+    // ------------------------------------------------------
+    // expect MPresentityGroupList event.
+
+    event = XIMPTestEventFactory::CreateGroupListEventLCX(
+            KPresentUri1, KNullDesC,
+            XIMPTestEventFactory::ETestPGLDeleted,
+            KNullDesC, KNullDesC,
+            MXIMPDataSubscriptionState::ESubscriptionActive,
+            MXIMPDataSubscriptionState::EDataAvailable
+            );
+
+    listener2->ExpectL( event );
+    CleanupStack::Pop( event ); // 4 more items in cleanupstack
+
+    EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "HandlePresentityGroupListL failed (Deletion)" );
+    CleanupStack::PopAndDestroy( 4 ); // lists
+    // ------------------------------------------------------
+
+    CleanupStack::PopAndDestroy( listener2 );
+
+    // unsubscribe group list and log out
+    UnsubscribeL();
+    UnbindL();
+    }
+
+// Single client, subscribed to the group, then subscribe list
+void T_PresenceGroupListManagement::T_HandlePresentityGroupList_Subscribed_L()
+    {
+    EUNIT_PRINT( _L("Handle presentity group list, subscribed to the group.") );
+
+    // log in
+    BindL();
+    SubscribeGroupL( KPresentUri1 );
+    SubscribeL();
+
+    // ------------------------------------------------------
+    // some startup stuff
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    MXIMPContext* context = wrapper->GetContext();
+
+    CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context );
+    CleanupStack::PushL( listener2 );
+    // ------------------------------------------------------
+
+    // Tell the protocol it should act normally
+    wrapper->GetMessenger()->SetNoError();
+
+    // ------------------------------------------------------
+    // 1. Create faked server message about group list
+    SendSrvMsgL( KPresentUri1,
+            KPresentDispName1,
+            CXIMPTestFileSrvMsg::ETestSrvMsgPresentityGroupCreate );
+
+    // ------------------------------------------------------
+    // expect empty MPresentityGroupList event.
+
+    CPresentityGroupListEventImp* event = XIMPTestEventFactory::CreateGroupListEventLCX(
+            KPresentUri1, KPresentDispName1,
+            XIMPTestEventFactory::ETestPGLCreated,
+            KPresentUri1, KPresentDispName1,
+            MXIMPDataSubscriptionState::ESubscriptionActive,
+            MXIMPDataSubscriptionState::EDataAvailable
+            );
+
+    listener2->ExpectL( event );
+    CleanupStack::Pop( event ); // 4 more items in cleanupstack
+
+    EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "HandlePresentityGroupListL failed" );
+    CleanupStack::PopAndDestroy( 4 ); // lists
+    // ------------------------------------------------------
+
+    CleanupStack::PopAndDestroy( listener2 );
+
+    // clean it up
+    UnsubscribeL();
+    UnsubscribeGroupL( KPresentUri1 );
+    UnbindL();
+    }
+
+void T_PresenceGroupListManagement::T_HandlePresentityGroupUpdate_L()
+    {
+    EUNIT_PRINT( _L("Handle presentity group displayname update.") );
+
+    // log in and subscribe a group list
+    BindL();
+    SubscribeL();
+
+    // ------------------------------------------------------
+    // some startup stuff
+
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    MXIMPContext* context = wrapper->GetContext();
+
+    CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context );
+    CleanupStack::PushL( listener2 );
+    // ------------------------------------------------------
+
+    // Tell the protocol it should act normally
+    wrapper->GetMessenger()->SetNoError();
+
+    // ------------------------------------------------------
+    // 1. Create faked notification about create
+    SendSrvMsgL( KPresentUri1, KPresentDispName1,
+            CXIMPTestFileSrvMsg::ETestSrvMsgPresentityGroupCreate );
+
+    // ------------------------------------------------------
+    // expect MPresentityGroupList event.
+
+    CPresentityGroupListEventImp* event = XIMPTestEventFactory::CreateGroupListEventLCX(
+            KPresentUri1, KPresentDispName1,
+            XIMPTestEventFactory::ETestPGLCreated,
+            KPresentUri1, KPresentDispName1,
+            MXIMPDataSubscriptionState::ESubscriptionActive,
+            MXIMPDataSubscriptionState::EDataAvailable
+            );
+
+    listener2->ExpectL( event );
+    CleanupStack::Pop( event ); // 4 more items in cleanupstack
+
+    EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "HandlePresentityGroupListL failed (Creation)" );
+    CleanupStack::PopAndDestroy( 4 ); // lists
+
+    // ------------------------------------------------------
+    // 4. Change displayname of group and send faked notification about
+    // update
+
+    SendSrvMsgL( KPresentUri1, KPresentDispName2,
+            CXIMPTestFileSrvMsg::ETestSrvMsgPresentityGroupUpdate );
+
+    // ------------------------------------------------------
+    // expect MPresentityGroupList event.
+
+    event = XIMPTestEventFactory::CreateGroupListEventLCX(
+            KPresentUri1, KPresentDispName2,
+            XIMPTestEventFactory::ETestPGLUpdated,
+            KPresentUri1, KPresentDispName2,
+            MXIMPDataSubscriptionState::ESubscriptionActive,
+            MXIMPDataSubscriptionState::EDataAvailable
+            );
+
+    listener2->ExpectL( event );
+    CleanupStack::Pop( event ); // 4 more items in cleanupstack
+
+    EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "HandlePresentityGroupListL failed (Update)" );
+    CleanupStack::PopAndDestroy( 4 ); // lists
+    // ------------------------------------------------------
+
+    CleanupStack::PopAndDestroy( listener2 );
+
+    // unsubscribe group list and log out
+    UnsubscribeL();
+    UnbindL();
+    }
+
+// ===========================================================================
+// SETUP HELPERS FOR THE LISTENER
+// ===========================================================================
+//
+
+// send a faked server-originated message with group info made
+// from the given uri and displayname
+//
+void T_PresenceGroupListManagement::SendSrvMsgL(
+        const TDesC& aUri, const TDesC& aDispName,
+        TInt aMsgType )
+    {
+    // we'll use hard-coded wrapper 0 instance for now.
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+
+    // create a group info contained within the server-originated
+    // faked message
+    CXIMPIdentityImp* groupId = CXIMPIdentityImp::NewLC( aUri );
+    CPresentityGroupInfoImp* groupItem = CPresentityGroupInfoImp::NewLC( *groupId, aDispName );
+    HBufC8* packet = NULL;
+    if( aMsgType == CXIMPTestFileSrvMsg::ETestSrvMsgPresentityGroupDelete )
+        {
+        packet = TXIMPObjectPacker< CXIMPIdentityImp >::PackL( *groupId );        
+        }
+    else
+        {
+        packet = TXIMPObjectPacker< CPresentityGroupInfoImp >::PackL( *groupItem );        
+        }
+    CleanupStack::PushL( packet );
+    
+    // use filetool to send it for plugin.
+    CXIMPTestFileSrvMsg* srvMsg = CXIMPTestFileSrvMsg::NewL( aMsgType, *packet );
+    CleanupStack::PushL( srvMsg );
+    wrapper->FileTool().CleanAllL();
+    wrapper->FileTool().SrvMsgStoreL( srvMsg );
+    CleanupStack::PopAndDestroy( 4, groupId ); // srvMsg, packet, groupItem, groupId
+    }
+
+// send a faked server-originated message with empty contents
+//
+void T_PresenceGroupListManagement::SendSrvMsgL( TInt aMsgType )
+    {
+    // we'll use hard-coded wrapper 0 instance for now.
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+
+    // create a server-originated faked message with empty contents
+    RXIMPObjOwningPtrArray<CPresentityGroupInfoImp> groupList;
+
+    HBufC8* packedArray = TXIMPObjectPacker<CPresentityGroupInfoImp>::PackArrayL( groupList );
+    CleanupStack::PushL( packedArray );
+
+    // use filetool to send it for plugin.
+    CXIMPTestFileSrvMsg* srvMsg = CXIMPTestFileSrvMsg::NewL( aMsgType,
+            *packedArray );
+    CleanupStack::PushL( srvMsg );
+    wrapper->FileTool().CleanAllL();
+    wrapper->FileTool().SrvMsgStoreL( srvMsg );
+    CleanupStack::PopAndDestroy( 2 ); // srvMsg, packedArray
+    }
+
+// update display name of group without having subscribed to it
+void T_PresenceGroupListManagement::T_UpdateDisplayNameL(
+        const TDesC& aGroupId,
+        const TDesC& aDispName )
+    {
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    MXIMPContext* context = wrapper->GetContext();
+    CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+    // Get the interfaces
+    MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+    MPresentityGroups& presGroup = presFeat->PresentityGroups();
+
+    wrapper->GetMessenger()->SetNoError();
+
+    CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context );
+    CleanupStack::PushL( listener2 );
+
+    MXIMPIdentity* groupId = context->ObjectFactory().NewIdentityLC();
+    groupId->SetIdentityL( aGroupId );
+
+    // ------------------------------------------------------
+    // expect request complete with a group info imp inside
+    TXIMPRequestId reqIdDummy;  // not checked
+    CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+
+    CPresentityGroupInfoImp* grpInfo = CPresentityGroupInfoImp::NewLC(
+            *groupId,
+            aDispName );
+
+    evReqComplete->AppendParamL( grpInfo );
+    CleanupStack::Pop(); // grpInfo
+
+    listener2->ExpectL( evReqComplete );
+    CleanupStack::Pop( evReqComplete );
+
+    // ------------------------------------------------------
+    // update
+    TXIMPRequestId reqId = presGroup.UpdatePresentityGroupDisplayNameL(
+            *groupId,
+            aDispName );
+
+    EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Unsubscribe group content failed" );
+
+    messenger->AssertUpdatePresentityGroupDisplayNameCalled( ETrue );
+
+    CleanupStack::PopAndDestroy(); // groupId
+    CleanupStack::PopAndDestroy( listener2 );
+    }
+
+
+// test method for updating display name of group without having subscribed
+// to it
+void T_PresenceGroupListManagement::T_UpdateDisplayName_Single_L()
+    {
+    EUNIT_PRINT( _L("Update presentity group displayname, single.") );
+
+    BindL();
+
+    T_UpdateDisplayNameL( KPresentUri1, KPresentDispName1 );
+
+    UnbindL();
+    }
+
+
+
+// Single client, unsubscribe nonsubscribed
+void T_PresenceGroupListManagement::T_UnsubNonsubscribed_Single_L()
+    {
+    EUNIT_PRINT( _L("Single unsubscribe nonsubscribed") );
+
+    BindL();
+
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    MXIMPContext* context = wrapper->GetContext();
+    CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+    // Get the interfaces
+    MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+    MPresentityGroups& presGroup = presFeat->PresentityGroups();
+
+    CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context );
+    CleanupStack::PushL( listener2 );
+
+    // Tell the protocol it should act normally
+    messenger->SetNoError();
+
+    // ---------------------------------------------
+    // unsubscribe
+    TXIMPRequestId reqIdDummy;  // not checked
+    CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+    listener2->ExpectL( evReqComplete );
+    CleanupStack::Pop( evReqComplete );
+
+    // group list event with Unsubscribed
+    CPresentityGroupListEventImp* event = XIMPTestEventFactory::CreateGroupListEventLCX(
+            KNullDesC, KNullDesC,
+            XIMPTestEventFactory::ETestPGLEmpty,
+
+            KNullDesC, KNullDesC,
+            MXIMPDataSubscriptionState::ESubscriptionInactive,
+            MXIMPDataSubscriptionState::EDataUnavailable
+            );
+
+    listener2->ExpectL( event );
+    CleanupStack::Pop( event ); // 4 more items in cleanupstack
+
+    TXIMPRequestId reqId = presGroup.UnsubscribePresentityGroupListL();
+    EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Unsubscribe failed" );
+    CleanupStack::PopAndDestroy( 4 ); // rest of the group list event
+    messenger->AssertUnsubscribePresentityGroupListCalled( EFalse );  // should not be called, no subscriptions
+
+    CleanupStack::PopAndDestroy( listener2 );
+
+    UnbindL();
+    }
+
+// ===========================================================================
+// TEST CASE TABLE
+// ===========================================================================
+//
+EUNIT_BEGIN_TEST_TABLE(
+        T_PresenceGroupListManagement,
+        "XIMP presence group list management tests",
+        "MODULE" )
+
+PRFW_DECORATED_TEST(
+        "Subscribe single presence",
+        "",
+        "",
+        "FUNCTIONALITY",
+        Setup_L,
+        T_SubscribePresentityGroup_Single_L,
+        Teardown )
+
+PRFW_DECORATED_TEST(
+        "Subscribe single presence with error",
+        "",
+        "",
+        "FUNCTIONALITY",
+        Setup_L,
+        T_SubscribePresentityGroup_Error_Single_L,
+        Teardown )
+
+PRFW_DECORATED_TEST(
+        "Unsubscribe single presence with error",
+        "",
+        "",
+        "FUNCTIONALITY",
+        Setup_L,
+        T_UnsubscribePresentityGroup_Error_Single_L,
+        Teardown )
+
+PRFW_DECORATED_TEST(
+        "Unsubscribe nonsubscribed",
+        "",
+        "",
+        "FUNCTIONALITY",
+        Setup_L,
+        T_UnsubNonsubscribed_Single_L,
+        Teardown )
+
+PRFW_DECORATED_TEST(
+        "Subscribe multiple presence",
+        "",
+        "",
+        "FUNCTIONALITY",
+        SetupMultiple_L,
+        T_SubscribePresentityGroup_Multiple_L,
+        Teardown )
+
+PRFW_DECORATED_TEST(
+        "Multiple subscribe all but one, unsub all",
+        "",
+        "",
+        "FUNCTIONALITY",
+        SetupMultiple_L,
+        T_SubscribeAll_One_Unsub_Multiple_L,
+        Teardown )
+
+PRFW_DECORATED_TEST(
+        "Single refresh multiple presence",
+        "",
+        "",
+        "FUNCTIONALITY",
+        SetupMultiple_L,
+        T_RefreshPresentityGroup_One_Multiple_L,
+        Teardown )
+
+PRFW_DECORATED_TEST(
+        "Multiple refresh presence",
+        "",
+        "",
+        "FUNCTIONALITY",
+        SetupMultiple_L,
+        T_RefreshPresentityGroup_Multiple_L,
+        Teardown )
+
+PRFW_DECORATED_TEST(
+        "Handle Presentity Group List",
+        "",
+        "",
+        "FUNCTIONALITY",
+        Setup_L,
+        T_HandlePresentityGroupList_L,
+        Teardown )
+
+PRFW_DECORATED_TEST(
+        "Handle Presentity Group List (subscribed group)",
+        "",
+        "",
+        "FUNCTIONALITY",
+        Setup_L,
+        T_HandlePresentityGroupList_Subscribed_L,
+        Teardown )
+
+PRFW_DECORATED_TEST(
+        "Create and delete group.",
+        "",
+        "",
+        "FUNCTIONALITY",
+        Setup_L,
+        T_HandlePresentityGroupCreateAndDelete_L,
+        Teardown )
+
+PRFW_DECORATED_TEST(
+        "Handle update displayname",
+        "",
+        "",
+        "FUNCTIONALITY",
+        Setup_L,
+        T_HandlePresentityGroupUpdate_L,
+        Teardown )
+
+PRFW_DECORATED_TEST(
+        "Update displayname",
+        "",
+        "",
+        "FUNCTIONALITY",
+        Setup_L,
+        T_UpdateDisplayName_Single_L,
+        Teardown )
+
+EUNIT_END_TEST_TABLE
+
+
+// ===========================================================================
+// TEST SUITE CONSTRUCTION
+// ===========================================================================
+//
+EXPORT_C MEUnitTest* CreateTestSuiteL()
+    {
+    return T_PresenceGroupListManagement::NewL();
+    }
+
+
+// end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/tsrc/src/t_presencegrouplistmngt/t_presencegrouplistmngt.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,133 @@
+/*
+* 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: XIMP Framework Test Code 
+*
+*/
+
+#ifndef T_PRESENCEGROUPLISTMANAGEMENT_H
+#define T_PRESENCEGROUPLISTMANAGEMENT_H
+
+
+//  EXTERNAL INCLUDES
+#include <platform/digia/eunit/ceunittestsuiteclass.h>
+#include <platform/digia/eunit/EUnitDecorators.h>
+
+#include <ximpbase.h>
+#include "prfwteststatuseventlistener.h"
+#include "prfwtestmessaging.h"
+
+class CXIMPTestContextWrapper;
+class CXIMPTestContextWrapperMgr;
+class CXIMPTestMessenger;
+class CPresentityGroupInfoImp;
+class CPresentityGroupListEventImp;
+
+/**
+ * XIMP Framework Eunit tests.
+ *
+ * Tests for XIMP session management services.
+ *
+ * @since S60 v4.0
+ */
+class T_PresenceGroupListManagement : public CEUnitTestSuiteClass
+    {
+
+public:
+    static T_PresenceGroupListManagement* NewL();
+    virtual ~T_PresenceGroupListManagement();
+
+
+private:
+    T_PresenceGroupListManagement();
+    void ConstructL();
+
+private:    // Test case functions
+
+    void Setup_L();
+    void SetupMultiple_L();
+    void BindL();
+    void BindAllL();
+    void Teardown();
+    void UnbindL();
+    void UnbindAllL();
+    void SubscribeL();
+    void SubscribeGroupL( const TDesC& aGroupId );
+    void UnsubscribeGroupL( const TDesC& aGroupId );
+    void UnsubscribeL();
+
+    void T_SubscribePresentityGroup_Single_L();
+    void T_UnsubscribePresentityGroup_Error_Single_L();
+    void T_SubscribePresentityGroup_Error_Single_L();
+    void T_SubscribePresentityGroup_Multiple_L();
+    void T_UpdateDisplayName_Single_L();
+    void T_HandlePresentityGroupList_L();
+    void T_HandlePresentityGroupList_Subscribed_L();
+    void T_HandlePresentityGroupCreateAndDelete_L();
+    void T_HandlePresentityGroupUpdate_L();
+    void T_HandlePresentityGroupUpdate_WithHelpers_L();
+    void T_SubscribePresentityGroup_One_Multiple_L();
+    void T_RefreshPresentityGroup_One_Multiple_L();
+    void T_UnsubNonsubscribed_Single_L();
+    void T_RefreshPresentityGroup_Multiple_L();
+    void T_SubscribeAll_One_Unsub_Multiple_L();
+
+    void T_UpdateDisplayNameL( 
+            const TDesC& aGroupId, 
+            const TDesC& aDispName );
+
+private:    // Test helpers
+
+    /**
+     * Fake a server-originated (=mobile terminated) message.
+     * The message appears to adaptation and framework as if
+     * it came from the network. Uses only one group.
+     * @param aUri The URI of group
+     * @param aDispName The display name for the group
+     * @param aMsgType The message type for CXIMPTestFileSrvMsg
+     */
+    void SendSrvMsgL( 
+            const TDesC& aUri, const TDesC& aDispName,
+            TInt aMsgType );
+    
+    /**
+     * Fake a server-originated message with empty content.
+     * Whether to use this depends on the event you expect.
+     * @see SendSrvMsgL
+     */
+    void SendSrvMsgL( TInt aMsgType );
+
+private: // Test data
+
+    /**
+     * Eunit test case table declaration.
+     */
+    EUNIT_DECLARE_TEST_TABLE;
+
+    // owned
+    CXIMPTestContextWrapperMgr* iWrapperMgr;
+    
+    // 
+    TInt iLastError;
+    RXIMPObjOwningPtrArray< CPresentityGroupInfoImp > iValidateArray;
+    };
+
+
+#endif      //  T_PRESENCEGROUPLISTMANAGEMENT_H
+
+
+
+// end of file
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/tsrc/src/t_presencegrouplistmngt/t_presencegrouplistmngt.mmp	Wed Nov 03 09:32:20 2010 +0530
@@ -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: XIMP Framework Test Code 
+*
+*/
+
+#include            "../../tsrcutils/eunitcommon/eunittstdllbase.hrh"
+#include            "../../tsrcutils/processmaster/pm.h"
+
+#include<platform_paths.hrh>
+#include<eunitcaps.h>
+TARGET              t_presencegrouplistmngt.dll
+//CAPABILITY              ALL - TCB - DRM
+CAPABILITY      EUNIT_CAPS
+
+SOURCEPATH          .
+SOURCE              t_presencegrouplistmngt.cpp
+
+USERINCLUDE             ../../../core/srcdatamodel
+USERINCLUDE             ../../../presence/srcpresencedatamodel
+USERINCLUDE             ../../../presence/srcpresencedatamodel/presentitygroups
+USERINCLUDE             ../../../presence/srcpresencedatamodel/presencewatching
+USERINCLUDE             ../../../presence/srcpresencedatamodel/presenceauthorization
+USERINCLUDE             ../../../presence/srcpresencedatamodel/presencepublishing
+USERINCLUDE             ../../../presence/srcpresencedatamodel/presenceinfo
+USERINCLUDE             ../../../core/srcutils
+
+// TODO remove unnecessary
+
+#if defined ( OS_LAYER_SYSTEMINCLUDE )
+OS_LAYER_SYSTEMINCLUDE
+#else
+SYSTEMINCLUDE     /epoc32/include
+#endif
+
+ #if defined ( APP_LAYER_SYSTEMINCLUDE )
+ APP_LAYER_SYSTEMINCLUDE
+ #else
+ SYSTEMINCLUDE     \epoc32\include
+ #endif
+ 
+ 
+SYSTEMINCLUDE           ../../../inc/core/base
+SYSTEMINCLUDE           ../../../inc/core/datamodel
+SYSTEMINCLUDE           ../../../inc/core/protocolplugin
+SYSTEMINCLUDE           ../../../inc/core/protocolpluginhost
+SYSTEMINCLUDE           ../../../inc/presence/presencedatamodel
+SYSTEMINCLUDE           ../../../inc/presence/presencemanagement
+SYSTEMINCLUDE           ../../../inc/presence/presenceprotocolplugin
+SYSTEMINCLUDE           ../../../inc/presence/presenceprotocolpluginhost
+
+
+LIBRARY             ecom.lib
+LIBRARY             bafl.lib
+LIBRARY             ximpdatamodel.lib
+LIBRARY             presencedatamodel.lib
+LIBRARY             estor.lib
+LIBRARY             ximputils.lib
+LIBRARY             eunit.lib
+LIBRARY             eunitutil.lib
+LIBRARY             euser.lib
+
+// end of file
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/tsrc/src/t_presencegroupmembermngt/bld.inf	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,23 @@
+/*
+* 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 t_presencegroupmngt.dll
+ *
+*/
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_TESTMMPFILES
+t_presencegroupmembermngt.mmp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/tsrc/src/t_presencegroupmembermngt/t_presencegroupmembermngt.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,2283 @@
+/*
+* 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: XIMP Framework Test Code 
+*
+*/
+
+
+#include "eunittools.h"
+
+
+#include <platform/digia/eunit/eunitmacros.h>
+#include <platform/digia/eunit/teunitassertioninfo.h>
+
+#include <ecom/ecom.h>
+#include <badesca.h>
+#include <e32std.h>
+
+#include <ximpclient.h>
+#include <ximpcontext.h>
+#include <ximpobjectfactory.h>
+#include <ximpcontextstateevent.h>
+#include <ximprequestcompleteevent.h>
+#include <ximpstatus.h>
+#include <presencefeatures.h>
+#include <presentitygroups.h>
+#include <presentitygroupmemberinfo.h>
+#include <presentitygroupcontentevent.h>
+
+
+#include "ximpeventcodec.h"
+
+#include "t_presencegroupmembermngt.h"
+#include "prfwteststatuseventlistener.h"
+#include "prfwtestmessaging.h"
+#include "prfwtestmessenger.h"
+#include "prfwtestlistener.h"
+#include "prfwtestcontextwrappermgr.h"
+#include "prfwtestcontextwrapper.h"
+#include "ximpcontextstateeventimp.h"
+#include "ximpcontextstateevent.h"
+
+#include "presenceinfoimp.h"
+#include "presenceinfofilterimp.h"
+#include "prfwtestpresencedatautils.h"
+#include "ximpidentityimp.h"
+#include "presentitygroupcontenteventimp.h"
+#include "ximprequestcompleteeventimp.h"
+#include "presentitygroupinfoimp.h"
+#include "presentitygrouplisteventimp.h"
+#include "presentitygroupmemberinfoimp.h"
+#include "ximprequestcompleteeventimp.h"
+#include "ximprestrictedobjectcollection.h"
+#include "ximpobjectfactoryimp.h"
+
+#include "prfwtestrobustnesstools.h"
+#include "ximpobjecthelpers.h"
+#include "prfwtestfilesrvmsg.h"
+#include "prfwtestfiletool.h"
+#include "prfwtestwaithelper.h"
+#include "prfwtesteventfactory.h"
+
+
+_LIT( KGroupId,   "wv:group/member@imps.com" );
+_LIT( KGroupId2,  "wv:group2/chutney@naan.com" );
+_LIT( KGroupDisplayName, "Salamapartio Z" );
+
+_LIT( KMemberId, "wv:member@imps.com" );
+_LIT( KMemberDisplayName,  "Stroustrup" );
+_LIT( KMemberDisplayName2, "Bjarne" );
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// CONSTRUCTION
+T_PresenceGroupMemberManagement* T_PresenceGroupMemberManagement::NewL()
+    {
+    T_PresenceGroupMemberManagement* self = new( ELeave ) T_PresenceGroupMemberManagement;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+
+    return self;
+    }
+
+T_PresenceGroupMemberManagement::~T_PresenceGroupMemberManagement()
+    {
+    delete iLastEvent;
+
+    if ( iASWait && iASWait->IsStarted() )
+        {
+        iASWait->AsyncStop();
+        }
+    delete iASWait;
+
+    delete iListener2;
+
+    delete iCurrentGrId;
+    }
+
+void T_PresenceGroupMemberManagement::ConstructL()
+    {
+    CEUnitTestSuiteClass::ConstructL();
+    iASWait = new ( ELeave ) CActiveSchedulerWait();
+    }
+
+
+T_PresenceGroupMemberManagement::T_PresenceGroupMemberManagement()
+    {
+    }
+
+// ===========================================================================
+// TEST CASE SETUP & TEARDOWN METHODS
+// ===========================================================================
+//
+
+void T_PresenceGroupMemberManagement::Setup_L()
+    {
+    PrfwTestRobustness::DoPreCleaning();
+
+    iWrapperMgr = CXIMPTestContextWrapperMgr::NewL();
+    iWrapperMgr->CreateWrapperL();
+
+    // must reset these to EFalse
+    iSkipSubscribe = EFalse;
+    iSkipUnsubscribe = EFalse;
+    }
+
+void T_PresenceGroupMemberManagement::SetupMultiple_L()
+    {
+    PrfwTestRobustness::DoPreCleaning();
+
+    iWrapperMgr = CXIMPTestContextWrapperMgr::NewL();
+    iWrapperMgr->CreateWrapperL();
+    iWrapperMgr->CreateWrapperL();
+    iWrapperMgr->CreateWrapperL();
+
+    // must reset these to EFalse
+    iSkipSubscribe = EFalse;
+    iSkipUnsubscribe = EFalse;
+    }
+
+// bind helper
+void T_PresenceGroupMemberManagement::BindAllL()
+    {
+    for( TInt a = 0; a < iWrapperMgr->WrapperCount(); ++a )
+        {
+        CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a );
+        wrapper->BindL( 0 );
+        }
+    }
+
+// unbind helper
+void T_PresenceGroupMemberManagement::UnbindAllL()
+    {
+    for( TInt a = 0; a < iWrapperMgr->WrapperCount(); ++a )
+        {
+        CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a );
+        wrapper->UnbindL();
+        }
+    }
+
+void T_PresenceGroupMemberManagement::TeardownTestSupport()
+    {
+    // anything NOT initialized by test case Setup method,
+    // but initialized in the test case itself, goes here
+    delete iCurrentGrId;
+    iCurrentGrId = NULL;
+
+    delete iListener2;
+    iListener2 = NULL;
+
+    delete iLastEvent;
+    iLastEvent = NULL;
+    }
+
+void T_PresenceGroupMemberManagement::Teardown()
+    {
+    TeardownTestSupport();
+    // just in case to avoid memleaks. should not have anything to
+    // delete anyway
+
+    delete iWrapperMgr;
+    iWrapperMgr = NULL;
+
+    REComSession::FinalClose();
+
+    // must reset these to EFalse
+    iSkipSubscribe = EFalse;
+    iSkipUnsubscribe = EFalse;
+
+    // it's best to nuke the servers during exit too.
+    PrfwTestRobustness::DoPreCleaning();
+    }
+
+// ===========================================================================
+// TEST CASES for presentity presence subscription
+// ===========================================================================
+
+// General test case for single member
+void T_PresenceGroupMemberManagement::T_GenericSubAndUnsubL(
+        TXIMPCallBack& aCbFuncL )
+    {
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    wrapper->BindL( 0 );
+
+    // ------------------------------------------------------
+    // some startup stuff
+    MXIMPContext* context = wrapper->GetContext();
+    CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+    // Get the interfaces
+    MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+    MPresentityGroups& presGroup = presFeat->PresentityGroups();
+
+    iListener2 = CXIMPTestListener::NewL( context );
+    // ------------------------------------------------------
+
+    // Tell the protocol it should act normally
+    wrapper->GetMessenger()->SetNoError();
+
+    iCurrentGrId = context->ObjectFactory().NewIdentityLC();
+    CleanupStack::Pop(); // iCurrentGrId
+    iCurrentGrId->SetIdentityL( KGroupId );
+
+    // ------------------------------------------------------
+    // create presentity group
+    //
+    // expect events:
+    // - request complete.
+    // NOTE: no presentitygrouplistevent as we've not subscribed the group lists
+
+    // normal request complete
+    TXIMPRequestId reqIdDummy;  // not checked
+    CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+
+    // identity + displayname
+    CPresentityGroupInfoImp* infoImp = CPresentityGroupInfoImp::NewLC( *iCurrentGrId, KGroupDisplayName );
+    evReqComplete->AppendParamL( infoImp );
+    CleanupStack::Pop( infoImp );
+
+    iListener2->ExpectL( evReqComplete );
+    CleanupStack::Pop( evReqComplete );
+
+    TXIMPRequestId reqId = presGroup.CreatePresentityGroupL( *iCurrentGrId, KGroupDisplayName );
+
+    // and wait
+    EUNIT_ASSERT_DESC( KErrNone == iListener2->WaitAndAssertL(), "CreatePresentityGroupL failed" );
+    messenger->AssertCreatePresentityGroupCalled( ETrue );
+
+    if ( ! iSkipSubscribe )
+        {
+        // ------------------------------------------------------
+        // subscribe presentity group CONTENT
+        //
+        // expect events:
+        // - request complete
+        evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+        iListener2->ExpectL( evReqComplete );
+        CleanupStack::Pop( evReqComplete );
+
+        // do the call
+        reqId = presGroup.SubscribePresentityGroupContentL( *iCurrentGrId );
+
+        // and wait
+        EUNIT_ASSERT_DESC( KErrNone == iListener2->WaitAndAssertL(), "SubscribePresentityGroupContentL failed" );
+
+        // verify that subscribe was called
+        messenger->AssertSubscribePresentityGroupContentCalled( ETrue );
+        }
+
+    // ------------------------------------------------------
+    // do the actual test. this is a function pointer because the
+    // "red tape" of each test is similar (create group, subscribe content, do
+    // actual test, unsubscribe content, delete group) - this is the variable
+    // part, the "do actual test".
+    (this->*aCbFuncL)();
+
+    if ( ! iSkipUnsubscribe )
+        {
+        // ------------------------------------------------------
+        // unsubscribe presentity group content
+        //
+        // expect events:
+        // - request complete
+        // - presentity group content event
+
+        evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+        iListener2->ExpectL( evReqComplete );
+        CleanupStack::Pop( evReqComplete );
+
+        CPresentityGroupContentEventImp* groupCntEvent =
+            XIMPTestEventFactory::CreateGroupContentEventLCX(
+                    KGroupId,
+                    KNullDesC,
+                    KNullDesC,
+                    XIMPTestEventFactory::ETestPGLCntRemoved,
+                    KNullDesC,
+                    KNullDesC,
+                    MXIMPDataSubscriptionState::ESubscriptionInactive,
+                    MXIMPDataSubscriptionState::EDataUnavailable
+                    );
+
+        iListener2->ExpectL( groupCntEvent );
+        CleanupStack::Pop( groupCntEvent ); // 5 more items in cleanupstack
+
+        // do the call
+        reqId = presGroup.UnsubscribePresentityGroupContentL( *iCurrentGrId );
+
+        // and wait
+        EUNIT_ASSERT_DESC( KErrNone == iListener2->WaitAndAssertL(), "UnsubscribePresentityGroupContentL failed" );
+        CleanupStack::PopAndDestroy( 5 ); // lists
+
+        // verify that unsubscribe was called
+        messenger->AssertUnsubscribePresentityGroupContentCalled( ETrue );
+        }
+
+    // ------------------------------------------------------
+    // delete presentity group
+    //
+    // expect events:
+    // - request complete
+    // NO presentity group content event as we've just unsubscribed it.
+
+    evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+    iListener2->ExpectL( evReqComplete );
+    CleanupStack::Pop( evReqComplete );
+
+    // do the call
+    reqId = presGroup.DeletePresentityGroupL( *iCurrentGrId );
+
+    // and wait
+    EUNIT_ASSERT_DESC( KErrNone == iListener2->WaitAndAssertL(), "DeletePresentityGroupL failed" );
+
+    // ------------------------------------------------------
+
+    // make sure the new listener is not listening for events!
+    iListener2->SetEventSourceL( NULL );
+
+    wrapper->UnbindL();
+
+    TeardownTestSupport();
+    }
+
+// ===========================================================================
+// Variant methods, this is where the actual testing happens.
+// Called by the generic subscribe and unsubscribe -method
+// ===========================================================================
+
+// ------------------------------------------------------
+// empty test variant method
+// test only the creation, subscribe and unsubcscribe
+// ------------------------------------------------------
+//
+void T_PresenceGroupMemberManagement::T_EmptyFunc()
+    {
+    // nothing
+    }
+
+// ------------------------------------------------------
+// test adding members
+// ------------------------------------------------------
+//
+void T_PresenceGroupMemberManagement::T_TestAddMembersL()
+    {
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    MXIMPContext* context = wrapper->GetContext();
+    CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+    // Get the interfaces
+    MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+    MPresentityGroups& presGroup = presFeat->PresentityGroups();
+
+    // Tell the protocol it should act normally
+    messenger->SetNoError();
+
+    // ------------------------------------------------------
+    // add presentity group member
+    //
+    // expect events:
+    // - request complete,
+    // - presentitygroupcontentevent
+
+    MXIMPIdentity* member = context->ObjectFactory().NewIdentityLC();
+    member->SetIdentityL( KMemberId );
+
+    // normal request complete
+    TXIMPRequestId reqIdDummy;  // not checked
+    CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+
+    // group id
+    CXIMPIdentityImp* identity = CXIMPIdentityImp::NewLC( iCurrentGrId->Identity() );
+    evReqComplete->AppendParamL( identity );
+    CleanupStack::Pop(); // identity
+
+    // id for member info
+    CXIMPIdentityImp* miId = CXIMPIdentityImp::NewLC( KMemberId );
+    // member info
+    CPresentityGroupMemberInfoImp* memInfoImp =
+        CPresentityGroupMemberInfoImp::NewLC( *miId, KMemberDisplayName );
+    evReqComplete->AppendParamL( memInfoImp );
+    CleanupStack::Pop(); // memInfoImp owned by AppendParamL
+    CleanupStack::PopAndDestroy( miId ); // copy was made
+
+    iListener2->ExpectL( evReqComplete );
+    CleanupStack::Pop( evReqComplete );
+
+    // group content event
+    CPresentityGroupContentEventImp* groupCntEvent =
+        XIMPTestEventFactory::CreateGroupContentEventLCX(
+                iCurrentGrId->Identity(),
+                KMemberId,
+                KMemberDisplayName,
+                XIMPTestEventFactory::ETestPGLCntAdded,
+                KMemberId,
+                KMemberDisplayName,
+                MXIMPDataSubscriptionState::ESubscriptionActive,
+                MXIMPDataSubscriptionState::EDataAvailable
+                );
+
+    iListener2->ExpectL( groupCntEvent );
+    CleanupStack::Pop( groupCntEvent ); // 5 more items in cleanupstack
+
+    // do the call
+    TXIMPRequestId reqId = presGroup.AddPresentityGroupMemberL(
+            *iCurrentGrId, *member, KMemberDisplayName );
+
+    // and wait
+    EUNIT_ASSERT_DESC( KErrNone == iListener2->WaitAndAssertL(), "AddPresentityGroupMemberL failed" );
+    CleanupStack::PopAndDestroy( 5 ); // lists from groupCntEvent
+
+    messenger->AssertAddPresentityGroupMemberCalled( ETrue );
+
+    // ------------------------------------------------------
+    CleanupStack::PopAndDestroy(); // member
+    }
+
+// ------------------------------------------------------
+// test adding members when not subscribed
+// ------------------------------------------------------
+//
+void T_PresenceGroupMemberManagement::T_TestAddMembers_NonSub_L()
+    {
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    MXIMPContext* context = wrapper->GetContext();
+    CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+    // Get the interfaces
+    MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+    MPresentityGroups& presGroup = presFeat->PresentityGroups();
+
+    // Tell the protocol it should act normally
+    messenger->SetNoError();
+
+    // ------------------------------------------------------
+    // add presentity group member
+    //
+    // expect events:
+    // - request complete,
+
+    MXIMPIdentity* member = context->ObjectFactory().NewIdentityLC();
+    member->SetIdentityL( KMemberId );
+
+    // normal request complete
+    TXIMPRequestId reqIdDummy;  // not checked
+    CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+
+    // group id
+    CXIMPIdentityImp* identity = CXIMPIdentityImp::NewLC( iCurrentGrId->Identity() );
+    evReqComplete->AppendParamL( identity );
+    CleanupStack::Pop(); // identity
+
+    // id for member info
+    CXIMPIdentityImp* miId = CXIMPIdentityImp::NewLC( KMemberId );
+    // member info
+    CPresentityGroupMemberInfoImp* memInfoImp =
+        CPresentityGroupMemberInfoImp::NewLC( *miId, KMemberDisplayName );
+    evReqComplete->AppendParamL( memInfoImp );
+    CleanupStack::Pop(); // memInfoImp owned by AppendParamL
+    CleanupStack::PopAndDestroy( miId ); // copy was made
+
+    iListener2->ExpectL( evReqComplete );
+    CleanupStack::Pop( evReqComplete );
+
+    // do the call
+    TXIMPRequestId reqId = presGroup.AddPresentityGroupMemberL(
+            *iCurrentGrId, *member, KMemberDisplayName );
+
+    // and wait
+    EUNIT_ASSERT_DESC( KErrNone == iListener2->WaitAndAssertL(), "AddPresentityGroupMemberL failed" );
+
+    messenger->AssertAddPresentityGroupMemberCalled( ETrue );
+
+    // ------------------------------------------------------
+    CleanupStack::PopAndDestroy(); // member
+    }
+
+// ------------------------------------------------------
+// test removing members
+// ------------------------------------------------------
+//
+void T_PresenceGroupMemberManagement::T_TestRemoveMembersL()
+    {
+    // add a member
+    T_TestAddMembersL();
+
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    MXIMPContext* context = wrapper->GetContext();
+    CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+    // Get the interfaces
+    MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+    MPresentityGroups& presGroup = presFeat->PresentityGroups();
+
+    // Tell the protocol it should act normally
+    messenger->SetNoError();
+
+    // ------------------------------------------------------
+    // remove presentity group member
+    //
+    // expect events:
+    // - request complete,
+    // - presentitygroupcontentevent
+
+    MXIMPIdentity* member = context->ObjectFactory().NewIdentityLC();
+    member->SetIdentityL( KMemberId );
+
+    // normal request complete
+    TXIMPRequestId reqIdDummy;  // not checked
+    CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+    iListener2->ExpectL( evReqComplete );
+    CleanupStack::Pop( evReqComplete );
+
+    // group content event
+    CPresentityGroupContentEventImp* groupCntEvent =
+        XIMPTestEventFactory::CreateGroupContentEventLCX(
+                iCurrentGrId->Identity(),
+                KMemberId,
+                KNullDesC,
+                XIMPTestEventFactory::ETestPGLCntRemoved,
+                KNullDesC,
+                KNullDesC,
+                MXIMPDataSubscriptionState::ESubscriptionActive,
+                MXIMPDataSubscriptionState::EDataAvailable
+                );
+
+    iListener2->ExpectL( groupCntEvent );
+    CleanupStack::Pop( groupCntEvent ); // 5 more items in cleanupstack
+
+    // do the call
+    TXIMPRequestId reqId = presGroup.RemovePresentityGroupMemberL(
+            *iCurrentGrId, *member );
+
+    // and wait
+    EUNIT_ASSERT_DESC( KErrNone == iListener2->WaitAndAssertL(), "RemovePresentityGroupMemberL failed" );
+    CleanupStack::PopAndDestroy( 5 ); // lists from groupCntEvent
+
+    messenger->AssertRemovePresentityGroupMemberCalled( ETrue );
+
+    // ------------------------------------------------------
+    CleanupStack::PopAndDestroy(); //member
+    }
+
+// ------------------------------------------------------
+// test removing members when non-subscribed
+// ------------------------------------------------------
+//
+void T_PresenceGroupMemberManagement::T_TestRemoveMembers_NonSub_L()
+    {
+    // add a member
+    T_TestAddMembers_NonSub_L();
+
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    MXIMPContext* context = wrapper->GetContext();
+    CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+    // Get the interfaces
+    MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+    MPresentityGroups& presGroup = presFeat->PresentityGroups();
+
+    // Tell the protocol it should act normally
+    messenger->SetNoError();
+
+    // ------------------------------------------------------
+    // remove presentity group member
+    //
+    // expect events:
+    // - request complete,
+    // - presentitygroupcontentevent
+
+    MXIMPIdentity* member = context->ObjectFactory().NewIdentityLC();
+    member->SetIdentityL( KMemberId );
+
+    // normal request complete
+    TXIMPRequestId reqIdDummy;  // not checked
+    CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+    iListener2->ExpectL( evReqComplete );
+    CleanupStack::Pop( evReqComplete );
+
+    // do the call
+    TXIMPRequestId reqId = presGroup.RemovePresentityGroupMemberL(
+            *iCurrentGrId, *member );
+
+    // and wait
+    EUNIT_ASSERT_DESC( KErrNone == iListener2->WaitAndAssertL(), "RemovePresentityGroupMemberL failed" );
+
+    messenger->AssertRemovePresentityGroupMemberCalled( ETrue );
+
+    // ------------------------------------------------------
+    CleanupStack::PopAndDestroy(); //member
+    }
+
+// test removing nonexisting members
+void T_PresenceGroupMemberManagement::T_TestRemoveMembers_NonExisting_L()
+    {
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    MXIMPContext* context = wrapper->GetContext();
+    CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+    // Get the interfaces
+    MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+    MPresentityGroups& presGroup = presFeat->PresentityGroups();
+
+    // Tell the protocol it should act normally
+    messenger->SetNoError();
+
+    // ------------------------------------------------------
+    // remove presentity group member
+    //
+    // expect events:
+    // - request complete,
+
+    MXIMPIdentity* member = context->ObjectFactory().NewIdentityLC();
+    member->SetIdentityL( KMemberId );
+
+    // normal request complete
+    TXIMPRequestId reqIdDummy;  // not checked
+    CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+    iListener2->ExpectL( evReqComplete );
+    CleanupStack::Pop( evReqComplete );
+
+    // do the call
+    TXIMPRequestId reqId = presGroup.RemovePresentityGroupMemberL(
+            *iCurrentGrId, *member );
+
+    // and wait
+    EUNIT_ASSERT_DESC( KErrNone == iListener2->WaitAndAssertL(), "RemovePresentityGroupMemberL failed" );
+
+    messenger->AssertRemovePresentityGroupMemberCalled( ETrue );
+
+    // ------------------------------------------------------
+    CleanupStack::PopAndDestroy(); //member
+    }
+
+// ------------------------------------------------------
+// test updating members
+// ------------------------------------------------------
+//
+void T_PresenceGroupMemberManagement::T_TestUpdateMembers_L()
+    {
+    // add a member
+    T_TestAddMembersL();
+
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    MXIMPContext* context = wrapper->GetContext();
+    CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+    // Get the interfaces
+    MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+    MPresentityGroups& presGroup = presFeat->PresentityGroups();
+
+    // Tell the protocol it should act normally
+    messenger->SetNoError();
+
+    // ------------------------------------------------------
+    // update presentity group member
+    //
+    // expect events:
+    // - request complete,
+    // - presentitygroupcontentevent
+
+    MXIMPIdentity* member = context->ObjectFactory().NewIdentityLC();
+    member->SetIdentityL( KMemberId );
+
+    // group content request complete
+    TXIMPRequestId reqIdDummy;  // not checked
+    CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+    CXIMPIdentityImp* identity = CXIMPIdentityImp::NewLC( iCurrentGrId->Identity() );
+    evReqComplete->AppendParamL( identity );
+    CleanupStack::Pop( identity );
+
+    CPresentityGroupMemberInfoImp* mbrInfo = CPresentityGroupMemberInfoImp::NewLC( *member, KMemberDisplayName2 );
+    evReqComplete->AppendParamL( mbrInfo );
+    CleanupStack::Pop( mbrInfo );
+
+    iListener2->ExpectL( evReqComplete );
+    CleanupStack::Pop( evReqComplete );
+
+    // group content event
+    CPresentityGroupContentEventImp* groupCntEvent =
+        XIMPTestEventFactory::CreateGroupContentEventLCX(
+                iCurrentGrId->Identity(),
+                KMemberId,
+                KMemberDisplayName2,
+                XIMPTestEventFactory::ETestPGLCntUpdated,
+                KMemberId,
+                KMemberDisplayName2,
+                MXIMPDataSubscriptionState::ESubscriptionActive,
+                MXIMPDataSubscriptionState::EDataAvailable
+                );
+
+    iListener2->ExpectL( groupCntEvent );
+    CleanupStack::Pop( groupCntEvent ); // 5 more items in cleanupstack
+
+    // do the call
+    TXIMPRequestId reqId = presGroup.UpdatePresentityGroupMemberDisplayNameL(
+            *iCurrentGrId, *member, KMemberDisplayName2 );
+
+    // and wait
+    EUNIT_ASSERT_DESC( KErrNone == iListener2->WaitAndAssertL(), "UpdatePresentityGroupMemberDisplayNameL failed" );
+    CleanupStack::PopAndDestroy( 5 ); // lists from groupCntEvent
+
+    messenger->AssertUpdatePresentityGroupMemberDisplayNameCalled( ETrue );
+
+    // ------------------------------------------------------
+    CleanupStack::PopAndDestroy();
+    }
+
+// ------------------------------------------------------
+// test updating members (nonsubscribed)
+// ------------------------------------------------------
+//
+void T_PresenceGroupMemberManagement::T_TestUpdateMembers_NonSub_L()
+    {
+    // add a member
+    T_TestAddMembers_NonSub_L();
+
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    MXIMPContext* context = wrapper->GetContext();
+    CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+    // Get the interfaces
+    MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+    MPresentityGroups& presGroup = presFeat->PresentityGroups();
+
+    // Tell the protocol it should act normally
+    messenger->SetNoError();
+
+    // ------------------------------------------------------
+    // update presentity group member
+    //
+    // expect events:
+    // - request complete,
+
+    MXIMPIdentity* member = context->ObjectFactory().NewIdentityLC();
+    member->SetIdentityL( KMemberId );
+
+    // group content request complete
+    TXIMPRequestId reqIdDummy;  // not checked
+    CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+    CXIMPIdentityImp* identity = CXIMPIdentityImp::NewLC( iCurrentGrId->Identity() );
+    evReqComplete->AppendParamL( identity );
+    CleanupStack::Pop( identity );
+
+    CPresentityGroupMemberInfoImp* mbrInfo = CPresentityGroupMemberInfoImp::NewLC( *member, KMemberDisplayName2 );
+    evReqComplete->AppendParamL( mbrInfo );
+    CleanupStack::Pop( mbrInfo );
+
+    iListener2->ExpectL( evReqComplete );
+    CleanupStack::Pop( evReqComplete );
+
+    // do the call
+    TXIMPRequestId reqId = presGroup.UpdatePresentityGroupMemberDisplayNameL(
+            *iCurrentGrId, *member, KMemberDisplayName2 );
+
+    // and wait
+    EUNIT_ASSERT_DESC( KErrNone == iListener2->WaitAndAssertL(), "UpdatePresentityGroupMemberDisplayNameL failed" );
+
+    messenger->AssertUpdatePresentityGroupMemberDisplayNameCalled( ETrue );
+
+    // ------------------------------------------------------
+    CleanupStack::PopAndDestroy();
+    }
+
+// ------------------------------------------------------
+// test updating members with non-existing id
+// ------------------------------------------------------
+//
+void T_PresenceGroupMemberManagement::T_TestUpdateMembers_NonExisting_L()
+    {
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    MXIMPContext* context = wrapper->GetContext();
+    CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+    // Get the interfaces
+    MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+    MPresentityGroups& presGroup = presFeat->PresentityGroups();
+    
+    // Tell the protocol it should act normally
+    messenger->SetNoError();
+
+    // ------------------------------------------------------
+    // update presentity group member
+    //
+    // expect events:
+    // - request complete,
+
+    MXIMPIdentity* member = context->ObjectFactory().NewIdentityLC();
+    member->SetIdentityL( KMemberId );
+
+    // group content request complete
+    TXIMPRequestId reqIdDummy;  // not checked
+    CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+    CXIMPIdentityImp* identity = CXIMPIdentityImp::NewLC( iCurrentGrId->Identity() );
+    evReqComplete->AppendParamL( identity );
+    CleanupStack::Pop( identity );
+
+    CPresentityGroupMemberInfoImp* mbrInfo = CPresentityGroupMemberInfoImp::NewLC( *member, KMemberDisplayName2 );
+    evReqComplete->AppendParamL( mbrInfo );
+    CleanupStack::Pop( mbrInfo );
+
+    iListener2->ExpectL( evReqComplete );
+    CleanupStack::Pop( evReqComplete );
+
+    // do the call
+    TXIMPRequestId reqId = presGroup.UpdatePresentityGroupMemberDisplayNameL(
+            *iCurrentGrId, *member, KMemberDisplayName2 );
+
+    // and wait
+    EUNIT_ASSERT_DESC( KErrNone == iListener2->WaitAndAssertL(), "UpdatePresentityGroupMemberDisplayNameL failed" );
+
+    messenger->AssertUpdatePresentityGroupMemberDisplayNameCalled( ETrue );
+
+    // ------------------------------------------------------
+    CleanupStack::PopAndDestroy();
+    }
+
+// ===========================================================================
+// Test case methods
+// ===========================================================================
+
+// Subscribe and unsubscribe test
+void T_PresenceGroupMemberManagement::T_SubUnsubGroupContent_Single_L()
+    {
+    EUNIT_PRINT( _L("Single presentity group content sub and unsub") );
+
+    TXIMPCallBack callback = &T_PresenceGroupMemberManagement::T_EmptyFunc;
+    T_GenericSubAndUnsubL( callback );
+    }
+
+// subscribe and unsubscribe, altered id
+void T_PresenceGroupMemberManagement::T_SubUnsubGroupContent_Altered_Single_L()
+    {
+    EUNIT_PRINT( _L("Single presentity group content sub and unsub with altered id") );
+
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    wrapper->BindL( 0 );
+
+    // ------------------------------------------------------
+    // some startup stuff
+    MXIMPContext* context = wrapper->GetContext();
+    CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+    // Get the interfaces
+    MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+    MPresentityGroups& presGroup = presFeat->PresentityGroups();
+
+    iListener2 = CXIMPTestListener::NewL( context );
+    // ------------------------------------------------------
+
+    // Tell the protocol it should act normally
+    wrapper->GetMessenger()->SetNoError();
+
+    iCurrentGrId = context->ObjectFactory().NewIdentityLC();
+    CleanupStack::Pop(); // iCurrentGrId
+    iCurrentGrId->SetIdentityL( KGroupId );
+
+    // ------------------------------------------------------
+    // create presentity group
+    //
+    // expect events:
+    // - request complete.
+    // NOTE: no presentitygrouplistevent as we've not subscribed the group lists
+
+    // normal request complete
+    TXIMPRequestId reqIdDummy;  // not checked
+    CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+
+    // identity + displayname
+    CPresentityGroupInfoImp* infoImp = CPresentityGroupInfoImp::NewLC( *iCurrentGrId, KGroupDisplayName );
+    evReqComplete->AppendParamL( infoImp );
+    CleanupStack::Pop( infoImp );
+
+    iListener2->ExpectL( evReqComplete );
+    CleanupStack::Pop( evReqComplete );
+
+    TXIMPRequestId reqId = presGroup.CreatePresentityGroupL( *iCurrentGrId, KGroupDisplayName );
+
+    // and wait
+    EUNIT_ASSERT_DESC( KErrNone == iListener2->WaitAndAssertL(), "CreatePresentityGroupL failed" );
+    messenger->AssertCreatePresentityGroupCalled( ETrue );
+
+    // ------------------------------------------------------
+    // subscribe presentity group CONTENT
+    //
+    // expect events:
+    // - request complete
+    evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+    iListener2->ExpectL( evReqComplete );
+    CleanupStack::Pop( evReqComplete );
+
+    // tell the test protocol to send back an altered id
+    MXIMPIdentity* identityParam = context->ObjectFactory().NewIdentityLC();
+    identityParam->SetIdentityL( KGroupId2 );
+
+    CXIMPIdentityImp* identityParamImp =
+             ( CXIMPIdentityImp* ) identityParam->GetInterface(
+                                        CXIMPIdentityImp::KClassId,
+                                        MXIMPBase::EPanicIfUnknown );
+    HBufC8* packedId = TXIMPObjectPacker< CXIMPIdentityImp >::PackL( *identityParamImp );
+    CleanupStack::PopAndDestroy(); // identityParam
+    CleanupStack::PushL( packedId );
+    CXIMPTestFileSrvMsg* srvMsg = CXIMPTestFileSrvMsg::NewL( CXIMPTestFileSrvMsg::ETestSrvMsgReqParamIdentity,
+                                                             *packedId );
+    CleanupStack::PopAndDestroy( packedId );
+    CleanupStack::PushL( srvMsg );
+    wrapper->FileTool().SrvMsgStoreL( srvMsg );
+    CleanupStack::PopAndDestroy( srvMsg );
+
+    // Wait for server to handle srvmsg.
+    User::After( 2 );
+    // now the adaptation should know how to answer
+
+    // do the call
+    reqId = presGroup.SubscribePresentityGroupContentL( *iCurrentGrId );
+
+    // and wait
+    EUNIT_ASSERT_DESC( KErrNone == iListener2->WaitAndAssertL(), "SubscribePresentityGroupContentL failed" );
+
+    // verify that subscribe was called
+    messenger->AssertSubscribePresentityGroupContentCalled( ETrue );
+
+    // ------------------------------------------------------
+
+    // make sure the new listener is not listening for events!
+    iListener2->SetEventSourceL( NULL );
+
+    wrapper->UnbindL();
+
+    TeardownTestSupport();
+    }
+
+// subscribe and unsubscribe, altered id is the same
+void T_PresenceGroupMemberManagement::T_SubUnsubGroupContent_AlteredSame_Single_L()
+    {
+    EUNIT_PRINT( _L("Single presentity group content sub and unsub with altered but same id") );
+
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    wrapper->BindL( 0 );
+
+    // ------------------------------------------------------
+    // some startup stuff
+    MXIMPContext* context = wrapper->GetContext();
+    CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+    // Get the interfaces
+    MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+    MPresentityGroups& presGroup = presFeat->PresentityGroups();
+
+    iListener2 = CXIMPTestListener::NewL( context );
+    // ------------------------------------------------------
+
+    // Tell the protocol it should act normally
+    wrapper->GetMessenger()->SetNoError();
+
+    iCurrentGrId = context->ObjectFactory().NewIdentityLC();
+    CleanupStack::Pop(); // iCurrentGrId
+    iCurrentGrId->SetIdentityL( KGroupId );
+
+    // ------------------------------------------------------
+    // create presentity group
+    //
+    // expect events:
+    // - request complete.
+    // NOTE: no presentitygrouplistevent as we've not subscribed the group lists
+
+    // normal request complete
+    TXIMPRequestId reqIdDummy;  // not checked
+    CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+
+    // identity + displayname
+    CPresentityGroupInfoImp* infoImp = CPresentityGroupInfoImp::NewLC( *iCurrentGrId, KGroupDisplayName );
+    evReqComplete->AppendParamL( infoImp );
+    CleanupStack::Pop( infoImp );
+
+    iListener2->ExpectL( evReqComplete );
+    CleanupStack::Pop( evReqComplete );
+
+    TXIMPRequestId reqId = presGroup.CreatePresentityGroupL( *iCurrentGrId, KGroupDisplayName );
+
+    // and wait
+    EUNIT_ASSERT_DESC( KErrNone == iListener2->WaitAndAssertL(), "CreatePresentityGroupL failed" );
+    messenger->AssertCreatePresentityGroupCalled( ETrue );
+
+    // ------------------------------------------------------
+    // subscribe presentity group CONTENT
+    //
+    // expect events:
+    // - request complete
+    evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+    iListener2->ExpectL( evReqComplete );
+    CleanupStack::Pop( evReqComplete );
+
+    // tell the test protocol to send back an altered id
+    MXIMPIdentity* identityParam = context->ObjectFactory().NewIdentityLC();
+    identityParam->SetIdentityL( KGroupId );
+
+    CXIMPIdentityImp* identityParamImp =
+             ( CXIMPIdentityImp* ) identityParam->GetInterface(
+                                        CXIMPIdentityImp::KClassId,
+                                        MXIMPBase::EPanicIfUnknown );
+    HBufC8* packedId = TXIMPObjectPacker< CXIMPIdentityImp >::PackL( *identityParamImp );
+    CleanupStack::PopAndDestroy(); // identityParam
+    CleanupStack::PushL( packedId );
+    CXIMPTestFileSrvMsg* srvMsg = CXIMPTestFileSrvMsg::NewL( CXIMPTestFileSrvMsg::ETestSrvMsgReqParamIdentity,
+                                                             *packedId );
+    CleanupStack::PopAndDestroy( packedId );
+    CleanupStack::PushL( srvMsg );
+    wrapper->FileTool().SrvMsgStoreL( srvMsg );
+    CleanupStack::PopAndDestroy( srvMsg );
+
+    // Wait for server to handle srvmsg.
+    User::After( 2 );
+    // now the adaptation should know how to answer
+
+    // do the call
+    reqId = presGroup.SubscribePresentityGroupContentL( *iCurrentGrId );
+
+    // and wait
+    EUNIT_ASSERT_DESC( KErrNone == iListener2->WaitAndAssertL(), "SubscribePresentityGroupContentL failed" );
+
+    // verify that subscribe was called
+    messenger->AssertSubscribePresentityGroupContentCalled( ETrue );
+
+    // ------------------------------------------------------
+
+    // make sure the new listener is not listening for events!
+    iListener2->SetEventSourceL( NULL );
+
+    wrapper->UnbindL();
+
+    TeardownTestSupport();
+    }
+
+
+// Add members
+void T_PresenceGroupMemberManagement::T_AddGroupMembers_Single_L()
+    {
+    EUNIT_PRINT( _L("Single add members to group") );
+
+    TXIMPCallBack callback = &T_PresenceGroupMemberManagement::T_TestAddMembersL;
+    T_GenericSubAndUnsubL( callback );
+    }
+
+// Remove members
+void T_PresenceGroupMemberManagement::T_RemoveGroupMembers_Single_L()
+    {
+    EUNIT_PRINT( _L("Single remove member of group") );
+
+    TXIMPCallBack callback = &T_PresenceGroupMemberManagement::T_TestRemoveMembersL;
+    T_GenericSubAndUnsubL( callback );
+    }
+
+// Update members
+void T_PresenceGroupMemberManagement::T_UpdateGroupMembers_Single_L()
+    {
+    EUNIT_PRINT( _L("Single update member of group") );
+
+    TXIMPCallBack callback = &T_PresenceGroupMemberManagement::T_TestUpdateMembers_L;
+    T_GenericSubAndUnsubL( callback );
+    }
+
+// Update members without subscription
+void T_PresenceGroupMemberManagement::T_UpdateGroupMembers_NonSub_Single_L()
+    {
+    EUNIT_PRINT( _L("Single update member of group, unsubscribed") );
+
+    TXIMPCallBack callback = &T_PresenceGroupMemberManagement::T_TestUpdateMembers_NonSub_L;
+    iSkipSubscribe = ETrue;
+    iSkipUnsubscribe = ETrue;
+    T_GenericSubAndUnsubL( callback );
+    }
+
+// Update members with non-existing member
+void T_PresenceGroupMemberManagement::T_UpdateGroupMembers_NonExist_Single_L()
+    {
+    EUNIT_PRINT( _L("Single update nonexisting member of group") );
+
+    TXIMPCallBack callback = &T_PresenceGroupMemberManagement::T_TestUpdateMembers_NonExisting_L;
+    T_GenericSubAndUnsubL( callback );
+    }
+
+// Remove members without subscription
+void T_PresenceGroupMemberManagement::T_RemoveGroupMembers_NonSub_Single_L()
+    {
+    EUNIT_PRINT( _L("Single remove member of group, unsubscribed") );
+
+    TXIMPCallBack callback = &T_PresenceGroupMemberManagement::T_TestRemoveMembers_NonSub_L;
+    iSkipSubscribe = ETrue;
+    iSkipUnsubscribe = ETrue;
+    T_GenericSubAndUnsubL( callback );
+    }
+
+// Remove members with non-existing member
+void T_PresenceGroupMemberManagement::T_RemoveGroupMembers_NonExist_Single_L()
+    {
+    EUNIT_PRINT( _L("Single remove nonexisting member of group") );
+
+    TXIMPCallBack callback = &T_PresenceGroupMemberManagement::T_TestRemoveMembers_NonExisting_L;
+    T_GenericSubAndUnsubL( callback );
+    }
+
+// ------------------------------------------------------
+// expire non-subscribed data
+// ------------------------------------------------------
+//
+void T_PresenceGroupMemberManagement::T_ExpireNonSubscribedData_L()
+    {
+    EUNIT_PRINT( _L("Expire non subscribed data") );
+
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    wrapper->BindL( 0 );
+
+    MXIMPContext* context = wrapper->GetContext();
+    CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+    // Get the interfaces
+    MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+    MPresentityGroups& presGroup = presFeat->PresentityGroups();
+
+    iCurrentGrId = context->ObjectFactory().NewIdentityLC();
+    CleanupStack::Pop(); // iCurrentGrId
+    iCurrentGrId->SetIdentityL( KGroupId );
+
+    // Tell the protocol it should act normally
+    messenger->SetNoError();
+
+    // 1. Create notification
+    RXIMPObjOwningPtrArray<CPresentityGroupMemberInfoImp> groupMemberList;
+    CXIMPIdentityImp* identityImp =
+             ( CXIMPIdentityImp* ) iCurrentGrId->GetInterface(
+                                        CXIMPIdentityImp::KClassId,
+                                        MXIMPBase::EPanicIfUnknown );
+    HBufC8* packedId = TXIMPObjectPacker< CXIMPIdentityImp >::PackL( *identityImp );
+    CleanupStack::PushL( packedId );
+    HBufC8* packedArray = TXIMPObjectPacker<CPresentityGroupMemberInfoImp>::PackArrayL( groupMemberList );
+    CleanupStack::PushL( packedArray );
+    RPointerArray< HBufC8 > bufferArray;
+    CleanupClosePushL( bufferArray );
+    bufferArray.AppendL( packedId );
+    bufferArray.AppendL( packedArray );
+    HBufC8* packedBufferArray = TXIMPHBuf8Packer::PackArrayL( bufferArray );
+    CleanupStack::PopAndDestroy( 2, packedArray ); // bufferArray, packedArray
+    CleanupStack::PushL( packedBufferArray );
+
+    // 2. Use filetool to send it for plugin.
+    CXIMPTestFileSrvMsg* srvMsg = CXIMPTestFileSrvMsg::NewL( CXIMPTestFileSrvMsg::ETestSrvMsgPresentityGroupMemberList,
+                                                             *packedBufferArray );
+    CleanupStack::PopAndDestroy( packedBufferArray );
+    CleanupStack::PushL( srvMsg );
+    wrapper->FileTool().CleanAllL();
+    wrapper->FileTool().SrvMsgStoreL( srvMsg );
+    CleanupStack::PopAndDestroy( srvMsg );
+
+    // Wait for server to handle srvmsg.
+    CXIMPTestWaitHelper* wait = CXIMPTestWaitHelper::NewL();
+    CleanupStack::PushL( wait );
+    wait->WaitForL( 2 );
+
+    // 3. Create and send check notification to server
+    srvMsg = CXIMPTestFileSrvMsg::NewL( CXIMPTestFileSrvMsg::ETestCheckIfGroupMemberExists,
+                                                             *packedId );
+    CleanupStack::PushL( srvMsg );
+    wrapper->FileTool().SrvMsgStoreL( srvMsg );
+
+    // Wait for server to handle srvmsg.
+    wait->WaitForL( 2 );
+
+    TInt value = messenger->GetValueFor( EXIMPPlgTestExistsGroupContentInCache );
+    EUNIT_ASSERT_DESC( value == 1, "Data not cached temporarly" );
+
+   // 4. Wait for cache to clear.
+    wait->WaitForL( 15 );
+
+    // 5. Send check notification to server
+    wrapper->FileTool().SrvMsgStoreL( srvMsg );
+    CleanupStack::PopAndDestroy( srvMsg );
+
+    // Wait for server to handle srvmsg.
+    wait->WaitForL( 2 );
+    CleanupStack::PopAndDestroy( wait );
+    CleanupStack::PopAndDestroy( packedId );
+    value = messenger->GetValueFor( EXIMPPlgTestExistsGroupContentInCache );
+    EUNIT_ASSERT_DESC( value == KErrNotFound, "Data not cleared like it should" );
+    wrapper->UnbindL();
+    }
+
+// ------------------------------------------------------
+// expire non-subscribed data, update multiple
+// ------------------------------------------------------
+//
+void T_PresenceGroupMemberManagement::T_ExpireNonSubscribedDataUpdateMultiple_L()
+    {
+    EUNIT_PRINT( _L("Expire non subscribed data, update multiple") );
+
+    // Wait for server to handle srvmsg.
+    CXIMPTestWaitHelper* wait = CXIMPTestWaitHelper::NewL();
+    CleanupStack::PushL( wait );
+
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    wrapper->BindL( 0 );
+
+    MXIMPContext* context = wrapper->GetContext();
+    CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+    // Get the interfaces
+    MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+    MPresentityGroups& presGroup = presFeat->PresentityGroups();
+
+    iCurrentGrId = context->ObjectFactory().NewIdentityLC();
+    CleanupStack::Pop(); // iCurrentGrId
+    iCurrentGrId->SetIdentityL( KGroupId );
+
+    // Tell the protocol it should act normally
+    messenger->SetNoError();
+
+    // 1. Create notification
+    RXIMPObjOwningPtrArray<CPresentityGroupMemberInfoImp> groupMemberList;
+    CXIMPIdentityImp* identityImp =
+             ( CXIMPIdentityImp* ) iCurrentGrId->GetInterface(
+                                        CXIMPIdentityImp::KClassId,
+                                        MXIMPBase::EPanicIfUnknown );
+    HBufC8* packedId = TXIMPObjectPacker< CXIMPIdentityImp >::PackL( *identityImp );
+    CleanupStack::PushL( packedId );
+    HBufC8* packedArray = TXIMPObjectPacker<CPresentityGroupMemberInfoImp>::PackArrayL( groupMemberList );
+    CleanupStack::PushL( packedArray );
+    RPointerArray< HBufC8 > bufferArray;
+    CleanupClosePushL( bufferArray );
+    bufferArray.AppendL( packedId );
+    bufferArray.AppendL( packedArray );
+    HBufC8* packedBufferArray = TXIMPHBuf8Packer::PackArrayL( bufferArray );
+    CleanupStack::PopAndDestroy( 2, packedArray ); // bufferArray, packedArray
+    CleanupStack::PushL( packedBufferArray );
+
+    // 2. Use filetool to send it for plugin.
+    CXIMPTestFileSrvMsg* srvMsg = CXIMPTestFileSrvMsg::NewL( CXIMPTestFileSrvMsg::ETestSrvMsgPresentityGroupMemberList,
+                                                             *packedBufferArray );
+    CleanupStack::PopAndDestroy( packedBufferArray );
+    CleanupStack::PushL( srvMsg );
+    wrapper->FileTool().CleanAllL();
+    wrapper->FileTool().SrvMsgStoreL( srvMsg );
+
+    wait->WaitForL( 2 );
+
+    // 3. Create and send check notification to server
+    CXIMPTestFileSrvMsg* srvMsg2 = CXIMPTestFileSrvMsg::NewL( CXIMPTestFileSrvMsg::ETestCheckIfGroupMemberExists,
+                                                             *packedId );
+    CleanupStack::PushL( srvMsg2 );
+    wrapper->FileTool().SrvMsgStoreL( srvMsg2 );
+
+    // Wait for server to handle srvmsg.
+    wait->WaitForL( 2 );
+
+    TInt value = messenger->GetValueFor( EXIMPPlgTestExistsGroupContentInCache );
+    EUNIT_ASSERT_DESC( value == 1, "Data not cached temporarly" );
+
+   // 4. Wait for cache to clear.
+    wait->WaitForL( 5 );
+
+    // Refresh temporar cache.
+    wrapper->FileTool().SrvMsgStoreL( srvMsg );
+
+   // 4. Wait for cache to clear.
+    wait->WaitForL( 10 );
+
+    // 5. Send check notification to server
+    wrapper->FileTool().SrvMsgStoreL( srvMsg2 );
+    CleanupStack::PopAndDestroy( 3, packedId ); //packedId, srvMsg, srvMsg2
+
+    // Wait for server to handle srvmsg.
+    wait->WaitForL( 2 );
+    value = messenger->GetValueFor( EXIMPPlgTestExistsGroupContentInCache );
+    EUNIT_ASSERT_DESC( value == 1, "Data not cached temporarly, but it should be" );
+
+    wrapper->UnbindL();
+
+    CleanupStack::PopAndDestroy( wait );
+    }
+
+// ------------------------------------------------------
+// General subscribe and unsubscribe for multiple
+// ------------------------------------------------------
+//
+void T_PresenceGroupMemberManagement::T_SubUnsubGroupContent_Multi_L()
+    {
+    BindAllL();
+
+    TInt countOfWrappers = iWrapperMgr->WrapperCount();
+
+    CXIMPObjectFactoryImp* factory = CXIMPObjectFactoryImp::NewL();
+    CleanupStack::PushL( factory );
+
+    MXIMPIdentity* currentGrId = factory->NewIdentityLC();
+    currentGrId->SetIdentityL( KGroupId );
+
+    // create group to all connections
+    for ( TInt i = 0; i < countOfWrappers; i++ )
+        {
+        CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( i );
+
+        // ------------------------------------------------------
+        // some startup stuff
+        MXIMPContext* context = wrapper->GetContext();
+        CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+        // Get the interfaces
+        MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+        MPresentityGroups& presGroup = presFeat->PresentityGroups();
+
+        CXIMPTestListener* listener = CXIMPTestListener::NewL( context );
+        CleanupStack::PushL( listener );
+        // ------------------------------------------------------
+
+        // Tell the protocol it should act normally
+        wrapper->GetMessenger()->SetNoError();
+
+        // ------------------------------------------------------
+        // create presentity group
+        //
+        // expect events:
+        // - request complete.
+        // NOTE: no presentitygrouplistevent as we've not subscribed the group lists
+
+        // normal request complete
+        TXIMPRequestId reqIdDummy;  // not checked
+        CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+
+        // identity + displayname
+        CPresentityGroupInfoImp* infoImp = CPresentityGroupInfoImp::NewLC( *currentGrId, KGroupDisplayName );
+        evReqComplete->AppendParamL( infoImp );
+        CleanupStack::Pop( infoImp );
+
+        listener->ExpectL( evReqComplete );
+        CleanupStack::Pop( evReqComplete );
+
+        TXIMPRequestId reqId = presGroup.CreatePresentityGroupL( *currentGrId, KGroupDisplayName );
+
+        // and wait
+        EUNIT_ASSERT_DESC( KErrNone == listener->WaitAndAssertL(), "CreatePresentityGroupL failed" );
+
+        // verify that create was called
+        messenger->AssertCreatePresentityGroupCalled( ETrue );
+
+        CleanupStack::PopAndDestroy( listener );
+        }
+
+    // subscribe presentity group content in all connections
+    for ( TInt i = 0; i < countOfWrappers; i++ )
+        {
+        CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( i );
+
+        // ------------------------------------------------------
+        // some startup stuff
+        MXIMPContext* context = wrapper->GetContext();
+        CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+        // Get the interfaces
+        MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+        MPresentityGroups& presGroup = presFeat->PresentityGroups();
+
+        CXIMPTestListener* listener = CXIMPTestListener::NewL( context );
+        CleanupStack::PushL( listener );
+        // ------------------------------------------------------
+
+        // ------------------------------------------------------
+        // subscribe presentity group CONTENT
+        //
+        // expect events:
+        // - request complete
+        TXIMPRequestId reqIdDummy;  // not checked
+        CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+        listener->ExpectL( evReqComplete );
+        CleanupStack::Pop( evReqComplete );
+
+        // do the call
+        TXIMPRequestId reqId = presGroup.SubscribePresentityGroupContentL( *currentGrId );
+
+        // and wait
+        EUNIT_ASSERT_DESC( KErrNone == listener->WaitAndAssertL(), "SubscribePresentityGroupContentL failed" );
+
+        // verify that subscribe was called
+        messenger->AssertSubscribePresentityGroupContentCalled( ETrue );
+
+        CleanupStack::PopAndDestroy( listener );
+        }
+
+    // unsubscribe presentity group content in all connections
+    for ( TInt i = 0; i < countOfWrappers; i++ )
+        {
+        CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( i );
+
+        // ------------------------------------------------------
+        // some startup stuff
+        MXIMPContext* context = wrapper->GetContext();
+        CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+        // Get the interfaces
+        MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+        MPresentityGroups& presGroup = presFeat->PresentityGroups();
+
+        CXIMPTestListener* listener = CXIMPTestListener::NewL( context );
+        CleanupStack::PushL( listener );
+        // ------------------------------------------------------
+
+        // ------------------------------------------------------
+        // unsubscribe presentity group content
+        //
+        // expect events:
+        // - request complete
+        // - presentity group content event
+
+        TXIMPRequestId reqIdDummy;  // not checked
+        CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+        listener->ExpectL( evReqComplete );
+        CleanupStack::Pop( evReqComplete );
+
+        CPresentityGroupContentEventImp* groupCntEvent =
+            XIMPTestEventFactory::CreateGroupContentEventLCX(
+                    KGroupId,
+                    KNullDesC,
+                    KNullDesC,
+                    XIMPTestEventFactory::ETestPGLCntRemoved,
+                    KNullDesC,
+                    KNullDesC,
+                    MXIMPDataSubscriptionState::ESubscriptionInactive,
+                    MXIMPDataSubscriptionState::EDataUnavailable
+                    );
+
+        listener->ExpectL( groupCntEvent );
+        CleanupStack::Pop( groupCntEvent ); // 5 more items in cleanupstack
+
+        // do the call
+        TXIMPRequestId reqId = presGroup.UnsubscribePresentityGroupContentL( *currentGrId );
+
+        // and wait
+        EUNIT_ASSERT_DESC( KErrNone == listener->WaitAndAssertL(), "UnsubscribePresentityGroupContentL failed" );
+        CleanupStack::PopAndDestroy( 5 ); // lists
+
+        // verify that unsubscribe was called
+        // unsubscribe really called only on the last one
+        messenger->AssertUnsubscribePresentityGroupContentCalled( i == countOfWrappers-1 ? ETrue : EFalse );
+
+        CleanupStack::PopAndDestroy( listener );
+        }
+
+    // delete presentity group in all connections
+    for ( TInt i = 0; i < countOfWrappers; i++ )
+        {
+        CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( i );
+
+        // ------------------------------------------------------
+        // some startup stuff
+        MXIMPContext* context = wrapper->GetContext();
+        CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+        // Get the interfaces
+        MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+        MPresentityGroups& presGroup = presFeat->PresentityGroups();
+
+        CXIMPTestListener* listener = CXIMPTestListener::NewL( context );
+        CleanupStack::PushL( listener );
+        // ------------------------------------------------------
+
+        // ------------------------------------------------------
+        // delete presentity group
+        //
+        // expect events:
+        // - request complete
+        // NO presentity group content event as we've just unsubscribed it.
+
+        TXIMPRequestId reqIdDummy;  // not checked
+        CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+        listener->ExpectL( evReqComplete );
+        CleanupStack::Pop( evReqComplete );
+
+        // do the call
+        TXIMPRequestId reqId = presGroup.DeletePresentityGroupL( *currentGrId );
+
+        // and wait
+        EUNIT_ASSERT_DESC( KErrNone == listener->WaitAndAssertL(), "DeletePresentityGroupL failed" );
+
+        CleanupStack::PopAndDestroy( listener );
+        }
+
+    // ------------------------------------------------------
+
+    CleanupStack::PopAndDestroy( 2 ); // currentGrId, factory
+
+
+    UnbindAllL();
+
+    TeardownTestSupport();
+    }
+
+// ------------------------------------------------------
+// General subscribe and unsubscribe for multiple
+// Subscribed for all contexts, force refresh
+// ------------------------------------------------------
+//
+void T_PresenceGroupMemberManagement::T_SubUnsubGroupContent_All_Multi_L()
+    {
+    BindAllL();
+
+    TInt countOfWrappers = iWrapperMgr->WrapperCount();
+
+    CXIMPObjectFactoryImp* factory = CXIMPObjectFactoryImp::NewL();
+    CleanupStack::PushL( factory );
+
+    MXIMPIdentity* currentGrId = factory->NewIdentityLC();
+    currentGrId->SetIdentityL( KGroupId );
+
+    // create group to all connections
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+
+    // ------------------------------------------------------
+    // some startup stuff
+    MXIMPContext* context = wrapper->GetContext();
+    CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+    // Get the interfaces
+    MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+    MPresentityGroups& presGroup = presFeat->PresentityGroups();
+
+    CXIMPTestListener* listener = CXIMPTestListener::NewL( context );
+    CleanupStack::PushL( listener );
+    // ------------------------------------------------------
+
+    // Tell the protocol it should act normally
+    wrapper->GetMessenger()->SetNoError();
+
+    // ------------------------------------------------------
+    // create presentity group
+    //
+    // expect events:
+    // - request complete.
+    // NOTE: no presentitygrouplistevent as we've not subscribed the group lists
+
+    // normal request complete
+    TXIMPRequestId reqIdDummy;  // not checked
+    CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+
+    // identity + displayname
+    CPresentityGroupInfoImp* infoImp = CPresentityGroupInfoImp::NewLC( *currentGrId, KGroupDisplayName );
+    evReqComplete->AppendParamL( infoImp );
+    CleanupStack::Pop( infoImp );
+
+    listener->ExpectL( evReqComplete );
+    CleanupStack::Pop( evReqComplete );
+
+    TXIMPRequestId reqId = presGroup.CreatePresentityGroupL( *currentGrId, KGroupDisplayName );
+
+    // and wait
+    EUNIT_ASSERT_DESC( KErrNone == listener->WaitAndAssertL(), "CreatePresentityGroupL failed" );
+
+    // verify that create was called
+    messenger->AssertCreatePresentityGroupCalled( ETrue );
+
+    // we'll make a new listener below, disable temporarily
+    listener->SetEventSourceL( NULL );
+
+    // subscribe presentity group content in all connections
+    for ( TInt i = 0; i < countOfWrappers; i++ )
+        {
+        CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( i );
+
+        // ------------------------------------------------------
+        // some startup stuff
+        MXIMPContext* context = wrapper->GetContext();
+        CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+        // Get the interfaces
+        MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+        MPresentityGroups& presGroup = presFeat->PresentityGroups();
+
+        CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context );
+        CleanupStack::PushL( listener2 );
+        // ------------------------------------------------------
+
+        // ------------------------------------------------------
+        // subscribe presentity group content for ALL contexts
+        //
+        // expect events:
+        // - request complete
+        evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+        listener2->ExpectL( evReqComplete );
+        CleanupStack::Pop( evReqComplete );
+
+        // do the call
+        reqId = presGroup.SubscribePresentityGroupContentL( *currentGrId );
+
+        // and wait
+        EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "SubscribePresentityGroupContentL failed" );
+
+        // verify that subscribe was called for first only
+        if ( i == 0 )
+            {
+            messenger->AssertSubscribePresentityGroupContentCalled( ETrue );
+            // reset flag
+            messenger->SetValueFor(
+                    EXIMPPlgTestSubscribePresentityGroupContentCalled,
+                    EFalse );
+            }
+        else
+            {
+            messenger->AssertSubscribePresentityGroupContentCalled( EFalse );
+            }
+
+        CleanupStack::PopAndDestroy( listener2 );
+        }
+
+    for ( TInt i = 0; i < countOfWrappers; i++ )
+        {
+        CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( i );
+
+        // ------------------------------------------------------
+        // some startup stuff
+        MXIMPContext* context = wrapper->GetContext();
+        CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+        // Get the interfaces
+        MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+        MPresentityGroups& presGroup = presFeat->PresentityGroups();
+
+        CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context );
+        CleanupStack::PushL( listener2 );
+        // ------------------------------------------------------
+
+        // ------------------------------------------------------
+        // subscribe presentity group content, making a REFRESH case
+        // with multiple contexts
+        //
+        // expect events:
+        // - request complete
+        // - group content event
+
+        evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+        listener2->ExpectL( evReqComplete );
+        CleanupStack::Pop( evReqComplete );
+
+        CPresentityGroupContentEventImp* groupCntEvent =
+            XIMPTestEventFactory::CreateGroupContentEventLCX(
+                    KGroupId,
+                    KNullDesC,
+                    KNullDesC,
+                    XIMPTestEventFactory::ETestPGLCntUpdated,
+                    KNullDesC,
+                    KNullDesC,
+                    MXIMPDataSubscriptionState::ESubscriptionActive,
+                    MXIMPDataSubscriptionState::EDataUnavailable
+                    );
+
+        listener2->ExpectL( groupCntEvent );
+        CleanupStack::Pop( groupCntEvent ); // 5 more items in cleanupstack
+
+        // do the call
+        reqId = presGroup.SubscribePresentityGroupContentL( *currentGrId );
+
+        // and wait
+        EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "SubscribePresentityGroupContentL failed" );
+
+        CleanupStack::PopAndDestroy( 5 ); // rest of group the content event
+
+        // subscribe is not called in the adaptation, this is a refresh case
+        messenger->AssertSubscribePresentityGroupContentCalled( EFalse );
+
+        CleanupStack::PopAndDestroy( listener2 );
+        }
+
+    // continue listening
+    listener->SetEventSourceL( context );
+
+    // ------------------------------------------------------
+    // unsubscribe presentity group content
+    //
+    // expect events:
+    // - request complete
+    // - presentity group content event
+
+    evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+    listener->ExpectL( evReqComplete );
+    CleanupStack::Pop( evReqComplete );
+
+    CPresentityGroupContentEventImp* groupCntEvent =
+        XIMPTestEventFactory::CreateGroupContentEventLCX(
+                KGroupId,
+                KNullDesC,
+                KNullDesC,
+                XIMPTestEventFactory::ETestPGLCntRemoved,
+                KNullDesC,
+                KNullDesC,
+                MXIMPDataSubscriptionState::ESubscriptionInactive,
+                MXIMPDataSubscriptionState::EDataUnavailable
+                );
+
+    listener->ExpectL( groupCntEvent );
+    CleanupStack::Pop( groupCntEvent ); // 5 more items in cleanupstack
+
+    // do the call
+    reqId = presGroup.UnsubscribePresentityGroupContentL( *currentGrId );
+
+    // and wait
+    EUNIT_ASSERT_DESC( KErrNone == listener->WaitAndAssertL(), "UnsubscribePresentityGroupContentL failed" );
+    CleanupStack::PopAndDestroy( 5 ); // lists
+
+    // verify that unsubscribe was NOT called (other contexts are listening too),
+    // and it will be unscubscribed on the last call
+    messenger->AssertUnsubscribePresentityGroupContentCalled( EFalse );
+
+    // ------------------------------------------------------
+    // delete presentity group
+    //
+    // expect events:
+    // - request complete
+    // NO presentity group content event as we've just unsubscribed it.
+
+    evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+    listener->ExpectL( evReqComplete );
+    CleanupStack::Pop( evReqComplete );
+
+    // do the call
+    reqId = presGroup.DeletePresentityGroupL( *currentGrId );
+
+    // and wait
+    EUNIT_ASSERT_DESC( KErrNone == listener->WaitAndAssertL(), "DeletePresentityGroupL failed" );
+
+    // ------------------------------------------------------
+
+    CleanupStack::PopAndDestroy( 3 ); // listener, currentGrId, factory
+
+    UnbindAllL();
+
+    TeardownTestSupport();
+    }
+
+// ------------------------------------------------------
+// General subscribe and unsubscribe for multiple
+// Subscribed for one context only
+// ------------------------------------------------------
+//
+void T_PresenceGroupMemberManagement::T_SubUnsubGroupContent_One_Multi_L()
+    {
+    BindAllL();
+
+    CXIMPObjectFactoryImp* factory = CXIMPObjectFactoryImp::NewL();
+    CleanupStack::PushL( factory );
+
+    MXIMPIdentity* currentGrId = factory->NewIdentityLC();
+    currentGrId->SetIdentityL( KGroupId );
+
+    // create group to all connections
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+
+    // ------------------------------------------------------
+    // some startup stuff
+    MXIMPContext* context = wrapper->GetContext();
+    CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+    // Get the interfaces
+    MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+    MPresentityGroups& presGroup = presFeat->PresentityGroups();
+
+    CXIMPTestListener* listener = CXIMPTestListener::NewL( context );
+    CleanupStack::PushL( listener );
+    // ------------------------------------------------------
+
+    // Tell the protocol it should act normally
+    wrapper->GetMessenger()->SetNoError();
+
+    // ------------------------------------------------------
+    // create presentity group
+    //
+    // expect events:
+    // - request complete.
+    // NOTE: no presentitygrouplistevent as we've not subscribed the group lists
+
+    // normal request complete
+    TXIMPRequestId reqIdDummy;  // not checked
+    CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+
+    // identity + displayname
+    CPresentityGroupInfoImp* infoImp = CPresentityGroupInfoImp::NewLC( *currentGrId, KGroupDisplayName );
+    evReqComplete->AppendParamL( infoImp );
+    CleanupStack::Pop( infoImp );
+
+    listener->ExpectL( evReqComplete );
+    CleanupStack::Pop( evReqComplete );
+
+    TXIMPRequestId reqId = presGroup.CreatePresentityGroupL( *currentGrId, KGroupDisplayName );
+
+    // and wait
+    EUNIT_ASSERT_DESC( KErrNone == listener->WaitAndAssertL(), "CreatePresentityGroupL failed" );
+
+    // verify that create was called
+    messenger->AssertCreatePresentityGroupCalled( ETrue );
+
+    // ------------------------------------------------------
+    // subscribe presentity group CONTENT
+    //
+    // expect events:
+    // - request complete
+    evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+    listener->ExpectL( evReqComplete );
+    CleanupStack::Pop( evReqComplete );
+
+    // do the call
+    reqId = presGroup.SubscribePresentityGroupContentL( *currentGrId );
+
+    // and wait
+    EUNIT_ASSERT_DESC( KErrNone == listener->WaitAndAssertL(), "SubscribePresentityGroupContentL failed" );
+
+    // verify that subscribe was called
+    messenger->AssertSubscribePresentityGroupContentCalled( ETrue );
+
+    // ------------------------------------------------------
+    // subscribe presentity group content, making a REFRESH case
+    // with multiple contexts
+    //
+    // expect events:
+    // - request complete
+    // - group content event
+
+    evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+    listener->ExpectL( evReqComplete );
+    CleanupStack::Pop( evReqComplete );
+
+    CPresentityGroupContentEventImp* groupCntEvent =
+        XIMPTestEventFactory::CreateGroupContentEventLCX(
+                KGroupId,
+                KNullDesC,
+                KNullDesC,
+                XIMPTestEventFactory::ETestPGLCntUpdated,
+                KNullDesC,
+                KNullDesC,
+                MXIMPDataSubscriptionState::ESubscriptionActive,
+                MXIMPDataSubscriptionState::EDataUnavailable
+                );
+
+    listener->ExpectL( groupCntEvent );
+    CleanupStack::Pop( groupCntEvent ); // 5 more items in cleanupstack
+
+    // do the call
+    reqId = presGroup.SubscribePresentityGroupContentL( *currentGrId );
+
+    // and wait
+    EUNIT_ASSERT_DESC( KErrNone == listener->WaitAndAssertL(), "SubscribePresentityGroupContentL failed" );
+
+    CleanupStack::PopAndDestroy( 5 ); // rest of group the content event
+
+    // verify that subscribe was called
+    messenger->AssertSubscribePresentityGroupContentCalled( ETrue );
+
+    // ------------------------------------------------------
+    // unsubscribe presentity group content
+    //
+    // expect events:
+    // - request complete
+    // - presentity group content event
+
+    evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+    listener->ExpectL( evReqComplete );
+    CleanupStack::Pop( evReqComplete );
+
+    groupCntEvent =
+        XIMPTestEventFactory::CreateGroupContentEventLCX(
+                KGroupId,
+                KNullDesC,
+                KNullDesC,
+                XIMPTestEventFactory::ETestPGLCntRemoved,
+                KNullDesC,
+                KNullDesC,
+                MXIMPDataSubscriptionState::ESubscriptionInactive,
+                MXIMPDataSubscriptionState::EDataUnavailable
+                );
+
+    listener->ExpectL( groupCntEvent );
+    CleanupStack::Pop( groupCntEvent ); // 5 more items in cleanupstack
+
+    // do the call
+    reqId = presGroup.UnsubscribePresentityGroupContentL( *currentGrId );
+
+    // and wait
+    EUNIT_ASSERT_DESC( KErrNone == listener->WaitAndAssertL(), "UnsubscribePresentityGroupContentL failed" );
+    CleanupStack::PopAndDestroy( 5 ); // lists
+
+    // verify that unsubscribe was called
+    // unsubscribe really called only on the last one
+    messenger->AssertUnsubscribePresentityGroupContentCalled( ETrue );
+
+    // ------------------------------------------------------
+    // delete presentity group
+    //
+    // expect events:
+    // - request complete
+    // NO presentity group content event as we've just unsubscribed it.
+
+    evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+    listener->ExpectL( evReqComplete );
+    CleanupStack::Pop( evReqComplete );
+
+    // do the call
+    reqId = presGroup.DeletePresentityGroupL( *currentGrId );
+
+    // and wait
+    EUNIT_ASSERT_DESC( KErrNone == listener->WaitAndAssertL(), "DeletePresentityGroupL failed" );
+
+    // ------------------------------------------------------
+
+    CleanupStack::PopAndDestroy( 3 ); // listener, currentGrId, factory
+
+    UnbindAllL();
+
+    TeardownTestSupport();
+    }
+
+// Unsubscribe non-subscribed
+void T_PresenceGroupMemberManagement::T_UnsubscribeNonSubscribed_L()
+    {
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    wrapper->BindL( 0 );
+
+    // ------------------------------------------------------
+    // some startup stuff
+    MXIMPContext* context = wrapper->GetContext();
+    CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+    // Get the interfaces
+    MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+    MPresentityGroups& presGroup = presFeat->PresentityGroups();
+
+    iListener2 = CXIMPTestListener::NewL( context );
+    // ------------------------------------------------------
+
+    // Tell the protocol it should act normally
+    wrapper->GetMessenger()->SetNoError();
+
+    iCurrentGrId = context->ObjectFactory().NewIdentityLC();
+    CleanupStack::Pop(); // iCurrentGrId
+    iCurrentGrId->SetIdentityL( KGroupId );
+
+    // ------------------------------------------------------
+    // create presentity group
+    //
+    // expect events:
+    // - request complete.
+    // NOTE: no presentitygrouplistevent as we've not subscribed the group lists
+
+    // normal request complete
+    TXIMPRequestId reqIdDummy;  // not checked
+    CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+
+    // identity + displayname
+    CPresentityGroupInfoImp* infoImp = CPresentityGroupInfoImp::NewLC( *iCurrentGrId, KGroupDisplayName );
+    evReqComplete->AppendParamL( infoImp );
+    CleanupStack::Pop( infoImp );
+
+    iListener2->ExpectL( evReqComplete );
+    CleanupStack::Pop( evReqComplete );
+
+    TXIMPRequestId reqId = presGroup.CreatePresentityGroupL( *iCurrentGrId, KGroupDisplayName );
+
+    // and wait
+    EUNIT_ASSERT_DESC( KErrNone == iListener2->WaitAndAssertL(), "CreatePresentityGroupL failed" );
+    messenger->AssertCreatePresentityGroupCalled( ETrue );
+
+    // ------------------------------------------------------
+    // unsubscribe presentity group content
+    //
+    // expect events:
+    // - request complete
+    // - presentity group content event
+
+    evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+    iListener2->ExpectL( evReqComplete );
+    CleanupStack::Pop( evReqComplete );
+
+    CPresentityGroupContentEventImp* groupCntEvent =
+        XIMPTestEventFactory::CreateGroupContentEventLCX(
+                KGroupId,
+                KNullDesC,
+                KNullDesC,
+                XIMPTestEventFactory::ETestPGLCntRemoved,
+                KNullDesC,
+                KNullDesC,
+                MXIMPDataSubscriptionState::ESubscriptionInactive,
+                MXIMPDataSubscriptionState::EDataUnavailable
+                );
+
+    iListener2->ExpectL( groupCntEvent );
+    CleanupStack::Pop( groupCntEvent ); // 5 more items in cleanupstack
+
+    // do the call
+    reqId = presGroup.UnsubscribePresentityGroupContentL( *iCurrentGrId );
+
+    // and wait
+    EUNIT_ASSERT_DESC( KErrNone == iListener2->WaitAndAssertL(), "UnsubscribePresentityGroupContentL failed" );
+
+    CleanupStack::PopAndDestroy( 5 ); // lists
+
+    // verify that unsubscribe was not called, not subscribed, so won't
+    // unsubscribe
+    messenger->AssertUnsubscribePresentityGroupContentCalled( EFalse );
+
+    // make sure the new listener is not listening for events!
+    iListener2->SetEventSourceL( NULL );
+
+    wrapper->UnbindL();
+
+    TeardownTestSupport();
+    }
+
+// ===========================================================================
+// SETUP HELPERS FOR THE LISTENER
+// ===========================================================================
+//
+void T_PresenceGroupMemberManagement::SetupListenerReqCompleteL( CXIMPTestContextWrapper* aWrapper, TXIMPTestStatusEventTemplate aEventType )
+    {
+    RArray< TInt32 > array;
+    CleanupClosePushL( array );
+    array.Append( MXIMPContextStateEvent::KInterfaceId );
+    array.Append( MPresentityGroupListEvent::KInterfaceId );
+    aWrapper->SetupListenerReqCompleteL( aEventType, &array );
+    CleanupStack::PopAndDestroy(); // array
+    }
+
+void T_PresenceGroupMemberManagement::SetupListenerReqCompleteAllowEventsL(  CXIMPTestContextWrapper* aWrapper, TXIMPTestStatusEventTemplate aEventType )
+    {
+    RArray< TInt32 > array;
+    CleanupClosePushL( array );
+    array.AppendL( MXIMPRequestCompleteEvent::KInterfaceId );
+    array.AppendL( MXIMPContextStateEvent::KInterfaceId );
+    array.Append( MPresentityGroupListEvent::KInterfaceId );
+    array.Append( MXIMPContextStateEvent::KInterfaceId );
+    array.Append( MPresentityGroupListEvent::KInterfaceId );
+    array.Append( MPresentityGroupContentEvent::KInterfaceId );
+    aWrapper->SetupListenerReqCompleteL( aEventType, &array );
+    CleanupStack::PopAndDestroy(); // array
+    }
+
+// ===========================================================================
+// TEST CASE TABLE
+// ===========================================================================
+//
+EUNIT_BEGIN_TEST_TABLE(
+        T_PresenceGroupMemberManagement,
+        "XIMP presence group member management tests",
+        "MODULE" )
+
+PRFW_DECORATED_TEST(
+        "Subscribe and unsubscribe presentity group content",
+        "",
+        "",
+        "FUNCTIONALITY",
+        Setup_L,
+        T_SubUnsubGroupContent_Single_L,
+        Teardown )
+
+PRFW_DECORATED_TEST(
+        "Subscribe and unsubscribe multiple",
+        "",
+        "",
+        "FUNCTIONALITY",
+        SetupMultiple_L,
+        T_SubUnsubGroupContent_Multi_L,
+        Teardown )
+
+PRFW_DECORATED_TEST(
+        "Refresh subscription for one, multiple",
+        "",
+        "",
+        "FUNCTIONALITY",
+        SetupMultiple_L,
+        T_SubUnsubGroupContent_One_Multi_L,
+        Teardown )
+
+PRFW_DECORATED_TEST(
+        "Refresh subscription for all, multiple",
+        "",
+        "",
+        "FUNCTIONALITY",
+        SetupMultiple_L,
+        T_SubUnsubGroupContent_All_Multi_L,
+        Teardown )
+
+PRFW_DECORATED_TEST(
+        "Subscribe content and receive altered id",
+        "",
+        "",
+        "FUNCTIONALITY",
+        Setup_L,
+        T_SubUnsubGroupContent_Altered_Single_L,
+        Teardown )
+
+PRFW_DECORATED_TEST(
+        "Subscribe content and receive altered but same id",
+        "",
+        "",
+        "FUNCTIONALITY",
+        Setup_L,
+        T_SubUnsubGroupContent_AlteredSame_Single_L,
+        Teardown )
+
+PRFW_DECORATED_TEST(
+        "Unsubscribe non-subscribed",
+        "",
+        "",
+        "FUNCTIONALITY",
+        Setup_L,
+        T_UnsubscribeNonSubscribed_L,
+        Teardown )
+
+PRFW_DECORATED_TEST(
+        "Add members to group",
+        "",
+        "",
+        "FUNCTIONALITY",
+        Setup_L,
+        T_AddGroupMembers_Single_L,
+        Teardown )
+
+PRFW_DECORATED_TEST(
+        "Remove members from group",
+        "",
+        "",
+        "FUNCTIONALITY",
+        Setup_L,
+        T_RemoveGroupMembers_Single_L,
+        Teardown )
+
+PRFW_DECORATED_TEST(
+        "Remove members from unsubscribed group",
+        "",
+        "",
+        "FUNCTIONALITY",
+        Setup_L,
+        T_RemoveGroupMembers_NonSub_Single_L,
+        Teardown )
+
+PRFW_DECORATED_TEST(
+        "Remove nonexisting member from group",
+        "",
+        "",
+        "FUNCTIONALITY",
+        Setup_L,
+        T_RemoveGroupMembers_NonExist_Single_L,
+        Teardown )
+
+PRFW_DECORATED_TEST(
+        "Updated members from group",
+        "",
+        "",
+        "FUNCTIONALITY",
+        Setup_L,
+        T_UpdateGroupMembers_Single_L,
+        Teardown )
+
+PRFW_DECORATED_TEST(
+        "Updated members from nonsubscribed group",
+        "",
+        "",
+        "FUNCTIONALITY",
+        Setup_L,
+        T_UpdateGroupMembers_NonSub_Single_L,
+        Teardown )
+
+PRFW_DECORATED_TEST(
+        "Updated nonexisting member of group",
+        "",
+        "",
+        "FUNCTIONALITY",
+        Setup_L,
+        T_UpdateGroupMembers_NonExist_Single_L,
+        Teardown )
+
+PRFW_DECORATED_TEST(
+        "Expire non-subscribed data",
+        "",
+        "",
+        "FUNCTIONALITY",
+        Setup_L,
+        T_ExpireNonSubscribedData_L,
+        Teardown )
+
+PRFW_DECORATED_TEST(
+        "Expire non-subscribed data. Update multiple times",
+        "",
+        "",
+        "FUNCTIONALITY",
+        Setup_L,
+        T_ExpireNonSubscribedDataUpdateMultiple_L,
+        Teardown )
+
+
+EUNIT_END_TEST_TABLE
+
+
+// ===========================================================================
+// TEST SUITE CONSTRUCTION
+// ===========================================================================
+//
+EXPORT_C MEUnitTest* CreateTestSuiteL()
+    {
+    return T_PresenceGroupMemberManagement::NewL();
+    }
+
+// TODO implement this (split this file to multiple parts):
+/*
+// ===========================================================================
+// TEST SUITE CONSTRUCTION
+// ===========================================================================
+//
+EXPORT_C MEUnitTest* CreateTestSuiteL()
+    {
+    CEUnitTestSuite* suiteCollection = CEUnitTestSuite::NewLC( _L("XIMP group list management tests") );
+
+    CEUnitTestSuite* suite = T_PresenceGroupListManagement::NewL();
+    CleanupStack::PushL( suite );
+    suiteCollection->AddL( suite );
+    CleanupStack::Pop( suite );
+
+    suite = T_xxx::NewL();
+    CleanupStack::PushL( suite );
+    suiteCollection->AddL( suite );
+    CleanupStack::Pop( suite );
+
+    CleanupStack::Pop( suiteCollection );
+    return suiteCollection;
+    }
+
+*/
+
+
+
+// ===========================================================================
+// MISC
+// ===========================================================================
+//
+//Exception handler function
+void MyExceptionHandler( TExcType /*aType*/ )
+    {
+    __BREAKPOINT();
+    }
+
+void T_PresenceGroupMemberManagement::UseMyOwnExceptionHandler()
+    {
+    //Register exeption handler
+    TInt r = User::SetExceptionHandler( MyExceptionHandler, 0xFFFFFFFF );
+    if (r != KErrNone)
+        {
+        User::Panic( _L("MyExHandler"), 1 );
+        }
+    }
+
+
+// end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/tsrc/src/t_presencegroupmembermngt/t_presencegroupmembermngt.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,158 @@
+/*
+* 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: XIMP Framework Test Code 
+*
+*/
+
+#ifndef T_PRESENCEGROUPMEMBERMANAGEMENT_H
+#define T_PRESENCEGROUPMEMBERMANAGEMENT_H
+
+
+
+//  EXTERNAL INCLUDES
+#include <platform/digia/eunit/ceunittestsuiteclass.h>
+#include <platform/digia/eunit/EUnitDecorators.h>
+
+#include <ximpbase.h>
+#include <presenceinfo.h>
+#include "prfwteststatuseventlistener.h"
+#include "prfwtestmessaging.h"
+
+class CXIMPTestContextWrapper;
+class CXIMPTestContextWrapperMgr;
+class CXIMPTestMessenger;
+class CPresentityGroupListEventImp;
+class CPresentityGroupContentEventImp;
+
+class T_PresenceGroupMemberManagement;
+
+class CXIMPTestListener;
+
+// function pointer to a method
+typedef void (T_PresenceGroupMemberManagement::* TXIMPCallBack )();
+
+/**
+ * XIMP Framework Eunit tests.
+ *
+ * Tests for XIMP group member management services.
+ *
+ * @since S60 v4.0
+ */
+class T_PresenceGroupMemberManagement : public CEUnitTestSuiteClass
+    {
+
+public:
+    static T_PresenceGroupMemberManagement* NewL();
+    virtual ~T_PresenceGroupMemberManagement();
+
+
+private:
+    T_PresenceGroupMemberManagement();
+    void ConstructL();
+
+private:    // Test case functions
+
+    void Setup_L();
+    void SetupMultiple_L();
+    void BindAllL();
+    void Teardown();
+    
+    // destroy test case support things, which cannot
+    // be known in Setup method.
+    void TeardownTestSupport();
+    
+    void UnbindAllL();
+
+    void T_SubUnsubGroupContent_Single_L();
+    void T_SubUnsubGroupContent_Multi_L();
+    void T_SubUnsubGroupContent_One_Multi_L();
+    void T_SubUnsubGroupContent_All_Multi_L();
+    void T_SubUnsubGroupContent_Altered_Single_L();
+    void T_SubUnsubGroupContent_AlteredSame_Single_L();
+    void T_UnsubscribeNonSubscribed_L();
+    void T_AddGroupMembers_Single_L();
+    void T_RemoveGroupMembers_Single_L();
+    void T_RemoveGroupMembers_NonSub_Single_L();
+    void T_RemoveGroupMembers_NonExist_Single_L();
+    void T_UpdateGroupMembers_Single_L();
+    void T_UpdateGroupMembers_NonSub_Single_L();
+    void T_UpdateGroupMembers_NonExist_Single_L();
+    void T_ExpireNonSubscribedData_L();
+    void T_ExpireNonSubscribedDataUpdateMultiple_L();
+
+    // variable test method support
+    void T_GenericSubAndUnsubL( TXIMPCallBack& aCbFuncL );
+
+    void T_EmptyFunc();
+    void T_TestAddMembersL();
+    void T_TestAddMembers_NonSub_L();
+    void T_TestRemoveMembersL();
+    void T_TestRemoveMembers_NonSub_L();
+    void T_TestRemoveMembers_NonExisting_L();
+    void T_TestUpdateMembers_L();
+    void T_TestUpdateMembers_NonSub_L();
+    void T_TestUpdateMembers_NonExisting_L();
+
+private:    // Test helpers
+
+    void SetupListenerReqCompleteL( CXIMPTestContextWrapper* aWrapper, TXIMPTestStatusEventTemplate aEventType );
+    void SetupListenerReqCompleteAllowEventsL( CXIMPTestContextWrapper* aWrapper, TXIMPTestStatusEventTemplate aEventTypes );
+
+    // sometimes EUnit might eat e.g. an Access violation.
+    // Call this method in the test case to break when it happens,
+    // hopefully you will find the cause.
+    void UseMyOwnExceptionHandler();
+
+private: // Test data
+
+    /**
+     * Eunit test case table declaration.
+     */
+    EUNIT_DECLARE_TEST_TABLE;
+
+    // owned
+    CXIMPTestContextWrapperMgr* iWrapperMgr;
+
+    CActiveSchedulerWait* iASWait;
+
+    // current group id
+    // owned.
+    MXIMPIdentity* iCurrentGrId;
+
+    /**
+     * Last received group content event.
+     * Owned.
+     */
+    CPresentityGroupContentEventImp* iLastEvent;
+
+    CXIMPTestListener* iListener2;
+
+    // ETrue, if you want to skip group content subscription in generic
+    // sub and unsub
+    TBool iSkipSubscribe;
+
+    // EFalse, if you want to skip group content unsubscription
+    TBool iSkipUnsubscribe;
+    };
+
+
+#endif      //  T_PRESENCEGROUPMEMBERMANAGEMENT_H
+
+
+
+// end of file
+
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/tsrc/src/t_presencegroupmembermngt/t_presencegroupmembermngt.mmp	Wed Nov 03 09:32:20 2010 +0530
@@ -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: XIMP Framework Test Code 
+*
+*/
+
+#include            "../../tsrcutils/eunitcommon/eunittstdllbase.hrh"
+#include            "../../tsrcutils/processmaster/pm.h"
+
+#include<platform_paths.hrh>
+#include<eunitcaps.h>
+
+TARGET              t_presencegroupmembermngt.dll
+//CAPABILITY              ALL - TCB - DRM
+CAPABILITY      EUNIT_CAPS
+
+SOURCEPATH          .
+SOURCE              t_presencegroupmembermngt.cpp
+
+
+USERINCLUDE             ../../../core/srcdatamodel
+USERINCLUDE             ../../../presence/srcpresencedatamodel
+USERINCLUDE             ../../../presence/srcpresencedatamodel/presentitygroups
+USERINCLUDE             ../../../presence/srcpresencedatamodel/presencewatching
+USERINCLUDE             ../../../presence/srcpresencedatamodel/presenceauthorization
+USERINCLUDE             ../../../presence/srcpresencedatamodel/presencepublishing
+USERINCLUDE             ../../../presence/srcpresencedatamodel/presenceinfo
+USERINCLUDE             ../../../core/srcutils
+
+// TODO remove unnecessary
+#if defined ( OS_LAYER_SYSTEMINCLUDE )
+OS_LAYER_SYSTEMINCLUDE
+#else
+SYSTEMINCLUDE     /epoc32/include
+#endif
+
+ #if defined ( APP_LAYER_SYSTEMINCLUDE )
+ APP_LAYER_SYSTEMINCLUDE
+ #else
+ SYSTEMINCLUDE     \epoc32\include
+ #endif
+ 
+SYSTEMINCLUDE           ../../../inc/core/base
+SYSTEMINCLUDE           ../../../inc/core/datamodel
+SYSTEMINCLUDE           ../../../inc/core/protocolplugin
+SYSTEMINCLUDE           ../../../inc/core/protocolpluginhost
+SYSTEMINCLUDE           ../../../inc/presence/presencedatamodel
+SYSTEMINCLUDE           ../../../inc/presence/presencemanagement
+SYSTEMINCLUDE           ../../../inc/presence/presenceprotocolplugin
+SYSTEMINCLUDE           ../../../inc/presence/presenceprotocolpluginhost
+
+LIBRARY             ecom.lib
+LIBRARY             bafl.lib
+LIBRARY             ximpdatamodel.lib
+LIBRARY             presencedatamodel.lib
+LIBRARY             estor.lib
+LIBRARY             ximputils.lib
+LIBRARY             eunit.lib
+LIBRARY             eunitutil.lib
+LIBRARY             euser.lib
+
+
+// end of file
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/tsrc/src/t_presencepublishing/bld.inf	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,26 @@
+/*
+* 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 t_presencemng.dll
+*
+*/
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_TESTMMPFILES
+t_presencepublishing.mmp
+
+PRJ_TESTMMPFILES
+///epoc32/release/winscw/udeb/t_presencepublishing.dll	/epoc32/release/winscw/udeb/z/sys/bin/t_presencepublishing.dll
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/tsrc/src/t_presencepublishing/t_presencepublishing.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,1213 @@
+/*
+* 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: XIMP Framework Test Code 
+*
+*/
+
+
+#include "eunittools.h"
+
+#include <platform/digia/eunit/eunitmacros.h>
+#include <platform/digia/eunit/teunitassertioninfo.h>
+
+#include <ecom/ecom.h>
+#include <badesca.h>
+
+#include <ximpbase.h>
+#include <ximpclient.h>
+#include <ximpcontext.h>
+#include <ximpcontextstateevent.h>
+#include <ximpcontextstate.h>
+#include <ximpobjectfactory.h>
+#include <presencepublishing.h>
+#include <presentitypresenceevent.h>
+#include <presenceobjectfactory.h>
+#include <presencefeatures.h>
+#include <presenceinfofield.h>
+#include <presenceinfofieldcollection.h>
+#include <servicepresenceinfo.h>
+#include <devicepresenceinfo.h>
+#include <personpresenceinfo.h>
+#include <presenceinfofieldvalueenum.h>
+#include <presenceinfofieldvaluetext.h>
+#include <presenceinfo.h>
+
+#include "t_presencepublishing.h"
+
+#include "prfwtestmessaging.h"
+#include "prfwtestmessenger.h"
+#include "prfwtestcontextwrappermgr.h"
+#include "prfwtestcontextwrapper.h"
+
+#include "prfwtestpresencedatautils.h"
+
+#include "ximprequestcompleteeventimp.h"
+#include "ximpcontextstateeventimp.h"
+#include "ximpcontextstateimp.h"
+#include "ximpstatusimp.h"
+#include "ownpresenceeventimp.h"
+
+// new test stuff
+#include "prfwtestlistener.h"
+#include "prfwtestfilesrvmsg.h"
+#include "prfwtestfiletool.h"
+
+
+#include "prfwtestrobustnesstools.h"
+
+_LIT8( KPrefix1, "PreA_" );
+_LIT8( KPrefix2, "PreB_" );
+_LIT8( KPrefix3, "PreC_" );
+_LIT8( KPrefix4, "PreD_" );
+
+_LIT8( KServiceType, "test_service" );
+_LIT(  KStatusMsg, "This is my status." );
+
+const TInt KTestAvailability = 1;
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// CONSTRUCTION
+T_PresencePublishing* T_PresencePublishing::NewL()
+    {
+    T_PresencePublishing* self = new( ELeave ) T_PresencePublishing;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+
+    return self;
+    }
+
+
+T_PresencePublishing::~T_PresencePublishing()
+    {
+    }
+
+
+void T_PresencePublishing::ConstructL()
+    {
+    CEUnitTestSuiteClass::ConstructL();
+    }
+
+
+T_PresencePublishing::T_PresencePublishing()
+    {
+    }
+
+
+
+// ===========================================================================
+// TEST CASE SETUP & TEARDOWN METHODS
+// ===========================================================================
+//
+
+void T_PresencePublishing::Setup_L()
+    {
+    PrfwTestRobustness::DoPreCleaning();
+  
+    iWrapperMgr = CXIMPTestContextWrapperMgr::NewL();
+    iWrapperMgr->CreateWrapperL();
+    }
+
+void T_PresencePublishing::SetupMultiple_L()
+    {
+    PrfwTestRobustness::DoPreCleaning();
+
+    iWrapperMgr = CXIMPTestContextWrapperMgr::NewL();
+    iWrapperMgr->CreateWrapperL();
+    iWrapperMgr->CreateWrapperL();
+    iWrapperMgr->CreateWrapperL();
+    }
+
+
+void T_PresencePublishing::BindL()
+    {
+    CXIMPTestContextWrapper* wrapper0 = iWrapperMgr->GetWrapperL( 0 );
+
+    wrapper0->BindL( 0 );
+    }
+
+void T_PresencePublishing::Bind2L()
+    {
+    CXIMPTestContextWrapper* wrapper0 = iWrapperMgr->GetWrapperL( 0 );
+    wrapper0->BindWithSettingsL( 0 );
+    }
+    
+void T_PresencePublishing::BindAllL()
+    {
+    for( TInt a = 0; a < iWrapperMgr->WrapperCount(); ++a )
+        {
+        CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a );
+        wrapper->BindL( 0 );
+        }
+    }
+
+
+void T_PresencePublishing::Teardown()
+    {
+    delete iWrapperMgr;
+    iWrapperMgr = NULL;
+
+    REComSession::FinalClose();
+
+    PrfwTestRobustness::DoPreCleaning();
+    }
+
+void T_PresencePublishing::UnbindL()
+    {
+    // Do unbind
+    CXIMPTestContextWrapper* wrapper0 = iWrapperMgr->GetWrapperL( 0 );
+    wrapper0->UnbindL();
+    }
+
+void T_PresencePublishing::UnbindAllL()
+    {
+    for( TInt a = 0; a < iWrapperMgr->WrapperCount(); ++a )
+        {
+        CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a );
+        wrapper->UnbindL();
+        }
+    }
+
+
+// ===========================================================================
+// TEST CASES for presence publish
+// ===========================================================================
+void T_PresencePublishing::T_Publish_Single_L()
+    {
+    EUNIT_PRINT( _L("Single Presence Publish test") );
+
+    BindL();
+
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    MXIMPContext* context = wrapper->GetContext();
+    CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+    CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context );
+    CleanupStack::PushL( listener2 );
+
+    // Get the interfaces
+    MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+    MPresencePublishing& presPub = presFeat->PresencePublishing();
+
+    // Generate a doc
+    CPresenceInfoImp* presInfo =
+            XIMPTestPresenceDataUtils::GenerateInfoLC( &KPrefix1 );
+
+    // Tell the protocol it should act normally
+    messenger->SetNoError();
+
+    // Publish the presence
+    TXIMPRequestId reqId = presPub.PublishOwnPresenceL( *presInfo );
+
+    // Setup status event listener
+    CXIMPRequestCompleteEventImp* evReqComplete =
+                            CXIMPRequestCompleteEventImp::NewLC( reqId );
+    listener2->ExpectL( evReqComplete );
+    CleanupStack::Pop( evReqComplete );
+
+    // Wait for events on the request
+    EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Publishing presence failed" );
+    
+
+    COMMONASSERT( messenger, EXIMPPlgTestPublishPresenceCalled, "PublishPresenceL was not called", ETrue, NULL );
+
+    CleanupStack::PopAndDestroy( presInfo );
+    CleanupStack::PopAndDestroy( listener2 );
+    UnbindL();
+    }
+
+void T_PresencePublishing::T_NetworkUnplugError_L()
+	{
+    EUNIT_PRINT( _L("Error from plug-in in publish own presence") );
+    
+    // Creating the error which comes from KErrTimedOut and protocol sends Connection terminated.
+
+// BIND AND SETUP
+
+    Bind2L();
+
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    MXIMPContext* context = wrapper->GetContext();
+    CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+
+    CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context );
+    CleanupStack::PushL( listener2 );
+
+    // Get the interfaces
+    MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+    MPresencePublishing& presPub = presFeat->PresencePublishing();
+
+
+// PUBLISH OWN
+
+    //messenger->SetLeave( KErrAbort );
+	messenger->SetError(KErrTimedOut);
+	
+    // publish own presence in here
+    MPresenceInfo* info = CreateInfoLC();
+
+    TXIMPRequestId reqId = presPub.PublishOwnPresenceL( *info );
+    
+   
+    // Setup status event listener for RequestComplete
+    listener2->Reset();
+    // request complete with KErrAbort
+    CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqId );
+    evReqComplete->CompletionResultImp().SetResultCode( KErrTimedOut );
+    listener2->ExpectL( evReqComplete );
+    CleanupStack::Pop( evReqComplete );
+    
+    CXIMPContextStateEventImp* evContextEvent = CXIMPContextStateEventImp::NewLC();
+    evContextEvent->ContextStateImp().SetStateValue( MXIMPContextState::EUnbinding);
+    listener2->ExpectL( evContextEvent );
+    CleanupStack::Pop( evContextEvent );
+    
+    CXIMPContextStateEventImp* evContextEvent2 = CXIMPContextStateEventImp::NewLC();
+    evContextEvent2->ContextStateImp().SetStateValue( MXIMPContextState::EInactive);
+    listener2->ExpectL( evContextEvent2 );
+    CleanupStack::Pop( evContextEvent2 );
+    
+    listener2->WaitAndAssertL();
+
+// UNBIND
+
+    CleanupStack::PopAndDestroy(1);//info
+    CleanupStack::PopAndDestroy( listener2 );
+
+    messenger->SetError( KErrNone );
+
+    UnbindL();
+	}    
+
+
+void T_PresencePublishing::T_NetworkUnplugErrorMultiple_L()
+	{
+    EUNIT_PRINT( _L("Network disconnect from plug-in in publish own presence, multiple contexts") );
+
+	// Bind 2 contexts
+	BindAllL();
+
+	/* 
+	 * Make the 1st client publish someting and then the disconnect would happen 
+	 */
+	CXIMPTestContextWrapper* wrapper0 = iWrapperMgr->GetWrapperL( 0 );
+    MXIMPContext* context0 = wrapper0->GetContext();
+    CXIMPTestMessenger* messenger0 = wrapper0->GetMessenger();
+
+
+    CXIMPTestListener* listener0 = CXIMPTestListener::NewL( context0);
+    CleanupStack::PushL( listener0);
+
+    MPresenceFeatures* presFeat0 = wrapper0->GetPresenceFeatures();
+    MPresencePublishing& presPub0 = presFeat0->PresencePublishing();
+
+    //messenger->SetLeave( KErrAbort );
+	messenger0->SetError(KErrTimedOut);
+	
+
+    // publish own presence in here
+    MPresenceInfo* info = CreateInfoLC();
+    TXIMPRequestId reqId = presPub0.PublishOwnPresenceL( *info );
+
+    /* Setup status event listener for RequestComplete for client 1 */
+    listener0->Reset();
+    // request complete with KErrTimedOut
+    CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqId );
+    evReqComplete->CompletionResultImp().SetResultCode( KErrTimedOut );
+    listener0->ExpectL( evReqComplete );
+    CleanupStack::Pop( evReqComplete );
+    
+    // Create the context state events for unbinding
+    CXIMPContextStateEventImp* evContextEvent = CXIMPContextStateEventImp::NewLC();
+    evContextEvent->ContextStateImp().SetStateValue( MXIMPContextState::EUnbinding);
+    listener0->ExpectL( evContextEvent );
+    CleanupStack::Pop( evContextEvent );
+    
+    CXIMPContextStateEventImp* evContextEvent2 = CXIMPContextStateEventImp::NewLC();
+    evContextEvent2->ContextStateImp().SetStateValue( MXIMPContextState::EInactive);
+    listener0->ExpectL( evContextEvent2 );
+    CleanupStack::Pop( evContextEvent2 );
+
+  
+   
+   	/* 
+   	 * Create a request for client 2, this will not be processed by the protocol plug-in 
+   	 */
+	CXIMPTestContextWrapper* wrapper1 = iWrapperMgr->GetWrapperL( 1 );
+    MXIMPContext* context1 = wrapper1->GetContext();
+
+    MPresenceFeatures* presFeat1 = wrapper1->GetPresenceFeatures();
+    MPresencePublishing& presPub1 = presFeat1->PresencePublishing();
+
+
+    // Create the empty presence info filter
+    CPresenceInfoFilterImp* pif = CPresenceInfoFilterImp::NewLC();
+    TXIMPRequestId reqId1 = presPub1.SubscribeOwnPresenceL( *pif );
+	CleanupStack::PopAndDestroy(pif);
+
+    // Setup status event listener for RequestComplete
+    CXIMPTestListener* listener1 = CXIMPTestListener::NewL( context1);
+    CleanupStack::PushL( listener1);
+    listener1->Reset();
+    // normal request complete
+    CXIMPRequestCompleteEventImp* evReqComplete1 = CXIMPRequestCompleteEventImp::NewLC( reqId1 );
+    evReqComplete1->CompletionResultImp().SetResultCode( KErrTimedOut );
+    listener1->ExpectL( evReqComplete1 );
+    CleanupStack::Pop( evReqComplete1 );
+
+    // Create the context state events for unbinding
+    evContextEvent = CXIMPContextStateEventImp::NewLC();
+    evContextEvent->ContextStateImp().SetStateValue( MXIMPContextState::EUnbinding);
+    listener1->ExpectL( evContextEvent );
+    CleanupStack::Pop( evContextEvent );
+    
+    evContextEvent2 = CXIMPContextStateEventImp::NewLC();
+    evContextEvent2->ContextStateImp().SetStateValue( MXIMPContextState::EInactive);
+    listener1->ExpectL( evContextEvent2 );
+    CleanupStack::Pop( evContextEvent2 );
+
+
+    // Wait for events on the request
+    
+    EUNIT_ASSERT_DESC( KErrNone == listener0->WaitAndAssertL(), "Publish own presence failed in client 1");
+
+    EUNIT_ASSERT_DESC( KErrNone == listener1->WaitAndAssertL(), "SubscribeOwnPresence failed in client 2" );
+
+    CleanupStack::PopAndDestroy( listener1 );
+    CleanupStack::PopAndDestroy(1);//info
+    CleanupStack::PopAndDestroy( listener0 );
+		
+	// Finish the test case	
+	UnbindAllL();	
+	}
+
+void T_PresencePublishing::T_Publish_ErrFromPlg_Leave_L()
+    {
+    EUNIT_PRINT( _L("Single Presence Publish test") );
+    EUNIT_PRINT( _L("Plugin leaves from PublishOwnPresenceL") );
+
+    BindL();
+
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    MXIMPContext* context = wrapper->GetContext();
+    CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+    CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context );
+    CleanupStack::PushL( listener2 );
+
+    // Get the interfaces
+    MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+    MPresencePublishing& presPub = presFeat->PresencePublishing();
+
+    // Generate a doc
+    CPresenceInfoImp* presDoc =
+                XIMPTestPresenceDataUtils::GenerateInfoLC( &KPrefix1 );
+
+    // Setup status event listener
+    SetupListenerReqCompleteL( wrapper, EXIMPTestStatusEvents_RequestOk );
+
+    // Tell the test protocol to leave on next operation
+    messenger->SetLeave( KErrAbort );
+
+    // Publish the presence
+    TXIMPRequestId reqId = presPub.PublishOwnPresenceL( *presDoc );
+    // Wait for events on the request
+    wrapper->WaitRequestAndStackEvents( reqId );
+    wrapper->VerifyEventStackL( _L8("Publishing single presence, leave with error: ") );
+
+    // Verify that plugin left and didn't go through the PublishOwnPresenceL.
+    COMMONASSERT( messenger, EXIMPPlgTestPublishPresenceCalled, "PublishPresenceL was not called",
+                                                EFalse, "PublishPresenceL was called." );
+
+
+    // TODO wait and verify the events
+    EUNIT_FAIL_TEST( "Under construction." );
+
+    CleanupStack::PopAndDestroy( presDoc );
+    CleanupStack::PopAndDestroy( listener2 );
+    UnbindL();
+    }
+
+void T_PresencePublishing::T_Publish_ErrFromPlg_CompleteWithError_L()
+    {
+    EUNIT_PRINT( _L("Single Presence Publish test") );
+    EUNIT_PRINT( _L("Plugin completes PublishOwnPresenceL with error") );
+
+    BindL();
+
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    MXIMPContext* context = wrapper->GetContext();
+    CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+    CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context );
+    CleanupStack::PushL( listener2 );
+
+    // Get the interfaces
+    MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+    MPresencePublishing& presPub = presFeat->PresencePublishing();
+
+    // Generate a doc
+    CPresenceInfoImp* presDoc =
+                XIMPTestPresenceDataUtils::GenerateInfoLC( &KPrefix1 );
+
+    // Setup status event listener:
+    //TODO  Setup presence event listener
+    SetupListenerReqCompleteL( wrapper, EXIMPTestStatusEvents_RequestOk );
+
+    // Tell the test protocol to return with error on next operation
+    messenger->SetError( KErrAbort );
+
+    // Publish the presence
+    TXIMPRequestId reqId = presPub.PublishOwnPresenceL( *presDoc );
+    // Wait for events on the request
+    wrapper->WaitRequestAndStackEvents( reqId );
+    wrapper->VerifyEventStackL( _L8("Publishing single presence, complete with error: ") );
+
+    // Verify that we did go through PublishOwnPresenceL.
+    COMMONASSERT( messenger, EXIMPPlgTestPublishPresenceCalled, "PublishPresenceL was not called", ETrue, NULL );
+
+    // TODO wait and verify presence events
+    EUNIT_FAIL_TEST( "Under construction." );
+
+    CleanupStack::PopAndDestroy( presDoc );
+    CleanupStack::PopAndDestroy( listener2 );
+
+    UnbindL();
+    }
+
+
+// ===========================================================================
+// TEST CASES for presence interest registration
+// ===========================================================================
+
+// Single client, empty filter
+void T_PresencePublishing::T_SubscribeOwnPresence_Single_Empty_L()
+    {
+    EUNIT_PRINT( _L("Single interest registration") );
+
+    BindL();
+
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    MXIMPContext* context = wrapper->GetContext();
+    CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+
+    CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context );
+    CleanupStack::PushL( listener2 );
+
+    // Tell the protocol it should act normally
+    messenger->SetNoError();
+
+    // Get the interfaces
+    MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+    MPresencePublishing& presPub = presFeat->PresencePublishing();
+
+    // Create the empty presence info filter
+    CPresenceInfoFilterImp* pif = CPresenceInfoFilterImp::NewLC();
+
+    // Setup status event listener for RequestComplete
+    listener2->Reset();
+    // normal request complete
+    TXIMPRequestId reqIdDummy;  // not checked
+    CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+    listener2->ExpectL( evReqComplete );
+    CleanupStack::Pop( evReqComplete );
+
+    // subscribe own presence
+    TXIMPRequestId reqId = presPub.SubscribeOwnPresenceL( *pif );
+
+    // Wait for events on the request
+    EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "SubscribeOwnPresence failed" );
+
+    // verify that SubscribeOwnPresenceL was called
+    COMMONASSERT( messenger, EXIMPPlgTestSubscribeOwnPresenceCalled, "SubscribeOwnPresenceL was not called", ETrue, NULL );
+
+    // Setup status event listener for RequestComplete
+    listener2->Reset();
+    evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+    listener2->ExpectL( evReqComplete );
+    CleanupStack::Pop( evReqComplete );
+  
+    // unsubscribe own presence
+    reqId = presPub.UnsubscribeOwnPresenceL();
+
+    // Wait for events on the request
+    EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "UnsubscribeOwnPresence failed" );
+    
+    // verify that UnsubscribeOwnPresenceL was called
+    COMMONASSERT( messenger, EXIMPPlgTestUnsubscribeOwnPresenceCalled, "UnsubscribeOwnPresenceL was not called", ETrue, NULL );
+
+    CleanupStack::PopAndDestroy( pif );
+    CleanupStack::PopAndDestroy( listener2 );
+    UnbindL();
+    }
+
+// Single client, empty filter
+void T_PresencePublishing::T_SubscribeOwnPresence_Multiple_Empty_L()
+    {
+    EUNIT_PRINT( _L("Multiple client filter registration") );
+
+    BindAllL();
+
+    // Create the empty presence info filter
+    CPresenceInfoFilterImp* pif = CPresenceInfoFilterImp::NewLC();
+
+    TInt countOfWrappers = iWrapperMgr->WrapperCount();
+
+    CXIMPTestListener* listeners[ 50 ];
+    TXIMPRequestId reqIdDummy;  // not checked
+
+
+
+// Setup listeners
+    for( TInt a = 0; a < countOfWrappers; a++ )
+        {
+        CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a );
+        MXIMPContext* context = wrapper->GetContext();
+        listeners[ a ] = CXIMPTestListener::NewL( context );
+        CleanupStack::PushL( listeners[ a ] );
+        }
+
+
+// SUBSCRIBE
+    for( TInt a = countOfWrappers - 1; a > 0 ; --a )
+        {
+        CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a );
+        MXIMPContext* context = wrapper->GetContext();
+        CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+        // Tell the protocol it should act normally
+        messenger->SetNoError();
+
+        // Get the interfaces
+        MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+        MPresencePublishing& presPub = presFeat->PresencePublishing();
+
+        // Setup status event listener for RequestComplete
+        listeners[ a ]->Reset();
+        CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+        listeners[ a ]->ExpectL( evReqComplete );
+        CleanupStack::Pop( evReqComplete );
+
+        messenger->SetValueFor( EXIMPPlgTestSubscribeOwnPresenceCalled, 0 );
+        // subscribe own presence
+        TXIMPRequestId reqId = presPub.SubscribeOwnPresenceL( *pif );
+
+        // Wait for events on the request
+        EUNIT_ASSERT_DESC( KErrNone == listeners[ a ]->WaitAndAssertL(), "SubscribeOwnPresence failed" );
+
+        // verify that SubscribeOwnPresenceL was called
+        COMMONASSERT( messenger, EXIMPPlgTestSubscribeOwnPresenceCalled, "SubscribeOwnPresenceL was not called", 
+        ( a > 1 ) ? ETrue : EFalse , "SubscribeOwnPresenceL was called." );
+        }
+        
+// REFRESH
+
+    for( TInt a = countOfWrappers - 1; a > 0 ; --a )
+        {
+        CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a );
+        MXIMPContext* context = wrapper->GetContext();
+        CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+        // Tell the protocol it should act normally
+        messenger->SetNoError();
+
+        // Get the interfaces
+        MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+        MPresencePublishing& presPub = presFeat->PresencePublishing();
+
+        // Setup status event listener for RequestComplete
+        listeners[ a ]->Reset();
+        CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+        listeners[ a ]->ExpectL( evReqComplete );
+        CleanupStack::Pop( evReqComplete );
+        
+        CXIMPDataSubscriptionStateImp* stateImp = CXIMPDataSubscriptionStateImp::NewLC();
+        stateImp->SetDataStateL( MXIMPDataSubscriptionState::EDataUnavailable );
+        stateImp->SetSubscriptionStateL( MXIMPDataSubscriptionState::ESubscriptionActive );
+        COwnPresenceEventImp* evOwnPresence = COwnPresenceEventImp::NewLC( stateImp );
+        CleanupStack::Pop( 2, stateImp );
+        CleanupStack::PushL( evOwnPresence );
+        listeners[ a ]->ExpectL( evOwnPresence );
+        CleanupStack::Pop( evOwnPresence );
+        
+        // TODO check if this call is still needed
+        messenger->SetValueFor( EXIMPPlgTestSubscribeOwnPresenceCalled, 0 );
+
+        // subscribe own presence
+        TXIMPRequestId reqId = presPub.SubscribeOwnPresenceL( *pif );
+
+        // Wait for events on the request
+        EUNIT_ASSERT_DESC( KErrNone == listeners[ a ]->WaitAndAssertL(), "SubscribeOwnPresence failed" );
+        
+        // verify that SubscribeOwnPresenceL was called
+        COMMONASSERT( messenger, EXIMPPlgTestSubscribeOwnPresenceCalled,
+                        "SubscribeOwnPresenceL was not called", 
+                        EFalse , "SubscribeOwnPresenceL was called." );
+        }
+
+        
+// UNSUBSCRIBE
+        
+    for( TInt a = 0; a < countOfWrappers; ++a )
+        {
+        CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a );
+        MXIMPContext* context = wrapper->GetContext();
+        CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+        // Get the interfaces
+        MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+        MPresencePublishing& presPub = presFeat->PresencePublishing();
+
+        // Setup status event listener for RequestComplete
+        listeners[ a ]->Reset();
+        CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+        listeners[ a ]->ExpectL( evReqComplete );
+        CleanupStack::Pop( evReqComplete );
+        
+
+        // register interest
+        TXIMPRequestId reqId = presPub.UnsubscribeOwnPresenceL();
+
+        // Wait for events on the request
+        EUNIT_ASSERT_DESC( KErrNone == listeners[ a ]->WaitAndAssertL(), "UnsubscribeOwnPresence failed" );
+
+ 
+        // verify that UpdateInterest was called
+        COMMONASSERT( messenger, EXIMPPlgTestUnsubscribeOwnPresenceCalled, 
+            "UnsubscribeOwnPresenceL was not called",
+            ( a < 2 ) ? EFalse : ETrue,
+            "UnsubscribeOwnPresenceL was called" );
+        }
+
+
+    // delete the listeners
+    CleanupStack::PopAndDestroy( countOfWrappers ); // the contents of listeners[]
+
+    CleanupStack::PopAndDestroy( pif );
+    
+    UnbindAllL();
+    }
+
+
+// Single client, filled filter
+void T_PresencePublishing::T_SubscribeOwnPresence_Single_L()
+    {
+    EUNIT_PRINT( _L("Single interest registration") );
+
+    BindL();
+
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    MXIMPContext* context = wrapper->GetContext();
+    CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+    CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context );
+    CleanupStack::PushL( listener2 );
+
+    // Get the interfaces
+    MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+    MPresencePublishing& presPub = presFeat->PresencePublishing();
+
+    // Create the filled interest document
+    CPresenceInfoFilterImp* pif =
+                XIMPTestPresenceDataUtils::GenerateInfoFilterLC( &KPrefix1 );
+
+    // Tell the protocol it should act normally
+    messenger->SetNoError();
+
+
+// SUBSCRIBE
+
+    // subscribe own presence
+    TXIMPRequestId reqId = presPub.SubscribeOwnPresenceL( *pif );
+
+    // Setup status event listener for RequestComplete
+    listener2->Reset();
+    SetupListenerReqCompleteL( wrapper, EXIMPTestStatusEvents_RequestOk );
+    CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqId );
+    listener2->ExpectL( evReqComplete );
+    CleanupStack::Pop( evReqComplete );
+
+    // Wait for events on the request
+    EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "SubscribeOwnPresence failed" );
+
+    // verify that SubscribeOwnPresenceL was called
+    COMMONASSERT( messenger, EXIMPPlgTestSubscribeOwnPresenceCalled, "SubscribeOwnPresenceL was not called", ETrue, NULL );    
+
+// REFRESH
+
+    // subscribe own presence (refresh)
+    reqId = presPub.SubscribeOwnPresenceL( *pif );
+
+    // Setup status event listener for RequestComplete
+    SetupListenerReqCompleteL( wrapper, EXIMPTestStatusEvents_RequestOk );
+    messenger->SetValueFor( EXIMPPlgTestSubscribeOwnPresenceCalled, 0 );
+    listener2->Reset();
+    evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqId );
+    listener2->ExpectL( evReqComplete );
+    CleanupStack::Pop( evReqComplete );
+    // also the event
+    
+    CXIMPDataSubscriptionStateImp* stateImp = CXIMPDataSubscriptionStateImp::NewLC();
+    stateImp->SetDataStateL( MXIMPDataSubscriptionState::EDataUnavailable );
+    stateImp->SetSubscriptionStateL( MXIMPDataSubscriptionState::ESubscriptionActive );    
+    COwnPresenceEventImp* event = COwnPresenceEventImp::NewLC( stateImp );
+    CleanupStack::Pop( 2, stateImp );
+    CleanupStack::PushL( event );    
+    listener2->ExpectL( event );
+    CleanupStack::Pop( event );
+
+    // Wait for events on the request
+    EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Refreshing own presence subscription failed" );
+
+    // verify that SubscribeOwnPresenceL was called
+    COMMONASSERT( messenger, EXIMPPlgTestSubscribeOwnPresenceCalled, "SubscribeOwnPresenceL was not called", EFalse, "SubscribeOwnPresenceL was called" );
+
+    CleanupStack::PopAndDestroy( pif );
+    CleanupStack::PopAndDestroy( listener2 );
+    UnbindL();
+    }
+
+void T_PresencePublishing::T_ErrFromPlg_LeaveOnSubscribeOwnPresence_L()
+    {
+    EUNIT_PRINT( _L("Error from plug-in in presentity presence subscribe") );
+    EUNIT_PRINT( _L("Plug-in leaves from SubscribePresence().") );
+
+// BIND AND SETUP
+
+    BindL();
+
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    MXIMPContext* context = wrapper->GetContext();
+    CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+
+    CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context );
+    CleanupStack::PushL( listener2 );
+
+    // Get the interfaces
+    MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+    MPresencePublishing& presPub = presFeat->PresencePublishing();
+
+    // Create the filled interest document
+    CPresenceInfoFilterImp* pif =
+                XIMPTestPresenceDataUtils::GenerateInfoFilterLC( &KPrefix1 );
+
+// SUBSCRIBE
+
+    messenger->SetLeave( KErrAbort );
+
+    // subscribe own presence
+    TXIMPRequestId reqId = presPub.SubscribeOwnPresenceL( *pif );
+
+    // Setup status event listener for RequestComplete
+    listener2->Reset();
+    // request complete with KErrAbort
+    CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqId );
+    evReqComplete->CompletionResultImp().SetResultCode( KErrAbort );
+    listener2->ExpectL( evReqComplete );
+    CleanupStack::Pop( evReqComplete );
+
+    // Wait for events on the request
+    EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Subscribing presentity presence, didn't complete with error" );
+    
+    // verify that SubscribeOwnPresenceL was called
+    COMMONASSERT( messenger, EXIMPPlgTestSubscribeOwnPresenceCalled, "SubscribeOwnPresenceL was not called", EFalse, "SubscribeOwnPresenceL was called" );
+    
+        
+// SUBSCRIBE
+
+    messenger->SetLeave( KErrNone );
+
+    // subscribe own presence
+    reqId = presPub.SubscribeOwnPresenceL( *pif );
+
+    // Setup status event listener for RequestComplete
+    listener2->Reset();
+    evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqId );
+    listener2->ExpectL( evReqComplete );
+    CleanupStack::Pop( evReqComplete );
+
+    // Wait for events on the request
+    EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Subscribing presentity presence failed" );
+
+    // verify that SubscribeOwnPresenceL was called
+    COMMONASSERT( messenger, EXIMPPlgTestSubscribeOwnPresenceCalled, "SubscribeOwnPresenceL was not called", ETrue, "SubscribeOwnPresenceL was called" );
+    
+
+// UNSUBSCRIBE
+
+    messenger->SetLeave( KErrAbort );
+
+    // register interest
+    reqId = presPub.UnsubscribeOwnPresenceL();
+
+    // Setup status event listener for RequestComplete
+    listener2->Reset();
+    evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqId );
+    evReqComplete->CompletionResultImp().SetResultCode( KErrAbort );
+    listener2->ExpectL( evReqComplete );
+    CleanupStack::Pop( evReqComplete );
+
+    // Wait for events on the request
+    EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Unsubscribing presentity presence with error failed" );
+
+    // verify that UnsubscribeOwnPresenceL was called
+    COMMONASSERT( messenger, EXIMPPlgTestUnsubscribeOwnPresenceCalled, "UnsubscribeOwnPresenceL was not called", EFalse, 
+                                                                       "UnsubscribeOwnPresenceL was called." );
+    
+// UNBIND
+
+    CleanupStack::PopAndDestroy( pif );
+    CleanupStack::PopAndDestroy( listener2 );
+
+    messenger->SetLeave( KErrNone );
+
+    UnbindL();
+    }
+
+// ===========================================================================
+// Single client, filled filter, publish.
+// ===========================================================================
+//
+
+void T_PresencePublishing::T_SubscribeOwnPresence_Publish_Single_L()
+    {
+    EUNIT_PRINT( _L("Single interest registration with publish") );
+
+    /*
+     * TODO: 
+     *
+     * case 1
+     *
+     * - subscribetä oma presence
+     * - luo filtteri
+     * - luo info
+     * - publishaa oma presence + info
+     * - tsekkaa että alakerta on saanut infon
+     * - subscribetä uudelleen (=refresh case)
+     * - tsekkaa että kaikki ok
+     *
+     * case 2
+     *
+     * - sama filtteri kuin edellä
+     * - feikkaa verkkoserveriltä tuleva viesti, jossa sama info kuin edellä
+     * - tsekkaa, että frameworkin läpi tuleva info sisältää vain ne kamat
+     *   jotka on sallittu ja että muut on blokattu. ts. "test_service":n
+     *   "availability" pitäisi tulla läpi. person-presenceen tungettu kama jää
+     *   pois
+     *
+     */
+
+    BindL();
+
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    MXIMPContext* context = wrapper->GetContext();
+    CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+    CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context );
+    CleanupStack::PushL( listener2 );
+
+    // Get the interfaces
+    MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+    MPresencePublishing& presPub = presFeat->PresencePublishing();
+
+    // Create the filter 
+    MPresenceInfoFilter* pif = presFeat->PresenceObjectFactory().NewPresenceInfoFilterLC();
+    pif->AcceptServiceFilterL( KServiceType, NPresenceInfo::NFieldType::KAvailability ); // "test_service", "availability"
+    // note, the person info will be filtered out now since we don't accept it.
+
+    // Tell the protocol it should act normally
+    messenger->SetNoError();
+
+    // SUBSCRIBE
+
+    // subscribe own presence
+    TXIMPRequestId reqId = presPub.SubscribeOwnPresenceL( *pif );
+
+    // Setup status event listener for RequestComplete
+    CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqId );
+    listener2->ExpectL( evReqComplete );
+    CleanupStack::Pop( evReqComplete );
+
+    // Wait for events on the request
+    EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "SubscribeOwnPresence failed" );
+
+    // verify that SubscribeOwnPresenceL was called
+    COMMONASSERT( messenger, EXIMPPlgTestSubscribeOwnPresenceCalled, "SubscribeOwnPresenceL was not called", ETrue, NULL );    
+    
+    // publish own presence in here
+    MPresenceInfo* info = CreateInfoLC();
+
+    reqId = presPub.PublishOwnPresenceL( *info );
+
+    // Setup status event listener
+    evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqId );
+    listener2->ExpectL( evReqComplete );
+    CleanupStack::Pop( evReqComplete );
+    
+    CXIMPDataSubscriptionStateImp* stateImp = CXIMPDataSubscriptionStateImp::NewLC();
+    stateImp->SetDataStateL( MXIMPDataSubscriptionState::EDataAvailable );
+    stateImp->SetSubscriptionStateL( MXIMPDataSubscriptionState::ESubscriptionActive );    
+    COwnPresenceEventImp* event = COwnPresenceEventImp::NewLC( stateImp );
+    CleanupStack::Pop( 2, stateImp );
+    CleanupStack::PushL( event );    
+    listener2->ExpectL( event );
+    CleanupStack::Pop( event );
+
+    // Wait for events on the request
+    EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Publishing presence failed" );
+    COMMONASSERT( messenger, EXIMPPlgTestPublishPresenceCalled, "PublishPresenceL was not called", ETrue, NULL );
+
+    // REFRESH
+
+    // subscribe own presence (refresh)
+    reqId = presPub.SubscribeOwnPresenceL( *pif );
+
+    // Setup status event listener for RequestComplete
+    messenger->SetValueFor( EXIMPPlgTestSubscribeOwnPresenceCalled, 0 );
+    evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqId );
+    listener2->ExpectL( evReqComplete );
+    CleanupStack::Pop( evReqComplete );
+    // also the event
+    
+    stateImp = CXIMPDataSubscriptionStateImp::NewLC();
+    stateImp->SetDataStateL( MXIMPDataSubscriptionState::EDataAvailable );
+    stateImp->SetSubscriptionStateL( MXIMPDataSubscriptionState::ESubscriptionActive );    
+    event = COwnPresenceEventImp::NewLC( stateImp );
+    CleanupStack::Pop( 2, stateImp );
+    CleanupStack::PushL( event );    
+    listener2->ExpectL( event );
+    CleanupStack::Pop( event );
+
+    // Wait for events on the request
+    EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Refreshing own presence subscription failed" );
+
+    // verify that SubscribeOwnPresenceL was called
+    COMMONASSERT( messenger, EXIMPPlgTestSubscribeOwnPresenceCalled, "SubscribeOwnPresenceL was not called", EFalse, "SubscribeOwnPresenceL was called" );
+
+    CleanupStack::PopAndDestroy( 3, listener2 ); // info, pif, listener2
+    UnbindL();
+    }
+
+
+// ===========================================================================
+// SETUP HELPERS FOR THE LISTENER
+// ===========================================================================
+//
+void T_PresencePublishing::SetupListenerReqCompleteL( CXIMPTestContextWrapper* aWrapper, TXIMPTestStatusEventTemplate aEventType )
+    {
+    RArray< TInt32 > array;
+    CleanupClosePushL( array );
+    array.Append( MXIMPContextStateEvent::KInterfaceId );
+    array.Append( MOwnPresenceEvent::KInterfaceId );
+    aWrapper->SetupListenerReqCompleteL( aEventType, &array );
+    CleanupStack::PopAndDestroy(); // array
+    }
+
+void T_PresencePublishing::SetupListenerReqCompleteAllowEventsL(  CXIMPTestContextWrapper* aWrapper, TXIMPTestStatusEventTemplate aEventType )
+    {
+    RArray< TInt32 > array;
+    CleanupClosePushL( array );
+    array.AppendL( MXIMPRequestCompleteEvent::KInterfaceId );
+    array.AppendL( MXIMPContextStateEvent::KInterfaceId );
+    array.AppendL( MOwnPresenceEvent::KInterfaceId );
+    aWrapper->SetupListenerReqCompleteL( aEventType, &array );
+    CleanupStack::PopAndDestroy(); // array
+    }
+
+MPresenceInfo* T_PresencePublishing::CreateInfoLC()
+    {
+    // fill up the info structure with:
+    // service info imp: 
+    //   - info name:    "test_service"
+    //   - field name:   availability
+    //   - field value:  enum type, value 1
+    // person info imp:
+    //   - field name:   "status-message"
+    //   - field value:  "This is my status message."
+    //
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    MXIMPContext* context = wrapper->GetContext();
+
+    // Get the interface
+    MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+    MPresenceInfo* info = presFeat->PresenceObjectFactory().NewPresenceInfoLC();
+
+    // fill service info
+    MServicePresenceInfo* srvInfo = presFeat->PresenceObjectFactory().NewServicePresenceInfoLC();
+    srvInfo->SetServiceTypeL( KServiceType );  // test
+
+    MPresenceInfoField* infoField = presFeat->PresenceObjectFactory().NewInfoFieldLC();
+    
+    MPresenceInfoFieldValueEnum* enumField = presFeat->PresenceObjectFactory().NewEnumInfoFieldLC();
+    enumField->SetValueL( KTestAvailability ); // 1
+    infoField->SetFieldTypeL( NPresenceInfo::NFieldType::KAvailability ); // "availability"
+    infoField->SetFieldValue( enumField );
+    CleanupStack::Pop(); // enumField
+
+    srvInfo->Fields().AddOrReplaceFieldL( infoField );
+    CleanupStack::Pop(); // infoField 
+
+    info->AddServicePresenceL( srvInfo );
+    CleanupStack::Pop(); // srvInfo 
+
+    // fill person info
+    MPersonPresenceInfo* persInfo = presFeat->PresenceObjectFactory().NewPersonPresenceInfoLC();
+    MPresenceInfoField* infoField2 = presFeat->PresenceObjectFactory().NewInfoFieldLC();
+    
+    MPresenceInfoFieldValueText* textField = presFeat->PresenceObjectFactory().NewTextInfoFieldLC();
+    textField->SetTextValueL( KStatusMsg );
+
+    infoField2->SetFieldTypeL( NPresenceInfo::NFieldType::KStatusMessage );
+    infoField2->SetFieldValue( textField );
+    CleanupStack::Pop(); // textField
+
+    persInfo->Fields().AddOrReplaceFieldL( infoField2 );
+    CleanupStack::Pop(); // infoField2
+
+    info->SetPersonPresenceL( persInfo );
+    CleanupStack::Pop(); // persInfo
+    // that's it
+
+    return info;
+    }
+
+// ===========================================================================
+// TEST CASE TABLE
+// ===========================================================================
+//
+EUNIT_BEGIN_TEST_TABLE(
+        T_PresencePublishing,
+        "XIMP presence management tests",
+        "MODULE" )
+
+
+PRFW_DECORATED_TEST(
+        "Publish single presence",
+        "",
+        "",
+        "FUNCTIONALITY",
+        Setup_L,
+        T_Publish_Single_L,
+        Teardown )
+
+/*
+PRFW_NOT_DECORATED_TEST(
+        "Publish, error leave",
+        "",
+        "",
+        "ERRORHANDLING",
+        Setup_Bind_L,
+        T_Publish_ErrFromPlg_Leave_L,
+        Teardown_Unbind )
+
+PRFW_NOT_DECORATED_TEST(
+        "Publish, error complete",
+        "",
+        "",
+        "ERRORHANDLING",
+        Setup_Bind_L,
+        T_Publish_ErrFromPlg_CompleteWithError_L,
+        Teardown_Unbind )
+*/
+
+PRFW_DECORATED_TEST(
+        "Empty own presence subscribtion",
+        "",
+        "",
+        "FUNCTIONALITY",
+        Setup_L,
+        T_SubscribeOwnPresence_Single_Empty_L,
+        Teardown )
+
+PRFW_DECORATED_TEST(
+        "Empty own presence subscribtion for multiple clients",
+        "",
+        "",
+        "FUNCTIONALITY",
+        SetupMultiple_L,
+        T_SubscribeOwnPresence_Multiple_Empty_L,
+        Teardown )
+
+
+PRFW_DECORATED_TEST(
+        "Single own presence subscribtion",
+        "",
+        "",
+        "FUNCTIONALITY",
+        Setup_L,
+        T_SubscribeOwnPresence_Single_L,
+        Teardown )
+
+PRFW_DECORATED_TEST(
+        "Single own presence subscribtion with publish",
+        "",
+        "",
+        "FUNCTIONALITY",
+        Setup_L,
+        T_SubscribeOwnPresence_Publish_Single_L,
+        Teardown )
+
+PRFW_DECORATED_TEST(
+        "Error - Fail subscription",
+        "",
+        "",
+        "FUNCTIONALITY",
+        Setup_L,
+        T_ErrFromPlg_LeaveOnSubscribeOwnPresence_L,
+        Teardown )
+
+PRFW_DECORATED_TEST(
+        "Error - Network UnplugError",
+        "",
+        "",
+        "FUNCTIONALITY",
+        Setup_L,
+        T_NetworkUnplugError_L,
+        Teardown )
+
+/*
+PRFW_DECORATED_TEST(
+        "Error - Network UnplugError",
+        "",
+        "",
+        "FUNCTIONALITY",
+        SetupMultiple_L,
+        T_NetworkUnplugErrorMultiple_L,
+        Teardown )
+*/
+
+EUNIT_END_TEST_TABLE
+
+
+// ===========================================================================
+// TEST SUITE CONSTRUCTION
+// ===========================================================================
+//
+EXPORT_C MEUnitTest* CreateTestSuiteL()
+    {
+    return T_PresencePublishing::NewL();
+    }
+
+
+// end of file
+
+
+
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/tsrc/src/t_presencepublishing/t_presencepublishing.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,135 @@
+/*
+* 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: XIMP Framework Test Code 
+* 
+*/
+
+#ifndef T_PRESENCEPUBLISHING_H
+#define T_PRESENCEPUBLISHING_H
+
+
+//  EXTERNAL INCLUDES
+#include <platform/digia/eunit/ceunittestsuiteclass.h>
+#include <platform/digia/eunit/EUnitDecorators.h>
+
+#include <ximpbase.h>
+#include "prfwteststatuseventlistener.h"
+#include "prfwtestmessaging.h"
+
+class CXIMPTestContextWrapper;
+class CXIMPTestContextWrapperMgr;
+class CXIMPTestMessenger;
+
+/**
+ * XIMP Framework Eunit tests.
+ *
+ * Tests for XIMP session management services.
+ *
+ * @since S60 v4.0
+ */
+class T_PresencePublishing : public CEUnitTestSuiteClass
+    {
+
+public:
+    static T_PresencePublishing* NewL();
+    virtual ~T_PresencePublishing();
+
+
+private:
+    T_PresencePublishing();
+    void ConstructL();
+
+
+
+private:    // Test case functions
+
+    void Setup_L();
+    void SetupMultiple_L();
+    void BindL();
+    void Bind2L();
+    void BindAllL();
+    void Teardown();
+    void UnbindL();
+    void UnbindAllL();
+
+
+    //------------------------------------------
+    //Presence Publish
+    //
+    void T_Publish_Single_L();
+
+    // Maybe unneeded cases. All events should act likewise and these
+    // kind of situations are tested in t_sessionmng already.
+    void T_Publish_ErrFromPlg_Leave_L();
+    void T_Publish_ErrFromPlg_CompleteWithError_L();
+
+
+    //------------------------------------------
+    //Presence interest registration
+    //
+    void T_SubscribeOwnPresence_Single_Empty_L();
+    void T_SubscribeOwnPresence_Multiple_Empty_L();
+    void T_SubscribeOwnPresence_Single_L();
+    void T_SubscribeOwnPresence_Publish_Single_L();
+    void T_SubscribeOwnPresence_Two_Clients_L();
+    void T_ErrFromPlg_LeaveOnSubscribeOwnPresence_L();
+    void T_NetworkUnplugError_L();
+    void T_NetworkUnplugErrorMultiple_L();
+
+    // Plugin leaves with error, returns error. Same as above.
+    //void T_InterestRegistration_ErrorFromPlg_Leave_L();
+    //void T_InterestRegistration_ErrorFromPlg_Error_L();
+
+    //------------------------------------------
+    // Input data verification tests
+    // TODO when the mechanism for
+    //
+    //   Verify that plugin receives correct input data
+    //     - single publish
+    //     - single registration
+    //     - aggregated registrations
+    //   Verify that the test case received correct data (verify plugin output data)
+    //     - own presence event
+    //     - UpdatePresenceL / presentity event
+    //     - filter registration verifications on presentity events
+
+private:    // Test helpers
+
+    void SetupListenerReqCompleteL( CXIMPTestContextWrapper* aWrapper, TXIMPTestStatusEventTemplate aEventType );
+    void SetupListenerReqCompleteAllowEventsL( CXIMPTestContextWrapper* aWrapper, TXIMPTestStatusEventTemplate aEventTypes );
+    // TODO move these to some TOOL part - could be common
+    // among all components
+
+    MPresenceInfo* CreateInfoLC();
+
+private: // Test data
+
+    /**
+     * Eunit test case table declaration.
+     */
+    EUNIT_DECLARE_TEST_TABLE;
+
+    // owned
+    CXIMPTestContextWrapperMgr* iWrapperMgr;
+    };
+
+#endif      //  T_PRESENCEPUBLISHING_H
+
+
+
+// end of file
+
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/tsrc/src/t_presencepublishing/t_presencepublishing.mmp	Wed Nov 03 09:32:20 2010 +0530
@@ -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: XIMP Framework Test Code 
+*
+*/
+
+#include            "../../tsrcutils/eunitcommon/eunittstdllbase.hrh"
+#include            "../../tsrcutils/processmaster/pm.h"
+
+#include<platform_paths.hrh>
+#include<eunitcaps.h>
+
+TARGET              t_presencepublishing.dll
+//CAPABILITY              ALL - TCB - DRM
+CAPABILITY      EUNIT_CAPS
+
+SOURCEPATH          .
+SOURCE              t_presencepublishing.cpp
+
+
+USERINCLUDE             ../../../core/srcdatamodel
+USERINCLUDE             ../../../presence/srcpresencedatamodel
+USERINCLUDE             ../../../presence/srcpresencedatamodel/presentitygroups
+USERINCLUDE             ../../../presence/srcpresencedatamodel/presencewatching
+USERINCLUDE             ../../../presence/srcpresencedatamodel/presenceauthorization
+USERINCLUDE             ../../../presence/srcpresencedatamodel/presencepublishing
+USERINCLUDE             ../../../presence/srcpresencedatamodel/presenceinfo
+USERINCLUDE             ../../../core/srcutils
+
+// TODO remove unnecessary
+#if defined ( OS_LAYER_SYSTEMINCLUDE )
+OS_LAYER_SYSTEMINCLUDE
+#else
+SYSTEMINCLUDE     /epoc32/include
+#endif
+
+ #if defined ( APP_LAYER_SYSTEMINCLUDE )
+ APP_LAYER_SYSTEMINCLUDE
+ #else
+ SYSTEMINCLUDE     \epoc32\include
+ #endif
+ 
+ 
+SYSTEMINCLUDE           ../../../inc/core/base
+SYSTEMINCLUDE           ../../../inc/core/datamodel
+SYSTEMINCLUDE           ../../../inc/core/protocolplugin
+SYSTEMINCLUDE           ../../../inc/core/protocolpluginhost
+SYSTEMINCLUDE           ../../../inc/presence/presencedatamodel
+SYSTEMINCLUDE           ../../../inc/presence/presencemanagement
+SYSTEMINCLUDE           ../../../inc/presence/presenceprotocolplugin
+SYSTEMINCLUDE           ../../../inc/presence/presenceprotocolpluginhost
+
+LIBRARY             ecom.lib
+LIBRARY             bafl.lib
+LIBRARY             ximpdatamodel.lib
+LIBRARY             presencedatamodel.lib
+LIBRARY             estor.lib
+LIBRARY             ximputils.lib
+LIBRARY             eunit.lib
+LIBRARY             eunitutil.lib
+LIBRARY             euser.lib
+
+// end of file
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/tsrc/src/t_presencewatcherlistmngt/bld.inf	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,23 @@
+/*
+* 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 t_presencewatcherlistmngt.dll
+*
+*/
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_TESTMMPFILES
+t_presencewatcherlistmngt.mmp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/tsrc/src/t_presencewatcherlistmngt/t_presencewatcherlistmngt.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,1356 @@
+/*
+* 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: XIMP Framework Test Code 
+*
+*/
+
+
+#include "eunittools.h"
+
+#include <platform/digia/eunit/eunitmacros.h>
+#include <platform/digia/eunit/teunitassertioninfo.h>
+
+
+#include <ecom/ecom.h>
+#include <badesca.h>
+
+#include <ximpbase.h>
+#include <ximpclient.h>
+#include <presencefeatures.h>
+#include <presencepublishing.h>
+#include <ximpdatasubscriptionstate.h>
+#include <presentitygroups.h>
+#include <ximpobjectfactory.h>
+#include <presencewatching.h>
+#include <presenceobjectfactory.h>
+#include <ximpcontext.h>
+#include <ximpcontextstateevent.h>
+#include <ximprequestcompleteevent.h>
+#include <ximpstatus.h>
+#include <presentitypresenceevent.h>
+#include "prfwtestpresencedatautils.h"
+
+
+
+#include "t_presencewatcherlistmngt.h"
+
+// watcher list related includes
+#include "presencewatcherinfoimp.h"
+#include "presencewatcherlisteventimp.h"
+
+// other data model includes
+#include "ximpidentityimp.h"
+#include "ximpdatasubscriptionstateimp.h"
+#include "presentitygroupmemberinfoimp.h"
+#include "presenceinfofilterimp.h"
+
+// utils includes
+#include "ximpobjecthelpers.h"
+
+#include "ximprequestcompleteeventimp.h"
+
+// testing tool includes
+#include "prfwtestmessaging.h"
+#include "prfwtestmessenger.h"
+#include "prfwtestcontextwrappermgr.h"
+#include "prfwtestcontextwrapper.h"
+#include "prfwtestwaithelper.h"
+
+#include "prfwtestfilesrvmsg.h"
+#include "prfwtestfiletool.h"
+#include "prfwtestlistener.h"
+
+#include "prfwtestrobustnesstools.h"
+
+
+
+
+
+/*#include "presenceinfoimp.h"
+#include "presenceinfofilterimp.h"
+#include "prfwtestpresencedatautils.h"
+#include "ximpidentityimp.h"
+#include "presentitygroupmemberinfoimp.h"
+#include "ximpobjecthelpers.h"
+#include "prfwtestfilesrvmsg.h"
+#include "prfwtestwaithelper.h"*/
+
+_LIT8( KPrefix1, "PreA_" );
+_LIT8( KPrefix2, "PreB_" );
+_LIT8( KPrefix3, "PreC_" );
+_LIT8( KPrefix4, "PreD_" );
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// CONSTRUCTION
+T_PresenceWatcherListManagement* T_PresenceWatcherListManagement::NewL()
+    {
+    T_PresenceWatcherListManagement* self = new( ELeave ) T_PresenceWatcherListManagement;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+
+    return self;
+    }
+
+
+T_PresenceWatcherListManagement::~T_PresenceWatcherListManagement()
+    {
+    }
+
+
+void T_PresenceWatcherListManagement::ConstructL()
+    {
+    CEUnitTestSuiteClass::ConstructL();
+    }
+
+
+T_PresenceWatcherListManagement::T_PresenceWatcherListManagement()
+    {
+    }
+
+
+
+// ===========================================================================
+// TEST CASE SETUP & TEARDOWN METHODS
+// ===========================================================================
+//
+
+void T_PresenceWatcherListManagement::Setup_L()
+    {
+        
+    __UHEAP_MARK;
+    PrfwTestRobustness::DoPreCleaning();
+
+    iWrapperMgr = CXIMPTestContextWrapperMgr::NewL();
+    iWrapperMgr->CreateWrapperL();
+    }
+
+void T_PresenceWatcherListManagement::SetupMultiple_L()
+    {
+    __UHEAP_MARK;
+    PrfwTestRobustness::DoPreCleaning();
+
+    iWrapperMgr = CXIMPTestContextWrapperMgr::NewL();
+    iWrapperMgr->CreateWrapperL();
+    iWrapperMgr->CreateWrapperL();
+    iWrapperMgr->CreateWrapperL();
+    }
+
+
+void T_PresenceWatcherListManagement::BindL()
+    {
+    CXIMPTestContextWrapper* wrapper0 = iWrapperMgr->GetWrapperL( 0 );
+
+    wrapper0->BindL( 0 );
+    }
+
+void T_PresenceWatcherListManagement::BindAllL()
+    {
+    for( TInt a = 0; a < iWrapperMgr->WrapperCount(); ++a )
+        {
+        CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a );
+        wrapper->BindL( 0 );
+        }
+    }
+
+
+void T_PresenceWatcherListManagement::Teardown()
+    {
+    delete iWrapperMgr;
+    iWrapperMgr = NULL;
+
+    REComSession::FinalClose();
+
+    PrfwTestRobustness::DoPreCleaning();
+        
+    __UHEAP_MARKEND;
+    }
+
+void T_PresenceWatcherListManagement::UnbindL()
+    {
+    // Do unbind
+    CXIMPTestContextWrapper* wrapper0 = iWrapperMgr->GetWrapperL( 0 );
+    wrapper0->UnbindL();
+    }
+
+void T_PresenceWatcherListManagement::UnbindAllL()
+    {
+    for( TInt a = 0; a < iWrapperMgr->WrapperCount(); ++a )
+        {
+        CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a );
+        wrapper->UnbindL();
+        }
+    }
+
+
+// ===========================================================================
+// TEST CASES for presentity presence subscription
+// ===========================================================================
+// Check that this don't leak memory
+void T_PresenceWatcherListManagement::T_BindUnbind_L()
+    {
+    BindL();
+    UnbindL();
+    }
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+// Subscribe, unsubscribe - Single client
+void T_PresenceWatcherListManagement::T_SubscribePresenceWatcherList_Single_L()
+    {
+
+    EUNIT_PRINT( _L("Single client presence watcher list subscription") );
+
+    BindL();
+
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    MXIMPContext* context = wrapper->GetContext();
+    CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+    CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context );
+    CleanupStack::PushL( listener2 );
+
+    // Tell the protocol it should act normally
+    messenger->SetNoError();
+
+    // Get the interfaces
+    MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+    MPresencePublishing& presPub = presFeat->PresencePublishing();
+
+    //-------------------------------------------------
+    // subscribe
+
+    // Setup status event listener for RequestComplete
+    // ---------------------------------------------
+    listener2->Reset();
+
+    // normal request complete
+    TXIMPRequestId reqIdDummy;  // not checked
+    CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+    listener2->ExpectL( evReqComplete );
+    CleanupStack::Pop( evReqComplete );
+
+
+    // Subscribe
+    TXIMPRequestId reqId = presPub.SubscribePresenceWatcherListL();
+
+    EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Subscribe failed" );
+
+    // verify that SubscribePresenceWatcherListL was called
+    COMMONASSERT( messenger, EXIMPPlgTestSubscribePresenceWatcherListCalled, "SubscribePresenceWatcherListL was not called", ETrue, NULL );
+
+    //-------------------------------------------------
+    // refresh subscribe
+
+    // Setup status event listener for RequestComplete
+    listener2->Reset();
+
+    evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+    listener2->ExpectL( evReqComplete );
+    CleanupStack::Pop( evReqComplete );
+
+    RPrWatLstInfoImpArray* currentList(NULL);
+    CPresenceWatcherListEventImp* event = CreateWatcherListEventLCX(
+        KNullDesC, KNullDesC,
+        MXIMPDataSubscriptionState::ESubscriptionActive,
+        MXIMPDataSubscriptionState::EDataUnavailable,
+        ETestPWlCurrent, currentList);
+    listener2->ExpectL( event );
+    CleanupStack::Pop(); //event 3 to go.
+    // ---------------------------------------------
+
+    // Subscribe second time
+    reqId = presPub.SubscribePresenceWatcherListL();
+
+    EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Refresh failed" );
+    CleanupStack::PopAndDestroy( 3 ); // rest of the items.
+
+    // verify that SubscribePresenceWatcherListL was called
+    COMMONASSERT( messenger, EXIMPPlgTestSubscribePresenceWatcherListCalled, "SubscribePresenceWatcherListL was not called", ETrue, NULL );
+
+
+    //-------------------------------------------------
+    // unsubscribe
+
+    // Setup status event listener for RequestComplete
+    listener2->Reset();
+
+    evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+    listener2->ExpectL( evReqComplete );
+    CleanupStack::Pop( evReqComplete );
+
+    // register interest
+    reqId = presPub.UnsubscribePresenceWatcherListL();
+
+    EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Unsubscribe failed" );
+
+    // verify that UnsubscribePresenceWatcherListL was called
+    COMMONASSERT( messenger, EXIMPPlgTestUnsubscribePresenceWatcherListCalled, "UnsubscribePresenceWatcherListL was not called", ETrue, NULL );
+
+    //-------------------------------------------------
+    // unsubscribe nonsubscribed
+
+    // Setup status event listener for RequestComplete
+    listener2->Reset();
+
+    evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+    listener2->ExpectL( evReqComplete );
+    CleanupStack::Pop( evReqComplete );
+
+    // register interest
+    reqId = presPub.UnsubscribePresenceWatcherListL();
+
+    // Wait for events on the request
+    EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Unsubscribe failed" );
+
+    // verify that UpdateInterest was called
+    COMMONASSERT( messenger, EXIMPPlgTestUnsubscribePresenceWatcherListCalled, "UnsubscribePresenceWatcherListL was not called", ETrue, NULL );
+
+
+
+    listener2->SetEventSourceL( NULL );
+
+    UnbindL();
+
+    CleanupStack::PopAndDestroy( listener2 );
+    }
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+// Subscribe, Unsubscribe - Multiple clients
+void T_PresenceWatcherListManagement::T_SubscribePresenceWatcherList_Multiple_L()
+    {
+    EUNIT_PRINT( _L("Multiple client presence watcher list subscription") );
+
+    BindAllL();
+
+    TInt countOfWrappers = iWrapperMgr->WrapperCount();
+    for( TInt a = 0; a < countOfWrappers; ++a )
+        {
+        CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a );
+        MXIMPContext* context = wrapper->GetContext();
+        CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+        // Tell the protocol it should act normally
+        messenger->SetNoError();
+
+        CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context );
+        CleanupStack::PushL( listener2 );
+
+        // Get the interfaces
+        MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+        MPresencePublishing& presPub = presFeat->PresencePublishing();
+
+        // Setup status event listener for RequestComplete
+        listener2->Reset();
+
+        TXIMPRequestId reqIdDummy;  // not checked
+        CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+        listener2->ExpectL( evReqComplete );
+        CleanupStack::Pop( evReqComplete );
+
+        // Subscribe
+        TXIMPRequestId reqId = presPub.SubscribePresenceWatcherListL();
+
+        // Wait for events on the request
+        EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Subscribe failed" );
+
+        // verify that SubscribePresenceWatcherListL was called
+        COMMONASSERT( messenger, EXIMPPlgTestSubscribePresenceWatcherListCalled, "SubscribePresenceWatcherListL was not called", ETrue, NULL );
+
+        CleanupStack::PopAndDestroy( listener2 );
+        }
+    for( TInt a = 0; a < countOfWrappers; ++a )
+        {
+        CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a );
+        MXIMPContext* context = wrapper->GetContext();
+        CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+        CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context );
+        CleanupStack::PushL( listener2 );
+
+        // Get the interfaces
+        MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+        MPresencePublishing& presPub = presFeat->PresencePublishing();
+
+        // Setup status event listener for RequestComplete
+        listener2->Reset();
+
+        TXIMPRequestId reqIdDummy;  // not checked
+        CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+        listener2->ExpectL( evReqComplete );
+        CleanupStack::Pop( evReqComplete );
+
+        // Unsubscribe
+        TXIMPRequestId reqId = presPub.UnsubscribePresenceWatcherListL();
+
+        // Wait for events on the request
+        EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Unsubscribe failed" );
+
+        // verify that unsubscribe was called
+        COMMONASSERT( messenger, EXIMPPlgTestUnsubscribePresenceWatcherListCalled,
+            "UnsubscribePresenceWatcherListL was not called",
+            ( a < 2 ) ? EFalse : ETrue,
+            "UnsubscribePresenceWatcherListL was called" );
+
+        CleanupStack::PopAndDestroy( listener2 );
+        }
+
+    UnbindAllL();
+    }
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+void T_PresenceWatcherListManagement::SubscribeL()
+    {
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    MXIMPContext* context = wrapper->GetContext();
+    CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+    // Get the interfaces
+    MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+    MPresencePublishing& presPub = presFeat->PresencePublishing();
+
+    CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context );
+    CleanupStack::PushL( listener2 );
+
+    // Setup status event listener for RequestComplete
+    listener2->Reset();
+
+    TXIMPRequestId reqIdDummy;  // not checked
+    CXIMPRequestCompleteEventImp* evReqComplete =
+                    CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+    listener2->ExpectL( evReqComplete );
+    CleanupStack::Pop( evReqComplete );
+
+    // subscribe
+    TXIMPRequestId reqId = presPub.SubscribePresenceWatcherListL();
+
+    // Wait for events on the request
+    EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Subscribe failed" );
+
+    COMMONASSERT( messenger, EXIMPPlgTestSubscribePresenceWatcherListCalled, "SubscribeWatcherListL was not called", ETrue, NULL );
+
+    CleanupStack::PopAndDestroy( listener2 );
+    }
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+void T_PresenceWatcherListManagement::UnsubscribeL()
+    {
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    MXIMPContext* context = wrapper->GetContext();
+    CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+    // Get the interfaces
+    MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+    MPresencePublishing& presPub = presFeat->PresencePublishing();
+
+    // Setup status event listener for RequestComplete
+    CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context );
+    CleanupStack::PushL( listener2 );
+
+    // Setup status event listener for RequestComplete
+    listener2->Reset();
+
+    TXIMPRequestId reqIdDummy;  // not checked
+    CXIMPRequestCompleteEventImp* evReqComplete =
+                    CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
+    listener2->ExpectL( evReqComplete );
+    CleanupStack::Pop( evReqComplete );
+
+    // unsubscribe
+    TXIMPRequestId reqId = presPub.UnsubscribePresenceWatcherListL();
+
+    EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Unsbscribe failed" );
+
+    // verify that UnsubscribeWatcherListL was called
+    COMMONASSERT( messenger, EXIMPPlgTestUnsubscribePresenceWatcherListCalled, "UnsubscribeWatcherListL was not called", ETrue, NULL );
+
+    CleanupStack::PopAndDestroy( listener2 );
+
+    }
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+void T_PresenceWatcherListManagement::T_HandlePresenceWatcherList_L()
+    {
+    EUNIT_PRINT( _L("Handle presence watcher list.") );
+
+    BindL();
+    SubscribeL();
+
+    // ------------------------------------------------------
+    // some startup stuff
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    MXIMPContext* context = wrapper->GetContext();
+
+    CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context );
+    CleanupStack::PushL( listener2 );
+    // ------------------------------------------------------
+
+    // Tell the protocol it should act normally
+    wrapper->GetMessenger()->SetNoError();
+
+    // ------------------------------------------------------
+    // 1. Create faked server message about watcher list (empty)
+    SendSrvMsgL( CXIMPTestFileSrvMsg::ETestSrvMsgPresenceWatcherList );
+
+    // ------------------------------------------------------
+    // expect empty MPresencewatcherList event.
+
+    RPrWatLstInfoImpArray* currentList(NULL);
+    CPresenceWatcherListEventImp* event = CreateWatcherListEventLCX(
+            KNullDesC, KNullDesC,
+        MXIMPDataSubscriptionState::ESubscriptionActive,
+        MXIMPDataSubscriptionState::EDataAvailable,
+        ETestPWlCurrent, currentList);
+
+    listener2->ExpectL( event );
+    CleanupStack::Pop( event ); // 3 more items in cleanupstack
+
+    //Waqas: Fixed task Ticket#22
+    EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "HandlePresenceWatcherListL failed" );
+    CleanupStack::PopAndDestroy( 3 ); // lists
+    // ------------------------------------------------------
+
+
+    // ------------------------------------------------------
+    // 2. Create faked server message about watcher list (new)
+    listener2->Reset();
+
+    _LIT16( KWatcherUri1,      "http://carpe.diem.com" );
+    _LIT16( KWatcherDispName1, "DispnameA, LoremI" );
+
+    SendSrvMsgL( KWatcherUri1,
+                 KWatcherDispName1,
+                 CXIMPTestFileSrvMsg::ETestSrvMsgPresenceWatcherList );
+
+    // ------------------------------------------------------
+    // MPresencewatcherList event.
+
+    currentList = NULL; // previous one was destroyed
+    //Now create the actual event
+    event = CreateWatcherListEventLCX(  // previous event was destroyed
+            KWatcherUri1, KWatcherDispName1,
+        MXIMPDataSubscriptionState::ESubscriptionActive,
+        MXIMPDataSubscriptionState::EDataAvailable,
+        ETestPWlNew, currentList);
+    
+
+    listener2->ExpectL( event );
+    CleanupStack::Pop( event ); // 3 more items in cleanupstack
+
+    EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "HandlePresenceWatcherListL failed" );
+    CleanupStack::PopAndDestroy( 3 ); // lists
+
+
+    // ------------------------------------------------------
+    // 3. Create faked server message about watcher list (disappeared)
+    listener2->Reset();
+
+    SendSrvMsgL( CXIMPTestFileSrvMsg::ETestSrvMsgPresenceWatcherList );
+    // ------------------------------------------------------
+    // MPresencewatcherList event.
+
+    CXIMPIdentityImp* idForEvent = CXIMPIdentityImp::NewLC( KWatcherUri1 );
+    // we need to create current list to give to the event
+    currentList = new ( ELeave ) RPrWatLstInfoImpArray; // previous is destroyed
+    CleanupDeletePushL( currentList );
+            // create the group info
+    CPresenceWatcherInfoImp* watcherInfoForEvent = 
+                            CPresenceWatcherInfoImp::NewLC( (MPresenceWatcherInfo::TWatcherType)0, *idForEvent, KWatcherDispName1);
+    currentList->AppendL( watcherInfoForEvent );
+    CleanupStack::Pop( watcherInfoForEvent );
+    CleanupStack::Pop( currentList );
+    CleanupStack::PopAndDestroy( idForEvent );    
+
+
+    //Now create the actual event
+    event = CreateWatcherListEventLCX(
+            KWatcherUri1, KWatcherDispName1,
+        MXIMPDataSubscriptionState::ESubscriptionActive,
+        MXIMPDataSubscriptionState::EDataAvailable,
+        ETestPWlDisappeared, currentList);
+
+    listener2->ExpectL( event );
+    CleanupStack::Pop( event ); // 3 more items in cleanupstack
+
+    //Waqas: Fixed task Ticket#22
+    EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "HandlePresenceWatcherListL failed" );
+
+    CleanupStack::PopAndDestroy( 3 ); // lists
+
+
+    // clean it up
+    UnsubscribeL();
+    
+    /* TODO later on better time.
+    // ------------------------------------------------------
+    // 4. Create faked server message about watcher list (no subscribers to list)
+    //    Make sure no event is 
+    listener2->Reset();
+    
+    event = CreateWatcherListEventLCX(
+            KNullDesC, KNullDesC,
+            ETestPWlEmpty );
+
+    //EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "HandlePresenceWatcherListL failed" );
+
+    */
+    CleanupStack::PopAndDestroy( listener2 );
+    
+    UnbindL();
+    }
+
+////////////////////////////////////////////////////
+//// INTIA CASE 
+////////////////////////////////////////////////////
+void T_PresenceWatcherListManagement::T_IndiaCase_L()
+    {
+
+    EUNIT_PRINT( _L("Presence notification subscribed list, Intia") );
+   
+
+    BindL();
+
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    MXIMPContext* presenceCtx = wrapper->GetContext();
+    CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+    CXIMPTestListener* ctxObserver = CXIMPTestListener::NewL( presenceCtx );
+    CleanupStack::PushL( ctxObserver );  // << ctxObserver
+  
+
+    // Tell the protocol it should act normally
+    messenger->SetNoError();
+
+       // Get the interfaces
+    MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+    MPresencePublishing& presPub = presFeat->PresencePublishing();
+    MPresentityGroups& presGroups = presFeat->PresentityGroups();    
+    MPresenceWatching& presWatch = presFeat->PresenceWatching();
+    
+    MXIMPObjectFactory& objFactory = presenceCtx->ObjectFactory();
+    
+    _LIT( KGroupId, "rakesh.harsh/Friends" );
+    _LIT( KGroupDisplayName, "my_friend" );
+    _LIT( KMemberId1, "user1" );
+    _LIT( KMember1DisplayName, "user1DisplayName" );
+    _LIT( KMemberId2, "user2" );
+    _LIT( KMember2DisplayName, "user2DisplayName" );
+    
+    
+    // Create test variables
+    MXIMPIdentity* testGroupId = objFactory.NewIdentityLC();   // << testGroupId
+    testGroupId->SetIdentityL( KGroupId ); 
+        
+    MXIMPIdentity* member1 = objFactory.NewIdentityLC(); // << member1
+    member1->SetIdentityL( KMemberId1 );
+    
+    MXIMPIdentity* member2 = objFactory.NewIdentityLC(); // << member2
+    member2->SetIdentityL( KMemberId2 );
+    
+    //////////////////////////////////////////////////////////////////////////
+    // SUBSCRIBE PRESENTITY GROUP LIST
+    //////////////////////////////////////////////////////////////////////////
+    
+    // Setup status event listener for RequestComplete
+    TXIMPRequestId reqId;  
+    ctxObserver->Reset();
+    CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqId );// << evReqComplete
+    ctxObserver->ExpectL( evReqComplete );
+    CleanupStack::Pop( evReqComplete ); // >> evReqComplete 
+    
+    SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk );
+    
+    // subscribe PresentityGroupList
+    reqId = presGroups.SubscribePresentityGroupListL();
+    
+    // Wait for events on the request
+    wrapper->WaitRequestAndStackEvents( reqId );
+    wrapper->VerifyEventStackL( _L8("Subscribing presentity group list, complete with error: ") );
+    
+    // verify that SubscribePresentityGroupListL was called
+    messenger->AssertSubscribePresentityGroupListCalled( ETrue );
+    
+    
+    // get list request
+/*    TXIMPRequestId req = presGroups.SubscribePresentityGroupListL(); 
+    ctxObserver->WaitOpToCompleteL( req );
+
+    CUserAfter::AfterL( 1000000 );
+*/
+    
+    //////////////////////////////////////////////////////////////////////////
+    // SUBSCRIBE PRESENTITY GROUP CONTENT
+    //////////////////////////////////////////////////////////////////////////    
+
+    // Setup status event listener for RequestComplete
+    ctxObserver->Reset();
+    evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqId );
+    ctxObserver->ExpectL( evReqComplete );
+    CleanupStack::Pop( evReqComplete );
+    SetupListenerReqCompleteL( wrapper, EXIMPTestStatusEvents_RequestOk );
+            
+    // subscribe group content
+    reqId = presGroups.SubscribePresentityGroupContentL( *testGroupId );
+    
+    // Wait for events on the request
+    wrapper->WaitRequestAndStackEvents( reqId );
+    wrapper->VerifyEventStackL( _L8("Subscribe presentity group content, complete with error: ") );
+
+    COMMONASSERT( messenger, EXIMPPlgTestSubscribePresentityGroupContentCalled, "SubscribeGroupContentL was not called", ETrue, NULL );
+    
+/*    TInt count = ctxObserver->gidcount;
+    // List manage request
+     for(TInt i = 0; i<count;i++)
+     { 
+      //get the content of the lists
+       MXIMPIdentity*   tgid = objFactory.NewIdentityLC();
+     tgid->SetIdentityL( ctxObserver->gid[i] ); 
+    // tgid->SetIdentityL( _L("rakesh.harsh/basu2@nokia.com") );
+      
+      TXIMPRequestId  req = presGroups.SubscribePresentityGroupContentL( *tgid );
+    
+      ctxObserver->WaitOpToCompleteL( req );
+    
+      CleanupStack::PopAndDestroy( 1 ); //  tgid
+     }  */
+     
+    //////////////////////////////////////////////////////////////////////////
+    // CREATE PRESENTITY GROUP
+    /////////////////////////////////////////////////////////////////////////
+    
+    // Setup status event listener for RequestComplete
+    // This will also produce HandlePresentityGroupListEvent, since the
+    // the group is subscribed 
+    ctxObserver->Reset();
+    evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqId );
+    ctxObserver->ExpectL( evReqComplete );
+    CleanupStack::Pop( evReqComplete );//TODO???
+
+    SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk );
+
+    // Create group
+    reqId = presGroups.CreatePresentityGroupL( *testGroupId, KGroupDisplayName );
+    
+    // Wait for events on the request
+    wrapper->WaitRequestAndStackEvents( reqId );
+    wrapper->VerifyEventStackL( _L8("CreatePresentityGroupL failed, complete with error: ") );
+    
+    // verify that SubscribePresentityGroupListL was called
+    messenger->AssertCreatePresentityGroupCalled( ETrue );
+
+    
+                   
+    // first make a test group in our roster
+ /*   MXIMPIdentity* newGroupId = objFactory.NewIdentityLC();//1
+    newGroupId->SetIdentityL( _L("rakesh.harsh/Friends") );
+
+    req = presGroups.CreatePresentityGroupL( *newGroupId,_L("my_friend") );
+    // wait completion
+    ctxObserver->WaitOpToCompleteL( req );
+      
+    CUserAfter::AfterL( 1000000 );*/
+    
+    //////////////////////////////////////////////////////////////////////////
+    // ADD PRESENTITY GROUP MEMBER
+    ////////////////////////////////////////////////////////////////////////// 
+    
+    // Setup event listener for RequestComplete
+    ctxObserver->Reset();
+    evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqId ); // << evReqComplete
+
+    // group id
+    CXIMPIdentityImp* grid = CXIMPIdentityImp::NewLC( testGroupId->Identity() ); // << grid
+    evReqComplete->AppendParamL( grid );
+    CleanupStack::Pop(); // >> grid
+
+    // id for member info
+    CXIMPIdentityImp* miId = CXIMPIdentityImp::NewLC( KMemberId1 ); // << miId
+    // member info
+    CPresentityGroupMemberInfoImp* memInfoImp =
+        CPresentityGroupMemberInfoImp::NewLC( *miId, KMember1DisplayName ); // << memInfoImp
+    evReqComplete->AppendParamL( memInfoImp );
+    CleanupStack::Pop(); // memInfoImp owned by AppendParamL    // >> memInfoImp
+    CleanupStack::PopAndDestroy( miId ); // copy was made   // >>> miId
+
+    ctxObserver->ExpectL( evReqComplete );
+    CleanupStack::Pop( evReqComplete ); // >> evReqComplete
+
+    // do the call
+    reqId = presGroups.AddPresentityGroupMemberL(
+            *testGroupId, *member1, KMember1DisplayName );
+
+    // Wait for events on the request
+    wrapper->WaitRequestAndStackEvents( reqId );
+    messenger->AssertAddPresentityGroupMemberCalled( ETrue );
+
+ 
+    //add a member
+/*    MXIMPIdentity* testContactId = objFactory.NewIdentityLC();
+    testContactId->SetIdentityL( _L("mukesh") );
+    req = presGroups.AddPresentityGroupMemberL( *newGroupId,
+                                                *testContactId,
+                                                _L("h2") );
+    // wait completion
+    ctxObserver->WaitOpToCompleteL( req );
+    
+    
+    CUserAfter::AfterL( 1000000 );*/
+    
+    
+    //////////////////////////////////////////////////////////////////////////
+    // ADD PRESENTITY GROUP MEMBER
+    ////////////////////////////////////////////////////////////////////////// 
+
+    // Setup event listener for RequestComplete
+    ctxObserver->Reset();
+    evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqId ); // << evReqComplete
+
+    // group id
+    CXIMPIdentityImp* grid2 = CXIMPIdentityImp::NewLC( testGroupId->Identity() );
+    evReqComplete->AppendParamL( grid2 );
+    CleanupStack::Pop(); // grid2
+
+    // id for member info
+    CXIMPIdentityImp* miId2 = CXIMPIdentityImp::NewLC( KMemberId2 );
+    // member info
+    CPresentityGroupMemberInfoImp* memInfoImp2 =
+        CPresentityGroupMemberInfoImp::NewLC( *miId2, KMember2DisplayName );
+    evReqComplete->AppendParamL( memInfoImp2 );
+    CleanupStack::Pop(); // memInfoImp owned by AppendParamL
+    CleanupStack::PopAndDestroy( miId2 ); // copy was made
+
+    ctxObserver->ExpectL( evReqComplete );
+    CleanupStack::Pop( evReqComplete );
+    // reset the variable
+    messenger->SetValueFor( EXIMPPlgTestAddPresentityGroupMemberCalled, 0 );
+    // do the call
+    reqId = presGroups.AddPresentityGroupMemberL(
+            *testGroupId, *member2, KMember2DisplayName );
+
+    // Wait for events on the request
+    wrapper->WaitRequestAndStackEvents( reqId );
+    messenger->AssertAddPresentityGroupMemberCalled( ETrue );
+
+    
+/*    testContactId->SetIdentityL( _L("bb0") );
+    req = presGroups.AddPresentityGroupMemberL( *newGroupId,
+                                                *testContactId,
+                                                _L("b1") );
+    // wait completion
+    ctxObserver->WaitOpToCompleteL( req );
+    
+*/    
+    //////////////////////////////////////////////////////////////////////////
+    // SUBSCRIBE PRESENTITY GROUP MEMBERS PRESENCE
+    ////////////////////////////////////////////////////////////////////////// 
+        
+    // Setup status event listener for RequestComplete
+    ctxObserver->Reset();
+    evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqId );
+    ctxObserver->ExpectL( evReqComplete );
+    CleanupStack::Pop( evReqComplete );
+    SetupListenerReqCompleteL( wrapper, EXIMPTestStatusEvents_RequestOk );
+
+    
+    // Set filter for the group
+    MPresenceInfoFilter* gpif = presFeat->PresenceObjectFactory().NewPresenceInfoFilterLC();
+    gpif->AcceptPersonFilterL( NPresenceInfo::NFieldType::KStatusMessage  );
+    gpif->AcceptPersonFilterL( NPresenceInfo::NFieldType::KAvatar );
+
+    // register interest
+    reqId = presWatch.SubscribePresentityGroupMembersPresenceL( *testGroupId, *gpif );
+    
+    CleanupStack::PopAndDestroy(); // >>> gpif
+
+    // Wait for events on the request
+    wrapper->WaitRequestAndStackEvents( reqId );
+    wrapper->VerifyEventStackL( _L8("Subscribe presentity group members, complete with error: ") );
+        
+    // verify that UpdateInterest was called
+    COMMONASSERT( messenger, EXIMPPlgTestSubscribePresentityGroupMembersPresesenceCalled, "SubscribePresentityGroupMembersPresenceL was not called", ETrue, NULL );
+
+     
+
+/*    CUserAfter::AfterL( 1000000 );
+    MPresenceWatching& presWatch = presenceCtx->PresenceWatching();
+    MPresenceInfoFilter* infoFilt = objFactory.NewPresenceInfoFilterLC();
+    req = presWatch.SubscribePresentityGroupMembersPresenceL( *newGroupId, *infoFilt );
+    // wait completion
+    ctxObserver->WaitOpToCompleteL( req );
+    
+   // req = presWatch.SubscribePresentityPresenceL( *testContactId, *infoFilt );
+    // wait completion
+   // ctxObserver->WaitOpToCompleteL( req );
+    //MXIMPClient* presClient1 = NULL;
+   // MXIMPContext* presenceCtx1 = NULL;
+    //CUSContextObserver* ctxObserver1  = NULL;
+    
+    /*TInt pushCount1 = DoSetupDefaultContext1LC( presClient1,
+                                              presenceCtx1,
+                                              ctxObserver1 );
+    
+    ctxObserver->WaitOpToCompleteL( req );*/
+ //   CUserAfter::AfterL( 60000000 ); //60 seconds
+    
+    /*if ( !iWait.IsStarted() )
+			{    
+			iWait.Start();  // CSI: 10 # iWait is not an active object
+			}
+     */
+    //code is for login with diff id 
+     //Initialize XIMP client
+ /*  #if 0
+    MXIMPClient* presClient1 = MXIMPClient::NewClientL();
+    CleanupDeletePushL( presClient );
+      
+    //Create new sink to receive presence context events
+    CUSContextObserver* eventObserver1 = CUSContextObserver::NewLC();
+
+    //Create new presence context
+    MXIMPContext* presecenCtx1 = presClient->NewPresenceContextLC();
+    presecenCtx1->RegisterObserverL( *eventObserver1 );
+
+    //Bind context to desired presence service
+    TUid protocolUid = TUid::Uid( KProtocolUid );
+
+
+    //Bind context to desired presence service
+     req = presecenCtx1->BindToL( protocolUid,
+                                               KServerAddress,
+                                               KUserName2,
+                                               KPassword2,
+                                               KIAP );
+ 
+    //Wait with CActiveSchedulerWait the binding to complete
+    //If binding fails, it is handled with leave
+    eventObserver1->WaitOpToCompleteL( req );
+    MXIMPIdentity* newGroupId1 = objFactory.NewIdentityLC();//1
+    newGroupId1->SetIdentityL( _L("bb0/jaya") );
+
+     req = presGroups.CreatePresentityGroupL( *newGroupId1,_L("my_sweety") );
+    // wait completion
+    ctxObserver->WaitOpToCompleteL( req );
+      
+    CUserAfter::AfterL( 1000000 );
+    presecenCtx1->UnbindL();
+    eventObserver1->WaitOpToCompleteL( req );
+    CleanupStack::PopAndDestroy( 4 ); //newGroupId1,presecenCtx1,eventObserver1,presClient1
+    
+    #endif*/
+    //code is for login with diff id end
+    
+    //add this user to bb0's contact list.i should  recieve notification
+    
+    //   delete group friend which is created above statement 
+    //req = presGroups.DeletePresentityGroupL( *newGroupId );
+    // wait completion
+   // ctxObserver->WaitOpToCompleteL( req );
+ //   CUserAfter::AfterL( 60000000 );
+    //Unbind the context and wait completion
+  //  req = presenceCtx->UnbindL();
+  //  ctxObserver->WaitOpToCompleteL( req );
+
+    //Destroy the context (it is automaticly unbind)
+ //   CleanupStack::PopAndDestroy( 3 ); //  infoFilt,testContactId,newGroupId
+ //   CleanupStack::PopAndDestroy( pushCount );	
+ 
+ 
+    //////////////////////////////////////////////////////////////////////////
+    // SEND DATA FOR GROUP MEMBER -> HANDLE PRESENTITY PRESENCE
+    ////////////////////////////////////////////////////////////////////////// 
+
+     
+     // create test message
+    CPresenceInfoImp* presenceInfo = CPresenceInfoImp::NewLC(); // << presenceInfo
+    HBufC8* packedInfo = TXIMPObjectPacker< CPresenceInfoImp >::PackL( *presenceInfo );
+    CleanupStack::PopAndDestroy( presenceInfo );// >>> presenceInfo
+    CleanupStack::PushL( packedInfo );  // << packedInfo
+    
+    CXIMPIdentityImp* changed = CXIMPIdentityImp::NewLC( ); // << changed
+    changed->SetIdentityL( KMemberId1 );
+    HBufC8* packedId = TXIMPObjectPacker< CXIMPIdentityImp >::PackL( *changed );
+    CleanupStack::PopAndDestroy(); // >>> changed
+    CleanupStack::PushL( packedId );// << packedId
+    
+    RPointerArray< HBufC8 > bufferArray;
+    CleanupClosePushL( bufferArray );   // << bufferArray
+    bufferArray.AppendL( packedId );
+    bufferArray.AppendL( packedInfo );
+    
+    HBufC8* packedBufferArray = TXIMPHBuf8Packer::PackArrayL( bufferArray );
+    CleanupStack::PopAndDestroy( 2 ); // >>> packedId, packedInfo
+    CleanupStack::PopAndDestroy(); // >>> bufferArray
+    CleanupStack::PushL( packedBufferArray );   // << packedBufferArray
+    
+    // Send it to plugin 
+    CXIMPTestFileSrvMsg* srvMsg = CXIMPTestFileSrvMsg::NewL( CXIMPTestFileSrvMsg::ETestSrvMsgPresentityPresence, 
+                                                             *packedBufferArray );
+    CleanupStack::PopAndDestroy( packedBufferArray );   // >>> packedBufferArray
+    
+    CleanupStack::PushL( srvMsg );  // << srvMsg
+    wrapper->FileTool().SrvMsgStoreL( srvMsg );
+    CleanupStack::PopAndDestroy( srvMsg );  // >>> srvMsg
+    wrapper->FileTool().CleanAllL();
+
+    // Wait for server to handle srvmsg.
+    User::After( 4 * 1000000 );       
+
+    COMMONASSERT( messenger, EXIMPPlgTestHandlePresentityPresenceCalled, "HandlePresentityPresenceL was not called", ETrue, NULL );
+
+    CleanupStack::PopAndDestroy( 3 ); // >>> testGroupId, member1, member2
+    CleanupStack::PopAndDestroy( ctxObserver ); // >>> ctxObserver
+    
+    UnbindL(); 
+
+}
+// ===========================================================================
+// SETUP HELPERS FOR THE LISTENER
+// ===========================================================================
+//
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+// send a faked server-originated message with watcher info made
+// from the given uri and displayname
+//
+void T_PresenceWatcherListManagement::SendSrvMsgL(
+        const TDesC& aUri, const TDesC& aDispName,
+        TInt aMsgType )
+    {
+    // we'll use hard-coded wrapper 0 instance for now.
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+
+    // create a grant req info contained within the server-originated
+    // faked message
+    RXIMPObjOwningPtrArray<CPresenceWatcherInfoImp> watcherList;
+    CleanupClosePushL( watcherList );
+
+    CXIMPIdentityImp* watcherId = CXIMPIdentityImp::NewLC( aUri );
+    CPresenceWatcherInfoImp* watcherItem =
+                CPresenceWatcherInfoImp::NewLC(
+                            (MPresenceWatcherInfo::TWatcherType)0,
+                            *watcherId,
+                            aDispName );
+    watcherList.AppendL( watcherItem );
+    CleanupStack::Pop( watcherItem );
+    CleanupStack::PopAndDestroy( watcherId );
+
+    HBufC8* packedArray =
+        TXIMPObjectPacker<CPresenceWatcherInfoImp>::PackArrayL( watcherList );
+    CleanupStack::PushL( packedArray );
+
+    // use filetool to send it for plugin.
+    CXIMPTestFileSrvMsg* srvMsg = CXIMPTestFileSrvMsg::NewL( aMsgType,
+            *packedArray );
+    CleanupStack::PushL( srvMsg );
+    wrapper->FileTool().CleanAllL();
+    wrapper->FileTool().SrvMsgStoreL( srvMsg );
+    CleanupStack::PopAndDestroy( 3 ); // srvMsg, packedArray, watcherList
+    }
+
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+// send a faked server-originated message with empty contents
+//
+void T_PresenceWatcherListManagement::SendSrvMsgL( TInt aMsgType )
+    {
+    // we'll use hard-coded wrapper 0 instance for now.
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+
+    // create a server-originated faked message with empty contents
+    RXIMPObjOwningPtrArray<CPresenceWatcherInfoImp> watcherList;
+
+    HBufC8* packedArray = TXIMPObjectPacker<CPresenceWatcherInfoImp>::PackArrayL( watcherList );
+    CleanupStack::PushL( packedArray );
+
+    // use filetool to send it for plugin.
+    CXIMPTestFileSrvMsg* srvMsg = CXIMPTestFileSrvMsg::NewL( aMsgType,
+            *packedArray );
+    CleanupStack::PushL( srvMsg );
+    wrapper->FileTool().CleanAllL();
+    wrapper->FileTool().SrvMsgStoreL( srvMsg );
+    CleanupStack::PopAndDestroy( 2 ); // srvMsg, packedArray
+    }
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+// create a watcher list event with given arrays
+//
+CPresenceWatcherListEventImp* T_PresenceWatcherListManagement::CreateWatcherListEventLCX(
+        const TDesC& aUri,
+        const TDesC& aDispName,
+            MXIMPDataSubscriptionState::TSubscriptionState aSubscriptionState,
+            MXIMPDataSubscriptionState::TDataState aDataState,
+            TTestPWlOperation aOperation,
+            RPrWatLstInfoImpArray* aCurrentList)
+    {
+    // create the arrays
+
+
+    // new list
+    RPrWatLstInfoImpArray* newList = new ( ELeave ) RPrWatLstInfoImpArray;
+    CleanupDeletePushL( newList );
+
+    // current list, created by caller
+    if(!aCurrentList) // if client didnt created the list
+        aCurrentList = new ( ELeave ) RPrWatLstInfoImpArray;
+    CleanupDeletePushL( aCurrentList );
+
+    // disappeared list
+    RPrWatLstInfoImpArray* disappearedList = new ( ELeave ) RPrWatLstInfoImpArray;
+    CleanupDeletePushL( disappearedList );
+
+    // create the watcher info
+    CPresenceWatcherInfoImp* watcherInfoForEvent1 = NULL; 
+            {
+            CXIMPIdentityImp* idForEvent = CXIMPIdentityImp::NewLC( aUri );
+            watcherInfoForEvent1 = CPresenceWatcherInfoImp::NewLC( (MPresenceWatcherInfo::TWatcherType)0, *idForEvent, aDispName );
+            CleanupStack::Pop( watcherInfoForEvent1 );        
+            CleanupStack::PopAndDestroy( idForEvent ); 
+            CleanupStack::PushL( watcherInfoForEvent1 );        
+            }
+    
+    CPresenceWatcherInfoImp* watcherInfoForEvent2 = 
+            TXIMPObjectCloner< CPresenceWatcherInfoImp >::CloneLC( *watcherInfoForEvent1 );
+    
+    TInt count(0);
+    TBool found(EFalse);
+    TInt i(0);
+    
+    // put the given watcher info into the specified array
+    switch ( aOperation )
+        {
+        case ETestPWlNew:
+            {
+            newList->AppendL( watcherInfoForEvent2 );
+            CleanupStack::Pop( watcherInfoForEvent2 );
+            
+            aCurrentList->AppendL( watcherInfoForEvent1 );
+            CleanupStack::Pop( watcherInfoForEvent1 );
+            }
+            break;
+        case ETestPWlCurrent:
+            {
+            // don't add, thus return what user has given
+            CleanupStack::PopAndDestroy( watcherInfoForEvent2 ); // watcherInfoForEvent2
+            CleanupStack::PopAndDestroy( watcherInfoForEvent1 ); // watcherInfoForEvent1
+            }
+            break;
+        case ETestPWlDisappeared:
+            {
+            // search the given id in current list
+            count = aCurrentList->Count();
+            for(i=0;i<count;i++)
+                {
+                // if dispname and id are same
+                if (( ((((*aCurrentList)[i])->WatcherId()).Identity()) == aUri )
+                    && ( (((*aCurrentList)[i])->WatcherDisplayName()) == aDispName ))
+                    {
+                    found = ETrue;
+            break;            
+                    }
+                }
+            if(found) // do we need to leave if error? Waqas
+            {
+                delete (*aCurrentList)[i];
+                aCurrentList->Remove(i);
+                disappearedList->AppendL( watcherInfoForEvent2 );
+                CleanupStack::Pop( watcherInfoForEvent2 );
+                }
+            else
+                CleanupStack::PopAndDestroy( watcherInfoForEvent2 );
+            
+            CleanupStack::PopAndDestroy( watcherInfoForEvent1 );
+            }
+            break;
+        default:
+            {
+            User::Leave( KErrArgument );
+            }
+            break;            
+        };
+
+    CXIMPDataSubscriptionStateImp* stateImp = CXIMPDataSubscriptionStateImp::NewLC();
+    stateImp->SetDataStateL( aDataState );
+    stateImp->SetSubscriptionStateL( aSubscriptionState );
+    CleanupStack::Pop( stateImp );
+
+    // create the actual event
+    CPresenceWatcherListEventImp* tmp =
+        CPresenceWatcherListEventImp::NewLC(
+                newList,
+                aCurrentList,
+                disappearedList,
+                stateImp );
+     
+
+    /*
+     * In cleanupstack there are 4 items, FIFO
+     *   - new list
+     *   - current list
+     *   - disappeared list
+     *   - event imp
+     */
+
+    return tmp;
+    }
+
+void T_PresenceWatcherListManagement::SetupListenerReqCompleteL( CXIMPTestContextWrapper* aWrapper, TXIMPTestStatusEventTemplate aEventType )
+    {
+    RArray< TInt32 > array;
+    CleanupClosePushL( array );
+    array.AppendL( MXIMPRequestCompleteEvent::KInterfaceId );
+    array.Append( MXIMPContextStateEvent::KInterfaceId );
+    array.Append( MPresentityPresenceEvent::KInterfaceId );
+    aWrapper->SetupListenerReqCompleteL( aEventType, &array );
+    CleanupStack::PopAndDestroy(); // array
+    }
+
+void T_PresenceWatcherListManagement::SetupListenerReqCompleteAllowEventsL(  CXIMPTestContextWrapper* aWrapper, TXIMPTestStatusEventTemplate aEventType )
+    {
+    RArray< TInt32 > array;
+    CleanupClosePushL( array );
+    array.AppendL( MXIMPRequestCompleteEvent::KInterfaceId );
+    array.AppendL( MXIMPContextStateEvent::KInterfaceId );
+    array.AppendL( MPresentityPresenceEvent::KInterfaceId );
+    aWrapper->SetupListenerReqCompleteL( aEventType, &array );
+    CleanupStack::PopAndDestroy(); // array
+    }
+
+// ===========================================================================
+// EVENT OBSERVER METHODS
+// ===========================================================================
+//
+void T_PresenceWatcherListManagement::HandlePresenceContextEvent(
+    const MXIMPContext& aContext,
+    const MXIMPBase& aEvent )
+    {
+    iLastError = KErrNone;
+    TInt ifId = aEvent.GetInterfaceId();
+    TInt gg = MPresentityPresenceEvent::KInterfaceId;
+    if( ifId == MPresenceWatcherListEvent::KInterfaceId )
+        {
+        const MPresenceWatcherListEvent* watcherListEvent = 
+        TXIMPGetInterface< const MPresenceWatcherListEvent >::From( aEvent, MXIMPBase::EPanicIfUnknown );
+        
+        if( watcherListEvent->NewWatchersCount() )
+            {
+            iLastEvent = EWatcherList;
+            TInt count = watcherListEvent->NewWatchersCount();
+            for( TInt a = 0; a < count; ++a )
+                {
+                TRAPD( error,
+                    CPresenceWatcherInfoImp* watcherInfo = CPresenceWatcherInfoImp::NewLC(
+                        watcherListEvent->NewWatcher( a ).WatcherType(),
+                        watcherListEvent->NewWatcher( a ).WatcherId(),
+                        watcherListEvent->NewWatcher( a ).WatcherDisplayName() );
+                    iValidateArray.AppendL( watcherInfo );
+                    CleanupStack::Pop( watcherInfo );
+                    );
+                if( error != KErrNone )
+                    {
+                    iLastError = error;
+                    return;
+                    }
+                }
+            }
+            }
+    else if( ifId == MPresentityPresenceEvent::KInterfaceId )
+        {
+        const MPresentityPresenceEvent* presentityPresenceEvent = 
+        TXIMPGetInterface< const MPresentityPresenceEvent >::From( aEvent, MXIMPBase::EPanicIfUnknown );
+        const MXIMPIdentity& prId = presentityPresenceEvent->PresentityId();
+        const MPresenceInfo& prPif = presentityPresenceEvent->SubscribedPresence(); 
+        const MXIMPDataSubscriptionState& prDataStae =  presentityPresenceEvent->DataSubscriptionState();
+        }
+    else
+        {
+        iLastEvent = EInvalid;
+        }
+    }
+
+// ===========================================================================
+// TEST CASE TABLE
+// ===========================================================================
+//
+EUNIT_BEGIN_TEST_TABLE(
+        T_PresenceWatcherListManagement,
+        "XIMP presence watching tests",
+        "MODULE" )
+
+PRFW_DECORATED_TEST(
+        "Bind Unbind",
+        "",
+        "",
+        "FUNCTIONALITY",
+        Setup_L,
+        T_BindUnbind_L,
+        Teardown )
+
+PRFW_DECORATED_TEST(
+        "Single client watcher list subscription",
+        "",
+        "",
+        "FUNCTIONALITY",
+        Setup_L,
+        T_SubscribePresenceWatcherList_Single_L,
+        Teardown )
+
+PRFW_DECORATED_TEST(
+        "Multiple client watcher list subscription",
+        "",
+        "",
+        "FUNCTIONALITY",
+        SetupMultiple_L,
+        T_SubscribePresenceWatcherList_Multiple_L,
+        Teardown )
+
+PRFW_DECORATED_TEST(
+        "Handle Presence Watcher List",
+        "",
+        "",
+        "FUNCTIONALITY",
+        Setup_L,
+        T_HandlePresenceWatcherList_L,
+        Teardown )
+        
+ PRFW_DECORATED_TEST(
+        "Test India Case",
+        "",
+        "",
+        "FUNCTIONALITY",
+        Setup_L,
+        T_IndiaCase_L,
+        Teardown )
+
+
+EUNIT_END_TEST_TABLE
+
+
+// ===========================================================================
+// TEST SUITE CONSTRUCTION
+// ===========================================================================
+//
+EXPORT_C MEUnitTest* CreateTestSuiteL()
+    {
+    return T_PresenceWatcherListManagement::NewL();
+    }
+
+
+// end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/tsrc/src/t_presencewatcherlistmngt/t_presencewatcherlistmngt.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,183 @@
+/*
+* 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: XIMP Framework Test Code 
+*
+*/
+
+#ifndef T_PRESENCEWATCHERLISTMANAGEMENT_H
+#define T_PRESENCEWATCHERLISTMANAGEMENT_H
+
+
+//  EXTERNAL INCLUDES
+#include <platform/digia/eunit/ceunittestsuiteclass.h>
+#include <platform/digia/eunit/EUnitDecorators.h>
+
+#include <ximpbase.h>
+#include <ximpcontextobserver.h>
+#include "presencetypehelpers.h"
+#include "prfwteststatuseventlistener.h"
+#include "prfwtestmessaging.h"
+
+class CXIMPTestContextWrapper;
+class CXIMPTestContextWrapperMgr;
+class CXIMPTestMessenger;
+class CPresenceWatcherInfoImp;
+class CPresenceWatcherListEventImp;
+
+/**
+ * XIMP Framework Eunit tests.
+ *
+ * Tests for XIMP presence watcher list.
+ *
+ * @since S60 v4.0
+ */
+class T_PresenceWatcherListManagement : public CEUnitTestSuiteClass, 
+    public MXIMPContextObserver
+    {
+
+public:
+    static T_PresenceWatcherListManagement* NewL();
+    virtual ~T_PresenceWatcherListManagement();
+
+
+private:
+    T_PresenceWatcherListManagement();
+    void ConstructL();
+
+    enum TValidateType
+        {
+        EWatcherList,
+        EInvalid = 1000
+        };
+
+private:    // Test case functions
+
+    void Setup_L();
+    void SetupMultiple_L();
+    void BindL();
+    void BindAllL();
+    void Teardown();
+    void UnbindL();
+    void UnbindAllL();
+    void SubscribeL();
+    void UnsubscribeL();
+
+    void T_BindUnbind_L();
+    void T_SubscribePresenceWatcherList_Single_L();
+    void T_SubscribePresenceWatcherList_Multiple_L();
+    void T_HandlePresenceWatcherList_L();
+    void T_IndiaCase_L();
+    void SetupListenerReqCompleteL( CXIMPTestContextWrapper* aWrapper, 
+    TXIMPTestStatusEventTemplate aEventType );
+
+    void SetupListenerReqCompleteAllowEventsL(  CXIMPTestContextWrapper* aWrapper, 
+            TXIMPTestStatusEventTemplate aEventType );
+
+    //TBool ValidateWatcherListEvent( RXIMPObjOwningPtrArray<CPresenceWatcherInfoImp>& aExpectedArray, TValidateType aType );
+
+
+private: // From MXIMPContextObserver
+
+    void HandlePresenceContextEvent(
+                const MXIMPContext& aContext,
+                const MXIMPBase& aEvent );
+
+
+private:    // Test helpers
+
+    /**
+     * Fake a server-originated (=mobile terminated) message.
+     * The message appears to adaptation and framework as if
+     * it came from the network. Uses only one group.
+     * @param aUri The URI of group
+     * @param aDispName The display name for the group
+     * @param aMsgType The message type for CXIMPTestFileSrvMsg
+     */
+    void SendSrvMsgL(
+            const TDesC& aUri, const TDesC& aDispName,
+            TInt aMsgType );
+
+    /**
+     * Fake a server-originated message with empty content.
+     * Whether to use this depends on the event you expect.
+     * @see SendSrvMsgL
+     */
+    void SendSrvMsgL( TInt aMsgType );
+
+    // @see below
+    enum TTestPWlOperation
+        {
+        ETestPWlNew = 0,       // new watchers
+        ETestPWlCurrent,        // current watchers
+        ETestPWlDisappeared    // disappeared watchers
+        };
+
+
+    /**
+     * Creates an event for new watcher, current, or disappred presence watcher
+     * list. The caller provides an identity and current presence watcher list.
+     * Depending on the provided operation an event is created. 
+     *
+     * In cleanupstack there are 4 items, FIFO:
+     *   - new list
+     *   - current list
+     *   - disappeared list
+     *   - event imp
+     *
+     * This is because this event won't take ownership to the arrays
+     * when created this way.
+     *
+     * @param aUri Uri
+     * @param aDispName Displayname
+     * @param aOperation operation for which caller wants to generates event
+     * @param aCurrentList Current watcher list provided by caller, method takes
+     *         ownership of the current list, and it is included in above 3 lists.
+     *         a NULL pointer with operation ETestPWlCurrent causes empty event.
+     * @return The suitably filled event.
+     */
+    CPresenceWatcherListEventImp* CreateWatcherListEventLCX(
+            const TDesC& aUri,
+            const TDesC& aDispName,
+            MXIMPDataSubscriptionState::TSubscriptionState aSubscriptionState,
+            MXIMPDataSubscriptionState::TDataState aDataState,
+            TTestPWlOperation aOperation,
+            RPrWatLstInfoImpArray* aCurrentList = NULL
+            );
+
+
+private: // Test data
+
+    /**
+     * Eunit test case table declaration.
+     */
+    EUNIT_DECLARE_TEST_TABLE;
+
+    // owned
+    CXIMPTestContextWrapperMgr* iWrapperMgr;
+
+    //
+    TValidateType iLastEvent;
+    TInt iLastError;
+    RXIMPObjOwningPtrArray< CPresenceWatcherInfoImp > iValidateArray;
+    };
+
+
+#endif      //  T_PRESENCEWATCHERLISTMANAGEMENT_H
+
+
+
+// end of file
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/tsrc/src/t_presencewatcherlistmngt/t_presencewatcherlistmngt.mmp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,74 @@
+/*
+* 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: XIMP Framework Test Code 
+*
+*/
+
+#include            "../../tsrcutils/eunitcommon/eunittstdllbase.hrh"
+#include            "../../tsrcutils/processmaster/pm.h"
+
+#include<platform_paths.hrh>
+#include<eunitcaps.h>
+TARGET              t_presencewatcherlistmngt.dll
+//CAPABILITY              ALL - TCB - DRM
+CAPABILITY      EUNIT_CAPS
+
+SOURCEPATH          .
+SOURCE              t_presencewatcherlistmngt.cpp
+
+USERINCLUDE             ../../../core/srcdatamodel
+USERINCLUDE             ../../../presence/srcpresencedatamodel
+USERINCLUDE             ../../../presence/srcpresencedatamodel/presentitygroups
+USERINCLUDE             ../../../presence/srcpresencedatamodel/presencewatching
+USERINCLUDE             ../../../presence/srcpresencedatamodel/presenceauthorization
+USERINCLUDE             ../../../presence/srcpresencedatamodel/presencepublishing
+USERINCLUDE             ../../../presence/srcpresencedatamodel/presenceinfo
+USERINCLUDE             ../../../core/srcutils
+
+// TODO remove unnecessary
+#if defined ( OS_LAYER_SYSTEMINCLUDE )
+OS_LAYER_SYSTEMINCLUDE
+#else
+SYSTEMINCLUDE     /epoc32/include
+#endif
+
+ #if defined ( APP_LAYER_SYSTEMINCLUDE )
+ APP_LAYER_SYSTEMINCLUDE
+ #else
+ SYSTEMINCLUDE     \epoc32\include
+ #endif
+ 
+ 
+SYSTEMINCLUDE           ../../../inc/core/base
+SYSTEMINCLUDE           ../../../inc/core/datamodel
+SYSTEMINCLUDE           ../../../inc/core/protocolplugin
+SYSTEMINCLUDE           ../../../inc/core/protocolpluginhost
+SYSTEMINCLUDE           ../../../inc/presence/presencedatamodel
+SYSTEMINCLUDE           ../../../inc/presence/presencemanagement
+SYSTEMINCLUDE           ../../../inc/presence/presenceprotocolplugin
+SYSTEMINCLUDE           ../../../inc/presence/presenceprotocolpluginhost
+
+LIBRARY             ecom.lib
+LIBRARY             bafl.lib
+LIBRARY             ximpdatamodel.lib
+LIBRARY             presencedatamodel.lib
+LIBRARY             euser.lib
+LIBRARY             ximputils.lib
+LIBRARY             eunit.lib
+LIBRARY             eunitutil.lib
+LIBRARY             estor.lib
+
+// end of file
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/tsrc/src/t_presencewatching/bld.inf	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,23 @@
+/*
+* 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 t_presencewatching.dll
+*
+*/
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_TESTMMPFILES
+t_presencewatching.mmp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/tsrc/src/t_presencewatching/t_presencewatching.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,1523 @@
+/*
+* 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: XIMP Framework Test Code 
+*
+*/
+
+
+#include "eunittools.h"
+
+#include <platform/digia/eunit/eunitmacros.h>
+#include <platform/digia/eunit/teunitassertioninfo.h>
+
+
+#include <ecom/ecom.h>
+#include <badesca.h>
+
+#include <ximpbase.h>
+#include <ximpclient.h>
+#include <ximpcontext.h>
+#include <ximpcontextstateevent.h>
+#include <ximprequestcompleteevent.h>
+#include <ximpstatus.h>
+#include <presencefeatures.h>
+#include <presencewatching.h>
+#include <presencepublishing.h>
+#include <presentitypresenceevent.h>
+#include <ximpobjectfactory.h>
+
+#include "t_presencewatching.h"
+#include "prfwteststatuseventlistener.h"
+#include "prfwtestmessaging.h"
+#include "prfwtestmessenger.h"
+#include "prfwtestcontextwrappermgr.h"
+#include "prfwtestcontextwrapper.h"
+
+#include "presenceinfoimp.h"
+#include "presenceinfofilterimp.h"
+#include "prfwtestpresencedatautils.h"
+#include "ximpidentityimp.h"
+#include "presentitygroupmemberinfoimp.h"
+#include "ximpobjecthelpers.h"
+#include "prfwtestfilesrvmsg.h"
+#include "prfwtestwaithelper.h"
+
+#include "prfwtestrobustnesstools.h"
+#include "presenceinfofieldimp.h"
+#include "presenceinfofieldcollectionimp.h"
+#include "presenceinfofieldvaluetextimp.h"
+#include "personpresenceinfoimp.h"
+
+#include <presencecachereader.h>
+
+// For the protocol UID
+#include "prfwtestprotocols.h"
+
+
+_LIT8( KPrefix1, "PreA_" );
+_LIT8( KPrefix2, "PreB_" );
+_LIT8( KPrefix3, "PreC_" );
+_LIT8( KPrefix4, "PreD_" );
+
+_LIT( KIdentity, "TestId@hello.world" );
+_LIT8( KIdentity8, "TestId@hello.world" );
+
+_LIT( KText, "Hello World" );
+
+
+const TUid KTestProtocolUid = { K_PRFW_TST_PROTOCOL_1_IMPLEMENTATION_UID };  // hardcoded...
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// CONSTRUCTION
+T_PresenceWatching* T_PresenceWatching::NewL()
+    {
+    T_PresenceWatching* self = new( ELeave ) T_PresenceWatching;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+
+    return self;
+    }
+
+
+T_PresenceWatching::~T_PresenceWatching()
+    {
+    }
+
+
+void T_PresenceWatching::ConstructL()
+    {
+    CEUnitTestSuiteClass::ConstructL();
+    }
+
+
+T_PresenceWatching::T_PresenceWatching()
+    {
+    }
+
+
+
+// ===========================================================================
+// TEST CASE SETUP & TEARDOWN METHODS
+// ===========================================================================
+//
+
+void T_PresenceWatching::Setup_L()
+    {
+    __UHEAP_MARK;
+    PrfwTestRobustness::DoPreCleaning();
+
+    iWrapperMgr = CXIMPTestContextWrapperMgr::NewL();
+    iWrapperMgr->CreateWrapperL();
+    
+    iMPresenceCacheReader = MPresenceCacheReader::NewL();
+    }
+
+void T_PresenceWatching::SetupMultiple_L()
+    {
+    PrfwTestRobustness::DoPreCleaning();
+
+    iWrapperMgr = CXIMPTestContextWrapperMgr::NewL();
+    iWrapperMgr->CreateWrapperL();
+    iWrapperMgr->CreateWrapperL();
+    iWrapperMgr->CreateWrapperL();
+    }
+
+
+void T_PresenceWatching::BindL()
+    {
+    CXIMPTestContextWrapper* wrapper0 = iWrapperMgr->GetWrapperL( 0 );
+
+    wrapper0->BindL( 0 );
+    }
+
+void T_PresenceWatching::BindAllL()
+    {
+    for( TInt a = 0; a < iWrapperMgr->WrapperCount(); ++a )
+        {
+        CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a );
+        wrapper->BindL( 0 );
+        }
+    }
+
+
+void T_PresenceWatching::Teardown()
+    {
+    delete iWrapperMgr;
+    iWrapperMgr = NULL;
+    
+    delete iMPresenceCacheReader;
+
+    REComSession::FinalClose();
+
+    PrfwTestRobustness::DoPreCleaning();
+    __UHEAP_MARKEND;
+    }
+
+void T_PresenceWatching::UnbindL()
+    {
+    // Do unbind
+    CXIMPTestContextWrapper* wrapper0 = iWrapperMgr->GetWrapperL( 0 );
+    wrapper0->UnbindL();
+    }
+
+void T_PresenceWatching::UnbindAllL()
+    {
+    for( TInt a = 0; a < iWrapperMgr->WrapperCount(); ++a )
+        {
+        CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a );
+        wrapper->UnbindL();
+        }
+    }
+
+
+// ===========================================================================
+// TEST CASES for presentity presence subscription
+// ===========================================================================
+
+// Single client, empty filter
+void T_PresenceWatching::T_SubscribePresentityPresence_Single_L()
+    {
+    EUNIT_PRINT( _L("Single presentity subscription") );
+
+// BIND AND SETUP
+
+    BindL();
+
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    MXIMPContext* context = wrapper->GetContext();
+    CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+    // Tell the protocol it should act normally
+    messenger->SetNoError();
+
+    // Get the interfaces
+    MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+    MPresenceWatching& presWatch = presFeat->PresenceWatching();
+
+// SUBSCRIBE
+    // Setup status event listener for RequestComplete
+    SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk );
+
+    CXIMPIdentityImp* identity = XIMPTestPresenceDataUtils::GenerateIdentityLC( &KNullDesC8 );
+    CPresenceInfoFilterImp* pif = XIMPTestPresenceDataUtils::GenerateInfoFilterLC( &KPrefix1 );
+    
+    // register interest
+    TXIMPRequestId reqId = presWatch.SubscribePresentityPresenceL( *identity, *pif );
+
+    // Wait for events on the request
+    wrapper->WaitRequestAndStackEvents( reqId );
+    wrapper->VerifyEventStackL( _L8("Subscribing presentity presence, complete with error: ") );
+    // verify that UpdateInterest was called
+    COMMONASSERT( messenger, EXIMPPlgTestSubscribePresentityPresesenceCalled, "SubscribePresentityPresenceL was not called", ETrue, NULL );
+
+
+// REFRESH
+    // Setup status event listener for RequestComplete
+    SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk );
+    messenger->SetValueFor( EXIMPPlgTestSubscribePresentityPresesenceCalled, 0 );
+
+    // register interest
+    reqId = presWatch.SubscribePresentityPresenceL( *identity, *pif );
+
+    // Wait for events on the request
+    wrapper->WaitRequestAndStackEvents( reqId );
+    wrapper->VerifyEventStackL( _L8("Subscribing presentity presence, complete with error: ") );
+    
+    // Wait for event because refresh happened
+    SetupListenerReqCompleteL( wrapper, EXIMPTestStatusEvents_HandlePresentityPresencePending );
+    // Wait for events
+    wrapper->WaitAnyEvent();
+    wrapper->VerifyEventStackL( _L8("Handle presence watcher list. Wrong event occurred.") );
+    
+    // verify that UpdateInterest was called
+    COMMONASSERT( messenger, EXIMPPlgTestSubscribePresentityPresesenceCalled, 
+                 "SubscribePresentityPresenceL was not called", EFalse,
+                 "SubscribePresentityPresenceL was called" );
+
+// UNSUBSCRIBE
+
+    // Setup status event listener for RequestComplete
+    SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); // allow events after reqcomplete
+
+    // register interest
+    reqId = presWatch.UnsubscribePresentityPresenceL( *identity );
+
+    // Wait for events on the request
+    wrapper->WaitRequestAndStackEvents( reqId );
+    wrapper->VerifyEventStackL( _L8("UnSubscribing presentity presence, complete with error: ") );
+    // verify that UpdateInterest was called
+    COMMONASSERT( messenger, EXIMPPlgTestUnsubscribePresentityPresesenceCalled, "UnsubscribePresentityPresenceL was not called", ETrue, NULL );
+
+// UNBIND    
+
+    CleanupStack::PopAndDestroy( pif );
+    CleanupStack::PopAndDestroy( identity );
+    
+    UnbindL();
+    }
+
+// Single client, empty filter, presence cache checking
+void T_PresenceWatching::T_SubscribeHandlePresentityPresence_Single_L()
+    {
+    EUNIT_PRINT( _L("Single presentity subscription") );
+
+// BIND AND SETUP
+
+    BindL();
+
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    MXIMPContext* context = wrapper->GetContext();
+    CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+    // Tell the protocol it should act normally
+    messenger->SetNoError();
+
+    // Get the interfaces
+    MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+    MPresenceWatching& presWatch = presFeat->PresenceWatching();
+
+// SUBSCRIBE
+    // Setup status event listener for RequestComplete
+    SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk );
+
+    CXIMPIdentityImp* identity = XIMPTestPresenceDataUtils::GenerateIdentityLC( &KIdentity8 );
+    CPresenceInfoFilterImp* pif = XIMPTestPresenceDataUtils::GenerateInfoFilterLC( &KPrefix1 );
+    
+    // register interest
+    TXIMPRequestId reqId = presWatch.SubscribePresentityPresenceL( *identity, *pif );
+
+    // Wait for events on the request
+    wrapper->WaitRequestAndStackEvents( reqId );
+    wrapper->VerifyEventStackL( _L8("Subscribing presentity presence, complete with error: ") );
+    // verify that UpdateInterest was called
+    COMMONASSERT( messenger, EXIMPPlgTestSubscribePresentityPresesenceCalled, "SubscribePresentityPresenceL was not called", ETrue, NULL );
+
+// SEND DATA
+    
+    // Create some meaningful data
+    CPresenceInfoImp* presenceInfo = CPresenceInfoImp::NewLC();
+
+    MPresenceInfoFieldValueText* value = CPresenceInfoFieldValueTextImp::NewLC();
+    value->SetTextValueL(KText);
+    
+    MPresenceInfoField* infoField = CPresenceInfoFieldImp::NewLC();
+    infoField->SetFieldTypeL(NPresenceInfo::NFieldType::KStatusMessage);
+    infoField->SetFieldValue(value);    
+    
+    MPersonPresenceInfo* personPres = CPersonPresenceInfoImp::NewLC();
+    MPresenceInfoFieldCollection& fieldCol = personPres->Fields();
+    fieldCol.AddOrReplaceFieldL(infoField);
+    TInt fieldCount= fieldCol.FieldCount();
+        
+    presenceInfo->SetPersonPresenceL(personPres);
+    CleanupStack::Pop(3); // value, infoField, personPres
+    
+    // Pack the data for FileTool
+    HBufC8* packedInfo = TXIMPObjectPacker< CPresenceInfoImp >::PackL( *presenceInfo );
+    CleanupStack::PushL( packedInfo );
+    HBufC8* packedId = TXIMPObjectPacker< CXIMPIdentityImp >::PackL( *identity );
+    CleanupStack::PushL( packedId );
+    RPointerArray< HBufC8 > bufferArray;
+    CleanupClosePushL( bufferArray );
+    bufferArray.AppendL( packedId );
+    bufferArray.AppendL( packedInfo );
+    HBufC8* packedBufferArray = TXIMPHBuf8Packer::PackArrayL( bufferArray );
+    CleanupStack::PopAndDestroy( 3, packedInfo ); // packedId, packedInfo, bufferArray
+    CleanupStack::PushL( packedBufferArray );
+    
+    // Use filetool to send it for plugin.
+    CXIMPTestFileSrvMsg* srvMsg = CXIMPTestFileSrvMsg::NewL( CXIMPTestFileSrvMsg::ETestSrvMsgPresentityPresence, 
+                                                             *packedBufferArray );
+    CleanupStack::PopAndDestroy( packedBufferArray );
+    CleanupStack::PushL( srvMsg );
+    wrapper->FileTool().SrvMsgStoreL( srvMsg );
+    CleanupStack::PopAndDestroy( srvMsg );
+    
+    // Wait for event
+    SetupListenerReqCompleteL( wrapper, EXIMPTestStatusEvents_HandlePresentityPresence );
+
+    // Wait for events
+    wrapper->WaitAnyEvent();
+    wrapper->VerifyEventStackL( _L8("Handle presentity presence. Wrong event occurred.") );
+    
+    // Verify the cache
+    MPresenceInfo* presInfoRead = iMPresenceCacheReader->PresenceInfoLC(*identity);
+
+    CPresenceInfoImp* readInfo = 
+        TXIMPGetImpClassOrPanic<CPresenceInfoImp>::From(*presInfoRead);    
+
+
+    EUNIT_ASSERT( presenceInfo->EqualsContent(*readInfo) );
+    
+    CleanupStack::PopAndDestroy( 2 ); // readInfo, presenceInfo
+            
+        
+// UNSUBSCRIBE
+
+    // Setup status event listener for RequestComplete
+    SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); // allow events after reqcomplete
+
+    // unsubscribe
+    reqId = presWatch.UnsubscribePresentityPresenceL( *identity );
+
+    // Wait for events on the request
+    wrapper->WaitRequestAndStackEvents( reqId );
+    wrapper->VerifyEventStackL( _L8("UnSubscribing presentity presence, complete with error: ") );
+    // verify that UpdateInterest was called
+    COMMONASSERT( messenger, EXIMPPlgTestUnsubscribePresentityPresesenceCalled, "UnsubscribePresentityPresenceL was not called", ETrue, NULL );
+
+// UNBIND    
+
+    CleanupStack::PopAndDestroy( pif );
+    CleanupStack::PopAndDestroy( identity );
+    
+    UnbindL();
+    }
+
+
+// Single client, empty filter
+void T_PresenceWatching::T_SubscribePresentityPresenceChangeId_Single_L()
+    {
+    EUNIT_PRINT( _L("Single presentity subscription") );
+
+// BIND AND SETUP
+
+    BindL();
+
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    MXIMPContext* context = wrapper->GetContext();
+    CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+    // Tell the protocol it should act normally
+    messenger->SetNoError();
+
+    // Get the interfaces
+    MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+    MPresenceWatching& presWatch = presFeat->PresenceWatching();
+
+// ID CHANGE REQUEST TO ADAPTATION
+
+    MXIMPIdentity* identityParam = context->ObjectFactory().NewIdentityLC();
+    identityParam->SetIdentityL( KIdentity );
+    
+    CXIMPIdentityImp* identityParamImp =
+             ( CXIMPIdentityImp* ) identityParam->GetInterface(
+                                        CXIMPIdentityImp::KClassId,
+                                        MXIMPBase::EPanicIfUnknown );
+    HBufC8* packedId = TXIMPObjectPacker< CXIMPIdentityImp >::PackL( *identityParamImp );
+    CleanupStack::PopAndDestroy(); // identityParam
+    CleanupStack::PushL( packedId );
+    CXIMPTestFileSrvMsg* srvMsg = CXIMPTestFileSrvMsg::NewL( CXIMPTestFileSrvMsg::ETestSrvMsgReqParamIdentity, 
+                                                             *packedId );
+    CleanupStack::PopAndDestroy( packedId );
+    CleanupStack::PushL( srvMsg );
+    wrapper->FileTool().SrvMsgStoreL( srvMsg );
+    CleanupStack::PopAndDestroy( srvMsg );
+
+    // Wait for server to handle srvmsg.
+    CXIMPTestWaitHelper* wait = CXIMPTestWaitHelper::NewL();
+    CleanupStack::PushL( wait );
+    wait->WaitForL( 2 );
+    CleanupStack::PopAndDestroy( wait );
+
+// SUBSCRIBE
+    // Setup status event listener for RequestComplete
+    SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk );
+
+    CXIMPIdentityImp* identity = XIMPTestPresenceDataUtils::GenerateIdentityLC( &KNullDesC8 );
+    CPresenceInfoFilterImp* pif = XIMPTestPresenceDataUtils::GenerateInfoFilterLC( &KPrefix1 );
+    
+    // register interest
+    TXIMPRequestId reqId = presWatch.SubscribePresentityPresenceL( *identity, *pif );
+
+    // Wait for events on the request
+    wrapper->WaitRequestAndStackEvents( reqId );
+    wrapper->VerifyEventStackL( _L8("Subscribing presentity presence, complete with error: ") );
+    // verify that UpdateInterest was called
+    COMMONASSERT( messenger, EXIMPPlgTestSubscribePresentityPresesenceCalled, "SubscribePresentityPresenceL was not called", ETrue, NULL );
+
+// UNBIND    
+
+    CleanupStack::PopAndDestroy( pif );
+    CleanupStack::PopAndDestroy( identity );
+    
+    UnbindL();
+    }
+
+
+void T_PresenceWatching::T_UnsubscribeNotSubscribedPresentityPresence_Single_L()
+    {
+    EUNIT_PRINT( _L("Unsubscribe not subscribed presentity presence") );
+
+// BIND AND SETUP
+
+    BindL();
+
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    MXIMPContext* context = wrapper->GetContext();
+    CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+    // Tell the protocol it should act normally
+    messenger->SetNoError();
+
+    // Get the interfaces
+    MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+    MPresenceWatching& presWatch = presFeat->PresenceWatching();
+    
+    CXIMPIdentityImp* identity = XIMPTestPresenceDataUtils::GenerateIdentityLC( &KNullDesC8 );
+    CPresenceInfoFilterImp* pif = XIMPTestPresenceDataUtils::GenerateInfoFilterLC( &KPrefix1 );
+    
+// UNSUBSCRIBE
+
+    // Setup status event listener for RequestComplete
+    SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); // allow events after reqcomplete
+
+    // register interest
+    TXIMPRequestId reqId = presWatch.UnsubscribePresentityPresenceL( *identity );
+
+    // Wait for events on the request
+    wrapper->WaitRequestAndStackEvents( reqId );
+    wrapper->VerifyEventStackL( _L8("UnSubscribing presentity presence, complete with error: ") );
+
+    // verify that UpdateInterest was called
+    COMMONASSERT( messenger, EXIMPPlgTestUnsubscribePresentityPresesenceCalled, "UnsubscribePresentityPresenceL was not called", EFalse, 
+                                                                                "UnsbuscribePresentityPresenceL was called." );
+
+// UNBIND    
+
+    CleanupStack::PopAndDestroy( pif );
+    CleanupStack::PopAndDestroy( identity );
+    
+    UnbindL();
+    }
+
+void T_PresenceWatching::T_UnsubscribeNotSubscribedPresentityPresence_Multiple_L()
+    {
+    EUNIT_PRINT( _L("Multiple client filter registration") );
+
+    BindAllL();
+
+    CXIMPIdentityImp* identity = XIMPTestPresenceDataUtils::GenerateIdentityLC( &KNullDesC8 );
+    CPresenceInfoFilterImp* pif = XIMPTestPresenceDataUtils::GenerateInfoFilterLC( &KPrefix1 );
+
+    TInt countOfWrappers = iWrapperMgr->WrapperCount();
+    for( TInt a = countOfWrappers - 1; a >= 1 ; --a ) // Don't subscribe the first one.
+        {
+        CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a );
+        MXIMPContext* context = wrapper->GetContext();
+        CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+        // Tell the protocol it should act normally
+        messenger->SetNoError();
+
+        // Get the interfaces
+        MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+        MPresenceWatching& presWatch = presFeat->PresenceWatching();
+
+        // Setup status event listener for RequestComplete
+        SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk );
+
+        // register interest
+        TXIMPRequestId reqId = presWatch.SubscribePresentityPresenceL( *identity, *pif );
+
+        // Wait for events on the request
+        wrapper->WaitRequestAndStackEvents( reqId );
+        // verify that UpdateInterest was called
+        COMMONASSERT( messenger, EXIMPPlgTestSubscribePresentityPresesenceCalled, 
+            "SubscribePresentityPresenceL was not called",
+            ( a > 1 ) ? ETrue : EFalse,
+            "SubscribePresentityPresenceL was called" );
+        }
+
+    for( TInt a = 0; a < countOfWrappers; ++a ) // Try to unsubscribe first one first.
+        {
+        CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a );
+        MXIMPContext* context = wrapper->GetContext();
+        CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+        // Get the interfaces
+        MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+        MPresenceWatching& presWatch = presFeat->PresenceWatching();
+        
+        // Setup status event listener for RequestComplete
+        SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); // allow events after reqcomplete
+
+        // register interest
+        TXIMPRequestId reqId = presWatch.UnsubscribePresentityPresenceL( *identity );
+
+        // Wait for events on the request
+        wrapper->WaitRequestAndStackEvents( reqId );
+        wrapper->VerifyEventStackL( _L8("Subscribing presentity presence, complete with error: ") );
+        // verify that UpdateInterest was called
+        COMMONASSERT( messenger, EXIMPPlgTestUnsubscribePresentityPresesenceCalled, 
+            "UnsubscribePresentityPresenceL was not called",
+            ( a < 2 ) ? EFalse : ETrue,
+            "UnsubscribePresentityPresenceL was called" );
+        }
+    
+    CleanupStack::PopAndDestroy( pif );
+    CleanupStack::PopAndDestroy( identity );
+        
+    UnbindAllL();    
+    }
+
+
+void T_PresenceWatching::T_ErrFromPlg_LeaveOnSubscribePresentityPresence_L()
+    {
+    EUNIT_PRINT( _L("Error from plug-in in presentity presence subscribe") );
+    EUNIT_PRINT( _L("Plug-in leaves from SubscribePresence().") );
+
+// BIND AND SETUP
+
+    BindL();
+
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    MXIMPContext* context = wrapper->GetContext();
+    CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+    messenger->SetLeave( KErrAbort );
+
+    // Get the interfaces
+    MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+    MPresenceWatching& presWatch = presFeat->PresenceWatching();
+    
+// SUBSCRIBE
+
+    // Setup status event listener for RequestComplete
+    SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_PresentitySubscribeFailKErrAbort );
+
+    CXIMPIdentityImp* identity = XIMPTestPresenceDataUtils::GenerateIdentityLC( &KNullDesC8 );
+    CPresenceInfoFilterImp* pif = XIMPTestPresenceDataUtils::GenerateInfoFilterLC( &KPrefix1 );
+    
+    // register interest
+    TXIMPRequestId reqId = presWatch.SubscribePresentityPresenceL( *identity, *pif );
+
+    // Wait for events on the request
+    wrapper->WaitRequestAndStackEvents( reqId );
+    wrapper->VerifyEventStackL( _L8("Subscribing presentity presence, complete with error: ") );
+    // verify that UpdateInterest was called
+    COMMONASSERT( messenger, EXIMPPlgTestSubscribePresentityPresesenceCalled, "SubscribePresentityPresenceL was not called", EFalse, "SubscribePresentityPresenceL was called" );
+    
+// UNBIND
+
+    CleanupStack::PopAndDestroy( pif );
+    CleanupStack::PopAndDestroy( identity );
+
+    messenger->SetLeave( KErrNone );
+
+    UnbindL();
+    }
+
+
+void T_PresenceWatching::T_ErrFromPlg_LeaveOnUnsubscribePresentityPresence_L()
+    {
+    EUNIT_PRINT( _L("Error from plug-in in presentity presence subscribe") );
+    EUNIT_PRINT( _L("Plug-in leaves from SubscribePresence().") );
+
+// BIND AND SETUP
+
+    BindL();
+
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    MXIMPContext* context = wrapper->GetContext();
+    CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+    // Get the interfaces
+    MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+    MPresenceWatching& presWatch = presFeat->PresenceWatching();
+
+// SUBSCRIBE
+
+    // Setup status event listener for RequestComplete
+    SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk );
+
+    CXIMPIdentityImp* identity = XIMPTestPresenceDataUtils::GenerateIdentityLC( &KNullDesC8 );
+    CPresenceInfoFilterImp* pif = XIMPTestPresenceDataUtils::GenerateInfoFilterLC( &KPrefix1 );
+    
+    // register interest
+    TXIMPRequestId reqId = presWatch.SubscribePresentityPresenceL( *identity, *pif );
+
+    // Wait for events on the request
+    wrapper->WaitRequestAndStackEvents( reqId );
+    wrapper->VerifyEventStackL( _L8("Subscribing presentity presence, complete with error: ") );
+    // verify that UpdateInterest was called
+    COMMONASSERT( messenger, EXIMPPlgTestSubscribePresentityPresesenceCalled, "SubscribePresentityPresenceL was not called", ETrue, NULL );
+
+// UNSUBSCRIBE
+
+    messenger->SetLeave( KErrAbort );
+
+    // Setup status event listener for RequestComplete
+    SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_PresentitySubscribeFailKErrAbort ); // allow events after reqcomplete
+
+    // register interest
+    reqId = presWatch.UnsubscribePresentityPresenceL( *identity );
+
+    // Wait for events on the request
+    wrapper->WaitRequestAndStackEvents( reqId );
+    wrapper->VerifyEventStackL( _L8("UnSubscribing presentity presence, complete with error: ") );
+
+    // verify that UpdateInterest was called
+    COMMONASSERT( messenger, EXIMPPlgTestUnsubscribePresentityPresesenceCalled, "UnsubscribePresentityPresenceL was not called", EFalse, 
+                                                                                "UnsbuscribePresentityPresenceL was called." );
+    
+// UNBIND
+
+    CleanupStack::PopAndDestroy( pif );
+    CleanupStack::PopAndDestroy( identity );
+
+    messenger->SetLeave( KErrNone );
+
+    UnbindL();
+    }
+
+
+// Multiple client, empty filter
+void T_PresenceWatching::T_SubscribePresentityPresence_Multiple_L()
+    {
+    EUNIT_PRINT( _L("Multiple client filter registration") );
+
+    BindAllL();
+
+    CXIMPIdentityImp* identity = XIMPTestPresenceDataUtils::GenerateIdentityLC( &KNullDesC8 );
+    CPresenceInfoFilterImp* pif = XIMPTestPresenceDataUtils::GenerateInfoFilterLC( &KPrefix1 );
+
+    TInt countOfWrappers = iWrapperMgr->WrapperCount();
+    for( TInt a = 0; a < countOfWrappers; ++a )
+        {
+        CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a );
+        MXIMPContext* context = wrapper->GetContext();
+        CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+        // Tell the protocol it should act normally
+        messenger->SetNoError();
+
+        // Get the interfaces
+        MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+        MPresenceWatching& presWatch = presFeat->PresenceWatching();
+
+        // Setup status event listener for RequestComplete
+        SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk );
+
+        // register interest
+        TXIMPRequestId reqId = presWatch.SubscribePresentityPresenceL( *identity, *pif );
+
+        // Wait for events on the request
+        wrapper->WaitRequestAndStackEvents( reqId );
+        // verify that UpdateInterest was called
+        COMMONASSERT( messenger, EXIMPPlgTestSubscribePresentityPresesenceCalled, 
+            "SubscribePresentityPresenceL was not called",
+            ( a == 0 ) ? ETrue : EFalse,
+            "SubscribePresentityPresenceL was called" );
+        }
+        
+    for( TInt a = 0; a < countOfWrappers; ++a )
+        {
+        CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a );
+        MXIMPContext* context = wrapper->GetContext();
+        CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+        
+        // Get the interfaces
+        MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+        MPresenceWatching& presWatch = presFeat->PresenceWatching();
+                
+        // Setup status event listener for RequestComplete
+        SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk );
+        messenger->SetValueFor( EXIMPPlgTestSubscribePresentityPresesenceCalled, 0 );
+
+        // register interest
+        TXIMPRequestId reqId = presWatch.SubscribePresentityPresenceL( *identity, *pif );
+
+        // Wait for events on the request
+        wrapper->WaitRequestAndStackEvents( reqId );
+        wrapper->VerifyEventStackL( _L8("Subscribing presentity presence, complete with error: ") );
+
+        // Wait for event because refresh happened
+        SetupListenerReqCompleteL( wrapper, EXIMPTestStatusEvents_HandlePresentityPresencePending );
+        // Wait for events
+        wrapper->WaitAnyEvent();
+        wrapper->VerifyEventStackL( _L8("Handle presence watcher list. Wrong event occurred.") );
+
+        // verify that UpdateInterest was called
+        COMMONASSERT( messenger, EXIMPPlgTestSubscribePresentityPresesenceCalled, 
+                     "SubscribePresentityPresenceL was not called", EFalse,
+                     "SubscribePresentityPresenceL was called" );
+        }
+        
+        
+    for( TInt a = 0; a < countOfWrappers; ++a )
+        {
+        CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a );
+        MXIMPContext* context = wrapper->GetContext();
+        CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+        
+        // Get the interfaces
+        MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+        MPresenceWatching& presWatch = presFeat->PresenceWatching();
+
+        // Setup status event listener for RequestComplete
+        SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); // allow events after reqcomplete
+
+        // register interest
+        TXIMPRequestId reqId = presWatch.UnsubscribePresentityPresenceL( *identity );
+
+        // Wait for events on the request
+        wrapper->WaitRequestAndStackEvents( reqId );
+        wrapper->VerifyEventStackL( _L8("Subscribing presentity presence, complete with error: ") );
+        // verify that UpdateInterest was called
+        COMMONASSERT( messenger, EXIMPPlgTestUnsubscribePresentityPresesenceCalled, 
+            "UnsubscribePresentityPresenceL was not called",
+            ( a < 2 ) ? EFalse : ETrue,
+            "UnsubscribePresentityPresenceL was called" );
+        }
+    
+    CleanupStack::PopAndDestroy( pif );
+    CleanupStack::PopAndDestroy( identity );
+    
+    
+    UnbindAllL();
+    }
+
+
+// ===========================================================================
+// TEST CASES for presentity group members presence subscription
+// ===========================================================================
+
+// Single client, empty filter
+void T_PresenceWatching::T_SubscribePresentityGroupMembersPresence_Single_L()
+    {
+    EUNIT_PRINT( _L("Single presentity group members subscription") );
+
+    BindL();
+
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    MXIMPContext* context = wrapper->GetContext();
+    CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+    // Tell the protocol it should act normally
+    messenger->SetNoError();
+
+    // Get the interfaces
+    MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+    MPresenceWatching& presWatch = presFeat->PresenceWatching();
+    // Setup status event listener for RequestComplete
+    SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk );
+
+    CXIMPIdentityImp* identity = XIMPTestPresenceDataUtils::GenerateIdentityLC( &KNullDesC8 );
+    CPresenceInfoFilterImp* pif = XIMPTestPresenceDataUtils::GenerateInfoFilterLC( &KPrefix1 );
+
+// SUBSCRIBE
+
+    // register interest
+    TXIMPRequestId reqId = presWatch.SubscribePresentityGroupMembersPresenceL( *identity, *pif );
+
+    // Wait for events on the request
+    wrapper->WaitRequestAndStackEvents( reqId );
+    // verify that UpdateInterest was called
+    COMMONASSERT( messenger, EXIMPPlgTestSubscribePresentityGroupMembersPresesenceCalled, "SubscribePresentityGroupMembersPresenceL was not called", ETrue, NULL );
+
+// REFRESH
+
+    // Setup status event listener for RequestComplete
+    SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk );
+    messenger->SetValueFor( EXIMPPlgTestSubscribePresentityGroupMembersPresesenceCalled, 0 );
+
+    // register interest
+    reqId = presWatch.SubscribePresentityGroupMembersPresenceL( *identity, *pif );
+
+    // Wait for events on the request
+    wrapper->WaitRequestAndStackEvents( reqId );
+    // verify that UpdateInterest was called
+    COMMONASSERT( messenger, EXIMPPlgTestSubscribePresentityGroupMembersPresesenceCalled, 
+                 "SubscribePresentityPresenceL was not called", EFalse,
+                 "SubscribePresentityPresenceL was called" );
+
+// UNSUBSCRIBE
+
+    // Setup status event listener for RequestComplete
+    SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); // allow events after reqcomplete
+
+
+    // register interest
+    reqId = presWatch.UnsubscribePresentityGroupMembersPresenceL( *identity );
+
+    // Wait for events on the request
+    wrapper->WaitRequestAndStackEvents( reqId );
+    wrapper->VerifyEventStackL( _L8("Subscribing presentity group members presence, complete with error: ") );
+    // verify that UpdateInterest was called
+    COMMONASSERT( messenger, EXIMPPlgTestUnsubscribePresentityGroupMembersPresesenceCalled, "UnsubscribePresentityGroupMembersPresenceL was not called", ETrue, NULL );
+
+    
+    CleanupStack::PopAndDestroy( pif );
+    CleanupStack::PopAndDestroy( identity );
+    
+    UnbindL();
+    }
+
+void T_PresenceWatching::T_UnsubscribeNotSubscribedPresentityGroupMembersPresence_Single_L()
+    {
+    EUNIT_PRINT( _L("Unsubscribe not subscribed presentity group members presence") );
+
+// BIND AND SETUP
+
+    BindL();
+
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    MXIMPContext* context = wrapper->GetContext();
+    CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+    // Tell the protocol it should act normally
+    messenger->SetNoError();
+
+    // Get the interfaces
+    MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+    MPresenceWatching& presWatch = presFeat->PresenceWatching();    
+    CXIMPIdentityImp* identity = XIMPTestPresenceDataUtils::GenerateIdentityLC( &KNullDesC8 );
+    CPresenceInfoFilterImp* pif = XIMPTestPresenceDataUtils::GenerateInfoFilterLC( &KPrefix1 );
+    
+// UNSUBSCRIBE
+
+    // Setup status event listener for RequestComplete
+    SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); // allow events after reqcomplete
+
+    // register interest
+    TXIMPRequestId reqId = presWatch.UnsubscribePresentityGroupMembersPresenceL( *identity );
+
+    // Wait for events on the request
+    wrapper->WaitRequestAndStackEvents( reqId );
+    wrapper->VerifyEventStackL( _L8("UnSubscribing presentity presence, complete with error: ") );
+
+    // verify that UpdateInterest was called
+    COMMONASSERT( messenger, EXIMPPlgTestUnsubscribePresentityGroupMembersPresesenceCalled, "UnsubscribePresentityGroupMembersPresenceL was not called", EFalse, 
+                                                                                            "UnsubscribePresentityGroupMembersPresenceL was called." );
+
+// UNBIND    
+
+    CleanupStack::PopAndDestroy( pif );
+    CleanupStack::PopAndDestroy( identity );
+    
+    UnbindL();
+    }
+
+
+void T_PresenceWatching::T_UnsubscribeNotSubscribedPresentityGroupMembersPresence_Multiple_L()
+    {
+    EUNIT_PRINT( _L("Multiple client filter registration") );
+
+    BindAllL();
+
+    CXIMPIdentityImp* identity = XIMPTestPresenceDataUtils::GenerateIdentityLC( &KNullDesC8 );
+    CPresenceInfoFilterImp* pif = XIMPTestPresenceDataUtils::GenerateInfoFilterLC( &KPrefix1 );
+
+    TInt countOfWrappers = iWrapperMgr->WrapperCount();
+    for( TInt a = countOfWrappers - 1; a >= 1; --a )
+        {
+        CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a );
+        MXIMPContext* context = wrapper->GetContext();
+        CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+        // Tell the protocol it should act normally
+        messenger->SetNoError();
+
+        // Get the interfaces
+        MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+        MPresenceWatching& presWatch = presFeat->PresenceWatching();
+    
+        // Setup status event listener for RequestComplete
+        SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk );
+
+        // register interest
+        TXIMPRequestId reqId = presWatch.SubscribePresentityGroupMembersPresenceL( *identity, *pif );
+
+        // Wait for events on the request
+        wrapper->WaitRequestAndStackEvents( reqId );
+        // verify that UpdateInterest was called
+        COMMONASSERT( messenger, EXIMPPlgTestSubscribePresentityGroupMembersPresesenceCalled,
+            "SubscribePresentityPresenceL was not called",
+            ( a > 1 ) ? ETrue : EFalse,
+            "SubscribePresentityPresenceL was called" );
+        }
+        
+    for( TInt a = 0; a < countOfWrappers; ++a )
+        {
+        CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a );
+        MXIMPContext* context = wrapper->GetContext();
+        CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+        // Get the interfaces
+        MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+        MPresenceWatching& presWatch = presFeat->PresenceWatching();
+    
+        // Setup status event listener for RequestComplete
+        SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); // allow events after reqcomplete
+
+        // register interest
+        TXIMPRequestId reqId = presWatch.UnsubscribePresentityGroupMembersPresenceL( *identity );
+
+        // Wait for events on the request
+        wrapper->WaitRequestAndStackEvents( reqId );
+        wrapper->VerifyEventStackL( _L8("Subscribing presentity presence, complete with error: ") );
+        // verify that UpdateInterest was called
+        COMMONASSERT( messenger, EXIMPPlgTestUnsubscribePresentityGroupMembersPresesenceCalled, 
+            "UnsubscribePresentityPresenceL was not called",
+            ( a < 2 ) ? EFalse : ETrue,
+            "UnsubscribePresentityPresenceL was called" );
+        }
+    
+    CleanupStack::PopAndDestroy( pif );
+    CleanupStack::PopAndDestroy( identity );
+        
+    UnbindAllL();    
+    }
+
+
+
+// Multiple client, empty filter
+void T_PresenceWatching::T_SubscribeGroupMembersPresence_Multiple_L()
+    {
+    EUNIT_PRINT( _L("Multiple client filter registration") );
+
+    BindAllL();
+
+    CXIMPIdentityImp* identity = XIMPTestPresenceDataUtils::GenerateIdentityLC( &KNullDesC8 );
+    CPresenceInfoFilterImp* pif = XIMPTestPresenceDataUtils::GenerateInfoFilterLC( &KPrefix1 );
+
+    TInt countOfWrappers = iWrapperMgr->WrapperCount();
+    for( TInt a = 0; a < countOfWrappers; ++a )
+        {
+        CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a );
+        MXIMPContext* context = wrapper->GetContext();
+        CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+        // Tell the protocol it should act normally
+        messenger->SetNoError();
+
+        // Get the interfaces
+        MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+        MPresenceWatching& presWatch = presFeat->PresenceWatching();
+
+        // Setup status event listener for RequestComplete
+        SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk );
+
+        // register interest
+        TXIMPRequestId reqId = presWatch.SubscribePresentityGroupMembersPresenceL( *identity, *pif );
+
+        // Wait for events on the request
+        wrapper->WaitRequestAndStackEvents( reqId );
+        // verify that UpdateInterest was called
+        COMMONASSERT( messenger, EXIMPPlgTestSubscribePresentityGroupMembersPresesenceCalled, 
+            "SubscribePresentityPresenceL was not called",
+            ( a == 0 ) ? ETrue : EFalse,
+            "SubscribePresentityPresenceL was called" );
+        }
+        
+    for( TInt a = 0; a < countOfWrappers; ++a )
+        {
+        CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a );
+        MXIMPContext* context = wrapper->GetContext();
+        CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+        
+        // Get the interfaces
+        MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+        MPresenceWatching& presWatch = presFeat->PresenceWatching();  
+                      
+        // Setup status event listener for RequestComplete
+        SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk );
+        messenger->SetValueFor( EXIMPPlgTestSubscribePresentityGroupMembersPresesenceCalled, 0 );
+
+        // register interest
+        TXIMPRequestId reqId = presWatch.SubscribePresentityGroupMembersPresenceL( *identity, *pif );
+
+        // Wait for events on the request
+        wrapper->WaitRequestAndStackEvents( reqId );
+        wrapper->VerifyEventStackL( _L8("Subscribing presentity presence, complete with error: ") );
+
+        // verify that UpdateInterest was called
+        COMMONASSERT( messenger, EXIMPPlgTestSubscribePresentityGroupMembersPresesenceCalled, 
+                     "SubscribePresentityPresenceL was not called", EFalse,
+                     "SubscribePresentityPresenceL was called" );
+        }
+        
+        
+    for( TInt a = 0; a < countOfWrappers; ++a )
+        {
+        CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a );
+        MXIMPContext* context = wrapper->GetContext();
+        CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+    
+        // Get the interfaces
+        MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+        MPresenceWatching& presWatch = presFeat->PresenceWatching();
+    
+        // Setup status event listener for RequestComplete
+        SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); // allow events after reqcomplete
+
+        // register interest
+        TXIMPRequestId reqId = presWatch.UnsubscribePresentityGroupMembersPresenceL( *identity );
+
+        // Wait for events on the request
+        wrapper->WaitRequestAndStackEvents( reqId );
+        wrapper->VerifyEventStackL( _L8("Subscribing presentity presence, complete with error: ") );
+        // verify that UpdateInterest was called
+        COMMONASSERT( messenger, EXIMPPlgTestUnsubscribePresentityGroupMembersPresesenceCalled, 
+            "UnsubscribePresentityPresenceL was not called",
+            ( a < 2 ) ? EFalse : ETrue,
+            "UnsubscribePresentityPresenceL was called" );
+        }
+    
+    CleanupStack::PopAndDestroy( pif );
+    CleanupStack::PopAndDestroy( identity );
+    
+    
+    UnbindAllL();
+    }
+
+
+void T_PresenceWatching::T_ErrFromPlg_LeaveOnSubscribePresentityGroupMembersPresence_L()
+    {
+    EUNIT_PRINT( _L("Error from plug-in in presentity group members presence subscribe") );
+    EUNIT_PRINT( _L("Plug-in leaves from SubscribeGroupMembersPresence().") );
+
+// BIND AND SETUP
+
+    BindL();
+
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    MXIMPContext* context = wrapper->GetContext();
+    CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+    messenger->SetLeave( KErrAbort );
+
+    // Get the interfaces
+    MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+    MPresenceWatching& presWatch = presFeat->PresenceWatching();
+
+// SUBSCRIBE
+
+    // Setup status event listener for RequestComplete
+    SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_PresentitySubscribeFailKErrAbort );
+
+    CXIMPIdentityImp* identity = XIMPTestPresenceDataUtils::GenerateIdentityLC( &KNullDesC8 );
+    CPresenceInfoFilterImp* pif = XIMPTestPresenceDataUtils::GenerateInfoFilterLC( &KPrefix1 );
+    
+    // register interest
+    TXIMPRequestId reqId = presWatch.SubscribePresentityGroupMembersPresenceL( *identity, *pif );
+
+    // Wait for events on the request
+    wrapper->WaitRequestAndStackEvents( reqId );
+    wrapper->VerifyEventStackL( _L8("Subscribing presentity presence, complete with error: ") );
+    // verify that UpdateInterest was called
+    COMMONASSERT( messenger, EXIMPPlgTestSubscribePresentityGroupMembersPresesenceCalled, "SubscribePresentityPresenceL was not called", EFalse, "SubscribePresentityPresenceL was called" );
+    
+// UNBIND
+
+    CleanupStack::PopAndDestroy( pif );
+    CleanupStack::PopAndDestroy( identity );
+
+    messenger->SetLeave( KErrNone );
+
+    UnbindL();
+    }
+
+
+void T_PresenceWatching::T_ErrFromPlg_LeaveOnUnsubscribePresentityGroupMembersPresence_L()
+    {
+    EUNIT_PRINT( _L("Error from plug-in in presentity group members presence unsubscribe") );
+    EUNIT_PRINT( _L("Plug-in leaves from UnsubscribeGroupMembersPresence().") );
+
+// BIND AND SETUP
+
+    BindL();
+
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    MXIMPContext* context = wrapper->GetContext();
+    CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+     // Get the interfaces
+    MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+    MPresenceWatching& presWatch = presFeat->PresenceWatching();
+
+// SUBSCRIBE
+
+    // Setup status event listener for RequestComplete
+    SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk );
+
+    CXIMPIdentityImp* identity = XIMPTestPresenceDataUtils::GenerateIdentityLC( &KNullDesC8 );
+    CPresenceInfoFilterImp* pif = XIMPTestPresenceDataUtils::GenerateInfoFilterLC( &KPrefix1 );
+    
+    // register interest
+    TXIMPRequestId reqId = presWatch.SubscribePresentityGroupMembersPresenceL( *identity, *pif );
+
+    // Wait for events on the request
+    wrapper->WaitRequestAndStackEvents( reqId );
+    wrapper->VerifyEventStackL( _L8("Subscribing presentity presence, complete with error: ") );
+    // verify that UpdateInterest was called
+    COMMONASSERT( messenger, EXIMPPlgTestSubscribePresentityGroupMembersPresesenceCalled, "SubscribePresentityPresenceL was not called", ETrue, "SubscribePresentityPresenceL was called" );
+
+// UNSUBSCRIBE
+
+    messenger->SetLeave( KErrAbort );
+
+    // Setup status event listener for RequestComplete
+    SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_PresentitySubscribeFailKErrAbort ); // allow events after reqcomplete
+
+    // register interest
+    reqId = presWatch.UnsubscribePresentityGroupMembersPresenceL( *identity );
+
+    // Wait for events on the request
+    wrapper->WaitRequestAndStackEvents( reqId );
+    wrapper->VerifyEventStackL( _L8("UnSubscribing presentity presence, complete with error: ") );
+
+    // verify that UpdateInterest was called
+    COMMONASSERT( messenger, EXIMPPlgTestUnsubscribePresentityGroupMembersPresesenceCalled, "UnsubscribePresentityGroupMembersPresenceL was not called", EFalse, 
+                                                                                            "UnsubscribePresentityGroupMembersPresenceL was called." );
+
+// UNBIND
+
+    CleanupStack::PopAndDestroy( pif );
+    CleanupStack::PopAndDestroy( identity );
+
+    messenger->SetLeave( KErrNone );
+
+    UnbindL();
+    }
+
+
+void T_PresenceWatching::T_ContentChangePresentityGroupMembersPresence_Single_L()
+    {
+    EUNIT_PRINT( _L("Presentity group members content change") );
+
+    BindL();
+
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    MXIMPContext* context = wrapper->GetContext();
+    CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+    // Tell the protocol it should act normally
+    messenger->SetNoError();
+
+    // Get the interfaces
+    MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
+    MPresenceWatching& presWatch = presFeat->PresenceWatching();
+    // Setup status event listener for RequestComplete
+    SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk );
+
+    CXIMPIdentityImp* identity = XIMPTestPresenceDataUtils::GenerateIdentityLC( &KNullDesC8 );
+    CPresenceInfoFilterImp* pif = CPresenceInfoFilterImp::NewLC();
+
+
+    // register interest
+    TXIMPRequestId reqId = presWatch.SubscribePresentityGroupMembersPresenceL( *identity, *pif );
+
+    // Wait for events on the request
+    wrapper->WaitRequestAndStackEvents( reqId );
+    // verify that UpdateInterest was called
+    COMMONASSERT( messenger, EXIMPPlgTestSubscribePresentityGroupMembersPresesenceCalled, "SubscribePresentityGroupMembersPresenceL was not called", ETrue, NULL );
+
+
+// TODO THINGSIES
+    // Get the interface
+    MPresencePublishing& presPub = presFeat->PresencePublishing();
+
+    // Setup status event listener for RequestComplete
+    SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk );
+
+    // register interest
+    reqId = presPub.SubscribeOwnPresenceL( *pif );
+
+    // Wait for events on the request
+    wrapper->WaitRequestAndStackEvents( reqId );
+
+
+
+    // Create member to grouplist we are interested in.
+    // 1. Create notification    
+    RXIMPObjOwningPtrArray<CPresentityGroupMemberInfoImp> groupMemberList;
+    CleanupClosePushL( groupMemberList );
+    CPresentityGroupMemberInfoImp* info = CPresentityGroupMemberInfoImp::NewLC( *identity, KNullDesC );
+    User::LeaveIfError( groupMemberList.Append( info ) );
+    CleanupStack::Pop(); //info
+    HBufC8* packedId = TXIMPObjectPacker< CXIMPIdentityImp >::PackL( *identity );
+    CleanupStack::PushL( packedId );
+    HBufC8* packedArray = TXIMPObjectPacker<CPresentityGroupMemberInfoImp>::PackArrayL( groupMemberList );
+    CleanupStack::PushL( packedArray );    
+    RPointerArray< HBufC8 > bufferArray;
+    CleanupClosePushL( bufferArray );
+    bufferArray.AppendL( packedId );
+    bufferArray.AppendL( packedArray );
+    HBufC8* packedBufferArray = TXIMPHBuf8Packer::PackArrayL( bufferArray );
+    CleanupStack::PopAndDestroy( 4 ); // packedId, bufferArray, packedArray, groupMemberList
+    CleanupStack::PushL( packedBufferArray );
+    
+    // 2. Use filetool to send it for plugin.
+    CXIMPTestFileSrvMsg* srvMsg = CXIMPTestFileSrvMsg::NewL( CXIMPTestFileSrvMsg::ETestSrvMsgPresentityGroupMemberList, 
+                                                             *packedBufferArray );
+    CleanupStack::PopAndDestroy( packedBufferArray );
+    CleanupStack::PushL( srvMsg );
+    wrapper->FileTool().CleanAllL();
+    wrapper->FileTool().SrvMsgStoreL( srvMsg );
+    CleanupStack::PopAndDestroy( srvMsg );
+
+    // 3. Send data to member
+    CPresenceInfoImp* presenceInfo = CPresenceInfoImp::NewLC();
+    HBufC8* packedInfo = TXIMPObjectPacker< CPresenceInfoImp >::PackL( *presenceInfo );
+    CleanupStack::PopAndDestroy( presenceInfo );
+    CleanupStack::PushL( packedInfo );
+    packedId = TXIMPObjectPacker< CXIMPIdentityImp >::PackL( *identity );
+    CleanupStack::PushL( packedId );
+    CleanupClosePushL( bufferArray );
+    bufferArray.AppendL( packedId );
+    bufferArray.AppendL( packedInfo );
+    packedBufferArray = TXIMPHBuf8Packer::PackArrayL( bufferArray );
+    CleanupStack::PopAndDestroy( 3, packedInfo ); // packedId, packedInfo
+    CleanupStack::PushL( packedBufferArray );
+    
+    // 4. Use filetool to send it for plugin.
+    srvMsg = CXIMPTestFileSrvMsg::NewL( CXIMPTestFileSrvMsg::ETestSrvMsgPresentityPresence, 
+                                                             *packedBufferArray );
+    CleanupStack::PopAndDestroy( packedBufferArray );
+    CleanupStack::PushL( srvMsg );
+    wrapper->FileTool().SrvMsgStoreL( srvMsg );
+    CleanupStack::PopAndDestroy( srvMsg );
+    
+    // Wait for event
+    // 5. Wait for event.
+    SetupListenerReqCompleteL( wrapper, EXIMPTestStatusEvents_HandlePresentityPresence );
+    // Wait for events
+    wrapper->WaitAnyEvent();
+    wrapper->VerifyEventStackL( _L8("Handle presence watcher list. Wrong event occurred.") );
+        
+        
+    // Setup status event listener for RequestComplete
+    SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); // allow events after reqcomplete
+
+    // register interest
+    reqId = presPub.UnsubscribeOwnPresenceL();
+
+    // Wait for events on the request
+    wrapper->WaitRequestAndStackEvents( reqId );
+    wrapper->VerifyEventStackL( _L8("Subscribing own presence, complete with error: ") );
+        
+// TODO THINGSIES
+
+    // Setup status event listener for RequestComplete
+    SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); // allow events after reqcomplete
+
+    // register interest
+    reqId = presWatch.UnsubscribePresentityGroupMembersPresenceL( *identity );
+
+    // Wait for events on the request
+    wrapper->WaitRequestAndStackEvents( reqId );
+    wrapper->VerifyEventStackL( _L8("Subscribing presentity group members presence, complete with error: ") );
+    // verify that UpdateInterest was called
+    COMMONASSERT( messenger, EXIMPPlgTestUnsubscribePresentityGroupMembersPresesenceCalled, "UnsubscribePresentityGroupMembersPresenceL was not called", ETrue, NULL );
+
+    CleanupStack::PopAndDestroy( 2, identity ); //pif, identity
+    
+    UnbindL();
+    }
+
+
+// ===========================================================================
+// SETUP HELPERS FOR THE LISTENER
+// ===========================================================================
+//
+void T_PresenceWatching::SetupListenerReqCompleteL( CXIMPTestContextWrapper* aWrapper, TXIMPTestStatusEventTemplate aEventType )
+    {
+    RArray< TInt32 > array;
+    CleanupClosePushL( array );
+    array.Append( MXIMPContextStateEvent::KInterfaceId );
+    array.Append( MPresentityPresenceEvent::KInterfaceId );
+    aWrapper->SetupListenerReqCompleteL( aEventType, &array );
+    CleanupStack::PopAndDestroy(); // array
+    }
+
+void T_PresenceWatching::SetupListenerReqCompleteAllowEventsL(  CXIMPTestContextWrapper* aWrapper, TXIMPTestStatusEventTemplate aEventType )
+    {
+    RArray< TInt32 > array;
+    CleanupClosePushL( array );
+    array.AppendL( MXIMPRequestCompleteEvent::KInterfaceId );
+    array.AppendL( MXIMPContextStateEvent::KInterfaceId );
+    array.AppendL( MPresentityPresenceEvent::KInterfaceId );
+    aWrapper->SetupListenerReqCompleteL( aEventType, &array );
+    CleanupStack::PopAndDestroy(); // array
+    }
+
+// ===========================================================================
+// TEST CASE TABLE
+// ===========================================================================
+//
+EUNIT_BEGIN_TEST_TABLE(
+        T_PresenceWatching,
+        "XIMP presence watching tests",
+        "MODULE" )
+
+PRFW_DECORATED_TEST(
+        "Subscribe single presence",
+        "",
+        "",
+        "FUNCTIONALITY",
+        Setup_L,
+        T_SubscribePresentityPresence_Single_L,
+        Teardown )
+
+PRFW_DECORATED_TEST(
+        "Subscribe single presence and handle the presence data with cache checking",
+        "",
+        "",
+        "FUNCTIONALITY",
+        Setup_L,
+        T_SubscribeHandlePresentityPresence_Single_L,
+        Teardown )
+
+PRFW_DECORATED_TEST(
+        "Subscribe single presence change id",
+        "",
+        "",
+        "FUNCTIONALITY",
+        Setup_L,
+        T_SubscribePresentityPresenceChangeId_Single_L,
+        Teardown )
+
+
+PRFW_DECORATED_TEST(
+        "Unsubscribe single presence",
+        "",
+        "",
+        "FUNCTIONALITY",
+        Setup_L,
+        T_UnsubscribeNotSubscribedPresentityPresence_Single_L,
+        Teardown )
+
+PRFW_DECORATED_TEST(
+        "Unsubscribe multiple presence",
+        "",
+        "",
+        "FUNCTIONALITY",
+        SetupMultiple_L,
+        T_UnsubscribeNotSubscribedPresentityPresence_Multiple_L,
+        Teardown )
+
+
+PRFW_DECORATED_TEST(
+        "Error From Plugin -> Leave when presentity subscribe is called",
+        "",
+        "",
+        "ERROHANDLING",
+        Setup_L,
+        T_ErrFromPlg_LeaveOnSubscribePresentityPresence_L,
+        Teardown )
+
+PRFW_DECORATED_TEST(
+        "Error From Plugin -> Leave when presentity unsubscribe is called",
+        "",
+        "",
+        "ERROHANDLING",
+        Setup_L,
+        T_ErrFromPlg_LeaveOnUnsubscribePresentityPresence_L,
+        Teardown )
+
+
+PRFW_DECORATED_TEST(
+        "Subscribe multiple presence",
+        "",
+        "",
+        "FUNCTIONALITY",
+        SetupMultiple_L,
+        T_SubscribePresentityPresence_Multiple_L,
+        Teardown )
+
+PRFW_DECORATED_TEST(
+        "Subscribe group members single presence",
+        "",
+        "",
+        "FUNCTIONALITY",
+        Setup_L,
+        T_SubscribePresentityGroupMembersPresence_Single_L,
+        Teardown )
+
+PRFW_DECORATED_TEST(
+        "Unsubscribe single group members presence",
+        "",
+        "",
+        "FUNCTIONALITY",
+        Setup_L,
+        T_UnsubscribeNotSubscribedPresentityGroupMembersPresence_Single_L,
+        Teardown )
+
+PRFW_DECORATED_TEST(
+        "Unsubscribe multiple group members presence",
+        "",
+        "",
+        "FUNCTIONALITY",
+        SetupMultiple_L,
+        T_UnsubscribeNotSubscribedPresentityGroupMembersPresence_Multiple_L,
+        Teardown )
+
+
+PRFW_DECORATED_TEST(
+        "Subscribe multiple presence for group members",
+        "",
+        "",
+        "FUNCTIONALITY",
+        SetupMultiple_L,
+        T_SubscribeGroupMembersPresence_Multiple_L,
+        Teardown )
+
+        
+PRFW_DECORATED_TEST(
+        "Error From Plugin -> Leave when presentity group members subscribe is called",
+        "",
+        "",
+        "ERROHANDLING",
+        Setup_L,
+        T_ErrFromPlg_LeaveOnSubscribePresentityGroupMembersPresence_L,
+        Teardown )
+
+PRFW_DECORATED_TEST(
+        "Error From Plugin -> Leave when presentity group members unsubscribe is called",
+        "",
+        "",
+        "ERROHANDLING",
+        Setup_L,
+        T_ErrFromPlg_LeaveOnUnsubscribePresentityGroupMembersPresence_L,
+        Teardown )
+        
+
+PRFW_DECORATED_TEST(
+        "Handle group members single presence",
+        "",
+        "",
+        "FUNCTIONALITY",
+        Setup_L,
+        T_ContentChangePresentityGroupMembersPresence_Single_L,
+        Teardown )
+
+
+EUNIT_END_TEST_TABLE
+
+
+// ===========================================================================
+// TEST SUITE CONSTRUCTION
+// ===========================================================================
+//
+EXPORT_C MEUnitTest* CreateTestSuiteL()
+    {
+    return T_PresenceWatching::NewL();
+    }
+
+
+// end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/tsrc/src/t_presencewatching/t_presencewatching.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,112 @@
+/*
+* 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: XIMP Framework Test Code 
+*
+*/
+
+#ifndef T_PRESENCEWATCHING_H
+#define T_PRESENCEWATCHING_H
+
+
+//  EXTERNAL INCLUDES
+#include <platform/digia/eunit/ceunittestsuiteclass.h>
+#include <platform/digia/eunit/EUnitDecorators.h>
+
+#include <ximpbase.h>
+#include "prfwteststatuseventlistener.h"
+#include "prfwtestmessaging.h"
+
+class CXIMPTestContextWrapper;
+class CXIMPTestContextWrapperMgr;
+class CXIMPTestMessenger;
+class MPresenceCacheReader;
+
+/**
+ * XIMP Framework Eunit tests.
+ *
+ * Tests for XIMP session management services.
+ *
+ * @since S60 v4.0
+ */
+class T_PresenceWatching : public CEUnitTestSuiteClass
+    {
+
+public:
+    static T_PresenceWatching* NewL();
+    virtual ~T_PresenceWatching();
+
+
+private:
+    T_PresenceWatching();
+    void ConstructL();
+
+
+
+private:    // Test case functions
+
+    void Setup_L();
+    void SetupMultiple_L();
+    void BindL();
+    void BindAllL();
+    void Teardown();
+    void UnbindL();
+    void UnbindAllL();
+
+    void T_SubscribePresentityPresence_Single_L();
+    void T_SubscribeHandlePresentityPresence_Single_L();
+    void T_SubscribePresentityPresenceChangeId_Single_L();
+    void T_UnsubscribeNotSubscribedPresentityPresence_Single_L();
+    void T_UnsubscribeNotSubscribedPresentityPresence_Multiple_L();
+
+    void T_SubscribePresentityPresence_Multiple_L();
+    void T_SubscribePresentityGroupMembersPresence_Single_L();
+    void T_UnsubscribeNotSubscribedPresentityGroupMembersPresence_Single_L();
+    void T_UnsubscribeNotSubscribedPresentityGroupMembersPresence_Multiple_L();
+    void T_ContentChangePresentityGroupMembersPresence_Single_L();
+    
+    void T_ErrFromPlg_LeaveOnSubscribePresentityPresence_L();
+    void T_ErrFromPlg_LeaveOnSubscribePresentityGroupMembersPresence_L();
+    void T_ErrFromPlg_LeaveOnUnsubscribePresentityPresence_L();
+    void T_ErrFromPlg_LeaveOnUnsubscribePresentityGroupMembersPresence_L();
+    
+    void T_SubscribeGroupMembersPresence_Multiple_L();
+
+private:    // Test helpers
+
+    void SetupListenerReqCompleteL( CXIMPTestContextWrapper* aWrapper, TXIMPTestStatusEventTemplate aEventType );
+    void SetupListenerReqCompleteAllowEventsL( CXIMPTestContextWrapper* aWrapper, TXIMPTestStatusEventTemplate aEventTypes );
+
+private: // Test data
+
+    /**
+     * Eunit test case table declaration.
+     */
+    EUNIT_DECLARE_TEST_TABLE;
+
+    // owned
+    CXIMPTestContextWrapperMgr* iWrapperMgr;
+    
+    MPresenceCacheReader* iMPresenceCacheReader;
+    };
+
+
+#endif      //  T_PRESENCEWATCHING_H
+
+
+
+// end of file
+
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/tsrc/src/t_presencewatching/t_presencewatching.mmp	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  XIMP Framework Test Code 
+*
+*/
+
+#include            "../../tsrcutils/eunitcommon/eunittstdllbase.hrh"
+#include            "../../tsrcutils/processmaster/pm.h"
+
+#include<platform_paths.hrh>
+#include<eunitcaps.h>
+TARGET              t_presencewatching.dll
+//CAPABILITY              ALL - TCB - DRM
+CAPABILITY      EUNIT_CAPS
+
+SOURCEPATH          .
+SOURCE              t_presencewatching.cpp
+
+
+USERINCLUDE             ../../../core/srcdatamodel
+USERINCLUDE             ../../../presence/srcpresencedatamodel
+USERINCLUDE             ../../../presence/srcpresencedatamodel/presentitygroups
+USERINCLUDE             ../../../presence/srcpresencedatamodel/presencewatching
+USERINCLUDE             ../../../presence/srcpresencedatamodel/presenceauthorization
+USERINCLUDE             ../../../presence/srcpresencedatamodel/presencepublishing
+USERINCLUDE             ../../../presence/srcpresencedatamodel/presenceinfo
+USERINCLUDE             ../../../core/srcutils
+
+USERINCLUDE             ../../tsrcprotocols
+
+// TODO remove unnecessary
+
+#if defined ( OS_LAYER_SYSTEMINCLUDE )
+OS_LAYER_SYSTEMINCLUDE
+#else
+SYSTEMINCLUDE     /epoc32/include
+#endif
+
+ #if defined ( APP_LAYER_SYSTEMINCLUDE )
+ APP_LAYER_SYSTEMINCLUDE
+ #else
+ SYSTEMINCLUDE     \epoc32\include
+ #endif
+ 
+ 
+SYSTEMINCLUDE           ../../../inc/core/base
+SYSTEMINCLUDE           ../../../inc/core/datamodel
+SYSTEMINCLUDE           ../../../inc/core/protocolplugin
+SYSTEMINCLUDE           ../../../inc/core/protocolpluginhost
+SYSTEMINCLUDE           ../../../inc/presence/presencedatamodel
+SYSTEMINCLUDE           ../../../inc/presence/presencemanagement
+SYSTEMINCLUDE           ../../../inc/presence/presenceprotocolplugin
+SYSTEMINCLUDE           ../../../inc/presence/presenceprotocolpluginhost
+
+
+LIBRARY             ecom.lib
+LIBRARY             bafl.lib
+LIBRARY             ximpdatamodel.lib
+LIBRARY             estor.lib
+LIBRARY             presencedatamodel.lib
+LIBRARY             ximputils.lib
+LIBRARY             eunit.lib
+LIBRARY             eunitutil.lib
+LIBRARY             euser.lib
+
+// end of file
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/tsrc/src/t_rootservices/bld.inf	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,23 @@
+/*
+* 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 t_rootservices.dll
+*
+*/
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_TESTMMPFILES
+t_rootservices.mmp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/tsrc/src/t_rootservices/t_rootservices.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -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: XIMP Framework Test Code 
+*
+*/
+
+#include "t_rootservices.h"
+
+#include "eunittools.h"
+
+#include <ecom/ecom.h>
+#include <badesca.h>
+#include <platform/digia/eunit/eunitmacros.h>
+#include <platform/digia/eunit/teunitassertioninfo.h>
+
+//XIMP headers
+#include <ximpbase.h>
+#include <ximpclient.h>
+#include <ximpprotocolinfo.h>
+#include <ximpfeatureinfo.h>
+
+#include "prfwtestrobustnesstools.h"
+#include "prfwtestprotocols.h"
+
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// CONSTRUCTION
+T_RootServices* T_RootServices::NewL()
+    {
+    T_RootServices* self = new( ELeave ) T_RootServices;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+
+    return self;
+    }
+
+
+T_RootServices::~T_RootServices()
+    {
+    }
+
+
+void T_RootServices::ConstructL()
+    {
+    CEUnitTestSuiteClass::ConstructL();
+    }
+
+
+T_RootServices::T_RootServices()
+    {
+    }
+
+
+
+// ===========================================================================
+// TEST CASE SETUP & TEARDOWN METHODS
+// ===========================================================================
+//
+void T_RootServices::Setup_L()
+    {
+    PrfwTestRobustness::DoPreCleaning();
+    }
+
+
+
+void T_RootServices::Teardown()
+    {
+    REComSession::FinalClose();
+    PrfwTestRobustness::DoPreCleaning();
+    }
+
+
+
+// ===========================================================================
+// USAGE SCENARIO:
+//
+// ===========================================================================
+//
+void T_RootServices::Test_ListProtocolsAndTheirCapabilities_L()
+    {
+    //Initialize XIMP client
+    MXIMPClient* presClient = MXIMPClient::NewClientL();
+    CleanupDeletePushL( presClient );
+
+    RXIMPObjOwningPtrArray< MXIMPProtocolInfo > protocolList;
+    CleanupClosePushL( protocolList );
+
+    //List & dump all available protocols
+    presClient->GetProtocolsL( protocolList );
+    __DumpProtocolListL( protocolList );
+
+    //Verify that atleast main test protocol exist in list
+    //And for it is reported corect properties
+    TBool mainTestProtocolFound( EFalse );
+    for ( TInt index( 0 ); index < protocolList.Count(); index++ )
+        {
+        MXIMPProtocolInfo& protocol = *protocolList[ index ];
+        if (protocol.DisplayName() == K_PRFW_TST_PROTOCOL_1_DISPLAY_NAME )
+            {
+            if ( protocol.ImplementationUid() == TUid::Uid( K_PRFW_TST_PROTOCOL_1_IMPLEMENTATION_UID ) ) 
+                {
+                mainTestProtocolFound = ETrue;
+                break;
+                }
+            }
+        }
+
+    EUNIT_ASSERT_DESC( mainTestProtocolFound, "Primary test protocol not found." );
+
+    CleanupStack::PopAndDestroy(); //protocolList
+    CleanupStack::PopAndDestroy(); //presClient
+    }
+
+
+
+
+// ===========================================================================
+// HELPERS
+// ===========================================================================
+//
+void T_RootServices::__DumpProtocolListL(
+    RXIMPObjOwningPtrArray< MXIMPProtocolInfo >& aProtocolList )
+    {
+    const TInt count = aProtocolList.Count();
+    EUNIT_PRINT( _L( "Dumping %d protocols:"), count );
+
+    //Iterate through the list of protocols and dump details
+    for( TInt ix = 0; ix < count; ix++ )
+        {
+        MXIMPProtocolInfo& protocol = *aProtocolList[ ix ];
+        MXIMPFeatureInfo* feats = protocol.GetProtocolFeaturesLC();
+
+            {
+            TBuf< 1000 > buffer;
+
+            //Print protocol details
+            buffer.AppendFormat( _L("  Protocol %d: [%08x] [%S]"),
+                                 ix,
+                                 protocol.ImplementationUid(),
+                                 &protocol.DisplayName() );
+            EUNIT_PRINT( buffer );
+
+
+            //Print feature details
+            const MDesC8Array& featureIds = feats->FeatureIds();
+
+            const TInt featCount = featureIds.MdcaCount();
+            buffer.Zero();
+            buffer.AppendFormat( _L("  Supported features %d: "), featCount );
+
+            for( TInt ix = 0; ix < featCount; ix++ )
+                {
+                TBuf< 50 > tmpBuf;
+                tmpBuf.Copy( featureIds.MdcaPoint( ix ) );
+                buffer.AppendFormat( _L("%S "), &tmpBuf );
+                }
+
+            EUNIT_PRINT( buffer );
+            }
+
+        CleanupStack::PopAndDestroy(); //feats
+        }
+    }
+
+
+
+
+// ===========================================================================
+// TEST CASE TABLE
+// ===========================================================================
+//
+EUNIT_BEGIN_TEST_TABLE(
+    T_RootServices,
+    "XIMP root services",
+    "MODULE" )
+
+    PRFW_NOT_DECORATED_TEST(
+        "List available protocols and their capabilities",
+        "",
+        "",
+        "FUNCTIONALITY",
+        Setup_L,
+        Test_ListProtocolsAndTheirCapabilities_L,
+        Teardown )
+
+
+EUNIT_END_TEST_TABLE
+
+
+
+
+
+// ===========================================================================
+// TEST SUITE CONSTRUCTION
+// ===========================================================================
+//
+EXPORT_C MEUnitTest* CreateTestSuiteL()
+    {
+    return T_RootServices::NewL();
+    }
+
+
+// end of file
+
+
+
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/tsrc/src/t_rootservices/t_rootservices.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,90 @@
+/*
+* 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: XIMP Framework Test Code 
+*
+*/
+
+#ifndef T_ROOTSERVICES_H__
+#define T_ROOTSERVICES_H__
+
+
+
+//  EXTERNAL INCLUDES
+#include <platform/digia/eunit/ceunittestsuiteclass.h>
+#include <platform/digia/eunit/EUnitDecorators.h>
+
+#include <ximpbase.h>
+
+class MXIMPProtocolInfo;
+class MXIMPClient;
+class MXIMPContext;
+class CUSContextObserver;
+
+
+/**
+ * XIMP Framework Eunit tests.
+ *
+ * Tests for XIMP root services.
+ *
+ * @since S60 v3.2
+ */
+class T_RootServices : public CEUnitTestSuiteClass
+    {
+public:
+    static T_RootServices* NewL();
+    virtual ~T_RootServices();
+
+
+private:
+    T_RootServices();
+    void ConstructL();
+
+
+
+private:    // Test case functions
+
+    void Setup_L();
+    void Teardown();
+
+    void Test_ListProtocolsAndTheirCapabilities_L();
+
+
+private:    // Test helpers
+
+    void __DumpProtocolListL(
+        RXIMPObjOwningPtrArray< MXIMPProtocolInfo >& aProtocolList );
+
+
+
+private: // Test data
+
+
+    /**
+     * Eunit test case table declaration.
+     */
+    EUNIT_DECLARE_TEST_TABLE;
+
+
+    };
+
+
+#endif      //  T_ROOTSERVICES_H__
+
+
+
+// end of file
+
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/tsrc/src/t_rootservices/t_rootservices.mmp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,64 @@
+/*
+* 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: XIMP Framework Test Code 
+* 
+*/
+
+#include            "../../tsrcutils/eunitcommon/eunittstdllbase.hrh"
+#include            "../../tsrcutils/processmaster/pm.h"
+
+#include<platform_paths.hrh>
+#include<eunitcaps.h>
+TARGET              t_rootservices.dll
+CAPABILITY      EUNIT_CAPS
+
+SOURCEPATH          .
+SOURCE              t_rootservices.cpp
+
+USERINCLUDE             ../../../core/srcdatamodel
+USERINCLUDE             ../../../presence/srcpresencedatamodel
+USERINCLUDE             ../../../presence/srcpresencedatamodel/presentitygroups
+USERINCLUDE             ../../../presence/srcpresencedatamodel/presencewatching
+USERINCLUDE             ../../../presence/srcpresencedatamodel/presenceauthorization
+USERINCLUDE             ../../../presence/srcpresencedatamodel/presencepublishing
+USERINCLUDE             ../../../presence/srcpresencedatamodel/presenceinfo
+USERINCLUDE             ../../../core/srcutils
+
+
+USERINCLUDE         ../../tsrcprotocols
+#if defined ( OS_LAYER_SYSTEMINCLUDE )
+OS_LAYER_SYSTEMINCLUDE
+#else
+SYSTEMINCLUDE     /epoc32/include
+#endif
+
+ #if defined ( APP_LAYER_SYSTEMINCLUDE )
+ APP_LAYER_SYSTEMINCLUDE
+ #else
+ SYSTEMINCLUDE     \epoc32\include
+ #endif
+
+LIBRARY             ecom.lib
+LIBRARY             bafl.lib
+LIBRARY             ximpdatamodel.lib
+LIBRARY             presencedatamodel.lib
+LIBRARY             estor.lib
+LIBRARY             ximputils.lib
+LIBRARY             eunit.lib
+LIBRARY             eunitutil.lib
+LIBRARY             euser.lib
+
+// end of file
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/tsrc/src/t_sessionmng/bld.inf	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,23 @@
+/*
+* 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 t_sessionmng.dll
+*
+*/
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_TESTMMPFILES
+t_sessionmng.mmp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/tsrc/src/t_sessionmng/t_sessionmng.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,875 @@
+/*
+* 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: XIMP Framework Test Code 
+*
+*/
+
+//#include <eunitmacros.h>
+#include <ecom/ecom.h>
+#include <badesca.h>
+#include <e32base.h>
+
+#include "t_sessionmng.h"
+#include "prfwteststatuseventlistener.h"
+#include "prfwtestmessaging.h"
+#include "prfwtestmessenger.h"
+#include "prfwtestcontextwrappermgr.h"
+#include "prfwtestcontextwrapper.h"
+#include "prfwtestfiletool.h"
+#include "userafter.h"
+
+#include "eunittools.h"
+#include "prfwtestrobustnesstools.h"
+#include "prfwtestprotocols.h"
+
+#include <ximpclient.h>
+#include <ximpcontext.h>
+#include <ximpcontextstateevent.h>
+#include <ximprequestcompleteevent.h>
+#include <ximpstatus.h>
+#include <ximpfeatureinfo.h>
+#include <ximpserviceinfo.h>
+
+
+
+
+#include <platform/digia/eunit/eunitmacros.h>
+#include <platform/digia/eunit/teunitassertioninfo.h>
+
+
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// CONSTRUCTION
+T_SessionMng* T_SessionMng::NewL()
+    {
+    T_SessionMng* self = new( ELeave ) T_SessionMng;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+
+    return self;
+    }
+
+
+T_SessionMng::~T_SessionMng()
+    {
+    delete iWrapperMgr;
+    
+    CXIMPTestFileTool::CleanAllL();
+    }
+
+
+void T_SessionMng::ConstructL()
+    {
+    CEUnitTestSuiteClass::ConstructL();
+    CXIMPTestFileTool::CleanAllL();
+    }
+
+
+T_SessionMng::T_SessionMng()
+    {
+    }
+
+
+
+// ===========================================================================
+// TEST CASE SETUP & TEARDOWN METHODS
+// ===========================================================================
+//
+
+void T_SessionMng::Setup_L()
+    {
+    PrfwTestRobustness::DoPreCleaning();
+
+    // now we're using only one connection
+    iWrapperMgr = CXIMPTestContextWrapperMgr::NewL();
+    iWrapperMgr->CreateWrapperL();
+    }
+
+
+void T_SessionMng::Setup_2_L()
+    {
+    iWrapperMgr = CXIMPTestContextWrapperMgr::NewL();
+
+    // two wrappers
+    iWrapperMgr->CreateWrapperL();
+    iWrapperMgr->CreateWrapperL();
+    }
+
+
+void T_SessionMng::Setup_3_L()
+    {
+    iWrapperMgr = CXIMPTestContextWrapperMgr::NewL();
+
+    // three wrappers for unbalanced bind/share unbind/unshare test
+    iWrapperMgr->CreateWrapperL();
+    iWrapperMgr->CreateWrapperL();
+    iWrapperMgr->CreateWrapperL();
+    }
+
+
+void T_SessionMng::Teardown()
+    {
+    delete iWrapperMgr;
+    iWrapperMgr = NULL;
+
+    REComSession::FinalClose();
+
+    PrfwTestRobustness::DoPreCleaning();
+    }
+
+
+
+// ===========================================================================
+// TEST CASE
+// ===========================================================================
+void T_SessionMng::T_Simple_Bind_Wait_Unbind_L()
+    {
+    EUNIT_PRINT( _L("Simple context Bind/Unbind test.") );
+    EUNIT_PRINT( _L("Client side waits bind completion before issuing unbind.") );
+
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    MXIMPContext* context = wrapper->GetContext();
+    CXIMPTestStatusEventListener* eventListener = wrapper->GetEventListener();
+    CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+    //Do bind, wait and verify events
+    wrapper->SetupListenerL( EXIMPTestStatusEvents_BindingOk );
+    
+    messenger->SetPluginIndex( 0 );
+    messenger->SetNoError();
+
+    TXIMPRequestId reqId;
+    reqId = BindContextToDefaultL( context );
+    EUNIT_ASSERT( reqId != TXIMPRequestId::Null() );
+
+    wrapper->WaitRequestAndStackEvents( reqId );
+    wrapper->VerifyEventStackL( _L8("Binding single context: ") );
+
+    messenger->AssertOpenSessionCalled( ETrue );
+
+    //Verify features availability
+    MXIMPFeatureInfo* ctxFeats = context->GetContextFeaturesLC();
+    EUNIT_ASSERT_DESC( ctxFeats->FeatureIds().MdcaCount() > 0, "No features from context" );
+    CleanupStack::PopAndDestroy(); //ctxFeats
+
+    //Do unbind, wait and verify events
+    wrapper->SetupListenerL( EXIMPTestStatusEvents_UnbindingOk );
+    messenger->SetNoError();
+    reqId = context->UnbindL();
+    EUNIT_ASSERT( reqId != TXIMPRequestId::Null() );
+
+    wrapper->WaitRequestAndStackEvents( reqId );
+    wrapper->VerifyEventStackL( _L8("Unbinding single context: ") );
+
+    messenger->AssertCloseSessionCalled( ETrue );
+    messenger->AssertPluginDied( ETrue );
+    }
+
+// ===========================================================================
+// TEST CASE
+// ===========================================================================
+void T_SessionMng::T_Settings_Bind_Wait_Unbind_L()
+    {
+    EUNIT_PRINT( _L("Context Bind with Settings id/Unbind test.") );
+    EUNIT_PRINT( _L("Client side waits bind completion before issuing unbind.") );
+
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    MXIMPContext* context = wrapper->GetContext();
+    CXIMPTestStatusEventListener* eventListener = wrapper->GetEventListener();
+    CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+    //Do bind, wait and verify events
+    wrapper->SetupListenerL( EXIMPTestStatusEvents_BindingOk );
+    
+    messenger->SetPluginIndex( 0 );
+    messenger->SetNoError();
+
+    TXIMPRequestId reqId;
+    TUid protocol = { K_PRFW_TST_PROTOCOL_1_IMPLEMENTATION_UID };
+    reqId = context->BindToL( protocol, 0 );
+    
+    EUNIT_ASSERT( reqId != TXIMPRequestId::Null() );
+
+    wrapper->WaitRequestAndStackEvents( reqId );
+    wrapper->VerifyEventStackL( _L8("Binding single context: ") );
+
+    messenger->AssertOpenSessionCalled( ETrue );
+
+    //Verify features availability
+    MXIMPFeatureInfo* ctxFeats = context->GetContextFeaturesLC();
+    EUNIT_ASSERT_DESC( ctxFeats->FeatureIds().MdcaCount() > 0, "No features from context" );
+    CleanupStack::PopAndDestroy(); //ctxFeats
+
+    //Do unbind, wait and verify events
+    wrapper->SetupListenerL( EXIMPTestStatusEvents_UnbindingOk );
+    messenger->SetNoError();
+    reqId = context->UnbindL();
+    EUNIT_ASSERT( reqId != TXIMPRequestId::Null() );
+
+    wrapper->WaitRequestAndStackEvents( reqId );
+    wrapper->VerifyEventStackL( _L8("Unbinding single context: ") );
+
+    messenger->AssertCloseSessionCalled( ETrue );
+    messenger->AssertPluginDied( ETrue );
+    }
+
+
+// ===========================================================================
+// TEST CASE
+// ===========================================================================
+void T_SessionMng::T_Simple_Bind_Wait_OOM_L()
+    {
+    EUNIT_PRINT( _L("Simple context Bind OOM test.") );
+    EUNIT_PRINT( _L("Client side waits bind completion in alloc heaven.") );
+
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    MXIMPContext* context = wrapper->GetContext();
+    CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+    //Do bind, wait and verify events
+    wrapper->SetupListenerReqCompleteL( EXIMPTestStatusEvents_RequestOk );
+
+    messenger->SetPluginIndex( 0 );
+    messenger->SetNoError();
+
+    TXIMPRequestId reqId;
+    reqId = BindContextToDefaultL( context );
+    EUNIT_ASSERT( reqId != TXIMPRequestId::Null() );
+
+    wrapper->WaitRequestAndStackEvents( reqId );
+    
+    CXIMPTestStatusEventListener* eventListener = wrapper->GetEventListener();    
+    TInt reqCompleteErr = eventListener->GetReqCompletionErrL( reqId );
+    User::LeaveIfError( reqCompleteErr );
+    
+    wrapper->VerifyEventStackL( _L8("Binding single context in OOM: ") );
+    }
+
+
+// ===========================================================================
+// TEST CASE
+// ===========================================================================
+void T_SessionMng::T_Simple_Bind_Wait_Unbind_WithReqCompleteEventFilter_L()
+    {
+    EUNIT_PRINT( _L("Simple context Bind/Unbind test.") );
+    EUNIT_PRINT( _L("Client side waits bind completion before issuing unbind.") );
+    EUNIT_PRINT( _L("Client event filter accepts only request completion events") );
+
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    MXIMPContext* context = wrapper->GetContext();
+    CXIMPTestStatusEventListener* eventListener = wrapper->GetEventListener();
+    CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+    //Accept only ReqComplete events
+    wrapper->SetupListenerReqCompleteL( EXIMPTestStatusEvents_RequestOk );
+    
+    messenger->SetPluginIndex( 0 );
+    messenger->SetNoError();
+    
+    
+    //Do bind, wait and verify events    
+    TXIMPRequestId reqId = BindContextToDefaultL( context );
+
+    wrapper->WaitRequestAndStackEvents( reqId );
+    wrapper->VerifyEventStackL( _L8("Binding single context, accepting only reqComplete events: ") );
+    messenger->AssertOpenSessionCalled( ETrue );
+    
+
+    //Accept only ReqComplete events
+    wrapper->SetupListenerReqCompleteL( EXIMPTestStatusEvents_RequestOk );
+    messenger->SetNoError();
+
+    //Do unbind, wait and verify events
+    reqId = context->UnbindL();
+
+    wrapper->WaitRequestAndStackEvents( reqId );
+    wrapper->VerifyEventStackL( _L8("Unbinding single context, accepting only reqComplete events: ") );
+
+    messenger->AssertCloseSessionCalled( ETrue );
+    }
+
+
+
+// ===========================================================================
+// TEST CASE
+// ===========================================================================
+//
+void T_SessionMng::T_Simple_Bind_Wait_CloseHandle_L()
+    {
+    EUNIT_PRINT( _L("Simple context Bind/CloseHandle test.") );
+    EUNIT_PRINT( _L("Client side waits bind completion before closing the handle.") );
+
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    MXIMPContext* context = wrapper->GetContext();
+    CXIMPTestStatusEventListener* eventListener = wrapper->GetEventListener();
+    CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+    //Do bind, wait and verify events
+    wrapper->SetupListenerL( EXIMPTestStatusEvents_BindingOk );
+
+    messenger->SetPluginIndex( 0 );
+    messenger->SetNoError();
+
+    TXIMPRequestId reqId = BindContextToDefaultL( context );
+
+    wrapper->WaitRequestAndStackEvents( reqId );
+    wrapper->VerifyEventStackL( _L8("Binding single context: ") );
+
+    messenger->AssertOpenSessionCalled( ETrue );
+
+
+    //Close handle and verify events
+    wrapper->ClearListener();    
+    messenger->SetNoError();
+    wrapper->DeletePresenceContext();
+    
+    
+    // we give 10 sec to plugin to die
+    CUserAfter::AfterSecondsL( 10 );
+
+
+    messenger->AssertCloseSessionCalled( ETrue );
+    messenger->AssertPluginDied( ETrue );
+
+    wrapper->VerifyEventStackL( _L8("Closing single context handle: ") );
+    }
+
+
+
+// ===========================================================================
+// TEST CASE
+// ===========================================================================
+//
+void T_SessionMng::T_Simple_Bind_Direct_Unbind_L()
+    {
+    EUNIT_PRINT( _L("Simple context Bind/Unbind test.") );
+    EUNIT_PRINT( _L("Client side deletes context while the binding is still active.") );
+
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    MXIMPContext* context = wrapper->GetContext();
+    CXIMPTestStatusEventListener* eventListener = wrapper->GetEventListener();
+    CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+    wrapper->SetupListenerL( EXIMPTestStatusEvents_BindingOk );
+    wrapper->AppendToTraitsL( EXIMPTestStatusEvents_UnbindingOk );
+
+    
+    messenger->SetPluginIndex( 0 );
+    messenger->SetNoError(); //For binding
+
+    
+    TXIMPRequestId bindReqId = BindContextToDefaultL( context );
+
+
+    messenger->AssertOpenSessionCalled( ETrue );
+
+    messenger->SetNoError(); // for unbinding
+    TXIMPRequestId unbindReqId = context->UnbindL();
+
+    wrapper->WaitRequestAndStackEvents( bindReqId );
+    wrapper->WaitRequestAndStackEvents( unbindReqId );
+
+    wrapper->VerifyEventStackL( _L8("Direct Bind/Unbind single context: ") );
+
+    messenger->AssertCloseSessionCalled( ETrue );
+    messenger->AssertPluginDied( ETrue );
+    }
+
+
+
+
+// ===========================================================================
+// TEST CASE
+// ===========================================================================
+//
+void T_SessionMng::T_Simple_Bind_Direct_CloseHandle_L()
+    {
+    EUNIT_PRINT( _L("Simple context Bind/Unbind test.") );
+    EUNIT_PRINT( _L("Client side closes context handle while the binding is still active.") );
+
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    MXIMPContext* context = wrapper->GetContext();
+    CXIMPTestStatusEventListener* eventListener = wrapper->GetEventListener();
+    CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+   
+    messenger->SetPluginIndex( 0 );
+    messenger->SetNoError();   
+
+
+    TXIMPRequestId reqId = BindContextToDefaultL( context );
+
+    messenger->AssertOpenSessionCalled( ETrue );
+    wrapper->DeletePresenceContext();
+
+    // wait for plugin to die properly here
+    CUserAfter::AfterSecondsL( 10 );
+
+    messenger->AssertCloseSessionCalled( ETrue );
+    messenger->AssertPluginDied( ETrue );
+    }
+
+
+
+
+// ===========================================================================
+// TEST CASE
+// ===========================================================================
+//
+void T_SessionMng::T_ErrFromPlg_LeaveOnOpenSession_L()
+    {
+    EUNIT_PRINT( _L("Error from plug-in in bind/unbind." ) );
+    EUNIT_PRINT( _L("Plug-in leaves from OpenSessionL()." ) );
+
+
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    MXIMPContext* context = wrapper->GetContext();
+    CXIMPTestStatusEventListener* eventListener = wrapper->GetEventListener();
+    CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+        {
+        wrapper->SetupListenerL( EXIMPTestStatusEvents_BindingFailKErrAbort );
+        messenger->SetLeave( KErrAbort );
+        messenger->SetPluginIndex( 0 );
+        
+        TXIMPRequestId reqId = BindContextToDefaultL( context );
+
+        wrapper->WaitRequestAndStackEvents( reqId );
+        wrapper->VerifyEventStackL( _L8("Binding single context: ") );
+
+        //Verify that features are not available
+        TRAPD( featLoadErr,
+                MXIMPFeatureInfo* ctxFeats = context->GetContextFeaturesLC();
+                CleanupStack::PopAndDestroy(); //ctxFeats
+             );
+        EUNIT_ASSERT_NOT_EQUALS( featLoadErr, KErrNone );
+
+        // plugin should've been unloaded without calling CloseSession
+        EUNIT_ASSERT_DESC( ! messenger->GetBoolean( EXIMPPlgTestCloseSessionCalled ), "CloseSession was called" );
+
+        messenger->AssertPluginDied( ETrue );
+        }
+    }
+
+
+// ===========================================================================
+// TEST CASE:
+// ===========================================================================
+//
+void T_SessionMng::T_ErrFromPlg_ErrorResultOnOpenSession_L()
+    {
+    EUNIT_PRINT( _L("Error from plug-in in bind/unbind") );
+    EUNIT_PRINT( _L("Plug-in completes OpenSessionL() with error") );
+    EUNIT_PRINT( _L("Clint ctx can be reused for second bind.") );
+
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    MXIMPContext* context = wrapper->GetContext();
+    CXIMPTestStatusEventListener* eventListener = wrapper->GetEventListener();
+    CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+        {
+        wrapper->SetupListenerL( EXIMPTestStatusEvents_BindingFailKErrAbort );
+
+        messenger->SetError( KErrAbort );
+
+        messenger->SetPluginIndex( 0 );
+
+        TXIMPRequestId reqId = BindContextToDefaultL( context );
+
+        wrapper->WaitRequestAndStackEvents( reqId );
+        wrapper->VerifyEventStackL( _L8("Binding single context: ") );
+
+
+        // plugin should've been unloaded without calling CloseSession
+        EUNIT_ASSERT_DESC( ! messenger->GetBoolean( EXIMPPlgTestCloseSessionCalled ), "CloseSession was called" );
+        messenger->AssertPluginDied( ETrue );
+        }
+
+    
+    //It should be possible to reuse client ctx for second bind
+        {
+        //Do bind, wait and verify events
+        wrapper->SetupListenerL( EXIMPTestStatusEvents_BindingOk );
+        
+        messenger->SetPluginIndex( 0 );
+        messenger->SetNoError();
+
+        TXIMPRequestId reqId;
+        reqId = BindContextToDefaultL( context );
+        EUNIT_ASSERT( reqId != TXIMPRequestId::Null() );
+
+        wrapper->WaitRequestAndStackEvents( reqId );
+        wrapper->VerifyEventStackL( _L8("Binding single context: ") );
+
+        messenger->AssertOpenSessionCalled( ETrue );
+
+        //Verify features availability
+        MXIMPFeatureInfo* ctxFeats = context->GetContextFeaturesLC();
+        EUNIT_ASSERT_DESC( ctxFeats->FeatureIds().MdcaCount() > 0, "No features from context" );
+        CleanupStack::PopAndDestroy(); //ctxFeats
+
+        //Do unbind, wait and verify events
+        wrapper->SetupListenerL( EXIMPTestStatusEvents_UnbindingOk );
+        messenger->SetNoError();
+        reqId = context->UnbindL();
+        EUNIT_ASSERT( reqId != TXIMPRequestId::Null() );
+
+        wrapper->WaitRequestAndStackEvents( reqId );
+        wrapper->VerifyEventStackL( _L8("Unbinding single context: ") );
+
+        messenger->AssertCloseSessionCalled( ETrue );
+        messenger->AssertPluginDied( ETrue );
+        }    
+    }
+
+
+// ===========================================================================
+// TEST CASE:
+// Simple bind, bind error
+// ===========================================================================
+//
+void T_SessionMng::T_ErrFromPlg_InvalidReqIdOnOpenSession_L()
+    {
+    EUNIT_PRINT( _L("Error from plug-in in bind/unbind") );
+    EUNIT_PRINT( _L("Plug-in completes OpenSessionL() with faulty ReqId") );
+
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    MXIMPContext* context = wrapper->GetContext();
+    CXIMPTestStatusEventListener* eventListener = wrapper->GetEventListener();
+    CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+        {
+        wrapper->SetupListenerL( EXIMPTestStatusEvents_BindingFailInvalidReqId );
+        messenger->SetBoolean( EXIMPTestPlgBehaveInvalidReqId );
+        messenger->SetPluginIndex( 0 );
+        
+        TXIMPRequestId reqId = BindContextToDefaultL( context );
+
+        wrapper->WaitRequestAndStackEvents( reqId );
+        wrapper->VerifyEventStackL( _L8("Binding single context: ") );
+        }
+
+    }
+
+
+
+// ===========================================================================
+// TEST CASE:
+// ===========================================================================
+//
+void T_SessionMng::T_ErrFromPlg_ErrorResultOnCloseSession_L()
+    {
+    EUNIT_PRINT( _L("Error from plug-in in bind/unbind") );
+    EUNIT_PRINT( _L("Plug-in completes CloseSession() with error") );
+
+    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
+    MXIMPContext* context = wrapper->GetContext();
+    CXIMPTestStatusEventListener* eventListener = wrapper->GetEventListener();
+    CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+    //Do bind, wait and verify events
+    wrapper->SetupListenerL( EXIMPTestStatusEvents_BindingOk );
+
+    messenger->SetNoError();
+
+    messenger->SetPluginIndex( 0 );
+    
+    TXIMPRequestId reqId = BindContextToDefaultL( context );    
+
+
+    wrapper->WaitRequestAndStackEvents( reqId );
+    wrapper->VerifyEventStackL( _L8("Binding single context: ") );
+
+    messenger->AssertOpenSessionCalled( ETrue );
+
+    //Do unbind, wait and verify events
+    wrapper->SetupListenerL( EXIMPTestStatusEvents_UnbindingOk );
+
+    messenger->SetError( KErrCouldNotDisconnect );
+    reqId = context->UnbindL();
+
+    wrapper->WaitRequestAndStackEvents( reqId );
+    wrapper->VerifyEventStackL( _L8("Unbinding single context: ") );
+
+    messenger->AssertPluginDied( ETrue );
+    }
+
+  
+
+
+
+// ===========================================================================
+// TEST CASE
+// ===========================================================================
+//
+void T_SessionMng::T_Multi_Bind_Unbind_WithWaits_L()
+    {
+    EUNIT_PRINT( _L("Multiple context Bind/Unbind test.") );
+    EUNIT_PRINT( _L("Client performs multiple bind & unbinds for a separated context sharing a connection.") );
+
+    TInt ix;
+
+    // bind contexts
+    for ( ix = 0; ix < 3; ix++ )
+        {
+        CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( ix );
+        MXIMPContext* context = wrapper->GetContext();
+        CXIMPTestStatusEventListener* eventListener = wrapper->GetEventListener();
+        CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+        if ( ix == 1 )
+            {
+            // fail the middle one
+            wrapper->SetupListenerL( EXIMPTestStatusEvents_BindingFailKErrAbort );
+            messenger->SetError( KErrAbort );   // for binding
+            }
+        else
+            {
+            wrapper->SetupListenerL( EXIMPTestStatusEvents_BindingOk );
+            messenger->SetNoError();   // for binding
+            }
+
+        messenger->SetPluginIndex( ix );
+
+        TUid protocol = { K_PRFW_TST_PROTOCOL_1_IMPLEMENTATION_UID };
+        const TDesC16& instanceId = wrapper->InstanceId();
+        TXIMPRequestId reqId = context->BindToL( protocol,
+                                                _L("www.imps.no/wv"),
+                                                _L("user"),
+                                                _L("password"),
+                                                instanceId,
+                                                ix );
+
+        wrapper->WaitRequestAndStackEvents( reqId );
+
+        TBuf8<100> title;
+        title.AppendFormat( _L8("Bind [%d]: "), ix );
+        wrapper->VerifyEventStackL( title );
+
+        switch ( ix )
+            {
+            case 0 :
+            case 1 :
+            case 2 :
+                {
+                messenger->AssertOpenSessionCalled( ETrue );
+                break;
+                }
+            default :
+                {
+                break;
+                }
+            }
+    }
+
+
+    // now context has been bound.
+    // one has failed, but two are okay. do 3 unbinds.
+    for( ix = 0; ix < 3; ix++ )
+        {
+        CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( ix );
+        MXIMPContext* context = wrapper->GetContext();
+        CXIMPTestStatusEventListener* eventListener = wrapper->GetEventListener();
+        CXIMPTestMessenger* messenger = wrapper->GetMessenger();
+
+        if ( ix == 1 )
+            {
+            // the middle one has failed
+            TRAPD( err, context->UnbindL() );
+            EUNIT_ASSERT_EQUALS( err, KErrNotReady );
+            }
+
+        else
+            {
+            // we expect all unbinds to be okay from client point of view
+            wrapper->SetupListenerL( EXIMPTestStatusEvents_UnbindingOk );
+            messenger->SetNoError();   // For unbinding
+
+            TXIMPRequestId reqId = context->UnbindL();
+            wrapper->WaitRequestAndStackEvents( reqId );
+
+            TBuf8<100> title;
+            title.AppendFormat( _L8("Unbind [%d]: "), ix );
+            wrapper->VerifyEventStackL( title );
+            messenger->AssertCloseSessionCalled( ETrue );
+            }
+        }
+    }
+    
+    
+TXIMPRequestId T_SessionMng::BindContextToDefaultL( MXIMPContext* aContext )
+    {
+    TUid protocol = { K_PRFW_TST_PROTOCOL_1_IMPLEMENTATION_UID };
+    return aContext->BindToL( protocol,
+                             _L("www.imps.no/wv"),
+                             _L("user"),
+                             _L("password"),
+                             0 ); 
+    }
+
+
+
+// ===========================================================================
+// TEST CASE TABLE
+// ===========================================================================
+//
+EUNIT_BEGIN_TEST_TABLE(
+        T_SessionMng,
+        "XIMP session management tests",
+        "MODULE" )
+
+
+PRFW_NOT_DECORATED_TEST(
+        "Simple bind wait unbind",
+        "",
+        "",
+        "FUNCTIONALITY",
+        Setup_L,
+        T_Simple_Bind_Wait_Unbind_L,
+        Teardown )
+
+ PRFW_NOT_DECORATED_TEST(
+        "Settings bind wait unbind",
+        "",
+        "",
+        "FUNCTIONALITY",
+        Setup_L,
+        T_Settings_Bind_Wait_Unbind_L,
+        Teardown )
+
+EUNIT_ALLOC_TEST(
+        "Simple bind in OOM",
+        "",
+        "",
+        "FUNCTIONALITY",
+        Setup_L,
+        T_Simple_Bind_Wait_OOM_L,
+        Teardown )
+
+
+PRFW_NOT_DECORATED_TEST(
+        "Simple bind wait unbind with reqComplete event filter",
+        "",
+        "",
+        "FUNCTIONALITY",
+        Setup_L,
+        T_Simple_Bind_Wait_Unbind_WithReqCompleteEventFilter_L,
+        Teardown )
+
+PRFW_NOT_DECORATED_TEST(
+        "Simple bind wait close handle",
+        "",
+        "",
+        "FUNCTIONALITY",
+        Setup_L,
+        T_Simple_Bind_Wait_CloseHandle_L,
+        Teardown )
+
+
+PRFW_NOT_DECORATED_TEST(
+        "Simple bind direct unbind",
+        "",
+        "",
+        "FUNCTIONALITY",
+        Setup_L,
+        T_Simple_Bind_Direct_Unbind_L,
+        Teardown )
+
+
+PRFW_NOT_DECORATED_TEST(
+        "Simple bind direct close handle",
+        "",
+        "",
+        "FUNCTIONALITY",
+        Setup_L,
+        T_Simple_Bind_Direct_CloseHandle_L,
+        Teardown )
+
+
+// opensession errors
+PRFW_NOT_DECORATED_TEST(
+        "ErrFromPlg leave OpenSession",
+        "",
+        "",
+        "ERROHANDLING",
+        Setup_L,
+        T_ErrFromPlg_LeaveOnOpenSession_L,
+        Teardown )
+
+PRFW_NOT_DECORATED_TEST(
+        "ErrFromPlg OpenSession",
+        "",
+        "",
+        "ERROHANDLING",
+        Setup_L,
+        T_ErrFromPlg_ErrorResultOnOpenSession_L,
+        Teardown )
+
+
+
+PRFW_NOT_DECORATED_TEST(
+        "ErrFromPlg Invalid ReqId",
+        "",
+        "",
+        "ERROHANDLING",
+        Setup_L,
+        T_ErrFromPlg_InvalidReqIdOnOpenSession_L,
+        Teardown )
+
+
+// closesession errors
+PRFW_NOT_DECORATED_TEST(
+        "ErrFromPlg CloseSession",
+        "",
+        "",
+        "ERROHANDLING",
+        Setup_L,
+        T_ErrFromPlg_ErrorResultOnCloseSession_L,
+        Teardown )
+
+
+// multiple bind + unbind tests
+PRFW_NOT_DECORATED_TEST(
+        "Multiple context Bind/Unbind test.",
+        "",
+        "",
+        "ERROHANDLING",
+        Setup_3_L,
+        T_Multi_Bind_Unbind_WithWaits_L,
+        Teardown )
+
+
+EUNIT_END_TEST_TABLE
+
+
+// ===========================================================================
+// TEST SUITE CONSTRUCTION
+// ===========================================================================
+//
+EXPORT_C MEUnitTest* CreateTestSuiteL()
+    {
+    return T_SessionMng::NewL();
+    }
+
+
+// end of file
+
+
+
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/tsrc/src/t_sessionmng/t_sessionmng.h	Wed Nov 03 09:32:20 2010 +0530
@@ -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: XIMP Framework Test Code 
+*
+*/
+
+#ifndef T_SESSIONMNG_H__
+#define T_SESSIONMNG_H__
+
+
+
+
+//  EXTERNAL INCLUDES
+#include <platform/digia/eunit/ceunittestsuiteclass.h>
+#include <platform/digia/eunit/EUnitDecorators.h>
+
+#include <ximpbase.h>
+
+#include "prfwteststatuseventlistener.h"
+
+
+class CXIMPTestContextWrapperMgr;
+class MXIMPContext;
+
+/**
+ * XIMP Framework Eunit tests.
+ *
+ * Tests for XIMP session management services.
+ *
+ * @since S60 v4.0
+ */
+class T_SessionMng : public CEUnitTestSuiteClass
+    {
+
+public:
+    static T_SessionMng* NewL();
+    virtual ~T_SessionMng();
+
+
+private:
+    T_SessionMng();
+    void ConstructL();
+
+
+
+private:    // Test case functions
+
+    void Teardown();
+    
+    void Setup_L();
+    void Setup_2_L();
+    void Setup_3_L();
+
+   
+    void T_Simple_Bind_Wait_Unbind_L();
+    void T_Settings_Bind_Wait_Unbind_L();
+    void T_Simple_Bind_Wait_OOM_L();
+
+    void T_Simple_Bind_Wait_Unbind_WithReqCompleteEventFilter_L();
+    void T_Simple_Bind_Wait_CloseHandle_L();
+    void T_Simple_Bind_Direct_Unbind_L();
+    void T_Simple_Bind_Direct_CloseHandle_L();
+
+
+
+    void T_ErrFromPlg_LeaveOnOpenSession_L();
+    void T_ErrFromPlg_ErrorResultOnOpenSession_L();
+    void T_ErrFromPlg_ErrorResultOnCloseSession_L();
+    
+    void T_ErrFromPlg_InvalidReqIdOnOpenSession_L();
+    void T_Multi_Bind_Unbind_WithWaits_L();    
+    
+
+
+private:    // Test helpers
+
+    TXIMPRequestId BindContextToDefaultL( MXIMPContext* aContext );
+
+
+
+
+
+private: // Test data
+
+    /**
+     * Eunit test case table declaration.
+     */
+    EUNIT_DECLARE_TEST_TABLE;
+
+    /**
+     * Context Wrapper Manager
+     */
+    CXIMPTestContextWrapperMgr* iWrapperMgr;
+
+    };
+
+#endif      //  T_SESSIONMNG_H__
+
+
+
+// end of file
+
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/tsrc/src/t_sessionmng/t_sessionmng.mmp	Wed Nov 03 09:32:20 2010 +0530
@@ -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: XIMP Framework Test Code 
+*
+*/
+
+#include            "../../tsrcutils/eunitcommon/eunittstdllbase.hrh"
+#include            "../../tsrcutils/processmaster/pm.h"
+
+#include<platform_paths.hrh>
+#include<eunitcaps.h>
+TARGET              t_sessionmng.dll
+CAPABILITY      EUNIT_CAPS
+
+SOURCEPATH          .
+SOURCE              t_sessionmng.cpp
+
+USERINCLUDE             ../../../core/srcdatamodel
+USERINCLUDE             ../../../presence/srcpresencedatamodel
+USERINCLUDE             ../../../presence/srcpresencedatamodel/presentitygroups
+USERINCLUDE             ../../../presence/srcpresencedatamodel/presencewatching
+USERINCLUDE             ../../../presence/srcpresencedatamodel/presenceauthorization
+USERINCLUDE             ../../../presence/srcpresencedatamodel/presencepublishing
+USERINCLUDE             ../../../presence/srcpresencedatamodel/presenceinfo
+USERINCLUDE             ../../../core/srcutils
+USERINCLUDE         ../../tsrcprotocols
+
+#if defined ( OS_LAYER_SYSTEMINCLUDE )
+OS_LAYER_SYSTEMINCLUDE
+#else
+SYSTEMINCLUDE     /epoc32/include
+#endif
+
+ #if defined ( APP_LAYER_SYSTEMINCLUDE )
+ APP_LAYER_SYSTEMINCLUDE
+ #else
+ SYSTEMINCLUDE     \epoc32\include
+ #endif
+
+LIBRARY             ecom.lib
+LIBRARY             bafl.lib
+LIBRARY             ximpdatamodel.lib
+LIBRARY             presencedatamodel.lib
+LIBRARY             estor.lib
+LIBRARY             ximputils.lib
+LIBRARY             eunit.lib
+LIBRARY             eunitutil.lib
+LIBRARY             euser.lib
+
+// end of file
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/tsrc/src/t_utils/bld.inf	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,23 @@
+/*
+* 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 t_utils.dll
+ *
+*/
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_TESTMMPFILES
+t_utils.mmp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/tsrc/src/t_utils/t_utils.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,646 @@
+/*
+* 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: XIMP Framework Test Code 
+*
+*/
+
+
+#include <ecom/ecom.h>
+#include <badesca.h>
+#include <e32property.h>
+#include <e32base.h>
+#include <e32std.h>
+
+#include "eunittools.h"
+
+
+#include <platform/digia/eunit/eunitmacros.h>
+#include <platform/digia/eunit/teunitassertioninfo.h>
+
+#include "t_utils.h"
+
+
+
+#include <ximpbase.h>
+#include <presenceinfo.h>
+
+#include "ximpeventcodec.h"
+#include "ownpresenceeventimp.h"
+#include "prfwtestfiletool.h"
+#include "ximppanics.h"
+
+#include "prfwtestrobustnesstools.h"
+
+#include "ximpobjectfactoryimp.h"
+#include "ximpobjectcollection.h"
+#include "ximprestrictedobjectcollection.h"
+#include "ximpidentityimp.h"
+#include "ximpstatusimp.h"
+#include "ximprequestidbuilder.h"
+
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// CONSTRUCTION
+T_Utils* T_Utils::NewL()
+    {
+    T_Utils* self = new( ELeave ) T_Utils;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+
+    return self;
+    }
+
+
+T_Utils::~T_Utils()
+    {
+    }
+
+
+void T_Utils::ConstructL()
+    {
+    CEUnitTestSuiteClass::ConstructL();
+    }
+
+
+T_Utils::T_Utils()
+    {
+    }
+
+// ===========================================================================
+// TEST CASE SETUP & TEARDOWN METHODS
+// ===========================================================================
+//
+
+void T_Utils::Setup_L()
+    {
+    }
+
+void T_Utils::Teardown()
+    {
+    }
+
+// ===========================================================================
+// TEST CASE
+// ===========================================================================
+void T_Utils::T_FileToolTest_L()
+    {
+    // TODO add more brains to the test
+    EUNIT_PRINT( _L("FileTool test.") );
+
+    /*
+    CXIMPTestFileTool* tool = CXIMPTestFileTool::NewL();
+    CleanupStack::PushL( tool );
+    tool->CleanL( 0 );
+    tool->PrepareL( 0 );
+    TInt files = tool->NumObjectsL( 0 );
+
+    EUNIT_ASSERT_DESC( files == 0, "Non-zero count of files, Clean or Prepare did not work" );
+
+    // make a proper object and store it.
+    MPresenceInfo::TPresenceInfoStatus status;
+    status = MPresenceInfo::EDataSubscriptionPending;
+    COwnPresenceEventImp* event = COwnPresenceEventImp::NewLC( status );
+
+    CBufFlat* buf = CBufFlat::NewL( 50 );
+    CleanupStack::PushL( buf );
+    TInt32 eventType = 0;
+    XIMPEventCodec::PackL( *event, eventType, buf );
+    HBufC8* extObj = buf->Ptr( 0 ).AllocLC();
+
+    // create more objects
+    tool->StoreL( 0, *extObj );
+    tool->StoreL( 0, *extObj );
+    tool->StoreL( 0, *extObj );
+    tool->StoreL( 0, *extObj );
+    tool->StoreL( 0, *extObj );
+
+    files = tool->NumObjectsL( 0 );
+    EUNIT_ASSERT_DESC( files == 5, "Bad count of files" );
+
+    COwnPresenceEventImp* object = static_cast<COwnPresenceEventImp*>( tool->RestoreLC( 0, 2 ) );
+    EUNIT_ASSERT_DESC( status == object->Status(), "Wrong status from restored object." );
+
+    CleanupStack::PopAndDestroy( 4, event ); // object, extObj, buf, event
+
+    CleanupStack::PopAndDestroy( tool );
+    */
+    }
+
+// ===========================================================================
+// TEST CASE
+// ===========================================================================
+void T_Utils::T_KillServers_L()
+    {
+    EUNIT_PRINT( _L("Utility to kill the servers. Always succeeds.") );
+
+    PrfwTestRobustness::DoPreCleaning();
+    }
+
+_LIT8( KTestObjectName,    "John Doe" );     // regular
+_LIT8( KTestObjectName2,   "Jane Doe" );     // regular
+_LIT8( KTestObjectNameWC,  "Jo* Doe" );      // wildcards
+_LIT8( KTestObjectNameWC2, "Ja* Doe" );      // wildcards
+
+_LIT( KIdentity1, "Identity 1" );
+_LIT( KIdentity2, "Identity 2" );
+
+// ===========================================================================
+// TEST CASE
+// ===========================================================================
+void T_Utils::T_ObjectCollection_Unnamed_L()
+    {
+    EUNIT_PRINT( _L("Object collection unnamed tests.") );
+
+    CXIMPObjectFactoryImp* factory = CXIMPObjectFactoryImp::NewL();
+    CleanupStack::PushL( factory );
+
+    MXIMPObjectCollection* collection = factory->NewObjectCollectionLC();
+
+    // LookupByType should not find anything
+    const MXIMPBase* obj = NULL;
+    collection->LookupByType( obj, MXIMPIdentity::KInterfaceId );
+    EUNIT_ASSERT_DESC( obj == NULL, "LookupByType found an object" );
+
+    // LookupByTypeAndName should not find anything
+    collection->LookupByTypeAndName( obj, MXIMPIdentity::KInterfaceId, KTestObjectName );
+    EUNIT_ASSERT_DESC( obj == NULL, "LookupByTypeAndName found an object" );
+
+    collection->LookupByTypeAndName( obj, MXIMPIdentity::KInterfaceId, KTestObjectNameWC );
+    EUNIT_ASSERT_DESC( obj == NULL, "LookupByTypeAndName with wildcard found an object" );
+
+    // add some
+    MXIMPIdentity* identity2 = factory->NewIdentityLC();
+    identity2->SetIdentityL( KIdentity2 );
+
+    MXIMPStatus* status = factory->NewStatusLC();
+    status->SetResultCode( KErrArgument );
+
+    MXIMPIdentity* identity1 = factory->NewIdentityLC();
+    identity1->SetIdentityL( KIdentity1 );
+
+    collection->AddObjectL( identity1 );
+    CleanupStack::Pop(); // identity1
+
+    collection->AddObjectL( status );
+    CleanupStack::Pop(); // status
+
+    collection->AddObjectL( identity2 );
+    CleanupStack::Pop(); // identity2
+
+    // get and verify the status
+    MXIMPBase* getObj = NULL;
+    collection->GetByType( getObj, MXIMPStatus::KInterfaceId );
+    EUNIT_ASSERT_DESC( getObj != NULL, "LookupByType did not find an object" );
+
+    MXIMPStatus* gotStatus = ( MXIMPStatus* ) getObj->GetInterface( MXIMPStatus::KInterfaceId, MXIMPBase::EPanicIfUnknown );
+    CleanupDeletePushL( gotStatus );
+    EUNIT_ASSERT_DESC( gotStatus->ResultCode() == KErrArgument, "Status got corrupted" );
+    CleanupStack::PopAndDestroy(); // gotStatus
+
+    // check that status can't be found anymore
+    obj = NULL;
+    collection->LookupByType( obj, MXIMPStatus::KInterfaceId );
+    EUNIT_ASSERT_DESC( obj == NULL, "LookupByType found an object" );
+
+    collection->LookupByTypeAndName( obj, MXIMPStatus::KInterfaceId, KTestObjectName );
+    EUNIT_ASSERT_DESC( obj == NULL, "LookupByTypeAndName found an object" );
+
+    collection->LookupByTypeAndName( obj, MXIMPStatus::KInterfaceId, KTestObjectNameWC );
+    EUNIT_ASSERT_DESC( obj == NULL, "LookupByTypeAndName with wildcard found an object" );
+
+    // get and verify the two identities
+    // first identity
+    getObj = NULL;
+    collection->GetByType( getObj, MXIMPIdentity::KInterfaceId );
+    EUNIT_ASSERT_DESC( getObj != NULL, "LookupByType did not find an object" );
+
+    MXIMPIdentity* gotIdentity = ( MXIMPIdentity* ) getObj->GetInterface( MXIMPIdentity::KInterfaceId, MXIMPBase::EPanicIfUnknown );
+    CleanupDeletePushL( gotIdentity );
+    EUNIT_ASSERT_DESC( 0 == gotIdentity->Identity().Compare( KIdentity1 ), "Wrong identity object found" );
+    CleanupStack::PopAndDestroy(); // gotIdentity
+
+    // second identity
+    getObj = NULL;
+    collection->GetByType( getObj, MXIMPIdentity::KInterfaceId );
+    EUNIT_ASSERT_DESC( getObj != NULL, "LookupByType did not find an object" );
+
+    gotIdentity = ( MXIMPIdentity* ) getObj->GetInterface( MXIMPIdentity::KInterfaceId, MXIMPBase::EPanicIfUnknown );
+    CleanupDeletePushL( gotIdentity );
+    EUNIT_ASSERT_DESC( 0 == gotIdentity->Identity().Compare( KIdentity2 ), "Wrong identity object found" );
+    CleanupStack::PopAndDestroy(); // gotIdentity
+
+    // now there should not be anything anymore
+    obj = NULL;
+    collection->LookupByType( obj, MXIMPIdentity::KInterfaceId );
+    EUNIT_ASSERT_DESC( obj == NULL, "LookupByType found an object" );
+
+    CleanupStack::PopAndDestroy(); // collection
+    CleanupStack::PopAndDestroy( factory );
+    }
+
+// ===========================================================================
+// TEST CASE
+// ===========================================================================
+void T_Utils::T_ObjectCollection_Named_L()
+    {
+    EUNIT_PRINT( _L("Object collection named tests.") );
+
+    CXIMPObjectFactoryImp* factory = CXIMPObjectFactoryImp::NewL();
+    CleanupStack::PushL( factory );
+
+    MXIMPObjectCollection* collection = factory->NewObjectCollectionLC();
+
+    // LookupByType should not find anything
+    const MXIMPBase* obj = NULL;
+    collection->LookupByType( obj, MXIMPIdentity::KInterfaceId );
+    EUNIT_ASSERT_DESC( obj == NULL, "LookupByType found an object" );
+
+    // LookupByTypeAndName should not find anything
+    collection->LookupByTypeAndName( obj, MXIMPIdentity::KInterfaceId, KTestObjectName );
+    EUNIT_ASSERT_DESC( obj == NULL, "LookupByTypeAndName found an object" );
+
+    collection->LookupByTypeAndName( obj, MXIMPIdentity::KInterfaceId, KTestObjectNameWC );
+    EUNIT_ASSERT_DESC( obj == NULL, "LookupByTypeAndName with wildcard found an object" );
+
+    // add some
+    MXIMPIdentity* identity2 = factory->NewIdentityLC();
+    identity2->SetIdentityL( KIdentity2 );
+    
+    MXIMPStatus* status = factory->NewStatusLC();
+    status->SetResultCode( KErrArgument );
+
+    MXIMPIdentity* identity1 = factory->NewIdentityLC();
+    identity1->SetIdentityL( KIdentity1 );
+    
+    collection->AddObjectWithNameL( identity1, KTestObjectName );
+    CleanupStack::Pop(); // identity1
+
+    TRAPD( err, collection->AddObjectWithNameL( status, KTestObjectNameWC ) );
+    EUNIT_ASSERT_DESC( err == KErrBadName, "Did not leave when given wildcards" );
+    CleanupStack::PopAndDestroy(); // status
+
+    collection->AddObjectWithNameL( identity2, KTestObjectName2 );
+    CleanupStack::Pop(); // identity2
+
+    // should not find the status object
+    MXIMPBase* getObj = NULL;
+    collection->GetByType( getObj, MXIMPStatus::KInterfaceId );
+    EUNIT_ASSERT_DESC( getObj == NULL, "LookupByType found wrong object" );
+
+    // get and verify the two identities
+    // first identity
+    getObj = NULL;
+    collection->GetByTypeAndName( getObj, MXIMPIdentity::KInterfaceId, KTestObjectName );
+    EUNIT_ASSERT_DESC( getObj != NULL, "LookupByType did not find an object" );
+
+    MXIMPIdentity* gotIdentity = ( MXIMPIdentity* ) getObj->GetInterface( MXIMPIdentity::KInterfaceId, MXIMPBase::EPanicIfUnknown );
+    CleanupDeletePushL( gotIdentity );
+    EUNIT_ASSERT_DESC( 0 == gotIdentity->Identity().Compare( KIdentity1 ), "Wrong identity object found" );
+    CleanupStack::PopAndDestroy(); // gotIdentity
+
+    // second identity
+    getObj = NULL;
+    collection->GetByTypeAndName( getObj, MXIMPIdentity::KInterfaceId, KTestObjectNameWC2 );
+    EUNIT_ASSERT_DESC( getObj != NULL, "LookupByType did not find an object" );
+
+    gotIdentity = ( MXIMPIdentity* ) getObj->GetInterface( MXIMPIdentity::KInterfaceId, MXIMPBase::EPanicIfUnknown );
+    CleanupDeletePushL( gotIdentity );
+    EUNIT_ASSERT_DESC( 0 == gotIdentity->Identity().Compare( KIdentity2 ), "Wrong identity object found" );
+    CleanupStack::PopAndDestroy(); // gotIdentity
+
+    // now there should not be anything anymore
+    obj = NULL;
+    collection->LookupByType( obj, MXIMPIdentity::KInterfaceId );
+    EUNIT_ASSERT_DESC( obj == NULL, "LookupByType found an object" );
+
+    CleanupStack::PopAndDestroy(); // collection
+    CleanupStack::PopAndDestroy( factory );
+    }
+
+// ===========================================================================
+// TEST CASE
+// ===========================================================================
+void T_Utils::T_RestrictedObjectCollection_L()
+    {
+    EUNIT_PRINT( _L("Restricted object collection tests.") );
+
+    CXIMPObjectFactoryImp* factory = CXIMPObjectFactoryImp::NewL();
+    CleanupStack::PushL( factory );
+
+    MXIMPRestrictedObjectCollection* resColl = factory->NewRestrictedObjectCollectionLC();
+
+    // LookupByType should not find anything, empty collection
+    const MXIMPBase* obj = NULL;
+    resColl->LookupByType( obj, MXIMPIdentity::KInterfaceId );
+    EUNIT_ASSERT_DESC( obj == NULL, "LookupByType found an object" );
+
+    // add some
+    MXIMPIdentity* identity2 = factory->NewIdentityLC();
+    identity2->SetIdentityL( KIdentity2 );
+    
+    MXIMPStatus* status = factory->NewStatusLC();
+    status->SetResultCode( KErrArgument );
+
+    MXIMPIdentity* identity1 = factory->NewIdentityLC();
+    identity1->SetIdentityL( KIdentity1 );
+    
+    resColl->AddOrReplaceTypeL( identity1 );
+    CleanupStack::Pop(); // identity1
+
+    resColl->AddOrReplaceTypeL( status );
+    CleanupStack::Pop(); // identity1
+
+    resColl->AddOrReplaceTypeL( identity2 );
+    CleanupStack::Pop(); // identity2
+
+    // there should only be {identity2, status} in the collection
+    obj = NULL;
+    resColl->LookupByType( obj, MXIMPIdentity::KInterfaceId );
+    EUNIT_ASSERT_DESC( obj != NULL, "LookupByType did not find an object" );
+
+    obj = NULL;
+    resColl->LookupByType( obj, MXIMPStatus::KInterfaceId );
+    EUNIT_ASSERT_DESC( obj != NULL, "LookupByType did not find an object" );
+
+    // get the objects and verify their contents
+    
+    // 1. identity
+    MXIMPBase* getObj = NULL;
+    resColl->GetByType( getObj, MXIMPIdentity::KInterfaceId );
+    EUNIT_ASSERT_DESC( getObj != NULL, "LookupByType did not find an object" );
+
+    MXIMPIdentity* gotIdentity = ( MXIMPIdentity* ) getObj->GetInterface( MXIMPIdentity::KInterfaceId, MXIMPBase::EPanicIfUnknown );
+    CleanupDeletePushL( gotIdentity );
+    EUNIT_ASSERT_DESC( 0 == gotIdentity->Identity().Compare( KIdentity2 ), "Second identity object did not replace the first one" );
+    CleanupStack::PopAndDestroy(); // gotIdentity
+
+    // 2. status
+    getObj = NULL;
+    resColl->GetByType( getObj, MXIMPStatus::KInterfaceId );
+    EUNIT_ASSERT_DESC( getObj != NULL, "LookupByType did not find an object" );
+
+    MXIMPStatus* gotStatus = ( MXIMPStatus* ) getObj->GetInterface( MXIMPStatus::KInterfaceId, MXIMPBase::EPanicIfUnknown );
+    CleanupDeletePushL( gotStatus );
+    EUNIT_ASSERT_DESC( KErrArgument == gotStatus->ResultCode(), "Status object was corrupted" );
+    CleanupStack::PopAndDestroy(); // gotStatus
+
+    // now there should not be anything anymore
+    obj = NULL;
+    resColl->LookupByType( obj, MXIMPIdentity::KInterfaceId );
+    EUNIT_ASSERT_DESC( obj == NULL, "LookupByType found an identity object although it was removed" );
+    
+    obj = NULL;
+    resColl->LookupByType( obj, MXIMPStatus::KInterfaceId );
+    EUNIT_ASSERT_DESC( obj == NULL, "LookupByType found a status object although it was removed" );
+
+    CleanupStack::PopAndDestroy(); // collection
+    CleanupStack::PopAndDestroy( factory );
+    }
+
+void T_Utils::T_DataSubscriptionState_L()
+    {
+    EUNIT_PRINT( _L("Data subscription state tests.") );
+
+    CXIMPObjectFactoryImp* factory = CXIMPObjectFactoryImp::NewL();
+    CleanupStack::PushL( factory );
+
+    MXIMPDataSubscriptionState* dataState = factory->NewDataSubscriptionStateLC();
+
+    EUNIT_ASSERT_DESC( dataState->DataState() == MXIMPDataSubscriptionState::EDataUnavailable, 
+                      "Data was available." );
+    EUNIT_ASSERT_DESC( dataState->SubscriptionState() == MXIMPDataSubscriptionState::ESubscriptionInactive, 
+                      "Subscription was active." );
+    
+    dataState->SetDataStateL( MXIMPDataSubscriptionState::EDataAvailable );
+    dataState->SetSubscriptionStateL( MXIMPDataSubscriptionState::ESubscriptionActive );
+
+    EUNIT_ASSERT_DESC( dataState->DataState() == MXIMPDataSubscriptionState::EDataAvailable, 
+                      "Data was unavailable." );
+    EUNIT_ASSERT_DESC( dataState->SubscriptionState() == MXIMPDataSubscriptionState::ESubscriptionActive, 
+                      "Subscription was inactive." );
+
+    CleanupStack::PopAndDestroy(); // collection
+    CleanupStack::PopAndDestroy( factory );
+    }
+
+
+
+void T_Utils::T_TXIMPRequestIdBuilder_Test_L()
+    {
+    EUNIT_PRINT( _L("TXIMPRequestIdbuilder test.") );
+    
+    TXIMPRequestIdBuilder builder;
+    builder.SetProtocolId( 1 );
+    builder.SetSessionId( 1 );
+    builder.SetRequestId( 1 );    
+
+    TXIMPRequestId id1 = builder.BuildRequestId();
+    EUNIT_ASSERT( id1 == id1 );
+    EUNIT_ASSERT( id1 != TXIMPRequestId::Null() );
+
+
+        {
+        builder.SetProtocolId( 2 );   
+        TXIMPRequestId id2 = builder.BuildRequestId();
+        EUNIT_ASSERT( id2 == id2 );
+        EUNIT_ASSERT( id1 != id2 );
+        EUNIT_ASSERT( id2 != id1 );
+        EUNIT_ASSERT( id2 != TXIMPRequestId::Null() );        
+        }
+
+        {
+        builder.SetSessionId( 2 );   
+        TXIMPRequestId id3 = builder.BuildRequestId();
+        EUNIT_ASSERT( id3 == id3 );
+        EUNIT_ASSERT( id1 != id3 );
+        EUNIT_ASSERT( id3 != id1 );
+        EUNIT_ASSERT( id3 != TXIMPRequestId::Null() );        
+        }
+
+
+        {
+        builder.SetRequestId( 2 );   
+        TXIMPRequestId id4 = builder.BuildRequestId();
+        EUNIT_ASSERT( id4 == id4 );
+        EUNIT_ASSERT( id1 != id4 );
+        EUNIT_ASSERT( id4 != id1 );
+        EUNIT_ASSERT( id4 != TXIMPRequestId::Null() );                
+        }
+        
+        
+        {
+        builder.SetProtocolId( 33333333 );
+        builder.SetSessionId( 44444444 );
+        builder.SetRequestId( 55555555 );    
+
+        TXIMPRequestId id5 = builder.BuildRequestId();
+        EUNIT_ASSERT( id5 == id5 );
+        EUNIT_ASSERT( id1 != id5 );
+        EUNIT_ASSERT( id5 != id1 );
+        EUNIT_ASSERT( id5 != TXIMPRequestId::Null() );                
+        }
+    }
+
+
+void T_Utils::T_TXIMPRequestId_Test_L()
+    {
+    EUNIT_PRINT( _L("TXIMPRequestIdbuilder test.") );
+    
+    TXIMPRequestId id0 = TXIMPRequestId::Null();
+    EUNIT_ASSERT( id0 == TXIMPRequestId::Null() );  
+    
+        {
+        TXIMPRequestId id1 = TXIMPRequestId::Init( 1 ); 
+        EUNIT_ASSERT( id1 != TXIMPRequestId::Null() ); 
+        }
+
+
+        {
+        TXIMPRequestId id2 = TXIMPRequestId::Init( 2);     
+        EUNIT_ASSERT( id0 != id2 );             
+        }
+
+    
+        {
+        TXIMPRequestId id3 = TXIMPRequestId::Init( KMaxTInt );     
+        EUNIT_ASSERT( id0 != id3 );             
+        }
+
+
+        {
+        TXIMPRequestId id4 = TXIMPRequestId::Init( 33333333 );     
+        EUNIT_ASSERT( id0 != id4 );             
+        }
+        
+        {
+        TXIMPRequestId id5 = TXIMPRequestId::Init( KMaxTInt );     
+        TXIMPRequestId id6 = TXIMPRequestId::Init( KMinTInt );     
+        EUNIT_ASSERT( id0 != id5 );             
+        EUNIT_ASSERT( id0 != id6 );             
+        EUNIT_ASSERT( id5 != id6 );             
+        }
+        
+    }
+
+
+
+
+// ===========================================================================
+// TEST CASE TABLE
+// ===========================================================================
+//
+EUNIT_BEGIN_TEST_TABLE(
+        T_Utils,
+        "XIMP test utils tests",
+        "MODULE" )
+
+ PRFW_NOT_DECORATED_TEST(
+        "Kill servers",
+        "",
+        "",
+        "FUNCTIONALITY",
+        Setup_L,
+        T_KillServers_L,
+        Teardown )
+
+PRFW_NOT_DECORATED_TEST(
+        "Object collection without names",
+        "",
+        "",
+        "FUNCTIONALITY",
+        Setup_L,
+        T_ObjectCollection_Unnamed_L,
+        Teardown )
+
+PRFW_NOT_DECORATED_TEST(
+        "Object collection using names",
+        "",
+        "",
+        "FUNCTIONALITY",
+        Setup_L,
+        T_ObjectCollection_Named_L,
+        Teardown )
+
+PRFW_NOT_DECORATED_TEST(
+        "Restricted object collection",
+        "",
+        "",
+        "FUNCTIONALITY",
+        Setup_L,
+        T_RestrictedObjectCollection_L,
+        Teardown )
+
+PRFW_NOT_DECORATED_TEST(
+        "Data subscription state",
+        "",
+        "",
+        "FUNCTIONALITY",
+        Setup_L,
+        T_DataSubscriptionState_L,
+        Teardown )
+
+
+PRFW_NOT_DECORATED_TEST(
+        "TXIMPRequestIdBuilder test",
+        "",
+        "",
+        "FUNCTIONALITY",
+        Setup_L,
+        T_TXIMPRequestIdBuilder_Test_L,
+        Teardown )
+
+
+PRFW_NOT_DECORATED_TEST(
+        "TXIMPRequestId test",
+        "",
+        "",
+        "FUNCTIONALITY",
+        Setup_L,
+        T_TXIMPRequestId_Test_L,
+        Teardown )
+
+
+/* PRFW_NOT_DECORATED_TEST(
+        "FileTool test",
+        "",
+        "",
+        "FUNCTIONALITY",
+        Setup_L,
+        T_FileToolTest_L,
+        Teardown ) */
+
+
+EUNIT_END_TEST_TABLE
+
+
+// ===========================================================================
+// TEST SUITE CONSTRUCTION
+// ===========================================================================
+//
+EXPORT_C MEUnitTest* CreateTestSuiteL()
+    {
+    return T_Utils::NewL();
+    }
+
+
+// end of file
+
+
+
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/tsrc/src/t_utils/t_utils.h	Wed Nov 03 09:32:20 2010 +0530
@@ -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: XIMP Framework Test Code 
+*
+*/
+
+#ifndef T_UTILS_H__
+#define T_UTILS_H__
+
+
+//  EXTERNAL INCLUDES
+#include <platform/digia/eunit/ceunittestsuiteclass.h>
+#include <platform/digia/eunit/EUnitDecorators.h>
+
+
+#include <ximpbase.h>
+
+#include "prfwteststatuseventlistener.h"
+#include "prfwwaitobserver.h"
+
+class CXIMPTestContextWrapperMgr;
+
+/**
+ * XIMP Framework Eunit tests.
+ *
+ * Tests for XIMP session management services.
+ *
+ * @since S60 v4.0
+ */
+class T_Utils : public CEUnitTestSuiteClass
+    {
+
+public:
+    static T_Utils* NewL();
+    virtual ~T_Utils();
+
+private:
+    T_Utils();
+    void ConstructL();
+
+private:    // Test case functions
+
+    void Setup_L();
+    void Teardown();
+
+    void T_FileToolTest_L();
+
+    void T_KillServers_L();
+    
+    void T_ObjectCollection_Unnamed_L();
+    void T_ObjectCollection_Named_L();
+    void T_RestrictedObjectCollection_L();
+    void T_DataSubscriptionState_L();
+    
+    void T_TXIMPRequestIdBuilder_Test_L();
+    void T_TXIMPRequestId_Test_L();
+
+private:    // Test helpers
+
+private: // Test data
+
+    /**
+     * Eunit test case table declaration.
+     */
+    EUNIT_DECLARE_TEST_TABLE;
+    };
+
+#endif      //  T_UTILS_H__
+
+// end of file
+
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/tsrc/src/t_utils/t_utils.mmp	Wed Nov 03 09:32:20 2010 +0530
@@ -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: XIMP Framework Test Code 
+*
+*/
+
+#include            "../../tsrcutils/eunitcommon/eunittstdllbase.hrh"
+#include            "../../tsrcutils/processmaster/pm.h"
+
+#include<platform_paths.hrh>
+#include<eunitcaps.h>
+TARGET              t_utils.dll
+CAPABILITY      EUNIT_CAPS
+
+SOURCEPATH          .
+SOURCE              t_utils.cpp
+
+
+
+USERINCLUDE             ../../../core/srcdatamodel
+USERINCLUDE             ../../../presence/srcpresencedatamodel
+USERINCLUDE             ../../../presence/srcpresencedatamodel/presentitygroups
+USERINCLUDE             ../../../presence/srcpresencedatamodel/presencewatching
+USERINCLUDE             ../../../presence/srcpresencedatamodel/presenceauthorization
+USERINCLUDE             ../../../presence/srcpresencedatamodel/presencepublishing
+USERINCLUDE             ../../../presence/srcpresencedatamodel/presenceinfo
+USERINCLUDE             ../../../core/srcutils
+
+// TODO remove unnecessary
+
+#if defined ( OS_LAYER_SYSTEMINCLUDE )
+OS_LAYER_SYSTEMINCLUDE
+#else
+SYSTEMINCLUDE     /epoc32/include
+#endif
+
+ #if defined ( APP_LAYER_SYSTEMINCLUDE )
+ APP_LAYER_SYSTEMINCLUDE
+ #else
+ SYSTEMINCLUDE     \epoc32\include
+ #endif
+
+SYSTEMINCLUDE           ../../../inc/core/base
+SYSTEMINCLUDE           ../../../inc/core/datamodel
+SYSTEMINCLUDE           ../../../inc/core/protocolplugin
+SYSTEMINCLUDE           ../../../inc/core/protocolpluginhost
+SYSTEMINCLUDE           ../../../inc/presence/presencedatamodel
+SYSTEMINCLUDE           ../../../inc/presence/presencemanagement
+SYSTEMINCLUDE           ../../../inc/presence/presenceprotocolplugin
+SYSTEMINCLUDE           ../../../inc/presence/presenceprotocolpluginhost
+
+
+LIBRARY             ecom.lib
+LIBRARY             bafl.lib
+LIBRARY             ximpdatamodel.lib
+LIBRARY             presencedatamodel.lib
+LIBRARY             estor.lib
+LIBRARY             ximputils.lib
+LIBRARY             eunit.lib
+LIBRARY             eunitutil.lib
+LIBRARY             euser.lib
+
+// end of file
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/tsrc/tsrcprotocols/bld.inf	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,26 @@
+/*
+* 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 PrFw test protocols
+ *
+*/
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_TESTMMPFILES
+
+pr_prfwtestprotocol/pr_prfwtestprotocol.mmp
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/tsrc/tsrcprotocols/pr_prfwtestprotocol/bld.inf	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,29 @@
+/*
+* 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 Presence Framework
+*
+*/
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+PRJ_TESTMMPFILES
+pr_prfwtestprotocol.mmp
+
+
+
+PRJ_TESTEXPORTS
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/tsrc/tsrcprotocols/pr_prfwtestprotocol/pr_prfwtestprotocol.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,1519 @@
+/*
+* 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:  Test Protocol implementation for XIMP Framework
+ *
+*/
+
+
+#include <badesca.h>
+#include <ecom/implementationproxy.h>
+
+#include <ximpstatus.h>
+#include <ximpserviceinfo.h>
+#include <ximpcontextclientinfo.h>
+
+#include <ximpprotocolconnectionhost.h>
+#include <protocolpresencepublishingdatahost.h>
+#include <protocolpresencefeatures.h>
+#include <ximprestrictedobjectcollection.h>
+#include <ximpidentity.h>
+#include <presentitygroupinfo.h>
+#include <presentitygroupmemberinfo.h>
+#include <ximpobjectfactory.h>
+#include <ximpprotocolrequestcompleteevent.h>
+#include <presencefeatures.h>
+#include <presenceobjectfactory.h>
+#include <protocolpresencedatahost.h>
+
+
+#include "pr_prfwtestprotocol.h"
+#include "prfwgeneralwaiter.h"
+#include "prfwtestmessaging.h"
+#include "prfwtestmessenger.h"
+#include "prfwtestfilelogichelper.h"
+#include "prfwtestfiletool.h"
+#include "ximprequestidbuilder.h"
+#include "prfwtestprotocols.h"
+
+
+
+const TInt KWaitTime = 1;
+
+T_XIMPTestConnection::ClientWrapper* T_XIMPTestConnection::ClientWrapper::NewLC( const TDesC& aClientId )
+    {
+    ClientWrapper* self = new ( ELeave ) ClientWrapper;
+    CleanupStack::PushL( self );
+    self->ConstructL( aClientId );
+    return self;
+    }
+
+void T_XIMPTestConnection::ClientWrapper::ConstructL( const TDesC& aClientId )
+    {
+    iId.CreateL( aClientId );
+    }
+
+void T_XIMPTestConnection::ClientWrapper::InitializeL( MXIMPProtocolConnectionHost& aConnectionHost )
+    {
+    if( !iMessenger )
+        {
+        TLex lex( iId );
+        TInt index = 0;
+        User::LeaveIfError( lex.Val( index ) );
+        // TEST CODE
+        __ASSERT_ALWAYS( index != -1, User::Panic(_L("Protocol"), 666));
+        iMessenger = CXIMPTestMessenger::NewForAdaptationSideL( index );
+        iPluginIndex = index;
+        }
+
+    if( !iFileLogicHelper )
+        {
+        iFileLogicHelper = CXIMPTestFileLogicHelper::NewL( aConnectionHost, *iMessenger );
+        }
+
+    if( !iFileTool )
+        {
+        // TODO FIX FILETOOL CREATION
+        iFileTool = CXIMPTestFileTool::NewL( K_PRFW_TST_PROTOCOL_1_IMPLEMENTATION_UID, iId );
+        iFileTool->RegisterObserverL( iFileLogicHelper );
+        }
+    }
+
+T_XIMPTestConnection::ClientWrapper::~ClientWrapper()
+    {
+    if( iFileTool && iFileLogicHelper )
+        {
+        iFileTool->UnregisterObserver( iFileLogicHelper );
+        }
+    delete iFileTool;
+    delete iFileLogicHelper;
+    delete iMessenger;
+
+    iId.Close();
+    }
+
+// ---------------------------------------------------------------------------
+// OrderOfClients()
+// ---------------------------------------------------------------------------
+//
+TInt T_XIMPTestConnection::OrderOfClients( const T_XIMPTestConnection::ClientWrapper& aFirst,
+                                           const T_XIMPTestConnection::ClientWrapper& aSecond )
+    {
+    return aFirst.iId.Compare( aSecond.iId );
+    }
+
+// ======== MEMBER FUNCTIONS ========
+
+
+// ---------------------------------------------------------------------------
+// OrderOfConnections()
+// ---------------------------------------------------------------------------
+//
+TInt T_XIMPTestConnection::OrderOfConnections( const T_XIMPTestConnection& aFirst,
+                                               const T_XIMPTestConnection& aSecond )
+    {
+    TInt retVal = aFirst.iServerAddress->Compare( *aSecond.iServerAddress );
+    if( retVal != 0 )
+        {
+        return retVal;
+        }
+    retVal = aFirst.iUserName->Compare( *aSecond.iUserName );
+    if( retVal != 0 )
+        {
+        return retVal;
+        }
+
+    return aFirst.iPassword->Compare( *aSecond.iPassword );
+    }
+
+
+// ---------------------------------------------------------------------------
+// T_XIMPTestConnection::T_XIMPTestConnection()
+// ---------------------------------------------------------------------------
+//
+T_XIMPTestConnection::T_XIMPTestConnection()
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// T_XIMPTestConnection::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void T_XIMPTestConnection::ConstructL( const MXIMPServiceInfo& aServiceInfo,
+                                       const MXIMPContextClientInfo& aClientCtxInfo )
+    {
+    iWaitter = CXIMPTestGeneralWaiter::NewL( this );
+
+    iAuxTimer = CPeriodic::NewL( CActive::EPriorityIdle );
+
+    iServerAddress = aServiceInfo.ServiceAddress().AllocL();
+    iUserName = aServiceInfo.UserId().AllocL();
+    iPassword = aServiceInfo.Password().AllocL();
+    iClientId = aClientCtxInfo.ClientId().Identity().AllocL();
+    }
+
+
+// ---------------------------------------------------------------------------
+// T_XIMPTestConnection::NewLC()
+// ---------------------------------------------------------------------------
+//
+T_XIMPTestConnection* T_XIMPTestConnection::NewLC( const MXIMPServiceInfo& aServiceInfo,
+                                                   const MXIMPContextClientInfo& aClientCtxInfo )
+    {
+    T_XIMPTestConnection* self = new( ELeave ) T_XIMPTestConnection(  );
+    CleanupStack::PushL( self );
+    self->ConstructL( aServiceInfo, aClientCtxInfo );
+    return self;
+    }
+
+
+// ---------------------------------------------------------------------------
+// T_XIMPTestConnection::NewL()
+// ---------------------------------------------------------------------------
+//
+T_XIMPTestConnection* T_XIMPTestConnection::NewL( const MXIMPServiceInfo& aServiceInfo,
+                                                  const MXIMPContextClientInfo& aClientCtxInfo )
+    {
+    T_XIMPTestConnection* self = T_XIMPTestConnection::NewLC( aServiceInfo, aClientCtxInfo );
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// T_XIMPTestConnection::~T_XIMPTestConnection()
+// ---------------------------------------------------------------------------
+//
+T_XIMPTestConnection::~T_XIMPTestConnection()
+    {
+    SetBoolean( EXIMPPlgTestDeath );
+
+    if ( iAuxTimer )
+        {
+        iAuxTimer->Deque();
+        }
+    delete iAuxTimer;
+
+    delete iWaitter;
+
+    iClients.ResetAndDestroy();
+
+    delete iServerAddress;
+    delete iUserName;
+    delete iPassword;
+    delete iClientId;
+
+    delete iClientToBeDeleted;
+    }
+
+
+// ---------------------------------------------------------------------------
+// T_XIMPTestConnection::PrimeHost()
+// ---------------------------------------------------------------------------
+//
+void T_XIMPTestConnection::PrimeHost( MXIMPProtocolConnectionHost& aHost )
+    {
+    iConnectionHost = &aHost;
+    }
+
+// ---------------------------------------------------------------------------
+// T_XIMPTestConnection::PresenceFeatures()
+// ---------------------------------------------------------------------------
+//
+MProtocolPresenceFeatures& T_XIMPTestConnection::ProtocolPresenceFeatures()
+    {
+    return *this;
+    }
+
+
+// ---------------------------------------------------------------------------
+// T_XIMPTestConnection::PresenceFeatures()
+// ---------------------------------------------------------------------------
+//	MProtocolImFeatures* ProtocolImFeatures();
+//MProtocolImFeatures* T_XIMPTestConnection::ProtocolImFeatures()
+//    {
+//    return NULL;
+//    }
+// ---------------------------------------------------------------------------
+// T_XIMPTestConnection::GetProtocolInterface()
+// ---------------------------------------------------------------------------
+TAny* T_XIMPTestConnection::GetProtocolInterface(TInt aInterfaceId)
+	{
+	return NULL ;
+	}
+    
+    
+    
+// ---------------------------------------------------------------------------
+// T_XIMPTestConnection::PresenceWatching()
+// ---------------------------------------------------------------------------
+//
+MProtocolPresenceWatching& T_XIMPTestConnection::PresenceWatching()
+    {
+    return *this;
+    }
+// ---------------------------------------------------------------------------
+// T_XIMPTestConnection::PresencePublishing()
+// ---------------------------------------------------------------------------
+//
+MProtocolPresencePublishing& T_XIMPTestConnection::PresencePublishing()
+    {
+    return *this;
+    }
+// ---------------------------------------------------------------------------
+// T_XIMPTestConnection::PresentityGroups()
+// ---------------------------------------------------------------------------
+//
+MProtocolPresentityGroups& T_XIMPTestConnection::PresentityGroups()
+    {
+    return *this;
+    }
+// ---------------------------------------------------------------------------
+// T_XIMPTestConnection::PresenceAuthorization()
+// ---------------------------------------------------------------------------
+//
+MProtocolPresenceAuthorization& T_XIMPTestConnection::PresenceAuthorization()
+    {
+    return *this;
+    }
+
+// ---------------------------------------------------------------------------
+// T_XIMPTestConnection::HandleProtocolConnectionHostEvent()
+// ---------------------------------------------------------------------------
+//
+void T_XIMPTestConnection::HandleProtocolConnectionHostEvent(
+    const MXIMPProtocolConnectionHost& aHost,
+    const MXIMPBase& aEvent )
+    {
+    if( &aHost != iConnectionHost )
+        {
+        User::Panic(_L("Protocol"), -42 );
+        }
+    
+    
+    if( aEvent.GetInterfaceId() == MXIMPProtocolRequestCompleteEvent::KInterfaceId )
+        {
+        const MXIMPProtocolRequestCompleteEvent* eventIf =
+        TXIMPGetInterface< const MXIMPProtocolRequestCompleteEvent >::From( aEvent,
+                                                                            MXIMPBase::EPanicIfUnknown );
+        RDebug::Print( _L("   T_XIMPTestConnection: received ProtocolRequestCompleteEvent with result [%d]"), 
+                       eventIf->ResultCode() );
+        }
+    }
+    
+    
+
+// ---------------------------------------------------------------------------
+// T_XIMPTestConnection::OpenSessionL()
+// ---------------------------------------------------------------------------
+//
+void T_XIMPTestConnection::OpenSessionL( const MXIMPContextClientInfo& aClientCtxInfo,
+                                       TXIMPRequestId aReqId )
+    {
+    iConnectionHost->RegisterObserverL( *this );
+
+    ClientWrapper* client = ClientWrapper::NewLC( aClientCtxInfo.ClientId().Identity() );
+
+    TLinearOrder< T_XIMPTestConnection::ClientWrapper > order( T_XIMPTestConnection::OrderOfClients );
+    TInt indexOfClient = iClients.FindInOrder( client, order );
+
+    if( indexOfClient != KErrNotFound )
+        {
+        User::LeaveIfError( indexOfClient );
+        CleanupStack::PopAndDestroy(); //id
+        client = iClients[ indexOfClient ];
+        }
+    else
+        {
+        client->InitializeL( *iConnectionHost );
+        iCurrentMessenger = client->iMessenger;
+        }
+
+    PluginAPIMethodCommonL( aReqId );
+
+    if( indexOfClient == KErrNotFound )
+        {
+        iClients.InsertInOrderL( client, order );
+        CleanupStack::Pop(); //id
+        }
+
+
+    SetBooleanToCurrent( EXIMPPlgTestOpenSessionCalled );
+    iWaitter->WaitForL( KWaitTime );
+    }
+
+// ---------------------------------------------------------------------------
+// T_XIMPTestConnection::OpenSessionL()
+// ---------------------------------------------------------------------------
+//
+void T_XIMPTestConnection::OpenSessionL(
+                const TInt& aSettingsId,
+                TXIMPRequestId aReqId )
+
+    {
+    iConnectionHost->RegisterObserverL( *this );
+
+    ClientWrapper* client = ClientWrapper::NewLC( _L("0") );
+
+    TLinearOrder< T_XIMPTestConnection::ClientWrapper > order( T_XIMPTestConnection::OrderOfClients );
+    TInt indexOfClient = iClients.FindInOrder( client, order );
+
+    if( indexOfClient != KErrNotFound )
+        {
+        User::LeaveIfError( indexOfClient );
+        CleanupStack::PopAndDestroy(); //id
+        client = iClients[ indexOfClient ];
+        }
+    else
+        {
+        client->InitializeL( *iConnectionHost );
+        iCurrentMessenger = client->iMessenger;
+        }
+
+    PluginAPIMethodCommonL( aReqId );
+
+    if( indexOfClient == KErrNotFound )
+        {
+        iClients.InsertInOrderL( client, order );
+        CleanupStack::Pop(); //id
+        }
+
+
+    SetBooleanToCurrent( EXIMPPlgTestOpenSessionCalled );
+    iWaitter->WaitForL( KWaitTime );
+    }
+        
+        
+
+// ---------------------------------------------------------------------------
+// T_XIMPTestConnection::CloseSession()
+// ---------------------------------------------------------------------------
+//
+void T_XIMPTestConnection::CloseSession( const MXIMPContextClientInfo& aClientCtxInfo,
+                                         TXIMPRequestId aReqId )
+    {
+    PluginAPIMethodCommonL( aReqId );
+
+    iClientToBeDeleted = NULL;
+    TInt count = iClients.Count();
+    TBool found(EFalse);
+    for( TInt a = 0; a < count && !iClientToBeDeleted; ++a )
+        {
+        if( aClientCtxInfo.ClientId().Identity().Compare( iClients[ a ]->iId ) == 0 )
+            {
+            iClientToBeDeleted = iClients[ a ];
+            iClients.Remove( a );
+            found = ETrue;
+            }
+        }
+
+    SetBooleanToCurrent( EXIMPPlgTestCloseSessionCalled );
+
+    if(found)
+    iWaitter->WaitForL( KWaitTime );
+    else
+    	{
+	    MXIMPStatus* status = iConnectionHost->ObjectFactory().NewStatusLC();
+	    CleanupStack::Pop(); // status.
+	    status->SetResultCode(KErrNone);
+    	iConnectionHost->HandleRequestCompleted( aReqId, status);    		
+    	}
+    	
+    
+    	
+    }
+
+
+// ---------------------------------------------------------------------------
+// T_XIMPTestConnection::GetSupportedFeaturesL()
+// ---------------------------------------------------------------------------
+//
+void T_XIMPTestConnection::GetSupportedFeaturesL( CDesC8Array& aFeatures ) const
+    {
+    if ( ! iClients.Count() )
+        {
+        User::LeaveIfError( KErrNotReady );
+        }
+
+    // first empty the whole array
+    aFeatures.Reset();
+
+    // then add two features there: 1 supported by XIMP, 1 not
+    aFeatures.AppendL( _L8("feat/pres/pub") );
+    aFeatures.AppendL( _L8("feat/worlddomination") );
+    }
+
+// ---------------------------------------------------------------------------
+// T_XIMPTestConnection::DoSubscribeOwnPresenceL
+// ---------------------------------------------------------------------------
+//
+void T_XIMPTestConnection::DoSubscribeOwnPresenceL( const MPresenceInfoFilter& aPif,
+        TXIMPRequestId aReqId )
+    {
+    PluginAPIMethodCommonL( aReqId );
+
+    SetBooleanToCurrent( EXIMPPlgTestSubscribeOwnPresenceCalled );
+
+    // TODO do something, like in PublishPresence
+
+    iWaitter->WaitForL( KWaitTime );
+    }
+
+// ---------------------------------------------------------------------------
+// T_XIMPTestConnection::DoUpdateOwnPresenceSubscriptionL
+// ---------------------------------------------------------------------------
+//
+void T_XIMPTestConnection::DoUpdateOwnPresenceSubscriptionPifL( const MPresenceInfoFilter& aPif,
+        TXIMPRequestId aReqId )
+    {
+    PluginAPIMethodCommonL( aReqId );
+
+    SetBooleanToCurrent( EXIMPPlgTestUpdateOwnSubscriptionCalled );
+
+    // TODO do something, like in PublishPresence
+
+    iWaitter->WaitForL( KWaitTime );
+    }
+
+
+// ---------------------------------------------------------------------------
+// From MPscPlugin class.
+// T_XIMPTestConnection::DoSubscribePresenceWatcherListL()
+// ---------------------------------------------------------------------------
+//
+void T_XIMPTestConnection::DoSubscribePresenceWatcherListL( TXIMPRequestId aReqId )
+    {
+    PluginAPIMethodCommonL( aReqId );
+
+    SetBooleanToCurrent( EXIMPPlgTestSubscribePresenceWatcherListCalled );
+
+    // TODO do something, like in PublishPresence
+
+    iWaitter->WaitForL( KWaitTime );
+    }
+
+// ---------------------------------------------------------------------------
+// From MPscPlugin class.
+// T_XIMPTestConnection::DoUnsubscribePresenceWatcherListL()
+// ---------------------------------------------------------------------------
+//
+void T_XIMPTestConnection::DoUnsubscribePresenceWatcherListL( TXIMPRequestId aReqId )
+    {
+    PluginAPIMethodCommonL( aReqId );
+
+    SetBooleanToCurrent( EXIMPPlgTestUnsubscribePresenceWatcherListCalled );
+
+    // TODO do something, like in PublishPresence
+
+    iWaitter->WaitForL( KWaitTime );
+    }
+
+// ---------------------------------------------------------------------------
+// T_XIMPTestConnection::DoSubscribePresentityGroupListL
+// ---------------------------------------------------------------------------
+//
+void T_XIMPTestConnection::DoSubscribePresentityGroupListL( TXIMPRequestId aReqId )
+    {
+    PluginAPIMethodCommonL( aReqId );
+
+    SetBooleanToCurrent( EXIMPPlgTestSubscribeGroupListCalled );
+
+    // TODO do something, like in PublishPresence
+
+    iWaitter->WaitForL( KWaitTime );
+    }
+
+// ---------------------------------------------------------------------------
+// T_XIMPTestConnection::DoUnsubscribePresentityGroupListL
+// ---------------------------------------------------------------------------
+//
+void T_XIMPTestConnection::DoUnsubscribePresentityGroupListL( TXIMPRequestId aReqId )
+    {
+    PluginAPIMethodCommonL( aReqId );
+
+    SetBooleanToCurrent( EXIMPPlgTestUnsubscribeGroupListCalled );
+
+    // TODO do something, like in PublishPresence
+
+    iWaitter->WaitForL( KWaitTime );
+    }
+
+
+// ---------------------------------------------------------------------------
+// T_XIMPTestConnection::PublishPresenceL()
+// ---------------------------------------------------------------------------
+//
+void T_XIMPTestConnection::DoPublishOwnPresenceL(
+        const MPresenceInfo& aPresence,
+        TXIMPRequestId aReqId )
+    {
+    // With SetupLeave we leave here
+    PluginAPIMethodCommonL( aReqId );
+
+    SetBooleanToCurrent( EXIMPPlgTestPublishPresenceCalled );
+
+    MProtocolPresenceDataHost& presHost = iConnectionHost->ProtocolPresenceDataHost();
+    // Set own presence data in data cache
+    MPresenceInfo* presence = presHost.PresenceObjectFactory().NewPresenceInfoLC();
+    TXIMPRequestId reqid = presHost.PublishingDataHost().HandleSubscribedOwnPresenceL( presence );
+    CleanupStack::Pop(); //presence
+
+    
+    if(iCurrentMessenger->GetError()==KErrTimedOut)
+    	{
+	    MXIMPStatus* status1 = iConnectionHost->ObjectFactory().NewStatusLC();
+	    iConnectionHost->HandleConnectionTerminated(status1);
+
+		CleanupStack::PopAndDestroy(1);
+    	}
+
+    iWaitter->WaitForL( KWaitTime );
+
+    // TODO when implemented, write the data received for test case verification
+    }
+
+// ---------------------------------------------------------------------------
+// T_XIMPTestConnection::DoUnsubscribeOwnPresenceL()
+// ---------------------------------------------------------------------------
+//
+void T_XIMPTestConnection::DoUnsubscribeOwnPresenceL( TXIMPRequestId aReqId )
+    {
+    PluginAPIMethodCommonL( aReqId );
+
+    // prepare the message for test code
+    SetBooleanToCurrent( EXIMPPlgTestUnsubscribeOwnPresenceCalled );
+    // TODO when implemented, read the data given by test case and
+    //      generate the required events
+    iWaitter->WaitForL( KWaitTime );
+    }
+
+// ---------------------------------------------------------------------------
+// T_XIMPTestConnection::DoCreatePresentityGroupL
+// ---------------------------------------------------------------------------
+//
+void T_XIMPTestConnection::DoCreatePresentityGroupL( const MXIMPIdentity& aIdentity,
+                                           const TDesC16& aDisplayName,
+                                           TXIMPRequestId aReqId )
+    {
+    PluginAPIMethodCommonL( aReqId );
+
+    // prepare the message for test code
+    SetBooleanToCurrent( EXIMPPlgTestCreatePresentityGroupCalled );
+    // TODO when implemented, read the data given by test case and
+    //      generate the required events
+    iWaitter->WaitForL( KWaitTime );
+    }
+
+// ---------------------------------------------------------------------------
+// T_XIMPTestConnection::DoCreatePresentityGroupL
+// ---------------------------------------------------------------------------
+//
+void T_XIMPTestConnection::DoDeletePresentityGroupL( const MXIMPIdentity& aIdentity,
+                                           TXIMPRequestId aReqId )
+    {
+    PluginAPIMethodCommonL( aReqId );
+
+    // prepare the message for test code
+    SetBooleanToCurrent( EXIMPPlgTestDeletePresentityGroupCalled );
+    // TODO when implemented, read the data given by test case and
+    //      generate the required events
+    iWaitter->WaitForL( KWaitTime );
+    }
+
+// ---------------------------------------------------------------------------
+// T_XIMPTestConnection::DoCreatePresentityGroupL
+// ---------------------------------------------------------------------------
+//
+void T_XIMPTestConnection::DoUpdatePresentityGroupDisplayNameL( const MXIMPIdentity& aIdentity,
+                                           const TDesC16& aDisplayName,
+                                           TXIMPRequestId aReqId )
+    {
+    PluginAPIMethodCommonL( aReqId );
+
+    // prepare the message for test code
+    SetBooleanToCurrent( EXIMPPlgTestUpdatePresentityGroupDisplayNameCalled );
+    // TODO when implemented, read the data given by test case and
+    //      generate the required events
+    iWaitter->WaitForL( KWaitTime );
+    }
+
+// ---------------------------------------------------------------------------
+// T_XIMPTestConnection::DoSubscribePresentityPresenceL
+// ---------------------------------------------------------------------------
+//
+void T_XIMPTestConnection::DoSubscribePresentityPresenceL(
+                                    const MXIMPIdentity& aIdentity,
+                                    const MPresenceInfoFilter& aPif,
+                                    TXIMPRequestId aReqId )
+    {
+    PluginAPIMethodCommonL( aReqId );
+
+    // prepare the message for test code
+    SetBooleanToCurrent( EXIMPPlgTestSubscribePresentityPresesenceCalled );
+    // TODO when implemented, read the data given by test case and
+    //      generate the required events
+    iWaitter->WaitForL( KWaitTime );
+    }
+
+// ---------------------------------------------------------------------------
+// T_XIMPTestConnection::DoUpdatePresentityPresenceSubscriptionL
+// ---------------------------------------------------------------------------
+//
+void T_XIMPTestConnection::DoUpdatePresentityPresenceSubscriptionPifL(
+                                    const MXIMPIdentity& aIdentity,
+                                    const MPresenceInfoFilter& aPif,
+                                    TXIMPRequestId aReqId )
+    {
+    PluginAPIMethodCommonL( aReqId );
+
+    // prepare the message for test code
+    SetBooleanToCurrent( EXIMPPlgTestUpdatePresentityPresesenceCalled );
+    // TODO when implemented, read the data given by test case and
+    //      generate the required events
+    iWaitter->WaitForL( KWaitTime );
+    }
+
+// ---------------------------------------------------------------------------
+// T_XIMPTestConnection::DoUnsubscribePresentityPresenceL
+// ---------------------------------------------------------------------------
+//
+void T_XIMPTestConnection::DoUnsubscribePresentityPresenceL(
+                                        const MXIMPIdentity& aIdentity,
+                                        TXIMPRequestId aReqId )
+    {
+    PluginAPIMethodCommonL( aReqId );
+
+    // prepare the message for test code
+    SetBooleanToCurrent( EXIMPPlgTestUnsubscribePresentityPresesenceCalled );
+    // TODO when implemented, read the data given by test case and
+    //      generate the required events
+    iWaitter->WaitForL( KWaitTime );
+    }
+
+
+// ---------------------------------------------------------------------------
+// T_XIMPTestConnection::DoSubscribePresentityGroupMembersPresenceL
+// ---------------------------------------------------------------------------
+//
+void T_XIMPTestConnection::DoSubscribePresentityGroupMembersPresenceL(
+                                    const MXIMPIdentity& aIdentity,
+                                    const MPresenceInfoFilter& aPif,
+                                    TXIMPRequestId aReqId )
+    {
+    PluginAPIMethodCommonL( aReqId );
+
+    // prepare the message for test code
+    SetBooleanToCurrent( EXIMPPlgTestSubscribePresentityGroupMembersPresesenceCalled );
+    // TODO when implemented, read the data given by test case and
+    //      generate the required events
+    iWaitter->WaitForL( KWaitTime );
+    }
+
+// ---------------------------------------------------------------------------
+// T_XIMPTestConnection::DoUpdatePresentityPresenceSubscriptionL
+// ---------------------------------------------------------------------------
+//
+void T_XIMPTestConnection::DoUpdatePresentityGroupMembersPresenceSubscriptionPifL(
+                                    const MXIMPIdentity& aIdentity,
+                                    const MPresenceInfoFilter& aPif,
+                                    TXIMPRequestId aReqId )
+    {
+    PluginAPIMethodCommonL( aReqId );
+
+    // prepare the message for test code
+    SetBooleanToCurrent( EXIMPPlgTestUpdatePresentityGroupMembersPresesenceCalled );
+    // TODO when implemented, read the data given by test case and
+    //      generate the required events
+    iWaitter->WaitForL( KWaitTime );
+    }
+
+// ---------------------------------------------------------------------------
+// T_XIMPTestConnection::DoUnsubscribePresentityPresenceL
+// ---------------------------------------------------------------------------
+//
+void T_XIMPTestConnection::DoUnsubscribePresentityGroupMembersPresenceL(
+                                        const MXIMPIdentity& aIdentity,
+                                        TXIMPRequestId aReqId )
+    {
+    PluginAPIMethodCommonL( aReqId );
+
+    // prepare the message for test code
+    SetBooleanToCurrent( EXIMPPlgTestUnsubscribePresentityGroupMembersPresesenceCalled );
+    // TODO when implemented, read the data given by test case and
+    //      generate the required events
+    iWaitter->WaitForL( KWaitTime );
+    }
+
+
+
+// ---------------------------------------------------------------------------
+// From MPscPlugin class.
+// T_XIMPTestConnection::DoSubscribePresentityGroupContentL
+// ---------------------------------------------------------------------------
+//
+void T_XIMPTestConnection::DoSubscribePresentityGroupContentL(
+                                            const MXIMPIdentity& aGroupId,
+                                            TXIMPRequestId aReqId )
+    {
+    PluginAPIMethodCommonL( aReqId );
+
+    // prepare the message for test code
+    SetBooleanToCurrent( EXIMPPlgTestSubscribePresentityGroupContentCalled );
+    // TODO when implemented, read the data given by test case and
+    //      generate the required events
+    iWaitter->WaitForL( KWaitTime );
+    }
+
+// ---------------------------------------------------------------------------
+// From MPscPlugin class.
+// T_XIMPTestConnection::DoUnsubscribePresentityGroupContentL
+// ---------------------------------------------------------------------------
+//
+void T_XIMPTestConnection::DoUnsubscribePresentityGroupContentL(
+                                            const MXIMPIdentity& aGroupId,
+                                            TXIMPRequestId aReqId )
+    {
+    PluginAPIMethodCommonL( aReqId );
+    // prepare the message for test code
+    SetBooleanToCurrent( EXIMPPlgTestUnsubscribePresentityGroupContentCalled );
+    // TODO when implemented, read the data given by test case and
+    //      generate the required events
+    iWaitter->WaitForL( KWaitTime );
+
+    }
+
+// ---------------------------------------------------------------------------
+// From MPscPlugin class.
+// T_XIMPTestConnection::DoAddPresentityGroupMemberL
+// ---------------------------------------------------------------------------
+//
+void T_XIMPTestConnection::DoAddPresentityGroupMemberL(
+                                            const MXIMPIdentity& aGroupId,
+                                            const MXIMPIdentity& aMemberId,
+                                            const TDesC16& aMemberDisplayName,
+                                            TXIMPRequestId aReqId )
+    {
+        /*
+        //Req complete parameter template
+        {
+        MXIMPRestrictedObjectCollection* collection =
+            iConnectionHost->ObjectFactory().NewRestrictedObjectCollectionLC();
+
+        MXIMPIdentity* identityClone = iConnectionHost->ObjectFactory().NewIdentityLC();
+        identityClone->SetIdentityL( aMemberId.Identity() );
+
+        MPresentityGroupMemberInfo* grpMember =
+        iConnectionHost->ObjectFactory().NewPresentityGroupMemberInfoLC( *identityClone,
+                                                                         _L("AlteredDisplayname") );
+        CleanupStack::Pop(); //grpMember
+        CleanupStack::PopAndDestroy(); //identityClone
+
+        CleanupDeletePushL( grpMember );
+        collection->AddOrReplaceTypeL( grpMember );
+        CleanupStack::Pop(); //grpMember
+
+        delete iReqCompleteParams;
+        iReqCompleteParams = NULL;
+        iReqCompleteParams = collection;
+
+        CleanupStack::Pop(); //collection
+        }
+        */
+
+    PluginAPIMethodCommonL( aReqId );
+
+    // prepare the message for test code
+    SetBooleanToCurrent( EXIMPPlgTestAddPresentityGroupMemberCalled );
+    // TODO when implemented, read the data given by test case and
+    //      generate the required events
+    iWaitter->WaitForL( KWaitTime );
+    }
+
+// ---------------------------------------------------------------------------
+// From MPscPlugin class.
+// T_XIMPTestConnection::DoRemovePresentityGroupMemberL
+// ---------------------------------------------------------------------------
+//
+void T_XIMPTestConnection::DoRemovePresentityGroupMemberL(
+                                            const MXIMPIdentity& aGroupId,
+                                            const MXIMPIdentity& aMemberId,
+                                            TXIMPRequestId aReqId )
+    {
+    PluginAPIMethodCommonL( aReqId );
+
+    // prepare the message for test code
+    SetBooleanToCurrent( EXIMPPlgTestRemovePresentityGroupMemberCalled );
+    // TODO when implemented, read the data given by test case and
+    //      generate the required events
+    iWaitter->WaitForL( KWaitTime );
+    }
+
+// ---------------------------------------------------------------------------
+// From MPscPlugin class.
+// T_XIMPTestConnection::DoUpdatePresentityGroupMemberDisplayNameL
+// ---------------------------------------------------------------------------
+//
+void T_XIMPTestConnection::DoUpdatePresentityGroupMemberDisplayNameL(
+                                            const MXIMPIdentity& aGroupId,
+                                            const MXIMPIdentity& aMemberId,
+                                            const TDesC16& aMemberDisplayName,
+                                            TXIMPRequestId aReqId )
+    {
+    PluginAPIMethodCommonL( aReqId );
+
+    // prepare the message for test code
+    SetBooleanToCurrent( EXIMPPlgTestUpdatePresentityGroupMemberDisplayNameCalled );
+    // TODO when implemented, read the data given by test case and
+    //      generate the required events
+    iWaitter->WaitForL( KWaitTime );
+    }
+
+
+// ---------------------------------------------------------------------------
+// From MPscPlugin class.
+// T_XIMPTestConnection::DoSubscribePresenceGrantRequestListL
+// ---------------------------------------------------------------------------
+//
+void T_XIMPTestConnection::DoSubscribePresenceGrantRequestListL( TXIMPRequestId aReqId )
+    {
+    PluginAPIMethodCommonL( aReqId );
+
+    SetBooleanToCurrent( EXIMPPlgTestSubscribePresenceGrantRequestListCalled );
+
+    // TODO do something, like in PublishPresence
+
+    iWaitter->WaitForL( KWaitTime );
+    }
+
+// ---------------------------------------------------------------------------
+// From MPscPlugin class.
+// T_XIMPTestConnection::DoUnsubscribePresenceGrantRequestListL
+// ---------------------------------------------------------------------------
+//
+void T_XIMPTestConnection::DoUnsubscribePresenceGrantRequestListL( TXIMPRequestId aReqId )
+    {
+    PluginAPIMethodCommonL( aReqId );
+
+    SetBooleanToCurrent( EXIMPPlgTestUnsubscribePresenceGrantRequestListCalled );
+
+    // TODO do something, like in PublishPresence
+
+    iWaitter->WaitForL( KWaitTime );
+    }
+
+
+void T_XIMPTestConnection::DoGrantPresenceForPresentityL( const MXIMPIdentity& aIdentity,
+                                           const MPresenceInfoFilter& aPif,
+                                           TXIMPRequestId aReqId )
+    {
+    PluginAPIMethodCommonL( aReqId );
+
+    SetBooleanToCurrent( EXIMPPlgTestGrantPresenceForPresentityCalled );
+
+    // TODO do something, like in PublishPresence
+
+    iWaitter->WaitForL( KWaitTime );
+
+    }
+void T_XIMPTestConnection::DoGrantPresenceForPresentityGroupMembersL( const MXIMPIdentity& aGroupId,
+                                                        const MPresenceInfoFilter& aPif,
+                                                        TXIMPRequestId aReqId )
+    {
+    PluginAPIMethodCommonL( aReqId );
+
+    SetBooleanToCurrent( EXIMPPlgTestGrantPresenceForPresentityGroupMembersCalled );
+
+    // TODO do something, like in PublishPresence
+
+    iWaitter->WaitForL( KWaitTime );
+
+    }
+
+void T_XIMPTestConnection::DoGrantPresenceForEveryoneL( const MPresenceInfoFilter& aPif,
+                                                        TXIMPRequestId aReqId )
+    {
+    PluginAPIMethodCommonL( aReqId );
+
+    SetBooleanToCurrent( EXIMPPlgTestGrantPresenceForEveryoneCalled );
+
+    // TODO do something, like in PublishPresence
+
+    iWaitter->WaitForL( KWaitTime );
+
+    }
+
+
+void T_XIMPTestConnection::DoUpdatePresenceGrantPifForPresentityL( const MXIMPIdentity& aIdentity,
+                                           const MPresenceInfoFilter& aPif,
+                                           TXIMPRequestId aReqId )
+    {
+    PluginAPIMethodCommonL( aReqId );
+
+    SetBooleanToCurrent( EXIMPPlgTestUpdateGrantPresenceForPresentityCalled );
+
+    // TODO do something, like in PublishPresence
+
+    iWaitter->WaitForL( KWaitTime );
+
+    }
+
+void T_XIMPTestConnection::DoUpdatePresenceGrantPifForPresentityGroupMembersL( const MXIMPIdentity& aGroupId,
+                                                        const MPresenceInfoFilter& aPif,
+                                                        TXIMPRequestId aReqId )
+    {
+    PluginAPIMethodCommonL( aReqId );
+
+    SetBooleanToCurrent( EXIMPPlgTestUpdateGrantPresenceForPresentityGroupMembersCalled );
+
+    // TODO do something, like in PublishPresence
+
+    iWaitter->WaitForL( KWaitTime );
+
+    }
+
+void T_XIMPTestConnection::DoUpdatePresenceGrantPifForEveryoneL( const MPresenceInfoFilter& aPif,
+                                                                 TXIMPRequestId aReqId )
+    {
+    PluginAPIMethodCommonL( aReqId );
+
+    SetBooleanToCurrent( EXIMPPlgTestUpdateGrantPresenceForEveryoneCalled );
+
+    // TODO do something, like in PublishPresence
+
+    iWaitter->WaitForL( KWaitTime );
+
+    }
+
+
+void T_XIMPTestConnection::DoWithdrawPresenceGrantFromPresentityL( const MXIMPIdentity& aIdentity, TXIMPRequestId aReqId )
+    {
+    PluginAPIMethodCommonL( aReqId );
+
+    SetBooleanToCurrent( EXIMPPlgTestWithdrawPresenceFromPresentityCalled );
+
+    // TODO do something, like in PublishPresence
+
+    iWaitter->WaitForL( KWaitTime );
+
+    }
+
+void T_XIMPTestConnection::DoWithdrawPresenceGrantFromEveryoneL( TXIMPRequestId aReqId )
+    {
+    PluginAPIMethodCommonL( aReqId );
+
+    SetBooleanToCurrent( EXIMPPlgTestWithdrawPresenceFromEveryoneCalled );
+
+    // TODO do something, like in PublishPresence
+
+    iWaitter->WaitForL( KWaitTime );
+
+    }
+
+void T_XIMPTestConnection::DoWithdrawPresenceGrantFromPresentityGroupMembersL( const MXIMPIdentity& aGroupId,
+                                                            TXIMPRequestId aReqId )
+    {
+    PluginAPIMethodCommonL( aReqId );
+
+    SetBooleanToCurrent( EXIMPPlgTestWithdrawPresenceFromPresentityGroupMembersCalled );
+
+    // TODO do something, like in PublishPresence
+
+    iWaitter->WaitForL( KWaitTime );
+
+    }
+
+void T_XIMPTestConnection::DoSubscribePresenceBlockListL( TXIMPRequestId aReqId )
+    {
+    PluginAPIMethodCommonL( aReqId );
+
+    SetBooleanToCurrent( EXIMPPlgTestSubscribePresenceBlockListCalled );
+
+    // TODO do something, like in PublishPresence
+
+    iWaitter->WaitForL( KWaitTime );
+
+    }
+
+void T_XIMPTestConnection::DoUnsubscribePresenceBlockListL( TXIMPRequestId aReqId )
+    {
+    PluginAPIMethodCommonL( aReqId );
+
+    SetBooleanToCurrent( EXIMPPlgTestUnsubscribePresenceBlockListCalled );
+
+    // TODO do something, like in PublishPresence
+
+    iWaitter->WaitForL( KWaitTime );
+
+    }
+void T_XIMPTestConnection::DoBlockPresenceForPresentityL( const MXIMPIdentity& aPresentityId,
+                                    TXIMPRequestId aReqId )
+    {
+    PluginAPIMethodCommonL( aReqId );
+
+    SetBooleanToCurrent( EXIMPPlgTestBlockPresenceForPresentityCalled );
+
+    // TODO do something, like in PublishPresence
+
+    iWaitter->WaitForL( KWaitTime );
+
+    }
+void T_XIMPTestConnection::DoCancelPresenceBlockFromPresentityL( const MXIMPIdentity& aPresentityId,
+                                           TXIMPRequestId aReqId )
+    {
+    PluginAPIMethodCommonL( aReqId );
+
+    SetBooleanToCurrent( EXIMPPlgTestCancelPresenceBlockFromPresentityCalled );
+
+    // TODO do something, like in PublishPresence
+
+    iWaitter->WaitForL( KWaitTime );
+
+    }
+
+
+
+// ---------------------------------------------------------------------------
+// T_XIMPTestConnection::PluginAPIMethodCommonL
+// ---------------------------------------------------------------------------
+//
+void T_XIMPTestConnection::PluginAPIMethodCommonL( TXIMPRequestId& aOpId )
+    {
+    iReqId = aOpId;
+
+    TInt index = CXIMPTestMessenger::GetPluginIndex();
+    TInt count = iClients.Count();
+    for( TInt a = 0; a < count; ++a )
+        {
+        if( iClients[ a ]->iPluginIndex == index )
+            {
+            iCurrentMessenger = iClients[ a ]->iMessenger;
+            }
+        }
+    iCurrentMessenger->HandleLeaveL();
+    // handle other errors here
+    if ( iCurrentMessenger->GetBoolean( EXIMPTestPlgBehaveInvalidReqId ) )
+        {
+        // arbitrarily mangle the given request id
+        TXIMPRequestIdBuilder idBuilder;
+        idBuilder.SetProtocolId( 123 );
+        idBuilder.SetSessionId( 456 );
+        idBuilder.SetRequestId( 789 );
+        //iReqId = TXIMPRequestId( 123, 456, 789 );
+        iReqId = idBuilder.BuildRequestId();
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// T_XIMPTestConnection::WaitCompleted()
+// ---------------------------------------------------------------------------
+//
+void T_XIMPTestConnection::WaitCompleted( TInt /* aRetVal */ )
+    {
+    TInt errorCode = iCurrentMessenger->GetError();
+
+/*
+    if ( iSessionLostFailReconnects )
+        {
+        // fail all reconnects
+        errorCode = KErrTimedOut;
+        iConnectedClients = 0;
+        }
+*/
+    MXIMPStatus* status = iConnectionHost->ObjectFactory().NewStatusLC();
+    CleanupStack::Pop(); // status.
+    status->SetResultCode( errorCode );
+
+    MXIMPRestrictedObjectCollection* reqCompleteParams = iCurrentMessenger->GetReqCompleteParams();
+
+    if( reqCompleteParams )
+        {
+        iConnectionHost->HandleRequestCompleted( iReqId, status, reqCompleteParams );
+        reqCompleteParams = NULL;
+        }
+    else
+        {
+        iConnectionHost->HandleRequestCompleted( iReqId, status );
+        }
+
+    if ( iSessionLostFailReconnects )
+        {
+        // doing a sequence of failing reconnects
+        return;
+        }
+
+    // check if test code wants us to fake session lost
+    TInt val = iCurrentMessenger->GetValueFor( EXIMPTestPlgSessionLostStrategy );
+
+    if ( val != EXIMPPrtValSessionLostEmpty )
+        {
+        // yep, fake session lost
+
+        // reset the old value! otherwise timer will restart upon next operation.
+        iCurrentMessenger->SetValueFor( EXIMPTestPlgSessionLostStrategy, EXIMPPrtValSessionLostEmpty );
+
+        iSessionLostReconnect = val == EXIMPPrtValSessionLostReconnect;
+        iSessionLostFailReconnects = val == EXIMPPrtValSessionLostReconnectExhaustAttempts;
+
+        // start another wait (5 sec) with callback.
+        TInt time = 1000000 * 5;
+        TCallBack callback( ReconnectSimulator, this );
+        iAuxTimer->Start( time, time, callback );
+        }
+
+    delete iClientToBeDeleted;
+    iClientToBeDeleted = NULL;
+    
+    }
+
+// ---------------------------------------------------------------------------
+// RECONNECTION SIMULATOR ROUTINES
+// ---------------------------------------------------------------------------
+//
+TInt T_XIMPTestConnection::ReconnectSimulator( TAny* aMyself )
+    {
+//    (static_cast<T_XIMPTestConnection*>(aMyself))->DoReconnectSimulator();
+    return 0; // ignored by CPeriodic
+    }
+
+void T_XIMPTestConnection::DoReconnectSimulator()
+    {
+/*    TRAPD( err, DoReconnectSimulatorL() );
+    if ( err != KErrNone )
+        {
+        // TODO what to do? is this enough to fail testcode
+        User::Panic( _L("XIMPTestPrt"), 424242 );
+        }
+        */
+    }
+
+void T_XIMPTestConnection::DoReconnectSimulatorL()
+    {
+    iAuxTimer->Cancel();    // must stop it from running again
+/*
+    // connection dies.
+    iConnectedClients = 0;
+
+    if ( iSessionLostReconnect || iSessionLostFailReconnects )
+        {
+        // tell host to try to reconnect
+        iConnectionHost->HandleConnectionLost( iStatus );
+        }
+    else
+        {
+        // tell host to kill connection
+        iConnectionHost->HandleConnectionTerminated( iStatus );
+        }
+*/
+    }
+
+void T_XIMPTestConnection::SetBooleanToCurrent( TXIMPTestPropertyKeys aKey )
+    {
+    if( iCurrentMessenger )
+        {
+        iCurrentMessenger->SetBoolean( aKey );
+        }
+    }
+
+void T_XIMPTestConnection::SetBoolean( TXIMPTestPropertyKeys aKey )
+    {
+    TInt count = iClients.Count();
+    for( TInt a = 0; a < count ; ++a )
+        {
+        iClients[ a ]->iMessenger->SetBoolean( aKey );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// T_XIMPTestConnection::GetInterface()
+// ---------------------------------------------------------------------------
+//
+TAny* T_XIMPTestConnection::GetInterface(
+        TInt32 aInterfaceId,
+        TIfGetOps /* aOptions */ )
+    {
+    if ( aInterfaceId == MXIMPProtocolConnection::KInterfaceId )
+        {
+        // caller wants this interface
+        MXIMPProtocolConnection* myIf = this;
+        return myIf;
+        }
+    else if( aInterfaceId == MProtocolPresencePublishing::KInterfaceId )
+        {
+        // caller wants this interface
+        MProtocolPresencePublishing* myIf = this;
+        return myIf;
+        }
+    else if( aInterfaceId == MProtocolPresenceWatching::KInterfaceId )
+        {
+        // caller wants this interface
+        MProtocolPresenceWatching* myIf = this;
+        return myIf;
+        }
+    else if( aInterfaceId == MProtocolPresenceAuthorization::KInterfaceId )
+        {
+        // caller wants this interface
+        MProtocolPresenceAuthorization* myIf = this;
+        return myIf;
+        }
+    else if( aInterfaceId == MProtocolPresentityGroups::KInterfaceId )
+        {
+        // caller wants this interface
+        MProtocolPresentityGroups* myIf = this;
+        return myIf;
+        }
+    else if( aInterfaceId == T_XIMPTestConnection::KClassId )
+        {
+        return this;
+        }
+    else
+        {
+        return NULL;
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// T_XIMPTestConnection::GetInterface()
+// ---------------------------------------------------------------------------
+//
+const TAny* T_XIMPTestConnection::GetInterface(
+        TInt32 aInterfaceId,
+        TIfGetOps /* aOptions */ ) const
+    {
+    if ( aInterfaceId == MXIMPProtocolConnection::KInterfaceId )
+        {
+        // caller wants this interface
+        const MXIMPProtocolConnection* myIf = this;
+        return myIf;
+        }
+    else if( aInterfaceId == MProtocolPresencePublishing::KInterfaceId )
+        {
+        // caller wants this interface
+        const MProtocolPresencePublishing* myIf = this;
+        return myIf;
+        }
+    else if( aInterfaceId == MProtocolPresenceWatching::KInterfaceId )
+        {
+        // caller wants this interface
+        const MProtocolPresenceWatching* myIf = this;
+        return myIf;
+        }
+    else if( aInterfaceId == MProtocolPresenceAuthorization::KInterfaceId )
+        {
+        // caller wants this interface
+        const MProtocolPresenceAuthorization* myIf = this;
+        return myIf;
+        }
+    else if( aInterfaceId == MProtocolPresentityGroups::KInterfaceId )
+        {
+        // caller wants this interface
+        const MProtocolPresentityGroups* myIf = this;
+        return myIf;
+        }
+    else if( aInterfaceId == T_XIMPTestConnection::KClassId )
+        {
+        return this;
+        }
+    else
+        {
+        return NULL;
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// T_XIMPTestConnection::GetInterfaceId()
+// ---------------------------------------------------------------------------
+//
+TInt32 T_XIMPTestConnection::GetInterfaceId() const
+    {
+    return MXIMPProtocolConnection::KInterfaceId;
+    }
+
+
+// ---------------------------------------------------------------------------
+// Key value pair table to identify correct constructor
+// function for the requested interface.
+// ---------------------------------------------------------------------------
+//
+const TImplementationProxy ImplementationTable[] =
+    {
+    IMPLEMENTATION_PROXY_ENTRY( K_PRFW_TST_PROTOCOL_1_IMPLEMENTATION_UID,
+                                T_XIMPTestProtocol::NewL )
+    };
+
+
+// ---------------------------------------------------------------------------
+// Exported function to return the implementation proxy table
+// ---------------------------------------------------------------------------
+//
+EXPORT_C const TImplementationProxy* ImplementationGroupProxy( TInt& aTableCount )
+    {
+    aTableCount = sizeof( ImplementationTable ) / sizeof( TImplementationProxy );
+    return ImplementationTable;
+    }
+
+// ---------------------------------------------------------------------------
+// T_XIMPTestProtocol::T_XIMPTestProtocol()
+// ---------------------------------------------------------------------------
+//
+T_XIMPTestProtocol::T_XIMPTestProtocol()
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// T_XIMPTestProtocol::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void T_XIMPTestProtocol::ConstructL()
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// T_XIMPTestProtocol::NewLC()
+// ---------------------------------------------------------------------------
+//
+T_XIMPTestProtocol* T_XIMPTestProtocol::NewLC()
+    {
+    T_XIMPTestProtocol* self = new( ELeave ) T_XIMPTestProtocol();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+
+// ---------------------------------------------------------------------------
+// T_XIMPTestProtocol::NewL()
+// ---------------------------------------------------------------------------
+//
+T_XIMPTestProtocol* T_XIMPTestProtocol::NewL()
+    {
+    T_XIMPTestProtocol* self = T_XIMPTestProtocol::NewLC();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// T_XIMPTestProtocol::~T_XIMPTestProtocol()
+// ---------------------------------------------------------------------------
+//
+T_XIMPTestProtocol::~T_XIMPTestProtocol()
+    {
+    iConnections.Close();
+    }
+
+// ---------------------------------------------------------------------------
+// T_XIMPTestProtocol::PrimeHost()
+// ---------------------------------------------------------------------------
+//
+void T_XIMPTestProtocol::PrimeHost( MXIMPProtocolPluginHost& aHost )
+    {
+    iHost = &aHost;
+    }
+
+// ---------------------------------------------------------------------------
+// T_XIMPTestProtocol::AcquireConnectionL()
+// ---------------------------------------------------------------------------
+//
+MXIMPProtocolConnection& T_XIMPTestProtocol::AcquireConnectionL(
+                                    const MXIMPServiceInfo& aServiceInfo,
+                                    const MXIMPContextClientInfo& aClientCtxInfo )
+    {
+    T_XIMPTestConnection* newConnection = T_XIMPTestConnection::NewLC( aServiceInfo, aClientCtxInfo );
+    TLinearOrder< T_XIMPTestConnection > order( T_XIMPTestConnection::OrderOfConnections );
+    TInt index = iConnections.FindInOrder( newConnection, order );
+    if( index != KErrNotFound )
+        {
+        User::LeaveIfError( index );
+        CleanupStack::PopAndDestroy(); // newConnection
+        newConnection = iConnections[ index ];
+        }
+    else
+        {
+        iConnections.InsertInOrderL( newConnection, order );
+        CleanupStack::Pop(); //newConnection
+        }
+    return *newConnection;
+    }
+
+// ---------------------------------------------------------------------------
+// T_XIMPTestProtocol::ReleaseConnection()
+// ---------------------------------------------------------------------------
+//
+void T_XIMPTestProtocol::ReleaseConnection( MXIMPProtocolConnection& aConnection )
+    {
+    TLinearOrder< T_XIMPTestConnection > order( T_XIMPTestConnection::OrderOfConnections );
+    T_XIMPTestConnection* connection = ( T_XIMPTestConnection* )( aConnection.GetInterface(
+                    T_XIMPTestConnection::KClassId,
+                    MXIMPBase::EPanicIfUnknown ) );
+    TInt index = iConnections.FindInOrder( connection, order );
+    if( index >= 0 )
+        {
+        iConnections.Remove( index );
+        }
+    delete connection;
+    }
+
+// ---------------------------------------------------------------------------
+// T_XIMPTestProtocol::GetInterface()
+// ---------------------------------------------------------------------------
+//
+TAny* T_XIMPTestProtocol::GetInterface(
+        TInt32 aInterfaceId,
+        TIfGetOps /* aOptions */ )
+    {
+    if ( aInterfaceId == MXIMPProtocolPlugin::KInterfaceId )
+        {
+        // caller wants this interface
+        MXIMPProtocolPlugin* myIf = this;
+        return myIf;
+        }
+    else
+        {
+        return NULL;
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// T_XIMPTestProtocol::GetInterface()
+// ---------------------------------------------------------------------------
+//
+const TAny* T_XIMPTestProtocol::GetInterface(
+        TInt32 aInterfaceId,
+        TIfGetOps /* aOptions */ ) const
+    {
+    if ( aInterfaceId == MXIMPProtocolPlugin::KInterfaceId )
+        {
+        // caller wants this interface
+        const MXIMPProtocolPlugin* myIf = this;
+        return myIf;
+        }
+    else
+        {
+        return NULL;
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// T_XIMPTestProtocol::GetInterfaceId()
+// ---------------------------------------------------------------------------
+//
+TInt32 T_XIMPTestProtocol::GetInterfaceId() const
+    {
+    return MXIMPProtocolPlugin::KInterfaceId;
+    }
+
+
+
+// End of file
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/tsrc/tsrcprotocols/pr_prfwtestprotocol/pr_prfwtestprotocol.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,403 @@
+/*
+* 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:  Test Protocol implementation for XIMP Framework
+ *
+*/
+
+
+#ifndef T_PRFWTESTPROTOCOL_H
+#define T_PRFWTESTPROTOCOL_H
+
+
+#include <e32base.h>
+
+#include <ximpprotocolpluginbase.h>
+#include <protocolpresencepublishing.h>
+#include <protocolpresencewatching.h>
+#include <protocolpresenceauthorization.h>
+#include <protocolpresentitygroups.h>
+#include <protocolpresencefeatures.h>
+#include <ximpprotocolconnection.h>
+#include <ximpprotocolconnectionhostobserver.h>
+#include <ximpbase.h>
+
+#include "prfwwaitobserver.h"
+
+#include "prfwtestmessaging.h"
+
+class CXIMPTestGeneralWaiter;
+class CXIMPTestMessenger;
+class CPeriodic;
+class CXIMPTestFileLogicHelper;
+class CXIMPTestFileTool;
+class MXIMPRestrictedObjectCollection;
+class MProtocolImFeatures;
+#define PRIMP_CLSID_CPRESENTITYGROUPINFOIMP 15000
+
+class T_XIMPTestConnection :public CBase,
+                            public MXIMPProtocolConnection,
+                            public MProtocolPresenceFeatures,
+                            public MProtocolPresencePublishing,
+                            public MProtocolPresenceWatching,
+                            public MProtocolPresenceAuthorization,
+                            public MProtocolPresentityGroups,
+                            public MXIMPProtocolConnectionHostObserver,
+                            public T_MWaitObserver
+                            
+    {
+    public:
+    /** The class ID. */
+    enum { KClassId = PRIMP_CLSID_CPRESENTITYGROUPINFOIMP };
+
+
+        class ClientWrapper : public CBase
+            {
+            private:
+
+                void ConstructL( const TDesC& aClientId );
+
+            public:
+
+                static ClientWrapper* NewLC( const TDesC& aClientId );
+                void InitializeL( MXIMPProtocolConnectionHost& aConnectionHost );
+                ~ClientWrapper();
+
+            public:
+
+                RBuf iId;
+                CXIMPTestFileTool* iFileTool;
+                CXIMPTestMessenger* iMessenger;
+                CXIMPTestFileLogicHelper* iFileLogicHelper;
+                TInt iPluginIndex;
+            };
+
+    public:
+
+        static T_XIMPTestConnection* NewL( const MXIMPServiceInfo& aServiceInfo,
+                                           const MXIMPContextClientInfo& aClientCtxInfo );
+        static T_XIMPTestConnection* NewLC( const MXIMPServiceInfo& aServiceInfo,
+                                            const MXIMPContextClientInfo& aClientCtxInfo );
+
+        ~T_XIMPTestConnection();
+
+
+    private:
+
+        T_XIMPTestConnection();
+        void ConstructL( const MXIMPServiceInfo& aServiceInfo,
+                         const MXIMPContextClientInfo& aClientCtxInfo );
+
+    public: // From MXIMPProtocolConnection
+
+        /**
+         * host for connection
+         */
+        void PrimeHost( MXIMPProtocolConnectionHost& aHost );
+
+        void OpenSessionL( const MXIMPContextClientInfo& aClientCtxInfo,
+                               TXIMPRequestId aReqId  );
+
+        
+        void OpenSessionL(
+                const TInt& aSettingsId,
+                TXIMPRequestId aReqId );
+
+        void CloseSession( const MXIMPContextClientInfo& aClientCtxInfo,
+                               TXIMPRequestId aReqId );
+                               
+        MProtocolPresenceFeatures& ProtocolPresenceFeatures();
+		
+		//MProtocolImFeatures* ProtocolImFeatures();
+		
+		TAny* GetProtocolInterface(TInt aInterfaceId);
+		
+    public: // MProtocolPresenceFeatures
+        MProtocolPresenceWatching& PresenceWatching();
+        MProtocolPresencePublishing& PresencePublishing();
+        MProtocolPresentityGroups& PresentityGroups();
+        MProtocolPresenceAuthorization& PresenceAuthorization();
+        
+        
+    public: // From MXIMPProtocolConnectionHostObserver        
+    
+        void HandleProtocolConnectionHostEvent(
+                const MXIMPProtocolConnectionHost& aHost,
+                const MXIMPBase& aEvent );
+
+
+    public: // from MPscPlugin
+
+
+        void GetSupportedFeaturesL(
+                CDesC8Array& aFeatures ) const;
+
+        void DoPublishOwnPresenceL(
+                const MPresenceInfo& aPresence,
+                TXIMPRequestId aReqId );
+
+        void DoSubscribeOwnPresenceL( const MPresenceInfoFilter& aPif,
+                                          TXIMPRequestId aReqId );
+
+        void DoUnsubscribeOwnPresenceL( TXIMPRequestId aReqId );
+
+        void DoUpdateOwnPresenceSubscriptionPifL( const MPresenceInfoFilter& aPif,
+                                          TXIMPRequestId aReqId );
+
+
+        void DoSubscribePresenceWatcherListL( TXIMPRequestId aReqId );
+        void DoUnsubscribePresenceWatcherListL( TXIMPRequestId aReqId );
+
+        void DoSubscribePresentityGroupListL( TXIMPRequestId aReqId );
+        void DoUnsubscribePresentityGroupListL( TXIMPRequestId aReqId );
+
+        void DoCreatePresentityGroupL( const MXIMPIdentity& aIdentity,
+                                           const TDesC16& aDisplayName,
+                                           TXIMPRequestId aReqId );
+        void DoDeletePresentityGroupL( const MXIMPIdentity& aIdentity,
+                                               TXIMPRequestId aReqId );
+        void DoUpdatePresentityGroupDisplayNameL( const MXIMPIdentity& aIdentity,
+                                               const TDesC16& aDisplayName,
+                                               TXIMPRequestId aReqId );
+        void DoSubscribePresentityPresenceL(
+                                    const MXIMPIdentity& aIdentity,
+                                    const MPresenceInfoFilter& aPif,
+                                    TXIMPRequestId aReqId );
+        void DoUpdatePresentityPresenceSubscriptionPifL(
+                                    const MXIMPIdentity& aIdentity,
+                                    const MPresenceInfoFilter& aPif,
+                                    TXIMPRequestId aReqId );
+        void DoUnsubscribePresentityPresenceL( const MXIMPIdentity& aIdentity,
+                                    TXIMPRequestId aReqId );
+
+        void DoSubscribePresentityGroupContentL( const MXIMPIdentity& aGroupId,
+                                                     TXIMPRequestId aReqId );
+
+        void DoUnsubscribePresentityGroupContentL( const MXIMPIdentity& aGroupId,
+                                                       TXIMPRequestId aReqId );
+
+        void DoAddPresentityGroupMemberL( const MXIMPIdentity& aGroupId,
+                                              const MXIMPIdentity& aMemberId,
+                                              const TDesC16& aMemberDisplayName,
+                                              TXIMPRequestId aReqId );
+
+        void DoRemovePresentityGroupMemberL( const MXIMPIdentity& aGroupId,
+                                                 const MXIMPIdentity& aMemberId,
+                                                 TXIMPRequestId aReqId );
+
+        void DoUpdatePresentityGroupMemberDisplayNameL( const MXIMPIdentity& aGroupId,
+                                                            const MXIMPIdentity& aMemberId,
+                                                            const TDesC16& aMemberDisplayName,
+                                                            TXIMPRequestId aReqId );
+        void DoSubscribePresentityGroupMembersPresenceL(
+                                        const MXIMPIdentity& aIdentity,
+                                        const MPresenceInfoFilter& aPif,
+                                        TXIMPRequestId aReqId );
+
+        void DoUpdatePresentityGroupMembersPresenceSubscriptionPifL(
+                                        const MXIMPIdentity& aIdentity,
+                                        const MPresenceInfoFilter& aPif,
+                                        TXIMPRequestId aReqId );
+
+        void DoUnsubscribePresentityGroupMembersPresenceL( const MXIMPIdentity& aIdentity,
+                                        TXIMPRequestId aReqId );
+
+        void DoSubscribePresenceGrantRequestListL( TXIMPRequestId aReqId );
+
+        void DoUnsubscribePresenceGrantRequestListL( TXIMPRequestId aReqId );
+
+        void DoGrantPresenceForPresentityL( const MXIMPIdentity& aIdentity,
+                                                   const MPresenceInfoFilter& aPif,
+                                                   TXIMPRequestId aReqId );
+        void DoGrantPresenceForPresentityGroupMembersL( const MXIMPIdentity& aGroupId,
+                                                                const MPresenceInfoFilter& aPif,
+                                                                TXIMPRequestId aReqId );
+
+        void DoGrantPresenceForEveryoneL( const MPresenceInfoFilter& aPif,
+                                            TXIMPRequestId aReqId );
+
+        void DoUpdatePresenceGrantPifForPresentityL( const MXIMPIdentity& aIdentity,
+                                                   const MPresenceInfoFilter& aPif,
+                                                   TXIMPRequestId aReqId );
+
+        void DoUpdatePresenceGrantPifForPresentityGroupMembersL( const MXIMPIdentity& aGroupId,
+                                                                const MPresenceInfoFilter& aPif,
+                                                                TXIMPRequestId aReqId );
+
+        void DoUpdatePresenceGrantPifForEveryoneL( const MPresenceInfoFilter& aPif,
+                                                   TXIMPRequestId aReqId );
+
+        void DoWithdrawPresenceGrantFromPresentityL( const MXIMPIdentity& aIdentity, TXIMPRequestId aReqId );
+
+        void DoWithdrawPresenceGrantFromPresentityGroupMembersL( const MXIMPIdentity& aGroupId,
+                                                                    TXIMPRequestId aReqId );
+
+        void DoWithdrawPresenceGrantFromEveryoneL( TXIMPRequestId aReqId );
+
+        void DoSubscribePresenceBlockListL( TXIMPRequestId aReqId );
+        void DoUnsubscribePresenceBlockListL( TXIMPRequestId aReqId );
+        void DoBlockPresenceForPresentityL( const MXIMPIdentity& aPresentityId,
+                                            TXIMPRequestId aReqId );
+        void DoCancelPresenceBlockFromPresentityL( const MXIMPIdentity& aPresentityId,
+                                                   TXIMPRequestId aReqId );
+
+    public: // from T_MWaitObserver
+
+        void WaitCompleted( TInt aRetVal );
+
+
+    public: // from MXIMPBase
+
+        TAny* GetInterface(
+                TInt32 aInterfaceId,
+                TIfGetOps aOptions );
+
+        const TAny* GetInterface(
+                TInt32 aInterfaceId,
+                TIfGetOps aOptions ) const;
+
+        TInt32 GetInterfaceId() const;
+
+    private:
+        /**
+         * All plugin API methods should call this method
+         * to handle test code to plugin communication
+         * properly.
+         * Add more common stuff here (such as new special messages
+         * which behave in a common way to all plugin API calls, etc.)
+         * @param aOpId The request id
+         */
+        void PluginAPIMethodCommonL( TXIMPRequestId& aOpId );
+
+        /**
+         * Callback for aux timer
+         * @see TCallBack
+         */
+        static TInt ReconnectSimulator( TAny* aMyself );
+
+        /**
+         * Actual callback called from ReconnectSimulator
+         */
+        void DoReconnectSimulator();
+
+        /**
+         * Leaving version of aux timer callback.
+         */
+        void DoReconnectSimulatorL();
+
+        void SetBooleanToCurrent( TXIMPTestPropertyKeys aKey );
+        void SetBoolean( TXIMPTestPropertyKeys aKey );
+
+    public:
+        static TInt OrderOfConnections( const T_XIMPTestConnection& aFirst,
+                                        const T_XIMPTestConnection& aSecond );
+
+    private:
+
+        static TInt OrderOfClients( const ClientWrapper& aFirst,
+                                    const ClientWrapper& aSecond );
+    private:
+
+        HBufC* iServerAddress;
+        HBufC* iUserName;
+        HBufC* iPassword;
+        HBufC* iClientId;
+
+        //TInt iConnectedClients;
+
+        RPointerArray< ClientWrapper > iClients;
+        ClientWrapper* iClientToBeDeleted;
+
+        TXIMPRequestId iReqId;
+        CXIMPTestGeneralWaiter* iWaitter;
+
+        MXIMPStatus* iStatus;
+
+        // last received message
+        TXIMPTestMsg iLastMsg;
+
+        // ETrue if reconnect is to be faked for session lost.
+        TBool iSessionLostReconnect;
+
+        // ETrue if all reconnects are to be failed.
+        TBool iSessionLostFailReconnects;
+
+        // auxiliary timer (session lost simulation)
+        CPeriodic* iAuxTimer;
+
+
+        /**
+         * File tool for monitoring events.
+         */
+        //CXIMPTestFileTool* iFileTool;
+
+        /**
+         * Host for connection
+         */
+        MXIMPProtocolConnectionHost* iConnectionHost;
+
+        CXIMPTestMessenger* iCurrentMessenger;
+    };
+
+/**
+ * Example protocol plugin
+ *
+ *
+ * @lib ?library
+ * @since S60 v4.0
+ */
+class T_XIMPTestProtocol : public CXIMPProtocolPluginBase
+    {
+    public:
+
+        static T_XIMPTestProtocol* NewL();
+        static T_XIMPTestProtocol* NewLC();
+
+        ~T_XIMPTestProtocol();
+
+    private:
+
+        T_XIMPTestProtocol();
+        void ConstructL();
+
+    public: // From MXIMPProtocolPlugin
+
+        void PrimeHost( MXIMPProtocolPluginHost& aHost );
+
+        MXIMPProtocolConnection& AcquireConnectionL(
+                    const MXIMPServiceInfo& aServiceInfo,
+                    const MXIMPContextClientInfo& aClientCtxInfo );
+        void ReleaseConnection(
+                        MXIMPProtocolConnection& aConnection );
+
+    public: // from MXIMPBase
+
+        TAny* GetInterface(
+                TInt32 aInterfaceId,
+                TIfGetOps aOptions );
+
+        const TAny* GetInterface(
+                TInt32 aInterfaceId,
+                TIfGetOps aOptions ) const;
+
+        TInt32 GetInterfaceId() const;
+
+
+    private: // Data
+
+        // Prime host
+        MXIMPProtocolPluginHost* iHost;
+        RXIMPObjOwningPtrArray< T_XIMPTestConnection > iConnections;
+    };
+
+#endif // T_PRFWTESTPROTOCOL_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/tsrc/tsrcprotocols/pr_prfwtestprotocol/pr_prfwtestprotocol.mmp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,92 @@
+/*
+* 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 Presence Framework Test Protocol
+*
+*/
+
+#include <platform_paths.hrh>
+#include "../prfwtestprotocols_resource.hrh"
+#include<eunitcaps.h>
+
+TARGET              pr_prfwtestprotocol.dll
+TARGETTYPE          PLUGIN
+UID                 XIMP_DLL_UID_ECOM_PLUGIN  PRFW_DLL_UID_PR_PRFWTESTPROTOCOL
+VENDORID            VID_DEFAULT
+//CAPABILITY          ALL -TCB
+CAPABILITY      EUNIT_CAPS
+
+
+//ECOM RESOURCE
+START RESOURCE      pr_prfwtestprotocol.rss
+TARGET              pr_prfwtestprotocol.rsc
+END                 // RESOURCE
+
+SOURCEPATH          .
+SOURCE              pr_prfwtestprotocol.cpp
+
+SOURCEPATH          ../../tsrcutils/testcaseutils
+SOURCE              prfwtestfilelogichelper.cpp
+SOURCE              prfwtestfiletool.cpp
+
+USERINCLUDE             ../../../core/srcdatamodel
+USERINCLUDE             ../../../presence/srcpresencedatamodel
+USERINCLUDE             ../../../presence/srcpresencedatamodel/presentitygroups
+USERINCLUDE             ../../../presence/srcpresencedatamodel/presencewatching
+USERINCLUDE             ../../../presence/srcpresencedatamodel/presenceauthorization
+USERINCLUDE             ../../../presence/srcpresencedatamodel/presencepublishing
+USERINCLUDE             ../../../presence/srcpresencedatamodel/presenceinfo
+USERINCLUDE             ../../../core/srcutils
+USERINCLUDE             ../../tsrcprotocols
+USERINCLUDE             ../../tsrcutils/testcaseutils
+
+// TODO remove unnecessary
+SYSTEMINCLUDE           ../../../inc/core/base
+SYSTEMINCLUDE           ../../../inc/core/datamodel
+SYSTEMINCLUDE           ../../../inc/core/protocolplugin
+SYSTEMINCLUDE           ../../../inc/core/protocolpluginhost
+SYSTEMINCLUDE           ../../../inc/presence/presencedatamodel
+SYSTEMINCLUDE           ../../../inc/presence/presencemanagement
+SYSTEMINCLUDE           ../../../inc/presence/presenceprotocolplugin
+SYSTEMINCLUDE           ../../../inc/presence/presenceprotocolpluginhost
+
+#if defined ( OS_LAYER_SYSTEMINCLUDE )
+OS_LAYER_SYSTEMINCLUDE
+#else
+SYSTEMINCLUDE     /epoc32/include
+#endif
+
+ #if defined ( APP_LAYER_SYSTEMINCLUDE )
+ APP_LAYER_SYSTEMINCLUDE
+ #else
+ SYSTEMINCLUDE     \epoc32\include
+ #endif
+
+MW_LAYER_SYSTEMINCLUDE
+SYSTEMINCLUDE   /epoc32/include/ecom
+
+
+LIBRARY             euser.lib
+LIBRARY             ecom.lib
+LIBRARY             bafl.lib
+LIBRARY             estor.lib
+LIBRARY             efsrv.lib
+LIBRARY             flogger.lib
+
+LIBRARY             ximpdatamodel.lib
+LIBRARY             presencedatamodel.lib
+LIBRARY             ximputils.lib
+LIBRARY             prfwtestcaseutils.lib
+
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/tsrc/tsrcprotocols/pr_prfwtestprotocol/pr_prfwtestprotocol.rss	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  ECOM registery info for Presence Framework Test Protocol
+*
+*/
+
+#include <ecom/registryinfov2.rh>
+#include <ximpprotocolpluginifids.hrh>
+
+#include "prfwtestprotocols_resource.hrh"
+
+
+
+// ---------------------------------------------------------------------------
+// ECOM registery info for Presence Framework ECOM hook
+// ---------------------------------------------------------------------------
+//
+RESOURCE REGISTRY_INFO theInfo
+    {
+    resource_format_version = RESOURCE_FORMAT_VERSION_2;
+    dll_uid = PRFW_DLL_UID_PR_PRFWTESTPROTOCOL;
+
+    interfaces =
+        {
+        INTERFACE_INFO
+            {
+            interface_uid = XIMP_ECOM_IF_UID_PROTOCOL_PLUGIN_BASE_INTERFACE;
+
+            implementations =
+                {
+                IMPLEMENTATION_INFO
+                    {
+                    implementation_uid = PRFW_TST_PROTOCOL_1_IMPLEMENTATION_UID;
+                    version_no         = PRFW_TST_PROTOCOL_1_VERSION_NO;
+                    display_name       = PRFW_TST_PROTOCOL_1_DISPLAY_NAME;
+                    default_data       = PRFW_TST_PROTOCOL_1_DEFAULT_DATA;
+                    opaque_data        = PRFW_TST_PROTOCOL_1_OPAQUE_DATA;
+                    }
+                };
+            }
+        };
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/tsrc/tsrcprotocols/prfwtestprotocols.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,49 @@
+/*
+* 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:  XIMP Framework Test Code 
+*
+*/
+
+#ifndef PRFWTESTPROTOCOLS_H
+#define PRFWTESTPROTOCOLS_H
+
+#include <e32std.h>
+
+
+/**
+ * C++ compatible definitions for XIMP test protocols.
+ *
+ * This must be kept in-sync with definitions in
+ * "prfwtestprotocols_resource.hrh"
+ */
+
+//XIMP primary test protocol
+const TInt K_PRFW_TST_PROTOCOL_1_IMPLEMENTATION_UID  = 0x10282DDF;
+const TInt K_PRFW_TST_PROTOCOL_1_VERSION_NO          = 1;
+_LIT( K_PRFW_TST_PROTOCOL_1_DISPLAY_NAME,            "XIMP primary test protocol" );
+_LIT( K_PRFW_TST_PROTOCOL_1_DEFAULT_DATA,            "" );
+_LIT( K_PRFW_TST_PROTOCOL_1_OPAQUE_DATA,             "<p>Nokia<f>feat/pres/pub<f>feat/pres/fetch<f>feat/pres/subs<s>sip" );
+
+
+
+//XIMP secondary test protocols
+const TInt K_PRFW_TST_PROTOCOL_2_IMPLEMENTATION_UID  = 0x10282DE0;
+const TInt K_PRFW_TST_PROTOCOL_3_IMPLEMENTATION_UID  = 0x10282DE1;
+const TInt K_PRFW_TST_PROTOCOL_4_IMPLEMENTATION_UID  = 0x10282DE2;
+const TInt K_PRFW_TST_PROTOCOL_5_IMPLEMENTATION_UID  = 0x10282DE3;
+
+
+
+#endif // PRFWTESTPROTOCOLS_H
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/tsrc/tsrcprotocols/prfwtestprotocols_resource.hrh	Wed Nov 03 09:32:20 2010 +0530
@@ -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: XIMP Framework Test Code 
+*
+*/
+
+#ifndef PRFWTESTPROTOCOLS_RESOURCE_HRH
+#define PRFWTESTPROTOCOLS_RESOURCE_HRH
+
+
+
+/**
+ * System wide UID 2:s for ECom plugin dlls.
+ */
+#define XIMP_DLL_UID_ECOM_PLUGIN                    0x10009D8D
+
+
+/**
+ * Officially reserved UID 3 for the Presence Framework
+ * test protocol dll.
+ */
+#define PRFW_DLL_UID_PR_PRFWTESTPROTOCOL            0x10282DDD
+
+
+
+/**
+ * Resource file compatible defintions for PrFw test protocols.
+ *
+ * This must be kept in-sync with definitions in
+ * "prfwtestprotocols.h"
+ */
+
+//PrFw primary test protocol
+#define PRFW_TST_PROTOCOL_1_IMPLEMENTATION_UID      0x10282DDF
+#define PRFW_TST_PROTOCOL_1_VERSION_NO              1
+#define PRFW_TST_PROTOCOL_1_DISPLAY_NAME            "PrFw primary test protocol"
+#define PRFW_TST_PROTOCOL_1_DEFAULT_DATA            ""
+#define PRFW_TST_PROTOCOL_1_OPAQUE_DATA             "<p>Nokia<f>feat/pres/pub<f>feat/pres/fetch<f>feat/pres/subs<s>sip"
+
+
+
+//PrFw secondary test protocols
+#define PRFW_TST_PROTOCOL_2_IMPLEMENTATION_UID      0x10282DE0
+#define PRFW_TST_PROTOCOL_3_IMPLEMENTATION_UID      0x10282DE1
+#define PRFW_TST_PROTOCOL_4_IMPLEMENTATION_UID      0x10282DE2
+#define PRFW_TST_PROTOCOL_5_IMPLEMENTATION_UID      0x10282DE3
+
+
+
+#endif // PRFWTESTPROTOCOLS_RESOURCE_HRH
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/tsrc/tsrcutils/bld.inf	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,22 @@
+/*
+* 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 prfwtestcaseutils.dll
+*
+*/
+
+
+#include "testcaseutils/bld.inf"
+#include "processmaster/bld.inf"
+
+//#include "eunitcommon/move_tests_to_eunit.inf"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/tsrc/tsrcutils/bwins/prfwtestcaseutilsu.def	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,113 @@
+EXPORTS
+	??0TXIMPTestStatusEventSnapshot@@QAE@HHH@Z @ 1 NONAME ; TXIMPTestStatusEventSnapshot::TXIMPTestStatusEventSnapshot(int, int, int)
+	??0TXIMPTestStatusEventSnapshot@@QAE@XZ @ 2 NONAME ; TXIMPTestStatusEventSnapshot::TXIMPTestStatusEventSnapshot(void)
+	?AcceptedEventTypes@CXIMPTestStatusEventListener@@QAEAAV?$RArray@J@@XZ @ 3 NONAME ; class RArray<long> & CXIMPTestStatusEventListener::AcceptedEventTypes(void)
+	?AppendToTraitsL@CXIMPTestContextWrapper@@QAEXW4TXIMPTestStatusEventTemplate@@@Z @ 4 NONAME ; void CXIMPTestContextWrapper::AppendToTraitsL(enum TXIMPTestStatusEventTemplate)
+	?AssertAddPresentityGroupMemberCalled@CXIMPTestMessenger@@QAEXH@Z @ 5 NONAME ; void CXIMPTestMessenger::AssertAddPresentityGroupMemberCalled(int)
+	?AssertCloseSessionCalled@CXIMPTestMessenger@@QAEXH@Z @ 6 NONAME ; void CXIMPTestMessenger::AssertCloseSessionCalled(int)
+	?AssertCreatePresentityGroupCalled@CXIMPTestMessenger@@QAEXH@Z @ 7 NONAME ; void CXIMPTestMessenger::AssertCreatePresentityGroupCalled(int)
+	?AssertEquality@XIMPTestPresenceDataUtils@@SAXAAVMPresenceInfo@@0@Z @ 8 NONAME ; void XIMPTestPresenceDataUtils::AssertEquality(class MPresenceInfo &, class MPresenceInfo &)
+	?AssertOpenSessionCalled@CXIMPTestMessenger@@QAEXH@Z @ 9 NONAME ; void CXIMPTestMessenger::AssertOpenSessionCalled(int)
+	?AssertPluginDied@CXIMPTestMessenger@@QAEXH@Z @ 10 NONAME ; void CXIMPTestMessenger::AssertPluginDied(int)
+	?AssertRemovePresentityGroupMemberCalled@CXIMPTestMessenger@@QAEXH@Z @ 11 NONAME ; void CXIMPTestMessenger::AssertRemovePresentityGroupMemberCalled(int)
+	?AssertShareSessionCalled@CXIMPTestMessenger@@QAEXH@Z @ 12 NONAME ; void CXIMPTestMessenger::AssertShareSessionCalled(int)
+	?AssertSubscribePresentityGroupContentCalled@CXIMPTestMessenger@@QAEXH@Z @ 13 NONAME ; void CXIMPTestMessenger::AssertSubscribePresentityGroupContentCalled(int)
+	?AssertSubscribePresentityGroupListCalled@CXIMPTestMessenger@@QAEXH@Z @ 14 NONAME ; void CXIMPTestMessenger::AssertSubscribePresentityGroupListCalled(int)
+	?AssertUnshareSessionCalled@CXIMPTestMessenger@@QAEXH@Z @ 15 NONAME ; void CXIMPTestMessenger::AssertUnshareSessionCalled(int)
+	?AssertUnsubscribePresentityGroupContentCalled@CXIMPTestMessenger@@QAEXH@Z @ 16 NONAME ; void CXIMPTestMessenger::AssertUnsubscribePresentityGroupContentCalled(int)
+	?AssertUnsubscribePresentityGroupListCalled@CXIMPTestMessenger@@QAEXH@Z @ 17 NONAME ; void CXIMPTestMessenger::AssertUnsubscribePresentityGroupListCalled(int)
+	?AssertUpdatePresentityGroupDisplayNameCalled@CXIMPTestMessenger@@QAEXH@Z @ 18 NONAME ; void CXIMPTestMessenger::AssertUpdatePresentityGroupDisplayNameCalled(int)
+	?AssertUpdatePresentityGroupMemberDisplayNameCalled@CXIMPTestMessenger@@QAEXH@Z @ 19 NONAME ; void CXIMPTestMessenger::AssertUpdatePresentityGroupMemberDisplayNameCalled(int)
+	?BindL@CXIMPTestContextWrapper@@QAEXH@Z @ 20 NONAME ; void CXIMPTestContextWrapper::BindL(int)
+	?BindL@CXIMPTestContextWrapper@@QAEXVTUid@@ABVTDesC16@@11@Z @ 21 NONAME ; void CXIMPTestContextWrapper::BindL(class TUid, class TDesC16 const &, class TDesC16 const &, class TDesC16 const &)
+	?BindWithSettingsL@CXIMPTestContextWrapper@@QAEXH@Z @ 22 NONAME ; void CXIMPTestContextWrapper::BindWithSettingsL(int)
+	?CleanAllL@CXIMPTestFileTool@@SAXXZ @ 23 NONAME ; void CXIMPTestFileTool::CleanAllL(void)
+	?ClearListener@CXIMPTestContextWrapper@@QAEXXZ @ 24 NONAME ; void CXIMPTestContextWrapper::ClearListener(void)
+	?CommonAssert@CXIMPTestMessenger@@ABEXW4TXIMPTestPropertyKeys@@HABVTDesC8@@1@Z @ 25 NONAME ; void CXIMPTestMessenger::CommonAssert(enum TXIMPTestPropertyKeys, int, class TDesC8 const &, class TDesC8 const &) const
+	?Contains@XIMPTestPresenceDataUtils@@QBEHAAVMPresenceInfo@@0@Z @ 26 NONAME ; int XIMPTestPresenceDataUtils::Contains(class MPresenceInfo &, class MPresenceInfo &) const
+	?CreateGroupContentEventLCX@XIMPTestEventFactory@@SAPAVCPresentityGroupContentEventImp@@ABVTDesC16@@00W4TTestPGLContentArraySpecifier@1@00W4TSubscriptionState@MXIMPDataSubscriptionState@@W4TDataState@6@@Z @ 27 NONAME ; class CPresentityGroupContentEventImp * XIMPTestEventFactory::CreateGroupContentEventLCX(class TDesC16 const &, class TDesC16 const &, class TDesC16 const &, enum XIMPTestEventFactory::TTestPGLContentArraySpecifier, class TDesC16 const &, class TDesC16 const &, enum MXIMPDataSubscriptionState::TSubscriptionState, enum MXIMPDataSubscriptionState::TDataState)
+	?CreateGroupListEventLCX@XIMPTestEventFactory@@SAPAVCPresentityGroupListEventImp@@ABVTDesC16@@0W4TTestPGLArraySpecifier@1@00W4TSubscriptionState@MXIMPDataSubscriptionState@@W4TDataState@6@@Z @ 28 NONAME ; class CPresentityGroupListEventImp * XIMPTestEventFactory::CreateGroupListEventLCX(class TDesC16 const &, class TDesC16 const &, enum XIMPTestEventFactory::TTestPGLArraySpecifier, class TDesC16 const &, class TDesC16 const &, enum MXIMPDataSubscriptionState::TSubscriptionState, enum MXIMPDataSubscriptionState::TDataState)
+	?CreateWrapperL@CXIMPTestContextWrapperMgr@@QAEXH@Z @ 29 NONAME ; void CXIMPTestContextWrapperMgr::CreateWrapperL(int)
+	?DeletePresenceContext@CXIMPTestContextWrapper@@QAEXXZ @ 30 NONAME ; void CXIMPTestContextWrapper::DeletePresenceContext(void)
+	?DeletePubSubKeys@CXIMPTestMessenger@@QAEXXZ @ 31 NONAME ; void CXIMPTestMessenger::DeletePubSubKeys(void)
+	?Equals@TXIMPTestStatusEventSnapshot@@QBEHABV1@@Z @ 32 NONAME ; int TXIMPTestStatusEventSnapshot::Equals(class TXIMPTestStatusEventSnapshot const &) const
+	?Equals@XIMPTestPresenceDataUtils@@QBEHAAVCPresenceInfoImp@@0@Z @ 33 NONAME ; int XIMPTestPresenceDataUtils::Equals(class CPresenceInfoImp &, class CPresenceInfoImp &) const
+	?ExpectL@CXIMPTestListener@@QAEXPAVCXIMPApiObjBase@@@Z @ 34 NONAME ; void CXIMPTestListener::ExpectL(class CXIMPApiObjBase *)
+	?ExternalizeL@CXIMPTestFileSrvMsg@@QBEXAAVRWriteStream@@@Z @ 35 NONAME ; void CXIMPTestFileSrvMsg::ExternalizeL(class RWriteStream &) const
+	?FileTool@CXIMPTestContextWrapper@@QBEAAVCXIMPTestFileTool@@XZ @ 36 NONAME ; class CXIMPTestFileTool & CXIMPTestContextWrapper::FileTool(void) const
+	?GenerateIdentityLC@XIMPTestPresenceDataUtils@@SAPAVCXIMPIdentityImp@@PBVTDesC8@@W4TPresenceDataGroup@1@@Z @ 37 NONAME ; class CXIMPIdentityImp * XIMPTestPresenceDataUtils::GenerateIdentityLC(class TDesC8 const *, enum XIMPTestPresenceDataUtils::TPresenceDataGroup)
+	?GenerateInfoFilterLC@XIMPTestPresenceDataUtils@@SAPAVCPresenceInfoFilterImp@@PBVTDesC8@@W4TPresenceDataGroup@1@@Z @ 38 NONAME ; class CPresenceInfoFilterImp * XIMPTestPresenceDataUtils::GenerateInfoFilterLC(class TDesC8 const *, enum XIMPTestPresenceDataUtils::TPresenceDataGroup)
+	?GenerateInfoLC@XIMPTestPresenceDataUtils@@SAPAVCPresenceInfoImp@@PBVTDesC8@@W4TPresenceDataGroup@1@@Z @ 39 NONAME ; class CPresenceInfoImp * XIMPTestPresenceDataUtils::GenerateInfoLC(class TDesC8 const *, enum XIMPTestPresenceDataUtils::TPresenceDataGroup)
+	?GetBoolean@CXIMPTestMessenger@@QBEHW4TXIMPTestPropertyKeys@@@Z @ 40 NONAME ; int CXIMPTestMessenger::GetBoolean(enum TXIMPTestPropertyKeys) const
+	?GetClient@CXIMPTestContextWrapper@@QAEPAVMXIMPClient@@XZ @ 41 NONAME ; class MXIMPClient * CXIMPTestContextWrapper::GetClient(void)
+	?GetContext@CXIMPTestContextWrapper@@QAEPAVMXIMPContext@@XZ @ 42 NONAME ; class MXIMPContext * CXIMPTestContextWrapper::GetContext(void)
+	?GetError@CXIMPTestMessenger@@QAEHXZ @ 43 NONAME ; int CXIMPTestMessenger::GetError(void)
+	?GetEventListener@CXIMPTestContextWrapper@@QAEPAVCXIMPTestStatusEventListener@@XZ @ 44 NONAME ; class CXIMPTestStatusEventListener * CXIMPTestContextWrapper::GetEventListener(void)
+	?GetEventTemplateL@CXIMPTestStatusEventListener@@QAEXAAV?$RArray@VTXIMPTestStatusEventSnapshot@@@@W4TXIMPTestStatusEventTemplate@@@Z @ 45 NONAME ; void CXIMPTestStatusEventListener::GetEventTemplateL(class RArray<class TXIMPTestStatusEventSnapshot> &, enum TXIMPTestStatusEventTemplate)
+	?GetLeave@CXIMPTestMessenger@@QAEHXZ @ 46 NONAME ; int CXIMPTestMessenger::GetLeave(void)
+	?GetMessenger@CXIMPTestContextWrapper@@QAEPAVCXIMPTestMessenger@@XZ @ 47 NONAME ; class CXIMPTestMessenger * CXIMPTestContextWrapper::GetMessenger(void)
+	?GetPluginIndex@CXIMPTestMessenger@@SAHXZ @ 48 NONAME ; int CXIMPTestMessenger::GetPluginIndex(void)
+	?GetPresenceFeatures@CXIMPTestContextWrapper@@QAEPAVMPresenceFeatures@@XZ @ 49 NONAME ; class MPresenceFeatures * CXIMPTestContextWrapper::GetPresenceFeatures(void)
+	?GetReqCompleteParams@CXIMPTestMessenger@@QAEPAVMXIMPRestrictedObjectCollection@@XZ @ 50 NONAME ; class MXIMPRestrictedObjectCollection * CXIMPTestMessenger::GetReqCompleteParams(void)
+	?GetReqCompletionErrL@CXIMPTestStatusEventListener@@QBEHABVTXIMPRequestId@@@Z @ 51 NONAME ; int CXIMPTestStatusEventListener::GetReqCompletionErrL(class TXIMPRequestId const &) const
+	?GetStatusTraits@CXIMPTestContextWrapper@@QAEPAV?$RArray@VTXIMPTestStatusEventSnapshot@@@@XZ @ 52 NONAME ; class RArray<class TXIMPTestStatusEventSnapshot> * CXIMPTestContextWrapper::GetStatusTraits(void)
+	?GetValueFor@CXIMPTestMessenger@@QBEHW4TXIMPTestPropertyKeys@@@Z @ 53 NONAME ; int CXIMPTestMessenger::GetValueFor(enum TXIMPTestPropertyKeys) const
+	?GetWrapperL@CXIMPTestContextWrapperMgr@@QAEPAVCXIMPTestContextWrapper@@H@Z @ 54 NONAME ; class CXIMPTestContextWrapper * CXIMPTestContextWrapperMgr::GetWrapperL(int)
+	?HandleLeaveL@CXIMPTestMessenger@@QAEXXZ @ 55 NONAME ; void CXIMPTestMessenger::HandleLeaveL(void)
+	?InsertPrefixL@XIMPTestPresenceDataUtils@@SAXPBVTDesC8@@AAVRBuf8@@@Z @ 56 NONAME ; void XIMPTestPresenceDataUtils::InsertPrefixL(class TDesC8 const *, class RBuf8 &)
+	?InstanceId@CXIMPTestContextWrapper@@QBEABVTDesC16@@XZ @ 57 NONAME ; class TDesC16 const & CXIMPTestContextWrapper::InstanceId(void) const
+	?InstanceId@CXIMPTestFileTool@@QBEABVTDesC16@@XZ @ 58 NONAME ; class TDesC16 const & CXIMPTestFileTool::InstanceId(void) const
+	?InternalizeL@CXIMPTestFileSrvMsg@@QAEXAAVRReadStream@@@Z @ 59 NONAME ; void CXIMPTestFileSrvMsg::InternalizeL(class RReadStream &)
+	?NewForAdaptationSideL@CXIMPTestMessenger@@SAPAV1@H@Z @ 60 NONAME ; class CXIMPTestMessenger * CXIMPTestMessenger::NewForAdaptationSideL(int)
+	?NewForClientSideL@CXIMPTestMessenger@@SAPAV1@H@Z @ 61 NONAME ; class CXIMPTestMessenger * CXIMPTestMessenger::NewForClientSideL(int)
+	?NewL@CXIMPTestContextWrapper@@SAPAV1@HPAVMXIMPClient@@@Z @ 62 NONAME ; class CXIMPTestContextWrapper * CXIMPTestContextWrapper::NewL(int, class MXIMPClient *)
+	?NewL@CXIMPTestContextWrapperMgr@@SAPAV1@XZ @ 63 NONAME ; class CXIMPTestContextWrapperMgr * CXIMPTestContextWrapperMgr::NewL(void)
+	?NewL@CXIMPTestFileSrvMsg@@SAPAV1@HABVTDesC8@@@Z @ 64 NONAME ; class CXIMPTestFileSrvMsg * CXIMPTestFileSrvMsg::NewL(int, class TDesC8 const &)
+	?NewL@CXIMPTestFileTool@@SAPAV1@KABVTDesC16@@@Z @ 65 NONAME ; class CXIMPTestFileTool * CXIMPTestFileTool::NewL(unsigned long, class TDesC16 const &)
+	?NewL@CXIMPTestFileTool@@SAPAV1@KH@Z @ 66 NONAME ; class CXIMPTestFileTool * CXIMPTestFileTool::NewL(unsigned long, int)
+	?NewL@CXIMPTestGeneralWaiter@@SAPAV1@PAVT_MWaitObserver@@@Z @ 67 NONAME ; class CXIMPTestGeneralWaiter * CXIMPTestGeneralWaiter::NewL(class T_MWaitObserver *)
+	?NewL@CXIMPTestListener@@SAPAV1@PAVMXIMPContext@@@Z @ 68 NONAME ; class CXIMPTestListener * CXIMPTestListener::NewL(class MXIMPContext *)
+	?NewL@CXIMPTestStatusEventListener@@SAPAV1@HPAVMXIMPContext@@@Z @ 69 NONAME ; class CXIMPTestStatusEventListener * CXIMPTestStatusEventListener::NewL(int, class MXIMPContext *)
+	?NewL@CXIMPTestWaitHelper@@SAPAV1@XZ @ 70 NONAME ; class CXIMPTestWaitHelper * CXIMPTestWaitHelper::NewL(void)
+	?NewLC@CXIMPTestFileSrvMsg@@SAPAV1@XZ @ 71 NONAME ; class CXIMPTestFileSrvMsg * CXIMPTestFileSrvMsg::NewLC(void)
+	?NumObjectsL@CXIMPTestFileTool@@QAEHXZ @ 72 NONAME ; int CXIMPTestFileTool::NumObjectsL(void)
+	?NumSrvMsgL@CXIMPTestFileTool@@QAEHXZ @ 73 NONAME ; int CXIMPTestFileTool::NumSrvMsgL(void)
+	?PayloadL@CXIMPTestFileSrvMsg@@QAEAAVTDesC8@@XZ @ 74 NONAME ; class TDesC8 & CXIMPTestFileSrvMsg::PayloadL(void)
+	?PluginRestoreLC@CXIMPTestFileTool@@QAEPAVCXIMPApiEventBase@@H@Z @ 75 NONAME ; class CXIMPApiEventBase * CXIMPTestFileTool::PluginRestoreLC(int)
+	?PluginStoreL@CXIMPTestFileTool@@QAEXABVTDesC8@@@Z @ 76 NONAME ; void CXIMPTestFileTool::PluginStoreL(class TDesC8 const &)
+	?PrepareL@CXIMPTestFileTool@@QAEXXZ @ 77 NONAME ; void CXIMPTestFileTool::PrepareL(void)
+	?ReRegisterEventFilterL@CXIMPTestStatusEventListener@@QAEXXZ @ 78 NONAME ; void CXIMPTestStatusEventListener::ReRegisterEventFilterL(void)
+	?Reset@CXIMPTestListener@@QAEXXZ @ 79 NONAME ; void CXIMPTestListener::Reset(void)
+	?ResetEventStack@CXIMPTestStatusEventListener@@QAEXXZ @ 80 NONAME ; void CXIMPTestStatusEventListener::ResetEventStack(void)
+	?ResetEventTypeStack@CXIMPTestStatusEventListener@@QAEXXZ @ 81 NONAME ; void CXIMPTestStatusEventListener::ResetEventTypeStack(void)
+	?ResetListener@CXIMPTestContextWrapper@@QAEXXZ @ 82 NONAME ; void CXIMPTestContextWrapper::ResetListener(void)
+	?ResetPubSub@CXIMPTestMessenger@@QAEXXZ @ 83 NONAME ; void CXIMPTestMessenger::ResetPubSub(void)
+	?SetBoolean@CXIMPTestMessenger@@QAEXW4TXIMPTestPropertyKeys@@@Z @ 84 NONAME ; void CXIMPTestMessenger::SetBoolean(enum TXIMPTestPropertyKeys)
+	?SetError@CXIMPTestMessenger@@QAEXH@Z @ 85 NONAME ; void CXIMPTestMessenger::SetError(int)
+	?SetEventObserver@CXIMPTestListener@@QAEXPAVMXIMPContextObserver@@@Z @ 86 NONAME ; void CXIMPTestListener::SetEventObserver(class MXIMPContextObserver *)
+	?SetEventObserver@CXIMPTestStatusEventListener@@QAEXPAVMXIMPContextObserver@@@Z @ 87 NONAME ; void CXIMPTestStatusEventListener::SetEventObserver(class MXIMPContextObserver *)
+	?SetEventSourceL@CXIMPTestListener@@QAEXPAVMXIMPContext@@@Z @ 88 NONAME ; void CXIMPTestListener::SetEventSourceL(class MXIMPContext *)
+	?SetEventSourceL@CXIMPTestStatusEventListener@@QAEXPAVMXIMPContext@@@Z @ 89 NONAME ; void CXIMPTestStatusEventListener::SetEventSourceL(class MXIMPContext *)
+	?SetLeave@CXIMPTestMessenger@@QAEXH@Z @ 90 NONAME ; void CXIMPTestMessenger::SetLeave(int)
+	?SetNoError@CXIMPTestMessenger@@QAEXXZ @ 91 NONAME ; void CXIMPTestMessenger::SetNoError(void)
+	?SetPluginIndex@CXIMPTestMessenger@@QAEXH@Z @ 92 NONAME ; void CXIMPTestMessenger::SetPluginIndex(int)
+	?SetReqCompleteParams@CXIMPTestMessenger@@QAEXPAVMXIMPRestrictedObjectCollection@@@Z @ 93 NONAME ; void CXIMPTestMessenger::SetReqCompleteParams(class MXIMPRestrictedObjectCollection *)
+	?SetValueFor@CXIMPTestMessenger@@QAEXW4TXIMPTestPropertyKeys@@H@Z @ 94 NONAME ; void CXIMPTestMessenger::SetValueFor(enum TXIMPTestPropertyKeys, int)
+	?SetupEmptyListener@CXIMPTestContextWrapper@@QAEXXZ @ 95 NONAME ; void CXIMPTestContextWrapper::SetupEmptyListener(void)
+	?SetupListenerL@CXIMPTestContextWrapper@@QAEXW4TXIMPTestStatusEventTemplate@@@Z @ 96 NONAME ; void CXIMPTestContextWrapper::SetupListenerL(enum TXIMPTestStatusEventTemplate)
+	?SetupListenerReqCompleteL@CXIMPTestContextWrapper@@QAEXW4TXIMPTestStatusEventTemplate@@PAV?$RArray@J@@@Z @ 97 NONAME ; void CXIMPTestContextWrapper::SetupListenerReqCompleteL(enum TXIMPTestStatusEventTemplate, class RArray<long> *)
+	?SrvMsgId@CXIMPTestFileSrvMsg@@QAEHXZ @ 98 NONAME ; int CXIMPTestFileSrvMsg::SrvMsgId(void)
+	?SrvMsgRestoreLC@CXIMPTestFileTool@@QAEPAVCXIMPTestFileSrvMsg@@H@Z @ 99 NONAME ; class CXIMPTestFileSrvMsg * CXIMPTestFileTool::SrvMsgRestoreLC(int)
+	?SrvMsgStoreL@CXIMPTestFileTool@@QAEXPAVCXIMPTestFileSrvMsg@@@Z @ 100 NONAME ; void CXIMPTestFileTool::SrvMsgStoreL(class CXIMPTestFileSrvMsg *)
+	?UnbindL@CXIMPTestContextWrapper@@QAEXXZ @ 101 NONAME ; void CXIMPTestContextWrapper::UnbindL(void)
+	?VerifyEventStackL@CXIMPTestContextWrapper@@QAEXABVTPtrC8@@@Z @ 102 NONAME ; void CXIMPTestContextWrapper::VerifyEventStackL(class TPtrC8 const &)
+	?VerifyEventStackL@CXIMPTestStatusEventListener@@QBEXABV?$TArray@VTXIMPTestStatusEventSnapshot@@@@ABVTDesC8@@@Z @ 103 NONAME ; void CXIMPTestStatusEventListener::VerifyEventStackL(class TArray<class TXIMPTestStatusEventSnapshot> const &, class TDesC8 const &) const
+	?WaitAndAssertL@CXIMPTestListener@@QAEHXZ @ 104 NONAME ; int CXIMPTestListener::WaitAndAssertL(void)
+	?WaitAnyEvent@CXIMPTestContextWrapper@@QAEXXZ @ 105 NONAME ; void CXIMPTestContextWrapper::WaitAnyEvent(void)
+	?WaitAnyEvent@CXIMPTestStatusEventListener@@QAEXXZ @ 106 NONAME ; void CXIMPTestStatusEventListener::WaitAnyEvent(void)
+	?WaitForL@CXIMPTestGeneralWaiter@@QAEXH@Z @ 107 NONAME ; void CXIMPTestGeneralWaiter::WaitForL(int)
+	?WaitForL@CXIMPTestWaitHelper@@QAEXH@Z @ 108 NONAME ; void CXIMPTestWaitHelper::WaitForL(int)
+	?WaitRequestAndStackEvents@CXIMPTestContextWrapper@@QAEXVTXIMPRequestId@@@Z @ 109 NONAME ; void CXIMPTestContextWrapper::WaitRequestAndStackEvents(class TXIMPRequestId)
+	?WaitRequestAndStackEvents@CXIMPTestStatusEventListener@@QAEXABVTXIMPRequestId@@H@Z @ 110 NONAME ; void CXIMPTestStatusEventListener::WaitRequestAndStackEvents(class TXIMPRequestId const &, int)
+	?WrapperCount@CXIMPTestContextWrapperMgr@@QBEHXZ @ 111 NONAME ; int CXIMPTestContextWrapperMgr::WrapperCount(void) const
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/tsrc/tsrcutils/eabi/prfwtestcaseutilsu.def	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,132 @@
+EXPORTS
+	_ZN17CXIMPTestFileTool10NumSrvMsgLEv @ 1 NONAME
+	_ZN17CXIMPTestFileTool11NumObjectsLEv @ 2 NONAME
+	_ZN17CXIMPTestFileTool12PluginStoreLERK6TDesC8 @ 3 NONAME
+	_ZN17CXIMPTestFileTool12SrvMsgStoreLEP19CXIMPTestFileSrvMsg @ 4 NONAME
+	_ZN17CXIMPTestFileTool15PluginRestoreLCEi @ 5 NONAME
+	_ZN17CXIMPTestFileTool15SrvMsgRestoreLCEi @ 6 NONAME
+	_ZN17CXIMPTestFileTool4NewLEmRK7TDesC16 @ 7 NONAME
+	_ZN17CXIMPTestFileTool4NewLEmi @ 8 NONAME
+	_ZN17CXIMPTestFileTool8PrepareLEv @ 9 NONAME
+	_ZN17CXIMPTestFileTool9CleanAllLEv @ 10 NONAME
+	_ZN17CXIMPTestListener14WaitAndAssertLEv @ 11 NONAME
+	_ZN17CXIMPTestListener15SetEventSourceLEP12MXIMPContext @ 12 NONAME
+	_ZN17CXIMPTestListener16SetEventObserverEP20MXIMPContextObserver @ 13 NONAME
+	_ZN17CXIMPTestListener4NewLEP12MXIMPContext @ 14 NONAME
+	_ZN17CXIMPTestListener5ResetEv @ 15 NONAME
+	_ZN17CXIMPTestListener7ExpectLEP15CXIMPApiObjBase @ 16 NONAME
+	_ZN18CXIMPTestMessenger10SetBooleanE21TXIMPTestPropertyKeys @ 17 NONAME
+	_ZN18CXIMPTestMessenger10SetNoErrorEv @ 18 NONAME
+	_ZN18CXIMPTestMessenger11ResetPubSubEv @ 19 NONAME
+	_ZN18CXIMPTestMessenger11SetValueForE21TXIMPTestPropertyKeysi @ 20 NONAME
+	_ZN18CXIMPTestMessenger12HandleLeaveLEv @ 21 NONAME
+	_ZN18CXIMPTestMessenger14GetPluginIndexEv @ 22 NONAME
+	_ZN18CXIMPTestMessenger14SetPluginIndexEi @ 23 NONAME
+	_ZN18CXIMPTestMessenger16AssertPluginDiedEi @ 24 NONAME
+	_ZN18CXIMPTestMessenger16DeletePubSubKeysEv @ 25 NONAME
+	_ZN18CXIMPTestMessenger17NewForClientSideLEi @ 26 NONAME
+	_ZN18CXIMPTestMessenger20GetReqCompleteParamsEv @ 27 NONAME
+	_ZN18CXIMPTestMessenger20SetReqCompleteParamsEP31MXIMPRestrictedObjectCollection @ 28 NONAME
+	_ZN18CXIMPTestMessenger21NewForAdaptationSideLEi @ 29 NONAME
+	_ZN18CXIMPTestMessenger23AssertOpenSessionCalledEi @ 30 NONAME
+	_ZN18CXIMPTestMessenger24AssertCloseSessionCalledEi @ 31 NONAME
+	_ZN18CXIMPTestMessenger24AssertShareSessionCalledEi @ 32 NONAME
+	_ZN18CXIMPTestMessenger26AssertUnshareSessionCalledEi @ 33 NONAME
+	_ZN18CXIMPTestMessenger33AssertCreatePresentityGroupCalledEi @ 34 NONAME
+	_ZN18CXIMPTestMessenger36AssertAddPresentityGroupMemberCalledEi @ 35 NONAME
+	_ZN18CXIMPTestMessenger39AssertRemovePresentityGroupMemberCalledEi @ 36 NONAME
+	_ZN18CXIMPTestMessenger40AssertSubscribePresentityGroupListCalledEi @ 37 NONAME
+	_ZN18CXIMPTestMessenger42AssertUnsubscribePresentityGroupListCalledEi @ 38 NONAME
+	_ZN18CXIMPTestMessenger43AssertSubscribePresentityGroupContentCalledEi @ 39 NONAME
+	_ZN18CXIMPTestMessenger44AssertUpdatePresentityGroupDisplayNameCalledEi @ 40 NONAME
+	_ZN18CXIMPTestMessenger45AssertUnsubscribePresentityGroupContentCalledEi @ 41 NONAME
+	_ZN18CXIMPTestMessenger50AssertUpdatePresentityGroupMemberDisplayNameCalledEi @ 42 NONAME
+	_ZN18CXIMPTestMessenger8GetErrorEv @ 43 NONAME
+	_ZN18CXIMPTestMessenger8GetLeaveEv @ 44 NONAME
+	_ZN18CXIMPTestMessenger8SetErrorEi @ 45 NONAME
+	_ZN18CXIMPTestMessenger8SetLeaveEi @ 46 NONAME
+	_ZN19CXIMPTestFileSrvMsg12InternalizeLER11RReadStream @ 47 NONAME
+	_ZN19CXIMPTestFileSrvMsg4NewLEiRK6TDesC8 @ 48 NONAME
+	_ZN19CXIMPTestFileSrvMsg5NewLCEv @ 49 NONAME
+	_ZN19CXIMPTestFileSrvMsg8PayloadLEv @ 50 NONAME
+	_ZN19CXIMPTestFileSrvMsg8SrvMsgIdEv @ 51 NONAME
+	_ZN19CXIMPTestWaitHelper4NewLEv @ 52 NONAME
+	_ZN19CXIMPTestWaitHelper8WaitForLEi @ 53 NONAME
+	_ZN20XIMPTestEventFactory23CreateGroupListEventLCXERK7TDesC16S2_NS_22TTestPGLArraySpecifierES2_S2_N26MXIMPDataSubscriptionState18TSubscriptionStateENS4_10TDataStateE @ 54 NONAME
+	_ZN20XIMPTestEventFactory26CreateGroupContentEventLCXERK7TDesC16S2_S2_NS_29TTestPGLContentArraySpecifierES2_S2_N26MXIMPDataSubscriptionState18TSubscriptionStateENS4_10TDataStateE @ 55 NONAME
+	_ZN22CXIMPTestGeneralWaiter4NewLEP15T_MWaitObserver @ 56 NONAME
+	_ZN22CXIMPTestGeneralWaiter8WaitForLEi @ 57 NONAME
+	_ZN23CXIMPTestContextWrapper10GetContextEv @ 58 NONAME
+	_ZN23CXIMPTestContextWrapper12GetMessengerEv @ 59 NONAME
+	_ZN23CXIMPTestContextWrapper12WaitAnyEventEv @ 60 NONAME
+	_ZN23CXIMPTestContextWrapper13ClearListenerEv @ 61 NONAME
+	_ZN23CXIMPTestContextWrapper13ResetListenerEv @ 62 NONAME
+	_ZN23CXIMPTestContextWrapper14SetupListenerLE28TXIMPTestStatusEventTemplate @ 63 NONAME
+	_ZN23CXIMPTestContextWrapper15AppendToTraitsLE28TXIMPTestStatusEventTemplate @ 64 NONAME
+	_ZN23CXIMPTestContextWrapper15GetStatusTraitsEv @ 65 NONAME
+	_ZN23CXIMPTestContextWrapper16GetEventListenerEv @ 66 NONAME
+	_ZN23CXIMPTestContextWrapper17BindWithSettingsLEi @ 67 NONAME
+	_ZN23CXIMPTestContextWrapper17VerifyEventStackLERK6TPtrC8 @ 68 NONAME
+	_ZN23CXIMPTestContextWrapper18SetupEmptyListenerEv @ 69 NONAME
+	_ZN23CXIMPTestContextWrapper19GetPresenceFeaturesEv @ 70 NONAME
+	_ZN23CXIMPTestContextWrapper21DeletePresenceContextEv @ 71 NONAME
+	_ZN23CXIMPTestContextWrapper25SetupListenerReqCompleteLE28TXIMPTestStatusEventTemplateP6RArrayIlE @ 72 NONAME
+	_ZN23CXIMPTestContextWrapper25WaitRequestAndStackEventsE14TXIMPRequestId @ 73 NONAME
+	_ZN23CXIMPTestContextWrapper4NewLEiP11MXIMPClient @ 74 NONAME
+	_ZN23CXIMPTestContextWrapper5BindLE4TUidRK7TDesC16S3_S3_ @ 75 NONAME
+	_ZN23CXIMPTestContextWrapper5BindLEi @ 76 NONAME
+	_ZN23CXIMPTestContextWrapper7UnbindLEv @ 77 NONAME
+	_ZN23CXIMPTestContextWrapper9GetClientEv @ 78 NONAME
+	_ZN25XIMPTestPresenceDataUtils13InsertPrefixLEPK6TDesC8R5RBuf8 @ 79 NONAME
+	_ZN25XIMPTestPresenceDataUtils14AssertEqualityER13MPresenceInfoS1_ @ 80 NONAME
+	_ZN25XIMPTestPresenceDataUtils14GenerateInfoLCEPK6TDesC8NS_18TPresenceDataGroupE @ 81 NONAME
+	_ZN25XIMPTestPresenceDataUtils18GenerateIdentityLCEPK6TDesC8NS_18TPresenceDataGroupE @ 82 NONAME
+	_ZN25XIMPTestPresenceDataUtils20GenerateInfoFilterLCEPK6TDesC8NS_18TPresenceDataGroupE @ 83 NONAME
+	_ZN26CXIMPTestContextWrapperMgr11GetWrapperLEi @ 84 NONAME
+	_ZN26CXIMPTestContextWrapperMgr14CreateWrapperLEi @ 85 NONAME
+	_ZN26CXIMPTestContextWrapperMgr4NewLEv @ 86 NONAME
+	_ZN28CXIMPTestStatusEventListener12WaitAnyEventEv @ 87 NONAME
+	_ZN28CXIMPTestStatusEventListener15ResetEventStackEv @ 88 NONAME
+	_ZN28CXIMPTestStatusEventListener15SetEventSourceLEP12MXIMPContext @ 89 NONAME
+	_ZN28CXIMPTestStatusEventListener16SetEventObserverEP20MXIMPContextObserver @ 90 NONAME
+	_ZN28CXIMPTestStatusEventListener17GetEventTemplateLER6RArrayI28TXIMPTestStatusEventSnapshotE28TXIMPTestStatusEventTemplate @ 91 NONAME
+	_ZN28CXIMPTestStatusEventListener18AcceptedEventTypesEv @ 92 NONAME
+	_ZN28CXIMPTestStatusEventListener19ResetEventTypeStackEv @ 93 NONAME
+	_ZN28CXIMPTestStatusEventListener22ReRegisterEventFilterLEv @ 94 NONAME
+	_ZN28CXIMPTestStatusEventListener25WaitRequestAndStackEventsERK14TXIMPRequestIdi @ 95 NONAME
+	_ZN28CXIMPTestStatusEventListener4NewLEiP12MXIMPContext @ 96 NONAME
+	_ZN28TXIMPTestStatusEventSnapshotC1Eiii @ 97 NONAME
+	_ZN28TXIMPTestStatusEventSnapshotC1Ev @ 98 NONAME
+	_ZN28TXIMPTestStatusEventSnapshotC2Eiii @ 99 NONAME
+	_ZN28TXIMPTestStatusEventSnapshotC2Ev @ 100 NONAME
+	_ZNK17CXIMPTestFileTool10InstanceIdEv @ 101 NONAME
+	_ZNK18CXIMPTestMessenger10GetBooleanE21TXIMPTestPropertyKeys @ 102 NONAME
+	_ZNK18CXIMPTestMessenger11GetValueForE21TXIMPTestPropertyKeys @ 103 NONAME
+	_ZNK19CXIMPTestFileSrvMsg12ExternalizeLER12RWriteStream @ 104 NONAME
+	_ZNK23CXIMPTestContextWrapper10InstanceIdEv @ 105 NONAME
+	_ZNK23CXIMPTestContextWrapper8FileToolEv @ 106 NONAME
+	_ZNK25XIMPTestPresenceDataUtils6EqualsER16CPresenceInfoImpS1_ @ 107 NONAME
+	_ZNK25XIMPTestPresenceDataUtils8ContainsER13MPresenceInfoS1_ @ 108 NONAME
+	_ZNK26CXIMPTestContextWrapperMgr12WrapperCountEv @ 109 NONAME
+	_ZNK28CXIMPTestStatusEventListener17VerifyEventStackLERK6TArrayI28TXIMPTestStatusEventSnapshotERK6TDesC8 @ 110 NONAME
+	_ZNK28CXIMPTestStatusEventListener20GetReqCompletionErrLERK14TXIMPRequestId @ 111 NONAME
+	_ZNK28TXIMPTestStatusEventSnapshot6EqualsERKS_ @ 112 NONAME
+	_ZTI17CXIMPTestFileTool @ 113 NONAME ; #<TI>#
+	_ZTI17CXIMPTestListener @ 114 NONAME ; #<TI>#
+	_ZTI18CXIMPTestMessenger @ 115 NONAME ; #<TI>#
+	_ZTI19CXIMPTestFileSrvMsg @ 116 NONAME ; #<TI>#
+	_ZTI19CXIMPTestWaitHelper @ 117 NONAME ; #<TI>#
+	_ZTI22CXIMPTestGeneralWaiter @ 118 NONAME ; #<TI>#
+	_ZTI23CXIMPTestContextWrapper @ 119 NONAME ; #<TI>#
+	_ZTI26CXIMPTestContextWrapperMgr @ 120 NONAME ; #<TI>#
+	_ZTI28CXIMPTestStatusEventListener @ 121 NONAME ; #<TI>#
+	_ZTV17CXIMPTestFileTool @ 122 NONAME ; #<VT>#
+	_ZTV17CXIMPTestListener @ 123 NONAME ; #<VT>#
+	_ZTV18CXIMPTestMessenger @ 124 NONAME ; #<VT>#
+	_ZTV19CXIMPTestFileSrvMsg @ 125 NONAME ; #<VT>#
+	_ZTV19CXIMPTestWaitHelper @ 126 NONAME ; #<VT>#
+	_ZTV22CXIMPTestGeneralWaiter @ 127 NONAME ; #<VT>#
+	_ZTV23CXIMPTestContextWrapper @ 128 NONAME ; #<VT>#
+	_ZTV26CXIMPTestContextWrapperMgr @ 129 NONAME ; #<VT>#
+	_ZTV28CXIMPTestStatusEventListener @ 130 NONAME ; #<VT>#
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/tsrc/tsrcutils/eunitcommon/cglobalwaitingnote.h	Wed Nov 03 09:32:20 2010 +0530
@@ -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: XIMP Framework Test Code 
+*
+*/
+
+#ifndef CGLOBALWAITINGNOTE_H
+#define CGLOBALWAITINGNOTE_H
+
+// INCLUDES
+#include <e32base.h>
+#include <aknglobalprogressdialog.h>
+#include <avkon.rsg>
+
+
+
+/**
+ * Global waiting message for XIMP Framework Eunit tests.
+ */
+class CGlobalWaitingNote : public CActive
+    {
+    public:
+
+        /**
+         * Shows the waiting message with progress bar.
+         *
+         * @param aMessage The message text to show.
+         * @param aTotalShowTime The show time in milliseconds.
+         * @param aProgressSteps How many progress steps the progress bar should have.
+         */
+        inline static void ShowMsgL( const TDesC& aMessage,
+                                     TInt aTotalShowTime,
+                                     TInt aProgressSteps );
+
+
+    private:
+
+        inline CGlobalWaitingNote();
+        inline ~CGlobalWaitingNote();
+        inline void ConstructL();
+
+        inline void DoShowMsgL( const TDesC& aMessage,
+                                TInt aTotalShowTime,
+                                TInt aProgressSteps );
+
+        inline static TInt ProgressTickCb( TAny* aSelf );
+        inline TInt HandleProgressTick();
+
+        inline void RunL();
+        inline TInt RunError( TInt aError );
+        inline void DoCancel();
+
+
+
+    private: //data
+
+        //OWN: Active Scheduler wait
+        CActiveSchedulerWait    iWait;
+
+        //OWN: Progress ticker
+        CPeriodic*  iProgressTicker;
+
+        //OWN: The global note.
+        CAknGlobalProgressDialog*   iGlobalNote;
+
+        //OWN: Total show time
+        TInt iTotalShowTime;
+
+        //OWN: Progress interval
+        TInt iProgressInterval;
+
+        //OWN: Current progress value
+        TInt iCurrentProgress;
+    };
+
+
+
+
+
+// -----------------------------------------------------------------------------
+// CGlobalWaitingNote public functions
+// -----------------------------------------------------------------------------
+//
+void CGlobalWaitingNote::ShowMsgL( const TDesC& aMessage,
+                                   TInt aTotalShowTime,
+                                   TInt aProgressSteps )
+    {
+    CGlobalWaitingNote* self = new (ELeave) CGlobalWaitingNote;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    self->DoShowMsgL( aMessage,
+                      aTotalShowTime,
+                      aProgressSteps );
+
+    CleanupStack::PopAndDestroy();
+    }
+
+
+
+// -----------------------------------------------------------------------------
+// CGlobalWaitingNote private functions
+// -----------------------------------------------------------------------------
+//
+CGlobalWaitingNote::CGlobalWaitingNote()
+    : CActive( CActive::EPriorityStandard )
+    {
+    }
+
+
+CGlobalWaitingNote::~CGlobalWaitingNote()
+    {
+    delete iProgressTicker;
+    delete iGlobalNote;
+    }
+
+
+void CGlobalWaitingNote::ConstructL()
+    {
+    CActiveScheduler::Add( this );
+    iGlobalNote = CAknGlobalProgressDialog::NewL();
+
+    iProgressTicker = CPeriodic::NewL( CActive::EPriorityStandard );
+    }
+
+
+
+void CGlobalWaitingNote::DoShowMsgL( const TDesC& aMessage,
+                                     TInt aTotalShowTime,
+                                     TInt aProgressSteps )
+    {
+    iGlobalNote->ShowProgressDialogL( iStatus,
+                                      aMessage,
+                                      R_AVKON_SOFTKEYS_OK_EMPTY,
+                                      aTotalShowTime );
+    SetActive();
+
+    iProgressInterval =  aTotalShowTime / aProgressSteps;
+    iTotalShowTime = aTotalShowTime;
+    iCurrentProgress = 0;
+
+    TCallBack progressCb( CGlobalWaitingNote::ProgressTickCb, this );
+    iProgressTicker->Start( iProgressInterval, iProgressInterval, progressCb );
+
+    iWait.Start();
+    }
+
+
+TInt CGlobalWaitingNote::ProgressTickCb( TAny* aSelf )
+    {
+    return ( (CGlobalWaitingNote*) aSelf )->HandleProgressTick();
+    }
+
+
+TInt CGlobalWaitingNote::HandleProgressTick()
+    {
+    if( iCurrentProgress < iTotalShowTime )
+        {
+        iCurrentProgress += iProgressInterval;
+        iGlobalNote->UpdateProgressDialog( iCurrentProgress, iTotalShowTime );
+        }
+
+    else
+        {
+        iGlobalNote->ProcessFinished();
+        }
+
+    return KErrNone;
+    }
+
+
+
+void CGlobalWaitingNote::RunL()
+    {
+    iWait.AsyncStop();
+    }
+
+
+TInt CGlobalWaitingNote::RunError( TInt /*aError*/ )
+    {
+    return KErrNone;
+    }
+
+
+void CGlobalWaitingNote::DoCancel()
+    {
+    iGlobalNote->ProcessFinished();
+    }
+
+#endif // CGLOBALWAITINGNOTE_H
+
+// end of file
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/tsrc/tsrcutils/eunitcommon/eunit_test_mover.pl	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,80 @@
+#
+# 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: XIMP Framework Test Code 
+#
+#!perl
+#
+use strict;
+use File::Path;
+
+$|=1; # ensures that any progress information sent to the screen is displayed immediately and not buffered
+
+# When this script is used with build tools, move is done only for WINSCW platform 
+if ( exists($ENV{'PLATFORM'})  && 
+     ($ENV{'PLATFORM'} ne 'WINSCW' ) )
+	{
+	print "\nEUnit Test DLL Mover: nothing to do for platform.\n";
+	exit 0;
+	}
+
+
+# destination folder where EUnit test dlls are placed
+my $destFolder = "\\epoc32\\release\\winscw\\udeb\\z\\sys\\bin";
+
+# ABLD command 
+# If this script is used with build chain, then "TO_BLDINF" env. variable points to the ABLD folder 
+# else use ABLD from current folder
+my $abldCommand = ""; 
+if (exists($ENV{'TO_BLDINF'}))
+	{
+	$abldCommand = $ENV{'TO_BLDINF'} . "\\abld build winscw udeb -what";	
+	}
+else
+	{
+	$abldCommand = "abld build winscw udeb -what";
+	}
+
+# get option
+my $option = $ARGV[0];
+
+# get all the files produced by the ABLD
+my @allProducedFiles = `$abldCommand`;
+
+# we're interested only from dlls
+my @dllList = grep{ $_=~m#^.+\.dll$#i }@allProducedFiles;
+
+print "\n";
+foreach my $dll (@dllList)
+	{
+	chomp($dll);
+
+    # skip those which are not mt_, ut_, t_, dec_
+    my @paths = split(/\\/, $dll);
+    next unless (grep { $paths[-1] =~ m#^$_.+$#i; } (qw(mt_ ut_ t_ dec_)));
+
+	if( $option eq "-wipe" )
+		{
+		my($dllPath, $dllName) = $dll =~ m/(.*\\)(.*)$/;
+		$dll = $destFolder . "\\" . $dllName;
+		print "EUnit Test DLL Mover: CLEANING $dll\n";
+		rmtree $dll;
+		}
+	else
+		{
+		print "EUnit Test DLL Mover: COPYING $dll to $destFolder\n";
+		system "copy $dll ${destFolder}";
+		}
+	}
+	
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/tsrc/tsrcutils/eunitcommon/eunittools.h	Wed Nov 03 09:32:20 2010 +0530
@@ -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: XIMP Framework Test Code 
+*
+*/
+
+#ifndef EUNITTOOLS_H
+#define EUNITTOOLS_H
+
+#include <e32std.h>
+
+#include <platform/digia/eunit/eunitmacros.h>
+#include <platform/digia/eunit/teunitassertioninfo.h>
+
+#include <platform/digia/eunit/ceunittestsuiteclass.h>
+#include <platform/digia/eunit/EUnitDecorators.h>
+
+
+#include "cglobalwaitingnote.h"
+
+
+
+// -----------------------------------------------------------------------------
+// ASSERTION HELPER
+// Leaves if the provided error code is decorator error.
+// -----------------------------------------------------------------------------
+//
+#define LEAVE_IF_DECORATOR_ERROR( aErr ) \
+    { \
+    if( aErr == KErrNoMemory ) \
+        { \
+        User::Leave( KErrNoMemory ); \
+        } \
+    }
+
+
+
+// -----------------------------------------------------------------------------
+// ASSERTION HELPER
+// Returns from current function if the provided error code is decorator error.
+// -----------------------------------------------------------------------------
+//
+#define RETURN_IF_DECORATOR_ERROR( aErr ) \
+    { \
+    if( aErr == KErrNoMemory ) \
+        { \
+        return KErrNoMemory; \
+        } \
+    }
+
+
+
+// -----------------------------------------------------------------------------
+// MEMORY LEAK TRACKING HELPER
+// Performs __UHEAP_MARK and shows visual notify.
+// (Visual notify gives time to reset HookLogger heap checks.)
+// -----------------------------------------------------------------------------
+//
+#define __UHEAP_MARK_WITH_VISUAL_NOTIFY \
+    { \
+    __UHEAP_MARK; \
+    EUnitTools::NotifyFromTestEnterL(); \
+    }
+
+
+// -----------------------------------------------------------------------------
+// MEMORY LEAK TRACKING HELPER
+// Performs __UHEAP_MARKEND with JIT debugger on.
+// -----------------------------------------------------------------------------
+//
+#define __UHEAP_MARKEND_WITH_DEBUGGER \
+    { \
+    TBool __justInTime = User::JustInTime(); \
+    User::SetJustInTime( ETrue ); \
+    __UHEAP_MARKEND; \
+    User::SetJustInTime( __justInTime ); \
+    }
+
+
+
+
+
+// -----------------------------------------------------------------------------
+// TEST CASE DECLARATION
+// Defines not decorated test case.
+// -----------------------------------------------------------------------------
+//
+#define PRFW_NOT_DECORATED_TEST( aDescription, aClass, aMethods, aCategory, aSetupMethod, aTestMethod, aTeardownMethod )\
+EUNIT_NOT_DECORATED_TEST( aDescription, aClass, aMethods, aCategory, aSetupMethod, aTestMethod, aTeardownMethod )
+
+// -----------------------------------------------------------------------------
+// TEST CASE DECLARATION
+// Defines decorated test case.
+// -----------------------------------------------------------------------------
+//
+#define PRFW_DECORATED_TEST( aDescription, aClass, aMethods, aCategory, aSetupMethod, aTestMethod, aTeardownMethod )\
+EUNIT_TEST( aDescription, aClass, aMethods, aCategory, aSetupMethod, aTestMethod, aTeardownMethod )
+
+#define PRFW_ASSERT_DESC( aCondition, aDescription ) \
+    if ( aCondition ) { } else { \
+        TEUnitAssertionInfo __eunit_assert_info = { \
+			__EUNIT_INTERNAL_ASSERT_BASE( aCondition, aDescription ), \
+        	NULL }; \
+        EUnit::AssertionFailedL( __eunit_assert_info ); }
+
+
+/**
+ * Collection of EUnit Tools
+ */
+class EUnitTools
+    {
+    public:
+        static inline void NotifyFromTestEnterL();
+
+    };
+
+
+
+inline void EUnitTools::NotifyFromTestEnterL()
+    {
+    __UHEAP_MARK;
+
+    TInt decoratorfailCount = -1;
+    CEUnitTestCaseDecorator* decorator = CEUnitTestCaseDecorator::ActiveTestCaseDecorator( KNullDesC ); //Any decorator
+    if( decorator )
+        {
+        decorator->GetParameter( _L("ErrorCount"), //Run loop counter value
+                                 decoratorfailCount );
+        }
+
+    if( !decorator ||
+        ( decoratorfailCount == 1 ) )
+        {
+        EUNIT_DISABLE_ANY_DECORATOR;
+
+        TFileName processImage = RProcess().FileName();
+        TBuf<350> msg;
+        msg.Append( _L("Entering to test case. Test process:") );
+        msg.Append( processImage );
+
+        CGlobalWaitingNote::ShowMsgL( msg, 15000000, 15 );  //15 seconds, 1 second steps
+
+        EUNIT_ENABLE_ANY_DECORATOR;
+        }
+    }
+
+
+
+#endif // EUNITTOOLS_H
+
+
+
+//  end of file
+
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/tsrc/tsrcutils/eunitcommon/eunittstdll_armv5u.def	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,3 @@
+EXPORTS
+	_Z16CreateTestSuiteLv @ 1 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/tsrc/tsrcutils/eunitcommon/eunittstdll_winsu.def	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,3 @@
+EXPORTS
+	?CreateTestSuiteL@@YAPAVMEUnitTest@@XZ @ 1 NONAME ; class MEUnitTest * CreateTestSuiteL(void)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/tsrc/tsrcutils/eunitcommon/eunittstdllbase.hrh	Wed Nov 03 09:32:20 2010 +0530
@@ -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: XIMP Framework Test code 
+*
+*/
+
+// To get the MW_LAYER_SYSTEMINCLUDE-definition
+#include <platform_paths.hrh>
+
+// DEFINES
+#define KEUnitUid3 0x1000af59
+#define KEUnitTestDllUid2 0x1000af5a
+
+
+// COMMON TEST DLL TARGET DEFINITIONS
+#if defined(ARMCC)
+deffile             ./eunittstdll_armv5.def
+#elif defined(MARM)
+deffile             ./eunittstdll_marm.def
+#elif defined(WINS)
+deffile             ./eunittstdll_wins.def
+#endif
+
+UID                 KEUnitTestDllUid2 KEUnitUid3
+TARGETTYPE          dll
+CAPABILITY          ALL -TCB
+VENDORID            VID_DEFAULT
+NOEXPORTLIBRARY
+
+
+// COMMON TEST DLL INCLUDE PATHS
+// Default system include paths for middleware layer modules.
+MW_LAYER_SYSTEMINCLUDE
+SYSTEMINCLUDE       /epoc32/include/digia/eunit
+USERINCLUDE         .
+
+
+// COMMON TEST DLL DEPENDENCIES TO SYSTEM COMPONENTS
+LIBRARY             euser.lib
+LIBRARY             eunit.lib
+LIBRARY             eunitutil.lib
+LIBRARY             aknnotify.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/tsrc/tsrcutils/eunitcommon/move_tests_to_eunit.inf	Wed Nov 03 09:32:20 2010 +0530
@@ -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: XIMP Framework Test Code 
+*
+*/
+////////////////////////////////////////////////////////////
+// bld.inf extension
+// Part of Presence Engine EUnit tests
+
+PRJ_EXPORTS
+eunit_test_mover.pl /epoc32/tools/eunit_test_mover.pl
+
+
+PRJ_TESTMMPFILES
+gnumakefile move_tests_to_eunit.mk
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/tsrc/tsrcutils/eunitcommon/move_tests_to_eunit.mk	Wed Nov 03 09:32:20 2010 +0530
@@ -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: XIMP Framework Test Code 
+#
+
+do_nothing :
+	@rem do_nothing
+
+MAKMAKE : do_nothing
+
+BLD :	do_nothing
+
+CLEAN : 
+	@\epoc32\tools\eunit_test_mover.pl -wipe
+
+LIB : do_nothing
+
+CLEANLIB : do_nothing
+
+RESOURCE : do_nothing
+
+FREEZE : do_nothing
+
+SAVESPACE : do_nothing
+
+RELEASABLES : do_nothing
+
+FINAL : 
+	@\epoc32\tools\eunit_test_mover.pl
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/tsrc/tsrcutils/processmaster/bld.inf	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  prfwtestprocessmaster.mmp
+*
+*/
+// Platforms
+PRJ_PLATFORMS
+DEFAULT
+
+// Server components
+PRJ_TESTMMPFILES
+prfwtestprocessmaster.mmp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/tsrc/tsrcutils/processmaster/pm.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,27 @@
+/*
+* 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: XIMP Framework Test code pm.h
+*
+*/
+
+
+// assume tests in /internal/tsrc/t_blah
+
+USERINCLUDE         ../../tsrcutils/processmaster
+USERINCLUDE         ../../tsrcutils/testcaseutils
+USERINCLUDE         ../../../core/srcpscserver
+USERINCLUDE         ../../../core/srcrootserver
+
+LIBRARY             efsrv.lib
+LIBRARY             prfwtestcaseutils.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/tsrc/tsrcutils/processmaster/prfwtestprocessmaster.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,99 @@
+/*
+* 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: XIMP Framework Test Code prfwtestprocessmaster.cpp
+ *
+*/
+
+#include <E32Base.h>
+#include "prfwtestprocessmaster.h"
+
+
+// ==============================================================
+// ============ DoKillProcessL()                    =============
+// ==============================================================
+void DoKillProcessL( const TDesC& aProcessName )
+    {
+    TFullName psName;
+    psName.Append( _L("*") );
+    psName.Append( aProcessName );
+    psName.Append( _L("*") );
+
+    TFindProcess psFinder;
+    psFinder.Find( psName );
+
+    TInt killCount( 0 );
+    while( psFinder.Next( psName ) != KErrNotFound )
+        {
+        RProcess ps;
+        User::LeaveIfError( ps.Open( psFinder ) );
+        ps.Kill( -666 );
+        ps.Close();
+        killCount++;
+        }
+
+    User::Leave( killCount );
+    }
+
+
+// ==============================================================
+// ============ E32MainL()                          =============
+// ==============================================================
+void E32MainL()
+    {
+    TInt theCommand;
+    User::LeaveIfError( User::GetTIntParameter( PrfwTestProcessMaster::EMsgSlot_Command, theCommand ) );
+
+    TBuf< PrfwTestProcessMaster::EMaxMsgDataLength > theDesC16;
+    User::LeaveIfError( User::GetDesParameter( PrfwTestProcessMaster::EMsgSlot_Desc16Data, theDesC16 ) );
+
+    switch( theCommand )
+        {
+        case PrfwTestProcessMaster::EKillProcess:
+            {
+            DoKillProcessL( theDesC16 );
+            break;
+            }
+
+        default:
+            {
+            User::Leave( KErrNotSupported );
+            break;
+            }
+        }
+    }
+
+
+// ==============================================================
+// ============ E32Main()                           =============
+// ==============================================================
+GLDEF_C TInt E32Main()
+    {
+    CTrapCleanup* tc = CTrapCleanup::New();
+    if( !tc )
+        {
+        return KErrNoMemory;
+        }
+
+    __UHEAP_MARK;
+    TRAPD( err, E32MainL() );
+    __UHEAP_MARKEND;
+
+    delete tc;
+
+    RProcess::Rendezvous( err );
+    return err;
+    }
+
+
+//End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/tsrc/tsrcutils/processmaster/prfwtestprocessmaster.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,148 @@
+/*
+* 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: XIMP Framework Test Code prfwtestprocessmaster.h
+ *
+*/
+
+#ifndef PRFWTESTPROCESSMASTER_H__
+#define PRFWTESTPROCESSMASTER_H__
+
+
+// INCLUDES
+#include <e32std.h>
+#include <data_caging_path_literals.hrh>
+#include <f32file.h>
+#include <e32base.h>
+
+#include "ximpserverdefs.h"
+#include "ximprootserverdefs.h"
+
+// CLASS DESCRIPTION
+
+/**
+ * Test utility for managing Presence Engine processies
+ */
+class PrfwTestProcessMaster
+    {
+    public: //enumerations
+        enum TPEngProcessMasterEnums
+            {
+            EMsgSlot_Command = 1,
+            EMsgSlot_Desc16Data = 2,
+
+            EKillProcess = 100,
+            EMaxMsgDataLength = 256
+            };
+
+    public: //Public functions
+
+        /**
+         *
+         *
+         *
+         *
+         *
+         */
+        static inline TInt KillPscServers();
+        static inline TInt KillRootServer();
+
+    private: //Helper functions
+        static inline TInt DoKillServer( const TDesC& aServer );
+
+    };
+
+
+
+
+// -----------------------------------------------------------------------------
+// PrfwTestProcessMaster public functions
+// -----------------------------------------------------------------------------
+//
+inline TInt PrfwTestProcessMaster::KillPscServers()
+    {
+    return PrfwTestProcessMaster::DoKillServer( NXIMPSrv::NName::KServerPattern );
+    }
+
+inline TInt PrfwTestProcessMaster::KillRootServer()
+    {
+    return PrfwTestProcessMaster::DoKillServer( NRootSrv::NName::KServerPattern );
+    }
+
+// -----------------------------------------------------------------------------
+// PrfwTestProcessMaster private functions
+// -----------------------------------------------------------------------------
+//
+inline TInt PrfwTestProcessMaster::DoKillServer( const TDesC& aServer )
+    {
+    //Compose full executable name
+    TFileName processMasterExe;
+
+    // TODO this code shouldn't leave? does it? it was TRAP+L elsewhere.
+    TFileName dllPath;
+    Dll::FileName( dllPath );
+    TParsePtrC dllPathParser( dllPath );
+    processMasterExe.Insert( 0, dllPathParser.Drive() );
+
+    processMasterExe.Append( KDC_PROGRAMS_DIR );
+    processMasterExe.Append( _L("prfwtestprocessmaster.exe") );
+
+    //Initialize ProcessMaster process
+    RProcess processMaster;
+    TInt err = processMaster.Create( processMasterExe, KNullDesC );
+    if( err != KErrNone )
+        {
+        processMaster.Close();
+        return err;
+        }
+
+    err = processMaster.SetParameter( PrfwTestProcessMaster::EMsgSlot_Command,
+            PrfwTestProcessMaster::EKillProcess );
+    if( err != KErrNone )
+        {
+        processMaster.Close();
+        return err;
+        }
+
+
+    err = processMaster.SetParameter( PrfwTestProcessMaster::EMsgSlot_Desc16Data,
+            aServer );
+    if( err != KErrNone )
+        {
+        processMaster.Close();
+        return err;
+        }
+
+    //Execute ProcessMaster
+    TRequestStatus rendezvousStatus;
+    processMaster.Rendezvous( rendezvousStatus );
+    processMaster.Resume();
+    User::WaitForRequest( rendezvousStatus );
+    err = rendezvousStatus.Int();
+
+
+    //Get exit statuses for debuging purposes
+    TExitType exitType = processMaster.ExitType();
+    TExitCategoryName exitCategory = processMaster.ExitCategory();
+    TInt exitReason = processMaster.ExitReason();
+
+    processMaster.Close();
+
+    return err;
+    }
+
+
+#endif // PRFWTESTPROCESSMASTER_H__
+
+//  End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/tsrc/tsrcutils/processmaster/prfwtestprocessmaster.mmp	Wed Nov 03 09:32:20 2010 +0530
@@ -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: XIMP Framework Test Code prfwtestprocessmaster.mmp
+*
+*/
+
+// To get the MW_LAYER_SYSTEMINCLUDE-definition
+#include <platform_paths.hrh>
+#include<eunitcaps.h>
+TARGET          prfwtestprocessmaster.exe
+TARGETTYPE      exe
+UID             0x0     0x10282DDE
+VENDORID        VID_DEFAULT
+CAPABILITY      CAP_SERVER ProtServ PowerMgmt AllFiles ReadDeviceData  EUNIT_CAPS
+
+TARGETPATH      /system/libs
+SOURCEPATH      .
+SOURCE          prfwtestprocessmaster.cpp
+
+#if defined ( OS_LAYER_SYSTEMINCLUDE )
+OS_LAYER_SYSTEMINCLUDE
+#else
+SYSTEMINCLUDE     /epoc32/include
+#endif
+
+ #if defined ( APP_LAYER_SYSTEMINCLUDE )
+ APP_LAYER_SYSTEMINCLUDE
+ #else
+ SYSTEMINCLUDE     \epoc32\include
+ #endif
+
+MW_LAYER_SYSTEMINCLUDE
+USERINCLUDE     ../testcaseutils
+USERINCLUDE     ../../../core/srcrootserver
+USERINCLUDE     ../../../core/srcpscserver
+
+
+LIBRARY         euser.lib
+
+//  End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/tsrc/tsrcutils/testcaseutils/bld.inf	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,23 @@
+/*
+* 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 prfwtestcaseutils.dll
+*
+*/
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_TESTMMPFILES
+prfwtestcaseutils.mmp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/tsrc/tsrcutils/testcaseutils/prfwgeneralwaiter.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,110 @@
+/*
+* 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:  XIMP Framework Test code 
+*
+*/
+
+
+
+#include <e32std.h>
+
+#include "prfwgeneralwaiter.h"
+#include "prfwwaitobserver.h"
+
+
+
+// ======== LOCAL FUNCTIONS ========
+
+
+// ======== MEMBER FUNCTIONS ========
+
+
+// ---------------------------------------------------------------------------
+// ?description_if_needed
+// ---------------------------------------------------------------------------
+//
+CXIMPTestGeneralWaiter::CXIMPTestGeneralWaiter( T_MWaitObserver* aObserver ) :
+    CActive( EPriorityNormal ),
+    iObserver( aObserver )
+    {
+    CActiveScheduler::Add( this );
+    }
+
+
+// ---------------------------------------------------------------------------
+// ?description_if_needed
+// ---------------------------------------------------------------------------
+//
+void CXIMPTestGeneralWaiter::ConstructL()
+    {
+    iTimer.CreateLocal();
+    }
+
+
+// ---------------------------------------------------------------------------
+// ?description_if_needed
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CXIMPTestGeneralWaiter* CXIMPTestGeneralWaiter::NewL( T_MWaitObserver* aObserver )
+    {
+    CXIMPTestGeneralWaiter* self = new( ELeave ) CXIMPTestGeneralWaiter( aObserver );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+
+// ---------------------------------------------------------------------------
+// ?description_if_needed
+// ---------------------------------------------------------------------------
+//
+CXIMPTestGeneralWaiter::~CXIMPTestGeneralWaiter()
+    {
+    iTimer.Close();
+    }
+
+
+// ---------------------------------------------------------------------------
+// ?implementation_description
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CXIMPTestGeneralWaiter::WaitForL( TInt aSeconds )
+    {
+    TTimeIntervalMicroSeconds32 timeToWait( aSeconds * 1000000 );
+    iTimer.After( iStatus, timeToWait );
+    SetActive();
+    }
+
+
+void CXIMPTestGeneralWaiter::RunL()
+    {
+    iObserver->WaitCompleted( KErrNone );
+    }
+
+
+void CXIMPTestGeneralWaiter::DoCancel()
+    {
+    
+    }
+
+
+TInt CXIMPTestGeneralWaiter::RunErrorL( TInt /* aError */ )
+    {
+    iObserver->WaitCompleted( KErrGeneral );
+    return 0;
+    }
+
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/tsrc/tsrcutils/testcaseutils/prfwgeneralwaiter.h	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  XIMP Framework Test code 
+*
+*/
+
+
+
+#ifndef CPRFWTESTGENERALWAITER_H
+#define CPRFWTESTGENERALWAITER_H 
+
+
+#include <e32base.h>
+
+
+class T_MWaitObserver;
+
+
+/**
+ * ?one_line_short_description
+ *
+ * ?more_complete_description
+ *
+ * @lib ?library
+ * @since S60 v4.0
+ */
+class CXIMPTestGeneralWaiter : public CActive
+    {
+public:
+
+    IMPORT_C static CXIMPTestGeneralWaiter* NewL( T_MWaitObserver* aObserver );
+
+
+    virtual ~CXIMPTestGeneralWaiter();
+
+
+private:
+
+    CXIMPTestGeneralWaiter( T_MWaitObserver* aObserver );
+    void ConstructL();
+
+
+public:
+
+    /**
+     * ?description
+     *
+     * @since S60 ?S60_version
+     * @param ?arg1 ?description
+     * @param ?arg2 ?description
+     * @return ?description
+     */
+    IMPORT_C void WaitForL( TInt aSeconds );
+
+
+private:
+
+    void RunL();
+
+
+    void DoCancel();
+
+
+    TInt RunErrorL( TInt aError );
+
+
+private: // data
+
+
+    T_MWaitObserver* iObserver;
+
+    RTimer iTimer;
+
+    };
+
+#endif // CPRFWTESTGENERALWAITER_H 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/tsrc/tsrcutils/testcaseutils/prfwsrvtestclient.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,184 @@
+/*
+* 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:  XIMP Framework server test client implementation
+*
+*/
+
+
+//  INCLUDE FILES
+#include "ximpbase.h"
+#include "ximpsrvtestclient.h"
+#include "ximpprocessstarter.h"
+#include "ximprootserverdefs.h"
+#include "ximpserverdefs.h"
+#include "prfwtestserverdefs.h"
+
+#include <e32base.h>
+#include <s32mem.h>
+
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// RXIMPSrvRootClient::RXIMPSrvRootClient()
+// ---------------------------------------------------------------------------
+//
+RXIMPSrvTestClient::RXIMPSrvTestClient()
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// RXIMPSrvRootClient::Connect()
+// ---------------------------------------------------------------------------
+//
+TInt RXIMPSrvTestClient::Connect()
+    {
+    TFileName fullExePath;
+    XIMPProcessStarter::FullExePathForClienLocation( NRootSrv::NName::KExecutable,
+                                                     fullExePath );
+
+    TInt ret = XIMPProcessStarter::ConnectToServer( fullExePath,
+                                            KNullDesC,
+                                            NULL,
+                                            *this,
+                                            NRootSrv::NName::KSymbianServer,
+                                            TVersion( NRootSrv::NVersion::KMajor,
+                                                      NRootSrv::NVersion::KMinor,
+                                                      NRootSrv::NVersion::KBuild ),
+                                                      NRootSrv::NRequest::KMsgSlotCount );
+
+    if ( ret == KErrNone )
+        {
+        TIpcArgs msgArgs;
+        ret = SendReceive( NTestSrv::NRequest::EInstantiateTestSession, msgArgs );
+        }
+
+    return ret;
+    }
+
+// ---------------------------------------------------------------------------
+// RXIMPSrvContextClient::Connect()
+// ---------------------------------------------------------------------------
+//
+void RXIMPSrvTestClient::ConnectL( TUid aProtocolImpUid )
+    {
+    // create the server name: "!XIMPCtxSrv9bde667a" 
+    HBufC* serverName = HBufC::NewLC( NXIMPSrv::NName::KSymbianServer().Length() + 
+                                      NXIMPSrv::NStartupParam::KProtocolUidMaxLen + 
+                                      1 );
+
+    serverName->Des().Copy( NXIMPSrv::NName::KSymbianServer );
+    serverName->Des().AppendNumFixedWidth( aProtocolImpUid.iUid, 
+                                           EHex, 
+                                           NXIMPSrv::NStartupParam::KProtocolUidMaxLen );
+
+    // Pass the UID to server side.
+    // For security reasons it was not allowed to pass the complete 
+    // server name descriptor but just the UID part
+    RArray< TXIMPProcessStartupParam > params;
+    CleanupClosePushL( params );
+
+    TXIMPProcessStartupParam paramUid;
+    paramUid.Set( NXIMPSrv::NStartupParam::KProtocolUidIndex, 
+                  aProtocolImpUid.iUid );
+
+    User::LeaveIfError( params.Append( paramUid ) );
+    TArray< TXIMPProcessStartupParam > array = params.Array();
+
+
+    //Get path to correct exe to launch
+    TFileName fullExePath;
+    XIMPProcessStarter::FullExePathForClienLocation( NXIMPSrv::NName::KExecutable,
+                                                     fullExePath );
+
+    //Create a connection
+    TInt ret = XIMPProcessStarter::ConnectToServer( fullExePath,
+                                                    KNullDesC,
+                                                    &array,
+                                                    *this,
+                                                    *serverName,
+                                                    TVersion( NXIMPSrv::NVersion::KMajor,
+                                                              NXIMPSrv::NVersion::KMinor,
+                                                              NXIMPSrv::NVersion::KBuild ),
+                                                    NXIMPSrv::NRequest::KMsgSlotCount );
+    User::LeaveIfError( ret );
+    CleanupStack::PopAndDestroy( 2, serverName ); // params, serverName
+
+    //Mutate the server side session to correct type
+    ret = SendReceive( NTestSrv::NRequest::EInstantiateTestSession );
+    User::LeaveIfError( ret );
+    }
+
+// ---------------------------------------------------------------------------
+// RXIMPSrvRootClient::Close()
+// ---------------------------------------------------------------------------
+//
+void RXIMPSrvTestClient::Close()
+    {
+    RSessionBase::Close();
+    }
+
+
+// ---------------------------------------------------------------------------
+// RXIMPSrvTestClient::SetAllocFailureL()
+// ---------------------------------------------------------------------------
+//
+void RXIMPSrvTestClient::SetAllocFailure( TInt aRate )
+    {
+    TPckgBuf< TInt > rateBuf( aRate );
+    TIpcArgs msgArgs;
+    msgArgs.Set( 0, &rateBuf );
+    
+    SendReceive( NTestSrv::NRequest::ESetAllocFail, msgArgs );
+    }
+    
+// ---------------------------------------------------------------------------
+// RXIMPSrvRootClient::GetLastError()
+// ---------------------------------------------------------------------------
+//
+NTestSrv::SErrorData RXIMPSrvTestClient::FetchErrorData()
+    {
+    NTestSrv::SErrorData errorData;
+    TPckgBuf< NTestSrv::SErrorData > errorBuf( errorData );
+    TIpcArgs msgArgs;
+    msgArgs.Set( 0, &errorBuf );
+    TInt retVal = SendReceive( NTestSrv::NRequest::EPrepareErrorData, msgArgs );
+    __ASSERT_ALWAYS( retVal >= 0, User::Panic( _L( "SendReceive failed" ), retVal ) );
+    errorData = errorBuf();
+    return errorData;
+//    return GetData( NTestSrv::NRequest::EPrepareErrorData );
+    }    
+
+// ---------------------------------------------------------------------------
+// RXIMPSrvRootClient::GetDataL()
+// ---------------------------------------------------------------------------
+//
+NTestSrv::SErrorData RXIMPSrvTestClient::GetData( TInt aMsg )
+    {
+/*    TInt bufSize = SendReceive( aMsg );
+    __ASSERT_ALWAYS( bufSize == NTestSrv::KErrorDataSize, User::Panic( _L( "Wrong bufsize" ), KErrArgument ) );
+
+    NTestSrv::SErrorData errorData;
+    TPckgBuf< NTestSrv::SErrorData > errorBuf( errorData );
+    TIpcArgs msgArgs;
+    msgArgs.Set( 0, &errorBuf );
+    __ASSERT_ALWAYS( SendReceive( NTestSrv::NRequest::EFetchData, msgArgs ) >= 0, 
+                    User::Panic( _L( "SendReceive failed" ) ) );
+    return errorData;*/
+    }
+
+
+// End of file
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/tsrc/tsrcutils/testcaseutils/prfwsrvtestclient.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,72 @@
+/*
+* 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:  XIMP Framework server test session.
+*
+*/
+
+#ifndef PRFWSRVTESTCLIENT_H__
+#define PRFWSRVTESTCLIENT_H__
+
+#include <ximpbase.h>
+#include <e32std.h>
+#include "prfwtestserverdefs.h"
+
+
+/**
+ * XIMP Framework server test session.
+ *
+ * @lib ximpsrvclient.dll
+ * @since S60 v3.2
+ */
+class RXIMPSrvTestClient : public RSessionBase
+    {
+public:
+
+    /**
+     * Default constructor.
+     */
+    RXIMPSrvTestClient();
+
+    /**
+     * Session connection method.
+     *
+     * @return Error code from creating server connection.
+     */
+    TInt Connect();
+    void ConnectL( TUid aProtocolImpUid );
+
+    /**
+     * Closes server connection.
+     */
+    void Close();
+    
+    /**
+     * Set alloc failure
+     */
+    void SetAllocFailure( TInt aRate );
+    NTestSrv::SErrorData RXIMPSrvTestClient::FetchErrorData();
+
+private:
+
+    /**
+     * Helper to get data from server side.
+     * @return Externalized object to be passed onward
+     */
+    NTestSrv::SErrorData GetData( TInt aMsg );
+    };
+
+
+#endif      //  PRFWSRVTESTCLIENT_H__
+
+// END OF FILE
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/tsrc/tsrcutils/testcaseutils/prfwtestcaseutils.mmp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,108 @@
+/*
+* 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:   prfwtestdlluids dll mmp file
+*
+*/
+
+#include<platform_paths.hrh>
+#include<eunitcaps.h>
+
+#include "prfwtestdlluids.hrh"
+
+TARGET                  prfwtestcaseutils.dll
+TARGETTYPE              dll
+UID                     PRFWTEST_DLL_UID_STATIC_INTERFACE PRFWTEST_DLL_UID_COMMON
+
+//CAPABILITY              ALL -TCB -DRM 
+CAPABILITY 			     EUNIT_CAPS
+VENDORID                VID_DEFAULT
+
+
+SOURCEPATH              .
+SOURCE                  prfwteststatuseventlistener.cpp
+SOURCE                  prfwtestmessenger.cpp
+SOURCE                  prfwtestfilesrvmsg.cpp
+SOURCE                  prfwtestfiletool.cpp
+SOURCE                  prfwtestcontextwrapper.cpp
+SOURCE                  prfwtestcontextwrappermgr.cpp
+SOURCE                  prfwgeneralwaiter.cpp
+SOURCE                  prfwtestpresencedatautils.cpp
+SOURCE                  prfwtestlistener.cpp
+SOURCE                  prfwtestwaithelper.cpp
+SOURCE                  prfwtesteventfactory.cpp
+
+USERINCLUDE             ../../../core/srcdatamodel
+USERINCLUDE             ../../../presence/srcpresencedatamodel
+USERINCLUDE             ../../../presence/srcpresencedatamodel/presentitygroups
+USERINCLUDE             ../../../presence/srcpresencedatamodel/presencewatching
+USERINCLUDE             ../../../presence/srcpresencedatamodel/presenceauthorization
+USERINCLUDE             ../../../presence/srcpresencedatamodel/presencepublishing
+USERINCLUDE             ../../../presence/srcpresencedatamodel/presenceinfo
+USERINCLUDE             ../../../core/srcutils
+
+
+USERINCLUDE             ../../../core/srcclient
+USERINCLUDE             ../../../core/srcpscserver
+USERINCLUDE             ../../../core/srcrootserver
+
+USERINCLUDE             .
+USERINCLUDE             ../../tsrcutils/eunitcommon
+USERINCLUDE             ../../tsrcutils/processmaster
+USERINCLUDE             ../../tsrcprotocols
+
+
+// TODO remove unnecessary
+#if defined ( OS_LAYER_SYSTEMINCLUDE )
+OS_LAYER_SYSTEMINCLUDE
+#else
+SYSTEMINCLUDE     /epoc32/include
+#endif
+
+ #if defined ( APP_LAYER_SYSTEMINCLUDE )
+ APP_LAYER_SYSTEMINCLUDE
+ #else
+ SYSTEMINCLUDE     \epoc32\include
+ #endif
+SYSTEMINCLUDE           ../../../inc/core/base
+SYSTEMINCLUDE           ../../../inc/core/datamodel
+SYSTEMINCLUDE           ../../../inc/core/protocolplugin
+SYSTEMINCLUDE           ../../../inc/core/protocolpluginhost
+SYSTEMINCLUDE           ../../../inc/presence/presencedatamodel
+SYSTEMINCLUDE           ../../../inc/presence/presencemanagement
+SYSTEMINCLUDE           ../../../inc/presence/presenceprotocolplugin
+SYSTEMINCLUDE           ../../../inc/presence/presenceprotocolpluginhost
+
+SYSTEMINCLUDE           /epoc32/include/platform/digia/eunit
+MW_LAYER_SYSTEMINCLUDE
+
+
+LIBRARY                 ecom.lib
+LIBRARY                 bafl.lib
+LIBRARY                 euser.lib
+LIBRARY                 estor.lib
+LIBRARY                 efsrv.lib
+LIBRARY                 eunit.lib
+LIBRARY                 eunitutil.lib
+LIBRARY                 ximpsrvclient.lib
+LIBRARY                 ximpdatamodel.lib
+LIBRARY             presencedatamodel.lib
+LIBRARY                 ximputils.lib
+LIBRARY 								aknnotify.lib 
+LIBRARY									eiksrv.lib 
+
+EXPORTUNFROZEN
+
+// end of file
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/tsrc/tsrcutils/testcaseutils/prfwtestcaseutilspanics.h	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  XIMP Framework panic defines.
+ *
+*/
+
+#ifndef PRFWTESTCASEUTILSPANICS_H
+#define PRFWTESTCASEUTILSPANICS_H
+
+#include <e32std.h>
+
+/**
+ * Panic category and reason codes for XIMP Framework
+ * test case utils failures.
+ */
+namespace NXIMPTestCaseUtilsPanic
+    {
+    _LIT( KCategory, "XIMPTestUtils" );
+
+    enum TReason
+        {
+        EStatusEventListenerBadMaxCount,
+        EStatusEventListenerAlreadyWaiting,
+        EStatusEventListenerUnknownEventTemplate,
+        EAddSnapshotOverflow,
+        ESnapshotIndexOutOfBounds,
+        EReceivingEventFromWrongContext,
+        EReceivedNotAcceptedEventType,
+        EUnsupportedEventTypeInVerification
+        };
+
+
+    inline void Panic( NXIMPTestCaseUtilsPanic::TReason aReason )
+        {
+        User::Panic( KCategory, aReason );
+
+        }
+    }
+
+
+#endif  //PRFWTESTCASEUTILSPANICS_H
+
+
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/tsrc/tsrcutils/testcaseutils/prfwtestcontextwrapper.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,453 @@
+/*
+* 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:  Testing context wrapper
+ *
+*/
+
+
+
+#include <e32std.h>
+
+#include <eunitmacros.h>
+
+#include "prfwtestcontextwrapper.h"
+#include <ximpclient.h>
+#include <ximpcontext.h>
+#include <ximpcontextstateevent.h>
+#include <ximprequestcompleteevent.h>
+#include <ximpstatus.h>
+#include <presencefeatures.h>
+
+
+#include "prfwteststatuseventlistener.h"
+#include "prfwtestmessenger.h"
+#include "prfwtestmessaging.h"
+#include "prfwtestfiletool.h"
+#include "prfwtestprotocols.h"
+
+_LIT( KInstanceAsNumber, "%d" );
+// ======== LOCAL FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// Length of number in characters (e.g. 501 --> 3)
+// ---------------------------------------------------------------------------
+//
+TInt NumLenInChars( TInt aNum )
+    {
+    TInt len = 0;
+    TInt tmp = aNum;
+    do
+        {
+        tmp /= 10;  // number is base-10
+        len++;
+        }
+    while ( tmp > 0 );
+    return len;
+    }
+
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// Instance id
+// ---------------------------------------------------------------------------
+//
+EXPORT_C const TDesC16& CXIMPTestContextWrapper::InstanceId() const
+    {
+    return *iInstance;
+    }
+
+
+// ---------------------------------------------------------------------------
+// ?description_if_needed
+// ---------------------------------------------------------------------------
+//
+CXIMPTestContextWrapper::CXIMPTestContextWrapper( TInt aIndex,
+        MXIMPClient* aClient ) :
+    iIndex( aIndex ),
+    iClient( aClient )
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// ?description_if_needed
+// ---------------------------------------------------------------------------
+//
+void CXIMPTestContextWrapper::ConstructL()
+    {
+    iContext = iClient->NewPresenceContextLC();
+    CleanupStack::Pop(); // iContext
+    iListener = CXIMPTestStatusEventListener::NewL( 20, iContext );
+    iMessenger = CXIMPTestMessenger::NewForClientSideL( iIndex );
+    iPresFeatures = MPresenceFeatures::NewL(iContext); 
+    TInt instanceLength = NumLenInChars( iIndex );
+    iInstance = HBufC::NewL( instanceLength );
+    iInstance->Des().AppendFormat( KInstanceAsNumber, iIndex );
+    }
+
+// ---------------------------------------------------------------------------
+// ?description_if_needed
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CXIMPTestContextWrapper* CXIMPTestContextWrapper::NewL(
+        TInt aIndex, MXIMPClient* aClient )
+    {
+    CXIMPTestContextWrapper* self = new( ELeave ) CXIMPTestContextWrapper( aIndex, aClient );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// ?description_if_needed
+// ---------------------------------------------------------------------------
+//
+CXIMPTestContextWrapper::~CXIMPTestContextWrapper()
+    {
+    iStatusEventTraits.Close();
+
+    delete iMessenger;
+    delete iListener;
+    delete iContext;
+    delete iFileTool;
+    delete iInstance;
+    delete iPresFeatures;
+    }
+
+// ---------------------------------------------------------------------------
+// ?description_if_needed
+// ---------------------------------------------------------------------------
+//
+EXPORT_C MXIMPContext* CXIMPTestContextWrapper::GetContext()
+    {
+    return iContext;
+    }
+
+// ---------------------------------------------------------------------------
+// ?description_if_needed
+// ---------------------------------------------------------------------------
+//
+EXPORT_C MPresenceFeatures* CXIMPTestContextWrapper::GetPresenceFeatures()
+    {
+    return iPresFeatures;
+    }
+// ---------------------------------------------------------------------------
+// ?description_if_needed
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CXIMPTestStatusEventListener* CXIMPTestContextWrapper::GetEventListener()
+    {
+    return iListener;
+    }
+
+// ---------------------------------------------------------------------------
+// ?description_if_needed
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CXIMPTestMessenger* CXIMPTestContextWrapper::GetMessenger()
+    {
+    return iMessenger;
+    }
+
+// ---------------------------------------------------------------------------
+// ?description_if_needed
+// ---------------------------------------------------------------------------
+//
+EXPORT_C MXIMPClient* CXIMPTestContextWrapper::GetClient()
+    {
+    return iClient;
+    }
+
+// ---------------------------------------------------------------------------
+// ?description_if_needed
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CXIMPTestContextWrapper::DeletePresenceContext()
+    {
+    // used to test abrupt handle closings
+    iListener->SetEventSourceL( NULL );
+    delete iContext;
+    iContext = NULL;
+    }
+
+// ---------------------------------------------------------------------------
+// ?description_if_needed
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CXIMPTestContextWrapper::SetupEmptyListener()
+    {
+    iListener->ResetEventStack();
+    iStatusEventTraits.Reset();
+    }
+
+// ---------------------------------------------------------------------------
+// ?description_if_needed
+// ---------------------------------------------------------------------------
+//
+EXPORT_C RArray<TXIMPTestStatusEventSnapshot>* CXIMPTestContextWrapper::GetStatusTraits()
+    {
+    return &iStatusEventTraits;
+    }
+
+// ---------------------------------------------------------------------------
+// ?description_if_needed
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CXIMPTestContextWrapper::SetupListenerL( TXIMPTestStatusEventTemplate aEventType )
+    {
+    ResetListener();
+    iListener->GetEventTemplateL( iStatusEventTraits, aEventType );
+    iMessenger->SetPluginIndex( iIndex );
+    }
+
+// ---------------------------------------------------------------------------
+// ?description_if_needed
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CXIMPTestContextWrapper::AppendToTraitsL( TXIMPTestStatusEventTemplate aEventType )
+    {
+    iListener->GetEventTemplateL( iStatusEventTraits, aEventType );
+    }
+
+// ---------------------------------------------------------------------------
+// ?description_if_needed
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CXIMPTestContextWrapper::SetupListenerReqCompleteL(
+        TXIMPTestStatusEventTemplate aEventType,
+        RArray< TInt32 >* aAdditionalEvents )
+    {
+    iListener->ResetEventStack();
+    iListener->AcceptedEventTypes().Reset();
+    iListener->AcceptedEventTypes().AppendL( MXIMPRequestCompleteEvent::KInterfaceId );
+
+    if ( aAdditionalEvents )
+        {
+        for ( TInt i = 0; i < aAdditionalEvents->Count(); i++ )
+            {
+            iListener->AcceptedEventTypes().AppendL( (*aAdditionalEvents)[ i ] );
+            }
+        }
+
+    iListener->ReRegisterEventFilterL();
+    iStatusEventTraits.Reset();
+    iListener->GetEventTemplateL( iStatusEventTraits, aEventType );
+
+    iMessenger->SetPluginIndex( iIndex );
+    }
+
+// ---------------------------------------------------------------------------
+// ?description_if_needed
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CXIMPTestContextWrapper::ClearListener()
+    {
+    iListener->ResetEventStack();
+    iListener->SetEventSourceL( NULL );
+
+    iStatusEventTraits.Reset();
+    }
+
+
+// ---------------------------------------------------------------------------
+// ?description_if_needed
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CXIMPTestContextWrapper::ResetListener()
+    {
+    iListener->ResetEventStack();
+    iListener->ResetEventTypeStack();
+    iStatusEventTraits.Reset();
+    iListener->ReRegisterEventFilterL();
+    }
+
+// ---------------------------------------------------------------------------
+// ?description_if_needed
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CXIMPTestContextWrapper::WaitRequestAndStackEvents( TXIMPRequestId aReqId )
+    {
+    iListener->WaitRequestAndStackEvents( aReqId );
+    }
+
+// ---------------------------------------------------------------------------
+// ?description_if_needed
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CXIMPTestContextWrapper::VerifyEventStackL( const TPtrC8& aDesc )
+    {
+    iListener->VerifyEventStackL( iStatusEventTraits.Array(), aDesc );
+    }
+
+// ---------------------------------------------------------------------------
+// CXIMPTestContextWrapper::WaitAnyEvent
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CXIMPTestContextWrapper::WaitAnyEvent()
+    {
+    iListener->WaitAnyEvent();
+    }
+
+// ---------------------------------------------------------------------------
+// ?description_if_needed
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CXIMPTestContextWrapper::BindL(
+        TUid aUid,
+        const TDesC& aServer,
+        const TDesC& aUser,
+        const TDesC& aPassword )
+    {
+    SetupListenerL( EXIMPTestStatusEvents_BindingOk );
+    iMessenger->SetNoError();
+    iMessenger->SetPluginIndex( iIndex );
+
+    delete iFileTool;
+    iFileTool = NULL;
+    iFileTool = CXIMPTestFileTool::NewL( aUid.iUid, iIndex );
+
+    TXIMPRequestId reqId = iContext->BindToL(
+            aUid,
+            aServer,
+            aUser,
+            aPassword,
+            *iInstance,
+            iIndex );
+
+    WaitRequestAndStackEvents( reqId );
+    VerifyEventStackL( _L8("Binding (wrapper BindL): ") );
+
+    EUNIT_ASSERT_DESC( iMessenger->GetBoolean( EXIMPPlgTestOpenSessionCalled ) ||
+                       iMessenger->GetBoolean( EXIMPPlgTestShareSessionCalled ), "OpenSessionL was not called" );
+    }
+
+// ---------------------------------------------------------------------------
+// Bind alternative
+// ---------------------------------------------------------------------------
+//
+const TUid KTestProtocolUid = { K_PRFW_TST_PROTOCOL_1_IMPLEMENTATION_UID };  // hardcoded...
+
+_LIT( KTestFakeServer,      "www.imps%d.no/wv" );
+_LIT( KTestFakeUser,        "user%d" );
+_LIT( KTestFakePassword,    "password%d" );
+
+EXPORT_C void CXIMPTestContextWrapper::BindL( TInt aId )
+    {
+    SetupListenerL( EXIMPTestStatusEvents_BindingOk );
+    iMessenger->SetNoError();
+    iMessenger->SetPluginIndex( aId );
+
+    // create fake info
+    TInt extraLength = 8; // bad style... but length is enough
+
+    HBufC* fakeSrv = HBufC::NewLC( KTestFakeServer().Length() + extraLength );
+    fakeSrv->Des().AppendFormat( KTestFakeServer, aId );
+
+    HBufC* fakeUser = HBufC::NewLC( KTestFakeUser().Length() + extraLength );
+    fakeUser->Des().AppendFormat( KTestFakeUser, aId );
+
+    HBufC* fakePass = HBufC::NewLC( KTestFakePassword().Length() + extraLength );
+    fakePass->Des().AppendFormat( KTestFakePassword, aId );
+
+    delete iFileTool;
+    iFileTool = NULL;
+    iFileTool = CXIMPTestFileTool::NewL( KTestProtocolUid.iUid, iIndex );
+
+    TXIMPRequestId reqId = iContext->BindToL(
+            KTestProtocolUid,
+            *fakeSrv,
+            *fakeUser,
+            *fakePass,
+            *iInstance,
+            aId );
+
+    CleanupStack::PopAndDestroy( 3, fakeSrv );
+
+    WaitRequestAndStackEvents( reqId );
+    VerifyEventStackL( _L8("Binding (wrapper BindL): ") );
+
+    EUNIT_ASSERT_DESC( iMessenger->GetBoolean( EXIMPPlgTestOpenSessionCalled ) ||
+                       iMessenger->GetBoolean( EXIMPPlgTestShareSessionCalled ), "OpenSessionL was not called" );
+    }
+
+  
+    
+ ///NEW BIND   
+ EXPORT_C void CXIMPTestContextWrapper::BindWithSettingsL( TInt aId )
+    {
+    SetupListenerL( EXIMPTestStatusEvents_BindingOk );
+    iMessenger->SetNoError();
+    iMessenger->SetPluginIndex( 0/*aId*/ );
+
+    // create fake info
+    TInt extraLength = 8; // bad style... but length is enough
+
+    HBufC* fakeSrv = HBufC::NewLC( KTestFakeServer().Length() + extraLength );
+    fakeSrv->Des().AppendFormat( KTestFakeServer, aId );
+
+    HBufC* fakeUser = HBufC::NewLC( KTestFakeUser().Length() + extraLength );
+    fakeUser->Des().AppendFormat( KTestFakeUser, aId );
+
+    HBufC* fakePass = HBufC::NewLC( KTestFakePassword().Length() + extraLength );
+    fakePass->Des().AppendFormat( KTestFakePassword, aId );
+
+    delete iFileTool;
+    iFileTool = NULL;
+    iFileTool = CXIMPTestFileTool::NewL( KTestProtocolUid.iUid, iIndex );
+
+    TXIMPRequestId reqId = iContext->BindToL(
+            KTestProtocolUid, aId );
+
+    CleanupStack::PopAndDestroy( 3, fakeSrv );
+
+    WaitRequestAndStackEvents( reqId );
+    VerifyEventStackL( _L8("Binding (wrapper BindWithSettingsL): ") );
+
+    EUNIT_ASSERT_DESC( iMessenger->GetBoolean( EXIMPPlgTestOpenSessionCalled ) ||
+                       iMessenger->GetBoolean( EXIMPPlgTestShareSessionCalled ), "OpenSessionL was not called" );
+    }
+
+// ---------------------------------------------------------------------------
+// ?description_if_needed
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CXIMPTestContextWrapper::UnbindL()
+    {
+    SetupListenerL( EXIMPTestStatusEvents_UnbindingOk );
+    iMessenger->SetNoError();
+    TXIMPRequestId reqId = iContext->UnbindL();
+
+    WaitRequestAndStackEvents( reqId );
+    VerifyEventStackL( _L8("Unbinding (wrapper UnbindL): ") );
+
+    EUNIT_ASSERT_DESC( iMessenger->GetBoolean( EXIMPPlgTestCloseSessionCalled ) ||
+                       iMessenger->GetBoolean( EXIMPPlgTestUnshareSessionCalled ) , "CloseSession was not called" );
+    if( iMessenger->GetBoolean( EXIMPPlgTestCloseSessionCalled ) )
+        {
+        DeletePresenceContext();
+        //EUNIT_ASSERT_DESC( iMessenger->GetBoolean( EXIMPPlgTestDeath ), "Plugin did not die, destructor not called.");
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// ?description_if_needed
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CXIMPTestFileTool& CXIMPTestContextWrapper::FileTool() const
+    {
+    return *iFileTool;
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/tsrc/tsrcutils/testcaseutils/prfwtestcontextwrapper.h	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  Testing context wrapper
+ *
+*/
+
+
+#ifndef CPRFWTESTCONTEXTWRAPPER_H
+#define CPRFWTESTCONTEXTWRAPPER_H 
+
+#include <e32base.h>
+
+#include "prfwteststatuseventlistener.h"
+
+class MXIMPClient;
+class MXIMPContext;
+class CXIMPTestStatusEventListener;
+class CXIMPTestMessenger;
+class CXIMPTestFileTool;
+class MPresenceFeatures;
+
+/**
+ * Wrapper for testing.
+ * Owns the things needed to test one host-plugin connection.
+ *
+ * @since S60 v4.0
+ */
+class CXIMPTestContextWrapper : public CBase
+    {
+    public:
+
+        /**
+         * @param aIndex Index of wrapper (used for pubsub-messaging
+         * between test plugin and test code).
+         */
+        IMPORT_C static CXIMPTestContextWrapper* NewL( TInt aIndex, MXIMPClient* aClient );
+        virtual ~CXIMPTestContextWrapper();
+
+    private:
+
+        CXIMPTestContextWrapper( TInt aIndex, MXIMPClient* aClient );
+        void ConstructL();
+
+    public:
+
+        // accessors
+        IMPORT_C MXIMPContext* GetContext();
+        IMPORT_C CXIMPTestStatusEventListener* GetEventListener();
+        IMPORT_C CXIMPTestMessenger* GetMessenger();
+        IMPORT_C MXIMPClient* GetClient();
+        IMPORT_C RArray<TXIMPTestStatusEventSnapshot>* GetStatusTraits();
+        IMPORT_C MPresenceFeatures* GetPresenceFeatures();
+
+        // low-level test support - see e.g. t_sessionmng test for usage
+        //
+        /**
+         * Delete the presence context and set it to NULL.
+         */
+        IMPORT_C void DeletePresenceContext();
+
+        /**
+         * Like SetupListenerL but sets no event template. Use AppendToTraitsL to set
+         * the desired templates. Useful for certain test cases.
+         */
+        IMPORT_C void SetupEmptyListener();
+
+        /**
+         * Setup a listener using the given event template for the traits.
+         * @param aEventType The event template to listen to.
+         */
+        IMPORT_C void SetupListenerL( TXIMPTestStatusEventTemplate aEventType );
+
+        /**
+         * Append the given template to the internal traits.
+         * @param aEventType The event template to add.
+         */
+        IMPORT_C void AppendToTraitsL( TXIMPTestStatusEventTemplate aEventType );
+
+        /**
+         * Setup a listener for a request complete event. All other events from the
+         * given template are ignored (except those given by aAdditionalEvents).
+         * @param aEventType The event template.
+         * @param aAdditionalEvents Additional events to listen to.
+         */
+        IMPORT_C void SetupListenerReqCompleteL( 
+                TXIMPTestStatusEventTemplate aEventType,
+                RArray< TInt32 >* aAdditionalEvents = NULL );
+
+        /**
+         * Clear the listener.
+         */
+        IMPORT_C void ClearListener();
+        
+        /**
+         * Back to begin state of listener.
+         */
+        IMPORT_C void ResetListener(); 
+
+        /**
+         * Wait for the events and a request complete event for the given request id.
+         * @param aReqId The request id for which a req. complete ends the wait
+         */
+        IMPORT_C void WaitRequestAndStackEvents( TXIMPRequestId aReqId );
+
+        /**
+         * Wait for any event to occur. Event ends the wait.
+         */
+        IMPORT_C void WaitAnyEvent();
+
+        /**
+         * Verify the event stack against the previously set template(s).
+         * The description is printed to the EUnit log.
+         * @param aDesc The description
+         */
+        IMPORT_C void VerifyEventStackL( const TPtrC8& aDesc );
+
+        // high-level test support
+        /**
+         * Happy-path binding.
+         */
+        IMPORT_C void BindL( 
+                TUid aUid, 
+                const TDesC& aServer,
+                const TDesC& aUser,
+                const TDesC& aPassword );
+        
+        /**
+         * Happy-path binding alternative method.
+         * The server, userid and password are automatically modified
+         * based on the given id:
+         * Server: www.imps%d.no/wv
+         * User:   user%d
+         * Password: password%d.
+         * @param aId An id used to modify server login data.
+         */
+        IMPORT_C void BindL( TInt aId );
+        
+        IMPORT_C void BindWithSettingsL( TInt aId );
+        /**
+         * Happy-path unbinding
+         */
+        IMPORT_C void UnbindL();
+        
+        /**
+         * Access to filetool of wrapper.
+         */
+        IMPORT_C CXIMPTestFileTool& FileTool() const;
+        
+        /**
+         * @return Instance id
+         */
+        IMPORT_C const TDesC16& InstanceId() const;        
+
+    private: // data
+
+        // not owned
+        MXIMPClient* iClient;
+
+        // owned
+        MXIMPContext* iContext;
+
+        // owned
+        MPresenceFeatures* iPresFeatures;
+
+
+        // owned
+        CXIMPTestStatusEventListener* iListener;
+
+        // owned
+        CXIMPTestMessenger* iMessenger;
+
+        // owned
+        RArray< TXIMPTestStatusEventSnapshot > iStatusEventTraits;
+
+        TInt iIndex;
+        
+        /**
+         * Filetool 
+         */
+        CXIMPTestFileTool* iFileTool;
+        
+        HBufC16* iInstance;     // the global instance id        
+
+    };
+
+#endif // CPRFWTESTCONTEXTWRAPPER_H 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/tsrc/tsrcutils/testcaseutils/prfwtestcontextwrappermgr.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  Testing context wrapper
+ *
+*/
+
+
+
+#include <e32std.h>
+
+#include <ximpclient.h>
+#include <ximpbase.h>
+#include "prfwtestcontextwrappermgr.h"
+#include "prfwtestcontextwrapper.h"
+#include <ximpcontext.h>
+#include "prfwteststatuseventlistener.h"
+#include "prfwtestmessenger.h"
+#include "prfwtestmessaging.h"
+
+// ======== LOCAL FUNCTIONS ========
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// ?description_if_needed
+// ---------------------------------------------------------------------------
+//
+CXIMPTestContextWrapperMgr::CXIMPTestContextWrapperMgr() 
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// ?description_if_needed
+// ---------------------------------------------------------------------------
+//
+void CXIMPTestContextWrapperMgr::ConstructL()
+    {
+    // TODO
+    }
+
+// ---------------------------------------------------------------------------
+// ?description_if_needed
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CXIMPTestContextWrapperMgr* CXIMPTestContextWrapperMgr::NewL()
+    {
+    CXIMPTestContextWrapperMgr* self = new( ELeave ) CXIMPTestContextWrapperMgr();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// ?description_if_needed
+// ---------------------------------------------------------------------------
+//
+CXIMPTestContextWrapperMgr::~CXIMPTestContextWrapperMgr()
+    {
+    iWrappers.Close();
+    iPrClients.Close();
+    }
+
+// ---------------------------------------------------------------------------
+// ?description_if_needed
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CXIMPTestContextWrapperMgr::CreateWrapperL( TInt aClientIndex /* = KErrNotFound */ )
+    {
+    // make sure we've the client
+    MXIMPClient* client = NULL;
+
+    if ( aClientIndex == KErrNotFound )
+        {
+        if( iPrClients.Count() == 0 )
+            {
+            // make a new one
+            client = MXIMPClient::NewClientL();
+            iPrClients.AppendL( client );
+            }
+        else
+            {
+            client = iPrClients[ 0 ];
+            }
+        }
+    else
+        {
+        // if the index was bad, everything will blow. it's up to the client to instruct
+        // us correctly
+        client = iWrappers[ aClientIndex ]->GetClient();
+        }
+
+    CXIMPTestContextWrapper* tmp = CXIMPTestContextWrapper::NewL( iIndex, client );
+    iWrappers.AppendL( tmp );
+
+    iIndex++;
+    }
+
+// ---------------------------------------------------------------------------
+// ?description_if_needed
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CXIMPTestContextWrapper* CXIMPTestContextWrapperMgr::GetWrapperL( TInt aIndex )
+    {
+    return iWrappers[ aIndex ];
+    }
+
+EXPORT_C TInt CXIMPTestContextWrapperMgr::WrapperCount() const
+    {
+    return iWrappers.Count();
+    } 
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/tsrc/tsrcutils/testcaseutils/prfwtestcontextwrappermgr.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,81 @@
+/*
+* 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:  Testing context wrapper
+ *
+*/
+
+
+#ifndef CPRFWTESTCONTEXTWRAPPERMGR_H
+#define CPRFWTESTCONTEXTWRAPPERMGR_H 
+
+#include <e32base.h>
+#include <ximpbase.h>
+
+#include "prfwteststatuseventlistener.h"
+
+class MXIMPClient;
+class CXIMPTestContextWrapper;
+class MXIMPContext;
+class CXIMPTestStatusEventListener;
+class CXIMPTestMessenger;
+
+/**
+ * Manager for wrappers.
+ * Owns the wrappers and provides convenience methods for
+ * test code.
+ *
+ * @since S60 v4.0
+ */
+class CXIMPTestContextWrapperMgr : public CBase
+    {
+    public:
+
+        IMPORT_C static CXIMPTestContextWrapperMgr* NewL();
+        virtual ~CXIMPTestContextWrapperMgr();
+
+    private:
+
+        CXIMPTestContextWrapperMgr();
+        void ConstructL();
+
+    public:
+
+        /**
+         * Creates a wrapper. The presence client can be given for wrappers
+         * which share a presence client.
+         * @param aClientIndex Use the client from this wrapper
+         * If aClientIndex is KErrNotFound, creates a new client.
+         */
+        IMPORT_C void CreateWrapperL( TInt aClientIndex = KErrNotFound );
+
+        /**
+         * Direct access to a wrapper. Ownership NOT transferred.
+         * @param aIndex The index of desired wrapper
+         */
+        IMPORT_C CXIMPTestContextWrapper* GetWrapperL( TInt aIndex );
+
+        /**
+         * Count of wrappers
+         */         
+        IMPORT_C TInt WrapperCount() const;
+
+    private: // data
+
+        RXIMPObjOwningPtrArray<CXIMPTestContextWrapper> iWrappers;
+        RXIMPObjOwningPtrArray<MXIMPClient> iPrClients;
+
+        TInt iIndex;
+    };
+
+#endif // CPRFWTESTCONTEXTWRAPPERMGR_H 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/tsrc/tsrcutils/testcaseutils/prfwtestdlluids.hrh	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  Presence Framework Eunit tests.
+*
+*/
+
+#ifndef PRFWTESTDLLUIDS_HRH
+#define PRFWTESTDLLUIDS_HRH
+
+
+// -----------------------------------------------------------------------------
+// These are system wide UID 2:s for the various dll types.
+//
+// -----------------------------------------------------------------------------
+//
+#define PRFWTEST_DLL_UID_STATIC_INTERFACE           0x1000008d
+#define PRFWTEST_DLL_UID_ECOM_PLUGIN                0x10009D8D
+
+// -----------------------------------------------------------------------------
+// These are the UID 3:s for the Presence Framework test dlls.
+//
+// -----------------------------------------------------------------------------
+//
+#define PRFWTEST_DLL_UID_COMMON                     0x1110ff50 // TODO
+
+
+#endif // PRFWDLLUIDS_HRH
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/tsrc/tsrcutils/testcaseutils/prfwtesteventfactory.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,426 @@
+/*
+* 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:  XIMP Framework XIMPTestEventFactory
+*
+*/
+
+
+#include "prfwtestcaseutilspanics.h"
+#include "prfwtesteventfactory.h"
+
+#include <eunitmacros.h>
+#include <ximpcontextstateevent.h>
+#include <ximprequestcompleteevent.h>
+#include <ximpstatus.h>
+#include <presentitypresenceevent.h>
+#include <presentitygrouplistevent.h>
+#include <presentitygroupcontentevent.h>
+#include <presenceinfo.h>
+
+#include "ximpidentityimp.h"
+#include "presencetypehelpers.h"
+#include "presentitygroupinfoimp.h"
+#include "presentitygroupmemberinfoimp.h"
+#include "presentitygroupcontenteventimp.h"
+#include "presentitygrouplisteventimp.h"
+
+
+
+using namespace NXIMPTestCaseUtilsPanic;
+
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// ---------------------------------------------------------------------------
+// create a group content event with given arrays
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CPresentityGroupContentEventImp*
+XIMPTestEventFactory::CreateGroupContentEventLCX(
+        const TDesC& aGroupId,
+        const TDesC& aIdentityForDelta,
+        const TDesC& aDispNameForDelta,
+        TTestPGLContentArraySpecifier aArraySpec,
+        const TDesC& aIdentityCurrent,
+        const TDesC& aDispNameCurrent,
+        MXIMPDataSubscriptionState::TSubscriptionState aSubscriptionState,
+        MXIMPDataSubscriptionState::TDataState aDataState
+        )
+    {
+    // id for group
+    CXIMPIdentityImp* idForGroup = CXIMPIdentityImp::NewLC( aGroupId );
+
+    // create the arrays
+    RPrGrpMemInfoImpArray* addedList = new ( ELeave ) RPrGrpMemInfoImpArray;
+    CleanupDeletePushL( addedList );
+
+    RPrGrpMemInfoImpArray* updatedList = new ( ELeave ) RPrGrpMemInfoImpArray;
+    CleanupDeletePushL( updatedList );
+
+    RPrGrpMemInfoImpArray* removedList = new ( ELeave ) RPrGrpMemInfoImpArray;
+    CleanupDeletePushL( removedList );
+
+    RPrGrpMemInfoImpArray* currentList = new ( ELeave ) RPrGrpMemInfoImpArray;
+    CleanupDeletePushL( currentList );
+
+    // populate the current list
+    if ( aIdentityCurrent.Length() > 0 )
+        {
+        // but don't put "KNullDesC" there if it's really empty
+        CXIMPIdentityImp* idForCurrent = CXIMPIdentityImp::NewLC( aIdentityCurrent );
+        CPresentityGroupMemberInfoImp* grpInfoForCurrent =
+            CPresentityGroupMemberInfoImp::NewLC( *idForCurrent, aDispNameCurrent );
+        currentList->AppendL( grpInfoForCurrent );
+        CleanupStack::Pop( grpInfoForCurrent );
+        CleanupStack::PopAndDestroy( idForCurrent );
+        }
+
+    // create the delta list
+    CXIMPIdentityImp* idForEvent = CXIMPIdentityImp::NewLC( aIdentityForDelta );
+    CPresentityGroupMemberInfoImp* grpInfoForEvent =
+        CPresentityGroupMemberInfoImp::NewLC( *idForEvent, aDispNameForDelta );
+
+    // notice the cleanup stack usage. AppendL takes ownership, but
+    // it might not be done always.
+    TBool didAppend = EFalse;
+
+    // put the given group info into the specified array.
+    switch ( aArraySpec )
+        {
+        case ETestPGLCntAdded :
+            {
+            if ( aIdentityForDelta.Length() > 0 )
+                {
+                addedList->AppendL( grpInfoForEvent );
+                didAppend = ETrue;
+                }
+            break;
+            }
+
+        case ETestPGLCntUpdated :
+            {
+            if ( aIdentityForDelta.Length() > 0 )
+                {
+                updatedList->AppendL( grpInfoForEvent );
+                didAppend = ETrue;
+                }
+            break;
+            }
+
+        case ETestPGLCntRemoved :
+            {
+            if ( aIdentityForDelta.Length() > 0 )
+                {
+                removedList->AppendL( grpInfoForEvent );
+                didAppend = ETrue;
+                }
+            break;
+            }
+
+        case ETestPGLCntEmpty :
+            {
+            // don't add, thus creating an empty array.
+            break;
+            }
+
+        default:
+            {
+            User::Leave( KErrArgument );
+            break;
+            }
+        };
+
+    // remove the event and id from cleanupstack. removal
+    // method depends on whether we did append or not
+    if ( didAppend )
+        {
+        CleanupStack::Pop( grpInfoForEvent );
+        CleanupStack::PopAndDestroy( idForEvent );
+        }
+    else
+        {
+        CleanupStack::PopAndDestroy( 2, idForEvent );
+        }
+
+    CXIMPDataSubscriptionStateImp* stateImp = CXIMPDataSubscriptionStateImp::NewLC();
+    stateImp->SetSubscriptionStateL( aSubscriptionState );
+    stateImp->SetDataStateL( aDataState );
+        
+    // create the actual event
+    CPresentityGroupContentEventImp* tmp =
+        CPresentityGroupContentEventImp::NewLC(
+                *idForGroup,
+                addedList,
+                updatedList,
+                removedList,
+                currentList,
+                stateImp
+                );
+    CleanupStack::Pop( 2, stateImp );
+    CleanupStack::PushL( tmp );
+
+    // test the accessors
+    if ( aIdentityForDelta.Length() > 0 )
+        {
+        switch ( aArraySpec )
+            {
+            case ETestPGLCntAdded :
+                {
+                EUNIT_ASSERT_DESC( tmp->NewMembersCount() == 1, "Added group member count mismatch" );
+                TBool same = 0 == tmp->NewMember( 0 ).GroupMemberId().Identity().Compare( aIdentityForDelta );
+                EUNIT_ASSERT_DESC( same, "Added group member id mismatch" );
+                break;
+                }
+
+            case ETestPGLCntUpdated :
+                {
+                EUNIT_ASSERT_DESC( tmp->UpdatedMembersCount() == 1, "Updated group member count mismatch" );
+                TBool same = 0 == tmp->UpdatedMember( 0 ).GroupMemberId().Identity().Compare( aIdentityForDelta );
+                EUNIT_ASSERT_DESC( same, "Updated group member id mismatch" );
+                break;
+                }
+
+            case ETestPGLCntRemoved :
+                {
+                EUNIT_ASSERT_DESC( tmp->DisappearedMembersCount() == 1, "Removed group member count mismatch" );
+                TBool same = 0 == tmp->DisappearedMember( 0 ).GroupMemberId().Identity().Compare( aIdentityForDelta );
+                EUNIT_ASSERT_DESC( same, "Removed group member id mismatch" );
+                break;
+                }
+
+            case ETestPGLCntEmpty :
+                {
+                // don't add, thus creating an empty array.
+                break;
+                }
+
+            default :
+                {
+                break;
+                }
+            }
+        }
+
+    if ( aIdentityCurrent.Length() > 0 )
+        {
+        EUNIT_ASSERT_DESC( tmp->CurrentMembersCount() == 1, "Current group member count mismatch" );
+        
+        TBool same = 0 == tmp->CurrentMember( 0 ).GroupMemberId().Identity().Compare( aIdentityCurrent );
+        EUNIT_ASSERT_DESC( same, "Current group member id mismatch" );
+        
+        same = 0 == tmp->CurrentMember( 0 ).GroupMemberDisplayName().Compare( aDispNameCurrent );
+        EUNIT_ASSERT_DESC( same, "Current group member display name mismatch" );
+        }
+    else
+        {
+        EUNIT_ASSERT_DESC( tmp->CurrentMembersCount() == 0, "Current group member count mismatch" );
+        }
+
+    /*
+     * In cleanupstack there are 6 items, FIFO:
+     *   - identity object
+     *   - added list
+     *   - updated list
+     *   - removed list
+     *   - current member list
+     *   - event imp
+     */
+
+    return tmp;
+    }
+
+
+// ---------------------------------------------------------------------------
+// create a group list event with given arrays
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CPresentityGroupListEventImp* XIMPTestEventFactory::CreateGroupListEventLCX(
+        const TDesC& aUri,
+        const TDesC& aDispName,
+        TTestPGLArraySpecifier aArraySpec,
+        const TDesC& aUriCurrent,
+        const TDesC& aDispNameCurrent,
+        MXIMPDataSubscriptionState::TSubscriptionState aSubscriptionState,
+        MXIMPDataSubscriptionState::TDataState aDataState
+        )
+    {
+    // create the arrays
+    RPrGrpInfoImpArray* createdList = new ( ELeave ) RPrGrpInfoImpArray;
+    CleanupDeletePushL( createdList );
+
+    RPrGrpInfoImpArray* updatedList = new ( ELeave ) RPrGrpInfoImpArray;
+    CleanupDeletePushL( updatedList );
+
+    RPrGrpInfoImpArray* deletedList = new ( ELeave ) RPrGrpInfoImpArray;
+    CleanupDeletePushL( deletedList );
+    
+    RPrGrpInfoImpArray* currentList = new ( ELeave ) RPrGrpInfoImpArray;
+    CleanupDeletePushL( currentList );
+
+    // create the group info
+    CXIMPIdentityImp* idForEvent = CXIMPIdentityImp::NewLC( aUri );
+    CPresentityGroupInfoImp* grpInfoForEvent =
+        CPresentityGroupInfoImp::NewLC( *idForEvent, aDispName );
+
+    // populate the current list
+    if ( aUriCurrent.Length() > 0 )
+        {
+        // but don't put "KNullDesC" there if it's really empty
+        CXIMPIdentityImp* idForCurrent = CXIMPIdentityImp::NewLC( aUriCurrent );
+        CPresentityGroupInfoImp* grpInfoForCurrent =
+            CPresentityGroupInfoImp::NewLC( *idForCurrent, aDispNameCurrent );
+        currentList->AppendL( grpInfoForCurrent );
+        CleanupStack::Pop( grpInfoForCurrent );
+        CleanupStack::PopAndDestroy( idForCurrent );
+        }
+    
+    // notice the cleanup stack usage. AppendL takes ownership, but
+    // it might not be done always.
+    TBool didAppend = EFalse;
+
+    // put the given group info into the specified array
+    switch ( aArraySpec )
+        {
+        case ETestPGLCreated :
+            {
+            if ( aUri.Length() > 0 )
+                {
+                createdList->AppendL( grpInfoForEvent );
+                didAppend = ETrue;
+                }
+            break;
+            }
+
+        case ETestPGLUpdated :
+            {
+            if ( aUri.Length() > 0 )
+                {
+                updatedList->AppendL( grpInfoForEvent );
+                didAppend = ETrue;
+                }
+            break;
+            }
+
+        case ETestPGLDeleted :
+            {
+            if ( aUri.Length() > 0 )
+                {
+                deletedList->AppendL( grpInfoForEvent );
+                didAppend = ETrue;
+                }
+            break;
+            }
+
+        case ETestPGLEmpty :
+            {
+            // don't add, thus creating an empty array
+            break;
+            }
+
+        default:
+            {
+            User::Leave( KErrArgument );
+            break;
+            }
+        };
+
+    // remove the event and id from cleanupstack. removal
+    // method depends on whether we did append or not
+    if ( didAppend )
+        {
+        CleanupStack::Pop( grpInfoForEvent );
+        CleanupStack::PopAndDestroy( idForEvent );
+        }
+    else
+        {
+        CleanupStack::PopAndDestroy( 2, idForEvent );
+        }
+
+    CXIMPDataSubscriptionStateImp* stateImp = CXIMPDataSubscriptionStateImp::NewLC();
+    stateImp->SetSubscriptionStateL( aSubscriptionState );
+    stateImp->SetDataStateL( aDataState );
+        
+    // create the actual event
+    CPresentityGroupListEventImp* tmp =
+        CPresentityGroupListEventImp::NewLC(
+                createdList,
+                updatedList,
+                deletedList,
+                currentList,
+                stateImp
+                );                
+    CleanupStack::Pop( 2, stateImp );
+    CleanupStack::PushL( tmp );
+
+    // verify that the event contains correct information
+    if ( aUri.Length() > 0 )
+        {
+        switch ( aArraySpec )
+            {
+            case ETestPGLCreated :
+                {
+                EUNIT_ASSERT_DESC( tmp->NewGroupsCount() == 1, "Created group count mismatch" );
+                TBool same = 0 == tmp->NewGroup( 0 ).GroupId().Identity().Compare( aUri );
+                EUNIT_ASSERT_DESC( same, "Created group id mismatch" );
+                break;
+                }
+
+            case ETestPGLUpdated :
+                {
+                EUNIT_ASSERT_DESC( tmp->UpdatedGroupsCount() == 1, "Updated group count mismatch" );
+                TBool same = 0 == tmp->UpdatedGroup( 0 ).GroupId().Identity().Compare( aUri );
+                EUNIT_ASSERT_DESC( same, "Updated group id mismatch" );
+                break;
+                }
+
+            case ETestPGLDeleted :
+                {
+                EUNIT_ASSERT_DESC( tmp->DisappearedGroupsCount() == 1, "Deleted group count mismatch" );
+                TBool same = 0 == tmp->DisappearedGroup( 0 ).GroupId().Identity().Compare( aUri );
+                EUNIT_ASSERT_DESC( same, "Deleted group id mismatch" );
+                break;
+                }
+            }
+        }
+    
+    if ( aUriCurrent.Length() > 0 )
+        {
+        EUNIT_ASSERT_DESC( tmp->CurrentGroupsCount() == 1, "Current group count mismatch" );
+   
+        TBool same = 0 == tmp->CurrentGroup( 0 ).GroupId().Identity().Compare( aUriCurrent );
+        EUNIT_ASSERT_DESC( same, "Current group id mismatch" );
+        
+        same = 0 == tmp->CurrentGroup( 0 ).GroupDisplayName().Compare( aDispNameCurrent );
+        EUNIT_ASSERT_DESC( same, "Current group display name mismatch" );
+        }
+    else
+        {
+        EUNIT_ASSERT_DESC( tmp->CurrentGroupsCount() == 0, "Current group count mismatch, expected 0" );
+        }
+
+    /*
+     * In cleanupstack there are 5 items, FIFO:
+     *   - created list
+     *   - updated list
+     *   - deleted list
+     *   - current list
+     *   - event imp
+     */
+
+    return tmp;
+    }
+
+// end of file
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/tsrc/tsrcutils/testcaseutils/prfwtesteventfactory.h	Wed Nov 03 09:32:20 2010 +0530
@@ -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: XIMP Framework XIMPTestEventFactory
+*
+*/
+
+
+#ifndef PRFWTESTEVENTFACTORY_H__
+#define PRFWTESTEVENTFACTORY_H__
+
+#include <e32base.h>
+#include <ximpdatasubscriptionstate.h>
+
+// CLASS DESCRIPTION
+
+class CPresentityGroupListEventImp;
+class CPresentityGroupContentEventImp;
+class CXIMPDataSubscriptionStateImp;
+
+/**
+ * Presence event factory for use in tests.
+ */
+class XIMPTestEventFactory
+    {
+    public:
+
+        // @see below  
+        enum TTestPGLArraySpecifier 
+            { 
+            ETestPGLCreated = 0,    // group info is created
+            ETestPGLUpdated,        // group info is updated
+            ETestPGLDeleted,        // group info is deleted
+            ETestPGLEmpty,          // make an empty array for empty event
+            };
+
+        /**
+         * Places an identity (uri-displayname pair) inside a group info into the
+         * array defined by aArraySpec, and returns the created event.
+         *
+         * In cleanupstack there are 5 items, FIFO:
+         *   - created list
+         *   - updated list
+         *   - deleted list
+         *   - current list
+         *   - event imp
+         *
+         * This is because this event won't take ownership to the arrays
+         * when created this way.
+         *
+         * @param aUri URI of group
+         * @param aDispName Displayname
+         * @param aArraySpec Defines into which array to put the group info
+         * @param aUriCurrent The URI of group in "current"-list
+         * @param aDispNameCurrent The display name of the group in
+         * "current"-list
+         * @param aStatus The subscription status 
+         * @return The suitably filled event.
+         */
+        IMPORT_C static CPresentityGroupListEventImp* CreateGroupListEventLCX( 
+                const TDesC& aUri,
+                const TDesC& aDispName,
+
+                TTestPGLArraySpecifier aArraySpec,
+
+                const TDesC& aUriCurrent,
+                const TDesC& aDispNameCurrent,
+                
+                MXIMPDataSubscriptionState::TSubscriptionState aSubscriptionState,
+                MXIMPDataSubscriptionState::TDataState aDataState
+                );
+
+        // @see below  
+        enum TTestPGLContentArraySpecifier 
+            { 
+            ETestPGLCntAdded = 0,    // group content is added
+            ETestPGLCntUpdated,      // group content is updated
+            ETestPGLCntRemoved,      // group content is deleted
+            ETestPGLCntEmpty,        // make an empty array for empty event
+            };
+
+        /**
+         * Places an group member (identity-displayname pair) inside 
+         * a group content info into the delta array defined by aArraySpec, 
+         * and returns the created event.
+         *
+         * The current member list will contain only the group member
+         * specified by parameters aIdentityCurrent and aDispNameCurrent.
+         * To support more members than 1 this method needs to be changed,
+         * but for now, it suffices for our testing.
+         *
+         * In cleanupstack there are 5 items, FIFO:
+         *   - added list
+         *   - updated list
+         *   - removed list
+         *   - current member list
+         *   - event imp
+         *
+         * This is because this event won't take ownership to the arrays
+         * when created this way.
+         *
+         * @param aGroupId The group id
+         * @param aUri Uri
+         * @param aDispName Displayname
+         * @param aArraySpec Defines into which delta array to put the member
+         * @param aIdentityCurrent Identity part of current member
+         * @param aDispNameCurrent Display name part of current member
+         * @param aStatus The subscription status
+         * @return The suitably filled event.
+         */
+        IMPORT_C static CPresentityGroupContentEventImp* 
+            CreateGroupContentEventLCX( 
+                    const TDesC& aGroupId,
+                    
+                    const TDesC& aIdentityForDelta,
+                    const TDesC& aDispNameForDelta,
+                    
+                    TTestPGLContentArraySpecifier aArraySpec,
+         
+                    const TDesC& aIdentityCurrent,
+                    const TDesC& aDispNameCurrent,
+                    
+                    MXIMPDataSubscriptionState::TSubscriptionState aSubscriptionState,
+                    MXIMPDataSubscriptionState::TDataState aDataState
+                    );
+    };
+
+#endif //PRFWTESTEVENTFACTORY_H__
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/tsrc/tsrcutils/testcaseutils/prfwtestfilelogichelper.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,317 @@
+/*
+* 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:  Test support file tool
+ *
+*/
+
+
+#include <ximpprotocolconnectionhost.h>
+#include <protocolpresenceauthorizationdatahost.h>
+#include <protocolpresentitygroupsdatahost.h>
+#include <protocolpresencepublishingdatahost.h>
+#include <protocolpresencewatchingdatahost.h>
+#include <ximpdatasubscriptionstate.h>
+#include <protocolpresencedatahost.h>
+#include "prfwtestfilelogichelper.h"
+#include "prfwtestfilesrvmsg.h"
+#include "presentitygroupinfoimp.h"
+#include "presentitygroupmemberinfoimp.h"
+#include "presencewatcherinfoimp.h"
+#include "presencegrantrequestinfoimp.h"
+#include "presenceblockinfoimp.h"
+#include "ximpidentityimp.h"
+#include "ximpobjecthelpers.h"
+#include "prfwtestmessenger.h"
+#include "ximprestrictedobjectcollectionimp.h"
+#include "ximpobjectcollectionimp.h"
+#include "presenceinfoimp.h"
+
+// ======== LOCAL FUNCTIONS ========
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// ?description_if_needed
+// ---------------------------------------------------------------------------
+//
+CXIMPTestFileLogicHelper::CXIMPTestFileLogicHelper( MXIMPProtocolConnectionHost& aHost, CXIMPTestMessenger& aMessenger )
+: iHost( aHost ), iMessenger( aMessenger )
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// ?description_if_needed
+// ---------------------------------------------------------------------------
+//
+void CXIMPTestFileLogicHelper::ConstructL()
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// ?description_if_needed
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CXIMPTestFileLogicHelper* CXIMPTestFileLogicHelper::NewL( MXIMPProtocolConnectionHost& aHost, CXIMPTestMessenger& aMessenger  )
+    {
+    CXIMPTestFileLogicHelper* self = new( ELeave ) CXIMPTestFileLogicHelper( aHost, aMessenger );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// ?description_if_needed
+// ---------------------------------------------------------------------------
+//
+CXIMPTestFileLogicHelper::~CXIMPTestFileLogicHelper()
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// ?description_if_needed
+// ---------------------------------------------------------------------------
+//
+void CXIMPTestFileLogicHelper::HandleL( TInt aCommandType, TDesC8& aCommand )
+    {
+    switch( aCommandType )
+        {
+        case CXIMPTestFileSrvMsg::ETestSrvMsgPresenceGrantRequestList:
+            {
+            RXIMPObjOwningPtrArray< CPresenceGrantRequestInfoImp > array;
+            CleanupClosePushL( array );
+            TXIMPObjectPacker<CPresenceGrantRequestInfoImp>::UnPackArrayL( array, aCommand );
+            CXIMPObjectCollectionImp* objCollection = CXIMPObjectCollectionImp::NewLC();
+            for( TInt a = 0; a < array.Count(); ++a )
+                {
+                objCollection->AddObjectL( array[ a ] );
+                array[ a ] = NULL;
+                }
+
+            iHost.ProtocolPresenceDataHost().AuthorizationDataHost().HandlePresenceGrantRequestListL( objCollection );
+            CleanupStack::Pop( objCollection );
+            CleanupStack::PopAndDestroy(); //array
+            break;
+            }
+        case CXIMPTestFileSrvMsg::ETestSrvMsgPresenceGrantRequestReceived:
+            {
+            CPresenceGrantRequestInfoImp* infoFromServer =
+                                CPresenceGrantRequestInfoImp::NewLC();
+            TXIMPObjectPacker<CPresenceGrantRequestInfoImp>::UnPackL(
+                                    *infoFromServer, aCommand );
+
+            iHost.ProtocolPresenceDataHost().AuthorizationDataHost().HandlePresenceGrantRequestReceivedL( infoFromServer );
+            CleanupStack::Pop( infoFromServer );
+            break;
+            }
+        case CXIMPTestFileSrvMsg::ETestSrvMsgPresenceGrantRequestObsoleted:
+            {
+            CXIMPIdentityImp* idFromServer = CXIMPIdentityImp::NewLC();
+            TXIMPObjectPacker<CXIMPIdentityImp>::UnPackL( *idFromServer,
+                                                            aCommand );
+
+            iHost.ProtocolPresenceDataHost().AuthorizationDataHost().HandlePresenceGrantRequestObsoletedL( idFromServer );
+            CleanupStack::Pop( idFromServer );
+            break;
+            }
+        case CXIMPTestFileSrvMsg::ETestSrvMsgPresentityGroupList:
+            {
+            RXIMPObjOwningPtrArray< CPresentityGroupInfoImp > array;
+            CleanupClosePushL( array );
+            TXIMPObjectPacker<CPresentityGroupInfoImp>::UnPackArrayL( array, aCommand );
+            CXIMPObjectCollectionImp* objCollection = CXIMPObjectCollectionImp::NewLC();
+            for( TInt a = 0; a < array.Count(); ++a )
+                {
+                objCollection->AddObjectL( array[ a ] );
+                array[ a ] = NULL;
+                }
+            iHost.ProtocolPresenceDataHost().GroupsDataHost().HandlePresentityGroupListL( objCollection );
+            CleanupStack::Pop( objCollection );
+            CleanupStack::PopAndDestroy(); //array
+            break;            
+            }
+        case CXIMPTestFileSrvMsg::ETestSrvMsgPresentityGroupCreate:
+        case CXIMPTestFileSrvMsg::ETestSrvMsgPresentityGroupUpdate:
+            {
+            CPresentityGroupInfoImp* infoFromServer =
+                                CPresentityGroupInfoImp::NewLC();
+            TXIMPObjectPacker<CPresentityGroupInfoImp>::UnPackL(
+                                    *infoFromServer, aCommand );
+
+            if( aCommandType == CXIMPTestFileSrvMsg::ETestSrvMsgPresentityGroupCreate )
+                {
+                iHost.ProtocolPresenceDataHost().GroupsDataHost().HandlePresentityGroupCreatedL( infoFromServer );
+                }
+            else
+                {
+                iHost.ProtocolPresenceDataHost().GroupsDataHost().HandlePresentityGroupDisplayNameUpdatedL( infoFromServer );
+                }
+            CleanupStack::Pop( infoFromServer );
+            break;
+            }
+        case CXIMPTestFileSrvMsg::ETestSrvMsgPresentityGroupDelete:
+            {
+            CXIMPIdentityImp* idFromServer = CXIMPIdentityImp::NewLC();
+            TXIMPObjectPacker<CXIMPIdentityImp>::UnPackL( *idFromServer,
+                                                            aCommand );
+            iHost.ProtocolPresenceDataHost().GroupsDataHost().HandlePresentityGroupDeletedL( idFromServer );
+            CleanupStack::Pop( idFromServer );
+            break;
+            }
+        case CXIMPTestFileSrvMsg::ETestSrvMsgPresentityGroupMemberList:
+            {
+            RPointerArray< HBufC8 > bufferArray;
+            CleanupClosePushL( bufferArray );
+            TXIMPHBuf8Packer::UnPackArrayL( bufferArray, aCommand );
+            HBufC8* groupIdBuf = bufferArray[ 0 ];
+            HBufC8* array = bufferArray[ 1 ];
+            CleanupStack::PopAndDestroy(); //  BufferArray
+            CleanupStack::PushL( groupIdBuf );
+            CleanupStack::PushL( array );
+
+            CXIMPIdentityImp* groupId = CXIMPIdentityImp::NewLC();
+            TXIMPObjectPacker< CXIMPIdentityImp >::UnPackL( *groupId, *groupIdBuf );
+
+            RXIMPObjOwningPtrArray< CPresentityGroupMemberInfoImp > memberArray;
+            CleanupClosePushL( memberArray );
+            TXIMPObjectPacker<CPresentityGroupMemberInfoImp>::UnPackArrayL( memberArray, *array );
+            CXIMPObjectCollectionImp* objCollection = CXIMPObjectCollectionImp::NewLC();
+            for( TInt a = 0; a < memberArray.Count(); ++a )
+                {
+                objCollection->AddObjectL( memberArray[ a ] );
+                memberArray[ a ] = NULL;
+                }
+            iHost.ProtocolPresenceDataHost().GroupsDataHost().HandlePresentityGroupContentL( groupId, objCollection );
+            CleanupStack::Pop( objCollection );
+            CleanupStack::PopAndDestroy(); //memberArray
+            CleanupStack::Pop( groupId );
+            CleanupStack::PopAndDestroy( 2, groupIdBuf );
+            break;
+            }
+        case CXIMPTestFileSrvMsg::ETestCheckIfGroupMemberExists:
+            {
+            CXIMPIdentityImp* groupId = CXIMPIdentityImp::NewLC();
+            TXIMPObjectPacker< CXIMPIdentityImp >::UnPackL( *groupId, aCommand );
+            // Write to pubsub
+            const MXIMPDataSubscriptionState& state = 
+                iHost.ProtocolPresenceDataHost().GroupsDataHost().PresentityGroupContentDataSubscriptionState( *groupId );
+            if( state.DataState() == MXIMPDataSubscriptionState::EDataAvailable )
+                {
+                iMessenger.SetValueFor( EXIMPPlgTestExistsGroupContentInCache, 1 );
+                }
+            else
+                {
+                iMessenger.SetValueFor( EXIMPPlgTestExistsGroupContentInCache, KErrNotFound );
+                }
+            CleanupStack::PopAndDestroy( groupId );
+            break;
+            }
+        case CXIMPTestFileSrvMsg::ETestSrvMsgPresenceWatcherList:
+            {
+            RXIMPObjOwningPtrArray< CPresenceWatcherInfoImp > array;
+            CleanupClosePushL( array );
+            TXIMPObjectPacker< CPresenceWatcherInfoImp >::UnPackArrayL( array, aCommand );
+            CXIMPObjectCollectionImp* objCollection = CXIMPObjectCollectionImp::NewLC();
+            for( TInt a = 0; a < array.Count(); ++a )
+                {
+                objCollection->AddObjectL( array[ a ] );
+                array[ a ] = NULL;
+                }
+
+            iHost.ProtocolPresenceDataHost().PublishingDataHost().HandlePresenceWatcherListL( objCollection );
+            CleanupStack::Pop( objCollection );
+            CleanupStack::PopAndDestroy(); //, array
+            break;
+            }
+        case CXIMPTestFileSrvMsg::ETestSrvMsgPresentityPresence:
+            {
+            RPointerArray< HBufC8 > bufferArray;
+            CleanupClosePushL( bufferArray );
+            TXIMPHBuf8Packer::UnPackArrayL( bufferArray, aCommand );
+            HBufC8* presenceIdBuf = bufferArray[ 0 ];
+            HBufC8* presenceInfoBuf = bufferArray[ 1 ];
+            CleanupStack::PopAndDestroy(); //  BufferArray
+            CleanupStack::PushL( presenceIdBuf );
+            CleanupStack::PushL( presenceInfoBuf );
+
+            CXIMPIdentityImp* presenceId = CXIMPIdentityImp::NewLC();
+            TXIMPObjectPacker< CXIMPIdentityImp >::UnPackL( *presenceId, *presenceIdBuf );
+
+            CPresenceInfoImp* presenceInfo = CPresenceInfoImp::NewLC();
+            TXIMPObjectPacker< CPresenceInfoImp >::UnPackL( *presenceInfo, *presenceInfoBuf );
+
+            iHost.ProtocolPresenceDataHost().WatchingDataHost().HandleSubscribedPresentityPresenceL( presenceId, presenceInfo );
+            
+            CleanupStack::Pop( 2, presenceId );
+            CleanupStack::PopAndDestroy( 2, presenceIdBuf );
+            break;
+            }
+        case CXIMPTestFileSrvMsg::ETestSrvMsgPresenceBlockList:
+            {
+            RXIMPObjOwningPtrArray< CPresenceBlockInfoImp > array;
+            CleanupClosePushL( array );
+            TXIMPObjectPacker< CPresenceBlockInfoImp >::UnPackArrayL( array, aCommand );
+            CXIMPObjectCollectionImp* objCollection = CXIMPObjectCollectionImp::NewLC();
+            for( TInt a = 0; a < array.Count(); ++a )
+                {
+                objCollection->AddObjectL( array[ a ] );
+                array[ a ] = NULL;
+                }
+
+            iHost.ProtocolPresenceDataHost().AuthorizationDataHost().HandlePresenceBlockListL( objCollection );
+            CleanupStack::Pop( objCollection );
+            CleanupStack::PopAndDestroy(); // array
+            break;
+            }
+        case CXIMPTestFileSrvMsg::ETestSrvMsgPresenceBlocked:
+            {
+            CPresenceBlockInfoImp* infoFromServer =
+                                CPresenceBlockInfoImp::NewLC();
+            TXIMPObjectPacker<CPresenceBlockInfoImp>::UnPackL(
+                                    *infoFromServer, aCommand );
+            iHost.ProtocolPresenceDataHost().AuthorizationDataHost().HandlePresenceBlockedL( infoFromServer );
+            CleanupStack::Pop( infoFromServer );
+            break;
+            }
+        case CXIMPTestFileSrvMsg::ETestSrvMsgPresenceBlockCanceled:
+            {
+            CXIMPIdentityImp* idFromServer = CXIMPIdentityImp::NewLC();
+            TXIMPObjectPacker<CXIMPIdentityImp>::UnPackL( *idFromServer,
+                                                            aCommand );
+
+            iHost.ProtocolPresenceDataHost().AuthorizationDataHost().HandlePresenceBlockCanceledL( idFromServer );
+
+            CleanupStack::Pop( idFromServer );
+            break;
+            }
+
+        case CXIMPTestFileSrvMsg::ETestSrvMsgReqParamIdentity:
+            {
+            CXIMPIdentityImp* groupId = CXIMPIdentityImp::NewLC();
+            TXIMPObjectPacker< CXIMPIdentityImp >::UnPackL( *groupId, aCommand );
+            CXIMPRestrictedObjectCollectionImp* paramCollection = CXIMPRestrictedObjectCollectionImp::NewLC();
+            paramCollection->AddOrReplaceTypeL( groupId );
+            iMessenger.SetReqCompleteParams( paramCollection );
+            CleanupStack::Pop( 2, groupId );
+            break;
+            }
+        default:
+            {
+            User::Panic( _L( "Not valid commandtype" ), 59 );
+            break;
+            }
+        }
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/tsrc/tsrcutils/testcaseutils/prfwtestfilelogichelper.h	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  Test support file tool
+ *
+*/
+
+
+#ifndef CPRFWTESTFILELOGICHELPER_H
+#define CPRFWTESTFILELOGICHELPER_H
+
+#include <e32base.h>
+#include "prfwtestfileobserver.h"
+
+class MXIMPProtocolConnectionHost;
+class CXIMPTestMessenger;
+
+/**
+ * @since S60 v4.0
+ */
+class CXIMPTestFileLogicHelper : public CBase, public MXIMPTestFileObserver
+    {
+    public:
+
+        IMPORT_C static CXIMPTestFileLogicHelper* NewL( MXIMPProtocolConnectionHost& aHost, CXIMPTestMessenger& aMessenger  );
+        virtual ~CXIMPTestFileLogicHelper();
+
+    private:
+
+        CXIMPTestFileLogicHelper( MXIMPProtocolConnectionHost& aHost, CXIMPTestMessenger& aMessenger );
+        void ConstructL();
+
+    public:
+
+
+    private: // From MXIMPTestFileObserver
+
+        /**
+         * @see MXIMPTestFileObserver
+         */
+        virtual void HandleL( TInt aCommandType, TDesC8& aCommand );
+
+    private: // data
+
+        /**
+         * Access to host for server messages.
+         */
+        MXIMPProtocolConnectionHost& iHost;
+        
+        /**
+         * Does not own. Messenger for signaling.
+         */
+        CXIMPTestMessenger& iMessenger;
+    };
+
+#endif // CPRFWTESTFILELOGICHELPER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/tsrc/tsrcutils/testcaseutils/prfwtestfileobserver.h	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  Test support file tool
+ *
+*/
+
+
+#ifndef MPRFWTESTFILEOBSERVER_H
+#define MPRFWTESTFILEOBSERVER_H
+
+/**
+ * @since S60 v4.0
+ */
+class MXIMPTestFileObserver
+    {
+    protected:
+
+        /**
+         * Cannot be deleted through this interface
+         */
+        virtual ~MXIMPTestFileObserver(){}
+
+    public: // Interface
+
+        virtual void HandleL( TInt aCommandType, TDesC8& aCommand ) = 0;
+
+    };
+
+#endif // CPRFWTESTFILELOGICHELPER_H
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/tsrc/tsrcutils/testcaseutils/prfwtestfilesrvmsg.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,149 @@
+/*
+* 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:  Test support file tool server message
+ *
+*/
+
+
+
+#include <e32std.h>
+#include <f32file.h>
+#include <s32file.h>
+
+#include "prfwtestfilesrvmsg.h"
+
+// ======== LOCAL FUNCTIONS ========
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// ?description_if_needed
+// ---------------------------------------------------------------------------
+//
+CXIMPTestFileSrvMsg::CXIMPTestFileSrvMsg()
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// ?description_if_needed
+// ---------------------------------------------------------------------------
+//
+void CXIMPTestFileSrvMsg::ConstructL()
+    {
+    iPayload = HBufC8::NewL(0);
+    }
+
+
+// ---------------------------------------------------------------------------
+// ?description_if_needed
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CXIMPTestFileSrvMsg* CXIMPTestFileSrvMsg::NewLC()
+    {
+    CXIMPTestFileSrvMsg* self = new( ELeave ) CXIMPTestFileSrvMsg();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// ?description_if_needed
+// ---------------------------------------------------------------------------
+//
+void CXIMPTestFileSrvMsg::ConstructL( const TDesC8& aPayload )
+    {
+    iPayload = aPayload.AllocL();
+    }
+
+// ---------------------------------------------------------------------------
+// ?description_if_needed
+// ---------------------------------------------------------------------------
+//
+CXIMPTestFileSrvMsg::CXIMPTestFileSrvMsg( TInt aSrvMsgId ) :
+    iSrvMsgId( aSrvMsgId )
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// ?description_if_needed
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CXIMPTestFileSrvMsg* CXIMPTestFileSrvMsg::NewL(
+        TInt aSrvMsgId,
+        const TDesC8& aPayload )
+    {
+    CXIMPTestFileSrvMsg* self = new( ELeave ) CXIMPTestFileSrvMsg( aSrvMsgId );
+    CleanupStack::PushL( self );
+    self->ConstructL( aPayload );
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// ?description_if_needed
+// ---------------------------------------------------------------------------
+//
+CXIMPTestFileSrvMsg::~CXIMPTestFileSrvMsg()
+    {
+    delete iPayload;
+    }
+
+// ---------------------------------------------------------------------------
+// ?description_if_needed
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CXIMPTestFileSrvMsg::ExternalizeL( RWriteStream& aStream ) const
+    {
+    aStream.WriteUint32L( iSrvMsgId );
+    aStream.WriteUint32L( iPayload->Length() );
+    aStream.WriteL( *iPayload );
+    }
+        
+// ---------------------------------------------------------------------------
+// ?description_if_needed
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CXIMPTestFileSrvMsg::InternalizeL( RReadStream& aStream )
+    {
+    iSrvMsgId = aStream.ReadUint32L();
+    TInt len = aStream.ReadUint32L();
+
+    HBufC8* buffer = HBufC8::NewLC( len );
+    TPtr8 ptr = buffer->Des();
+    aStream.ReadL( ptr, len );
+
+    delete iPayload;
+    CleanupStack::Pop( buffer );
+    iPayload = buffer;   
+    }
+        
+// ---------------------------------------------------------------------------
+// ?description_if_needed
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TDesC8& CXIMPTestFileSrvMsg::PayloadL()
+    {
+    return *iPayload;
+    }
+        
+// ---------------------------------------------------------------------------
+// ?description_if_needed
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CXIMPTestFileSrvMsg::SrvMsgId()
+    {
+    return iSrvMsgId;
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/tsrc/tsrcutils/testcaseutils/prfwtestfilesrvmsg.h	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  Test support file tool server message
+ *
+*/
+
+
+#ifndef CPRFWTESTFILESRVMSG_H
+#define CPRFWTESTFILESRVMSG_H 
+
+#include <e32base.h>
+#include <s32strm.h>
+
+/**
+ * Support for servermessage files.
+ *
+ * @since S60 v4.0
+ */
+class CXIMPTestFileSrvMsg : public CBase
+    {
+    public:
+    
+        enum TTestSrvMsgType
+            {
+            ETestSrvMsgPresenceBlockList,
+            ETestSrvMsgPresenceBlocked,
+            ETestSrvMsgPresenceBlockCanceled,
+            ETestSrvMsgPresenceGrantRequestList,
+            ETestSrvMsgPresenceGrantRequestReceived,
+            ETestSrvMsgPresenceGrantRequestObsoleted,
+            ETestSrvMsgPresentityGroupList,
+            ETestSrvMsgPresentityGroupCreate,
+            ETestSrvMsgPresentityGroupDelete,
+            ETestSrvMsgPresentityGroupUpdate,
+            ETestSrvMsgPresentityGroupMemberList,
+            ETestCheckIfGroupMemberExists,
+            ETestSrvMsgPresenceWatcherList,
+            ETestSrvMsgPresentityPresence,
+            ETestSrvMsgReqParamIdentity,
+            };
+    
+    public:
+
+        IMPORT_C static CXIMPTestFileSrvMsg* NewLC();
+        
+        IMPORT_C static CXIMPTestFileSrvMsg* NewL( 
+                TInt aSrvMsgId,
+                const TDesC8& aPayload );
+        
+        virtual ~CXIMPTestFileSrvMsg();
+
+    private:
+
+        CXIMPTestFileSrvMsg();
+
+        void ConstructL();
+        
+        CXIMPTestFileSrvMsg( TInt aSrvMsgId );
+        
+        void ConstructL( const TDesC8& aPayload );
+
+    public:
+
+        /**
+         * Extenalizes object data to given stream.
+         * @param aStream Stream to write.
+         */
+        IMPORT_C void ExternalizeL( RWriteStream& aStream ) const;
+
+        /**
+         * Internalizes object data from given stream.
+         * @param aStream Stream to read.
+         */
+        IMPORT_C void InternalizeL( RReadStream& aStream );
+
+        /**
+         * Getter for the data stored inside this class.
+         * @return Reference to the data
+         */
+        IMPORT_C TDesC8& PayloadL();
+
+        /**
+         * Server message identifier specifies what kind of
+         * server-originated message this is.
+         * @return Server message identifier
+         */
+        IMPORT_C TInt SrvMsgId();
+
+    private: // data
+
+        TInt iSrvMsgId;
+        HBufC8* iPayload;
+    };
+
+#endif // CPRFWTESTFILESRVMSG_H 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/tsrc/tsrcutils/testcaseutils/prfwtestfiletool.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,502 @@
+/*
+* 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:  Test support file tool
+ *
+*/
+
+
+
+#include <e32std.h>
+#include <f32file.h>
+#include <s32file.h>
+
+#include "prfwtestfiletool.h"
+#include "prfwtestfilesrvmsg.h"
+#include "ximpeventcodec.h"
+#include "prfwtestfileobserver.h"
+
+/* Hierarchy under C:/temp/prfw/:
+ * /protocoluid/instancenumber/Plugin\
+ * /protocoluid/instancenumber/SrvMsg\
+ */
+
+_LIT( KFileToolMainDirFull, "c:\\temp\\prfw" );
+
+_LIT( KFileToolBackslash, "\\" );
+_LIT( KFileToolDirUid, "%d" );
+_LIT( KInstanceAsNumber, "%d" );
+
+_LIT( KFileToolPluginDirBase, "Plugin" );
+_LIT( KFileToolSrvDirBase, "SrvMsg" );
+
+_LIT( KFileToolWildcard, "file*.prfw" );
+_LIT( KFileToolFileBase, "file%d.prfw" );
+
+// ======== LOCAL FUNCTIONS ========
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// ?description_if_needed
+// ---------------------------------------------------------------------------
+//
+CXIMPTestFileTool::CXIMPTestFileTool( TUint32 aUid ) :
+    iUid( aUid )
+    {
+    iFs.Connect();
+    }
+
+// ---------------------------------------------------------------------------
+// ?description_if_needed
+// ---------------------------------------------------------------------------
+//
+void CXIMPTestFileTool::ConstructL( const TDesC16& aInstanceId )
+    {
+    iTimer = CPeriodic::NewL( CActive::EPriorityStandard );
+    iInstance = aInstanceId.AllocL();
+    }
+
+// ---------------------------------------------------------------------------
+// ?description_if_needed
+// ---------------------------------------------------------------------------
+//
+void CXIMPTestFileTool::ConstructL( TInt aInstanceIdAsNum )
+    {
+    TInt instanceLength = NumLenInChars( aInstanceIdAsNum );
+    HBufC* instance = HBufC::NewLC( instanceLength );
+    instance->Des().AppendFormat( KInstanceAsNumber, aInstanceIdAsNum );
+    ConstructL( *instance );
+    CleanupStack::PopAndDestroy( instance );
+    }
+
+// ---------------------------------------------------------------------------
+// ?description_if_needed
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CXIMPTestFileTool* CXIMPTestFileTool::NewL( TUint32 aUid, const TDesC16& aInstanceId )
+    {
+    CXIMPTestFileTool* self = new( ELeave ) CXIMPTestFileTool( aUid );
+    CleanupStack::PushL( self );
+    self->ConstructL( aInstanceId );
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// ?description_if_needed
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CXIMPTestFileTool* CXIMPTestFileTool::NewL( TUint32 aUid, TInt aInstanceIdAsNum )
+    {
+    CXIMPTestFileTool* self = new( ELeave ) CXIMPTestFileTool( aUid );
+    CleanupStack::PushL( self );
+    self->ConstructL( aInstanceIdAsNum );
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+
+// ---------------------------------------------------------------------------
+// ?description_if_needed
+// ---------------------------------------------------------------------------
+//
+CXIMPTestFileTool::~CXIMPTestFileTool()
+    {
+    iFs.Close();
+    if ( iTimer )
+        {
+        iTimer->Deque();
+        }
+    delete iTimer;
+    iObservers.Close();
+    delete iInstance;
+    }
+
+// ---------------------------------------------------------------------------
+// Remove the entire prfw directory 
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CXIMPTestFileTool::CleanAllL()
+    {
+    RFs fs;
+    fs.Connect();
+    CleanupClosePushL( fs );
+
+    CFileMan* fileMan = CFileMan::NewL( fs );
+    CleanupStack::PushL( fileMan );
+
+    // remove the files and the directory
+    fileMan->RmDir( KFileToolMainDirFull );
+
+    CleanupStack::PopAndDestroy( 2 );  // fileman, fs
+    }
+
+// ---------------------------------------------------------------------------
+// Prepare everything, after this objects can be externalized and
+// internalized
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CXIMPTestFileTool::PrepareL()
+    {
+    // create the directory structure
+    HBufC* dirName = GetDirNameAndBackslashLC( KFileToolPluginDirBase );
+    iFs.MkDirAll( *dirName );
+    CleanupStack::PopAndDestroy( dirName );
+    
+    dirName = GetDirNameAndBackslashLC( KFileToolSrvDirBase );
+    iFs.MkDirAll( *dirName );
+    CleanupStack::PopAndDestroy( dirName );
+    }
+
+// ---------------------------------------------------------------------------
+// Write the file to correct directory.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CXIMPTestFileTool::PluginStoreL( const TDesC8& aExternalizedObject )
+    {
+    HBufC* fileName = GetFileNameLC( 
+            KFileToolPluginDirBase,
+            iObjIndex );
+
+    RFileWriteStream out;
+    CleanupClosePushL( out );
+    out.Create( iFs, *fileName, EFileWrite|EFileStream|EFileShareAny );
+
+    // write the file
+    TUint32 len = aExternalizedObject.Length();
+    out.WriteUint32L( len );
+    out.WriteL( aExternalizedObject );
+    CleanupStack::PopAndDestroy(); // out
+
+    CleanupStack::PopAndDestroy( fileName ); // fileName
+
+    // next file will have a new index
+    iObjIndex++;
+    }
+
+// ---------------------------------------------------------------------------
+// Restore the file from given directory and given index
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CXIMPApiEventBase* CXIMPTestFileTool::PluginRestoreLC(
+        TInt aObjIndex )
+    {
+    HBufC* fileName = GetFileNameLC( 
+            KFileToolPluginDirBase, 
+            aObjIndex );
+
+    // try to instantiate it
+    RFileReadStream in;
+    CleanupClosePushL( in );
+
+    in.Open( iFs, *fileName, EFileStream );
+    TInt len = in.ReadUint32L();
+    HBufC8* buffer = HBufC8::NewLC( len );
+    TPtr8 ptr = buffer->Des();
+    in.ReadL( ptr );
+
+    // instantiate the object
+    TInt32 dummy = 0;
+    CXIMPApiEventBase* object = XIMPEventCodec::UnPackL( *buffer, dummy );
+
+    CleanupStack::PopAndDestroy( 2 ); // buffer, in
+
+    // delete the just read object
+    iFs.Delete( *fileName );
+
+    CleanupStack::PopAndDestroy( fileName );
+
+    CleanupStack::PushL( object );
+    return object;
+    }
+
+// ---------------------------------------------------------------------------
+// Write the server message object to correct directory.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CXIMPTestFileTool::SrvMsgStoreL( 
+        CXIMPTestFileSrvMsg* aSrvMsg )
+    {
+    TInt nextObjIndex = NumSrvMsgL();
+    HBufC* fileName = GetFileNameLC( 
+            KFileToolSrvDirBase,
+            nextObjIndex);
+
+    RFileWriteStream out;
+    CleanupClosePushL( out );
+    TInt retVal = out.Create( iFs, *fileName, EFileWrite|EFileStream|EFileShareAny );
+    User::LeaveIfError( retVal );
+
+    aSrvMsg->ExternalizeL( out );
+    
+    CleanupStack::PopAndDestroy( 2, fileName ); // out, fileName
+
+    // next file will have a new index
+    //iSrvObjIndex++;
+    }
+
+// ---------------------------------------------------------------------------
+// Restore the file from given directory and given index
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CXIMPTestFileSrvMsg* CXIMPTestFileTool::SrvMsgRestoreLC(
+        TInt aObjIndex )
+    {
+    CXIMPTestFileSrvMsg* msg = CXIMPTestFileSrvMsg::NewLC();
+
+    HBufC* fileName = GetFileNameLC( 
+            KFileToolSrvDirBase, 
+            aObjIndex );
+
+    // try to instantiate it
+    RFileReadStream in;
+    CleanupClosePushL( in );
+
+    in.Open( iFs, *fileName, EFileStream );
+
+    msg->InternalizeL( in ); 
+
+    CleanupStack::PopAndDestroy(); // in
+
+    // delete the just read object
+    iFs.Delete( *fileName );
+
+    CleanupStack::PopAndDestroy( fileName ); // fileName
+    return msg;
+    }
+
+// ---------------------------------------------------------------------------
+// Common file counting helper
+// ---------------------------------------------------------------------------
+//
+TInt CXIMPTestFileTool::DoNumObjectsL( const TDesC& aTemplate )
+    {
+    CDir* dir = GetDirListL( aTemplate );
+    TInt count = dir->Count();
+    delete dir;
+    return count;
+    }
+
+// ---------------------------------------------------------------------------
+// Number of objects (files) in a given directory
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CXIMPTestFileTool::NumObjectsL()
+    {
+    return DoNumObjectsL( KFileToolPluginDirBase );
+    }
+
+// ---------------------------------------------------------------------------
+// Number of server-originated objects (files) in a given directory
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CXIMPTestFileTool::NumSrvMsgL()
+    {
+    // returns the number of objects in the directory
+    // get file listing and derive the count from that
+    return DoNumObjectsL( KFileToolSrvDirBase );
+    }
+
+// ---------------------------------------------------------------------------
+// Instace id
+// ---------------------------------------------------------------------------
+//
+EXPORT_C const TDesC16& CXIMPTestFileTool::InstanceId() const
+    {
+    return *iInstance;
+    }
+    
+// ---------------------------------------------------------------------------
+// Length of number in characters (e.g. 501 --> 3)
+// ---------------------------------------------------------------------------
+//
+TInt CXIMPTestFileTool::NumLenInChars( TInt aNum )
+    {
+    TInt len = 0;
+    TInt tmp = aNum;
+    do
+        {
+        tmp /= 10;  // number is base-10
+        len++;
+        }
+    while ( tmp > 0 );
+    return len;
+    }
+
+// ---------------------------------------------------------------------------
+// Gets properly expanded directory name with backslash appended
+// ---------------------------------------------------------------------------
+//
+HBufC* CXIMPTestFileTool::GetDirNameAndBackslashLC( 
+        const TDesC& aTemplate )
+    {
+    TInt uidLength = NumLenInChars( iUid );
+    TInt instanceLength = iInstance->Length();
+
+    HBufC* dirName = HBufC::NewLC( 
+            KFileToolMainDirFull().Length()
+            + KFileToolBackslash().Length()
+            + KFileToolDirUid().Length()
+            -2  // "%d" gets modified to be the number
+            + KFileToolBackslash().Length()
+            + uidLength + instanceLength
+            + KFileToolBackslash().Length()
+            + aTemplate.Length()
+            + KFileToolBackslash().Length() // added for later use by GetDirNameAndBackslashLC.
+            );
+
+    dirName->Des().Append( KFileToolMainDirFull );
+    dirName->Des().Append( KFileToolBackslash );
+    dirName->Des().AppendFormat( KFileToolDirUid, iUid );
+    dirName->Des().Append( KFileToolBackslash );
+    dirName->Des().Append( *iInstance );
+    dirName->Des().Append( KFileToolBackslash );
+    dirName->Des().Append( aTemplate );
+    
+    dirName->Des().Append( KFileToolBackslash );
+    iFs.MkDirAll( *dirName );
+    return dirName;
+    }
+
+// ---------------------------------------------------------------------------
+// Get full path wildcard for files residing in a directory
+// with given index
+// ---------------------------------------------------------------------------
+//
+HBufC* CXIMPTestFileTool::GetWildcardLC( 
+        const TDesC& aDirTemplate )
+    {
+    HBufC* dirName = GetDirNameAndBackslashLC( aDirTemplate );
+    HBufC* wildcard = HBufC::NewLC(
+            dirName->Length() + KFileToolWildcard().Length() );
+    wildcard->Des().Append( *dirName );
+    wildcard->Des().Append( KFileToolWildcard );
+
+    CleanupStack::Pop( 2 ); // wildcard, dirName
+    delete dirName;
+
+    CleanupStack::PushL( wildcard );
+    return wildcard;
+    }
+
+// ---------------------------------------------------------------------------
+// Get a list of files in a given directory
+// ---------------------------------------------------------------------------
+//
+CDir* CXIMPTestFileTool::GetDirListL( const TDesC& aTemplate )
+    {
+    HBufC* wildcard = GetWildcardLC( aTemplate );
+
+    CDir* dirList = NULL;
+    iFs.GetDir( *wildcard, KEntryAttNormal, ESortByName, dirList );
+    CleanupStack::PopAndDestroy( wildcard );
+
+    return dirList;
+    }
+
+// ---------------------------------------------------------------------------
+// Get fully qualified file name
+// ---------------------------------------------------------------------------
+//
+HBufC* CXIMPTestFileTool::GetFileNameLC( 
+        const TDesC& aDirTemplate,
+        TInt aObjIndex )
+    {
+    // create file name
+    HBufC* dirName = GetDirNameAndBackslashLC( aDirTemplate );
+
+    TInt numLen = NumLenInChars( aObjIndex );
+    HBufC* fileName = HBufC::NewLC(
+            dirName->Length()
+            + KFileToolFileBase().Length()
+            + numLen
+            - 2  // "%d" gets modified to be the number
+            );
+    fileName->Des().Append( *dirName );
+    fileName->Des().AppendFormat( KFileToolFileBase, aObjIndex );
+
+    CleanupStack::Pop( fileName );
+    CleanupStack::PopAndDestroy( dirName );
+    CleanupStack::PushL( fileName );
+
+    // now we have the filename
+    return fileName;
+    }
+
+const TInt KSecond = 1000000;
+
+// ---------------------------------------------------------------------------
+// CXIMPTestFileTool::RegisterObserverL
+// ---------------------------------------------------------------------------
+//
+void CXIMPTestFileTool::RegisterObserverL( MXIMPTestFileObserver* aObserver )
+    {    
+    iObservers.AppendL( aObserver );
+    if( !iTimer->IsActive() )
+        {
+        TCallBack callback( Process, this );
+        iTimer->Start( KSecond, KSecond, callback );
+        }        
+    }
+    
+// ---------------------------------------------------------------------------
+// CXIMPTestFileTool::UnregisterObserver
+// ---------------------------------------------------------------------------
+//
+void CXIMPTestFileTool::UnregisterObserver( MXIMPTestFileObserver* aObserver )
+    {    
+    TInt index = iObservers.Find( aObserver );
+    if( index != KErrNotFound )
+        {
+        iObservers.Remove( index );
+        }
+    if( iObservers.Count() == 0 )
+        {
+        iTimer->Cancel();
+        }
+    }
+
+
+// ---------------------------------------------------------------------------
+// CXIMPTestFileTool::RunL
+// ---------------------------------------------------------------------------
+//
+TInt CXIMPTestFileTool::Process( TAny* aMyself )
+    {
+    TRAPD( ignore, ( static_cast< CXIMPTestFileTool* >( aMyself ) )->DoProcessL() );
+    return 0; // ignored by CPeriodic
+    }
+
+// ---------------------------------------------------------------------------
+// CXIMPTestFileTool::RunL
+// ---------------------------------------------------------------------------
+//
+void CXIMPTestFileTool::DoProcessL()
+    {
+    TInt countOfSrvMsg = NumSrvMsgL();
+    TInt countOfObservers = iObservers.Count();
+    
+    for( TInt a = 0; a < countOfSrvMsg; ++a )
+        {
+        CXIMPTestFileSrvMsg* newMsg = SrvMsgRestoreLC( a );
+        for( TInt b = 0;b < countOfObservers; ++b )
+            {
+            iObservers[ b ]->HandleL( newMsg->SrvMsgId(), newMsg->PayloadL() );
+            }
+        CleanupStack::PopAndDestroy( newMsg );
+        }
+    }
+
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/tsrc/tsrcutils/testcaseutils/prfwtestfiletool.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,199 @@
+/*
+* 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:  Test support file tool
+ *
+*/
+
+
+#ifndef CPRFWTESTFILETOOL_H
+#define CPRFWTESTFILETOOL_H 
+
+#include <e32base.h>
+#include <ximpbase.h>
+
+class CXIMPApiEventBase;
+class CXIMPTestFileSrvMsg;
+class MXIMPTestFileObserver;
+
+/**
+ * File support for tests.
+ * Support functions for externalizing a class to a known directory and
+ * retrieving the classes.
+ *
+ * This is a sort of "pseudo-IPC" from the test protocol (ecom plugin)
+ * to EUnit test code. A server could also be used, but this is faster
+ * to do and simpler.
+ *
+ * @since S60 v4.0
+ */
+class CXIMPTestFileTool : public CBase
+    {
+    public:
+
+        IMPORT_C static CXIMPTestFileTool* NewL( TUint32 aUid, const TDesC16& aInstanceId );
+        IMPORT_C static CXIMPTestFileTool* NewL( TUint32 aUid, TInt aInstanceIdAsNum );
+        virtual ~CXIMPTestFileTool();
+
+    private:
+
+        CXIMPTestFileTool( TUint32 aUid );
+        void ConstructL( const TDesC16& aInstanceId );
+        void ConstructL( TInt aInstanceIdAsNum );
+
+    public:
+
+        /**
+         * Clean all files from the filetool directory.
+         * Remove also the directory itself.
+         * Removes EVERYTHING from ALL DIRECTORIES used
+         * by filetool!!! So don't call it everytime, only once
+         * upon test case startup.
+         */
+        IMPORT_C static void CleanAllL();
+
+        /**
+         * Prepares for writing only the directory used by this
+         * filetool instance
+         */
+        IMPORT_C void PrepareL();
+
+        /**
+         * Store the object to file.
+         * The given descriptor is externalized as given,
+         * with the length of the descriptor written first,
+         * as a 32-bit TUint:
+         * <length of descriptor 32-bit><descriptor data>
+         * @param aExternalizedObject The externalized object
+         */
+        IMPORT_C void PluginStoreL( const TDesC8& aExternalizedObject );
+        
+        /**
+         * Restore a stored object from file.
+         * Ownership is transferred!
+         * @param aObjIndex The index for the object
+         */
+        IMPORT_C CXIMPApiEventBase* PluginRestoreLC( TInt aObjIndex );
+        
+        /**
+         * Store the object to file. (SERVER MESSAGE)
+         * The given descriptor is externalized as given,
+         * with the length of the descriptor written first,
+         * as a 32-bit TUint:
+         * <length of descriptor 32-bit><descriptor data>
+         * @param aExternalizedObject The externalized object
+         */
+        IMPORT_C void SrvMsgStoreL( CXIMPTestFileSrvMsg* aSrvMsg );
+        
+        /**
+         * Restore a stored object from file. (SERVER MESSAGE)
+         * Ownership is transferred!
+         * @param aIndex The index for the object
+         */
+        IMPORT_C CXIMPTestFileSrvMsg* SrvMsgRestoreLC( TInt aIndex );
+
+        /**
+         * Return the number of objects currently stored in the directory.
+         */
+        IMPORT_C TInt NumObjectsL();
+        
+        /**
+         * Return the number of objects depicting server-originated
+         * message currently stored in the directory.
+         */
+        IMPORT_C TInt NumSrvMsgL();
+        
+        /**
+         * @return Instance id
+         */
+        IMPORT_C const TDesC16& InstanceId() const;
+
+    private:
+
+        /**
+         * @return The directory name (with backslash)
+         * (E.g. "C:/temp/prfw/1234/0/SrvMsg/")
+         */
+        HBufC* GetDirNameAndBackslashLC( 
+                const TDesC& aTemplate );
+
+        /**
+         * @return Wildcard for file deletion 
+         * (E.g. "C:/temp/prfw/1234/0/SrvMsg/file*.prfw")
+         * @param aDirTemplate The directory template for the wildcard
+         */
+        HBufC* GetWildcardLC( 
+                const TDesC& aDirTemplate );
+
+        /**
+         * Get the full file name, properly expanded.
+         * @param aDirTemplate The template for the dirs
+         * @param aObjIndex The object index
+         */
+        HBufC* GetFileNameLC( 
+                const TDesC& aDirTemplate,
+                TInt aObjIndex );
+
+        /**
+         * @return Length of the given number as if it were a string.
+         * @param aNum The number
+         */
+        TInt NumLenInChars( TInt aNum );
+
+        /**
+         * @return Listing of the directory
+         * @param aTemplate The wildcard template for the files
+         */
+        CDir* GetDirListL( const TDesC& aTemplate );
+        
+        /**
+         * Common helper for NumObjects methods.
+         */
+        TInt DoNumObjectsL( const TDesC& aTemplate );
+        
+        /**
+         *
+         */
+        static TInt Process( TAny* aMyself );
+        void DoProcessL();
+        
+    public:
+      
+        /**
+         * Observer registration
+         */
+        void RegisterObserverL( MXIMPTestFileObserver* aObserver );        
+        void UnregisterObserver( MXIMPTestFileObserver* aObserver );
+        
+        
+    private: // data
+
+        TUint32 iUid;       // protocoluid
+        HBufC16* iInstance;     // the global instance id
+
+        TInt iObjIndex;     // object index for created objects
+        TInt iSrvObjIndex;  // object index for created srvmsg objects
+        RFs iFs;
+        
+        
+        /**
+         * Monitor on when there is observers. 
+         * Call HandleL for observers for every new file.         
+         */
+        RPointerArray< MXIMPTestFileObserver > iObservers;
+        
+        // timer
+        CPeriodic* iTimer;        
+    };
+
+#endif // CPRFWTESTFILETOOL_H 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/tsrc/tsrcutils/testcaseutils/prfwtestlistener.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,280 @@
+/*
+* 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:  XIMP Framework CXIMPTestListener
+*
+*/
+
+#include "prfwtestlistener.h"
+#include "prfwtestcaseutilspanics.h"
+#include "prfwgeneralwaiter.h"
+
+#include <eunitmacros.h>
+#include <ximpcontextstateevent.h>
+#include <ximprequestcompleteevent.h>
+#include <ximpstatus.h>
+#include <presentitypresenceevent.h>
+#include <presentitygrouplistevent.h>
+#include <presentitygroupcontentevent.h>
+#include <presenceinfo.h>
+
+#include <ximpbase.h>
+#include "ximpapiobjbase.h"
+#include "ximpapieventbase.h"
+
+
+using namespace NXIMPTestCaseUtilsPanic;
+
+const TInt KWaitAfterEvents = 2;
+
+// ============================ MEMBER FUNCTIONS ===============================
+EXPORT_C CXIMPTestListener* CXIMPTestListener::NewL(
+        MXIMPContext* aEventSource )
+    {
+    CXIMPTestListener* self = new (ELeave) CXIMPTestListener( aEventSource );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+
+CXIMPTestListener::~CXIMPTestListener()
+    {
+    if( iEventSource )
+        {
+        iEventSource->UnregisterObserver( *this );
+        }
+
+    iDescription.Close();
+
+    if ( iWait.IsStarted() )
+        {
+        iWait.AsyncStop();
+        }
+    }
+
+
+CXIMPTestListener::CXIMPTestListener( MXIMPContext* aEventSource ) :
+    iEventSource( aEventSource )
+    {
+    }
+
+
+void CXIMPTestListener::ConstructL()
+    {
+    if( iEventSource )
+        {
+        iEventSource->RegisterObserverL( *this, NULL );
+        }
+
+    iDescription.CreateL( 512 );
+    }
+
+
+// ===========================================================================
+// PUBLIC FUNCTIONS
+// ===========================================================================
+//
+EXPORT_C void CXIMPTestListener::SetEventSourceL(
+        MXIMPContext* aEventSource )
+    {
+    if( iEventSource )
+        {
+        iEventSource->UnregisterObserver( *this );
+        }
+
+    if( aEventSource )
+        {
+        aEventSource->RegisterObserverL( *this, NULL );
+        }
+
+    iEventSource = aEventSource;
+    }
+
+// clear the stack
+EXPORT_C void CXIMPTestListener::Reset()
+    {
+    iEventStack.ResetAndDestroy();
+    }
+
+// expect the given event
+EXPORT_C void CXIMPTestListener::ExpectL( CXIMPApiObjBase* aEvent )
+    {
+    iEventStack.AppendL( aEvent );
+
+    iDescription.Zero();
+    iDescription.AppendFormat( _L8("Eventstack has [%d] items."), iEventStack.Count() );
+    EUNIT_PRINT( iDescription );
+    }
+
+// wait for req complete and events (must come in the given order!)
+EXPORT_C TInt CXIMPTestListener::WaitAndAssertL()
+    {
+    __ASSERT_ALWAYS( !iWait.IsStarted(),
+            Panic( EStatusEventListenerAlreadyWaiting ) );
+
+    iCoolDownActive = EFalse;
+    iError = KErrNone;
+    iReceivedEventCount = 0;
+    iWait.Start();
+
+    // start a timer to catch excess events, 2 seconds should
+    // be enough. such events are caught by DoHandleEventL and printed.
+    // if any events arrived, iError will be set.
+
+    iCoolDownActive = ETrue;
+    CXIMPTestGeneralWaiter* waiter = CXIMPTestGeneralWaiter::NewL( this );
+    CleanupStack::PushL( waiter );
+    waiter->WaitForL( KWaitAfterEvents );
+    iWait.Start();
+
+    // waiter callback will have ended the wait
+    CleanupStack::PopAndDestroy( waiter );
+
+    return iError;
+    }
+
+// the event observer where to pass the events
+EXPORT_C void CXIMPTestListener::SetEventObserver( MXIMPContextObserver* aObserver )
+    {
+    iObserver = aObserver;
+    }
+
+// ===========================================================================
+// FROM MPRFWPRESENCECONTEXTOBSERVER
+// ===========================================================================
+//
+void CXIMPTestListener::DoHandlePresenceContextEventL(
+    const MXIMPContext& aContext,
+    const MXIMPBase& aEvent )
+    {
+    const TInt32 eventType = aEvent.GetInterfaceId();
+
+    __ASSERT_ALWAYS( iEventSource == &aContext,
+            Panic( EReceivingEventFromWrongContext ) );
+
+    if( iObserver )
+        {
+        // give the event to the observer, if any, at the earliest possible
+        // phase
+        iObserver->HandlePresenceContextEvent( aContext, aEvent );
+
+        // XXX should this be done when cool-down is active?
+        }
+
+    if ( iCoolDownActive )
+    {
+        iDescription.Zero();
+        iDescription.AppendFormat( _L8("Excess event with interface id [%d]"), aEvent.GetInterfaceId() );
+        EUNIT_PRINT( iDescription );
+
+        iError = KErrGeneral;
+
+        // just ignore it
+        return;
+    }
+
+    iDescription.Zero();
+    iDescription.AppendFormat( _L8("Expecting event to stack pos [%d]"), iReceivedEventCount );
+    EUNIT_PRINT( iDescription );
+
+    // try to find the received event from the stack - the given stack must
+    // be in order
+    TBool found = EFalse;
+    TInt stackId = iEventStack[ 0 ]->Base().GetInterfaceId();
+    found = stackId == aEvent.GetInterfaceId();
+
+    if ( ! found )
+        {
+        // unexpected event
+        iDescription.Zero();
+        iDescription.AppendFormat( _L8("Expected interface id [%d], got [%d]"), stackId, aEvent.GetInterfaceId() );
+        EUNIT_PRINT( iDescription );
+
+        iDescription.Zero();
+        iDescription.AppendFormat( _L8("Received unexpected event at pos [%d]"), iReceivedEventCount );
+        EUNIT_PRINT( iDescription );
+
+        // get out
+        User::Leave( KErrGeneral );
+        }
+
+    // found the received event from the stack of expected events.
+    // remove the event from the stack of expected events, then handle it.
+    CXIMPApiEventBase* expected = ( CXIMPApiEventBase* ) iEventStack[ 0 ];
+    CleanupStack::PushL( expected );
+    iEventStack.Remove( 0 );
+
+    CXIMPApiEventBase* received = ( CXIMPApiEventBase* ) ( aEvent.GetInterface( XIMPIMP_CLSID_CXIMPAPIEVENTBASE, MXIMPBase::EPanicIfUnknown ) );
+
+    if ( ! expected->EqualsContent( *received ) )
+        {
+        // expected event mismatches with the received event
+        iDescription.Zero();
+        iDescription.AppendFormat( _L8("Received event with mismatching content at pos [%d]"), iReceivedEventCount );
+        EUNIT_PRINT( iDescription );
+
+        // get out
+        User::Leave( KErrGeneral );
+        }
+
+    CleanupStack::PopAndDestroy( expected );
+
+    iDescription.Zero();
+    iDescription.AppendFormat( _L8("Got correct event to stack pos [%d]"), iReceivedEventCount );
+    EUNIT_PRINT( iDescription );
+
+    // we've processed a received event successfully
+    iReceivedEventCount++;
+
+    if ( iEventStack.Count() <= 0 )
+        {
+        // no more events to expect
+        if( iWait.IsStarted() )
+            {
+            iWait.AsyncStop();
+            }
+        }
+    }
+    
+
+void CXIMPTestListener::HandlePresenceContextEvent( 
+    const MXIMPContext& aContext,
+    const MXIMPBase& aEvent )
+    {
+    TRAPD( err, DoHandlePresenceContextEventL( aContext, aEvent ) );
+
+    if ( err != KErrNone )
+        {
+        // something evil happened, stop async wait
+
+        iError = err;
+
+        if( iWait.IsStarted() )
+            {
+            iWait.AsyncStop();
+            }
+        }
+    }
+
+void CXIMPTestListener::WaitCompleted( TInt aRetVal )
+    {
+    if( iWait.IsStarted() )
+        {
+        iWait.AsyncStop();
+        }
+    }
+
+// end of file
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/tsrc/tsrcutils/testcaseutils/prfwtestlistener.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,152 @@
+/*
+* 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:  XIMP Framework CXIMPTestListener
+*
+*/
+
+
+#ifndef CPRFWTESTLISTENER_H__
+#define CPRFWTESTLISTENER_H__
+
+
+#include <e32base.h>
+#include <ximpcontextobserver.h>
+#include <ximpcontext.h>
+
+#include "prfwwaitobserver.h"
+
+// CLASS DESCRIPTION
+class CXIMPApiObjBase;
+
+/**
+ * Presence test listener to record events
+ * and to wait request completion.
+ */
+class CXIMPTestListener : public CBase,
+    public MXIMPContextObserver,
+    public T_MWaitObserver
+    {
+    public:
+
+        /**
+         * Instantiates new listener object.
+         *
+         * If valid event source is given, reqisters this object as
+         * event observer to it.
+         */
+        IMPORT_C static CXIMPTestListener* CXIMPTestListener::NewL(
+                MXIMPContext* aEventSource );
+
+        ~CXIMPTestListener();
+
+    private:
+
+        CXIMPTestListener( MXIMPContext* aEventSource );
+
+        void ConstructL();
+
+    public:
+
+        /**
+         * Sets new event source from where to listen events.
+         * Unregisters from previous one.
+         * Can be NULL, in which case just performs the
+         * unregistration.
+         */
+        IMPORT_C void SetEventSourceL( MXIMPContext* aEventSource );
+
+        /**
+         * Clears the event trait template. After this call,
+         * you must call ExpectL to tell listener what events to expect.
+         */
+        IMPORT_C void Reset();
+
+        /**
+         * Add the given event to the list of expected events.
+         * The order of ExpectL calls is significant.
+         * Ownership of given event is transferred to this class.
+         * @param aEvent The event to expect
+         */
+        IMPORT_C void ExpectL( CXIMPApiObjBase* aEvent );
+
+        /**
+         * Method to wait with CActiveSchedulerWait
+         * a request complete, then any events which are expected.
+         * When all events are received, the method returns. If not all events
+         * come, the test case will timeout. If a wrong event or event with wrong
+         * data is received, the method will barf in EUNIT_ASSERT.
+         * 
+         * @return Error code, if any
+         */
+        IMPORT_C TInt WaitAndAssertL();
+
+        /**
+         * Forward the received events to the given event observer, if set.
+         * Set to NULL to disable forwarding.
+         * @param aObserver The observer 
+         */
+        IMPORT_C void SetEventObserver( MXIMPContextObserver* aObserver );
+
+    public:  // from T_MWaitObserver
+
+        void WaitCompleted( TInt aRetVal );
+
+    private:  //From MXIMPContextObserver
+
+        void HandlePresenceContextEvent(
+                const MXIMPContext& aContext,
+                const MXIMPBase& aEvent );
+
+        void DoHandlePresenceContextEventL(
+                const MXIMPContext& aContext,
+                const MXIMPBase& aEvent );
+
+
+    private: //Helpers
+
+    private:  //Data
+
+        //OWN: Active scheduler wait for waiting the completion
+        CActiveSchedulerWait    iWait;
+
+        //REF: Context from where receiving events
+        MXIMPContext* iEventSource;
+
+        //OWN: Description buffer to hold the failure description
+        mutable RBuf8 iDescription;
+
+        // To handle event by observer.
+        MXIMPContextObserver* iObserver;
+
+        // OWN: the event stack (and the objects)
+        RXIMPObjOwningPtrArray< CXIMPApiObjBase > iEventStack;
+
+        // current error state. WaitAndAssertL
+        // always clears the error
+        TInt iError;
+
+        // number of received events
+        TInt iReceivedEventCount;
+
+        // ETrue if we're doing a "cool-down" period, that is,
+        // we are waiting for any events which might come after
+        // we've successfully exhausted our stack of expected events.
+        // This is so that we can spot any excess events
+        // during testing.
+        TBool iCoolDownActive;
+    };
+
+#endif //CPRFWTESTLISTENER_H__
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/tsrc/tsrcutils/testcaseutils/prfwtestmessaging.h	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  XIMP Framework Test Code prfwtestmessaging.h
+*
+*/
+
+
+#ifndef T_PRFWTESTMESSAGING_H_
+#define T_PRFWTESTMESSAGING_H_
+
+#include <e32base.h>
+#include <e32property.h>
+
+// FIXME change this?
+// base UID for pubsub keys
+const TUid KXIMPTestPropertyCatBase = { 0x10012345 };
+
+enum TXIMPTestPropertyValues
+    {
+    // values for EXIMPPlgTestDeath
+    EXIMPPrtValPluginDeathEmpty = 0,
+    EXIMPPrtValPluginDeathDied = 1,
+
+    // values for EXIMPTestPlgSessionLostStrategy
+    EXIMPPrtValSessionLostEmpty = 0,
+    EXIMPPrtValSessionLostReconnect,
+    EXIMPPrtValSessionLostTeardown,
+    EXIMPPrtValSessionLostReconnectExhaustAttempts,
+
+    // values for EXIMPTestPlgBehaveGeneric
+    EXIMPPrtValBehaveNothing = 0,           // do nothing
+    };
+
+// pubsub keys
+enum TXIMPTestPropertyKeys
+    {
+    // meta things (message queue internal)
+    EXIMPTestMetaPubSubDefined,             // pubsub stuff has been defined (1)
+    EXIMPTestMetaPluginIndex,               // protocol plugin reads its index from this (-1=undefined)
+
+    // p = plugin, h = host, t = test code.
+    // direction also encoded into the property name
+
+    // Instructions for plugin behaviour (t->p).
+    // next call to plugin API method will cause the requested behavior (e.g. leave)
+    EXIMPTestPlgBehaveLeave,            // leave with given code
+    EXIMPTestPlgBehaveError,            // cause error with given code
+
+    // boolean valued
+    EXIMPTestPlgBehaveCloseHandle,      // abrupt close handle (1)
+    EXIMPTestPlgBehaveInvalidReqId,     // complete next call with invalid req. id (1)
+
+    // API method called -messages (p->t)
+    // value is boolean (set or unset, 1 or 0)
+    EXIMPPlgTestOpenSessionCalled,           // OpenSessionL
+    EXIMPPlgTestShareSessionCalled,          // ShareSessionL
+    EXIMPPlgTestUnshareSessionCalled,        // ShareSessionL
+    EXIMPPlgTestCloseSessionCalled,          // CloseSessionL
+    EXIMPPlgTestPublishPresenceCalled,       // PublishPresenceL
+    EXIMPPlgTestUpdateInterestCalled,        // UpdatePresenceInterestL
+    EXIMPPlgTestSubscribeOwnPresenceCalled,  // DoSubscribeOwnPresenceL
+    EXIMPPlgTestUnsubscribeOwnPresenceCalled, // DoUnsubscribeOwnPresenceL
+    EXIMPPlgTestUpdateOwnSubscriptionCalled, // DoUpdateOwnPresenceSubscriptionL
+    EXIMPPlgTestSubscribeGroupListCalled,    // DoSubscribePresentityGroupListL
+    EXIMPPlgTestUnsubscribeGroupListCalled,    // DoUnsubscribePresentityGroupListL
+    EXIMPPlgTestCreatePresentityGroupCalled, // DoCreatePresentityGroupL
+    EXIMPPlgTestDeletePresentityGroupCalled, // DoDeletePresentityGroupL
+    EXIMPPlgTestUpdatePresentityGroupDisplayNameCalled, // DoUpdatePresentityGroupDisplayNameL
+    EXIMPPlgTestSubscribePresentityPresesenceCalled,    // DoSubscribePresentityPresenceL
+    EXIMPPlgTestUpdatePresentityPresesenceCalled,       // DoUpdatePresentityPresenceSubscriptionL
+    EXIMPPlgTestUnsubscribePresentityPresesenceCalled,  // DoUnsubscribePresentityPresenceL
+    EXIMPPlgTestSubscribePresentityGroupMembersPresesenceCalled,    // DoSubscribePresentityGroupMembersPresenceL
+    EXIMPPlgTestUpdatePresentityGroupMembersPresesenceCalled,       // DoUpdatePresentityGroupMembersPresenceSubscriptionL
+    EXIMPPlgTestUnsubscribePresentityGroupMembersPresesenceCalled,  // DoUnsubscribePresentityGroupMembersPresenceL
+
+    EXIMPPlgTestSubscribePresentityGroupContentCalled,  // DoSubscribePresentityGroupContentL
+    EXIMPPlgTestUnsubscribePresentityGroupContentCalled,  // DoUnsubscribePresentityGroupContentL
+    EXIMPPlgTestAddPresentityGroupMemberCalled,  // DoAddPresentityGroupMemberL
+    EXIMPPlgTestRemovePresentityGroupMemberCalled,  // DoRemovePresentityGroupMemberL
+    EXIMPPlgTestUpdatePresentityGroupMemberDisplayNameCalled,  // DoUpdatePresentityGroupMemberDisplayNameL
+    EXIMPPlgTestSubscribePresenceWatcherListCalled,     // DoSubscribePresenceWatcherListL
+    EXIMPPlgTestUnsubscribePresenceWatcherListCalled,   // DoUnsubscribePresenceWatcherListL
+
+    EXIMPPlgTestSubscribePresenceGrantRequestListCalled,    // DoSubscribePresenceGrantRequestListL
+    EXIMPPlgTestUnsubscribePresenceGrantRequestListCalled,    // DoUnsubscribePresenceGrantRequestListL
+
+    EXIMPPlgTestGrantPresenceForPresentityCalled,                   // EXIMPPlgTestGrantPresenceForPresentityCalled
+    EXIMPPlgTestGrantPresenceForPresentityGroupMembersCalled,       // EXIMPPlgTestGrantPresenceForPresentityGroupMembersCalled
+    EXIMPPlgTestGrantPresenceForEveryoneCalled,                   // EXIMPPlgTestGrantPresenceForEveryoneCalled
+    EXIMPPlgTestUpdateGrantPresenceForPresentityCalled,             // EXIMPPlgTestUpdateGrantPresenceForPresentityCalled
+    EXIMPPlgTestUpdateGrantPresenceForEveryoneCalled,             // EXIMPPlgTestUpdateGrantPresenceForEveryoneCalled
+    EXIMPPlgTestUpdateGrantPresenceForPresentityGroupMembersCalled, // EXIMPPlgTestUpdateGrantPresenceForPresentityGroupMembersCalled
+    EXIMPPlgTestWithdrawPresenceFromPresentityCalled,               // EXIMPPlgTestWithdrawPresenceFromPresentityCalled
+    EXIMPPlgTestWithdrawPresenceFromPresentityGroupMembersCalled,   // EXIMPPlgTestWithdrawPresenceFromPresentityGroupMembersCalled
+    EXIMPPlgTestWithdrawPresenceFromEveryoneCalled,               // EXIMPPlgTestWithdrawPresenceFromEveryoneCalled
+    EXIMPPlgTestSubscribePresenceBlockListCalled,                   // EXIMPPlgTestSubscribePresenceBlockListCalled
+    EXIMPPlgTestUnsubscribePresenceBlockListCalled,                  // EXIMPPlgTestUnubscribePresenceBlockListCalled
+    EXIMPPlgTestBlockPresenceForPresentityCalled,                   // EXIMPPlgTestBlockPresenceForPresentityCalled
+    EXIMPPlgTestCancelPresenceBlockFromPresentityCalled,            // EXIMPPlgTestCancelPresenceBlockFromPresentityCalled
+    
+    EXIMPPlgTestSubscribePresentityGroupListCalled,  // DoSubscribePresentityGroupListL
+    EXIMPPlgTestUnsubscribePresentityGroupListCalled,  // DoUnsubscribePresentityGroupListL
+    EXIMPPlgTestHandlePresentityGroupListCalled, //EXIMPPlgTestHandlePresentityGroupListCalled
+    EXIMPPlgTestHandlePresentityPresenceCalled,   
+    
+
+
+    // For signaling some situations checked by adaptation
+    EXIMPPlgTestExistsGroupContentInCache,              // Check if group content exists in cache.
+
+    // signal Plg destruction (p->t)
+    EXIMPPlgTestDeath,
+
+    // simulate session lost with given strategy (t->p)
+    EXIMPTestPlgSessionLostStrategy,
+    };
+
+// T-class for internal use
+class TXIMPTestMsg
+    {
+public:
+    TXIMPTestPropertyKeys iKey;     // pubsub key
+    TInt iVal;                      // pubsub value
+    };
+
+    /**
+     * @param aIndex The index for the testing context
+     * @param aDescription Description for failed test.
+     * @param aModifier If EFalse, negate the test, thus checking for
+     * publish presence NOT being called.
+     * @param aDescription2 Description for negate failed test.
+     */
+#define COMMONASSERT( aMsg, aKey, aDescription, aModifier, aDescription2 ) \
+        { \
+        TBool value = aMsg->GetBoolean( aKey ); \
+        if( aModifier ) \
+            { \
+            EUNIT_ASSERT_DESC( value, aDescription ); \
+            } \
+        else if( !aDescription2 ) \
+            { \
+            EUNIT_ASSERT_DESC( value, "Description 2 not set." ); \
+            } \
+        else \
+            { \
+            EUNIT_ASSERT_DESC( !value, aDescription2 ); \
+            } \
+        }
+
+#endif // T_PRFWTESTMESSAGING_H_
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/tsrc/tsrcutils/testcaseutils/prfwtestmessenger.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,584 @@
+/*
+* 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: XIMP Framework Test Code prfwtestmessenger.cpp
+*
+*/
+
+
+#include "eunittools.h"
+#include <e32def.h>
+#include <eunitmacros.h>
+#include <ximprestrictedobjectcollection.h>
+
+#include "prfwtestmessaging.h"
+#include "prfwtestmessenger.h"
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// CONSTRUCTION
+EXPORT_C CXIMPTestMessenger* CXIMPTestMessenger::NewForClientSideL( TInt aId )
+    {
+    CXIMPTestMessenger* self = new (ELeave) CXIMPTestMessenger( aId );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+    self->DeletePubSubKeys();
+    self->ResetPubSub();
+    return self;
+    }
+
+
+EXPORT_C CXIMPTestMessenger* CXIMPTestMessenger::NewForAdaptationSideL( TInt aId )
+    {
+    CXIMPTestMessenger* self = new (ELeave) CXIMPTestMessenger( aId );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+    return self;
+    }
+
+
+
+void CXIMPTestMessenger::ConstructL()
+    {
+    iDescription.CreateL( 512 );
+    }
+
+// reset the given pubsub keys
+// and any helper variables
+
+_LIT_SECURITY_POLICY_PASS( KAllowReadToAll );
+_LIT_SECURITY_POLICY_PASS( KAllowWriteToAll );
+
+EXPORT_C void CXIMPTestMessenger::ResetPubSub()
+    {
+    // check if we've already defined the keys. if we redefine and set
+    // defaults, the test logic breaks.
+    /*TInt pubSubDefined = GetValueFor( EXIMPTestMetaPubSubDefined );
+    if ( pubSubDefined )
+        {
+        // all done
+        return;
+        }
+*/
+    TInt r = 0;
+
+    // special behavioral keys
+    r = RProperty::Define( iMyUid, EXIMPTestMetaPubSubDefined, RProperty::EInt, KAllowReadToAll, KAllowWriteToAll );
+
+    r = RProperty::Define( iMyUid, EXIMPPlgTestDeath,                RProperty::EInt, KAllowReadToAll, KAllowWriteToAll );
+    r = RProperty::Define( iMyUid, EXIMPTestPlgSessionLostStrategy,  RProperty::EInt, KAllowReadToAll, KAllowWriteToAll );
+
+    // behavioral keys
+    r = RProperty::Define( iMyUid, EXIMPTestPlgBehaveLeave,    RProperty::EInt, KAllowReadToAll, KAllowWriteToAll );
+    r = RProperty::Define( iMyUid, EXIMPTestPlgBehaveError,    RProperty::EInt, KAllowReadToAll, KAllowWriteToAll );
+    r = RProperty::Define( iMyUid, EXIMPTestPlgBehaveCloseHandle, RProperty::EInt, KAllowReadToAll, KAllowWriteToAll );
+    r = RProperty::Define( iMyUid, EXIMPTestPlgBehaveInvalidReqId, RProperty::EInt, KAllowReadToAll, KAllowWriteToAll );
+    // TODO add more here
+
+    // "method called" keys
+    r = RProperty::Define( iMyUid, EXIMPPlgTestOpenSessionCalled,       RProperty::EInt, KAllowReadToAll, KAllowWriteToAll );
+    r = RProperty::Define( iMyUid, EXIMPPlgTestShareSessionCalled,      RProperty::EInt, KAllowReadToAll, KAllowWriteToAll );
+    r = RProperty::Define( iMyUid, EXIMPPlgTestUnshareSessionCalled,    RProperty::EInt, KAllowReadToAll, KAllowWriteToAll );
+    r = RProperty::Define( iMyUid, EXIMPPlgTestCloseSessionCalled,      RProperty::EInt, KAllowReadToAll, KAllowWriteToAll );
+    r = RProperty::Define( iMyUid, EXIMPPlgTestPublishPresenceCalled,   RProperty::EInt, KAllowReadToAll, KAllowWriteToAll );
+    r = RProperty::Define( iMyUid, EXIMPPlgTestUpdateInterestCalled,    RProperty::EInt, KAllowReadToAll, KAllowWriteToAll );
+    r = RProperty::Define( iMyUid, EXIMPPlgTestSubscribeOwnPresenceCalled,  RProperty::EInt, KAllowReadToAll, KAllowWriteToAll );
+    r = RProperty::Define( iMyUid, EXIMPPlgTestUnsubscribeOwnPresenceCalled,  RProperty::EInt, KAllowReadToAll, KAllowWriteToAll );
+    r = RProperty::Define( iMyUid, EXIMPPlgTestUpdateOwnSubscriptionCalled, RProperty::EInt, KAllowReadToAll, KAllowWriteToAll );
+    r = RProperty::Define( iMyUid, EXIMPPlgTestSubscribeGroupListCalled,  RProperty::EInt, KAllowReadToAll, KAllowWriteToAll );
+    r = RProperty::Define( iMyUid, EXIMPPlgTestUnsubscribeGroupListCalled,  RProperty::EInt, KAllowReadToAll, KAllowWriteToAll );
+    r = RProperty::Define( iMyUid, EXIMPPlgTestCreatePresentityGroupCalled,  RProperty::EInt, KAllowReadToAll, KAllowWriteToAll );
+    r = RProperty::Define( iMyUid, EXIMPPlgTestDeletePresentityGroupCalled,  RProperty::EInt, KAllowReadToAll, KAllowWriteToAll );
+    r = RProperty::Define( iMyUid, EXIMPPlgTestUpdatePresentityGroupDisplayNameCalled,  RProperty::EInt, KAllowReadToAll, KAllowWriteToAll );
+    r = RProperty::Define( iMyUid, EXIMPPlgTestSubscribePresentityPresesenceCalled,  RProperty::EInt, KAllowReadToAll, KAllowWriteToAll );
+    r = RProperty::Define( iMyUid, EXIMPPlgTestUnsubscribePresentityPresesenceCalled,  RProperty::EInt, KAllowReadToAll, KAllowWriteToAll );
+    r = RProperty::Define( iMyUid, EXIMPPlgTestUpdatePresentityPresesenceCalled,  RProperty::EInt, KAllowReadToAll, KAllowWriteToAll );
+    r = RProperty::Define( iMyUid, EXIMPPlgTestSubscribePresentityGroupContentCalled,  RProperty::EInt, KAllowReadToAll, KAllowWriteToAll );
+    r = RProperty::Define( iMyUid, EXIMPPlgTestUnsubscribePresentityGroupContentCalled,  RProperty::EInt, KAllowReadToAll, KAllowWriteToAll );
+    r = RProperty::Define( iMyUid, EXIMPPlgTestAddPresentityGroupMemberCalled,  RProperty::EInt, KAllowReadToAll, KAllowWriteToAll );
+    r = RProperty::Define( iMyUid, EXIMPPlgTestRemovePresentityGroupMemberCalled,  RProperty::EInt, KAllowReadToAll, KAllowWriteToAll );
+    r = RProperty::Define( iMyUid, EXIMPPlgTestUpdatePresentityGroupMemberDisplayNameCalled,  RProperty::EInt, KAllowReadToAll, KAllowWriteToAll );
+    r = RProperty::Define( iMyUid, EXIMPPlgTestSubscribePresenceWatcherListCalled,  RProperty::EInt, KAllowReadToAll, KAllowWriteToAll );
+    r = RProperty::Define( iMyUid, EXIMPPlgTestUnsubscribePresenceWatcherListCalled,  RProperty::EInt, KAllowReadToAll, KAllowWriteToAll );
+    r = RProperty::Define( iMyUid, EXIMPPlgTestSubscribePresentityGroupMembersPresesenceCalled,  RProperty::EInt, KAllowReadToAll, KAllowWriteToAll );
+    r = RProperty::Define( iMyUid, EXIMPPlgTestUnsubscribePresentityGroupMembersPresesenceCalled,  RProperty::EInt, KAllowReadToAll, KAllowWriteToAll );
+    r = RProperty::Define( iMyUid, EXIMPPlgTestUpdatePresentityGroupMembersPresesenceCalled,  RProperty::EInt, KAllowReadToAll, KAllowWriteToAll );
+    r = RProperty::Define( iMyUid, EXIMPPlgTestSubscribePresenceGrantRequestListCalled,  RProperty::EInt, KAllowReadToAll, KAllowWriteToAll );
+    r = RProperty::Define( iMyUid, EXIMPPlgTestUnsubscribePresenceGrantRequestListCalled,  RProperty::EInt, KAllowReadToAll, KAllowWriteToAll );
+
+    r = RProperty::Define( iMyUid, EXIMPPlgTestGrantPresenceForPresentityCalled,  RProperty::EInt, KAllowReadToAll, KAllowWriteToAll );
+    r = RProperty::Define( iMyUid, EXIMPPlgTestGrantPresenceForPresentityGroupMembersCalled,  RProperty::EInt, KAllowReadToAll, KAllowWriteToAll );
+    r = RProperty::Define( iMyUid, EXIMPPlgTestGrantPresenceForEveryoneCalled,  RProperty::EInt, KAllowReadToAll, KAllowWriteToAll );
+    r = RProperty::Define( iMyUid, EXIMPPlgTestUpdateGrantPresenceForPresentityCalled,  RProperty::EInt, KAllowReadToAll, KAllowWriteToAll );
+    r = RProperty::Define( iMyUid, EXIMPPlgTestUpdateGrantPresenceForPresentityGroupMembersCalled,  RProperty::EInt, KAllowReadToAll, KAllowWriteToAll );
+    r = RProperty::Define( iMyUid, EXIMPPlgTestUpdateGrantPresenceForEveryoneCalled,  RProperty::EInt, KAllowReadToAll, KAllowWriteToAll );
+    r = RProperty::Define( iMyUid, EXIMPPlgTestWithdrawPresenceFromPresentityCalled,  RProperty::EInt, KAllowReadToAll, KAllowWriteToAll );
+    r = RProperty::Define( iMyUid, EXIMPPlgTestWithdrawPresenceFromPresentityGroupMembersCalled,  RProperty::EInt, KAllowReadToAll, KAllowWriteToAll );
+    r = RProperty::Define( iMyUid, EXIMPPlgTestWithdrawPresenceFromEveryoneCalled,  RProperty::EInt, KAllowReadToAll, KAllowWriteToAll );
+    
+    r = RProperty::Define( iMyUid, EXIMPPlgTestSubscribePresenceBlockListCalled,  RProperty::EInt, KAllowReadToAll, KAllowWriteToAll );
+    r = RProperty::Define( iMyUid, EXIMPPlgTestUnsubscribePresenceBlockListCalled,  RProperty::EInt, KAllowReadToAll, KAllowWriteToAll );
+    r = RProperty::Define( iMyUid, EXIMPPlgTestBlockPresenceForPresentityCalled,  RProperty::EInt, KAllowReadToAll, KAllowWriteToAll );
+    r = RProperty::Define( iMyUid, EXIMPPlgTestCancelPresenceBlockFromPresentityCalled,  RProperty::EInt, KAllowReadToAll, KAllowWriteToAll );
+
+//Pia
+    r = RProperty::Define( iMyUid, EXIMPPlgTestSubscribePresentityGroupListCalled, RProperty::EInt, KAllowReadToAll, KAllowWriteToAll );
+    r = RProperty::Define( iMyUid, EXIMPPlgTestUnsubscribePresentityGroupListCalled, RProperty::EInt, KAllowReadToAll, KAllowWriteToAll );
+    r = RProperty::Define( iMyUid, EXIMPPlgTestHandlePresentityGroupListCalled, RProperty::EInt, KAllowReadToAll, KAllowWriteToAll );
+    r = RProperty::Define( iMyUid, EXIMPPlgTestHandlePresentityPresenceCalled, RProperty::EInt, KAllowReadToAll, KAllowWriteToAll );
+
+    r = RProperty::Define( iMyUid, EXIMPPlgTestExistsGroupContentInCache,  RProperty::EInt, KAllowReadToAll, KAllowWriteToAll );
+
+    // TODO add more here
+
+    // reset keys which have special meaning to defaults which will cause
+    // no actions - a happy path scenario
+    SetValueFor( EXIMPPlgTestDeath, EXIMPPrtValPluginDeathEmpty );
+    SetValueFor( EXIMPTestPlgSessionLostStrategy, EXIMPPrtValSessionLostEmpty );
+
+    // set other behavioral things to "happy path" by default
+    SetValueFor( EXIMPTestPlgBehaveLeave, KErrNone );
+    SetValueFor( EXIMPTestPlgBehaveError, KErrNone );
+    SetValueFor( EXIMPTestPlgBehaveCloseHandle, 0 );
+    SetValueFor( EXIMPTestPlgBehaveInvalidReqId, 0 );
+
+    // reset method called messages
+    SetValueFor( EXIMPPlgTestOpenSessionCalled, 0 );
+    SetValueFor( EXIMPPlgTestShareSessionCalled, 0 );
+    SetValueFor( EXIMPPlgTestUnshareSessionCalled, 0 );
+    SetValueFor( EXIMPPlgTestCloseSessionCalled, 0 );
+    SetValueFor( EXIMPPlgTestPublishPresenceCalled, 0 );
+    SetValueFor( EXIMPPlgTestUpdateInterestCalled, 0 );
+    SetValueFor( EXIMPPlgTestSubscribeOwnPresenceCalled, 0 );
+    SetValueFor( EXIMPPlgTestUnsubscribeOwnPresenceCalled, 0 );
+    SetValueFor( EXIMPPlgTestUpdateOwnSubscriptionCalled, 0 );
+    SetValueFor( EXIMPPlgTestSubscribeGroupListCalled, 0 );
+    SetValueFor( EXIMPPlgTestUnsubscribeGroupListCalled, 0 );
+    SetValueFor( EXIMPPlgTestCreatePresentityGroupCalled, 0 );
+    SetValueFor( EXIMPPlgTestDeletePresentityGroupCalled, 0 );
+    SetValueFor( EXIMPPlgTestUpdatePresentityGroupDisplayNameCalled, 0 );
+    SetValueFor( EXIMPPlgTestSubscribePresentityPresesenceCalled, 0 );
+    SetValueFor( EXIMPPlgTestUnsubscribePresentityPresesenceCalled, 0 );
+    SetValueFor( EXIMPPlgTestUpdatePresentityPresesenceCalled, 0 );
+    SetValueFor( EXIMPPlgTestSubscribePresentityGroupContentCalled, 0 );
+    SetValueFor( EXIMPPlgTestUnsubscribePresentityGroupContentCalled, 0 );
+    SetValueFor( EXIMPPlgTestAddPresentityGroupMemberCalled, 0 );
+    SetValueFor( EXIMPPlgTestRemovePresentityGroupMemberCalled, 0 );
+    SetValueFor( EXIMPPlgTestUpdatePresentityGroupMemberDisplayNameCalled, 0 );
+    SetValueFor( EXIMPPlgTestSubscribePresenceWatcherListCalled, 0 );
+    SetValueFor( EXIMPPlgTestUnsubscribePresenceWatcherListCalled, 0 );
+    SetValueFor( EXIMPPlgTestSubscribePresentityGroupMembersPresesenceCalled, 0 );
+    SetValueFor( EXIMPPlgTestUnsubscribePresentityGroupMembersPresesenceCalled, 0 );
+    SetValueFor( EXIMPPlgTestUpdatePresentityGroupMembersPresesenceCalled, 0 );
+    SetValueFor( EXIMPPlgTestSubscribePresenceGrantRequestListCalled, 0 );
+    SetValueFor( EXIMPPlgTestUnsubscribePresenceGrantRequestListCalled, 0 );
+
+    SetValueFor( EXIMPPlgTestGrantPresenceForPresentityCalled, 0 );
+    SetValueFor( EXIMPPlgTestGrantPresenceForPresentityGroupMembersCalled, 0 );
+    SetValueFor( EXIMPPlgTestGrantPresenceForEveryoneCalled, 0 );
+    SetValueFor( EXIMPPlgTestUpdateGrantPresenceForPresentityCalled, 0 );
+    SetValueFor( EXIMPPlgTestUpdateGrantPresenceForPresentityGroupMembersCalled, 0 );
+    SetValueFor( EXIMPPlgTestUpdateGrantPresenceForEveryoneCalled, 0 );
+    SetValueFor( EXIMPPlgTestWithdrawPresenceFromPresentityCalled, 0 );
+    SetValueFor( EXIMPPlgTestWithdrawPresenceFromPresentityGroupMembersCalled, 0 );
+    SetValueFor( EXIMPPlgTestWithdrawPresenceFromEveryoneCalled, 0 );
+
+    SetValueFor( EXIMPPlgTestSubscribePresenceBlockListCalled, 0 );
+    SetValueFor( EXIMPPlgTestUnsubscribePresenceBlockListCalled, 0 );
+    SetValueFor( EXIMPPlgTestBlockPresenceForPresentityCalled, 0 );
+    SetValueFor( EXIMPPlgTestCancelPresenceBlockFromPresentityCalled, 0 );
+    //Pia
+    SetValueFor( EXIMPPlgTestSubscribePresentityGroupListCalled, 0 );  // DoSubscribePresentityGroupListL
+    SetValueFor( EXIMPPlgTestUnsubscribePresentityGroupListCalled, 0 );  // DoUnsubscribePresentityGroupListL
+    SetValueFor( EXIMPPlgTestHandlePresentityGroupListCalled, 0 ); //EXIMPPlgTestHandlePresentityGroupListCalled
+    SetValueFor( EXIMPPlgTestHandlePresentityPresenceCalled, 0 );
+
+    SetValueFor( EXIMPPlgTestExistsGroupContentInCache, 0 );
+
+    // TODO add any new keys also to DeletePubSubKeys!!!
+
+
+   // TODO add more here
+
+    // TODO make the integer-valued keys and values into an array with
+    // default values, then loop over the array
+
+    // pubsub things have been defined. keep this as last line!
+    SetValueFor( EXIMPTestMetaPubSubDefined, 1 );
+    }
+
+
+EXPORT_C void CXIMPTestMessenger::SetPluginIndex( TInt aIndex /* = KErrNotFound */ )
+    {
+    // NOTE! Plugin index is ALWAYS set to base UID!
+    TInt val = 0;
+    TInt r = RProperty::Get( KXIMPTestPropertyCatBase,EXIMPTestMetaPluginIndex, val );
+    if ( r == KErrNotFound )
+        {
+        // value was not defined
+        TInt r = RProperty::Define( KXIMPTestPropertyCatBase, EXIMPTestMetaPluginIndex, RProperty::EInt );
+        }
+
+    r = RProperty::Set( KXIMPTestPropertyCatBase, EXIMPTestMetaPluginIndex, aIndex );
+
+    iMyUid = TUid::Uid( KXIMPTestPropertyCatBase.iUid + aIndex );
+    }
+
+
+EXPORT_C TInt CXIMPTestMessenger::GetPluginIndex()
+    {
+    TInt val = 0;
+    TInt r = RProperty::Get( KXIMPTestPropertyCatBase,EXIMPTestMetaPluginIndex, val );
+    if ( r == KErrNotFound )
+        {
+        val = KErrNotFound;
+        }
+
+    return val;
+    }
+
+
+CXIMPTestMessenger::~CXIMPTestMessenger()
+    {
+    DeletePubSubKeys();
+    iDescription.Close();
+    delete iReqCompleteParams;
+    }
+
+
+CXIMPTestMessenger::CXIMPTestMessenger( TInt aId )
+    {
+    iId = aId;
+    iMyUid = TUid::Uid( KXIMPTestPropertyCatBase.iUid + iId );
+    }
+
+
+// ===========================================================================
+// PUBLIC FUNCTIONS
+// ===========================================================================
+//
+
+//
+// Setters and getters for error code
+//
+EXPORT_C void CXIMPTestMessenger::SetNoError()
+    {
+    SetValueFor( EXIMPTestPlgBehaveError, KErrNone );
+    }
+
+EXPORT_C void CXIMPTestMessenger::SetError( TInt aErrorCode )
+    {
+    SetValueFor( EXIMPTestPlgBehaveError, aErrorCode );
+    }
+
+EXPORT_C TInt CXIMPTestMessenger::GetError()
+    {
+    return GetValueFor( EXIMPTestPlgBehaveError );
+    }
+
+//
+// Setters and getters for boolean flags
+//
+EXPORT_C void CXIMPTestMessenger::SetBoolean( TXIMPTestPropertyKeys aKey )
+    {
+    // aKey takes boolean value, e.g. "*BehaveInvalidReqId"
+    SetValueFor( aKey, 1 );
+    }
+
+EXPORT_C TBool CXIMPTestMessenger::GetBoolean( TXIMPTestPropertyKeys aKey ) const
+    {
+    // aKey takes boolean value, e.g. "*BehaveInvalidReqId"
+    return GetValueFor( aKey ) == 1;
+    }
+
+//
+// Setters, getters and utility methods for leave codes
+//
+EXPORT_C void CXIMPTestMessenger::SetLeave( TInt aLeaveCode )
+    {
+    SetValueFor( EXIMPTestPlgBehaveLeave, aLeaveCode );
+    }
+
+EXPORT_C TInt CXIMPTestMessenger::GetLeave()
+    {
+    return GetValueFor( EXIMPTestPlgBehaveLeave );
+    }
+
+// call this method to automatically handle leaves
+EXPORT_C void CXIMPTestMessenger::HandleLeaveL()
+    {
+    User::LeaveIfError( GetLeave() );
+    }
+
+
+//
+//
+// General messaging support for direct access,
+// also used internally as setters and getters.
+//
+EXPORT_C void CXIMPTestMessenger::SetValueFor( TXIMPTestPropertyKeys aKey, TInt aValue )
+    {
+    TXIMPTestMsg testMsg;
+    testMsg.iKey = aKey;
+    testMsg.iVal = aValue;
+    Send( testMsg );
+    }
+
+EXPORT_C TInt CXIMPTestMessenger::GetValueFor( TXIMPTestPropertyKeys aKey ) const
+    {
+    TXIMPTestMsg testMsg;
+    testMsg.iKey = aKey;
+    Receive( testMsg );
+    return testMsg.iVal;
+    }
+
+//
+// Actual pubsub setters and getters
+//
+void CXIMPTestMessenger::Send( TXIMPTestMsg& aMsg )
+    {
+    TInt r = RProperty::Set( iMyUid, aMsg.iKey, aMsg.iVal );
+    // TODO handle error in r
+    }
+
+void CXIMPTestMessenger::Receive( TXIMPTestMsg& aMsg ) const
+    {
+    TInt val = 0;
+    TInt r = RProperty::Get( iMyUid,
+            aMsg.iKey, val );
+    aMsg.iVal = val;
+    // TODO handle error in r, set val appropriately (0)?
+    }
+
+// ----------------------------------------------------------------
+//
+// assert helpers
+//
+void CXIMPTestMessenger::CommonAssert( TXIMPTestPropertyKeys aKey,
+        TBool aCompareState,
+        const TDesC8& aTrueDesc,
+        const TDesC8& aFalseDesc ) const
+    {
+    iDescription.Zero();
+    TBool value = GetBoolean( aKey );
+
+    if ( aCompareState )
+        {
+        // the true case means success here
+        iDescription = aFalseDesc;
+        PRFW_ASSERT_DESC( value, iDescription.PtrZ() );
+        }
+    else
+        {
+        // the false case means success here
+        iDescription = aTrueDesc;
+        PRFW_ASSERT_DESC( ! value, iDescription.PtrZ() );
+        }
+    }
+
+//
+// One Assert-method for each boolean-value (see prfwtestmessaging.h)
+//
+EXPORT_C void CXIMPTestMessenger::AssertPluginDied( TBool aState )
+    {
+    // ETrue == Yes, plugin died.
+/*    CommonAssert( EXIMPPlgTestDeath, aState,
+                 _L8( "Plugin was destroyed" ),
+                 _L8( "Plugin was not destroyed" ) );*/
+    }
+
+EXPORT_C void CXIMPTestMessenger::AssertOpenSessionCalled( TBool aState )
+    {
+    CommonAssert( EXIMPPlgTestOpenSessionCalled, aState,
+                 _L8( "OpenSession called" ),
+                 _L8( "OpenSession not called" ) );
+    }
+
+EXPORT_C void CXIMPTestMessenger::AssertShareSessionCalled( TBool aState )
+    {
+    CommonAssert( EXIMPPlgTestShareSessionCalled, aState,
+                 _L8( "ShareSession called" ),
+                 _L8( "ShareSession not called" ) );
+    }
+
+EXPORT_C void CXIMPTestMessenger::AssertCloseSessionCalled( TBool aState )
+    {
+    CommonAssert( EXIMPPlgTestCloseSessionCalled, aState,
+                 _L8( "CloseSession called" ),
+                 _L8( "CloseSession not called" ) );
+    }
+
+EXPORT_C void CXIMPTestMessenger::AssertUnshareSessionCalled( TBool aState )
+    {
+    CommonAssert( EXIMPPlgTestUnshareSessionCalled, aState,
+                 _L8( "UnshareSession called" ),
+                 _L8( "UnshareSession not called" ) );
+    }
+
+EXPORT_C void CXIMPTestMessenger::AssertSubscribePresentityGroupContentCalled( TBool aState )
+    {
+    CommonAssert( EXIMPPlgTestSubscribePresentityGroupContentCalled, aState,
+            _L8( "DoSubscribePresentityGroupContentL called" ),
+            _L8( "DoSubscribePresentityGroupContentL not called" ) );
+    }
+
+EXPORT_C void CXIMPTestMessenger::AssertSubscribePresentityGroupListCalled( TBool aState )
+    {
+    CommonAssert( EXIMPPlgTestSubscribeGroupListCalled, aState,
+            _L8( "DoSubscribePresentityGroupListL called" ),
+            _L8( "DoSubscribePresentityGroupListL not called" ) );
+    }
+
+EXPORT_C void CXIMPTestMessenger::AssertUnsubscribePresentityGroupContentCalled( TBool aState )
+    {
+    CommonAssert( EXIMPPlgTestUnsubscribePresentityGroupContentCalled, aState,
+                 _L8( "DoUnsubscribePresentityGroupContentL called" ),
+                 _L8( "DoUnsubscribePresentityGroupContentL not called" ) );
+    }
+
+EXPORT_C void CXIMPTestMessenger::AssertUnsubscribePresentityGroupListCalled( TBool aState )
+    {
+    CommonAssert( EXIMPPlgTestUnsubscribeGroupListCalled, aState,
+                 _L8( "DoUnsubscribePresentityGroupListL called" ),
+                 _L8( "DoUnsubscribePresentityGroupListL not called" ) );
+    }
+
+EXPORT_C void CXIMPTestMessenger::AssertAddPresentityGroupMemberCalled( TBool aState )
+    {
+    CommonAssert( EXIMPPlgTestAddPresentityGroupMemberCalled, aState,
+            _L8( "DoAddPresentityGroupMemberL called" ),
+            _L8( "DoAddPresentityGroupMemberL not called" ) );
+    }
+
+EXPORT_C void CXIMPTestMessenger::AssertRemovePresentityGroupMemberCalled( TBool aState )
+    {
+    CommonAssert( EXIMPPlgTestRemovePresentityGroupMemberCalled, aState,
+                 _L8( "DoRemovePresentityGroupMemberL called" ),
+                 _L8( "DoRemovePresentityGroupMemberL not called" ) );
+    }
+
+EXPORT_C void CXIMPTestMessenger::AssertUpdatePresentityGroupMemberDisplayNameCalled( TBool aState )
+    {
+    CommonAssert( EXIMPPlgTestUpdatePresentityGroupMemberDisplayNameCalled, aState,
+                 _L8( "DoUpdatePresentityGroupMemberDisplayNameL called" ),
+                 _L8( "DoUpdatePresentityGroupMemberDisplayNameL not called" ) );
+    }
+
+EXPORT_C void CXIMPTestMessenger::AssertUpdatePresentityGroupDisplayNameCalled( TBool aState )
+    {
+    CommonAssert( EXIMPPlgTestUpdatePresentityGroupDisplayNameCalled, aState,
+                 _L8( "DoUpdatePresentityGroupDisplayNameL called" ),
+                 _L8( "DoUpdatePresentityGroupDisplayNameL not called" ) );
+    }
+
+EXPORT_C void CXIMPTestMessenger::AssertCreatePresentityGroupCalled( TBool aState )
+    {
+    CommonAssert( EXIMPPlgTestCreatePresentityGroupCalled, aState,
+                 _L8( "DoCreatePresentityGroupL called" ),
+                 _L8( "DoCreatePresentityGroupL not called" ) );
+    }
+
+EXPORT_C void CXIMPTestMessenger::SetReqCompleteParams( MXIMPRestrictedObjectCollection* aParams )
+    {
+    delete iReqCompleteParams;
+    iReqCompleteParams = aParams;
+    }
+EXPORT_C MXIMPRestrictedObjectCollection* CXIMPTestMessenger::GetReqCompleteParams()
+    {
+    MXIMPRestrictedObjectCollection* retParam = iReqCompleteParams;
+    iReqCompleteParams = NULL;
+    return retParam;
+    }
+
+// TODO add more
+
+EXPORT_C void CXIMPTestMessenger::DeletePubSubKeys()
+    {
+    TInt r = RProperty::Delete( iMyUid, EXIMPPlgTestDeath );
+    r = RProperty::Delete( iMyUid, EXIMPTestPlgSessionLostStrategy );
+
+    // behavioral keys
+    r = RProperty::Delete( iMyUid, EXIMPTestPlgBehaveLeave );
+    r = RProperty::Delete( iMyUid, EXIMPTestPlgBehaveError );
+    r = RProperty::Delete( iMyUid, EXIMPTestPlgBehaveCloseHandle );
+    r = RProperty::Delete( iMyUid, EXIMPTestPlgBehaveInvalidReqId );
+    // TODO add more here
+
+    // "method called" keys
+    r = RProperty::Delete( iMyUid, EXIMPPlgTestOpenSessionCalled );
+    r = RProperty::Delete( iMyUid, EXIMPPlgTestShareSessionCalled );
+    r = RProperty::Delete( iMyUid, EXIMPPlgTestUnshareSessionCalled );
+    r = RProperty::Delete( iMyUid, EXIMPPlgTestCloseSessionCalled );
+    r = RProperty::Delete( iMyUid, EXIMPPlgTestPublishPresenceCalled );
+    r = RProperty::Delete( iMyUid, EXIMPPlgTestUpdateInterestCalled );
+    r = RProperty::Delete( iMyUid, EXIMPPlgTestSubscribeOwnPresenceCalled );
+    r = RProperty::Delete( iMyUid, EXIMPPlgTestUnsubscribeOwnPresenceCalled );
+    r = RProperty::Delete( iMyUid, EXIMPPlgTestUpdateOwnSubscriptionCalled );
+    r = RProperty::Delete( iMyUid, EXIMPPlgTestSubscribeGroupListCalled );
+    r = RProperty::Delete( iMyUid, EXIMPPlgTestUnsubscribeGroupListCalled );
+    r = RProperty::Delete( iMyUid, EXIMPPlgTestCreatePresentityGroupCalled );
+    r = RProperty::Delete( iMyUid, EXIMPPlgTestDeletePresentityGroupCalled );
+    r = RProperty::Delete( iMyUid, EXIMPPlgTestUpdatePresentityGroupDisplayNameCalled );
+    r = RProperty::Delete( iMyUid, EXIMPPlgTestSubscribePresentityPresesenceCalled );
+    r = RProperty::Delete( iMyUid, EXIMPPlgTestUnsubscribePresentityPresesenceCalled );
+    r = RProperty::Delete( iMyUid, EXIMPPlgTestUpdatePresentityPresesenceCalled );
+    r = RProperty::Delete( iMyUid, EXIMPPlgTestSubscribePresentityGroupMembersPresesenceCalled );
+    r = RProperty::Delete( iMyUid, EXIMPPlgTestUnsubscribePresentityGroupMembersPresesenceCalled );
+    r = RProperty::Delete( iMyUid, EXIMPPlgTestUpdatePresentityGroupMembersPresesenceCalled );
+
+    r = RProperty::Delete( iMyUid, EXIMPPlgTestSubscribePresentityGroupContentCalled );
+    r = RProperty::Delete( iMyUid, EXIMPPlgTestUnsubscribePresentityGroupContentCalled );
+    r = RProperty::Delete( iMyUid, EXIMPPlgTestAddPresentityGroupMemberCalled );
+    r = RProperty::Delete( iMyUid, EXIMPPlgTestRemovePresentityGroupMemberCalled );
+    r = RProperty::Delete( iMyUid, EXIMPPlgTestUpdatePresentityGroupMemberDisplayNameCalled );
+
+    r = RProperty::Delete( iMyUid, EXIMPPlgTestSubscribePresenceWatcherListCalled );
+    r = RProperty::Delete( iMyUid, EXIMPPlgTestUnsubscribePresenceWatcherListCalled );
+
+    r = RProperty::Delete( iMyUid, EXIMPPlgTestSubscribePresenceGrantRequestListCalled );
+    r = RProperty::Delete( iMyUid, EXIMPPlgTestUnsubscribePresenceGrantRequestListCalled );
+
+    r = RProperty::Delete( iMyUid, EXIMPPlgTestGrantPresenceForPresentityCalled );
+    r = RProperty::Delete( iMyUid, EXIMPPlgTestGrantPresenceForPresentityGroupMembersCalled );
+    r = RProperty::Delete( iMyUid, EXIMPPlgTestGrantPresenceForEveryoneCalled );
+    r = RProperty::Delete( iMyUid, EXIMPPlgTestUpdateGrantPresenceForPresentityCalled );
+    r = RProperty::Delete( iMyUid, EXIMPPlgTestUpdateGrantPresenceForPresentityGroupMembersCalled );
+    r = RProperty::Delete( iMyUid, EXIMPPlgTestUpdateGrantPresenceForEveryoneCalled );
+    r = RProperty::Delete( iMyUid, EXIMPPlgTestWithdrawPresenceFromPresentityCalled );
+    r = RProperty::Delete( iMyUid, EXIMPPlgTestWithdrawPresenceFromPresentityGroupMembersCalled );
+    r = RProperty::Delete( iMyUid, EXIMPPlgTestWithdrawPresenceFromEveryoneCalled );
+
+    r = RProperty::Delete( iMyUid, EXIMPPlgTestSubscribePresenceBlockListCalled );
+    r = RProperty::Delete( iMyUid, EXIMPPlgTestUnsubscribePresenceBlockListCalled );
+    r = RProperty::Delete( iMyUid, EXIMPPlgTestBlockPresenceForPresentityCalled );
+    r = RProperty::Delete( iMyUid, EXIMPPlgTestCancelPresenceBlockFromPresentityCalled );
+
+    
+       //Pia
+    r = RProperty::Delete( iMyUid, EXIMPPlgTestSubscribePresentityGroupListCalled );  // DoSubscribePresentityGroupListL
+    r = RProperty::Delete( iMyUid, EXIMPPlgTestUnsubscribePresentityGroupListCalled );  // DoUnsubscribePresentityGroupListL
+    r = RProperty::Delete( iMyUid, EXIMPPlgTestHandlePresentityGroupListCalled); //EXIMPPlgTestHandle
+    r = RProperty::Delete( iMyUid, EXIMPPlgTestHandlePresentityPresenceCalled); //
+
+
+    r = RProperty::Delete( iMyUid, EXIMPTestMetaPubSubDefined );
+
+    r = RProperty::Delete( iMyUid, EXIMPPlgTestExistsGroupContentInCache );    
+    }
+
+
+// end of file
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/tsrc/tsrcutils/testcaseutils/prfwtestmessenger.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,221 @@
+/*
+* 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: XIMP Framewor Test code prfwtestmessenger.h
+*
+*/
+
+
+#ifndef CPRFWTESTMESSENGER_H 
+#define CPRFWTESTMESSENGER_H
+
+// INCLUDES
+#include <e32def.h>
+#include <e32base.h>
+#include <e32property.h>
+#include "prfwtestmessaging.h"
+
+// CLASS DESCRIPTION
+
+class TXIMPTestMsg;
+class MXIMPRestrictedObjectCollection;
+
+/**
+ * Asynchronous protocol for PRFW testing.
+ * Implementation class and helper routines.
+ * Done using Publish and Subscribe, although it's used as a collection of
+ * "flags".
+ *
+ * RMsgQueue is not good, because we do not know the length of the array in
+ * advance: there is often 1 in the array, but there could be 2 or 3 or more.
+ * Each time someone writes, the array should be read. This becomes a bit
+ * problematic, an easier and more robust way is to use pubsub.
+ *
+ * The descriptions of API methods rely on the protocol implementation, thus
+ * the descriptions are meant to document what kind of effects the clients and
+ * users of this class expect this class to cause.
+ */
+class CXIMPTestMessenger : public CBase
+    {
+    public:
+
+        /**
+         * @param aMsgQName The name for the queue
+         */
+        IMPORT_C static CXIMPTestMessenger* NewForClientSideL( TInt aId );
+        IMPORT_C static CXIMPTestMessenger* NewForAdaptationSideL( TInt aId );
+        ~CXIMPTestMessenger();
+
+    private:
+
+        CXIMPTestMessenger( TInt aId );
+        
+        void ConstructL();
+
+    public:
+
+        /**
+         * Define and reset pubsub keys.
+         */
+        IMPORT_C void ResetPubSub();
+
+        /**
+         * Delete all pubsub keys.
+         */
+        IMPORT_C void DeletePubSubKeys();
+
+        /**
+         * Set index for plugin. Call before Bind-operation.
+         * Default of KErrNotFound (-1) will set the key to
+         * unused.
+         */
+        IMPORT_C void SetPluginIndex( TInt aIndex = KErrNotFound );
+        
+        /**
+         * Get index for plugin.
+         * @return Plugin index, or KErrNotFound if not found.
+         */
+        IMPORT_C static TInt GetPluginIndex();
+
+        /**
+         * Clears the error behavior.
+         */
+        IMPORT_C void SetNoError();
+
+        /**
+         * Setup for general error. Next operation will fail with this error
+         * code.
+         * @param aErrorCode The error code e.g. KErrNotFound
+         */
+        IMPORT_C void SetError( TInt aErrorCode );
+        
+        /**
+         * @return The currently set error code.
+         */
+        IMPORT_C TInt GetError();
+
+        /**
+         * Setup a specialized error which has a boolean value.
+         * Next operation will do the given specialized error, e.g. complete request
+         * with invalid request id (EXIMPTestPlgBehaveInvalidReqId)
+         * @param aKey The type defining the error, e.g. EXIMPTestPlgBehaveInvalidReqId
+         */
+        IMPORT_C void SetBoolean( TXIMPTestPropertyKeys aKey );
+        
+        /**
+         * @param aKey The type defining the error, e.g. EXIMPTestPlgBehaveInvalidReqId
+         * @return The value of the boolean-valued specialized error
+         */
+        IMPORT_C TBool GetBoolean( TXIMPTestPropertyKeys aKey ) const;
+
+        /**
+         * Setup for leave. Next operation will leave with given leave code.
+         * @param aLeaveCode Code with which to leave
+         */
+        IMPORT_C void SetLeave( TInt aLeaveCode );
+        
+        /**
+         * @return The currently set leave code
+         */
+        IMPORT_C TInt GetLeave();
+
+        /**
+         * Leaves if leave has been requested. Uses value obtained from pubsub.
+         */
+        IMPORT_C void HandleLeaveL();
+
+        /**
+         * General messaging support for direct access.
+         * @param aKey The key to set
+         * @param aValue The value to set to given key
+         */
+        IMPORT_C void SetValueFor( TXIMPTestPropertyKeys aKey, TInt aValue );
+
+        /**
+         * General messaging support for direct access.
+         * @param aKey The key to set
+         * @return The value in the given key
+         */
+        IMPORT_C TInt GetValueFor( TXIMPTestPropertyKeys aKey ) const;
+
+        /**
+         * Assert-methods.
+         * @param aState ETrue, if successful case is expected.
+         * 
+         * E.g. in the case of AssertPluginDied, 
+         * ETrue means:
+         *    "I expect the plugin to have died, check that it did" 
+         * and EFalse means:
+         *    "I expect the plugin to NOT have died, check that it didn't".
+         */
+        IMPORT_C void AssertPluginDied( TBool aState );
+        IMPORT_C void AssertOpenSessionCalled( TBool aState );
+        IMPORT_C void AssertCloseSessionCalled( TBool aState );
+        IMPORT_C void AssertShareSessionCalled( TBool aState );
+        IMPORT_C void AssertUnshareSessionCalled( TBool aState );
+        IMPORT_C void AssertSubscribePresentityGroupContentCalled( TBool aState );
+        IMPORT_C void AssertSubscribePresentityGroupListCalled( TBool aState );
+        IMPORT_C void AssertUnsubscribePresentityGroupContentCalled( TBool aState );
+        IMPORT_C void AssertUnsubscribePresentityGroupListCalled( TBool aState );
+        IMPORT_C void AssertAddPresentityGroupMemberCalled( TBool aState );
+        IMPORT_C void AssertCreatePresentityGroupCalled( TBool aState );
+        IMPORT_C void AssertRemovePresentityGroupMemberCalled( TBool aState );
+        IMPORT_C void AssertUpdatePresentityGroupMemberDisplayNameCalled( TBool aState );
+        IMPORT_C void AssertUpdatePresentityGroupDisplayNameCalled( TBool aState );
+        
+        IMPORT_C void SetReqCompleteParams( MXIMPRestrictedObjectCollection* aParams );
+        IMPORT_C MXIMPRestrictedObjectCollection* GetReqCompleteParams();
+
+    private:
+
+        /**
+         * Send the given message.
+         * @param aMessage The message to send with the key and value fields set
+         */
+        void Send( TXIMPTestMsg& aMsg );
+
+        /**
+         * Receive message.
+         * Returns the message with the value field set, using the same
+         * message parameter which was given as input.
+         * @param aMsg [inout] The message with the key field set
+         */
+        void Receive( TXIMPTestMsg& aMsg ) const;
+
+        /**
+         * Common internal assert method for all Assert* methods.
+         * @param aKey The key to assert
+         * @param aCompareState The expected state (ETrue for success)
+         * @param aTrueDesc Description for success case failing
+         * @param aFalseDesc Description for failure case failing
+         */
+        IMPORT_C void CommonAssert( TXIMPTestPropertyKeys aKey, 
+                TBool aCompareState, 
+                const TDesC8& aTrueDesc, 
+                const TDesC8& aFalseDesc ) const;
+    private:  
+
+        // id number for this message queue
+        TInt iId;
+        TUid iMyUid;
+
+        //OWN: Description buffer to hold the failure description
+        mutable RBuf8 iDescription;
+        
+        // Params for next reqcomplete
+        MXIMPRestrictedObjectCollection* iReqCompleteParams;
+    };
+
+#endif // CPRFWTESTMESSENGER_H
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/tsrc/tsrcutils/testcaseutils/prfwtestpresencedatautils.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -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: XIMP Framework Test Code prfwtestpresencedatautils.cpp
+*
+*/
+
+#include "prfwtestpresencedatautils.h"
+#include "prfwtestcaseutilspanics.h"
+#include <eunitmacros.h>
+
+#include "ximprbufhelpers.h"
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+
+// Generation
+// -----------------------------------------------------------------------------
+// XIMPTestPresenceDataUtils::GenerateIdentityLC()
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CXIMPIdentityImp*
+    XIMPTestPresenceDataUtils::GenerateIdentityLC(
+                            const TDesC8* aPrefix,
+                            TPresenceDataGroup aGroup )
+    {
+    // According to Group:
+    //   Generate uri
+    _LIT16( KUri, "http://google.com" );
+
+    //   Generate protocolAddr
+    _LIT16( KProtocolAddress, "protocollll" );
+    
+    CXIMPIdentityImp* pres = CXIMPIdentityImp::NewLC( KUri );
+    return pres;    
+    }
+
+
+
+// -----------------------------------------------------------------------------
+// XIMPTestPresenceDataUtils::GenerateInfoLC()
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CPresenceInfoImp*
+    XIMPTestPresenceDataUtils::GenerateInfoLC(
+                            const TDesC8* aPrefix,
+                            TPresenceDataGroup aGroup )
+    {
+    CPresenceInfoImp* doc = CPresenceInfoImp::NewLC();
+    return doc;
+    }
+    
+// -----------------------------------------------------------------------------
+// XIMPTestPresenceDataUtils::GenerateInfoFilterLC()
+// -----------------------------------------------------------------------------
+//        
+EXPORT_C CPresenceInfoFilterImp* 
+    XIMPTestPresenceDataUtils::GenerateInfoFilterLC( const TDesC8* aPrefix, 
+                                                     TPresenceDataGroup aGroup )
+    {
+    CPresenceInfoFilterImp* pif = CPresenceInfoFilterImp::NewLC();
+    return pif;
+    }
+    
+
+
+
+// -----------------------------------------------------------------------------
+// XIMPTestPresenceDataUtils::InsertPrefixL
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void XIMPTestPresenceDataUtils::InsertPrefixL( const TDesC8* aPrefix, RBuf8& buf )
+    {
+    if ( aPrefix )
+        {
+        XIMPRBuf8Helper::GrowIfNeededL( buf, aPrefix->Length() + buf.Length() );
+        buf.Insert( 0, *aPrefix );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// XIMPTestPresenceDataUtils::Contains()
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TBool XIMPTestPresenceDataUtils::Contains( MPresenceInfo& a1,
+                                                    MPresenceInfo& a2 ) const
+    {
+    return ETrue;
+    }
+
+
+
+// -----------------------------------------------------------------------------
+// XIMPTestPresenceDataUtils::Equals()
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TBool XIMPTestPresenceDataUtils::Equals( CPresenceInfoImp& a1,
+                                                  CPresenceInfoImp& a2 ) const
+    {
+    return ETrue;
+    }
+
+
+
+// -----------------------------------------------------------------------------
+// XIMPTestPresenceDataUtils::AssertEquality()
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void XIMPTestPresenceDataUtils::AssertEquality(
+    MPresenceInfo& a1,
+    MPresenceInfo& a2 )
+    {
+    }
+
+
+
+
+// end of file
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/tsrc/tsrcutils/testcaseutils/prfwtestpresencedatautils.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,81 @@
+/*
+* 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: XIMP Framework Test Code prfwtestpresencedatautils.h
+*
+*/
+
+#ifndef PRFWTESTPRESENCEDATAUTILS_H
+#define PRFWTESTPRESENCEDATAUTILS_H
+
+
+#include <e32base.h>
+#include "presenceinfoimp.h"
+#include "presenceinfofilterimp.h"
+#include "ximpidentityimp.h"
+
+
+// CLASS DESCRIPTION
+/**
+ * Helper class presence data comparison and generation.
+ */
+class XIMPTestPresenceDataUtils
+    {
+
+public:
+/**
+ * Enumeration defining the supported
+ * test data groups.
+ * A, B and C have unique values.
+ * The combinations are unions of those.
+ */
+enum TPresenceDataGroup
+    {
+    Group_None,
+    Group_A,
+    Group_B,
+    Group_C,
+    Group_AB,
+    Group_AC,
+    Group_BC,
+    Group_ABC,
+    };
+
+// TODO Add the defined names here (if needed for verification).
+
+public: //Generator functions
+    IMPORT_C static CXIMPIdentityImp* GenerateIdentityLC( const TDesC8* aPrefix, TPresenceDataGroup aGroup = Group_None );
+    IMPORT_C static CPresenceInfoImp* GenerateInfoLC( const TDesC8* aPrefix, TPresenceDataGroup aGroup = Group_None );
+    IMPORT_C static CPresenceInfoFilterImp* GenerateInfoFilterLC( const TDesC8* aPrefix, TPresenceDataGroup aGroup = Group_None );
+    
+public: //Comparator functions
+
+    // Contains. All a1 info are in a2
+    IMPORT_C TBool Contains( MPresenceInfo& a1, MPresenceInfo& a2 ) const;
+
+    
+    // Equality comparison
+    IMPORT_C TBool Equals( CPresenceInfoImp& a1, CPresenceInfoImp& a2 ) const;
+
+    // Equality assertion
+    // TODO these are containment currently. Used by t_dmattrobjs. Modify...
+    IMPORT_C static void AssertEquality( MPresenceInfo& a1,
+                                   MPresenceInfo& a2 );
+
+//private: // Helpers
+    IMPORT_C static void InsertPrefixL( const TDesC8* aPrefix, RBuf8& buf );
+    };
+
+#endif //PRFWTESTPRESENCEDATAUTILS_H
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/tsrc/tsrcutils/testcaseutils/prfwtestrobustnesstools.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,95 @@
+/*
+* 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:  Tools to increase Presence Engine tests robustness.
+ *
+*/
+
+#ifndef PENGTSTROBUSTNESSTOOLS_H__
+#define PENGTSTROBUSTNESSTOOLS_H__
+
+
+// INCLUDES
+#include <e32std.h>
+
+#include <platform/digia/eunit/eunitmacros.h>
+#include <platform/digia/eunit/teunitassertioninfo.h>
+#include "prfwtestprocessmaster.h"
+#include "userafter.h"
+#include "prfwtestfiletool.h"
+
+//MACROS
+
+
+// CLASS DESCRIPTION
+
+/**
+ * PE test robustness handler.
+ */
+class PrfwTestRobustness
+    {
+    public: //Robustness handling
+        static inline void DoPreCleaning();
+
+    private: //Helpers
+        static inline void HandleKill( TInt aErr,
+                TInt aWaitTime,
+                const TDesC& aDescription );
+
+    private: //Prohibited constructor / destructor
+        PrfwTestRobustness() {}
+        ~PrfwTestRobustness() {}
+    };
+
+
+
+// -----------------------------------------------------------------------------
+// PrfwTestRobustness public functions
+// -----------------------------------------------------------------------------
+//
+inline void PrfwTestRobustness::DoPreCleaning()
+    {
+    TInt err = PrfwTestProcessMaster::KillPscServers();
+    HandleKill( err, 0, _L("PSC srv processes - Pre") );
+
+    err = PrfwTestProcessMaster::KillRootServer();
+    HandleKill( err, 0, _L("ROOT srv processes - pre") );
+
+    TRAPD( ignore, CXIMPTestFileTool::CleanAllL() );
+    }
+
+
+// -----------------------------------------------------------------------------
+// PrfwTestRobustness functions
+// -----------------------------------------------------------------------------
+//
+inline void PrfwTestRobustness::HandleKill( TInt aErr,
+        TInt aWaitTime,
+        const TDesC& aDescription )
+    {
+    if( aErr > 0 )
+        {
+        if( aWaitTime > 0 )
+            {
+            TRAPD( ignore, CUserAfter::AfterL( aWaitTime ) );    
+            }
+
+        EUNIT_PRINT( _L("ProcessKill: %S, %d instance(s)"), &aDescription, aErr );
+        }
+    }
+
+
+#endif // PRWFWTESTROBUSTNESSTOOLS_H__
+
+//  End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/tsrc/tsrcutils/testcaseutils/prfwteststatuseventlistener.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,1051 @@
+/*
+* 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: XIMP Framework Test Code prfwteststatuseventlistener.cpp
+*
+*/
+
+#include "prfwteststatuseventlistener.h"
+#include "prfwtestcaseutilspanics.h"
+#include <eunitmacros.h>
+
+#include <ximpcontext.h>
+#include <ximpcontextstateevent.h>
+#include <ximprequestcompleteevent.h>
+#include <ximpstatus.h>
+#include <ownpresenceevent.h>
+#include <presentitypresenceevent.h>
+#include <presentitygrouplistevent.h>
+#include <presentitygroupcontentevent.h>
+#include <presencewatcherlistevent.h>
+#include <presencewatcherinfo.h>
+#include <ximpdatasubscriptionstate.h>
+
+
+using namespace NXIMPTestCaseUtilsPanic;
+EUNIT_DECLARE_PRINTABLE_AS_TINT( MXIMPContextState::TState )
+
+
+    // ============================ MEMBER FUNCTIONS ===============================
+EXPORT_C TXIMPTestStatusEventSnapshot::TXIMPTestStatusEventSnapshot()
+    {
+    iEventType = TXIMPTestStatusEventSnapshot::EStateValueNotPresent;
+    iCtxState = (MXIMPContextState::TState) TXIMPTestStatusEventSnapshot::EStateValueNotPresent;
+    iReqId = TXIMPRequestId();
+    iResultCode = TXIMPTestStatusEventSnapshot::EStateValueNotPresent;
+    }
+
+
+EXPORT_C TXIMPTestStatusEventSnapshot::TXIMPTestStatusEventSnapshot(
+        TInt aEventType,
+        TInt aCtxState,
+        TInt aResultCode )
+    {
+    iEventType = aEventType;
+    iCtxState = (MXIMPContextState::TState) aCtxState;
+    iResultCode = aResultCode;
+    }
+
+EXPORT_C TBool TXIMPTestStatusEventSnapshot::Equals(
+        const TXIMPTestStatusEventSnapshot& aOther ) const
+    {
+    TBool equals = ETrue;
+
+    if( iEventType != aOther.iEventType )
+        {
+        equals = EFalse;
+        }
+
+    if( iCtxState != aOther.iCtxState )
+        {
+        equals = EFalse;
+        }
+
+    if( iResultCode != aOther.iResultCode )
+        {
+        equals = EFalse;
+        }
+
+    return equals;
+    }
+
+
+
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+EXPORT_C CXIMPTestStatusEventListener* CXIMPTestStatusEventListener::NewL(
+        TInt aStackSize,
+        MXIMPContext* aEventSource )
+    {
+    CXIMPTestStatusEventListener* self =
+        new (ELeave) CXIMPTestStatusEventListener( aStackSize, aEventSource );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+
+CXIMPTestStatusEventListener::~CXIMPTestStatusEventListener()
+    {
+    User::Free( iSnapshots );
+    if( iEventSource )
+        {
+        iEventSource->UnregisterObserver( *this );
+        }
+
+    iAcceptedEventTypes.Reset();
+    iDescription.Close();
+    }
+
+
+CXIMPTestStatusEventListener::CXIMPTestStatusEventListener(
+        TInt aStackSize,
+        MXIMPContext* aEventSource )
+: iSnapshotMaxCount( aStackSize ),
+    iEventSource( aEventSource )
+    {
+    }
+
+
+void CXIMPTestStatusEventListener::ConstructL()
+    {
+    __ASSERT_ALWAYS( iSnapshotMaxCount > 0,
+            Panic( EStatusEventListenerBadMaxCount ) );
+
+    TInt allocSize = iSnapshotMaxCount * sizeof( TXIMPTestStatusEventSnapshot );
+    iSnapshots = (TXIMPTestStatusEventSnapshot*) User::AllocL( allocSize );
+    ResetEventStack();
+    ResetEventTypeStack();
+
+    if( iEventSource )
+        {
+        TArray< TInt32 > eventFilterArray = iAcceptedEventTypes.Array();
+        iEventSource->RegisterObserverL( *this, &eventFilterArray );
+        }
+
+    iDescription.CreateL( 512 );
+    }
+
+
+
+
+// ===========================================================================
+// PUBLIC FUNCTIONS
+// ===========================================================================
+//
+EXPORT_C void CXIMPTestStatusEventListener::SetEventSourceL(
+        MXIMPContext* aEventSource )
+    {
+    if( iEventSource )
+        {
+        iEventSource->UnregisterObserver( *this );
+        }
+
+    if( aEventSource )
+        {
+        TArray< TInt32 > eventFilterArray = iAcceptedEventTypes.Array();
+        aEventSource->RegisterObserverL( *this, &eventFilterArray );
+        }
+
+    iEventSource = aEventSource;
+    }
+
+
+
+EXPORT_C void CXIMPTestStatusEventListener::ReRegisterEventFilterL()
+    {
+    if( iEventSource )
+        {
+        TArray< TInt32 > eventFilterArray = iAcceptedEventTypes.Array();
+        iEventSource->RegisterObserverL( *this, &eventFilterArray );
+        }
+    }
+
+
+
+EXPORT_C RArray< TInt32 >& CXIMPTestStatusEventListener::AcceptedEventTypes()
+    {
+    return iAcceptedEventTypes;
+    }
+
+
+
+EXPORT_C void CXIMPTestStatusEventListener::GetEventTemplateL(
+        RArray< TXIMPTestStatusEventSnapshot >& aArray,
+        TXIMPTestStatusEventTemplate aTemplate )
+    {
+	CleanupClosePushL(aArray); 
+    switch( aTemplate )
+        {
+        // session handling
+        case EXIMPTestStatusEvents_BindingOk:
+            {
+            TXIMPTestStatusEventSnapshot event;
+            event.iEventType = MXIMPContextStateEvent::KInterfaceId;
+            event.iCtxState = MXIMPContextState::EBinding;
+            event.iResultCode = TXIMPTestStatusEventSnapshot::EStatusObjNotPresent;
+            aArray.AppendL( event );
+
+            event.iEventType = MXIMPContextStateEvent::KInterfaceId;
+            event.iCtxState = MXIMPContextState::EActive;
+            event.iResultCode = TXIMPTestStatusEventSnapshot::EStatusObjNotPresent;
+            aArray.AppendL( event );
+
+            event.iEventType = MXIMPRequestCompleteEvent::KInterfaceId;
+            event.iCtxState = (MXIMPContextState::TState) TXIMPTestStatusEventSnapshot::EStateValueNotPresent;
+            event.iResultCode = KErrNone;
+            aArray.AppendL( event );
+
+            break;
+            }
+
+        case EXIMPTestStatusEvents_BindingFailKErrAbort:
+            {
+            TXIMPTestStatusEventSnapshot event;
+            event.iEventType = MXIMPContextStateEvent::KInterfaceId;
+            event.iCtxState = MXIMPContextState::EBinding;
+            event.iResultCode = TXIMPTestStatusEventSnapshot::EStatusObjNotPresent;
+            aArray.AppendL( event );
+
+            event.iEventType = MXIMPContextStateEvent::KInterfaceId;
+            event.iCtxState = MXIMPContextState::EInactive;
+            event.iResultCode = TXIMPTestStatusEventSnapshot::EStatusObjNotPresent;
+            aArray.AppendL( event );
+
+            event.iEventType = MXIMPRequestCompleteEvent::KInterfaceId;
+            event.iCtxState = (MXIMPContextState::TState) TXIMPTestStatusEventSnapshot::EStateValueNotPresent;
+            event.iResultCode = KErrAbort;
+            aArray.AppendL( event );
+            break;
+            }
+
+        case EXIMPTestStatusEvents_BindingFailInvalidReqId:
+            {
+            TXIMPTestStatusEventSnapshot event;
+            event.iEventType = MXIMPContextStateEvent::KInterfaceId;
+            event.iCtxState = MXIMPContextState::EBinding;
+            event.iResultCode = TXIMPTestStatusEventSnapshot::EStatusObjNotPresent;
+            aArray.AppendL( event );
+
+            event.iEventType = MXIMPRequestCompleteEvent::KInterfaceId;
+            event.iCtxState = (MXIMPContextState::TState) TXIMPTestStatusEventSnapshot::EStateValueNotPresent,
+            event.iResultCode = KErrServerTerminated;
+            aArray.AppendL( event );            
+            
+            event.iEventType = MXIMPContextStateEvent::KInterfaceId;
+            event.iCtxState = MXIMPContextState::EInactive;
+            event.iResultCode = KErrServerTerminated;
+            
+            aArray.AppendL( event );
+            break;
+            }
+
+
+        case EXIMPTestStatusEvents_BindingFailServerTermination:
+            {
+            TXIMPTestStatusEventSnapshot event;
+            event.iEventType = MXIMPContextStateEvent::KInterfaceId;
+            event.iCtxState = MXIMPContextState::EUnbinding;
+            event.iResultCode = KErrServerTerminated;
+            aArray.AppendL( event );
+
+            event.iEventType = MXIMPContextStateEvent::KInterfaceId;
+            event.iCtxState = MXIMPContextState::EInactive;
+            event.iResultCode = KErrServerTerminated;
+            aArray.AppendL( event );
+
+            event.iEventType = MXIMPRequestCompleteEvent::KInterfaceId;
+            event.iCtxState = (MXIMPContextState::TState) TXIMPTestStatusEventSnapshot::EStateValueNotPresent;
+            event.iResultCode = KErrServerTerminated;
+            aArray.AppendL( event );
+
+            break;
+            }
+
+        case EXIMPTestStatusEvents_UnbindingOk:
+            {
+            TXIMPTestStatusEventSnapshot event;
+            event.iEventType = MXIMPContextStateEvent::KInterfaceId;
+            event.iCtxState = MXIMPContextState::EUnbinding;
+            event.iResultCode = TXIMPTestStatusEventSnapshot::EStatusObjNotPresent;
+            aArray.AppendL( event );
+
+            event.iEventType = MXIMPContextStateEvent::KInterfaceId;
+            event.iCtxState = MXIMPContextState::EInactive;
+            event.iResultCode = TXIMPTestStatusEventSnapshot::EStatusObjNotPresent;
+            aArray.AppendL( event );
+
+            event.iEventType = MXIMPRequestCompleteEvent::KInterfaceId;
+            event.iCtxState = (MXIMPContextState::TState) TXIMPTestStatusEventSnapshot::EStateValueNotPresent;
+            event.iResultCode = KErrNone;
+            aArray.AppendL( event );
+            break;
+            }
+
+
+        case EXIMPTestStatusEvents_RequestOk:
+            {
+            TXIMPTestStatusEventSnapshot event;
+            event.iEventType = MXIMPRequestCompleteEvent::KInterfaceId;
+            event.iCtxState = (MXIMPContextState::TState) TXIMPTestStatusEventSnapshot::EStateValueNotPresent;
+            event.iResultCode = KErrNone;
+            aArray.AppendL( event );
+            break;
+            }
+
+
+        case EXIMPTestStatusEvents_RequestOOM:
+            {
+            TXIMPTestStatusEventSnapshot event;
+            event.iEventType = MXIMPRequestCompleteEvent::KInterfaceId;
+            event.iCtxState = (MXIMPContextState::TState) TXIMPTestStatusEventSnapshot::EStateValueNotPresent;
+            event.iResultCode = KErrNoMemory;
+            aArray.AppendL( event );
+            break;
+            }
+
+
+
+        // own presence
+        case EXIMPTestStatusEvents_SubscribeOwnPresenceSingleCtx:
+            {
+            TXIMPTestStatusEventSnapshot event;
+            event.iEventType = MOwnPresenceEvent::KInterfaceId;
+            event.iCtxState = (MXIMPContextState::TState) ( MXIMPDataSubscriptionState::EDataUnavailable + MXIMPDataSubscriptionState::ESubscriptionActive );
+            event.iResultCode = TXIMPTestStatusEventSnapshot::EStateValueNotPresent;
+            aArray.AppendL( event );
+            break;
+            }
+
+        case EXIMPTestStatusEvents_UnsubscribeOwnPresenceSingleCtx:
+            {
+            TXIMPTestStatusEventSnapshot event;
+            event.iEventType = MOwnPresenceEvent::KInterfaceId;
+            event.iCtxState = (MXIMPContextState::TState) ( MXIMPDataSubscriptionState::EDataUnavailable + MXIMPDataSubscriptionState::ESubscriptionInactive );
+            event.iResultCode = TXIMPTestStatusEventSnapshot::EStateValueNotPresent;
+            aArray.AppendL( event );
+            break;
+            }
+
+        // presentity presence
+        case EXIMPTestStatusEvents_SubscribePresentityPresenceSingleCtx:
+            {
+            TXIMPTestStatusEventSnapshot event;
+            event.iEventType = MPresentityPresenceEvent::KInterfaceId;
+            event.iCtxState = (MXIMPContextState::TState) ( MXIMPDataSubscriptionState::EDataUnavailable + MXIMPDataSubscriptionState::ESubscriptionActive );
+            event.iResultCode = TXIMPTestStatusEventSnapshot::EStateValueNotPresent;
+            aArray.AppendL( event );
+            break;
+            }
+
+        case EXIMPTestStatusEvents_UnsubscribePresentityPresenceSingleCtx:
+            {
+            TXIMPTestStatusEventSnapshot event;
+            event.iEventType = MPresentityPresenceEvent::KInterfaceId;
+            event.iCtxState = (MXIMPContextState::TState) ( MXIMPDataSubscriptionState::EDataUnavailable + MXIMPDataSubscriptionState::ESubscriptionInactive );
+            event.iResultCode = TXIMPTestStatusEventSnapshot::EStateValueNotPresent;
+            aArray.AppendL( event );
+            break;
+            }
+
+        // group lists
+        case EXIMPTestStatusEvents_SubscribePresentityGroupListCtx:
+            {
+            // TODO check this
+            TXIMPTestStatusEventSnapshot event;
+            event.iEventType = MPresentityGroupListEvent::KInterfaceId;
+            event.iCtxState = (MXIMPContextState::TState) TXIMPTestStatusEventSnapshot::EStateValueNotPresent;
+            event.iResultCode = KErrNone;
+            aArray.AppendL( event );
+
+            event.iEventType = MXIMPRequestCompleteEvent::KInterfaceId;
+            event.iCtxState = (MXIMPContextState::TState) TXIMPTestStatusEventSnapshot::EStateValueNotPresent;
+            event.iResultCode = KErrNone;
+            aArray.AppendL( event );
+            break;
+            }
+
+        case EXIMPTestStatusEvents_UnsubscribePresentityGroupListCtx:
+            {
+            TXIMPTestStatusEventSnapshot event;
+            event.iEventType = MPresentityGroupListEvent::KInterfaceId;
+            // TODO check this
+            event.iCtxState = (MXIMPContextState::TState) TXIMPTestStatusEventSnapshot::EStateValueNotPresent;
+            event.iResultCode = TXIMPTestStatusEventSnapshot::EStateValueNotPresent;
+            aArray.AppendL( event );
+            break;
+            }
+
+        case EXIMPTestStatusEvents_CreatePresentityGroup:
+            {
+            TXIMPTestStatusEventSnapshot event;
+            event.iEventType = MPresentityGroupListEvent::KInterfaceId;
+            // TODO check this
+            event.iCtxState = (MXIMPContextState::TState) TXIMPTestStatusEventSnapshot::EStateValueNotPresent;
+            event.iResultCode = TXIMPTestStatusEventSnapshot::EStateValueNotPresent;
+            aArray.AppendL( event );
+
+            event.iEventType = MXIMPRequestCompleteEvent::KInterfaceId;
+            event.iCtxState = (MXIMPContextState::TState) TXIMPTestStatusEventSnapshot::EStateValueNotPresent;
+            event.iResultCode = KErrNone;
+            aArray.AppendL( event );
+
+            break;
+            }
+
+        case EXIMPTestStatusEvents_HandlePresentityGroupList:
+            {
+            TXIMPTestStatusEventSnapshot event;
+            event.iEventType = MPresentityGroupListEvent::KInterfaceId;
+            // TODO check this
+            event.iCtxState = (MXIMPContextState::TState) TXIMPTestStatusEventSnapshot::EStateValueNotPresent;
+            event.iResultCode = TXIMPTestStatusEventSnapshot::EStateValueNotPresent;
+            aArray.AppendL( event );
+            break;
+            }
+
+        // group content
+        case EXIMPTestStatusEvents_SubscribePresentityGroupContentSingleCtx:
+            {
+            // TODO check this
+            TXIMPTestStatusEventSnapshot event;
+            event.iEventType = MPresentityGroupContentEvent::KInterfaceId;
+            event.iCtxState = (MXIMPContextState::TState) TXIMPTestStatusEventSnapshot::EStateValueNotPresent;
+            event.iResultCode = KErrNone;
+            aArray.AppendL( event );
+
+            event.iEventType = MXIMPRequestCompleteEvent::KInterfaceId;
+            event.iCtxState = (MXIMPContextState::TState) TXIMPTestStatusEventSnapshot::EStateValueNotPresent;
+            event.iResultCode = KErrNone;
+            aArray.AppendL( event );
+            break;
+            }
+
+        case EXIMPTestStatusEvents_UnsubscribePresentityGroupContentSingleCtx:
+            {
+            TXIMPTestStatusEventSnapshot event;
+            event.iEventType = MPresentityGroupContentEvent::KInterfaceId;
+            event.iCtxState = (MXIMPContextState::TState) TXIMPTestStatusEventSnapshot::EStateValueNotPresent;
+            event.iResultCode = TXIMPTestStatusEventSnapshot::EStateValueNotPresent;
+            aArray.AppendL( event );
+
+            event.iEventType = MXIMPRequestCompleteEvent::KInterfaceId;
+            event.iCtxState = (MXIMPContextState::TState) TXIMPTestStatusEventSnapshot::EStateValueNotPresent;
+            event.iResultCode = KErrNone;
+            aArray.AppendL( event );
+            break;
+            }
+
+        // watcher list
+        case EXIMPTestStatusEvents_SubscribePresenceWatcherListCtx:
+            {
+            TXIMPTestStatusEventSnapshot event;
+            event.iEventType = MPresenceWatcherListEvent::KInterfaceId;
+            event.iCtxState = (MXIMPContextState::TState) TXIMPTestStatusEventSnapshot::EStateValueNotPresent;
+            event.iResultCode = KErrNone;
+            aArray.AppendL( event );
+
+            event.iEventType = MXIMPRequestCompleteEvent::KInterfaceId;
+            event.iCtxState = (MXIMPContextState::TState) TXIMPTestStatusEventSnapshot::EStateValueNotPresent;
+            event.iResultCode = KErrNone;
+            aArray.AppendL( event );
+            break;
+            }
+
+        case EXIMPTestStatusEvents_UnsubscribePresenceWatcherListCtx:
+            {
+            TXIMPTestStatusEventSnapshot event;
+            event.iEventType = MPresenceWatcherListEvent::KInterfaceId;
+            event.iCtxState = (MXIMPContextState::TState) TXIMPTestStatusEventSnapshot::EStateValueNotPresent;
+            event.iResultCode = TXIMPTestStatusEventSnapshot::EStateValueNotPresent;
+            aArray.AppendL( event );
+            break;
+            }
+
+        case EXIMPTestStatusEvents_HandlePresenceWatcherList:
+            {
+            TXIMPTestStatusEventSnapshot event;
+            event.iEventType = MPresenceWatcherListEvent::KInterfaceId;
+            event.iCtxState = (MXIMPContextState::TState) TXIMPTestStatusEventSnapshot::EStateValueNotPresent;
+            event.iResultCode = TXIMPTestStatusEventSnapshot::EStateValueNotPresent;
+            aArray.AppendL( event );
+            break;
+            }
+
+        case EXIMPTestStatusEvents_HandlePresentityPresence:
+            {
+            TXIMPTestStatusEventSnapshot event;
+            event.iEventType = MPresentityPresenceEvent::KInterfaceId;
+            event.iCtxState = (MXIMPContextState::TState) ( MXIMPDataSubscriptionState::EDataAvailable + MXIMPDataSubscriptionState::ESubscriptionActive );
+            event.iResultCode = TXIMPTestStatusEventSnapshot::EStateValueNotPresent;
+            aArray.AppendL( event );
+            break;
+            }
+
+
+        case EXIMPTestStatusEvents_HandlePresentityPresencePending:
+            {
+            TXIMPTestStatusEventSnapshot event;
+            event.iEventType = MPresentityPresenceEvent::KInterfaceId;
+            event.iCtxState = (MXIMPContextState::TState) ( MXIMPDataSubscriptionState::EDataUnavailable + MXIMPDataSubscriptionState::ESubscriptionActive );
+            event.iResultCode = TXIMPTestStatusEventSnapshot::EStateValueNotPresent;
+            aArray.AppendL( event );
+            break;
+            }
+
+        case EXIMPTestStatusEvents_PresentitySubscribeFailKErrAbort:
+            {
+            TXIMPTestStatusEventSnapshot event;
+            event.iEventType = MXIMPRequestCompleteEvent::KInterfaceId;
+            event.iCtxState = (MXIMPContextState::TState) TXIMPTestStatusEventSnapshot::EStateValueNotPresent;
+            event.iResultCode = KErrAbort;
+            aArray.AppendL( event );
+            break;
+            }
+
+        // misc
+        case EXIMPTestStatusEvents_PublishOk:
+            {
+            TXIMPTestStatusEventSnapshot event;
+
+            // request complete with KErrNone
+            event.iEventType = MXIMPRequestCompleteEvent::KInterfaceId;
+            event.iCtxState = (MXIMPContextState::TState) TXIMPTestStatusEventSnapshot::EStateValueNotPresent;
+            event.iResultCode = KErrNone;
+            aArray.AppendL( event );
+
+            // OwnPresenceEvent
+            event.iEventType = MOwnPresenceEvent::KInterfaceId;
+            event.iCtxState = (MXIMPContextState::TState) TXIMPTestStatusEventSnapshot::EStateValueNotPresent;
+            event.iResultCode = TXIMPTestStatusEventSnapshot::EStatusObjNotPresent;
+            aArray.AppendL( event );
+
+            break;
+            }
+
+        case EXIMPTestStatusEvents_PublishFailKErrAbort:
+            {
+            TXIMPTestStatusEventSnapshot event;
+
+            // Request completed with KErrAbort
+            event.iEventType = MXIMPRequestCompleteEvent::KInterfaceId;
+            event.iCtxState = (MXIMPContextState::TState) TXIMPTestStatusEventSnapshot::EStateValueNotPresent;
+            event.iResultCode = KErrAbort;
+            aArray.AppendL( event );
+
+            break;
+            }
+
+        default:
+            {
+            Panic( EStatusEventListenerUnknownEventTemplate );
+            }
+        }
+		CleanupStack::Pop(&aArray);
+    }
+
+
+
+EXPORT_C void CXIMPTestStatusEventListener::WaitRequestAndStackEvents(
+        const TXIMPRequestId& aReqToWait, TBool aAnyReq /* = EFalse */ )
+    {
+    __ASSERT_ALWAYS( !iWait.IsStarted(),
+            Panic( EStatusEventListenerAlreadyWaiting ) );
+
+    iWaitForAnyReq = aAnyReq;
+    iReqToWait = aReqToWait;
+    iWaitForAnyEvent = EFalse;
+
+    iWait.Start();
+    }
+
+EXPORT_C void CXIMPTestStatusEventListener::WaitAnyEvent()
+    {
+    iWaitForAnyEvent = ETrue;
+    iWait.Start();
+    }
+
+
+EXPORT_C void CXIMPTestStatusEventListener::VerifyEventStackL(
+        const TArray< TXIMPTestStatusEventSnapshot >& aEventTraits,
+        const TDesC8& aErrorTitle ) const
+    {
+    iDescription.Zero();
+    TInt ix = 0;
+
+    //Dumb event lists if there is some mismatches
+    if( !HasSameEvents( aEventTraits ) )
+        {
+        iDescription = aErrorTitle;
+        iDescription += _L8("Mismatches in event stack");
+        EUNIT_PRINT( iDescription );
+
+        iDescription = _L8("Received: ");
+        for( ix = 0; ix < iSnapshotCount; ix++ )
+            {
+            GetNameForEvent( iDescription, SnapshotFromStack( ix ).iEventType );
+            }
+        EUNIT_PRINT( iDescription );
+
+
+        iDescription = _L8("Expected: ");
+        const TInt traitCount = aEventTraits.Count();
+        for( ix = 0; ix < traitCount; ix++ )
+            {
+            GetNameForEvent( iDescription, aEventTraits[ ix ].iEventType );
+            }
+        EUNIT_PRINT( iDescription );
+        }
+
+
+    //Now do the actual verification
+    iDescription = aErrorTitle;
+    iDescription += _L8("Event count mismatch");
+    EUNIT_ASSERT_EQUALS_DESC( iSnapshotCount, aEventTraits.Count(), iDescription.PtrZ() );
+
+
+    for( TInt ix = 0; ix < iSnapshotCount; ix++ )
+        {
+        const TXIMPTestStatusEventSnapshot& expected = aEventTraits[ ix ];
+        const TXIMPTestStatusEventSnapshot& received = SnapshotFromStack( ix );
+
+            {
+            iDescription = aErrorTitle;
+            iDescription.AppendFormat( _L8("Event type mismatch on event [%d]"), ix );
+            EUNIT_ASSERT_EQUALS_DESC( expected.iEventType, expected.iEventType, iDescription.PtrZ() );
+            }
+
+            {
+            const TInt type = received.iEventType;
+
+            iDescription = aErrorTitle;
+            iDescription += _L8("Content mismatch on ");
+            GetNameForEvent( iDescription, type );
+            iDescription.AppendFormat( _L8("event on position [%d]"), ix );
+            switch( type )
+                {
+                case MXIMPRequestCompleteEvent::KInterfaceId:
+                    {
+                    EUNIT_ASSERT_EQUALS_DESC( expected.iResultCode, received.iResultCode, iDescription.PtrZ() );
+                    break;
+                    }
+
+
+                case MXIMPContextStateEvent::KInterfaceId:
+                    {
+                    EUNIT_ASSERT_EQUALS_DESC( expected.iCtxState, received.iCtxState, iDescription.PtrZ() );
+                    EUNIT_ASSERT_EQUALS_DESC( expected.iResultCode, received.iResultCode, iDescription.PtrZ() );
+                    break;
+                    }
+
+                case MOwnPresenceEvent::KInterfaceId:
+                case MPresentityPresenceEvent::KInterfaceId:
+                    {
+                    EUNIT_ASSERT_EQUALS_DESC( expected.iCtxState, received.iCtxState, iDescription.PtrZ() );
+                    break;
+                    }
+
+                case MPresentityGroupListEvent::KInterfaceId:
+                    {
+                    EUNIT_ASSERT_EQUALS_DESC( expected.iCtxState, received.iCtxState, iDescription.PtrZ() );
+                    EUNIT_ASSERT_EQUALS_DESC( expected.iResultCode, received.iResultCode, iDescription.PtrZ() );
+                    break;
+                    }
+
+                case MPresentityGroupContentEvent::KInterfaceId:
+                    {
+                    EUNIT_ASSERT_EQUALS_DESC( expected.iCtxState, received.iCtxState, iDescription.PtrZ() );
+                    EUNIT_ASSERT_EQUALS_DESC( expected.iResultCode, received.iResultCode, iDescription.PtrZ() );
+                    break;
+                    }
+
+                case MPresenceWatcherListEvent::KInterfaceId:
+                    {
+                    EUNIT_ASSERT_EQUALS_DESC( expected.iCtxState, received.iCtxState, iDescription.PtrZ() );
+                    EUNIT_ASSERT_EQUALS_DESC( expected.iResultCode, received.iResultCode, iDescription.PtrZ() );
+                    break;
+                    }
+
+
+                default:
+                    {
+                    Panic( EUnsupportedEventTypeInVerification );
+                    break;
+                    }
+                }
+            }
+        }
+    }
+
+
+
+
+EXPORT_C TInt CXIMPTestStatusEventListener::GetReqCompletionErrL( 
+    const TXIMPRequestId& aReqId ) const
+    {
+    for( TInt ix = 0; ix < iSnapshotCount; ix++ )
+        {
+        const TXIMPTestStatusEventSnapshot& received = SnapshotFromStack( ix );
+        const TInt type = received.iEventType;
+
+        if( type == MXIMPRequestCompleteEvent::KInterfaceId )
+            {
+            if( received.iReqId == aReqId )
+                {
+                return received.iResultCode;
+                }
+            }
+        }
+    
+    User::Leave( KErrNotFound );
+    return KErrNotFound;
+    }
+
+
+EXPORT_C void CXIMPTestStatusEventListener::ResetEventStack()
+    {
+    for( TInt ix = 0; ix < iSnapshotMaxCount; ix++ )
+        {
+        new( &iSnapshots[ ix ] ) TXIMPTestStatusEventSnapshot();
+        }
+
+    iSnapshotCount = 0;
+    }
+
+EXPORT_C void CXIMPTestStatusEventListener::ResetEventTypeStack()
+    {
+    iAcceptedEventTypes.Reset();
+    iAcceptedEventTypes.AppendL( MXIMPRequestCompleteEvent::KInterfaceId );
+    iAcceptedEventTypes.AppendL( MXIMPContextStateEvent::KInterfaceId );
+    iAcceptedEventTypes.AppendL( MOwnPresenceEvent::KInterfaceId );
+    iAcceptedEventTypes.AppendL( MPresentityPresenceEvent::KInterfaceId );
+    }
+
+EXPORT_C void CXIMPTestStatusEventListener::SetEventObserver( MXIMPContextObserver* aObserver )
+    {
+    iObserver = aObserver;
+    }
+
+
+
+
+
+
+
+
+// ===========================================================================
+// FROM MPRFWPRESENCECONTEXTOBSERVER
+// ===========================================================================
+//
+void CXIMPTestStatusEventListener::HandlePresenceContextEvent(
+    const MXIMPContext& aContext,
+    const MXIMPBase& aEvent )
+    {
+    const TInt32 eventType = aEvent.GetInterfaceId();
+
+    __ASSERT_ALWAYS( iEventSource == &aContext,
+            Panic( EReceivingEventFromWrongContext ) );
+
+    __ASSERT_ALWAYS( IsAcceptedEventType( eventType ),
+            Panic( EReceivedNotAcceptedEventType ) );
+
+    TXIMPTestStatusEventSnapshot snapShot;
+    switch( eventType )
+        {
+        case MXIMPRequestCompleteEvent::KInterfaceId:
+            {
+            const MXIMPRequestCompleteEvent* event =
+                TXIMPGetInterface< const MXIMPRequestCompleteEvent >::From( aEvent, MXIMPBase::EPanicIfUnknown );
+                {
+                snapShot.iEventType = event->GetInterfaceId();
+                snapShot.iCtxState = (MXIMPContextState::TState) TXIMPTestStatusEventSnapshot::EStateValueNotPresent;
+                snapShot.iReqId = event->RequestId();
+                snapShot.iResultCode = event->CompletionResult().ResultCode();
+
+                AddSnapshotToStack( snapShot );
+                }
+
+            if( iWaitForAnyReq || event->RequestId() == iReqToWait )
+                {
+                HandleRequestCompleteReceived();
+                }
+
+            break;
+            }
+
+        case MXIMPContextStateEvent::KInterfaceId:
+            {
+            const MXIMPContextStateEvent& event =
+                *TXIMPGetInterface< const MXIMPContextStateEvent >::From( aEvent,
+                                                                                  MXIMPBase::EPanicIfUnknown );
+                {
+                TXIMPTestStatusEventSnapshot snapShot;
+                snapShot.iEventType = event.GetInterfaceId();
+                snapShot.iCtxState = event.ContextState().ContextState();
+                if( event.StateChangeReason() )
+                    {
+                    snapShot.iResultCode = event.StateChangeReason()->ResultCode();
+                    }
+                else
+                    {
+                    snapShot.iResultCode = TXIMPTestStatusEventSnapshot::EStatusObjNotPresent;
+                    }
+
+                AddSnapshotToStack( snapShot );
+                }
+            break;
+            }
+
+        case MOwnPresenceEvent::KInterfaceId:
+            {
+            const MOwnPresenceEvent& event =
+                *TXIMPGetInterface< const MOwnPresenceEvent >::From( aEvent,
+                                                                         MXIMPBase::EPanicIfUnknown );
+                {
+                TXIMPTestStatusEventSnapshot snapShot;
+                snapShot.iEventType = event.GetInterfaceId();
+                snapShot.iCtxState = ( MXIMPContextState::TState ) ( event.DataSubscriptionState().DataState() + event.DataSubscriptionState().SubscriptionState() );
+                AddSnapshotToStack( snapShot );
+                }
+            break;
+            }
+
+        case MPresentityPresenceEvent::KInterfaceId:
+            {
+            const MPresentityPresenceEvent& event =
+                *TXIMPGetInterface< const MPresentityPresenceEvent >::From( aEvent,
+                                                                                MXIMPBase::EPanicIfUnknown );
+                {
+                TXIMPTestStatusEventSnapshot snapShot;
+                snapShot.iEventType = event.GetInterfaceId();
+                snapShot.iCtxState = ( MXIMPContextState::TState ) ( event.DataSubscriptionState().DataState() + event.DataSubscriptionState().SubscriptionState() );
+                AddSnapshotToStack( snapShot );
+                }
+            break;
+            }
+
+        case MPresentityGroupListEvent::KInterfaceId:
+            {
+            const MPresentityGroupListEvent& event =
+                *TXIMPGetInterface< const MPresentityGroupListEvent >::From( aEvent,
+                                                                                 MXIMPBase::EPanicIfUnknown );
+                {
+                TXIMPTestStatusEventSnapshot snapShot;
+                snapShot.iEventType = event.GetInterfaceId();
+                AddSnapshotToStack( snapShot );
+                }
+            break;
+            }
+
+        case MPresentityGroupContentEvent::KInterfaceId:
+            {
+            const MPresentityGroupContentEvent& event =
+            *TXIMPGetInterface< const MPresentityGroupContentEvent >::From( aEvent,
+                                                                                MXIMPBase::EPanicIfUnknown );
+                {
+                TXIMPTestStatusEventSnapshot snapShot;
+                snapShot.iEventType = event.GetInterfaceId();
+                AddSnapshotToStack( snapShot );
+                }
+            break;
+            }
+
+
+        case MPresenceWatcherListEvent::KInterfaceId:
+            {
+            const MPresenceWatcherListEvent& event =
+                *TXIMPGetInterface< const MPresenceWatcherListEvent >::From( aEvent,
+                                                                                 MXIMPBase::EPanicIfUnknown );
+                {
+                TXIMPTestStatusEventSnapshot snapShot;
+                snapShot.iEventType = event.GetInterfaceId();
+                AddSnapshotToStack( snapShot );
+                }
+            break;
+            }
+
+
+        default:
+            {
+            break;
+            }
+        }
+
+    if( iObserver )
+        {
+        iObserver->HandlePresenceContextEvent( aContext, aEvent );
+        }
+
+    if( iWaitForAnyEvent )
+        {
+        HandleRequestCompleteReceived();
+        }
+    }
+
+
+
+// ===========================================================================
+// HELPERS
+// ===========================================================================
+//
+void CXIMPTestStatusEventListener::HandleRequestCompleteReceived()
+    {
+    if( iWait.IsStarted() )
+        {
+        iWait.AsyncStop();
+        }
+    }
+
+
+
+TBool CXIMPTestStatusEventListener::IsAcceptedEventType( TInt32 aEventType ) const
+    {
+    TInt index = iAcceptedEventTypes.Find( aEventType );
+    if( index == KErrNotFound )
+        {
+        return EFalse;
+        }
+    return ETrue;
+    }
+
+
+
+void CXIMPTestStatusEventListener::AddSnapshotToStack(
+        TXIMPTestStatusEventSnapshot aSnapshot )
+    {
+    __ASSERT_ALWAYS( iSnapshotCount < iSnapshotMaxCount,
+            Panic( EAddSnapshotOverflow ) );
+
+    iSnapshots[ iSnapshotCount ] = aSnapshot;
+    iSnapshotCount++;
+    }
+
+
+
+const TXIMPTestStatusEventSnapshot& CXIMPTestStatusEventListener::SnapshotFromStack( TInt aIndex ) const
+    {
+    __ASSERT_ALWAYS( aIndex < iSnapshotCount,
+            Panic( ESnapshotIndexOutOfBounds ) );
+
+    return iSnapshots[ aIndex ];
+    }
+
+
+
+TBool CXIMPTestStatusEventListener::HasSameEvents(
+        const TArray< TXIMPTestStatusEventSnapshot >& aEventTraits ) const
+    {
+    TBool hasSameEvents = ETrue;
+
+    if( iSnapshotCount != aEventTraits.Count() )
+        {
+        hasSameEvents = EFalse;
+        }
+    else
+        {
+        for( TInt ix = 0; ix < iSnapshotCount; ix++ )
+            {
+            const TXIMPTestStatusEventSnapshot& eventTrait = aEventTraits[ ix ];
+            const TXIMPTestStatusEventSnapshot& receivedEvent = SnapshotFromStack( ix );
+
+            if( !receivedEvent.Equals( eventTrait ) )
+                {
+                hasSameEvents = EFalse;
+                }
+            }
+        }
+
+    return hasSameEvents;
+    }
+
+
+
+void CXIMPTestStatusEventListener::GetNameForEvent(
+        TDes8& aTarget,
+        TInt aEventType ) const
+    {
+    switch( aEventType )
+        {
+        case MXIMPRequestCompleteEvent::KInterfaceId:
+            {
+            SafeAppendEventName( aTarget, _L8("[ReqComplete] ") );
+            break;
+            }
+
+        case MXIMPContextStateEvent::KInterfaceId:
+            {
+            SafeAppendEventName( aTarget, _L8("[PresCtx] ") );
+            break;
+            }
+
+        case MOwnPresenceEvent::KInterfaceId:
+            {
+            SafeAppendEventName( aTarget, _L8("[OwnPres] ") );
+            break;
+            }
+
+        case MPresentityGroupListEvent::KInterfaceId:
+            {
+            SafeAppendEventName( aTarget, _L8("[GroupList] ") );
+            break;
+            }
+
+        case MPresentityGroupContentEvent::KInterfaceId:
+            {
+            SafeAppendEventName( aTarget, _L8("[GroupContent] ") );
+            break;
+            }
+
+        case MPresentityPresenceEvent::KInterfaceId:
+            {
+            SafeAppendEventName( aTarget, _L8("[Presentity] ") );
+            break;
+            }
+
+        default:
+            {
+            SafeAppendEventName( aTarget, _L8("[Unknown] ") );
+            break;
+            }
+        }
+    }
+
+
+
+void CXIMPTestStatusEventListener::SafeAppendEventName(
+        TDes8& aTarget,
+        const TDesC8& aName ) const
+    {
+    const TInt sizeAvailable = aTarget.MaxLength() - aTarget.Length();
+
+    if( sizeAvailable > aName.Size() )
+        {
+        aTarget += aName;
+        }
+    else
+        {
+        _LIT8( KEllipsis, "..." );
+        if( sizeAvailable > KEllipsis().Size() )
+            {
+            aTarget += KEllipsis;
+            }
+        }
+    }
+
+
+
+
+// end of file
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/tsrc/tsrcutils/testcaseutils/prfwteststatuseventlistener.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,284 @@
+/*
+* 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: XIMP Framework Test Code prfwteststatuseventlistener.h
+*
+*/
+
+#ifndef CPRFWTESTSTATUSEVENTLISTENER_H__
+#define CPRFWTESTSTATUSEVENTLISTENER_H__
+
+
+#include <e32base.h>
+#include <ximpcontextobserver.h>
+#include <ximpcontextstate.h>
+
+
+
+// CLASS DESCRIPTION
+/**
+ * Helper class to store snapshot from
+ * received status events:
+ * - MXIMPRequestCompleteEvent
+ * - MXIMPContextStateEvent
+ */
+class TXIMPTestStatusEventSnapshot
+    {
+public: //Value enums
+    enum
+        {
+        EStatusObjNotPresent = 100,
+        EStateValueNotPresent = 101
+        };
+
+public: //Constructors
+
+    //Default c++ constructor
+    IMPORT_C TXIMPTestStatusEventSnapshot();
+
+    //Constructor accepting integer fields
+    IMPORT_C TXIMPTestStatusEventSnapshot( TInt aEventType,
+                                           TInt aCtxState,
+                                           TInt aResultCode );
+
+public: //Comparator functions
+
+    IMPORT_C TBool Equals( const TXIMPTestStatusEventSnapshot& aOther ) const;
+
+
+public: //Data
+    TInt iEventType;
+    MXIMPContextState::TState iCtxState;
+    TXIMPRequestId iReqId;
+    TInt iResultCode;
+    TBuf< 24 > iPrtResultDescription;
+    };
+
+
+/**
+ * Enumeration defining supported
+ * status event templates.
+ */
+enum TXIMPTestStatusEventTemplate
+    {
+    EXIMPTestStatusEvents_BindingOk,
+    EXIMPTestStatusEvents_BindingFailKErrAbort,
+    EXIMPTestStatusEvents_BindingFailInvalidReqId,
+    EXIMPTestStatusEvents_BindingFailServerTermination,
+
+    EXIMPTestStatusEvents_UnbindingOk,
+
+    EXIMPTestStatusEvents_RequestOk,
+    EXIMPTestStatusEvents_RequestOOM,
+
+    EXIMPTestStatusEvents_PublishOk,
+    EXIMPTestStatusEvents_PublishFailKErrAbort,
+
+    EXIMPTestStatusEvents_SubscribeOwnPresenceSingleCtx,
+    EXIMPTestStatusEvents_UnsubscribeOwnPresenceSingleCtx,
+
+    EXIMPTestStatusEvents_SubscribePresentityPresenceSingleCtx,
+    EXIMPTestStatusEvents_UnsubscribePresentityPresenceSingleCtx,
+
+    EXIMPTestStatusEvents_SubscribePresentityGroupListCtx,
+    EXIMPTestStatusEvents_UnsubscribePresentityGroupListCtx,
+
+    EXIMPTestStatusEvents_SubscribePresentityGroupContentSingleCtx,
+    EXIMPTestStatusEvents_UnsubscribePresentityGroupContentSingleCtx,
+
+    EXIMPTestStatusEvents_HandlePresentityGroupList,
+
+    EXIMPTestStatusEvents_CreatePresentityGroup,
+
+    EXIMPTestStatusEvents_SubscribePresenceWatcherListCtx,
+    EXIMPTestStatusEvents_UnsubscribePresenceWatcherListCtx,
+    EXIMPTestStatusEvents_HandlePresenceWatcherList,
+
+    EXIMPTestStatusEvents_HandlePresentityPresence,
+    EXIMPTestStatusEvents_HandlePresentityPresencePending,
+    EXIMPTestStatusEvents_PresentitySubscribeFailKErrAbort,
+    };
+
+
+/**
+ * Presence context listener to record status events
+ * and to wait request completion
+ * Handles following event types:
+ * - MXIMPRequestCompleteEvent
+ * - MXIMPContextStateEvent
+ *
+ * For other XIMP event types, see other
+ * test listeners.
+ */
+class CXIMPTestStatusEventListener : public CBase,
+                                     public MXIMPContextObserver
+    {
+public:
+
+    /**
+     * Instantiates new listener object.
+     *
+     * If valid event source is given, reqisters this object as
+     * event observer to it.
+     */
+    IMPORT_C static CXIMPTestStatusEventListener* CXIMPTestStatusEventListener::NewL(
+                    TInt aStackSize,
+                    MXIMPContext* aEventSource );
+
+    ~CXIMPTestStatusEventListener();
+
+private:
+    CXIMPTestStatusEventListener( TInt aStackSize,
+                                  MXIMPContext* aEventSource );
+    void ConstructL();
+
+
+public:
+
+    /**
+     * Sets new event source from where to listen events.
+     * Unregisters from previous one.
+     * Can be NULL, in wich case just performs the
+     * unregistration.
+     */
+    IMPORT_C void SetEventSourceL( MXIMPContext* aEventSource );
+
+    /**
+     * Access to accepted event types list.
+     * Client can alter the list.
+     *
+     * By default list has:
+     * - MXIMPRequestCompleteEvent
+     * - MXIMPContextStateEvent
+     *
+     * NOTE: remember to push edited list to event source with
+     *       ReRegisterEventFilterL()
+     */
+    IMPORT_C RArray< TInt32 >& AcceptedEventTypes();
+
+
+    /**
+     * ReRegisters this listener to event source.
+     * In practice, takes new event filter in use.
+     */
+    IMPORT_C void ReRegisterEventFilterL();
+
+
+    /**
+     * Fills the given array with event templates.
+     *
+     * Given enumeration defines which template to retrieve.
+     */
+    IMPORT_C void GetEventTemplateL( RArray< TXIMPTestStatusEventSnapshot >& aArray,
+                                     TXIMPTestStatusEventTemplate aTemplate );
+
+    /**
+     * Method to wait with CActiveSchedulerWait
+     * the given request completion.
+     * NOTE: Only one request can be waited at time.
+     * Stacks received MXIMPRequestCompleteEvent and
+     * MXIMPContextStateEvent details to
+     * event stack.
+     *
+     * @param aReqToWait The request to wait.
+     */
+    IMPORT_C void WaitRequestAndStackEvents( const TXIMPRequestId& aReqToWait, TBool aAnyReq = EFalse );
+    IMPORT_C void WaitAnyEvent();
+
+
+    /**
+     * Verifies event stack contents against the given traits.
+     *
+     * NOTE: You can use GetEventTemplateL() to retrieve a
+     * common event traits.
+     *
+     * Error title is printed in the error assertion description.
+     */
+    IMPORT_C void VerifyEventStackL( const TArray< TXIMPTestStatusEventSnapshot >& aEventTraits,
+                                     const TDesC8& aErrorTitle ) const;
+
+    
+    
+    IMPORT_C TInt GetReqCompletionErrL( const TXIMPRequestId& aReqId ) const;
+
+
+
+    /**
+     * Resets the event stack contents.
+     */
+    IMPORT_C void ResetEventStack();
+    IMPORT_C void ResetEventTypeStack();
+
+    /**
+     * Set event observer when needed.
+     */
+    IMPORT_C void SetEventObserver( MXIMPContextObserver* aObserver );
+
+
+private:  //From MXIMPContextObserver
+
+    void HandlePresenceContextEvent(
+            const MXIMPContext& aContext,
+            const MXIMPBase& aEvent );
+
+
+private: //Helpers
+    void HandleRequestCompleteReceived();
+    TBool IsAcceptedEventType( TInt32 aEventType ) const;
+    void AddSnapshotToStack( TXIMPTestStatusEventSnapshot aSnapshot );
+    const TXIMPTestStatusEventSnapshot& SnapshotFromStack( TInt aIndex ) const;
+
+    TBool HasSameEvents( const TArray< TXIMPTestStatusEventSnapshot >& aEventTraits ) const;
+    void GetNameForEvent( TDes8& aTarget, TInt aEventType ) const;
+    void SafeAppendEventName( TDes8& aTarget, const TDesC8& aName ) const;
+
+
+
+
+private:  //Data
+
+    //OWN: Active scheduler wait for waiting the completion
+    CActiveSchedulerWait    iWait;
+
+
+    //OWN: Request ID identifying request which completion event to wait
+    TXIMPRequestId    iReqToWait;
+
+
+    //REF: Context from where receiving events
+    MXIMPContext* iEventSource;
+
+
+    //OWN: Accepted event types
+    RArray< TInt32 > iAcceptedEventTypes;
+
+
+    //OWN: Variables to maintain event snapshot stack
+    const TInt iSnapshotMaxCount;
+    TInt iSnapshotCount;
+    TXIMPTestStatusEventSnapshot* iSnapshots;
+
+    //OWN: Description buffer to hold the failure description
+    mutable RBuf8 iDescription;
+
+    TBool iWaitForAnyReq;
+
+    TBool iWaitForAnyEvent;
+
+    // To handle event by observer.
+    MXIMPContextObserver* iObserver;
+    };
+
+#endif //CPRFWTESTSTATUSEVENTLISTENER_H__
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/tsrc/tsrcutils/testcaseutils/prfwtestwaithelper.cpp	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  XIMP Framework TestGeneralWaiter 
+*
+*/
+
+
+
+#include <e32std.h>
+
+#include "prfwtestwaithelper.h"
+
+// ======== LOCAL FUNCTIONS ========
+
+
+// ======== MEMBER FUNCTIONS ========
+
+
+// ---------------------------------------------------------------------------
+// ?description_if_needed
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CXIMPTestWaitHelper* CXIMPTestWaitHelper::NewL()
+    {
+    CXIMPTestWaitHelper* self = new ( ELeave ) CXIMPTestWaitHelper;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+void CXIMPTestWaitHelper::ConstructL()
+    {
+    }
+    
+CXIMPTestWaitHelper::~CXIMPTestWaitHelper()
+    {
+    }
+        
+EXPORT_C void CXIMPTestWaitHelper::WaitForL( TInt aSeconds )
+    {
+    User::After( aSeconds * 1000000 );
+    }
+    
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/tsrc/tsrcutils/testcaseutils/prfwtestwaithelper.h	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  XIMP Framework TestGeneralWaiter 
+*
+*/
+
+
+
+#ifndef CPRFWTESTWAITHELPER_H
+#define CPRFWTESTWAITHELPER_H
+
+
+#include <e32base.h>
+
+class CXIMPTestGeneralWaiter;
+
+class CXIMPTestWaitHelper : public CBase
+    {
+    public:
+
+        IMPORT_C static CXIMPTestWaitHelper* NewL();
+        
+        IMPORT_C void WaitForL( TInt aSeconds );
+        
+        ~CXIMPTestWaitHelper();
+
+    private:
+    
+        /**
+         *
+         */
+        void ConstructL();
+
+    private: // data
+    };
+
+#endif // CPRFWTESTWAITHELPER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/tsrc/tsrcutils/testcaseutils/prfwwaitobserver.h	Wed Nov 03 09:32:20 2010 +0530
@@ -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:  XIMP Framework Test Code prfwwaitobserver.h
+*
+*/
+
+
+
+#ifndef T_PRFWWAITOBSERVER
+#define T_PRFWWAITOBSERVER
+
+
+/**
+ * ?one_line_short_description
+ *
+ * ?more_complete_description
+ *
+ * @lib ?library
+ * @since S60 v4.0
+ */
+class T_MWaitObserver
+    {
+
+public:
+
+    /**
+     * ?description
+     *
+     * @since S60 ?S60_version
+     * @param ?arg1 ?description
+     * @param ?arg2 ?description
+     * @return ?description
+     */
+    virtual void WaitCompleted( TInt aRetVal ) = 0;
+
+
+protected:
+
+    /**
+     * Protected destructor.
+     * Instancies can't be destroyed via this interface.
+     */
+    virtual ~T_MWaitObserver() {};
+
+    };
+
+
+
+#endif // T_PRFWWAITOBSERVER
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ximpfw/tsrc/tsrcutils/testcaseutils/userafter.h	Wed Nov 03 09:32:20 2010 +0530
@@ -0,0 +1,151 @@
+/*
+* 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:  Active object based wait.
+*
+*/
+
+#ifndef CUSERAFTER_H__
+#define CUSERAFTER_H__
+
+// INCLUDES
+#include <E32base.h>
+
+
+// CLASS DESCRIPTION
+
+/**
+ * Active object based wait.
+ *
+ * Similar like User::After() but doesn't block
+ * whole thread, but current RunL() with
+ * CActiveSchedulerWait.
+ */
+class CUserAfter : public CTimer
+    {
+    public: //Construction
+        static inline CUserAfter* NewL();
+        static inline CUserAfter* NewLC();
+       ~CUserAfter();
+
+
+    public: //Wait support
+
+        /**
+         * Static "one shot" wait method.
+         */
+        static inline void AfterL( TInt aWaitTimeMicroSeconds );
+        static inline void AfterSecondsL( TInt aWaitTimeSeconds );
+
+        /**
+         * Member wait method.
+         */
+        inline void After( TInt aWaitTimeMicroSeconds );
+
+
+    private:
+        CUserAfter();
+
+        void RunL();
+        void RunError();
+        void DoCancel();
+
+
+    private:    //data
+        CActiveSchedulerWait iWait;
+
+    };
+
+
+
+
+// -----------------------------------------------------------------------------
+// CUserAfter public functions
+// -----------------------------------------------------------------------------
+//
+inline CUserAfter* CUserAfter::NewL()
+    {
+    CUserAfter* self = CUserAfter::NewLC();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+inline CUserAfter* CUserAfter::NewLC()
+    {
+    CUserAfter* self = new (ELeave) CUserAfter();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+
+inline CUserAfter::~CUserAfter()
+    {
+    CTimer::Cancel();
+    }
+
+inline void CUserAfter::After( TInt aWaitTimeMicroSeconds )
+    {
+    CTimer::After( aWaitTimeMicroSeconds );
+    iWait.Start();
+    }
+
+
+inline void CUserAfter::AfterL( TInt aWaitTimeMicroSeconds )
+    {
+    CUserAfter* after = CUserAfter::NewL();
+    after->After( aWaitTimeMicroSeconds );
+    delete after;
+    }
+
+
+inline void CUserAfter::AfterSecondsL( TInt aWaitTimeSeconds )
+    {
+    CUserAfter* after = CUserAfter::NewL();
+    after->After( aWaitTimeSeconds * 1000000 );
+    delete after;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CUserAfter private functions
+// -----------------------------------------------------------------------------
+//
+inline CUserAfter::CUserAfter()
+    : CTimer( CActive::EPriorityStandard )
+    {
+    CActiveScheduler::Add( this );
+    }
+
+
+inline void CUserAfter::RunL()
+    {
+    iWait.AsyncStop();
+    Cancel();
+    }
+
+inline void CUserAfter::RunError()
+    {
+    }
+
+inline void CUserAfter::DoCancel()
+    {
+    iWait.AsyncStop();
+    CTimer::DoCancel();
+    }
+
+
+#endif // CUSERAFTER_H__
+
+// End of File
+