1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

Better error messages for friend requests

This commit is contained in:
tux3 2015-04-25 22:07:12 +02:00
parent d962148dd0
commit 200af0fd49
No known key found for this signature in database
GPG Key ID: 7E086DD661263264

View File

@ -561,7 +561,15 @@ void Core::requestFriendship(const QString& friendAddress, const QString& messag
{
const QString userId = friendAddress.mid(0, TOX_PUBLIC_KEY_SIZE * 2);
if (hasFriendWithAddress(friendAddress))
if (message.isEmpty())
{
emit failedToAddFriend(userId, QString(tr("You need to write a message with you request")));
}
else if (message.size() > TOX_MAX_FRIEND_REQUEST_LENGTH)
{
emit failedToAddFriend(userId, QString(tr("Your message is too long!")));
}
else if (hasFriendWithAddress(friendAddress))
{
emit failedToAddFriend(userId, QString(tr("Friend is already added")));
}