Пример #1
0
bool LogCommandParser::OnCommand(const char *command, unsigned numParameters, char **parameterList, TransportInterface *transport, SystemAddress systemAddress, const char *originalString)
{
    (void) originalString;

    if (strcmp(command, "Subscribe")==0)
    {
        unsigned channelIndex;
        if (numParameters==0)
        {
            Subscribe(systemAddress, 0);
            transport->Send(systemAddress, "Subscribed to all channels.\r\n");
        }
        else if (numParameters==1)
        {
            if ((channelIndex=Subscribe(systemAddress, parameterList[0]))!=(unsigned)-1)
            {
                transport->Send(systemAddress, "You are now subscribed to channel %s.\r\n", channelNames[channelIndex]);
            }
            else
            {
                transport->Send(systemAddress, "Cannot find channel %s.\r\n", parameterList[0]);
                PrintChannels(systemAddress, transport);
            }
        }
        else
        {
            transport->Send(systemAddress, "Subscribe takes either 0 or 1 parameters.\r\n");
        }
    }
    else if (strcmp(command, "Unsubscribe")==0)
    {
        unsigned channelIndex;
        if (numParameters==0)
        {
            Unsubscribe(systemAddress, 0);
            transport->Send(systemAddress, "Unsubscribed from all channels.\r\n");
        }
        else if (numParameters==1)
        {
            if ((channelIndex=Unsubscribe(systemAddress, parameterList[0]))!=(unsigned)-1)
            {
                transport->Send(systemAddress, "You are now unsubscribed from channel %s.\r\n", channelNames[channelIndex]);
            }
            else
            {
                transport->Send(systemAddress, "Cannot find channel %s.\r\n", parameterList[0]);
                PrintChannels(systemAddress, transport);
            }
        }
        else
        {
            transport->Send(systemAddress, "Unsubscribe takes either 0 or 1 parameters.\r\n");
        }
    }

    return true;
}
FProfilerClientManager::~FProfilerClientManager()
{
#if STATS
	// Delete all active file writers and remove temporary files.
	for( auto It = ActiveTransfers.CreateIterator(); It; ++It )
	{
		FReceivedFileInfo& ReceivedFileInfo = It.Value();
		
		delete ReceivedFileInfo.FileWriter;
		ReceivedFileInfo.FileWriter = nullptr;

		IFileManager::Get().Delete( *ReceivedFileInfo.DestFilepath );

		UE_LOG(LogProfile, Log, TEXT( "File service-client transfer aborted: %s" ), *It.Key() );
	}

	FTicker::GetCoreTicker().RemoveTicker(MessageDelegateHandle);
	FTicker::GetCoreTicker().RemoveTicker(TickDelegateHandle);

	Unsubscribe();

	if (MessageBus.IsValid())
	{
		MessageBus->OnShutdown().RemoveAll(this);
	}

	LoadConnection = nullptr;
#endif
}
Пример #3
0
QScopeSubscriber::~QScopeSubscriber()
{
	if (the_stream != NULL) {
		ExitStream(true);
		Unsubscribe();
	}
}
void FProfilerClientManager::HandleMessageBusShutdown()
{
#if STATS
	Unsubscribe();

	MessageEndpoint.Reset();
	MessageBus.Reset();
#endif
}
Пример #5
0
UPNPSubscription::~UPNPSubscription()
{
    m_subscriptionLock.lock();
    QList<QString> usns = m_subscriptions.keys();
    while (!usns.isEmpty())
        Unsubscribe(usns.takeLast());
    m_subscriptions.clear();
    m_subscriptionLock.unlock();

    LOG(VB_UPNP, LOG_DEBUG, LOC + "Finished");
}
    /// <summary>
    ///     Called in order to reset this virtual processor root to a completely quiescent state (not running anything).
    /// </summary>
    /// <param name="switchState">
    ///     Indicates the state of the thread proxy that is making the call. The parameter is of type <typeparamref name="SwitchingProxyState"/>.
    /// </param>
    void FreeVirtualProcessorRoot::ResetOnIdle(SwitchingProxyState switchState)
    {
        FreeThreadProxy *pOriginalProxy = static_cast<FreeThreadProxy *>(m_pExecutingProxy);

        LONG newVal = InterlockedDecrement(&m_activationFence);
        if (newVal <= 0)
        {
            //
            // The value could be -1 if we raced with the virtual processor root being removed on a different thread.
            //
            ASSERT(newVal >= -1);
            //
            // The fence going down to zero arbitrates between a possible reset/remove race.
            //
            if (newVal == 0)
                Unsubscribe();

            m_pExecutingProxy = NULL;

            //
            // *** READ THIS ***:
            //
            // It is imperative on this path that once m_pExecutingProxy has been set to NULL, nothing touches the this pointer.  We are the race
            // resolution between a client getting off a vproc and removing it.  There can be a race between removal (DeleteThis) from outside and
            // a SwitchOut (here) on the vproc.
            //
            if (switchState == Blocking)
            {
                pOriginalProxy->SuspendExecution();
            }
        }
        else
        {
            Concurrency::IExecutionContext *pActivatedContext = AcquireActivatedContext();
            ASSERT(newVal == 1 && pActivatedContext != NULL);

            //
            // This means we had a race between an Activate and an Idling (via either SwitchOut or return from dispatch loop).  In either
            // of these cases, we stashed away the context which was activated in m_pActivatedContext.  This context now needs to run atop us.
            //
            FreeThreadProxy *pProxy = static_cast<FreeThreadProxy *> (pActivatedContext->GetProxy());
            ASSERT(pProxy != NULL);

            //
            // While it is safe to run through an X->X context switch after the blocked flag is set, there is no point.  If we raced a SwitchOut/Activate
            // for the same proxy on the same vproc, it's a NOP.
            //
            if (pOriginalProxy != pProxy)
            {
                pOriginalProxy->SwitchTo(pActivatedContext, switchState);
            }
        }
    }
