当前位置: 首页>>代码示例>>C++>>正文


C++ Contact::getName方法代码示例

本文整理汇总了C++中Contact::getName方法的典型用法代码示例。如果您正苦于以下问题:C++ Contact::getName方法的具体用法?C++ Contact::getName怎么用?C++ Contact::getName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Contact的用法示例。


在下文中一共展示了Contact::getName方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: addContactToRoster

bool MySqlStorage::addContactToRoster(QString jid, Contact contact)
{
    if (contactExists(jid, contact.getJid()))
    {
        updateNameToContact(jid, contact.getJid(), contact.getName());
        updateGroupToContact(jid, contact.getJid(), contact.getGroups());
        return true;
    }
    else
    {
        if (userExists(contact.getJid()))
        {
            QJsonDocument document;
            QJsonObject object;
            object.insert("groups", QJsonArray::fromStringList(QStringList::fromSet(contact.getGroups())));
            document.setObject(object);

            QSqlQuery query;
            query.prepare("INSERT INTO qjabberd_contact(user_id, approved, ask, groups, jid, name, subscription, version)"
                          " VALUES(:user_id, :approved, :ask, :groups, :jid, :name, :subscription, :version)");
            query.bindValue(":user_id", getUserId(jid));
            query.bindValue(":version", contact.getVersion());
            query.bindValue(":approved", (int)contact.getApproved());
            query.bindValue(":ask", contact.getAsk());
            query.bindValue(":jid", contact.getJid());
            query.bindValue(":name", contact.getName());
            query.bindValue(":subscription", contact.getSubscription());
            query.bindValue(":groups", document.toJson());
            return query.exec();
        }
    }
    return false;
}
开发者ID:tatiotir,项目名称:QJabberd,代码行数:33,代码来源:MySqlStorage.cpp

示例2: processQueue

void OSDPlugin::processQueue()
{
    if (m_timer->isActive())
        return;
    while (queue.size()){
        m_request = queue.front();
        QString text;
        Contact *contact = getContacts()->contact(m_request.contact);
        OSDUserData *data = NULL;
        if (contact){
            data = (OSDUserData*)contact->getUserData(user_data_id);
        }else{
            data = (OSDUserData*)getContacts()->getUserData(user_data_id);
        }
        switch (m_request.type){
        case OSD_ALERT:
            if (data->EnableAlert.bValue && contact)
                text = i18n("%1 is online") .arg(contact->getName());
            break;
        case OSD_TYPING:
            if (data->EnableTyping.bValue && contact)
                text = i18n("%1 typed") .arg(contact->getName());
            break;
        default:
            if (data->EnableMessage.bValue && core){
                unsigned type = m_request.type;
                CommandDef *cmd = core->messageTypes.find(type);
                if (cmd){
                    MessageDef *def = (MessageDef*)(cmd->param);
                    text = i18n(def->singular, def->plural, 1);
                    int pos = text.find("1 ");
                    if (pos > 0){
                        text = text.left(pos);
                    }else if (pos == 0){
                        text = text.mid(2);
                    }
                    text = text.left(1).upper() + text.mid(1);
                    if (contact)
                        text = i18n("%1 from %2")
                               .arg(text)
                               .arg(contact->getName());
                }
            }
        }
        if (!text.isEmpty()){
            if (m_osd == NULL){
                m_osd = new OSDWidget;
                connect(m_osd, SIGNAL(dblClick()), this, SLOT(dblClick()));
            }
            static_cast<OSDWidget*>(m_osd)->showOSD(text, data);
            m_timer->start(data->Timeout.value * 1000);
            queue.erase(queue.begin());
            break;
        }
        queue.erase(queue.begin());
    }
}
开发者ID:,项目名称:,代码行数:57,代码来源:

示例3: disconnectPortFromTopic

bool RosNameSpace::disconnectPortFromTopic(const Contact& src,
                                           const Contact& dest,
                                           ContactStyle style) {
    Bottle cmd;
    cmd.addString("unregisterPublisher");
    cmd.addString(toRosNodeName(src.getName()));
    cmd.addString(dest.getName());
    cmd.addString(rosify(src).toString());
    return connectTopic(cmd, false, src, dest, style, false);
}
开发者ID:jgvictores,项目名称:yarp,代码行数:10,代码来源:RosNameSpace.cpp

示例4: disconnectTopicFromPort

bool RosNameSpace::disconnectTopicFromPort(const Contact& src,
                                           const Contact& dest,
                                           ContactStyle style) {
    Bottle cmd;
    cmd.addString("unregisterSubscriber");
    cmd.addString(toRosNodeName(dest.getName()));
    cmd.addString(src.getName());
    cmd.addString(rosify(dest).toString());
    return connectTopic(cmd, true, src, dest, style, false);
}
开发者ID:jgvictores,项目名称:yarp,代码行数:10,代码来源:RosNameSpace.cpp

