TNT/include/message.h
m1ngsama ed5fc43cbd feat: add :last, :search, :mute-joins commands and MOTD support
- :last [N]: show last N messages from log (max 50, default 10)
- :search <keyword>: case-insensitive full-text search across log history
- :mute-joins: per-client toggle to silence join/leave system messages,
  indicated by [静音] in the title bar
- MOTD: display motd.txt from state directory on connect before entering chat
- Add message_search() to message.c/h for log file scanning
- Update :help and tui help screen (EN/ZH) with new commands
2026-04-23 12:03:27 +08:00

29 lines
839 B
C

#ifndef MESSAGE_H
#define MESSAGE_H
#include "common.h"
/* Message structure */
typedef struct {
time_t timestamp;
char username[MAX_USERNAME_LEN];
char content[MAX_MESSAGE_LEN];
} message_t;
/* Initialize message subsystem */
void message_init(void);
/* Load messages from log file */
int message_load(message_t **messages, int max_messages);
/* Save a message to log file */
int message_save(const message_t *msg);
/* Format a message for display */
void message_format(const message_t *msg, char *buffer, size_t buf_size, int width);
/* Search log file for messages matching query (case-insensitive, username or content).
* Returns the last max_results matches in chronological order; caller must free *results. */
int message_search(const char *query, message_t **results, int max_results);
#endif /* MESSAGE_H */