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


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

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


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

示例1: phoneCall

void SMSClient::phoneCall(const QString &number)
{
    if (m_call && (number == m_callNumber))
        return;
    if (m_call){
        m_callTimer->stop();
        Event e(EventMessageDeleted, m_call);
        e.process();
        delete m_call;
        m_call = NULL;
    }
    m_callNumber = number;
    m_call = new Message(MessagePhoneCall);
    if (!number.isEmpty()){
        bool bNew = false;
        Contact *contact = getContacts()->contactByPhone(number.latin1());
        if (contact->getFlags() & CONTACT_TEMPORARY){
            bNew = true;
            contact->setFlags(contact->getFlags() & ~CONTACT_TEMPORARY);
            contact->setName(number);
        }
        QString phones = contact->getPhones();
        bool bFound = false;
        while (!phones.isEmpty()){
            QString item = getToken(phones, ';', false);
            QString phone = getToken(item, ',');
            if (number == phone){
                bFound = true;
                break;
            }
        }
        if (!bFound){
            phones = contact->getPhones();
            if (!phones.isEmpty())
                phones += ";";
            contact->setPhones(phones + number + ",,2/-");
        }
        if (bNew){
            Event e(EventContactChanged, contact);
            e.process();
        }
        m_call->setContact(contact->id());
    }
    m_call->setFlags(MESSAGE_RECEIVED | MESSAGE_TEMP);
    Event e(EventMessageReceived, m_call);
    if (e.process()){
        m_call = NULL;
        return;
    }
    m_bCall = false;
    m_callTimer->start(12000);
}
开发者ID:BackupTheBerlios,项目名称:sim-im-svn,代码行数:52,代码来源:sms.cpp

示例2: phonebookEntry

void SMSClient::phonebookEntry(int index, int type, const QString &phone, const QString &name)
{
    bool bNew = false;
    Contact *contact;
    ContactList::ContactIterator it;
    while ((contact = ++it) != NULL){
        smsUserData *data;
        ClientDataIterator itd(contact->clientData);
        while ((data = (smsUserData*)(++itd)) != NULL){
            if (name == QString::fromUtf8(data->Name.ptr))
                break;
        }
        if (data)
            break;
    }
    if (contact == NULL){
        contact = getContacts()->contactByPhone(phone.latin1());
        if (contact->getFlags() & CONTACT_TEMPORARY){
            bNew = true;
            contact->setFlags(contact->getFlags() & ~CONTACT_TEMPORARY);
            contact->setName(name);
        }
    }
    QString phones = contact->getPhones();
    bool bFound = false;
    while (!phones.isEmpty()){
        QString item = getToken(phones, ';', false);
        QString number = getToken(item, ',');
        if (number == phone){
            bFound = true;
            break;
        }
    }
    if (!bFound){
        phones = contact->getPhones();
        if (!phones.isEmpty())
            phones += ";";
        contact->setPhones(phones + phone + ",,2/-");
    }
    smsUserData *data = (smsUserData*)contact->clientData.createData(this);
    set_str(&data->Phone.ptr, phone.utf8());
    set_str(&data->Name.ptr, name.utf8());
    data->Index.value = index;
    data->Type.value  = type;
    if (bNew){
        Event e(EventContactChanged, contact);
        e.process();
    }
}
开发者ID:BackupTheBerlios,项目名称:sim-im-svn,代码行数:49,代码来源:sms.cpp

示例3: closed

UserWnd::~UserWnd()
{
    emit closed(this);
    free_data(userWndData, &data);
    Contact *contact = getContacts()->contact(id());
    if (contact && (contact->getFlags() & CONTACT_TEMPORARY)){
        m_id = 0;
        delete contact;
    }
}
开发者ID:BackupTheBerlios,项目名称:sim-im-svn,代码行数:10,代码来源:userwnd.cpp

示例4: getContacts

