-
Notifications
You must be signed in to change notification settings - Fork 88
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
XMPP codec should be modular #9
Comments
Great ... thanks will try it out soon |
tag in rebar is should it be some version tag ? @zinid |
No, we tag it during release, later. |
This is example of script to build custom XMPP codec module for this library:
The project structure:
spec folder should contains specification additional tags. Makefile can be like this:
So just run: |
By the way. All these flow are big crutches. XMPP library MUST allow build CUSTOM MODULES for all developers. |
MORE CAPS |
how to make custom iq spec? for example i have custom iq handler with query ns "NS-CUSTOM-MODULE" |
@ltAldoRaine you can show an example of your IQ payload, so I can write some spec you can start with. |
I did everything as you described. after restarting ejabberd there was error which was throwed by xmpp:register_codec()
Crash dump is being written to: /usr/local/var/log/ejabberd/erl_crash_20180205-174736.dump...done |
|
|
You should compile it inside your project. Then you just set |
You can of course compile it within ejabberd project (just put your ERL file inside |
Thanks ! I will try second option..my modules(not xmpp-codec) is also in ejabberd src folder |
It worked ! :) now ejabberd is receiving my iq stanza. |
I was experimenting with this example and still can't make it work. So, the steps performed:
What am I missing here? Would appreciate any suggestions please. |
The module |
@zinid, truly appreciate the prompt response. I wish there were an easier way to do this and proper documentation of the steps with examples. |
What do you mean by "loaded"? Did you put it into ejabberd.yml? |
No, I meant compiled and installed the module Actually that was the problem, updated Wondering why the Anyway, thank you very much @zinid, truly appreciate. |
Because a module typically requires some start options. |
If you are still having this issue, check.. here |
XMPP codec should allow third-party developers to create their own submodules and plug them into xmpp_codec.
This is implemented in 3976a85
Here is a brief description for developers about how they could use it:
$ git clone https://github.com/processone/xmpp
$ make
specs/xmpp_codec.spec
with propermodule
attribute set$ make spec
src
directory. Those files are your submodules. Grab them to the working directory of your project.include/xmpp_codec.hrl
. Grab those too in your project (either put them in your *.hrl files or in your *.erl files directly).Done!
Not very clear, eh? OK, here is an example.
Let's say we want to add submodule for the following element:
Clone and compile the repo, open
specs/xmpp_codec.spec
and put the following spec somewhere inside it (the order doesn't matter):Now type
make spec
in order to recompile the specification. New file will be created insidesrc
directory:Copy this
foo.erl
into your working directory.Now, consult the recompiled
xmpp_codec.hrl
:Put this record and type definition somewhere in your files.
Now, you need to register your submodule (
foo
) during startup. This should look something like this:Note, that you need to call
xmpp:register_codec/1
again, if you have your submodule (foo
) recompiled and reloaded in runtime.Also, you may want to unregister the submodule during shutdown procedure, although, strictly speaking, this is not required:
Now you have everything done to use your new "subcodec".
Have fun ;)
The text was updated successfully, but these errors were encountered: