[jitsi-dev] PluginComponent for MUC


#1

I am working on modifying the otr plugin to support Group-Off-The-Record
chats in XMPP MUCs. But I do not know how to get a list of users and the
room name from within the PluginComponent so I can update the button
accordingly.

What would be the way to go about this?

Thanks,
Mike Schliep


#2

Hi Mike,

That sounds like a valuable addition.

To get to the MUC information, you'd first have to acquire a
'MUCService' instance. With this instance you can query for available
MUC chat room providers and then you can drill down to specific chat
rooms, and then chat room members.

To acquire instances of the various services that Jitsi offers, have a
look at one of the many XxxActivator classes. These are the classes that
represent the entry point for OSGi modules. For example, the
IrcActivator class, it queries the 'bundle' instance for a MUCService
instance for multi-user chat services, and a UIService for user
interface-related services.

In your implementation you should take the same approach, except that
you will acquire instances via your own *Activator and bundle instances.

Note that getChatRoomProviders() will return you all the available MUC
providers, so you'd have to select the ones you need. Alternatively you
could make the implementation protocol-agnostic if you do not rely on
specific features of XMPP.

Kind regards,
Danny

···

On 18-11-14 17:10, Michael Schliep wrote:

I am working on modifying the otr plugin to support
Group-Off-The-Record chats in XMPP MUCs. But I do not know how to get
a list of users and the room name from within the PluginComponent so I
can update the button accordingly.

What would be the way to go about this?

Thanks,
Mike Schliep

_______________________________________________
dev mailing list
dev@jitsi.org
Unsubscribe instructions and other list options:
http://lists.jitsi.org/mailman/listinfo/dev


#3

Thanks, that helps with looking up the chat room information.

But the issue I am having is, the button to start the encryption has no way
of knowing which chat room is active in the gui. The button
is OtrMetaContactButton which is a PluginComponent. PluginComponents do not
receive any information about chat rooms. They only receive null values in
their setCurrentContact() methods.

Is there anyway of retrieving this information from within a
PluginComponent when it is clicked? Or does the interface need to change?

Thanks,
Mike

···

On Tue, Nov 18, 2014 at 1:32 PM, Danny van Heumen <danny@dannyvanheumen.nl> wrote:

Hi Mike,

That sounds like a valuable addition.

To get to the MUC information, you'd first have to acquire a
'MUCService' instance. With this instance you can query for available
MUC chat room providers and then you can drill down to specific chat
rooms, and then chat room members.

To acquire instances of the various services that Jitsi offers, have a
look at one of the many XxxActivator classes. These are the classes that
represent the entry point for OSGi modules. For example, the
IrcActivator class, it queries the 'bundle' instance for a MUCService
instance for multi-user chat services, and a UIService for user
interface-related services.

In your implementation you should take the same approach, except that
you will acquire instances via your own *Activator and bundle instances.

Note that getChatRoomProviders() will return you all the available MUC
providers, so you'd have to select the ones you need. Alternatively you
could make the implementation protocol-agnostic if you do not rely on
specific features of XMPP.

Kind regards,
Danny

On 18-11-14 17:10, Michael Schliep wrote:
> I am working on modifying the otr plugin to support
> Group-Off-The-Record chats in XMPP MUCs. But I do not know how to get
> a list of users and the room name from within the PluginComponent so I
> can update the button accordingly.
>
> What would be the way to go about this?
>
> Thanks,
> Mike Schliep
>
>
> _______________________________________________
> dev mailing list
> dev@jitsi.org
> Unsubscribe instructions and other list options:
> http://lists.jitsi.org/mailman/listinfo/dev

_______________________________________________
dev mailing list
dev@jitsi.org
Unsubscribe instructions and other list options:
http://lists.jitsi.org/mailman/listinfo/dev


#4

Hi Mike,

Thanks, that helps with looking up the chat room information.

But the issue I am having is, the button to start the encryption has
no way of knowing which chat room is active in the gui. The button
is OtrMetaContactButton which is a PluginComponent. PluginComponents
do not receive any information about chat rooms. They only receive
null values in their setCurrentContact() methods.

Ah right, that explains why you referred to the PluginComponent. Sorry
about that.
I had another quick look, but I'm not sure on how to proceed there. I
know that there is a BaseChatRoomSourceContact (which is there for a
slightly different purpose), but that does not implement interface
Contact. So, (only looking at the code) it does not seem that you get
updates for UI changes w.r.t. Chat Rooms.
--> Have you tried this in code by any chance, ... if you dump the
information of the Contact instance for each callback?

