forked from blue/squawk
initial functionality of mucs
This commit is contained in:
parent
e2cc1bae2e
commit
023494de0b
23 changed files with 347 additions and 119 deletions
|
@ -1,6 +1,6 @@
|
|||
#include "contact.h"
|
||||
|
||||
#include <QDebug>
|
||||
#include "account.h"
|
||||
|
||||
Models::Contact::Contact(const QString& p_jid ,const QMap<QString, QVariant> &data, Item *parentItem):
|
||||
Item(Item::contact, data, parentItem),
|
||||
|
@ -227,16 +227,6 @@ QIcon Models::Contact::getStatusIcon(bool big) const
|
|||
}
|
||||
}
|
||||
|
||||
QString Models::Contact::getAccountName() const
|
||||
{
|
||||
const Account* acc = getParentAccount();
|
||||
if (acc == 0) {
|
||||
qDebug() << "An attempt to request account name of the contact " << jid << " but the parent account wasn't found, returning empty string";
|
||||
return "";
|
||||
}
|
||||
return acc->getName();
|
||||
}
|
||||
|
||||
void Models::Contact::addMessage(const Shared::Message& data)
|
||||
{
|
||||
const QString& res = data.getPenPalResource();
|
||||
|
@ -291,36 +281,6 @@ void Models::Contact::getMessages(Models::Contact::Messages& container) const
|
|||
}
|
||||
}
|
||||
|
||||
QString Models::Contact::getAccountJid() const
|
||||
{
|
||||
const Account* acc = getParentAccount();
|
||||
if (acc == 0) {
|
||||
qDebug() << "An attempt to request account jid of the contact " << jid << " but the parent account wasn't found, returning empty string";
|
||||
return "";
|
||||
}
|
||||
return acc->getLogin() + "@" + acc->getServer();
|
||||
}
|
||||
|
||||
QString Models::Contact::getAccountResource() const
|
||||
{
|
||||
const Account* acc = getParentAccount();
|
||||
if (acc == 0) {
|
||||
qDebug() << "An attempt to request account resource of the contact " << jid << " but the parent account wasn't found, returning empty string";
|
||||
return "";
|
||||
}
|
||||
return acc->getResource();
|
||||
}
|
||||
|
||||
const Models::Account * Models::Contact::getParentAccount() const
|
||||
{
|
||||
const Item* p = this;
|
||||
do {
|
||||
p = p->parentItemConst();
|
||||
} while (p != 0 && p->type != Item::account);
|
||||
|
||||
return static_cast<const Account*>(p);
|
||||
}
|
||||
|
||||
void Models::Contact::toOfflineState()
|
||||
{
|
||||
emit childIsAboutToBeRemoved(this, 0, childItems.size());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue