• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

processone / ejabberd / 1296

19 Jan 2026 11:25AM UTC coverage: 33.562% (+0.09%) from 33.468%
1296

push

github

badlop
mod_conversejs: Cosmetic change: sort paths alphabetically

0 of 4 new or added lines in 1 file covered. (0.0%)

11245 existing lines in 174 files now uncovered.

15580 of 46421 relevant lines covered (33.56%)

1074.56 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

29.41
/src/mod_caps_mnesia.erl
1
%%%-------------------------------------------------------------------
2
%%% File    : mod_caps_mnesia.erl
3
%%% Author  : Evgeny Khramtsov <ekhramtsov@process-one.net>
4
%%% Created : 13 Apr 2016 by Evgeny Khramtsov <ekhramtsov@process-one.net>
5
%%%
6
%%%
7
%%% ejabberd, Copyright (C) 2002-2026   ProcessOne
8
%%%
9
%%% This program is free software; you can redistribute it and/or
10
%%% modify it under the terms of the GNU General Public License as
11
%%% published by the Free Software Foundation; either version 2 of the
12
%%% License, or (at your option) any later version.
13
%%%
14
%%% This program is distributed in the hope that it will be useful,
15
%%% but WITHOUT ANY WARRANTY; without even the implied warranty of
16
%%% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17
%%% General Public License for more details.
18
%%%
19
%%% You should have received a copy of the GNU General Public License along
20
%%% with this program; if not, write to the Free Software Foundation, Inc.,
21
%%% 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
22
%%%
23
%%%----------------------------------------------------------------------
24

25
-module(mod_caps_mnesia).
26

27
-behaviour(mod_caps).
28

29
%% API
30
-export([init/2, caps_read/2, caps_write/3, import/3]).
31
-export([need_transform/1, transform/1]).
32

33
-include("mod_caps.hrl").
34
-include("logger.hrl").
35

36
%%%===================================================================
37
%%% API
38
%%%===================================================================
39
init(_Host, _Opts) ->
UNCOV
40
    ejabberd_mnesia:create(?MODULE, caps_features,
2✔
41
                           [{disc_only_copies, [node()]},
42
                            {local_content, true},
43
                            {attributes, record_info(fields, caps_features)}]).
44

45
caps_read(_LServer, Node) ->
UNCOV
46
    case mnesia:dirty_read({caps_features, Node}) of
4✔
UNCOV
47
        [#caps_features{features = Features}] -> {ok, Features};
2✔
UNCOV
48
        _ -> error
2✔
49
    end.
50

51
caps_write(_LServer, Node, Features) ->
UNCOV
52
    mnesia:dirty_write(#caps_features{node_pair = Node,
2✔
53
                                      features = Features}).
54

55
import(_LServer, NodePair, [I]) when is_integer(I) ->
56
    mnesia:dirty_write(
×
57
      #caps_features{node_pair = NodePair, features = I});
58
import(_LServer, NodePair, Features) ->
59
    mnesia:dirty_write(
×
60
      #caps_features{node_pair = NodePair, features = Features}).
61

62
need_transform(#caps_features{node_pair = {N, P}, features = Fs}) ->
63
    case is_list(N) orelse is_list(P) orelse
×
64
        (is_list(Fs) andalso lists:any(fun is_list/1, Fs)) of
×
65
        true ->
66
            ?INFO_MSG("Mnesia table 'caps_features' will be "
×
67
                      "converted to binary", []),
×
68
            true;
×
69
        false ->
70
            false
×
71
    end.
72

73
transform(#caps_features{node_pair = {N, P}, features = Fs} = R) ->
74
    NewFs = if is_integer(Fs) ->
×
75
                    Fs;
×
76
               true ->
77
                    [iolist_to_binary(F) || F <- Fs]
×
78
            end,
79
    R#caps_features{node_pair = {iolist_to_binary(N), iolist_to_binary(P)},
×
80
                    features = NewFs}.
81

82
%%%===================================================================
83
%%% Internal functions
84
%%%===================================================================
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc