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

bug and format fixes

This commit is contained in:
Jfreegman 2013-09-27 19:55:11 -04:00
parent 49a10e5a40
commit 38f6f446c4
2 changed files with 13 additions and 10 deletions

View File

@ -222,10 +222,8 @@ static void do_tox(Tox *m, ToxWindow *prompt)
if (!dht_on && !tox_isconnected(m) && !(conn_try++ % 100)) { if (!dht_on && !tox_isconnected(m) && !(conn_try++ % 100)) {
if (!conn_err) { if (!conn_err) {
conn_err = init_connection(m); wprintw(prompt->window, "Establishing connection...\n");
wprintw(prompt->window, "\nEstablishing connection...\n"); if (conn_err = init_connection(m))
if (conn_err)
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 && tox_isconnected(m)) { } else if (!dht_on && tox_isconnected(m)) {

View File

@ -87,6 +87,7 @@ static void print_prompt_help(ToxWindow *self)
wprintw(self->window, " /add <id> <message> : Add friend with optional message\n"); wprintw(self->window, " /add <id> <message> : Add friend with optional message\n");
wprintw(self->window, " /accept <n> : Accept friend request\n"); wprintw(self->window, " /accept <n> : Accept friend request\n");
wprintw(self->window, " /connect <ip> <port> <key> : Manually connect to a DHT server\n");
wprintw(self->window, " /status <type> <message> : Set your status with optional note\n"); wprintw(self->window, " /status <type> <message> : Set your status with optional note\n");
wprintw(self->window, " /note <message> : Set a personal note\n"); wprintw(self->window, " /note <message> : Set a personal note\n");
wprintw(self->window, " /nick <nickname> : Set your nickname\n"); wprintw(self->window, " /nick <nickname> : Set your nickname\n");
@ -149,18 +150,22 @@ static void prompt_onKey(ToxWindow *self, Tox *m, wint_t key)
static void prompt_onDraw(ToxWindow *self, Tox *m) static void prompt_onDraw(ToxWindow *self, Tox *m)
{ {
curs_set(1); curs_set(1);
int x, y;
size_t i;
getyx(self->window, y, x);
for (i = 0; i < (strlen(prompt_buf)); ++i) { int x, y, x2, y2;
getyx(self->window, y, x);
getmaxyx(self->window, y2, x2);
size_t i;
for (i = 0; i < (prompt_buf_pos); ++i) {
if ((prompt_buf[i] == '\n') && (y != 0)) if ((prompt_buf[i] == '\n') && (y != 0))
--y; --y;
} }
StatusBar *statusbar = (StatusBar *) self->stb; StatusBar *statusbar = (StatusBar *) self->stb;
werase(statusbar->topline); werase(statusbar->topline);
mvwhline(statusbar->topline, 1, 0, '-', x2);
wmove(statusbar->topline, 0, 0);
if (statusbar->is_online) { if (statusbar->is_online) {
int colour = WHITE; int colour = WHITE;
@ -211,7 +216,7 @@ static void prompt_onDraw(ToxWindow *self, Tox *m)
static void prompt_onInit(ToxWindow *self, Tox *m) static void prompt_onInit(ToxWindow *self, Tox *m)
{ {
scrollok(self->window, 1); scrollok(self->window, true);
print_prompt_help(self); print_prompt_help(self);
wclrtoeol(self->window); wclrtoeol(self->window);
} }