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

git pushed a commit to branch tytab
in repository terminology.

View the commit online.

commit 8a6105abd7cb746e7978bc7e8d2c9259287ffef1
Author: [email protected] <[email protected]>
AuthorDate: Sun Mar 29 21:33:56 2026 -0600

    refactor: move IPC hash computation to shared tycommon
    
    Extracts _ipc_hash_get() from ipc.c into tycommon.c as ipc_hash_get()
    so tytab can connect to the same IPC socket for the nonce protocol.
    
    Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
---
 src/bin/ipc.c      | 37 ++-----------------------------------
 src/bin/tycommon.c | 40 ++++++++++++++++++++++++++++++++++++++++
 src/bin/tycommon.h |  1 +
 3 files changed, 43 insertions(+), 35 deletions(-)

diff --git a/src/bin/ipc.c b/src/bin/ipc.c
index 6cad2b9f..7dfff99c 100644
--- a/src/bin/ipc.c
+++ b/src/bin/ipc.c
@@ -5,6 +5,7 @@
 #include <Ecore_Ipc.h>
 #include <Eet.h>
 #include "ipc.h"
+#include "tycommon.h"
 
 #define TY_IPC_MAJOR  3
 #define TY_IPC_MINOR  8
@@ -44,41 +45,7 @@ _ipc_cb_client_data(void *_data EINA_UNUSED,
 static char *
 _ipc_hash_get(void)
 {
-   char buf[1024], hash[64] = {};
-   const char *disp, *session, *xdg_session, *xdg_id, *xdg_seat, *xdg_vt;
-   char *s;
-   unsigned int i;
-
-   /* dumb stoopid hash - i'm feeling lazy */
-   disp = getenv("DISPLAY");
-   if (!disp) disp = "-unknown-";
-   session = getenv("DBUS_SESSION_BUS_ADDRESS");
-   if (!session) session = ":unknown:";
-   xdg_session = getenv("XDG_SESSION_COOKIE");
-   if (!xdg_session) xdg_session = "/unknown/";
-   xdg_id = getenv("XDG_SESSION_ID");
-   if (!xdg_id) xdg_id = "=unknown=";
-   xdg_seat = getenv("XDG_SEAT");
-   if (!xdg_seat) xdg_seat = "@unknown@";
-   xdg_vt = getenv("XDG_VTNR");
-   if (!xdg_vt) xdg_vt = "!unknown!";
-   snprintf(buf, sizeof(buf), "%s.%s.%s.%s.%s.%s",
-            disp, session, xdg_session,
-            xdg_id, xdg_seat, xdg_vt);
-   memcpy(hash, "terminology-", 12);
-   memset(hash+12, 'x', 32);
-   for (i = 0, s = buf; *s; s++)
-     {
-        unsigned char c1, c2;
-
-        c1 = (((unsigned char)*s) >> 4) & 0xf;
-        c2 = ((unsigned char)*s) & 0x0f;
-        hash[12 + (i % 32)] = (((hash[12 + (i % 32)] - 'a') ^ c1) % 26) + 'a';
-        i++;
-        hash[12 + (i % 32)] = (((hash[12 + (i % 32)] - 'a') ^ c2) % 26) + 'a';
-        i++;
-     }
-   return strdup(hash);
+   return ipc_hash_get();
 }
 
 void
diff --git a/src/bin/tycommon.c b/src/bin/tycommon.c
index 7503eeaa..e7d62646 100644
--- a/src/bin/tycommon.c
+++ b/src/bin/tycommon.c
@@ -114,6 +114,46 @@ end:
    return res;
 }
 
+char *
+ipc_hash_get(void)
+{
+   char buf[1024], hash[64] = {};
+   const char *disp, *session, *xdg_session, *xdg_id, *xdg_seat, *xdg_vt;
+   char *s;
+   unsigned int i;
+
+   /* dumb stoopid hash - i'm feeling lazy */
+   disp = getenv("DISPLAY");
+   if (!disp) disp = "-unknown-";
+   session = getenv("DBUS_SESSION_BUS_ADDRESS");
+   if (!session) session = ":unknown:";
+   xdg_session = getenv("XDG_SESSION_COOKIE");
+   if (!xdg_session) xdg_session = "/unknown/";
+   xdg_id = getenv("XDG_SESSION_ID");
+   if (!xdg_id) xdg_id = "=unknown=";
+   xdg_seat = getenv("XDG_SEAT");
+   if (!xdg_seat) xdg_seat = "@unknown@";
+   xdg_vt = getenv("XDG_VTNR");
+   if (!xdg_vt) xdg_vt = "!unknown!";
+   snprintf(buf, sizeof(buf), "%s.%s.%s.%s.%s.%s",
+            disp, session, xdg_session,
+            xdg_id, xdg_seat, xdg_vt);
+   memcpy(hash, "terminology-", 12);
+   memset(hash+12, 'x', 32);
+   for (i = 0, s = buf; *s; s++)
+     {
+        unsigned char c1, c2;
+
+        c1 = (((unsigned char)*s) >> 4) & 0xf;
+        c2 = ((unsigned char)*s) & 0x0f;
+        hash[12 + (i % 32)] = (((hash[12 + (i % 32)] - 'a') ^ c1) % 26) + 'a';
+        i++;
+        hash[12 + (i % 32)] = (((hash[12 + (i % 32)] - 'a') ^ c2) % 26) + 'a';
+        i++;
+     }
+   return strdup(hash);
+}
+
 ssize_t
 ty_write(int fd, const void *buf, size_t count)
 {
diff --git a/src/bin/tycommon.h b/src/bin/tycommon.h
index 69b9fcb9..81f38c2e 100644
--- a/src/bin/tycommon.h
+++ b/src/bin/tycommon.h
@@ -1,6 +1,7 @@
 #ifndef TERMINOLOGY_TY_COMMON_H_
 #define TERMINOLOGY_TY_COMMON_H_ 1
 
+char *ipc_hash_get(void);
 int expect_running_in_terminology(void);
 ssize_t ty_write(int fd, const void *buf, size_t count);
 

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

Reply via email to