示例#1
0
UtlBoolean SipDialogMgr::isNewRemoteTransaction(const SipMessage& message)
{
    UtlBoolean matchesTransaction = FALSE;
    UtlString handle;
    SipDialog::getDialogHandle(message, handle);

    UtlString callId;
    UtlString fromTag;
    UtlString toTag;
    Url fromField;
    Url toField;
    message.getFromUrl(fromField);
    message.getToUrl(toField);
    message.getCallIdField(callId);
    fromField.getFieldParameter("tag", fromTag);
    toField.getFieldParameter("tag", toTag);

    lock();
    // Looking for any dialog that matches this handle
    SipDialog* dialog = findDialog(handle,
                                   TRUE, // if established, match early dialog
                                   TRUE); // if early, match established dialog

    if(dialog && 
       dialog->isTransactionRemotelyInitiated(callId, fromTag, toTag) &&
       dialog->isNextRemoteCseq(message))
    {
        matchesTransaction = TRUE;
    }

    unlock();
    
    return(matchesTransaction);
}
示例#2
0
UtlBoolean SipDialogMgr::isLastLocalTransaction(const SipMessage& message, 
                                                const char* dialogHandle)
{
    UtlBoolean matchesTransaction = FALSE;
    UtlString handle(dialogHandle ? dialogHandle : "");
    // If the dialog handle was not set, get it from the message
    if(handle.isNull())
    {
        message.getDialogHandle(handle);
    }

    UtlString callId;
    UtlString fromTag;
    UtlString toTag;
    SipDialog::parseHandle(handle, callId, fromTag, toTag);

    lock();
    // Looking for any dialog that matches this handle
    SipDialog* dialog = findDialog(handle,
                                   TRUE, // if established, match early dialog
                                   TRUE); // if early, match established dialog

    if(dialog && 
       dialog->isTransactionLocallyInitiated(callId, fromTag, toTag) &&
       dialog->isSameLocalCseq(message))
    {
        matchesTransaction = TRUE;
    }

    unlock();
    
    return(matchesTransaction);
}
示例#3
0
// Set the next local CSeq for a dialog.
UtlBoolean SipDialogMgr::setNextLocalCseq(const UtlString& dialogHandleString,
                                          int nextLocalCseq)
{
   UtlBoolean ret;

   lock();

   // Find the dialog.
   SipDialog* dialog = findDialog(dialogHandleString,
                                  FALSE, // If established only want exact match  dialogs 
                                  TRUE); // If message is from a prior transaction
                                         // when the dialog was in an early state
                                         // allow it to match an established 
                                         // dialog

   if (dialog)
   {
      // If we could find the dialog, set its next local CSeq.
      dialog->setLastLocalCseq(nextLocalCseq);
      ret = TRUE;
   }
   else
   {
      ret = FALSE;
   }

   unlock();

   return ret;
}
示例#4
0
UtlBoolean SipDialogMgr::getEstablishedDialogHandleFor(const char* earlyDialogHandle,
                                                       UtlString& establishedDialogHandle)
{
    UtlBoolean foundDialog = FALSE;
    UtlString handle(earlyDialogHandle ? earlyDialogHandle : "");
    lock();
    // Looking for an dialog that matches this earlyHandle, if there
    // is not an exact match see if there is an established dialog
    // that matches
    SipDialog* dialog = findDialog(handle,
                                   FALSE, // if established, match early dialog
                                   TRUE); // if early, match established dialog
    if(dialog && !dialog->isInitialDialog())
    {
        dialog->getDialogHandle(establishedDialogHandle);
        foundDialog = TRUE;
    }
    else
    {
        establishedDialogHandle = "";
    }
    unlock();

    return(foundDialog);

}
示例#5
0
UtlBoolean SipDialogMgr::initialDialogExistsFor(const char* establishedDialogHandle)
{
    UtlBoolean foundDialog = FALSE;
    UtlString handle(establishedDialogHandle ? establishedDialogHandle : "");

    // If we have an established dialog handle
    if(!SipDialog::isInitialDialog(handle))
    {
        lock();
        // Looking for an dialog that matches this handle, if there
        // is not an exact match see if there is an early dialog
        // that matches the given presumably established dialog handle
        SipDialog* dialog = findDialog(handle,
                                       TRUE, // if established, match early dialog
                                       FALSE); // if early, match established dialog

        if(dialog && !dialog->isInitialDialog())
        {
            foundDialog = TRUE;
        }
        unlock();
    }

    return(foundDialog);
}
示例#6
0
UtlBoolean SipDialogMgr::setNextLocalTransactionInfo(SipMessage& request,
                                                     const char* method,
                                                     const char* dialogHandle)
{
    UtlBoolean requestSet = FALSE;
    UtlString dialogHandleString(dialogHandle ? dialogHandle : "");
    if(dialogHandleString.isNull())
    {
        request.getDialogHandle(dialogHandleString);
    }

    lock();
    SipDialog* dialog = findDialog(dialogHandleString,
                                   FALSE, // If established only want exact match dialogs
                                   TRUE); // If message is from a prior transaction
                                          // when the dialog was in an early state
                                          // allow it to match an established
                                          // dialog
    if(dialog)
    {
        dialog->setRequestData(request, method);
        requestSet = TRUE;

#ifdef TEST_PRINT
        UtlString dialogDump;
        dialog->toString(dialogDump);
        OsSysLog::add(FAC_SIP, PRI_DEBUG, "SipDialogMgr::setNextLocalTransactionInfo dialog: '%s'",
                      dialogDump.data());
#endif
    }
    else
    {
       OsSysLog::add(FAC_SIP, PRI_ERR, "SipDialogMgr::setNextLocalTransactionInfo dialog not found for handle '%s'",
                     dialogHandle);

       if (OsSysLog::willLog(FAC_SIP, PRI_DEBUG))
       {
          SipDialog* dialog;
          UtlHashBagIterator iterator(mDialogs);
          
          while ((dialog = (SipDialog*) iterator()))
          {
             UtlString callId, localTag, remoteTag;
             dialog->getCallId(callId);
             dialog->getLocalTag(localTag);
             dialog->getRemoteTag(remoteTag);
             OsSysLog::add(FAC_SIP, PRI_DEBUG, "SipDialogMgr::setNextLocalTransactionInfo dialog call-id = '%s', local tag = '%s', remote tag = '%s'",
                           callId.data(), localTag.data(), remoteTag.data());
          }
       }
    }

    unlock();

    return(requestSet);
}
示例#7
0
void Editor::findPrevious()
{
    if( lastSearch == "" ) {
        findDialog();
    }
    else {
        if( !find(lastSearch, lastSearchOptions ^ QTextDocument::FindBackward) ) {
            QMessageBox::information(this, tr("Find Previous"), tr("String '%0' not found").arg(lastSearch));
        }
    }
}
CodeEditor::CodeEditor(QWidget *parent) : QPlainTextEdit(parent){
    lineNumberArea = new LineNumberArea(this);

    findDialog_ = new FindDialog(this);
    findDialog_->setModal(false);
    findDialog_->setTextEdit(this);

    findReplaceDialog_ = new FindReplaceDialog(this);
    findReplaceDialog_->setModal(false);
    findReplaceDialog_->setTextEdit(this);

    qtScriptReservedWords_<<"break"<<"case"<<"catch"<<"continue"<<"debugger"<<"default"<<"delete"<<"do"<<"else"<<"finally"<<\
    "for"<<"function"<<"if"<<"in"<<"instanceof"<<"new"<<"return"<<"switch"<<"this"<<"throw"<<"try"<<\
    "typeof"<<"var"<<"void"<<"while"<<"with";

    syntaxHighlighter_ = new ScriptSyntaxHighlighter(this->document());

    s = Global::guiSettings(this);
    s->beginGroup("CodeEditor");
    QFont font = s->value("font",this->font()).value<QFont>();
    this->setFont(font);
    s->endGroup();

    findAction = new QAction("Find...",this);
    connect(findAction, SIGNAL(triggered()), this, SLOT(findDialog()));
    findAction->setShortcut(tr("Ctrl+F"));
    addAction(findAction);

    findReplaceAction = new QAction("Replace...",this);
    connect(findReplaceAction, SIGNAL(triggered()), this, SLOT(findReplaceDialog()));
    findReplaceAction->setShortcut(tr("Ctrl+R"));
    addAction(findReplaceAction);

    beautifyAction = new QAction("Beautify javascript code",this);
    connect(beautifyAction, SIGNAL(triggered()), this, SLOT(beautify()));
    beautifyAction->setShortcut(tr("Ctrl+B"));
    addAction(beautifyAction);


    connect(this, SIGNAL(blockCountChanged(int)), this, SLOT(updateLineNumberAreaWidth(int)));
    connect(this, SIGNAL(updateRequest(QRect,int)), this, SLOT(updateLineNumberArea(QRect,int)));
    connect(this, SIGNAL(cursorPositionChanged()), this, SLOT(highlightCurrentLine()));

    updateLineNumberAreaWidth(0);
    highlightCurrentLine();

    completer_ = new QCompleter(this);
    completer_->setModel(modelFromStringList(qtScriptReservedWords_));
    completer_->setModelSorting(QCompleter::CaseInsensitivelySortedModel);
    completer_->setCaseSensitivity(Qt::CaseInsensitive);
    completer_->setWrapAround(false);
    this->setCompleter(completer_);

}
示例#9
0
void Editor::findAgain(bool forward)
    {
    if(mLastSearch.length() == 0)
        {
        findDialog();
        }
    else
        {
        find(mLastSearch, forward, mLastSearchCaseSensitive);
        }
    }
