1 |
|
%%% @doc Encoder and decoder for MAM JIDs |
2 |
|
%%% |
3 |
|
%%% Default implementations are: |
4 |
|
%%% - mam_jid_mini |
5 |
|
%%% - mam_jid_rfc |
6 |
|
-module(mam_jid). |
7 |
|
|
8 |
|
-ignore_xref([behaviour_info/1]). |
9 |
|
|
10 |
|
-callback encode(jid:jid(), jid:jid()) -> binary(). |
11 |
|
-callback decode(jid:jid(), binary()) -> jid:jid(). |
12 |
|
|
13 |
|
-export([encode/3, decode/3]). |
14 |
|
|
15 |
|
-spec encode(module(), jid:jid(), jid:jid()) -> binary(). |
16 |
|
encode(Module, UserJID, JID) -> |
17 |
15749 |
Module:encode(UserJID, JID). |
18 |
|
|
19 |
|
-spec decode(module(), jid:jid(), binary()) -> jid:jid(). |
20 |
|
decode(Module, UserJID, Bin) -> |
21 |
3304 |
Module:decode(UserJID, Bin). |
22 |
|
|