PtokaX forum

Archive => AllInOne Scripts => Archived 5.1 boards => DiXBoT => Topic started by: Snooze on 15 July, 2007, 22:52:40

Title: Draft: Suggestion to Profile handling in PtokaX
Post by: Snooze on 15 July, 2007, 22:52:40
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
Title: Re: Draft: Suggestion to Profile handling in PtokaX
Post by: bastya_elvtars on 16 July, 2007, 00:16:11
What is Permission in SetProfilePermission(ProfileNumber,Permission,1/0)?
Title: Re: Draft: Suggestion to Profile handling in PtokaX
Post by: Snooze on 16 July, 2007, 00:24:48
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)
Title: Re: Draft: Suggestion to Profile handling in PtokaX
Post by: Madman on 16 July, 2007, 00:27:01
umm, am I missing something here?
wouldn't SetProfileName(ProfileNumber) need to be SetProfileName("Name",ProfileNumber)?
Title: Re: Draft: Suggestion to Profile handling in PtokaX
Post by: Snooze on 16 July, 2007, 00:30:25
You're right - Corrected above..

Thanks,
Snooze
Title: Re: Draft: Suggestion to Profile handling in PtokaX
Post by: bastya_elvtars on 16 July, 2007, 03:09:35
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.
Title: Re: Draft: Suggestion to Profile handling in PtokaX
Post by: PPK on 16 July, 2007, 06:54:09
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.
Title: Re: Draft: Suggestion to Profile handling in PtokaX
Post by: Snooze on 16 July, 2007, 11:48:28
That would work too, PPK :)

-Snooze