5 #include <doldaconnect/uilib.h>
6 #include <doldaconnect/uimisc.h>
8 void authcallback(int err, wchar_t *reason, void *data)
10 printf("Logged in: %i\n", err);
13 int main(int argc, char **argv)
17 struct dc_response *resp;
20 fd = dc_connect(NULL);
28 if(poll(&pfd, 1, -1) < 0)
33 if((pfd.revents & POLLIN) && dc_handleread())
35 if((pfd.revents & POLLOUT) && dc_handlewrite())
37 while((resp = dc_getresp()) != NULL)
39 if(!wcscmp(resp->cmdname, L".connect"))
41 printf("Connected: %i\n", resp->code);
43 dc_loginasync(NULL, 1, NULL, authcallback, NULL);