librelist archives

« back to archive

Adding ability to programmatically join a room and open group chat box

Adding ability to programmatically join a room and open group chat box

From:
Simon Hill
Date:
2015-03-14 @ 23:26
I thought I'd take a shot at adding API functionality to programmatically
join a room and open its chatbox, which I need for something I am working
on. The user will already have become a member of the member-only room
before hand, so I really only need to emulate the function of entering the
room name and pressing the Join button.

First, I thought I would check that such a thing is not supported and
second, could you give me some code hints on how I would go about it, such
as where in the code such functionality should live.

Thanks!
Si

Re: [conversejs] Adding ability to programmatically join a room and open group chat box

From:
Jc Brand
Date:
2015-03-16 @ 13:59
On Sat, Mar 14, 2015 at 04:26:42PM -0700, Simon Hill wrote:
>    I thought I'd take a shot at adding API functionality to programmatically
>    join a room and open its chatbox, which I need for something I am working
>    on. The user will already have become a member of the member-only room
>    before hand, so I really only need to emulate the function of entering the
>    room name and pressing the Join button.
>    First, I thought I would check that such a thing is not supported and
>    second, could you give me some code hints on how I would go about it, such
>    as where in the code such functionality should live.

The API of converse.js starts here:

https://github.com/jcbrand/converse.js/blob/77137a538cd9e79b288491ba492819b1e37733de/converse.js#L5433

You can open a chat room exactly like you open any other chat, with 
converse.chats.open.

You'll most likely want to call the "join" method on the ChatRoom view:

https://github.com/jcbrand/converse.js/blob/77137a538cd9e79b288491ba492819b1e37733de/converse.js#L2611

Re: [conversejs] Adding ability to programmatically join a room and open group chat box

From:
Simon Hill
Date:
2015-04-01 @ 14:03
Hi JC

With respect to your guidelines below, backbone stumps me again: how do I
call the "join" method on the ChatRoomView?

I understand conceptually that I need to update the room join model and
call the join method on the ChatRoomView, but I can't find a reference to
that view that's already initialized, and when I try to initialize it, I
can't pass it the right parameters.

Incidentally I cannot get converse.chats.open to work with opening rooms.

BTW, I would be happy simulating click events on the UI form, instead of
hacking the API, if that were possible, at least for v1.

Thanks again for your marvelous support of this valuable project.

Si


On Mon, Mar 16, 2015 at 6:59 AM, JC Brand <lists@opkode.com> wrote:

> On Sat, Mar 14, 2015 at 04:26:42PM -0700, Simon Hill wrote:
> >    I thought I'd take a shot at adding API functionality to
> programmatically
> >    join a room and open its chatbox, which I need for something I am
> working
> >    on. The user will already have become a member of the member-only room
> >    before hand, so I really only need to emulate the function of
> entering the
> >    room name and pressing the Join button.
> >    First, I thought I would check that such a thing is not supported and
> >    second, could you give me some code hints on how I would go about it,
> such
> >    as where in the code such functionality should live.
>
> The API of converse.js starts here:
>
> 
https://github.com/jcbrand/converse.js/blob/77137a538cd9e79b288491ba492819b1e37733de/converse.js#L5433
>
> You can open a chat room exactly like you open any other chat, with
> converse.chats.open.
>
> You'll most likely want to call the "join" method on the ChatRoom view:
>
> 
https://github.com/jcbrand/converse.js/blob/77137a538cd9e79b288491ba492819b1e37733de/converse.js#L2611
>

Re: [conversejs] Adding ability to programmatically join a room and open group chat box

From:
Jc Brand
Date:
2015-04-04 @ 09:07
Hi Simon

I think it'll be possible to get an already open chat room via chats.get, but
chats.open won't work because it assumes only SUC chat boxes.

See the discussion here: https://github.com/jcbrand/converse.js/issues/355

I think the best solution is to create a new API namespace "rooms", so that
people can use "rooms.get" and "rooms.open".

About the "join" method. This is not exposed through the API. You'll need to
write a plugin method to override those models or views you need to modify.