示例#10
0
void Editor::findNext()
{
    if( lastSearch == "" ) {
        findDialog();
    }
    else {
        if( !find(lastSearch, lastSearchOptions) ) {
            QMessageBox::information(this, tr("Find Next"), tr("String '%0' not found").arg(lastSearch));
        }
    }
}
void MainWindow::createActions() {
    connect(ui->actionFind, SIGNAL(triggered()), this, SLOT(findDialog()));
    connect(ui->actionReplace, SIGNAL(triggered()), this, SLOT(findReplaceDialog()));

    connect(ui->actionAbout, SIGNAL(triggered()), this, SLOT(about()));

    connect(ui->actionAboutQt, SIGNAL(triggered()), qApp, SLOT(aboutQt()));

    connect(ui->actionFindNext, SIGNAL(triggered()), m_findDialog, SLOT(findNext()));
    connect(ui->actionFindPrevious, SIGNAL(triggered()), m_findDialog, SLOT(findPrev()));
}
示例#12
0
SipDialog* SipDialogMgr::findDialog(UtlString& dailogHandle,
                                    UtlBoolean ifHandleEstablishedFindEarlyDialog,
                                    UtlBoolean ifHandleEarlyFindEstablishedDialog)
{
    UtlString callId;
    UtlString localTag;
    UtlString remoteTag;
    SipDialog::parseHandle(dailogHandle, callId, localTag, remoteTag);

    return(findDialog(callId, localTag, remoteTag,
                      ifHandleEstablishedFindEarlyDialog,
                      ifHandleEarlyFindEstablishedDialog));
}
示例#13
0
enum SipDialogMgr::transactionSequence
    SipDialogMgr::isNewRemoteTransaction(const SipMessage& message)
{
    enum transactionSequence ordering;
    UtlString handle;
    message.getDialogHandle(handle);

    UtlString callId;
    UtlString fromTag;
    UtlString toTag;
    SipDialog::parseHandle(handle, callId, fromTag, toTag);

    lock();
    // Looking for any dialog that matches this handle
    SipDialog* dialog = findDialog(handle,
                                   TRUE, // if established, match early dialog
                                   TRUE); // if early, match established dialog

    if (dialog && 
        dialog->isTransactionRemotelyInitiated(callId, fromTag, toTag))
    {
       int messageCSeq;
       message.getCSeqField(&messageCSeq, NULL);
       int lastRemoteCSeq = dialog->getLastRemoteCseq();
       ordering =
          messageCSeq < lastRemoteCSeq ? OUT_OF_ORDER :
          /** If this message was an exact duplicate of a previous message
           *  (with the same CSeq and branch parameter), it would have been
           *  absorbed earlier in processing.  So we know the branch parameter
           *  is different without having to remember the previous value.
           */
          messageCSeq == lastRemoteCSeq ? LOOPED :
          IN_ORDER;
    }
    else
    {
       ordering = NO_DIALOG;
    }

    unlock();
    
    return ordering;
}
示例#14
0
UtlBoolean SipDialogMgr::dialogExists(const char* dialogHandle)
{
    UtlBoolean foundDialog = FALSE;
    UtlString handle(dialogHandle ? dialogHandle : "");
    lock();
    // Looking for an dialog that exactly matches this handle
    SipDialog* dialog = findDialog(handle,
                                   FALSE, // if established, match early dialog
                                   FALSE); // if early, match established dialog

    if(dialog)
    {
        foundDialog = TRUE;
    }

    unlock();

    return(foundDialog);
}
示例#15
0
UtlBoolean SipDialogMgr::setNextLocalTransactionInfo(SipMessage& request,
                                                     const char* method,
                                                     const char* dialogHandle)
{
    UtlBoolean requestSet = FALSE;
    UtlString dialogHandleString(dialogHandle ? dialogHandle : "");
    if(dialogHandleString.isNull())
    {
       SipDialog::getDialogHandle(request, dialogHandleString);
    }

    lock();
    SipDialog* dialog = findDialog(dialogHandleString,
                                   FALSE, // If established only want exact match  dialogs 
                                   TRUE); // If message is from a prior transaction
                                          // when the dialog was in an early state
                                          // allow it to match and established 
                                          // dialog
    if(dialog)
    {
        dialog->setRequestData(request, method);
        requestSet = TRUE;

#ifdef TEST_PRINT
        UtlString dialogDump;
        dialog->toString(dialogDump);
        printf("SipDialogMgr::setNextLocalTransactionInfo dialog:\n%s\n",
               dialogDump.data());
#endif

    }
    else
    {
        OsSysLog::add(FAC_SIP,
                      PRI_WARNING, 
                      "SipDialogMgr::setNextLocalTransactionInfo could not find dialog with handle %s",
                      dialogHandle);
    }

    unlock();

    return(requestSet);
}
void EDA_DRAW_FRAME::FocusOnLocation( const wxPoint& aPos, bool aWarpCursor, bool aCenterView )
{
    if( aCenterView )
    {
        wxWindow* dialog = findDialog( GetChildren() );

        // If a dialog partly obscures the window, then center on the uncovered area.
        if( dialog )
        {
            wxRect dialogRect( GetGalCanvas()->ScreenToClient( dialog->GetScreenPosition() ),
                               dialog->GetSize() );
            GetGalCanvas()->GetView()->SetCenter( aPos, dialogRect );
        }
        else
            GetGalCanvas()->GetView()->SetCenter( aPos );
    }

    if( aWarpCursor )
        GetGalCanvas()->GetViewControls()->SetCursorPosition( aPos );
    else
        GetGalCanvas()->GetViewControls()->SetCrossHairCursorPosition( aPos );
}
示例#17
0
UtlBoolean SipDialogMgr::initialDialogExists(const char* dialogHandle)
{
    UtlBoolean foundDialog = FALSE;
    UtlString handle(dialogHandle ? dialogHandle : "");
    lock();
    // Looking for an dialog that matches this handle, if there
    // is not an exact match see if there is an early dialog
    // that matches the given presumably established dialog handle
    SipDialog* dialog = findDialog(handle,
                                   TRUE, // if established, match early dialog
                                   FALSE); // if early, match established dialog

    // We only want early dialogs
    if(dialog && dialog->isInitialDialog())
    {
        foundDialog = TRUE;
    }

    unlock();

    return(foundDialog);
}
示例#18
0
UtlBoolean SipDialogMgr::updateDialog(const SipMessage& message, 
                                      const char* dialogHandle)
{
    UtlString handle(dialogHandle ? dialogHandle : "");
    // If the dialog handle was not set, get it from the message
    if(handle.isNull())
    {
       SipDialog::getDialogHandle(message, handle);
    }

    lock();
    
    SipDialog* dialog = findDialog(handle,
                                   TRUE, // if established handle, find early dialog
                                   FALSE); // do not want established dialogs for early handle
    if(dialog)
    {
#ifdef TEST_PRINT
        UtlString dialogDump;
        dialog->toString(dialogDump);
        printf("SipDialogMgr::updateDialog dialog before:\n%s\n",
               dialogDump.data());
#endif

        dialog->updateDialog(message);

#ifdef TEST_PRINT
        dialog->toString(dialogDump);
        printf("SipDialogMgr::updateDialog dialog after:\n%s\n",
               dialogDump.data());
#endif
    }


    unlock();

    return(dialog != NULL);
}
示例#19
0
UtlBoolean SipDialogMgr::deleteDialog(const char* dialogHandle)
{
    UtlBoolean dialogRemoved = FALSE;
    UtlString handle(dialogHandle ? dialogHandle : "");
    lock();
    // Not sure if it should match all flavors of dialog, especially the
    // last one (i.e. ealy handle matching an established
    SipDialog* dialog = findDialog(handle,
                                   TRUE, // match early dialogs for handle
                                   TRUE); // if early, match established

    if(dialog)
    {
        dialogRemoved = TRUE;
        mDialogs.removeReference(dialog);
        delete dialog;
        dialog = NULL;
    }

    unlock();

    return(dialogRemoved);
}
示例#20
0
UtlBoolean SipDialogMgr::getInitialDialogHandleFor(const char* establishedDialogHandle, 
                                                   UtlString& earlyDialogHandle)
{
    UtlBoolean foundDialog = FALSE;
    UtlString handle(establishedDialogHandle ? establishedDialogHandle : "");

    lock();
    SipDialog* dialog = findDialog(handle,
                                   TRUE, // if established, match early dialog
                                   FALSE); // if early, match established dialog
    if(dialog)
    {
        dialog->getInitialDialogHandle(earlyDialogHandle);
        foundDialog = TRUE;
    }
    else
    {
        earlyDialogHandle = "";
    }
    unlock();

    return(foundDialog);
}
示例#21
0
void MainWindow::findEvent() {
    FindEventDialog findDialog(storage.getEvents(), this);
    connect(&findDialog, SIGNAL(eventFound(CalendarEvent)),
            calendar, SLOT(selectEvent(CalendarEvent)));
    findDialog.exec();
}