Page 1 of 1

need help with module

Posted: Mon Nov 14, 2005 4:49 pm
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?

Posted: Mon Nov 14, 2005 5:22 pm
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 ;).

Posted: Mon Nov 14, 2005 5:25 pm
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?

Posted: Mon Nov 14, 2005 5:27 pm
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).

Posted: Mon Nov 14, 2005 6:04 pm
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..

Posted: Tue Nov 15, 2005 6:59 am
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?

Posted: Tue Nov 15, 2005 5:33 pm
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

Posted: Tue Nov 15, 2005 10:53 pm
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

Posted: Tue Nov 15, 2005 11:04 pm
by Syzop
Oh ok, I thought you meant you made some API docs or something ;).

(nm ;p)

Posted: Wed Nov 16, 2005 4:56 am
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.

Module Sample

Posted: Wed Jan 11, 2006 7:57 pm
by bsacco
There is a place where we can find a documented module sample?
A base module where we can start codig another one ...

I am begging for assistance [please help]

Posted: Fri Apr 14, 2006 8:05 am
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