Set proper resource in MUCs
This commit is contained in:
parent
e312a8602e
commit
196afcf3a3
5 changed files with 9 additions and 5 deletions
|
@ -96,7 +96,7 @@ class NetworkPluginServer {
|
|||
void handleFTDataPayload(Backend *b ,const std::string &payload);
|
||||
|
||||
void handleUserCreated(User *user);
|
||||
void handleRoomJoined(User *user, const std::string &room, const std::string &nickname, const std::string &password);
|
||||
void handleRoomJoined(User *user, const Swift::JID &who, const std::string &room, const std::string &nickname, const std::string &password);
|
||||
void handleRoomLeft(User *user, const std::string &room);
|
||||
void handleUserReadyToConnect(User *user);
|
||||
void handleUserPresenceChanged(User *user, Swift::Presence::ref presence);
|
||||
|
|
|
@ -111,7 +111,7 @@ class User : public Swift::EntityCapsProvider {
|
|||
|
||||
boost::signal<void ()> onReadyToConnect;
|
||||
boost::signal<void (Swift::Presence::ref presence)> onPresenceChanged;
|
||||
boost::signal<void (const std::string &room, const std::string &nickname, const std::string &password)> onRoomJoined;
|
||||
boost::signal<void (const Swift::JID &who, const std::string &room, const std::string &nickname, const std::string &password)> onRoomJoined;
|
||||
boost::signal<void (const std::string &room)> onRoomLeft;
|
||||
boost::signal<void ()> onDisconnected;
|
||||
|
||||
|
|
|
@ -64,6 +64,9 @@ void ConversationManager::removeConversation(Conversation *conv) {
|
|||
|
||||
void ConversationManager::resetResources() {
|
||||
for (std::map<std::string, Conversation *>::const_iterator it = m_convs.begin(); it != m_convs.end(); it++) {
|
||||
if ((*it).second->isMUC()) {
|
||||
continue;
|
||||
}
|
||||
(*it).second->setJID(m_user->getJID().toBare());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -935,7 +935,7 @@ void NetworkPluginServer::handleUserCreated(User *user) {
|
|||
// UserInfo userInfo = user->getUserInfo();
|
||||
user->onReadyToConnect.connect(boost::bind(&NetworkPluginServer::handleUserReadyToConnect, this, user));
|
||||
user->onPresenceChanged.connect(boost::bind(&NetworkPluginServer::handleUserPresenceChanged, this, user, _1));
|
||||
user->onRoomJoined.connect(boost::bind(&NetworkPluginServer::handleRoomJoined, this, user, _1, _2, _3));
|
||||
user->onRoomJoined.connect(boost::bind(&NetworkPluginServer::handleRoomJoined, this, user, _1, _2, _3, _4));
|
||||
user->onRoomLeft.connect(boost::bind(&NetworkPluginServer::handleRoomLeft, this, user, _1));
|
||||
}
|
||||
|
||||
|
@ -991,7 +991,7 @@ void NetworkPluginServer::handleUserPresenceChanged(User *user, Swift::Presence:
|
|||
send(c->connection, message);
|
||||
}
|
||||
|
||||
void NetworkPluginServer::handleRoomJoined(User *user, const std::string &r, const std::string &nickname, const std::string &password) {
|
||||
void NetworkPluginServer::handleRoomJoined(User *user, const Swift::JID &who, const std::string &r, const std::string &nickname, const std::string &password) {
|
||||
UserInfo userInfo = user->getUserInfo();
|
||||
|
||||
pbnetwork::Room room;
|
||||
|
@ -1014,6 +1014,7 @@ void NetworkPluginServer::handleRoomJoined(User *user, const std::string &r, con
|
|||
NetworkConversation *conv = new NetworkConversation(user->getConversationManager(), r, true);
|
||||
conv->onMessageToSend.connect(boost::bind(&NetworkPluginServer::handleMessageReceived, this, _1, _2));
|
||||
conv->setNickname(nickname);
|
||||
conv->setJID(who);
|
||||
}
|
||||
|
||||
void NetworkPluginServer::handleRoomLeft(User *user, const std::string &r) {
|
||||
|
|
|
@ -226,7 +226,7 @@ void User::handlePresence(Swift::Presence::ref presence) {
|
|||
if (presence->getPayload<Swift::MUCPayload>() != NULL) {
|
||||
password = presence->getPayload<Swift::MUCPayload>()->getPassword() ? *presence->getPayload<Swift::MUCPayload>()->getPassword() : "";
|
||||
}
|
||||
onRoomJoined(room, presence->getTo().getResource(), password);
|
||||
onRoomJoined(presence->getFrom(), room, presence->getTo().getResource(), password);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue