Browse Source

added isActiveProfile function and fixed a typo

pull/1675/head
marcel 10 years ago
parent
commit
66dc368662
  1. 7
      src/core/toxid.cpp
  2. 4
      src/core/toxid.h

7
src/core/toxid.cpp

@ -1,5 +1,7 @@ @@ -1,5 +1,7 @@
#include "toxid.h"
#include "core.h"
#include <tox/tox.h>
#include <qregularexpression.h>
@ -40,6 +42,11 @@ bool ToxId::operator!=(const ToxId &other) const @@ -40,6 +42,11 @@ bool ToxId::operator!=(const ToxId &other) const
return publicKey != other.publicKey;
}
bool ToxId::isActiveProfile() const
{
return *this == Core::getInstance()->getSelfId();
}
QString ToxId::toString() const
{
return publicKey + noSpam + checkSum;

4
src/core/toxid.h

@ -13,11 +13,13 @@ public: @@ -13,11 +13,13 @@ public:
ToxId(); ///< The default constructor. Creates an empty Tox ID.
ToxId(const ToxId& other); ///< The copy constructor.
ToxId(const QString& id); ///< Create a Tox ID from QString.
/// If the given id is not a valid Tox ID, than
/// If the given id is not a valid Tox ID, then:
/// publicKey == id and noSpam == "" == checkSum.
bool operator==(const ToxId& other) const; ///< Compares only publicKey.
bool operator!=(const ToxId& other) const; ///< Compares only publicKey.
bool isActiveProfile() const; ///< Returns true if this Tox ID is equals to
/// the Tox ID of the currently active profile.
QString toString() const; ///< Returns the Tox ID as QString.
void clear(); ///< Clears all elements of the Tox ID.

Loading…
Cancel
Save