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

Implement a groupchat accept screen. #1074

Open
wants to merge 26 commits into
base: develop
Choose a base branch
from
Open

Conversation

robinlinden
Copy link
Member

@robinlinden robinlinden commented Sep 30, 2017

I don't remember where I was on this, but it's not done.


This change is Reviewable

@GrayHatter
Copy link
Member

Reviewed 3 of 15 files at r1, 26 of 38 files at r2.
Review status: 29 of 47 files reviewed at latest revision, 2 unresolved discussions.


langs/en.h, line 338 at r2 (raw file):

msgid(GROUP_INVITE_FRIEND)
msgstr("%s invites you to the chat")

we don't allow null termination from data that could come from untrusted users.


src/layout/group.c, line 65 at r2 (raw file):

            }

            unsigned w = textwidth(buf, text_length);

this can overrun.


Comments from Reviewable

@redmanmale
Copy link
Contributor

Review status: 27 of 47 files reviewed at latest revision, 2 unresolved discussions.


langs/en.h, line 338 at r2 (raw file):

Previously, GrayHatter (Gregory Mullen) wrote…

we don't allow null termination from data that could come from untrusted users.

Done.


src/layout/group.c, line 65 at r2 (raw file):

Previously, GrayHatter (Gregory Mullen) wrote…

this can overrun.

Done.


Comments from Reviewable

@redmanmale redmanmale mentioned this pull request Oct 3, 2017
@robinlinden
Copy link
Member Author

Reviewed 8 of 15 files at r1, 32 of 38 files at r2, 7 of 7 files at r3.
Review status: all files reviewed at latest revision, 2 unresolved discussions.


Comments from Reviewable

@robinlinden
Copy link
Member Author

Review status: all files reviewed at latest revision, 3 unresolved discussions.


langs/en.h, line 335 at r3 (raw file):

msgid(GROUP_INVITE)
msgstr("Chat invite")

I'm not a fan of the change from groupchat to chat. Is this something we want to do?


Comments from Reviewable

@robinlinden
Copy link
Member Author

Reviewed 18 of 18 files at r4.
Review status: all files reviewed at latest revision, 2 unresolved discussions.


Comments from Reviewable

@robinlinden
Copy link
Member Author

Reviewed 1 of 15 files at r1, 1 of 38 files at r2.
Review status: all files reviewed at latest revision, 2 unresolved discussions.


src/layout/group_invite.c, line 23 at r4 (raw file):

static void button_group_invite_reject_on_mup(void);

void group_invite_draw(void);

This declaration isn't needed.


Comments from Reviewable

@redmanmale
Copy link
Contributor

Review status: 46 of 47 files reviewed at latest revision, 2 unresolved discussions.


src/layout/group_invite.c, line 23 at r4 (raw file):

Previously, robinlinden (Robin Lindén) wrote…

This declaration isn't needed.

Done.


Comments from Reviewable

@robinlinden
Copy link
Member Author

Reviewed 1 of 1 files at r5.
Review status: all files reviewed at latest revision, 1 unresolved discussion.


Comments from Reviewable

@jhert0
Copy link
Member

jhert0 commented Dec 5, 2017

Reviewed 8 of 15 files at r1, 18 of 38 files at r2, 2 of 7 files at r3, 18 of 18 files at r4, 1 of 1 files at r5.
Review status: all files reviewed at latest revision, 3 unresolved discussions.


src/group_invite.c, line 30 at r5 (raw file):

}

static void group_invite_free(const uint8_t invite_id) {

Add a check to make sure invite_id is less than 16


src/group_invite.c, line 123 at r5 (raw file):

}

