MsgCommunicator: Delphi Instant Messaging (IM) SDK
for easy creation of custom messenger system
How to start.
Compile Client and Server demos. Run Server on one machine and distribute Client to all users' computers.
TCP/IP network of any configuration, UDP protocol. If you need something special, please contact email@example.com.
Do not forget to allow local/remote ports in firewalls.
Connecting, Login and Registration.
- Registered user. Set UserID then call Connect or set Connected to True.
- New user. Call Connect then prepare UserInfo (you must set UserName at least) and register new user.
Connection settings can be tuned in ConnectionParams before connecting.
You can add connecting depended specific actions by setting BeforeConnect and/or AfterConnect event handlers.
Connect or RegisterNewUser implicitly calls Logon. You should specify Password property before calling one of these methods. You must be logged to get the full access to the server. If the user is connected but not logged, it is in a guest mode (Connected is set to True, Logged is set to False, UserID is equal to MSG_INVALID_USER_ID default value). In the guest mode, the following commands are available only to enable you to switch to a full access mode and to get some information from the server you possibly need to logon or to register a new user: Logon, RegisterNewUser, IsUserExisting, FindUsers.
procedure SendMessage(ToUserID: Cardinal; const Text: String); overload;
procedure SendMessage(ToUserID: Cardinal; Buffer: PChar; Size: Integer); overload;
procedure SendMessage(ToUserID: Cardinal; Stream: TStream); overload;
FindMessages - Searches messages in message history (available with a database module only).
User details and users database.
|IsUserOnLine - Determines if user is on-line or off-line now.
|GetUserInfo - Determines if user with specified UserID exists in the server database and gets its details.
|FindUsers - Search for the user/users in the server database by user details (available with a database module only).
Working with contact list.
|AddUserToContacts - Adds new user to contact list of the client (i.e. current user specified by UserID property).
|ContactCount - Indicates the total number of users in a contact list.
|Contacts - Contains contact list with details of users.
|OnUserOnLine - Occurs when user presented in your contact list sets connection to the server.
|OnUserOffLine - Occurs when user presented in your contact list disconnects from the server.
To send commands, call SendCommand.
To receive custom commands, set OnReceiveCommand event handler.
Writing server application.