ObserverComponent::~ObserverComponent()
{
	for(size_t i = 0; i < EGE_END; ++i)
	{
		delete m_pAction[i];
	}

	for(size_t i = 0; i < m_pEventSystems.size(); ++i)
	{
		Unsubscribe(*m_pEventSystems[i]);
	}
}
Пример #8
0
/**
   \details Test the RegisterNotification (0x29) operation

   This function:
   -# 

   \param mt pointer on the top-level mapitest structure

   \return true on success, otherwise false
 */
_PUBLIC_ bool mapitest_oxcnotif_RegisterNotification(struct mapitest *mt)
{
	enum MAPISTATUS		retval;
	bool			ret;
	mapi_object_t		obj_store;
	mapi_object_t		obj_folder;
	struct mapi_session	*session;
	uint32_t tcon;

	/* Step 1. Logon */
	mapi_object_init(&obj_store);
	retval = OpenMsgStore(mt->session, &obj_store);
	mapitest_print_retval(mt, "OpenMsgStore");
	if (retval != MAPI_E_SUCCESS) {
		return false;
	}
	
	/* Step 2. Open Inbox folder */
	mapi_object_init(&obj_folder);
	ret = mapitest_common_folder_open(mt, &obj_store, &obj_folder, olFolderInbox);
	if (!ret) {
		return ret;
	}

	/* Step 3. Register notification */
	session = mapi_object_get_session(&obj_store);
	retval = RegisterNotification(session);
	mapitest_print_retval(mt, "RegisterNotification");
	if ( retval != MAPI_E_SUCCESS) {
		return false;
	}

	/* Step 4. Subscribe for notifications */
	retval = Subscribe(&obj_store, &tcon, fnevObjectCopied, true, cb, NULL);
	mapitest_print_retval(mt, "Subscribe");
	if (retval != MAPI_E_SUCCESS) {
		return false;
	}

	/* Step 5. Unsubscribe for notifications */
	retval = Unsubscribe(mt->session, tcon);
	mapitest_print_retval(mt, "Unsubscribe");
	if (retval != MAPI_E_SUCCESS) {
		return false;
	}

	/* Step 6. Cleanup */
	mapi_object_release(&obj_folder);
	mapi_object_release(&obj_store);

	return true;
}
Пример #9
0
Subscription& Subscription::operator=(Subscription&& other) {
  if (this != &other) {
    // remove the existing subscription
    Unsubscribe();

    m_isSubscribed = other.m_isSubscribed;
    m_unsubscribeCallback = other.m_unsubscribeCallback;

    other.m_isSubscribed = false;
    other.m_unsubscribeCallback = nullptr;
  }

  return *this;
}
Пример #10
0
    /// <summary>
    ///     Causes the thread proxy running atop this virtual processor root to temporarily stop dispatching pContext.
    /// </summary>
    /// <param name="pContext">
    ///     The context which should temporarily stop being dispatched by the thread proxy running atop this virtual processor root.
    /// </param>
    bool FreeVirtualProcessorRoot::Deactivate(Concurrency::IExecutionContext *pContext)
    {
        if (pContext == NULL)
            throw std::invalid_argument("pContext");

        if (m_pExecutingProxy == NULL)
            throw invalid_operation();

        FreeThreadProxy * pProxy = static_cast<FreeThreadProxy *> (pContext->GetProxy());

        if (m_pExecutingProxy != pProxy)
        {
            throw invalid_operation();
        }

        LONG newVal = InterlockedDecrement(&m_activationFence);

        if (newVal == 0)
        {
            //
            // Reduce the subscription level on the core while the root is suspended. The count is used by dynamic resource management
            // to tell which cores allocated to a scheduler are unused, so that they can be temporarily repurposed.
            //
            InterlockedExchangePointer(reinterpret_cast<void * volatile *>(&m_pDeactivatedProxy), m_pExecutingProxy);
            Unsubscribe();
            pProxy->SuspendExecution();
        }
        else
        {
            //
            // There should be no Deactivate/Remove races.
            //
            ASSERT(newVal == 1);

            Concurrency::IExecutionContext *pActivatedContext = AcquireActivatedContext();

            //
            // If we got here, it means while activated we saw an activation of pCtxX and a subsequent deactivation of pCtxY.  These contexts
            // must be equal to be spec legal.
            //
            ASSERT(pActivatedContext == pContext);

            //
            // The activation for this deactivation came in early, so we return early here without making a kernel transition.
            //
        }

        return true;
    }
