[JDEV] JabberCOM c++ sample

david.belius at chello.se david.belius at chello.se
Thu May 17 06:39:49 CDT 2001


Are there any samples online?
I need info about the eventsink stuff especially.
I read in a post in the archives that you needed to create a COM object 
to catch the events.
I am not using this method, i have class based on IDispatch. I overload 
Invoke() to catch the events.
Then i create a instance of the class with the c++ new operator. I then 
create a connection point and connect my class to IJabberSessionEvents, 
like this:



         MyEventSink *e = new MyEventSink;
	IConnectionPointContainer *conncont;
	IConnectionPoint *conn;
	DWORD cookie=666;
	
	hr = js->QueryInterface( IID_IConnectionPointContainer, (void**)&conncont );
	if( FAILED(hr) )
		printf("Error in query interface\n");
	
	hr = conncont->FindConnectionPoint( DIID_IJabberSessionEvents, &conn );
	if( FAILED(hr) )
		printf("Error in FindConnectionPoint\n");

	conncont->Release();
	conn->Advise( e, &cookie );


This method seems to work because i recieve OnXML() events. On the other 
hand i don't recieve any OnConnect() or OnAuthError() or any other 
events when i should be recieving them.

Can anyone point me to a sample?

/David




More information about the JDev mailing list