public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
From: Peter Lemenkov <lemenkov@gmail.com>
To: git-commits@fedoraproject.org
Subject: [rpms/ejabberd] f45: Updated @online@ patch
Date: Wed, 23 Sep 2026 19:07:03 GMT [thread overview]
Message-ID: <179019042372.1.6651657700972111430.rpms-ejabberd-d665892003eb@fedoraproject.org> (raw)
A new commit has been pushed.
Repo : rpms/ejabberd
Branch : f45
Commit : d665892003eb611b92e40d5700aece741279100c
Author : Peter Lemenkov <lemenkov@gmail.com>
Date : 2011-02-24T16:35:39+03:00
Stats : +289/-345 in 13 file(s)
URL : https://src.fedoraproject.org/rpms/ejabberd/c/d665892003eb611b92e40d5700aece741279100c?branch=f45
Log:
Updated @online@ patch
Signed-off-by: Peter Lemenkov <lemenkov@gmail.com>
---
diff --git a/ejabberd-0001-Fix-PAM-service-example-name-to-match-actual-one.patch b/ejabberd-0001-Fix-PAM-service-example-name-to-match-actual-one.patch
index 3b0dd34..5b91cf4 100644
--- a/ejabberd-0001-Fix-PAM-service-example-name-to-match-actual-one.patch
+++ b/ejabberd-0001-Fix-PAM-service-example-name-to-match-actual-one.patch
@@ -1,7 +1,7 @@
From 9087a0b27b3d56f8fdb28e5190012796f348d43a Mon Sep 17 00:00:00 2001
From: Peter Lemenkov <lemenkov@gmail.com>
Date: Tue, 16 Feb 2010 16:03:38 +0300
-Subject: [PATCH 01/10] Fix PAM service example name to match actual one
+Subject: [PATCH 01/11] Fix PAM service example name to match actual one
Signed-off-by: Peter Lemenkov <lemenkov@gmail.com>
---
@@ -22,5 +22,5 @@ index a95689b..005c73c 100644
%%
%% Authentication using LDAP
--
-1.7.3.3
+1.7.4.1
diff --git a/ejabberd-0002-Add-mod_ctlextra-as-an-ejabberd-module.patch b/ejabberd-0002-Add-mod_ctlextra-as-an-ejabberd-module.patch
index 1ebcd1f..841f503 100644
--- a/ejabberd-0002-Add-mod_ctlextra-as-an-ejabberd-module.patch
+++ b/ejabberd-0002-Add-mod_ctlextra-as-an-ejabberd-module.patch
@@ -1,7 +1,7 @@
From 85b432d0293d867dd5c11ae8e7b5c724b7fad056 Mon Sep 17 00:00:00 2001
From: Peter Lemenkov <lemenkov@gmail.com>
Date: Tue, 16 Feb 2010 16:05:53 +0300
-Subject: [PATCH 02/10] Add mod_ctlextra as an ejabberd module
+Subject: [PATCH 02/11] Add mod_ctlextra as an ejabberd module
See this link for the details:
http://www.ejabberd.im/mod_ctlextra
@@ -932,5 +932,5 @@ index 0000000..bc61024
+ Ps),
+ lists:reverse(Grouped_Ps).
--
-1.7.3.3
+1.7.4.1
diff --git a/ejabberd-0003-Fixed-delays-in-s2s-connections.patch b/ejabberd-0003-Fixed-delays-in-s2s-connections.patch
index 4c4fd48..fe644a7 100644
--- a/ejabberd-0003-Fixed-delays-in-s2s-connections.patch
+++ b/ejabberd-0003-Fixed-delays-in-s2s-connections.patch
@@ -1,7 +1,7 @@
From cf4847224a1180836d1caee3621ff0d562e4e8a7 Mon Sep 17 00:00:00 2001
From: Sergei Golovan <sgolovan@nes.ru>
Date: Tue, 16 Feb 2010 16:07:37 +0300
-Subject: [PATCH 03/10] Fixed delays in s2s connections.
+Subject: [PATCH 03/11] Fixed delays in s2s connections.
Patch by Sergei Golovan increases timeouts in S2S and removes horrible 5-minute
delay between remote server connection attempts after a falure (in case of
@@ -49,5 +49,5 @@ index f59e8ec..1422d3a 100644
end;
open_socket(stop, StateData) ->
--
-1.7.3.3
+1.7.4.1
diff --git a/ejabberd-0004-Introducing-mod_admin_extra.patch b/ejabberd-0004-Introducing-mod_admin_extra.patch
index 0e09141..32d000d 100644
--- a/ejabberd-0004-Introducing-mod_admin_extra.patch
+++ b/ejabberd-0004-Introducing-mod_admin_extra.patch
@@ -1,7 +1,7 @@
From 9c419c9531e16a1bafcecd3257bfc4646ebdc9d5 Mon Sep 17 00:00:00 2001
From: Badlop <badlop@process-one.net>
Date: Tue, 16 Feb 2010 16:12:17 +0300
-Subject: [PATCH 04/10] Introducing mod_admin_extra
+Subject: [PATCH 04/11] Introducing mod_admin_extra
Adds the mod_admin_extra module to ejabberd.
This module extends the functionality provided by ejabberdctl
@@ -1314,5 +1314,5 @@ index 0000000..9f3ca14
+is_glob_match(String, Glob) ->
+ is_regexp_match(String, regexp:sh_to_awk(Glob)).
--
-1.7.3.3
+1.7.4.1
diff --git a/ejabberd-0005-Fedora-specific-changes-to-ejabberdctl.patch b/ejabberd-0005-Fedora-specific-changes-to-ejabberdctl.patch
index c4c280c..a97d9fa 100644
--- a/ejabberd-0005-Fedora-specific-changes-to-ejabberdctl.patch
+++ b/ejabberd-0005-Fedora-specific-changes-to-ejabberdctl.patch
@@ -1,7 +1,7 @@
From e5f84e1f8e62e073be61843cc124f3150e4d2206 Mon Sep 17 00:00:00 2001
From: Peter Lemenkov <lemenkov@gmail.com>
Date: Tue, 16 Feb 2010 16:30:05 +0300
-Subject: [PATCH 05/10] Fedora-specific changes to ejabberdctl
+Subject: [PATCH 05/11] Fedora-specific changes to ejabberdctl
Signed-off-by: Peter Lemenkov <lemenkov@gmail.com>
---
@@ -44,5 +44,5 @@ index 67eafbf..1665a02 100644
done
if [ "$ID" -eq "$EJID" ] ; then
--
-1.7.3.3
+1.7.4.1
diff --git a/ejabberd-0006-Install-.so-objects-with-0755-permissions.patch b/ejabberd-0006-Install-.so-objects-with-0755-permissions.patch
index 4366d9b..f4a80fc 100644
--- a/ejabberd-0006-Install-.so-objects-with-0755-permissions.patch
+++ b/ejabberd-0006-Install-.so-objects-with-0755-permissions.patch
@@ -1,7 +1,7 @@
From de49bf5543375fbccaf112bdd189a71d43acbbf0 Mon Sep 17 00:00:00 2001
From: Peter Lemenkov <lemenkov@gmail.com>
Date: Sat, 12 Jun 2010 14:14:52 +0400
-Subject: [PATCH 06/10] Install *.so objects with 0755 permissions
+Subject: [PATCH 06/11] Install *.so objects with 0755 permissions
Signed-off-by: Peter Lemenkov <lemenkov@gmail.com>
---
@@ -22,5 +22,5 @@ index 4e56181..ef8a55e 100644
# Translated strings
install -d $(MSGSDIR)
--
-1.7.3.3
+1.7.4.1
diff --git a/ejabberd-0007-Use-versioned-directory-for-storing-docs.patch b/ejabberd-0007-Use-versioned-directory-for-storing-docs.patch
index ffb2ec1..07ad3a9 100644
--- a/ejabberd-0007-Use-versioned-directory-for-storing-docs.patch
+++ b/ejabberd-0007-Use-versioned-directory-for-storing-docs.patch
@@ -1,7 +1,7 @@
From 3e1eeccdfdd315c4e660e48098cb3a8c8802f75c Mon Sep 17 00:00:00 2001
From: Peter Lemenkov <lemenkov@gmail.com>
Date: Sat, 12 Jun 2010 16:12:11 +0400
-Subject: [PATCH 07/10] Use versioned directory for storing docs
+Subject: [PATCH 07/11] Use versioned directory for storing docs
It's also a good idea to store doc-files under the versioned directory.
This may greatly simplify parallel installation of different versions of
@@ -31,5 +31,5 @@ index ef8a55e..d15739c 100644
DOCDIR = $(DESTDIR)@docdir@
--
-1.7.3.3
+1.7.4.1
diff --git a/ejabberd-0008-Support-SASL-GSSAPI-authentication-thanks-to-Mikael-.patch b/ejabberd-0008-Support-SASL-GSSAPI-authentication-thanks-to-Mikael-.patch
index df9055f..4c37561 100644
--- a/ejabberd-0008-Support-SASL-GSSAPI-authentication-thanks-to-Mikael-.patch
+++ b/ejabberd-0008-Support-SASL-GSSAPI-authentication-thanks-to-Mikael-.patch
@@ -1,7 +1,7 @@
From 60b08ab02f17070d66558a37fae69a735bda696a Mon Sep 17 00:00:00 2001
From: Badlop <badlop@process-one.net>
Date: Thu, 15 Apr 2010 17:20:16 +0200
-Subject: [PATCH 08/10] Support SASL GSSAPI authentication (thanks to Mikael Magnusson)(EJAB-831)
+Subject: [PATCH 08/11] Support SASL GSSAPI authentication (thanks to Mikael Magnusson)(EJAB-831)
---
src/cyrsasl.erl | 76 +++++++++++++++++----
@@ -476,5 +476,5 @@ index 4d21e40..66b9c4c 100644
%% Internal functions
%%====================================================================
--
-1.7.3.3
+1.7.4.1
diff --git a/ejabberd-0009-Added-old-modules-for-Active-Directory.patch b/ejabberd-0009-Added-old-modules-for-Active-Directory.patch
index 1261b98..0642cf8 100644
--- a/ejabberd-0009-Added-old-modules-for-Active-Directory.patch
+++ b/ejabberd-0009-Added-old-modules-for-Active-Directory.patch
@@ -1,7 +1,7 @@
From c28b04f3abf3a4e233115c3d783db356c9567d9b Mon Sep 17 00:00:00 2001
From: Peter Lemenkov <lemenkov@gmail.com>
Date: Tue, 14 Dec 2010 18:28:44 +0300
-Subject: [PATCH 09/10] Added old modules for Active Directory
+Subject: [PATCH 09/11] Added old modules for Active Directory
These modules were extracted from a patch found on
http://realloc.spb.ru/share/ejabberdad.html
@@ -1262,5 +1262,5 @@ index 0000000..52ddbec
+ true.
+
--
-1.7.3.3
+1.7.4.1
diff --git a/ejabberd-0010-last-minute-fix-correct-version-in-configure.patch b/ejabberd-0010-last-minute-fix-correct-version-in-configure.patch
index 31a9d2b..1bad3d6 100644
--- a/ejabberd-0010-last-minute-fix-correct-version-in-configure.patch
+++ b/ejabberd-0010-last-minute-fix-correct-version-in-configure.patch
@@ -1,7 +1,7 @@
From 244c5ae4bfab64220a1d7ff492bdb67dc6612f51 Mon Sep 17 00:00:00 2001
From: Peter Lemenkov <lemenkov@gmail.com>
Date: Tue, 14 Dec 2010 18:52:04 +0300
-Subject: [PATCH 10/10] last minute fix - correct version in configure
+Subject: [PATCH 10/11] last minute fix - correct version in configure
Signed-off-by: Peter Lemenkov <lemenkov@gmail.com>
---
@@ -24,5 +24,5 @@ index d515abc..ab0beca 100755
PACKAGE_URL=''
--
-1.7.3.3
+1.7.4.1
diff --git a/ejabberd-0011-Add-support-for-online-Shared-Roster-Group-thanks-to.patch b/ejabberd-0011-Add-support-for-online-Shared-Roster-Group-thanks-to.patch
new file mode 100644
index 0000000..b54782b
--- /dev/null
+++ b/ejabberd-0011-Add-support-for-online-Shared-Roster-Group-thanks-to.patch
@@ -0,0 +1,263 @@
+From 7be587955e435f9ceff4fa63f7a2f25838f1a858 Mon Sep 17 00:00:00 2001
+From: Badlop <badlop@process-one.net>
+Date: Mon, 21 Feb 2011 22:33:23 +0100
+Subject: [PATCH 11/11] Add support for '@online@' Shared Roster Group (thanks to Martin Langhoff)(EJAB-1391)
+
+New version of the @online@ patch originally by Collabora.
+Notes:
+- the presence push is mediated via the group rather than
+ per user - this may reduce memory footprint... _if_ ejabberd
+ has some smart optimisation in that codepath
+- it assumes that any group with membership @online@ _displays_
+ online as well -- this is a simplification and breaks the
+ decoupling that ejabberd has in this regard.
+---
+ doc/guide.tex | 10 ++--
+ src/mod_shared_roster.erl | 113 +++++++++++++++++++++++++++++++++++++++++---
+ 2 files changed, 111 insertions(+), 12 deletions(-)
+
+diff --git a/doc/guide.tex b/doc/guide.tex
+index 0ae3053..8fda148 100644
+--- a/doc/guide.tex
++++ b/doc/guide.tex
+@@ -4020,11 +4020,13 @@ has a unique identification and the following parameters:
+ \item[Name] The name of the group, which will be displayed in the roster.
+ \item[Description] The description of the group. This parameter does not affect
+ anything.
+-\item[Members] A list of full JIDs of group members, entered one per line in
++\item[Members] A list of JIDs of group members, entered one per line in
+ the Web Admin.
+- To put as members all the registered users in the virtual hosts,
+- you can use the special directive: @all@.
+- Note that this directive is designed for a small server with just a few hundred users.
++ The special member directive \term{@all@}
++ represents all the registered users in the virtual host;
++ which is only recommended for a small server with just a few hundred users.
++ The special member directive \term{@online@}
++ represents the online users in the virtual host.
+ \item[Displayed groups] A list of groups that will be in the rosters of this
+ group's members.
+ \end{description}
+diff --git a/src/mod_shared_roster.erl b/src/mod_shared_roster.erl
+index 64a8291..6f58b0e 100644
+--- a/src/mod_shared_roster.erl
++++ b/src/mod_shared_roster.erl
+@@ -37,6 +37,8 @@
+ process_item/2,
+ in_subscription/6,
+ out_subscription/4,
++ user_available/1,
++ unset_presence/4,
+ register_user/2,
+ remove_user/2,
+ list_groups/1,
+@@ -85,6 +87,10 @@ start(Host, _Opts) ->
+ ?MODULE, get_jid_info, 70),
+ ejabberd_hooks:add(roster_process_item, Host,
+ ?MODULE, process_item, 50),
++ ejabberd_hooks:add(user_available_hook, Host,
++ ?MODULE, user_available, 50),
++ ejabberd_hooks:add(unset_presence_hook, Host,
++ ?MODULE, unset_presence, 50),
+ ejabberd_hooks:add(register_user, Host,
+ ?MODULE, register_user, 50),
+ ejabberd_hooks:add(remove_user, Host,
+@@ -109,6 +115,10 @@ stop(Host) ->
+ ?MODULE, get_jid_info, 70),
+ ejabberd_hooks:delete(roster_process_item, Host,
+ ?MODULE, process_item, 50),
++ ejabberd_hooks:delete(user_available_hook, Host,
++ ?MODULE, user_available, 50),
++ ejabberd_hooks:delete(unset_presence_hook, Host,
++ ?MODULE, unset_presence, 50),
+ ejabberd_hooks:delete(register_user, Host,
+ ?MODULE, register_user, 50),
+ ejabberd_hooks:delete(remove_user, Host,
+@@ -470,21 +480,38 @@ get_group_opt(Host, Group, Opt, Default) ->
+ Default
+ end.
+
++get_online_users(Host) ->
++ lists:usort([{U, S} || {U, S, _} <- ejabberd_sm:get_vh_session_list(Host)]).
++
+ get_group_users(Host, Group) ->
+ case get_group_opt(Host, Group, all_users, false) of
+ true ->
+ ejabberd_auth:get_vh_registered_users(Host);
+ false ->
+ []
+- end ++ get_group_explicit_users(Host, Group).
++ end ++
++ case get_group_opt(Host, Group, online_users, false) of
++ true ->
++ get_online_users(Host);
++ false ->
++ []
++ end ++
++ get_group_explicit_users(Host, Group).
+
+-get_group_users(_User, Host, Group, GroupOpts) ->
++get_group_users(Host, Group, GroupOpts) ->
+ case proplists:get_value(all_users, GroupOpts, false) of
+ true ->
+ ejabberd_auth:get_vh_registered_users(Host);
+ false ->
+ []
+- end ++ get_group_explicit_users(Host, Group).
++ end ++
++ case proplists:get_value(online_users, GroupOpts, false) of
++ true ->
++ get_online_users(Host);
++ false ->
++ []
++ end ++
++ get_group_explicit_users(Host, Group).
+
+ %% @spec (Host::string(), Group::string()) -> [{User::string(), Server::string()}]
+ get_group_explicit_users(Host, Group) ->
+@@ -502,11 +529,20 @@ get_group_explicit_users(Host, Group) ->
+ get_group_name(Host, Group) ->
+ get_group_opt(Host, Group, name, Group).
+
+-%% Get list of names of groups that have @all@ in the memberlist
++%% Get list of names of groups that have @all@/@online@/etc in the memberlist
+ get_special_users_groups(Host) ->
+ lists:filter(
+ fun(Group) ->
+ get_group_opt(Host, Group, all_users, false)
++ orelse get_group_opt(Host, Group, online_users, false)
++ end,
++ list_groups(Host)).
++
++%% Get list of names of groups that have @online@ in the memberlist
++get_special_users_groups_online(Host) ->
++ lists:filter(
++ fun(Group) ->
++ get_group_opt(Host, Group, online_users, false)
+ end,
+ list_groups(Host)).
+
+@@ -661,7 +697,7 @@ push_user_to_members(User, Server, Subscription) ->
+ lists:foreach(
+ fun({U, S}) ->
+ push_roster_item(U, S, LUser, LServer, GroupName, Subscription)
+- end, get_group_users(LUser, LServer, Group, GroupOpts))
++ end, get_group_users(LServer, Group, GroupOpts))
+ end, lists:usort(SpecialGroups++UserGroups)).
+
+ push_user_to_displayed(LUser, LServer, Group, Subscription) ->
+@@ -673,7 +709,8 @@ push_user_to_displayed(LUser, LServer, Group, Subscription) ->
+
+ push_user_to_group(LUser, LServer, Group, GroupName, Subscription) ->
+ lists:foreach(
+- fun({U, S}) ->
++ fun({U, S}) when (U == LUser) and (S == LServer) -> ok;
++ ({U, S}) ->
+ push_roster_item(U, S, LUser, LServer, GroupName, Subscription)
+ end, get_group_users(LServer, Group)).
+
+@@ -757,6 +794,51 @@ ask_to_pending(subscribe) -> out;
+ ask_to_pending(unsubscribe) -> none;
+ ask_to_pending(Ask) -> Ask.
+
++user_available(New) ->
++ LUser = New#jid.luser,
++ LServer = New#jid.lserver,
++ Resources = ejabberd_sm:get_user_resources(LUser, LServer),
++ ?DEBUG("user_available for ~p @ ~p (~p resources)",
++ [LUser, LServer, length(Resources)]),
++ case length(Resources) of
++ %% first session for this user
++ 1 ->
++ %% This is a simplification - we ignore he 'display'
++ %% property - @online@ is always reflective.
++ OnlineGroups = get_special_users_groups_online(LServer),
++ lists:foreach(
++ fun(OG) ->
++ ?DEBUG("user_available: pushing ~p @ ~p grp ~p",
++ [LUser, LServer, OG ]),
++ push_user_to_displayed(LUser, LServer, OG, both)
++ end, OnlineGroups);
++ _ ->
++ ok
++ end.
++
++unset_presence(LUser, LServer, Resource, Status) ->
++ Resources = ejabberd_sm:get_user_resources(LUser, LServer),
++ ?DEBUG("unset_presence for ~p @ ~p / ~p -> ~p (~p resources)",
++ [LUser, LServer, Resource, Status, length(Resources)]),
++ %% if user has no resources left...
++ case length(Resources) of
++ 0 ->
++ %% This is a simplification - we ignore he 'display'
++ %% property - @online@ is always reflective.
++ OnlineGroups = get_special_users_groups_online(LServer),
++ %% for each of these groups...
++ lists:foreach(
++ fun(OG) ->
++ %% Push removal of the old user to members of groups
++ %% where the group that this uwas members was displayed
++ push_user_to_displayed(LUser, LServer, OG, remove),
++ %% Push removal of members of groups that where
++ %% displayed to the group which thiuser has left
++ push_displayed_to_user(LUser, LServer, OG, LServer,remove)
++ end, OnlineGroups);
++ _ ->
++ ok
++ end.
+
+ %%---------------------
+ %% Web Admin
+@@ -860,6 +942,7 @@ shared_roster_group(Host, Group, Query, Lang) ->
+ Name = get_opt(GroupOpts, name, ""),
+ Description = get_opt(GroupOpts, description, ""),
+ AllUsers = get_opt(GroupOpts, all_users, false),
++ OnlineUsers = get_opt(GroupOpts, online_users, false),
+ %%Disabled = false,
+ DisplayedGroups = get_opt(GroupOpts, displayed_groups, []),
+ Members = mod_shared_roster:get_group_explicit_users(Host, Group),
+@@ -869,7 +952,14 @@ shared_roster_group(Host, Group, Query, Lang) ->
+ "@all@\n";
+ true ->
+ []
+- end ++ [[us_to_list(Member), $\n] || Member <- Members],
++ end ++
++ if
++ OnlineUsers ->
++ "@online@\n";
++ true ->
++ []
++ end ++
++ [[us_to_list(Member), $\n] || Member <- Members],
+ FDisplayedGroups = [[DG, $\n] || DG <- DisplayedGroups],
+ DescNL = length(element(2, regexp:split(Description, "\n"))),
+ FGroup =
+@@ -953,6 +1043,8 @@ shared_roster_group_parse_query(Host, Group, Query) ->
+ case SJID of
+ "@all@" ->
+ USs;
++ "@online@" ->
++ USs;
+ _ ->
+ case jlib:string_to_jid(SJID) of
+ JID when is_record(JID, jid) ->
+@@ -967,10 +1059,15 @@ shared_roster_group_parse_query(Host, Group, Query) ->
+ true -> [{all_users, true}];
+ false -> []
+ end,
++ OnlineUsersOpt =
++ case lists:member("@online@", SJIDs) of
++ true -> [{online_users, true}];
++ false -> []
++ end,
+
+ mod_shared_roster:set_group_opts(
+ Host, Group,
+- NameOpt ++ DispGroupsOpt ++ DescriptionOpt ++ AllUsersOpt),
++ NameOpt ++ DispGroupsOpt ++ DescriptionOpt ++ AllUsersOpt ++ OnlineUsersOpt),
+
+ if
+ NewMembers == error -> error;
+--
+1.7.4.1
+
diff --git a/ejabberd-0011-online-shared-roster-grp.patch b/ejabberd-0011-online-shared-roster-grp.patch
deleted file mode 100644
index 5084f60..0000000
--- a/ejabberd-0011-online-shared-roster-grp.patch
+++ /dev/null
@@ -1,322 +0,0 @@
-From f98185d4da9ed34df7e5e3bf7f0b8e4b1b169e6c Mon Sep 17 00:00:00 2001
-From: Martin Langhoff <martin@laptop.org>
-Date: Mon, 24 Jan 2011 17:55:22 -0500
-Subject: [PATCH] New version of the @online@ patch originally by Collabora.
-
-Notes:
-
- - fixed a typo in is_user_in_group
- - simplified user_available and unset_presence hook handlers
- - the presence push is mediated via the group rather than
- per user - this may reduce memory footprint... _if_ ejabberd
- has some smart optimisation in that codepath
- - it assumes that any group with membership @online@ _displays_
- online as well -- this is a simplification and breaks the
- decoupling that ejabberd has in this regard.
----
- src/mod_shared_roster.erl | 154 ++++++++++++++++++++++++++++++++++++++++-----
- 1 files changed, 137 insertions(+), 17 deletions(-)
-
-diff --git a/src/mod_shared_roster.erl b/src/mod_shared_roster.erl
-index 64a8291..2f23201 100644
---- a/src/mod_shared_roster.erl
-+++ b/src/mod_shared_roster.erl
-@@ -37,6 +37,8 @@
- process_item/2,
- in_subscription/6,
- out_subscription/4,
-+ user_available/1,
-+ unset_presence/4,
- register_user/2,
- remove_user/2,
- list_groups/1,
-@@ -45,7 +47,7 @@
- delete_group/2,
- get_group_opts/2,
- set_group_opts/3,
-- get_group_users/2,
-+ get_group_users/3,
- get_group_explicit_users/2,
- is_user_in_group/3,
- add_user_to_group/3,
-@@ -85,6 +87,10 @@ start(Host, _Opts) ->
- ?MODULE, get_jid_info, 70),
- ejabberd_hooks:add(roster_process_item, Host,
- ?MODULE, process_item, 50),
-+ ejabberd_hooks:add(user_available_hook, Host,
-+ ?MODULE, user_available, 50),
-+ ejabberd_hooks:add(unset_presence_hook, Host,
-+ ?MODULE, unset_presence, 50),
- ejabberd_hooks:add(register_user, Host,
- ?MODULE, register_user, 50),
- ejabberd_hooks:add(remove_user, Host,
-@@ -109,6 +115,10 @@ stop(Host) ->
- ?MODULE, get_jid_info, 70),
- ejabberd_hooks:delete(roster_process_item, Host,
- ?MODULE, process_item, 50),
-+ ejabberd_hooks:delete(user_available_hook, Host,
-+ ?MODULE, user_available, 50),
-+ ejabberd_hooks:delete(unset_presence_hook, Host,
-+ ?MODULE, unset_presence, 50),
- ejabberd_hooks:delete(register_user, Host,
- ?MODULE, register_user, 50),
- ejabberd_hooks:delete(remove_user, Host,
-@@ -132,7 +142,7 @@ get_user_roster(Items, US) ->
- GroupName,
- Acc2)
- end
-- end, Acc1, get_group_users(S, Group))
-+ end, Acc1, get_group_users(U, S, Group))
- end, dict:new(), DisplayedGroups),
-
- %% If partially subscribed users are also in shared roster, show them as
-@@ -310,7 +320,7 @@ get_subscription_lists({F, T}, User, Server) ->
- lists:usort(
- lists:flatmap(
- fun(Group) ->
-- get_group_users(LServer, Group)
-+ get_group_users(LUser, LServer, Group)
- end, DisplayedGroups)),
- SRJIDs = [{U1, S1, ""} || {U1, S1} <- SRUsers],
- {lists:usort(SRJIDs ++ F), lists:usort(SRJIDs ++ T)}.
-@@ -329,7 +339,7 @@ get_jid_info({Subscription, Groups}, User, Server, JID) ->
- fun(User1, Acc2) ->
- dict:append(
- User1, get_group_name(LServer, Group), Acc2)
-- end, Acc1, get_group_users(LServer, Group))
-+ end, Acc1, get_group_users(LUser, LServer, Group))
- end, dict:new(), DisplayedGroups),
- case dict:find(US1, SRUsers) of
- {ok, GroupNames} ->
-@@ -371,7 +381,7 @@ process_subscription(Direction, User, Server, JID, _Type, Acc) ->
- lists:usort(
- lists:flatmap(
- fun(Group) ->
-- get_group_users(LServer, Group)
-+ get_group_users(LUser, LServer, Group)
- end, DisplayedGroups)),
- case lists:member(US1, SRUsers) of
- true ->
-@@ -470,21 +480,41 @@ get_group_opt(Host, Group, Opt, Default) ->
- Default
- end.
-
--get_group_users(Host, Group) ->
-+-record(last_activity, {us, timestamp, status}).
-+-record(session, {sid, usr, us, priority, info}).
-+
-+get_online_users(Host) ->
-+ lists:usort([{U, S} || {U, S, _} <- ejabberd_sm:get_vh_session_list(Host)]).
-+
-+get_group_users(User, Host, Group) ->
- case get_group_opt(Host, Group, all_users, false) of
- true ->
- ejabberd_auth:get_vh_registered_users(Host);
- false ->
- []
-- end ++ get_group_explicit_users(Host, Group).
--
--get_group_users(_User, Host, Group, GroupOpts) ->
-+ end ++
-+ case get_group_opt(Host, Group, online_users, false) of
-+ true ->
-+ get_online_users(Host);
-+ false ->
-+ []
-+ end ++
-+ get_group_explicit_users(Host, Group).
-+
-+get_group_users(User, Host, Group, GroupOpts) ->
- case proplists:get_value(all_users, GroupOpts, false) of
- true ->
- ejabberd_auth:get_vh_registered_users(Host);
- false ->
- []
-- end ++ get_group_explicit_users(Host, Group).
-+ end ++
-+ case proplists:get_value(online_users, GroupOpts, false) of
-+ true ->
-+ get_online_users(Host);
-+ false ->
-+ []
-+ end ++
-+ get_group_explicit_users(Host, Group).
-
- %% @spec (Host::string(), Group::string()) -> [{User::string(), Server::string()}]
- get_group_explicit_users(Host, Group) ->
-@@ -502,11 +532,20 @@ get_group_explicit_users(Host, Group) ->
- get_group_name(Host, Group) ->
- get_group_opt(Host, Group, name, Group).
-
--%% Get list of names of groups that have @all@ in the memberlist
-+%% Get list of names of groups that have @all@/@online@/etc in the memberlist
- get_special_users_groups(Host) ->
- lists:filter(
- fun(Group) ->
-- get_group_opt(Host, Group, all_users, false)
-+ get_group_opt(Host, Group, all_users, false) orelse
-+ get_group_opt(Host, Group, online_users, false)
-+ end,
-+ list_groups(Host)).
-+
-+%% Get list of names of groups that have @online@ in the memberlist
-+get_special_users_groups_online(Host) ->
-+ lists:filter(
-+ fun(Group) ->
-+ get_group_opt(Host, Group, online_users, false)
- end,
- list_groups(Host)).
-
-@@ -565,7 +604,7 @@ get_user_displayed_groups(US) ->
- is_user_in_group({_U, S} = US, Group, Host) ->
- case catch mnesia:dirty_match_object(
- #sr_user{us=US, group_host={Group, Host}}) of
-- [] -> lists:member(US, get_group_users(S, Group));
-+ [] -> lists:member(US, get_group_users(_U, S, Group));
- _ -> true
- end.
-
-@@ -632,7 +671,7 @@ push_members_to_user(LUser, LServer, Group, Host, Subscription) ->
- GroupsOpts = groups_with_opts(LServer),
- GroupOpts = proplists:get_value(Group, GroupsOpts, []),
- GroupName = proplists:get_value(name, GroupOpts, Group),
-- Members = get_group_users(Host, Group),
-+ Members = get_group_users(LUser, Host, Group),
- lists:foreach(
- fun({U, S}) ->
- push_roster_item(LUser, LServer, U, S, GroupName, Subscription)
-@@ -675,7 +714,7 @@ push_user_to_group(LUser, LServer, Group, GroupName, Subscription) ->
- lists:foreach(
- fun({U, S}) ->
- push_roster_item(U, S, LUser, LServer, GroupName, Subscription)
-- end, get_group_users(LServer, Group)).
-+ end, get_group_users(LUser, LServer, Group)).
-
- %% Get list of groups to which this group is displayed
- displayed_to_groups(GroupName, LServer) ->
-@@ -757,6 +796,72 @@ ask_to_pending(subscribe) -> out;
- ask_to_pending(unsubscribe) -> none;
- ask_to_pending(Ask) -> Ask.
-
-+%% get a roster item for a contact from a particular user's
-+%% perspective, considering both normal and shared roster items
-+%% FIXME: is there a more efficient way to do this?
-+get_user_roster_item(FromUS, ToUS) ->
-+ {FUser, FServer} = FromUS,
-+ case catch ejabberd_hooks:run_fold(roster_get, FServer, [], [ToUS]) of
-+ Items when is_list(Items) ->
-+ case [I || I <- Items, I#roster.jid == {FUser, FServer, []}] of
-+ [Item | _ ] ->
-+ Item;
-+ [] ->
-+ false
-+ end;
-+ _ ->
-+ error
-+ end.
-+
-+user_available(New) ->
-+ LUser = New#jid.luser,
-+ LServer = New#jid.lserver,
-+ Resources = ejabberd_sm:get_user_resources(LUser, LServer),
-+ ?INFO_MSG("user_available for ~p @ ~p (~p resources)",
-+ [LUser, LServer, length(Resources)]),
-+
-+ case length(Resources) of
-+ %% first session for this user
-+ 1 ->
-+
-+ %% This is a simplification - we ignore he 'display'
-+ %% property - @online@ is always reflective.
-+ OnlineGroups = get_special_users_groups_online(LServer),
-+
-+ lists:foreach(
-+ fun(OG) ->
-+ ?INFO_MSG("user_available: pushing ~p @ ~p grp ~p",
-+ [LUser, LServer, OG ]),
-+ push_user_to_displayed(LUser, LServer, OG, both)
-+ end, OnlineGroups);
-+
-+ _ ->
-+ ok
-+ end.
-+
-+unset_presence(LUser, LServer, Resource, Status) ->
-+ Resources = ejabberd_sm:get_user_resources(LUser, LServer),
-+ ?INFO_MSG("unset_presence for ~p @ ~p / ~p -> ~p (~p resources)",
-+ [LUser, LServer, Resource, Status, length(Resources)]),
-+
-+ %% if user has no resources left...
-+ case length(Resources) of
-+ 0 ->
-+ %% This is a simplification - we ignore he 'display'
-+ %% property - @online@ is always reflective.
-+ OnlineGroups = get_special_users_groups_online(LServer),
-+
-+ %% for each of these groups...
-+ lists:foreach(
-+ fun(OG) ->
-+ %% Push removal of the old user to members of groups where the group that this user was members was displayed
-+ push_user_to_displayed(LUser, LServer, OG, remove),
-+ %% Push removal of members of groups that where displayed to the group which this user has left
-+ push_displayed_to_user(LUser, LServer, OG, LServer, remove)
-+ end, OnlineGroups);
-+ _ ->
-+ ok
-+ end.
-
- %%---------------------
- %% Web Admin
-@@ -860,6 +965,7 @@ shared_roster_group(Host, Group, Query, Lang) ->
- Name = get_opt(GroupOpts, name, ""),
- Description = get_opt(GroupOpts, description, ""),
- AllUsers = get_opt(GroupOpts, all_users, false),
-+ OnlineUsers = get_opt(GroupOpts, online_users, false),
- %%Disabled = false,
- DisplayedGroups = get_opt(GroupOpts, displayed_groups, []),
- Members = mod_shared_roster:get_group_explicit_users(Host, Group),
-@@ -869,7 +975,14 @@ shared_roster_group(Host, Group, Query, Lang) ->
- "@all@\n";
- true ->
- []
-- end ++ [[us_to_list(Member), $\n] || Member <- Members],
-+ end ++
-+ if
-+ OnlineUsers ->
-+ "@online@\n";
-+ true ->
-+ []
-+ end ++
-+ [[us_to_list(Member), $\n] || Member <- Members],
- FDisplayedGroups = [[DG, $\n] || DG <- DisplayedGroups],
- DescNL = length(element(2, regexp:split(Description, "\n"))),
- FGroup =
-@@ -953,6 +1066,8 @@ shared_roster_group_parse_query(Host, Group, Query) ->
- case SJID of
- "@all@" ->
- USs;
-+ "@online@" ->
-+ USs;
- _ ->
- case jlib:string_to_jid(SJID) of
- JID when is_record(JID, jid) ->
-@@ -967,10 +1082,15 @@ shared_roster_group_parse_query(Host, Group, Query) ->
- true -> [{all_users, true}];
- false -> []
- end,
-+ OnlineUsersOpt =
-+ case lists:member("@online@", SJIDs) of
-+ true -> [{online_users, true}];
-+ false -> []
-+ end,
-
- mod_shared_roster:set_group_opts(
- Host, Group,
-- NameOpt ++ DispGroupsOpt ++ DescriptionOpt ++ AllUsersOpt),
-+ NameOpt ++ DispGroupsOpt ++ DescriptionOpt ++ AllUsersOpt ++ OnlineUsersOpt),
-
- if
- NewMembers == error -> error;
---
-1.7.3.4
-
diff --git a/ejabberd.spec b/ejabberd.spec
index 992d0ea..b43cbd6 100644
--- a/ejabberd.spec
+++ b/ejabberd.spec
@@ -11,7 +11,7 @@
Name: ejabberd
Version: 2.1.6
-Release: 3%{?dist}
+Release: 4%{?dist}
Summary: A distributed, fault-tolerant Jabber/XMPP server
Group: Applications/Internet
@@ -47,8 +47,8 @@ Patch8: ejabberd-0008-Support-SASL-GSSAPI-authentication-thanks-to-Mikael-.patch
Patch9: ejabberd-0009-Added-old-modules-for-Active-Directory.patch
# Correct version in configure (DON'T FORGET TO REMOVE IN THE NEXT VERSION)
Patch10: ejabberd-0010-last-minute-fix-correct-version-in-configure.patch
-# OLPC's @online@ shared roster group patch - EJAB-1391
-Patch11: ejabberd-0011-online-shared-roster-grp.patch
+# OLPC's @online@ shared roster group patch - EJAB-1391 (backported from upstream)
+Patch11: ejabberd-0011-Add-support-for-online-Shared-Roster-Group-thanks-to.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
@@ -341,6 +341,9 @@ rm -rf %{buildroot}
%doc %{_docdir}/%{name}-%{version}/*.txt
%changelog
+* Thu Feb 24 2011 Peter Lemenkov <lemenkov@gmail.com> - 2.1.6-4
+- Updated @online@ patch
+
* Tue Feb 08 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.1.6-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild
reply other threads:[~2026-09-23 19:07 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=179019042372.1.6651657700972111430.rpms-ejabberd-d665892003eb@fedoraproject.org \
--to=lemenkov@gmail.com \
--cc=git-commits@fedoraproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox