dylex / slack-libpurple

Slack module for libpurple
GNU General Public License v2.0
276 stars 38 forks source link

fix "Get history" for aliased channels #170

Closed edquist closed 2 years ago

edquist commented 2 years ago

If you alias a channel in pidgin, "Get history" returns nothing. But it works again after re-aliasing back to the original channel name. This is the case for regular channels and MPDM group chats, but not single-recipient DMs.

Turns out that for chats (channels & MPDM), PURPLE_BLIST_NODE_NAME() and purple_chat_get_name() actually return the alias for the chat (the pidgin alias, that is), rather than the real chat name.

(Presumably this is because PurpleBuddy has name & alias members, but PurpleChat only has an alias. The real chat name is under components.)

The result is, the channel alias is used to do the lookup against channel_names, which contains the real names. This lookup fails if the alias is different than the real channel name. (Or perhaps even succeeds for the wrong channel if aliased that way.)

Anyway, fix this by grabbing the real name for chats from components in the callback function.

Also go ahead and fix the name in get_history_prompt for chats, for a consistent display. That is, so that @user and #channel both display the real (slack) names rather than (pidgin) aliases.

edquist commented 2 years ago

Thanks @dylex for reviewing & accepting this. It fixed a long-standing bug which I finally worked up the motivation to track down :)