How can you most easily detect if user is away

If your UnrealIRCd is up and running but you have a question about it, then use this forum.
(NOT for installation or connecting issues! Use the other forum instead.)

Moderator: Supporters

Locked
petanb
Posts: 4
Joined: Tue Dec 08, 2015 12:14 pm

How can you most easily detect if user is away

Post by petanb » Tue Dec 08, 2015 12:23 pm

I am a developer of 2 irc client libraries, one for C++ and one for C#, and there is one issue I was sort of ignoring for a while but I would like to properly sort it out.

Most of IRCD's including unreal which I am myself using, support away mechanisms, where user set themselves away using raw AWAY (with parameters to set away without to unset).

Problem here is: what is a most efficient way from client point of view to figure out that someone became away / removed away message.

Right now the way I solve this is that when you execute WHO <channel name> results similar to:

Code: Select all

(Tue Dec 8 13:18:33 2015) WHO: petan #support grumpy petan.staff.tm-irc.org hub.tm-irc.org petan Hr: 0 GrumpyIRC
(Tue Dec 8 13:18:33 2015) WHO: petan #support wm-bot wikimedia-bot.services.tm-irc.org hub.tm-irc.org wm-bot Hr+: 0 wm-bot
(Tue Dec 8 13:18:33 2015) WHO: petan #support sid129243 steinsplitter.irc hub.tm-irc.org Steinsplitter Hr: 0 Steinsplitter
(Tue Dec 8 13:18:33 2015) WHO: petan #support operbot bot.tm-irc.org hidden OperBot H*&: 0 Operations Bot
are returned. I couldn't really find any decent documentation on the format of result, but from what I have observed the 6th parameter (count from 0) contains some flags (in example here it's mostly Hr) and if G is there it means the user is away.

I also know that when you message user who is away you usually receive a message from server:

Code: Select all

(Tue Dec 8 13:20:25 2015) :hub.tm-irc.org 301 petan petan :I am currently not here
Which is cool, but pretty inefficient. If you need to keep a track of all users in channel who are away, you need to periodically send WHO for every single channel which you are in just to refresh the current status of every single user.

Is there any better way? This may be off-topic here, but I couldn't find any other section that would fit better. Nor I know about any general place where IRC standards can be discussed.

Syzop
UnrealIRCd head coder
Posts: 1957
Joined: Sat Mar 06, 2004 8:57 pm
Location: .nl
Contact:

Re: How can you most easily detect if user is away

Post by Syzop » Tue Dec 08, 2015 8:25 pm

What you describe is correct, those were until recently the ways to do this.

In UnrealIRCd 4 there's a new feature called away-notify, which does exactly what you need. Other ircds may have it as well.
What you send is "CAP REQ away-notify" (just once) and then you will receive AWAY notifications of when a user in the same channel as you goes away or returns (unaways). So normally you'd combine this with an initial WHO when joining the channel (to get the initial state).

petanb
Posts: 4
Joined: Tue Dec 08, 2015 12:14 pm

Re: How can you most easily detect if user is away

Post by petanb » Wed Dec 09, 2015 9:01 am

That looks cool, unfortunatelly my ircd is unreal 3.2.10.4 and even if it seems to have CAP command, it doesn't contain any help for it, sending raw HELP ?CAP returned:

Code: Select all

(Wed Dec 9 10:00:14 2015) :hub.tm-irc.org 290 petan : ***** No Help Available *****
(Wed Dec 9 10:00:14 2015) :hub.tm-irc.org 292 petan : -
(Wed Dec 9 10:00:14 2015) :hub.tm-irc.org 292 petan : We're sorry, we don't have help available for the command you requested.
Is there any documentation for CAP?

petanb
Posts: 4
Joined: Tue Dec 08, 2015 12:14 pm

Re: How can you most easily detect if user is away

Post by petanb » Wed Dec 09, 2015 9:03 am

My point is, I am trying to make my irc libraries compatible with most known ircd servers, so I need to have a way to figure out if ircd server support these commands in a first place, that is why I need some documentation for them.


dboyz
Posts: 68
Joined: Tue Jun 14, 2011 6:36 am

Re: How can you most easily detect if user is away

Post by dboyz » Fri Dec 11, 2015 8:48 am

Hi, away-notify is an ircv3 extension, using CAP (also an ircv3 extension) as a prerequisite. The link you've posted lists the specification for away-notify and you may find other ircv3 extensions at http://ircv3.net. All implementations of ircv3 are expected to comply with those specifications.

Locked