static void intCleanUpIntelMap(void) { MESSAGE *psMessage, *psNext; //remove any research messages that have been read for (psMessage = apsMessages[selectedPlayer]; psMessage != NULL; psMessage = psNext) { psNext = psMessage->psNext; if (psMessage->type == MSG_RESEARCH && psMessage->read) { removeMessage(psMessage, selectedPlayer); } } resetIntelligencePauseState(); immediateMessage = false; cdAudio_Resume(); if (interpProcessorActive()) { debug(LOG_SCRIPT, "intCleanUpIntelMap: interpreter running, storing CALL_VIDEO_QUIT"); if(!msgStackPush(CALL_VIDEO_QUIT,-1,-1,"\0",-1,-1,NULL)) { debug(LOG_ERROR, "intCleanUpIntelMap() - msgStackPush - stack failed"); return; } } else { debug(LOG_SCRIPT, "intCleanUpIntelMap: not running"); eventFireCallbackTrigger((TRIGGER_TYPE)CALL_VIDEO_QUIT); } }
void HlpFlightPlannerApp::mapToolChanged( QgsMapTool *newTool, QgsMapTool *oldTool ) { if ( oldTool ) { disconnect( oldTool, SIGNAL( displayMessage( QString ) ), this, SLOT( displayMapToolMessage( QString ) ) ); disconnect( oldTool, SIGNAL( displayMessage( QString, QgsMessageBar::MessageLevel ) ), this, SLOT( displayMapToolMessage( QString, QgsMessageBar::MessageLevel ) ) ); disconnect( oldTool, SIGNAL( removeMessage() ), this, SLOT( removeMapToolMessage() ) ); } if ( newTool ) { connect( newTool, SIGNAL( displayMessage( QString ) ), this, SLOT( displayMapToolMessage( QString ) ) ); connect( newTool, SIGNAL( displayMessage( QString, QgsMessageBar::MessageLevel ) ), this, SLOT( displayMapToolMessage( QString, QgsMessageBar::MessageLevel ) ) ); connect( newTool, SIGNAL( removeMessage() ), this, SLOT( removeMapToolMessage() ) ); } }
void medMessageController::remove(medMessage *message) { if(message != NULL) { emit removeMessage(message); message->deleteLater(); } }
// free up a feature with no visual effects bool removeFeature(FEATURE *psDel) { MESSAGE *psMessage; Vector3i pos; ASSERT_OR_RETURN(false, psDel != NULL, "Invalid feature pointer"); ASSERT_OR_RETURN(false, !psDel->died, "Feature already dead"); //remove from the map data StructureBounds b = getStructureBounds(psDel); for (int breadth = 0; breadth < b.size.y; ++breadth) { for (int width = 0; width < b.size.x; ++width) { if (tileOnMap(b.map.x + width, b.map.y + breadth)) { MAPTILE *psTile = mapTile(b.map.x + width, b.map.y + breadth); if (psTile->psObject == psDel) { psTile->psObject = NULL; auxClearBlocking(b.map.x + width, b.map.y + breadth, FEATURE_BLOCKED | AIR_BLOCKED); } } } } if (psDel->psStats->subType == FEAT_GEN_ARTE || psDel->psStats->subType == FEAT_OIL_DRUM) { pos.x = psDel->pos.x; pos.z = psDel->pos.y; pos.y = map_Height(pos.x, pos.z) + 30; addEffect(&pos, EFFECT_EXPLOSION, EXPLOSION_TYPE_DISCOVERY, false, NULL, 0, gameTime - deltaGameTime + 1); if (psDel->psStats->subType == FEAT_GEN_ARTE) { scoreUpdateVar(WD_ARTEFACTS_FOUND); intRefreshScreen(); } } if (psDel->psStats->subType == FEAT_GEN_ARTE || psDel->psStats->subType == FEAT_OIL_RESOURCE) { for (unsigned player = 0; player < MAX_PLAYERS; ++player) { psMessage = findMessage((MSG_VIEWDATA *)psDel, MSG_PROXIMITY, player); while (psMessage) { removeMessage(psMessage, player); psMessage = findMessage((MSG_VIEWDATA *)psDel, MSG_PROXIMITY, player); } } } debug(LOG_DEATH, "Killing off feature %s id %d (%p)", objInfo(psDel), psDel->id, psDel); killFeature(psDel); return true; }
void KisFloatingMessage::startFade() { m_fadeTimeLine.setDuration(250); m_fadeTimeLine.setCurveShape(QTimeLine::EaseInCurve); m_fadeTimeLine.setLoopCount(1); m_fadeTimeLine.setFrameRange(OSD_WINDOW_OPACITY, 0); m_fadeTimeLine.setFrameRange(0, 10); connect(&m_fadeTimeLine, SIGNAL(finished()), SLOT(removeMessage())); connect(&m_fadeTimeLine, SIGNAL(frameChanged(int)), SLOT(updateOpacity(int))); m_fadeTimeLine.start(); }
void MessageListEditor::updateLayout() { iscore::clearLayout(m_messageListLayout); int i = 0; for(auto& mess : m_messages) { m_messageListLayout->addWidget(new MessageWidget{mess, m_model, this}, i, 0); auto removeButton = new QPushButton(tr("Remove")); m_messageListLayout->addWidget(removeButton, i, 1); connect(removeButton,&QPushButton::pressed, this, [=] { removeMessage(i); }); i++; } }
bool QMessageStore::removeMessages(const QMessageFilter& filter, QMessageManager::RemovalOption option) { bool noErrors; d_ptr->error = QMessageManager::NoError; noErrors = QMFStore::instance()->removeMessages(filter, option, d_ptr->error); QMessageIdList ids = StorageEngine::instance()->queryMessagesSync(filter, QMessageSortOrder(), 0, 0); for (int i = 0; i < ids.size(); i++) { if (!removeMessage(ids.at(i), option)) noErrors = false; } return noErrors; }
static unsigned int handleEventCore(ruleset *tree, char *message, jsonProperty *properties, void **rulesBinding, unsigned short actionType, unsigned short *commandCount) { jsonProperty *idProperty; int idLength; int result = getId(properties, ID_HASH, &idProperty, &idLength); if (result != RULES_OK) { return result; } char mid[idLength + 1]; strncpy(mid, idProperty->firstValue, idLength); mid[idLength] = '\0'; result = getId(properties, SID_HASH, &idProperty, &idLength); if (result != RULES_OK) { return result; } char sid[idLength + 1]; strncpy(sid, idProperty->firstValue, idLength); sid[idLength] = '\0'; if (actionType == ACTION_NEGATE_MESSAGE) { result = removeMessage(*rulesBinding, mid); if (result != RULES_OK) { return result; } *commandCount = *commandCount + 1; } result = handleAlpha(tree, sid, mid, message, &tree->nodePool[NODE_M_OFFSET].value.a, properties, rulesBinding, actionType, commandCount); if (result == ERR_NEW_SESSION) { char session[11 + idLength]; strcpy(session, "{\"id\":\""); strncpy(session + 7, sid, idLength); strcpy(session + 7 + idLength, "\"}"); result = handleSession(tree, session, *rulesBinding, ACTION_ASSERT_SESSION_IMMEDIATE, commandCount, 0); if (result != RULES_OK && result != ERR_EVENT_NOT_HANDLED) { return result; } return RULES_OK; } return result; }
bool StaticText::addMessage(const std::string& name, Otc::SpeakType type, const std::string& message) { //TODO: this could be moved to lua // First message if(m_messages.size() == 0) { m_name = name; m_messageType = type; } else { // we can only add another message if it follows these conditions if(m_name != name || m_messageType != type) return false; } m_messages.push_back(message); compose(); auto self = asStaticText(); g_eventDispatcher.scheduleEvent([self]() { self->removeMessage(); }, std::max<int>(Otc::STATIC_DURATION_PER_CHARACTER * message.length(), Otc::MIN_STATIC_TEXT_DURATION)); return true; }
// free up a feature with no visual effects bool removeFeature(FEATURE *psDel) { int mapX, mapY, width, breadth, player; MESSAGE *psMessage; Vector3i pos; ASSERT_OR_RETURN(false, psDel != NULL, "Invalid feature pointer"); ASSERT_OR_RETURN(false, !psDel->died, "Feature already dead"); if(bMultiMessages && !ingame.localJoiningInProgress) { SendDestroyFeature(psDel); // inform other players of destruction return true; // Wait for our message before really destroying the feature. } //remove from the map data mapX = map_coord(psDel->pos.x) - psDel->psStats->baseWidth/2; mapY = map_coord(psDel->pos.y) - psDel->psStats->baseBreadth/2; for (width = 0; width < psDel->psStats->baseWidth; width++) { for (breadth = 0; breadth < psDel->psStats->baseBreadth; breadth++) { if (tileOnMap(mapX + width, mapY + breadth)) { MAPTILE *psTile = mapTile(mapX + width, mapY + breadth); if (psTile->psObject == (BASE_OBJECT *)psDel) { psTile->psObject = NULL; auxClearBlocking(mapX + width, mapY + breadth, FEATURE_BLOCKED | AIR_BLOCKED); } } } } if(psDel->psStats->subType == FEAT_GEN_ARTE) { pos.x = psDel->pos.x; pos.z = psDel->pos.y; pos.y = map_Height(pos.x,pos.z); addEffect(&pos,EFFECT_EXPLOSION,EXPLOSION_TYPE_DISCOVERY,false,NULL,0); scoreUpdateVar(WD_ARTEFACTS_FOUND); intRefreshScreen(); } if (psDel->psStats->subType == FEAT_GEN_ARTE || psDel->psStats->subType == FEAT_OIL_RESOURCE) { for (player = 0; player < MAX_PLAYERS; player++) { psMessage = findMessage((MSG_VIEWDATA *)psDel, MSG_PROXIMITY, player); while (psMessage) { removeMessage(psMessage, player); psMessage = findMessage((MSG_VIEWDATA *)psDel, MSG_PROXIMITY, player); } } } killFeature(psDel); return true; }
void subscribeMwiClientTest() { smClientExpiration = -1; smNumClientNotifiesReceived = 0; smLastClientNotifyReceived = NULL; smNumClientSubResponsesReceived = 0; smLastClientSubResponseReceived = NULL; UtlString resourceId("[email protected]:"); UtlString eventTypeKey("message-summary"); UtlString eventType(eventTypeKey); UtlString from("Frida<sip:111@localhost:"); UtlString to("Tia<sip:222@localhost:"); UtlString contact("sip:[email protected]:"); char portString[20]; sprintf(portString, "%d", UNIT_TEST_SIP_PORT); resourceId.append(portString); from.append(portString); from.append('>'); to.append(portString); to.append('>'); contact.append(portString); SipUserAgent* userAgent = new SipUserAgent(UNIT_TEST_SIP_PORT, UNIT_TEST_SIP_PORT); userAgent->start(); // Set up the subscribe client SipDialogMgr* clientDialogMgr = new SipDialogMgr(); SipRefreshManager* refreshMgr = new SipRefreshManager(*userAgent, *clientDialogMgr); refreshMgr->start(); SipSubscribeClient* subClient = new SipSubscribeClient(*userAgent, *clientDialogMgr, *refreshMgr); subClient->start(); // Set up the subscribe server SipSubscribeServer* subServer = SipSubscribeServer::buildBasicServer(*userAgent, eventType); SipSubscriptionMgr* subMgr = subServer->getSubscriptionMgr(eventType); SipDialogMgr* serverDialogMgr = subMgr->getDialogMgr(); SipPublishContentMgr* contentMgr = subServer->getPublishMgr(eventType); HttpBody* preexistingBodyPtr = NULL; UtlBoolean isDefaultContent; subServer->start(); // Enable the handler for the MWI server subServer->enableEventType(eventType, userAgent); //CPPUNIT_ASSERT(TRUE); //ASSERT_STR_EQUAL("a", "a"); // Create a crude Subscription server/observer OsMsgQ incomingServerMsgQueue; // Register an interest in SUBSCRIBE requests // for this event type userAgent->addMessageObserver(incomingServerMsgQueue, SIP_SUBSCRIBE_METHOD, TRUE, // requests FALSE, // no reponses TRUE, // incoming FALSE, // no outgoing eventType, NULL, NULL); OsMsgQ incomingClientMsgQueue; userAgent->addMessageObserver(incomingClientMsgQueue, SIP_SUBSCRIBE_METHOD, FALSE, // no requests TRUE, // reponses TRUE, // incoming FALSE, // no outgoing eventType, NULL, NULL); // Should not be any pre-existing content CPPUNIT_ASSERT(!contentMgr->getContent(resourceId, eventTypeKey, NULL, preexistingBodyPtr, isDefaultContent)); int numDefaultContent = -1; int numResourceSpecificContent = -1; int numCallbacksRegistered = -1; contentMgr->getStats(numDefaultContent, numResourceSpecificContent, numCallbacksRegistered); CPPUNIT_ASSERT(numDefaultContent == 0); CPPUNIT_ASSERT(numResourceSpecificContent == 0); CPPUNIT_ASSERT(numCallbacksRegistered == 1); // Create a subscribe request, send it and keep it refreshed UtlString earlyDialogHandle; CPPUNIT_ASSERT(subClient->addSubscription(resourceId, eventType, from, to, contact, 60, // seconds expiration this, subStateCallback, notifyCallback, earlyDialogHandle)); contentMgr->getStats(numDefaultContent, numResourceSpecificContent, numCallbacksRegistered); CPPUNIT_ASSERT(numDefaultContent == 0); CPPUNIT_ASSERT(numResourceSpecificContent == 0); CPPUNIT_ASSERT(numCallbacksRegistered == 1); // See if a subscribe was sent and received /*OsTime messageTimeout(5, 0); // 5 seconds OsMsg* osMessage = NULL; const SipMessage* subscribeResponse = NULL; const SipMessage* notifyRequest = NULL; incomingServerMsgQueue.receive(osMessage, messageTimeout); CPPUNIT_ASSERT(osMessage); int msgType = osMessage->getMsgType(); int msgSubType = osMessage->getMsgSubType(); CPPUNIT_ASSERT(msgType == OsMsg::PHONE_APP); CPPUNIT_ASSERT(msgSubType == SipMessage::NET_SIP_MESSAGE); const SipMessage* sipMessage = ((SipMessageEvent*)osMessage)->getMessage(); int messageType = ((SipMessageEvent*)osMessage)->getMessageStatus(); CPPUNIT_ASSERT(sipMessage); CPPUNIT_ASSERT(messageType == SipMessageEvent::APPLICATION);*/ const SipMessage* serverSideSubRequest = NULL; CPPUNIT_ASSERT(removeMessage(incomingServerMsgQueue, 5000, // milliseconds serverSideSubRequest)); CPPUNIT_ASSERT(serverSideSubRequest); // Sub request got to server const SipMessage* clientSideSubResponse = NULL; CPPUNIT_ASSERT(removeMessage(incomingClientMsgQueue, 5000, // milliseconds clientSideSubResponse)); CPPUNIT_ASSERT(clientSideSubResponse); //UtlString clientStateString; //subClient->dumpStates(clientStateString); //printf("client states:\n%s\n", clientStateString.data()); int waitIterations = 0; while(smLastClientNotifyReceived == NULL || smLastClientSubResponseReceived == NULL) { OsTask::delay(100); waitIterations++; if(waitIterations >= 100) { break; } } CPPUNIT_ASSERT(smLastClientSubResponseReceived); CPPUNIT_ASSERT(smLastClientNotifyReceived); SipMessage* firstSubResponse = smLastClientSubResponseReceived; smLastClientSubResponseReceived = NULL; int firstSubCseq; firstSubResponse->getCSeqField(&firstSubCseq, NULL); SipMessage* firstNotifyRequest = smLastClientNotifyReceived; smLastClientNotifyReceived = NULL; int firstNotifyCseq; firstNotifyRequest->getCSeqField(&firstNotifyCseq, NULL); CPPUNIT_ASSERT(firstSubCseq == 1); CPPUNIT_ASSERT(firstNotifyCseq == 0); //subClient->dumpStates(clientStateString); //printf("client states:\n%s\n", clientStateString.data()); //UtlString dialogMgrDumpString; //clientDialogMgr.toString(dialogMgrDumpString); //printf("Client Dialog manager dump 1:\n%s\n", // dialogMgrDumpString.data()); // The refresh manager should re-SUBSCRIBE // Wait for the next notify request and subscribe response int secondMessageWait = 60; int resendTimeout = 0.55 * secondMessageWait; if(resendTimeout < 40) { resendTimeout = 40; } for(int i = 0; i < secondMessageWait - 1; i++) { if(i == resendTimeout - 1) { printf("v"); } else { printf("="); } } printf("v\n"); SipMessage* secondSubResponse = NULL; SipMessage* secondNotifyRequest = NULL; while(secondNotifyRequest == NULL || secondSubResponse == NULL) { OsTask::delay(1000); if(smLastClientSubResponseReceived) { secondSubResponse = smLastClientSubResponseReceived; smLastClientSubResponseReceived = NULL; } if(smLastClientNotifyReceived) { secondNotifyRequest = smLastClientNotifyReceived; smLastClientNotifyReceived = NULL; } printf("."); waitIterations++; if(waitIterations >= secondMessageWait) { printf("\n"); break; } } //subClient->dumpStates(clientStateString); //printf("client states:\n%s\n", clientStateString.data()); //clientDialogMgr.toString(dialogMgrDumpString); //printf("Client Dialog manager dump 2:\n%s\n", // dialogMgrDumpString.data()); CPPUNIT_ASSERT(removeMessage(incomingServerMsgQueue, 5000, // milliseconds serverSideSubRequest)); CPPUNIT_ASSERT(serverSideSubRequest); // Sub request got to server //UtlString subRequestDump; //int len; //serverSideSubRequest->getBytes(&subRequestDump, &len); //printf("server side sub request:\n%s\n", // subRequestDump.data()); CPPUNIT_ASSERT(removeMessage(incomingClientMsgQueue, 5000, // milliseconds clientSideSubResponse)); CPPUNIT_ASSERT(clientSideSubResponse); // Sub respon got to client //UtlString subResponseDump; //clientSideSubResponse->getBytes(&subResponseDump, &len); //printf("client side sub response:\n%s\n", // subResponseDump.data()); CPPUNIT_ASSERT(secondNotifyRequest); CPPUNIT_ASSERT(secondSubResponse); int secondSubCseq = -1; int secondNotifyCseq = -1; smLastClientSubResponseReceived = NULL; secondSubResponse->getCSeqField(&secondSubCseq, NULL); smLastClientNotifyReceived = NULL; secondNotifyRequest->getCSeqField(&secondNotifyCseq, NULL); CPPUNIT_ASSERT(firstSubCseq < secondSubCseq); CPPUNIT_ASSERT(firstNotifyCseq < secondNotifyCseq); // Unregister the queues so we stop receiving messages on them userAgent->removeMessageObserver(incomingServerMsgQueue); userAgent->removeMessageObserver(incomingClientMsgQueue); refreshMgr->requestShutdown(); subClient->requestShutdown(); }
/** * Called when a message is persisted. We don't need to track it any more * because it will be reloaded from the database. */ void MessageToManager::onMessagePersisted(const MessageToId &messageId) { removeMessage(messageId); }
/** * Called when a message is acknowledged by the game servers. If we were * tracking it, we don't need to any more. */ void MessageToManager::handleMessageToAck(const MessageToId &messageId) { removeMessage(messageId); }