in reply to Jabber MUC bot channel list problem.
I would store users as a hash, rather than an array, making it much faster to determine whether the person is already in the list, or not, and also making deletions simpler.
my %roster; # to test for person being present, using a hash: if ( $roster{$jid} ) { .... } # to delete people when they leave: delete $roster{$jid};
I would re-initialize the list from the channel, say every half hour, to avoid going out of sync with reality. You might have some bug which loses people, or there might be a network problem which results in people joining or leaving without you being properly notified.
As for your code not working as you want it to, are you testing individual routines one by one, using Test::More or other testing frameworks? Can you run the program under the debugger, and determine data, inputs and outputs just before and just after an arrival ... use a private channel, where you can control arrivals. How about outputting a flood of data to a log file, and manually determining whether it's Doing The Right Thing?
As Occam said: Entia non sunt multiplicanda praeter necessitatem.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Jabber MUC bot channel list problem.
by Jarek (Novice) on May 25, 2011 at 09:17 UTC | |
by oxone (Friar) on May 25, 2011 at 21:59 UTC | |
by Jarek (Novice) on May 27, 2011 at 08:33 UTC |