Ejemplo n.º 1
0
Archivo: client.cpp Proyecto: j0wl/licq
void Client::handleItemUpdated(const gloox::JID& jid)
{
  TRACE("%s", jid.full().c_str());

  gloox::RosterItem* item = myRosterManager->getRosterItem(jid);
  addRosterItem(*item);
}
Ejemplo n.º 2
0
					void ClientConnection::handleItemUpdated (const gloox::JID& jid)
					{
						if (!JID2CLEntry_.contains (jid.bareJID ()))
						{
							qWarning () << Q_FUNC_INFO
									<< "strange, we have no"
									<< jid.full ().c_str ()
									<< "in our JID2CLEntry_";
							return;
						}

						emit rosterItemUpdated (JID2CLEntry_ [jid.bareJID ()]);
					}
Ejemplo n.º 3
0
					void ClientConnection::handleItemRemoved (const gloox::JID& jid)
					{
						if (!JID2CLEntry_.contains (jid.bareJID ()))
						{
							qWarning () << Q_FUNC_INFO
									<< "strange, we have no"
									<< jid.full ().c_str ()
									<< "in our JID2CLEntry_";
							return;
						}

						GlooxCLEntry *entry = JID2CLEntry_.take (jid.bareJID ());
						emit rosterItemRemoved (entry);
					}
Ejemplo n.º 4
0
bool UserPlugin::onVCard(const VCardWrapper& vcardWrapper)
{
	const gloox::JID jid=vcardWrapper.jid();
	gloox::VCard vcard=gloox::VCard(vcardWrapper.vcard());

	qDebug() << "Got vcard: "+vcardWrapper.id();
	QString jidStr=QString::fromStdString(jid.full());
	QString reqId=QString("vcard_%1").arg(vcardWrapper.id());
	AsyncRequest* req=bot()->asyncRequests()->byStanzaId(reqId);
	if (req==0l)
	{
		return false;
	}
	if (vcardWrapper.isEmpty())
	{
		reply(req->stanza(), "No VCard found");
		bot()->asyncRequests()->removeAll(req);
		return true;
	}

	if (req->name()=="VCARD")
	{
		QString replyStr=vcardWrapper.vcardStr();
		if (replyStr.isEmpty())
		{
			reply(req->stanza(), "Empty VCard");
		}
		else
		{
			reply(req->stanza(), QString("VCard: %1").arg(replyStr));
		}
	}
	else if (req->name()=="PHOTO")
	{
		std::string photoContentStd=vcard.photo().binval;
		QByteArray photoContent=QByteArray(photoContentStd.data(),
				photoContentStd.size());
		//QFile file("/tmp/out.png");
		//file.open(QIODevice::WriteOnly);
		//file.write(photoContentStd.data(), photoContentStd.size());
		//file.close();
		QImage image;
		if (!image.loadFromData(photoContent))
		{
			reply(req->stanza(), "Can't load image");
			bot()->asyncRequests()->removeAll(req);
			return true;
		}

		MessageParser parser(req->stanza(), getMyNick(req->stanza()));
		parser.nextToken();
		QString cmd=parser.nextToken().toUpper();
		QString jid=parser.nextToken();
		QString widthStr=parser.nextToken();
		QString white=parser.nextToken();
		QString black=parser.nextToken();

		Image2Ascii img2ascii(image);

		if (!widthStr.isEmpty())
			img2ascii.setWidth(widthStr.toInt());
		if (!white.isEmpty() && white.length()<=5)
			img2ascii.setWhite(white);
		if (!black.isEmpty() && black.length()<=5)
			img2ascii.setBlack(black);

		QString ascii=img2ascii.ascii();
		if (ascii.isEmpty())
			reply(req->stanza(), "Can't convert image to ASCII");
		else
			reply(req->stanza(), QString("Photo:\n%1").arg(ascii));
	}
	bot()->asyncRequests()->removeAll(req);
	return true;
}
Ejemplo n.º 5
0
Archivo: client.cpp Proyecto: j0wl/licq
void Client::handleItemUnsubscribed(const gloox::JID& jid)
{
  TRACE("%s", jid.full().c_str());

  gLog.info("No longer authorized for %s", jid.bare().c_str());
}
Ejemplo n.º 6
0
Archivo: client.cpp Proyecto: j0wl/licq
void Client::handleItemRemoved(const gloox::JID& jid)
{
  TRACE("%s", jid.full().c_str());

  myHandler.onUserRemoved(jid.bare());
}