1
0
mirror of https://github.com/Tha14/toxic.git synced 2024-11-15 03:33:01 +01:00

show self in group when it's first created

This commit is contained in:
Jfreegman 2015-04-14 01:59:39 -04:00
commit 2acd99b04c
No known key found for this signature in database
GPG Key ID: 3627F3144076AE63
2 changed files with 10 additions and 4 deletions

View File

@ -114,6 +114,7 @@ static const char group_cmd_list[AC_NUM_GROUP_COMMANDS][MAX_CMDNAME_SIZE] = {
static void groupchat_set_group_name(ToxWindow *self, Tox *m, int groupnum); static void groupchat_set_group_name(ToxWindow *self, Tox *m, int groupnum);
ToxWindow new_group_chat(Tox *m, int groupnum, const char *groupname, int length); ToxWindow new_group_chat(Tox *m, int groupnum, const char *groupname, int length);
static void groupchat_onGroupNamelistChange(ToxWindow *self, Tox *m, int groupnum);
int init_groupchat_win(Tox *m, int groupnum, const char *groupname, int length) int init_groupchat_win(Tox *m, int groupnum, const char *groupname, int length)
{ {
@ -139,12 +140,13 @@ int init_groupchat_win(Tox *m, int groupnum, const char *groupname, int length)
if (groupchats[i].peer_names == NULL || groupchats[i].peer_name_lengths == NULL) if (groupchats[i].peer_names == NULL || groupchats[i].peer_name_lengths == NULL)
exit_toxic_err("failed in init_groupchat_win", FATALERR_MEMORY); exit_toxic_err("failed in init_groupchat_win", FATALERR_MEMORY);
set_active_window(groupchats[i].chatwin);
if (i == max_groupchat_index) if (i == max_groupchat_index)
++max_groupchat_index; ++max_groupchat_index;
set_active_window(groupchats[i].chatwin);
groupchat_onGroupNamelistChange(&self, m, groupnum);
store_data(m, DATA_FILE); store_data(m, DATA_FILE);
return 0; return 0;
} }
} }
@ -436,6 +438,9 @@ static void groupchat_onGroupNamelistChange(ToxWindow *self, Tox *m, int groupnu
int num_peers = tox_group_get_number_peers(m, groupnum); int num_peers = tox_group_get_number_peers(m, groupnum);
if (num_peers <= 0)
return;
uint8_t tmp_peerlist[num_peers][TOX_MAX_NAME_LENGTH]; uint8_t tmp_peerlist[num_peers][TOX_MAX_NAME_LENGTH];
uint16_t tmp_peerlens[num_peers]; uint16_t tmp_peerlens[num_peers];

View File

@ -712,10 +712,11 @@ static Tox *load_toxic(char *data_path)
queue_init_message("Falling back to ipv4"); queue_init_message("Falling back to ipv4");
tox_opts.ipv6_enabled = false; tox_opts.ipv6_enabled = false;
m = load_tox(data_path, &tox_opts, &new_err); m = load_tox(data_path, &tox_opts, &new_err);
} else if (new_err != TOX_ERR_NEW_OK) {
exit_toxic_err("Tox network failed to initialize (tox_new failed with error %d)", new_err);
} }
if (new_err != TOX_ERR_NEW_OK)
exit_toxic_err("Tox network failed to initialize (tox_new failed with error %d)", new_err);
init_tox_callbacks(m); init_tox_callbacks(m);
load_friendlist(m); load_friendlist(m);
load_blocklist(BLOCK_FILE); load_blocklist(BLOCK_FILE);