[Gajim-devel] Declaring return type of gajim dbus method list_contacts with dbus glib

Yann Leboulanger asterix at lagaule.org
Thu Aug 30 21:10:56 CEST 2007


Øystein Gisnås wrote:
> 2007/8/30, Øystein Gisnås <oystein at gisnas.net>:
>> 2007/8/29, Yann Leboulanger <asterix at lagaule.org>:
>>> Øystein Gisnås wrote:
>>>> 2007/8/26, Yann Leboulanger <asterix at lagaule.org>:
>>>>> Øystein Gisnås wrote:
>>>>>> The signature of list_contacts in remote_control.py has changed return
>>>>>> value from undefined to 'av', via 'a{ss}'. The return array has been
>>>>>> changed from undefined to 'a{sv}', via 's'. See
>>>>>> http://trac.gajim.org/changeset/7877 and
>>>>>> http://trac.gajim.org/changeset/7811
>>>>>>
>>>>>> Nautilus-sendto tries to call the method using glib binding. It worked
>>>>>> with previous gaim versions, but not now. The return type is specified
>>>>>> as
>>>>>> dbus_g_type_get_collection ("GSList", dbus_g_type_get_map
>>>>>> ("GHashTable", G_TYPE_STRING, G_TYPE_VALUE))
>>>>>>
>>>>>> The error message being returned is "Expected D-BUS array, got type code 'v'"
>>>>>>
>>>>>> Is the return type in nautilus-sendto wrong, or doesn't the DBus GLib
>>>>>> binding work like it should here?
>>>>>>
>>>>>> This bug is reported against nautilus-sendto at
>>>>>> http://bugzilla.gnome.org/show_bug.cgi?id=443484 and
>>>>>> https://bugs.launchpad.net/ubuntu/+source/nautilus-sendto/+bug/118475
>>>>>>
>>>>>> Cheers,
>>>>>> Øystein Gisnås
>>>>>> Debian Maintainer
>>>>> indeed there seem to be a pb in dbus signatures. unfortunatly I can't
>>>>> test at home (debian unstable) because of that:
>>>>>
>>>>> $ nautilus-sendto gajim.py
>>>>> Segmentation fault
>>>>>
>>>>> but if you can you can try to change the out_signatures to a{sv} in
>>>>> src/remote_controle.py ?
>>>>>
>>>>> Maybe the bug is in nautilus-sendto code that handles badly what
>>>>> list_contacts returns ...
>>>> Hi, I tried your suggestion of chaning out_signatures to a{sv}. Now I
>>>> get this error message:
>>>> ** (nautilus-sendto:16598): WARNING **: [Gajim] caught remote method
>>>> exception org.freedesktop.DBus.Python.exceptions.TypeError: Traceback
>>>> (most recent call last):
>>>>   File "/var/lib/python-support/python2.4/dbus/service.py", line 730,
>>>> in _message_cb
>>>>     _method_reply_return(connection, message, method_name, signature, *retval)
>>>>   File "/var/lib/python-support/python2.4/dbus/service.py", line 248,
>>>> in _method_reply_return
>>>>     reply.append(signature=signature, *retval)
>>>> TypeError: list indices must be integers
>>>>
>>>> Does this make sense to you?
>>>>
>>>> Cheers,
>>>> Øystein
>>>>
>>> no that doesn't :/
>>> I cc to dbus ML, maybe they could help us ;)
>> I solved it!
>>
>> Change the two output signatures to aa{sv}.. Before:
>> raffen% dbus-send --print-reply --dest='org.gajim.dbus'
>> '/org/gajim/dbus/RemoteObject'
>> 'org.gajim.dbus.RemoteInterface.list_contacts' string:'jabber.org'
>> method return sender=:1.81 -> dest=:1.95 reply_serial=2
>>    array [
>>       variant          array [
>>             dict entry(
>>                string "jid"
>>                variant                   string "test at jabber.org"
>>             )
>>             dict entry(
>>                string "name"
>>                variant                   string "None"
>>             )
>>             dict entry(
>>                string "resources"
>>                variant                   array [
>>                      struct {
>>                         string ""
>>                         int32 0
>>                         string ""
>>                      }
>>                   ]
>>             )
>>             dict entry(
>>                string "show"
>>                variant                   string "offline"
>>             )
>>          ]
>>    ]
>>
>> After:
>> raffen% dbus-send --print-reply --dest='org.gajim.dbus'
>> '/org/gajim/dbus/RemoteObject'
>> 'org.gajim.dbus.RemoteInterface.list_contacts' string:'jabber.org'
>> method return sender=:1.96 -> dest=:1.97 reply_serial=2
>>    array [
>>       array [
>>          dict entry(
>>             string "jid"
>>             variant                string "test at jabber.org"
>>          )
>>          dict entry(
>>             string "name"
>>             variant                string ""
>>          )
>>          dict entry(
>>             string "resources"
>>             variant                array [
>>                   struct {
>>                      string ""
>>                      int32 0
>>                      string ""
>>                   }
>>                ]
>>          )
>>          dict entry(
>>             string "show"
>>             variant                string "offline"
>>          )
>>       ]
>>    ]
>>
>> I've file a ticket with a patch at http://trac.gajim.org/ticket/3408
>> I've tested the patched gajim with nautilus-sendto and gaim-remote.
> 
> Are there any other known users of the DBus method list_contacts?
> 
> Øystein
> 

hehe good catch ! I still don't understand why a{sv} doesn't work though ...

and no, I don't know any other program using list_contacts

thanks for your patch
-- 
Yann


More information about the Gajim-devel mailing list