Backbone is actually conceptually very simple. If you want to modify
converse.js then you need to invest the time in learning how it works and how
to work with it.

Regards
JC

On Wed, Apr 01, 2015 at 07:03:32AM -0700, Simon Hill wrote:
>    Hi JC
>    With respect to your guidelines below, backbone stumps me again: how do I
>    call the "join" method on the ChatRoomView?
>    I understand conceptually that I need to update the room join model and
>    call the join method on the ChatRoomView, but I can't find a reference to
>    that view that's already initialized, and when I try to initialize it, I
>    can't pass it the right parameters.
>    Incidentally I cannot get converse.chats.open to work with opening rooms.
>    BTW, I would be happy simulating click events on the UI form, instead of
>    hacking the API, if that were possible, at least for v1.
>    Thanks again for your marvelous support of this valuable project.
>    Si
>    On Mon, Mar 16, 2015 at 6:59 AM, JC Brand <[1]lists@opkode.com> wrote:
> 
>      On Sat, Mar 14, 2015 at 04:26:42PM -0700, Simon Hill wrote:
>      >    I thought I'd take a shot at adding API functionality to
>      programmatically
>      >    join a room and open its chatbox, which I need for something I am
>      working
>      >    on. The user will already have become a member of the member-only
>      room
>      >    before hand, so I really only need to emulate the function of
>      entering the
>      >    room name and pressing the Join button.
>      >    First, I thought I would check that such a thing is not supported
>      and
>      >    second, could you give me some code hints on how I would go about
>      it, such
>      >    as where in the code such functionality should live.
> 
>      The API of converse.js starts here:
>      
[2]https://github.com/jcbrand/converse.js/blob/77137a538cd9e79b288491ba492819b1e37733de/converse.js#L5433
> 
>      You can open a chat room exactly like you open any other chat, with
>      converse.chats.open.
> 
>      You'll most likely want to call the "join" method on the ChatRoom view:
>      
[3]https://github.com/jcbrand/converse.js/blob/77137a538cd9e79b288491ba492819b1e37733de/converse.js#L2611
> 
> References
> 
>    Visible links
>    1. mailto:lists@opkode.com
>    2. 
https://github.com/jcbrand/converse.js/blob/77137a538cd9e79b288491ba492819b1e37733de/converse.js#L5433
>    3. 
https://github.com/jcbrand/converse.js/blob/77137a538cd9e79b288491ba492819b1e37733de/converse.js#L2611

Re: [conversejs] Adding ability to programmatically join a room and open group chat box

From:
Simon Hill
Date:
2015-04-04 @ 17:06
Thanks JC. Does converse have a plugin architecture I can follow, or will I
need to modify the core code base? Do you have any examples of a plugin
method that I can follow?



On Sat, Apr 4, 2015 at 2:07 AM, JC Brand <lists@opkode.com> wrote:

