sm00th / bitlbee-discord

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

Set away status #158

Closed rcx closed 6 years ago

rcx commented 6 years ago

You can set your discord status to 'online', 'dnd', 'idle', or 'invisible' via away variable's value.

Known issues:

These changes are experimental, feel free to suggest feedback before merging to mainline.

Alcaro commented 6 years ago

Looks like you never free 'stat' in discord_ws_set_status.

g_list_prepend is faster than g_list_append, append has to traverse the entire list to find the end. It makes little if any difference for one- or four-element lists, it's just kinda unidiomatic; your choice if it's worth fixing.

Nothing else looks obviously wrong, but I'm not familiar enough with the codebase to say it's definitely correct.

rcx commented 6 years ago

Nice catch.

sm00th commented 6 years ago

Sorry it took a while to review this. It looks good I have one question though.

"afk": true means you should receive push notifications regardless of away status.

Where does this assumption come from, is it documented anywhere? The only docs on this field I found is update status section in gateway docs and it mentions nothing like this. If this is an undocumented feature using it in a 'non-away' state feels a bit hackish, discord may change the way it treats it at any time.

rcx commented 6 years ago

Maybe afk should be moved out to a separate variable. I don't know how to implement that, though.

I saw that documentation 3rd-party here

afk (bool) – Indicates if you are going AFK. This allows the discord client to know how to handle push notifications better for you in case you are actually idle and not lying.

This reminds me of issue #131

sm00th commented 6 years ago

Thanks for clearing this up for me, it indeed does look like setting afk:true will solve #131.

Let's do it this way:

rcx commented 6 years ago

OK, seems good to me.

rcx commented 6 years ago

Thanks for merging

sm00th commented 6 years ago

No no, thank you for your contribution. :)

digitalcircuit commented 6 years ago

Would it be reasonable to assume idle: as the desired state if the away message doesn't specify any other status (online:, invisible:, etc)?

The tradition for /away seems to be to set one's client as, well, Away (or Idle). As it is now, it keeps one marked Online, just setting game state.

If not, perhaps a setting to enable this behavior?

At the time, I didn't pay close enough attention to these code changes, but @ecx86 is correct - with how Quassel behaves, unless I change my away status to have idle:[message], which affects every other Bitlbee account and other non-Bitlbee IRC networks using this identity, bitlbee-discord no longer sets myself as away.

(I can try opening a pull request if desired, but wanted to confirm these changes first.)

digitalcircuit commented 6 years ago

Pardon the noise, looking further, it appears Bitlbee has a built-in list of keywords it uses for other protocols: https://www.bitlbee.org/user-guide.html#away . Perhaps consistency with this is a good idea?

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 accross 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.

digitalcircuit commented 6 years ago

At @dequis 's suggestion (thanks!), filed a new issue for this: https://github.com/sm00th/bitlbee-discord/issues/161

In hindsight I should've just done that anyways. Oops.