[jitsi-dev] Question about editing message in a chat window


#1

Hi, guys!

Can you help me with resolving of one problem?
I'm developing a new jitsi plugin which implements the XEP-0184 (message
delivery receipts) for Jabber protocol.
When the plugin receives a delivery confirmation. Then a corresponding
outgoing message in the current chat panel should be edited (it can be
realized with adding some picture to the title of message, for example).

My problem is how can I do it correctly from the plugin without patching
code of jitsi?

I tried to get the current instance of the ChatPanel class or the
ChatConversationPanel class.
Code is following:
        String clName =
            "net.java.sip.communicator.impl.gui.main.chat.ChatPanel";

        try
        {
            Class<?> cl = null;
            for (Bundle b : bundleContext.getBundles()) {
                try {
                    cl = b.loadClass(clName);
                } catch (ClassNotFoundException e) {
                    // No problem, this bundle doesn't have the class
                }
            }
            if (cl == null) {
                throw new ClassNotFoundException(clName + " not found");
            }
            Object chatPanelObj = cl.cast(chat);
            Method getChatConversationPanel =
chatPanelObj.getClass().getMethod("getChatConversationPanel");
            Object connObj = getChatConversationPanel.invoke(chatPanelObj);
            ChatConversationPanel chatConversationPanel =
(ChatConversationPanel) connObj;
            return chatConversationPanel;
         } catch ...

But I didn't get the current chat conversation panel in this case.

Maybe, there is another way to edit a message in the chat window by its ID,
isn't it?

Best regards,
Semyon Baranov