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,5 +1,5 @@  /* - * Copyright (c) 2013-2017 Isode Limited. + * Copyright (c) 2013-2018 Isode Limited.   * All rights reserved.   * See the COPYING file for more information.   */ @@ -38,6 +38,9 @@ SluiftClient::SluiftClient(      client->onPresenceReceived.connect(boost::bind(&SluiftClient::handleIncomingPresence, this, _1));      client->getPubSubManager()->onEvent.connect(boost::bind(&SluiftClient::handleIncomingPubSubEvent, this, _1, _2));      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));      client->getClientBlockListManager()->getBlockList()->onItemRemoved.connect(boost::bind(&SluiftClient::handleIncomingUnblockEvent, this, _1));  } @@ -48,6 +51,9 @@ SluiftClient::~SluiftClient() {  }  void SluiftClient::connect() { +    if (client->isActive()) { +        throw Lua::Exception("Client is already connecting or connected"); +    }      rosterReceived = false;      blockListReceived = false;      disconnectedError = boost::optional<ClientError>(); @@ -189,6 +195,18 @@ void SluiftClient::handleInitialRosterPopulated() {      rosterReceived = true;  } +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) {      requestResponse = response;      requestError = error; | 
 Swift
 Swift