Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Indicate that group chat peer's username is not known #768

Closed
tox-user opened this issue Feb 6, 2018 · 4 comments · Fixed by #819
Closed

Indicate that group chat peer's username is not known #768

tox-user opened this issue Feb 6, 2018 · 4 comments · Fixed by #819
Assignees
Labels
enhancement New feature for the user, not a new feature for build script P3 Low priority
Milestone

Comments

@tox-user
Copy link
Member

tox-user commented Feb 6, 2018

In group chat when a joining peer's username is not known a string "Tox User" is returned. As far as I know toxcore gives no other indication about this. That means clients can never trust if the peer's name they got from toxcore is correct or not. "Tox User" can be a legitimate username, so there is no way to distinguish if it's a correct name. This makes creating join notifications for group chats difficult.

When a user joins a group chat we are in, we will at first see their name as "Tox User". Then it will probably get changed to their real name calling TOX_CONFERENCE_STATE_CHANGE_PEER_NAME_CHANGE. I don't know how clients get around it, but this should be changed.

in group.c:

/* Copy the name of peer_index who is in groupnumber to name.
 * name must be at least MAX_NAME_LENGTH long.
 *
 * return length of name if success
 * return -1 if groupnumber is invalid.
 * return -2 if peer_index is invalid.
 */
int group_peername(const Group_Chats *g_c, int groupnumber, int peer_index, uint8_t *name)
{
    Group_c *g = get_group_c(g_c, groupnumber);

    if (!g) {
        return -1;
    }

    if (peer_index < 0 || (uint32_t)peer_index >= g->numpeers_in_list) {
        return -2;
    }

    if (g->peers_list[peer_index] == INVALID_PEER_INDEX) {
        return -2;
    }

    Group_Peer *peer = &g->peers[g->peers_list[peer_index]];

    peer->nick_changed = false;

    if (peer->nick_len == 0) {
        memcpy(name, "Tox User", 8);
        return 8;
    }

    memcpy(name, peer->nick, peer->nick_len);
    return peer->nick_len;
}
@sudden6
Copy link

sudden6 commented Feb 10, 2018

What about using an empty string instead of using Tox User?

@zoff99
Copy link

zoff99 commented Feb 10, 2018

maybe somewhere along this line:

    if (peer->nick_len == 0) {
        name[0] = '\0';
        return 0;
    }

@tox-user
Copy link
Member Author

There has to be some default name. We could set it to an empty string and let clients decide what the default name should be, but then it will be different in each client.

There is also another problem. Why is the string "Tox User" returned for every peer that joins and changed to user's real name later? It must mean that every joining user's name is empty at first. Why?

@sudden6
Copy link

sudden6 commented Feb 10, 2018

We could set it to an empty string and let clients decide what the default name should be, but then it will be different in each client.

I think letting the client decide the default name wouldn't be to bad, qTox already has a default name when you create a profile, wouldn't be much work to make one for groups.

Why is the string "Tox User" returned for every peer that joins and changed to user's real name later?

Maybe the packet indicating the peer name arrives after the one indicating someone joined the group? Not sure what the protocol says here.

@SkyzohKey SkyzohKey added enhancement New feature for the user, not a new feature for build script MOD:Groupchats labels Feb 13, 2018
tox-user added a commit to tox-user/c-toxcore that referenced this issue Feb 26, 2018
tox-user added a commit to tox-user/c-toxcore that referenced this issue Feb 26, 2018
tox-user added a commit to tox-user/c-toxcore that referenced this issue Feb 26, 2018
tox-user added a commit to tox-user/c-toxcore that referenced this issue Feb 27, 2018
tox-user added a commit to tox-user/c-toxcore that referenced this issue Feb 27, 2018
@robinlinden robinlinden modified the milestone: v0.2.11 Mar 20, 2020
@iphydf iphydf added this to the meta milestone Feb 4, 2022
@iphydf iphydf added the P3 Low priority label Feb 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature for the user, not a new feature for build script P3 Low priority
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants