Repository navigation
Add setting to optionally include own URLs in tab-completion - #2214
shan995-cell wants to merge 2 commits into
Conversation
|
Was this tested by either one of you? |
jubalh
left a comment
There was a problem hiding this comment.
A first quick and superficial review:
The new own also needs to be added to the tab autcompleter in src/command/cmd_ac.c. Look for url_ac there. And then own also needs to complete on/off.
And I think the scanning of URLs in own messages isn't done for carbon copied messages (sent from another device while we are online with this one).
I didn't check in detail but it looks like equals_our_barejid() isn't appropriate in all the cases. In MUCs message->from_jid->barejid probably will the the MUC JID (without nick) right? Maybe worth checking out get_display_name().
Unconditionally adding the URLs when we get the (legacy) MUC history is okay since we can't validate reliably whether it was sent by us or not.
Would be great if you could also state which paths were tested (in case they were).
URLs in outgoing messages aren't included in tab-completion, however that wasn't true of sent messages loaded from history. Signed-off-by: onf <onf@disroot.org>
14e00bd to
3dea515
Compare
|
Updated to v3 (description updated too) -- printing the Hope I did nothing wrong while submitting the patches... |
Adds boolean `url.own` setting controlled via `/url own on|off`. Fixes: profanity-im#2212 Signed-off-by: onf <onf@disroot.org>
3dea515 to
ec7bdf4
Compare
|
Updated to v4 -- fixes an indentation error in |
jubalh
left a comment
There was a problem hiding this comment.
In my earlier review I already stated I didn't check in detail but it looks like equals_our_barejid() isn't appropriate in all the cases. In MUCs message->from_jid->barejid probably will the the MUC JID (without nick) right? Maybe worth checking out get_display_name().
I didn't get any feedback on that neither was it adressed in the code.
Speaking of it I didn't receive any answer regarding:
Would be great if you could also state which paths were tested (in case they were).
PR submitted on behalf of "onf", who sent these two patches by email. Below is his message (with slight modifications for readability).
Hi,
I am sending updated patches. I have tried addressing jubalh's feedback:
Thanks for pointing all of these issues out. I am still somewhat new to XMPP so please excuse my ignorance and verbosity and please correct me if I got anything wrong.
I did test the patch before submitting it. Specifically, I tested live messages in
chatwin,mucwinandprivwin, and history inchatwin. I also briefly testedmucwinhistory, but clearly not well enough, and carbons I've missed completely.Autocompletion for
/url ownand itson/offvalues has been added and carbons fixed.I am not completely sure what you mean by "legacy MUC history". Please correct me if any of the following is wrong: If I turn off MAM and join a MUC, the server immediately sends a bunch of old messages with
<delay/>but without any namespace whatsoever. That's the legacy MUC history. Those messages are handled as regular MUC messages without passing through any special functions. Profanity also maintains local MUC history which it loads from a sqlite DB and that one passes through thewin_print*historyfunctions.By the way, if I scroll up above these retrieved messages, history is loaded from the DB (passed through
win_print_old_history) and suddenly the history is there twice, which I assume isn't the intended behavior.Regarding MUCs, as you point out, history includes only "MUC-local" JIDs based on users' nicks, making it impossible to figure out whether a message came from us or not (unless the nick is registered in the MUC, but there doesn't seem to be a reliable way of keeping track of that IIUC).
get_display_namewon't help us because it treats all messages as being sent by us if nick matches which cannot be assumed to always hold true. The only reasonable approach seems to be to add all URLs to completion regardless ofurl.ownsetting as you have suggested.win_print_historyandwin_print_old_historyare used for bothmucwinandchatwin. The check is there forchatwin, for which it does the right thing. Formucwinit always evalutes to true, adding all messages to completion as before, andprivwindoesn't use history IIUC.This time I have tested it more thoroughly, with the following results:
I didn't determine whether
privwincarbons are correctly added to autocomplete becauseprivwincarbons are completely broken. The carbon messages are completely identical tochatwincarbon messages except for the JIDs being "MUC-local JIDs", so Profanity treats them aschatwinmessages and openschatwinto the bare JID, which is obviously a MUC and not an XMPP account, so it doesn't work. Try for yourself, especially when the Profanity receiving carbons hasn't joined the MUC.For that to be fixed, it seems we need a way to determine if the bare JID is a MUC. If we are already in the MUC, it's easy, otherwise we need some fallback, unfortunately I don't know enough about the possible options here.
Also, if two devices (resources) join a MUC, each under a different nick, and message each other, the messages get duplicated due to carbons. Are you interested in a patch for this edge case?
Anyway, in summary, this should hopefully be good to go. The problems outlined above are results of problems that are already present in master.