@@ -65,7 +65,7 @@ PeerItem::PeerItem(FeedHolder *parent, uint32_t feedId, const RsPeerId &peerId,
6565 {
6666 auto fe = dynamic_cast <const RsFriendListEvent*>(e.get ());
6767
68- if (!fe)
68+ if (!fe || fe-> mSslId != mPeerId )
6969 return ;
7070
7171 updateItem ();
@@ -173,78 +173,62 @@ void PeerItem::updateItemStatic()
173173
174174void PeerItem::updateItem ()
175175{
176- if (!rsPeers)
177- return ;
176+ if (!rsPeers)
177+ return ;
178178
179- /* fill in */
179+ /* fill in */
180180#ifdef DEBUG_ITEM
181- std::cerr << " PeerItem::updateItem()" ;
182- std::cerr << std::endl;
181+ std::cerr << " PeerItem::updateItem()" ;
182+ std::cerr << std::endl;
183183#endif
184- if (!RsAutoUpdatePage::eventsLocked ()) {
185- RsPeerDetails details;
186- if (!rsPeers->getPeerDetails (mPeerId , details))
187- {
188- chatButton->setEnabled (false );
189- sendmsgButton->setEnabled (false );
190-
191- return ;
192- }
184+ RsPeerDetails details;
185+ if (!rsPeers->getPeerDetails (mPeerId , details))
186+ {
187+ chatButton->setEnabled (false );
188+ sendmsgButton->setEnabled (false );
193189
194- /* top Level info */
195- QString status = StatusDefs::peerStateString (details. state );
190+ return ;
191+ }
196192
197- #if 0
198- /* Append additional status info from status service */
199- StatusInfo statusInfo;
200- if ((rsStatus) && (rsStatus->getStatus(*it, statusInfo)))
201- {
202- status.append(QString::fromStdString("/" + RsStatusString(statusInfo.status)));
203- }
204- #endif
205- statusLabel->setText (status);
206- trustLabel->setText (QString::fromStdString (RsPeerTrustString (details.trustLvl )));
193+ /* top Level info */
194+ QString status = StatusDefs::peerStateString (details.state );
207195
208- QString ip_string;
196+ statusLabel->setText (status);
197+ trustLabel->setText (QString::fromStdString (RsPeerTrustString (details.trustLvl )));
209198
210- if (details.localPort != 0 )
211- ip_string += QString (" %1:%2" ).arg (QString::fromStdString (details.localAddr )).arg (details.localPort );
199+ QString ip_string;
212200
213- if (details.extPort != 0 )
214- {
215- if (!ip_string.isNull ())
216- ip_string += " /" ;
201+ if (details.localPort != 0 )
202+ ip_string += QString (" %1:%2" ).arg (QString::fromStdString (details.localAddr )).arg (details.localPort );
217203
218- ip_string += ip_string += QString (" %1:%2" ).arg (QString::fromStdString (details.extAddr )).arg (details.extPort );
219- }
220- ipLabel->setText (ip_string);
204+ if (details.extPort != 0 )
205+ {
206+ if (!ip_string.isNull ())
207+ ip_string += " /" ;
221208
222- connLabel->setText (StatusDefs::connectStateString (details));
209+ ip_string += ip_string += QString (" %1:%2" ).arg (QString::fromStdString (details.extAddr )).arg (details.extPort );
210+ }
211+ ipLabel->setText (ip_string);
223212
224- /* do buttons */
225- chatButton->setEnabled (details.state & RS_PEER_STATE_CONNECTED );
226- if (details.state & RS_PEER_STATE_CONNECTED )
227- {
228- sendmsgButton->setEnabled (true );
229- }
230- else
231- {
232- sendmsgButton->setEnabled (false );
233- }
213+ connLabel->setText (StatusDefs::connectStateString (details));
234214
235- if (rsRtt)
236- {
237- double offset = rsRtt->getMeanOffset (RsPeerId (mPeerId ));
238- offsetLabel->setText (QString::number (offset,' f' ,2 ).append (" s" ));
239- }
215+ /* do buttons */
216+ chatButton->setEnabled (details.state & RS_PEER_STATE_CONNECTED );
240217
241- }
218+ if (details.state & RS_PEER_STATE_CONNECTED )
219+ {
220+ sendmsgButton->setEnabled (true );
221+ }
222+ else
223+ {
224+ sendmsgButton->setEnabled (false );
225+ }
242226
243- /* slow Tick */
244- int msec_rate = 10129 ;
245-
246- QTimer::singleShot ( msec_rate, this , SLOT ( updateItem () ));
247- return ;
227+ if (rsRtt)
228+ {
229+ double offset = rsRtt-> getMeanOffset ( RsPeerId ( mPeerId ));
230+ offsetLabel-> setText ( QString::number (offset, ' f ' , 2 ). append ( " s " ));
231+ }
248232}
249233
250234void PeerItem::toggle ()
0 commit comments