1 #define _XOPEN_SOURCE 500
12 struct isds_ctx
*ctx
= NULL
;
15 setlocale(LC_ALL
, "");
19 printf("isds_init() failed: %s\n", isds_strerror(err
));
23 isds_set_logging(ILF_ALL
& ~ILF_HTTP
, ILL_ALL
);
25 ctx
= isds_ctx_create();
27 printf("isds_ctx_create() failed");
30 err
= isds_set_timeout(ctx
, 10000);
32 printf("isds_set_timeout() failed: %s\n", isds_strerror(err
));
35 err
= isds_login(ctx
, url
, username(), password(), NULL
, NULL
);
37 printf("isds_login() failed: %s: %s\n", isds_strerror(err
),
38 isds_long_message(ctx
));
40 printf("Logged in :)\n");
45 struct isds_list
*changed_states
= NULL
, *item
;
46 struct timeval not_before
= { .tv_sec
= 0, .tv_usec
= 0 };
47 struct timeval not_after
;
49 if (!gettimeofday(¬_after
, NULL
)) {
50 /* Changes older than 15 days are not reported currently. */
51 not_before
.tv_sec
= not_after
.tv_sec
- 10 * 24 * 3600;
53 err
= isds_get_list_of_sent_message_state_changes(ctx
,
54 ¬_before
, ¬_after
, &changed_states
);
56 printf("isds_get_list_of_sent_message_state_changes() failed: "
57 "%s: %s\n", isds_strerror(err
), isds_long_message(ctx
));
59 printf("isds_get_list_of_sent_message_state_changes() "
62 printf("No message status changes available\n");
64 for(item
= changed_states
; item
; item
= item
->next
) {
65 printf("List item:\n");
66 print_message_status_change(item
->data
);
71 isds_list_free(&changed_states
);
73 perror("Could not get current time");
78 err
= isds_logout(ctx
);
80 printf("isds_logout() failed: %s\n", isds_strerror(err
));
84 err
= isds_ctx_free(&ctx
);
86 printf("isds_ctx_free() failed: %s\n", isds_strerror(err
));
92 printf("isds_cleanup() failed: %s\n", isds_strerror(err
));