Anope IRC Services

Please login or register.

Login with username, password and session length
Advanced search  

News:

Pages: [1]   Go Down

Author Topic: MySQL NickServ Flags? Help!  (Read 2706 times)

0 Members and 1 Guest are viewing this topic.

Westwood

  • Guest
MySQL NickServ Flags? Help!
« on: December 20, 2006, 05:33:58 PM »

Hey,

I've just installed anope with mysql support and everything is running perfectly... BUT I've kind of come to a stand-still with the database because I'm trying to figure out how the flags work for a nickname in apone_ns_core.

For example, I'm creating a web interface using PHP & MySQL, though I would like to use the flags in a manner of identifying service admins, specific nick settings (e.g. /nickserv set kill quick) and so on.

How or where could I find a reference explaining and describing how these flags work and how I could resolve this for the web interface.

Please help!
Logged

heinz

  • Guest
(No subject)
« Reply #1 on: December 20, 2006, 05:45:49 PM »

The flags are based off the NI_ defines in services.h. You'll need to use bitwise comparison to check if they are on or off.
Logged

Jobe

  • Contributor
  • *
  • Offline Offline
  • Gender: Male
  • Posts: 1023
    • Anope IRC Services
(No subject)
« Reply #2 on: December 20, 2006, 05:46:36 PM »

Just so youre aware you cannot at present make a web interface to allow registration. At most all you can do is read since Anope doesnt read from the MySQL anyway all it does it write to it. So any change you make to the MySQL would be completly ignored and overwritten.
Logged
Your IP: ()
My IRC Status:

Come along and visit http://www.anopequotes.org/

Westwood

  • Guest
(No subject)
« Reply #3 on: December 20, 2006, 07:41:34 PM »

Quote
Originally posted by Jobe1986
Just so youre aware you cannot at present make a web interface to allow registration. At most all you can do is read since Anope doesnt read from the MySQL anyway all it does it write to it. So any change you make to the MySQL would be completly ignored and overwritten.


Yeah I'm aware of that, thanks for pointing it out though. The web interface is based on getting information, reading memos, etc. which is why I need to understand the flags so I can define unread memos from read memos, etc.
Logged

Westwood

  • Guest
(No subject)
« Reply #4 on: December 20, 2006, 07:55:08 PM »

Quote
Originally posted by heinz
The flags are based off the NI_ defines in services.h. You'll need to use bitwise comparison to check if they are on or off.


Alright, I see...

Now I'm really going the whole nine yards... how excactly could I do that and get the specific bitwise comparisons using PHP and the flags returned from MySQL to, say, return "NI_SERVICES_ROOT" or "NI_SERVICES_ADMIN" so I could at least classify it on the web interface.

Any idea? I'd appreciate the help :)

[Edited on 20-12-2006 by Westwood]

[Edited on 20-12-2006 by Westwood]
Logged

heinz

  • Guest
(No subject)
« Reply #5 on: December 20, 2006, 09:18:48 PM »

See: http://uk.php.net/manual/en/language.operators.bitwise.php

You can define the NI_ flags directly into PHP, and use them in statements. Eg:

define('NI_SERVICES_ADMIN', 0x00002000)

if ($flags & NI_SERVICES_ADMIN) {
   [user has flag]
}
Logged
Pages: [1]   Go Up