mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
fix(addfriend): create ToxId from QString before emitting the signal
fix #4086
This commit is contained in:
parent
1df9f5726d
commit
a5d2c573dd
|
@ -162,13 +162,13 @@ void AddFriendForm::onUsernameSet(const QString& username)
|
|||
|
||||
void AddFriendForm::onSendTriggered()
|
||||
{
|
||||
QString id = toxId.text().trimmed();
|
||||
ToxId toxId;
|
||||
QString idText = toxId.text().trimmed();
|
||||
ToxId friendId(idText);
|
||||
|
||||
if (!ToxId::isValidToxId(id))
|
||||
if (!friendId.isValid())
|
||||
{
|
||||
toxId = Toxme::lookup(id); // Try Toxme
|
||||
if (!toxId.isValid())
|
||||
friendId = Toxme::lookup(idText); // Try Toxme
|
||||
if (!friendId.isValid())
|
||||
{
|
||||
GUI::showWarning(tr("Couldn't add friend"),
|
||||
tr("This Tox ID is invalid or does not exist", "Toxme error"));
|
||||
|
@ -176,13 +176,13 @@ void AddFriendForm::onSendTriggered()
|
|||
}
|
||||
}
|
||||
|
||||
deleteFriendRequest(toxId);
|
||||
if (toxId == Core::getInstance()->getSelfId())
|
||||
deleteFriendRequest(friendId);
|
||||
if (friendId == Core::getInstance()->getSelfId())
|
||||
GUI::showWarning(tr("Couldn't add friend"),
|
||||
tr("You can't add yourself as a friend!",
|
||||
"When trying to add your own Tox ID as friend"));
|
||||
else
|
||||
emit friendRequested(toxId, getMessage());
|
||||
emit friendRequested(friendId, getMessage());
|
||||
|
||||
this->toxId.clear();
|
||||
this->message.clear();
|
||||
|
|
Loading…
Reference in New Issue
Block a user