mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
Renamed function isMine to isActiveProfile.
As an user can have multiple profiles where each profile has its own Tox ID the name isMine is not very accurate.
This commit is contained in:
parent
a41765a58d
commit
2ffabb19ec
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
};
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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))
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue
Block a user