MyChat Scripts: function mGetCIDSByClientType, full list of online connections by type
Get the list of all connections (Connection ID) of online applications on the server by type.
Syntax
function mGetCIDSByClientType(const sClientType: string): string;
Parameters and return values
Parameter |
Type |
Value |
sClientType |
string |
connection type divided by commas. If you specify an empty string or the word "any", then all connections will be selected. |
Function result
List of CIDs divided by commas. If the list is empty, then there is no online connections of this type.
Example
The script gets the list of all ConnectionID and shows the IP, client connection type, and UIN of a registered user.
var
sIP, sCIDList, sClientType: string;
iUIN: integer;
iCID: int64;
begin
sCIDList := mGetCIDSByClientType('any');
while length(sCIDList) > 0 do begin
iCID := StrToInt64(Fetch(sCIDList, ','));
iUIN := mGetUINByCID(iCID);
sIP := mGetCIDAttribute(iCID, 'IP');
sClientType := mGetCIDAttribute(iCID, 'ClientType');
mLogScript('UIN: ' + IntToStr(iUIN) + ', IP: ' + sIP + ', ClientType: ' + sClientType, 'CID ' + IntToStr(iCID));
end;
end.
Script work result
[16:17:01] (Log "mGetCIDSByClientType"): [CID 1] UIN: 6, IP: 127.0.0.1, ClientType: admin
[16:17:01] (Log "mGetCIDSByClientType"): [CID 2] UIN: 6, IP: 127.0.0.1, ClientType: kanban
[16:17:01] (Log "mGetCIDSByClientType"): [CID 3] UIN: 6, IP: 127.0.0.1, ClientType: forum
[16:17:01] (Run "mGetCIDSByClientType"): Script operation type: 15 ms
[16:17:01] (Run "mGetCIDSByClientType"): Script done successfully.