diff options
author | Olli Salli <ollisal@gmail.com> | 2010-12-31 12:26:21 +0200 |
---|---|---|
committer | Olli Salli <ollisal@gmail.com> | 2010-12-31 16:35:01 +0200 |
commit | b8cd97e01ef22990c731dd7df4cda2a4ce28e90d (patch) | |
tree | 6c1a29a64f022ddc70a13d4628f37f1f62573bdf | |
parent | 37b8e3197c7455c79df6d83810bfdc2e612bc5a1 (diff) |
Make requestLeave early-succeed if already left
-rw-r--r-- | TelepathyQt4/channel.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/TelepathyQt4/channel.cpp b/TelepathyQt4/channel.cpp index a8c815c6..3f75987c 100644 --- a/TelepathyQt4/channel.cpp +++ b/TelepathyQt4/channel.cpp @@ -1570,6 +1570,9 @@ PendingOperation *Channel::requestClose() * if supported, which is indicated by ChannelGroupFlagMessageDepart and/or * ChannelGroupFlagMessageReject. * + * Attempting to leave again when we have already left, either by our request or forcibly, will be a + * no-op, with the returned PendingOperation immediately finishing successfully. + * * \param message The message, which can be blank if desired. * \param reason A reason for leaving. * \return A PendingOperation, which will emit PendingOperation::finished @@ -1593,6 +1596,12 @@ PendingOperation *Channel::requestLeave(const QString &message, ChannelGroupChan return requestClose(); } + if (mPriv->groupSelfContactRemoveInfo.isValid()) { + debug() << "Channel::requestLeave() called for " << objectPath() << + "which has already been left"; + return new PendingSuccess(ChannelPtr(this)); + } + // TODO: use PendingLeave which handles errors correctly by falling back to Close return new PendingVoid(mPriv->group->RemoveMembersWithReason( UIntList() << mPriv->groupSelfHandle, @@ -2090,7 +2099,7 @@ Channel::GroupMemberChangeDetails Channel::groupLocalPendingContactChangeInfo( * the user hasn't been removed from the group, an object for which * GroupMemberChangeDetails::isValid() Return <code>false</code> is returned. * - * This method should be called only after the channel has been closed. + * This method should be called only after you've left the channel. * This is useful for getting the remove information after missing the * corresponding groupMembersChanged() signal, as the local user being * removed usually causes the remote Channel to be closed. |