summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swift/Controllers/Chat/MUCController.cpp')
-rw-r--r--Swift/Controllers/Chat/MUCController.cpp14
1 files changed, 13 insertions, 1 deletions
diff --git a/Swift/Controllers/Chat/MUCController.cpp b/Swift/Controllers/Chat/MUCController.cpp
index 3d04b34..94fd142 100644
--- a/Swift/Controllers/Chat/MUCController.cpp
+++ b/Swift/Controllers/Chat/MUCController.cpp
@@ -28,18 +28,19 @@
#include <Swift/Controllers/Roster/ContactRosterItem.h>
#include <Swiften/Avatars/AvatarManager.h>
#include <Swiften/Elements/Delay.h>
#include <Swiften/MUC/MUC.h>
#include <Swiften/Client/StanzaChannel.h>
#include <Swift/Controllers/Roster/Roster.h>
#include <Swift/Controllers/Roster/SetAvatar.h>
#include <Swift/Controllers/Roster/SetPresence.h>
#include <Swiften/Disco/EntityCapsProvider.h>
+#include <Swiften/Roster/XMPPRoster.h>
#define MUC_JOIN_WARNING_TIMEOUT_MILLISECONDS 60000
namespace Swift {
/**
* The controller does not gain ownership of the stanzaChannel, nor the factory.
*/
@@ -51,27 +52,29 @@ MUCController::MUCController (
StanzaChannel* stanzaChannel,
IQRouter* iqRouter,
ChatWindowFactory* chatWindowFactory,
PresenceOracle* presenceOracle,
AvatarManager* avatarManager,
UIEventStream* uiEventStream,
bool useDelayForLatency,
TimerFactory* timerFactory,
EventController* eventController,
- EntityCapsProvider* entityCapsProvider) :
+ EntityCapsProvider* entityCapsProvider,
+ XMPPRoster* roster) :
ChatControllerBase(self, stanzaChannel, iqRouter, chatWindowFactory, muc->getJID(), presenceOracle, avatarManager, useDelayForLatency, uiEventStream, eventController, timerFactory, entityCapsProvider), muc_(muc), nick_(nick), desiredNick_(nick), password_(password) {
parting_ = true;
joined_ = false;
lastWasPresence_ = false;
shouldJoinOnReconnect_ = true;
doneGettingHistory_ = false;
events_ = uiEventStream;
inviteWindow_ = NULL;
+ xmppRoster_ = roster;
roster_ = new Roster(false, true);
completer_ = new TabComplete();
chatWindow_->setRosterModel(roster_);
chatWindow_->setTabComplete(completer_);
chatWindow_->setName(muc->getJID().getNode());
chatWindow_->onClosed.connect(boost::bind(&MUCController::handleWindowClosed, this));
chatWindow_->onOccupantSelectionChanged.connect(boost::bind(&MUCController::handleWindowOccupantSelectionChanged, this, _1));
chatWindow_->onOccupantActionSelected.connect(boost::bind(&MUCController::handleActionRequestedOnOccupant, this, _1, _2));
@@ -721,18 +724,27 @@ void MUCController::handleDestroyRoomRequest() {
muc_->destroyRoom();
}
void MUCController::handleInvitePersonToThisMUCRequest() {
if (!inviteWindow_) {
inviteWindow_ = chatWindow_->createInviteToChatWindow();
inviteWindow_->onCompleted.connect(boost::bind(&MUCController::handleInviteToMUCWindowCompleted, this));
inviteWindow_->onDismissed.connect(boost::bind(&MUCController::handleInviteToMUCWindowDismissed, this));
}
+ std::vector<std::pair<JID, std::string> > autoCompletes;
+ foreach (XMPPRosterItem item, xmppRoster_->getItems()) {
+ std::pair<JID, std::string> jidName;
+ jidName.first = item.getJID();
+ jidName.second = item.getName();
+ autoCompletes.push_back(jidName);
+ std::cerr << "MUCController adding " << item.getJID().toString() << std::endl;
+ }
+ inviteWindow_->setAutoCompletions(autoCompletes);
}
void MUCController::handleInviteToMUCWindowDismissed() {
inviteWindow_= NULL;
}
void MUCController::handleInviteToMUCWindowCompleted() {
foreach (const JID& jid, inviteWindow_->getJIDs()) {
muc_->invitePerson(jid, inviteWindow_->getReason());