BOOL COXRollup::CreateRollUp(CWnd* pParent, WORD nID, LPCTSTR lpszCaption)
{
	ASSERT(pParent!=NULL && ::IsWindow(pParent->GetSafeHwnd()));
	ASSERT(lpszCaption!=NULL);

	BOOL bAlreadyCreated=::IsWindow(GetSafeHwnd());
	if(bAlreadyCreated)
	{
		DestroyWindow();
	}

	ASSERT(nID!=0);
	// set our roll up ID used later when dispatching messages
	m_nRollup=nID;

	m_sCaption=lpszCaption;

	// set up the window which is responsible for handling the close msg
	m_hWndDestroyRC = pParent->GetSafeHwnd();

	// register ourselves ( the parent ) as owner of the message dispatch
	SetRecipient(pParent);

	// now create us!
	m_bRolledUp = FALSE;	// full size
	if(!CDialog::Create(m_nTemplateID, pParent))
		return FALSE;
	
	ASSERT(::IsWindow(m_hWnd));
	DetermineFrameStyle();
	
	LPCTSTR lptstrBitmap=GetTitleBarBitmap();
	ASSERT(lptstrBitmap!=NULL);
	VERIFY(m_pTitleBar->LoadBitmap(lptstrBitmap));
	
	return TRUE;
}
Beispiel #2
0
// Ref: http://tools.ietf.org/html/rfc3261#section-24
// Builds the header using the previously set parameters. Call this again if you change any of them!
void SIPPacket::BuildHeader(){
	// Make sure body is set before calculating header-parameters!
	if (!bodySet){
		std::cout<< "ERROR: Body not set before calling SIPPacket::BuildHeader! Fix this, yo.";
		assert(bodySet);	
	}
	// Set default sender (us) if no sender already specified.
	if (!sender)
		sender = defaultSender;
	if (!senderSet){
		SetSender(sender);
	}
	if (!recipientSet){
		SetRecipient(recipient);
	}
	header.Clear();
	String typeName = PacketTypeName();
	switch(type){
		case SIP_REGISTER:
		case SIP_INFO:
		case SIP_INVITE:
		case SIP_BYE:
		case SIP_ACK:
		case SIP_CANCEL:
		case SIP_OPTIONS:
		case SIP_SUBSCRIBE:
		case SIP_NOTIFY:
			header.Add(typeName+" sip:"+recipientAddress+" SIP/"+SIPVersion);
			break;
		case SIP_OK:
		case SIP_BAD_REQUEST:
			header.Add("SIP/"+String(SIPVersion)+" "+typeName);
			break;
		default:
			std::cout<<"Unrecognized packet type: "<<type<<" typeName: "<<typeName;
			assert(false && "Unrecognized packet-type when setting first row in SIP message header. Add a new case for it?");
			break;
	}
	String toString = "To: "+recipientData;
	/// Only do this if the recipient is known.
	SIPSessionData * recipientSessionData = NULL;
	if (recipient){
		recipientSessionData = (SIPSessionData*)recipient->GetSessionData(SessionType::SIP);
		if (recipientSessionData->theirTag.Length()){
			toString.Add(";tag="+recipientSessionData->theirTag);
		}
	}
	header.Add(toString);
	String senderString = "From: "+senderData;
	if (recipientSessionData){
		if (recipientSessionData->ourTag.Length()){
			senderString.Add(";tag="+recipientSessionData->ourTag);
		}
	}
	header.Add(senderString);
	// TODO: Add Call-ID ?
	// Add CSeq
	if (cSeq.Length())
		header.Add("CSeq: "+cSeq);
	// Script-type, for Subscribe messages
	if (event.Length()){
		header.Add("Script: "+event);
	}
	// TODO: Add Contact
	if (expirationTime >= 0)
		header.Add("Expires: "+String::ToString(expirationTime));
	int bodyLength = BodyLength();
	if (bodyLength > 0){
		if (!contentType.Length())
			contentType = "application/customP2PMediaProtocol";
		header.Add("Content-Type: "+contentType);
	}
	header.Add("Content-Length: "+String::ToString(bodyLength));
	headerSet = true;
}
Beispiel #3
0
//---------------------------------------------------------------------------
void __fastcall TAddressBook::DeleteRecipient(const UnicodeString& Name)
{
	SetRecipient(Name, L"");
}