Re: RegisterCallback callback problems

"Peter Millard" <me-STcBuFROdrv2eFz/[email protected]> Thu, 16 Dec 2004 08:30:18 -0700
Newsgroups gmane.network.jabber.exodus.devel
Message-ID <002c01c4e384$26116940$e201020a@pmillard2k>
Patrick Fitzgerald wrote:
> in Process() I process the result, for example,
>
>     _exodus.showToast('Call Back Received:'+xml,0,1);
>
> THEN I want the call back to go away until I need the vcard of another user,
> because my plugin has to do other things - it cant wait.
>
>     if (_cb >= 0) then  _exodus.UnRegisterCallback(_cb);
>
> BUT it doesnt. I continue to get callbacks until I terminate the
> application. Am I going about this the wrong way? Or is it a bug?

A quick glance at the code shows the right thing is supposed to be happening.. I
don't have time at this moment to debug/test. I'm also confused by what you said
above: "it can't wait".. Leaving a callback in place doesn't not block operation
of your plugin in any way.

Also, you may consider using a more filtered callback, like:

_cb:=_exodus.RegisterCallback('/packet/iq/vCard[@xmlns="vcard-temp"]', Self);

By using just /packet, you are getting every single packet that flows through
the client, which isn't the most efficient thing. It also means you have to do
more work inside your Process() event to check to see if it's a packet your
interested in.

I'll get a chance this wknd to test unregistering callbacks to make sure it's
working properly.

pgm.