-
Notifications
You must be signed in to change notification settings - Fork 140
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
is there any documentation about the functions available in ejabberd? #227
Comments
There is no such documentation. If you want simple put/get/delete operations you can look at the code of |
Also, if you have particular questions, like "I want to read value X, do something with it and then write value Y", you can ask here. |
I have the data that I want to write to my custom table but I am unable to. On
But nothing is inserted in the DB. There is no error in ejabberd logs. EDIT: |
There are several problems with your code:
You should encode it to binary_to_list(fxml:element_to_binary(xmpp:encode(Msg))) |
thanks @zinid , So then I used the Also whats the recommended way of creating a table for my custom ejabberd module? I have created the table directly for now but that doesn't make it reusable, is there anyway to put .sql in some directory which would be read by ejabberd on startup? |
Options of function compile:file/2 can be used in
There is nothing like this in ejabberd, but on our TODO list. |
Alright, thanks again for your help @zinid .
EDIT: |
|
ok, I see |
Well, in such case you have to write your module, yes. |
@zinid , Questionhow can I start same server multiple times? ContextI have created one ejabberd module
Now when my module
but it seems that the first command starts a child, but second command doesn't do anything. On a separate notethe function I added to
While current signature is |
Two many questions, please ask a single question at a time, it's hard to address them. |
You cannot use functions from |
Regarding offline: I didn't understand the question. There are a lot of functions attached to the hook and they work. |
@zinid , |
@zinid At first I returned |
Yes, if the intention is to drop the message silently. That's an absolutely correct way doing this. |
Thank you, Scenario: |
So send it in the same hook, using |
Or you can send it using |
thanks again @zinid , Using swift.im or adium works fine with ejabberd and my custom modules.
Received xml from above log:
I can't figure anything wrong with the packet sent by the client, plus such packets are working fine with tigase. |
You cannot include declarations inside an already opened stream, ejabberd actually tells you this:
|
thanks.. after removing declaration from every packet, chat started to work fine. To connect to an external mysql database, is there any other way to achieve it except for creating my own I do not completely understand the |
It depends. If you want to rewrite SQL code significantly, then you will have to cope with parse transformers (which is quite brutal). You probably don't need to use your own SQL handlers, what is lacking for you in standard ones? |
Well I have configured mysql as default dB for ejabberd, I have added few tables to it and created modules which use those tables. Now I need to connect to other mysql server and run some queries there. As per my current knowledge of Erlang and ejabberd, that is not possible currently and I will have to write my own I am hoping that I will be using the |
i'm closing this thread, which contains so much different points, and is out of the scope of this project. |
Please @zinid can just give me an example of elixir database query with :ejabberd_sql. |
$ grep 'sql_query' ejabberd/src/*.erl | wc -l
336 So 336 examples in ejabberd code is not enough for you? You need yet another one? |
@zinid dont be offended sir, its just they are written in Erlang. i see something like this. |
Ah, Elixir. Well, regarding Elixir, I already tired to explain: if you choose Elixir to avoid reading/learning Erlang then you are wrong. As wrong as those guys choosing Scala to avoid Java. So eventually you'll end up in reading/writing both languages, which is not bad by itself but was definitely not the purpose people chose Elixir for. |
I am trying to develop a custom module in elixir, in which I need to access the configured database (creating a new table and storing data in it on certain event). The list of events is not available in new documentation but i was able to find it in the old docs, but even in old docs its not defined when those events are fired.
From where can I get the list of existing modules, functions and records in ejabberd which I can use to access the database?
The text was updated successfully, but these errors were encountered: