Draft: Suggestion to Profile handling in PtokaX
 

News:

29 December 2022 - PtokaX 0.5.3.0 (20th anniversary edition) released...
11 April 2017 - PtokaX 0.5.2.2 released...
8 April 2015 Anti child and anti pedo pr0n scripts are not allowed anymore on this board!
28 September 2015 - PtokaX 0.5.2.1 for Windows 10 IoT released...
3 September 2015 - PtokaX 0.5.2.1 released...
16 August 2015 - PtokaX 0.5.2.0 released...
1 August 2015 - Crowdfunding for ADC protocol support in PtokaX ended. Clearly nobody want ADC support...
30 June 2015 - PtokaX 0.5.1.0 released...
30 April 2015 Crowdfunding for ADC protocol support in PtokaX
26 April 2015 New support hub!
20 February 2015 - PtokaX 0.5.0.3 released...
13 April 2014 - PtokaX 0.5.0.2 released...
23 March 2014 - PtokaX testing version 0.5.0.1 build 454 is available.
04 March 2014 - PtokaX.org sites were temporary down because of DDOS attacks and issues with hosting service provider.

Main Menu

Draft: Suggestion to Profile handling in PtokaX

Started by Snooze, 15 July, 2007, 22:52:40

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Snooze

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

bastya_elvtars

What is Permission in SetProfilePermission(ProfileNumber,Permission,1/0)?
Everything could have been anything else and it would have just as much meaning.

Snooze

#2
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

Madman

umm, am I missing something here?
wouldn't SetProfileName(ProfileNumber) need to be SetProfileName("Name",ProfileNumber)?
We suffer in silence, we lurk in the shadows, we kill in the night
Site currently down, ETA of returning online is 2099 ;p


bastya_elvtars

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.
Everything could have been anything else and it would have just as much meaning.

PPK

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.
"Most of you are familiar with the virtues of a programmer. There are three, of course: laziness, impatience, and hubris." - Larry Wall


SMF spam blocked by CleanTalk