Closed digitalcircuit closed 2 years ago
Hi, first of all thanks for getting the issue to this stage. It is nice to have people contributing code.
As you mention the solution is a bit hacky. I was wondering whether we can fix this (and any similar potential problems in other protocols) in bitlbee itself by something like this:
diff --git a/protocols/nogaim.c b/protocols/nogaim.c
index de954e34..7e029944 100644
--- a/protocols/nogaim.c
+++ b/protocols/nogaim.c
@@ -836,7 +836,7 @@ static char *imc_away_state_find(GList *gcm, char *away, char **message)
*message = NULL;
}
- return imc_away_alias_list[i][j];
+ return m->data;
}
}
}
This makes sure imc_away_state_find()
returns what protocols expects, casing intact. @dequis what do you think?
That approach makes more sense to me, too.
It is technically changing Bitlbee's plugin API, but it's to something that (in my opinion) is more consistent and intuitive, so it may be fine. As both of us mentioned dx
, I'm guessing we should wait a bit for feedback. And maybe file a pull request on Bitlbee if no negative signal is heard for a while.
This has been fixed in Bitlbee itself as of https://github.com/bitlbee/bitlbee/commit/b82ba4a8d245e87090059ce1cd3500b514bd011e !
I'm closing this pull request here, though others may find it useful if they are stuck on old Bitlbee versions.
In brief
status
state provided by Bitlbee/away Busy - reason
→"status":"dnd"
/away Busy - reason
→"status":"DND"
, which Discord ignoredDetails
Lowercase the
status
state provided by Bitlbee to fix handling aliases.Doing
/away DND - test
would givednd
, but/away Busy - test
would giveDND
from the alias list.See sm00th's comment with a self-contained example:
Bitlbee plugin API
@dequis In the future, Bitlbee may want to change
imc_away_state_find
to match case with the plugin's provided away states?If so,
bitlbee-discord
may want to keep this patch for some time until new Bitlbee versions have rolled out across distros.Test case
Steps
sudo --user=bitlbee BITLBEE_DEBUG=1 bitlbee -nvD
/away
status (in Quassel IRC, use/back
)/away DND - test
, observe results/away
status/away Busy - test
, observe resultsBefore
/away Busy - test
"status":"DND"
→"client_status":{"web":"online"}
After
/away Busy - test
"status":"dnd"
→"client_status":{"web":"dnd"}