aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
m---------depends/odhtdb0
-rw-r--r--src/Channel.cpp7
-rw-r--r--src/main.cpp5
3 files changed, 6 insertions, 6 deletions
diff --git a/depends/odhtdb b/depends/odhtdb
-Subproject b0cc417bc9289fdd5c98028136e37c6a6ee6294
+Subproject df4c9798e514eaaf7d8387110eb06a2187e43ee
diff --git a/src/Channel.cpp b/src/Channel.cpp
index 0db6e5f..b43e75c 100644
--- a/src/Channel.cpp
+++ b/src/Channel.cpp
@@ -1,6 +1,7 @@
#include "../include/Channel.hpp"
#include <odhtdb/User.hpp>
#include <odhtdb/Database.hpp>
+#include <odhtdb/bin2hex.hpp>
#include <cstring>
using namespace std;
@@ -154,14 +155,10 @@ namespace dchat
auto groupToAddUserTo = database->getStorage().getGroupById(*databaseNodeInfo.getRequestHash(), groupIdRaw);
if(!groupToAddUserTo)
{
- fprintf(stderr, "Group with id %s does not exist in channel %s\n", groupId.c_str(), databaseNodeInfo.getRequestHash()->toString().c_str());
+ fprintf(stderr, "Group with id %s does not exist in channel %s\n", odhtdb::bin2hex(groupId.c_str(), groupId.size()).c_str(), databaseNodeInfo.getRequestHash()->toString().c_str());
return false;
}
database->addUser(databaseNodeInfo, static_cast<const odhtdb::LocalUser*>(localOnlineUser->databaseUser), "noname", userId, groupToAddUserTo);
-
- auto addedUser = database->getStorage().getUserByPublicKey(*databaseNodeInfo.getRequestHash(), userId);
- assert(addedUser);
- addUserLocally(new OnlineUser(addedUser));
return true;
}
diff --git a/src/main.cpp b/src/main.cpp
index eb5683f..6286884 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -165,10 +165,13 @@ int main(int argc, char **argv)
database.setOnAddUserCallback([&currentUserKeyPair, &channels, &channelMessageMutex, &waitingToJoin](const odhtdb::DatabaseAddUserRequest &request)
{
lock_guard<recursive_mutex> lock(channelMessageMutex);
+ printf("Add user callback. Channel to add user to: %s\n", request.nodeHash->toString().c_str());
for(Channel *channel : channels)
{
+ printf("My channel: %s (%s)\n", channel->getNodeInfo().getRequestHash()->toString().c_str(), channel->getName().c_str());
if(*request.nodeHash == *channel->getNodeInfo().getRequestHash())
{
+ printf("Add user to one of my channels\n");
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());
@@ -493,7 +496,7 @@ int main(int argc, char **argv)
window.draw(shadeRect);
const sf::Font *FONT = ResourceCache::getFont("fonts/Roboto-Regular.ttf");
- const float FONT_SIZE = 30 * Settings::getScaling();
+ const float FONT_SIZE = (double)windowSize.x / 40.0;
sf::Text text("Wait until you are added to the channel", *FONT, FONT_SIZE);
text.setPosition(floor((float)windowSize.x * 0.5f - text.getLocalBounds().width * 0.5f), floor((float)windowSize.y * 0.5f - FONT->getLineSpacing(FONT_SIZE) * 0.5f));
window.draw(text);