diff options
Diffstat (limited to 'Sluift/SluiftClient.cpp')
-rw-r--r-- | Sluift/SluiftClient.cpp | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/Sluift/SluiftClient.cpp b/Sluift/SluiftClient.cpp index e8c43c9..99892a9 100644 --- a/Sluift/SluiftClient.cpp +++ b/Sluift/SluiftClient.cpp @@ -1,3 +1,3 @@ /* - * Copyright (c) 2013-2017 Isode Limited. + * Copyright (c) 2013-2018 Isode Limited. * All rights reserved. @@ -40,2 +40,5 @@ SluiftClient::SluiftClient( client->getRoster()->onInitialRosterPopulated.connect(boost::bind(&SluiftClient::handleInitialRosterPopulated, this)); + client->getRoster()->onJIDAdded.connect(boost::bind(&SluiftClient::handleIncomingRosterAdd, this, _1)); + client->getRoster()->onJIDRemoved.connect(boost::bind(&SluiftClient::handleIncomingRosterRemove, this, _1)); + client->getRoster()->onJIDUpdated.connect(boost::bind(&SluiftClient::handleIncomingRosterUpdate, this, _1)); client->getClientBlockListManager()->getBlockList()->onItemAdded.connect(boost::bind(&SluiftClient::handleIncomingBlockEvent, this, _1)); @@ -50,2 +53,5 @@ SluiftClient::~SluiftClient() { void SluiftClient::connect() { + if (client->isActive()) { + throw Lua::Exception("Client is already connecting or connected"); + } rosterReceived = false; @@ -191,2 +197,14 @@ void SluiftClient::handleInitialRosterPopulated() { +void SluiftClient::handleIncomingRosterAdd(const JID& item) { + pendingEvents.push_back(Event(item, Event::RosterAddType)); +} + +void SluiftClient::handleIncomingRosterRemove(const JID& item) { + pendingEvents.push_back(Event(item, Event::RosterRemoveType)); +} + +void SluiftClient::handleIncomingRosterUpdate(const JID& item) { + pendingEvents.push_back(Event(item, Event::RosterUpdateType)); +} + void SluiftClient::handleRequestResponse(std::shared_ptr<Payload> response, std::shared_ptr<ErrorPayload> error) { |