This is an automated email from the git hooks/post-receive script.

git pushed a commit to branch tymux
in repository terminology.

View the commit online.

commit ed34134a9e02c17267f40f327763077a1c6de19a
Author: [email protected] <[email protected]>
AuthorDate: Mon Mar 23 22:21:42 2026 -0600

    feat: add PAUSE/RESUME support to Terminology tymux client
    
    - Add cb_pause, cb_resume callbacks and paused flag to TermTymux struct
    - Handle TSRV_MSG_PAUSE/RESUME in _cb_tymux_data: set paused state,
      invoke callbacks, and reset last_seq=0 on RESUME for full resync
    - Skip _sync_shadow and cb_change while paused to avoid rendering
      stale content from a hijacked session
    - Prepend TSRV_ATTACH_HIJACK mode byte to ATTACH payload so the daemon
      can distinguish hijack clients from plain attach clients
    
    Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
---
 src/bin/termtymux.c | 47 ++++++++++++++++++++++++++++++++++++-----------
 src/bin/termtymux.h |  7 +++++++
 2 files changed, 43 insertions(+), 11 deletions(-)

diff --git a/src/bin/termtymux.c b/src/bin/termtymux.c
index aa0a3668..e007b186 100644
--- a/src/bin/termtymux.c
+++ b/src/bin/termtymux.c
@@ -679,9 +679,12 @@ _cb_tymux_data(void *data, Ecore_Fd_Handler *handler EINA_UNUSED)
            if (seq != ts->last_seq)
              {
                 ts->last_seq = seq;
-                _sync_shadow(ts);
-                if (ts->cb_change.func)
-                  ts->cb_change.func(ts->cb_change.data);
+                if (!ts->paused)
+                  {
+                     _sync_shadow(ts);
+                     if (ts->cb_change.func)
+                       ts->cb_change.func(ts->cb_change.data);
+                  }
              }
            break;
         }
@@ -725,6 +728,20 @@ _cb_tymux_data(void *data, Ecore_Fd_Handler *handler EINA_UNUSED)
           }
         break;
 
+      case TSRV_MSG_PAUSE:
+        ts->paused = EINA_TRUE;
+        if (ts->cb_pause.func)
+          ts->cb_pause.func(ts->cb_pause.data);
+        break;
+
+      case TSRV_MSG_RESUME:
+        ts->paused = EINA_FALSE;
+        if (ts->cb_resume.func)
+          ts->cb_resume.func(ts->cb_resume.data);
+        /* Force full resync on next NOTIFY */
+        ts->last_seq = 0;
+        break;
+
       default:
         WRN("termtymux: unexpected message type %d", type);
         break;
@@ -915,14 +932,22 @@ termtymux_attach(const char *tymux_name,
           }
      }
 
-   /* Send ATTACH with tymux name as payload */
-   if (termsrv_msg_send(sock_fd, TSRV_MSG_ATTACH,
-                        tymux_name,
-                        (uint32_t)strlen(tymux_name)) < 0)
-     {
-        ERR("termtymux: send ATTACH: %s", strerror(errno));
-        goto fail;
-     }
+   /* Send ATTACH with mode byte prepended to tymux name */
+   {
+      size_t   name_len = strlen(tymux_name);
+      size_t   pay_len  = 1 + name_len;
+      uint8_t *pay      = alloca(pay_len);
+
+      pay[0] = TSRV_ATTACH_HIJACK;
+      memcpy(pay + 1, tymux_name, name_len);
+
+      if (termsrv_msg_send(sock_fd, TSRV_MSG_ATTACH,
+                           pay, (uint32_t)pay_len) < 0)
+        {
+           ERR("termtymux: send ATTACH: %s", strerror(errno));
+           goto fail;
+        }
+   }
 
    /* Receive ATTACHED + shm memfd (and optional backlog memfd) */
    if (termsrv_recv_attached(sock_fd, &shm_fd, &backlog_fd,
diff --git a/src/bin/termtymux.h b/src/bin/termtymux.h
index fbcb8152..2457be88 100644
--- a/src/bin/termtymux.h
+++ b/src/bin/termtymux.h
@@ -44,6 +44,13 @@ struct _TermTymux {
       void (*func)(void *data);
       void *data;
    } cb_change, cb_title, cb_bell, cb_exit;
+
+   struct {
+      void (*func)(void *data);
+      void *data;
+   } cb_pause, cb_resume;
+
+   Eina_Bool paused;  /* EINA_TRUE when session is paused by hijacker */
 };
 
 /*

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.

Reply via email to