Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mod_roster backends rewrite #139

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
122 commits
Select commit Hold shift + click to select a range
fce2f58
Indentation fixup trough whole file.
mpmiszczyk Jan 22, 2014
b5ce561
Seperate behaviuor from addition module interface.
mpmiszczyk Jan 22, 2014
419de9b
Plain definition of backend module.
mpmiszczyk Jan 22, 2014
37cb444
Moved inicializaion of backend to new module.
mpmiszczyk Jan 22, 2014
04e7afe
Type definitions copied from ejabber.
mpmiszczyk Jan 23, 2014
b226409
Plain move function call to backend module.
mpmiszczyk Jan 23, 2014
77b1963
Removed type wrapping (by backend call) form function call.
mpmiszczyk Jan 23, 2014
7dcaeba
Changed patter-match order in case statment.
mpmiszczyk Jan 23, 2014
c51b23a
Changed return type, to allow explicit pattern match on failing version.
mpmiszczyk Jan 23, 2014
17500e3
Moved writing roster version to backend module.
mpmiszczyk Jan 23, 2014
0525310
REFACTORING removed need to call function with magic-accumulator
mpmiszczyk Jan 23, 2014
5d60d35
REFACTORING simplified functin logic, and their responsibility.
mpmiszczyk Jan 23, 2014
d68df1f
Plain move function to backend module.
mpmiszczyk Jan 23, 2014
7fd3027
REFACTORING removed unnecessary delegation.
mpmiszczyk Jan 23, 2014
7e48448
Typo.
mpmiszczyk Jan 23, 2014
e973663
Document hook handlers.
mpmiszczyk Jan 23, 2014
fca51ad
Update `get_version` return value and usage.
mpmiszczyk Jan 23, 2014
5476a53
REFACTORING extract function
mpmiszczyk Jan 24, 2014
b83bae2
Moved function to backend module.
mpmiszczyk Jan 24, 2014
eec3bfd
Typo in function call
mpmiszczyk Jan 24, 2014
e4795a1
REFACTORIGN Moved function to backend module.
mpmiszczyk Jan 24, 2014
d557139
Changed to use already existing backend_module function.
mpmiszczyk Jan 24, 2014
9f4a5fa
REFACTORING moved function to backend module.
mpmiszczyk Jan 24, 2014
cff19b5
REFACTORING explicite change, and "obligatory" recursive call.
mpmiszczyk Jan 24, 2014
5569280
REFACTORIG variable rename and more visible recursion.
mpmiszczyk Jan 24, 2014
fe68136
INDENTATION
mpmiszczyk Jan 24, 2014
eb6b1fd
REFACTORING proper inicialization of function with accumulators.
mpmiszczyk Jan 24, 2014
e5e997d
REFACTORING moved function to backend module.
mpmiszczyk Jan 24, 2014
166c023
REFACTORING moved logic from backend to main module.
mpmiszczyk Jan 24, 2014
9f20e79
Removed code duplication from backend module.
mpmiszczyk Jan 24, 2014
10b0fb8
Use new backend module.
mpmiszczyk Jan 24, 2014
e8be6ef
Yet another typo.
mpmiszczyk Jan 24, 2014
06e66e7
REFACTORING introduce variable
mpmiszczyk Jan 24, 2014
efc7794
REFACTORING use backend module to write to database.
mpmiszczyk Jan 24, 2014
1e10dc8
BUG call with bad function arity.
mpmiszczyk Jan 24, 2014
cdf5ae5
REFACTORING use backend module to read from database; introduce new
mpmiszczyk Jan 24, 2014
e3368d6
REFACTORING use backend module.
mpmiszczyk Jan 24, 2014
547e8ca
REFACTORING use new module with new return types
mpmiszczyk Jan 24, 2014
0363654
Refactor to explicit recurency.
mpmiszczyk Jan 24, 2014
ab2e849
REFACTORING use backend module.
mpmiszczyk Jan 25, 2014
e462619
REFACTORING extract methid for better readability.
mpmiszczyk Jan 25, 2014
509124d
Introduce behaviour module.
mpmiszczyk Jan 25, 2014
e1e4c8f
INDENTATION
mpmiszczyk Jan 25, 2014
0bf9e1d
FIX missing type definitions.
mpmiszczyk Jan 25, 2014
e0ade59
Introduce new types definitions.
mpmiszczyk Jan 25, 2014
5a6b155
New spec and callback definition.
mpmiszczyk Jan 25, 2014
9e4602d
New spec and callback definition.
mpmiszczyk Jan 25, 2014
3d514ad
REFACTORING function rename
mpmiszczyk Jan 26, 2014
6197565
BUG FIX lost variable during refactoring.
mpmiszczyk Jan 26, 2014
f360197
Intorudce spec and callback.
mpmiszczyk Jan 26, 2014
c1b599f
REFACTORING function name change
mpmiszczyk Jan 26, 2014
bb234e3
Introduce spec and callback.
mpmiszczyk Jan 26, 2014
425d8d0
Intorudce spec and callback for all the rest of functions.
mpmiszczyk Jan 26, 2014
fe4796d
Added "type checking" for functions accepting specific tuples.
mpmiszczyk Jan 26, 2014
90d3703
REFACTORING function name change.
mpmiszczyk Jan 26, 2014
6698737
Plain introduce backed module for odbc.
mpmiszczyk Jan 26, 2014
5781de2
Inicialization of backend; which in oryginal module did nothing.
mpmiszczyk Jan 26, 2014
f6c56a2
Implement and use `roster_version`.
mpmiszczyk Jan 26, 2014
c7fbc30
Use backend module.
mpmiszczyk Jan 26, 2014
35c31b2
Implement and use `write_version`.
mpmiszczyk Jan 26, 2014
1d804ed
Implement and use `rosters_by_us`.
mpmiszczyk Jan 26, 2014
5ad7b5c
FAILING spliti function into two, to meke this module more similar to
mpmiszczyk Jan 27, 2014
677844e
Implmentation of get roster functionality.
mpmiszczyk Jan 27, 2014
0b9b3a1
Use backend module.
mpmiszczyk Jan 27, 2014
9bce311
Implementation of remove roster.
mpmiszczyk Jan 27, 2014
82fc9db
REFACTORING implementaion and use of `write_roster`
mpmiszczyk Jan 27, 2014
8c209b3
Use of backend module.
mpmiszczyk Jan 27, 2014
dd16133
Sudo implementation of transaction.
mpmiszczyk Jan 27, 2014
6440dde
Unification between two bakcend-handled modules, to make differences
mpmiszczyk Jan 27, 2014
30cc9d9
REFACTORING simplifiy funciton inicializaiton and structure.
mpmiszczyk Jan 27, 2014
f794e2b
User backend module.
mpmiszczyk Jan 27, 2014
7daf9e6
Use backend module.
mpmiszczyk Jan 27, 2014
24cab10
FIX include earlier omitted gropus.
mpmiszczyk Jan 27, 2014
5b870cc
Use of backend module.
mpmiszczyk Jan 27, 2014
8b1a351
Use of backend module.
mpmiszczyk Jan 27, 2014
2dcbcdd
Removed not longer neede variables.
mpmiszczyk Jan 27, 2014
65b1374
User backend module.
mpmiszczyk Jan 27, 2014
e4baf83
Notes; idea for introducing back odbc optimalization.
mpmiszczyk Jan 27, 2014
067ab7f
Use backend module.
mpmiszczyk Jan 27, 2014
2969c06
Change to gen_backend API.
mpmiszczyk Jan 27, 2014
a3ba006
Update and implement bahaviour; `remove_user` implementation.
mpmiszczyk Jan 27, 2014
b7b012b
Use backend module.
mpmiszczyk Jan 27, 2014
24ecd2a
Use backend module; and possible bug fix.
mpmiszczyk Jan 27, 2014
aeb179d
Use backend module.
mpmiszczyk Jan 27, 2014
87b52cc
INDENTATION
mpmiszczyk Jan 27, 2014
3ea05c1
Use backend module.
mpmiszczyk Jan 27, 2014
c4c0d60
FIX possible infinite loop.
mpmiszczyk Jan 27, 2014
8612530
REFACTORING extracted function.
mpmiszczyk Jan 27, 2014
f41f842
Introduce recursion, and point out exit points.
mpmiszczyk Jan 27, 2014
b8d2686
Remove usused functions.
mpmiszczyk Jan 27, 2014
4cd7b21
Unify and update `transaction` in backend module.
mpmiszczyk Jan 27, 2014
30db84f
Removed hooks and logic related to web-administration.
mpmiszczyk Jan 27, 2014
7b45d68
Introduce-back original odbc optymalization.
mpmiszczyk Jan 27, 2014
a460403
Reintroduce odbc optymalization.
mpmiszczyk Jan 27, 2014
cdfb752
Use optimized backend function.
mpmiszczyk Jan 27, 2014
4249eab
FIX reimplement lost functionality of filtering rosters based on subs…
mpmiszczyk Jan 27, 2014
60208da
Removing differances inbetween modules with roster logic.
mpmiszczyk Jan 28, 2014
c86452d
REFACTORING usemore verbose version of what-s going on.
mpmiszczyk Jan 28, 2014
49d8c34
REAFACTORING more readable function body.
mpmiszczyk Jan 28, 2014
62b19fb
Make `process_item_attrs` look the same while keeping logic intact.
mpmiszczyk Jan 29, 2014
2b74345
IMPORTANT Merge branch 'master' into feature/mod_roster_backend_rewrite
mpmiszczyk Jan 29, 2014
f84a4a7
Whitespace cleanup.
mpmiszczyk Jan 31, 2014
049219d
Typos.
mpmiszczyk Jan 31, 2014
482b6dd
Change guard into pattern matching.
mpmiszczyk Jan 31, 2014
f24b7fc
Unify `remove_user`
mpmiszczyk Jan 31, 2014
6644e28
Remove unused hook.
mpmiszczyk Jan 31, 2014
d341e14
Simplifie call logic.
mpmiszczyk Jan 31, 2014
38e82dc
Simplify variables scope.
mpmiszczyk Jan 31, 2014
d77b85e
Bug Fix: changed to dirty read, since function is called outside of t…
mpmiszczyk Feb 17, 2014
a4d0b01
Removed `optional` attribute from roster versioning.
mpmiszczyk Feb 17, 2014
2ecf9d2
Change JID to LJID.
mpmiszczyk Feb 17, 2014
de0821f
Change JID to LJID when creatign roster not found in backend.
mpmiszczyk Feb 17, 2014
9d18b0a
Use version which allows to count database reads
mpmiszczyk Feb 17, 2014
213ec6f
List to binaries, and removed whitespaces.
mpmiszczyk Feb 17, 2014
645bc2c
Cleaner version, and explicite handling of possible `not_found` roste…
mpmiszczyk Feb 17, 2014
71c7421
Change comment to possible future improvement.
mpmiszczyk Feb 17, 2014
967b514
Log if we fail to convert database entry to roster record
mpmiszczyk Feb 17, 2014
fb5c185
Dynamic selecting of backend module.
mpmiszczyk Feb 18, 2014
18811a7
Removed unneded file with roster logic.
mpmiszczyk Feb 18, 2014
378b223
Renamed backend file to fit naming and dymanic loading convention.
mpmiszczyk Feb 18, 2014
a01657b
Moved backend behaviour definition to `mod_roster` module.
mpmiszczyk Feb 18, 2014
17b5e1c
Use LJID where possible.
mpmiszczyk Feb 18, 2014
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 24 additions & 22 deletions apps/ejabberd/include/jlib.hrl
Original file line number Diff line number Diff line change
Expand Up @@ -326,28 +326,31 @@
% ?STREAM_ERRORT(<<"">>, Lang, Text)).


