MsgCommunicator: Delphi Instant Messaging (IM) SDK
for easy creation of custom messenger system
Registers new user at server.
function RegisterNewUser(var UserInfo: TMsgUserInfo; Password: ShortString = ''): Integer;
Fill UserInfo record by user details (UserName at least, set UserID to MSG_INVALID_USER_ID if you would like to allow server to give you a new unique identifier), specify Password (if you plan to prevent unauthorized work), then call RegisterNewUser to register new user at server. RegisterNewUser sends command to the server, waits for an answer, and returns MSG_COMMAND_OK if this operation executed successfully, otherwise it returns one of the following error codes:
If you would like to get desired UserID, you should check if a user with this UserID is not already registered by calling IsUserExisting, then call RegisterNewUser with desired UserInfo.UserID. Note, this operation can be failed if another user gets this UserID first, in this case you'll get MSG_Error_RegisterNewUser_UserAlreadyExists error code.
The best scenario is to enable server to assign you a new unique UserID itself. Just set UserInfo.UserID to MSG_INVALID_USER_ID default value for this way.
RegisterNewUser implicitly calls Logon in case of success to get the full access to the server.
Here you can see the full list of the Return Codes and Error Codes of Client Methods.