Skip to content
This repository has been archived by the owner on Feb 12, 2023. It is now read-only.

Commit

Permalink
fix(core): fix formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
Monsterovich committed Dec 26, 2018
1 parent 8c239c8 commit c136a17
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions src/widget/form/groupchatform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -318,8 +318,7 @@ void GroupChatForm::sendJoinLeaveMessages()
}

// generate user list from the current group if it's empty
if (groupLast.isEmpty())
{
if (groupLast.isEmpty()) {
groupLast = group->getPeerList();
return;
}
Expand All @@ -329,22 +328,19 @@ void GroupChatForm::sendJoinLeaveMessages()
const QString name = peers.value(peerPk);
// ignore weird issue: when user joins the group, the name is empty, then it's renamed to normal nickname (why?)
// so, just ignore the first insertion
if (!firstTime.value(peerPk, false))
{
if (!firstTime.value(peerPk, false)) {
firstTime[peerPk] = true;
continue;
}
if (!groupLast.contains(peerPk))
{
if (!groupLast.contains(peerPk)) {
groupLast.insert(peerPk, name);
addSystemInfoMessage(tr("%1 has joined the group").arg(name), ChatMessage::INFO, QDateTime::currentDateTime());
}
}
// user leaves
for (const auto& peerPk : groupLast.keys()) {
const QString name = groupLast.value(peerPk);
if (!peers.contains(peerPk))
{
if (!peers.contains(peerPk)) {
groupLast.remove(peerPk);
firstTime.remove(peerPk);
addSystemInfoMessage(tr("%1 has left the group").arg(name), ChatMessage::INFO, QDateTime::currentDateTime());
Expand Down

0 comments on commit c136a17

Please sign in to comment.