MyChat Scripts: function mGetCIDSByUINAndClientType, user's connection list
Getting a list of connections (Connection ID) of a user's online applications by his UIN and application type.
Syntax
function GetCIDSByUINAndClientType(const iUIN: integer; const sClientType: string): integer;
Parameters and return values
Parameter |
Type |
Value |
iUIN |
integer |
user ID; his CIDs we need to get; |
sClientType |
string |
connection types divided by commas. When specifying an empty string or the word "any", all the connections are selected; |
Function result
A list of CIDs divided by commas. If the list is empty, a user is offline.
Example
const
iUIN = 6; // user UIN for test, set your own number
var
iCID: integer;
sCIDList, sClientType, sIP: string;
begin
sCIDList := mGetCIDSByUINAndClientType(iUIN, 'win32,web,forum,kanban,admin');
if length(sCIDList) = 0 then mLogScript('User is offline or unregistered UIN', '')
else begin
while length(sCIDList) > 0 do begin
iCID := StrToInt(Fetch(sCIDList, ','));
sClientType := mGetCIDAttribute(iCID, 'ClientType');
sIP := mGetCIDAttribute(iCID, 'IP');
mLogScript(sClientType, sIP);
end;
end;
end.
Script work result
[15:35:47] (Log "mGetCIDSByUIN"): [192.168.10.1] win32
[15:35:47] (Log "mGetCIDSByUIN"): [192.168.10.13] web
[15:35:47] (Log "mGetCIDSByUIN"): [192.168.10.113] admin
[15:35:47] (Log "mGetCIDSByUIN"): [213.130.24.149] kanban
[15:35:47] (Log "mGetCIDSByUIN"): [213.130.24.149] forum
[15:35:47] (Run "mGetCIDSByUIN"): Script operation time: 3 ms
[15:35:47] (Run "mGetCIDSByUIN"): Script done successfully.