void HandleNewTransactionEvent(struct Dialog *dialog, int event, MESSAGE *message) { struct Dialog *matched = MatchMessage2Dialog(message); SIP_METHOD method = MessageGetMethod(message); if (matched == NULL) { int account = FindMessageDestAccount(message); struct UserAgent *ua = AddUa(account); struct Dialog *d = AddDialog(NULL, ua); if (method == SIP_METHOD_INVITE) { DialogNewTransaction(d, message, TRANSACTION_TYPE_SERVER_INVITE); } else { struct Transaction *t = DialogNewTransaction(d, message, TRANSACTION_TYPE_SERVER_NON_INVITE); Response(t,TRANSACTION_SEND_OK); } } else { DialogReceiveBye(matched, message); } }
TEST(TryingMessageBuildTestGroup, TryingMessageDesAddrtTest) { MESSAGE *trying = NULL; AccountInit(); struct UserAgent *ua = CreateUserAgent(0); struct Dialog *dialog = AddDialog(NULL_DIALOG_ID, ua); MESSAGE *invite = BuildInviteMessage(dialog, (char *)"88002"); trying = BuildResponse(invite, STATUS_CODE_TRYING); STRCMP_EQUAL(AccountGetProxyAddr(GetAccount(0)),GetMessageAddr(trying)); DestroyMessage(&trying); DestroyMessage(&invite); ClearDialogManager(); ClearAccountManager(); DestroyUserAgent(&ua); }
// // Handle control notifications // LRESULT ExemptionsDialog::OnNotifyControl( IN INT ControlId, IN HWND ControlWindow, IN UINT Code, IN PVOID Notify) { LRESULT Result = 0; switch (ControlId) { // // Exemption list drop down // case EXEMPTIONS_DROPDOWN_SELECTION: switch (Code) { // // When the user changes selections // case CBN_SELCHANGE: { LRESULT Selection = SendMessage( GetControl( ControlId), CB_GETCURSEL, 0, 0); if (Selection == 0) DisplayApplicationExemptions(); else if (Selection == 1) DisplayDirectoryExemptions(); else DisplayImageFileExemptions(); } break; default: break; } break; // // Add button // case EXEMPTIONS_BUTTON_ADD: switch (Code) { // // When the user wants to add a new exemption // case BN_CLICKED: { AddEditExemptionDialog AddDialog( GlobalScope, CurrentExemptionType, NULL); AddDialog.Create( GetWindow(), TRUE); SetForegroundWindow( GetWindow()); DisplayExemptions( CurrentExemptionType); } break; default: break; } break; // // Edit button // case EXEMPTIONS_BUTTON_EDIT: switch (Code) { // // When the user wants to edit an exemption // case BN_CLICKED: { LPTSTR NtFilePath = GetCurrentSelectionNtFilePath(); // // If we get back a valid path // if (NtFilePath) { AddEditExemptionDialog EditDialog( GlobalScope, CurrentExemptionType, NtFilePath); EditDialog.Create( GetWindow(), TRUE); SetForegroundWindow( GetWindow()); } else { LPTSTR ErrorString = Locale::LoadStringDefault( IDS_NO_FILE_SELECTED, TEXT("You must select at least one file.")); if (ErrorString) { MessageBox( GetWindow(), ErrorString, NULL, MB_ICONEXCLAMATION | MB_OK); Locale::FreeString( ErrorString); } } } break; default: break; } break; // // Remove button // case EXEMPTIONS_BUTTON_REMOVE: switch (Code) { case BN_CLICKED: { BOOLEAN Refresh = FALSE; LRESULT SelCount; LPDWORD SelIndexes; LONG Index; HWND ExemptionList; ExemptionList = GetControl( EXEMPTIONS_LIST_APPLIED); // // Get the number of selected items // if ((SelCount = SendMessage( ExemptionList, LB_GETSELCOUNT, 0, 0)) == LB_ERR) break; if (SelCount == 0) { LPTSTR ErrorString = Locale::LoadStringDefault( IDS_NO_FILE_SELECTED, TEXT("You must select at least one file.")); if (ErrorString) { MessageBox( GetWindow(), ErrorString, NULL, MB_ICONEXCLAMATION | MB_OK); Locale::FreeString( ErrorString); } break; } // // Allocate storage for the selected indexes and query each // them // SelIndexes = (LPDWORD)malloc(sizeof(DWORD) * SelCount); if ((!SelIndexes) || (SendMessage( ExemptionList, LB_GETSELITEMS, (WPARAM)(LRESULT)SelCount, (WPARAM)(LPDWORD)SelIndexes) == LB_ERR)) { if (SelIndexes) free( SelIndexes); break; } // // Enumerate the returned selected indexes, removing each one // for (Index = 0; Index < SelCount; Index++) { LPTSTR NtFilePath = (LPTSTR)SendMessage( ExemptionList, LB_GETITEMDATA, SelIndexes[Index], 0); // // If the NT file path is valid... // if ((NtFilePath) && (NtFilePath != (LPTSTR)LB_ERR)) { DWORD Result; // // Remove the path from the current exemption type // if ((Result = RemoveExemptionFromCurrentType( NtFilePath)) != ERROR_SUCCESS) { LPTSTR ErrorString; TCHAR Error[256] = { 0 }; ErrorString = Locale::LoadStringDefault( IDS_ERROR_COULD_NOT_REMOVE_EXEMPTION, TEXT("The exemption could not be removed (error %lu):\n\n%s")); if (ErrorString) { _sntprintf_s( Error, sizeof(Error) - sizeof(TCHAR), ErrorString, Result, NtFilePath); MessageBox( GetWindow(), Error, NULL, MB_ICONERROR | MB_OK); Locale::FreeString( ErrorString); } } else Refresh = TRUE; } } if (Refresh) DisplayExemptions( CurrentExemptionType); free( SelIndexes); } break; default: break; } break; // // Flush button // case EXEMPTIONS_BUTTON_FLUSH: switch (Code) { case BN_CLICKED: { DWORD Result; if ((Result = FlushExemptionsFromCurrentType()) != ERROR_SUCCESS) { LPTSTR ErrorString; TCHAR Error[256] = { 0 }; ErrorString = Locale::LoadStringDefault( IDS_ERROR_COULD_NOT_FLUSH_EXEMPTIONS, TEXT("The exemptions could not be flushed (error %lu).")); if (ErrorString) { _sntprintf_s( Error, sizeof(Error) - sizeof(TCHAR), ErrorString, Result); MessageBox( GetWindow(), Error, NULL, MB_ICONERROR | MB_OK); Locale::FreeString( ErrorString); } } else DisplayExemptions( CurrentExemptionType); } break; default: break; } break; default: break; } return Result; }
void CPhraseDialogManager::InitDialog (CPhraseDialogManager* dialog_partner, DIALOG_SHARED_PTR& phrase_dialog) { phrase_dialog->Init(this, dialog_partner); AddDialog(phrase_dialog); dialog_partner->AddDialog(phrase_dialog); }
void CDynControl::AddControl(CPoint* ppoint) { PrepareDataArray(); if(m_nControlType == ID_DYNBUTTONTREE)//TREE { CTreeCtrl* pControl=new CTreeCtrl(); int nStyle= WS_CHILD | TVS_SHOWSELALWAYS | WS_BORDER; if(aDataList[0].bData) nStyle = nStyle | TVS_HASBUTTONS; if(aDataList[1].bData) nStyle = nStyle | TVS_HASLINES; if(aDataList[2].bData) nStyle = nStyle | TVS_LINESATROOT; AddDialog(pControl,ppoint,200,100,"SysTreeView32",nStyle,WS_EX_CLIENTEDGE); if(aDataList[3].bData) pControl->SetImageList(GetImageList(),TVSIL_NORMAL); OnUpdate(); } else if (m_nControlType == ID_DYNBUTTONGRID) // GRID - MFCGridCtrl { CGridCtrl* pControl=new CGridCtrl(); AddDialog(pControl,ppoint,200,100,"MFCGridCtrl",0,WS_EX_CLIENTEDGE); #ifdef MYDEBUG pControl->SetDoubleBuffering(0); #else pControl->SetDoubleBuffering(1); #endif pControl->SetImageList(GetImageList()); //начальные параметры таблицы pControl->EnableDragAndDrop(false); pControl->SetGridLineColor(0); //pControl->SetFixedColumnSelection(aDataList[5].bData); //pControl->SetFixedRowSelection(aDataList[6].bData); pControl->SetHeaderSort(aDataList[7].bData); if(aDataList[8].nData<=0) aDataList[8].nData=16; pControl->SetDefCellHeight(aDataList[8].nData); if(aDataList[9].nData<=0) aDataList[9].nData=130; pControl->SetDefCellWidth(aDataList[9].nData); pControl->AutoSizeColumns(aDataList[11].bData); pControl->SetGridBkColor(aDataList[13].Color); //pControl->m_NotUseMyExtEdit=TRUE; //pControl->SetCompareFunction(CGridCtrl::pfnCellNumericCompare);//сравнение чисел if(m_bConfigMode) { int nColumn=5; pControl->SetEditable(0); pControl->SetHeaderSort(0); pControl->SetRowCount(20); pControl->SetColumnCount(nColumn); pControl->SetFixedRowCount(1); pControl->SetFixedColumnCount(0); pControl->SetSingleColSelection(1); pControl->SetFixedColumnSelection(1); } else { pControl->EnableSelection(0); pControl->m_bAutoExpandColumnsToFit=TRUE; pControl->SetVirtualMode(aDataList[12].bData); pControl->SetEditable(aDataList[4].bData); pControl->SetRowCount(aDataList[0].nData); pControl->SetColumnCount(aDataList[1].nData); pControl->SetFixedRowCount(aDataList[2].nData); pControl->SetFixedColumnCount(aDataList[3].nData); //pControl->SetSingleRowSelection(aDataList[10].bData); //pControl->SetListMode(aDataList[10].bData); } OnUpdate(); } else if (m_nControlType == ID_DYNBUTTONEDIT) // EDIT { if(aDataList[0].sData=="Дата"&&(!m_bConfigMode)) { m_nControlType = ID_DYNBUTTONDATE; // DATE if(afxAppRunMode!=CONFIG_MODE) if(aDataList[8].bData) m_bEnable=0; } else { int nStyle = WS_CHILD|ES_AUTOHSCROLL; if(aDataList[5].bData) nStyle = nStyle | ES_MULTILINE | WS_VSCROLL | ES_WANTRETURN | WS_HSCROLL ; if(!m_bConfigMode) if(aDataList[6].bData) nStyle = nStyle | ES_PASSWORD; if(aDataList[0].sData=="Число"&&(!m_bConfigMode)) { nStyle = nStyle | ES_RIGHT; if(aDataList[7].bData) { //nStyle = nStyle | ES_NUMBER; CCalcEdit *pControl=new CCalcEdit(1); pControl->nUseFilter=1; AddDialog(pControl,ppoint,90,DEFAULT_DIALOG_H,"EDIT",nStyle,WS_EX_CLIENTEDGE); if(!aDataList[1].bData) pControl->SetLimitText(aDataList[2].nData); if(!m_bConfigMode) pControl->SetReadOnly(aDataList[8].bData); } else { CXrNumericEdit *pControl=new CXrNumericEdit(); AddDialog(pControl,ppoint,90,DEFAULT_DIALOG_H,"EDIT",nStyle,WS_EX_CLIENTEDGE); pControl->SetCountDigitsDecimals(aDataList[2].nData-aDataList[3].nData); pControl->SetCountDigitsAfterDecimals(aDataList[3].nData); pControl->SetDisplayDigitsDecimalsFormat(xrDDDFDataTypeOnlyInputs);//xrDDDFDataTypeFull pControl->SetDisplayLeadingZero(xrDLZDataTypeFull);//xrDLZDataTypeParcial pControl->SetDecimalSymbol('.'); pControl->SetSeparatorGrouping("'"); pControl->SetNegativeValue(aDataList[4].bData); pControl->SetWindowText("0"); if(!m_bConfigMode) pControl->SetReadOnly(aDataList[8].bData); } } else { CDropEdit*pControl=new CDropEdit(aDataList[7].bData); pControl->SetInvalidCharacters(""); AddDialog(pControl,ppoint,90,DEFAULT_DIALOG_H,"EDIT",nStyle,WS_EX_CLIENTEDGE); if(!aDataList[1].bData) pControl->SetLimitText(aDataList[2].nData); if(!m_bConfigMode) pControl->SetReadOnly(aDataList[8].bData); } } } else if (m_nControlType == ID_DYNBUTTONLABEL) // LABEL { int nStyle = WS_CHILD|WS_DISABLED;// | WS_BORDER; if(m_bVisible||m_bConfigMode) nStyle = nStyle | WS_VISIBLE; CXColorStatic *pControl=new CXColorStatic(); AddDialog(pControl,ppoint,90,DEFAULT_DIALOG_H,"STATIC",WS_CHILD|WS_DISABLED | WS_BORDER); CWnd *p=pControl->GetOwner(); pControl->SetOwner(m_pParentWnd); pControl->SetParent(m_pParentWnd); if(aDataList[0].nData==0) aDataList[0].nData=8; int nHAllign=GetPosNumber(aDataList[5].sData,aDataList[5].nData); int nVAllign=GetPosNumber(aDataList[6].sData,aDataList[6].nData); SetStaticParams(*pControl,nHAllign,nVAllign,"MS Sans Serif",aDataList[1].bData,aDataList[2].bData,aDataList[3].bData,aDataList[0].nData,aDataList[4].Color); OnUpdate(); if(!aDataList[7].sData.IsEmpty()||!aDataList[8].sData.IsEmpty()) ::SetWindowLong(pControl->m_hWnd, GWL_STYLE, ::GetWindowLong(pControl->m_hWnd, GWL_STYLE) | SS_NOTIFY); } else if (m_nControlType == ID_DYNBUTTONCOMBO) // COMBO { CComboBox* pControl=new CComboBox(); AddDialog(pControl,ppoint,90,20*6,"COMBOBOX",WS_CHILD | CBS_DROPDOWNLIST | WS_VSCROLL | LBS_NOINTEGRALHEIGHT,0); OnUpdate(); } else if (m_nControlType == ID_DYNBUTTONLISTBOX) // LISTBOX { int nStyle = WS_CHILD|LBS_STANDARD|WS_HSCROLL|LBS_NOINTEGRALHEIGHT; CIconListBox* pControl=new CIconListBox(); if(aDataList[0].bData) { nStyle = nStyle | LBS_OWNERDRAWFIXED |LBS_NOTIFY |LBS_HASSTRINGS; pControl->SetImageList(GetImageList()); } AddDialog(pControl,ppoint,90,20*5,"LISTBOX",nStyle,WS_EX_CLIENTEDGE ); OnUpdate(); } else if (m_nControlType == ID_DYNBUTTONGROUP) // GROUPBOX { AddDialog(new CButton(),ppoint,90,DEFAULT_DIALOG_H*5,"BUTTON",WS_CHILD | BS_GROUPBOX &~WS_TABSTOP,0); OnUpdate(); } else if (m_nControlType == ID_DYNBUTTONCHECK) // CHECK { AddDialog(new CButton(),ppoint,90,DEFAULT_DIALOG_H,"BUTTON",WS_CHILD | BS_AUTOCHECKBOX,0); OnUpdate(); } else if (m_nControlType == ID_DYNBUTTON) // BUTTON { int nStyle = WS_CHILD; if(aDataList[0].bData) nStyle=nStyle | BS_DEFPUSHBUTTON; nStyle=nStyle | BS_OWNERDRAW; AddDialog(new CImageButton(),ppoint,80,22,"BUTTON",nStyle); OnUpdate(); } else if (m_nControlType == ID_DYNBUTTONRADIO) // RADIO { int nStyle = WS_CHILD | BS_AUTORADIOBUTTON; if (aDataList[0].bData) nStyle = nStyle | WS_GROUP; // if (m_csValue.IsEmpty()) // m_csValue = "Переключатель"; AddDialog(new CRadio(),ppoint,110,DEFAULT_DIALOG_H,"BUTTON",nStyle,0); OnUpdate(); } else if (m_nControlType == ID_BUTTONPROGRESS) // CProgressCtrl { int nStyle = WS_CHILD; if (aDataList[2].bData) nStyle = nStyle | PBS_VERTICAL; if (aDataList[3].bData) nStyle = nStyle | PBS_SMOOTH; CProgressCtrl* pControl=new CProgressCtrl(); AddDialog(pControl,ppoint,90,DEFAULT_DIALOG_H,"msctls_progress32",nStyle,0); pControl->SetRange32(aDataList[0].nData,aDataList[1].nData); } else if (m_nControlType == ID_BUTTONSLIDER) // CSliderCtrl { int nStyle = WS_CHILD | TBS_AUTOTICKS; if (aDataList[2].bData) nStyle = nStyle | TBS_VERT; if (aDataList[3].bData) nStyle = nStyle | TBS_TOP; if (!aDataList[4].bData) nStyle = nStyle | TBS_NOTICKS; CSliderCtrl* pControl=new CSliderCtrl(); AddDialog(pControl,ppoint,90,DEFAULT_DIALOG_H,"msctls_trackbar32",nStyle,0); pControl->SetRange(aDataList[0].nData,aDataList[1].nData); } else if (m_nControlType == ID_BUTTONFORMOBJECT) //Пользовательская форма - микроформа { CreateMicroForm(); m_pWnd->MoveWindow(ppoint->x,ppoint->y, 200,100,1); OnUpdate(); } else if (m_nControlType == ID_BUTTON_TAB) // Tabl { CMyTabCtrl* pControl=new CMyTabCtrl(); int nStyle=WS_CHILD; if(aDataList[1].bData)//Кнопки nStyle |= TCS_BUTTONS; if(aDataList[2].bData)//Многострочный nStyle |= TCS_MULTILINE; if(aDataList[3].bData)//Вертикально nStyle |= TCS_VERTICAL; if(aDataList[4].bData)//Перевернуть nStyle |= TCS_BOTTOM; AddDialog(pControl,ppoint,200,60,"SysTabControl32",nStyle ); if(m_bConfigMode) { TCITEM tcItem; tcItem.mask = TCIF_TEXT; tcItem.pszText = "Слой 1"; pControl->InsertItem(0,&tcItem); tcItem.pszText = "Слой 2"; pControl->InsertItem(1,&tcItem); tcItem.pszText = "Слой 3"; pControl->InsertItem(2,&tcItem); } OnUpdate(); } //без else, т.к. возможны превращения CEdit в Дату if (m_nControlType == ID_DYNBUTTONDATE) // DATE { int nStyle = WS_CHILD | WS_BORDER ;//| DTS_SHOWNONE; if(m_bVisible||m_bConfigMode) nStyle = nStyle | WS_VISIBLE; if(!m_nTabOrder) nStyle = nStyle | WS_TABSTOP; CRect rectPos; rectPos.left = ppoint->x; rectPos.top = ppoint->y; rectPos.right = rectPos.left + 110; // width and height rectPos.bottom = rectPos.top + 21; // of the control CDateTimeCtrl* pControl = new CDateTimeCtrl; m_pWnd = pControl; m_hWnd = pControl->GetSafeHwnd(); pControl->CreateEx(0,DATETIMEPICK_CLASS,"DateTime",nStyle, rectPos.left, rectPos.top, rectPos.Width(), rectPos.Height(), m_pParentWnd->m_hWnd,NULL); pControl->SetDlgCtrlID(m_nID); pControl->SetFont(&m_fontDefault); pControl->EnableWindow(m_bEnable); } }