sm00th / bitlbee-discord

Bitlbee plugin for Discord (http://discordapp.com)
GNU General Public License v2.0
291 stars 27 forks source link

"/away" is not treated as Away by default, keywords #161

Closed digitalcircuit closed 6 years ago

digitalcircuit commented 6 years ago

In brief

Criteria Rank Reason
Impact ★★☆ 2/3 User-facing statuses, matches expectations from IRC and Bitlbee
Risk ★★☆ 2/3 Potentially setting wrong status, changes existing behavior
Complexity ★★☆ 2/3 String parsing, matching, documentation changes

Rationale

Most IRC clients and networks allow one to mark themselves as unavailable using /away [some message]. Unfortunately, IRC does not yet have a way to use other presence levels supported by different protocols.

Bitlbee's approach is to make use of keywords in away messages, mapping them to lower-level protocol presence states. E.g. /away Busy - Filing issues on GitHub would map to Discord's dnd and set the status message to Filing issues on GitHub.

(For Discord, if use of /away is needed for setting status message, too, Online - A message could map to online/not AFK with status message of A message.)

Bitlbee also handles /away without any matching keywords to mark oneself as away. This matches assumptions made by clients that automatically set away messages on idle or disconnect from a bouncer.

bitlbee-discord should support these keywords and follow Bitlbee's behavior to reduce confusion, avoid learning new keywords, and avoid interfering with the assumptions made by IRC clients/bouncers.

Additional

Bitlbee documentation on Away

Bold emphasis added

Away states

To mark yourself as away, you can just use the /away command in your IRC client. BitlBee supports most away-states supported by the protocols.

Away states have different names across different protocols. BitlBee will try to pick the best available option for every connection:

  • Away
  • NA
  • Busy, DND
  • BRB
  • Phone
  • Lunch, Food
  • Invisible, Hidden

So /away Food will set your state to "Out to lunch" on your MSN connection, and for most other connections the default, "Away" will be chosen.

You can also add more information to your away message. Setting it to "Busy - Fixing BitlBee bugs" will set your IM-away-states to Busy, but your away message will be more descriptive for people on IRC. Most IM-protocols can also show this additional information to your buddies.

If you want to set an away state for only one of your connections, you can use the per-account away setting. See help set away.


If needed, this issue will be updated with more details later on.

sm00th commented 6 years ago

Thanks for such a detailed report, this really helped to make this easy. I actually thought that we were already doing this because of:

So /away Food will set your state to "Out to lunch" on your MSN connection, and for most other connections the default, "Away" will be chosen.

What I didn't realize is that 98f3893 changed that default to 'online' resulting in this weird behavior.

Please reopen if anything is missing.

digitalcircuit commented 6 years ago

I had misread the code, and with putting idle to the end of the list, almost everything works as expected!

Only (minor!) issue I see is not supporting the alternative documented Bitlbee keywords, too. So far in the help guide, this is busy for dnd and hidden for invisible.

If desired, the code for nogaim.c has a longer list:

static char *imc_away_alias_list[8][5] =
{
    { "Away from computer", "Away", "Extended away", NULL },
    { "NA", "N/A", "Not available", NULL },
    { "Busy", "Do not disturb", "DND", "Occupied", NULL },
    { "Be right back", "BRB", NULL },
    { "On the phone", "Phone", "On phone", NULL },
    { "Out to lunch", "Lunch", "Food", NULL },
    { "Invisible", "Hidden" },
    { NULL }
};

Edit: Only the ones that apply to Discord's API, of course. Discord doesn't have a food presence.

Glad to have helped, and thanks for the quick response! I can move adding the aliases to another issue if desired.

digitalcircuit commented 6 years ago

Aside, for whatever reason, GitHub is not offering me an option to re-open the issue. I know I've seen that button in the past...