> Hi Simon
>
> I think it'll be possible to get an already open chat room via chats.get,
> but
> chats.open won't work because it assumes only SUC chat boxes.
>
> See the discussion here: https://github.com/jcbrand/converse.js/issues/355
>
> I think the best solution is to create a new API namespace "rooms", so that
> people can use "rooms.get" and "rooms.open".
>
> About the "join" method. This is not exposed through the API. You'll need
> to
> write a plugin method to override those models or views you need to modify.
>
> Backbone is actually conceptually very simple. If you want to modify
> converse.js then you need to invest the time in learning how it works and
> how
> to work with it.
>
> Regards
> JC
>
> On Wed, Apr 01, 2015 at 07:03:32AM -0700, Simon Hill wrote:
> >    Hi JC
> >    With respect to your guidelines below, backbone stumps me again: how
> do I
> >    call the "join" method on the ChatRoomView?
> >    I understand conceptually that I need to update the room join model
> and
> >    call the join method on the ChatRoomView, but I can't find a
> reference to
> >    that view that's already initialized, and when I try to initialize
> it, I
> >    can't pass it the right parameters.
> >    Incidentally I cannot get converse.chats.open to work with opening
> rooms.
> >    BTW, I would be happy simulating click events on the UI form, instead
> of
> >    hacking the API, if that were possible, at least for v1.
> >    Thanks again for your marvelous support of this valuable project.
> >    Si
> >    On Mon, Mar 16, 2015 at 6:59 AM, JC Brand <[1]lists@opkode.com>
> wrote:
> >
> >      On Sat, Mar 14, 2015 at 04:26:42PM -0700, Simon Hill wrote:
> >      >    I thought I'd take a shot at adding API functionality to
> >      programmatically
> >      >    join a room and open its chatbox, which I need for something I
> am
> >      working
> >      >    on. The user will already have become a member of the
> member-only
> >      room
> >      >    before hand, so I really only need to emulate the function of
> >      entering the
> >      >    room name and pressing the Join button.
> >      >    First, I thought I would check that such a thing is not
> supported
> >      and
> >      >    second, could you give me some code hints on how I would go
> about
> >      it, such
> >      >    as where in the code such functionality should live.
> >
> >      The API of converse.js starts here:
> >      [2]
> 
https://github.com/jcbrand/converse.js/blob/77137a538cd9e79b288491ba492819b1e37733de/converse.js#L5433
> >
> >      You can open a chat room exactly like you open any other chat, with
> >      converse.chats.open.
> >
> >      You'll most likely want to call the "join" method on the ChatRoom
> view:
> >      [3]
> 
https://github.com/jcbrand/converse.js/blob/77137a538cd9e79b288491ba492819b1e37733de/converse.js#L2611
> >
> > References
> >
> >    Visible links
> >    1. mailto:lists@opkode.com
> >    2.
> 
https://github.com/jcbrand/converse.js/blob/77137a538cd9e79b288491ba492819b1e37733de/converse.js#L5433
> >    3.
> 
https://github.com/jcbrand/converse.js/blob/77137a538cd9e79b288491ba492819b1e37733de/converse.js#L2611
>

Re: [conversejs] Adding ability to programmatically join a room and open group chat box

From:
Jc Brand
Date:
2015-04-04 @ 19:18
On Sat, Apr 04, 2015 at 10:06:52AM -0700, Simon Hill wrote:
>    Thanks JC. Does converse have a plugin architecture I can follow, or will
>    I need to modify the core code base? Do you have any examples of a plugin
>    method that I can follow?

Unfortunately the plugin API is not yet properly documented.
You can see the relevant code here:

https://github.com/jcbrand/converse.js/blob/5a488333ec96762a6b1dd8650714fbf085816472/converse.js#L5572

And Guillermo created a gist of a plugin:
https://gist.github.com/gbonvehi/376078bd6b702255a7e7


