ejabberd end-byte

Im curious, what's ejabberd end-byte, because I want to write a Flash jabber client, and flash needs messages from servers terminated my ASCII 0 byte!
If it's not zero byte, then is it possible to change to zero byte somehow?
Thanks!

Same problem here, any workarround?

I recently post a thread about this problem, has anyone a idea or fix abount do that?

Thanks!

Shouldn't be impossible

From my superficial understanding of the ejabberd code, it seems that you could add the null byte in the function send_text in ejabberd_c2s.erl. (In some cases, send_text is called with error_stanza++stream_trailer, which means that there will be no null byte inserted between them. I don't know Flash, so I don't know whether that is a problem.)

Coding this, testing it, and making it a configurable option instead of hardcoded is left as an exercise for the reader. ;-)

This patch adds \0 to the

This patch (for ejabberd 0.9.1) adds \0 to the text that is going to be sent. I don't know if Erlang will replace \0 with a null character, I don't know if that place is the right one to add this character, etc. Anyway, they can try it, maybe it helps a little. At least I'm able to login correctly with Tkabber after applying it.

--- ejabberd_c2s.erl.orig	2005-07-27 22:26:32.000000000 +0200
+++ ejabberd_c2s.erl	2005-07-27 22:54:32.686213992 +0200
@@ -1059,7 +1059,8 @@
     ejabberd_receiver:change_shaper(StateData#state.receiver, Shaper).
 
 send_text(StateData, Text) ->
-    (StateData#state.sockmod):send(StateData#state.socket, Text).
+    Text2 = io_lib:fwrite("~s\0", [Text]),
+    (StateData#state.sockmod):send(StateData#state.socket, Text2).
 
 send_element(StateData, El) ->
     send_text(StateData, xml:element_to_string(El)).

Can you post a tutotial like post?

Can you post a tutotial like post for apply you patch? Im not very erlang friendly. ;-)

THANX!

Under Linux, FreeBSD,... you

Under Linux, FreeBSD,... you should put the content of the quote in a file. Then you need to do "patch -p0 <the_file_you_created" in the directory containing ejabberd_c2s.erl (I think this will be the src directory). Then you need to to a "make" and "make install" again and restart ejabberd (or reload that module).

Under Windows it will be more difficult as I think this OS has no "patch" tool (yes, it is not as userfriendly as one of the OSes lissted above ;-) ). Open ejabberd_c2s.erl in a text editor that don't breaks the encoding and things (I think Notepad will be risky!). Then search the line "(StateData#state.sockmod):send(StateData#state.socket, Text)." and verify if the lines above and under it are the same as in the patch (without the lines with the +!). If so, you should remove that line and replace it with the lines with the + before it (copy without the +!). If you did it ok and your text editor did'nt broke the file you now can compile ejabberd as described in the Ejabberd Installation and Operation Guide.

--
sander

Works smoothly, Thanks!!!!!

Works smoothly, Thanks!!!!!

A few days ago, I apply the patch

A few days ago, I apply the patch and my flash client start working(almost, just connect, send and receive data aparentrly), but I'm unable to log to the server. I try Pandion and exodus, Pandion is unable to login, Exodus does well.

With my flash client, this is the trace I having

SENT:
<?xml
version="1.0"?><stream:stream to="localhost"
xmlns="jabber:client" xmlns:stream="http://etherx.jabber.org/streams"
version="0.9">

RECEIVE2: <?xml
version='1.0'?><stream:stream xmlns="jabber:client"
xmlns:stream="http://etherx.jabber.org/streams"
id="2380769756" from="localhost" xml:lang="en"
/>

SENT: <iq id="log_user_1"
type="get"><query
xmlns="jabber:iq:auth"><username>werem</username></query></iq>

RECEIVE2:
<stream:error><xml-not-well-formed xmlns="urn:ietf:params:xml:ns:xmpp-streams" /></stream:error>

I'm using version="0.9" in the initialization XML trying to avoid the MD5 authentication. I think that make the trick, because the login sequence is diferent.
Maybe I'm doing something wrong or maybe the patch lacs something. Any help will be wellcome.

Thanks

I think that the server

I think that the server manages the loguin thing from another place, and that is not sending the '/0', can anibody confirm that?

I found that the server

I found that the server closes the socket after the first response, anyone knows if that is configurable?

The patch is incomplete

It's disconecting you because you are sending a "\0" as well to the server, which the server will understand exactly the same way if you would send "Hi, i'm trying to send you data", and it will dump you off just like that. The patch it's great and it really sends the users a \0 (null) char at the end of every stream, but part 2 needs to be posted in order to make the server understand that stream + null character is a valid XML stream.
I'm currently working on getting it finished, so i'll post the patch as soon as i get it done. Cheers to all you. Congratulations for the site, i'm brand new here and i find it excellent.

Best Regards.

The patch is incomplete

Any update on this patch? Has it been updated with the second part of the fix whereby stream + null character is recognized as a valid XML stream?

Yes, the patch is in Bugzilla

Yes, the patch is in Bugzilla bug 186. The patch works for me, but feedback appreciated, of courseā€¦

Patch isnt working for me.

This patch has not been working for me. I have ejabberd-1.1.1 and have yet to keep a connection with the flash xiffian example.

i downloaded the changes into a file "xiff_patch" sitting in the same folder as the ejabberd-1.1.1 folder, i then entered the /ejabberd-1.1.1/src folder and applied the patch with "patch < ../../xiff_patch"

i did see it succeed, but something isnt working properly.

whenever xiffian tried to connect, it attempts to connect then just dies and retries, no messages sent from the server are sending the /0 null byte.

Jeffrey R. | dS

Small ideas

Patches are usually applied with: 'patch -p0 <file.diff', I don't know if it makes a difference.

After applying the changes, did you compile and install the new binaries, and restart the Jabber server?

i was originally applying

i was originally applying the patch in the wrong manner, it was creating the modified files in the folder where xiff_patch was. I have since moved the xiff patch to inside the src directory and have confirmed the files modification dates and "flash hack" variables in the modified files. This still is not working for me. And yes i have patched, recompiled binaries, removed old install and then re-installed them.

EDIT: still no go, question for those using XIFFIAN, are u using 'terminatedflash' or 'flash' as your client setting?
not that it should matter but just to be certain.

Any other tips are welcome.

This is my patch log if it matters:

patching file Makefile.in
patching file configure.ac
patching file ejabberd.hrl
patching file ejabberd_c2s.erl
Hunk #3 succeeded at 181 (offset 7 lines).
Hunk #5 succeeded at 591 (offset 7 lines).
patching file expat_erl.c
patching file jlib.hrl

Thanks,
Jeffrey R. | dS

ejabberd xiff fedora

Still no luck,

I would really appreciate it if someone could post a working copy of ejabberd-1.1.1 pre-patched with the flash hack, preferably before compiling. also any ejabberd.cfg files, and possibly the startup command/script.

Im really not sure where i am failing but i have grabbed older revisions of ejabberd and tried compiling with the patch but still no luck.

My guess is that its a Fedora Core 5 issue or expat (had to downgrade).

I would appreciate any assistance that is available.

Thanks,
Jeffrey R. | dS

flash patch, did you..?

hey,

after applying the patch, you have to recompile everything:

./configure --enable-flash-hack
make -B

did you do that? a simple "make" wouldn't apply the patch, if there are already compiled beam's in the dir..

flip

There now is a page about

There now is a page about the flash-hack.

--
sander

it's here:

it's here: Flash Hack

Something in the patch

Something in the patch closes the socket, this is very painfull, have you got an idea why is this?

Thanks!

Flash patch

I've written a patch, which should enable Flash clients to connect to an ejabberd server. I hope it will be useful.

Patch for 1.1.2 or svn?

Any plans to rewrite patch for 1.1.2 or latest svn version (r700)?

There is already a patch for

There is already a patch for version 1.1.2. I just uploaded a patch for latest SVN; does it work for you?

There is already a patch for

[/temp/flash/ejabberd-1.1.2/src]# patch -p2 < ejabberd-flash3.patch
patching file Makefile.in
Hunk #2 succeeded at 78 (offset 7 lines).
patching file configure.ac
Hunk #1 succeeded at 54 with fuzz 2 (offset 9 lines).
patching file ejabberd.hrl
patching file ejabberd_c2s.erl
Hunk #3 succeeded at 181 (offset 7 lines).
Hunk #5 succeeded at 591 (offset 7 lines).
Hunk #6 succeeded at 1226 (offset 1 line).
patching file expat_erl.c
patching file jlib.hrl
___________
autoconf
___________________________________________________
./configure --prefix=/usr/local/ejabberd --enable-flash-hack --enable-odbc
--skipped--
__________________________________
make
--skipped--
/usr/bin/erlc -W -DENABLE_FLASH_HACK xml_stream.erl
making all in mod_irc
/bin/sh: line 3: cd: mod_irc: No such file or directory
make: *** [all-recursive] Error 1
______________________
Without patch it compiles succesfully, though "make clean" also failed with this error.
mod_irc directory exists.
The same with svn version.

There is already a patch for

Problem was with my bash environment, specifically in CDPATH variable. It compiles, but we still failed with flash. Is there any working example of code to check with?

Patch doesn't work for me :(

I'm using ejabberd-1.1.1 and applied the last version of the patch but I still can't connect from flash clients.

I enabled the debugging mode for ejabberd and got this:

--------------------------------------------------------------------------------

I(<0.224.0>:ejabberd_listener:90): (#Port<0.384>) Accepted connection {{192,168,0,122},2170} -> {{192,168,0,248},5222}
D(<0.391.0>:ejabberd_receiver:261) : Received XML on stream = [60,
63,
120,
...
62,
0]
D(<0.390.0>:ejabberd_c2s:1234) : Send XML on stream = "<?xml version='1.0'?>"

--------------------------------------------------------------------------------

Looks like ejabberd is receiving the XML as ASCII codes :S although I could get the correct XML with Ethereal being sent from the Flash client.
Any clue on this?

Thanks,

Sergio Bessa

I am experiencing the same

I am experiencing the same problem :(

Guide to apply the patch

There is a new small guide to install the patch: Flash-hack.

I've verified it using Xiffian0013-B0ris_prod.zip, ejabberd 1.1.1, Erlang R10B-10, Expat 1.95.8 on Debian unstable.

Flash-hack - Does it work with ejabberd 1.1.2?

I've tried to use the latest flash patch with ejabberd 1.1.2 and I got an error when applying Hunk 6. I tried to compile it anyway, it works but not with flash clients. I have used the "Updated patch for ejabberd_socket changes" (http://www.jabber.ru/bugzilla/attachment.cgi?id=176). Is there any patch working with the ejabberd 1.1.2 yet? Or should I continue to use ejabberd 1.1.1 if I need to support flash clients?

Thanks!

Fernando

The patch for 1.1.1 applies to 1.1.2

It seems that the patch for 1.1.1 will work with 1.1.2 too. The 1.1.1 patch is confusingly labeled "Update for SVN version" in bugzilla; the flash-hack page gets it straight.

Flash clients with 1.1.2 version - Ok!

Thanks for your reply. I've tested the patch http://www.jabber.ru/bugzilla/attachment.cgi?id=155 (for 1.1.1 version) and it really works with 1.1.2 version, so I confirm, it is working now with flash clients. The other patch (http://www.jabber.ru/bugzilla/attachment.cgi?id=176) gave me the error I described before (failed on Hunk 6) and the flash clients couldn't connecto to the ejabberd server.

Best regards

Fernando

Do we need to do anything

Do we need to do anything with later version of jabber with cross domain policy file for Flash?

Syndicate content