From 0151b9b49fb6528989068ecd7c9a2729e0d0124b Mon Sep 17 00:00:00 2001 From: Jfreegman Date: Tue, 11 Mar 2014 18:57:32 -0400 Subject: [PATCH] rm 'connecting' message and a few small fixes --- src/log.c | 4 ++-- src/main.c | 8 ++++---- src/misc_tools.c | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/log.c b/src/log.c index 5f8b132..de1a244 100644 --- a/src/log.c +++ b/src/log.c @@ -53,7 +53,7 @@ void init_logging_session(uint8_t *name, uint8_t *key, struct chatlog *log) } else { struct tm *tminfo = get_time(); snprintf(ident, sizeof(ident), - "%04d-%02d-%02d[%02d:%02d:%02d]", tminfo->tm_year+1900,tminfo->tm_mon+1, tminfo->tm_mday, + "%04d-%02d-%02d[%d:%02d:%02d]", tminfo->tm_year+1900,tminfo->tm_mon+1, tminfo->tm_mday, tminfo->tm_hour, tminfo->tm_min, tminfo->tm_sec); path_len += strlen(ident) + 1; } @@ -97,7 +97,7 @@ void write_to_log(uint8_t *msg, uint8_t *name, struct chatlog *log, bool event) snprintf(name_frmt, sizeof(name_frmt), "%s:", name); struct tm *tminfo = get_time(); - fprintf(log->file,"%04d/%02d/%02d [%02d:%02d:%02d] %s %s\n", tminfo->tm_year+1900, + fprintf(log->file,"%04d/%02d/%02d [%d:%02d:%02d] %s %s\n", tminfo->tm_year+1900, tminfo->tm_mon+1, tminfo->tm_mday, tminfo->tm_hour, tminfo->tm_min, tminfo->tm_sec, name_frmt, msg); diff --git a/src/main.c b/src/main.c index 4ed4935..2569b68 100644 --- a/src/main.c +++ b/src/main.c @@ -275,18 +275,18 @@ static void do_connection(Tox *m, ToxWindow *prompt) bool is_connected = tox_isconnected(m); if (!dht_on && !is_connected && !(conn_try++ % 100)) { - prep_prompt_win(); if (!conn_err) { - wprintw(prompt->window, "Establishing connection...\n"); - if ((conn_err = init_connection(m))) + if ((conn_err = init_connection(m))) { + prep_prompt_win(); wprintw(prompt->window, "\nAuto-connect failed with error code %d\n", conn_err); + } } } else if (!dht_on && is_connected) { dht_on = true; prompt_update_connectionstatus(prompt, dht_on); prep_prompt_win(); - wprintw(prompt->window, "\nDHT connected.\n"); + wprintw(prompt->window, "DHT connected.\n"); } else if (dht_on && !is_connected) { dht_on = false; prompt_update_connectionstatus(prompt, dht_on); diff --git a/src/misc_tools.c b/src/misc_tools.c index 74b3bf6..b8cb294 100644 --- a/src/misc_tools.c +++ b/src/misc_tools.c @@ -70,7 +70,7 @@ void print_time(WINDOW *window) struct tm *timeinfo = get_time(); wattron(window, COLOR_PAIR(BLUE)); - wprintw(window, "[%02d:%02d:%02d] ", timeinfo->tm_hour, timeinfo->tm_min, timeinfo->tm_sec); + wprintw(window, "[%2d:%02d:%02d] ", timeinfo->tm_hour, timeinfo->tm_min, timeinfo->tm_sec); wattroff(window,COLOR_PAIR(BLUE)); } @@ -189,11 +189,11 @@ int qsort_strcasecmp_hlpr(const void *nick1, const void *nick2) return strcasecmp((const char *) nick1, (const char *) nick2); } -/* Returns true if nick is valid. A valid toxic nick: +/* Returns 1 if nick is valid, 0 if not. A valid toxic nick: - cannot be empty - cannot start with a space - must not contain contiguous spaces */ -bool valid_nick(uint8_t *nick) +int valid_nick(uint8_t *nick) { if (!nick[0] || nick[0] == ' ') return false;