MsgCommunicator: Delphi Instant Messaging (IM) SDK
for easy creation of custom messenger system


TMsgClient.RegisterNewUser
TMsgClient
Top 

Registers new user at server.

function RegisterNewUser(var UserInfo: TMsgUserInfo; Password: ShortString = ''; Logon: Boolean = True): Integer;

Description
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 makes logon by defult. You can set Logon parameter to False in case you have no needs to logon after registration.
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:

Name
Value
MSG_Error_RegisterNewUser_NotConnected   
MSG_Error_RegisterNewUser_SendCommandFailed   
MSG_Error_RegisterNewUser_ReceiveResultFailed   
MSG_Error_RegisterNewUser_InvalidParams   
MSG_Error_RegisterNewUser_InvalidServerReply   
MSG_Error_RegisterNewUser_Failed   
MSG_Error_RegisterNewUser_UserAlreadyExists   
60026   
60027   
60028   
60029   
60030   
60031   
60032


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.



© AidAim Software MsgCommunicator: Delphi Messenger Sdk Instant Messaging Sdk Im Sdk