This is what I've submitted to PPK on how to handle Profile Changing from script in PtokaX ..
It's drafted from my ideas mixed with Mutors and a few others..
Any ideas/suggestions/comments are welcome..
Suggestion to Profile handling in PtokaX
Current API Set:
GetProfiles () -Returning Profile Names in table 1 to n (where 1 = 0)
GetProfilePermission(ProfileNumber) -Returning Profile permissions in table or nil
AddProfile(ProfileName) - Return 1 success or -1 failed. Max ProfileName length 64 chars.
RemoveProfile(ProfileName) - Return 1 success 0 failed (profile don't exist or default profile (0-3)) -1 failed (profile in use)
GetProfileIdx(ProfileName) - Return ProfileNumber or -1 failed
GetProfileName(PrifileName,ProfileNumber) - Return ProfileName or nil for failed
GetUsersByProfile(ProfileName) - Return table with user nicks of given profile name or nil for failed
GetUserProfile(Nick) - Return user profile number if is registered, else nil.
New API Set:
SetProfileName(ProfileNumber,ProfileName) -Set the ProfileName for a given ProfileNumber Returns true/nil forSuccess/Failure
SetProfilePermission(ProfileNumber,Permission,1/0) -Sets the Profile permissions for a given Profile. Returns true for success/nil for failure.
-Snooze
What is Permission in SetProfilePermission(ProfileNumber,Permission,1/0)?
Quote from: bastya_elvtars on 16 July, 2007, 00:16:11
What is Permission in SetProfilePermission(ProfileNumber,Permission,1/0)?
Example:
SetProfilePermission(1,bTopic,1)This would allow profile 1 to set the topic.
Had the command been:
SetProfilePermission(1,bTopic,0)It would have set profile 1 not to set the topic.
bTopic is taken from Scripting-Interface.txt (http://dixbot.com/dixbot/Scripting-Interface.txt)
umm, am I missing something here?
wouldn't SetProfileName(ProfileNumber) need to be SetProfileName("Name",ProfileNumber)?
You're right - Corrected above..
Thanks,
Snooze
Ah, you mean "bTopic" cause bTopic is a nil varname. It would be easily done by fetching the profile object, getting the function's 2nd (string) argument and setting it in the profile table accordingly.
profObj.bTopic = profObj["bTopic"]
The trick must be writing it back to a file.
What not change it completely ::)
ProfMan.AddProfile(sProfileName) - Add profile to profilemanager, return 1 if success or nil when profile already exist.
ProfMan.RemoveProfile(sProfileName) - Remove profile from profilemanager, return 1 if success or nil when profile not exist or is in use.
ProfMan.GetProfiles() - Return table with profiles as profile tables.
ProfMan.GetProfile(sProfileName/iProfileNumber) - Return profile as profile table or nil if not exist.
ProfMan.SetProfileName(iProfileNumber, sProfileName) - Change profile name, return 1 if success or nil if profile not exist.
PRofMan.SetProfilePermission(iProfileNumber, iPermissionId, 1/0) - Change profile permission, return 1 if success or nil if profile not exist.
sProfileName length is limited to 64 chars.
Profile table will for now contain sProfileName, iProfileNumber and table with permissions. More things will come in future.
That would work too, PPK :)
-Snooze