X-Git-Url: http://git.dolda2000.com/gitweb/?a=blobdiff_plain;f=clients%2Ftest.c;h=34f0779e5fc5924cba1acbcdb7bbf580577cb28d;hb=7665d29ddb2ab55ab455a4cfcd840ea38af06c04;hp=25deedb15714142ce5d437811c62e2a77015e673;hpb=d3372da97568d5e1f35fa19787c8ec8af93a0435;p=doldaconnect.git diff --git a/clients/test.c b/clients/test.c index 25deedb..34f0779 100644 --- a/clients/test.c +++ b/clients/test.c @@ -1,25 +1,34 @@ #include #include #include +#include +#include #include #include +#include + +int done; +double btime; void authcallback(int err, wchar_t *reason, void *data) { + printf("auth: %f\n", ntime() - btime); printf("Logged in: %i\n", err); + exit(0); + dc_queuecmd(NULL, NULL, L"quit", NULL); } int main(int argc, char **argv) { - int i; struct pollfd pfd; - int fd, done; + int fd; struct dc_response *resp; - struct dc_intresp *ires; + btime = ntime(); dc_init(); - fd = dc_connect("localhost", -1); + printf("init: %f\n", ntime() - btime); + fd = dc_connect(NULL); done = 0; while(!done) { @@ -38,14 +47,18 @@ int main(int argc, char **argv) done = 1; while((resp = dc_getresp()) != NULL) { - if(resp->cmdname == NULL) + if(!wcscmp(resp->cmdname, L".connect")) { - printf("Connected\n"); - dc_loginasync(NULL, 0, NULL, authcallback, NULL); + printf("conn: %f\n", ntime() - btime); + printf("Connected: %i\n", resp->code); + if(resp->code == 201) + dc_loginasync(NULL, 1, NULL, authcallback, NULL); } dc_freeresp(resp); } } + printf("fini: %f\n", ntime() - btime); dc_cleanup(); + printf("exit: %f\n", ntime() - btime); return(0); }