예제 #1
0
void CSkypeProto::OnContactListChanged(const ContactRef &contact)
{
	bool result;

	contact->IsMemberOfHardwiredGroup(CContactGroup::ALL_BUDDIES, result);
	if (result)
	{
		if ( !this->contactList.contains(contact))
		{
			CContact::Ref newContact(contact);
			this->contactList.append(newContact);
			newContact.fetch();
		}
	}

	contact->IsMemberOfHardwiredGroup(CContactGroup::CONTACTS_WAITING_MY_AUTHORIZATION, result);
	if (result)
	{
		SEString data;

		uint newTS = 0;
		contact->GetPropAuthreqTimestamp(newTS);

		this->RaiseAuthRequestEvent(newTS, contact);
	}
}
예제 #2
0
   void testUpdateExistingUriNewContact()
      {
         UtlSList bindings;
         RegistrationBinding* binding;

         RegistrationDbTestContext testDbContext(TEST_DATA_DIR "/regdbdata",
                                                 TEST_WORK_DIR "/regdbdata"
                                                 );

         testDbContext.inputFile("updateBindings.xml");

         RegistrationDB* regDb = RegistrationDB::getInstance();

         // Get an existing binding
         Int64 seqOneUpdates = regDb->getNewUpdatesForRegistrar("seqOne", 2, bindings);
         CPPUNIT_ASSERT_EQUAL(1LL, seqOneUpdates);

         binding = (RegistrationBinding*)bindings.first();

         // Change the contact address
         const UtlString* oldContact = binding->getContact();
         UtlString newContact(*oldContact);
         newContact.replace('2', '3');
         binding->setContact(newContact);
         regDb->updateBinding(*binding);

         // We should have 2 bindings now
         bindings.destroyAll();
         seqOneUpdates = regDb->getNewUpdatesForRegistrar("seqOne", 2, bindings);
         CPPUNIT_ASSERT_EQUAL(2LL, seqOneUpdates);
      }
예제 #3
0
void R_AddContact(Lumobj &lum)
{
    // BspLeafs with no geometry cannot be contacted (zero world volume).
    if(lum.bspLeafAtOrigin().hasSubspace())
    {
        newContact(&lum, ContactLumobj);
    }
}
예제 #4
0
void R_AddContact(mobj_t &mobj)
{
    // BspLeafs with no geometry cannot be contacted (zero world volume).
    if(Mobj_BspLeafAtOrigin(mobj).hasSubspace())
    {
        newContact(&mobj, ContactMobj);
    }
}
예제 #5
0
void SMSList::addSMS ( SMSMessage message )
{

    m_smslist->append ( message );
    emit newContact ( message.Address,message.Time );
    if ( PhoneNumberUtil::compare(message.Address,m_filter) )
    {
        sortedInsert ( &m_smslist->last() );
    }
}
예제 #6
0
void ContactEditController::handleChangeContactRequest(const std::string& name, const std::set<std::string>& newGroups) {
	std::vector<std::string> oldGroupsVector = currentContact->getGroups();
	std::set<std::string> oldGroups(oldGroupsVector.begin(), oldGroupsVector.end());
	if (oldGroups != newGroups || currentContact->getName() != name) {
		XMPPRosterItem newContact(*currentContact);
		newContact.setName(name);
		newContact.setGroups(std::vector<std::string>(newGroups.begin(), newGroups.end()));
		rosterController->updateItem(newContact);
	}
	contactEditWindow->hide();
}
예제 #7
0
TestPart::TestPart(QObject *parent, const char *name) // ## parentWidget
  : KParts::ReadOnlyPart(parent, name)
{
  setInstance( new KInstance("testpart") ); // ## memleak
  m_edit = new QTextEdit;
  setWidget(m_edit);
  setXMLFile("testpartui.rc");
  new KAction( "new contact (test)", 0, this, SLOT( newContact() ), actionCollection(), "test_deleteevent" );
  m_kab_stub = 0L;

  new KParts::SideBarExtension(new QComboBox(this), this, "sbe");

  kapp->dcopClient()->setNotifications( true );
  connect( kapp->dcopClient(), SIGNAL( applicationRemoved( const QCString&)),
           this, SLOT( unregisteredFromDCOP( const QCString& )) );
}
예제 #8
0
/**
 * nearCallback method that is called for every geom-pair that collides during the current simulation step. Here the collisions are resolved by creating contact joints with appropriate properties are added to the simulation and all contacts are stored to be reported to the CollisionManager.
 * @param data 
 * @param o1 first ode geom that is involved in the contact.
 * @param o2 second ode geom that is involved in the contact.
 */