>    On Sat, Apr 4, 2015 at 2:07 AM, JC Brand <[1]lists@opkode.com> wrote:
> 
>      Hi Simon
> 
>      I think it'll be possible to get an already open chat room via
>      chats.get, but
>      chats.open won't work because it assumes only SUC chat boxes.
> 
>      See the discussion here:
>      [2]https://github.com/jcbrand/converse.js/issues/355
> 
>      I think the best solution is to create a new API namespace "rooms", so
>      that
>      people can use "rooms.get" and "rooms.open".
> 
>      About the "join" method. This is not exposed through the API. You'll
>      need to
>      write a plugin method to override those models or views you need to
>      modify.
> 
>      Backbone is actually conceptually very simple. If you want to modify
>      converse.js then you need to invest the time in learning how it works
>      and how
>      to work with it.
> 
>      Regards
>      JC
>      On Wed, Apr 01, 2015 at 07:03:32AM -0700, Simon Hill wrote:
>      >    Hi JC
>      >    With respect to your guidelines below, backbone stumps me again:
>      how do I
>      >    call the "join" method on the ChatRoomView?
>      >    I understand conceptually that I need to update the room join model
>      and
>      >    call the join method on the ChatRoomView, but I can't find a
>      reference to
>      >    that view that's already initialized, and when I try to initialize
>      it, I
>      >    can't pass it the right parameters.
>      >    Incidentally I cannot get converse.chats.open to work with opening
>      rooms.
>      >    BTW, I would be happy simulating click events on the UI form,
>      instead of
>      >    hacking the API, if that were possible, at least for v1.
>      >    Thanks again for your marvelous support of this valuable project.
>      >    Si
>      >    On Mon, Mar 16, 2015 at 6:59 AM, JC Brand <[1][3]lists@opkode.com>
>      wrote:
>      >
>      >      On Sat, Mar 14, 2015 at 04:26:42PM -0700, Simon Hill wrote:
>      >      >    I thought I'd take a shot at adding API functionality to
>      >      programmatically
>      >      >    join a room and open its chatbox, which I need for something
>      I am
>      >      working
>      >      >    on. The user will already have become a member of the
>      member-only
>      >      room
>      >      >    before hand, so I really only need to emulate the function
>      of
>      >      entering the
>      >      >    room name and pressing the Join button.
>      >      >    First, I thought I would check that such a thing is not
>      supported
>      >      and
>      >      >    second, could you give me some code hints on how I would go
>      about
>      >      it, such
>      >      >    as where in the code such functionality should live.
>      >
>      >      The API of converse.js starts here:
>      >     
>      
[2][4]https://github.com/jcbrand/converse.js/blob/77137a538cd9e79b288491ba492819b1e37733de/converse.js#L5433
>      >
>      >      You can open a chat room exactly like you open any other chat,
>      with
>      >      converse.chats.open.
>      >
>      >      You'll most likely want to call the "join" method on the ChatRoom
>      view:
>      >     
>      
[3][5]https://github.com/jcbrand/converse.js/blob/77137a538cd9e79b288491ba492819b1e37733de/converse.js#L2611
>      >
>      > References
>      >
>      >    Visible links
>      >    1. mailto:[6]lists@opkode.com
>      >    2.
>      
[7]https://github.com/jcbrand/converse.js/blob/77137a538cd9e79b288491ba492819b1e37733de/converse.js#L5433
>      >    3.
>      
[8]https://github.com/jcbrand/converse.js/blob/77137a538cd9e79b288491ba492819b1e37733de/converse.js#L2611
> 
> References
> 
>    Visible links
>    1. mailto:lists@opkode.com
>    2. https://github.com/jcbrand/converse.js/issues/355
>    3. mailto:lists@opkode.com
>    4. 
https://github.com/jcbrand/converse.js/blob/77137a538cd9e79b288491ba492819b1e37733de/converse.js#L5433
>    5. 
https://github.com/jcbrand/converse.js/blob/77137a538cd9e79b288491ba492819b1e37733de/converse.js#L2611
>    6. mailto:lists@opkode.com
>    7. 
https://github.com/jcbrand/converse.js/blob/77137a538cd9e79b288491ba492819b1e37733de/converse.js#L5433
>    8. 
https://github.com/jcbrand/converse.js/blob/77137a538cd9e79b288491ba492819b1e37733de/converse.js#L2611

Re: [conversejs] Adding ability to programmatically join a room and open group chat box

From:
paparazzia
Date:
2015-04-05 @ 06:20
Hello Simon, JC,

Just pulling a request for adding rooms api right now

2015-04-04 11:07 GMT+02:00 JC Brand <lists@opkode.com>:

