void MessageInput::Send() { LOG(LOG_VERBOSE, "Sending text to participant"); // limit size of message history while ((mMessageHistory.size()) && (mMessageHistory.size() > MESSAGE_HISTORY_SIZE)) mMessageHistory.erase(mMessageHistory.begin()); // add current message to history mMessageHistory.push_back(toPlainText()); mMessageHistoryPos = -1; // filter and replace URLs QString tInputMessage = toPlainText(); QString tOutputMessage = ""; int tStartPos = 0; int tEndPos = -1; while (tStartPos < tInputMessage.size()) { tEndPos = tInputMessage.indexOf(' ', tStartPos); if (tEndPos == -1) { if (tEndPos < tInputMessage.size() -1) tEndPos = tInputMessage.size(); else break; } QString tWord = tInputMessage.mid(tStartPos, tEndPos - tStartPos); LOG(LOG_VERBOSE, "Message token: \"%s\"", tWord.toStdString().c_str()); if ((tWord.startsWith("http://")) && (tWord.size() > 7)) { LOG(LOG_VERBOSE, "Found http reference: %s", tWord.toStdString().c_str()); tOutputMessage.append("<a href=\"" + tWord + "\">" + tWord + "</a>"); } else if ((tWord.startsWith("ftp://")) && (tWord.size() > 6)) { LOG(LOG_VERBOSE, "Found ftp reference: %s", tWord.toStdString().c_str()); tOutputMessage.append("<a href=\"" + tWord + "\">" + tWord + "</a>"); } else if ((tWord.startsWith("mailto://")) && (tWord.size() > 9)) { LOG(LOG_VERBOSE, "Found mailto reference: %s", tWord.toStdString().c_str()); tOutputMessage.append("<a href=\"" + tWord + "\">" + tWord + "</a>"); } else tOutputMessage.append(tWord); if (tEndPos < tInputMessage.size() -1) tOutputMessage.append(' '); tStartPos = tEndPos + 1; } if (tOutputMessage.size() > 0) setPlainText(tOutputMessage); emit SendTrigger(); }
void MessageInput::Send() { LOG(LOG_VERBOSE, "Sending text to participant"); // limit size of message history while ((mMessageHistory.size()) && (mMessageHistory.size() > MESSAGE_HISTORY_SIZE)) mMessageHistory.erase(mMessageHistory.begin()); // add current message to history mMessageHistory.push_back(toPlainText()); mMessageHistoryPos = -1; emit SendTrigger(); }
void Dpoll_next(Dpoll *unit, int inNumSamples) { if (inNumSamples) { float x = DEMANDINPUT_A(0, inNumSamples); float run = DEMANDINPUT_A(2, inNumSamples) > 0.f; if(unit->m_mayprint && run) { Print("%s: %g block offset: %d\n", unit->m_id_string, x, inNumSamples - 1); } if(IN0(1) >= 0.0) SendTrigger(&unit->mParent->mNode, (int)IN0(1), x); OUT0(0) = x; } else { RESETINPUT(0); } }
DWORD PCOCamera::GetImage(PCOBuffer *buf,int timeout) { DWORD err = PCO_NOERROR; if (!IsRunning()) return PCO_ERROR_APPLICATION|(PCO_ERROR_SDKDLL_RECORDINGMUSTBEON&~PCO_ERROR_LAYER_MASK); HANDLE picev = buf->Picevent(); int Status; err = buf->Add(); if(err==PCO_NOERROR) { err = SendTrigger(); WaitForSingleObject(picev,timeout); Status=buf->Status(); if((Status & 0x0F000) != 0) return PCO_ERROR_APPLICATION; if ((Status & 0x0002) == 0) return PCO_ERROR_APPLICATION_PICTURETIMEOUT; } return err; }
void MessageWidget::Init(QMenu *pMenu, QString pParticipant, enum TransportType pParticipantTransport, bool pVisible) { mParticipant = pParticipant; mParticipantTransport = pParticipantTransport; initializeGUI(); mPbCall->SetPartner(mParticipant, mParticipantTransport); //#################################################################### //### create the remaining necessary menu item and short cuts //#################################################################### if (pMenu != NULL) { mAssignedAction = pMenu->addAction(pParticipant); mAssignedAction->setCheckable(true); mAssignedAction->setChecked(pVisible); QIcon tIcon; tIcon.addPixmap(QPixmap(":/images/22_22/Checked.png"), QIcon::Normal, QIcon::On); tIcon.addPixmap(QPixmap(":/images/22_22/Unchecked.png"), QIcon::Normal, QIcon::Off); mAssignedAction->setIcon(tIcon); } if (mAssignedAction != NULL) connect(mAssignedAction, SIGNAL(triggered()), this, SLOT(ToggleVisibility())); //#################################################################### //### update GUI //#################################################################### //TODO: remove the following if the feature is complete #ifdef RELEASE_VERSION mPbFile->setEnabled(false); #endif setWindowTitle(mParticipant); connect(mTeMessage, SIGNAL(SendTrigger()), this, SLOT(SendMessage())); connect(mPbFile, SIGNAL(released()), this, SLOT(SendFile())); connect(mPbAdd, SIGNAL(released()), this, SLOT(AddPArticipantToContacts())); if(IsKnownContact()) { mPbAdd->hide(); }else { mPbAdd->show(); } if (pVisible) { show(); }else { hide(); } UpdateParticipantState(CONTACT_UNDEFINED_STATE); //### set focus setFocus mTeMessage->setFocus(Qt::TabFocusReason); // are we part of broadcast window? if (mParticipant == BROACAST_IDENTIFIER) { mPbAdd->hide(); mPbCall->setEnabled(false); } }
void SoccerGoal::OnTouchNotify( HOBJECT hObj ) { CollisionInfo colInfo; DVector vBallVel; DBOOL bGoal; SoccerBall *pSoccerBall; DVector vPos, vDir, vDims; HOBJECT hPlayer; LMessage *pMsg; if( g_pServerDE->IsKindOf( g_pServerDE->GetObjectClass(hObj), m_hSoccerBall )) { pSoccerBall = ( SoccerBall * )g_pServerDE->HandleToObject( hObj ); if( !pSoccerBall ) return; // Already recorded this goal. Ball should delete itself soon. if( pSoccerBall->IsMadeGoal( )) return; // Ball has to enter from correct side for directional goals if( m_bDirectional ) { // Assume no goal bGoal = DFALSE; g_pServerDE->GetVelocity( hObj, &vBallVel ); // Check if going in the right direction if( VEC_DOT( vBallVel, m_vGoalDirection ) > 0.0f ) { bGoal = DTRUE; } } else bGoal = DTRUE; if( bGoal ) { if(( hPlayer = pSoccerBall->GetLastPlayerTouched( )) == DNULL ) return; // Send message to player and ball if( g_pServerDE->Common( )->CreateMessage( pMsg ) != LT_OK ) return; pMsg->WriteByte( m_nTeamID ); g_pServerDE->SendToObject( *pMsg, MID_GOAL, m_hObject, hPlayer, 0 ); g_pServerDE->SendToObject( *pMsg, MID_GOAL, m_hObject, hObj, 0 ); pMsg->Release(); // Create special effects g_pServerDE->GetObjectPos( hObj, &vPos ); g_pServerDE->GetVelocity( hObj, &vDir ); VEC_MULSCALAR( vDir, vDir, -1.0f ); VEC_SET( vDims, 25.0f, 25.0f, 25.0f ); SetupClientGibFX( &vPos, &vDir, &vDims, ( SURFTYPE_FLESH/10 ) | SIZE_SMALL | TRAIL_BLOOD, 1.0f, 5 ); // Play the sound if( m_hstrScoreSound ) { g_pServerDE->GetObjectPos( m_hObject, &vPos ); PlaySoundFromPos( &vPos, g_pServerDE->GetStringData( m_hstrScoreSound ), m_fRadius, SOUNDPRIORITY_MISC_MEDIUM ); } SendTrigger( ); } } }