ejabberd - Comments for "User in multiple roster groups" https://www.ejabberd.im/node/4855 en First, please note that I'm https://www.ejabberd.im/node/4855#comment-57639 <p>First, please note that I'm not a ejabberd developer, so I can only guess. However, as I started to work on improving mod_shared_roster_ldap, I seem to start understandint its logic. Please treat this answer as educated guess.</p> <p>Imagine the situation when you login to ejabberd for the first time, and you have a contact in shared roster. It is in the group X. You then decide to move this contact to group Y (or even to the top level, i.e. remove it from group). This effectively puts this contact to your personal roster.</p> <p>Next time you log in, this contact is in your personal roster in group Y. If the shared roster module would replace this contact with its data, this contact would jump back to group X. And if it would add its groups to this contact's groups, then there would be an interesting situation.<br /> Let's imagine that your client supports showing a contact in multiple groups. Then you would see this contact to become member of two groups - X and Y, while you moved it, not copied. And in the real situation, when you use an ordinary client that shows one group per contact, you would see the group that happens to be first in the list.</p> <p>Shared roster module has no knowledge about custom modifications user could have made to roster, however, ejabberd must honor user's decisions. The only thing user can't do with this contact is to remove it from roster (however, some clients allow you to hide a contact from list). If user modifies the shared contact, he tells ejabberd than from now on, he manages this contact himself, so shared roster modules don't interfere.</p> <p>Your situation is not typical. So you need a custom solution. The change is not going to be difficult, you just need to replace the line 167<br /> <code>{Item#roster{subscription = both, ask = none},</code><br /> with</p> <div class="codeblock"><code>NewGroups = lists:megre(Item#roster.groups, _GroupNames),<br />{Item#roster{subscription = both, ask = none, groups = NewGroups},</code></div> <p>(or something like this, I didn't compile or debug it; if you use mod_shared_roster).</p> Sun, 24 Jul 2011 02:54:42 +0000 mikekaganski comment 57639 at https://www.ejabberd.im Out of curiosity, why is this https://www.ejabberd.im/node/4855#comment-57638 <p>Out of curiosity, why is this the chosen logic path? Even in a corporate environment, I could see situations where a person is in multiple shared roster groups (Managers, R&amp;D) as well as someone's personal group (like Lunch Crew, Outside Friends, etc). Why would one want to keep the users out of the Managers group on their client just because they are part of their Lunch Crew?</p> <p>If, in the personal roster, there is NO group, I could see not duplicating the user in the roster since the client wouldn't know where to put it anyway. I'm not sure I agree with removing them from the shared roster groups though.</p> <p>Looks like I need to learn erlang....</p> Sat, 23 Jul 2011 18:58:51 +0000 barhorn comment 57638 at https://www.ejabberd.im Ok, this is another https://www.ejabberd.im/node/4855#comment-57636 <p>Ok, this is another story.</p> <p>When a user asks server for a roster, the server looks to the database first to get the user's personal roster. Then server asks shared roster modules to add items to this list. The shared roster modules have the following logic: they first get the shared roster for the user, then check if the shared roster items are already in the user's personal roster. If they are, then the shared roster group for this contact isn't added, and the shared roster module only makes sure that this contact is authorised in both directions.</p> <p>Thus, it's impossible to have a contact in both custom group and shared roster group. It is possible to have it in two or more custom groups.</p> <p>If you need another logic, you will need to make changes to the source code and recompile the shared roster module. The function that you will need to change is <code>get_user_roster(Items, US)</code>.</p> Sat, 23 Jul 2011 12:03:20 +0000 mikekaganski comment 57636 at https://www.ejabberd.im I keep trying to post a https://www.ejabberd.im/node/4855#comment-57635 <p>I keep trying to post a lengthy response with examples, but the forum seems to reject it (or at least I don't see my reply). Long story short: I run "ejabberdctl srg_get_members ahciv_game_45 chat.mydomain.com" and get a list of people in the shared roster, but when I run "ejabberdctl get_roster skywatcher1138 chat.mydomain.com" I get the user's roster, but not all of the users are in the correct groups. At first glance, it looks like it may be a problem with the user being in both shared rosters and normal roster groups...</p> <p>If there's some place I can send the exact data (so the forum doesn't filter it) let me know. Checking Pidgin's XMPP Console as you suggested verifies what ejabberdctl is telling me.</p> Fri, 22 Jul 2011 17:45:12 +0000 barhorn comment 57635 at https://www.ejabberd.im I enabled the XMPP Console in https://www.ejabberd.im/node/4855#comment-57633 <p>I enabled the XMPP Console in Pidgin, and I actually do not see the users listed. Here's a snippet (all domains changed to chat.mydomain.com since I haven't secured anything yet...):</p> <div class="codeblock"><code>&lt;iq from=&#039;skywatcher1138@chat.mydomain.com&#039; to=&#039;skywatcher1138@chat.mydomain.com/rw082deu&#039; id=&#039;purplee56ca97d&#039; type=&#039;result&#039;&gt;<br /> &lt;query xmlns=&#039;jabber:iq:roster&#039;&gt;<br />....<br /> &lt;item subscription=&#039;both&#039; name=&#039;Nathan Barhorst&#039; jid=&#039;ngb@chat.mydomain.com&#039;&gt;<br /> &lt;group&gt;Friends&lt;/group&gt;<br /> &lt;/item&gt;<br />....<br /> &lt;item subscription=&#039;both&#039; jid=&#039;nardo@chat.mydomain.com&#039;&gt;<br /> &lt;group&gt;THM-2010&lt;/group&gt;<br /> &lt;/item&gt;<br />....<br /> &lt;/query&gt;<br />&lt;/iq&gt;</code></div> <p>The group Friends is a normal roster group. There should be an entry for <noindex><a href="mailto:ngb@chat.mydomain.com" rel="nofollow" >ngb@chat.mydomain.com</a></noindex> in the group from the shared roster "THM-2010" (group ahciv_game_45), but there isn't. The shared roster appears to be loaded (since nardo exists there), but not ngb. I verified through the Web Admin panel that ngb was indeed a member. Additionally, when I use ejabberdctl:</p> <div class="codeblock"><code>C:\Program Files\ejabberd-2.1.8\bin&gt;ejabberdctl get_roster skywatcher1138 chat.mydomain.com<br />kevin@chat.mydomain.com&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; kevin&nbsp;&nbsp; both&nbsp;&nbsp;&nbsp; none&nbsp;&nbsp;&nbsp; Friends<br /><noindex><a href="mailto:ngb@chat.mydomain.com" rel="nofollow" >ngb@chat.mydomain.com</a></noindex> Nathan Barhorst both&nbsp;&nbsp;&nbsp; none&nbsp;&nbsp;&nbsp; Friends<br />nardo@chat.mydomain.com&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; both&nbsp;&nbsp;&nbsp; none&nbsp;&nbsp;&nbsp; THM-2010<br />heather@chat.mydomain.com&nbsp;&nbsp;&nbsp;&nbsp; heather both&nbsp;&nbsp;&nbsp; none&nbsp;&nbsp;&nbsp; Friends<br />kdoub@chat.mydomain.com&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Kevin Worth&nbsp;&nbsp;&nbsp;&nbsp; both&nbsp;&nbsp;&nbsp; none&nbsp;&nbsp;&nbsp; BPA 2011-F<br />steve@chat.mydomain.com&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; both&nbsp;&nbsp;&nbsp; none&nbsp;&nbsp;&nbsp; BPA 2011-F<br />danmorris@chat.mydomain.com&nbsp;&nbsp; danimal both&nbsp;&nbsp;&nbsp; none&nbsp;&nbsp;&nbsp; THM-2010<br />andyflip@chat.mydomain.com&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; both&nbsp;&nbsp;&nbsp; none&nbsp;&nbsp;&nbsp; THM-2010<br />stevegamer@chat.mydomain.com&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; both&nbsp;&nbsp;&nbsp; none&nbsp;&nbsp;&nbsp; Something Work-Related<br />stevegamer@chat.mydomain.com&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; both&nbsp;&nbsp;&nbsp; none&nbsp;&nbsp;&nbsp; BPA 2011-B<br />mrpanda@chat.mydomain.com&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; both&nbsp;&nbsp;&nbsp; none&nbsp;&nbsp;&nbsp; BPA 2011-F<br />bosworth@chat.mydomain.com&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; both&nbsp;&nbsp;&nbsp; none&nbsp;&nbsp;&nbsp; Something Work-Related<br />skrofler@chat.mydomain.com&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; both&nbsp;&nbsp;&nbsp; none&nbsp;&nbsp;&nbsp; Something Work-Related<br />cardboardwarrior@chat.mydomain.com&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; both&nbsp;&nbsp;&nbsp; none&nbsp;&nbsp;&nbsp; BPA 2011-B<br />lunau@chat.mydomain.com&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; both&nbsp;&nbsp;&nbsp; none&nbsp;&nbsp;&nbsp; BPA 2011-B<br />jatang@chat.mydomain.com&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Jamie&nbsp;&nbsp; both&nbsp;&nbsp;&nbsp; none&nbsp;&nbsp;&nbsp; BPA 2011-B<br />shantanu@chat.mydomain.com&nbsp;&nbsp;&nbsp; Shantanu Saha&nbsp;&nbsp; both&nbsp;&nbsp;&nbsp; none&nbsp;&nbsp;&nbsp; BPA 2011-B<br />muirkai@chat.mydomain.com&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; both&nbsp;&nbsp;&nbsp; none&nbsp;&nbsp;&nbsp; THM-2010<br />duck@chat.mydomain.com&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; both&nbsp;&nbsp;&nbsp; none&nbsp;&nbsp;&nbsp; BPA 2011-F<br />corolus@chat.mydomain.com&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; both&nbsp;&nbsp;&nbsp; none&nbsp;&nbsp;&nbsp; BPA 2011-F<br />spealer@chat.mydomain.com&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; both&nbsp;&nbsp;&nbsp; none&nbsp;&nbsp;&nbsp; Something Work-Related<br />kinginyellow@chat.mydomain.com&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; both&nbsp;&nbsp;&nbsp; none&nbsp;&nbsp;&nbsp; BPA 2011-B<br />hightower@chat.mydomain.com&nbsp;&nbsp; Hightower&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; both&nbsp;&nbsp;&nbsp; none&nbsp;&nbsp;&nbsp; THM-2010<br />palpatine@chat.mydomain.com&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; both&nbsp;&nbsp;&nbsp; none&nbsp;&nbsp;&nbsp; THM-2010<br />tapion@chat.mydomain.com&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; both&nbsp;&nbsp;&nbsp; none&nbsp;&nbsp;&nbsp; Something Work-Related<br />vlakaa@chat.mydomain.com&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; both&nbsp;&nbsp;&nbsp; none&nbsp;&nbsp;&nbsp; Something Work-Related<br />locus99@chat.mydomain.com&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; both&nbsp;&nbsp;&nbsp; none&nbsp;&nbsp;&nbsp; BPA 2011-F <p>C:\Program Files\ejabberd-2.1.8\bin&gt;ejabberdctl srg_get_members ahciv_game_45 chat.mydomain.com<br /><noindex><a href="mailto:ngb@chat.mydomain.com" rel="nofollow" >ngb@chat.mydomain.com</a></noindex><br /><noindex><a href="mailto:danmorris@chat.mydomain.com" rel="nofollow" >danmorris@chat.mydomain.com</a></noindex><br /><noindex><a href="mailto:palpatine@chat.mydomain.com" rel="nofollow" >palpatine@chat.mydomain.com</a></noindex><br /><noindex><a href="mailto:skywatcher1138@chat.mydomain.com" rel="nofollow" >skywatcher1138@chat.mydomain.com</a></noindex><br /><noindex><a href="mailto:hightower@chat.mydomain.com" rel="nofollow" >hightower@chat.mydomain.com</a></noindex><br /><noindex><a href="mailto:andyflip@chat.mydomain.com" rel="nofollow" >andyflip@chat.mydomain.com</a></noindex><br /><noindex><a href="mailto:muirkai@chat.mydomain.com" rel="nofollow" >muirkai@chat.mydomain.com</a></noindex><br />nardo@chat.mydomain.com</p></code></div> <p>Therefore, it is looking to me like it isn't displaying everything from the shared rosters, correct? Let me know if you want more details information on anything...</p> Fri, 22 Jul 2011 17:36:52 +0000 barhorn comment 57633 at https://www.ejabberd.im You could easily get the https://www.ejabberd.im/node/4855#comment-57619 <p>You could easily get the answer to your question by simply inspecting the xml communications between your client and ejabberd. Specifically, in Pidgin, you need to enable the XMPP Console module in the menu Modules, and then use it to inspect the traffic from server.</p> <p>(Spoiler: yes, it is the client issue (ejabberd does send multiple groups per contact), and it is very common among different clients. E.g., Miranda IM cannot display a single contact in different groups, too. Maybe it's because it would require to show blinking/changing status/etc many times for one contact for each event...)</p> Thu, 21 Jul 2011 08:49:47 +0000 mikekaganski comment 57619 at https://www.ejabberd.im