28
28
29
29
#include < QList>
30
30
#include < QMap>
31
- #include < type_traits>
32
31
33
32
#define NS_XML " http://www.w3.org/XML/1998/namespace"
34
33
@@ -336,7 +335,7 @@ void MUCItem::setAffiliation(Affiliation a) { affiliation_ = a; }
336
335
337
336
void MUCItem::setRole (Role r) { role_ = r; }
338
337
339
- void MUCItem::setActor (const Jid &a) { actor_ = a; }
338
+ void MUCItem::setActor (const Actor &a) { actor_ = a; }
340
339
341
340
void MUCItem::setReason (const QString &r) { reason_ = r; }
342
341
@@ -348,7 +347,7 @@ MUCItem::Affiliation MUCItem::affiliation() const { return affiliation_; }
348
347
349
348
MUCItem::Role MUCItem::role () const { return role_; }
350
349
351
- const Jid &MUCItem::actor () const { return actor_; }
350
+ const MUCItem::Actor &MUCItem::actor () const { return actor_; }
352
351
353
352
const QString &MUCItem::reason () const { return reason_; }
354
353
@@ -384,14 +383,11 @@ void MUCItem::fromXml(const QDomElement &e)
384
383
role_ = NoRole;
385
384
}
386
385
387
- for (QDomNode n = e.firstChild (); !n.isNull (); n = n.nextSibling ()) {
388
- QDomElement i = n.toElement ();
389
- if (i.isNull ())
390
- continue ;
391
-
392
- if (i.tagName () == QLatin1String (" actor" ))
393
- actor_ = Jid (i.attribute (QLatin1String (" jid" )));
394
- else if (i.tagName () == QLatin1String (" reason" ))
386
+ for (QDomElement i = e.firstChildElement (); !i.isNull (); i = i.nextSiblingElement ()) {
387
+ if (i.tagName () == QLatin1String (" actor" )) {
388
+ actor_.jid = Jid (i.attribute (QLatin1String (" jid" )));
389
+ actor_.nick = i.attribute (QLatin1String (" nick" ));
390
+ } else if (i.tagName () == QLatin1String (" reason" ))
395
391
reason_ = i.text ();
396
392
}
397
393
}
@@ -448,11 +444,15 @@ QDomElement MUCItem::toXml(QDomDocument &d)
448
444
return e;
449
445
}
450
446
447
+ bool MUCItem::Actor::operator ==(const Actor &o) const
448
+ {
449
+ return ((!jid.isValid () && !o.jid .isValid ()) || jid.compare (o.jid , true )) && (nick == o.nick );
450
+ }
451
+
451
452
bool MUCItem::operator ==(const MUCItem &o) const
452
453
{
453
454
return !nick_.compare (o.nick_ ) && ((!jid_.isValid () && !o.jid_ .isValid ()) || jid_.compare (o.jid_ , true ))
454
- && ((!actor_.isValid () && !o.actor_ .isValid ()) || actor_.compare (o.actor_ , true ))
455
- && affiliation_ == o.affiliation_ && role_ == o.role_ && !reason_.compare (o.reason_ );
455
+ && (actor_ == o.actor_ ) && affiliation_ == o.affiliation_ && role_ == o.role_ && !reason_.compare (o.reason_ );
456
456
}
457
457
458
458
// ----------------------------------------------------------------------------
0 commit comments