~ubuntu-branches/ubuntu/utopic/ejabberd/utopic

« back to all changes in this revision

Viewing changes to src/mod_roster.erl

  • Committer: Package Import Robot
  • Author(s): Gerfried Fuchs, Konstantin Khomoutov, Gerfried Fuchs
  • Date: 2011-09-11 16:16:55 UTC
  • mfrom: (1.1.18 upstream)
  • Revision ID: package-import@ubuntu.com-20110911161655-rz3jall453jo3zek
Tags: 2.1.8-1
[ Konstantin Khomoutov ]
* New upstream release.
* Remove patch fixing DSA-2248-1 (CVE-2011-1753)
  as the fix is now integrated upstream.
* Drop patches from OLPC project implementing @recent@ and @online@
  shared roster groups; support for @online@ is now intergated upstream.
* Add patch fixing version string where applicable (EJAB-1484).
* Bump standards version to 3.9.2

[ Gerfried Fuchs ]
* Add recommended targets build-arch and build-indep to debian/rules.
* Fix spelling error in manpage noticed by lintian.

Show diffs side-by-side

added added

removed removed

Lines of Context:
5
5
%%% Created : 11 Dec 2002 by Alexey Shchepin <alexey@process-one.net>
6
6
%%%
7
7
%%%
8
 
%%% ejabberd, Copyright (C) 2002-2010   ProcessOne
 
8
%%% ejabberd, Copyright (C) 2002-2011   ProcessOne
9
9
%%%
10
10
%%% This program is free software; you can redistribute it and/or
11
11
%%% modify it under the terms of the GNU General Public License as
161
161
            Feature = {xmlelement,
162
162
                       "ver",
163
163
                       [{"xmlns", ?NS_ROSTER_VER}],
164
 
                       [{xmlelement, "optional", [], []}]},
 
164
                       []},
165
165
            [Feature | Acc];
166
166
        false -> []
167
167
    end.
411
411
 
412
412
% TODO: don't push to those who didn't load roster
413
413
push_item(User, Server, Resource, From, Item) ->
 
414
    push_item(User, Server, Resource, From, Item, not_found).
 
415
 
 
416
push_item(User, Server, Resource, From, Item, RosterVersion) ->
 
417
    ExtraAttrs = case RosterVersion of
 
418
        not_found -> [];
 
419
        _ -> [{"ver", RosterVersion}]
 
420
    end,
414
421
    ResIQ = #iq{type = set, xmlns = ?NS_ROSTER,
415
422
                id = "push" ++ randoms:get_string(),
416
423
                sub_el = [{xmlelement, "query",
417
 
                           [{"xmlns", ?NS_ROSTER}],
 
424
                           [{"xmlns", ?NS_ROSTER}|ExtraAttrs],
418
425
                           [item_to_xml(Item)]}]},
419
426
    ejabberd_router:route(
420
427
      From,
425
432
%% TODO: don't push to those who didn't load roster
426
433
push_item_version(Server, User, From, Item, RosterVersion)  ->
427
434
    lists:foreach(fun(Resource) ->
428
 
                          push_item_version(User, Server, Resource, From, Item, RosterVersion)
 
435
                          push_item(User, Server, Resource, From, Item, RosterVersion)
429
436
                end, ejabberd_sm:get_user_resources(User, Server)).
430
437
 
431
 
push_item_version(User, Server, Resource, From, Item, RosterVersion) ->
432
 
    IQPush = #iq{type = 'set', xmlns = ?NS_ROSTER,
433
 
                 id = "push" ++ randoms:get_string(),
434
 
                 sub_el = [{xmlelement, "query",
435
 
                            [{"xmlns", ?NS_ROSTER},
436
 
                             {"ver", RosterVersion}],
437
 
                            [item_to_xml(Item)]}]},
438
 
    ejabberd_router:route(
439
 
      From,
440
 
      jlib:make_jid(User, Server, Resource),
441
 
      jlib:iq_to_xml(IQPush)).
442
 
 
443
438
get_subscription_lists(_, User, Server) ->
444
439
    LUser = jlib:nodeprep(User),
445
440
    LServer = jlib:nameprep(Server),