$ git clone http://tcclient.ion.nu/tc_client.git
commit 2651d4aefc15a71af19ea89087355a055a8ab755
Author: Alicia <...>
Date:   Thu Sep 15 00:53:57 2016 +0200

    tc_client-gtk: if the server disconnects, print the notification and stop any outgoing broadcast.

diff --git a/ChangeLog b/ChangeLog
index 6f1616a..6419984 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -23,6 +23,7 @@ tc_client-gtk: when resizing the window, resize the camera pane before the chat
 tc_client-gtk: break the cameras into two or more rows if it means they can be larger and still fit.
 tc_client-gtk: un-highlight selected PM tabs even if the sender has left.
 tc_client-gtk: prevent new PM tabs from stopping automatic scrolling.
+tc_client-gtk: if the server disconnects, print the notification and stop any outgoing broadcast.
 tc_client-gtk and camviewer: fixed compatibility with newer libavutil.
 tc_client-gtk and camviewer: added compatibility fallbacks for av_image_get_buffer_size() and av_packet_unref()
 tc_client-gtk and camviewer: specify a scaling algorithm for libswscale (mandatory for older versions of libswscale)
diff --git a/utilities/gtk/camviewer.c b/utilities/gtk/camviewer.c
index a8582c1..cd4397b 100644
--- a/utilities/gtk/camviewer.c
+++ b/utilities/gtk/camviewer.c
@@ -159,6 +159,7 @@ void printchat_color(const char* text, const char* color, unsigned int offset, c
   if(bottom){autoscroll_after(scroll);}
 }
 
+unsigned int cameventsource=0;
 char buf[1024];
 gboolean handledata(GIOChannel* iochannel, GIOCondition condition, gpointer datap)
 {
@@ -464,6 +465,17 @@ gboolean handledata(GIOChannel* iochannel, GIOCondition condition, gpointer data
     camera_remove(&buf[10]);
     return 1;
   }
+  if(!strcmp(buf, "Server disconnected"))
+  {
+    printchat(buf, 0);
+    if(camproc)
+    {
+      g_source_remove(cameventsource);
+      kill(camproc, SIGINT);
+      camproc=0;
+    }
+    return 1;
+  }
   if(!strncmp(buf, "Audio: ", 7))
   {
     char* sizestr=strchr(&buf[7], ' ');
@@ -572,7 +584,6 @@ void audiothread(int fd)
 }
 #endif
 
-unsigned int cameventsource=0;
 void togglecam(GtkCheckMenuItem* item, struct viddata* data)
 {
   if(!gtk_check_menu_item_get_active(item))