diff --git a/src/event_pusher/mod_event_pusher_push_rdbms.erl b/src/event_pusher/mod_event_pusher_push_rdbms.erl index cdde39a887b..6970c624154 100644 --- a/src/event_pusher/mod_event_pusher_push_rdbms.erl +++ b/src/event_pusher/mod_event_pusher_push_rdbms.erl @@ -81,6 +81,7 @@ decode_row({NodeID, PubSubBin, FormJSON}) -> NodeID, decode_form(FormJSON)}. +-spec encode_form(mod_event_pusher_push:form()) -> iodata(). encode_form(Form) -> jiffy:encode(Form). diff --git a/src/event_pusher/mod_event_pusher_rabbit.erl b/src/event_pusher/mod_event_pusher_rabbit.erl index 98118f17e72..7fe2ed4c0b1 100644 --- a/src/event_pusher/mod_event_pusher_rabbit.erl +++ b/src/event_pusher/mod_event_pusher_rabbit.erl @@ -178,7 +178,7 @@ user_topic_routing_key(JID, Topic) -> -spec presence_msg(JID :: jid:jid(), Status :: atom()) -> binary(). presence_msg(JID, Status) -> Msg = #{user_id => jid:to_binary(jid:to_lower(JID)), present => is_user_online(Status)}, - jiffy:encode(Msg). + iolist_to_binary(jiffy:encode(Msg)). -spec chat_msg(From :: jid:jid(), To :: jid:jid(), UserMsg :: binary()) -> binary(). @@ -186,7 +186,7 @@ chat_msg(From, To, UserMsg) -> Msg = #{to_user_id => jid:to_binary(jid:to_lower(To)), message => UserMsg, from_user_id => jid:to_binary(jid:to_lower(From))}, - jiffy:encode(Msg). + iolist_to_binary(jiffy:encode(Msg)). -spec is_user_online(online | offline) -> boolean(). is_user_online(online) -> true; diff --git a/src/mongoose_client_api/mongoose_client_api_sse.erl b/src/mongoose_client_api/mongoose_client_api_sse.erl index 786dfba6d69..118c033d3f2 100644 --- a/src/mongoose_client_api/mongoose_client_api_sse.erl +++ b/src/mongoose_client_api/mongoose_client_api_sse.erl @@ -64,11 +64,11 @@ terminate(_Reason, _Req, _State) -> ok. maybe_send_message_event(<<"chat">>, Packet, Timestamp, #{id := ID} = State) -> - Data = jiffy:encode(mongoose_client_api_messages:encode(Packet, Timestamp)), + Data = iolist_to_binary(jiffy:encode(mongoose_client_api_messages:encode(Packet, Timestamp))), Event = #{id => integer_to_binary(ID), event => <<"message">>, data => Data}, {send, Event, State#{id := ID + 1}}; maybe_send_message_event(<<"groupchat">>, Packet, Timestamp, #{id := ID} = State) -> - Data = jiffy:encode(mongoose_client_api_rooms_messages:encode(Packet, Timestamp)), + Data = iolist_to_binary(jiffy:encode(mongoose_client_api_rooms_messages:encode(Packet, Timestamp))), Event = #{id => integer_to_binary(ID), event => <<"room.message">>, data => Data}, {send, Event, State#{id := ID + 1}}; maybe_send_message_event(_, _, _, State) -> diff --git a/src/muc/mod_muc_rdbms.erl b/src/muc/mod_muc_rdbms.erl index ca8f4c5ed3f..ca21a3ce0ab 100644 --- a/src/muc/mod_muc_rdbms.erl +++ b/src/muc/mod_muc_rdbms.erl @@ -219,7 +219,7 @@ store_nick_transaction(HostType, MucHost, Jid, Nick, true) -> Error -> Error end. --spec store_room_transaction(mongooseim:host_type(), muc_host(), jid:luser(), binary(), term()) -> ok. +-spec store_room_transaction(mongooseim:host_type(), muc_host(), jid:luser(), iodata(), term()) -> ok. store_room_transaction(HostType, MucHost, RoomName, ExtOpts, Affs) -> execute_insert_room(HostType, MucHost, RoomName, ExtOpts), Result = execute_select_room_id(HostType, MucHost, RoomName), @@ -249,7 +249,7 @@ forget_room_transaction(HostType, MucHost, RoomName) -> %% Execute call functions --spec execute_insert_room(mongooseim:host_type(), muc_host(), jid:luser(), binary()) -> ok. +-spec execute_insert_room(mongooseim:host_type(), muc_host(), jid:luser(), iodata()) -> ok. execute_insert_room(HostType, MucHost, RoomName, ExtOpts) -> Args = [MucHost, RoomName, ExtOpts], execute_successfully(HostType, muc_insert_room, Args), diff --git a/src/rdbms/mongoose_rdbms.erl b/src/rdbms/mongoose_rdbms.erl index 2a7abde452a..0167536eb29 100644 --- a/src/rdbms/mongoose_rdbms.erl +++ b/src/rdbms/mongoose_rdbms.erl @@ -158,8 +158,8 @@ -type rdbms_msg() :: {sql_query, _} | {sql_transaction, fun()} | {sql_dirty, fun()} - | {sql_execute, atom(), [binary() | boolean() | integer()]} - | {sql_execute_wrapped, atom(), [binary() | boolean() | integer()], request_wrapper()}. + | {sql_execute, atom(), [iodata() | boolean() | integer()]} + | {sql_execute_wrapped, atom(), [iodata() | boolean() | integer()], request_wrapper()}. -type single_query_result() :: {selected, [tuple()]} | {updated, non_neg_integer() | undefined} | {updated, non_neg_integer(), [tuple()]} |