예제 #1
0
void ChatNotifier::notify(Notification *notification)
{
	if (!m_chatWidgetRepository)
		return;

	auto aggregateNotification = qobject_cast<AggregateNotification *>(notification);
	if (!aggregateNotification)
		return;

	auto latestNotification = aggregateNotification->notifications().last();

	auto buddies = BuddySet();
	auto chat = latestNotification->data()["chat"].value<Chat>();
	if (chat)
		buddies = chat.contacts().toBuddySet();

	for (auto chatWidget : m_chatWidgetRepository.data())
		// warning: do not exchange intersect caller and argument, it will modify buddies variable if you do
		if (buddies.isEmpty() || !chatWidget->chat().contacts().toBuddySet().intersect(buddies).isEmpty())
			sendNotificationToChatWidget(latestNotification, chatWidget);
}
예제 #2
0
BuddySet ProxyActionContext::buddies()
{
	return ForwardActionContext
			? ForwardActionContext->buddies()
			: BuddySet();
}