aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2018-05-01 15:39:26 +0200
committerdec05eba <dec05eba@protonmail.com>2018-05-01 15:39:29 +0200
commit78c737a0990b3cd2139b0fcca60355ce9f9d4b11 (patch)
tree98f9d380068d5dab047455561e267b6d6f62dcc0
parent1818ee0d0b5c1560fb72681094639e270579bc50 (diff)
Fix channel joining waiting status, fix duplicate message locally
-rw-r--r--src/Channel.cpp1
-rw-r--r--src/main.cpp4
2 files changed, 2 insertions, 3 deletions
diff --git a/src/Channel.cpp b/src/Channel.cpp
index f403984..0db6e5f 100644
--- a/src/Channel.cpp
+++ b/src/Channel.cpp
@@ -115,7 +115,6 @@ namespace dchat
{
if(database && localUser->type == User::Type::ONLINE)
{
- addLocalMessage(msg, localUser, database->getSyncedTimestampUtc().seconds);
auto localOnlineUser = static_cast<OnlineUser*>(localUser);
assert(localOnlineUser->databaseUser->getType() == odhtdb::User::Type::LOCAL);
database->addData(databaseNodeInfo, static_cast<const odhtdb::LocalUser*>(localOnlineUser->databaseUser), odhtdb::DataView((void*)msg.data(), msg.size()));
diff --git a/src/main.cpp b/src/main.cpp
index c7dd433..bf74d23 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -169,8 +169,7 @@ int main(int argc, char **argv)
{
if(*request.nodeHash == *channel->getNodeInfo().getRequestHash())
{
- User *userToAdd = channel->getUserByPublicKey(request.userToAdd->getPublicKey());
- if(userToAdd && currentUserKeyPair && request.userToAdd->getPublicKey() == currentUserKeyPair->getPublicKey() && channel->getLocalUser()->type != User::Type::ONLINE)
+ if(currentUserKeyPair && request.userToAdd->getPublicKey() == currentUserKeyPair->getPublicKey() && channel->getLocalUser()->type != User::Type::ONLINE)
{
printf("You were added to channel %s by %s\n", request.nodeHash->toString().c_str(), request.creatorUser->getName().c_str());
channel->replaceLocalUser(new OnlineUser(request.userToAdd));
@@ -178,6 +177,7 @@ int main(int argc, char **argv)
return;
}
+ User *userToAdd = channel->getUserByPublicKey(request.userToAdd->getPublicKey());
if(userToAdd)
{
fprintf(stderr, "User %s already exists in channel\n", request.userToAdd->getPublicKey().toString().c_str());