Code::Blocks Forums

Developer forums (C::B DEVELOPMENT STRICTLY!) => Plugins development => Topic started by: Cualli on June 09, 2007, 10:54:53 pm

Title: IRC plugin; Where to start?
Post by: Cualli on June 09, 2007, 10:54:53 pm
I have a working grasp of C and not much else. I intend to code an IRC plugin because:

A) It'd be useful to hang out in #c or #codeblocks while coding.
B) IRC = Decent collaboration tool. Not a bad idea to talk to other programmers while you work on something.

and

C) I like IRC.

Would anybody like to help me? What do I need to know?
Title: Re: IRC plugin; Where to start?
Post by: TDragon on June 10, 2007, 04:56:32 pm
What do I need to know?
C++.

... At least enough of it to interface a C::B plugin in C++ with whatever you choose for the IRC portion.
Title: Re: IRC plugin; Where to start?
Post by: Ceniza on June 10, 2007, 06:04:21 pm
It's funny to see, once again, such proposal (search the forums and you will see :wink:).

Just like TDragon said, C++ is the first thing you must know. You will also need some basic knowledge about wxWidgets (interface and sockets), the Code::Blocks' SDK (just check the source of some plugins to get an idea) and you'll need to have the RFC of IRC handy.

Have fun.
Title: Re: IRC plugin; Where to start?
Post by: Cualli on June 11, 2007, 07:52:05 am
It's funny to see, once again, such proposal (search the forums and you will see :wink:).

Just like TDragon said, C++ is the first thing you must know. You will also need some basic knowledge about wxWidgets (interface and sockets), the Code::Blocks' SDK (just check the source of some plugins to get an idea) and you'll need to have the RFC of IRC handy.

Have fun.

Why is C++ necessary? Is it truly impossible to write it in straight C?
Title: Re: IRC plugin; Where to start?
Post by: TDragon on June 11, 2007, 03:13:14 pm
Is it truly impossible to write it in straight C?
As far as I know. First, a plugin must define a class which inherits at least from the cbPlugin class. I'll admit that, with a lot of skill and trickery, this can probably be emulated in C -- but, in order to properly register a plugin, C::B needs the plugin DLL to create a static instance of another class, templated on your cbPlugin inheritor. This static instance in turn registers the plugin class with the main C::B program's plugin set (actually, this takes place in codeblocks.dll, but that's irrelevant). The upshot of all this is that C::B merely calls wxWidget's dynamic DLL loading routines, then examines its list of plugins to find the one that's newly loaded.

On the side of the standard C++ plugin, getting this done is quite easy:
Code
namespace
{
    PluginRegistrant<MyPlugin> reg(_T("MyPlugin"));
}
Getting that done somehow in C would be a lot harder, I imagine.

Cheers,
John E. / TDM
Title: Re: IRC plugin; Where to start?
Post by: lubos on June 11, 2007, 07:42:31 pm
if it could be possible to open web pages inside c::b editor tabs, then you could use an internet irc client  :)