示例5: setNameServerContact

bool NetworkBase::setNameServerContact(Contact &nameServerContact)
{
    NameConfig nameConfig;
    if (nameServerContact.getName() != "")
        setNameServerName(nameServerContact.getName());
    nameConfig.fromFile();
    nameConfig.setAddress(nameServerContact);
    bool result = nameConfig.toFile();
    getNameSpace().activate(true);
    return result;
}
开发者ID:giuliavezzani,项目名称:yarp,代码行数:11,代码来源:Network.cpp

示例6: noteDud

static int noteDud(const Contact& src) {
    NameStore *store = getNameSpace().getQueryBypass();
    if (store!=YARP_NULLPTR) {
        return store->announce(src.getName().c_str(),0);
    }
    Bottle cmd, reply;
    cmd.addString("announce");
    cmd.addString(src.getName().c_str());
    cmd.addInt(0);
    ContactStyle style;
    bool ok = NetworkBase::writeToNameServer(cmd,
                                             reply,
                                             style);
    return ok?0:1;
 }
开发者ID:giuliavezzani,项目名称:yarp,代码行数:15,代码来源:Network.cpp

示例7: getLongName

QString UserWnd::getLongName()
{
	QString res;
    Contact *contact = getContacts()->contact(m_id);
    res = contact->getName();
    void *data;
    Client *client = m_edit->client(data, false);
	if (client && data){
		res += " ";
        res += client->contactName(data);
		bool bFrom = false;
		for (unsigned i = 0; i < getContacts()->nClients(); i++){
			Client *pClient = getContacts()->getClient(i);
			if (pClient == client)
				continue;
			Contact *contact;
			clientData *data1 = (clientData*)data;
			if (pClient->isMyData(data1, contact)){
				bFrom = true;
				break;
			}
		}
		if (bFrom){
			res += " ";
			if (m_edit->m_bReceived){
				res += i18n("to %1") .arg(client->name().c_str());
			}else{
				res += i18n("from %1") .arg(client->name().c_str());
			}
		}
	}
	return res;
}
开发者ID:,项目名称:,代码行数:33,代码来源:

示例8: registerContact

Contact YarpNameSpace::registerContact(const Contact& contact) {
    NameClient& nic = HELPER(this);
    Contact address = nic.registerName(contact.getName().c_str(),
                                       contact);
    if (address.isValid()) {
        NestedContact nc;
        nc.fromString(address.getRegName().c_str());
        std::string cat = nc.getCategory();
        if (nc.getNestedName()!="") {
            //bool service = (cat.find("1") != std::string::npos);
            bool publish = (cat.find('+') != std::string::npos);
            bool subscribe = (cat.find('-') != std::string::npos);
            ContactStyle style;
            Contact c1(nc.getFullName());
            Contact c2(std::string("topic:/") + nc.getNestedName());
            if (subscribe) {
                style.persistenceType = ContactStyle::END_WITH_TO_PORT;
                connectPortToTopic(c2, c1, style);
            }
            if (publish) {
                style.persistenceType = ContactStyle::END_WITH_FROM_PORT;
                connectPortToTopic(c1, c2, style);
            }
        }
    }
    return address;
}
开发者ID:claudiofantacci,项目名称:yarp,代码行数:27,代码来源:YarpNameSpace.cpp

示例9: it

void *YahooClient::processEvent(Event *e)
{
    if (e->type() == EventContactChanged) {
        Contact *contact = (Contact*)(e->param());
        string grpName;
        string name;
        name = contact->getName().utf8();
        Group *grp = NULL;
        if (contact->getGroup())
            grp = getContacts()->group(contact->getGroup());
        if (grp)
            grpName = grp->getName().utf8();
        ClientDataIterator it(contact->clientData, this);
        YahooUserData *data;
        while ((data = (YahooUserData*)(++it)) != NULL) {
            moveBuddy(data, grpName.c_str());
        }
    }
    if (e->type() == EventContactDeleted) {
        Contact *contact = (Contact*)(e->param());
        ClientDataIterator it(contact->clientData, this);
        YahooUserData *data;
        while ((data = (YahooUserData*)(++it)) != NULL) {
            removeBuddy(data);
        }
    }
    if (e->type() == EventTemplateExpanded) {
        TemplateExpand *t = (TemplateExpand*)(e->param());
        sendStatus(YAHOO_STATUS_CUSTOM, t->tmpl.local8Bit());
    }
    return NULL;
}
开发者ID:,项目名称:,代码行数:32,代码来源:

示例10: setName

void HistoryWindow::setName()
{
    QString name;
    Contact *contact = getContacts()->contact(m_id);
    if (contact)
        name = contact->getName();
    setCaption(i18n("History") + " " + name);
}
开发者ID:,项目名称:,代码行数:8,代码来源:

