c++ client custom room properties

Options
MariusKurgonas
edited May 2014 in Native
Hi,

I am probably doing something wrong, because i can not set the custom room properties. The code is as follows - any help would be appreciated:
MutableRoom room = _client->getCurrentlyJoinedRoom(); //No custom room properties set

room.addCustomProperty(<char *>, <hashTable>) //Adding some variables of types given

room.getCustomProperties.toString() //Logging this to console prints correct values which have just been added eg. { <char *> = <hashtable> }

_client->getCurrentlyJoinedRoom().getCustomProperties().toString() //Loging that immediately after gives empty hash table with no values inside { }

This is done by master client.

Does it need time to sync?

Comments

  • Kaiserludi
    Options
    Hi Marius.
    [code2=cpp]MutableRoom room = _client->getCurrentlyJoinedRoom(); //No custom room properties set[/code2]
    This line makes a copy of the room. Afterwards you are operating on that copy, so you are never actually modifying the original room.
  • Ups! Did not notice that - silly mistake. Found method which i probably have to use:
    bool Client::opSetPropertiesOfRoom(const Hashtable& properties)
    

    So do i get properties from local room copy, and set them invoking this method?
  • Kaiserludi
    Options
    [code2=cpp]bool Client::opSetPropertiesOfRoom(const Hashtable& properties)[/code2]
    is protected.

    Just get a reference to the currently joined room instead of a copy and then operate on that reference:
    [code2=cpp]MutableRoom& room = _client->getCurrentlyJoinedRoom(); //No custom room properties set[/code2]