$ git clone http://tcclient.ion.nu/tc_client.git
commit 7b0b6985d204777f81fc6f299143a8c9e89f48ba
Author: Alicia <...>
Date: Wed Jun 10 15:43:38 2015 +0200
Added a /version remote command to give the client name and version number, making /userinfo conform to the flash client's behaviour instead, and send the response with the two separate privacy field options 'n' and 'b'.
diff --git a/ChangeLog b/ChangeLog
index 363325a..980ed2c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,6 @@
0.33:
Fixed the /forgive command (by name) which would previously fail unless the target was found in the first 'banlist' AMF0 packet.
+Added a /version remote command to give the client name and version number, making /userinfo conform to the flash client's behaviour instead, and send the response with the two separate privacy field options 'n' and 'b'.
modbot: fixed finding the duration of videos longer than 59 minutes (conversion from hh:mm:ss format to seconds)
tc_client-gtk: redesigned the startup window to better support frequenting multiple channels.
tc_client-gtk and camviewer: added compatibility code to build on windows (for now the tc_client core still needs to be built with cygwin for windows)
diff --git a/Makefile b/Makefile
index b93e7bc..dbcba48 100644
--- a/Makefile
+++ b/Makefile
@@ -47,7 +47,7 @@ ifdef READLINE_LIBS
INSTALLDEPS+=cursedchat
endif
endif
-CFLAGS+=-DPREFIX=\"$(PREFIX)\"
+CFLAGS+=-DPREFIX=\"$(PREFIX)\" -DVERSION=\"$(VERSION)\"
INSTALLDEPS=tc_client
tc_client: $(OBJ)
diff --git a/client.c b/client.c
index 9cf775a..91a9566 100644
--- a/client.c
+++ b/client.c
@@ -704,30 +704,48 @@ int main(int argc, char** argv)
printf("%s \x1b[%sm%s: ", timestamp(), color, amfin->items[5].string.string);
fwrite(msg, len, 1, stdout);
printf("\x1b[0m\n");
+ char* response=0;
if(len==18 && !strncmp(msg, "/userinfo $request", 18))
{
- char* msg;
if(account_user)
{
- unsigned int len=strlen("/userinfo \n0")+strlen(account_user);
+ unsigned int len=strlen("/userinfo ")+strlen(account_user);
char buf[len+1];
- sprintf(buf, "/userinfo %s\n", account_user);
- msg=tonumlist(buf, len);
+ sprintf(buf, "/userinfo %s", account_user);
+ response=tonumlist(buf, len);
}else{
- msg=tonumlist("/userinfo tc_client\n", 20); // TODO: include version number?
+ response=tonumlist("/userinfo $noinfo", 17);
}
+ }
+ else if(len==8 && !strncmp(msg, "/version", 8))
+ {
+ response=tonumlist("/version tc_client-" VERSION, strlen(VERSION)+19);
+ }
+ if(response)
+ {
+ // Send our command reponse with a privacy field
amfinit(&amf, 3);
amfstring(&amf, "privmsg");
amfnum(&amf, 0);
amfnull(&amf);
- amfstring(&amf, msg);
+ amfstring(&amf, response);
amfstring(&amf, "#0,en");
int id=idlist_get(amfin->items[5].string.string);
char priv[snprintf(0, 0, "n%i-%s", id, amfin->items[5].string.string)+1];
sprintf(priv, "n%i-%s", id, amfin->items[5].string.string);
amfstring(&amf, priv);
amfsend(&amf, sock);
- free(msg);
+ // And again in case they're broadcasting
+ amfinit(&amf, 3);
+ amfstring(&amf, "privmsg");
+ amfnum(&amf, 0);
+ amfnull(&amf);
+ amfstring(&amf, response);
+ amfstring(&amf, "#0,en");
+ priv[0]='b';
+ amfstring(&amf, priv);
+ amfsend(&amf, sock);
+ free(response);
}
free(msg);
fflush(stdout);