1
0
mirror of https://github.com/Tha14/toxic.git synced 2024-12-23 16:13:24 +01:00

move pointer inits and bug fix

This commit is contained in:
Jfreegman 2013-11-26 22:15:48 -05:00
parent d00b9e26b7
commit 53b1a297d2
2 changed files with 12 additions and 6 deletions

View File

@ -13,6 +13,7 @@
#include "misc_tools.h"
extern ToxWindow *prompt;
extern int num_groupchats;
void cmd_chat_help(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[MAX_STR_SIZE])
{
@ -65,6 +66,11 @@ void cmd_groupinvite(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*a
void cmd_join_group(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[MAX_STR_SIZE])
{
if (num_groupchats >= MAX_GROUPCHAT_NUM) {
wprintw(window, "\nMaximum number of group chats has been reached.\n");
return;
}
uint8_t *groupkey = friends[self->num].pending_groupchat;
if (groupkey[0] == '\0') {

View File

@ -33,7 +33,12 @@ int init_groupchat_win(ToxWindow *prompt, Tox *m, int groupnum)
groupchats[i].chatwin = add_window(m, new_group_chat(m, groupnum));
groupchats[i].active = true;
groupchats[i].num_peers = 0;
set_active_window(groupchats[i].chatwin);
groupchats[i].peer_names = malloc(sizeof(uint8_t *) * TOX_MAX_NAME_LENGTH);
groupchats[i].oldpeer_names = malloc(sizeof(uint8_t *) * TOX_MAX_NAME_LENGTH);
memset(groupchats[i].peer_names, 0, sizeof(groupchats[i].peer_names));
memset(groupchats[i].oldpeer_names, 0, sizeof(groupchats[i].oldpeer_names));
//set_active_window(groupchats[i].chatwin);
if (i == max_groupchat_index)
++max_groupchat_index;
@ -328,11 +333,6 @@ static void groupchat_onInit(ToxWindow *self, Tox *m)
print_groupchat_help(ctx);
wmove(self->window, y-CURS_Y_OFFSET, 0);
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);
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)