Need help with a "special module"

These are old archives. They are kept for historic purposes only.
Post Reply
Fussi
Posts: 33
Joined: Fri Sep 24, 2004 9:46 pm
Location: At Home
Contact:

Need help with a "special module"

Post by Fussi »

Hi there

ok, i'm running an U.IRCD server with ircservices v5.x since ~140 days and i'm pretty familiar with the most commands, the config files and the modules.
Everything is "normal", users can connect, register their nicknames, but:

- I need a new channel mode (+F abc)
- Users must "link" their IRC account with an portal system (not via SQL, by "post"'ing username and pw to an .php script)
via "/nickserv link_account testuser testpwd"
The script returns "below-zero" values on error, or a number between 1 and 10 if success.
This number is stored in the IRC account (new usermode?)

Example:

*** You are now connected to irc.test.net
[21:29] -NickServ- This nickname is registered and protected. If it is your nickname, type /msg NickServ IDENTIFY password. Otherwise, please choose a different nickname.
-
[21:29] -NickServ- Password accepted -- you are now recognized.
-
[21:29] -NickServ- Notice: Your account isn't linked to an forum account. To do so, type "/nickserv link_account <forum.username> <forum.pw>"-
> /join #led
-
#led can't join channel (not a member of this faction)
-
> /nickserv link_account Fussi 12345
-
[21:30] -NickServ- Please wait, checking account status...
(Module sends query to the script, script returns "5")
[21:30] -NickServ- Account verified. You are a member of the L.E.D.
-
> /join #led
-
*** Now talking in #led
(Channel mode: +F 5 (or maybe "+F led" if this is possible))

**************************
Note: The channels aren't random, they're predefined. We have 9 channels, so we need 9 different "levels". 10 means "can join every channel".
Important: the usermode must be visible and set-able by the faction leaders (script return == 10) and the IRCOps!

The very first questions:
How to do this and where to start...

Just a module? Possible at all? Need to modify the sourcecode and recompile?


Thanks for any help, and please, ask any questions you have about this idea!
codemastr
Former UnrealIRCd head coder
Posts: 811
Joined: Sat Mar 06, 2004 8:47 pm
Location: United States
Contact:

Re: Need help with a "special module"

Post by codemastr »

How to do this and where to start...

Just a module? Possible at all? Need to modify the sourcecode and recompile?
If you don't know the answers to these questions, I can assure you that you will not be successful. You want a very complex module. It's going to require a module for your services as well as for Unreal. The way you want it done is also bad. Making it post to a php form is a terrible idea and you're still going to need to have the services directly access the SQL anyway. Your way just makes it MUCH slower, MUCH uglier, and MUCH more difficult. In any case, this is not something I can just say "here's how to start." I know nothing about your skill level! Have you ever worked with C? Are you familiar with the Unreal module API? Are you familiar with the MySQL C API? etc. If you answered "no" to any of those, then the place to start is reading.
-- codemastr
Dukat
Posts: 1083
Joined: Tue Mar 16, 2004 5:44 pm
Location: Switzerland

Post by Dukat »

Couldn't any of Syzop's SQL* modules do what you want, Fussi?

http://www.unrealircd.com/index.php?pag ... d=cat&id=5
Fussi
Posts: 33
Joined: Fri Sep 24, 2004 9:46 pm
Location: At Home
Contact:

Post by Fussi »

Well, that php script is just because the sql db is on another server. But its also possible to setup a sql db on the machine and sync it with crontabs every 5 min, or via a manual update command.

I've never worked with the U.IRDD Module Api, and i've never written any C/C++ programms for a linux environment, but i'm familiar with C/C++, and i've worked with MySQL too. (Not with the C-Api, but i know how to get data from a database. And there are so many examples for it, shouldn't be the problem).

For Syzop modules, the SQLMod module sounds very interesting, but i run this server for free for Duplex systems already, and 150 Euro is just too much for me. Also, i just dont know if this module can do what i need. And i cant just say "Hey duplex, can you buy me this module please?" because i dont even know if this is possible at all. (With this channel mode +F, and the account link)

Codemastr said that i'll need an Module for the ircservices too, and syzop's mod is for unreal. So who'll write the other one?
I dont say i cant do it, but it'll take month's until i got a first version.

Whatever, are there any manuals/example modules how to add something to the IRC account of an user and how to add a new channel mode and how to restrict the access with it?

The channel mode would be a good start at all, and a not too hard to reach first target.
codemastr
Former UnrealIRCd head coder
Posts: 811
Joined: Sat Mar 06, 2004 8:47 pm
Location: United States
Contact:

Post by codemastr »

Well you can't truly add something to the "IRC account" (it's called the aClient structure). You have to create your own storage structure and maintain this information there. For example, you could have a linked list that contains aClient *sptr; and int that_number; Then when you want to see if a user has one set, you search the list for list->sptr == sptr and then get list->that_number.

How to add a new channel mode, well first I'd recommend you take a look at http://modules.unrealircd.com it has (incomplete) documentation on the Module API. Also, check the file src/modules/m_chmodetst.c it provides a sample of creating channel modes. And about restricting channel access, take a look at my LevelLimit module (http://www.codemastr.com?page=module) it provides a sample of how to use the hooks to restrict channel access. Other than that though, you're pretty much on your own here.
-- codemastr
Post Reply