Пример #11
0
void QScopeSubscriber::Enter(BAbstractBufferStream *stream)
{
	// Leave old stream
	if (the_stream != NULL) {
		ExitStream(true);
		Unsubscribe();
		the_stream = NULL;
	}

	// Subscribe to new stream
	if (Subscribe(stream) == B_NO_ERROR) {
		EnterStream(NULL, false, this, stream_func, NULL, true);
		the_stream = stream;
	}
}
Пример #12
0
void Opal::Sip::EndPoint::OnRegistered (const PString & _aor,
                                        bool was_registering)
{
  std::string aor = (const char *) _aor;
  std::string::size_type found;
  std::string::size_type loc = aor.find ("@", 0);
  std::string server;
  std::stringstream strm;

  if (aor.find (uri_prefix) == std::string::npos) 
    strm << uri_prefix << aor;
  else
    strm << aor;

  std::list<std::string>::iterator it = find (aors.begin (), aors.end (), aor);

  if (was_registering) {

    if (it == aors.end ())
      aors.push_back (strm.str ());
  }
  else {

    if (it != aors.end ())
      aors.remove (strm.str ());
  }

  if (loc != string::npos) {

    server = aor.substr (loc+1);

    if (server.empty ())
      return;

    if (was_registering && std::find (domains.begin (), domains.end (), server) == domains.end ()) 
      domains.push_back (server);

    if (!was_registering && std::find (domains.begin (), domains.end (), server) != domains.end ()) 
      domains.remove (server);

    if (was_registering) {
      for (std::list<std::string>::const_iterator iter = to_subscribe_uris.begin (); 
           iter != to_subscribe_uris.end () ; ) { 

        found = (*iter).find (server, 0);
        if (found != string::npos) {

          Subscribe (SIPSubscribe::Presence, 300, PString ((*iter).c_str ()));
          subscribed_uris.push_back (*iter);
          to_subscribe_uris.remove (*iter++);
        }
        else
          ++iter;
      }
    }
    else {
      for (std::list<std::string>::const_iterator iter = subscribed_uris.begin (); 
           iter != subscribed_uris.end () ; ) { 

        found = (*iter).find (server, 0);
        if (found != string::npos) {

          Unsubscribe (SIPSubscribe::Presence, PString ((*iter).c_str ()));
          to_subscribe_uris.push_back (*iter);
          subscribed_uris.remove (*iter++);
        }
        else
          iter++;
      }
    }
  }

  /* Subscribe for MWI */
  if (!IsSubscribed (SIPSubscribe::MessageSummary, aor))
    Subscribe (SIPSubscribe::MessageSummary, 3600, aor);

  /* Signal */
  Ekiga::Account *account = account_core.find_account (strm.str ());
  if (account)
    runtime.run_in_main (sigc::bind (account->registration_event.make_slot (),
                                     was_registering ? Ekiga::AccountCore::Registered : Ekiga::AccountCore::Unregistered,
                                     std::string ()));
}
Пример #13
0
Subscription::~Subscription() { Unsubscribe(); }
Пример #14
0
 Observer::~Observer(void)
 {
     Unsubscribe();
 }
