forked from blue/squawk
minor fixes, form to join MUC
This commit is contained in:
parent
5f8d38bd9a
commit
c295fa1c1d
23 changed files with 385 additions and 34 deletions
|
@ -1002,19 +1002,7 @@ void Core::Account::bookmarksReceived(const QXmppBookmarkSet& bookmarks)
|
|||
QString jid = c.jid();
|
||||
std::map<QString, Conference*>::const_iterator cItr = conferences.find(jid);
|
||||
if (cItr == conferences.end()) {
|
||||
QXmppMucRoom* room = mm->addRoom(jid);
|
||||
QString nick = c.nickName();
|
||||
Conference* conf = new Conference(jid, getName(), c.autoJoin(), c.name(), nick == "" ? getName() : nick, room);
|
||||
conferences.insert(std::make_pair(jid, conf));
|
||||
|
||||
handleNewConference(conf);
|
||||
|
||||
emit addRoom(jid, {
|
||||
{"autoJoin", conf->getAutoJoin()},
|
||||
{"joined", conf->getJoined()},
|
||||
{"nick", conf->getNick()},
|
||||
{"name", conf->getName()}
|
||||
});
|
||||
addNewRoom(jid, c.nickName(), c.name(), c.autoJoin());
|
||||
} else {
|
||||
qDebug() << "Received a bookmark to a MUC " << jid << " which is already booked by another bookmark, skipping";
|
||||
}
|
||||
|
@ -1133,6 +1121,33 @@ void Core::Account::removeRoomRequest(const QString& jid)
|
|||
storeConferences();
|
||||
}
|
||||
|
||||
void Core::Account::addRoomRequest(const QString& jid, const QString& nick, bool autoJoin)
|
||||
void Core::Account::addRoomRequest(const QString& jid, const QString& nick, const QString& password, bool autoJoin)
|
||||
{
|
||||
std::map<QString, Conference*>::const_iterator cItr = conferences.find(jid);
|
||||
if (cItr == conferences.end()) {
|
||||
addNewRoom(jid, nick, "", autoJoin);
|
||||
storeConferences();
|
||||
} else {
|
||||
qDebug() << "An attempt to add a MUC " << jid << " which is already present in the rester, skipping";
|
||||
}
|
||||
}
|
||||
|
||||
void Core::Account::addNewRoom(const QString& jid, const QString& nick, const QString& roomName, bool autoJoin)
|
||||
{
|
||||
QXmppMucRoom* room = mm->addRoom(jid);
|
||||
QString lNick = nick;
|
||||
if (lNick.size() == 0) {
|
||||
lNick = getName();
|
||||
}
|
||||
Conference* conf = new Conference(jid, getName(), autoJoin, roomName, lNick, room);
|
||||
conferences.insert(std::make_pair(jid, conf));
|
||||
|
||||
handleNewConference(conf);
|
||||
|
||||
emit addRoom(jid, {
|
||||
{"autoJoin", conf->getAutoJoin()},
|
||||
{"joined", conf->getJoined()},
|
||||
{"nick", conf->getNick()},
|
||||
{"name", conf->getName()}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -74,7 +74,7 @@ public:
|
|||
void setRoomJoined(const QString& jid, bool joined);
|
||||
void setRoomAutoJoin(const QString& jid, bool joined);
|
||||
void removeRoomRequest(const QString& jid);
|
||||
void addRoomRequest(const QString& jid, const QString& nick, bool autoJoin);
|
||||
void addRoomRequest(const QString& jid, const QString& nick, const QString& password, bool autoJoin);
|
||||
|
||||
signals:
|
||||
void connectionStateChanged(int);
|
||||
|
@ -164,6 +164,7 @@ private:
|
|||
void handleNewConference(Conference* contact);
|
||||
bool handleChatMessage(const QXmppMessage& msg, bool outgoing = false, bool forwarded = false, bool guessing = false);
|
||||
bool handleGroupMessage(const QXmppMessage& msg, bool outgoing = false, bool forwarded = false, bool guessing = false);
|
||||
void addNewRoom(const QString& jid, const QString& nick, const QString& roomName, bool autoJoin);
|
||||
void addToGroup(const QString& jid, const QString& group);
|
||||
void removeFromGroup(const QString& jid, const QString& group);
|
||||
void initializeMessage(Shared::Message& target, const QXmppMessage& source, bool outgoing = false, bool forwarded = false, bool guessing = false) const;
|
||||
|
|
|
@ -474,3 +474,14 @@ void Core::Squawk::removeRoomRequest(const QString& account, const QString& jid)
|
|||
}
|
||||
itr->second->removeRoomRequest(jid);
|
||||
}
|
||||
|
||||
void Core::Squawk::addRoomRequest(const QString& account, const QString& jid, const QString& nick, const QString& password, bool autoJoin)
|
||||
{
|
||||
AccountsMap::const_iterator itr = amap.find(account);
|
||||
if (itr == amap.end()) {
|
||||
qDebug() << "An attempt to add the room" << jid << "to non existing account" << account << ", skipping";
|
||||
return;
|
||||
}
|
||||
itr->second->addRoomRequest(jid, nick, password, autoJoin);
|
||||
}
|
||||
|
||||
|
|
|
@ -79,6 +79,7 @@ public slots:
|
|||
void addContactRequest(const QString& account, const QString& jid, const QString& name, const QSet<QString>& groups);
|
||||
void setRoomJoined(const QString& account, const QString& jid, bool joined);
|
||||
void setRoomAutoJoin(const QString& account, const QString& jid, bool joined);
|
||||
void addRoomRequest(const QString& account, const QString& jid, const QString& nick, const QString& password, bool autoJoin);
|
||||
void removeRoomRequest(const QString& account, const QString& jid);
|
||||
|
||||
private:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue