[cl-irc-devel] Implementing MODE messages and mode tracking

Erik Huelsmann e.huelsmann at gmx.net
Sun Aug 22 20:55:29 UTC 2004


Hi,

For my application I wanted to track user modes (mostly the operator mode
actually). So I decided to jump into the different modes in different
networks. It turned out to be a challenge :-)

So I decided to implement (for now) only the modes in the RFC since those
seem to be common for all networks. The framework should be really easy to
expand later on. This is what I did:

Both channels and users have a 'modes' slot which is of type plist (because
they are typically small lists).
Channel modes can have zero or one argument. Some modes messages set one
value, others add to a list of values. The channel key being in the first
category, ban lists in the second. This means there are 3 different mode
types with 2 major categories:
* modes which are either on or off
* modes with a value, which are divided into two groups too:
  - modes with exactly one value
  - modes with a list of values

In order to know how to process the MODE arguments, a structure is required
which holds the mode message description. I chose an assoc list for that.

In order to hide the differences between the networks (using different
characters for different modes), I introduced a 'character -> keyword'
mapping. Applications can use the keywords instead of the mode characters in
order to become network independent. The library will have to select the
right mapping upon connection to the server (or pick the default and only
support the RFC).

The code is adapted to:
* A new 'default-hook' with an irc-mode-message argument is implemented to
handle (known) mode changes.
* The names-reply is adapted to pick out nicks with the @-sign to be added
to the channels op-list.
* The quit- and part-message hooks are updated to update any modes on the
user and channels he parted.
* The library user and channel management routines updated to update modes
according to the action required.


Anybody interested in seeing a patch?


bye,

Erik.

-- 
Supergünstige DSL-Tarife + WLAN-Router für 0,- EUR*
Jetzt zu GMX wechseln und sparen http://www.gmx.net/de/go/dsl





More information about the cl-irc-devel mailing list