--- a/mmshplugins/mmshsipcrplugin/src/mussipcrplugin.cpp Tue Aug 31 15:12:07 2010 +0300
+++ b/mmshplugins/mmshsipcrplugin/src/mussipcrplugin.cpp Wed Sep 01 12:31:01 2010 +0100
@@ -24,20 +24,10 @@
#include "musmanager.h"
#include "musuid.hrh"
#include "musunittesting.h"
-#include "mussettings.h"
-#include <mussettingskeys.h>
#include <sipstrings.h>
#include <sipstrconsts.h>
-#include <sdpdocument.h>
-#include <sdpmediafield.h>
-#include <sdpcodecstringpool.h>
-#include <sdpcodecstringconstants.h>
-#include <sdpattributefield.h>
-
-_LIT8( KSendRecv, "sendrecv"); // For attribute checks
-_LIT8( KRecvOnly, "recvonly"); // For attribute checks
-_LIT8( KSendOnly, "sendonly" ); // For attribute checks
+#include <featmgr.h>
_LIT8(KCapabilities,
"<SIP_CLIENT ALLOW_STARTING=\"YES\">\
@@ -55,7 +45,6 @@
</SDP_LINES>\
</SIP_CLIENT>");
-
// -------------------------------------------------------------------------
// Two-phased constructor.
// -------------------------------------------------------------------------
@@ -80,10 +69,6 @@
{
MUS_LOG( "mus: [MUSSCR] -> CMusSipCrPlugin::~CMusSipCrPlugin()" );
delete iManager;
- if ( iCloseStringPool )
- {
- SdpCodecStringPool::Close();
- }
MUS_LOG( "mus: [MUSSCR] <- CMusSipCrPlugin::~CMusSipCrPlugin()" );
}
@@ -105,31 +90,6 @@
{
MUS_LOG( "mus: [MUSSCR] -> CMusSipCrPlugin::ConstructL()" );
iManager = CMusManager::NewL();
-
- TRAPD( err, SdpCodecStringPool::OpenL() );
-
- switch ( err )
- {
- case KErrNone:
- {
- //close pool at destructor, not opened by others
- iCloseStringPool = ETrue;
- break;
- }
-
- case KErrAlreadyExists:
- {
- //already opened, do not try to close at destructor
- iCloseStringPool = EFalse;
- break;
- }
-
- default:
- {
- User::Leave( err );
- }
- }
-
MUS_LOG( "mus: [MUSSCR] <- CMusSipCrPlugin::ConstructL()" );
}
@@ -141,16 +101,34 @@
TUid CMusSipCrPlugin::ChannelL( RStringF aMethod,
const TDesC8& /*aRequestUri*/,
const RPointerArray<CSIPHeaderBase>& /*aHeaders*/,
- const TDesC8& aContent,
- const CSIPContentTypeHeader* /*aContentType*/ )
+ const TDesC8& /*aContent*/,
+ const CSIPContentTypeHeader* /*aContentType*/)
{
- MUS_LOG( "mus: [MUSSCR] -> CMusSipCrPlugin::ChannelL()" );
-
+ FeatureManager::InitializeLibL();
+ TBool support = FeatureManager::FeatureSupported( KFeatureIdMultimediaSharing );
+ FeatureManager::UnInitializeLib();
+ TUid uid;
+ uid.iUid = ( TInt ) CMusManager::ESipInviteNotDesired;
+ if ( support )
+ {
+ uid = DoChannelL( aMethod );
+ }
+ return uid;
+ }
+
+
+// -------------------------------------------------------------------------
+// CMusSipCrPlugin::DoChannelL
+// -------------------------------------------------------------------------
+TUid CMusSipCrPlugin::DoChannelL( RStringF aMethod )
+ {
+ MUS_LOG( "mus: [MUSSCR] -> CMusSipCrPlugin::DoChannelL()" );
+
if ( aMethod == SIPStrings::StringF( SipStrConsts::EOptions ) )
{
TUid uid;
uid.iUid = ( TInt ) CMusManager::ESipOptions;
- MUS_LOG1( "mus: [MUSSCR] <- CMusSipCrPlugin::ChannelL(): KSipOptions %d",
+ MUS_LOG1( "mus: [MUSSCR] <- CMusSipCrPlugin::DoChannelL(): KSipOptions %d",
uid.iUid );
return uid;
}
@@ -164,7 +142,7 @@
{
TUid uid;
uid.iUid = ( TInt ) CMusManager::ESipInviteNotDesired;
- MUS_LOG1( "mus: [MUSSCR] <- CMusSipCrPlugin::ChannelL(): \
+ MUS_LOG1( "mus: [MUSSCR] <- CMusSipCrPlugin::DoChannelL(): \
KNotAllowedSipInvite %d", uid.iUid );
return uid;
}
@@ -172,90 +150,14 @@
{
TUid uid;
uid.iUid = ( TInt ) CMusManager::ESipInviteDesired;
- TBool twoWaySupported = MultimediaSharingSettings::VideoDirectionL() ==
- MusSettingsKeys::ETwoWayVideo;
-
- if ( ( aContent.Length() > 0 ) && twoWaySupported )
- {
- MUS_LOG( "mus: [MUSSCR] 2 way supported, parsing SDP..." );
- CSdpDocument* sdpDocument = CSdpDocument::DecodeLC( aContent );
- TBool sendRecv = CheckForSendRecvAttributeL( sdpDocument->MediaFields() );
- if ( sendRecv )
- {
- uid.iUid = ( TInt ) CMusManager::ESipInviteDesired2WayVideo;
- }
-
- CleanupStack::PopAndDestroy( sdpDocument );
- }
-
- MUS_LOG1( "mus: [MUSSCR] <- CMusSipCrPlugin::ChannelL(): \
+ MUS_LOG1( "mus: [MUSSCR] <- CMusSipCrPlugin::DoChannelL(): \
KAllowedSipInvite %d", uid.iUid );
return uid;
}
}
}
-// -------------------------------------------------------------------------
-// CMusSipCrPlugin::CheckForSendRecvAttribute
-// -------------------------------------------------------------------------
-//
-TBool CMusSipCrPlugin::CheckForSendRecvAttributeL(
- RPointerArray<CSdpMediaField>& aFields ) const
- {
- MUS_LOG( "mus: [MUSSCR] -> CMusSipCrPlugin::CheckForSendRecvAttribute()" );
-
- TBool sendRecv = EFalse;
- TBool sendAttrFound = EFalse;
- TBool videoFound = EFalse;
- RStringF videoType = SdpCodecStringPool::StringPoolL().StringF(
- SdpCodecStringConstants::EMediaVideo,
- SdpCodecStringPool::StringTableL() );
- const TInt fieldcount = aFields.Count();
-
- for ( TInt i = 0; i < fieldcount && !videoFound; i++ )
- {
- CSdpMediaField* mField = aFields[i];
-
- //only check video fields
- videoFound = mField->Media() == videoType;
-
- if ( videoFound )
- {
- RPointerArray< CSdpAttributeField > attrList =
- mField->AttributeFields();
-
- TInt attrCount = attrList.Count();
- for (TInt j = 0; j < attrCount && !sendAttrFound; j++ )
- {
- CSdpAttributeField* attributeField = attrList[j];
- RStringF attribute = attributeField->Attribute();
-
- if ( KErrNotFound != attribute.DesC().FindF( KSendRecv ) )
- {
- sendRecv = ETrue;
- sendAttrFound = ETrue;
- MUS_LOG( "mus: [MUSSCR] <sendrecv> attribute found!" );
- }
- else if ( ( KErrNotFound != attribute.DesC().FindF( KSendOnly ) ) ||
- ( KErrNotFound != attribute.DesC().FindF( KRecvOnly ) ) )
- {
- MUS_LOG( "mus: [MUSSCR] <sendonly>/<recvonly> attribute found!" );
- sendAttrFound = ETrue;
- }
- }
-
- if ( !sendAttrFound )
- {
- MUS_LOG( "mus: [MUSSCR] no send/recv related attributes found!" );
- sendRecv = ETrue;
- }
- }
- }
- MUS_LOG1( "mus: [MUSSCR] <- CMusSipCrPlugin::CheckForSendRecvAttribute(), \
- sendrecv: %d", sendRecv );
-
- return sendRecv;
- }
+
// -------------------------------------------------------------------------
// CMusSipCrPlugin::ConnectL
@@ -266,7 +168,6 @@
MUS_LOG1( "mus: [MUSSCR] -> CMusSipCrPlugin::ConnectL( %d )", aUid.iUid );
if ( aUid.iUid == CMusManager::ESipOptions ||
aUid.iUid == CMusManager::ESipInviteDesired ||
- aUid.iUid == CMusManager::ESipInviteDesired2WayVideo ||
aUid.iUid == CMusManager::ESipInviteNotDesired )
{
iManager->HandleSipRequestL(( CMusManager::TRequestType ) aUid.iUid );