summaryrefslogtreecommitdiff
path: root/src/mod_mam.erl
diff options
context:
space:
mode:
authorHolger Weiss <holger@zedat.fu-berlin.de>2017-11-14 22:58:16 +0100
committerHolger Weiss <holger@zedat.fu-berlin.de>2017-11-14 22:58:16 +0100
commit06d4f1ff33a506bd7c912e1a7e861bcf126da881 (patch)
tree7efc2eda7ad1518fd3fdbefd579de6f255b9b67b /src/mod_mam.erl
parentmod_mam: Apply minor cosmetic changes (diff)
mod_mam: Add a few function specifications
Diffstat (limited to 'src/mod_mam.erl')
-rw-r--r--src/mod_mam.erl7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/mod_mam.erl b/src/mod_mam.erl
index 65217817..7c710771 100644
--- a/src/mod_mam.erl
+++ b/src/mod_mam.erl
@@ -372,6 +372,7 @@ init_stanza_id(Pkt, LServer) ->
Pkt1 = strip_my_stanza_id(Pkt, LServer),
xmpp:put_meta(Pkt1, stanza_id, ID).
+-spec set_stanza_id(stanza(), jid(), integer()) -> stanza().
set_stanza_id(Pkt, JID, ID) ->
BareJID = jid:remove_resource(JID),
Archived = #mam_archived{by = BareJID, id = ID},
@@ -576,6 +577,7 @@ process_iq(LServer, #iq{from = #jid{luser = LUser}, lang = Lang,
end
end.
+-spec should_archive(message(), binary()) -> boolean().
should_archive(#message{type = error}, _LServer) ->
false;
should_archive(#message{meta = #{from_offline := true}}, _LServer) ->
@@ -684,6 +686,7 @@ should_archive_peer(LUser, LServer,
end
end.
+-spec should_archive_muc(message()) -> boolean().
should_archive_muc(#message{type = groupchat,
body = Body, subject = Subj} = Pkt) ->
case check_store_hint(Pkt) of
@@ -707,6 +710,7 @@ should_archive_muc(#message{type = groupchat,
should_archive_muc(_) ->
false.
+-spec check_store_hint(message()) -> store | no_store | none.
check_store_hint(Pkt) ->
case has_store_hint(Pkt) of
true ->
@@ -740,6 +744,7 @@ is_resent(Pkt, LServer) ->
false
end.
+-spec may_enter_room(jid(), mod_muc_room:state()) -> boolean().
may_enter_room(From,
#state{config = #config{members_only = false}} = MUCState) ->
mod_muc_room:get_affiliation(From, MUCState) /= outcast;
@@ -769,6 +774,8 @@ store_msg(Pkt, LUser, LServer, Peer, Dir) ->
pass
end.
+-spec store_muc(mod_muc_room:state(), message(), jid(), jid(), binary())
+ -> ok | pass | any().
store_muc(MUCState, Pkt, RoomJID, Peer, Nick) ->
case should_archive_muc(Pkt) of
true ->