$ git clone http://tcclient.ion.nu/tc_client.git
commit a7d3a1c9b91f1a3e96c5f223538b1046e7b93358
Author: Alicia <...>
Date:   Sun Oct 2 21:41:26 2016 +0200

    tc_client-gtk: when keeping HTTP cookies, use separate cookies per account and one for no account to avoid serverside issues.

diff --git a/ChangeLog b/ChangeLog
index 7e3ab65..7fc29b3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -10,6 +10,7 @@ tc_client-gtk: cleaned up leftover windows compatibility code that is no longer
 tc_client-gtk: changed the greenscreen postprocessor to use libcamera for the background, allowing you to use either another camera or an image through the virtual "Image" camera as background.
 tc_client-gtk: turn URLs mentioned in chat into clickable links.
 tc_client-gtk: reimplemented automatic scrolling using a state to keep track of whether the GtkTextView is scrolled to the bottom and using gtk_text_view_scroll_to_mark() to scroll.
+tc_client-gtk: when keeping HTTP cookies, use separate cookies per account and one for no account to avoid serverside issues.
 tc_client-gtk and camviewer: updated to libavcodec's avcodec_{send,receive}_{frame,packet} API.
 libcamera(v4l2): cache the frame and if there is no data to be read, return the cache instead of blocking.
 0.39:
diff --git a/utilities/gtk/camviewer.c b/utilities/gtk/camviewer.c
index eaa5776..a160d5f 100644
--- a/utilities/gtk/camviewer.c
+++ b/utilities/gtk/camviewer.c
@@ -27,6 +27,7 @@
   #include <sys/wait.h>
 #endif
 #include <ctype.h>
+#include <sys/stat.h>
 #include <libavcodec/avcodec.h>
 #include <libswscale/swscale.h>
 #if LIBAVUTIL_VERSION_MAJOR>50 || (LIBAVUTIL_VERSION_MAJOR==50 && LIBAVUTIL_VERSION_MINOR>37)
@@ -827,12 +828,15 @@ void startsession(GtkButton* button, void* x)
   if(!chanpass[0]){chanpass=gtk_entry_get_text(GTK_ENTRY(gtk_builder_get_object(gui, "cc_password")));}
   const char* acc_user=gtk_entry_get_text(GTK_ENTRY(gtk_builder_get_object(gui, "acc_username")));
   const char* acc_pass=gtk_entry_get_text(GTK_ENTRY(gtk_builder_get_object(gui, "acc_password")));
+  const char* cookiename=(acc_user[0]?acc_user:"no_account");
 #ifdef _WIN32
-  char cmd[strlen("./tc_client --hexcolors --cookies tinychat.cookie -u    0")+strlen(acc_user)+strlen(channel)+strlen(nick)+strlen(chanpass)];
+  char cmd[strlen("./tc_client --hexcolors --cookies tinychat_.cookie -u    0")+strlen(cookiename)+strlen(acc_user)+strlen(channel)+strlen(nick)+strlen(chanpass)];
   strcpy(cmd, "./tc_client --hexcolors ");
   if(config_get_bool("storecookies"))
   {
-    strcat(cmd, "--cookies tinychat.cookie ");
+    strcat(cmd, "--cookies tinychat_");
+    strcat(cmd, cookiename);
+    strcat(cmd, ".cookie ");
   }
   if(acc_user[0])
   {
@@ -860,8 +864,13 @@ void startsession(GtkButton* button, void* x)
     if(config_get_bool("storecookies"))
     {
       const char* home=getenv("HOME");
-      char filename[strlen(home)+strlen("/.tinychat.cookie0")];
-      sprintf(filename, "%s/.tinychat.cookie", home);
+
+      char filename[strlen(home)+strlen("/.config/tc_client-gtk.cookies/0")+strlen(cookiename)];
+      sprintf(filename, "%s/.config", home);
+      mkdir(filename, 0700);
+      sprintf(filename, "%s/.config/tc_client-gtk.cookies", home);
+      mkdir(filename, 0700);
+      sprintf(filename, "%s/.config/tc_client-gtk.cookies/%s", home, cookiename);
       if(acc_user[0])
       {
         execlp(TC_CLIENT, TC_CLIENT, "--hexcolors", "-u", acc_user, "--cookies", filename, channel, nick, chanpass, (char*)0);