diff options
author | Alexey Shchepin <alexey@process-one.net> | 2017-11-02 17:03:30 +0300 |
---|---|---|
committer | Alexey Shchepin <alexey@process-one.net> | 2017-11-02 18:21:40 +0300 |
commit | 78dfb832b8e5b711cfbbe3131493057325c0008d (patch) | |
tree | 8b3148730887908a2c6e676e6ce159b24b6d05d8 /src/mod_carboncopy_sql.erl | |
parent | Fix pkix:validate() return value (diff) |
Add SQL_INSERT macro and update SQL queries to use server_host field
Diffstat (limited to 'src/mod_carboncopy_sql.erl')
-rw-r--r-- | src/mod_carboncopy_sql.erl | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/mod_carboncopy_sql.erl b/src/mod_carboncopy_sql.erl index 3271d8a1..1b8e1e11 100644 --- a/src/mod_carboncopy_sql.erl +++ b/src/mod_carboncopy_sql.erl @@ -42,6 +42,7 @@ enable(LUser, LServer, LResource, NS) -> NodeS = erlang:atom_to_binary(node(), latin1), case ?SQL_UPSERT(LServer, "carboncopy", ["!username=%(LUser)s", + "!server_host=%(LServer)s", "!resource=%(LResource)s", "namespace=%(NS)s", "node=%(NodeS)s"]) of @@ -56,7 +57,7 @@ disable(LUser, LServer, LResource) -> case ejabberd_sql:sql_query( LServer, ?SQL("delete from carboncopy where username=%(LUser)s " - "and resource=%(LResource)s")) of + "and %(LServer)H and resource=%(LResource)s")) of {updated, _} -> ok; Err -> @@ -68,7 +69,7 @@ list(LUser, LServer) -> case ejabberd_sql:sql_query( LServer, ?SQL("select @(resource)s, @(namespace)s, @(node)s from carboncopy " - "where username=%(LUser)s")) of + "where username=%(LUser)s and %(LServer)H")) of {selected, Rows} -> {ok, [{Resource, NS, binary_to_atom(Node, latin1)} || {Resource, NS, Node} <- Rows]}; |