Пример #1
0
TlenPersonalInfoWidget::TlenPersonalInfoWidget(Account account, QWidget* parent) :
		QWidget(parent), TAccount(account), FetchOk(false)
{
	createGui();

	if (account.isNull() || !account.protocolHandler())
		return;

	Service = account.protocolHandler()->personalInfoService();
	if (!Service)
		return;

	connect(Service, SIGNAL(personalInfoAvailable(Buddy)), this, SLOT(personalInfoAvailable(Buddy)));
	Service->fetchPersonalInfo();
}
Пример #2
0
JabberPersonalInfoWidget::JabberPersonalInfoWidget(Account *account, QWidget* parent) :
		QWidget(parent)
{
	createGui();

	if (!account)
		return;

	Service = account->protocol()->personalInfoService();
	if (!Service)
		return;

	connect(Service, SIGNAL(personalInfoAvailable(Contact)), this, SLOT(personalInfoAvailable(Contact)));
	Service->fetchPersonalInfo();
}
void GaduContactPersonalInfoService::handleEventPubdir50Read(struct gg_event *e)
{
	gg_pubdir50_t res = e->event.pubdir50;

	if (FetchSeq != res->seq)
		return;

	int count = gg_pubdir50_count(res);
	if (1 != count)
	{
		emit personalInfoAvailable(Buddy::null);
		return;
	}

	Buddy result = GaduProtocolHelper::searchResultToBuddy(account(), res, 0);
	emit personalInfoAvailable(result);
}
GaduContactPersonalInfoWidget::GaduContactPersonalInfoWidget(const Contact &contact, QWidget *parent) :
		QWidget(parent), MyContact(contact)
{
	setAttribute(Qt::WA_DeleteOnClose);

	createGui();

	ContactPersonalInfoService *service = contact.contactAccount().protocolHandler()->contactPersonalInfoService();
	if (!service)
	{
		reset();
		return;
	}

	connect(service, SIGNAL(personalInfoAvailable(Buddy)), this, SLOT(personalInfoAvailable(Buddy)));
	service->fetchPersonalInfo(contact);
}
Пример #5
0
void TlenPersonalInfoService::handlePubdirReceived(QDomNodeList node)
{
	kdebugf();

	client = Protocol->client();
	if (!client)
		return;
	
	disconnect(client, SIGNAL(pubdirReceived(QDomNodeList)), this, SLOT(handlePubdirReceived(QDomNodeList)));
	disconnect(client, SIGNAL(pubdirUpdated(bool)), this, SIGNAL(personalInfoUpdated(bool)));

	if (1 != node.count())
	{
		emit personalInfoAvailable(Buddy::null);
		return;
	}

	emit personalInfoAvailable(Protocol->nodeToBuddy(node.item(0)));
}
JabberContactPersonalInfoWidget::JabberContactPersonalInfoWidget(Contact &contact, QWidget *parent) :
		QWidget(parent), MyContact(contact)
{
	setAttribute(Qt::WA_DeleteOnClose);

	createGui();
	reset();

	ContactPersonalInfoService *service = contact.contactAccount().protocolHandler()->contactPersonalInfoService();
	if (!service)
		return;

	connect(service, SIGNAL(personalInfoAvailable(Buddy)), this, SLOT(personalInfoAvailable(Buddy)));

	Buddy b = Buddy::create();
	Contact c = Contact::create();
	c.setId(contact.id());
	c.setOwnerBuddy(b);

	service->fetchPersonalInfo(c);
}
Пример #7
0
void JabberPersonalInfoService::vCardDownloaded(bool ok, const QXmppVCardIq &vCard)
{
	if (!ok)
		return;

	CurrentBuddy.setNickName(vCard.nickName());
	CurrentBuddy.setFirstName(vCard.fullName());
	CurrentBuddy.setFamilyName(vCard.middleName());
	QDate bday = vCard.birthday();
	if (bday.isValid() && !bday.isNull())
		CurrentBuddy.setBirthYear(bday.year());

	if (!vCard.addresses().isEmpty())
		CurrentBuddy.setCity(vCard.addresses().at(0).locality());
	if (!vCard.emails().isEmpty())
		CurrentBuddy.setEmail(vCard.emails().at(0).address());
	CurrentBuddy.setWebsite(vCard.url());

	emit personalInfoAvailable(CurrentBuddy);
}
void JabberPersonalInfoService::fetchingVCardFinished()
{
	XMPP::VCard vcard;
	XMPP::JT_VCard *task = (XMPP::JT_VCard *)sender();
	
	if (task && task->success())
	{
		vcard = task->vcard();
		CurrentBuddy.setNickName(vcard.nickName());
		CurrentBuddy.setFirstName(vcard.fullName());
		CurrentBuddy.setFamilyName(vcard.familyName());
		QDate bday = QDate::fromString(vcard.bdayStr(), "yyyy-MM-dd");
		if (bday.isValid() && !bday.isNull())
			CurrentBuddy.setBirthYear(bday.year());

		if (vcard.addressList().count() > 0)
			CurrentBuddy.setCity(vcard.addressList().at(0).locality);
		if (vcard.emailList().count() > 0)
			CurrentBuddy.setEmail(vcard.emailList().at(0).userid);
		CurrentBuddy.setWebsite(vcard.url());

		emit personalInfoAvailable(CurrentBuddy);
	}
}