Aw citizen add
Minimum requirements | ||
---|---|---|
Added in version 2.1 | ||
SDK | build 13 |
int aw_citizen_add (void)
Description
Adds a new citizen to the universe.
Callback
Notes
It is an error to specify a value for AW_CITIZEN_NUMBER that is greater than the highest citizen number currently assigned in the universe (e.g. you cannot create citizen #456789 if there are only 200 citizens in the universe). To create a new citizen, set AW_CITIZEN_NUMBER to 0 (zero) and the next available citizen number in this universe will be assigned to the account automatically.
AW_CITIZEN_PRIVACY can be set to 0 (zero) or may be set to AW_PRIVACY_BLOCK_TELEGRAMS in order to block telegram capability for this new citizen.
If AW_CITIZEN_IMMIGRATION_TIME is set to 0 (zero) then the current date and time will be used. Note AW_CITIZEN_LAST_LOGIN and AW_CITIZEN_TOTAL_TIME attributes are calculated by the universe server and should not be modified by SDK applications other than for importing purposes.
Arguments
None
Argument attributes
- AW_CITIZEN_NUMBER
- AW_CITIZEN_NAME
- AW_CITIZEN_PASSWORD
- AW_CITIZEN_EMAIL
- AW_CITIZEN_BETA
- AW_CITIZEN_TRIAL
- AW_CITIZEN_CAV_ENABLED
- AW_CITIZEN_PAV_ENABLED
- AW_CITIZEN_BOT_LIMIT
- AW_CITIZEN_COMMENT
- AW_CITIZEN_EXPIRATION_TIME
- AW_CITIZEN_IMMIGRATION_TIME
- AW_CITIZEN_LAST_LOGIN
- AW_CITIZEN_PRIVILEGE_PASSWORD
- AW_CITIZEN_PRIVACY
- AW_CITIZEN_TOTAL_TIME
- AW_CITIZEN_URL
Return values
- RC_SUCCESS (1) (2)
- RC_NOT_INITIALIZED (1)
- RC_NO_INSTANCE (1)
- RC_NO_CONNECTION (1)
- The connection to the universe is down.
- RC_NOT_AVAILABLE (1)
- Instance must be owned by the root account (citizen #1 - universe administrator).
- RC_UNAUTHORIZED (2)
- Instance must be owned by the root account (citizen #1 - universe administrator).
- RC_NAME_ALREADY_USED (2)
- RC_NUMBER_ALREADY_USED (2)
- RC_NAME_TOO_SHORT (2)
- RC_NAME_TOO_LONG (2)
- RC_NAME_CONTAINS_NONALPHANUMERIC_CHAR (2)
- RC_NO_SUCH_CITIZEN (2)
- Name ended with a " (double-quote).
- RC_NAME_ENDS_WITH_BLANK (2)
- RC_NAME_CONTAINS_INVALID_BLANK (2)
(1) Possible return values when a callback is installed.
(2) Returned by the universe server.
Returned attributes
Usage
int rc; aw_int_set (AW_CITIZEN_NUMBER, 0); aw_string_set (AW_CITIZEN_NAME, "George"); aw_string_set (AW_CITIZEN_PASSWORD, "secret"); aw_string_set (AW_CITIZEN_EMAIL, "george@xyz.com"); aw_bool_set (AW_CITIZEN_BETA, 0); aw_bool_set (AW_CITIZEN_TRIAL, 0); aw_bool_set (AW_CITIZEN_CAV_ENABLED, 0); aw_int_set (AW_CITIZEN_BOT_LIMIT, 3); aw_string_set (AW_CITIZEN_COMMENT, ""); aw_int_set (AW_CITIZEN_EXPIRATION_TIME, time (NULL) + 31622400); aw_int_set (AW_CITIZEN_IMMIGRATION_TIME, 0); aw_int_set (AW_CITIZEN_LAST_LOGIN, 0); aw_string_set (AW_CITIZEN_PRIVILEGE_PASSWORD, ""); aw_int_set (AW_CITIZEN_PRIVACY, 0); aw_int_set (AW_CITIZEN_TOTAL_TIME, 0); aw_int_set (AW_CITIZEN_URL, ""); rc = aw_citizen_add (); if (rc != RC_SUCCESS) printf ("Unable to add citizen (reason %d)\n", rc); else printf ("Citizen #%d added\n", aw_int (AW_CITIZEN_NUMBER));