Not logged in. · Lost password · Register
Forum: MatriX RSS
Avatar
Walance #1
Member since Jan 2013 · 12 posts
Group memberships: Members
Show profile · Link to this post
Subject: OnRosterItem does not get called for new users
This problem might also be caused by OpenFire or myself, but I'm not sure. When I login with a user, I receive the complete roster correctly, but if I create a new user while I'm logged in with another user, the OnRosterItem event does not get called. I can reproduce this with the MiniClient example. The OnPresence event does get called for the new user, but I need to add it to my roster via the OnRosterItem before I can do something with it in the OnPresence event.

This is the only xml that I receive from the new user:
  1. RECV: <presence from="ihv_testerbla_992246@chat-test.obec.local/MatriX" to="obecmw01_992246@chat-test.obec.local" xmlns="jabber:client">
  2.  <status />
  3.  <priority>0</priority>
  4. </presence>

I use OpenFire 3.7.1 and MatriX 1.5.2.7. The tutorial on your site says "This event gets also fired when a single contact is added, removed or updated.", so the event should be called when I create a new user? Is there something wrong with my OpenFire?
This post was edited on 2013-01-31, 18:27 by Alex.
Avatar
Alex #2
Member since Feb 2003 · 4296 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
adding a contact needs several steps.

1) you have to add the contact with the RosterManager. When you are doing this correct then youself and all your other logged in resources must get the roster push from the server which results in an OnRosterItem event. If you don't get this event then you are either doing something wring or the server has a bug

2) When you add a contact you normally also want to subscribe to the presence of this contact. You ask for subscription with the PresenceManager.

3) You will not get the the Presence information from this contact until the contact accepts the subscription request. This will result again in a roster push (OnRosterItem event) because the subscription of the contact changes
Avatar
Walance #3
Member since Jan 2013 · 12 posts
Group memberships: Members
Show profile · Link to this post
1) The contacts get added by a different system, that system adds them directly to OpenFire by using the OpenFire User Service plugin. But shouldn't this cause the server to push the roster again too?

2/3) Hmmm.. I actually never call PresenceManager.Subscribe() anywhere in my code, but I do receive all presence information when a user comes online, goes offline etc. So I'm a bit confused now...  I do set AutoPresence = true, but that's for sending my own presence to the server, not for receiving presences of others? Or does that cause OnPresence events as well? I can't really subscribe to new users if they are created like I said in 1, I think.
Avatar
Alex #4
Member since Feb 2003 · 4296 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
Quote by Walance:
1) The contacts get added by a different system, that system adds them directly to OpenFire by using the OpenFire User Service plugin. But shouldn't this cause the server to push the roster again too?

this depends on how this plugin was designed. It was probably not designed for adding contacts while you are online and send roster pushes. You have to consult the openfire developers for this.

Quote by Walance:
2/3) Hmmm.. I actually never call PresenceManager.Subscribe() anywhere in my code, but I do receive all presence information when a user comes online, goes offline etc. So I'm a bit confused now...  I do set AutoPresence = true, but that's for sending my own presence to the server, not for receiving presences of others? Or does that cause OnPresence events as well? I can't really subscribe to new users if they are created like I said in 1, I think.

no idea how the plugin works. It probably adds the subscription automatically on your behalf. Then you don't need the  PresenceManager.Subscribe() stuff I mentioned before.
To me it looks like you have to make some code changes to the plugin, or accept the restrictions it has.

Alex
This post was edited on 2013-02-01, 13:36 by Alex.
Avatar
Walance #5
Member since Jan 2013 · 12 posts
Group memberships: Members
Show profile · Link to this post
Alright, thank you for your answers. I will do as you suggested.
Avatar
Walance #6
Member since Jan 2013 · 12 posts
Group memberships: Members
Show profile · Link to this post
I noticed that our OpenFire server was constantly complaining that the Roster cache was full. Apparently this cache is only 1MB by default. At first I increased it to 10MB but that was still not enough (we have ~900 users and 4 groups in that server), so I increased it to 50MB and that worked better.

Since I did that, I have not had this problem anymore. I have created 25+ new users in a row, while 2 other users were logged in and both of the logged in users got every single roster update correctly. So it seems that this might have solved my problem.
Close Smaller – Larger + Reply to this post:
Verification code: VeriCode Please enter the word from the image into the text field below. (Type the letters only, lower case is okay.)
Smileys: :-) ;-) :-D :-p :blush: :cool: :rolleyes: :huh: :-/ <_< :-( :'( :#: :scared: 8-( :nuts: :-O
Special characters:
Forum: MatriX RSS