7 #include <doldaconnect/uilib.h>
8 #include <doldaconnect/uimisc.h>
9 #include <doldaconnect/utils.h>
14 void authcallback(int err, wchar_t *reason, void *data)
16 printf("auth: %f\n", ntime() - btime);
17 printf("Logged in: %i\n", err);
19 dc_queuecmd(NULL, NULL, L"quit", NULL);
22 int main(int argc, char **argv)
26 struct dc_response *resp;
30 printf("init: %f\n", ntime() - btime);
31 fd = dc_connect(NULL);
39 if(poll(&pfd, 1, -1) < 0)
44 if((pfd.revents & POLLIN) && dc_handleread())
46 if((pfd.revents & POLLOUT) && dc_handlewrite())
48 while((resp = dc_getresp()) != NULL)
50 if(!wcscmp(resp->cmdname, L".connect"))
52 printf("conn: %f\n", ntime() - btime);
53 printf("Connected: %i\n", resp->code);
55 dc_loginasync(NULL, 1, NULL, authcallback, NULL);
60 printf("fini: %f\n", ntime() - btime);
62 printf("exit: %f\n", ntime() - btime);