1 #define _XOPEN_SOURCE 500
12 struct isds_ctx
*ctx
= NULL
;
14 struct isds_DbOwnerInfo
*db_owner_info
= NULL
;
16 setlocale(LC_ALL
, "");
20 printf("isds_init() failed: %s\n", isds_strerror(err
));
24 isds_set_logging(ILF_ALL
& ~ILF_HTTP
, ILL_ALL
);
26 ctx
= isds_ctx_create();
28 printf("isds_ctx_create() failed");
31 err
= isds_set_timeout(ctx
, 10000);
33 printf("isds_set_timeout() failed: %s\n", isds_strerror(err
));
36 err
= isds_login(ctx
, url
, username(), password(), NULL
, NULL
);
38 printf("isds_login() failed: %s: %s\n", isds_strerror(err
),
39 isds_long_message(ctx
));
41 printf("Logged in :)\n");
46 printf("Getting info about my box:\n");
47 err
= isds_GetOwnerInfoFromLogin(ctx
, &db_owner_info
);
49 printf("isds_GetOwnerInfoFromLogin() failed: %s: %s\n",
50 isds_strerror(err
), isds_long_message(ctx
));
52 printf("isds_GetOwnerInfoFromLogin() succeeded\n");
54 print_DbOwnerInfo(db_owner_info
);
58 /* Switch commecrial message receiving status */
61 struct isds_DbOwnerInfo
*new_db_owner_info
= NULL
;
62 char *refnumber
= NULL
;
64 if (db_owner_info
->dbOpenAddressing
)
65 allow
= !*db_owner_info
->dbOpenAddressing
;
69 printf("Switching commerical receiving status to: %s\n",
70 (allow
) ? "true" : "false");
71 err
= isds_switch_commercial_receiving(ctx
, db_owner_info
->dbID
, allow
,
74 printf("isds_switch_commercial_receiving() failed: %s: %s\n",
75 isds_strerror(err
), isds_long_message(ctx
));
77 printf("isds_switch_commercial_receiving() succeeded "
78 "as request #%s\n", refnumber
);
82 printf("Verifying info about my box:\n");
83 err
= isds_GetOwnerInfoFromLogin(ctx
, &new_db_owner_info
);
85 printf("isds_GetOwnerInfoFromLogin() failed: %s: %s\n",
86 isds_strerror(err
), isds_long_message(ctx
));
88 printf("isds_GetOwnerInfoFromLogin() succeeded\n");
89 printf("New status is: ");
90 print_bool(new_db_owner_info
->dbOpenAddressing
);
92 isds_DbOwnerInfo_free(&new_db_owner_info
);
95 isds_DbOwnerInfo_free(&db_owner_info
);
98 err
= isds_logout(ctx
);
100 printf("isds_logout() failed: %s\n", isds_strerror(err
));
104 err
= isds_ctx_free(&ctx
);
106 printf("isds_ctx_free() failed: %s\n", isds_strerror(err
));
110 err
= isds_cleanup();
112 printf("isds_cleanup() failed: %s\n", isds_strerror(err
));