$ git clone http://tcclient.ion.nu/tc_client.git
commit 9e7de350db535ea5d2b196259b83394589292e65
Author: Alicia <...>
Date: Fri Oct 30 23:09:28 2015 +0100
Implemented /whois <nick/ID> to check someone's username.
diff --git a/ChangeLog b/ChangeLog
index a6cef9d..a02a42a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,5 @@
0.36:
+Implemented /whois <nick/ID> to check someone's username.
modbot: take time offset into account for the duration of videos.
modbot: added support for /mbpa (pause) and /mbpl (play/resume)
modbot: check that videos can be embedded (for the flash client) before adding them to the queue.
diff --git a/client.c b/client.c
index b72f8c4..a953f28 100644
--- a/client.c
+++ b/client.c
@@ -490,7 +490,8 @@ int main(int argc, char** argv)
"/camup = open an audio/video stream for broadcasting your video\n"
"/camdown = close the broadcasting stream\n"
"/video <length> = send a <length> bytes long encoded frame, send the frame data after this line\n"
- "/topic <topic> = set the channel topic\n");
+ "/topic <topic> = set the channel topic\n"
+ "/whois <nick/ID> = check a user's username\n");
fflush(stdout);
continue;
}
@@ -674,6 +675,19 @@ int main(int argc, char** argv)
amfsend(&amf, sock);
continue;
}
+ else if(!strncmp(buf, "/whois ", 7)) // Request username
+ {
+ amfinit(&amf, 3);
+ amfstring(&amf, "account");
+ amfnum(&amf, 0);
+ amfnull(&amf);
+ int id=idlist_get(&buf[7]);
+ if(id<0 && isdigit(buf[7])){id=atoi(&buf[7]);}
+ sprintf(buf, "%i", id);
+ amfstring(&amf, buf);
+ amfsend(&amf, sock);
+ continue;
+ }
}
char* msg=tonumlist(buf, len);
amfinit(&amf, 3);
@@ -979,6 +993,22 @@ int main(int argc, char** argv)
{
stream_handlestatus(amfin, sock);
}
+ else if(amfin->itemcount>2 && amfin->items[0].type==AMF_STRING && amfin->items[2].type==AMF_OBJECT && amf_comparestrings_c(&amfin->items[0].string, "account"))
+ {
+ struct amfitem* id=amf_getobjmember(&amfin->items[2].object, "id");
+ struct amfitem* account=amf_getobjmember(&amfin->items[2].object, "account");
+ if(id && account && id->type==AMF_NUMBER && account->type==AMF_STRING)
+ {
+ for(i=0; i<idlistlen; ++i)
+ {
+ if(id->number==idlist[i].id)
+ {
+ printf("%s is logged in as %s\n", idlist[i].name, account->string.string);
+ break;
+ }
+ }
+ }
+ }
// else{printf("Unknown command...\n"); printamf(amfin);} // (Debugging)
amf_free(amfin);
}