Browse Source

Add Toxme support in Toxuri handle

reviewable/pr3697/r1
Diadlo 10 years ago committed by tux3
parent
commit
e1305f1f6f
No known key found for this signature in database
GPG Key ID: 7E086DD661263264
  1. 17
      src/net/toxuri.cpp

17
src/net/toxuri.cpp

@ -20,6 +20,7 @@
#include "src/net/toxuri.h" #include "src/net/toxuri.h"
#include "src/net/toxdns.h" #include "src/net/toxdns.h"
#include "src/net/toxme.h"
#include "src/widget/tool/friendrequestdialog.h" #include "src/widget/tool/friendrequestdialog.h"
#include "src/nexus.h" #include "src/nexus.h"
#include "src/core/core.h" #include "src/core/core.h"
@ -62,20 +63,22 @@ bool handleToxURI(const QString &toxURI)
else else
toxaddr = toxURI.mid(4); toxaddr = toxURI.mid(4);
QString toxid = ToxDNS::resolveToxAddress(toxaddr, true).toString(); QString toxId = Toxme::lookup(toxaddr).toString();
if (toxId.isEmpty())
if (toxid.isEmpty()) {
toxId = ToxDNS::resolveToxAddress(toxaddr, true).toString();
if (toxId.isEmpty())
{ {
QMessageBox::warning(0, "qTox", toxaddr + " is not a valid Tox address."); QMessageBox::warning(0, "qTox", toxaddr + " is not a valid Tox address.");
return false;
} }
else }
{
ToxURIDialog dialog(0, toxaddr, QObject::tr("%1 here! Tox me maybe?", ToxURIDialog dialog(0, toxaddr, QObject::tr("%1 here! Tox me maybe?",
"Default message in Tox URI friend requests. Write something appropriate!") "Default message in Tox URI friend requests. Write something appropriate!")
.arg(Nexus::getCore()->getUsername())); .arg(Nexus::getCore()->getUsername()));
if (dialog.exec() == QDialog::Accepted) if (dialog.exec() == QDialog::Accepted)
Core::getInstance()->requestFriendship(toxid, dialog.getRequestMessage()); Core::getInstance()->requestFriendship(toxId, dialog.getRequestMessage());
}
return true; return true;
} }

Loading…
Cancel
Save