# HG changeset patch # User Matti Hamalainen # Date 1579284221 -7200 # Node ID f3ec1cb11cea96c24b83f368653502313d4d3ac3 # Parent e9232ce52bf8acba0b0c932241902a3fc44b6194 Trim whitespace. diff -r e9232ce52bf8 -r f3ec1cb11cea main.c --- a/main.c Fri Jan 17 19:30:48 2020 +0200 +++ b/main.c Fri Jan 17 20:03:41 2020 +0200 @@ -173,7 +173,7 @@ rdata->desc, rdata->port); } - + printf("\n"); } @@ -387,7 +387,7 @@ if (str == NULL) return FALSE; - + msg = th_strdup_printf("%s%s", user, str); if (msg != NULL) @@ -472,7 +472,7 @@ char tmpStr[128]; nn_window_t *tmpwin = (win != NULL) ? win : nnwin_main_window(); - // Only the main window + // Only the main window if (win == NULL && tmpwin != NULL && (flags & LOG_RECURSIVE) == 0) { time_t currTime = time(NULL); @@ -632,7 +632,7 @@ BOOL nn_check_name_list(th_llist_t *list, const char *name) { th_llist_t *node; - + for (node = list; node != NULL; node = node->next) { if (th_strcasecmp(name, (char *) node->data) == 0) @@ -658,7 +658,7 @@ t = th_conn_buf_strstr(conn, ""); if (!t) return 2; msg = conn->base.ptr; - + t = th_conn_buf_strstr(conn, ""); if (!t) return 3; *t = 0; @@ -700,7 +700,7 @@ nn_window_t *win; h = nn_decode_str2(t + 1); - // Check type of + // Check type of if ((isMine = strncmp(t, "BPRV from ", 10)) == 0) in_name = nn_decode_str2(t + 10); else @@ -732,7 +732,7 @@ "½11½%s½0½\n", h); } } - + th_free(in_name); th_free(h); } @@ -771,7 +771,7 @@ colorText = 0; } } - + printMsgF(NULL, isIgnored ? LOG_FILE : (LOG_WINDOW | LOG_FILE), "½5½<½%d½%s½5½>½%d½ %s½0½\n", colorNick, name, colorText, h); th_free(h); @@ -969,7 +969,7 @@ // Newer method, supported by new-ish versions of Firefox execlp(setBrowser, setBrowser, "-new-tab", uri, (void *)NULL); break; - + default: // Default old method { @@ -1011,7 +1011,7 @@ (void) conn; printMsg(currWin, "Opening profile for: '%s'\n", name); - + nn_open_uri(uri); th_free(uri); @@ -1225,7 +1225,7 @@ color = 3; snprintf(name, sizeof(name), "[½%d½%-20s½0½] ", color, user->name); - + d->total++; if (d->i >= NAME_NUM_PER_LINE) { @@ -1233,7 +1233,7 @@ d->i = 0; d->offs = 0; } - + len = strlen(name); memcpy(d->buf + d->offs, name, len + 1); d->offs += len; @@ -1396,7 +1396,7 @@ char *nbuf; if (buf[cmd->len] != 0 && !th_isspace(buf[cmd->len])) continue; - + nbuf = str_trim_left(buf + cmd->len); switch (cmd->flags) @@ -1409,7 +1409,7 @@ return 1; } break; - + case CMDARG_NONE: if (nbuf[0]) { @@ -1440,7 +1440,7 @@ } } } - + printMsgQ(currWin, "Unknown command: %s\n", buf); return 1; } @@ -1467,7 +1467,7 @@ if (list == NULL || pattern == NULL) return NULL; len = strlen(pattern); - + if (current != NULL) { th_llist_t *node; @@ -1548,13 +1548,13 @@ static void nn_tabcomplete_replace(nn_editbuf_t *buf, size_t *pi, const size_t startPos, const size_t endPos, char *c) { size_t i; - + for (i = startPos; i <= endPos; i++) nn_editbuf_delete(buf, startPos); for (i = startPos; *c; i++, c++) nn_editbuf_insert(buf, i, *c); - + *pi = i; } @@ -1790,7 +1790,7 @@ case 0x09: // Tab = complete username or command nn_tabcomplete_buffer(editBuf); break; - + default: return FALSE; } @@ -1802,7 +1802,7 @@ BOOL processUserPrompt(int c, nn_editbuf_t *editBuf, nn_editstate_t *editState) { (void) editBuf; - + switch (c) { case KEY_ENTER: @@ -1813,7 +1813,7 @@ printMsg(currWin, "Quitting per user request (%d/0x%x).\n", c, c); appQuitFlag = TRUE; break; - + default: return FALSE; } @@ -1874,7 +1874,7 @@ // PRV chat log size_t pos; char *cleaned; - + if ((cleaned = th_strdup(win->id)) == NULL) return FALSE; @@ -1889,7 +1889,7 @@ th_free(cleaned); } - + // Try to open the file for appending if (win->logFilename == NULL) goto error; @@ -2200,7 +2200,7 @@ errorMsg("Could not create connection structure.\n"); goto err_exit; } - + editState.conn = conn; // Are we using a proxy? @@ -2265,7 +2265,7 @@ // Initialize user commands nn_usercmd_init(); - + // Initialize random numbers editState.prevKeepAlive = time(NULL); srand((int) editState.prevKeepAlive); @@ -2335,7 +2335,7 @@ colorSet = TRUE; nn_conn_send_msg_v(conn, optUserNameEnc, "%%2FSetFontColor%%20%%2Dcolor%%20%06X", optUserColor); } - + if (appCursesInit && !flushed) { nnwin_update(FALSE, editState.mask, editBuf, optUserName, optUserColor); diff -r e9232ce52bf8 -r f3ec1cb11cea ui.c --- a/ui.c Fri Jan 17 19:30:48 2020 +0200 +++ b/ui.c Fri Jan 17 20:03:41 2020 +0200 @@ -120,7 +120,7 @@ chatWindows[0] = nn_window_new(NULL); nn_log_open(chatWindows[0]); currWin = chatWindows[0]; - + return TRUE; } @@ -225,7 +225,7 @@ *col = A_DIM | COLOR_PAIR(val); else if (val < 30) *col = A_BOLD | COLOR_PAIR(val - 9); - + return TRUE; } @@ -244,7 +244,7 @@ (*buf)[*len] = ((unsigned char) ch) | color; (*len)++; - + return TRUE; } @@ -253,10 +253,10 @@ { const char *s = fmt; int col = 0; - + if (win == NULL) return -16; - + while (*s) { if (win->line == NULL) @@ -351,7 +351,7 @@ // Save cursor position getyx(stdscr, sy, sx); } - + // Check if update is forced or if the window is dirty if (currWin != NULL && (force || currWin->dirty)) { @@ -410,7 +410,7 @@ " ½10½%s½13½ | ½16½%s½13½ | ½11½#%06x½13½ | WIN: %d: %s / %d | ½11½", tmpStamp, username, - usercolor, + usercolor, currWin->num + 1, currWin->id != NULL ? currWin->id : "MAIN", currWin->pos); @@ -424,7 +424,7 @@ (currWin != NULL && currWin->id != NULL) ? currWin->id : "MAIN", currWin != NULL ? currWin->pos : 0); #endif - + wmove(stdscr, scrHeight - 4, 0); wbkgdset(stdscr, COLOR_PAIR(10)); wclrtoeol(stdscr); @@ -438,7 +438,7 @@ waddstr(stdscr, tmpStr); } } - + // Restore cursor position wmove(stdscr, sy, sx); } @@ -482,13 +482,13 @@ BOOL (*callback)(int, nn_editbuf_t *, nn_editstate_t *)) { int c, cnt = 0; - + // Handle several buffered keypresses at once do { c = wgetch(stdscr); - - /* Handle various problematic cases where terminal + + /* Handle various problematic cases where terminal * keycodes do not get properly translated by curses */ if (c == 10 || c == 13) @@ -683,14 +683,14 @@ { nnwin_input_process(editBuf, editState, callback); update(editBuf, editState); - } - + } + if (allowEmpty || editBuf->len > 0) res = nn_editbuf_get_string(editBuf, 0, editBuf->len); else res = NULL; nn_editbuf_free(editBuf); - + return res; } diff -r e9232ce52bf8 -r f3ec1cb11cea util.c --- a/util.c Fri Jan 17 19:30:48 2020 +0200 +++ b/util.c Fri Jan 17 20:03:41 2020 +0200 @@ -37,7 +37,7 @@ for (pos = strlen(buf) - 1; pos > 0 && th_isspace(buf[pos]); pos--) buf[pos] = 0; - + return buf; } @@ -467,13 +467,13 @@ int n = 0; const uint8_t *c = (uint8_t *)name; uint8_t hash = 0xff; - + while (*c && n < 4) { hash = (hash << 1) ^ tolower(*c); c++; n++; } - + return (hash & 0xff); */ return (uint8_t) tolower(name[0]);