~ci-train-bot/history-service/history-service-ubuntu-zesty-2629

« back to all changes in this revision

Viewing changes to tests/common/mock/textchannel.cpp

  • Committer: Bileto Bot
  • Author(s): Gustavo Pichorim Boiko
  • Date: 2016-11-30 15:13:58 UTC
  • mfrom: (230.2.23 staging)
  • Revision ID: ci-train-bot@canonical.com-20161130151358-jy3mqj0ir0b6ncxe
Improve group chat support.

Approved by: Roberto Mier Escandón , Tiago Salem Herrmann

Show diffs side-by-side

added added

removed removed

Lines of Context:
74
74
    baseChannel->plugInterface(Tp::AbstractChannelInterfacePtr::dynamicCast(mMessagesIface));
75
75
 
76
76
    // group stuff
77
 
    mGroupIface = Tp::BaseChannelGroupInterface::create(Tp::ChannelGroupFlagCanAdd, conn->selfHandle());
 
77
    mGroupIface = Tp::BaseChannelGroupInterface::create();
 
78
    mGroupIface->setGroupFlags(Tp::ChannelGroupFlagCanAdd);
 
79
    mGroupIface->setSelfHandle(conn->selfHandle());
78
80
    mGroupIface->setAddMembersCallback(Tp::memFun(this,&MockTextChannel::onAddMembers));
79
81
    mGroupIface->setRemoveMembersCallback(Tp::memFun(this,&MockTextChannel::onRemoveMembers));
80
82
    baseChannel->plugInterface(Tp::AbstractChannelInterfacePtr::dynamicCast(mGroupIface));
232
234
            mMembers << handle;
233
235
        }
234
236
    }
235
 
    mGroupIface->addMembers(handles, recipients);
 
237
    mGroupIface->setMembers(mMembers, QVariantMap());
236
238
}
237
239
 
238
240
QStringList MockTextChannel::recipients() const
250
252
    addMembers(mConnection->inspectHandles(Tp::HandleTypeContact, handles, error));
251
253
}
252
254
 
253
 
void MockTextChannel::onRemoveMembers(const Tp::UIntList &handles, const QString &message, Tp::DBusError *error)
 
255
void MockTextChannel::onRemoveMembers(const Tp::UIntList &handles, const QString &message, uint reason, Tp::DBusError *error)
254
256
{
255
257
    Q_FOREACH(uint handle, handles) {
256
258
        Q_FOREACH(const QString &recipient, mConnection->inspectHandles(Tp::HandleTypeContact, Tp::UIntList() << handle, error)) {
258
260
        }
259
261
        mMembers.removeAll(handle);
260
262
    }
261
 
    mGroupIface->removeMembers(handles);
 
263
    mGroupIface->setMembers(mMembers, QVariantMap());
262
264
}