uint32_t group_invite_get_friend_id(const uint8_t invite_id) {

Add a check to make sure invite_id is less than 16


Comments from Reviewable

@im-grey
Copy link

im-grey commented Dec 6, 2017

Thank you for all your hard work.

@redmanmale
Copy link
Contributor

Review status: 32 of 48 files reviewed at latest revision, 3 unresolved discussions.


src/group_invite.c, line 30 at r5 (raw file):

Previously, endoffile78 (Endoffile) wrote…

Add a check to make sure invite_id is less than 16

Done.


src/group_invite.c, line 123 at r5 (raw file):

Previously, endoffile78 (Endoffile) wrote…

Add a check to make sure invite_id is less than 16

Done.


Comments from Reviewable

@jhert0
Copy link
Member

jhert0 commented Dec 6, 2017

:lgtm:


Reviewed 14 of 14 files at r6, 2 of 2 files at r7.
Review status: all files reviewed at latest revision, 1 unresolved discussion.


Comments from Reviewable

@redmanmale redmanmale assigned GrayHatter and unassigned redmanmale Dec 6, 2017
@GrayHatter
Copy link
Member

"TOUCH ALL THE FILES" -- @robinlinden probably

round 1 review


Reviewed 2 of 15 files at r1, 13 of 18 files at r4, 8 of 14 files at r6, 1 of 2 files at r7.
Review status: all files reviewed at latest revision, 5 unresolved discussions.


langs/en.h, line 335 at r3 (raw file):

Previously, robinlinden (Robin Lindén) wrote…

I'm not a fan of the change from groupchat to chat. Is this something we want to do?

Not in this pull, but we should change everything to conference. Per the toxcore change.

Then groups, and conferences can live side by side. Both with a different feature set.


langs/i18n_decls.h, line 107 at r2 (raw file):

    STR_GROUP_MESSAGE_INVITE,
    STR_GROUP_MESSAGE_JOIN,
    STR_GROUP_MESSAGE_CHANGE_NAME,

Do we want to add a suffix for strings that required additional params?

@robinlinden


src/ui.c, line 314 at r7 (raw file):

    /* Group Settings */
    CREATE_EDIT(group_topic, 10, 95, -10, 24);
    CREATE_DROPDOWN(notify_groupchats, 10, 150, 24, 100);

We don't use this macro anymore. Move it to the UI file.


src/ui.c, line 344 at r7 (raw file):

    CREATE_BUTTON(deny_deletion,    110, MAIN_TOP + 40, _BM_SBUTTON_WIDTH, _BM_SBUTTON_HEIGHT);

    group_invite_draw();

NTS: what is this?


Comments from Reviewable

@redmanmale
Copy link
Contributor

Review status: 46 of 48 files reviewed at latest revision, 5 unresolved discussions.


src/ui.c, line 314 at r7 (raw file):

Previously, GrayHatter (Gregory Mullen) wrote…

We don't use this macro anymore. Move it to the UI file.

This whole commit moved to #1079.


Comments from Reviewable

@jhert0
Copy link
Member

jhert0 commented Jan 18, 2018

Reviewed 2 of 2 files at r8.
Review status: all files reviewed at latest revision, 5 unresolved discussions, some commit checks failed.


Comments from Reviewable

@GrayHatter
Copy link
Member

Review status: all files reviewed at latest revision, 4 unresolved discussions, some commit checks failed.


src/layout/group.c, line 65 at r2 (raw file):

Previously, redmanmale (redmanmale) wrote…

Done.

Sorry, this is gonna take me some time to review. This being safe depends on how each platform searches string length, + where/how each func counts bytes, vs utf8-chars.

First glance your code looks correct, but I need to make sure all the other functions are being used correctly as well.


Comments from Reviewable

@redmanmale
Copy link
Contributor

Reviewed 3 of 15 files at r1, 13 of 38 files at r2, 1 of 7 files at r3, 13 of 18 files at r4, 1 of 1 files at r5, 13 of 14 files at r6, 2 of 2 files at r7, 2 of 2 files at r8.
Review status: all files reviewed at latest revision, 4 unresolved discussions, some commit checks failed.


src/layout/group.c, line 65 at r2 (raw file):

Previously, GrayHatter (Gregory Mullen) wrote…

Sorry, this is gonna take me some time to review. This being safe depends on how each platform searches string length, + where/how each func counts bytes, vs utf8-chars.

First glance your code looks correct, but I need to make sure all the other functions are being used correctly as well.

OK, but I did'n touch this at all.


Comments from Reviewable

@GrayHatter
Copy link
Member

@redmanmale You're right, but I can't LGTM a section that might be wrong. Hence the apology, through no fault of your own, I have to make you wait for code that's likely fine.

@redmanmale
Copy link
Contributor

Review status: 40 of 47 files reviewed at latest revision, 7 unresolved discussions, some commit checks broke.


src/messages.c, line 194 at r8 (raw file):

Previously, GrayHatter (Gregory Mullen) wrote…

what is this section trying to do?

Getting current group to scroll its content; if you're asking why I touched this at all it's because old code (flist_get_groupchat() == get_group(m->id)) was causing a SEGV and I fixed it.


src/layout/group_invite.c, line 27 at r8 (raw file):

Previously, GrayHatter (Gregory Mullen) wrote…

how often is .update called?

On every UI event; but we do this thing (update = button_setcolors_success) pretty often.


src/layout/group_invite.c, line 88 at r8 (raw file):

Previously, GrayHatter (Gregory Mullen) wrote…

add the positions to the structs above, and this doesn't' need to exist. (The goal is to remove this MACRO)

Done.


src/ui.c, line 344 at r7 (raw file):

Previously, GrayHatter (Gregory Mullen) wrote…

NTS: what is this?

Done. Moved to UI definition.


Comments from Reviewable

@GrayHatter
Copy link
Member

Reviewed 1 of 14 files at r6, 3 of 4 files at r9, 3 of 5 files at r10.
Review status: 45 of 47 files reviewed at latest revision, 5 unresolved discussions, some commit checks broke.


src/layout/group_invite.c, line 27 at r8 (raw file):

Previously, redmanmale (redmanmale) wrote…

On every UI event; but we do this thing (update = button_setcolors_success) pretty often.

LGTM but I'd also like to see // TODO: OPTIMIZE comments when we're doing something the easy way that is a good target for micro optimization.


Comments from Reviewable

@redmanmale redmanmale modified the milestones: v0.17.0, v0.18.0 Apr 18, 2018
@redmanmale
Copy link
Contributor

Review status: 18 files need 2 more reviewers, 3 open discussions remaining, 1 assignee LGTMs are missing, missing Admin LGTM at current revision. (waiting on @undefined, @undefined, @undefined, @undefined, @undefined, @undefined, @undefined, @undefined, @undefined, @undefined, @undefined, @undefined, @undefined, @undefined, @undefined, @undefined, @undefined, @undefined, @undefined, @undefined, @undefined, @undefined, @undefined, @undefined, @undefined, @undefined, @undefined, @undefined, @undefined, @undefined, @undefined, @undefined, @undefined, @undefined, @undefined, @undefined, @undefined, @undefined, @undefined, @undefined, @undefined, @undefined, @undefined, @undefined, @undefined, @undefined, @undefined, and @undefined)


src/layout/group_invite.c, line 27 at r8 (raw file):

Previously, GrayHatter (Gregory Mullen) wrote…

LGTM but I'd also like to see // TODO: OPTIMIZE comments when we're doing something the easy way that is a good target for micro optimization.

Done.


Comments from Reviewable

@jhert0
Copy link
Member

jhert0 commented Jun 18, 2018

:lgtm:


Reviewed 1 of 4 files at r9, 2 of 5 files at r10, 17 of 17 files at r11.
Review status: 17 files need 1 more reviewer, 3 open discussions remaining, 1 assignee LGTMs are missing, missing Admin LGTM at current revision. (waiting on @undefined, @undefined, @undefined, @undefined, @undefined, @undefined, @undefined, @undefined, @undefined, @undefined, @undefined, @undefined, @undefined, @undefined, @undefined, @undefined, @undefined, @undefined, @undefined, @undefined, @undefined, @undefined, @undefined, @undefined, @undefined, @undefined, @undefined, @undefined, @undefined, @undefined, @undefined, @undefined, @undefined, @undefined, @undefined, @undefined, @undefined, @undefined, @undefined, @undefined, @undefined, @undefined, @undefined, @undefined, @undefined, @undefined, @undefined, and @undefined)


Comments from Reviewable

@redmanmale
Copy link
Contributor

If no one mind it, I'd like to merge it. Are there any problems?

Copy link
Member Author

@robinlinden robinlinden left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 2 of 14 files at r6, 1 of 2 files at r7, 1 of 4 files at r9, 2 of 5 files at r10, 17 of 17 files at r11.
Reviewable status: 3 open discussions remaining, 1 assignee LGTMs are missing (waiting on @undefined, @undefined, @undefined, @undefined, @undefined, @undefined, @undefined, @undefined, @undefined, and @undefined)

@ghost
Copy link

ghost commented Sep 12, 2018

I want to take a look, too. And push translations for Polish, too. And German.

if (f != NULL && f->online) {
size_t msg_length = UTOX_FRIEND_NAME_LENGTH(f) + SLEN(GROUP_MESSAGE_INVITE);

This comment was marked as abuse.

src/flist.c Outdated
drawalpha(group_bitmap, avatar_x, y + ROSTER_AVATAR_TOP, default_w, default_w,
selected_item == i ? COLOR_MAIN_TEXT : COLOR_LIST_TEXT);

size_t msg_length = SLEN(GROUP_INVITE) + 4;

This comment was marked as abuse.

src/flist.c Outdated
@@ -895,6 +941,14 @@ GROUPCHAT *flist_get_groupchat(void) {
return NULL;
}

uint8_t flist_get_group_invite_id(void) {
if (flist_get_type() == ITEM_GROUP_INVITE) {

This comment was marked as abuse.

src/flist.c Outdated
if (f->online) {
size_t msg_length = UTOX_FRIEND_NAME_LENGTH(f) + SLEN(GROUP_MESSAGE_INVITE);

This comment was marked as abuse.

src/friend.c Outdated

size_t title_length = snprintf((char *)title, UTOX_FRIEND_NAME_LENGTH(f) + 25, "uTox new message from %.*s",
(int)UTOX_FRIEND_NAME_LENGTH(f), UTOX_FRIEND_NAME(f));
size_t title_length = UTOX_FRIEND_NAME_LENGTH(f) + SLEN(FRIEND_MESSAGE_NEW);

This comment was marked as abuse.

src/groups.c Outdated
memcpy(old, peer->name, peer->name_length);
size_t size = snprintf(msg, TOX_MAX_NAME_LENGTH, "<- has changed their name from %.*s",
peer->name_length, old);
size_t size = peer->name_length + SLEN(GROUP_MESSAGE_CHANGE_NAME);

This comment was marked as abuse.

src/groups.c Outdated
char title[g->name_length + 25];

size_t title_length = snprintf(title, g->name_length + 25, "uTox new message in %.*s", g->name_length, g->name);
size_t title_length = g->name_length + SLEN(GROUP_MESSAGE_NEW);

This comment was marked as abuse.

@@ -56,8 +56,14 @@ static void draw_group(int x, int UNUSED(y), int UNUSED(w), int UNUSED(height))
GROUP_PEER *peer = g->peer[i];

if (peer && peer->name_length) {
char buf[TOX_MAX_NAME_LENGTH];
int text_length = snprintf((char *)buf, TOX_MAX_NAME_LENGTH, "%.*s, ", (int)peer->name_length, peer->name);
uint8_t text_length = peer->name_length + 2;

This comment was marked as abuse.

setcolor(COLOR_MAIN_TEXT);
setfont(FONT_SELF_NAME);

size_t label_length = SLEN(GROUP_INVITE) + 4;

This comment was marked as abuse.

src/utox.c Outdated
@@ -632,7 +641,7 @@ void utox_message_dispatch(UTOX_MSG utox_msg_id, uint16_t param1, uint16_t param
g->source[param2] = g->source[g->peer_count];
}

g->topic_length = snprintf((char *)g->topic, sizeof(g->topic), "%u users in chat", g->peer_count);
g->topic_length = snprintf((char *)g->topic, sizeof(g->topic), S(GROUP_STATUS), g->peer_count);

This comment was marked as abuse.

src/utox.c Outdated
@@ -653,7 +662,7 @@ void utox_message_dispatch(UTOX_MSG utox_msg_id, uint16_t param1, uint16_t param
return;
}

g->topic_length = snprintf((char *)g->topic, sizeof(g->topic), "%u users in chat", g->peer_count);
g->topic_length = snprintf((char *)g->topic, sizeof(g->topic), S(GROUP_STATUS), g->peer_count);

This comment was marked as abuse.

return false;
}

uint32_t group_id = UINT32_MAX;

This comment was marked as abuse.

@ghost
Copy link

ghost commented Sep 16, 2018

I don't like the current screen.

  • When invited, the groupchat invitation appears on the friend list in a practically unnoticable fashion, even when you learned that it appears there, it is really hard to discover. It should be immediately obvious.

  • The screen is inconsistent with other screens. It should probably look like the delete-friend screen; bold font and the buttons immediately below and next to each other. The buttons being at opposing ends of the window is not so cool. And the buttons being at the bottom of the window, with the query being at the top, is not that cool, either.

  • The ignore button is shorter than its text.

@ghost
Copy link

ghost commented Sep 16, 2018

Also, there should be a setting for auto-accepting group invitations.

Correctly working code is not an exception in uTox.
@ghost
Copy link

ghost commented Sep 16, 2018

Next I'm translating to German and Polish.

@ghost ghost added the --WIP-- label Sep 16, 2018
ghost
ghost previously approved these changes Sep 16, 2018
@ghost ghost dismissed their stale review September 16, 2018 21:12

Not yet…

avoidr added 2 commits September 17, 2018 12:45
Translate:
FRIEND_MESSAGE_NEW
GROUP_STATUS
GROUP_INVITE
GROUP_INVITE_FRIEND
GROUP_MESSAGE_INVITE
GROUP_MESSAGE_JOIN
GROUP_MESSAGE_CHANGE_NAME
GROUP_MESSAGE_QUIT
GROUP_MESSAGE_NEW
Translate:
FRIEND_MESSAGE_NEW
GROUP_STATUS
GROUP_INVITE
GROUP_INVITE_FRIEND
GROUP_MESSAGE_INVITE
GROUP_MESSAGE_JOIN
GROUP_MESSAGE_CHANGE_NAME
GROUP_MESSAGE_QUIT
GROUP_MESSAGE_NEW

Change:
GROUP_JOIN_AUDIO
LEAVE_GROUP
@ghost
Copy link

ghost commented Sep 17, 2018

@cebe, you can please look at my translation.

I am not sure about LEAVE_GROUP. I find "Gruppe verlassen" better, but then it's not consistent with GROUP_CREATE, if that is even so important. I find just "Gruppe" to be better, shorter, more natural, easier to read.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants