Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Retrieve Participant List, Send Message to Channel and Real JID lookup of participants proxy JID #89

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
487 changes: 487 additions & 0 deletions Limber/MIXMockServer.cpp

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions Limber/SConscript
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ elif env["SCONS_STAGE"] == "build" :
myenv.UseFlags(env["LIMBER_FLAGS"])
myenv.UseFlags(env["SWIFTEN_FLAGS"])
myenv.UseFlags(env["SWIFTEN_DEP_FLAGS"])
myenv.Program("MIXMockServer", ["MIXMockServer.cpp"])
myenv.Program("limber", ["main.cpp"])

env.Append(UNITTEST_SOURCES = [
Expand Down
9 changes: 7 additions & 2 deletions Swiften/Client/Client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include <Swiften/Disco/EntityCapsManager.h>
#include <Swiften/FileTransfer/FileTransferManagerImpl.h>
#include <Swiften/Jingle/JingleSessionManager.h>
#include <Swiften/MIX/MIXRegistry.h>
#include <Swiften/MUC/MUCManager.h>
#include <Swiften/MUC/MUCRegistry.h>
#include <Swiften/Network/NetworkFactories.h>
Expand Down Expand Up @@ -58,6 +59,8 @@ Client::Client(const JID& jid, const SafeString& password, NetworkFactories* net
directedPresenceSender = new DirectedPresenceSender(stanzaChannelPresenceSender);
discoManager = new ClientDiscoManager(getIQRouter(), directedPresenceSender, networkFactories->getCryptoProvider());

mixRegistry = std::make_unique<MIXRegistry>(getJID(), getIQRouter(), getRoster(), getStanzaChannel());

mucRegistry = new MUCRegistry();
mucManager = new MUCManager(getStanzaChannel(), getIQRouter(), directedPresenceSender, mucRegistry);

Expand Down Expand Up @@ -118,6 +121,8 @@ Client::~Client() {
delete avatarManager;
delete vcardManager;

mixRegistry.reset();

delete mucManager;
delete mucRegistry;

Expand Down Expand Up @@ -148,13 +153,13 @@ void Client::handleConnected() {
discoManager->handleConnected();
}

void Client::requestRoster() {
void Client::requestRoster(bool includeMIX) {
// FIXME: We should set this once when the session is finished, but there
// is currently no callback for this
if (getSession()) {
rosterController->setUseVersioning(getSession()->getRosterVersioningSupported());
}
rosterController->requestRoster();
rosterController->requestRoster(includeMIX);
}

Presence::ref Client::getLastPresence(const JID& jid) const {
Expand Down
8 changes: 7 additions & 1 deletion Swiften/Client/Client.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ namespace Swift {
class FileTransferManager;
class FileTransferManager;
class JingleSessionManager;
class MIXRegistry;
class MUCManager;
class MUCRegistry;
class MemoryStorages;
Expand Down Expand Up @@ -93,7 +94,7 @@ namespace Swift {
*
* \see getRoster()
*/
void requestRoster();
void requestRoster(bool includeMIX = false);

/**
* Returns the last received presence for the given (full) JID.
Expand All @@ -111,6 +112,10 @@ namespace Swift {

PresenceSender* getPresenceSender() const;

MIXRegistry* getMIXRegistry() const {
return mixRegistry.get();
}

MUCManager* getMUCManager() const {
return mucManager;
}
Expand Down Expand Up @@ -191,6 +196,7 @@ namespace Swift {
PresenceOracle* presenceOracle;
DirectedPresenceSender* directedPresenceSender;
StanzaChannelPresenceSender* stanzaChannelPresenceSender;
std::unique_ptr<MIXRegistry> mixRegistry;
MUCRegistry* mucRegistry;
VCardManager* vcardManager;
AvatarManager* avatarManager;
Expand Down
1 change: 1 addition & 0 deletions Swiften/Elements/DiscoInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ const std::string DiscoInfo::MessageDeliveryReceiptsFeature = std::string("urn:x
const std::string DiscoInfo::WhiteboardFeature = std::string("http://swift.im/whiteboard");
const std::string DiscoInfo::BlockingCommandFeature = std::string("urn:xmpp:blocking");
const std::string DiscoInfo::MessageCarbonsFeature = std::string("urn:xmpp:carbons:2");
const std::string DiscoInfo::MIXFeature = std::string("urn:xmpp:mix:0");

bool DiscoInfo::Identity::operator<(const Identity& other) const {
if (category_ == other.category_) {
Expand Down
1 change: 1 addition & 0 deletions Swiften/Elements/DiscoInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ namespace Swift {
static const std::string WhiteboardFeature;
static const std::string BlockingCommandFeature;
static const std::string MessageCarbonsFeature;
static const std::string MIXFeature;

class Identity {
public:
Expand Down
8 changes: 6 additions & 2 deletions Swiften/Elements/RosterItemPayload.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ namespace Swift {
public:
enum Subscription { None, To, From, Both, Remove };

RosterItemPayload() : subscription_(None), ask_(false) {}
RosterItemPayload(const JID& jid, const std::string& name, Subscription subscription, const std::vector<std::string>& groups = std::vector<std::string>()) : jid_(jid), name_(name), subscription_(subscription), groups_(groups), ask_(false) { }
RosterItemPayload() : subscription_(None), ask_(false), isMIXChannel_(false) {}
RosterItemPayload(const JID& jid, const std::string& name, Subscription subscription, const std::vector<std::string>& groups = std::vector<std::string>()) : jid_(jid), name_(name), subscription_(subscription), groups_(groups), ask_(false) , isMIXChannel_(false) { }

void setJID(const JID& jid) { jid_ = jid; }
const JID& getJID() const { return jid_; }
Expand All @@ -41,12 +41,16 @@ namespace Swift {
unknownContent_ += c;
}

void setMIXChannel(bool isMIXChannel) { isMIXChannel_ = isMIXChannel; }
bool isMIXChannel() const { return isMIXChannel_; }

private:
JID jid_;
std::string name_;
Subscription subscription_;
std::vector<std::string> groups_;
bool ask_;
std::string unknownContent_;
bool isMIXChannel_;
};
}
11 changes: 10 additions & 1 deletion Swiften/Elements/RosterPayload.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ namespace Swift {
typedef std::vector<RosterItemPayload> RosterItemPayloads;

public:
RosterPayload() {}
RosterPayload(bool hasAnnotate = false) : hasAnnotate_(hasAnnotate) {}

boost::optional<RosterItemPayload> getItem(const JID& jid) const;

Expand All @@ -42,7 +42,16 @@ namespace Swift {
version_ = version;
}

bool hasRequestMIXAnnotations() const {
return hasAnnotate_;
}

void setRequestMIXAnnotations(bool hasAnnotate) {
hasAnnotate_ = hasAnnotate;
}

private:
bool hasAnnotate_;
RosterItemPayloads items_;
boost::optional<std::string> version_;
};
Expand Down
Loading