-record(jid, {
user :: binary(),
server :: binary(),
resource :: binary(),
luser :: binary(),
lserver :: binary(),
lresource :: binary()
}).
-record(jid, { user :: binary(),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new variant is harder to read and edit because of not unified alignment.

server :: binary(),
resource :: binary(),
luser :: binary(),
lserver :: binary(),
lresource :: binary()
}).
-type jid() :: #jid{}.

-record(iq, {id = <<>>,
type,
xmlns = <<>>,
lang = <<>>,
sub_el}).
-type(ljid() :: {binary(), binary(), binary()}).

-record(rsm_in, {
max :: non_neg_integer() | undefined | error,
direction :: before | aft | undefined,
%% id is empty, if cdata does not exists.
id :: binary() | undefined,
index :: non_neg_integer() | undefined | error
}).
-record(iq, { id = <<>>,
type,
xmlns = <<>>,
lang = <<>>,
sub_el
}).
-type iq() :: #iq{}.

-record(rsm_in, { max :: non_neg_integer() | undefined | error,
direction :: before | aft | undefined,
%% id is empty, if cdata does not exists.
id :: binary() | undefined,
index :: non_neg_integer() | undefined | error
}).

-record(mam_borders, {
after_id :: non_neg_integer() | undefined,
Expand All @@ -358,6 +361,5 @@

-record(rsm_out, {count, index, first, last}).

-type jid() :: #jid{}.
-type iq() :: #iq{}.


36 changes: 25 additions & 11 deletions apps/ejabberd/include/mod_roster.hrl
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,29 @@
%%%
%%%----------------------------------------------------------------------

-record(roster, {usj,
us,
jid,
name = <<>>,
subscription = none,
ask = none,
groups = [],
askmessage = <<>>,
xs = []}).
-record(roster, { usj = {<<>>, <<>>, {<<>>, <<>>, <<>>}} :: usj() | '_',
us = {<<>>, <<>>} :: us() | '_',
jid = {<<>>, <<>>, <<>>} :: ljid(),
name = <<>> :: binary() | '_',
subscription = none :: subscription() | '_',
ask = none :: ask() | '_',
groups = [] :: [binary()] | '_',
askmessage = <<"">> :: binary() | '_',
xs = [] :: [term()] | '_'
}).
-type roster() :: #roster{}.

-record(roster_version, {us,
version}).
-record(roster_version, { us = {<<>>, <<>>} :: us(),
version = <<>> :: binary()
}).

-type usj() :: { user() , server(), ljid() }.

-type us() :: { user(), server() }.

-type ask() :: none | in | out | both | subscribe | unsubscribe.
-type subscription() :: none | both | from | to | remove.

-type user() :: binary().
-type server() :: binary().
-type version() :: binary().
Loading