mirror of
https://github.com/Tha14/toxic.git
synced 2024-11-26 16:03:27 +01:00
fixed printing time stamp in toxic
This commit is contained in:
parent
c571696c46
commit
bbffe1b8a3
30
chat.c
30
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(msg);
|
||||||
fix_name(nick);
|
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));
|
wattron(ctx->history, COLOR_PAIR(2));
|
||||||
wprintw(ctx->history,"%s",hour);
|
wprintw(ctx->history, "%02d:%02d ", timeinfo->tm_hour, timeinfo->tm_min);
|
||||||
wprintw(ctx->history,":%s ",min);
|
|
||||||
wattron(ctx->history, COLOR_PAIR(4));
|
wattron(ctx->history, COLOR_PAIR(4));
|
||||||
wprintw(ctx->history, "%s: ", nick);
|
wprintw(ctx->history, "%s: ", nick);
|
||||||
wattroff(ctx->history, COLOR_PAIR(4));
|
wattroff(ctx->history, COLOR_PAIR(4));
|
||||||
@ -106,24 +93,11 @@ static void chat_onKey(ToxWindow* self, int key) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(key == '\n') {
|
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));
|
wattron(ctx->history, COLOR_PAIR(2));
|
||||||
wprintw(ctx->history,"%s",hour);
|
wprintw(ctx->history, "%02d:%02d ", timeinfo->tm_hour, timeinfo->tm_min);
|
||||||
wprintw(ctx->history,":%s ",min);
|
|
||||||
wattron(ctx->history, COLOR_PAIR(1));
|
wattron(ctx->history, COLOR_PAIR(1));
|
||||||
wprintw(ctx->history, "you: ", ctx->line);
|
wprintw(ctx->history, "you: ", ctx->line);
|
||||||
wattroff(ctx->history, COLOR_PAIR(1));
|
wattroff(ctx->history, COLOR_PAIR(1));
|
||||||
|
|
||||||
wprintw(ctx->history, "%s\n", ctx->line);
|
wprintw(ctx->history, "%s\n", ctx->line);
|
||||||
|
|
||||||
if(m_sendmessage(ctx->friendnum, (uint8_t*) ctx->line, strlen(ctx->line)+1) < 0) {
|
if(m_sendmessage(ctx->friendnum, (uint8_t*) ctx->line, strlen(ctx->line)+1) < 0) {
|
||||||
|
Loading…
Reference in New Issue
Block a user