diff --git a/src/core/corestructs.cpp b/src/core/corestructs.cpp index 20362b9bb..c329e6504 100644 --- a/src/core/corestructs.cpp +++ b/src/core/corestructs.cpp @@ -66,7 +66,7 @@ bool ToxID::operator!=(const ToxID& other) const return publicKey != other.publicKey; } -bool ToxID::isMine() const +bool ToxID::isActiveProfile() const { return *this == Core::getInstance()->getSelfId(); } diff --git a/src/core/corestructs.h b/src/core/corestructs.h index fe3373de9..8dc3f3654 100644 --- a/src/core/corestructs.h +++ b/src/core/corestructs.h @@ -30,7 +30,7 @@ struct ToxID bool operator==(const ToxID& other) const; bool operator!=(const ToxID& other) const; - bool isMine() const; + bool isActiveProfile() const; void clear(); }; diff --git a/src/group.cpp b/src/group.cpp index a1cd92239..31a2d6a74 100644 --- a/src/group.cpp +++ b/src/group.cpp @@ -98,7 +98,7 @@ void Group::regeneratePeerList() for (int i = 0; i < nPeers; i++) { ToxID id = Core::getInstance()->getGroupPeerToxID(groupId, i); - if (id.isMine()) + if (id.isActiveProfile()) selfPeerNum = i; QString toxid = id.publicKey; diff --git a/src/widget/form/addfriendform.cpp b/src/widget/form/addfriendform.cpp index 2b917bbb9..92b52be85 100644 --- a/src/widget/form/addfriendform.cpp +++ b/src/widget/form/addfriendform.cpp @@ -129,7 +129,7 @@ void AddFriendForm::setIdFromClipboard() QString id = clipboard->text().trimmed(); if (Core::getInstance()->isReady() && !id.isEmpty() && ToxID::isToxId(id)) { - if (!ToxID::fromString(id).isMine()) + if (!ToxID::fromString(id).isActiveProfile()) toxId.setText(id); } } diff --git a/src/widget/form/chatform.cpp b/src/widget/form/chatform.cpp index 012dc0c54..c7dc14b9b 100644 --- a/src/widget/form/chatform.cpp +++ b/src/widget/form/chatform.cpp @@ -179,7 +179,7 @@ void ChatForm::startFileSend(ToxFile file) return; QString name; - if (!previousId.isMine()) + if (!previousId.isActiveProfile()) { Core* core = Core::getInstance(); name = core->getUsername(); @@ -814,13 +814,13 @@ void ChatForm::loadHistory(QDateTime since, bool processUndelivered) // Show each messages ToxID authorId = ToxID::fromString(it.sender); - QString authorStr = authorId.isMine() ? Core::getInstance()->getUsername() : resolveToxID(authorId); + QString authorStr = authorId.isActiveProfile() ? Core::getInstance()->getUsername() : resolveToxID(authorId); bool isAction = it.message.startsWith("/me ", Qt::CaseInsensitive); ChatMessage::Ptr msg = ChatMessage::createChatMessage(authorStr, isAction ? it.message.right(it.message.length() - 4) : it.message, isAction ? ChatMessage::ACTION : ChatMessage::NORMAL, - authorId.isMine(), + authorId.isActiveProfile(), QDateTime()); if (!isAction && (prevId == authorId) && (prevMsgDateTime.secsTo(msgDateTime) < getChatLog()->repNameAfter) ) @@ -829,7 +829,7 @@ void ChatForm::loadHistory(QDateTime since, bool processUndelivered) prevId = authorId; prevMsgDateTime = msgDateTime; - if (it.isSent || !authorId.isMine()) + if (it.isSent || !authorId.isActiveProfile()) { msg->markAsSent(msgDateTime); } diff --git a/src/widget/form/genericchatform.cpp b/src/widget/form/genericchatform.cpp index f427f4bcd..d7a1a1183 100644 --- a/src/widget/form/genericchatform.cpp +++ b/src/widget/form/genericchatform.cpp @@ -248,7 +248,7 @@ void GenericChatForm::onChatContextMenuRequested(QPoint pos) ChatMessage::Ptr GenericChatForm::addMessage(const ToxID& author, const QString &message, bool isAction, const QDateTime &datetime, bool isSent) { - QString authorStr = author.isMine() ? Core::getInstance()->getUsername() : resolveToxID(author); + QString authorStr = author.isActiveProfile() ? Core::getInstance()->getUsername() : resolveToxID(author); ChatMessage::Ptr msg; if (isAction) @@ -258,7 +258,7 @@ ChatMessage::Ptr GenericChatForm::addMessage(const ToxID& author, const QString } else { - msg = ChatMessage::createChatMessage(authorStr, message, ChatMessage::NORMAL, author.isMine()); + msg = ChatMessage::createChatMessage(authorStr, message, ChatMessage::NORMAL, author.isActiveProfile()); if ( (author == previousId) && (prevMsgDateTime.secsTo(QDateTime::currentDateTime()) < getChatLog()->repNameAfter) ) msg->hideSender(); @@ -282,7 +282,7 @@ ChatMessage::Ptr GenericChatForm::addSelfMessage(const QString &message, bool is void GenericChatForm::addAlertMessage(const ToxID &author, QString message, QDateTime datetime) { QString authorStr = resolveToxID(author); - ChatMessage::Ptr msg = ChatMessage::createChatMessage(authorStr, message, ChatMessage::ALERT, author.isMine(), datetime); + ChatMessage::Ptr msg = ChatMessage::createChatMessage(authorStr, message, ChatMessage::ALERT, author.isActiveProfile(), datetime); insertChatMessage(msg); if ((author == previousId) && (prevMsgDateTime.secsTo(QDateTime::currentDateTime()) < getChatLog()->repNameAfter)) diff --git a/src/widget/widget.cpp b/src/widget/widget.cpp index 912861dfc..6b3e8e58f 100644 --- a/src/widget/widget.cpp +++ b/src/widget/widget.cpp @@ -951,7 +951,7 @@ void Widget::onGroupMessageReceived(int groupnumber, int peernumber, const QStri return; ToxID author = Core::getInstance()->getGroupPeerToxID(groupnumber, peernumber); - bool targeted = !author.isMine() && (message.contains(nameMention) || message.contains(sanitizedNameMention)); + bool targeted = !author.isActiveProfile() && (message.contains(nameMention) || message.contains(sanitizedNameMention)); if (targeted && !isAction) g->getChatForm()->addAlertMessage(author, message, QDateTime::currentDateTime()); else