Scripts Engine: mGetCIDAttribute, get a connection attribute
Function to obtain the properties of the user's connection (online connection) by his attribute.
Syntax
function mGetCIDAttribute(iCID: integer; sAttributeName: string): string;
Parameters and return values
Parameter |
Type |
Value |
iCID |
integer |
unique identifier of the user's connection; |
sAttributeName |
string |
attribute name, that you need to obtain. You can specify only one attribute. |
List of available attributes
Name |
Description |
LastAccessUTC |
date/time of the user's connection (UTC) in the format mm.dd.hh.nn.ss; |
ClientType |
|
Ver |
version of the user's application; |
IP |
IP address, from which the connection was made; |
MAC |
MAC address of the user's computer (if it was identified); |
NetName |
network name of the user's computer; |
HardwareID |
hardware identifier of the user's computer (if it was identified); |
OS |
operating system of the user; |
Interfaces |
list of local network connection interfaces, separated by comma; |
Reflink |
referral link, from which the user opened WEB chat; |
Lang |
default language of the user's system; |
UserAgent |
UserAgent of the user browser, if it is WEB chat; |
Secured |
if the user's connection is encrypted or not. |
Function result
Text string, attribute properties of the user's connection. If CID specified incorrectly or attribute not found or empty, then is returns an empty string.
Example
Processing the script event OnPrivateRequest to output the information about the user from WEB support browser to the operator chat:
function OnPrivateRequest(iCID, iUIN, iUINTo, iRole, iRoleReciever, iTask: integer): boolean;
var
s,
sIP, // IP address of WEB support user
sWEBSupportBrowserInfo, // information about the web-browser
sWEBSupportRefLink, // reflink
sWEBSupportsSysLanguage, // browser local language
sWEBSupportsPlatformOS: string; // opearting system of the user
iCIDTo: integer;
begin
if mGetRoleNameByID(iRole) = 'WEB guests' then begin
iCIDTo := mGetUserCID(iUINTo);
if iCIDTo <> -1 then begin
sIP := mGetCIDAttribute(iCID, 'IP');
sWEBSupportBrowserInfo := mGetCIDAttribute(iCID, 'UserAgent');
sWEBSupportRefLink := mGetCIDAttribute(iCID, 'Reflink');
sWEBSupportsSysLanguage := mGetCIDAttribute(iCID, 'Lang');
sWEBSupportsPlatformOS := mGetCIDAttribute(iCID, 'OS');
s := '---------------' + CRLF +
'-=WEB Support=-' + CRLF + CRLF +
'IP: ' + sIP;
if length(sWEBSupportBrowserInfo) > 0 then s := s + CRLF + 'Browser: ' + sWEBSupportBrowserInfo + CRLF;
if length(sWEBSupportRefLink) > 0 then s := s + CRLF + 'Reflink: ' + sWEBSupportRefLink;
if length(sWEBSupportsSysLanguage) > 0 then s := s + CRLF + 'System language: ' + sWEBSupportsSysLanguage;
if length(sWEBSupportsPlatformOS) > 0 then s := s + CRLF + 'OS: ' + sWEBSupportsPlatformOS;
mSendPrivateMessage(iUIN, iUINTo, s, 21, true);
mSendCustomMsgToClientConsoleByCID(iCIDTo, 'WEB support session from UIN ' + inttostr(iUIN), 'newmsg', false, true, 78);
end;
end;
result := true;
end;
begin
end.