User class

The User class represents a user connected to the hub.
Hex.User(iUserId) returns a new object of type User.
For more information about how to create an instance of this object read Hex.User(iUserId) section.

User:SendData(sData)

This function sends data to a user.
This function does not return a value.

Limitations:

You are prohibited from sending data containing: "$connecttome" or "$revconnecttome".
If your data contains either of the above strings then your request to send data will be silently ignored.
If you failed to terminate your data with a pipe then your request to send data will be ignored, but a warning issued in the console window.
This limitation is necessary to prevent a malicious hub owner/administrator to send out forged connection requests.
Requsts to remove this limitation will be denied.

Parameters:

User:Disconnect()

This function disconnects the user.
It returns true on success, and false on failure.

User:GetNick()

This function returns the nickname of the user.
If the user was renamed, you can use User:GetClientNick() to obtain the login nickname (only clients not supporting NickChange).

User:GetClientNick()

This function returns the clients nickname of the user.
For a client not supporting NickChange, this is the nickname used to login with.
Is it recommended that you use this function rather than User:GetNick() if you use the nickname as a part of a command.

For example:
local str = "$To: "..User:GetClientNick().." From: "..BotNick.." $<"..BotNick.." > Hi there "..User:GetNick().."|"
The above example illustrates how to use User:GetNick() and User:GetClientNick() respectivly.

User:GetIP()

This function returns the network address (IP) of the user as a 32 bit number.

User:GetIPString()

This function returns the network address (IP) of the user as a string in dotted notation.

User:GetOpStatus()

This function returns the OP status code of the user.

Return values:

User:SetOpStatus(iOpStatus)

This function changes the OP status of a user.
This function returns true on success, false on error.

Parameters:

OP status codes:

User:GetUserID()

This function returns the user identifier of the user represented by this object.
This function is intended to be used when iterating through the hubs nicklist.

User:GetAccountID()

This function returns the users account identifier, or 0 (zero) if the user is unregistered.
The account identifier can be used to initialize an Account class object (not available yet).

User:GetProfileID

This function returns the users profile identifier, or -1 if the user is unregistered.
The profile idenrifier can be used to initialize the Profile class object.

User:GetLanguage()

This function returns the users hub language as a 2-letter language identifier.

User:SetLanguage(sLanguage)

This function changes users hub language.
This function returns true on success, and false on error.

Parameters:

User:GetMode()

This function returns the name of the chat filter wich set on the user.

User:SetMode()

This function changes the users mode.
This function returns true on success, and false on error.

Parameters:

User:GetISPName()

This function returns the users ISP name.

User:GetAccessLevel()

This function returns the users access level.

User:SetAccessLevel(iAccess)

This function changes the users access level
This function does not return a value.

Parameters:

User:Next()

This function is used when iterating througt the hubs nicklist.
To use this function the User class object must be initialized with the value -1.
This function returns true on success, and false when there is no more users in the nicklist to iterate.
Snippet: Lua code sample: Iterating the nicklist

User:BanIP(sReason, iTime)

This function bans the users network address (IP), but does not disconnect the user.
This function returns true on success, and false on error.
If the ban type is not found in sReason then the ban will not be set.

Ban types (must be included in sReason parameter):

Parameters:

User:BanNick(sReason, iTime)

This function bans the users nickname, but does not disconnect the user.
This function returns true on success, and false on error.
If the ban type is not found in sReason then the ban will not be set.

Ban types (must be included in sReason parameter):

Parameters:

User:BanNickIP(sReason, iTime)

This function bans both the users network address (IP) and nickname, but does not disconnect the user.
This function returns true on success, and false on error.
If the ban type is not found in sReason then the ban will not be set.

Ban types (must be included in sReason parameter):

Parameters:

User:GetFullMyINFO()

This function returns the full $MyINFO string of the user.

User:GetINFO()

This function returns a myinfo string where restictions apply.
To get the myinfo string without restrictions use the User:GetFullMyINFO() function.

User:SetINFO(sMyINFO)

This function changes the users $MyINFO string, but it does not broadcast it.
Your myinfo string will be sent to new users though.
This function returns true on success, and false on error.

Parameters:

Functions for getting or setting fields in the $MyINFO string

These functions returns a part of the myinfo string. The names of the functions indicate what field they return.
All the User:Get* functions return a string.
And all the User:Set* functions take a string as parameter, and returns a boolean to indicate success or failure.
true = success, false = failure.
None of these functions will cause the hub to broadcast the myinfo string, but the updated myinfo is sent to new users.
The User:Set* functions have limitations on the length of the string parameter. Those limitations is stated in hexhub's plugins.txt.

Functions

Lua code sample: Iterating the nicklist

local usr = Hex.User(-1)
local bResult = true
while bResult == true do
	print("Nickname="..usr:GetNick())
	bResult = usr:Next()
end

Generated on Thu Aug 21 11:24:07 2008 for HeXHub/HexScript by  doxygen 1.5.4
Site hosted by SourceForge.net Logo