diff options
-rw-r--r-- | src/Channel.cpp | 1 | ||||
-rw-r--r-- | src/main.cpp | 4 |
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()); |