From 92f89e3d4503ac2affc6b7e5192dc12f012c331d Mon Sep 17 00:00:00 2001 From: vesvalo Date: Fri, 8 Aug 2014 13:26:16 +0400 Subject: Fix odbc update_t and update insert case return value --- src/odbc_queries.erl | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/odbc_queries.erl b/src/odbc_queries.erl index e0637f840..09549c0a2 100644 --- a/src/odbc_queries.erl +++ b/src/odbc_queries.erl @@ -97,10 +97,14 @@ update_t(Table, Fields, Vals, Where) -> of {updated, 1} -> ok; _ -> - ejabberd_odbc:sql_query_t([<<"insert into ">>, Table, + Res = ejabberd_odbc:sql_query_t([<<"insert into ">>, Table, <<"(">>, join(Fields, <<", ">>), <<") values ('">>, join(Vals, <<"', '">>), - <<"');">>]) + <<"');">>]), + case Res of + {updated,1} -> ok; + _ -> Res + end end. update(LServer, Table, Fields, Vals, Where) -> @@ -115,10 +119,14 @@ update(LServer, Table, Fields, Vals, Where) -> of {updated, 1} -> ok; _ -> - ejabberd_odbc:sql_query(LServer, + Res = ejabberd_odbc:sql_query(LServer, [<<"insert into ">>, Table, <<"(">>, join(Fields, <<", ">>), <<") values ('">>, - join(Vals, <<"', '">>), <<"');">>]) + join(Vals, <<"', '">>), <<"');">>]), + case Res of + {updated,1} -> ok; + _ -> Res + end end. %% F can be either a fun or a list of queries -- cgit v1.2.3 From 436f0832c1d7cdd98c6629977d41700e5aa7e589 Mon Sep 17 00:00:00 2001 From: vesvalo Date: Fri, 8 Aug 2014 13:57:27 +0400 Subject: fix mod_offline to store only chat messages with body xml element --- src/mod_offline.erl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/mod_offline.erl b/src/mod_offline.erl index bb488f8c5..95c5881df 100644 --- a/src/mod_offline.erl +++ b/src/mod_offline.erl @@ -296,8 +296,9 @@ get_sm_features(Acc, _From, _To, _Node, _Lang) -> store_packet(From, To, Packet) -> Type = xml:get_tag_attr_s(<<"type">>, Packet), + BodyElem = xml:get_path_s(Packet,[{elem, <<"body">>}]), if (Type /= <<"error">>) and (Type /= <<"groupchat">>) - and (Type /= <<"headline">>) -> + and (Type /= <<"headline">>) and (<<>> /= BodyElem) -> case has_no_storage_hint(Packet) of false -> case check_event(From, To, Packet) of -- cgit v1.2.3