void ODE_CollisionHandler::collisionCallback(void *data, dGeomID o1, dGeomID o2) {	

	//TODO verify if this is correct (seems to be copied)

	// checks, whether one of the dGeomID-objects is actually a space instead of a geom.
	if(dGeomIsSpace(o1) || dGeomIsSpace(o2)) { 
	 	// colliding a space with something :
  		dSpaceCollide2(o1, o2, data, &ODE_SimulationAlgorithm::nearCallback); 
		// collide all geoms internal to the space(s)
		if(dGeomIsSpace(o1)) {
			dSpaceCollide((dSpaceID) o1, data, &ODE_SimulationAlgorithm::nearCallback);
		}
		if(dGeomIsSpace(o2)) {
			dSpaceCollide((dSpaceID) o2, data, &ODE_SimulationAlgorithm::nearCallback);
		}
 	} 
	else {
		// find the CollisionObjects which belong to the ode-objects.
		CollisionObject *first = mLookUpTable.value(o1);
		CollisionObject *second = mLookUpTable.value(o2);	

		if(first == 0 || second == 0) {
			Core::log("ODE_CollisionHandler: CollisionObject could not be defined.");
			return;
		}

		//check for disabled Pairs
		bool collisionAllowed = false;
		if(first->areCollisionsDisabled() || second->areCollisionsDisabled()) {
			collisionAllowed = true;
		}
// 		else if(mAllowedCollisionPairs.contains(first)) {
// 			QList<CollisionObject*> partners = mAllowedCollisionPairs.value(first);
// 			if(partners.indexOf(second) != -1) {
// 				collisionAllowed = true;
// 			}	
// 		}
// 		if(mAllowedCollisionPairs.contains(second)) {
// 			QList<CollisionObject*> partners = mAllowedCollisionPairs.value(second);
// 			if(partners.indexOf(first) != -1) {
// 				collisionAllowed = true;
// 			}
// 		}
		else {
			QList<CollisionObject*> partners = mAllowedCollisionPairs.value(first);
			if(partners.contains(second)) {
				collisionAllowed = true;
			}
			else {
				QList<CollisionObject*> partners = mAllowedCollisionPairs.value(second);
				if(partners.contains(first)) {
					collisionAllowed = true;
				}
			}	
		}

  		// colliding two non-space geoms, so generate contact
  		// points between o1 and o2
		// there are reported max: mMaxContactPointsValue->get() contact points.
		dContact contact[mMaxContactPoints];
  		int num_contact = dCollide(o1, o2, mMaxContactPoints, 
			&contact[0].geom, sizeof(dContact));

		// TODO: maybe introduce getElasticity, getStaticFriction Methods to SimBody
		double restitution = 0.0;
		double staticFriction = 0.0;
		double dynamicFriction = 0.0;
		int material1 = -1;
		int material2 = -1;
		SimBody *host1 = 0;
		SimBody *host2 = 0;
		ODE_Body *odeHost1 = 0;
		ODE_Body *odeHost2 = 0;

		// determine material properties of the two colliding objects.
		if(first != 0) {
			material1 = first->getMaterialType();
			host1 = first->getHostBody();
			odeHost1 = dynamic_cast<ODE_Body*>(host1);
		}	
		if(second != 0) {
			material2 = second->getMaterialType();
			host2 = second->getHostBody();
			odeHost2 = dynamic_cast<ODE_Body*>(host2);
		}

		//TODO check if parameters should be accessed directly instead of via strings (performance)

		if(material1 < 0 || material2 < 0) {
		// Determine the friction properties of the colliding SimBody objects, 
		// in case one of the bodies has a unknown material property value.
			if(first != 0 && second != 0) {
				restitution = host1->getElasticityValue()->get() 
							+ host2->getElasticityValue()->get();
				staticFriction = host1->getStaticFrictionValue()->get() 
							+ host2->getStaticFrictionValue()->get();
				dynamicFriction = host1->getDynamicFrictionValue()->get()
							+ host2->getDynamicFrictionValue()->get();
// 				DoubleValue *restitutionValueOne = 
// 					dynamic_cast<DoubleValue*>(host1->getParameter("Elasticity"));
// 				DoubleValue *restitutionValueTwo = 
// 					dynamic_cast<DoubleValue*>(host2->getParameter("Elasticity"));
// 				if(restitutionValueOne != 0 && restitutionValueTwo != 0) {
// 					restitution = restitutionValueOne->get() 
// 						* restitutionValueTwo->get();
// 				}
// 				DoubleValue *staticFValueOne = 
// 					dynamic_cast<DoubleValue*>(host1->getParameter("StaticFriction"));
// 				DoubleValue *staticFValueTwo = 			
// 					dynamic_cast<DoubleValue*>(host2->getParameter("StaticFriction"));
// 				if(staticFValueOne != 0 && staticFValueTwo != 0) {
// 					staticFriction = staticFValueOne->get() + staticFValueTwo->get();
// 				}
// 				DoubleValue *dynamicFValueOne = 
// 					dynamic_cast<DoubleValue*>(host1->getParameter("DynamicFriction"));
// 				DoubleValue *dynamicFValueTwo = 
// 					dynamic_cast<DoubleValue*>(host2->getParameter("DynamicFriction"));
// 				if(dynamicFValueOne != 0 && dynamicFValueTwo != 0) {
// 					dynamicFriction = dynamicFValueOne->get() + dynamicFValueTwo->get();
// 				}
			}
		} 
		else {
			//Determine the friction properties in case both SimBody objects have valid material types.
			if(mGlobalMaterialProperties != 0) {
				restitution = mGlobalMaterialProperties->getRestitution(material1, material2);
				dynamicFriction = mGlobalMaterialProperties->getDynamicFriction(material1, material2);
				staticFriction = mGlobalMaterialProperties->getStaticFriction(material1, material2);
			}
		}

		dynamicFriction = dynamicFriction * mFrictionScalingFactor;

		//every notified collision is saved as a contact. Enables the notification of collision rules in every case
		Contact newContact(first, second);
		QList<Vector3D> contactPoints;

		//generate contact joints for all collision points of the two objects which collide.
		for(int i = 0; i < num_contact; i++) {
			// enable required ode-specific contact-definition properties.
    		contact[i].surface.mode = dContactBounce 
										| dContactSoftCFM 
										| dContactSoftERP 
										| dContactSlip1 
										| dContactSlip2 
										| dContactApprox1 
										| dContactMu2;
		
			dContactGeom contactGeom = contact[i].geom;
			// add contact point to list of contact points.
			contactPoints.push_back(Vector3D(contactGeom.pos[0], contactGeom.pos[1], contactGeom.pos[2]));

			// If the two collision objects are allowed to collide, no contact joint is created.
			if(collisionAllowed) {
				break;
			}
			// set the friction coefficient depending on the velocity in the friction directions 
			// (TODO: needs to be confirmed)
			if(Math::compareDoubles(contact[i].surface.motion1, 0.0,  mStaticFrictionAccuracy) == true) {
				contact[i].surface.mu = staticFriction;
			}
			else {
    			contact[i].surface.mu = dynamicFriction;
			}
			if(Math::compareDoubles(contact[i].surface.motion2, 0.0, mStaticFrictionAccuracy) == true) {
				contact[i].surface.mu2 = staticFriction;
			}
			else {
    			contact[i].surface.mu2 = dynamicFriction;
			}
		
			contact[i].surface.bounce = restitution;
			contact[i].surface.slip1 = mContactSlip;
			contact[i].surface.slip2 = mContactSlip;
			contact[i].surface.bounce_vel = mBouncingVelocity;
			contact[i].surface.soft_cfm = mSoftCFM;
			contact[i].surface.soft_erp = mSoftERP;
					
			if(fabs(contact[i].geom.depth) < 0.000001 ) {
				continue; 
			}
			dJointID contactJoint = dJointCreateContact(mAlgorithm->getODEWorldID(), 
				mAlgorithm->getContactJointGroupID(), &contact[i]);
			dJointAttach(contactJoint, dGeomGetBody(contact[i].geom.g1),
				dGeomGetBody(contact[i].geom.g2));

			//add feedback structure if needed.
			dJointFeedback *feedbackStructure = 0;
			if(odeHost1 != 0 && odeHost1->isFeedbackEnabled()) {
				feedbackStructure = new dJointFeedback();
				dJointSetFeedback(contactJoint, feedbackStructure);
				odeHost1->getOwnedJointFeedbackList().append(feedbackStructure);
				odeHost1->getJointFeedbackList().insertMulti(contactGeom.g1, feedbackStructure);
				odeHost1->getJointFeedbackList().insertMulti(contactGeom.g2, feedbackStructure);
			}
			if(odeHost2 != 0 && odeHost2->isFeedbackEnabled()) {
				feedbackStructure = new dJointFeedback();
				dJointSetFeedback(contactJoint, feedbackStructure);
				odeHost2->getOwnedJointFeedbackList().append(feedbackStructure);
				odeHost2->getJointFeedbackList().insertMulti(contactGeom.g1, feedbackStructure);
				odeHost2->getJointFeedbackList().insertMulti(contactGeom.g2, feedbackStructure);
			}
		}
		// add the contact points to the contact and add the contact to the list of occured contacts, 
		// if for both CollisionObjects reporting collisions is enabled (default).
		if(num_contact != 0) {
			if(first->areCollisionsReported() || second->areCollisionsReported()) {
				newContact.setContactPoints(contactPoints);
				mCurrentContacts.push_back(newContact);
			}
		}
 	}
}