mirror of
https://github.com/MarekZegare4/MeshCore-Solo.git
synced 2026-08-02 18:26:11 +00:00
feat: DM chat history, per-contact unread badges, bot history, contact index fix
- Add DM_HIST phase in QuickMsgScreen: 32-entry ring buffer tracks incoming and outgoing DMs per contact; selecting a contact now opens history view before compose - Per-contact DM unread badge in contact list (replaces hop count display) - Bot replies (DM and channel) stored in history so they appear on-screen - Fix contact index truncation: _sorted was uint8_t (max 255), causing contacts at indices 256-349 to map to wrong entries; changed to uint16_t - Add addDMMsg() virtual to AbstractUITask; wire through MyMesh.cpp - Incoming chat DMs call addDMMsg(); outgoing after successful send too - msgRead(0) from companion app clears per-contact unread table Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
d1fcd56b59
commit
855f0dada4
@@ -3,6 +3,7 @@
|
||||
// Included at the bottom of MyMesh.cpp after all class definitions.
|
||||
|
||||
void MyMesh::tryBotReplyDM(const ContactInfo& from, const char* text) {
|
||||
if (from.type != ADV_TYPE_CHAT) return;
|
||||
if (!(_prefs.bot_enabled && _prefs.bot_trigger[0] && _prefs.bot_reply_dm[0] &&
|
||||
millis() - _bot_last_reply_ms > 10000UL))
|
||||
return;
|
||||
@@ -24,8 +25,12 @@ void MyMesh::tryBotReplyDM(const ContactInfo& from, const char* text) {
|
||||
sensors.node_lat != 0.0 || sensors.node_lon != 0.0,
|
||||
ts, _prefs.tz_offset_hours);
|
||||
uint32_t expected_ack, est_timeout;
|
||||
if (sendMessage(from, ts, 0, expanded, expected_ack, est_timeout) != MSG_SEND_FAILED)
|
||||
if (sendMessage(from, ts, 0, expanded, expected_ack, est_timeout) != MSG_SEND_FAILED) {
|
||||
_bot_last_reply_ms = millis();
|
||||
#ifdef DISPLAY_CLASS
|
||||
if (_ui) _ui->addDMMsg(from.id.pub_key, true, expanded);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
void MyMesh::tryBotReplyChannel(uint8_t channel_idx, const char* text) {
|
||||
@@ -54,6 +59,14 @@ void MyMesh::tryBotReplyChannel(uint8_t channel_idx, const char* text) {
|
||||
sensors.node_lat != 0.0 || sensors.node_lon != 0.0,
|
||||
ts, _prefs.tz_offset_hours);
|
||||
int rlen = strlen(expanded);
|
||||
if (sendGroupMessage(ts, ch.channel, _prefs.node_name, expanded, rlen))
|
||||
if (sendGroupMessage(ts, ch.channel, _prefs.node_name, expanded, rlen)) {
|
||||
_bot_last_reply_ms = millis();
|
||||
#ifdef DISPLAY_CLASS
|
||||
if (_ui) {
|
||||
char with_sender[160];
|
||||
snprintf(with_sender, sizeof(with_sender), "%s: %s", _prefs.node_name, expanded);
|
||||
_ui->addChannelMsg(channel_idx, with_sender);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user