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


C++ RosterItem类代码示例

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


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

示例1: Window

void
RosterView::MouseDown(BPoint point)
{
	Window()->Activate(true);
	uint32 buttons = 0;
	GetMouse(&point, &buttons);

	printf("buttons %i\n",buttons);

	if (buttons & B_SECONDARY_MOUSE_BUTTON)
	{
		RosterItem *item = CurrentItemSelection();
		if (item && !item->StalePointer())
		{
			UpdatePopUpMenu();
			BPoint screen_point(point);
			ConvertToScreen(&screen_point);
			BRect r(screen_point.x - 4, screen_point.y - 20, screen_point.x + 24, screen_point.y + 4);
			_popup->Go(screen_point, true, true, r, false);
		}
	} 
	
	BOutlineListView::MouseDown(point);

}
开发者ID:devaspot,项目名称:chat,代码行数:25,代码来源:RosterView.cpp

示例2: get_item

Resource *Roster::get_resource(const QString &full_jid, bool create) {
  QString jid, resource;
  int index = full_jid.indexOf("/");
  if(index == -1) {
    jid = full_jid;
    resource = "default";
  } else {
    jid = full_jid.left(index);
    resource = full_jid.mid(index + 1);
  }
  //qDebug() << "jid:" << jid << "resource:" << resource;
  RosterItem *item = get_item(jid);
  if(!item) {
    qDebug() << "no item for jid" + jid;
    return 0;
  }

  Resource *n = static_cast<Resource *>(item->child(resource));
  if(!n && create) {
    n = new Resource(resource, item);
    item->addChild(n);
  }

  return n;
}
开发者ID:sje397,项目名称:saje,代码行数:25,代码来源:Roster.cpp

示例3:

int32
RosterView::FindUser(UserID *compare_user)
{
	if (compare_user == NULL) return -1;
	for (int i=0; i<FullListCountItems(); ++i) {
		RosterItem *item = dynamic_cast<RosterItem *>(FullListItemAt(i));
		if (item == NULL || item->StalePointer()) continue;
		if (item->GetUserID() == compare_user) return i;
	}
	return -1;
}
开发者ID:devaspot,项目名称:chat,代码行数:11,代码来源:RosterView.cpp

示例4: i

RosterItem *RosterGroup::get_item(const QString &jid) const {
  RosterTreeNode *c = 0;
  QVectorIterator<RosterTreeNode *> i(children);
  while(i.hasNext()) {
    c = i.next();
    if(c->type() == RTNT_ITEM) {
      RosterItem *item = static_cast<RosterItem *>(c);
      if(item->getJID() == jid)
        return item;
    } else if(c->type() == RTNT_GROUP) {
      RosterItem *i = static_cast<RosterGroup *>(c)->get_item(jid);
      if(i) return i;
    }
  }
  return 0;
}
开发者ID:sje397,项目名称:saje,代码行数:16,代码来源:Roster.cpp

示例5: handleRosterPresence

void CMainFrame::handleRosterPresence( const RosterItem& item, const std::string& resource,
									  Presence::PresenceType presence, const std::string& msg ) 

{
	if(m_pBuddyList)
	{
		CBuddyListItem* buddy= m_pBuddyList->FindBuddyItem(item.jid());
		if(buddy)
		{
			bool online=buddy->IsOnline();
			buddy->SetPresence(presence);
			buddy->SetSignature(utf8dec(msg));
			if(online!=buddy->IsOnline())
			{
				buddy->SetHeader(GetContext()->GetHeaderManager().GetHeader(item.jid(),buddy->IsOnline()));
			}
		}
	}
}
开发者ID:page31,项目名称:GJTalk,代码行数:19,代码来源:MainFrame.cpp

示例6: handlePresence

  void RosterManager::handlePresence( const Presence& presence )
  {
    if( presence.subtype() == Presence::Error )
      return;

    bool self = false;
    Roster::iterator it = m_roster.find( presence.from().bare() );
    if( it != m_roster.end() || ( self = ( presence.from().bareJID() == m_self->jidJID() ) ) )
    {
      RosterItem* ri = self ? m_self : (*it).second;
      const std::string& resource = presence.from().resource();

      if( presence.presence() == Presence::Unavailable )
        ri->removeResource( resource );
      else
      {
        ri->setPresence( resource, presence.presence() );
        ri->setStatus( resource, presence.status() );
        ri->setPriority( resource, presence.priority() );
        ri->setExtensions( resource, presence.extensions() );
      }

      if( m_rosterListener && !self )
        m_rosterListener->handleRosterPresence( *ri, resource,
                                                presence.presence(), presence.status() );
      else if( m_rosterListener && self )
        m_rosterListener->handleSelfPresence( *ri, resource,
                                              presence.presence(), presence.status() );
    }
    else
    {
      if( m_rosterListener )
        m_rosterListener->handleNonrosterPresence( presence );
    }
  }
