コード例 #1
0
ファイル: chat-notifier.cpp プロジェクト: leewood/kadu
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();
}