ContactDragObject::~ContactDragObject()
{
    ListView *view = static_cast<ListView*>(parent());
    if (view && view->m_pressedItem){
        QTreeWidgetItem *item = view->m_pressedItem;
        view->m_pressedItem = NULL;
    }
    Contact *contact = getContacts()->contact(m_id);
    if (contact && (contact->getFlags() & CONTACT_DRAG))
        delete contact;
}
开发者ID:BackupTheBerlios,项目名称:sim-im-svn,代码行数:11,代码来源:listview.cpp

示例5: getContacts

ContactDragObject::~ContactDragObject()
{
    ListView *view = static_cast<ListView*>(parent());
    if (view && view->m_pressedItem){
        //ListViewItem *item = view->m_pressedItem;
        view->m_pressedItem = NULL;
        //view->update(view->model()->index(item->row(), item->column()));
        view->update();
    }
    Contact *contact = getContacts()->contact(m_id);
    if (contact && (contact->getFlags() & CONTACT_DRAG))
        delete contact;
}
开发者ID:BackupTheBerlios,项目名称:sim-im-svn,代码行数:13,代码来源:listview.cpp

示例6: e

void *FilterPlugin::processEvent(Event *e)
{
    if (e->type() == EventMessageReceived){
        Message *msg = (Message*)(e->param());
        if (!msg || (msg->type() == MessageStatus))
            return NULL;
        Contact *contact = getContacts()->contact(msg->contact());
        FilterUserData *data = NULL;
        // check if we accept only from users on the list
        if (getFromList() && ((contact == NULL) || (contact->getFlags() & CONTACT_TEMPORARY))){
            delete msg;
            delete contact;
            return msg;
        }
        if (!contact)
            return NULL;
        // check if the user is a ignored user
        if (contact->getIgnore()){
            delete msg;
            return msg;
        }
        // get filter-data
        data = (FilterUserData*)(contact->getUserData(user_data_id));
        if (data && data->SpamList.ptr && *data->SpamList.ptr){
            if (checkSpam(msg->getPlainText(), QString::fromUtf8(data->SpamList.ptr))){
                delete msg;
                return msg;
            }
        }
        return NULL;
    }
    if (e->type() == EventCheckState){
        CommandDef *cmd = (CommandDef*)(e->param());
        if (cmd->id == CmdIgnore){
            cmd->flags &= ~BTN_HIDE;
            Contact *contact = getContacts()->contact((unsigned)(cmd->param));
            if (contact && contact->getGroup())
                cmd->flags |= BTN_HIDE;
            return e->param();
        }
        if (cmd->id == CmdIgnoreText){
            cmd->flags &= ~COMMAND_CHECKED;
            if (cmd->menu_id == MenuMsgView){
                MsgViewBase *edit = (MsgViewBase*)(cmd->param);
                if (edit->hasSelectedText())
                    return e->param();
            }else if (cmd->menu_id == MenuTextEdit){
                TextEdit *edit = ((MsgEdit*)(cmd->param))->m_edit;
                if (edit->hasSelectedText())
                    return e->param();
            }
            return NULL;
        }
        if (cmd->menu_id == MenuContactGroup){
            if (cmd->id == CmdIgnoreList){
                Contact *contact = getContacts()->contact((unsigned)(cmd->param));
                if (contact == NULL)
                    return NULL;
                cmd->flags &= COMMAND_CHECKED;
                if (contact->getIgnore())
                    cmd->flags |= COMMAND_CHECKED;
                return e->param();
            }
        }
    }
    if (e->type() == EventCommandExec){
        CommandDef *cmd = (CommandDef*)(e->param());
        if (cmd->id == CmdIgnore){
            Contact *contact = getContacts()->contact((unsigned)(cmd->param));
            if (contact){
                QString text = i18n("Add %1 to ignore list?") .arg(contact->getName());
                Command cmd;
                cmd->id		= CmdIgnore;
                cmd->param	= (void*)(contact->id());
                Event e(EventCommandWidget, cmd);
                QWidget *w = (QWidget*)(e.process());
                BalloonMsg::ask((void*)(contact->id()), text, w, SLOT(addToIgnore(void*)), NULL, NULL, this);
            }
            return e->param();
        }
开发者ID:,项目名称:,代码行数:80,代码来源:

示例7: processEvent

bool FilterPlugin::processEvent(Event *e)
{
    switch (e->type()) {
    case eEventContact: {
        EventContact *ec = static_cast<EventContact*>(e);
        if(ec->action() != EventContact::eChanged)
            break;
        Contact *contact = ec->contact();
        if (contact->getGroup()){
            Command cmd;
            cmd->id		= CmdIgnore;
            cmd->flags	= BTN_HIDE;
            cmd->param  = (void*)(contact->id());
            EventCommandShow(cmd).process();
        }
        break;
    }
    case eEventPluginLoadConfig:
    {
        setPropertyHub( ProfileManager::instance()->getPropertyHub("filter") );
        break;
    }
    case eEventMessageReceived: {
        EventMessage *em = static_cast<EventMessage*>(e);
        Message *msg = em->msg();
        if (!msg || (msg->type() == MessageStatus))
            return false;
        Contact *contact = getContacts()->contact(msg->contact());
        PropertyHubPtr data = contact->getUserData("filter");
        // check if we accept only from users on the list
        if (((contact == NULL) || contact->getFlags() & CONTACT_TEMPORARY) &&
                        ((value("FromList").toBool() &&
			  msg->type() != MessageAuthRequest &&
			  msg->type() != MessageAuthGranted &&
			  msg->type() != MessageAuthRefused) ||
                (value("AuthFromList").toBool() && msg->type() <= MessageContacts))) {
            delete msg;
            delete contact;
            return msg;
        }
        if (!contact)
            return false;
        // check if the user is a ignored user
        if (contact->getIgnore()){
            delete msg;
            return true;
        }

        // get filter-data
		if (data && !data->value("SpamList").toString().isEmpty() && (!contact || (contact->getFlags() & CONTACT_TEMPORARY) )) {
            if (checkSpam(msg->getPlainText(), data->value("SpamList").toString())){
                delete msg;
                return true;
            }
		}
        break;
    }
    case eEventCheckCommandState: {
        EventCheckCommandState *ecs = static_cast<EventCheckCommandState*>(e);
        CommandDef *cmd = ecs->cmd();
        if (cmd->id == CmdIgnore){
            cmd->flags &= ~BTN_HIDE;
            Contact *contact = getContacts()->contact((unsigned long)(cmd->param));
            if (contact && contact->getGroup())
                cmd->flags |= BTN_HIDE;
            return true;
        }
        if (cmd->id == CmdIgnoreText){
            cmd->flags &= ~COMMAND_CHECKED;
            if (cmd->menu_id == MenuMsgView){
                MsgViewBase *edit = (MsgViewBase*)(cmd->param);
                if (edit->textCursor().hasSelection())
                    return true;
            } else
            /*if (cmd->menu_id == MenuTextEdit){
                TextEdit *edit = ((MsgEdit*)(cmd->param))->m_edit;
                if (edit->textCursor().hasSelection())
                    return true;
            }*/							//Fixme Block (crashing on rightclick in msgedit from container)
            return false;
        }
        if (cmd->menu_id == MenuContactGroup){
            if (cmd->id == CmdIgnoreList){
                Contact *contact = getContacts()->contact((unsigned long)(cmd->param));
                if (contact == NULL)
                    return false;
                cmd->flags &= COMMAND_CHECKED;
                if (contact->getIgnore())
                    cmd->flags |= COMMAND_CHECKED;
                return true;
            }
        }
        break;
    }
    case eEventCommandExec: {
        EventCommandExec *ece = static_cast<EventCommandExec*>(e);
        CommandDef *cmd = ece->cmd();
        if (cmd->id == CmdIgnore){
            Contact *contact = getContacts()->contact((unsigned long)(cmd->param));
            if (contact){
//.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:sim-im,代码行数:101,代码来源:filter.cpp


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