all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Michael Albinus <michael.albinus@gmx.de>
To: <christian.lynbech@tieto.com>
Cc: "emacs-devel@gnu.org" <emacs-devel@gnu.org>
Subject: Re: Dbus method argument encoding problem
Date: Sat, 03 Jul 2010 10:52:44 +0200	[thread overview]
Message-ID: <87d3v59cbn.fsf@gmx.de> (raw)
In-Reply-To: <ytqpiq53gwo0.fsf@tieto.com> (christian lynbech's message of "Mon, 28 Jun 2010 14:37:51 +0200")

<christian.lynbech@tieto.com> writes:

> I have been experimenting to the pidgin chat client over dbus and have
> run into a problem with method calls. This is with emacs "23.2.50.1" (as
> taking from bzr a few weeks ago) on Linux.
>
> I want to call the PurpleBuddyGetName() method which takes a number as
> argument.
>
> If I call:
>
>     (dbus-call-method :session 
>                       "im.pidgin.purple.PurpleService"
>                       "/im/pidgin/purple/PurpleObject"
>                       "im.pidgin.purple.PurpleService" 
>                       "PurpleBuddyGetName" 
>                       4671)
>
> I get the following error:
>
>     (dbus-error "Argument 0 is specified to be of type \"int32\", but is actually of type \"uint32\"")
>
> If one looks at the documentation of `dbus-call-method', I see the
> following encoding scheme for method arguments:
>
> ...
>   number    => DBUS_TYPE_UINT32
>   integer   => DBUS_TYPE_INT32
> ...
>
> I am guessing that `4671' matches `number' and thus is encoded as a
> UINT32 but pidgin/libpurple insists on it being an INT32.
>
> One thing is that the documentation should probably say "natural number"
> instead of just "number" (since all integers are conventionally also
> numbers), but how can I force a positive integer to encode as INT32?

"number" refers to the result of `numberp':

    (numberp 4671) => t

Type casting is possible by respective keywords. You shall call

    (dbus-call-method :session 
                      "im.pidgin.purple.PurpleService"
                      "/im/pidgin/purple/PurpleObject"
                      "im.pidgin.purple.PurpleService" 
                      "PurpleBuddyGetName" 
                      :int32 4671)


> ------------------------+-----------------------------------------------------
> Christian Lynbech       | christian #\@ defun #\. dk
> ------------------------+-----------------------------------------------------
> Hit the philistines three times over the head with the Elisp reference manual.
>                                         - petonic@hal.com (Michael A. Petonic)

And continue with the dbus manual :-)

Best regards, Michael.



  reply	other threads:[~2010-07-03  8:52 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-28 12:37 Dbus method argument encoding problem christian.lynbech
2010-07-03  8:52 ` Michael Albinus [this message]
2010-07-04 20:46   ` Christian Lynbech
2010-07-05  3:25     ` Michael Albinus

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87d3v59cbn.fsf@gmx.de \
    --to=michael.albinus@gmx.de \
    --cc=christian.lynbech@tieto.com \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.