1 #define _XOPEN_SOURCE 500
11 int main(int argc
, char **argv
) {
12 struct isds_ctx
*ctx
= NULL
;
15 setlocale(LC_ALL
, "");
18 fprintf(stderr
, "Usage: program YOUR_MESSAGE_ID\n");
24 printf("isds_init() failed: %s\n", isds_strerror(err
));
28 isds_set_logging(ILF_ALL
& ~ILF_HTTP
, ILL_ALL
);
30 ctx
= isds_ctx_create();
32 printf("isds_ctx_create() failed");
35 err
= isds_set_timeout(ctx
, 10000);
37 printf("isds_set_timeout() failed: %s\n", isds_strerror(err
));
40 err
= isds_login(ctx
, url
, username(), password(), NULL
, NULL
);
42 printf("isds_login() failed: %s: %s\n", isds_strerror(err
),
43 isds_long_message(ctx
));
45 printf("Logged in :)\n");
49 /* Get sender of message selected by message ID */
51 isds_sender_type
*type
= NULL
;
52 char *raw_type
= NULL
;
55 printf("Getting sender of message with ID: %s\n",
57 err
= isds_get_message_sender(ctx
, argv
[1], &type
, &raw_type
, &name
);
59 printf("isds_get_message_sender() failed: %s: %s\n",
60 isds_strerror(err
), isds_long_message(ctx
));
62 printf("isds_get_message_sender() succeeded:\n");
64 print_sender_type(type
);
65 printf("raw_type = %s\n"
66 "name = %s\n", raw_type
, name
);
75 err
= isds_logout(ctx
);
77 printf("isds_logout() failed: %s\n", isds_strerror(err
));
80 err
= isds_ctx_free(&ctx
);
82 printf("isds_ctx_free() failed: %s\n", isds_strerror(err
));
87 printf("isds_cleanup() failed: %s\n", isds_strerror(err
));