> Hi Simon
>
> I think it'll be possible to get an already open chat room via chats.get,
> but
> chats.open won't work because it assumes only SUC chat boxes.
>
> See the discussion here: https://github.com/jcbrand/converse.js/issues/355
>
> I think the best solution is to create a new API namespace "rooms", so that
> people can use "rooms.get" and "rooms.open".
>
> About the "join" method. This is not exposed through the API. You'll need
> to
> write a plugin method to override those models or views you need to modify.
>
> Backbone is actually conceptually very simple. If you want to modify
> converse.js then you need to invest the time in learning how it works and
> how
> to work with it.
>
> Regards
> JC
>
> On Wed, Apr 01, 2015 at 07:03:32AM -0700, Simon Hill wrote:
> >    Hi JC
> >    With respect to your guidelines below, backbone stumps me again: how
> do I
> >    call the "join" method on the ChatRoomView?
> >    I understand conceptually that I need to update the room join model
> and
> >    call the join method on the ChatRoomView, but I can't find a
> reference to
> >    that view that's already initialized, and when I try to initialize
> it, I
> >    can't pass it the right parameters.
> >    Incidentally I cannot get converse.chats.open to work with opening
> rooms.
> >    BTW, I would be happy simulating click events on the UI form, instead
> of
> >    hacking the API, if that were possible, at least for v1.
> >    Thanks again for your marvelous support of this valuable project.
> >    Si
> >    On Mon, Mar 16, 2015 at 6:59 AM, JC Brand <[1]lists@opkode.com>
> wrote:
> >
> >      On Sat, Mar 14, 2015 at 04:26:42PM -0700, Simon Hill wrote:
> >      >    I thought I'd take a shot at adding API functionality to
> >      programmatically
> >      >    join a room and open its chatbox, which I need for something I
> am
> >      working
> >      >    on. The user will already have become a member of the
> member-only
> >      room
> >      >    before hand, so I really only need to emulate the function of
> >      entering the
> >      >    room name and pressing the Join button.
> >      >    First, I thought I would check that such a thing is not
> supported
> >      and
> >      >    second, could you give me some code hints on how I would go
> about
> >      it, such
> >      >    as where in the code such functionality should live.
> >
> >      The API of converse.js starts here:
> >      [2]
> 
https://github.com/jcbrand/converse.js/blob/77137a538cd9e79b288491ba492819b1e37733de/converse.js#L5433
> >
> >      You can open a chat room exactly like you open any other chat, with
> >      converse.chats.open.
> >
> >      You'll most likely want to call the "join" method on the ChatRoom
> view:
> >      [3]
> 
https://github.com/jcbrand/converse.js/blob/77137a538cd9e79b288491ba492819b1e37733de/converse.js#L2611
> >
> > References
> >
> >    Visible links
> >    1. mailto:lists@opkode.com
> >    2.
> 
https://github.com/jcbrand/converse.js/blob/77137a538cd9e79b288491ba492819b1e37733de/converse.js#L5433
> >    3.
> 
https://github.com/jcbrand/converse.js/blob/77137a538cd9e79b288491ba492819b1e37733de/converse.js#L2611
>

Re: [conversejs] Adding ability to programmatically join a room and open group chat box

From:
Simon Hill
Date:
2015-04-06 @ 20:41
@paparazzia I merged your changes into my local branch. The rooms API works
great. Thank you so much!

On Sat, Apr 4, 2015 at 11:20 PM, paparazzia <paparazzia@gmail.com> wrote:

