• Forum
  • Doc
  • Screenshots
  • Download
  • Donate
  • Contributors
  • Contact
  • Follow @phpfreechat
  • DEMO
  • Board index ‹ Version 1.x branch ‹ General Support (v1.x)
  • Change font size
  • FAQ
  • Register
  • Login

Multiple - User is admin? | Command set? | Create custom com

Moderators: OldWolf, re*s.t.a.r.s.*2

Post a reply
8 posts • Page 1 of 1

Postby roschler » Mon Oct 23, 2006 2:04 pm

Pardon the multiple questions, but I think phpFreeChat is truly a great software package and I'm a coder, so I am morally obligated to modify it. :)

Three questions:

1) What is the best way to tell if the user is an admin? I know I can search the admins array, but what if the user changed their "nick"? Where in the code (JS or PHP) is the best patch point to detect this?

2) Command Set? - I believe I read that phpFreeChat is based on the IRC command set. Does anyone have a good URL for a fast learn on what that command set is?

3) How do I create a custom command? - I'm really looking forward to this one. Is there a document that goes into this? If not, what is the best patch point in the source code (JS or PHP), for adding my own command? Also, what guidelines should I follow so that I don't create a command that destabilizes phpFreeChat.

Thanks.
roschler
Member
 
Posts: 23
Joined: Thu Oct 19, 2006 6:44 pm
Top

Postby phpfreechat » Mon Oct 23, 2006 3:40 pm

1) $isadmin = $container->getUserMeta($u->nickid, 'isadmin');
2) List the src/commands/ directory it contains all the basic pfc commands (one per file).
3) Copy one file in src/commands/ rename it to your command name and write some code into (there is not yet developer documentation in pfc).
phpfreechat
Site Admin
 
Posts: 2657
Joined: Tue Feb 07, 2006 3:35 pm
Location: France
Top

Postby roschler » Mon Oct 23, 2006 4:14 pm

Kerphi,

Ok, thanks! BTW, how exactly is the word "container" being used in phpFreeChat? I keep thinking of C++ data storage objects. :)

Thanks.
roschler
Member
 
Posts: 23
Joined: Thu Oct 19, 2006 6:44 pm
Top

Postby phpfreechat » Mon Oct 23, 2006 5:34 pm

In Pfc, a container is a data storage object. In fact, pfc can use different kind of containers:
- file container (it is the default one)
- mysql container [to write]
- shared memory container [to write]
- irc container (a gatway between pfc and a irc server) [to write]
...
The container architecture is here, it just need some ideas and some motivated peoples to write other kind of containers :)
I also wrote some testcases in order to make container's coder task easier. (look in testcases/ directory)
phpfreechat
Site Admin
 
Posts: 2657
Joined: Tue Feb 07, 2006 3:35 pm
Location: France
Top

Postby roschler » Mon Oct 23, 2006 5:47 pm

Ok thanks!
roschler
Member
 
Posts: 23
Joined: Thu Oct 19, 2006 6:44 pm
Top

Postby roschler » Mon Oct 23, 2006 7:54 pm

Kerphi,

Is there any way to tell if the current user is an administrator from the client side? I don't want to pop up my "new user in chatroom" alert box unless the current user is an administrator.

Regarding this:

$isadmin = $container->getUserMeta($u->nickid, 'isadmin');

How can this work? When the page is generated and the PHP code executes, unless "auto-admin" is true, the user joining initially will not be an admin until they "identify". Once they do "identify", it will be too late because the PHP code has already run, right? Or am I missing something.

Thanks.
roschler
Member
 
Posts: 23
Joined: Thu Oct 19, 2006 6:44 pm
Top

Postby phpfreechat » Mon Oct 23, 2006 9:11 pm

First of all to use metadata you must have the lastest subversion... getUserMeta is not available in < 1.0-beta7.

On the client side you should use this javascript function (it's a pfcClient method) : getUserMeta(nickid, 'isadmin')

The 'isadmin' metadata is setup in "connect" command (when 'isadmin' parameters is turned on) or in "identify" command (when the user run "/identify password"). So it will return false it the user is not identified as admin.
phpfreechat
Site Admin
 
Posts: 2657
Joined: Tue Feb 07, 2006 3:35 pm
Location: France
Top

Postby roschler » Tue Oct 24, 2006 1:32 am

Kerphi,

Thanks! I'll update to beta 7 tonight. Having spent a good part of the day learning the client/server structure of the code, I am very impressed by your talents as a programmer.
roschler
Member
 
Posts: 23
Joined: Thu Oct 19, 2006 6:44 pm
Top


Post a reply
8 posts • Page 1 of 1

Return to General Support (v1.x)

Who is online

Users browsing this forum: No registered users and 4 guests

  • Board index
  • The team • Delete all board cookies • All times are UTC + 1 hour
Powered by phpBB® Forum Software © phpBB Group
Sign in
Wrong credentials
Sign up I forgot my password
.
jeu-gratuit.net | more partners
Fork me on GitHub