void YaPrivacyManager::listReceived(const PrivacyList& list)
{
	QStringList previouslyBlockedContacts = blockedContacts();

	if (lists_.contains(list.name()))
		*lists_[list.name()] = list;
	else
		lists_[list.name()] = new PrivacyList(list);

	if (list.name() == BLOCKED_LIST_NAME)
		invalidateBlockedListCache();

	QStringList currentlyBlockedContacts = blockedContacts();
	QStringList updatedContacts;
	updatedContacts += findDifferences(previouslyBlockedContacts, currentlyBlockedContacts);
	updatedContacts += findDifferences(currentlyBlockedContacts, previouslyBlockedContacts);

	foreach(QString contact, updatedContacts) {
		emit simulateContactOffline(contact);

		if (!isContactBlocked(contact)) {
			if (isAuthorized(contact)) {
				JT_Presence* p = new JT_Presence(account_->client()->rootTask());
				p->pres(processJid(contact), account_->status());
				p->go(true);
			}

			{
				JT_Presence* p = new JT_Presence(account_->client()->rootTask());
				p->probe(processJid(contact));
				p->go(true);
			}
		}
	}
Beispiel #2
0
void PrivacyDlg::refreshList(const PrivacyList& list)
{
	if (list.name() == ui_.cb_lists->currentText()) {
		rememberSettings();
		model_.setList(list);
		setWidgetsEnabled(true);
	}
}
void PrivacyManager::getDefault_listReceived ( const PrivacyList& l )
{
	if ( l.name() == getDefault_default_ && getDefault_waiting_ ) {
		disconnect ( this,SIGNAL (listReceived(PrivacyList)),this,SLOT (getDefault_listReceived(PrivacyList)) );
		disconnect ( this,SIGNAL (listError()),this,SLOT (getDefault_listError()) );
		getDefault_waiting_ = false;
		emit defaultListAvailable ( l );
	}
}
Beispiel #4
0
void PrivacyDlg::renameList()
{
	QString newName = QInputDialog::getText(this, tr("Rename List"), tr("Input new name"));
	if(newName.isEmpty()) {
		return;
	}
	PrivacyList tmp = model_.list();
	model_.list().setName(newName);
	tmp.clear();
	manager_->changeList(model_.list());
	if(ui_.cb_default->currentText() == tmp.name()) {
		manager_->changeDefaultList(newName);
	}
	if(ui_.cb_active->currentText() == tmp.name()) {
		manager_->changeActiveList(newName);
	}
	manager_->changeList(tmp);
	manager_->requestListNames();
}
void MockPrivacyManager::changeList(const PrivacyList& list)
{
	qDebug() << "changeList(" << list.name() << ")";
}