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

rm 'connecting' message and a few small fixes

This commit is contained in:
Jfreegman 2014-03-11 18:57:32 -04:00
parent ab0da36cb7
commit 0151b9b49f
3 changed files with 9 additions and 9 deletions

View File

@ -53,7 +53,7 @@ void init_logging_session(uint8_t *name, uint8_t *key, struct chatlog *log)
} else { } else {
struct tm *tminfo = get_time(); struct tm *tminfo = get_time();
snprintf(ident, sizeof(ident), 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); tminfo->tm_hour, tminfo->tm_min, tminfo->tm_sec);
path_len += strlen(ident) + 1; 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); snprintf(name_frmt, sizeof(name_frmt), "%s:", name);
struct tm *tminfo = get_time(); 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_mon+1, tminfo->tm_mday, tminfo->tm_hour, tminfo->tm_min,
tminfo->tm_sec, name_frmt, msg); tminfo->tm_sec, name_frmt, msg);

View File

@ -275,18 +275,18 @@ static void do_connection(Tox *m, ToxWindow *prompt)
bool is_connected = tox_isconnected(m); bool is_connected = tox_isconnected(m);
if (!dht_on && !is_connected && !(conn_try++ % 100)) { if (!dht_on && !is_connected && !(conn_try++ % 100)) {
prep_prompt_win();
if (!conn_err) { 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); wprintw(prompt->window, "\nAuto-connect failed with error code %d\n", conn_err);
}
} }
} else if (!dht_on && is_connected) { } else if (!dht_on && is_connected) {
dht_on = true; dht_on = true;
prompt_update_connectionstatus(prompt, dht_on); prompt_update_connectionstatus(prompt, dht_on);
prep_prompt_win(); prep_prompt_win();
wprintw(prompt->window, "\nDHT connected.\n"); wprintw(prompt->window, "DHT connected.\n");
} else if (dht_on && !is_connected) { } else if (dht_on && !is_connected) {
dht_on = false; dht_on = false;
prompt_update_connectionstatus(prompt, dht_on); prompt_update_connectionstatus(prompt, dht_on);

View File

@ -70,7 +70,7 @@ void print_time(WINDOW *window)
struct tm *timeinfo = get_time(); struct tm *timeinfo = get_time();
wattron(window, COLOR_PAIR(BLUE)); 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)); 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); 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 be empty
- cannot start with a space - cannot start with a space
- must not contain contiguous spaces */ - must not contain contiguous spaces */
bool valid_nick(uint8_t *nick) int valid_nick(uint8_t *nick)
{ {
if (!nick[0] || nick[0] == ' ') if (!nick[0] || nick[0] == ' ')
return false; return false;