Valhalla Legends Forums Archive | C/C++ Programming | Best method of implementing idle kick

AuthorMessageTime
warz
Well, I figured I'd take my current bot a step further. I was thinking of ways to implement idle kick. I'm thinking I'll create a class for users attributes that are in the channel. Currently, I have a list that holds the users in the channel. I'm thinking of switching it to a map, and insert the users with an appropriate class holding their time of join, last time of talk, etc.

But, when it comes to the checking for idle users part, I can't really think of a good way to handle this. Would it be best to create a thread that just has an infinite loop with a sleep call in there so it loops every second, checking the users in the channel? This sounds like it'd be rather memory consuming. Anyone have any ideas?
April 19, 2006, 5:22 PM
rabbit
SID_PING should be received every 20 seconds.
April 20, 2006, 1:52 AM
Myndfyr
In the past I have simply created timers that notify me when a user has been idle for x ms.  I reset the timer when the user talks.  I also don't bother if the user is exempt from such a kick.
April 20, 2006, 3:23 AM
warz
I'll probably just use SID_PING. Sounds like a reasonable idea. The idle checking process isn't too high in priority, I'd assume.
April 20, 2006, 8:05 PM
LoRd
[quote author=rabbit link=topic=14800.msg150866#msg150866 date=1145497979]
SID_PING should be received every 20 seconds.
[/quote]

SID_PING is only sent by the server when the client itself is idle so if your client is dispatching messages or moderating the channel it'll throw off your timing scheme.
April 20, 2006, 8:26 PM

Search