$ git clone http://tcclient.ion.nu/tc_client.git
commit 8fd6eb1a361eb46bd74e2c1a1e013c99877ebf79
Author: Alicia <...>
Date: Sat Feb 18 23:31:53 2017 +0100
Adjusted tinychat account support for the latest compatibility-breaking changes.
diff --git a/ChangeLog b/ChangeLog
index 3ad6f6e..7b9a332 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -6,6 +6,7 @@ Cleaned up no-longer-needed headers in client.c
Don't bother trying to verify certificates on windows (lacking a ca bundle)
Fixed tinychat account support.
Call curl_easy_cleanup() at the end of the session to make sure cookies get written.
+Adjusted tinychat account support for the latest compatibility-breaking changes.
modbot: use https instead of http and use the tcclient subdomain since some DNSes have trouble with underscores.
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.
diff --git a/tinychat.c b/tinychat.c
index 529e9b3..e0792e5 100644
--- a/tinychat.c
+++ b/tinychat.c
@@ -166,9 +166,16 @@ static char* getmodkey(const char* user, const char* pass, const char* channel,
{
// TODO: if possible, do this in a neater way than digging the key out from an HTML page.
if(!user||!pass){return 0;}
- char post[strlen("form_sent=1&referer=&username=&password=&next=http://tinychat.com/0")+strlen(user)+strlen(pass)+strlen(channel)];
- sprintf(post, "form_sent=1&referer=&username=%s&password=%s&next=http://tinychat.com/%s", user, pass, channel);
- char* response=http_get("https://tinychat.com/login", post);
+ // Get token
+ char* response=http_get("https://tinychat.com/start/", 0);
+ char* token=strstr(response, "\" name=\"_token\"");
+ token[0]=0;
+ while(token>response && strncmp(token, "value=\"", 7)){--token;}
+ token=&token[7];
+ // Log in
+ char post[strlen("login_username=&login_password=&_token=&next=https://tinychat.com/0")+strlen(user)+strlen(pass)+strlen(token)+strlen(channel)];
+ sprintf(post, "login_username=%s&login_password=%s&_token=%s&next=https://tinychat.com/%s", user, pass, token, channel);
+ response=http_get("https://tinychat.com/login", post);
char* key=strstr(response, "autoop: \"");
if(key)
{
@@ -646,6 +653,7 @@ static void camup(int sock)
{
// Retrieve and send the key for broadcasting access
char* key=getbroadcastkey(channel, nickname, bpassword);
+ if(!key){printf("Failed to get the broadcast key\n"); return;}
struct rtmp amf;
amfinit(&amf, 3);
amfstring(&amf, "bauth");