jfyi UnDeRGoD, just because JOIN 0 makes a users part all channels, doesn't mean SVSJOIN 0 would have the same effect...
so like katsklaw said, what i suggested earlier is the way to go.
The C code for an anope module to go over the channels a user is in would look more or less like this:
User *u;
struct u_chanlist *uc;
Channel *c;
...
/* *u needs to point to a user by now... */
for (uc = u->chans; uc; uc = uc->next) {
if ((c = uc->chan)) {
...
}
}