librelist archives

« back to archive

onMessage

onMessage

From:
Dominik Raffetseder
Date:
2014-04-23 @ 08:18
Hello,
how can i read out the message Text in Javascript?
i get the parameter messageXML. i would like to print it in an alert?

Thank you.

Dominik

Re: [conversejs] onMessage

From:
Jc Brand
Date:
2014-04-23 @ 09:41
On Wed, Apr 23, 2014 at 10:18:55AM +0200, Dominik Raffetseder wrote:
> Hello,
> how can i read out the message Text in Javascript?
> i get the parameter messageXML. i would like to print it in an alert?

If you set debug=true you'll get all the XML stanzas printed out to the browser
console.

Is that sufficient?

Regards
JC

Re: [conversejs] onMessage

From:
Dominik Raffetseder
Date:
2014-04-23 @ 10:30
Not really, i do have set debug=true all the time,
but i’m not able to read out the message?

Regards,
Dominik

Am 23.04.2014 um 11:41 schrieb JC Brand <lists@opkode.com>:

On Wed, Apr 23, 2014 at 10:18:55AM +0200, Dominik Raffetseder wrote:
> Hello,
> how can i read out the message Text in Javascript?
> i get the parameter messageXML. i would like to print it in an alert?

If you set debug=true you'll get all the XML stanzas printed out to the browser
console.

Is that sufficient?

Regards
JC

Re: [conversejs] onMessage

From:
Jc Brand
Date:
2014-04-24 @ 07:57
On Wed, Apr 23, 2014 at 12:30:20PM +0200, Dominik Raffetseder wrote:
> Not really, i do have set debug=true all the time,
> but i’m not able to read out the message?

Why not?

The XML gets logged to the browser console. I use this feature all the time.

See here: https://github.com/jcbrand/converse.js/blob/master/converse.js#L596


> Am 23.04.2014 um 11:41 schrieb JC Brand <lists@opkode.com>:
> 
> On Wed, Apr 23, 2014 at 10:18:55AM +0200, Dominik Raffetseder wrote:
> > Hello,
> > how can i read out the message Text in Javascript?
> > i get the parameter messageXML. i would like to print it in an alert?
> 
> If you set debug=true you'll get all the XML stanzas printed out to the browser
> console.
> 
> Is that sufficient?
> 
> Regards
> JC
> 

Re: [conversejs] onMessage

From:
Dominik Raffetseder
Date:
2014-04-28 @ 08:31
Hey once again.

i just want to use the message text in javascript, an work with it.
How can i do this?

Regards,
Dominik
Am 24.04.2014 um 09:57 schrieb JC Brand <lists@opkode.com>:

> On Wed, Apr 23, 2014 at 12:30:20PM +0200, Dominik Raffetseder wrote:
>> Not really, i do have set debug=true all the time,
>> but i’m not able to read out the message?
> 
> Why not?
> 
> The XML gets logged to the browser console. I use this feature all the time.
> 
> See here: https://github.com/jcbrand/converse.js/blob/master/converse.js#L596
> 
> 
>> Am 23.04.2014 um 11:41 schrieb JC Brand <lists@opkode.com>:
>> 
>> On Wed, Apr 23, 2014 at 10:18:55AM +0200, Dominik Raffetseder wrote:
>>> Hello,
>>> how can i read out the message Text in Javascript?
>>> i get the parameter messageXML. i would like to print it in an alert?
>> 
>> If you set debug=true you'll get all the XML stanzas printed out to the browser
>> console.
>> 
>> Is that sufficient?
>> 
>> Regards
>> JC
>> 

Re: [conversejs] onMessage

From:
Jc Brand
Date:
2014-04-28 @ 15:19
On Mon, Apr 28, 2014 at 10:31:35AM +0200, Dominik Raffetseder wrote:
> Hey once again.
> 
> i just want to use the message text in javascript, an work with it.
> How can i do this?

Do you have an event listener for the "onMessage" event?
https://conversejs.org/docs/html/index.html#event-types

messageXML contains the whole XMPP stanza that was received.

You can then get the message text like so:

    text = $(messageXML).children('body').text();


> Am 24.04.2014 um 09:57 schrieb JC Brand <lists@opkode.com>:
> 
> > On Wed, Apr 23, 2014 at 12:30:20PM +0200, Dominik Raffetseder wrote:
> >> Not really, i do have set debug=true all the time,
> >> but i’m not able to read out the message?
> > 
> > Why not?
> > 
> > The XML gets logged to the browser console. I use this feature all the time.
> > 
> > See here: https://github.com/jcbrand/converse.js/blob/master/converse.js#L596
> > 
> > 
> >> Am 23.04.2014 um 11:41 schrieb JC Brand <lists@opkode.com>:
> >> 
> >> On Wed, Apr 23, 2014 at 10:18:55AM +0200, Dominik Raffetseder wrote:
> >>> Hello,
> >>> how can i read out the message Text in Javascript?
> >>> i get the parameter messageXML. i would like to print it in an alert?
> >> 
> >> If you set debug=true you'll get all the XML stanzas printed out to 
the browser
> >> console.
> >> 
> >> Is that sufficient?
> >> 
> >> Regards
> >> JC
> >> 
>