Display chat messages in console
This commit is contained in:
parent
493fefd89a
commit
690ca0ff28
|
@ -4,6 +4,7 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include "pc/network/network.h"
|
#include "pc/network/network.h"
|
||||||
|
#include "pc/djui/djui_console.h"
|
||||||
|
|
||||||
static void _debuglog_print_timestamp(void) {
|
static void _debuglog_print_timestamp(void) {
|
||||||
time_t ltime = time(NULL);
|
time_t ltime = time(NULL);
|
||||||
|
@ -51,5 +52,6 @@ static void _debuglog_print_log(char* logType, char* filename) {
|
||||||
#define LOG_INFO(...) (configDebugInfo ? ( _debuglog_print_log("INFO", __FILE__), printf(__VA_ARGS__), printf("\n") ) : 0)
|
#define LOG_INFO(...) (configDebugInfo ? ( _debuglog_print_log("INFO", __FILE__), printf(__VA_ARGS__), printf("\n") ) : 0)
|
||||||
#define LOG_ERROR(...) (configDebugError ? ( _debuglog_print_log("ERROR", __FILE__), printf(__VA_ARGS__), printf("\n") ) : 0)
|
#define LOG_ERROR(...) (configDebugError ? ( _debuglog_print_log("ERROR", __FILE__), printf(__VA_ARGS__), printf("\n") ) : 0)
|
||||||
#endif
|
#endif
|
||||||
|
#define LOG_CONSOLE(...) { snprintf(gDjuiConsoleTmpBuffer, CONSOLE_MAX_TMP_BUFFER, __VA_ARGS__), djui_console_message_create(gDjuiConsoleTmpBuffer); }
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -60,7 +60,7 @@ static bool djui_console_on_key_down(UNUSED struct DjuiBase* base, int scancode)
|
||||||
case SCANCODE_ESCAPE: djui_console_toggle(); break;
|
case SCANCODE_ESCAPE: djui_console_toggle(); break;
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
gDjuiConsole->scrolling = (*yValue != yMax);
|
gDjuiConsole->scrolling = (*yValue != 0);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -99,5 +99,9 @@ void network_receive_chat(struct Packet* p) {
|
||||||
|
|
||||||
// add the message
|
// add the message
|
||||||
djui_chat_message_create_from(globalIndex, remoteMessage);
|
djui_chat_message_create_from(globalIndex, remoteMessage);
|
||||||
|
|
||||||
|
if (gNetworkSystem && gNetworkSystem->get_id_str && np && np->name) {
|
||||||
|
LOG_CONSOLE("[%s] %s: %s", gNetworkSystem->get_id_str(np->localIndex), np->name, remoteMessage);
|
||||||
|
}
|
||||||
LOG_INFO("rx chat: %s", remoteMessage);
|
LOG_INFO("rx chat: %s", remoteMessage);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue