1
0
mirror of https://github.com/Tha14/toxic.git synced 2024-11-23 01:53:02 +01:00

small fix

This commit is contained in:
Jfreegman 2015-01-01 12:50:51 -05:00
parent 4a124dea43
commit ff0fbbc379
No known key found for this signature in database
GPG Key ID: 3627F3144076AE63

View File

@ -200,7 +200,7 @@ int load_blocklist(char *path)
char *data = malloc(len); char *data = malloc(len);
if (data == NULL) { if (data == NULL) {
fclose(fp); fclose(fp);
exit_toxic_err("Failed in load_blocklist", FATALERR_MEMORY); exit_toxic_err("Failed in load_blocklist", FATALERR_MEMORY);
} }
@ -311,7 +311,7 @@ static void friendlist_onMessage(ToxWindow *self, Tox *m, int32_t num, const cha
if (Friends.list[num].chatwin == -1) { if (Friends.list[num].chatwin == -1) {
if (get_num_active_windows() < MAX_WINDOWS_NUM) { if (get_num_active_windows() < MAX_WINDOWS_NUM) {
Friends.list[num].chatwin = add_window(m, new_chat(m, Friends.list[num].num)); Friends.list[num].chatwin = add_window(m, new_chat(m, Friends.list[num].num));
} else { } else {
char nick[TOX_MAX_NAME_LENGTH]; char nick[TOX_MAX_NAME_LENGTH];
get_nick_truncate(m, nick, num); get_nick_truncate(m, nick, num);
@ -477,7 +477,7 @@ static void friendlist_onFileSendRequest(ToxWindow *self, Tox *m, int32_t num, u
line_info_add(prompt, NULL, NULL, NULL, SYS_MSG, 0, RED, line_info_add(prompt, NULL, NULL, NULL, SYS_MSG, 0, RED,
"* File transfer from %s failed: too many windows are open.", nick); "* File transfer from %s failed: too many windows are open.", nick);
sound_notify(prompt, error, NT_WNDALERT_1, NULL); sound_notify(prompt, error, NT_WNDALERT_1, NULL);
} }
} }
@ -631,7 +631,7 @@ void block_friend(Tox *m, int32_t fnum)
if (Friends.num_friends <= 0) if (Friends.num_friends <= 0)
return; return;
realloc_blocklist(Blocked.max_idx + 1); realloc_blocklist(Blocked.max_idx + 1);
memset(&Blocked.list[Blocked.max_idx], 0, sizeof(BlockedFriend)); memset(&Blocked.list[Blocked.max_idx], 0, sizeof(BlockedFriend));
int i; int i;
@ -978,7 +978,7 @@ static void friendlist_onDraw(ToxWindow *self, Tox *m)
int day_dist = ( int day_dist = (
cur_loc_tm.tm_yday - Friends.list[f].last_online.tm.tm_yday cur_loc_tm.tm_yday - Friends.list[f].last_online.tm.tm_yday
+ ((cur_loc_tm.tm_year - Friends.list[f].last_online.tm.tm_year) * 365) + ((cur_loc_tm.tm_year - Friends.list[f].last_online.tm.tm_year) * 365)
) % 365; );
const char *hourmin = Friends.list[f].last_online.hour_min_str; const char *hourmin = Friends.list[f].last_online.hour_min_str;
switch (day_dist) { switch (day_dist) {
@ -1042,7 +1042,7 @@ static void friendlist_onAv(ToxWindow *self, ToxAv *av, int call_index)
if (get_num_active_windows() < MAX_WINDOWS_NUM) { if (get_num_active_windows() < MAX_WINDOWS_NUM) {
if (toxav_get_call_state(av, call_index) == av_CallStarting) { /* Only open windows when call is incoming */ if (toxav_get_call_state(av, call_index) == av_CallStarting) { /* Only open windows when call is incoming */
Friends.list[id].chatwin = add_window(m, new_chat(m, Friends.list[id].num)); Friends.list[id].chatwin = add_window(m, new_chat(m, Friends.list[id].num));
} }
} else { } else {
char nick[TOX_MAX_NAME_LENGTH]; char nick[TOX_MAX_NAME_LENGTH];
get_nick_truncate(m, nick, Friends.list[id].num); get_nick_truncate(m, nick, Friends.list[id].num);
@ -1050,7 +1050,7 @@ static void friendlist_onAv(ToxWindow *self, ToxAv *av, int call_index)
const char *errmsg = "* Warning: Too many windows are open."; const char *errmsg = "* Warning: Too many windows are open.";
line_info_add(prompt, NULL, NULL, NULL, SYS_MSG, 0, RED, errmsg); line_info_add(prompt, NULL, NULL, NULL, SYS_MSG, 0, RED, errmsg);
sound_notify(prompt, error, NT_WNDALERT_1, NULL); sound_notify(prompt, error, NT_WNDALERT_1, NULL);
} }
} }
@ -1089,18 +1089,18 @@ ToxWindow new_friendlist(void)
ret.onEnd = &friendlist_onAv; ret.onEnd = &friendlist_onAv;
ret.onRequestTimeout = &friendlist_onAv; ret.onRequestTimeout = &friendlist_onAv;
ret.onPeerTimeout = &friendlist_onAv; ret.onPeerTimeout = &friendlist_onAv;
ret.call_idx = -1; ret.call_idx = -1;
ret.device_selection[0] = ret.device_selection[1] = -1; ret.device_selection[0] = ret.device_selection[1] = -1;
#endif /* AUDIO */ #endif /* AUDIO */
ret.active_box = -1; ret.active_box = -1;
Help *help = calloc(1, sizeof(Help)); Help *help = calloc(1, sizeof(Help));
if (help == NULL) if (help == NULL)
exit_toxic_err("failed in new_friendlist", FATALERR_MEMORY); exit_toxic_err("failed in new_friendlist", FATALERR_MEMORY);
ret.help = help; ret.help = help;
strcpy(ret.name, "contacts"); strcpy(ret.name, "contacts");
return ret; return ret;