mirror of
https://github.com/Tha14/toxic.git
synced 2024-11-16 04:13:02 +01:00
fixes
This commit is contained in:
parent
33ec2f96c2
commit
d00b9e26b7
@ -124,8 +124,10 @@ static void copy_peernames(int gnum, int npeers, uint8_t tmp_peerlist[][TOX_MAX_
|
|||||||
free(groupchats[gnum].peer_names);
|
free(groupchats[gnum].peer_names);
|
||||||
free(groupchats[gnum].oldpeer_names);
|
free(groupchats[gnum].oldpeer_names);
|
||||||
|
|
||||||
groupchats[gnum].peer_names = malloc(sizeof(uint8_t *) * npeers * TOX_MAX_NAME_LENGTH);
|
int N = TOX_MAX_NAME_LENGTH;
|
||||||
groupchats[gnum].oldpeer_names = malloc(sizeof(uint8_t *) * npeers * TOX_MAX_NAME_LENGTH);
|
|
||||||
|
groupchats[gnum].peer_names = malloc(sizeof(uint8_t *) * npeers * N);
|
||||||
|
groupchats[gnum].oldpeer_names = malloc(sizeof(uint8_t *) * npeers * N);
|
||||||
|
|
||||||
if (groupchats[gnum].peer_names == NULL || groupchats[gnum].oldpeer_names == NULL) {
|
if (groupchats[gnum].peer_names == NULL || groupchats[gnum].oldpeer_names == NULL) {
|
||||||
endwin();
|
endwin();
|
||||||
@ -134,7 +136,6 @@ static void copy_peernames(int gnum, int npeers, uint8_t tmp_peerlist[][TOX_MAX_
|
|||||||
}
|
}
|
||||||
|
|
||||||
int i;
|
int i;
|
||||||
int N = TOX_MAX_NAME_LENGTH;
|
|
||||||
|
|
||||||
for (i = 0; i < npeers; ++i) {
|
for (i = 0; i < npeers; ++i) {
|
||||||
memcpy(&groupchats[gnum].peer_names[i*N], tmp_peerlist[i], N);
|
memcpy(&groupchats[gnum].peer_names[i*N], tmp_peerlist[i], N);
|
||||||
@ -300,9 +301,8 @@ static void groupchat_onDraw(ToxWindow *self, Tox *m)
|
|||||||
mvwaddch(ctx->sidebar, y-CHATBOX_HEIGHT, 0, ACS_BTEE);
|
mvwaddch(ctx->sidebar, y-CHATBOX_HEIGHT, 0, ACS_BTEE);
|
||||||
|
|
||||||
int num_peers = groupchats[self->num].num_peers;
|
int num_peers = groupchats[self->num].num_peers;
|
||||||
if (num_peers) {
|
|
||||||
int i;
|
|
||||||
int N = TOX_MAX_NAME_LENGTH;
|
int N = TOX_MAX_NAME_LENGTH;
|
||||||
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < num_peers; ++i) {
|
for (i = 0; i < num_peers; ++i) {
|
||||||
wmove(ctx->sidebar, i, 1);
|
wmove(ctx->sidebar, i, 1);
|
||||||
@ -311,7 +311,6 @@ static void groupchat_onDraw(ToxWindow *self, Tox *m)
|
|||||||
? &groupchats[self->num].peer_names[i*N] : (uint8_t *) UNKNOWN_NAME;
|
? &groupchats[self->num].peer_names[i*N] : (uint8_t *) UNKNOWN_NAME;
|
||||||
wprintw(ctx->sidebar, "%s\n", nick);
|
wprintw(ctx->sidebar, "%s\n", nick);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
wrefresh(self->window);
|
wrefresh(self->window);
|
||||||
}
|
}
|
||||||
@ -332,6 +331,8 @@ static void groupchat_onInit(ToxWindow *self, Tox *m)
|
|||||||
|
|
||||||
groupchats[self->num].peer_names = malloc(sizeof(uint8_t *) * TOX_MAX_NAME_LENGTH);
|
groupchats[self->num].peer_names = malloc(sizeof(uint8_t *) * TOX_MAX_NAME_LENGTH);
|
||||||
groupchats[self->num].oldpeer_names = malloc(sizeof(uint8_t *) * TOX_MAX_NAME_LENGTH);
|
groupchats[self->num].oldpeer_names = malloc(sizeof(uint8_t *) * TOX_MAX_NAME_LENGTH);
|
||||||
|
memset(groupchats[self->num].peer_names, 0, sizeof(groupchats[self->num].peer_names));
|
||||||
|
memset(groupchats[self->num].oldpeer_names, 0, sizeof(groupchats[self->num].oldpeer_names));
|
||||||
}
|
}
|
||||||
|
|
||||||
ToxWindow new_group_chat(Tox *m, int groupnum)
|
ToxWindow new_group_chat(Tox *m, int groupnum)
|
||||||
|
Loading…
Reference in New Issue
Block a user