Browse Source

- Hide properly the contacts connected from more than 2 ressources in the Roster (bug https://bugs.launchpad.net/movim/+bug/1235365 fixed)

pull/16/head
Jaussoin Timothée 12 years ago
parent
commit
8640223346
  1. 15
      app/widgets/Roster/Roster.php
  2. 21
      app/widgets/Roster/roster.js

15
app/widgets/Roster/Roster.php

@ -72,7 +72,7 @@ class Roster extends WidgetBase
RPC::call(
'movim_delete',
'roster'.$arr['jid'],
'roster'.$arr['jid'].$arr['ressource'],
$html /* this second parameter is just to bypass the RPC filter*/);
RPC::call('movim_append', 'group'.$group, $html);
@ -127,7 +127,8 @@ class Roster extends WidgetBase
$html .= '"';
$html .= '
id="roster'.$contact->jid.'"
id="roster'.$contact->jid.$contact->ressource.'"
data-jid="'.$contact->jid.'"
>';
$type = '';
@ -195,16 +196,10 @@ class Roster extends WidgetBase
// We get the current name of the group
$currentgroup = $contacts[$i]->groupname;
// Temporary array to prevent duplicate contact
$duplicate = array();
// We grab all the contacts of the group
$grouphtml = '';
while(isset($contacts[$i]) && $contacts[$i]->groupname == $currentgroup) {
if(!in_array($contacts[$i]->jid, $duplicate)) {
$grouphtml .= $this->prepareRosterElement($contacts[$i], $caps);
array_push($duplicate, $contacts[$i]->jid);
}
while(isset($contacts[$i]) && $contacts[$i]->groupname == $currentgroup) {
$grouphtml .= $this->prepareRosterElement($contacts[$i], $caps);
$i++;
}

21
app/widgets/Roster/roster.js

@ -27,6 +27,27 @@ function sortRoster() {
for(i = 0; i < server_error.length; i++) {
server_error.item(i).parentNode.insertBefore(server_error.item(i), contacts.item(contacts.length))
}
cleanMulti();
}
function cleanMulti() {
roster = document.querySelector('#rosterlist');
contacts = roster.querySelectorAll('li');
var i = 0;
var id = '';
while(i < contacts.length) {
if(contacts.item(i).className != 'offline'
&& contacts.item(i).className != 'server_error')
contacts.item(i).style.display = 'list-item';
if(id == contacts.item(i).dataset.jid)
contacts.item(i).style.display = 'none';
id = contacts.item(i).dataset.jid;
i++;
}
}
function showRoster(boolOffline) {

Loading…
Cancel
Save