From 3e5b40c0db6a4f9ea54d1be27a03a4cb721e2736 Mon Sep 17 00:00:00 2001 From: Sean Qureshi Date: Sat, 3 Aug 2013 01:55:07 -0700 Subject: [PATCH 1/3] Added a break from a pull request Merged a change from https://github.com/greato/ProjectTox-Core --- prompt.c | 1 + 1 file changed, 1 insertion(+) diff --git a/prompt.c b/prompt.c index 484f590..e71f5f0 100644 --- a/prompt.c +++ b/prompt.c @@ -141,6 +141,7 @@ static void execute(ToxWindow* self, char* cmd) { case -2: wprintw(self->window, "Please add a message to your request.\n"); case -3: + break; wprintw(self->window, "That appears to be your own ID.\n"); break; case -4: From bbffe1b8a38fefa2fe9cde09156b057d9dc6b63a Mon Sep 17 00:00:00 2001 From: Michael Kress Date: Sat, 3 Aug 2013 16:00:48 +0200 Subject: [PATCH 2/3] fixed printing time stamp in toxic --- chat.c | 34 ++++------------------------------ 1 file changed, 4 insertions(+), 30 deletions(-) diff --git a/chat.c b/chat.c index 19f5c97..ddf5923 100644 --- a/chat.c +++ b/chat.c @@ -47,21 +47,8 @@ static void chat_onMessage(ToxWindow* self, int num, uint8_t* msg, uint16_t len) fix_name(msg); fix_name(nick); - int inthour = timeinfo->tm_hour; - int intmin = timeinfo->tm_min; - char min[2]; - char hour[2]; - sprintf(hour,"%d",inthour); - if (intmin < 10) { - sprintf(min,"0%d",intmin); - } else { - sprintf(min,"%d",intmin); - } - - wattron(ctx->history, COLOR_PAIR(2)); - wprintw(ctx->history,"%s",hour); - wprintw(ctx->history,":%s ",min); + wprintw(ctx->history, "%02d:%02d ", timeinfo->tm_hour, timeinfo->tm_min); wattron(ctx->history, COLOR_PAIR(4)); wprintw(ctx->history, "%s: ", nick); wattroff(ctx->history, COLOR_PAIR(4)); @@ -106,24 +93,11 @@ static void chat_onKey(ToxWindow* self, int key) { } } else if(key == '\n') { - - int inthour = timeinfo->tm_hour; //Pretty bad, but it gets the job done - int intmin = timeinfo->tm_min; - char min[2]; - char hour[2]; - sprintf(hour,"%d",inthour); - if (intmin < 10) { - sprintf(min,"0%d",intmin); - } else { - sprintf(min,"%d",intmin); - } wattron(ctx->history, COLOR_PAIR(2)); - wprintw(ctx->history,"%s",hour); - wprintw(ctx->history,":%s ",min); + wprintw(ctx->history, "%02d:%02d ", timeinfo->tm_hour, timeinfo->tm_min); wattron(ctx->history, COLOR_PAIR(1)); wprintw(ctx->history, "you: ", ctx->line); wattroff(ctx->history, COLOR_PAIR(1)); - wprintw(ctx->history, "%s\n", ctx->line); if(m_sendmessage(ctx->friendnum, (uint8_t*) ctx->line, strlen(ctx->line)+1) < 0) { @@ -140,7 +114,7 @@ static void chat_onKey(ToxWindow* self, int key) { ctx->line[--ctx->pos] = '\0'; } } - + } static void chat_onDraw(ToxWindow* self) { @@ -188,7 +162,7 @@ ToxWindow new_chat(int friendnum) { uint8_t nick[MAX_NAME_LENGTH] = {0}; getname(friendnum, (uint8_t*) &nick); fix_name(nick); - + snprintf(ret.title, sizeof(ret.title), "[%s (%d)]", nick, friendnum); ChatContext* x = calloc(1, sizeof(ChatContext)); From f3ee6207770f700cd9161a9bdad16a2366388af1 Mon Sep 17 00:00:00 2001 From: Michael Kress Date: Sat, 3 Aug 2013 16:26:23 +0200 Subject: [PATCH 3/3] added seconds to time stamp in toxic --- chat.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/chat.c b/chat.c index ddf5923..7cae1c0 100644 --- a/chat.c +++ b/chat.c @@ -48,7 +48,7 @@ static void chat_onMessage(ToxWindow* self, int num, uint8_t* msg, uint16_t len) fix_name(nick); wattron(ctx->history, COLOR_PAIR(2)); - wprintw(ctx->history, "%02d:%02d ", timeinfo->tm_hour, timeinfo->tm_min); + wprintw(ctx->history, "%02d:%02d:%02d ", timeinfo->tm_hour, timeinfo->tm_min, timeinfo->tm_sec); wattron(ctx->history, COLOR_PAIR(4)); wprintw(ctx->history, "%s: ", nick); wattroff(ctx->history, COLOR_PAIR(4)); @@ -94,7 +94,7 @@ static void chat_onKey(ToxWindow* self, int key) { } else if(key == '\n') { wattron(ctx->history, COLOR_PAIR(2)); - wprintw(ctx->history, "%02d:%02d ", timeinfo->tm_hour, timeinfo->tm_min); + wprintw(ctx->history, "%02d:%02d:%02d ", timeinfo->tm_hour, timeinfo->tm_min, timeinfo->tm_sec); wattron(ctx->history, COLOR_PAIR(1)); wprintw(ctx->history, "you: ", ctx->line); wattroff(ctx->history, COLOR_PAIR(1));