MyChat Scripts: mHaltCID, shut down a remote MyChat application
The function to shut down the remote MyChat Client application by his connection (Connection ID). The client application receives this command and, disconnects from the server and unloads from memory.
Syntax
function mHaltCID(const iCID: int64): integer;
Parameters and return values
Parameter |
Type |
Value |
iCID |
int64 |
connection unique ID; |
Function result
0 |
all OK, connection terminated successfully; |
-1 |
unknown or incorrect CID; |
-2 |
CID must be above zero; |
Example
The script for shutting down all Android applications connected to MyChat Server.
var
sCIDList: string;
iCount: integer;
begin
iCount := 0;
sCIDList := mGetCIDSByClientType('android');
while length(sCIDList) > 0 do
if mHaltCID(StrToInt64(Fetch(sCIDList, ','))) = 0 then inc(iCount);
mLogScript('Total MyChat Android apps halted: ' + IntToStr(iCount), '');
end.
Script work result
[17:35:35] (Log "mHaltCID"): Total MyChat Android apps halted: 94
[17:35:35] (Run "mHaltCID"): Script operation time: 529 ms
[17:35:35] (Run "mHaltCID"): Script done successfully.
The Home screen displayed instead of MyChat for Android.