Example #1
0
void BookmarkManager::setBookmarks(const QList<URLBookmark>& urls, const QList<ConferenceBookmark>& conferences)
{
	urls_ = urls;
	conferences_ = conferences;

	QStringList localMucs;
	QList<ConferenceBookmark> remoteMucs;
	QStringList ignoreMucs;

	foreach (const ConferenceBookmark &cb, conferences) {
		if (cb.autoJoin() == ConferenceBookmark::OnlyThisComputer) {
			localMucs.append(cb.jid().withResource(cb.nick()).full());
		} else {
			if (cb.autoJoin() == ConferenceBookmark::ExceptThisComputer) {
				ignoreMucs.append(cb.jid().bare());
			}
			remoteMucs.append(cb);
		}
	}
	account_->setLocalMucBookmarks(localMucs);
	PsiOptions::instance()->setOption("options.muc.bookmarks.ignore-join", ignoreMucs);
	BookmarkTask* t = new BookmarkTask(account_->client()->rootTask());
	connect(t,SIGNAL(finished()),SLOT(setBookmarks_finished()));
	t->set(urls,remoteMucs);
	t->go(true);
}
Example #2
0
void BookmarkManager::getBookmarks()
{
	BookmarkTask* t = new BookmarkTask(account_->client()->rootTask());
	connect(t,SIGNAL(finished()),SLOT(getBookmarks_finished()));
	t->get();
	t->go(true);
}
Example #3
0
void BookmarkManager::setBookmarks(const QList<URLBookmark>& urls, const QList<ConferenceBookmark>& conferences)
{
	urls_ = urls;
	conferences_ = conferences;
	BookmarkTask* t = new BookmarkTask(account_->client()->rootTask());
	connect(t,SIGNAL(finished()),SLOT(setBookmarks_finished()));
	t->set(urls,conferences);
	t->go(true);
}
Example #4
0
void BookmarkManager::getBookmarks_finished()
{
	BookmarkTask* t = static_cast<BookmarkTask*>(sender());
	if (t->success()) {
		bool urlsWereChanged = urls_ != t->urls();
		bool conferencesWereChanged = conferences_ != t->conferences();
		urls_ = t->urls();
		QStringList localMucs = account_->localMucBookmarks();
		conferences_ = t->conferences();
		foreach (const QString &lmuc, localMucs) {
			Jid j(lmuc);
			if (j.isValid()) {
				conferences_.append(ConferenceBookmark(j.node(), Jid(j.bare()),
													   ConferenceBookmark::OnlyThisComputer,
													   j.resource()));
			}
		}
Example #5
0
void BookmarkManager::getBookmarks_finished()
{
	BookmarkTask* t = static_cast<BookmarkTask*>(sender());
	if (t->success()) {
		bool urlsWereChanged = urls_ != t->urls();
		bool conferencesWereChanged = conferences_ != t->conferences();
		urls_ = t->urls();
		conferences_ = t->conferences();

		if (urlsWereChanged)
			emit urlsChanged(urls_);
		if (conferencesWereChanged)
			emit conferencesChanged(conferences_);

		setIsAvailable(true);
	}
	else {
		setIsAvailable(false);
	}
}