GUI: put player on ignore list slot bugfix

This commit is contained in:
doitux
2010-03-30 19:38:14 +00:00
parent 72fa1fb9ec
commit b7809a6ca9
2 changed files with 13 additions and 8 deletions
@@ -1413,16 +1413,21 @@ bool gameLobbyDialogImpl::playerIsOnIgnoreList(unsigned playerId) {
}
void gameLobbyDialogImpl::putPlayerOnIgnoreList(unsigned playerId) {
void gameLobbyDialogImpl::putPlayerOnIgnoreList() {
if(!playerIsOnIgnoreList(playerId)) {
if(!treeWidget_NickList->selectedItems().isEmpty()) {
list<std::string> playerIgnoreList = myConfig->readConfigStringList("PlayerIgnoreList");
playerIgnoreList.push_back(QString("%1,%2").arg(playerId).arg(QString::fromUtf8(mySession->getClientPlayerInfo(playerId).playerName.c_str())).toUtf8().constData());
myConfig->writeConfigStringList("PlayerIgnoreList", playerIgnoreList);
myConfig->writeBuffer();
unsigned playerId = treeWidget_NickList->selectedItems().at(0)->data(0, Qt::UserRole).toUInt();
myChat->refreshIgnoreList();
if(!playerIsOnIgnoreList(playerId)) {
list<std::string> playerIgnoreList = myConfig->readConfigStringList("PlayerIgnoreList");
playerIgnoreList.push_back(QString("%1,%2").arg(playerId).arg(QString::fromUtf8(mySession->getClientPlayerInfo(playerId).playerName.c_str())).toUtf8().constData());
myConfig->writeConfigStringList("PlayerIgnoreList", playerIgnoreList);
myConfig->writeBuffer();
myChat->refreshIgnoreList();
}
}
}
@@ -108,7 +108,7 @@ public slots:
void showInvitationDialog(unsigned gameId, unsigned playerIdFrom);
void chatInfoPlayerInvitation(unsigned gameId, unsigned playerIdWho, unsigned playerIdFrom);
void chatInfoPlayerRejectedInvitation(unsigned gameId, unsigned playerIdWho, DenyGameInvitationReason reason);
void putPlayerOnIgnoreList(unsigned playerid);
void putPlayerOnIgnoreList();
bool playerIsOnIgnoreList(unsigned playerid);
private: