MyChat add-ons: developing, technical questions, testing, documentation and other useful information
User avatar
Alona Kutsenko
Script is written for those users, who use Windows terminal server. Usually MyChat Client is installed in C:\Program Files (x86)\MyChat Client\ folder, and Windows users launch applications each in their session.

History and settings profiles are stored in separate folders for each Windows user and don't interfere with each other.

The problem occurs when you need to update MyChat Client. Users don't have enough rights to update MyChat. Application shows the message that the server has the latest version and it's impossible to connect to the server. Users can't guess that they have to exit the application. The point is that it's impossible to update running MyChat Client because the system "holds" used program files.

In this case users must use the following updating scheme:

1. Before updating, launch the script to disconnect all Windows terminal server users from MyChat Server and shut down their MyChat Client program.
2. Update MyChat Server.
3. Update MyChat Client on the terminal server.

Script source (MyChat v.5.24+):

Code:

Code: Select all
// ---------------------------------------
// Script created by Alexey Pikurov ([email protected])
// 24.01.2017 11:31:47
// ---------------------------------------
var
  sOnlineUINS: string;
  iUIN: integer;
begin
  sOnlineUINS := mGetUsersListByParams('online');
 
    while length(sOnlineUINS) > 0 do begin
      iUIN := StrToInt(GetNextSt(sOnlineUINS, ','));
      mHaltMyChatClient(iUIN);
    end;
end.