need help with module

These are old archives. They are kept for historic purposes only.
Post Reply
Suchiara
Posts: 64
Joined: Fri May 20, 2005 2:37 pm

need help with module

Post by Suchiara »

Hello.
I'm trying to write a module, which forces chanmode +c to do exactly the same as +S does. However, when compiling my module, I get such message:

warning: assignment discards qualifiers from pointer target type

the lines near that which calls the warning are:

text = parv[2];
if (MyClient(sptr) && (chptr->mode.mode & MODE_NOCOLOR))
text = StripControlCodes(parv[2]);

What can be wrong here?
Syzop
UnrealIRCd head coder
Posts: 2112
Joined: Sat Mar 06, 2004 8:57 pm
Location: .nl
Contact:

Post by Syzop »

StripControlCodes returns a 'const char *', therefore if you assign the value to a 'char *' (so non-cost) it gives a warning.
Harmless in this case, so you cast to (char *)

But... It doesn't look to me like you are coding a proper module.
To code this in a proper module way, you would write a module which uses the HOOKTYPE_CHANMSG hook and has such a callback function (which returns a string).

Much better than modifying something official, or command overriding, or whatever you are doing ;).
Last edited by Syzop on Mon Nov 14, 2005 5:25 pm, edited 1 time in total.
Suchiara
Posts: 64
Joined: Fri May 20, 2005 2:37 pm

Post by Suchiara »

dammit.. everything goes wrong.. is there any information I can read about coding modules? Or some module coding tutorial for newbies or sth like that?
Syzop
UnrealIRCd head coder
Posts: 2112
Joined: Sat Mar 06, 2004 8:57 pm
Location: .nl
Contact:

Post by Syzop »

Best way to learn it is by looking at some of the the existing modules (like from me, codemastr, etc.. check unrealircd.com -> modules).

As for real documention there's some very limited stuff on http://modules.unrealircd.com/, although it's exactly sufficient for your purposes ;p.

And if you can't find something anywhere, then there's the source of course (though indeed, that's not so elegant).
Suchiara
Posts: 64
Joined: Fri May 20, 2005 2:37 pm

Post by Suchiara »

thanks.

Actually I was looking at the source and trying to write, but I find it very bad and evil because sometimes it is difficult to understand or find the code similar to your needs..
w00t
Posts: 1136
Joined: Thu Mar 25, 2004 3:31 am
Location: Nowra, Australia

Post by w00t »

Syzop, I'm actually looking at doing some case-by-case docs based on some of the smaller stuff I've written - would that be any good/postable somewhere?
-ChatSpike IRC Network [http://www.chatspike.net]
-Denora Stats [http://denora.nomadirc.net]
-Omerta [http://www.barafranca.com]
Syzop
UnrealIRCd head coder
Posts: 2112
Joined: Sat Mar 06, 2004 8:57 pm
Location: .nl
Contact:

Post by Syzop »

docs? well more recent module docs sound good, yes ;p.
What are case-by-case docs though?
And with postable do you mean on the forum or what? ;p
w00t
Posts: 1136
Joined: Thu Mar 25, 2004 3:31 am
Location: Nowra, Australia

Post by w00t »

case-by-case as in, looking at a particular problem, how I wanted to solve it, and the particular methods required to do it (ie: a module I do annotated to all hell, to give an easy example/introduction on how to do stuff).

I did a basic module to give a user a uline to test stuff for example, and I might use that as an example on how to add a command, process it, and send it to other servers, or whatever.

Postable as in, I dunno.. do you want them? Or shall I just whack them up someplace and put a link in my sig :p
-ChatSpike IRC Network [http://www.chatspike.net]
-Denora Stats [http://denora.nomadirc.net]
-Omerta [http://www.barafranca.com]
Syzop
UnrealIRCd head coder
Posts: 2112
Joined: Sat Mar 06, 2004 8:57 pm
Location: .nl
Contact:

Post by Syzop »

Oh ok, I thought you meant you made some API docs or something ;).

(nm ;p)
w00t
Posts: 1136
Joined: Thu Mar 25, 2004 3:31 am
Location: Nowra, Australia

Post by w00t »

API docs.. I still get confused in places, so don't know how great I'd be at that (I didn't know there was a difference between add_Command and CommandAdd until recently).

Maybe I'll have a go in a few months ;). I still need to work on a module that needs events, that'll be fun :p.
-ChatSpike IRC Network [http://www.chatspike.net]
-Denora Stats [http://denora.nomadirc.net]
-Omerta [http://www.barafranca.com]
bsacco
Posts: 2
Joined: Wed Jan 11, 2006 7:52 pm

Module Sample

Post by bsacco »

There is a place where we can find a documented module sample?
A base module where we can start codig another one ...
Spyke

I am begging for assistance [please help]

Post by Spyke »

I have been givin a task to code an unreal module. I don't know the first thing about coding in C/C++ except that you need a compiler, which I dl'd. I somehow need to create a module that when you set usermode +b to any user it will kill them with the msg "Happy Birthday!".
I have been constantly searching for someone that can help me in any way possible. Please people, i'm getting desperate. A free shell is on the line here to. So I have extra motivation to follow through with this. Send any information you may have to [email protected] please or [email protected]
Thank you for your time.

Sincerely,

Mike

[My site] http://Spyke.ro0t.org
Post Reply