Пример #15
0
 void Observer::Unsubscribe()
 {
     Unsubscribe(OBSERVER_PRIORITY_ANY);
 }
Пример #16
0
void MessageManager::Unsubscribe( IMessageSubscriber* pSubscriber, MessageID m )
{
	Unsubscribe( pSubscriber, MessageIDToString(m) );
}
Пример #17
0
	TLClient_WM::~TLClient_WM()
	{
		Unsubscribe();
		Disconnect();
	}
Пример #18
0
void
TBarApp::MessageReceived(BMessage* message)
{
	switch (message->what) {
		case 'gloc':
		case 'sloc':
		case 'gexp':
		case 'sexp':
		case 'info':
		case 'exst':
		case 'cwnt':
		case 'icon':
		case 'remv':
		case 'adon':
			// pass any BDeskbar originating messages on to the window
			fBarWindow->PostMessage(message);
			break;

		case kConfigShow:
			ShowPreferencesWindow();
			break;

		case kStateChanged:
			fPreferencesWindow->PostMessage(kStateChanged);
			break;

		case kShowBeMenu:
			if (fBarWindow->Lock()) {
				fBarWindow->ShowBeMenu();
				fBarWindow->Unlock();
			}
			break;

		case kShowTeamMenu:
			if (fBarWindow->Lock()) {
				fBarWindow->ShowTeamMenu();
				fBarWindow->Unlock();
			}
			break;

		case kUpdateRecentCounts:
			int32 count;
			bool enabled;

			if (message->FindInt32("applications", &count) == B_OK)
				fSettings.recentAppsCount = count;
			if (message->FindBool("applicationsEnabled", &enabled) == B_OK)
				fSettings.recentAppsEnabled = enabled && count > 0;

			if (message->FindInt32("folders", &count) == B_OK)
				fSettings.recentFoldersCount = count;
			if (message->FindBool("foldersEnabled", &enabled) == B_OK)
				fSettings.recentFoldersEnabled = enabled && count > 0;

			if (message->FindInt32("documents", &count) == B_OK)
				fSettings.recentDocsCount = count;
			if (message->FindBool("documentsEnabled", &enabled) == B_OK)
				fSettings.recentDocsEnabled = enabled && count > 0;
			break;

		case kConfigClose:
			fPreferencesWindow = NULL;
			break;

		case B_SOME_APP_LAUNCHED:
		{
			team_id team = -1;
			message->FindInt32("be:team", &team);

			uint32 flags = 0;
			message->FindInt32("be:flags", (long*)&flags);

			const char* sig = NULL;
			message->FindString("be:signature", &sig);

			entry_ref ref;
			message->FindRef("be:ref", &ref);

			AddTeam(team, flags, sig, &ref);
			break;
		}

		case B_SOME_APP_QUIT:
		{
			team_id team = -1;
			message->FindInt32("be:team", &team);
			RemoveTeam(team);
			break;
		}

		case B_ARCHIVED_OBJECT:
			// TODO: what's this???
			message->AddString("special", "Alex Osadzinski");
			fStatusViewMessenger.SendMessage(message);
			break;

		case kToggleDraggers:
			if (BDragger::AreDraggersDrawn())
				BDragger::HideAllDraggers();
			else
				BDragger::ShowAllDraggers();
			break;

		case kAlwaysTop:
			fSettings.alwaysOnTop = !fSettings.alwaysOnTop;
			fBarWindow->SetFeel(fSettings.alwaysOnTop ?
				B_FLOATING_ALL_WINDOW_FEEL : B_NORMAL_WINDOW_FEEL);
			fPreferencesWindow->PostMessage(kStateChanged);
			break;

		case kAutoRaise:
			fSettings.autoRaise = fSettings.alwaysOnTop ? false :
				!fSettings.autoRaise;

			fBarWindow->Lock();
			BarView()->UpdateEventMask();
			fBarWindow->Unlock();
			break;

		case kAutoHide:
			fSettings.autoHide = !fSettings.autoHide;

			fBarWindow->Lock();
			BarView()->UpdateEventMask();
			BarView()->HideDeskbar(fSettings.autoHide);
			fBarWindow->Unlock();
			break;
			
		case kTrackerFirst:
			fSettings.trackerAlwaysFirst = !fSettings.trackerAlwaysFirst;

			fBarWindow->Lock();
			BarView()->UpdatePlacement();
			fBarWindow->Unlock();
			break;

		case kSortRunningApps:
			fSettings.sortRunningApps = !fSettings.sortRunningApps;

			fBarWindow->Lock();
			BarView()->UpdatePlacement();
			fBarWindow->Unlock();
			break;

		case kUnsubscribe:
		{
			BMessenger messenger;
			if (message->FindMessenger("messenger", &messenger) == B_OK)
				Unsubscribe(messenger);
			break;
		}

		case kSuperExpando:
			fSettings.superExpando = !fSettings.superExpando;

			fBarWindow->Lock();
			BarView()->UpdatePlacement();
			fBarWindow->Unlock();
			break;

		case kExpandNewTeams:
			fSettings.expandNewTeams = !fSettings.expandNewTeams;

			fBarWindow->Lock();
			BarView()->UpdatePlacement();
			fBarWindow->Unlock();
			break;

		case 'TASK':
			fSwitcherMessenger.SendMessage(message);
			break;

		case kSuspendSystem:
			// TODO: Call BRoster?
			break;

		case kRebootSystem:
		case kShutdownSystem:
		{
			bool reboot = (message->what == kRebootSystem);
			bool confirm;
			message->FindBool("confirm", &confirm);

			BRoster roster;
			BRoster::Private rosterPrivate(roster);
			status_t error = rosterPrivate.ShutDown(reboot, confirm, false);
			if (error != B_OK)
				fprintf(stderr, "Shutdown failed: %s\n", strerror(error));

			break;
		}

		case kShowSplash:
			run_be_about();
			break;

		case kRestartTracker:
		{
			BRoster roster;
			roster.Launch(kTrackerSignature);
			break;
		}

		case B_LOCALE_CHANGED:
		{
			BLocaleRoster::Default()->Refresh();

			bool localize;
			if (message->FindBool("filesys", &localize) == B_OK)
				gLocalizedNamePreferred = localize;

			BMessenger(fBarWindow->FindView("_deskbar_tv_")).SendMessage(
				message);
				// Notify the TimeView that the format has changed and it should
				// recompute its size
			break;
		}

		default:
			BApplication::MessageReceived(message);
			break;
	}
}
Пример #19
0
void LogCommandParser::OnConnectionLost(SystemAddress systemAddress, TransportInterface *transport)
{
    (void) transport;
    Unsubscribe(systemAddress, 0);
}
PrioritizedObserverContainer::~PrioritizedObserverContainer(void)
{
    Unsubscribe();
}
Пример #21
0
void
TBarApp::MessageReceived(BMessage* message)
{
	switch (message->what) {
		case 'gloc':
		case 'sloc':
		case 'gexp':
		case 'sexp':
		case 'info':
		case 'exst':
		case 'cwnt':
		case 'icon':
		case 'remv':
		case 'adon':
			// pass any BDeskbar originating messages on to the window
			fBarWindow->PostMessage(message);
			break;

		case kConfigShow:
			ShowPreferencesWindow();
			break;

		case kConfigQuit:
			QuitPreferencesWindow();
			break;

		case kStateChanged:
			if (fPreferencesWindow != NULL)
				fPreferencesWindow->PostMessage(kStateChanged);
			break;

		case kShowDeskbarMenu:
			if (fBarWindow->Lock()) {
				fBarWindow->ShowDeskbarMenu();
				fBarWindow->Unlock();
			}
			break;

		case kShowTeamMenu:
			if (fBarWindow->Lock()) {
				fBarWindow->ShowTeamMenu();
				fBarWindow->Unlock();
			}
			break;

		case kUpdateRecentCounts:
			int32 count;
			bool enabled;

			if (message->FindInt32("applications", &count) == B_OK)
				fSettings.recentAppsCount = count;
			if (message->FindBool("applicationsEnabled", &enabled) == B_OK)
				fSettings.recentAppsEnabled = enabled && count > 0;

			if (message->FindInt32("folders", &count) == B_OK)
				fSettings.recentFoldersCount = count;
			if (message->FindBool("foldersEnabled", &enabled) == B_OK)
				fSettings.recentFoldersEnabled = enabled && count > 0;

			if (message->FindInt32("documents", &count) == B_OK)
				fSettings.recentDocsCount = count;
			if (message->FindBool("documentsEnabled", &enabled) == B_OK)
				fSettings.recentDocsEnabled = enabled && count > 0;

			if (fPreferencesWindow != NULL)
				fPreferencesWindow->PostMessage(kUpdatePreferences);
			break;

		case B_SOME_APP_LAUNCHED:
		{
			team_id team = -1;
			message->FindInt32("be:team", &team);

			uint32 flags = 0;
			message->FindInt32("be:flags", (int32*)&flags);

			const char* signature = NULL;
			message->FindString("be:signature", &signature);

			entry_ref ref;
			message->FindRef("be:ref", &ref);

			AddTeam(team, flags, signature, &ref);
			break;
		}

		case B_SOME_APP_QUIT:
		{
			team_id team = -1;
			message->FindInt32("be:team", &team);
			RemoveTeam(team);
			break;
		}

		case B_ARCHIVED_OBJECT:
			// TODO: what's this???
			message->AddString("special", "Alex Osadzinski");
			fStatusViewMessenger.SendMessage(message);
			break;

		case kToggleDraggers:
			if (BDragger::AreDraggersDrawn())
				BDragger::HideAllDraggers();
			else
				BDragger::ShowAllDraggers();
			break;

		case kAlwaysTop:
			fSettings.alwaysOnTop = !fSettings.alwaysOnTop;

			if (fPreferencesWindow != NULL)
				fPreferencesWindow->PostMessage(kUpdatePreferences);

			fBarWindow->SetFeel(fSettings.alwaysOnTop ? B_FLOATING_ALL_WINDOW_FEEL
				: B_NORMAL_WINDOW_FEEL);
			break;

		case kAutoRaise:
			fSettings.autoRaise = fSettings.alwaysOnTop ? false :
				!fSettings.autoRaise;

			if (fPreferencesWindow != NULL)
				fPreferencesWindow->PostMessage(kUpdatePreferences);
			break;

		case kAutoHide:
			fSettings.autoHide = !fSettings.autoHide;

			if (fPreferencesWindow != NULL)
				fPreferencesWindow->PostMessage(kUpdatePreferences);

			fBarWindow->Lock();
			fBarView->HideDeskbar(fSettings.autoHide);
			fBarWindow->Unlock();
			break;

		case kTrackerFirst:
			fSettings.trackerAlwaysFirst = !fSettings.trackerAlwaysFirst;

			if (fPreferencesWindow != NULL)
				fPreferencesWindow->PostMessage(kUpdatePreferences);

			// if mini mode we don't need to update the view
			if (fBarView->MiniState())
				break;

			fBarWindow->Lock();
			fBarView->SaveExpandedItems();
			fBarView->PlaceApplicationBar();
			fBarWindow->Unlock();
			break;

		case kSortRunningApps:
			fSettings.sortRunningApps = !fSettings.sortRunningApps;

			if (fPreferencesWindow != NULL)
				fPreferencesWindow->PostMessage(kUpdatePreferences);

			// if mini mode we don't need to update the view
			if (fBarView->MiniState())
				break;

			fBarWindow->Lock();
			fBarView->SaveExpandedItems();
			fBarView->PlaceApplicationBar();
			fBarWindow->Unlock();
			break;

		case kUnsubscribe:
		{
			BMessenger messenger;
			if (message->FindMessenger("messenger", &messenger) == B_OK)
				Unsubscribe(messenger);
			break;
		}

		case kSuperExpando:
			fSettings.superExpando = !fSettings.superExpando;

			if (fPreferencesWindow != NULL)
				fPreferencesWindow->PostMessage(kUpdatePreferences);

			// if mini mode we don't need to update the view
			if (fBarView->MiniState())
				break;

			fBarWindow->Lock();
			fBarView->SaveExpandedItems();
			fBarView->PlaceApplicationBar();
			fBarWindow->Unlock();
			break;

		case kExpandNewTeams:
			fSettings.expandNewTeams = !fSettings.expandNewTeams;

			if (fPreferencesWindow != NULL)
				fPreferencesWindow->PostMessage(kUpdatePreferences);

			// if mini mode we don't need to update the view
			if (fBarView->MiniState())
				break;

			fBarWindow->Lock();
			fBarView->SaveExpandedItems();
			fBarView->PlaceApplicationBar();
			fBarWindow->Unlock();
			break;

		case kHideLabels:
			fSettings.hideLabels = !fSettings.hideLabels;

			if (fPreferencesWindow != NULL)
				fPreferencesWindow->PostMessage(kUpdatePreferences);

			// if mini mode we don't need to update the view
			if (fBarView->MiniState())
				break;

			fBarWindow->Lock();
			fBarView->SaveExpandedItems();
			fBarView->PlaceApplicationBar();
			fBarWindow->Unlock();
			break;

		case kResizeTeamIcons:
		{
			int32 oldIconSize = fSettings.iconSize;
			int32 iconSize;
			if (message->FindInt32("be:value", &iconSize) != B_OK)
				break;

			fSettings.iconSize = iconSize * kIconSizeInterval;

			// pin icon size between min and max values
			if (fSettings.iconSize < kMinimumIconSize)
				fSettings.iconSize = kMinimumIconSize;
			else if (fSettings.iconSize > kMaximumIconSize)
				fSettings.iconSize = kMaximumIconSize;

			// don't resize if icon size hasn't changed
			if (fSettings.iconSize == oldIconSize)
				break;

			ResizeTeamIcons();

			if (fPreferencesWindow != NULL)
				fPreferencesWindow->PostMessage(kUpdatePreferences);

			// if mini mode we don't need to update the view
			if (fBarView->MiniState())
				break;

			fBarWindow->Lock();
			fBarView->SaveExpandedItems();
			if (!fBarView->Vertical()) {
				// Must also resize the Deskbar menu and replicant tray in
				// horizontal mode
				fBarView->PlaceDeskbarMenu();
				fBarView->PlaceTray(false, false);
			}
			fBarView->PlaceApplicationBar();
			fBarWindow->Unlock();
			break;
		}

		case 'TASK':
			fSwitcherMessenger.SendMessage(message);
			break;

		case kSuspendSystem:
			// TODO: Call BRoster?
			break;

		case kRebootSystem:
		case kShutdownSystem:
		{
			bool reboot = (message->what == kRebootSystem);
			bool confirm;
			message->FindBool("confirm", &confirm);

			BRoster roster;
			BRoster::Private rosterPrivate(roster);
			status_t error = rosterPrivate.ShutDown(reboot, confirm, false);
			if (error != B_OK)
				fprintf(stderr, "Shutdown failed: %s\n", strerror(error));

			break;
		}

		case kShowSplash:
			run_be_about();
			break;

		case kRestartTracker:
		{
			BRoster roster;
			roster.Launch(kTrackerSignature);
			break;
		}

		case B_LOCALE_CHANGED:
		{
			BLocaleRoster::Default()->Refresh();

			bool localize;
			if (message->FindBool("filesys", &localize) == B_OK)
				gLocalizedNamePreferred = localize;
		}
		// fall-through

		case kShowHideTime:
		case kShowSeconds:
		case kShowDayOfWeek:
		case kShowTimeZone:
		case kGetClockSettings:
			fStatusViewMessenger.SendMessage(message);
				// Notify the replicant tray (through BarView) that the time
				// interval has changed and it should update the time view
				// and reflow the tray icons.
			break;

		default:
			BApplication::MessageReceived(message);
			break;
	}
}
Пример #22
0
void LogCommandParser::OnConnectionLost(PlayerID playerId, TransportInterface *transport)
{
	Unsubscribe(playerId, 0);
}