Ejemplo n.º 1
0
void YahooClient::processStatus(unsigned short service, const char *id,
                                const char *_state, const char *_msg,
                                const char *_away, const char *_idle)
{
    Contact *contact;
    YahooUserData *data = findContact(id, NULL, contact);
    if (data == NULL)
        return;
    unsigned state = 0;
    unsigned away  = 0;
    unsigned idle  = 0;
    if (_state)
        state = atol(_state);
    if (_away)
        away  = atol(_away);
    if (_idle)
        idle  = atol(_idle);
    if (service == YAHOO_SERVICE_LOGOFF)
        state = YAHOO_STATUS_OFFLINE;
    if ((state != data->Status.value) ||
            ((state == YAHOO_STATUS_CUSTOM) &&
             (((away != 0) != data->bAway.bValue) || _cmp(_msg, data->AwayMessage.ptr)))) {

        unsigned long old_status = STATUS_UNKNOWN;
        unsigned style  = 0;
        const char *statusIcon = NULL;
        contactInfo(data, old_status, style, statusIcon);

        time_t now;
        time(&now);
        now -= idle;
        if (data->Status.value == YAHOO_STATUS_OFFLINE)
            data->OnlineTime.value = now;
        data->Status.value = state;
        data->bAway.bValue = (away != 0);
        data->StatusTime.value = now;

        unsigned long new_status = STATUS_UNKNOWN;
        contactInfo(data, old_status, style, statusIcon);

        if (old_status != new_status) {
            StatusMessage m;
            m.setContact(contact->id());
            m.setClient(dataName(data).c_str());
            m.setFlags(MESSAGE_RECEIVED);
            m.setStatus(STATUS_OFFLINE);
            Event e(EventMessageReceived, &m);
            e.process();
            if ((new_status == STATUS_ONLINE) && !contact->getIgnore()) {
                Event e(EventContactOnline, contact);
                e.process();
            }
        } else {
            Event e(EventContactStatus, contact);
            e.process();
        }
    }
}
Ejemplo n.º 2
0
void TestMustache::testEval()
{
	QVariantHash map;
	QVariantList list;
	list << contactInfo("Rob Knight", "*****@*****.**");
	list << contactInfo("Jim Smith", "*****@*****.**");
	map["list"] = list;

	QString _template = "{{#list}}{{#counter}}#{{count}} {{name}} {{email}}{{/counter}}\n{{/list}}";

	Mustache::Renderer renderer;
	CounterContext context(map);
	QString output = renderer.render(_template, &context);
	QCOMPARE(output, QString("#1 Rob Knight [email protected]\n"
	                         "#2 Jim Smith [email protected]\n"));
}
Ejemplo n.º 3
0
QString JabberClient::contactTip(void *_data)
{
    JabberUserData *data = (JabberUserData*)_data;
    QString res;
    QString statusText;
    unsigned long status = STATUS_OFFLINE;
    unsigned style  = 0;
    const char *statusIcon = NULL;
    contactInfo(data, status, style, statusIcon);
    if (statusIcon){
        res += "<img src=\"icon:";
        res += statusIcon;
        res += "\">";
        for (const CommandDef *cmd = protocol()->statusList(); cmd->text; cmd++){
            if (!strcmp(cmd->icon, statusIcon)){
                res += " ";
                statusText += i18n(cmd->text);
                res += statusText;
                break;
            }
        }
        res += "<br>";
    }
    res += "ID: <b>";
    res += QString::fromUtf8(data->ID);
    res += "</b>";
    if (data->Status == STATUS_OFFLINE){
        if (data->StatusTime){
            res += "<br><font size=-1>";
            res += i18n("Last online");
            res += ": </font>";
            res += formatTime(data->StatusTime);
        }
    }else{
        if (data->OnlineTime){
            res += "<br><font size=-1>";
            res += i18n("Online");
            res += ": </font>";
            res += formatTime(data->OnlineTime);
        }
        if (data->StatusTime != data->OnlineTime){
            res += "<br><font size=-1>";
            res += statusText;
            res += ": </font>";
            res += formatTime(data->StatusTime);
        }
    }
    if (data->Resource && *data->Resource){
        res += "<br>";
        res += QString::fromUtf8(data->Resource);
    }
    if (data->AutoReply && *data->AutoReply){
        res += "<br><br>";
        res += QString::fromUtf8(data->AutoReply);
    }
    return res;
}
Ejemplo n.º 4
0
void TestMustache::testSections()
{
	QVariantHash map = contactInfo("John Smith", "*****@*****.**");
	QVariantList contacts;
	contacts << contactInfo("James Dee", "*****@*****.**");
	contacts << contactInfo("Jim Jones", "*****@*****.**");
	map["contacts"] = contacts;

	QString _template = "Name: {{name}}, Email: {{email}}\n"
	                    "{{#contacts}}  {{name}} - {{email}}\n{{/contacts}}"
	                    "{{^contacts}}  No contacts{{/contacts}}";

	QString expectedOutput = "Name: John Smith, Email: [email protected]\n"
	                         "  James Dee - [email protected]\n"
	                         "  Jim Jones - [email protected]\n";

	Mustache::Renderer renderer;
	Mustache::QtVariantContext context(map);
	QString output = renderer.render(_template, &context);

	QCOMPARE(output, expectedOutput);

	// test inverted sections
	map.remove("contacts");
	context = Mustache::QtVariantContext(map);
	output = renderer.render(_template, &context);

	expectedOutput = "Name: John Smith, Email: [email protected]\n"
	                 "  No contacts";
	QCOMPARE(output, expectedOutput);

	// test with an empty list instead of an empty key
	map["contacts"] = QVariantHash();
	context = Mustache::QtVariantContext(map);
	output = renderer.render(_template, &context);
	QCOMPARE(output, expectedOutput);
}
Ejemplo n.º 5
0
void TestMustache::testPartialFile()
{
	QString path = QCoreApplication::applicationDirPath();

	QVariantHash map = contactInfo("Jim Smith", "*****@*****.**");

	QString _template = "{{>partial}}";

	Mustache::Renderer renderer;
	Mustache::PartialFileLoader partialLoader(path);
	Mustache::QtVariantContext context(map, &partialLoader);
	QString output = renderer.render(_template, &context);

	QCOMPARE(output, QString("Jim Smith -- [email protected]\n"));
}
Ejemplo n.º 6
0
RESTObject ContactsResource::get(std::string request) 
{
    if (!request.empty() && request != "/")
        throw HTTPException(400,"Invalid query");

    RESTObject result;

    result.properties = Json::Value(Json::arrayValue);

    for (const ContactsSet::Entry& contact : contacts) 
    {
        Json::Value contactInfo(Json::objectValue);
        contactInfo["address"] = contact.address.toString();
        contactInfo["latitude"] = contact.location.lat;
        contactInfo["longitude"] = contact.location.lon;
        contactInfo["expires"] = (Json::UInt64) contact.expires;

        result.properties.append(contactInfo);
    }

    return result;
}
Ejemplo n.º 7
0
status_t MSNConnection::HandleLST(Command *command) {
	LOG(kProtocolName, liDebug, "C %lX: Processing LST", this);
	
	BString passport = command->Param(0);
	passport.ReplaceFirst("N=", "");
	BString display = command->Param(1, true);
	display.ReplaceFirst("F=", "");
	
	BMessage contactInfo(msnContactInfo);
	contactInfo.AddString("passport", passport.String() );
	contactInfo.AddString("display", display.String() );
	
	if ( command->Params() == 4 )
	{ // this param might not be here if the contact is in no lists
		//	This is a bitmask. 1 = FL, 2 = AL, 4 = BL, 8 = RL
		int32 lists = atol(command->Param(3));
		
		LOG(kProtocolName, liDebug, "C %lX: %s (%s) is in list %i", this, passport.String(), display.String(), lists);
		
/*		if (lists == ltReverseList) {
			LOG(kProtocolName, liDebug, "C %lX: \"%s\" (%s) is only on our reverse list. Likely they "
				"added us while we were offline. Ask for authorisation", this, display.String(),
				passport.String());
			fManager->Handler()->AuthRequest(ltReverseList, passport.String(), display.String());
		}; */
		
		contactInfo.AddInt32("lists", lists);
	} else
	{
		LOG(kProtocolName, liDebug, "C %lX: %s (%s) is in no lists", this, passport.String(), display.String() );
		contactInfo.AddInt32("lists", 0);
	}
	
	fManMsgr.SendMessage( &contactInfo );
	
	return B_OK;
};
Ejemplo n.º 8
0
QString YahooClient::contactTip(void *_data)
{
    YahooUserData *data = (YahooUserData*)_data;
    unsigned long status = STATUS_UNKNOWN;
    unsigned style  = 0;
    const char *statusIcon = NULL;
    contactInfo(data, status, style, statusIcon);
    QString res;
    res += "<img src=\"icon:";
    res += statusIcon;
    res += "\">";
    QString statusText;
    for (const CommandDef *cmd = protocol()->statusList(); cmd->text; cmd++) {
        if (!strcmp(cmd->icon, statusIcon)) {
            res += " ";
            statusText = i18n(cmd->text);
            res += statusText;
            break;
        }
    }
    res += "<br>";
    res += QString::fromUtf8(data->Login.ptr);
    res += "</b>";
    if (data->Status.value == YAHOO_STATUS_OFFLINE) {
        if (data->StatusTime.value) {
            res += "<br><font size=-1>";
            res += i18n("Last online");
            res += ": </font>";
            res += formatDateTime(data->StatusTime.value);
        }
    } else {
        if (data->OnlineTime.value) {
            res += "<br><font size=-1>";
            res += i18n("Online");
            res += ": </font>";
            res += formatDateTime(data->OnlineTime.value);
        }
        if (data->Status.value != YAHOO_STATUS_AVAILABLE) {
            res += "<br><font size=-1>";
            res += statusText;
            res += ": </font>";
            res += formatDateTime(data->StatusTime.value);
            QString msg;
            switch (data->Status.value) {
            case YAHOO_STATUS_BRB:
                msg = i18n("Be right back");
                break;
            case YAHOO_STATUS_NOTATHOME:
                msg = i18n("Not at home");
                break;
            case YAHOO_STATUS_NOTATDESK:
                msg = i18n("Not at my desk");
                break;
            case YAHOO_STATUS_NOTINOFFICE:
                msg = i18n("Not in the office");
                break;
            case YAHOO_STATUS_ONPHONE:
                msg = i18n("On the phone");
                break;
            case YAHOO_STATUS_ONVACATION:
                msg = i18n("On vacation");
                break;
            case YAHOO_STATUS_OUTTOLUNCH:
                msg = i18n("Out to lunch");
                break;
            case YAHOO_STATUS_STEPPEDOUT:
                msg = i18n("Stepped out");
                break;
            case YAHOO_STATUS_CUSTOM:
                if (data->AwayMessage.ptr)
                    msg = QString::fromUtf8(data->AwayMessage.ptr);
            }
            if (!msg.isEmpty()) {
                res += "<br>";
                res += quoteString(msg);
            }
        }
    }
    return res;
}
Ejemplo n.º 9
0
void AddContactDialog::addContact()
{
    QList<QVariant> contactData = contactInfo();
    emit submitContact(contactData);
    emit updateGroup(contactData.at(0).toString());
}
Ejemplo n.º 10
0
		ContactNode::ContactNode(std::string uid, int period) :
				SensorNode(contactInfo(uid), period) {
		}
