$ git clone http://tcclient.ion.nu/tc_client.git
commit 7d371c476ab48a1ea686c8a723edebbf0fb78430
Author: Alicia <...>
Date: Thu Mar 3 09:20:54 2016 +0100
Added option --cookies <file> to keep and reuse tinychat HTTP cookies, resulting in having to solve captchas less often.
diff --git a/ChangeLog b/ChangeLog
index 1730377..af07d8c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -3,6 +3,7 @@ Handle multi-line messages.
Added option --hexcolors to print hex color codes instead of ANSI color escape codes.
Added compatibility code for systems lacking strndup() and made configure test for that and dprintf()
Always use format 0 (all fields included) for the first RTMP packet.
+Added option --cookies <file> to keep and reuse tinychat HTTP cookies, resulting in having to solve captchas less often.
Makefile: added missing sourcefiles for the tarball target.
Makefile: added some foolproofing for building on windows.
tc_client-gtk: if HOME is not set use "." instead.
diff --git a/client.c b/client.c
index 7a839d5..581a916 100644
--- a/client.c
+++ b/client.c
@@ -66,6 +66,7 @@ size_t writehttp(char* ptr, size_t size, size_t nmemb, void* x)
}
CURL* curl=0;
+const char* cookiefile="";
char* http_get(const char* url, const char* post)
{
if(!curl){curl=curl_easy_init();}
@@ -75,7 +76,8 @@ char* http_get(const char* url, const char* post)
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, writehttp);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &writebuf);
curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
- curl_easy_setopt(curl, CURLOPT_COOKIEFILE, "");
+ curl_easy_setopt(curl, CURLOPT_COOKIEFILE, cookiefile);
+ curl_easy_setopt(curl, CURLOPT_COOKIEJAR, cookiefile);
curl_easy_setopt(curl, CURLOPT_USERAGENT, "Mozilla Firefox");
if(post){curl_easy_setopt(curl, CURLOPT_POSTFIELDS, post);}
char err[CURL_ERROR_SIZE];
@@ -268,6 +270,8 @@ void usage(const char* me)
"-p, --pass <pass> Password of tinychat account to use.\n"
"-c, --color <value> Color to use in chat.\n"
" --hexcolors Print hex colors instead of ANSI color codes.\n"
+ " --cookies <file> File to store cookies in (not having to solve\n"
+ " the captchas every time)\n"
#ifdef RTMP_DEBUG
" --rtmplog <file> Write RTMP input to file.\n"
#endif
@@ -308,6 +312,11 @@ int main(int argc, char** argv)
++i;
currentcolor=atoi(argv[i]);
}
+ else if(!strcmp(argv[i], "--cookies"))
+ {
+ ++i;
+ cookiefile=argv[i];
+ }
#ifdef RTMP_DEBUG
else if(!strcmp(argv[i], "--rtmplog")){++i; rtmplog=open(argv[i], O_WRONLY|O_CREAT|O_TRUNC, 0600); if(rtmplog<0){perror("rtmplog: open");}}
#endif