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

Commit

Permalink
fix: Don't even try to add ourselves as a friend in the Tox URI handler
Browse files Browse the repository at this point in the history
  • Loading branch information
tux3 committed Feb 17, 2017
1 parent c75ee8a commit bfda028
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions src/net/toxuri.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,16 +79,30 @@ bool handleToxURI(const QString &toxURI)
toxId = Toxme::lookup(toxaddr);
if (!toxId.isValid())
{
QMessageBox *messageBox = new QMessageBox(QMessageBox::Warning, "qTox",
QMessageBox::tr("%1 is not a valid Toxme address.")
.arg(toxaddr), QMessageBox::Ok, nullptr);
QMessageBox *messageBox = new QMessageBox(QMessageBox::Warning,
QMessageBox::tr("Couldn't add friend"),
QMessageBox::tr("%1 is not a valid Toxme address.")
.arg(toxaddr), QMessageBox::Ok, nullptr);
messageBox->setButtonText(QMessageBox::Ok, QMessageBox::tr("Ok"));
QObject::connect(messageBox, &QMessageBox::finished, messageBox, &QMessageBox::deleteLater);
messageBox->show();
return false;
}
}

if (toxId == core->getSelfId())
{
QMessageBox *messageBox = new QMessageBox(QMessageBox::Warning,
QMessageBox::tr("Couldn't add friend"),
QMessageBox::tr("You can't add yourself as a friend!",
"When trying to add your own Tox ID as friend"),
QMessageBox::Ok, nullptr);
messageBox->setButtonText(QMessageBox::Ok, QMessageBox::tr("Ok"));
QObject::connect(messageBox, &QMessageBox::finished, messageBox, &QMessageBox::deleteLater);
messageBox->show();
return false;
}

ToxURIDialog *dialog = new ToxURIDialog(0, toxaddr, QObject::tr("%1 here! Tox me maybe?",
"Default message in Tox URI friend requests. Write something appropriate!")
.arg(Nexus::getCore()->getUsername()));
Expand Down

0 comments on commit bfda028

Please sign in to comment.