开发者ID:crazyit,项目名称:iGame,代码行数:35,代码来源:rostermanager.cpp

示例7: CurrentItemSelection

void
RosterView::UpdatePopUpMenu()
{
	RosterItem *item = CurrentItemSelection();

	if (item && !item->StalePointer())
	{
		const UserID *user = item->GetUserID();

		_change_user_item->SetEnabled(true);
		_remove_user_item->SetEnabled(true);
		
		if (user->OnlineStatus() != UserID::CONF_STATUS)
		{
			_presence->SetEnabled(true);
			
			if (user->HaveSubscriptionTo())
			{
				_subscribe_presence->SetEnabled(false);
				_unsubscribe_presence->SetEnabled(true);
			}
			else
			{
				_subscribe_presence->SetEnabled(true);
				_unsubscribe_presence->SetEnabled(false);
			}
		}
		else
		{
			_presence->SetEnabled(false);
		}
	}
	else
	{		
		_change_user_item->SetEnabled(false);
		_remove_user_item->SetEnabled(false);
		_presence->SetEnabled(false);
	}
}
开发者ID:devaspot,项目名称:chat,代码行数:39,代码来源:RosterView.cpp

示例8: xmlReadRoster

static Roster xmlReadRoster(const QDomElement &q, bool push)
{
	Roster r;

	for(QDomNode n = q.firstChild(); !n.isNull(); n = n.nextSibling()) {
		QDomElement i = n.toElement();
		if(i.isNull())
			continue;

		if(i.tagName() == "item") {
			RosterItem item;
			item.fromXml(i);

			if(push)
				item.setIsPush(true);

			r += item;
		}
	}

	return r;
}
开发者ID:stegmannt,项目名称:kopete-xep0280,代码行数:22,代码来源:xmpp_tasks.cpp

示例9: switch

void Client::importRosterItem(const RosterItem &item)
{
	QString substr;
	switch(item.subscription().type()) {
		case Subscription::Both:
			substr = "<-->";  break;
		case Subscription::From:
			substr = "  ->";  break;
		case Subscription::To:
			substr = "<-  ";  break;
		case Subscription::Remove:
			substr = "xxxx";  break;
		case Subscription::None:
		default:
			substr = "----";  break;
	}

	QString dstr, str;
	str.sprintf("  %s %-32s", substr.latin1(), item.jid().full().latin1());
	if(!item.name().isEmpty())
		str += QString(" [") + item.name() + "]";
	str += '\n';

	// Remove
	if(item.subscription().type() == Subscription::Remove) {
		LiveRoster::Iterator it = d->roster.find(item.jid());
		if(it != d->roster.end()) {
			rosterItemRemoved(*it);
			d->roster.remove(it);
		}
		dstr = "Client: (Removed) ";
	}
	// Add/Update
	else {
		LiveRoster::Iterator it = d->roster.find(item.jid());
		if(it != d->roster.end()) {
			LiveRosterItem &i = *it;
			i.setFlagForDelete(false);
			i.setRosterItem(item);
			rosterItemUpdated(i);
			dstr = "Client: (Updated) ";
                }
		else {
			LiveRosterItem i(item);
			d->roster += i;

			// signal it
			rosterItemAdded(i);
			dstr = "Client: (Added)   ";
		}
	}

	debug(dstr + str);
}
开发者ID:serghei,项目名称:kde3-kdenetwork,代码行数:54,代码来源:client.cpp

示例10: setRosterItem

void LiveRosterItem::setRosterItem(const RosterItem &i)
{
	setJid(i.jid());
	setName(i.name());
	setGroups(i.groups());
	setSubscription(i.subscription());
	setAsk(i.ask());
	setIsPush(i.isPush());
}
开发者ID:serghei,项目名称:kde3-kdenetwork,代码行数:9,代码来源:client.cpp

