aboutsummaryrefslogtreecommitdiff
path: root/src/mod_carboncopy_sql.erl
diff options
context:
space:
mode:
Diffstat (limited to 'src/mod_carboncopy_sql.erl')
-rw-r--r--src/mod_carboncopy_sql.erl5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/mod_carboncopy_sql.erl b/src/mod_carboncopy_sql.erl
index 3271d8a1c..1b8e1e111 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]};