My intuition says that either:
1. we would need to extend the Contact interface with additional methods
that will be called in the context of MUC, or
2. we would need to make chat rooms implement the Contact interface
(though maybe not the ChatRoom class exactly, but a class related to MUC
and ChatRoom that's closer to the UI)

I have to say that I am not that familiar with these regions of UI code.
So I'm hoping some of the other devs can jump in with information that
is actually useful :slight_smile:

Danny

···

On 18-11-14 21:39, Michael Schliep wrote:

Is there anyway of retrieving this information from within a
PluginComponent when it is clicked? Or does the interface need to change?

Thanks,
Mike

On Tue, Nov 18, 2014 at 1:32 PM, Danny van Heumen > <danny@dannyvanheumen.nl <mailto:danny@dannyvanheumen.nl>> wrote:

    Hi Mike,

    That sounds like a valuable addition.

    To get to the MUC information, you'd first have to acquire a
    'MUCService' instance. With this instance you can query for available
    MUC chat room providers and then you can drill down to specific chat
    rooms, and then chat room members.

    To acquire instances of the various services that Jitsi offers, have a
    look at one of the many XxxActivator classes. These are the
    classes that
    represent the entry point for OSGi modules. For example, the
    IrcActivator class, it queries the 'bundle' instance for a MUCService
    instance for multi-user chat services, and a UIService for user
    interface-related services.

    In your implementation you should take the same approach, except that
    you will acquire instances via your own *Activator and bundle
    instances.

    Note that getChatRoomProviders() will return you all the available MUC
    providers, so you'd have to select the ones you need.
    Alternatively you
    could make the implementation protocol-agnostic if you do not rely on
    specific features of XMPP.

    Kind regards,
    Danny

    On 18-11-14 17:10, Michael Schliep wrote:
    > I am working on modifying the otr plugin to support
    > Group-Off-The-Record chats in XMPP MUCs. But I do not know how
    to get
    > a list of users and the room name from within the
    PluginComponent so I
    > can update the button accordingly.
    >
    > What would be the way to go about this?
    >
    > Thanks,
    > Mike Schliep
    >
    >
    > _______________________________________________
    > dev mailing list
    > dev@jitsi.org <mailto:dev@jitsi.org>
    > Unsubscribe instructions and other list options:
    > http://lists.jitsi.org/mailman/listinfo/dev

    _______________________________________________
    dev mailing list
    dev@jitsi.org <mailto:dev@jitsi.org>
    Unsubscribe instructions and other list options:
    http://lists.jitsi.org/mailman/listinfo/dev

_______________________________________________
dev mailing list
dev@jitsi.org
Unsubscribe instructions and other list options:
http://lists.jitsi.org/mailman/listinfo/dev


#5

Hi,

My intuition says that either:
1. we would need to extend the Contact interface with additional methods
that will be called in the context of MUC, or
2. we would need to make chat rooms implement the Contact interface
(though maybe not the ChatRoom class exactly, but a class related to MUC
and ChatRoom that's closer to the UI)

I have to say that I am not that familiar with these regions of UI code.
So I'm hoping some of the other devs can jump in with information that
is actually useful :slight_smile:

The way to go is just change the PluginComponent(and maybe
AbstractPluginComponent). As it has setCurrentContact,
setCurrentContactGroup, setCurrentAccountID we need to add and
setCurrentChatRoom and set it on the relevant places.
You can see in the code in most places:

Object currentDescriptor = currentTransport.getDescriptor();

if (currentDescriptor instanceof Contact)
{
    Contact contact = (Contact) currentDescriptor;

    component.setCurrentContact(
            contact,
            currentTransport.getResourceName());
}

An else clause needs to be added, where needed:
else if (currentDescriptor instanceof ChatRoom)
{
    ChatRoom room = (ChatRoom) currentDescriptor;
    component.setCurrentChatRoom(room);
}

Regards
damencho

···

On Wed, Nov 19, 2014 at 12:40 AM, Danny van Heumen <danny@dannyvanheumen.nl> wrote:


#6

Thanks, that is working.

The process of decryption and authenticating a message requires sending
multiple private messages. I know how to do that, but what I do not know is
how to notify the MessageListeners of
the OperationSetBasicInstantMessaging. Would it be OK to add another method
to that operation set. Basically moving the "fireMessageEvent(EventObject
evt)" from the abstract class into the interface and making it public?

Thanks,
Mike

···

On Wed, Nov 19, 2014 at 1:06 AM, Damian Minkov <damencho@jitsi.org> wrote:

Hi,

On Wed, Nov 19, 2014 at 12:40 AM, Danny van Heumen > <danny@dannyvanheumen.nl> wrote:
> My intuition says that either:
> 1. we would need to extend the Contact interface with additional methods
> that will be called in the context of MUC, or
> 2. we would need to make chat rooms implement the Contact interface
> (though maybe not the ChatRoom class exactly, but a class related to MUC
> and ChatRoom that's closer to the UI)
>
> I have to say that I am not that familiar with these regions of UI code.
> So I'm hoping some of the other devs can jump in with information that
> is actually useful :slight_smile:

The way to go is just change the PluginComponent(and maybe
AbstractPluginComponent). As it has setCurrentContact,
setCurrentContactGroup, setCurrentAccountID we need to add and
setCurrentChatRoom and set it on the relevant places.
You can see in the code in most places:

Object currentDescriptor = currentTransport.getDescriptor();

if (currentDescriptor instanceof Contact)
{
    Contact contact = (Contact) currentDescriptor;

    component.setCurrentContact(
            contact,
            currentTransport.getResourceName());
}

An else clause needs to be added, where needed:
else if (currentDescriptor instanceof ChatRoom)
{
    ChatRoom room = (ChatRoom) currentDescriptor;
    component.setCurrentChatRoom(room);
}

Regards
damencho

_______________________________________________
dev mailing list
dev@jitsi.org
Unsubscribe instructions and other list options:
http://lists.jitsi.org/mailman/listinfo/dev