[jitsi-dev] XMPP message correction


#1

Hey all,

I'm Ivan, and I'll be working on adding XMPP message correction (
http://xmpp.org/extensions/xep-0308.html) to Jitsi.

I think I got most things clear after looking through the code and
verifying with Emil, however i do have a couple of questions (and I guess
some more will come up as I progress):
- In the ChatConversationPanel, is there a way to determine the element in
the HTMLDocument that was clicked when showing the context menu? This would
allow for an "Edit" option of previous messages. (So I basically need a
function that returns an HTML element given coordinates.)
- What's the correct way to indicate we support the extension and determine
if the other side supports it too? For the first part, I've just added the
Namespace and the new OpSet to the supported features in
ProtocolProviderServiceJabberImpl, which I think is OK. What I'm not so
sure about is the second part - right now I've added the OpSet and the
corresponding namespace in OPERATION_SETS_TO_FEATURES in
OperationSetContactCapabilities, but I feel like that's not the right place
for it.

Thanks in advance.

Cheers,
Ivan


#2

- What's the correct way to indicate we support the extension and determine
if the other side supports it too? For the first part, I've just added the
Namespace and the new OpSet to the supported features in
ProtocolProviderServiceJabberImpl, which I think is OK.

Yes, ProtocolProviderServiceJabberImpl#supportedFeatures lists the
features that the local client user supports.

What I'm not so sure
about is the second part - right now I've added the OpSet and the
corresponding namespace in OPERATION_SETS_TO_FEATURES in
OperationSetContactCapabilities, but I feel like that's not the right place
for it.

That is OperationSetContactCapabilitiesJabberImpl I guess. Its
OPERATION_SETS_TO_FEATURES does get used to determine which
OperationSets are supported by a remote client user/contact. I believe
it should be enough to map the OperationSet of your interest to the
list of features it stands for i.e. what you've done should be OK.

I don't know whether the message correction feature/OperationSet will
have to be reported as supported for offline contacts but, since
instant messaging is, I'd like to mention that OperationSets available
for offline contacts are supposed to be registered in
OperationSetContactCapabilitiesJabberImpl#OFFLINE_OPERATION_SETS.

···

2012/6/13 Ivan Vergiliev <ivan.vergiliev@gmail.com>:


#3

Hi Ivan,

Hey all,

I'm Ivan, and I'll be working on adding XMPP message correction (http://xmpp.org/extensions/xep-0308.html) to Jitsi.

I think I got most things clear after looking through the code and verifying with Emil, however i do have a couple of questions (and I guess some more will come up as I progress):
- In the ChatConversationPanel, is there a way to determine the element in the HTMLDocument that was clicked when showing the context menu? This would allow for an "Edit" option of previous messages. (So I basically need a function that returns an HTML element given coordinates.)

Currently there's no way to obtain this information. You could try using JTextPane viewToModel() method, which gives you the position of the element in the model, but then you should experiment, I didn't try it myself.

Cheers,
Yana

···

On Jun 13, 2012, at 4:20 AM, Ivan Vergiliev wrote:

- What's the correct way to indicate we support the extension and determine if the other side supports it too? For the first part, I've just added the Namespace and the new OpSet to the supported features in ProtocolProviderServiceJabberImpl, which I think is OK. What I'm not so sure about is the second part - right now I've added the OpSet and the corresponding namespace in OPERATION_SETS_TO_FEATURES in OperationSetContactCapabilities, but I feel like that's not the right place for it.

Thanks in advance.

Cheers,
Ivan


#4

Hi Ivan,

I'm not sure it's less clean, because it make sense to only edit messages that are currently in the chat window and not all messages from history. IMO it's better to obtain the message directly from the current document.

Cheers,
Yana

···

On Jun 18, 2012, at 1:56 PM, Ivan Vergiliev wrote:

Hey Yana, Lyubomir,

Thanks for the info!

I also found the viewToModel() method - I think it's used in the implementation of the Hyperlink Events. I think it'll do the job.

Another question - I need a way to get the message contents by ID (so the user can see the message he's editing in the Write Panel). Should I add a getMessageById method to the MessageHistoryService? If not, I can try to get it from the HTMLDocument in the conversation panel, which would probably be easier, but also seems less clean.

Cheers,
Ivan

On Mon, Jun 18, 2012 at 1:46 PM, Yana Stamcheva <yana@jitsi.org> wrote:
Hi Ivan,

On Jun 13, 2012, at 4:20 AM, Ivan Vergiliev wrote:

> Hey all,
>
> I'm Ivan, and I'll be working on adding XMPP message correction (http://xmpp.org/extensions/xep-0308.html) to Jitsi.
>
> I think I got most things clear after looking through the code and verifying with Emil, however i do have a couple of questions (and I guess some more will come up as I progress):
> - In the ChatConversationPanel, is there a way to determine the element in the HTMLDocument that was clicked when showing the context menu? This would allow for an "Edit" option of previous messages. (So I basically need a function that returns an HTML element given coordinates.)

Currently there's no way to obtain this information. You could try using JTextPane viewToModel() method, which gives you the position of the element in the model, but then you should experiment, I didn't try it myself.

Cheers,
Yana

> - What's the correct way to indicate we support the extension and determine if the other side supports it too? For the first part, I've just added the Namespace and the new OpSet to the supported features in ProtocolProviderServiceJabberImpl, which I think is OK. What I'm not so sure about is the second part - right now I've added the OpSet and the corresponding namespace in OPERATION_SETS_TO_FEATURES in OperationSetContactCapabilities, but I feel like that's not the right place for it.
>
> Thanks in advance.
>
> Cheers,
> Ivan