diff options
| author | Jeremy Lainé <jeremy.laine@m4x.org> | 2012-02-07 10:01:21 +0000 |
|---|---|---|
| committer | Jeremy Lainé <jeremy.laine@m4x.org> | 2012-02-07 10:01:21 +0000 |
| commit | 8ba49d951bc9b3de467cc2766f9130441099748c (patch) | |
| tree | f4ff79cd28966ba36ec1fdf00d376ecaf62479d5 /src/QXmppRosterManager.cpp | |
| parent | d11e0741bd431c46984a661dd76d487e7d7c59be (diff) | |
| download | qxmpp-8ba49d951bc9b3de467cc2766f9130441099748c.tar.gz | |
add QXmppRosterManager::addItem (fixes issue 95)
Diffstat (limited to 'src/QXmppRosterManager.cpp')
| -rw-r--r-- | src/QXmppRosterManager.cpp | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/src/QXmppRosterManager.cpp b/src/QXmppRosterManager.cpp index b89bdc0a..7c2f56ed 100644 --- a/src/QXmppRosterManager.cpp +++ b/src/QXmppRosterManager.cpp @@ -235,7 +235,30 @@ bool QXmppRosterManager::refuseSubscription(const QString &bareJid) return client()->sendPacket(presence); } -/// Removes a roster entry and cancels subscriptions to and from the contact. +/// Adds a new item to the roster without sending any subscription requests. +/// +/// As a result, the server will initiate a roster push, causing the +/// itemAdded() or itemChanged() signal to be emitted. +/// +/// \param bareJid +/// \param name Optional name for the item. +/// \param groups Optional groups for the item. + +bool QXmppRosterManager::addItem(const QString &bareJid, const QString &name, const QSet<QString> &groups) +{ + QXmppRosterIq::Item item; + item.setBareJid(bareJid); + item.setName(name); + item.setGroups(groups); + item.setSubscriptionType(QXmppRosterIq::Item::NotSet); + + QXmppRosterIq iq; + iq.setType(QXmppIq::Set); + iq.addItem(item); + return client()->sendPacket(iq); +} + +/// Removes a roster item and cancels subscriptions to and from the contact. /// /// As a result, the server will initiate a roster push, causing the /// itemRemoved() signal to be emitted. |
