1
0
mirror of https://github.com/Tha14/toxic.git synced 2024-07-01 16:57:45 +02:00

rm unused argument for sort func

This commit is contained in:
Jfreegman 2014-03-13 23:30:44 -04:00
parent ac82961bea
commit d8d198c81c
5 changed files with 24 additions and 17 deletions

View File

@ -62,7 +62,7 @@ static int index_name_cmp(const void *n1, const void *n2)
}
/* sorts friendlist_index first by connection status then alphabetically */
void sort_friendlist_index(Tox *m)
void sort_friendlist_index(void)
{
int i;
int n = 0;
@ -105,7 +105,7 @@ static void friendlist_onConnectionChange(ToxWindow *self, Tox *m, int num, uint
return;
friends[num].online = status == 1 ? true : false;
sort_friendlist_index(m);
sort_friendlist_index();
}
static void friendlist_onNickChange(ToxWindow *self, Tox *m, int num, uint8_t *str, uint16_t len)
@ -117,7 +117,7 @@ static void friendlist_onNickChange(ToxWindow *self, Tox *m, int num, uint8_t *s
len = strlen(str) + 1;
memcpy(friends[num].name, str, len);
friends[num].namelength = len;
sort_friendlist_index(m);
sort_friendlist_index();
}
static void friendlist_onStatusChange(ToxWindow *self, Tox *m, int num, TOX_USERSTATUS status)
@ -168,7 +168,7 @@ void friendlist_onFriendAdded(ToxWindow *self, Tox *m, int num, bool sort)
++max_friends_index;
if (sort)
sort_friendlist_index(m);
sort_friendlist_index();
return;
}
@ -253,7 +253,7 @@ static void delete_friend(Tox *m, int f_num)
if (num_friends && num_selected == num_friends)
--num_selected;
sort_friendlist_index(m);
sort_friendlist_index();
store_data(m, DATA_FILE);
}
@ -425,10 +425,12 @@ static void friendlist_onDraw(ToxWindow *self, Tox *m)
/* Reset friends[f].statusmsg on window resize */
if (fix_statuses) {
uint8_t statusmsg[TOX_MAX_STATUSMESSAGE_LENGTH] = {'\0'};
pthread_mutex_lock(&Winthread.lock);
tox_get_status_message(m, friends[f].num, statusmsg, TOX_MAX_STATUSMESSAGE_LENGTH);
friends[f].statusmsg_len = tox_get_status_message_size(m, f);
pthread_mutex_unlock(&Winthread.lock);
snprintf(friends[f].statusmsg, sizeof(friends[f].statusmsg), "%s", statusmsg);
}
@ -456,6 +458,11 @@ static void friendlist_onDraw(ToxWindow *self, Tox *m)
if (f_selected)
wattroff(self->window, A_BOLD);
// wprintw(self->window, "Last seen ");
// uint64_t last_seen = friends[f].last_online;
}
}
}

View File

@ -38,6 +38,7 @@ typedef struct {
bool online;
bool is_typing;
bool logging_on; /* saves preference for friend irrespective of chat windows */
uint64_t last_online;
TOX_USERSTATUS status;
struct FileReceiver file_receiver;
} ToxicFriend;
@ -54,6 +55,6 @@ int get_friendnum(uint8_t *name);
void friendlist_onFriendAdded(ToxWindow *self, Tox *m, int num, bool sort);
/* sorts friendlist_index first by connection status then alphabetically */
void sort_friendlist_index(Tox *m);
void sort_friendlist_index(void);
#endif /* end of include guard: FRIENDLIST_H_53I41IM */

View File

@ -99,7 +99,7 @@ void write_to_log(uint8_t *msg, uint8_t *name, struct chatlog *log, bool event)
strftime(s, MAX_STR_SIZE, "%Y/%m/%d [%H:%M:%S]", get_time());
fprintf(log->file,"%s %s %s\n", s, name_frmt, msg);
uint64_t curtime = (uint64_t) time(NULL);
uint64_t curtime = get_unix_time();
if (timed_out(log->lastwrite, curtime, LOG_FLUSH_LIMIT)) {
fflush(log->file);

View File

@ -501,8 +501,7 @@ int main(int argc, char *argv[])
prompt = init_windows(m);
/* create new thread for ncurses stuff */
if (pthread_mutex_init(&Winthread.lock, NULL) != 0)
{
if (pthread_mutex_init(&Winthread.lock, NULL) != 0) {
endwin();
fprintf(stderr, "Mutex init failed. Aborting...\n");
exit(EXIT_FAILURE);
@ -515,21 +514,21 @@ int main(int argc, char *argv[])
}
#ifdef _SUPPORT_AUDIO
attron(COLOR_PAIR(RED) | A_BOLD);
wprintw(prompt->window, "Starting audio...\n");
attroff(COLOR_PAIR(RED) | A_BOLD);
av = init_audio(prompt, m);
if ( errors() == NoError )
wprintw(prompt->window, "Audio started with no problems.\n");
else /* Get error code and stuff */
wprintw(prompt->window, "Error starting audio!\n");
#endif /* _SUPPORT_AUDIO */
if (f_loadfromfile)
load_data(m, DATA_FILE);
@ -547,7 +546,7 @@ int main(int argc, char *argv[])
attroff(COLOR_PAIR(RED) | A_BOLD);
}
sort_friendlist_index(m);
sort_friendlist_index();
prompt_init_statusbar(prompt, m);
while (true) {

View File

@ -477,7 +477,7 @@ void prompt_init_statusbar(ToxWindow *self, Tox *m)
snprintf(statusbar->nick, sizeof(statusbar->nick), "%s", nick);
/* temporary until statusmessage saving works */
/* load prev status message or show toxic version if it has never been set */
uint8_t ver[strlen(TOXICVER) + 1];
strcpy(ver, TOXICVER);
uint8_t *toxic_ver = strtok(ver, "_");