示例11: reset

void DockWnd::reset()
{
    m_unread = NULL;
    QString oldUnreadText = m_unreadText;
    m_unreadText = "";
    MAP_COUNT count;
    MAP_COUNT::iterator itc;
    for (list<msg_id>::iterator it = m_plugin->core->unread.begin(); it != m_plugin->core->unread.end(); ++it){
        if (m_unread == NULL){
            CommandDef *def = m_plugin->core->messageTypes.find((*it).type);
            if (def)
                m_unread = def->icon;
        }
        msgIndex m;
        m.contact = (*it).contact;
        m.type    = (*it).type;
        itc = count.find(m);
        if (itc == count.end()){
            count.insert(MAP_COUNT::value_type(m, 1));
        }else{
            (*itc).second++;
        }
    }
    if (!count.empty()){
        for (itc = count.begin(); itc != count.end(); ++itc){
            CommandDef *def = m_plugin->core->messageTypes.find((*itc).first.type);
            if (def == NULL)
                continue;
            MessageDef *mdef = (MessageDef*)(def->param);
            QString msg = i18n(mdef->singular, mdef->plural, (*itc).second);

            Contact *contact = getContacts()->contact((*itc).first.contact);
            if (contact == NULL)
                continue;
            msg = i18n("%1 from %2")
                  .arg(msg)
                  .arg(contact->getName());
#ifdef WIN32
            if (m_unreadText.length() + 2 + msg.length() >= 64){
                m_unreadText += "...";
                break;
            }
#endif

            if (!m_unreadText.isEmpty())
#ifdef WIN32
                m_unreadText += ", ";
#else
                m_unreadText += "\n";
#endif
            m_unreadText += msg;
        }
    }
    if (m_unread && !blinkTimer->isActive())
        blinkTimer->start(1500);
    if (m_unreadText != oldUnreadText)
        setTip(m_tip);
}
开发者ID:,项目名称:,代码行数:58,代码来源:

示例12: addOutput

bool Port::addOutput(const Contact& contact) {
    PortCoreAdapter& core = HELPER(implementation);
    if (core.isInterrupted()) return false;
    if (!core.isListening()) {
        return core.addOutput(contact.toString().c_str(),NULL,NULL,true);
    }
    Contact me = where();
    return NetworkBase::connect(me.getName().c_str(),
                                contact.toString().c_str());
}
开发者ID:johnty,项目名称:libYARP_OS_iOS,代码行数:10,代码来源:Port.cpp

示例13: testOpen

    void testOpen() {
        report(0,"checking opening and closing ports");
        Port out, in;

        in.open("/in");
        out.open(Contact::bySocket("tcp","",safePort()));

        Contact conIn = in.where();
        Contact conOut = out.where();

        checkTrue(conIn.isValid(),"valid address for /in");
        checkTrue(conOut.isValid(),"valid address for /out");

        out.addOutput(Contact::byName("/in").addCarrier("tcp"));
        //Time::delay(0.2);

        checkEqual(conIn.getName().c_str(),"/in","name is recorded");

        checkTrue(conOut.getName().find("/tmp")==0,
                  "name is created");

        Bottle bot1, bot2;
        bot1.fromString("5 10 \"hello\"");
        out.enableBackgroundWrite(true);
        out.write(bot1);
        in.read(bot2);
        checkEqual(bot1.get(0).asInt(),5,"check bot[0]");
        checkEqual(bot1.get(1).asInt(),10,"check bot[1]");
        checkEqual(bot1.get(2).asString().c_str(),"hello","check bot[2]");

        while (out.isWriting()) {
            printf("Waiting...\n");
            Time::delay(0.1);
        }

        bot1.fromString("18");
        out.write(bot1);
        in.read(bot2);
        checkEqual(bot1.get(0).asInt(),18,"check one more send/receive");

        in.close();
        out.close();
    }
开发者ID:JoErNanO,项目名称:yarp,代码行数:43,代码来源:PortTest.cpp

示例14: setTitle

void MainWindow::setTitle()
{
    QString title;
    Contact *owner = getContacts()->owner();
    if (owner)
        title = owner->getName();
    if (title.isEmpty())
        title = "SIM";
    setCaption(title);
}
开发者ID:BackupTheBerlios,项目名称:sim-im-svn,代码行数:10,代码来源:mainwin.cpp

示例15: getToken

static Message *dropContacts(QMimeSource *src)
{
    if (ContactDragObject::canDecode(src)){
        Contact *contact = ContactDragObject::decode(src);
        ContactsMessage *msg = new ContactsMessage;
        QString name = contact->getName();
        msg->setContacts(QString("sim:") + QString::number(contact->id()) + "," + getToken(name, '/'));
        return msg;
    }
    return NULL;
}
开发者ID:,项目名称:,代码行数:11,代码来源:


注:本文中的Contact::getName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。