示例11: handleRosterPresence

	void handleRosterPresence( const RosterItem& item, const std::string& resource, Presence presence, const std::string& msg ) {

		jsval fval;
		if ( !JS_GetProperty(_cx, _obj, "onRosterPresence", &fval) || fval.isUndefined() )
			return;
		if ( !JL_ValueIsCallable(_cx, fval) ) {

			JS_ReportError(_cx, "onRosterPresence is not a function.");
			return;
		}

		jsval fromVal, presenceVal, msgVal, tmp;
		JidToJsval(_cx, &JID(item.jid()), &fromVal);
		JL_NativeToJsval(_cx, presence, &presenceVal);
		JL_NativeToJsval(_cx, msg.c_str(), &msgVal);

		jsval argv[] = { fromVal, presenceVal, msgVal };
		JS_CallFunctionValue(_cx, _obj, fval, COUNTOF(argv), argv, &tmp); // errors will be managed later by JL_IsExceptionPending(cx)
	}
开发者ID:BenitoJedai,项目名称:jslibs,代码行数:19,代码来源:jabber.cpp

示例12: switch

QVariant ContactModel::data(const QModelIndex &index, int role) const
{
    if (!index.parent().isValid()) {
        // Groups
        switch (role) {
        case Qt::DisplayRole:
            if(index.column()==0)
                return groups.keys().at(index.row());
        }
    } else {
        // Contacts
        ContactGroup *group = reinterpret_cast<ContactGroup *>(index.internalPointer());
        Contact contact = group->contacts.at(index.row());
        MAGNORMOBOT *bot = contact.conduit.data();
        switch (role) {
        case Qt::DisplayRole:
            if(index.column()==1)
                return bot->getNameFromJid(contact.jid);
        case Qt::DecorationRole:
            {
                RosterItem *item = bot->getRosterItemFromJid(contact.jid);
                if (!item)
                    return QIcon(":/icons/user-offline");
                if (!item->highestResource())
                    return QIcon(":/icons/user-offline");
                switch (item->highestResource()->presence()) {
                case Presence::Available:
                case Presence::Chat:
                    if(index.column()==1)
                        return QIcon(":/icons/user-online");
                    else {
                        return bot->getAccountIcon();
                    }
                case Presence::Away:
                case Presence::DND:
                case Presence::XA:
                    if(index.column()==1)
                        return QIcon(":/icons/user-away");
                    else {
                        return bot->getAccountIcon();
                    }
                default:
                    return QIcon(":/icons/user-offline");
                }
                break;
            }

        case Qt::ToolTipRole:
        case ContactModel::JIDRole:
            return contact.jid;

        case ContactModel::ContactRole:
            return QVariant::fromValue(contact);

        case ContactModel::PresenceRole:
            {
                RosterItem *item = bot->getRosterItemFromJid(contact.jid);
                if (!item)
                    return Presence::Unavailable;
                if (!item->highestResource())
                    return Presence::Unavailable;
                return item->highestResource()->presence();
            }
        }
    }
    return QVariant();
}
开发者ID:cbranch,项目名称:INSTANT-MAGNORMO,代码行数:67,代码来源:contactmodel.cpp

示例13: handleRosterPresence

void Core::handleRosterPresence(const RosterItem &item, const std::string &resource, Presence::PresenceType presence, const std::string &msg){
		write_string("You have received a status update of: " + item.jid() + " (" + msg + ")");
		// some bugs with item.jid(), check caracters issues
		update_roster_choice();
}		
开发者ID:ratsy,项目名称:Cptalk-,代码行数:5,代码来源:XMPP.cpp

示例14: handleRosterPresence

 virtual void handleRosterPresence( const RosterItem& item, const std::string& resource,
                                    Presence presence, const std::string& /*msg*/ )
 {
   printf( "presence received: %s/%s -- %d\n", item.jid().c_str(), resource.c_str(), presence );
 }
开发者ID:SupportSpace,项目名称:SupportCenter,代码行数:5,代码来源:roster_example.cpp

示例15: itemUnavailable

 virtual void itemUnavailable( const RosterItem& item, const std::string& /*msg*/ )
 {
   printf( "item offline: %s\n", item.jid().c_str() );
 };
开发者ID:SupportSpace,项目名称:SupportCenter,代码行数:4,代码来源:roster_test.cpp


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