$ git clone http://tcclient.ion.nu/tc_client.git
commit 651be7c8cfb18c46a481e2695e86a8de314fffc4
Author: Alicia <...>
Date:   Fri Mar 10 11:18:14 2017 +0100

    irchack: don't rely on connection ID.

diff --git a/ChangeLog b/ChangeLog
index c82f19c..b4b1443 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -14,6 +14,7 @@ modbot: use https instead of http and use the tcclient subdomain since some DNSe
 modbot: added an option (--no-unapproved) to not add any unapproved videos to queue (videos still get approved by mods requesting or playing them manually)
 tc_client-gtk: fixed a race-condition in the builtin video player.
 tc_client-gtk: fixed some memory leaks.
+irchack: don't rely on connection ID.
 0.41.1:
 Use tinychat.com instead of apl.tinychat.com (works around SSL/TLS issues on windows)
 0.41:
diff --git a/utilities/irchack/irchack.c b/utilities/irchack/irchack.c
index b8128ef..7dfcbd5 100644
--- a/utilities/irchack/irchack.c
+++ b/utilities/irchack/irchack.c
@@ -219,7 +219,7 @@ char session(int sock, const char* nick, const char* channel, const char* pass,
   pfd[1].revents=0;
   char buf[2048];
   char joins=0;
-  char gotconnectionid=0;
+  char gotnick=0; // For services where you get assigned a "random" nickname and get it from the first join.
   while(1)
   {
     poll(pfd, 2, -1);
@@ -278,12 +278,6 @@ printf("Got from tc_client: '%s'\n", buf);
         close(tc_out[0]);
         return 1;
       }
-      if(!strncmp(buf, "Connection ID: ", 15))
-      {
-        gotconnectionid=1;
-        dprintf(sock, ":%s!user@host NICK :guest-%s\n", nick, &buf[15]);
-        continue;
-      }
       if(!strncmp(buf, "No such nick: ", 14))
       {
         dprintf(sock, ":irchack 401 %s %s :No such nick/channel\n", nick, &buf[14]);
@@ -293,7 +287,7 @@ printf("Got from tc_client: '%s'\n", buf);
       if(space && !strcmp(space, " is a moderator."))
       {
         space[0]=0;
-        dprintf(sock, ":irchack MODE #%s +o %s\n", channel, gotconnectionid?buf:nick);
+        dprintf(sock, ":irchack MODE #%s +o %s\n", channel, buf);
         continue;
       }
       if(space && !strcmp(space, " is no longer a moderator."))
@@ -377,11 +371,13 @@ printf("Got from tc_client: '%s'\n", buf);
         msg=&msg[1];
         if(!strcmp(msg, "entered the channel"))
         {
-          dprintf(sock, ":%s!user@host JOIN #%s\n", gotconnectionid?name:nick, channel);
-          if(!gotconnectionid)
+          if(!gotnick)
           {
-            dprintf(sock, ":irchack 353 %s = #%s :%s\n", nick, channel, nick);
+            gotnick=1;
+            dprintf(sock, ":%s!user@host NICK :%s\n", nick, name);
           }
+          dprintf(sock, ":%s!user@host JOIN #%s\n", name, channel);
+          dprintf(1, "Sending to IRC client: ':%s!user@host JOIN #%s'\n", name, channel);
         }
         else if(!strncmp(msg, "changed nickname to ", 20))
         {