aboutsummaryrefslogtreecommitdiff
path: root/src/QXmppRosterManager.cpp
diff options
context:
space:
mode:
authorJeremy Lainé <jeremy.laine@m4x.org>2011-04-29 08:46:28 +0000
committerJeremy Lainé <jeremy.laine@m4x.org>2011-04-29 08:46:28 +0000
commitac74e91fc474785391b6be798f527dc3daf2f502 (patch)
treef48310ece3d60a813e5706ef910745c5207aee3a /src/QXmppRosterManager.cpp
parent94cf9be3c80a80a098c7d9eca931af5e533f3c69 (diff)
downloadqxmpp-ac74e91fc474785391b6be798f527dc3daf2f502.tar.gz
* add QXmppRosterManager::itemAdded() and itemChanged()
* deprecate QXmppRosterManager::rosterChanged()
Diffstat (limited to 'src/QXmppRosterManager.cpp')
-rw-r--r--src/QXmppRosterManager.cpp16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/QXmppRosterManager.cpp b/src/QXmppRosterManager.cpp
index fd948e99..92b150ea 100644
--- a/src/QXmppRosterManager.cpp
+++ b/src/QXmppRosterManager.cpp
@@ -163,12 +163,22 @@ void QXmppRosterManager::rosterIqReceived(const QXmppRosterIq& rosterIq)
foreach (const QXmppRosterIq::Item &item, items) {
const QString bareJid = item.bareJid();
if (item.subscriptionType() == QXmppRosterIq::Item::Remove) {
- // notify the user that the item was removed if we previously had it
- if (m_entries.remove(bareJid))
+ if (m_entries.remove(bareJid)) {
+ // notify the user that the item was removed
emit itemRemoved(bareJid);
+ }
} else {
- // notify the user that the item changed
+ const bool added = !m_entries.contains(bareJid);
m_entries.insert(bareJid, item);
+ if (added) {
+ // notify the user that the item was added
+ emit itemAdded(bareJid);
+ } else {
+ // notify the user that the item changed
+ emit itemChanged(bareJid);
+ }
+
+ // FIXME: remove legacy signal
emit rosterChanged(bareJid);
}
}