/** * Called when the current state has finished and is ready to transition * into the next state */ void StateComplete(int state = -1) { _round->BeforeStateTransition(); Log tmp = _next_state_log; _next_state_log = Log(); if((_cycle_state == GetCurrentState()->GetState()) && (state == -1)) { qDebug() << "In" << _round->ToString() << "ending phase"; if(!_round->CycleComplete()) { return; } _log = Log(); IncrementPhase(); } if(state == -1) { qDebug() << "In" << _round->ToString() << "ending:" << StateToString(GetCurrentState()->GetState()) << "starting:" << StateToString(GetNextState()->GetState()); _current_sm_state = GetNextState(); } else { qDebug() << "In" << _round->ToString() << "ending:" << StateToString(GetCurrentState()->GetState()) << "starting:" << StateToString(_states[state]->GetState()); _current_sm_state = _states[state]; } (_round->*GetCurrentState()->GetTransitionCallback())(); for(int idx = 0; idx < tmp.Count(); idx++) { QPair<QByteArray, Id> entry = tmp.At(idx); ProcessData(entry.second, entry.first); } }
void ProcessDispatcher::Exit(int64_t retcode) { LTRACE_ENTRY_OBJ; DEBUG_ASSERT(ProcessDispatcher::GetCurrent() == this); { Guard<fbl::Mutex> guard{get_lock()}; // check that we're in the RUNNING state or we're racing with something // else that has already pushed us until the DYING state DEBUG_ASSERT_MSG(state_ == State::RUNNING || state_ == State::DYING, "state is %s", StateToString(state_)); // Set the exit status if there isn't already an exit in progress. if (state_ != State::DYING) { DEBUG_ASSERT(retcode_ == 0); retcode_ = retcode; } // enter the dying state, which should kill all threads SetStateLocked(State::DYING); } ThreadDispatcher::GetCurrent()->Exit(); __UNREACHABLE; }
// SessionManager must be read-locked int Call::tarificate(Connection *sqlCon) { if (price == PRICE_ERROR) return -1; if (state != ACTIVE && state != END && state != ERROR) { // log(LOG_ERROR, "Call::tarificate Error: wrong state %s (call=%d).", State2String(state), getID()); return 0; } cost = countCost(); log(LOG_ERROR, "doing Call::tarificate cost=%d state=%s (call=%d).", cost, StateToString(state), getID()); Translator *ServerAccount = sManager->getServerAccount(); // long fee = cost * t->getFeePercent(); if (cost > 0) { User::changeBalanceDyn(sqlCon, sManager, getClient(), -cost); User::changeBalanceDyn(sqlCon, sManager, getTranslator(), cost); /* if (!ServerAccount) { // done during billing purchase log(LOG_FATAL, "Call->tarificate: ServerAccount not initialized."); } else { ServerAccount->lock(); ServerAccount->changeBalance(sManager->getCallManager(), cost); ServerAccount->DBWrite(); ServerAccount->unlock(); } */ } // accounted = 0; return 0; }
bool PlayerContext::GetPlayingInfoMap(InfoMap &infoMap) const { bool loaded = false; LockPlayingInfo(__FILE__, __LINE__); if (playingInfo) { playingInfo->ToMap(infoMap); infoMap["tvstate"] = StateToString(playingState); infoMap["iconpath"] = ChannelUtil::GetIcon(playingInfo->GetChanID()); if ((playingInfo->IsVideoFile() || playingInfo->IsVideoDVD() || playingInfo->IsVideoBD()) && playingInfo->GetPathname() != playingInfo->GetBasename()) { infoMap["coverartpath"] = VideoMetaDataUtil::GetArtPath( playingInfo->GetPathname(), "Coverart"); infoMap["fanartpath"] = VideoMetaDataUtil::GetArtPath( playingInfo->GetPathname(), "Fanart"); infoMap["bannerpath"] = VideoMetaDataUtil::GetArtPath( playingInfo->GetPathname(), "Banners"); infoMap["screenshotpath"] = VideoMetaDataUtil::GetArtPath( playingInfo->GetPathname(), "Screenshots"); } if (player) player->GetCodecDescription(infoMap); infoMap.detach(); loaded = true; } UnlockPlayingInfo(__FILE__, __LINE__); return loaded; }
CustomStatusesManager::CustomStatusesManager (QObject *parent) : QObject (parent) , Model_ (new QStandardItemModel (this)) { Model_->setColumnCount (3); Model_->setHorizontalHeaderLabels ({ tr ("Name"), tr ("Status"), tr ("Text") }); Model_->horizontalHeaderItem (0)->setData (DataSources::DataFieldType::String, DataSources::DataSourceRole::FieldType); Model_->horizontalHeaderItem (1)->setData (DataSources::DataFieldType::Enum, DataSources::DataSourceRole::FieldType); QVariantList values; auto append = [&values] (State state) { const QVariantMap value { { "Name", StateToString (state) }, { "Icon", ResourcesManager::Instance ().GetIconForState (state) }, { "ID", QVariant::fromValue (state) } }; values << value; }; append (State::SOnline); append (State::SAway); append (State::SXA); append (State::SDND); append (State::SChat); append (State::SOffline); Model_->horizontalHeaderItem (1)->setData (values, DataSources::DataSourceRole::FieldValues); Model_->horizontalHeaderItem (2)->setData (DataSources::DataFieldType::String, DataSources::DataSourceRole::FieldType); Load (); }
void ShuffleRound::HandlePrivateKey(QDataStream &stream, const Id &id) { qDebug() << _group.GetIndex(_local_id) << _local_id.ToString() << ": received private key from " << _group.GetIndex(id) << id.ToString() << ", received" << _keys_received << "keys."; if(_state != Verification && _state != PrivateKeySharing) { qWarning() << "Received a private key message while in state " << StateToString(_state); return; } QByteArray key; stream >> key; int idx = _group.GetIndex(id); int kidx = _group.GetSize() - 1 - idx; _private_inner_keys[idx] = new CppPrivateKey(key); if(!_private_inner_keys[idx]->VerifyKey(*_public_inner_keys[kidx])) { qWarning() << "Invalid inner key for " << idx << id.ToString(); return; } if(++_keys_received == _private_inner_keys.count()) { Decrypt(); } }
void ShuffleRound::HandleVerification(bool go, const Id &id) { qDebug() << _group.GetIndex(_local_id) << _local_id.ToString() << ": received" << go << " from " << _group.GetIndex(id) << id.ToString(); if(_state != Verification && _state != ShuffleDone) { qWarning() << "Received a GoNoGo message while in state" << StateToString(_state); return; } if(!go) { return; } int idx = _group.GetIndex(id); if(_go_received[idx]) { qWarning() << "Multiple \"go\"s received from " << id.ToString(); return; } _go_received[idx] = true; if(++_go == _group.GetSize()) { BroadcastPrivateKey(); } }
void PrintOmxEvent(vlc_object_t *p_this, OMX_EVENTTYPE event, OMX_U32 data_1, OMX_U32 data_2, OMX_PTR event_data) { switch (event) { case OMX_EventCmdComplete: switch ((OMX_STATETYPE)data_1) { case OMX_CommandStateSet: msg_Dbg( p_this, "OmxEventHandler (%s, %s, %s)", EventToString(event), CommandToString(data_1), StateToString(data_2) ); break; default: msg_Dbg( p_this, "OmxEventHandler (%s, %s, %u)", EventToString(event), CommandToString(data_1), (unsigned int)data_2 ); break; } break; case OMX_EventError: msg_Dbg( p_this, "OmxEventHandler (%s, %s, %u, %s)", EventToString(event), ErrorToString((OMX_ERRORTYPE)data_1), (unsigned int)data_2, (const char *)event_data); break; default: msg_Dbg( p_this, "OmxEventHandler (%s, %u, %u)", EventToString(event), (unsigned int)data_1, (unsigned int)data_2 ); break; } }
void RepeatingBulkRound::ProcessData(const Id &from, const QByteArray &data) { _log.Append(data, from); try { ProcessDataBase(from, data); } catch (QRunTimeError &err) { qWarning() << GetGroup().GetIndex(GetLocalId()) << GetLocalId().ToString() << "received a message from" << GetGroup().GetIndex(from) << from.ToString() << "in session / round" << GetRoundId().ToString() << "in state" << StateToString(_state) << "causing the following exception: " << err.What(); _log.Pop(); return; } }
void CustomStatusesManager::Add (const CustomStatus& state, int after) { QList<QStandardItem*> row; row << new QStandardItem (state.Name_); row << new QStandardItem (ResourcesManager::Instance ().GetIconForState (state.State_), StateToString (state.State_)); row << new QStandardItem (state.Text_); row.at (1)->setData (static_cast<int> (state.State_)); if (after == -1) Model_->appendRow (row); else Model_->insertRow (after, row); }
/** * Does the real work for processing data, the round should funnel its * ProcessData to here. * @param from the sending member * @param data the data sent */ void ProcessData(const Id &from, const QByteArray &data) { _log.Append(data, from); try { ProcessDataBase(from, data); } catch (QRunTimeError &err) { qWarning() << _round->GetGroup().GetIndex(_round->GetLocalId()) << _round->GetLocalId() << "received a message from" << _round->GetGroup().GetIndex(from) << from << "in" << _round->GetRoundId() << "in state" << StateToString(GetCurrentState()->GetState()) << "causing the following exception:" << err.What(); _log.Pop(); return; } }
void ShuffleRound::HandleData(QDataStream &stream, const Id &id) { qDebug() << _group.GetIndex(_local_id) << _local_id.ToString() << ": received initial data from " << _group.GetIndex(id) << id.ToString(); if(_state != KeySharing && _state != DataSubmission && _state != WaitingForShuffle) { qWarning() << "Received a data message while in state " << StateToString(_state) << " from " << id.ToString(); return; } int idx = _group.GetIndex(_local_id); if(idx != 0) { qWarning() << "Received a data message while not the first node " << " in the group. Actual position: " << idx; return; } QByteArray data; stream >> data; idx = _group.GetIndex(id); if(data.isEmpty()) { qWarning() << _group.GetIndex(_local_id) << _local_id.ToString() << ": received null data from " << idx << id.ToString(); return; } if(!_shuffle_data[idx].isEmpty()) { if(_shuffle_data[idx] != data) { qWarning() << "Received a second data message from " << id.ToString(); } else { qWarning() << "Received a duplicate data message from " << id.ToString(); } return; } _shuffle_data[idx] = data; if(++_data_received == _group.GetSize()) { Shuffle(); } }
void nsLineBox::List(FILE* out, int32_t aIndent, uint32_t aFlags) const { nsFrame::IndentBy(out, aIndent); char cbuf[100]; fprintf(out, "line %p: count=%d state=%s ", static_cast<const void*>(this), GetChildCount(), StateToString(cbuf, sizeof(cbuf))); if (IsBlock() && !GetCarriedOutBottomMargin().IsZero()) { fprintf(out, "bm=%d ", GetCarriedOutBottomMargin().get()); } fprintf(out, "{%d,%d,%d,%d} ", mBounds.x, mBounds.y, mBounds.width, mBounds.height); if (mData && (!mData->mOverflowAreas.VisualOverflow().IsEqualEdges(mBounds) || !mData->mOverflowAreas.ScrollableOverflow().IsEqualEdges(mBounds))) { fprintf(out, "vis-overflow=%d,%d,%d,%d scr-overflow=%d,%d,%d,%d ", mData->mOverflowAreas.VisualOverflow().x, mData->mOverflowAreas.VisualOverflow().y, mData->mOverflowAreas.VisualOverflow().width, mData->mOverflowAreas.VisualOverflow().height, mData->mOverflowAreas.ScrollableOverflow().x, mData->mOverflowAreas.ScrollableOverflow().y, mData->mOverflowAreas.ScrollableOverflow().width, mData->mOverflowAreas.ScrollableOverflow().height); } fprintf(out, "<\n"); nsIFrame* frame = mFirstChild; int32_t n = GetChildCount(); while (--n >= 0) { frame->List(out, aIndent + 1, aFlags); frame = frame->GetNextSibling(); } if (HasFloats()) { nsFrame::IndentBy(out, aIndent); fputs("> floats <\n", out); ListFloats(out, aIndent + 1, mInlineData->mFloats); } nsFrame::IndentBy(out, aIndent); fputs(">\n", out); }
void BulkRound::HandleLoggedBulkData(QDataStream &stream, const Id &from) { if(from == GetLocalId()) { return; } qDebug() << GetGroup().GetIndex(GetLocalId()) << GetLocalId().ToString() << ": received logged bulk data from " << GetGroup().GetIndex(from) << from.ToString(); if(GetGroup().GetLeader() != from) { throw QRunTimeError("Received logged bulk data from non-leader."); } if(_state != ReceivingLeaderData) { throw QRunTimeError("Not expected at this time."); } QByteArray binary_log; stream >> binary_log; Log log(binary_log); if(log.Count() != GetGroup().Count()) { throw QRunTimeError("Incorrect number of log messages."); } _state = ProcessingLeaderData; for(int idx = 0; idx < log.Count(); idx++) { const QPair<QByteArray, Id> &res = log.At(idx); try { ProcessDataBase(res.second, res.first); } catch (QRunTimeError &err) { const Id &from = res.second; qWarning() << GetGroup().GetIndex(GetLocalId()) << GetLocalId().ToString() << "leader equivocated in message from" << GetGroup().GetIndex(from) << from.ToString() << "in session / round" << GetRoundId().ToString() << "in state" << StateToString(_state) << "causing the following exception: " << err.What(); // Should end round. break; } } }
void nsLineBox::List(FILE* out, PRInt32 aIndent) const { PRInt32 i; for (i = aIndent; --i >= 0; ) fputs(" ", out); char cbuf[100]; fprintf(out, "line %p: count=%d state=%s ", static_cast<const void*>(this), GetChildCount(), StateToString(cbuf, sizeof(cbuf))); if (IsBlock() && !GetCarriedOutBottomMargin().IsZero()) { fprintf(out, "bm=%d ", GetCarriedOutBottomMargin().get()); } fprintf(out, "{%d,%d,%d,%d} ", mBounds.x, mBounds.y, mBounds.width, mBounds.height); if (mData) { fprintf(out, "vis-overflow={%d,%d,%d,%d} scr-overflow={%d,%d,%d,%d} ", mData->mOverflowAreas.VisualOverflow().x, mData->mOverflowAreas.VisualOverflow().y, mData->mOverflowAreas.VisualOverflow().width, mData->mOverflowAreas.VisualOverflow().height, mData->mOverflowAreas.ScrollableOverflow().x, mData->mOverflowAreas.ScrollableOverflow().y, mData->mOverflowAreas.ScrollableOverflow().width, mData->mOverflowAreas.ScrollableOverflow().height); } fprintf(out, "<\n"); nsIFrame* frame = mFirstChild; PRInt32 n = GetChildCount(); while (--n >= 0) { frame->List(out, aIndent + 1); frame = frame->GetNextSibling(); } for (i = aIndent; --i >= 0; ) fputs(" ", out); if (HasFloats()) { fputs("> floats <\n", out); ListFloats(out, aIndent + 1, mInlineData->mFloats); for (i = aIndent; --i >= 0; ) fputs(" ", out); } fputs(">\n", out); }
bool CGameManageDlg::ShowGameUeser() { m_GameUeserListCtrl.DeleteAllItems(); CString s; for (int i = 0; i < m_wSocket.m_UserManage.GetOnLineUserCount(); i++) { s.Format("%.3d", m_wSocket.m_UserManage.FindOnLineUserByIndex(i)->GameUserInfo.dwUserID); int r = m_GameUeserListCtrl.InsertItem(i, s); m_GameUeserListCtrl.SetItemText(r, 1, m_wSocket.m_UserManage.FindOnLineUserByIndex(i)->GameUserInfo.nickName); m_GameUeserListCtrl.SetItemText(r, 2, StateToString(m_wSocket.m_UserManage.FindOnLineUserByIndex(i)->GameUserInfo.bUserState)); if (m_wSocket.m_UserManage.FindOnLineUserByIndex(i)->GameUserInfo.bDeskNO != 255) s.Format("%.3d", m_wSocket.m_UserManage.FindOnLineUserByIndex(i)->GameUserInfo.bDeskNO + 1); else s = ""; m_GameUeserListCtrl.SetItemText(r, 3, s); } ShowGameDeskStation(); return true; }
//***************************************************************************** // \internal // // Handler for the "info" command. // // \param argc contains the number of entries in the argv[] array. // \param argv is an array of pointers to each of the individual words parsed // from the command line. The first entry will be the command itself and later // entries represent any parameters. // // This function is called by the command line parser when the user enters // the "info" or "i" commands. It prints information on the current trigger // setting and the status of the latest capture request on UART0. // // \return Returns COMMAND_OK. // //***************************************************************************** int CmdInfo(int argc, char *argv[]) { tTriggerType eType; unsigned long ulTrigPos; unsigned short usLevel; tDataAcqCaptureStatus sStatus; // // Get the existing trigger parameters. // DataAcquisitionGetTrigger(&eType, &ulTrigPos, &usLevel); // // Print out the trigger info. // UARTprintf("\nTrigger\n"); UARTprintf("-------\n"); UARTprintf("Type: %s (%d)\n", TriggerToString(eType), eType); UARTprintf("Level: %d\n", usLevel); UARTprintf("Position: %d\n", ulTrigPos); // // Print out channel 1 status // DataAcquisitionGetStatus(&sStatus); UARTprintf("\nStatus\n"); UARTprintf("------\n"); UARTprintf("State: %s (%d)\n", StateToString(sStatus.eState), sStatus.eState); UARTprintf("Captured: %d\n", sStatus.ulSamplesCaptured); UARTprintf("Buffer: 0x%08x\n", sStatus.pusBuffer); UARTprintf("Data start: %d\n", sStatus.ulStartIndex); UARTprintf("Trigger: %d\n", sStatus.ulTriggerIndex); UARTprintf("Mode: %s\n", sStatus.bDualMode ? "Dual" : "Single"); UARTprintf("CH2 offset: %duS\n", sStatus.ulSampleOffsetuS); UARTprintf("Period: %duS\n", sStatus.ulSamplePerioduS); return(COMMAND_OK); }
void ShuffleRound::HandleShuffle(QDataStream &stream, const Id &id) { qDebug() << _group.GetIndex(_local_id) << _local_id.ToString() << ": received shuffle data from " << _group.GetIndex(id) << id.ToString(); if(_state != WaitingForShuffle) { qWarning() << "Received a shuffle message while in state " << StateToString(_state) << " from " << id.ToString(); return; } if(_group.Previous(_local_id) != id) { qWarning() << "Received shuffle out of order from " << id.ToString(); return; } stream >> _shuffle_data; Shuffle(); }
void ProcessDispatcher::SetStateLocked(State s) { LTRACEF("process %p: state %u (%s)\n", this, static_cast<unsigned int>(s), StateToString(s)); DEBUG_ASSERT(get_lock()->lock().IsHeld()); // look for some invalid state transitions if (state_ == State::DEAD && s != State::DEAD) { panic("ProcessDispatcher::SetStateLocked invalid state transition from DEAD to !DEAD\n"); return; } // transitions to your own state are okay if (s == state_) return; state_ = s; if (s == State::DYING) { // send kill to all of our threads KillAllThreadsLocked(); } }
void ShuffleRound::HandlePublicKeys(QDataStream &stream, const Id &id) { qDebug() << _group.GetIndex(_local_id) << _local_id.ToString() << ": received public keys from " << _group.GetIndex(id) << id.ToString(); if(_state != Offline && _state != KeySharing) { qWarning() << "Received a key message while in state " << StateToString(_state) << " from " << id.ToString(); return; } int idx = _group.GetIndex(id); int kidx = _group.GetSize() - 1 - idx; if(_public_inner_keys[kidx] != 0 || _public_outer_keys[kidx] != 0) { qWarning() << _group.GetIndex(_local_id) << _local_id.ToString() << ": received duplicate public keys from " << _group.GetIndex(id) << id.ToString(); return; } QByteArray inner_key, outer_key; stream >> inner_key >> outer_key; _public_inner_keys[kidx] = new CppPublicKey(inner_key); _public_outer_keys[kidx] = new CppPublicKey(outer_key); if(!_public_inner_keys[kidx]->IsValid()) { qWarning() << _group.GetIndex(_local_id) << _local_id.ToString() << ": invalid inner key from " << idx << id.ToString(); } else if(!_public_outer_keys[kidx]->IsValid()) { qWarning() << _group.GetIndex(_local_id) << _local_id.ToString() << ": invalid outer key from " << idx << id.ToString(); } if(++_keys_received == _group.GetSize()) { SubmitData(); } }
long PlugInShell_SetPluginState(const unsigned long inNewState) { long macError = eDSNoErr; bool isAcquired = false; LOG_ENTER("inNewState = 0x%08x (%s)", inNewState, StateToString(inNewState)); if (FlagOn(inNewState, ~(kActive | kInactive))) { LOG("Ignoring unexpected state flags: 0x%08x", FlagOn(inNewState, ~(kActive | kInactive))); } if (!FlagOn(inNewState, kActive | kInactive)) { // Nothing to do. LOG("Nothing to do because inactive/active flags are not specified."); macError = eDSNoErr; GOTO_CLEANUP(); } if (FlagOn(inNewState, kActive) && FlagOn(inNewState, kInactive)) { LOG_ERROR("Cannot set active and inactive at the same time."); macError = ePlugInError; GOTO_CLEANUP(); } GS_ACQUIRE_EXCLUSIVE(); isAcquired = true; GS_VERIFY_INITIALIZED(macError); LOG("Current State = 0x%08x", GlobalState.PluginState); if ( (FlagOn(inNewState, kActive | kInactive) == FlagOn(GlobalState.PluginState, kActive | kInactive)) ) { // Nothing to do. LOG("Nothing to do because the state matches"); macError = eDSNoErr; GOTO_CLEANUP(); } if ( FlagOn(inNewState, kActive) ) { LOG("Activating"); macError = Activate(); GOTO_CLEANUP_ON_MACERROR(macError); SetFlag(GlobalState.PluginState, kActive); ClearFlag(GlobalState.PluginState, kInactive); } else if ( FlagOn(inNewState, kInactive) ) { LOG("De-activating"); macError = Deactivate(); GOTO_CLEANUP_ON_MACERROR(macError); ClearFlag(GlobalState.PluginState, kActive); SetFlag(GlobalState.PluginState, kInactive); } else { // This should never happen. LOG_ERROR("Benign unexpected code path."); macError = eDSNoErr; } cleanup: if (isAcquired) { LOG("Final State = 0x%08x", GlobalState.PluginState); GS_RELEASE(); } LOG_LEAVE("--> %d", macError); return macError; }
std::string CMasternode::GetStateString() const { return StateToString(nActiveState); }
void EntryBase::SetStatus (const EntryStatus& status, const QString& variant, const QXmppPresence& presence) { const bool existed = CurrentStatus_.contains (variant); const bool wasOffline = existed ? CurrentStatus_ [variant].State_ == SOffline : false; if (existed && status == CurrentStatus_ [variant] && presence.priority () == Variant2ClientInfo_.value (variant).value ("priority")) return; CurrentStatus_ [variant] = status; const QStringList& vars = Variants (); if ((!existed || wasOffline) && !vars.isEmpty ()) { const QString& highest = vars.first (); if (Location_.contains ({})) Location_ [highest] = Location_.take ({}); if (Variant2Audio_.contains ({})) Variant2Audio_ [highest] = Variant2Audio_.take ({}); if (Variant2Mood_.contains ({})) Variant2Mood_ [highest] = Variant2Mood_.take ({}); if (Variant2Activity_.contains ({})) Variant2Activity_ [highest] = Variant2Activity_.take ({}); } if ((!existed || wasOffline) && status.State_ != SOffline) { auto conn = Account_->GetClientConnection (); if (conn->GetInfoReqPolicyManager ()->IsRequestAllowed (InfoRequest::Version, this)) { if (!variant.isEmpty ()) conn->FetchVersion (GetJID () + '/' + variant); else conn->FetchVersion (GetJID ()); } } if (status.State_ != SOffline) { if (const int p = presence.priority ()) Variant2ClientInfo_ [variant] ["priority"] = p; } else { Variant2Version_.remove (variant); Variant2ClientInfo_.remove (variant); Variant2VerString_.remove (variant); Variant2Identities_.remove (variant); Variant2Audio_.remove (variant); Variant2Mood_.remove (variant); Variant2Activity_.remove (variant); Variant2SecsDiff_.remove (variant); } emit statusChanged (status, variant); if (!existed || status.State_ == SOffline || wasOffline) emit availableVariantsChanged (vars); GlooxMessage *message = 0; if (GetEntryType () == EntryType::PrivateChat) message = new GlooxMessage (IMessage::Type::StatusMessage, IMessage::Direction::In, qobject_cast<RoomCLEntry*> (GetParentCLEntryObject ())-> GetRoomHandler ()->GetRoomJID (), GetEntryName (), Account_->GetClientConnection ().get ()); else message = new GlooxMessage (IMessage::Type::StatusMessage, IMessage::Direction::In, GetJID (), variant, Account_->GetClientConnection ().get ()); message->SetMessageSubType (IMessage::SubType::ParticipantStatusChange); const auto proxy = Account_->GetParentProtocol ()->GetProxyObject (); const auto& state = proxy->StateToString (status.State_); const auto& nick = GetEntryName () + '/' + variant; message->setProperty ("Azoth/Nick", nick); message->setProperty ("Azoth/TargetState", state); message->setProperty ("Azoth/StatusText", status.StatusString_); const auto& msg = tr ("%1 is now %2 (%3)") .arg (nick) .arg (state) .arg (status.StatusString_); message->SetBody (msg); HandleMessage (message); }
void Call::setState(call_state st) { log(LOG_ALL, "call %d[%d->%d] state: %s->%s", getID(), getClient(), getTranslator(), StateToString(state), StateToString(st)); state = st; }
BOOL DumpProcess(HANDLE hp) { ULONG64 base; ULONG64 next; MEMORY_BASIC_INFORMATION mbi; printf(" %12s %8s %8s: %3s %3s %4s %3s : %8s\n", "Address", "Offset", "Size", "Typ", "Sta", "Prot", "Ini", "Contents"); printf(" %12s %8s %8s: %3s %3s %4s %3s : %8s\n", "------------", "--------", "--------", "---", "---", "----", "---", "-----------------"); for (next = 0;;) { base = next; ZeroMemory(&mbi, sizeof(mbi)); if (VirtualQueryEx(hp, (PVOID)base, &mbi, sizeof(mbi)) == 0) { break; } if ((mbi.RegionSize & 0xfff) == 0xfff) { break; } next = (ULONG64)mbi.BaseAddress + mbi.RegionSize; if (mbi.State == MEM_FREE) { continue; } CHAR szType[16]; TypeToString(mbi.Type, szType, ARRAYSIZE(szType)); CHAR szState[16]; StateToString(mbi.State, szState, ARRAYSIZE(szState)); CHAR szProtect[16]; ProtectToString(mbi.Protect, szProtect, ARRAYSIZE(szProtect)); CHAR szAllocProtect[16]; ProtectToString(mbi.AllocationProtect, szAllocProtect, ARRAYSIZE(szAllocProtect)); CHAR szFile[MAX_PATH]; szFile[0] = '\0'; DWORD cb = 0; PCHAR pszFile = szFile; if (base == (ULONG64)mbi.AllocationBase) { #if 0 cb = pfGetMappedFileName(hp, (PVOID)mbi.AllocationBase, szFile, ARRAYSIZE(szFile)); #endif if (GetSections(hp, (PBYTE)mbi.AllocationBase)) { next = base + 0x1000; sprintf_s(szFile, ARRAYSIZE(szFile), "%d-bit PE", Bitness); } } if (cb > 0) { for (DWORD c = 0; c < cb; c++) { szFile[c] = (szFile[c] >= 'a' && szFile[c] <= 'z') ? szFile[c] - 'a' + 'A' : szFile[c]; } szFile[cb] = '\0'; } if ((pszFile = strrchr(szFile, '\\')) == NULL) { pszFile = szFile; } else { pszFile++; } PBYTE pbEnd; PCHAR pszSect = FindSectionName((PBYTE)base, pbEnd); if (pszSect != NULL) { pszFile = pszSect; if (next > (ULONG64)pbEnd) { next = (ULONG64)pbEnd; } } CHAR szDesc[128]; ZeroMemory(&szDesc, ARRAYSIZE(szDesc)); if (base == (ULONG64)mbi.AllocationBase) { sprintf_s(szDesc, ARRAYSIZE(szDesc), " %12I64x %8I64x %8I64x: %3s %3s %4s %3s : %s", (ULONG64)base, (ULONG64)base - (ULONG64)mbi.AllocationBase, (ULONG64)next - (ULONG64)base, szType, szState, szProtect, szAllocProtect, pszFile); } else { sprintf_s(szDesc, ARRAYSIZE(szDesc), " %12s %8I64x %8I64x: %3s %3s %4s %3s : %s", "-", (ULONG64)base - (ULONG64)mbi.AllocationBase, (ULONG64)next - (ULONG64)base, szType, szState, szProtect, szAllocProtect, pszFile); } printf("%s\n", szDesc); } return TRUE; }
QVariant CNeighboursTableModel::data(const QModelIndex& index, int role) const { if( !index.isValid() ) return QVariant(); if( index.row() > m_lNodes.size() || index.row() < 0 ) return QVariant(); if ( role == Qt::DecorationRole ) { const sNeighbour& n = m_lNodes.at(index.row()); if (index.column() == 0) { return n.iNetwork; } if(index.column() == 10) { return n.iCountry; } } if( role == Qt::DisplayRole ) { const sNeighbour& n = m_lNodes.at(index.row()); switch( index.column() ) { case 0: return n.pNode->GetAddress().toString(); case 1: return StateToString(n.nState); case 2: return QString().sprintf("%.2u:%.2u:%.2u", n.tConnected / 3600, (n.tConnected % 3600 / 60), (n.tConnected % 3600) % 60); case 3: return QString().sprintf("%1.3f / %1.3f", n.nBandwidthIn / 1024.0f, n.nBandwidthOut / 1024.0f); case 4: return QString().sprintf("%1.3f / %1.3f KB (%1.2f / %1.2f %%)", n.nBytesReceived / 1024.0f, n.nBytesSent / 1024.0f, 100.0f * n.nBytesReceived / n.nCompressionIn, 100.0f * n.nBytesSent / n.nCompressionOut ); case 5: return QString().sprintf("%u - %u", n.nPacketsIn, n.nPacketsOut); case 6: return TypeToString(n.nType); case 7: if( n.nType == G2_HUB ) { return QString().sprintf("%u / %u", n.nLeafCount, n.nLeafMax); } else return QString(); case 8: return QString().sprintf("%u msec", n.nRTT); case 9: return n.sUserAgent; case 10: return n.sCountry; } } else if( role == Qt::ForegroundRole ) { if( m_lNodes.at(index.row()).nState == nsConnected ) return skinSettings.neighborsColorConnected; else return skinSettings.neighborsColorConnecting; } return QVariant(); }
LRESULT CGameManageDlg::WindowProc(UINT message, WPARAM wParam, LPARAM lParam) { // TODO: 在此添加专用代码和/或调用基类 switch (message) { case MSG_CMD_SHOW_GAMEROOM: { if (wParam == 0) { ShowGameDesk(); ShowGameUeser(); } else if (wParam == 1) { int _Index = m_wSocket.m_UserManage.GetIndexByUserID(lParam); if (_Index != -1) { m_GameUeserListCtrl.SetItemText(_Index, 2, StateToString(m_wSocket.m_UserManage.FindOnLineUserByIndex(_Index)->GameUserInfo.bUserState)); } } else if (wParam == 2) { int _Index = m_wSocket.m_UserManage.GetIndexByUserID(lParam); if (_Index != -1) { CString s; s.Format("%.3d", m_wSocket.m_UserManage.FindOnLineUserByIndex(_Index)->GameUserInfo.dwUserID); int r = m_GameUeserListCtrl.InsertItem(_Index, s); m_GameUeserListCtrl.SetItemText(r, 1, m_wSocket.m_UserManage.FindOnLineUserByIndex(_Index)->GameUserInfo.nickName); m_GameUeserListCtrl.SetItemText(r, 2, StateToString(m_wSocket.m_UserManage.FindOnLineUserByIndex(_Index)->GameUserInfo.bUserState)); if (m_wSocket.m_UserManage.FindOnLineUserByIndex(_Index)->GameUserInfo.bDeskNO != 255) s.Format("%.3d", m_wSocket.m_UserManage.FindOnLineUserByIndex(_Index)->GameUserInfo.bDeskNO + 1); else s = ""; m_GameUeserListCtrl.SetItemText(r, 3, s); } } else if (wParam == 3) { m_GameUeserListCtrl.DeleteItem(lParam); } break; } case MSG_CMD_SHOW_GAMEDESKSTATE: { ShowGameDeskStation(); break; } case MSG_CMD_BACKWLOGIN: { m_BwSocket.SendOpera(m_BackOpera); break; } case MSG_CMD_GM_ALLLOCKOK: { m_wSocket.LockDesk(m_pLogonInfo->dwUserID, *((int*)wParam), *((int*)lParam), 1); break; } case MSG_CMD_GM_ALLUNLOCKOK: { m_wSocket.LockDesk(m_pLogonInfo->dwUserID, *((int*)wParam), *((int*)lParam), 2); break; } } return CDialog::WindowProc(message, wParam, lParam); }