> Hello Simon, JC,
>
> Just pulling a request for adding rooms api right now
>
> 2015-04-04 11:07 GMT+02:00 JC Brand <lists@opkode.com>:
>
>> Hi Simon
>>
>> I think it'll be possible to get an already open chat room via chats.get,
>> but
>> chats.open won't work because it assumes only SUC chat boxes.
>>
>> See the discussion here:
>> https://github.com/jcbrand/converse.js/issues/355
>>
>> I think the best solution is to create a new API namespace "rooms", so
>> that
>> people can use "rooms.get" and "rooms.open".
>>
>> About the "join" method. This is not exposed through the API. You'll need
>> to
>> write a plugin method to override those models or views you need to
>> modify.
>>
>> Backbone is actually conceptually very simple. If you want to modify
>> converse.js then you need to invest the time in learning how it works and
>> how
>> to work with it.
>>
>> Regards
>> JC
>>
>> On Wed, Apr 01, 2015 at 07:03:32AM -0700, Simon Hill wrote:
>> >    Hi JC
>> >    With respect to your guidelines below, backbone stumps me again: how
>> do I
>> >    call the "join" method on the ChatRoomView?
>> >    I understand conceptually that I need to update the room join model
>> and
>> >    call the join method on the ChatRoomView, but I can't find a
>> reference to
>> >    that view that's already initialized, and when I try to initialize
>> it, I
>> >    can't pass it the right parameters.
>> >    Incidentally I cannot get converse.chats.open to work with opening
>> rooms.
>> >    BTW, I would be happy simulating click events on the UI form,
>> instead of
>> >    hacking the API, if that were possible, at least for v1.
>> >    Thanks again for your marvelous support of this valuable project.
>> >    Si
>> >    On Mon, Mar 16, 2015 at 6:59 AM, JC Brand <[1]lists@opkode.com>
>> wrote:
>> >
>> >      On Sat, Mar 14, 2015 at 04:26:42PM -0700, Simon Hill wrote:
>> >      >    I thought I'd take a shot at adding API functionality to
>> >      programmatically
>> >      >    join a room and open its chatbox, which I need for something
>> I am
>> >      working
>> >      >    on. The user will already have become a member of the
>> member-only
>> >      room
>> >      >    before hand, so I really only need to emulate the function of
>> >      entering the
>> >      >    room name and pressing the Join button.
>> >      >    First, I thought I would check that such a thing is not
>> supported
>> >      and
>> >      >    second, could you give me some code hints on how I would go
>> about
>> >      it, such
>> >      >    as where in the code such functionality should live.
>> >
>> >      The API of converse.js starts here:
>> >      [2]
>> 
https://github.com/jcbrand/converse.js/blob/77137a538cd9e79b288491ba492819b1e37733de/converse.js#L5433
>> >
>> >      You can open a chat room exactly like you open any other chat, with
>> >      converse.chats.open.
>> >
>> >      You'll most likely want to call the "join" method on the ChatRoom
>> view:
>> >      [3]
>> 
https://github.com/jcbrand/converse.js/blob/77137a538cd9e79b288491ba492819b1e37733de/converse.js#L2611
>> >
>> > References
>> >
>> >    Visible links
>> >    1. mailto:lists@opkode.com
>> >    2.
>> 
https://github.com/jcbrand/converse.js/blob/77137a538cd9e79b288491ba492819b1e37733de/converse.js#L5433
>> >    3.
>> 
https://github.com/jcbrand/converse.js/blob/77137a538cd9e79b288491ba492819b1e37733de/converse.js#L2611
>>
>
>

Fwd: Re: [conversejs] Adding ability to programmatically join a room and open group chat box

From:
Simon Hill
Date:
2015-04-03 @ 13:32
Reposting my question in the hopes of an answer...    
          With respect to your guidelines below, backbone stumps me again:
how do I call the "join" method on the ChatRoomView?          
          I understand conceptually that I need to update the room join 
model and call the join method on the ChatRoomView, but I can't find a 
reference to that view that's already initialized, and when I try to 
initialize it, I can't pass it the right parameters.          
               Incidentally I cannot get      converse.chats.open to work 
with opening rooms.              
          BTW, I would be happy simulating click events on the UI form, 
instead of hacking the API, if that were possible, at least for v1.

          Thanks again for your marvelous support of this valuable 
project.          
          Si          
          
       On Mon, Mar 16, 2015 at 6:59 AM, JC Brand     <lists@opkode.com> wrote:    
                      On Sat, Mar 14, 2015 at 04:26:42PM -0700, Simon Hill
wrote:       
 >    I thought I'd take a shot at adding API functionality to 
programmatically       
 >    join a room and open its chatbox, which I need for something I am 
working       
 >    on. The user will already have become a member of the member-only 
room       
 >    before hand, so I really only need to emulate the function of 
entering the       
 >    room name and pressing the Join button.       
 >    First, I thought I would check that such a thing is not supported and       
 >    second, could you give me some code hints on how I would go about 
it, such       
 >    as where in the code such functionality should live.       
        
            The API of converse.js starts here:     
      
https://github.com/jcbrand/converse.js/blob/77137a538cd9e79b288491ba492819b1e37733de/converse.js#L5433

      
 You can open a chat room exactly like you open any other chat, with 
converse.chats.open.     
      
 You'll most likely want to call the "join" method on the ChatRoom view:     
      
https://github.com/jcbrand/converse.js/blob/77137a538cd9e79b288491ba492819b1e37733de/converse.js#L2611