[Server-devel] @a...@...?

2009-02-22 Thread Reuben K. Caron
Since @online@ is broken in 0.5.1. How should the directions be changed 
at http://wiki.laptop.org/go/XS_Installing_Software:

Type Online and click Add New.
Click on Online and enter Online for Name, @online@ for Members, 
and Online for Displayed Groups. Click Submit.

I'm just wondering how fussy ejabberd is here. Can we just replace the 
@online@ with @all@ or should we create an All Group, with All for 
Name and All for Displayed Groups?


___
Server-devel mailing list
Server-devel@lists.laptop.org
http://lists.laptop.org/listinfo/server-devel


Re: [Server-devel] @a...@...?

2009-02-22 Thread Martin Langhoff
On Mon, Feb 23, 2009 at 3:38 PM, Reuben K. Caron reu...@laptop.org wrote:
 Since @online@ is broken in 0.5.1. How should the directions be changed
 at http://wiki.laptop.org/go/XS_Installing_Software:

I've been mulling on this. Working on a updated @online@ patch that
applies on 2.0.3 . If it works, we stay the course.

[ I rather declare we have a bug and fix it than change the official
procedures all the time. A temporary note pointing to a bug would be
the right fix... so filed https://dev.laptop.org/ticket/9272 and put a
note in the install procedures. ]

 I'm just wondering how fussy ejabberd is here. Can we just replace the
 @online@ with @all@ or should we create an All Group, with All for
 Name and All for Displayed Groups?

The pretty names are just pretty names, as long as we put '@online@'
or '@all@' in the membership field, it'll work. So we should rename it
to Betty.

cheers,


m
-- 
 martin.langh...@gmail.com
 mar...@laptop.org -- School Server Architect
 - ask interesting questions
 - don't get distracted with shiny stuff  - working code first
 - http://wiki.laptop.org/go/User:Martinlanghoff
___
Server-devel mailing list
Server-devel@lists.laptop.org
http://lists.laptop.org/listinfo/server-devel


Re: [Server-devel] @a...@...?

2009-02-22 Thread Martin Langhoff
On Mon, Feb 23, 2009 at 4:31 PM, Martin Langhoff
martin.langh...@gmail.com wrote:
 I've been mulling on this. Working on a updated @online@ patch that
 applies on 2.0.3 . If it works, we stay the course.

Looks like I'm finding my way around this ejabberd thing, and now I
have an RPM that Does The Right Thing.

Now _we need testers for this_. It works very well on my tests here in
NZ, but it's well known that being close to the ozone layer hole ruins
testing sometimes.

How to install it?

   # install with yum - should grab ejabberd-xs-2.0.3-2.fc9.olpc.i386
   yum --enablerepo=olpcxs-testing install ejabberd-xs

   # now stop and start ejabberd
   /etc/init.d/ejabberd stop
   /etc/init.d/ejabberd start

How to test?

 - pay extra attention at the output of olpc-netstatus on the XOs -
we're looking for results that say 'gabble'

 - pay extra attention at the output of ejabberd connected-users -
should be in sync with what users see on their network view

 - tail the ejabberd logs, like this
tail -f /var/log/ejabberd/ejabberd.log | grep '\(unset_p\|user_av\)'

 - Remove all users from ejabberd's db, let them connect first time,
then stop/start server  XOs

How to review the code? Track the update-2.0.3 branch...
http://dev.laptop.org/git?p=users/martin/ejabberd-xs.git;a=commitdiff;h=a4afc81e992fd6716c5061a190f6a5b6064281f2

cheers,



m
-- 
 martin.langh...@gmail.com
 mar...@laptop.org -- School Server Architect
 - ask interesting questions
 - don't get distracted with shiny stuff  - working code first
 - http://wiki.laptop.org/go/User:Martinlanghoff
___
Server-devel mailing list
Server-devel@lists.laptop.org
http://lists.laptop.org/listinfo/server-devel


[Server-devel] [PATCH] mod_shared_roster: simplified @online@ patch

2009-02-22 Thread martin . langhoff
From: Martin Langhoff mar...@laptop.org

New version of the @online@ patch originally by Collabora.

With this patch, @online@ works 100% - @recent@ and @nearby@ are
_broken_ however. The author of this patch doubts they ever
worked reliably.

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 |  248 +---
 1 files changed, 231 insertions(+), 17 deletions(-)

diff --git a/src/mod_shared_roster.erl b/src/mod_shared_roster.erl
index af123c2..d1b169d 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,
@@ -131,7 +141,7 @@ get_user_roster(Items, US) -
   get_group_name(S, Group),
   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
@@ -267,7 +277,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)}.
@@ -286,7 +296,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} -
@@ -316,7 +326,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 -
@@ -414,21 +424,103 @@ get_group_opt(Host, Group, Opt, Default) -
false
 end.
 
-get_group_users(Host, Group) -
+-record(last_activity, {us, timestamp, status}).
+-record(session, {sid, usr, us, priority, info}).
+
+get_recent_users(Host, Days) -
+LServer = jlib:nameprep(Host),
+%% Convert older time
+SecOlder = Days*24*60*60,
+
+%% Get current time
+{MegaSecs, Secs, _MicroSecs} = now(),
+TimeStampOlder = MegaSecs * 100 + Secs - SecOlder,
+
+%% Get the list of recently connected users
+RecentUsers = mnesia:dirty_select(last_activity, 
+[{#last_activity{us={'$1',LServer},timestamp='$2',_='_'},
+  [{'','$2',TimeStampOlder}],
+  ['$1'] }]),
+%% 

Re: [Server-devel] @a...@...?

2009-02-22 Thread Martin Langhoff
On Mon, Feb 23, 2009 at 7:27 PM, Martin Langhoff
martin.langh...@gmail.com wrote:
 How to install it?

Or grab the 0.5.2-dev01 iso that should materialise at
http://xs-dev.laptop.org/xs/other/ soon.

It also includes Daniel's fixes to xs-activity-server.



m
-- 
 martin.langh...@gmail.com
 mar...@laptop.org -- School Server Architect
 - ask interesting questions
 - don't get distracted with shiny stuff  - working code first
 - http://wiki.laptop.org/go/User:Martinlanghoff
___
Server-devel mailing list
Server-devel@lists.laptop.org
http://lists.laptop.org/listinfo/server-devel