DBus - problem with dispatch

Krzysztof dibo20 at wp.pl
Fri Jun 17 07:45:49 EDT 2011


Hi,

I have dbus plugin which listening for ReceivedImMsg and SentImMsg signals.
I wrote it in free pascal which doesn't have dbus bindings yet so I can't
use such functions like "setup_with_mainloop". I use low lewel dbus api.
This code connect to pidgin dbus:

  { Initializes the errors }
  dbus_error_init(@FDBErr);

  { Connection }
  FDBConn := dbus_bus_get(DBUS_BUS_SESSION, @FDBErr);

  { Filters }
  dbus_bus_add_match(FDBConn,
'type=''signal'',interface=''im.pidgin.purple.PurpleInterface'',member=''ReceivedImMsg''',
@FDBErr);
  dbus_bus_add_match(FDBConn,
'type=''signal'',interface=''im.pidgin.purple.PurpleInterface'',member=''SentImMsg''',
@FDBErr);
  dbus_connection_add_filter(FDBConn, at MsgHandler,nil,nil);
  dbus_connection_flush(FDBConn);

And I have a timer which every 50 miliseconds call:
  dbus_connection_read_write_dispatch(FDBConn,0);

All messages are handled in dbus filter method:

function MsgHandler(connection: PDBusConnection; message_: PDBusMessage;
  user_data: Pointer): DBusHandlerResult; cdecl;
begin
  Logger.Log('Some message');
  Result := DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
  if (dbus_message_is_signal(message_, 'im.pidgin.purple.PurpleInterface',
'ReceivedImMsg')<>0) then
  begin
    Logger.Log('Received');
    Exit(DBUS_HANDLER_RESULT_HANDLED);
  end;
  if (dbus_message_is_signal(message_, 'im.pidgin.purple.PurpleInterface',
'SentImMsg')<>0) then
  begin
    Logger.Log('Sent');
    Exit(DBUS_HANDLER_RESULT_HANDLED);
  end;
end;

This worked well for some time. But now, I notify that it doesn't "catch"
all signals. I notify that after upgrade pidgin to 2.8.0. Before, even if
timer had 500 miliseconds interval, it catch all signals. Any idea?

Regards.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://pidgin.im/pipermail/support/attachments/20110617/1bba8b54/attachment-0002.html>


More information about the Support mailing list