Ejemplo n.º 11
0
void Skype::skypeMessage(const QString &message) {
	kdDebug(14311) << k_funcinfo << endl;//some debug info

	QString messageType = message.section(' ', 0, 0).stripWhiteSpace().upper();//get the first part of the message
	if (messageType == "CONNSTATUS") {//the connection status
		QString value = message.section(' ', 1, 1).stripWhiteSpace().upper();//get the second part of the message
		if (value == "OFFLINE")
			d->connStatus = csOffline;
		else if (value == "CONNECTING")
			d->connStatus = csConnecting;
		else if (value == "PAUSING")
			d->connStatus = csPausing;
		else if (value == "ONLINE")
			d->connStatus = csOnline;
		else if (value == "LOGGEDOUT")
			d->connStatus = csLoggedOut;

		resetStatus();//set new status
	} else if (messageType == "USERSTATUS") {//Status of this user
		QString value = message.section(' ', 1, 1).stripWhiteSpace().upper();//get the second part
		if (value == "UNKNOWN")
			d->onlineStatus = usUnknown;
		else if (value == "OFFLINE")
			d->onlineStatus = usOffline;
		else if (value == "ONLINE")
			d->onlineStatus = usOnline;
		else if (value == "SKYPEME")
			d->onlineStatus = usSkypeMe;
		else if (value == "AWAY")
			d->onlineStatus = usAway;
		else if (value == "NA")
			d->onlineStatus = usNA;
		else if (value == "DND")
			d->onlineStatus = usDND;
		else if (value == "INVISIBLE")
			d->onlineStatus = usInvisible;

		resetStatus();
	} else if (messageType == "USERS") {//some user info
		QString theRest = message.section(' ', 1).stripWhiteSpace();//take the rest
		if (d->searchFor == "FRIENDS") {//it was initial search for al users
			QStringList names = QStringList::split(",", theRest);//divide it into names by comas
			kdDebug(14311) << "Names: " << names << endl;//write what you have done with that
			for (QStringList::iterator it = names.begin(); it != names.end(); ++it) {//run trough the names
				QString name = (*it).stripWhiteSpace();//get the name only
				if (name.isEmpty())
					continue;//just skip the empty names
				emit newUser(name);//add the user to list
			}
			if (d->scanForUnread)
				search("MISSEDMESSAGES");
		}
	} else if (messageType == "USER") {//This is for some contact
		const QString &contactId = message.section(' ', 1, 1);//take the second part, it is the user name
		const QString &type = message.section(' ', 2, 2).stripWhiteSpace().upper();//get what it is
		if ((type == "FULLNAME") || (type == "DISPLAYNAME") || (type == "SEX") ||
			(type == "PHONE_HOME") || (type == "PHONE_OFFICE") ||
			(type == "PHONE_MOBILE") ||
			(type == "ONLINESTATUS") || (type == "BUDDYSTATUS") || (type == "HOMEPAGE")) {
			const QString &info = message.section(' ', 2);//and the rest is just the message for that contact
			emit contactInfo(contactId, info);//and let the contact know
		} else kdDebug(14311) << "Unknown message for contact, ignored" << endl;
	} else if (messageType == "CHATMESSAGE") {//something with message, maebe incoming/sent
		QString messageId = message.section(' ', 1, 1).stripWhiteSpace();//get the second part of message - it is the message ID
		QString type = message.section(' ', 2, 2).stripWhiteSpace().upper();//This part significates what about the message are we talking about (status, body, etc..)
		QString chatMessageType = (d->connection % QString("GET CHATMESSAGE %1 TYPE").arg(messageId)).section(' ', 3, 3).stripWhiteSpace().upper();
		if (chatMessageType == "ADDEDMEMBERS") {
			QString status = message.section(' ', 3, 3).stripWhiteSpace().upper();
			if (d->recvMessages.find(messageId) != d->recvMessages.end())
				return;
			d->recvMessages << messageId;
			const QString &users = (d->connection % QString("GET CHATMESSAGE %1 USERS").arg(messageId)).section(' ', 3).stripWhiteSpace();
			QStringList splitUsers = QStringList::split(' ', users);
			const QString &chatId = (d->connection % QString("GET CHATMESSAGE %1 CHATNAME").arg(messageId)).section(' ', 3, 3).stripWhiteSpace();
			for (QStringList::iterator it = splitUsers.begin(); it != splitUsers.end(); ++it) {
				if ((*it).upper() == getMyself().upper())
					continue;
				emit joinUser(chatId, *it);
			}
			return;
		} else if (chatMessageType == "LEFT") {
			QString status = message.section(' ', 3, 3).stripWhiteSpace().upper();
			if (d->recvMessages.find(messageId) != d->recvMessages.end())
				return;
			d->recvMessages << messageId;
			const QString &chatId = (d->connection % QString("GET CHATMESSAGE %1 CHATNAME").arg(messageId)).section(' ', 3, 3).stripWhiteSpace();
			const QString &chatType = (d->connection % QString("GET CHAT %1 STATUS").arg(chatId)).section(' ', 3, 3).stripWhiteSpace().upper();
			if ((chatType == "DIALOG") || (chatType == "LEGACY_DIALOG"))
				return;
			const QString &user = (d->connection % QString("GET CHATMESSAGE %1 FROM_HANDLE").arg(messageId)).section(' ', 3, 3).stripWhiteSpace();
			const QString &reason = (d->connection % QString("GET CHATMESSAGE %1 LEAVEREASON").arg(messageId)).section(' ', 3, 3).stripWhiteSpace().upper();
			QString showReason = i18n("Unknown");
			if (reason == "USER_NOT_FOUND") {
				showReason = i18n("User not found");
			} else if (reason == "USER_INCAPABLE") {
				showReason = i18n("Does not have multi-user chat capability");
			} else if ((reason == "ADDER_MUST_BE_FRIEND") || ("ADDER_MUST_BE_AUTHORIZED")) {
				showReason = i18n("Chat denied");
			} else if (reason == "UNSUBSCRIBE") {
				showReason = "";
			}
			if (user.upper() == getMyself().upper())
				return;
			emit leftUser(chatId, user, showReason);
			return;
		}
		if (type == "STATUS") {//OK, status of some message has changed, check what is it
			QString value = message.section(' ', 3, 3).stripWhiteSpace().upper();//get the last part, what status it is
			if (value == "RECEIVED") {//OK, received new message, possibly read it
				if (chatMessageType == "SAID") {//OK, it is some IM
					hitchHike(messageId);//receive the message
				}
			} else if (value == "SENDING") {
				if ((d->connection % QString("GET CHATMESSAGE %1 TYPE").arg(messageId)).section(' ', 3, 3).stripWhiteSpace().upper() == "SAID") {
					emit gotMessageId(messageId);
				}
			} else if (value == "SENT") {//Sendign out some message, that means it is a new one
				if ((d->connection % QString("GET CHATMESSAGE %1 TYPE").arg(messageId)).section(' ', 3, 3).stripWhiteSpace().upper() == "SAID")//it is some message I'm interested in
					emit gotMessageId(messageId);//Someone may be interested in its ID
					if (d->recvMessages.find(messageId) != d->recvMessages.end())
						return;//we already got this one
					d->recvMessages << messageId;
					const QString &chat = (d->connection % QString("GET CHATMESSAGE %1 CHATNAME").arg(messageId)).section(' ', 3, 3).stripWhiteSpace();
					const QString &body = (d->connection % QString("GET CHATMESSAGE %1 BODY").arg(messageId)).section(' ', 3);
					if (!body.isEmpty())//sometimes skype shows empty messages, just ignore them
						emit outgoingMessage(body, chat);
			}
		}
	} else if (messageType == "CHATMESSAGES") {
		if (d->searchFor == "MISSEDMESSAGES") {//Theese are messages we did not read yet
			QStringList messages = QStringList::split(' ', message.section(' ', 1));//get the meassage IDs
			for (QStringList::iterator it = messages.begin(); it != messages.end(); ++it) {
				QString Id = (*it).stripWhiteSpace();
				if (Id.isEmpty())
					continue;
				skypeMessage(QString("CHATMESSAGE %1 STATUS RECEIVED").arg(Id));//simulate incoming message notification
			}
		}
	} else if (messageType == "CALL") {
		const QString &callId = message.section(' ', 1, 1).stripWhiteSpace();
		if (message.section(' ', 2, 2).stripWhiteSpace().upper() == "CONF_ID") {
			if (d->knownCalls.findIndex(callId) == -1) {//new call
				d->knownCalls << callId;
				const QString &userId = (d->connection % QString("GET CALL %1 PARTNER_HANDLE").arg(callId)).section(' ', 3, 3).stripWhiteSpace();
				emit newCall(callId, userId);
			}
			const QString &confId = message.section(' ', 3, 3).stripWhiteSpace().upper();
			if (confId != "0") {//It is an conference
				emit groupCall(callId, confId);
			}
		}
		if (message.section(' ', 2, 2).stripWhiteSpace().upper() == "STATUS") {
			if (d->knownCalls.findIndex(callId) == -1) {//new call
				d->knownCalls << callId;
				const QString &userId = (d->connection % QString("GET CALL %1 PARTNER_HANDLE").arg(callId)).section(' ', 3, 3).stripWhiteSpace();
				emit newCall(callId, userId);
			}
			const QString &status = message.section(' ', 3, 3).stripWhiteSpace().upper();
			if (status == "FAILED") {
				int reason = (d->connection % QString("GET CALL %1 FAILUREREASON").arg(callId)).section(' ', 3, 3).stripWhiteSpace().toInt();
				QString errorText = i18n("Unknown error");
				switch (reason) {
					case 1:
						errorText = i18n("Misc error");
						break;
					case 2:
						errorText = i18n("User or phone number does not exist");
						break;
					case 3:
						errorText = i18n("User is offline");
						break;
					case 4:
						errorText = i18n("No proxy found");
						break;
					case 5:
						errorText = i18n("Session terminated");
						break;
					case 6:
						errorText = i18n("No common codec found");
						break;
					case 7:
						errorText = i18n("Sound I/O error");
						break;
					case 8:
						errorText = i18n("Problem with remote sound device");
						break;
					case 9:
						errorText = i18n("Call blocked by recipient");
						break;
					case 10:
						errorText = i18n("Recipient not a friend");
						break;
					case 11:
						errorText = i18n("User not authorized by recipient");
						break;
					case 12:
						errorText = i18n("Sound recording error");
						break;
				}
				emit callError(callId, errorText);
			}
			emit callStatus(callId, status);
		}
	} else if (messageType == "CURRENTUSERHANDLE") {
		QString user = message.section(' ', 1, 1).stripWhiteSpace();
		QString name = (d->connection % QString("GET USER %1 DISPLAYNAME").arg(user)).section(' ', 3).stripWhiteSpace();
		if (name.isEmpty())
			name = (d->connection % QString("GET USER %1 FULLNAME").arg(user)).section(' ', 3).stripWhiteSpace();
		if (name.isEmpty())
			name = user;
		emit setMyselfName(name);
	}
}
Ejemplo n.º 12
0
    ContactWidget::ContactWidget(QWidget* _parent, std::shared_ptr<Logic::contact_profile> _profile, const std::map<QString, QString>& _countries)
        :QWidget(_parent),
        profile_(_profile),
        name_(new TextEmojiWidget(this, Fonts::appFontScaled(18), CommonStyle::getColor(CommonStyle::Color::TEXT_PRIMARY))),
        info_(new TextEmojiWidget(this, Fonts::appFontScaled(14), CommonStyle::getColor(CommonStyle::Color::TEXT_SECONDARY))),
        addButton_(new QPushButton(this)),
        callButton_(new QPushButton(this)),
        msgButton_(new QPushButton(this))
    {
        Utils::grabTouchWidget(this);

        setFixedSize(Utils::scale_value(widget_width), Utils::scale_value(widget_height));

        QHBoxLayout* rootLayout = Utils::emptyHLayout();
        rootLayout->setAlignment(Qt::AlignLeft);

        const QString displayName = _profile->get_contact_name();

        auto avatarWidget = new ContactAvatarWidget(
            this,
            _profile->get_aimid(),
            displayName,
            Utils::scale_value(widget_height),
            false);

        avatarWidget->setCursor(QCursor(Qt::PointingHandCursor));

        rootLayout->addWidget(avatarWidget);

        Utils::grabTouchWidget(avatarWidget);

        QVBoxLayout* infoLayout = Utils::emptyVLayout();
        infoLayout->setContentsMargins(Utils::scale_value(12), 0, 0, 0);
        infoLayout->setAlignment(Qt::AlignTop);

        name_->setObjectName(qsl("contact_name"));
        name_->setFading(true);
        name_->setText(_profile->get_contact_name());
        infoLayout->addWidget(name_);
        Utils::grabTouchWidget(name_);

        info_->setObjectName(qsl("contact_info"));
        info_->setText(getContactInfo(_profile, _countries));
        infoLayout->addWidget(info_);
        Utils::grabTouchWidget(info_);

        QHBoxLayout* buttonsLayout = new QHBoxLayout();
        buttonsLayout->setSpacing(Utils::scale_value(12));
        buttonsLayout->setAlignment(Qt::AlignLeft);

        Logic::ContactItem* contactItem = Logic::getContactListModel()->getContactItem(profile_->get_aimid());

        addButton_->setObjectName(qsl("add_contact_button"));
        addButton_->setVisible(!contactItem);
        addButton_->setCursor(QCursor(Qt::PointingHandCursor));
        buttonsLayout->addWidget(addButton_);
        Utils::grabTouchWidget(addButton_);

        msgButton_->setVisible(!!contactItem);
        msgButton_->setObjectName(qsl("msg_contact_button"));
        msgButton_->setCursor(QCursor(Qt::PointingHandCursor));
        buttonsLayout->addWidget(msgButton_);
        Utils::grabTouchWidget(msgButton_);

        callButton_->setVisible(!!contactItem);
        callButton_->setObjectName("call_contact_button");
        callButton_->setCursor(QCursor(Qt::PointingHandCursor));
        buttonsLayout->addWidget(callButton_);
        Utils::grabTouchWidget(callButton_);

        infoLayout->addLayout(buttonsLayout);

        rootLayout->addLayout(infoLayout);

        setLayout(rootLayout);

        connect(addButton_, &QPushButton::clicked, [this]()
        {
            emit addContact(profile_->get_aimid());
        });

        connect(msgButton_, &QPushButton::clicked, [this]()
        {
            emit msgContact(profile_->get_aimid());
        });

        connect(callButton_, &QPushButton::clicked, [this]()
        {
            emit callContact(profile_->get_aimid());
        });

        connect(avatarWidget, &ContactAvatarWidget::clickedInternal, [this]()
        {
            emit contactInfo(profile_->get_aimid());
        });
    }