Optional message handling

Justin Forest <[email protected]> Sun, 30 Jan 2005 17:44:17 +0300
Newsgroups gmane.comp.misc.faerion.devel
Message-ID <[email protected]>
I've been thinking about adding the ability for modules to refuse 
processing a message, passing it to the next listener.  This way known 
messages could be extended by modules, instead of introducing the new ones.

This would be mostly applicable to protocol handlers, such as IRC, where 
a message carries whatever the client said, only parsing it to a more 
readable binary structure.  Take IRC for example.  If the standard 
protocol handler does not support a command, say, "WHOWILLBE", it just 
reports an error to the client.  To support such command, a new module 
must be written which handless all commands including "WHOWILLBE".  Or 
passes "common" messages to another handler of the same kind.

So, it's all about chaining the subscribers.  This is not the case when 
notifications can be used: if a protocol command is unhandled, an error 
must be reported, it must not just be ignored (which would happen if we 
used notifications to deliver protocol commands).

Adding such a function would be a matter of one function (say, 
para_msg_bounce()), which, when called, would forward the message to the 
next subscribed queue, leaving the sender blocked.  When the end of the 
queue is reached, a PEC_MSG_NO_RECIPIENT error would be reported.  There 
is one side effect: messages could be hijacked, modules could spy one 
over another.  I currently don't know whether it's good or bad.

Also, the whole chaining stuff is somewhat specific to protocol 
handlers, I believe, and I'm not sure if it's not too specific to be 
added as a base function.

Also, if there are different ways of implementing this, which I have 
somehow missed, I'd like to know about them.

This is a call for comments, yes.



-------------------------------------------------------
This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting
Tool for open source databases. Create drag-&-drop reports. Save time
by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc.
Download a FREE copy at http://www.intelliview.com/go/osdn_nl
-------------------------------------------------------
Discussions in this list are held in two languages: English and Russian.
When replying, please use the language that the sender of the original
message is guaranteed to understand, or use English.